Completed
Push — master ( a7cd2a...eabd6c )
by Stephen
38:42
created
src/wp-includes/customize/class-wp-customize-selective-refresh.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 * @since 4.5.0
79 79
 	 * @access public
80 80
 	 *
81
-	 * @return array Partials.
81
+	 * @return WP_Customize_Partial[] Partials.
82 82
 	 */
83 83
 	public function partials() {
84 84
 		return $this->partials;
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 	 * @param string $errstr  Error string.
284 284
 	 * @param string $errfile Error file.
285 285
 	 * @param string $errline Error line.
286
-	 * @return true Always true.
286
+	 * @return boolean Always true.
287 287
 	 */
288 288
 	public function handle_error( $errno, $errstr, $errfile = null, $errline = null ) {
289 289
 		$this->triggered_errors[] = array(
Please login to merge, or discard this patch.
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Customize API: WP_Customize_Selective_Refresh class
4
- *
5
- * @package WordPress
6
- * @subpackage Customize
7
- * @since 4.5.0
8
- */
3
+	 * Customize API: WP_Customize_Selective_Refresh class
4
+	 *
5
+	 * @package WordPress
6
+	 * @subpackage Customize
7
+	 * @since 4.5.0
8
+	 */
9 9
 
10 10
 /**
11 11
  * Core Customizer class for implementing selective refresh.
Please login to merge, or discard this patch.
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -65,11 +65,11 @@  discard block
 block discarded – undo
65 65
 	 *
66 66
 	 * @param WP_Customize_Manager $manager Manager instance.
67 67
 	 */
68
-	public function __construct( WP_Customize_Manager $manager ) {
68
+	public function __construct(WP_Customize_Manager $manager) {
69 69
 		$this->manager = $manager;
70
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-partial.php' );
70
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-partial.php');
71 71
 
72
-		add_action( 'customize_preview_init', array( $this, 'init_preview' ) );
72
+		add_action('customize_preview_init', array($this, 'init_preview'));
73 73
 	}
74 74
 
75 75
 	/**
@@ -94,22 +94,22 @@  discard block
 block discarded – undo
94 94
 	 * @param array                       $args Optional. Partial arguments. Default empty array.
95 95
 	 * @return WP_Customize_Partial             The instance of the panel that was added.
96 96
 	 */
97
-	public function add_partial( $id, $args = array() ) {
98
-		if ( $id instanceof WP_Customize_Partial ) {
97
+	public function add_partial($id, $args = array()) {
98
+		if ($id instanceof WP_Customize_Partial) {
99 99
 			$partial = $id;
100 100
 		} else {
101 101
 			$class = 'WP_Customize_Partial';
102 102
 
103 103
 			/** This filter (will be) documented in wp-includes/class-wp-customize-manager.php */
104
-			$args = apply_filters( 'customize_dynamic_partial_args', $args, $id );
104
+			$args = apply_filters('customize_dynamic_partial_args', $args, $id);
105 105
 
106 106
 			/** This filter (will be) documented in wp-includes/class-wp-customize-manager.php */
107
-			$class = apply_filters( 'customize_dynamic_partial_class', $class, $id, $args );
107
+			$class = apply_filters('customize_dynamic_partial_class', $class, $id, $args);
108 108
 
109
-			$partial = new $class( $this, $id, $args );
109
+			$partial = new $class($this, $id, $args);
110 110
 		}
111 111
 
112
-		$this->partials[ $partial->id ] = $partial;
112
+		$this->partials[$partial->id] = $partial;
113 113
 		return $partial;
114 114
 	}
115 115
 
@@ -122,9 +122,9 @@  discard block
 block discarded – undo
122 122
 	 * @param string $id Customize Partial ID.
123 123
 	 * @return WP_Customize_Partial|null The partial, if set. Otherwise null.
124 124
 	 */
125
-	public function get_partial( $id ) {
126
-		if ( isset( $this->partials[ $id ] ) ) {
127
-			return $this->partials[ $id ];
125
+	public function get_partial($id) {
126
+		if (isset($this->partials[$id])) {
127
+			return $this->partials[$id];
128 128
 		} else {
129 129
 			return null;
130 130
 		}
@@ -138,8 +138,8 @@  discard block
 block discarded – undo
138 138
 	 *
139 139
 	 * @param string $id Customize Partial ID.
140 140
 	 */
141
-	public function remove_partial( $id ) {
142
-		unset( $this->partials[ $id ] );
141
+	public function remove_partial($id) {
142
+		unset($this->partials[$id]);
143 143
 	}
144 144
 
145 145
 	/**
@@ -149,8 +149,8 @@  discard block
 block discarded – undo
149 149
 	 * @access public
150 150
 	 */
151 151
 	public function init_preview() {
152
-		add_action( 'template_redirect', array( $this, 'handle_render_partials_request' ) );
153
-		add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_preview_scripts' ) );
152
+		add_action('template_redirect', array($this, 'handle_render_partials_request'));
153
+		add_action('wp_enqueue_scripts', array($this, 'enqueue_preview_scripts'));
154 154
 	}
155 155
 
156 156
 	/**
@@ -160,8 +160,8 @@  discard block
 block discarded – undo
160 160
 	 * @access public
161 161
 	 */
162 162
 	public function enqueue_preview_scripts() {
163
-		wp_enqueue_script( 'customize-selective-refresh' );
164
-		add_action( 'wp_footer', array( $this, 'export_preview_data' ), 1000 );
163
+		wp_enqueue_script('customize-selective-refresh');
164
+		add_action('wp_footer', array($this, 'export_preview_data'), 1000);
165 165
 	}
166 166
 
167 167
 	/**
@@ -173,9 +173,9 @@  discard block
 block discarded – undo
173 173
 	public function export_preview_data() {
174 174
 		$partials = array();
175 175
 
176
-		foreach ( $this->partials() as $partial ) {
177
-			if ( $partial->check_capabilities() ) {
178
-				$partials[ $partial->id ] = $partial->json();
176
+		foreach ($this->partials() as $partial) {
177
+			if ($partial->check_capabilities()) {
178
+				$partials[$partial->id] = $partial->json();
179 179
 			}
180 180
 		}
181 181
 
@@ -183,14 +183,14 @@  discard block
 block discarded – undo
183 183
 			'partials'       => $partials,
184 184
 			'renderQueryVar' => self::RENDER_QUERY_VAR,
185 185
 			'l10n'           => array(
186
-				'shiftClickToEdit' => __( 'Shift-click to edit this element.' ),
186
+				'shiftClickToEdit' => __('Shift-click to edit this element.'),
187 187
 				/* translators: %s: document.write() */
188
-				'badDocumentWrite' => sprintf( __( '%s is forbidden' ), 'document.write()' ),
188
+				'badDocumentWrite' => sprintf(__('%s is forbidden'), 'document.write()'),
189 189
 			),
190 190
 		);
191 191
 
192 192
 		// Export data to JS.
193
-		echo sprintf( '<script>var _customizePartialRefreshExports = %s;</script>', wp_json_encode( $exports ) );
193
+		echo sprintf('<script>var _customizePartialRefreshExports = %s;</script>', wp_json_encode($exports));
194 194
 	}
195 195
 
196 196
 	/**
@@ -204,14 +204,14 @@  discard block
 block discarded – undo
204 204
 	 * @param array $partial_ids The partial ID to add.
205 205
 	 * @return array Added WP_Customize_Partial instances.
206 206
 	 */
207
-	public function add_dynamic_partials( $partial_ids ) {
207
+	public function add_dynamic_partials($partial_ids) {
208 208
 		$new_partials = array();
209 209
 
210
-		foreach ( $partial_ids as $partial_id ) {
210
+		foreach ($partial_ids as $partial_id) {
211 211
 
212 212
 			// Skip partials already created.
213
-			$partial = $this->get_partial( $partial_id );
214
-			if ( $partial ) {
213
+			$partial = $this->get_partial($partial_id);
214
+			if ($partial) {
215 215
 				continue;
216 216
 			}
217 217
 
@@ -230,8 +230,8 @@  discard block
 block discarded – undo
230 230
 			 * @param false|array $partial_args The arguments to the WP_Customize_Partial constructor.
231 231
 			 * @param string      $partial_id   ID for dynamic partial.
232 232
 			 */
233
-			$partial_args = apply_filters( 'customize_dynamic_partial_args', $partial_args, $partial_id );
234
-			if ( false === $partial_args ) {
233
+			$partial_args = apply_filters('customize_dynamic_partial_args', $partial_args, $partial_id);
234
+			if (false === $partial_args) {
235 235
 				continue;
236 236
 			}
237 237
 
@@ -246,11 +246,11 @@  discard block
 block discarded – undo
246 246
 			 * @param string $partial_id    ID for dynamic partial.
247 247
 			 * @param array  $partial_args  The arguments to the WP_Customize_Partial constructor.
248 248
 			 */
249
-			$partial_class = apply_filters( 'customize_dynamic_partial_class', $partial_class, $partial_id, $partial_args );
249
+			$partial_class = apply_filters('customize_dynamic_partial_class', $partial_class, $partial_id, $partial_args);
250 250
 
251
-			$partial = new $partial_class( $this, $partial_id, $partial_args );
251
+			$partial = new $partial_class($this, $partial_id, $partial_args);
252 252
 
253
-			$this->add_partial( $partial );
253
+			$this->add_partial($partial);
254 254
 			$new_partials[] = $partial;
255 255
 		}
256 256
 		return $new_partials;
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 	 * @return bool Whether the request is for rendering partials.
269 269
 	 */
270 270
 	public function is_render_partials_request() {
271
-		return ! empty( $_POST[ self::RENDER_QUERY_VAR ] );
271
+		return ! empty($_POST[self::RENDER_QUERY_VAR]);
272 272
 	}
273 273
 
274 274
 	/**
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 	 * @param string $errline Error line.
286 286
 	 * @return true Always true.
287 287
 	 */
288
-	public function handle_error( $errno, $errstr, $errfile = null, $errline = null ) {
288
+	public function handle_error($errno, $errstr, $errfile = null, $errline = null) {
289 289
 		$this->triggered_errors[] = array(
290 290
 			'partial'      => $this->current_partial_id,
291 291
 			'error_number' => $errno,
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 	 * @access public
304 304
 	 */
305 305
 	public function handle_render_partials_request() {
306
-		if ( ! $this->is_render_partials_request() ) {
306
+		if ( ! $this->is_render_partials_request()) {
307 307
 			return;
308 308
 		}
309 309
 
@@ -314,21 +314,21 @@  discard block
 block discarded – undo
314 314
 		 * user passed the 'customize' capability check and the nonce check, since
315 315
 		 * WP_Customize_Manager::setup_theme() is where the previewing flag is set.
316 316
 		 */
317
-		if ( ! is_customize_preview() ) {
318
-			status_header( 403 );
319
-			wp_send_json_error( 'expected_customize_preview' );
320
-		} else if ( ! isset( $_POST['partials'] ) ) {
321
-			status_header( 400 );
322
-			wp_send_json_error( 'missing_partials' );
317
+		if ( ! is_customize_preview()) {
318
+			status_header(403);
319
+			wp_send_json_error('expected_customize_preview');
320
+		} else if ( ! isset($_POST['partials'])) {
321
+			status_header(400);
322
+			wp_send_json_error('missing_partials');
323 323
 		}
324 324
 
325
-		$partials = json_decode( wp_unslash( $_POST['partials'] ), true );
325
+		$partials = json_decode(wp_unslash($_POST['partials']), true);
326 326
 
327
-		if ( ! is_array( $partials ) ) {
328
-			wp_send_json_error( 'malformed_partials' );
327
+		if ( ! is_array($partials)) {
328
+			wp_send_json_error('malformed_partials');
329 329
 		}
330 330
 
331
-		$this->add_dynamic_partials( array_keys( $partials ) );
331
+		$this->add_dynamic_partials(array_keys($partials));
332 332
 
333 333
 		/**
334 334
 		 * Fires immediately before partials are rendered.
@@ -343,35 +343,35 @@  discard block
 block discarded – undo
343 343
 		 *                                                 The array is keyed by partial ID, with each item being an array of
344 344
 		 *                                                 the placements' context data.
345 345
 		 */
346
-		do_action( 'customize_render_partials_before', $this, $partials );
346
+		do_action('customize_render_partials_before', $this, $partials);
347 347
 
348
-		set_error_handler( array( $this, 'handle_error' ), error_reporting() );
348
+		set_error_handler(array($this, 'handle_error'), error_reporting());
349 349
 
350 350
 		$contents = array();
351 351
 
352
-		foreach ( $partials as $partial_id => $container_contexts ) {
352
+		foreach ($partials as $partial_id => $container_contexts) {
353 353
 			$this->current_partial_id = $partial_id;
354 354
 
355
-			if ( ! is_array( $container_contexts ) ) {
356
-				wp_send_json_error( 'malformed_container_contexts' );
355
+			if ( ! is_array($container_contexts)) {
356
+				wp_send_json_error('malformed_container_contexts');
357 357
 			}
358 358
 
359
-			$partial = $this->get_partial( $partial_id );
359
+			$partial = $this->get_partial($partial_id);
360 360
 
361
-			if ( ! $partial || ! $partial->check_capabilities() ) {
362
-				$contents[ $partial_id ] = null;
361
+			if ( ! $partial || ! $partial->check_capabilities()) {
362
+				$contents[$partial_id] = null;
363 363
 				continue;
364 364
 			}
365 365
 
366
-			$contents[ $partial_id ] = array();
366
+			$contents[$partial_id] = array();
367 367
 
368 368
 			// @todo The array should include not only the contents, but also whether the container is included?
369
-			if ( empty( $container_contexts ) ) {
369
+			if (empty($container_contexts)) {
370 370
 				// Since there are no container contexts, render just once.
371
-				$contents[ $partial_id ][] = $partial->render( null );
371
+				$contents[$partial_id][] = $partial->render(null);
372 372
 			} else {
373
-				foreach ( $container_contexts as $container_context ) {
374
-					$contents[ $partial_id ][] = $partial->render( $container_context );
373
+				foreach ($container_contexts as $container_context) {
374
+					$contents[$partial_id][] = $partial->render($container_context);
375 375
 				}
376 376
 			}
377 377
 		}
@@ -392,13 +392,13 @@  discard block
 block discarded – undo
392 392
 		 *                                                 The array is keyed by partial ID, with each item being an array of
393 393
 		 *                                                 the placements' context data.
394 394
 		 */
395
-		do_action( 'customize_render_partials_after', $this, $partials );
395
+		do_action('customize_render_partials_after', $this, $partials);
396 396
 
397 397
 		$response = array(
398 398
 			'contents' => $contents,
399 399
 		);
400 400
 
401
-		if ( defined( 'WP_DEBUG_DISPLAY' ) && WP_DEBUG_DISPLAY ) {
401
+		if (defined('WP_DEBUG_DISPLAY') && WP_DEBUG_DISPLAY) {
402 402
 			$response['errors'] = $this->triggered_errors;
403 403
 		}
404 404
 
@@ -432,8 +432,8 @@  discard block
 block discarded – undo
432 432
 		 *                                                 The array is keyed by partial ID, with each item being an array of
433 433
 		 *                                                 the placements' context data.
434 434
 		 */
435
-		$response = apply_filters( 'customize_render_partials_response', $response, $this, $partials );
435
+		$response = apply_filters('customize_render_partials_response', $response, $this, $partials);
436 436
 
437
-		wp_send_json_success( $response );
437
+		wp_send_json_success($response);
438 438
 	}
439 439
 }
Please login to merge, or discard this patch.
src/wp-includes/formatting.php 4 patches
Doc Comments   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -879,7 +879,7 @@  discard block
 block discarded – undo
879 879
  * @staticvar string $_charset
880 880
  *
881 881
  * @param string     $string         The text which is to be encoded.
882
- * @param int|string $quote_style    Optional. Converts double quotes if set to ENT_COMPAT,
882
+ * @param integer $quote_style    Optional. Converts double quotes if set to ENT_COMPAT,
883 883
  *                                   both single and double if set to ENT_QUOTES or none if set to ENT_NOQUOTES.
884 884
  *                                   Also compatible with old values; converting single quotes if set to 'single',
885 885
  *                                   double if set to 'double' or both if otherwise set.
@@ -952,7 +952,7 @@  discard block
 block discarded – undo
952 952
  * @since 2.8.0
953 953
  *
954 954
  * @param string     $string The text which is to be decoded.
955
- * @param string|int $quote_style Optional. Converts double quotes if set to ENT_COMPAT,
955
+ * @param integer $quote_style Optional. Converts double quotes if set to ENT_COMPAT,
956 956
  *                                both single and double if set to ENT_QUOTES or
957 957
  *                                none if set to ENT_NOQUOTES.
958 958
  *                                Also compatible with old _wp_specialchars() values;
@@ -2658,7 +2658,7 @@  discard block
 block discarded – undo
2658 2658
  * @since 1.5.0
2659 2659
  *
2660 2660
  * @param string $timezone Either 'Z' for 0 offset or '±hhmm'.
2661
- * @return int|float The offset in seconds.
2661
+ * @return integer The offset in seconds.
2662 2662
  */
2663 2663
 function iso8601_timezone_to_offset( $timezone ) {
2664 2664
 	// $timezone is either 'Z' or '[+|-]hhmm'
@@ -3316,7 +3316,7 @@  discard block
 block discarded – undo
3316 3316
  * @since 2.8.1
3317 3317
  * @access private
3318 3318
  *
3319
- * @param string|array $search  The value being searched for, otherwise known as the needle.
3319
+ * @param string[] $search  The value being searched for, otherwise known as the needle.
3320 3320
  *                              An array may be used to designate multiple needles.
3321 3321
  * @param string       $subject The string being searched and replaced on, otherwise known as the haystack.
3322 3322
  * @return string The string with the replaced svalues.
@@ -3970,7 +3970,6 @@  discard block
 block discarded – undo
3970 3970
  * @link http://www.php.net/sprintf
3971 3971
  *
3972 3972
  * @param string $pattern   The string which formatted args are inserted.
3973
- * @param mixed  $args ,... Arguments to be formatted into the $pattern string.
3974 3973
  * @return string The formatted string.
3975 3974
  */
3976 3975
 function wp_sprintf( $pattern ) {
Please login to merge, or discard this patch.
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Main WordPress Formatting API.
4
- *
5
- * Handles many functions for formatting output.
6
- *
7
- * @package WordPress
8
- */
3
+	 * Main WordPress Formatting API.
4
+	 *
5
+	 * Handles many functions for formatting output.
6
+	 *
7
+	 * @package WordPress
8
+	 */
9 9
 
10 10
 /**
11 11
  * Replaces common plain text characters into formatted entities
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
 		.     '\\['                          // Opening bracket
806 806
 		.     "($tagregexp)"                 // 2: Shortcode name
807 807
 		.     '(?![\\w-])'                   // Not followed by word character or hyphen
808
-		                                     // Unroll the loop: Inside the opening shortcode tag
808
+											 // Unroll the loop: Inside the opening shortcode tag
809 809
 		.     '[^\\]\\/]*'                   // Not a closing bracket or forward slash
810 810
 		.     '(?:'
811 811
 		.         '\\/(?!\\])'               // A forward slash not followed by a closing bracket
@@ -2238,7 +2238,7 @@  discard block
 block discarded – undo
2238 2238
 				)
2239 2239
 				(\)?)                                                  # 3: Trailing closing parenthesis (for parethesis balancing post processing)
2240 2240
 			~xS'; // The regex is a non-anchored pattern and does not have a single fixed starting character.
2241
-			      // Tell PCRE to spend more time optimizing since, when used on a page load, it will probably be used several times.
2241
+				  // Tell PCRE to spend more time optimizing since, when used on a page load, it will probably be used several times.
2242 2242
 
2243 2243
 			$ret = preg_replace_callback( $url_clickable, '_make_url_clickable_cb', $ret );
2244 2244
 
@@ -2342,7 +2342,7 @@  discard block
 block discarded – undo
2342 2342
 	$rel  = 'nofollow';
2343 2343
 
2344 2344
 	if ( preg_match( '%href=["\'](' . preg_quote( set_url_scheme( home_url(), 'http' ) ) . ')%i', $text ) ||
2345
-	     preg_match( '%href=["\'](' . preg_quote( set_url_scheme( home_url(), 'https' ) ) . ')%i', $text )
2345
+		 preg_match( '%href=["\'](' . preg_quote( set_url_scheme( home_url(), 'https' ) ) . ')%i', $text )
2346 2346
 	) {
2347 2347
 		return "<a $text>";
2348 2348
 	}
@@ -3515,7 +3515,7 @@  discard block
 block discarded – undo
3515 3515
 	 * @since 2.0.6
3516 3516
 	 *
3517 3517
 	 * @param string $safe_text The text after it has been escaped.
3518
- 	 * @param string $text      The text prior to being escaped.
3518
+	 * @param string $text      The text prior to being escaped.
3519 3519
 	 */
3520 3520
 	return apply_filters( 'js_escape', $safe_text, $text );
3521 3521
 }
@@ -3540,7 +3540,7 @@  discard block
 block discarded – undo
3540 3540
 	 * @since 2.8.0
3541 3541
 	 *
3542 3542
 	 * @param string $safe_text The text after it has been escaped.
3543
- 	 * @param string $text      The text prior to being escaped.
3543
+	 * @param string $text      The text prior to being escaped.
3544 3544
 	 */
3545 3545
 	return apply_filters( 'esc_html', $safe_text, $text );
3546 3546
 }
@@ -3565,7 +3565,7 @@  discard block
 block discarded – undo
3565 3565
 	 * @since 2.0.6
3566 3566
 	 *
3567 3567
 	 * @param string $safe_text The text after it has been escaped.
3568
- 	 * @param string $text      The text prior to being escaped.
3568
+	 * @param string $text      The text prior to being escaped.
3569 3569
 	 */
3570 3570
 	return apply_filters( 'attribute_escape', $safe_text, $text );
3571 3571
 }
@@ -3586,7 +3586,7 @@  discard block
 block discarded – undo
3586 3586
 	 * @since 3.1.0
3587 3587
 	 *
3588 3588
 	 * @param string $safe_text The text after it has been escaped.
3589
- 	 * @param string $text      The text prior to being escaped.
3589
+	 * @param string $text      The text prior to being escaped.
3590 3590
 	 */
3591 3591
 	return apply_filters( 'esc_textarea', $safe_text, $text );
3592 3592
 }
@@ -3607,7 +3607,7 @@  discard block
 block discarded – undo
3607 3607
 	 * @since 2.8.0
3608 3608
 	 *
3609 3609
 	 * @param string $safe_tag The tag name after it has been escaped.
3610
- 	 * @param string $tag_name The text before it was escaped.
3610
+	 * @param string $tag_name The text before it was escaped.
3611 3611
 	 */
3612 3612
 	return apply_filters( 'tag_escape', $safe_tag, $tag_name );
3613 3613
 }
Please login to merge, or discard this patch.
Spacing   +956 added lines, -957 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
  * @param bool   $reset Set to true for unit testing. Translated patterns will reset.
39 39
  * @return string The string replaced with html entities
40 40
  */
41
-function wptexturize( $text, $reset = false ) {
41
+function wptexturize($text, $reset = false) {
42 42
 	global $wp_cockneyreplace, $shortcode_tags;
43 43
 	static $static_characters = null,
44 44
 		$static_replacements = null,
@@ -59,12 +59,12 @@  discard block
 block discarded – undo
59 59
 		$apos_flag = '<!--apos-->';
60 60
 
61 61
 	// If there's nothing to do, just stop.
62
-	if ( empty( $text ) || false === $run_texturize ) {
62
+	if (empty($text) || false === $run_texturize) {
63 63
 		return $text;
64 64
 	}
65 65
 
66 66
 	// Set up static variables. Run once only.
67
-	if ( $reset || ! isset( $static_characters ) ) {
67
+	if ($reset || ! isset($static_characters)) {
68 68
 		/**
69 69
 		 * Filter whether to skip running wptexturize().
70 70
 		 *
@@ -79,118 +79,118 @@  discard block
 block discarded – undo
79 79
 		 *
80 80
 		 * @param bool $run_texturize Whether to short-circuit wptexturize().
81 81
 		 */
82
-		$run_texturize = apply_filters( 'run_wptexturize', $run_texturize );
83
-		if ( false === $run_texturize ) {
82
+		$run_texturize = apply_filters('run_wptexturize', $run_texturize);
83
+		if (false === $run_texturize) {
84 84
 			return $text;
85 85
 		}
86 86
 
87 87
 		/* translators: opening curly double quote */
88
-		$opening_quote = _x( '&#8220;', 'opening curly double quote' );
88
+		$opening_quote = _x('&#8220;', 'opening curly double quote');
89 89
 		/* translators: closing curly double quote */
90
-		$closing_quote = _x( '&#8221;', 'closing curly double quote' );
90
+		$closing_quote = _x('&#8221;', 'closing curly double quote');
91 91
 
92 92
 		/* translators: apostrophe, for example in 'cause or can't */
93
-		$apos = _x( '&#8217;', 'apostrophe' );
93
+		$apos = _x('&#8217;', 'apostrophe');
94 94
 
95 95
 		/* translators: prime, for example in 9' (nine feet) */
96
-		$prime = _x( '&#8242;', 'prime' );
96
+		$prime = _x('&#8242;', 'prime');
97 97
 		/* translators: double prime, for example in 9" (nine inches) */
98
-		$double_prime = _x( '&#8243;', 'double prime' );
98
+		$double_prime = _x('&#8243;', 'double prime');
99 99
 
100 100
 		/* translators: opening curly single quote */
101
-		$opening_single_quote = _x( '&#8216;', 'opening curly single quote' );
101
+		$opening_single_quote = _x('&#8216;', 'opening curly single quote');
102 102
 		/* translators: closing curly single quote */
103
-		$closing_single_quote = _x( '&#8217;', 'closing curly single quote' );
103
+		$closing_single_quote = _x('&#8217;', 'closing curly single quote');
104 104
 
105 105
 		/* translators: en dash */
106
-		$en_dash = _x( '&#8211;', 'en dash' );
106
+		$en_dash = _x('&#8211;', 'en dash');
107 107
 		/* translators: em dash */
108
-		$em_dash = _x( '&#8212;', 'em dash' );
108
+		$em_dash = _x('&#8212;', 'em dash');
109 109
 
110 110
 		$default_no_texturize_tags = array('pre', 'code', 'kbd', 'style', 'script', 'tt');
111 111
 		$default_no_texturize_shortcodes = array('code');
112 112
 
113 113
 		// if a plugin has provided an autocorrect array, use it
114
-		if ( isset($wp_cockneyreplace) ) {
115
-			$cockney = array_keys( $wp_cockneyreplace );
116
-			$cockneyreplace = array_values( $wp_cockneyreplace );
114
+		if (isset($wp_cockneyreplace)) {
115
+			$cockney = array_keys($wp_cockneyreplace);
116
+			$cockneyreplace = array_values($wp_cockneyreplace);
117 117
 		} else {
118 118
 			/* translators: This is a comma-separated list of words that defy the syntax of quotations in normal use,
119 119
 			 * for example...  'We do not have enough words yet' ... is a typical quoted phrase.  But when we write
120 120
 			 * lines of code 'til we have enough of 'em, then we need to insert apostrophes instead of quotes.
121 121
 			 */
122
-			$cockney = explode( ',', _x( "'tain't,'twere,'twas,'tis,'twill,'til,'bout,'nuff,'round,'cause,'em",
123
-				'Comma-separated list of words to texturize in your language' ) );
122
+			$cockney = explode(',', _x("'tain't,'twere,'twas,'tis,'twill,'til,'bout,'nuff,'round,'cause,'em",
123
+				'Comma-separated list of words to texturize in your language'));
124 124
 
125
-			$cockneyreplace = explode( ',', _x( '&#8217;tain&#8217;t,&#8217;twere,&#8217;twas,&#8217;tis,&#8217;twill,&#8217;til,&#8217;bout,&#8217;nuff,&#8217;round,&#8217;cause,&#8217;em',
126
-				'Comma-separated list of replacement words in your language' ) );
125
+			$cockneyreplace = explode(',', _x('&#8217;tain&#8217;t,&#8217;twere,&#8217;twas,&#8217;tis,&#8217;twill,&#8217;til,&#8217;bout,&#8217;nuff,&#8217;round,&#8217;cause,&#8217;em',
126
+				'Comma-separated list of replacement words in your language'));
127 127
 		}
128 128
 
129
-		$static_characters = array_merge( array( '...', '``', '\'\'', ' (tm)' ), $cockney );
130
-		$static_replacements = array_merge( array( '&#8230;', $opening_quote, $closing_quote, ' &#8482;' ), $cockneyreplace );
129
+		$static_characters = array_merge(array('...', '``', '\'\'', ' (tm)'), $cockney);
130
+		$static_replacements = array_merge(array('&#8230;', $opening_quote, $closing_quote, ' &#8482;'), $cockneyreplace);
131 131
 
132 132
 
133 133
 		// Pattern-based replacements of characters.
134 134
 		// Sort the remaining patterns into several arrays for performance tuning.
135
-		$dynamic_characters = array( 'apos' => array(), 'quote' => array(), 'dash' => array() );
136
-		$dynamic_replacements = array( 'apos' => array(), 'quote' => array(), 'dash' => array() );
135
+		$dynamic_characters = array('apos' => array(), 'quote' => array(), 'dash' => array());
136
+		$dynamic_replacements = array('apos' => array(), 'quote' => array(), 'dash' => array());
137 137
 		$dynamic = array();
138 138
 		$spaces = wp_spaces_regexp();
139 139
 
140 140
 		// '99' and '99" are ambiguous among other patterns; assume it's an abbreviated year at the end of a quotation.
141
-		if ( "'" !== $apos || "'" !== $closing_single_quote ) {
142
-			$dynamic[ '/\'(\d\d)\'(?=\Z|[.,:;!?)}\-\]]|&gt;|' . $spaces . ')/' ] = $apos_flag . '$1' . $closing_single_quote;
141
+		if ("'" !== $apos || "'" !== $closing_single_quote) {
142
+			$dynamic['/\'(\d\d)\'(?=\Z|[.,:;!?)}\-\]]|&gt;|'.$spaces.')/'] = $apos_flag.'$1'.$closing_single_quote;
143 143
 		}
144
-		if ( "'" !== $apos || '"' !== $closing_quote ) {
145
-			$dynamic[ '/\'(\d\d)"(?=\Z|[.,:;!?)}\-\]]|&gt;|' . $spaces . ')/' ] = $apos_flag . '$1' . $closing_quote;
144
+		if ("'" !== $apos || '"' !== $closing_quote) {
145
+			$dynamic['/\'(\d\d)"(?=\Z|[.,:;!?)}\-\]]|&gt;|'.$spaces.')/'] = $apos_flag.'$1'.$closing_quote;
146 146
 		}
147 147
 
148 148
 		// '99 '99s '99's (apostrophe)  But never '9 or '99% or '999 or '99.0.
149
-		if ( "'" !== $apos ) {
150
-			$dynamic[ '/\'(?=\d\d(?:\Z|(?![%\d]|[.,]\d)))/' ] = $apos_flag;
149
+		if ("'" !== $apos) {
150
+			$dynamic['/\'(?=\d\d(?:\Z|(?![%\d]|[.,]\d)))/'] = $apos_flag;
151 151
 		}
152 152
 
153 153
 		// Quoted Numbers like '0.42'
154
-		if ( "'" !== $opening_single_quote && "'" !== $closing_single_quote ) {
155
-			$dynamic[ '/(?<=\A|' . $spaces . ')\'(\d[.,\d]*)\'/' ] = $open_sq_flag . '$1' . $closing_single_quote;
154
+		if ("'" !== $opening_single_quote && "'" !== $closing_single_quote) {
155
+			$dynamic['/(?<=\A|'.$spaces.')\'(\d[.,\d]*)\'/'] = $open_sq_flag.'$1'.$closing_single_quote;
156 156
 		}
157 157
 
158 158
 		// Single quote at start, or preceded by (, {, <, [, ", -, or spaces.
159
-		if ( "'" !== $opening_single_quote ) {
160
-			$dynamic[ '/(?<=\A|[([{"\-]|&lt;|' . $spaces . ')\'/' ] = $open_sq_flag;
159
+		if ("'" !== $opening_single_quote) {
160
+			$dynamic['/(?<=\A|[([{"\-]|&lt;|'.$spaces.')\'/'] = $open_sq_flag;
161 161
 		}
162 162
 
163 163
 		// Apostrophe in a word.  No spaces, double apostrophes, or other punctuation.
164
-		if ( "'" !== $apos ) {
165
-			$dynamic[ '/(?<!' . $spaces . ')\'(?!\Z|[.,:;!?"\'(){}[\]\-]|&[lg]t;|' . $spaces . ')/' ] = $apos_flag;
164
+		if ("'" !== $apos) {
165
+			$dynamic['/(?<!'.$spaces.')\'(?!\Z|[.,:;!?"\'(){}[\]\-]|&[lg]t;|'.$spaces.')/'] = $apos_flag;
166 166
 		}
167 167
 
168
-		$dynamic_characters['apos'] = array_keys( $dynamic );
169
-		$dynamic_replacements['apos'] = array_values( $dynamic );
168
+		$dynamic_characters['apos'] = array_keys($dynamic);
169
+		$dynamic_replacements['apos'] = array_values($dynamic);
170 170
 		$dynamic = array();
171 171
 
172 172
 		// Quoted Numbers like "42"
173
-		if ( '"' !== $opening_quote && '"' !== $closing_quote ) {
174
-			$dynamic[ '/(?<=\A|' . $spaces . ')"(\d[.,\d]*)"/' ] = $open_q_flag . '$1' . $closing_quote;
173
+		if ('"' !== $opening_quote && '"' !== $closing_quote) {
174
+			$dynamic['/(?<=\A|'.$spaces.')"(\d[.,\d]*)"/'] = $open_q_flag.'$1'.$closing_quote;
175 175
 		}
176 176
 
177 177
 		// Double quote at start, or preceded by (, {, <, [, -, or spaces, and not followed by spaces.
178
-		if ( '"' !== $opening_quote ) {
179
-			$dynamic[ '/(?<=\A|[([{\-]|&lt;|' . $spaces . ')"(?!' . $spaces . ')/' ] = $open_q_flag;
178
+		if ('"' !== $opening_quote) {
179
+			$dynamic['/(?<=\A|[([{\-]|&lt;|'.$spaces.')"(?!'.$spaces.')/'] = $open_q_flag;
180 180
 		}
181 181
 
182
-		$dynamic_characters['quote'] = array_keys( $dynamic );
183
-		$dynamic_replacements['quote'] = array_values( $dynamic );
182
+		$dynamic_characters['quote'] = array_keys($dynamic);
183
+		$dynamic_replacements['quote'] = array_values($dynamic);
184 184
 		$dynamic = array();
185 185
 
186 186
 		// Dashes and spaces
187
-		$dynamic[ '/---/' ] = $em_dash;
188
-		$dynamic[ '/(?<=^|' . $spaces . ')--(?=$|' . $spaces . ')/' ] = $em_dash;
189
-		$dynamic[ '/(?<!xn)--/' ] = $en_dash;
190
-		$dynamic[ '/(?<=^|' . $spaces . ')-(?=$|' . $spaces . ')/' ] = $en_dash;
187
+		$dynamic['/---/'] = $em_dash;
188
+		$dynamic['/(?<=^|'.$spaces.')--(?=$|'.$spaces.')/'] = $em_dash;
189
+		$dynamic['/(?<!xn)--/'] = $en_dash;
190
+		$dynamic['/(?<=^|'.$spaces.')-(?=$|'.$spaces.')/'] = $en_dash;
191 191
 
192
-		$dynamic_characters['dash'] = array_keys( $dynamic );
193
-		$dynamic_replacements['dash'] = array_values( $dynamic );
192
+		$dynamic_characters['dash'] = array_keys($dynamic);
193
+		$dynamic_replacements['dash'] = array_values($dynamic);
194 194
 	}
195 195
 
196 196
 	// Must do this every time in case plugins use these filters in a context sensitive manner
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 	 *
202 202
 	 * @param array $default_no_texturize_tags An array of HTML element names.
203 203
 	 */
204
-	$no_texturize_tags = apply_filters( 'no_texturize_tags', $default_no_texturize_tags );
204
+	$no_texturize_tags = apply_filters('no_texturize_tags', $default_no_texturize_tags);
205 205
 	/**
206 206
 	 * Filter the list of shortcodes not to texturize.
207 207
 	 *
@@ -209,84 +209,84 @@  discard block
 block discarded – undo
209 209
 	 *
210 210
 	 * @param array $default_no_texturize_shortcodes An array of shortcode names.
211 211
 	 */
212
-	$no_texturize_shortcodes = apply_filters( 'no_texturize_shortcodes', $default_no_texturize_shortcodes );
212
+	$no_texturize_shortcodes = apply_filters('no_texturize_shortcodes', $default_no_texturize_shortcodes);
213 213
 
214 214
 	$no_texturize_tags_stack = array();
215 215
 	$no_texturize_shortcodes_stack = array();
216 216
 
217 217
 	// Look for shortcodes and HTML elements.
218 218
 
219
-	preg_match_all( '@\[/?([^<>&/\[\]\x00-\x20=]++)@', $text, $matches );
220
-	$tagnames = array_intersect( array_keys( $shortcode_tags ), $matches[1] );
221
-	$found_shortcodes = ! empty( $tagnames );
222
-	$shortcode_regex = $found_shortcodes ? _get_wptexturize_shortcode_regex( $tagnames ) : '';
223
-	$regex = _get_wptexturize_split_regex( $shortcode_regex );
219
+	preg_match_all('@\[/?([^<>&/\[\]\x00-\x20=]++)@', $text, $matches);
220
+	$tagnames = array_intersect(array_keys($shortcode_tags), $matches[1]);
221
+	$found_shortcodes = ! empty($tagnames);
222
+	$shortcode_regex = $found_shortcodes ? _get_wptexturize_shortcode_regex($tagnames) : '';
223
+	$regex = _get_wptexturize_split_regex($shortcode_regex);
224 224
 
225
-	$textarr = preg_split( $regex, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY );
225
+	$textarr = preg_split($regex, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
226 226
 
227
-	foreach ( $textarr as &$curl ) {
227
+	foreach ($textarr as &$curl) {
228 228
 		// Only call _wptexturize_pushpop_element if $curl is a delimiter.
229 229
 		$first = $curl[0];
230
-		if ( '<' === $first ) {
231
-			if ( '<!--' === substr( $curl, 0, 4 ) ) {
230
+		if ('<' === $first) {
231
+			if ('<!--' === substr($curl, 0, 4)) {
232 232
 				// This is an HTML comment delimiter.
233 233
 				continue;
234 234
 			} else {
235 235
 				// This is an HTML element delimiter.
236 236
 
237 237
 				// Replace each & with &#038; unless it already looks like an entity.
238
-				$curl = preg_replace( '/&(?!#(?:\d+|x[a-f0-9]+);|[a-z1-4]{1,8};)/i', '&#038;', $curl );
238
+				$curl = preg_replace('/&(?!#(?:\d+|x[a-f0-9]+);|[a-z1-4]{1,8};)/i', '&#038;', $curl);
239 239
 
240
-				_wptexturize_pushpop_element( $curl, $no_texturize_tags_stack, $no_texturize_tags );
240
+				_wptexturize_pushpop_element($curl, $no_texturize_tags_stack, $no_texturize_tags);
241 241
 			}
242 242
 
243
-		} elseif ( '' === trim( $curl ) ) {
243
+		} elseif ('' === trim($curl)) {
244 244
 			// This is a newline between delimiters.  Performance improves when we check this.
245 245
 			continue;
246 246
 
247
-		} elseif ( '[' === $first && $found_shortcodes && 1 === preg_match( '/^' . $shortcode_regex . '$/', $curl ) ) {
247
+		} elseif ('[' === $first && $found_shortcodes && 1 === preg_match('/^'.$shortcode_regex.'$/', $curl)) {
248 248
 			// This is a shortcode delimiter.
249 249
 
250
-			if ( '[[' !== substr( $curl, 0, 2 ) && ']]' !== substr( $curl, -2 ) ) {
250
+			if ('[[' !== substr($curl, 0, 2) && ']]' !== substr($curl, -2)) {
251 251
 				// Looks like a normal shortcode.
252
-				_wptexturize_pushpop_element( $curl, $no_texturize_shortcodes_stack, $no_texturize_shortcodes );
252
+				_wptexturize_pushpop_element($curl, $no_texturize_shortcodes_stack, $no_texturize_shortcodes);
253 253
 			} else {
254 254
 				// Looks like an escaped shortcode.
255 255
 				continue;
256 256
 			}
257 257
 
258
-		} elseif ( empty( $no_texturize_shortcodes_stack ) && empty( $no_texturize_tags_stack ) ) {
258
+		} elseif (empty($no_texturize_shortcodes_stack) && empty($no_texturize_tags_stack)) {
259 259
 			// This is neither a delimiter, nor is this content inside of no_texturize pairs.  Do texturize.
260 260
 
261
-			$curl = str_replace( $static_characters, $static_replacements, $curl );
261
+			$curl = str_replace($static_characters, $static_replacements, $curl);
262 262
 
263
-			if ( false !== strpos( $curl, "'" ) ) {
264
-				$curl = preg_replace( $dynamic_characters['apos'], $dynamic_replacements['apos'], $curl );
265
-				$curl = wptexturize_primes( $curl, "'", $prime, $open_sq_flag, $closing_single_quote );
266
-				$curl = str_replace( $apos_flag, $apos, $curl );
267
-				$curl = str_replace( $open_sq_flag, $opening_single_quote, $curl );
263
+			if (false !== strpos($curl, "'")) {
264
+				$curl = preg_replace($dynamic_characters['apos'], $dynamic_replacements['apos'], $curl);
265
+				$curl = wptexturize_primes($curl, "'", $prime, $open_sq_flag, $closing_single_quote);
266
+				$curl = str_replace($apos_flag, $apos, $curl);
267
+				$curl = str_replace($open_sq_flag, $opening_single_quote, $curl);
268 268
 			}
269
-			if ( false !== strpos( $curl, '"' ) ) {
270
-				$curl = preg_replace( $dynamic_characters['quote'], $dynamic_replacements['quote'], $curl );
271
-				$curl = wptexturize_primes( $curl, '"', $double_prime, $open_q_flag, $closing_quote );
272
-				$curl = str_replace( $open_q_flag, $opening_quote, $curl );
269
+			if (false !== strpos($curl, '"')) {
270
+				$curl = preg_replace($dynamic_characters['quote'], $dynamic_replacements['quote'], $curl);
271
+				$curl = wptexturize_primes($curl, '"', $double_prime, $open_q_flag, $closing_quote);
272
+				$curl = str_replace($open_q_flag, $opening_quote, $curl);
273 273
 			}
274
-			if ( false !== strpos( $curl, '-' ) ) {
275
-				$curl = preg_replace( $dynamic_characters['dash'], $dynamic_replacements['dash'], $curl );
274
+			if (false !== strpos($curl, '-')) {
275
+				$curl = preg_replace($dynamic_characters['dash'], $dynamic_replacements['dash'], $curl);
276 276
 			}
277 277
 
278 278
 			// 9x9 (times), but never 0x9999
279
-			if ( 1 === preg_match( '/(?<=\d)x\d/', $curl ) ) {
279
+			if (1 === preg_match('/(?<=\d)x\d/', $curl)) {
280 280
 				// Searching for a digit is 10 times more expensive than for the x, so we avoid doing this one!
281
-				$curl = preg_replace( '/\b(\d(?(?<=0)[\d\.,]+|[\d\.,]*))x(\d[\d\.,]*)\b/', '$1&#215;$2', $curl );
281
+				$curl = preg_replace('/\b(\d(?(?<=0)[\d\.,]+|[\d\.,]*))x(\d[\d\.,]*)\b/', '$1&#215;$2', $curl);
282 282
 			}
283 283
 
284 284
 			// Replace each & with &#038; unless it already looks like an entity.
285
-			$curl = preg_replace( '/&(?!#(?:\d+|x[a-f0-9]+);|[a-z1-4]{1,8};)/i', '&#038;', $curl );
285
+			$curl = preg_replace('/&(?!#(?:\d+|x[a-f0-9]+);|[a-z1-4]{1,8};)/i', '&#038;', $curl);
286 286
 		}
287 287
 	}
288 288
 
289
-	return implode( '', $textarr );
289
+	return implode('', $textarr);
290 290
 }
291 291
 
292 292
 /**
@@ -303,59 +303,59 @@  discard block
 block discarded – undo
303 303
  * @param string $close_quote The closing quote char to use for replacement.
304 304
  * @return string The $haystack value after primes and quotes replacements.
305 305
  */
306
-function wptexturize_primes( $haystack, $needle, $prime, $open_quote, $close_quote ) {
306
+function wptexturize_primes($haystack, $needle, $prime, $open_quote, $close_quote) {
307 307
 	$spaces = wp_spaces_regexp();
308 308
 	$flag = '<!--wp-prime-or-quote-->';
309
-	$quote_pattern = "/$needle(?=\\Z|[.,:;!?)}\\-\\]]|&gt;|" . $spaces . ")/";
309
+	$quote_pattern = "/$needle(?=\\Z|[.,:;!?)}\\-\\]]|&gt;|".$spaces.")/";
310 310
 	$prime_pattern    = "/(?<=\\d)$needle/";
311 311
 	$flag_after_digit = "/(?<=\\d)$flag/";
312 312
 	$flag_no_digit    = "/(?<!\\d)$flag/";
313 313
 
314
-	$sentences = explode( $open_quote, $haystack );
314
+	$sentences = explode($open_quote, $haystack);
315 315
 
316
-	foreach ( $sentences as $key => &$sentence ) {
317
-		if ( false === strpos( $sentence, $needle ) ) {
316
+	foreach ($sentences as $key => &$sentence) {
317
+		if (false === strpos($sentence, $needle)) {
318 318
 			continue;
319
-		} elseif ( 0 !== $key && 0 === substr_count( $sentence, $close_quote ) ) {
320
-			$sentence = preg_replace( $quote_pattern, $flag, $sentence, -1, $count );
321
-			if ( $count > 1 ) {
319
+		} elseif (0 !== $key && 0 === substr_count($sentence, $close_quote)) {
320
+			$sentence = preg_replace($quote_pattern, $flag, $sentence, -1, $count);
321
+			if ($count > 1) {
322 322
 				// This sentence appears to have multiple closing quotes.  Attempt Vulcan logic.
323
-				$sentence = preg_replace( $flag_no_digit, $close_quote, $sentence, -1, $count2 );
324
-				if ( 0 === $count2 ) {
323
+				$sentence = preg_replace($flag_no_digit, $close_quote, $sentence, -1, $count2);
324
+				if (0 === $count2) {
325 325
 					// Try looking for a quote followed by a period.
326
-					$count2 = substr_count( $sentence, "$flag." );
327
-					if ( $count2 > 0 ) {
326
+					$count2 = substr_count($sentence, "$flag.");
327
+					if ($count2 > 0) {
328 328
 						// Assume the rightmost quote-period match is the end of quotation.
329
-						$pos = strrpos( $sentence, "$flag." );
329
+						$pos = strrpos($sentence, "$flag.");
330 330
 					} else {
331 331
 						// When all else fails, make the rightmost candidate a closing quote.
332 332
 						// This is most likely to be problematic in the context of bug #18549.
333
-						$pos = strrpos( $sentence, $flag );
333
+						$pos = strrpos($sentence, $flag);
334 334
 					}
335
-					$sentence = substr_replace( $sentence, $close_quote, $pos, strlen( $flag ) );
335
+					$sentence = substr_replace($sentence, $close_quote, $pos, strlen($flag));
336 336
 				}
337 337
 				// Use conventional replacement on any remaining primes and quotes.
338
-				$sentence = preg_replace( $prime_pattern, $prime, $sentence );
339
-				$sentence = preg_replace( $flag_after_digit, $prime, $sentence );
340
-				$sentence = str_replace( $flag, $close_quote, $sentence );
341
-			} elseif ( 1 == $count ) {
338
+				$sentence = preg_replace($prime_pattern, $prime, $sentence);
339
+				$sentence = preg_replace($flag_after_digit, $prime, $sentence);
340
+				$sentence = str_replace($flag, $close_quote, $sentence);
341
+			} elseif (1 == $count) {
342 342
 				// Found only one closing quote candidate, so give it priority over primes.
343
-				$sentence = str_replace( $flag, $close_quote, $sentence );
344
-				$sentence = preg_replace( $prime_pattern, $prime, $sentence );
343
+				$sentence = str_replace($flag, $close_quote, $sentence);
344
+				$sentence = preg_replace($prime_pattern, $prime, $sentence);
345 345
 			} else {
346 346
 				// No closing quotes found.  Just run primes pattern.
347
-				$sentence = preg_replace( $prime_pattern, $prime, $sentence );
347
+				$sentence = preg_replace($prime_pattern, $prime, $sentence);
348 348
 			}
349 349
 		} else {
350
-			$sentence = preg_replace( $prime_pattern, $prime, $sentence );
351
-			$sentence = preg_replace( $quote_pattern, $close_quote, $sentence );
350
+			$sentence = preg_replace($prime_pattern, $prime, $sentence);
351
+			$sentence = preg_replace($quote_pattern, $close_quote, $sentence);
352 352
 		}
353
-		if ( '"' == $needle && false !== strpos( $sentence, '"' ) ) {
354
-			$sentence = str_replace( '"', $close_quote, $sentence );
353
+		if ('"' == $needle && false !== strpos($sentence, '"')) {
354
+			$sentence = str_replace('"', $close_quote, $sentence);
355 355
 		}
356 356
 	}
357 357
 
358
-	return implode( $open_quote, $sentences );
358
+	return implode($open_quote, $sentences);
359 359
 }
360 360
 
361 361
 /**
@@ -372,12 +372,12 @@  discard block
 block discarded – undo
372 372
  * @param array  $stack List of open tag elements.
373 373
  * @param array  $disabled_elements The tag names to match against. Spaces are not allowed in tag names.
374 374
  */
375
-function _wptexturize_pushpop_element( $text, &$stack, $disabled_elements ) {
375
+function _wptexturize_pushpop_element($text, &$stack, $disabled_elements) {
376 376
 	// Is it an opening tag or closing tag?
377
-	if ( isset( $text[1] ) && '/' !== $text[1] ) {
377
+	if (isset($text[1]) && '/' !== $text[1]) {
378 378
 		$opening_tag = true;
379 379
 		$name_offset = 1;
380
-	} elseif ( 0 == count( $stack ) ) {
380
+	} elseif (0 == count($stack)) {
381 381
 		// Stack is empty. Just stop.
382 382
 		return;
383 383
 	} else {
@@ -386,17 +386,17 @@  discard block
 block discarded – undo
386 386
 	}
387 387
 
388 388
 	// Parse out the tag name.
389
-	$space = strpos( $text, ' ' );
390
-	if ( false === $space ) {
389
+	$space = strpos($text, ' ');
390
+	if (false === $space) {
391 391
 		$space = -1;
392 392
 	} else {
393 393
 		$space -= $name_offset;
394 394
 	}
395
-	$tag = substr( $text, $name_offset, $space );
395
+	$tag = substr($text, $name_offset, $space);
396 396
 
397 397
 	// Handle disabled tags.
398
-	if ( in_array( $tag, $disabled_elements ) ) {
399
-		if ( $opening_tag ) {
398
+	if (in_array($tag, $disabled_elements)) {
399
+		if ($opening_tag) {
400 400
 			/*
401 401
 			 * This disables texturize until we find a closing tag of our type
402 402
 			 * (e.g. <pre>) even if there was invalid nesting before that
@@ -405,9 +405,9 @@  discard block
 block discarded – undo
405 405
 			 *          "baba" won't be texturize
406 406
 			 */
407 407
 
408
-			array_push( $stack, $tag );
409
-		} elseif ( end( $stack ) == $tag ) {
410
-			array_pop( $stack );
408
+			array_push($stack, $tag);
409
+		} elseif (end($stack) == $tag) {
410
+			array_pop($stack);
411 411
 		}
412 412
 	}
413 413
 }
@@ -426,38 +426,38 @@  discard block
 block discarded – undo
426 426
  *                    after paragraphing. Default true.
427 427
  * @return string Text which has been converted into correct paragraph tags.
428 428
  */
429
-function wpautop( $pee, $br = true ) {
429
+function wpautop($pee, $br = true) {
430 430
 	$pre_tags = array();
431 431
 
432
-	if ( trim($pee) === '' )
432
+	if (trim($pee) === '')
433 433
 		return '';
434 434
 
435 435
 	// Just to make things a little easier, pad the end.
436
-	$pee = $pee . "\n";
436
+	$pee = $pee."\n";
437 437
 
438 438
 	/*
439 439
 	 * Pre tags shouldn't be touched by autop.
440 440
 	 * Replace pre tags with placeholders and bring them back after autop.
441 441
 	 */
442
-	if ( strpos($pee, '<pre') !== false ) {
443
-		$pee_parts = explode( '</pre>', $pee );
442
+	if (strpos($pee, '<pre') !== false) {
443
+		$pee_parts = explode('</pre>', $pee);
444 444
 		$last_pee = array_pop($pee_parts);
445 445
 		$pee = '';
446 446
 		$i = 0;
447 447
 
448
-		foreach ( $pee_parts as $pee_part ) {
448
+		foreach ($pee_parts as $pee_part) {
449 449
 			$start = strpos($pee_part, '<pre');
450 450
 
451 451
 			// Malformed html?
452
-			if ( $start === false ) {
452
+			if ($start === false) {
453 453
 				$pee .= $pee_part;
454 454
 				continue;
455 455
 			}
456 456
 
457 457
 			$name = "<pre wp-pre-tag-$i></pre>";
458
-			$pre_tags[$name] = substr( $pee_part, $start ) . '</pre>';
458
+			$pre_tags[$name] = substr($pee_part, $start).'</pre>';
459 459
 
460
-			$pee .= substr( $pee_part, 0, $start ) . $name;
460
+			$pee .= substr($pee_part, 0, $start).$name;
461 461
 			$i++;
462 462
 		}
463 463
 
@@ -469,41 +469,41 @@  discard block
 block discarded – undo
469 469
 	$allblocks = '(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|form|map|area|blockquote|address|math|style|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary)';
470 470
 
471 471
 	// Add a single line break above block-level opening tags.
472
-	$pee = preg_replace('!(<' . $allblocks . '[\s/>])!', "\n$1", $pee);
472
+	$pee = preg_replace('!(<'.$allblocks.'[\s/>])!', "\n$1", $pee);
473 473
 
474 474
 	// Add a double line break below block-level closing tags.
475
-	$pee = preg_replace('!(</' . $allblocks . '>)!', "$1\n\n", $pee);
475
+	$pee = preg_replace('!(</'.$allblocks.'>)!', "$1\n\n", $pee);
476 476
 
477 477
 	// Standardize newline characters to "\n".
478 478
 	$pee = str_replace(array("\r\n", "\r"), "\n", $pee);
479 479
 
480 480
 	// Find newlines in all elements and add placeholders.
481
-	$pee = wp_replace_in_html_tags( $pee, array( "\n" => " <!-- wpnl --> " ) );
481
+	$pee = wp_replace_in_html_tags($pee, array("\n" => " <!-- wpnl --> "));
482 482
 
483 483
 	// Collapse line breaks before and after <option> elements so they don't get autop'd.
484
-	if ( strpos( $pee, '<option' ) !== false ) {
485
-		$pee = preg_replace( '|\s*<option|', '<option', $pee );
486
-		$pee = preg_replace( '|</option>\s*|', '</option>', $pee );
484
+	if (strpos($pee, '<option') !== false) {
485
+		$pee = preg_replace('|\s*<option|', '<option', $pee);
486
+		$pee = preg_replace('|</option>\s*|', '</option>', $pee);
487 487
 	}
488 488
 
489 489
 	/*
490 490
 	 * Collapse line breaks inside <object> elements, before <param> and <embed> elements
491 491
 	 * so they don't get autop'd.
492 492
 	 */
493
-	if ( strpos( $pee, '</object>' ) !== false ) {
494
-		$pee = preg_replace( '|(<object[^>]*>)\s*|', '$1', $pee );
495
-		$pee = preg_replace( '|\s*</object>|', '</object>', $pee );
496
-		$pee = preg_replace( '%\s*(</?(?:param|embed)[^>]*>)\s*%', '$1', $pee );
493
+	if (strpos($pee, '</object>') !== false) {
494
+		$pee = preg_replace('|(<object[^>]*>)\s*|', '$1', $pee);
495
+		$pee = preg_replace('|\s*</object>|', '</object>', $pee);
496
+		$pee = preg_replace('%\s*(</?(?:param|embed)[^>]*>)\s*%', '$1', $pee);
497 497
 	}
498 498
 
499 499
 	/*
500 500
 	 * Collapse line breaks inside <audio> and <video> elements,
501 501
 	 * before and after <source> and <track> elements.
502 502
 	 */
503
-	if ( strpos( $pee, '<source' ) !== false || strpos( $pee, '<track' ) !== false ) {
504
-		$pee = preg_replace( '%([<\[](?:audio|video)[^>\]]*[>\]])\s*%', '$1', $pee );
505
-		$pee = preg_replace( '%\s*([<\[]/(?:audio|video)[>\]])%', '$1', $pee );
506
-		$pee = preg_replace( '%\s*(<(?:source|track)[^>]*>)\s*%', '$1', $pee );
503
+	if (strpos($pee, '<source') !== false || strpos($pee, '<track') !== false) {
504
+		$pee = preg_replace('%([<\[](?:audio|video)[^>\]]*[>\]])\s*%', '$1', $pee);
505
+		$pee = preg_replace('%\s*([<\[]/(?:audio|video)[>\]])%', '$1', $pee);
506
+		$pee = preg_replace('%\s*(<(?:source|track)[^>]*>)\s*%', '$1', $pee);
507 507
 	}
508 508
 
509 509
 	// Remove more than two contiguous line breaks.
@@ -516,8 +516,8 @@  discard block
 block discarded – undo
516 516
 	$pee = '';
517 517
 
518 518
 	// Rebuild the content as a string, wrapping every bit with a <p>.
519
-	foreach ( $pees as $tinkle ) {
520
-		$pee .= '<p>' . trim($tinkle, "\n") . "</p>\n";
519
+	foreach ($pees as $tinkle) {
520
+		$pee .= '<p>'.trim($tinkle, "\n")."</p>\n";
521 521
 	}
522 522
 
523 523
 	// Under certain strange conditions it could create a P of entirely whitespace.
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 	$pee = preg_replace('!<p>([^<]+)</(div|address|form)>!', "<p>$1</p></$2>", $pee);
528 528
 
529 529
 	// If an opening or closing block element tag is wrapped in a <p>, unwrap it.
530
-	$pee = preg_replace('!<p>\s*(</?' . $allblocks . '[^>]*>)\s*</p>!', "$1", $pee);
530
+	$pee = preg_replace('!<p>\s*(</?'.$allblocks.'[^>]*>)\s*</p>!', "$1", $pee);
531 531
 
532 532
 	// In some cases <li> may get wrapped in <p>, fix them.
533 533
 	$pee = preg_replace("|<p>(<li.+?)</p>|", "$1", $pee);
@@ -537,18 +537,18 @@  discard block
 block discarded – undo
537 537
 	$pee = str_replace('</blockquote></p>', '</p></blockquote>', $pee);
538 538
 
539 539
 	// If an opening or closing block element tag is preceded by an opening <p> tag, remove it.
540
-	$pee = preg_replace('!<p>\s*(</?' . $allblocks . '[^>]*>)!', "$1", $pee);
540
+	$pee = preg_replace('!<p>\s*(</?'.$allblocks.'[^>]*>)!', "$1", $pee);
541 541
 
542 542
 	// If an opening or closing block element tag is followed by a closing <p> tag, remove it.
543
-	$pee = preg_replace('!(</?' . $allblocks . '[^>]*>)\s*</p>!', "$1", $pee);
543
+	$pee = preg_replace('!(</?'.$allblocks.'[^>]*>)\s*</p>!', "$1", $pee);
544 544
 
545 545
 	// Optionally insert line breaks.
546
-	if ( $br ) {
546
+	if ($br) {
547 547
 		// Replace newlines that shouldn't be touched with a placeholder.
548 548
 		$pee = preg_replace_callback('/<(script|style).*?<\/\\1>/s', '_autop_newline_preservation_helper', $pee);
549 549
 
550 550
 		// Normalize <br>
551
-		$pee = str_replace( array( '<br>', '<br/>' ), '<br />', $pee );
551
+		$pee = str_replace(array('<br>', '<br/>'), '<br />', $pee);
552 552
 
553 553
 		// Replace any new line characters that aren't preceded by a <br /> with a <br />.
554 554
 		$pee = preg_replace('|(?<!<br />)\s*\n|', "<br />\n", $pee);
@@ -558,19 +558,19 @@  discard block
 block discarded – undo
558 558
 	}
559 559
 
560 560
 	// If a <br /> tag is after an opening or closing block tag, remove it.
561
-	$pee = preg_replace('!(</?' . $allblocks . '[^>]*>)\s*<br />!', "$1", $pee);
561
+	$pee = preg_replace('!(</?'.$allblocks.'[^>]*>)\s*<br />!', "$1", $pee);
562 562
 
563 563
 	// If a <br /> tag is before a subset of opening or closing block tags, remove it.
564 564
 	$pee = preg_replace('!<br />(\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)[^>]*>)!', '$1', $pee);
565
-	$pee = preg_replace( "|\n</p>$|", '</p>', $pee );
565
+	$pee = preg_replace("|\n</p>$|", '</p>', $pee);
566 566
 
567 567
 	// Replace placeholder <pre> tags with their original content.
568
-	if ( !empty($pre_tags) )
568
+	if ( ! empty($pre_tags))
569 569
 		$pee = str_replace(array_keys($pre_tags), array_values($pre_tags), $pee);
570 570
 
571 571
 	// Restore newlines in all elements.
572
-	if ( false !== strpos( $pee, '<!-- wpnl -->' ) ) {
573
-		$pee = str_replace( array( ' <!-- wpnl --> ', '<!-- wpnl -->' ), "\n", $pee );
572
+	if (false !== strpos($pee, '<!-- wpnl -->')) {
573
+		$pee = str_replace(array(' <!-- wpnl --> ', '<!-- wpnl -->'), "\n", $pee);
574 574
 	}
575 575
 
576 576
 	return $pee;
@@ -584,8 +584,8 @@  discard block
 block discarded – undo
584 584
  * @param string $input The text which has to be formatted.
585 585
  * @return array The formatted text.
586 586
  */
587
-function wp_html_split( $input ) {
588
-	return preg_split( get_html_split_regex(), $input, -1, PREG_SPLIT_DELIM_CAPTURE );
587
+function wp_html_split($input) {
588
+	return preg_split(get_html_split_regex(), $input, -1, PREG_SPLIT_DELIM_CAPTURE);
589 589
 }
590 590
 
591 591
 /**
@@ -598,14 +598,14 @@  discard block
 block discarded – undo
598 598
 function get_html_split_regex() {
599 599
 	static $regex;
600 600
 
601
-	if ( ! isset( $regex ) ) {
601
+	if ( ! isset($regex)) {
602 602
 		$comments =
603 603
 			  '!'           // Start of comment, after the <.
604 604
 			. '(?:'         // Unroll the loop: Consume everything until --> is found.
605 605
 			.     '-(?!->)' // Dash not followed by end of comment.
606 606
 			.     '[^\-]*+' // Consume non-dashes.
607 607
 			. ')*+'         // Loop possessively.
608
-			. '(?:-->)?';   // End of comment. If not found, match all input.
608
+			. '(?:-->)?'; // End of comment. If not found, match all input.
609 609
 
610 610
 		$cdata =
611 611
 			  '!\[CDATA\['  // Start of comment, after the <.
@@ -614,7 +614,7 @@  discard block
 block discarded – undo
614 614
 			.     '](?!]>)' // One ] not followed by end of comment.
615 615
 			.     '[^\]]*+' // Consume non-].
616 616
 			. ')*+'         // Loop possessively.
617
-			. '(?:]]>)?';   // End of comment. If not found, match all input.
617
+			. '(?:]]>)?'; // End of comment. If not found, match all input.
618 618
 
619 619
 		$escaped =
620 620
 			  '(?='           // Is the element escaped?
@@ -653,19 +653,19 @@  discard block
 block discarded – undo
653 653
  * @param string $shortcode_regex The result from _get_wptexturize_shortcode_regex().  Optional.
654 654
  * @return string The regular expression
655 655
  */
656
-function _get_wptexturize_split_regex( $shortcode_regex = '' ) {
656
+function _get_wptexturize_split_regex($shortcode_regex = '') {
657 657
 	static $html_regex;
658 658
 
659
-	if ( ! isset( $html_regex ) ) {
659
+	if ( ! isset($html_regex)) {
660 660
 		$comment_regex =
661 661
 			  '!'           // Start of comment, after the <.
662 662
 			. '(?:'         // Unroll the loop: Consume everything until --> is found.
663 663
 			.     '-(?!->)' // Dash not followed by end of comment.
664 664
 			.     '[^\-]*+' // Consume non-dashes.
665 665
 			. ')*+'         // Loop possessively.
666
-			. '(?:-->)?';   // End of comment. If not found, match all input.
666
+			. '(?:-->)?'; // End of comment. If not found, match all input.
667 667
 
668
-		$html_regex =			 // Needs replaced with wp_html_split() per Shortcode API Roadmap.
668
+		$html_regex = // Needs replaced with wp_html_split() per Shortcode API Roadmap.
669 669
 			  '<'                // Find start of element.
670 670
 			. '(?(?=!--)'        // Is this a comment?
671 671
 			.     $comment_regex // Find end of comment.
@@ -674,10 +674,10 @@  discard block
 block discarded – undo
674 674
 			. ')';
675 675
 	}
676 676
 
677
-	if ( empty( $shortcode_regex ) ) {
678
-		$regex = '/(' . $html_regex . ')/';
677
+	if (empty($shortcode_regex)) {
678
+		$regex = '/('.$html_regex.')/';
679 679
 	} else {
680
-		$regex = '/(' . $html_regex . '|' . $shortcode_regex . ')/';
680
+		$regex = '/('.$html_regex.'|'.$shortcode_regex.')/';
681 681
 	}
682 682
 
683 683
 	return $regex;
@@ -694,8 +694,8 @@  discard block
 block discarded – undo
694 694
  * @param array $tagnames List of shortcodes to find.
695 695
  * @return string The regular expression
696 696
  */
697
-function _get_wptexturize_shortcode_regex( $tagnames ) {
698
-	$tagregexp = join( '|', array_map( 'preg_quote', $tagnames ) );
697
+function _get_wptexturize_shortcode_regex($tagnames) {
698
+	$tagregexp = join('|', array_map('preg_quote', $tagnames));
699 699
 	$tagregexp = "(?:$tagregexp)(?=[\\s\\]\\/])"; // Excerpt of get_shortcode_regex().
700 700
 	$regex =
701 701
 		  '\['              // Find start of shortcode.
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
 		.     '<[^\[\]>]*>' // HTML elements permitted. Prevents matching ] before >.
708 708
 		. ')*+'             // Possessive critical.
709 709
 		. '\]'              // Find end of shortcode.
710
-		. '\]?';            // Shortcodes may end with ]]
710
+		. '\]?'; // Shortcodes may end with ]]
711 711
 
712 712
 	return $regex;
713 713
 }
@@ -721,32 +721,32 @@  discard block
 block discarded – undo
721 721
  * @param array $replace_pairs In the form array('from' => 'to', ...).
722 722
  * @return string The formatted text.
723 723
  */
724
-function wp_replace_in_html_tags( $haystack, $replace_pairs ) {
724
+function wp_replace_in_html_tags($haystack, $replace_pairs) {
725 725
 	// Find all elements.
726
-	$textarr = wp_html_split( $haystack );
726
+	$textarr = wp_html_split($haystack);
727 727
 	$changed = false;
728 728
 
729 729
 	// Optimize when searching for one item.
730
-	if ( 1 === count( $replace_pairs ) ) {
730
+	if (1 === count($replace_pairs)) {
731 731
 		// Extract $needle and $replace.
732
-		foreach ( $replace_pairs as $needle => $replace );
732
+		foreach ($replace_pairs as $needle => $replace);
733 733
 
734 734
 		// Loop through delimiters (elements) only.
735
-		for ( $i = 1, $c = count( $textarr ); $i < $c; $i += 2 ) {
736
-			if ( false !== strpos( $textarr[$i], $needle ) ) {
737
-				$textarr[$i] = str_replace( $needle, $replace, $textarr[$i] );
735
+		for ($i = 1, $c = count($textarr); $i < $c; $i += 2) {
736
+			if (false !== strpos($textarr[$i], $needle)) {
737
+				$textarr[$i] = str_replace($needle, $replace, $textarr[$i]);
738 738
 				$changed = true;
739 739
 			}
740 740
 		}
741 741
 	} else {
742 742
 		// Extract all $needles.
743
-		$needles = array_keys( $replace_pairs );
743
+		$needles = array_keys($replace_pairs);
744 744
 
745 745
 		// Loop through delimiters (elements) only.
746
-		for ( $i = 1, $c = count( $textarr ); $i < $c; $i += 2 ) {
747
-			foreach ( $needles as $needle ) {
748
-				if ( false !== strpos( $textarr[$i], $needle ) ) {
749
-					$textarr[$i] = strtr( $textarr[$i], $replace_pairs );
746
+		for ($i = 1, $c = count($textarr); $i < $c; $i += 2) {
747
+			foreach ($needles as $needle) {
748
+				if (false !== strpos($textarr[$i], $needle)) {
749
+					$textarr[$i] = strtr($textarr[$i], $replace_pairs);
750 750
 					$changed = true;
751 751
 					// After one strtr() break out of the foreach loop and look at next element.
752 752
 					break;
@@ -755,8 +755,8 @@  discard block
 block discarded – undo
755 755
 		}
756 756
 	}
757 757
 
758
-	if ( $changed ) {
759
-		$haystack = implode( $textarr );
758
+	if ($changed) {
759
+		$haystack = implode($textarr);
760 760
 	}
761 761
 
762 762
 	return $haystack;
@@ -771,8 +771,8 @@  discard block
 block discarded – undo
771 771
  * @param array $matches preg_replace_callback matches array
772 772
  * @return string
773 773
  */
774
-function _autop_newline_preservation_helper( $matches ) {
775
-	return str_replace( "\n", "<WPPreserveNewline />", $matches[0] );
774
+function _autop_newline_preservation_helper($matches) {
775
+	return str_replace("\n", "<WPPreserveNewline />", $matches[0]);
776 776
 }
777 777
 
778 778
 /**
@@ -787,20 +787,20 @@  discard block
 block discarded – undo
787 787
  * @param string $pee The content.
788 788
  * @return string The filtered content.
789 789
  */
790
-function shortcode_unautop( $pee ) {
790
+function shortcode_unautop($pee) {
791 791
 	global $shortcode_tags;
792 792
 
793
-	if ( empty( $shortcode_tags ) || !is_array( $shortcode_tags ) ) {
793
+	if (empty($shortcode_tags) || ! is_array($shortcode_tags)) {
794 794
 		return $pee;
795 795
 	}
796 796
 
797
-	$tagregexp = join( '|', array_map( 'preg_quote', array_keys( $shortcode_tags ) ) );
797
+	$tagregexp = join('|', array_map('preg_quote', array_keys($shortcode_tags)));
798 798
 	$spaces = wp_spaces_regexp();
799 799
 
800 800
 	$pattern =
801 801
 		  '/'
802 802
 		. '<p>'                              // Opening paragraph
803
-		. '(?:' . $spaces . ')*+'            // Optional leading whitespace
803
+		. '(?:'.$spaces.')*+'            // Optional leading whitespace
804 804
 		. '('                                // 1: The shortcode
805 805
 		.     '\\['                          // Opening bracket
806 806
 		.     "($tagregexp)"                 // 2: Shortcode name
@@ -825,11 +825,11 @@  discard block
 block discarded – undo
825 825
 		.         ')?'
826 826
 		.     ')'
827 827
 		. ')'
828
-		. '(?:' . $spaces . ')*+'            // optional trailing whitespace
828
+		. '(?:'.$spaces.')*+'            // optional trailing whitespace
829 829
 		. '<\\/p>'                           // closing paragraph
830 830
 		. '/';
831 831
 
832
-	return preg_replace( $pattern, '$1', $pee );
832
+	return preg_replace($pattern, '$1', $pee);
833 833
 }
834 834
 
835 835
 /**
@@ -844,20 +844,20 @@  discard block
 block discarded – undo
844 844
  * @param string $str The string to be checked
845 845
  * @return bool True if $str fits a UTF-8 model, false otherwise.
846 846
  */
847
-function seems_utf8( $str ) {
847
+function seems_utf8($str) {
848 848
 	mbstring_binary_safe_encoding();
849 849
 	$length = strlen($str);
850 850
 	reset_mbstring_encoding();
851
-	for ($i=0; $i < $length; $i++) {
851
+	for ($i = 0; $i < $length; $i++) {
852 852
 		$c = ord($str[$i]);
853 853
 		if ($c < 0x80) $n = 0; // 0bbbbbbb
854
-		elseif (($c & 0xE0) == 0xC0) $n=1; // 110bbbbb
855
-		elseif (($c & 0xF0) == 0xE0) $n=2; // 1110bbbb
856
-		elseif (($c & 0xF8) == 0xF0) $n=3; // 11110bbb
857
-		elseif (($c & 0xFC) == 0xF8) $n=4; // 111110bb
858
-		elseif (($c & 0xFE) == 0xFC) $n=5; // 1111110b
854
+		elseif (($c & 0xE0) == 0xC0) $n = 1; // 110bbbbb
855
+		elseif (($c & 0xF0) == 0xE0) $n = 2; // 1110bbbb
856
+		elseif (($c & 0xF8) == 0xF0) $n = 3; // 11110bbb
857
+		elseif (($c & 0xFC) == 0xF8) $n = 4; // 111110bb
858
+		elseif (($c & 0xFE) == 0xFC) $n = 5; // 1111110b
859 859
 		else return false; // Does not match any model
860
-		for ($j=0; $j<$n; $j++) { // n bytes matching 10bbbbbb follow ?
860
+		for ($j = 0; $j < $n; $j++) { // n bytes matching 10bbbbbb follow ?
861 861
 			if ((++$i == $length) || ((ord($str[$i]) & 0xC0) != 0x80))
862 862
 				return false;
863 863
 		}
@@ -888,55 +888,55 @@  discard block
 block discarded – undo
888 888
  * @param bool       $double_encode  Optional. Whether to encode existing html entities. Default is false.
889 889
  * @return string The encoded text with HTML entities.
890 890
  */
891
-function _wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) {
891
+function _wp_specialchars($string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false) {
892 892
 	$string = (string) $string;
893 893
 
894
-	if ( 0 === strlen( $string ) )
894
+	if (0 === strlen($string))
895 895
 		return '';
896 896
 
897 897
 	// Don't bother if there are no specialchars - saves some processing
898
-	if ( ! preg_match( '/[&<>"\']/', $string ) )
898
+	if ( ! preg_match('/[&<>"\']/', $string))
899 899
 		return $string;
900 900
 
901 901
 	// Account for the previous behaviour of the function when the $quote_style is not an accepted value
902
-	if ( empty( $quote_style ) )
902
+	if (empty($quote_style))
903 903
 		$quote_style = ENT_NOQUOTES;
904
-	elseif ( ! in_array( $quote_style, array( 0, 2, 3, 'single', 'double' ), true ) )
904
+	elseif ( ! in_array($quote_style, array(0, 2, 3, 'single', 'double'), true))
905 905
 		$quote_style = ENT_QUOTES;
906 906
 
907 907
 	// Store the site charset as a static to avoid multiple calls to wp_load_alloptions()
908
-	if ( ! $charset ) {
908
+	if ( ! $charset) {
909 909
 		static $_charset = null;
910
-		if ( ! isset( $_charset ) ) {
910
+		if ( ! isset($_charset)) {
911 911
 			$alloptions = wp_load_alloptions();
912
-			$_charset = isset( $alloptions['blog_charset'] ) ? $alloptions['blog_charset'] : '';
912
+			$_charset = isset($alloptions['blog_charset']) ? $alloptions['blog_charset'] : '';
913 913
 		}
914 914
 		$charset = $_charset;
915 915
 	}
916 916
 
917
-	if ( in_array( $charset, array( 'utf8', 'utf-8', 'UTF8' ) ) )
917
+	if (in_array($charset, array('utf8', 'utf-8', 'UTF8')))
918 918
 		$charset = 'UTF-8';
919 919
 
920 920
 	$_quote_style = $quote_style;
921 921
 
922
-	if ( $quote_style === 'double' ) {
922
+	if ($quote_style === 'double') {
923 923
 		$quote_style = ENT_COMPAT;
924 924
 		$_quote_style = ENT_COMPAT;
925
-	} elseif ( $quote_style === 'single' ) {
925
+	} elseif ($quote_style === 'single') {
926 926
 		$quote_style = ENT_NOQUOTES;
927 927
 	}
928 928
 
929
-	if ( ! $double_encode ) {
929
+	if ( ! $double_encode) {
930 930
 		// Guarantee every &entity; is valid, convert &garbage; into &amp;garbage;
931 931
 		// This is required for PHP < 5.4.0 because ENT_HTML401 flag is unavailable.
932
-		$string = wp_kses_normalize_entities( $string );
932
+		$string = wp_kses_normalize_entities($string);
933 933
 	}
934 934
 
935
-	$string = @htmlspecialchars( $string, $quote_style, $charset, $double_encode );
935
+	$string = @htmlspecialchars($string, $quote_style, $charset, $double_encode);
936 936
 
937 937
 	// Backwards compatibility
938
-	if ( 'single' === $_quote_style )
939
-		$string = str_replace( "'", '&#039;', $string );
938
+	if ('single' === $_quote_style)
939
+		$string = str_replace("'", '&#039;', $string);
940 940
 
941 941
 	return $string;
942 942
 }
@@ -961,52 +961,52 @@  discard block
 block discarded – undo
961 961
  *                                Default is ENT_NOQUOTES.
962 962
  * @return string The decoded text without HTML entities.
963 963
  */
964
-function wp_specialchars_decode( $string, $quote_style = ENT_NOQUOTES ) {
964
+function wp_specialchars_decode($string, $quote_style = ENT_NOQUOTES) {
965 965
 	$string = (string) $string;
966 966
 
967
-	if ( 0 === strlen( $string ) ) {
967
+	if (0 === strlen($string)) {
968 968
 		return '';
969 969
 	}
970 970
 
971 971
 	// Don't bother if there are no entities - saves a lot of processing
972
-	if ( strpos( $string, '&' ) === false ) {
972
+	if (strpos($string, '&') === false) {
973 973
 		return $string;
974 974
 	}
975 975
 
976 976
 	// Match the previous behaviour of _wp_specialchars() when the $quote_style is not an accepted value
977
-	if ( empty( $quote_style ) ) {
977
+	if (empty($quote_style)) {
978 978
 		$quote_style = ENT_NOQUOTES;
979
-	} elseif ( !in_array( $quote_style, array( 0, 2, 3, 'single', 'double' ), true ) ) {
979
+	} elseif ( ! in_array($quote_style, array(0, 2, 3, 'single', 'double'), true)) {
980 980
 		$quote_style = ENT_QUOTES;
981 981
 	}
982 982
 
983 983
 	// More complete than get_html_translation_table( HTML_SPECIALCHARS )
984
-	$single = array( '&#039;'  => '\'', '&#x27;' => '\'' );
985
-	$single_preg = array( '/&#0*39;/'  => '&#039;', '/&#x0*27;/i' => '&#x27;' );
986
-	$double = array( '&quot;' => '"', '&#034;'  => '"', '&#x22;' => '"' );
987
-	$double_preg = array( '/&#0*34;/'  => '&#034;', '/&#x0*22;/i' => '&#x22;' );
988
-	$others = array( '&lt;'   => '<', '&#060;'  => '<', '&gt;'   => '>', '&#062;'  => '>', '&amp;'  => '&', '&#038;'  => '&', '&#x26;' => '&' );
989
-	$others_preg = array( '/&#0*60;/'  => '&#060;', '/&#0*62;/'  => '&#062;', '/&#0*38;/'  => '&#038;', '/&#x0*26;/i' => '&#x26;' );
990
-
991
-	if ( $quote_style === ENT_QUOTES ) {
992
-		$translation = array_merge( $single, $double, $others );
993
-		$translation_preg = array_merge( $single_preg, $double_preg, $others_preg );
994
-	} elseif ( $quote_style === ENT_COMPAT || $quote_style === 'double' ) {
995
-		$translation = array_merge( $double, $others );
996
-		$translation_preg = array_merge( $double_preg, $others_preg );
997
-	} elseif ( $quote_style === 'single' ) {
998
-		$translation = array_merge( $single, $others );
999
-		$translation_preg = array_merge( $single_preg, $others_preg );
1000
-	} elseif ( $quote_style === ENT_NOQUOTES ) {
984
+	$single = array('&#039;'  => '\'', '&#x27;' => '\'');
985
+	$single_preg = array('/&#0*39;/'  => '&#039;', '/&#x0*27;/i' => '&#x27;');
986
+	$double = array('&quot;' => '"', '&#034;'  => '"', '&#x22;' => '"');
987
+	$double_preg = array('/&#0*34;/'  => '&#034;', '/&#x0*22;/i' => '&#x22;');
988
+	$others = array('&lt;'   => '<', '&#060;'  => '<', '&gt;'   => '>', '&#062;'  => '>', '&amp;'  => '&', '&#038;'  => '&', '&#x26;' => '&');
989
+	$others_preg = array('/&#0*60;/'  => '&#060;', '/&#0*62;/'  => '&#062;', '/&#0*38;/'  => '&#038;', '/&#x0*26;/i' => '&#x26;');
990
+
991
+	if ($quote_style === ENT_QUOTES) {
992
+		$translation = array_merge($single, $double, $others);
993
+		$translation_preg = array_merge($single_preg, $double_preg, $others_preg);
994
+	} elseif ($quote_style === ENT_COMPAT || $quote_style === 'double') {
995
+		$translation = array_merge($double, $others);
996
+		$translation_preg = array_merge($double_preg, $others_preg);
997
+	} elseif ($quote_style === 'single') {
998
+		$translation = array_merge($single, $others);
999
+		$translation_preg = array_merge($single_preg, $others_preg);
1000
+	} elseif ($quote_style === ENT_NOQUOTES) {
1001 1001
 		$translation = $others;
1002 1002
 		$translation_preg = $others_preg;
1003 1003
 	}
1004 1004
 
1005 1005
 	// Remove zero padding on numeric entities
1006
-	$string = preg_replace( array_keys( $translation_preg ), array_values( $translation_preg ), $string );
1006
+	$string = preg_replace(array_keys($translation_preg), array_values($translation_preg), $string);
1007 1007
 
1008 1008
 	// Replace characters according to translation table
1009
-	return strtr( $string, $translation );
1009
+	return strtr($string, $translation);
1010 1010
 }
1011 1011
 
1012 1012
 /**
@@ -1021,40 +1021,40 @@  discard block
 block discarded – undo
1021 1021
  * @param bool    $strip Optional. Whether to attempt to strip out invalid UTF8. Default is false.
1022 1022
  * @return string The checked text.
1023 1023
  */
1024
-function wp_check_invalid_utf8( $string, $strip = false ) {
1024
+function wp_check_invalid_utf8($string, $strip = false) {
1025 1025
 	$string = (string) $string;
1026 1026
 
1027
-	if ( 0 === strlen( $string ) ) {
1027
+	if (0 === strlen($string)) {
1028 1028
 		return '';
1029 1029
 	}
1030 1030
 
1031 1031
 	// Store the site charset as a static to avoid multiple calls to get_option()
1032 1032
 	static $is_utf8 = null;
1033
-	if ( ! isset( $is_utf8 ) ) {
1034
-		$is_utf8 = in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) );
1033
+	if ( ! isset($is_utf8)) {
1034
+		$is_utf8 = in_array(get_option('blog_charset'), array('utf8', 'utf-8', 'UTF8', 'UTF-8'));
1035 1035
 	}
1036
-	if ( ! $is_utf8 ) {
1036
+	if ( ! $is_utf8) {
1037 1037
 		return $string;
1038 1038
 	}
1039 1039
 
1040 1040
 	// Check for support for utf8 in the installed PCRE library once and store the result in a static
1041 1041
 	static $utf8_pcre = null;
1042
-	if ( ! isset( $utf8_pcre ) ) {
1043
-		$utf8_pcre = @preg_match( '/^./u', 'a' );
1042
+	if ( ! isset($utf8_pcre)) {
1043
+		$utf8_pcre = @preg_match('/^./u', 'a');
1044 1044
 	}
1045 1045
 	// We can't demand utf8 in the PCRE installation, so just return the string in those cases
1046
-	if ( !$utf8_pcre ) {
1046
+	if ( ! $utf8_pcre) {
1047 1047
 		return $string;
1048 1048
 	}
1049 1049
 
1050 1050
 	// preg_match fails when it encounters invalid UTF8 in $string
1051
-	if ( 1 === @preg_match( '/^./us', $string ) ) {
1051
+	if (1 === @preg_match('/^./us', $string)) {
1052 1052
 		return $string;
1053 1053
 	}
1054 1054
 
1055 1055
 	// Attempt to strip the bad chars if requested (not recommended)
1056
-	if ( $strip && function_exists( 'iconv' ) ) {
1057
-		return iconv( 'utf-8', 'utf-8', $string );
1056
+	if ($strip && function_exists('iconv')) {
1057
+		return iconv('utf-8', 'utf-8', $string);
1058 1058
 	}
1059 1059
 
1060 1060
 	return '';
@@ -1069,30 +1069,30 @@  discard block
 block discarded – undo
1069 1069
  * @param int    $length Max  length of the string
1070 1070
  * @return string String with Unicode encoded for URI.
1071 1071
  */
1072
-function utf8_uri_encode( $utf8_string, $length = 0 ) {
1072
+function utf8_uri_encode($utf8_string, $length = 0) {
1073 1073
 	$unicode = '';
1074 1074
 	$values = array();
1075 1075
 	$num_octets = 1;
1076 1076
 	$unicode_length = 0;
1077 1077
 
1078 1078
 	mbstring_binary_safe_encoding();
1079
-	$string_length = strlen( $utf8_string );
1079
+	$string_length = strlen($utf8_string);
1080 1080
 	reset_mbstring_encoding();
1081 1081
 
1082
-	for ($i = 0; $i < $string_length; $i++ ) {
1082
+	for ($i = 0; $i < $string_length; $i++) {
1083 1083
 
1084
-		$value = ord( $utf8_string[ $i ] );
1084
+		$value = ord($utf8_string[$i]);
1085 1085
 
1086
-		if ( $value < 128 ) {
1087
-			if ( $length && ( $unicode_length >= $length ) )
1086
+		if ($value < 128) {
1087
+			if ($length && ($unicode_length >= $length))
1088 1088
 				break;
1089 1089
 			$unicode .= chr($value);
1090 1090
 			$unicode_length++;
1091 1091
 		} else {
1092
-			if ( count( $values ) == 0 ) {
1093
-				if ( $value < 224 ) {
1092
+			if (count($values) == 0) {
1093
+				if ($value < 224) {
1094 1094
 					$num_octets = 2;
1095
-				} elseif ( $value < 240 ) {
1095
+				} elseif ($value < 240) {
1096 1096
 					$num_octets = 3;
1097 1097
 				} else {
1098 1098
 					$num_octets = 4;
@@ -1101,11 +1101,11 @@  discard block
 block discarded – undo
1101 1101
 
1102 1102
 			$values[] = $value;
1103 1103
 
1104
-			if ( $length && ( $unicode_length + ($num_octets * 3) ) > $length )
1104
+			if ($length && ($unicode_length + ($num_octets * 3)) > $length)
1105 1105
 				break;
1106
-			if ( count( $values ) == $num_octets ) {
1107
-				for ( $j = 0; $j < $num_octets; $j++ ) {
1108
-					$unicode .= '%' . dechex( $values[ $j ] );
1106
+			if (count($values) == $num_octets) {
1107
+				for ($j = 0; $j < $num_octets; $j++) {
1108
+					$unicode .= '%'.dechex($values[$j]);
1109 1109
 				}
1110 1110
 
1111 1111
 				$unicode_length += $num_octets * 3;
@@ -1129,8 +1129,8 @@  discard block
 block discarded – undo
1129 1129
  * @param string $string Text that might have accent characters
1130 1130
  * @return string Filtered string with replaced "nice" characters.
1131 1131
  */
1132
-function remove_accents( $string ) {
1133
-	if ( !preg_match('/[\x80-\xff]/', $string) )
1132
+function remove_accents($string) {
1133
+	if ( ! preg_match('/[\x80-\xff]/', $string))
1134 1134
 		return $string;
1135 1135
 
1136 1136
 	if (seems_utf8($string)) {
@@ -1140,7 +1140,7 @@  discard block
 block discarded – undo
1140 1140
 		chr(195).chr(128) => 'A', chr(195).chr(129) => 'A',
1141 1141
 		chr(195).chr(130) => 'A', chr(195).chr(131) => 'A',
1142 1142
 		chr(195).chr(132) => 'A', chr(195).chr(133) => 'A',
1143
-		chr(195).chr(134) => 'AE',chr(195).chr(135) => 'C',
1143
+		chr(195).chr(134) => 'AE', chr(195).chr(135) => 'C',
1144 1144
 		chr(195).chr(136) => 'E', chr(195).chr(137) => 'E',
1145 1145
 		chr(195).chr(138) => 'E', chr(195).chr(139) => 'E',
1146 1146
 		chr(195).chr(140) => 'I', chr(195).chr(141) => 'I',
@@ -1151,11 +1151,11 @@  discard block
 block discarded – undo
1151 1151
 		chr(195).chr(150) => 'O', chr(195).chr(153) => 'U',
1152 1152
 		chr(195).chr(154) => 'U', chr(195).chr(155) => 'U',
1153 1153
 		chr(195).chr(156) => 'U', chr(195).chr(157) => 'Y',
1154
-		chr(195).chr(158) => 'TH',chr(195).chr(159) => 's',
1154
+		chr(195).chr(158) => 'TH', chr(195).chr(159) => 's',
1155 1155
 		chr(195).chr(160) => 'a', chr(195).chr(161) => 'a',
1156 1156
 		chr(195).chr(162) => 'a', chr(195).chr(163) => 'a',
1157 1157
 		chr(195).chr(164) => 'a', chr(195).chr(165) => 'a',
1158
-		chr(195).chr(166) => 'ae',chr(195).chr(167) => 'c',
1158
+		chr(195).chr(166) => 'ae', chr(195).chr(167) => 'c',
1159 1159
 		chr(195).chr(168) => 'e', chr(195).chr(169) => 'e',
1160 1160
 		chr(195).chr(170) => 'e', chr(195).chr(171) => 'e',
1161 1161
 		chr(195).chr(172) => 'i', chr(195).chr(173) => 'i',
@@ -1194,7 +1194,7 @@  discard block
 block discarded – undo
1194 1194
 		chr(196).chr(172) => 'I', chr(196).chr(173) => 'i',
1195 1195
 		chr(196).chr(174) => 'I', chr(196).chr(175) => 'i',
1196 1196
 		chr(196).chr(176) => 'I', chr(196).chr(177) => 'i',
1197
-		chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij',
1197
+		chr(196).chr(178) => 'IJ', chr(196).chr(179) => 'ij',
1198 1198
 		chr(196).chr(180) => 'J', chr(196).chr(181) => 'j',
1199 1199
 		chr(196).chr(182) => 'K', chr(196).chr(183) => 'k',
1200 1200
 		chr(196).chr(184) => 'k', chr(196).chr(185) => 'L',
@@ -1210,13 +1210,13 @@  discard block
 block discarded – undo
1210 1210
 		chr(197).chr(140) => 'O', chr(197).chr(141) => 'o',
1211 1211
 		chr(197).chr(142) => 'O', chr(197).chr(143) => 'o',
1212 1212
 		chr(197).chr(144) => 'O', chr(197).chr(145) => 'o',
1213
-		chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe',
1214
-		chr(197).chr(148) => 'R',chr(197).chr(149) => 'r',
1215
-		chr(197).chr(150) => 'R',chr(197).chr(151) => 'r',
1216
-		chr(197).chr(152) => 'R',chr(197).chr(153) => 'r',
1217
-		chr(197).chr(154) => 'S',chr(197).chr(155) => 's',
1218
-		chr(197).chr(156) => 'S',chr(197).chr(157) => 's',
1219
-		chr(197).chr(158) => 'S',chr(197).chr(159) => 's',
1213
+		chr(197).chr(146) => 'OE', chr(197).chr(147) => 'oe',
1214
+		chr(197).chr(148) => 'R', chr(197).chr(149) => 'r',
1215
+		chr(197).chr(150) => 'R', chr(197).chr(151) => 'r',
1216
+		chr(197).chr(152) => 'R', chr(197).chr(153) => 'r',
1217
+		chr(197).chr(154) => 'S', chr(197).chr(155) => 's',
1218
+		chr(197).chr(156) => 'S', chr(197).chr(157) => 's',
1219
+		chr(197).chr(158) => 'S', chr(197).chr(159) => 's',
1220 1220
 		chr(197).chr(160) => 'S', chr(197).chr(161) => 's',
1221 1221
 		chr(197).chr(162) => 'T', chr(197).chr(163) => 't',
1222 1222
 		chr(197).chr(164) => 'T', chr(197).chr(165) => 't',
@@ -1313,21 +1313,21 @@  discard block
 block discarded – undo
1313 1313
 		// Used for locale-specific rules
1314 1314
 		$locale = get_locale();
1315 1315
 
1316
-		if ( 'de_DE' == $locale || 'de_DE_formal' == $locale ) {
1317
-			$chars[ chr(195).chr(132) ] = 'Ae';
1318
-			$chars[ chr(195).chr(164) ] = 'ae';
1319
-			$chars[ chr(195).chr(150) ] = 'Oe';
1320
-			$chars[ chr(195).chr(182) ] = 'oe';
1321
-			$chars[ chr(195).chr(156) ] = 'Ue';
1322
-			$chars[ chr(195).chr(188) ] = 'ue';
1323
-			$chars[ chr(195).chr(159) ] = 'ss';
1324
-		} elseif ( 'da_DK' === $locale ) {
1325
-			$chars[ chr(195).chr(134) ] = 'Ae';
1326
- 			$chars[ chr(195).chr(166) ] = 'ae';
1327
-			$chars[ chr(195).chr(152) ] = 'Oe';
1328
-			$chars[ chr(195).chr(184) ] = 'oe';
1329
-			$chars[ chr(195).chr(133) ] = 'Aa';
1330
-			$chars[ chr(195).chr(165) ] = 'aa';
1316
+		if ('de_DE' == $locale || 'de_DE_formal' == $locale) {
1317
+			$chars[chr(195).chr(132)] = 'Ae';
1318
+			$chars[chr(195).chr(164)] = 'ae';
1319
+			$chars[chr(195).chr(150)] = 'Oe';
1320
+			$chars[chr(195).chr(182)] = 'oe';
1321
+			$chars[chr(195).chr(156)] = 'Ue';
1322
+			$chars[chr(195).chr(188)] = 'ue';
1323
+			$chars[chr(195).chr(159)] = 'ss';
1324
+		} elseif ('da_DK' === $locale) {
1325
+			$chars[chr(195).chr(134)] = 'Ae';
1326
+ 			$chars[chr(195).chr(166)] = 'ae';
1327
+			$chars[chr(195).chr(152)] = 'Oe';
1328
+			$chars[chr(195).chr(184)] = 'oe';
1329
+			$chars[chr(195).chr(133)] = 'Aa';
1330
+			$chars[chr(195).chr(165)] = 'aa';
1331 1331
 		}
1332 1332
 
1333 1333
 		$string = strtr($string, $chars);
@@ -1371,7 +1371,7 @@  discard block
 block discarded – undo
1371 1371
  * @param string $filename The filename to be sanitized
1372 1372
  * @return string The sanitized filename
1373 1373
  */
1374
-function sanitize_file_name( $filename ) {
1374
+function sanitize_file_name($filename) {
1375 1375
 	$filename_raw = $filename;
1376 1376
 	$special_chars = array("?", "[", "]", "/", "\\", "=", "<", ">", ":", ";", ",", "'", "\"", "&", "$", "#", "*", "(", ")", "|", "~", "`", "!", "{", "}", "%", "+", chr(0));
1377 1377
 	/**
@@ -1382,18 +1382,18 @@  discard block
 block discarded – undo
1382 1382
 	 * @param array  $special_chars Characters to remove.
1383 1383
 	 * @param string $filename_raw  Filename as it was passed into sanitize_file_name().
1384 1384
 	 */
1385
-	$special_chars = apply_filters( 'sanitize_file_name_chars', $special_chars, $filename_raw );
1386
-	$filename = preg_replace( "#\x{00a0}#siu", ' ', $filename );
1387
-	$filename = str_replace( $special_chars, '', $filename );
1388
-	$filename = str_replace( array( '%20', '+' ), '-', $filename );
1389
-	$filename = preg_replace( '/[\r\n\t -]+/', '-', $filename );
1390
-	$filename = trim( $filename, '.-_' );
1385
+	$special_chars = apply_filters('sanitize_file_name_chars', $special_chars, $filename_raw);
1386
+	$filename = preg_replace("#\x{00a0}#siu", ' ', $filename);
1387
+	$filename = str_replace($special_chars, '', $filename);
1388
+	$filename = str_replace(array('%20', '+'), '-', $filename);
1389
+	$filename = preg_replace('/[\r\n\t -]+/', '-', $filename);
1390
+	$filename = trim($filename, '.-_');
1391 1391
 
1392 1392
 	// Split the filename into a base and extension[s]
1393 1393
 	$parts = explode('.', $filename);
1394 1394
 
1395 1395
 	// Return if only one extension
1396
-	if ( count( $parts ) <= 2 ) {
1396
+	if (count($parts) <= 2) {
1397 1397
 		/**
1398 1398
 		 * Filter a sanitized filename string.
1399 1399
 		 *
@@ -1402,7 +1402,7 @@  discard block
 block discarded – undo
1402 1402
 		 * @param string $filename     Sanitized filename.
1403 1403
 		 * @param string $filename_raw The filename prior to sanitization.
1404 1404
 		 */
1405
-		return apply_filters( 'sanitize_file_name', $filename, $filename_raw );
1405
+		return apply_filters('sanitize_file_name', $filename, $filename_raw);
1406 1406
 	}
1407 1407
 
1408 1408
 	// Process multiple extensions
@@ -1414,23 +1414,23 @@  discard block
 block discarded – undo
1414 1414
 	 * Loop over any intermediate extensions. Postfix them with a trailing underscore
1415 1415
 	 * if they are a 2 - 5 character long alpha string not in the extension whitelist.
1416 1416
 	 */
1417
-	foreach ( (array) $parts as $part) {
1418
-		$filename .= '.' . $part;
1417
+	foreach ((array) $parts as $part) {
1418
+		$filename .= '.'.$part;
1419 1419
 
1420
-		if ( preg_match("/^[a-zA-Z]{2,5}\d?$/", $part) ) {
1420
+		if (preg_match("/^[a-zA-Z]{2,5}\d?$/", $part)) {
1421 1421
 			$allowed = false;
1422
-			foreach ( $mimes as $ext_preg => $mime_match ) {
1423
-				$ext_preg = '!^(' . $ext_preg . ')$!i';
1424
-				if ( preg_match( $ext_preg, $part ) ) {
1422
+			foreach ($mimes as $ext_preg => $mime_match) {
1423
+				$ext_preg = '!^('.$ext_preg.')$!i';
1424
+				if (preg_match($ext_preg, $part)) {
1425 1425
 					$allowed = true;
1426 1426
 					break;
1427 1427
 				}
1428 1428
 			}
1429
-			if ( !$allowed )
1429
+			if ( ! $allowed)
1430 1430
 				$filename .= '_';
1431 1431
 		}
1432 1432
 	}
1433
-	$filename .= '.' . $extension;
1433
+	$filename .= '.'.$extension;
1434 1434
 	/** This filter is documented in wp-includes/formatting.php */
1435 1435
 	return apply_filters('sanitize_file_name', $filename, $filename_raw);
1436 1436
 }
@@ -1449,21 +1449,21 @@  discard block
 block discarded – undo
1449 1449
  * @param bool   $strict   If set limits $username to specific characters. Default false.
1450 1450
  * @return string The sanitized username, after passing through filters.
1451 1451
  */
1452
-function sanitize_user( $username, $strict = false ) {
1452
+function sanitize_user($username, $strict = false) {
1453 1453
 	$raw_username = $username;
1454
-	$username = wp_strip_all_tags( $username );
1455
-	$username = remove_accents( $username );
1454
+	$username = wp_strip_all_tags($username);
1455
+	$username = remove_accents($username);
1456 1456
 	// Kill octets
1457
-	$username = preg_replace( '|%([a-fA-F0-9][a-fA-F0-9])|', '', $username );
1458
-	$username = preg_replace( '/&.+?;/', '', $username ); // Kill entities
1457
+	$username = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '', $username);
1458
+	$username = preg_replace('/&.+?;/', '', $username); // Kill entities
1459 1459
 
1460 1460
 	// If strict, reduce to ASCII for max portability.
1461
-	if ( $strict )
1462
-		$username = preg_replace( '|[^a-z0-9 _.\-@]|i', '', $username );
1461
+	if ($strict)
1462
+		$username = preg_replace('|[^a-z0-9 _.\-@]|i', '', $username);
1463 1463
 
1464
-	$username = trim( $username );
1464
+	$username = trim($username);
1465 1465
 	// Consolidate contiguous whitespace
1466
-	$username = preg_replace( '|\s+|', ' ', $username );
1466
+	$username = preg_replace('|\s+|', ' ', $username);
1467 1467
 
1468 1468
 	/**
1469 1469
 	 * Filter a sanitized username string.
@@ -1474,7 +1474,7 @@  discard block
 block discarded – undo
1474 1474
 	 * @param string $raw_username The username prior to sanitization.
1475 1475
 	 * @param bool   $strict       Whether to limit the sanitization to specific characters. Default false.
1476 1476
 	 */
1477
-	return apply_filters( 'sanitize_user', $username, $raw_username, $strict );
1477
+	return apply_filters('sanitize_user', $username, $raw_username, $strict);
1478 1478
 }
1479 1479
 
1480 1480
 /**
@@ -1487,10 +1487,10 @@  discard block
 block discarded – undo
1487 1487
  * @param string $key String key
1488 1488
  * @return string Sanitized key
1489 1489
  */
1490
-function sanitize_key( $key ) {
1490
+function sanitize_key($key) {
1491 1491
 	$raw_key = $key;
1492
-	$key = strtolower( $key );
1493
-	$key = preg_replace( '/[^a-z0-9_\-]/', '', $key );
1492
+	$key = strtolower($key);
1493
+	$key = preg_replace('/[^a-z0-9_\-]/', '', $key);
1494 1494
 
1495 1495
 	/**
1496 1496
 	 * Filter a sanitized key string.
@@ -1500,7 +1500,7 @@  discard block
 block discarded – undo
1500 1500
 	 * @param string $key     Sanitized key.
1501 1501
 	 * @param string $raw_key The key prior to sanitization.
1502 1502
 	 */
1503
-	return apply_filters( 'sanitize_key', $key, $raw_key );
1503
+	return apply_filters('sanitize_key', $key, $raw_key);
1504 1504
 }
1505 1505
 
1506 1506
 /**
@@ -1517,10 +1517,10 @@  discard block
 block discarded – undo
1517 1517
  * @param string $context        Optional. The operation for which the string is sanitized
1518 1518
  * @return string The sanitized string.
1519 1519
  */
1520
-function sanitize_title( $title, $fallback_title = '', $context = 'save' ) {
1520
+function sanitize_title($title, $fallback_title = '', $context = 'save') {
1521 1521
 	$raw_title = $title;
1522 1522
 
1523
-	if ( 'save' == $context )
1523
+	if ('save' == $context)
1524 1524
 		$title = remove_accents($title);
1525 1525
 
1526 1526
 	/**
@@ -1532,9 +1532,9 @@  discard block
 block discarded – undo
1532 1532
 	 * @param string $raw_title The title prior to sanitization.
1533 1533
 	 * @param string $context   The context for which the title is being sanitized.
1534 1534
 	 */
1535
-	$title = apply_filters( 'sanitize_title', $title, $raw_title, $context );
1535
+	$title = apply_filters('sanitize_title', $title, $raw_title, $context);
1536 1536
 
1537
-	if ( '' === $title || false === $title )
1537
+	if ('' === $title || false === $title)
1538 1538
 		$title = $fallback_title;
1539 1539
 
1540 1540
 	return $title;
@@ -1550,8 +1550,8 @@  discard block
 block discarded – undo
1550 1550
  * @param string $title The string to be sanitized.
1551 1551
  * @return string The sanitized string.
1552 1552
  */
1553
-function sanitize_title_for_query( $title ) {
1554
-	return sanitize_title( $title, '', 'query' );
1553
+function sanitize_title_for_query($title) {
1554
+	return sanitize_title($title, '', 'query');
1555 1555
 }
1556 1556
 
1557 1557
 /**
@@ -1567,7 +1567,7 @@  discard block
 block discarded – undo
1567 1567
  * @param string $context   Optional. The operation for which the string is sanitized.
1568 1568
  * @return string The sanitized title.
1569 1569
  */
1570
-function sanitize_title_with_dashes( $title, $raw_title = '', $context = 'display' ) {
1570
+function sanitize_title_with_dashes($title, $raw_title = '', $context = 'display') {
1571 1571
 	$title = strip_tags($title);
1572 1572
 	// Preserve escaped octets.
1573 1573
 	$title = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $title);
@@ -1585,14 +1585,14 @@  discard block
 block discarded – undo
1585 1585
 
1586 1586
 	$title = strtolower($title);
1587 1587
 
1588
-	if ( 'save' == $context ) {
1588
+	if ('save' == $context) {
1589 1589
 		// Convert nbsp, ndash and mdash to hyphens
1590
-		$title = str_replace( array( '%c2%a0', '%e2%80%93', '%e2%80%94' ), '-', $title );
1590
+		$title = str_replace(array('%c2%a0', '%e2%80%93', '%e2%80%94'), '-', $title);
1591 1591
 		// Convert nbsp, ndash and mdash HTML entities to hyphens
1592
-		$title = str_replace( array( '&nbsp;', '&#160;', '&ndash;', '&#8211;', '&mdash;', '&#8212;' ), '-', $title );
1592
+		$title = str_replace(array('&nbsp;', '&#160;', '&ndash;', '&#8211;', '&mdash;', '&#8212;'), '-', $title);
1593 1593
 
1594 1594
 		// Strip these characters entirely
1595
-		$title = str_replace( array(
1595
+		$title = str_replace(array(
1596 1596
 			// iexcl and iquest
1597 1597
 			'%c2%a1', '%c2%bf',
1598 1598
 			// angle quotes
@@ -1606,10 +1606,10 @@  discard block
 block discarded – undo
1606 1606
 			'%c2%b4', '%cb%8a', '%cc%81', '%cd%81',
1607 1607
 			// grave accent, macron, caron
1608 1608
 			'%cc%80', '%cc%84', '%cc%8c',
1609
-		), '', $title );
1609
+		), '', $title);
1610 1610
 
1611 1611
 		// Convert times to x
1612
-		$title = str_replace( '%c3%97', 'x', $title );
1612
+		$title = str_replace('%c3%97', 'x', $title);
1613 1613
 	}
1614 1614
 
1615 1615
 	$title = preg_replace('/&.+?;/', '', $title); // kill entities
@@ -1636,8 +1636,8 @@  discard block
 block discarded – undo
1636 1636
  * @param string $orderby Order by clause to be validated.
1637 1637
  * @return string|false Returns $orderby if valid, false otherwise.
1638 1638
  */
1639
-function sanitize_sql_orderby( $orderby ) {
1640
-	if ( preg_match( '/^\s*(([a-z0-9_]+|`[a-z0-9_]+`)(\s+(ASC|DESC))?\s*(,\s*(?=[a-z0-9_`])|$))+$/i', $orderby ) || preg_match( '/^\s*RAND\(\s*\)\s*$/i', $orderby ) ) {
1639
+function sanitize_sql_orderby($orderby) {
1640
+	if (preg_match('/^\s*(([a-z0-9_]+|`[a-z0-9_]+`)(\s+(ASC|DESC))?\s*(,\s*(?=[a-z0-9_`])|$))+$/i', $orderby) || preg_match('/^\s*RAND\(\s*\)\s*$/i', $orderby)) {
1641 1641
 		return $orderby;
1642 1642
 	}
1643 1643
 	return false;
@@ -1658,15 +1658,15 @@  discard block
 block discarded – undo
1658 1658
  * 	Defaults to an empty string.
1659 1659
  * @return string The sanitized value
1660 1660
  */
1661
-function sanitize_html_class( $class, $fallback = '' ) {
1661
+function sanitize_html_class($class, $fallback = '') {
1662 1662
 	//Strip out any % encoded octets
1663
-	$sanitized = preg_replace( '|%[a-fA-F0-9][a-fA-F0-9]|', '', $class );
1663
+	$sanitized = preg_replace('|%[a-fA-F0-9][a-fA-F0-9]|', '', $class);
1664 1664
 
1665 1665
 	//Limit to A-Z,a-z,0-9,_,-
1666
-	$sanitized = preg_replace( '/[^A-Za-z0-9_-]/', '', $sanitized );
1666
+	$sanitized = preg_replace('/[^A-Za-z0-9_-]/', '', $sanitized);
1667 1667
 
1668
-	if ( '' == $sanitized && $fallback ) {
1669
-		return sanitize_html_class( $fallback );
1668
+	if ('' == $sanitized && $fallback) {
1669
+		return sanitize_html_class($fallback);
1670 1670
 	}
1671 1671
 	/**
1672 1672
 	 * Filter a sanitized HTML class string.
@@ -1677,7 +1677,7 @@  discard block
 block discarded – undo
1677 1677
 	 * @param string $class     HTML class before sanitization.
1678 1678
 	 * @param string $fallback  The fallback string.
1679 1679
 	 */
1680
-	return apply_filters( 'sanitize_html_class', $sanitized, $class, $fallback );
1680
+	return apply_filters('sanitize_html_class', $sanitized, $class, $fallback);
1681 1681
 }
1682 1682
 
1683 1683
 /**
@@ -1689,13 +1689,13 @@  discard block
 block discarded – undo
1689 1689
  * @param string $deprecated Not used.
1690 1690
  * @return string Converted string.
1691 1691
  */
1692
-function convert_chars( $content, $deprecated = '' ) {
1693
-	if ( ! empty( $deprecated ) ) {
1694
-		_deprecated_argument( __FUNCTION__, '0.71' );
1692
+function convert_chars($content, $deprecated = '') {
1693
+	if ( ! empty($deprecated)) {
1694
+		_deprecated_argument(__FUNCTION__, '0.71');
1695 1695
 	}
1696 1696
 
1697
-	if ( strpos( $content, '&' ) !== false ) {
1698
-		$content = preg_replace( '/&([^#])(?![a-z1-4]{1,8};)/i', '&#038;$1', $content );
1697
+	if (strpos($content, '&') !== false) {
1698
+		$content = preg_replace('/&([^#])(?![a-z1-4]{1,8};)/i', '&#038;$1', $content);
1699 1699
 	}
1700 1700
 
1701 1701
 	return $content;
@@ -1709,12 +1709,12 @@  discard block
 block discarded – undo
1709 1709
  * @param string $content String with entities that need converting.
1710 1710
  * @return string Converted string.
1711 1711
  */
1712
-function convert_invalid_entities( $content ) {
1712
+function convert_invalid_entities($content) {
1713 1713
 	$wp_htmltranswinuni = array(
1714 1714
 		'&#128;' => '&#8364;', // the Euro sign
1715 1715
 		'&#129;' => '',
1716 1716
 		'&#130;' => '&#8218;', // these are Windows CP1252 specific characters
1717
-		'&#131;' => '&#402;',  // they would look weird on non-Windows browsers
1717
+		'&#131;' => '&#402;', // they would look weird on non-Windows browsers
1718 1718
 		'&#132;' => '&#8222;',
1719 1719
 		'&#133;' => '&#8230;',
1720 1720
 		'&#134;' => '&#8224;',
@@ -1745,8 +1745,8 @@  discard block
 block discarded – undo
1745 1745
 		'&#159;' => '&#376;'
1746 1746
 	);
1747 1747
 
1748
-	if ( strpos( $content, '&#1' ) !== false ) {
1749
-		$content = strtr( $content, $wp_htmltranswinuni );
1748
+	if (strpos($content, '&#1') !== false) {
1749
+		$content = strtr($content, $wp_htmltranswinuni);
1750 1750
 	}
1751 1751
 
1752 1752
 	return $content;
@@ -1761,9 +1761,9 @@  discard block
 block discarded – undo
1761 1761
  * @param bool   $force If true, forces balancing, ignoring the value of the option. Default false.
1762 1762
  * @return string Balanced text
1763 1763
  */
1764
-function balanceTags( $text, $force = false ) {
1765
-	if ( $force || get_option('use_balanceTags') == 1 ) {
1766
-		return force_balance_tags( $text );
1764
+function balanceTags($text, $force = false) {
1765
+	if ($force || get_option('use_balanceTags') == 1) {
1766
+		return force_balance_tags($text);
1767 1767
 	} else {
1768 1768
 		return $text;
1769 1769
 	}
@@ -1787,22 +1787,22 @@  discard block
 block discarded – undo
1787 1787
  * @param string $text Text to be balanced.
1788 1788
  * @return string Balanced text.
1789 1789
  */
1790
-function force_balance_tags( $text ) {
1790
+function force_balance_tags($text) {
1791 1791
 	$tagstack = array();
1792 1792
 	$stacksize = 0;
1793 1793
 	$tagqueue = '';
1794 1794
 	$newtext = '';
1795 1795
 	// Known single-entity/self-closing tags
1796
-	$single_tags = array( 'area', 'base', 'basefont', 'br', 'col', 'command', 'embed', 'frame', 'hr', 'img', 'input', 'isindex', 'link', 'meta', 'param', 'source' );
1796
+	$single_tags = array('area', 'base', 'basefont', 'br', 'col', 'command', 'embed', 'frame', 'hr', 'img', 'input', 'isindex', 'link', 'meta', 'param', 'source');
1797 1797
 	// Tags that can be immediately nested within themselves
1798
-	$nestable_tags = array( 'blockquote', 'div', 'object', 'q', 'span' );
1798
+	$nestable_tags = array('blockquote', 'div', 'object', 'q', 'span');
1799 1799
 
1800 1800
 	// WP bug fix for comments - in case you REALLY meant to type '< !--'
1801 1801
 	$text = str_replace('< !--', '<    !--', $text);
1802 1802
 	// WP bug fix for LOVE <3 (and other situations with '<' before a number)
1803 1803
 	$text = preg_replace('#<([0-9]{1})#', '&lt;$1', $text);
1804 1804
 
1805
-	while ( preg_match("/<(\/?[\w:]*)\s*([^>]*)>/", $text, $regex) ) {
1805
+	while (preg_match("/<(\/?[\w:]*)\s*([^>]*)>/", $text, $regex)) {
1806 1806
 		$newtext .= $tagqueue;
1807 1807
 
1808 1808
 		$i = strpos($text, $regex[0]);
@@ -1811,25 +1811,25 @@  discard block
 block discarded – undo
1811 1811
 		// clear the shifter
1812 1812
 		$tagqueue = '';
1813 1813
 		// Pop or Push
1814
-		if ( isset($regex[1][0]) && '/' == $regex[1][0] ) { // End Tag
1815
-			$tag = strtolower(substr($regex[1],1));
1814
+		if (isset($regex[1][0]) && '/' == $regex[1][0]) { // End Tag
1815
+			$tag = strtolower(substr($regex[1], 1));
1816 1816
 			// if too many closing tags
1817
-			if ( $stacksize <= 0 ) {
1817
+			if ($stacksize <= 0) {
1818 1818
 				$tag = '';
1819 1819
 				// or close to be safe $tag = '/' . $tag;
1820 1820
 			}
1821 1821
 			// if stacktop value = tag close value then pop
1822
-			elseif ( $tagstack[$stacksize - 1] == $tag ) { // found closing tag
1823
-				$tag = '</' . $tag . '>'; // Close Tag
1822
+			elseif ($tagstack[$stacksize - 1] == $tag) { // found closing tag
1823
+				$tag = '</'.$tag.'>'; // Close Tag
1824 1824
 				// Pop
1825
-				array_pop( $tagstack );
1825
+				array_pop($tagstack);
1826 1826
 				$stacksize--;
1827 1827
 			} else { // closing tag not at top, search for it
1828
-				for ( $j = $stacksize-1; $j >= 0; $j-- ) {
1829
-					if ( $tagstack[$j] == $tag ) {
1828
+				for ($j = $stacksize - 1; $j >= 0; $j--) {
1829
+					if ($tagstack[$j] == $tag) {
1830 1830
 					// add tag to tagqueue
1831
-						for ( $k = $stacksize-1; $k >= $j; $k--) {
1832
-							$tagqueue .= '</' . array_pop( $tagstack ) . '>';
1831
+						for ($k = $stacksize - 1; $k >= $j; $k--) {
1832
+							$tagqueue .= '</'.array_pop($tagstack).'>';
1833 1833
 							$stacksize--;
1834 1834
 						}
1835 1835
 						break;
@@ -1843,43 +1843,43 @@  discard block
 block discarded – undo
1843 1843
 			// Tag Cleaning
1844 1844
 
1845 1845
 			// If it's an empty tag "< >", do nothing
1846
-			if ( '' == $tag ) {
1846
+			if ('' == $tag) {
1847 1847
 				// do nothing
1848 1848
 			}
1849 1849
 			// ElseIf it presents itself as a self-closing tag...
1850
-			elseif ( substr( $regex[2], -1 ) == '/' ) {
1850
+			elseif (substr($regex[2], -1) == '/') {
1851 1851
 				// ...but it isn't a known single-entity self-closing tag, then don't let it be treated as such and
1852 1852
 				// immediately close it with a closing tag (the tag will encapsulate no text as a result)
1853
-				if ( ! in_array( $tag, $single_tags ) )
1854
-					$regex[2] = trim( substr( $regex[2], 0, -1 ) ) . "></$tag";
1853
+				if ( ! in_array($tag, $single_tags))
1854
+					$regex[2] = trim(substr($regex[2], 0, -1))."></$tag";
1855 1855
 			}
1856 1856
 			// ElseIf it's a known single-entity tag but it doesn't close itself, do so
1857
-			elseif ( in_array($tag, $single_tags) ) {
1857
+			elseif (in_array($tag, $single_tags)) {
1858 1858
 				$regex[2] .= '/';
1859 1859
 			}
1860 1860
 			// Else it's not a single-entity tag
1861 1861
 			else {
1862 1862
 				// If the top of the stack is the same as the tag we want to push, close previous tag
1863
-				if ( $stacksize > 0 && !in_array($tag, $nestable_tags) && $tagstack[$stacksize - 1] == $tag ) {
1864
-					$tagqueue = '</' . array_pop( $tagstack ) . '>';
1863
+				if ($stacksize > 0 && ! in_array($tag, $nestable_tags) && $tagstack[$stacksize - 1] == $tag) {
1864
+					$tagqueue = '</'.array_pop($tagstack).'>';
1865 1865
 					$stacksize--;
1866 1866
 				}
1867
-				$stacksize = array_push( $tagstack, $tag );
1867
+				$stacksize = array_push($tagstack, $tag);
1868 1868
 			}
1869 1869
 
1870 1870
 			// Attributes
1871 1871
 			$attributes = $regex[2];
1872
-			if ( ! empty( $attributes ) && $attributes[0] != '>' )
1873
-				$attributes = ' ' . $attributes;
1872
+			if ( ! empty($attributes) && $attributes[0] != '>')
1873
+				$attributes = ' '.$attributes;
1874 1874
 
1875
-			$tag = '<' . $tag . $attributes . '>';
1875
+			$tag = '<'.$tag.$attributes.'>';
1876 1876
 			//If already queuing a close tag, then put this tag on, too
1877
-			if ( !empty($tagqueue) ) {
1877
+			if ( ! empty($tagqueue)) {
1878 1878
 				$tagqueue .= $tag;
1879 1879
 				$tag = '';
1880 1880
 			}
1881 1881
 		}
1882
-		$newtext .= substr($text, 0, $i) . $tag;
1882
+		$newtext .= substr($text, 0, $i).$tag;
1883 1883
 		$text = substr($text, $i + $l);
1884 1884
 	}
1885 1885
 
@@ -1890,12 +1890,12 @@  discard block
 block discarded – undo
1890 1890
 	$newtext .= $text;
1891 1891
 
1892 1892
 	// Empty Stack
1893
-	while( $x = array_pop($tagstack) )
1894
-		$newtext .= '</' . $x . '>'; // Add remaining tags to close
1893
+	while ($x = array_pop($tagstack))
1894
+		$newtext .= '</'.$x.'>'; // Add remaining tags to close
1895 1895
 
1896 1896
 	// WP fix for the bug with HTML comments
1897
-	$newtext = str_replace("< !--","<!--",$newtext);
1898
-	$newtext = str_replace("<    !--","< !--",$newtext);
1897
+	$newtext = str_replace("< !--", "<!--", $newtext);
1898
+	$newtext = str_replace("<    !--", "< !--", $newtext);
1899 1899
 
1900 1900
 	return $newtext;
1901 1901
 }
@@ -1916,7 +1916,7 @@  discard block
 block discarded – undo
1916 1916
  *                          Default false.
1917 1917
  * @return string The text after the filter (and possibly htmlspecialchars()) has been run.
1918 1918
  */
1919
-function format_to_edit( $content, $rich_text = false ) {
1919
+function format_to_edit($content, $rich_text = false) {
1920 1920
 	/**
1921 1921
 	 * Filter the text to be formatted for editing.
1922 1922
 	 *
@@ -1924,9 +1924,9 @@  discard block
 block discarded – undo
1924 1924
 	 *
1925 1925
 	 * @param string $content The text, prior to formatting for editing.
1926 1926
 	 */
1927
-	$content = apply_filters( 'format_to_edit', $content );
1928
-	if ( ! $rich_text )
1929
-		$content = esc_textarea( $content );
1927
+	$content = apply_filters('format_to_edit', $content);
1928
+	if ( ! $rich_text)
1929
+		$content = esc_textarea($content);
1930 1930
 	return $content;
1931 1931
 }
1932 1932
 
@@ -1947,8 +1947,8 @@  discard block
 block discarded – undo
1947 1947
  * @param int $threshold  Digit places number needs to be to not have zeros added.
1948 1948
  * @return string Adds leading zeros to number if needed.
1949 1949
  */
1950
-function zeroise( $number, $threshold ) {
1951
-	return sprintf( '%0' . $threshold . 's', $number );
1950
+function zeroise($number, $threshold) {
1951
+	return sprintf('%0'.$threshold.'s', $number);
1952 1952
 }
1953 1953
 
1954 1954
 /**
@@ -1959,10 +1959,10 @@  discard block
 block discarded – undo
1959 1959
  * @param string $string Value to which backslashes will be added.
1960 1960
  * @return string String with backslashes inserted.
1961 1961
  */
1962
-function backslashit( $string ) {
1963
-	if ( isset( $string[0] ) && $string[0] >= '0' && $string[0] <= '9' )
1964
-		$string = '\\\\' . $string;
1965
-	return addcslashes( $string, 'A..Za..z' );
1962
+function backslashit($string) {
1963
+	if (isset($string[0]) && $string[0] >= '0' && $string[0] <= '9')
1964
+		$string = '\\\\'.$string;
1965
+	return addcslashes($string, 'A..Za..z');
1966 1966
 }
1967 1967
 
1968 1968
 /**
@@ -1979,8 +1979,8 @@  discard block
 block discarded – undo
1979 1979
  * @param string $string What to add the trailing slash to.
1980 1980
  * @return string String with trailing slash added.
1981 1981
  */
1982
-function trailingslashit( $string ) {
1983
-	return untrailingslashit( $string ) . '/';
1982
+function trailingslashit($string) {
1983
+	return untrailingslashit($string).'/';
1984 1984
 }
1985 1985
 
1986 1986
 /**
@@ -1994,8 +1994,8 @@  discard block
 block discarded – undo
1994 1994
  * @param string $string What to remove the trailing slashes from.
1995 1995
  * @return string String without the trailing slashes.
1996 1996
  */
1997
-function untrailingslashit( $string ) {
1998
-	return rtrim( $string, '/\\' );
1997
+function untrailingslashit($string) {
1998
+	return rtrim($string, '/\\');
1999 1999
 }
2000 2000
 
2001 2001
 /**
@@ -2010,7 +2010,7 @@  discard block
 block discarded – undo
2010 2010
  * @return string Returns a string escaped with slashes.
2011 2011
  */
2012 2012
 function addslashes_gpc($gpc) {
2013
-	if ( get_magic_quotes_gpc() )
2013
+	if (get_magic_quotes_gpc())
2014 2014
 		$gpc = stripslashes($gpc);
2015 2015
 
2016 2016
 	return wp_slash($gpc);
@@ -2024,8 +2024,8 @@  discard block
 block discarded – undo
2024 2024
  * @param mixed $value The value to be stripped.
2025 2025
  * @return mixed Stripped value.
2026 2026
  */
2027
-function stripslashes_deep( $value ) {
2028
-	return map_deep( $value, 'stripslashes_from_strings_only' );
2027
+function stripslashes_deep($value) {
2028
+	return map_deep($value, 'stripslashes_from_strings_only');
2029 2029
 }
2030 2030
 
2031 2031
 /**
@@ -2036,8 +2036,8 @@  discard block
 block discarded – undo
2036 2036
  * @param mixed $value The array or string to be stripped.
2037 2037
  * @return mixed $value The stripped value.
2038 2038
  */
2039
-function stripslashes_from_strings_only( $value ) {
2040
-	return is_string( $value ) ? stripslashes( $value ) : $value;
2039
+function stripslashes_from_strings_only($value) {
2040
+	return is_string($value) ? stripslashes($value) : $value;
2041 2041
 }
2042 2042
 
2043 2043
 /**
@@ -2048,8 +2048,8 @@  discard block
 block discarded – undo
2048 2048
  * @param mixed $value The array or string to be encoded.
2049 2049
  * @return mixed $value The encoded value.
2050 2050
  */
2051
-function urlencode_deep( $value ) {
2052
-	return map_deep( $value, 'urlencode' );
2051
+function urlencode_deep($value) {
2052
+	return map_deep($value, 'urlencode');
2053 2053
 }
2054 2054
 
2055 2055
 /**
@@ -2060,8 +2060,8 @@  discard block
 block discarded – undo
2060 2060
  * @param mixed $value The array or string to be encoded.
2061 2061
  * @return mixed $value The encoded value.
2062 2062
  */
2063
-function rawurlencode_deep( $value ) {
2064
-	return map_deep( $value, 'rawurlencode' );
2063
+function rawurlencode_deep($value) {
2064
+	return map_deep($value, 'rawurlencode');
2065 2065
 }
2066 2066
 
2067 2067
 /**
@@ -2072,8 +2072,8 @@  discard block
 block discarded – undo
2072 2072
  * @param mixed $value The array or string to be decoded.
2073 2073
  * @return mixed $value The decoded value.
2074 2074
  */
2075
-function urldecode_deep( $value ) {
2076
-	return map_deep( $value, 'urldecode' );
2075
+function urldecode_deep($value) {
2076
+	return map_deep($value, 'urldecode');
2077 2077
 }
2078 2078
 
2079 2079
 /**
@@ -2085,20 +2085,20 @@  discard block
 block discarded – undo
2085 2085
  * @param int    $hex_encoding  Optional. Set to 1 to enable hex encoding.
2086 2086
  * @return string Converted email address.
2087 2087
  */
2088
-function antispambot( $email_address, $hex_encoding = 0 ) {
2088
+function antispambot($email_address, $hex_encoding = 0) {
2089 2089
 	$email_no_spam_address = '';
2090
-	for ( $i = 0, $len = strlen( $email_address ); $i < $len; $i++ ) {
2091
-		$j = rand( 0, 1 + $hex_encoding );
2092
-		if ( $j == 0 ) {
2093
-			$email_no_spam_address .= '&#' . ord( $email_address[$i] ) . ';';
2094
-		} elseif ( $j == 1 ) {
2090
+	for ($i = 0, $len = strlen($email_address); $i < $len; $i++) {
2091
+		$j = rand(0, 1 + $hex_encoding);
2092
+		if ($j == 0) {
2093
+			$email_no_spam_address .= '&#'.ord($email_address[$i]).';';
2094
+		} elseif ($j == 1) {
2095 2095
 			$email_no_spam_address .= $email_address[$i];
2096
-		} elseif ( $j == 2 ) {
2097
-			$email_no_spam_address .= '%' . zeroise( dechex( ord( $email_address[$i] ) ), 2 );
2096
+		} elseif ($j == 2) {
2097
+			$email_no_spam_address .= '%'.zeroise(dechex(ord($email_address[$i])), 2);
2098 2098
 		}
2099 2099
 	}
2100 2100
 
2101
-	return str_replace( '@', '&#64;', $email_no_spam_address );
2101
+	return str_replace('@', '&#64;', $email_no_spam_address);
2102 2102
 }
2103 2103
 
2104 2104
 /**
@@ -2113,10 +2113,10 @@  discard block
 block discarded – undo
2113 2113
  * @param array $matches Single Regex Match.
2114 2114
  * @return string HTML A element with URI address.
2115 2115
  */
2116
-function _make_url_clickable_cb( $matches ) {
2116
+function _make_url_clickable_cb($matches) {
2117 2117
 	$url = $matches[2];
2118 2118
 
2119
-	if ( ')' == $matches[3] && strpos( $url, '(' ) ) {
2119
+	if (')' == $matches[3] && strpos($url, '(')) {
2120 2120
 		// If the trailing character is a closing parethesis, and the URL has an opening parenthesis in it, add the closing parenthesis to the URL.
2121 2121
 		// Then we can let the parenthesis balancer do its thing below.
2122 2122
 		$url .= $matches[3];
@@ -2126,16 +2126,16 @@  discard block
 block discarded – undo
2126 2126
 	}
2127 2127
 
2128 2128
 	// Include parentheses in the URL only if paired
2129
-	while ( substr_count( $url, '(' ) < substr_count( $url, ')' ) ) {
2130
-		$suffix = strrchr( $url, ')' ) . $suffix;
2131
-		$url = substr( $url, 0, strrpos( $url, ')' ) );
2129
+	while (substr_count($url, '(') < substr_count($url, ')')) {
2130
+		$suffix = strrchr($url, ')').$suffix;
2131
+		$url = substr($url, 0, strrpos($url, ')'));
2132 2132
 	}
2133 2133
 
2134 2134
 	$url = esc_url($url);
2135
-	if ( empty($url) )
2135
+	if (empty($url))
2136 2136
 		return $matches[0];
2137 2137
 
2138
-	return $matches[1] . "<a href=\"$url\" rel=\"nofollow\">$url</a>" . $suffix;
2138
+	return $matches[1]."<a href=\"$url\" rel=\"nofollow\">$url</a>".$suffix;
2139 2139
 }
2140 2140
 
2141 2141
 /**
@@ -2150,22 +2150,22 @@  discard block
 block discarded – undo
2150 2150
  * @param array $matches Single Regex Match.
2151 2151
  * @return string HTML A element with URL address.
2152 2152
  */
2153
-function _make_web_ftp_clickable_cb( $matches ) {
2153
+function _make_web_ftp_clickable_cb($matches) {
2154 2154
 	$ret = '';
2155 2155
 	$dest = $matches[2];
2156
-	$dest = 'http://' . $dest;
2156
+	$dest = 'http://'.$dest;
2157 2157
 
2158 2158
 	// removed trailing [.,;:)] from URL
2159
-	if ( in_array( substr($dest, -1), array('.', ',', ';', ':', ')') ) === true ) {
2159
+	if (in_array(substr($dest, -1), array('.', ',', ';', ':', ')')) === true) {
2160 2160
 		$ret = substr($dest, -1);
2161
-		$dest = substr($dest, 0, strlen($dest)-1);
2161
+		$dest = substr($dest, 0, strlen($dest) - 1);
2162 2162
 	}
2163 2163
 
2164 2164
 	$dest = esc_url($dest);
2165
-	if ( empty($dest) )
2165
+	if (empty($dest))
2166 2166
 		return $matches[0];
2167 2167
 
2168
-	return $matches[1] . "<a href=\"$dest\" rel=\"nofollow\">$dest</a>$ret";
2168
+	return $matches[1]."<a href=\"$dest\" rel=\"nofollow\">$dest</a>$ret";
2169 2169
 }
2170 2170
 
2171 2171
 /**
@@ -2180,9 +2180,9 @@  discard block
 block discarded – undo
2180 2180
  * @param array $matches Single Regex Match.
2181 2181
  * @return string HTML A element with email address.
2182 2182
  */
2183
-function _make_email_clickable_cb( $matches ) {
2184
-	$email = $matches[2] . '@' . $matches[3];
2185
-	return $matches[1] . "<a href=\"mailto:$email\">$email</a>";
2183
+function _make_email_clickable_cb($matches) {
2184
+	$email = $matches[2].'@'.$matches[3];
2185
+	return $matches[1]."<a href=\"mailto:$email\">$email</a>";
2186 2186
 }
2187 2187
 
2188 2188
 /**
@@ -2196,30 +2196,30 @@  discard block
 block discarded – undo
2196 2196
  * @param string $text Content to convert URIs.
2197 2197
  * @return string Content with converted URIs.
2198 2198
  */
2199
-function make_clickable( $text ) {
2199
+function make_clickable($text) {
2200 2200
 	$r = '';
2201
-	$textarr = preg_split( '/(<[^<>]+>)/', $text, -1, PREG_SPLIT_DELIM_CAPTURE ); // split out HTML tags
2201
+	$textarr = preg_split('/(<[^<>]+>)/', $text, -1, PREG_SPLIT_DELIM_CAPTURE); // split out HTML tags
2202 2202
 	$nested_code_pre = 0; // Keep track of how many levels link is nested inside <pre> or <code>
2203
-	foreach ( $textarr as $piece ) {
2203
+	foreach ($textarr as $piece) {
2204 2204
 
2205
-		if ( preg_match( '|^<code[\s>]|i', $piece ) || preg_match( '|^<pre[\s>]|i', $piece ) || preg_match( '|^<script[\s>]|i', $piece ) || preg_match( '|^<style[\s>]|i', $piece ) )
2205
+		if (preg_match('|^<code[\s>]|i', $piece) || preg_match('|^<pre[\s>]|i', $piece) || preg_match('|^<script[\s>]|i', $piece) || preg_match('|^<style[\s>]|i', $piece))
2206 2206
 			$nested_code_pre++;
2207
-		elseif ( $nested_code_pre && ( '</code>' === strtolower( $piece ) || '</pre>' === strtolower( $piece ) || '</script>' === strtolower( $piece ) || '</style>' === strtolower( $piece ) ) )
2207
+		elseif ($nested_code_pre && ('</code>' === strtolower($piece) || '</pre>' === strtolower($piece) || '</script>' === strtolower($piece) || '</style>' === strtolower($piece)))
2208 2208
 			$nested_code_pre--;
2209 2209
 
2210
-		if ( $nested_code_pre || empty( $piece ) || ( $piece[0] === '<' && ! preg_match( '|^<\s*[\w]{1,20}+://|', $piece ) ) ) {
2210
+		if ($nested_code_pre || empty($piece) || ($piece[0] === '<' && ! preg_match('|^<\s*[\w]{1,20}+://|', $piece))) {
2211 2211
 			$r .= $piece;
2212 2212
 			continue;
2213 2213
 		}
2214 2214
 
2215 2215
 		// Long strings might contain expensive edge cases ...
2216
-		if ( 10000 < strlen( $piece ) ) {
2216
+		if (10000 < strlen($piece)) {
2217 2217
 			// ... break it up
2218
-			foreach ( _split_str_by_whitespace( $piece, 2100 ) as $chunk ) { // 2100: Extra room for scheme and leading and trailing paretheses
2219
-				if ( 2101 < strlen( $chunk ) ) {
2218
+			foreach (_split_str_by_whitespace($piece, 2100) as $chunk) { // 2100: Extra room for scheme and leading and trailing paretheses
2219
+				if (2101 < strlen($chunk)) {
2220 2220
 					$r .= $chunk; // Too big, no whitespace: bail.
2221 2221
 				} else {
2222
-					$r .= make_clickable( $chunk );
2222
+					$r .= make_clickable($chunk);
2223 2223
 				}
2224 2224
 			}
2225 2225
 		} else {
@@ -2240,18 +2240,18 @@  discard block
 block discarded – undo
2240 2240
 			~xS'; // The regex is a non-anchored pattern and does not have a single fixed starting character.
2241 2241
 			      // Tell PCRE to spend more time optimizing since, when used on a page load, it will probably be used several times.
2242 2242
 
2243
-			$ret = preg_replace_callback( $url_clickable, '_make_url_clickable_cb', $ret );
2243
+			$ret = preg_replace_callback($url_clickable, '_make_url_clickable_cb', $ret);
2244 2244
 
2245
-			$ret = preg_replace_callback( '#([\s>])((www|ftp)\.[\w\\x80-\\xff\#$%&~/.\-;:=,?@\[\]+]+)#is', '_make_web_ftp_clickable_cb', $ret );
2246
-			$ret = preg_replace_callback( '#([\s>])([.0-9a-z_+-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,})#i', '_make_email_clickable_cb', $ret );
2245
+			$ret = preg_replace_callback('#([\s>])((www|ftp)\.[\w\\x80-\\xff\#$%&~/.\-;:=,?@\[\]+]+)#is', '_make_web_ftp_clickable_cb', $ret);
2246
+			$ret = preg_replace_callback('#([\s>])([.0-9a-z_+-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,})#i', '_make_email_clickable_cb', $ret);
2247 2247
 
2248
-			$ret = substr( $ret, 1, -1 ); // Remove our whitespace padding.
2248
+			$ret = substr($ret, 1, -1); // Remove our whitespace padding.
2249 2249
 			$r .= $ret;
2250 2250
 		}
2251 2251
 	}
2252 2252
 
2253 2253
 	// Cleanup of accidental links within links
2254
-	return preg_replace( '#(<a([ \r\n\t]+[^>]+?>|>))<a [^>]+?>([^>]+?)</a></a>#i', "$1$3</a>", $r );
2254
+	return preg_replace('#(<a([ \r\n\t]+[^>]+?>|>))<a [^>]+?>([^>]+?)</a></a>#i', "$1$3</a>", $r);
2255 2255
 }
2256 2256
 
2257 2257
 /**
@@ -2283,27 +2283,27 @@  discard block
 block discarded – undo
2283 2283
  * @param int    $goal   The desired chunk length.
2284 2284
  * @return array Numeric array of chunks.
2285 2285
  */
2286
-function _split_str_by_whitespace( $string, $goal ) {
2286
+function _split_str_by_whitespace($string, $goal) {
2287 2287
 	$chunks = array();
2288 2288
 
2289
-	$string_nullspace = strtr( $string, "\r\n\t\v\f ", "\000\000\000\000\000\000" );
2289
+	$string_nullspace = strtr($string, "\r\n\t\v\f ", "\000\000\000\000\000\000");
2290 2290
 
2291
-	while ( $goal < strlen( $string_nullspace ) ) {
2292
-		$pos = strrpos( substr( $string_nullspace, 0, $goal + 1 ), "\000" );
2291
+	while ($goal < strlen($string_nullspace)) {
2292
+		$pos = strrpos(substr($string_nullspace, 0, $goal + 1), "\000");
2293 2293
 
2294
-		if ( false === $pos ) {
2295
-			$pos = strpos( $string_nullspace, "\000", $goal + 1 );
2296
-			if ( false === $pos ) {
2294
+		if (false === $pos) {
2295
+			$pos = strpos($string_nullspace, "\000", $goal + 1);
2296
+			if (false === $pos) {
2297 2297
 				break;
2298 2298
 			}
2299 2299
 		}
2300 2300
 
2301
-		$chunks[] = substr( $string, 0, $pos + 1 );
2302
-		$string = substr( $string, $pos + 1 );
2303
-		$string_nullspace = substr( $string_nullspace, $pos + 1 );
2301
+		$chunks[] = substr($string, 0, $pos + 1);
2302
+		$string = substr($string, $pos + 1);
2303
+		$string_nullspace = substr($string_nullspace, $pos + 1);
2304 2304
 	}
2305 2305
 
2306
-	if ( $string ) {
2306
+	if ($string) {
2307 2307
 		$chunks[] = $string;
2308 2308
 	}
2309 2309
 
@@ -2318,11 +2318,11 @@  discard block
 block discarded – undo
2318 2318
  * @param string $text Content that may contain HTML A elements.
2319 2319
  * @return string Converted content.
2320 2320
  */
2321
-function wp_rel_nofollow( $text ) {
2321
+function wp_rel_nofollow($text) {
2322 2322
 	// This is a pre save filter, so text is already escaped.
2323 2323
 	$text = stripslashes($text);
2324 2324
 	$text = preg_replace_callback('|<a (.+?)>|i', 'wp_rel_nofollow_callback', $text);
2325
-	return wp_slash( $text );
2325
+	return wp_slash($text);
2326 2326
 }
2327 2327
 
2328 2328
 /**
@@ -2336,30 +2336,30 @@  discard block
 block discarded – undo
2336 2336
  * @param array $matches Single Match
2337 2337
  * @return string HTML A Element with rel nofollow.
2338 2338
  */
2339
-function wp_rel_nofollow_callback( $matches ) {
2339
+function wp_rel_nofollow_callback($matches) {
2340 2340
 	$text = $matches[1];
2341
-	$atts = shortcode_parse_atts( $matches[1] );
2341
+	$atts = shortcode_parse_atts($matches[1]);
2342 2342
 	$rel  = 'nofollow';
2343 2343
 
2344
-	if ( preg_match( '%href=["\'](' . preg_quote( set_url_scheme( home_url(), 'http' ) ) . ')%i', $text ) ||
2345
-	     preg_match( '%href=["\'](' . preg_quote( set_url_scheme( home_url(), 'https' ) ) . ')%i', $text )
2344
+	if (preg_match('%href=["\']('.preg_quote(set_url_scheme(home_url(), 'http')).')%i', $text) ||
2345
+	     preg_match('%href=["\']('.preg_quote(set_url_scheme(home_url(), 'https')).')%i', $text)
2346 2346
 	) {
2347 2347
 		return "<a $text>";
2348 2348
 	}
2349 2349
 
2350
-	if ( ! empty( $atts['rel'] ) ) {
2351
-		$parts = array_map( 'trim', explode( ' ', $atts['rel'] ) );
2352
-		if ( false === array_search( 'nofollow', $parts ) ) {
2350
+	if ( ! empty($atts['rel'])) {
2351
+		$parts = array_map('trim', explode(' ', $atts['rel']));
2352
+		if (false === array_search('nofollow', $parts)) {
2353 2353
 			$parts[] = 'nofollow';
2354 2354
 		}
2355
-		$rel = implode( ' ', $parts );
2356
-		unset( $atts['rel'] );
2355
+		$rel = implode(' ', $parts);
2356
+		unset($atts['rel']);
2357 2357
 
2358 2358
 		$html = '';
2359
-		foreach ( $atts as $name => $value ) {
2359
+		foreach ($atts as $name => $value) {
2360 2360
 			$html .= "{$name}=\"$value\" ";
2361 2361
 		}
2362
-		$text = trim( $html );
2362
+		$text = trim($html);
2363 2363
 	}
2364 2364
 	return "<a $text rel=\"$rel\">";
2365 2365
 }
@@ -2378,21 +2378,21 @@  discard block
 block discarded – undo
2378 2378
  * @param array $matches Single match. Smiley code to convert to image.
2379 2379
  * @return string Image string for smiley.
2380 2380
  */
2381
-function translate_smiley( $matches ) {
2381
+function translate_smiley($matches) {
2382 2382
 	global $wpsmiliestrans;
2383 2383
 
2384
-	if ( count( $matches ) == 0 )
2384
+	if (count($matches) == 0)
2385 2385
 		return '';
2386 2386
 
2387
-	$smiley = trim( reset( $matches ) );
2388
-	$img = $wpsmiliestrans[ $smiley ];
2387
+	$smiley = trim(reset($matches));
2388
+	$img = $wpsmiliestrans[$smiley];
2389 2389
 
2390 2390
 	$matches = array();
2391
-	$ext = preg_match( '/\.([^.]+)$/', $img, $matches ) ? strtolower( $matches[1] ) : false;
2392
-	$image_exts = array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' );
2391
+	$ext = preg_match('/\.([^.]+)$/', $img, $matches) ? strtolower($matches[1]) : false;
2392
+	$image_exts = array('jpg', 'jpeg', 'jpe', 'gif', 'png');
2393 2393
 
2394 2394
 	// Don't convert smilies that aren't images - they're probably emoji.
2395
-	if ( ! in_array( $ext, $image_exts ) ) {
2395
+	if ( ! in_array($ext, $image_exts)) {
2396 2396
 		return $img;
2397 2397
 	}
2398 2398
 
@@ -2405,9 +2405,9 @@  discard block
 block discarded – undo
2405 2405
 	 * @param string $img        Filename for the smiley image.
2406 2406
 	 * @param string $site_url   Site URL, as returned by site_url().
2407 2407
 	 */
2408
-	$src_url = apply_filters( 'smilies_src', includes_url( "images/smilies/$img" ), $img, site_url() );
2408
+	$src_url = apply_filters('smilies_src', includes_url("images/smilies/$img"), $img, site_url());
2409 2409
 
2410
-	return sprintf( '<img src="%s" alt="%s" class="wp-smiley" style="height: 1em; max-height: 1em;" />', esc_url( $src_url ), esc_attr( $smiley ) );
2410
+	return sprintf('<img src="%s" alt="%s" class="wp-smiley" style="height: 1em; max-height: 1em;" />', esc_url($src_url), esc_attr($smiley));
2411 2411
 }
2412 2412
 
2413 2413
 /**
@@ -2423,33 +2423,33 @@  discard block
 block discarded – undo
2423 2423
  * @param string $text Content to convert smilies from text.
2424 2424
  * @return string Converted content with text smilies replaced with images.
2425 2425
  */
2426
-function convert_smilies( $text ) {
2426
+function convert_smilies($text) {
2427 2427
 	global $wp_smiliessearch;
2428 2428
 	$output = '';
2429
-	if ( get_option( 'use_smilies' ) && ! empty( $wp_smiliessearch ) ) {
2429
+	if (get_option('use_smilies') && ! empty($wp_smiliessearch)) {
2430 2430
 		// HTML loop taken from texturize function, could possible be consolidated
2431
-		$textarr = preg_split( '/(<.*>)/U', $text, -1, PREG_SPLIT_DELIM_CAPTURE ); // capture the tags as well as in between
2432
-		$stop = count( $textarr );// loop stuff
2431
+		$textarr = preg_split('/(<.*>)/U', $text, -1, PREG_SPLIT_DELIM_CAPTURE); // capture the tags as well as in between
2432
+		$stop = count($textarr); // loop stuff
2433 2433
 
2434 2434
 		// Ignore proessing of specific tags
2435 2435
 		$tags_to_ignore = 'code|pre|style|script|textarea';
2436 2436
 		$ignore_block_element = '';
2437 2437
 
2438
-		for ( $i = 0; $i < $stop; $i++ ) {
2438
+		for ($i = 0; $i < $stop; $i++) {
2439 2439
 			$content = $textarr[$i];
2440 2440
 
2441 2441
 			// If we're in an ignore block, wait until we find its closing tag
2442
-			if ( '' == $ignore_block_element && preg_match( '/^<(' . $tags_to_ignore . ')>/', $content, $matches ) )  {
2442
+			if ('' == $ignore_block_element && preg_match('/^<('.$tags_to_ignore.')>/', $content, $matches)) {
2443 2443
 				$ignore_block_element = $matches[1];
2444 2444
 			}
2445 2445
 
2446 2446
 			// If it's not a tag and not in ignore block
2447
-			if ( '' ==  $ignore_block_element && strlen( $content ) > 0 && '<' != $content[0] ) {
2448
-				$content = preg_replace_callback( $wp_smiliessearch, 'translate_smiley', $content );
2447
+			if ('' == $ignore_block_element && strlen($content) > 0 && '<' != $content[0]) {
2448
+				$content = preg_replace_callback($wp_smiliessearch, 'translate_smiley', $content);
2449 2449
 			}
2450 2450
 
2451 2451
 			// did we exit ignore block
2452
-			if ( '' != $ignore_block_element && '</' . $ignore_block_element . '>' == $content )  {
2452
+			if ('' != $ignore_block_element && '</'.$ignore_block_element.'>' == $content) {
2453 2453
 				$ignore_block_element = '';
2454 2454
 			}
2455 2455
 
@@ -2473,12 +2473,12 @@  discard block
 block discarded – undo
2473 2473
  * @param bool   $deprecated Deprecated.
2474 2474
  * @return string|bool Either false or the valid email address.
2475 2475
  */
2476
-function is_email( $email, $deprecated = false ) {
2477
-	if ( ! empty( $deprecated ) )
2478
-		_deprecated_argument( __FUNCTION__, '3.0' );
2476
+function is_email($email, $deprecated = false) {
2477
+	if ( ! empty($deprecated))
2478
+		_deprecated_argument(__FUNCTION__, '3.0');
2479 2479
 
2480 2480
 	// Test for the minimum length the email can be
2481
-	if ( strlen( $email ) < 3 ) {
2481
+	if (strlen($email) < 3) {
2482 2482
 		/**
2483 2483
 		 * Filter whether an email address is valid.
2484 2484
 		 *
@@ -2492,65 +2492,65 @@  discard block
 block discarded – undo
2492 2492
 		 * @param string $email    The email address being checked.
2493 2493
 		 * @param string $context  Context under which the email was tested.
2494 2494
 		 */
2495
-		return apply_filters( 'is_email', false, $email, 'email_too_short' );
2495
+		return apply_filters('is_email', false, $email, 'email_too_short');
2496 2496
 	}
2497 2497
 
2498 2498
 	// Test for an @ character after the first position
2499
-	if ( strpos( $email, '@', 1 ) === false ) {
2499
+	if (strpos($email, '@', 1) === false) {
2500 2500
 		/** This filter is documented in wp-includes/formatting.php */
2501
-		return apply_filters( 'is_email', false, $email, 'email_no_at' );
2501
+		return apply_filters('is_email', false, $email, 'email_no_at');
2502 2502
 	}
2503 2503
 
2504 2504
 	// Split out the local and domain parts
2505
-	list( $local, $domain ) = explode( '@', $email, 2 );
2505
+	list($local, $domain) = explode('@', $email, 2);
2506 2506
 
2507 2507
 	// LOCAL PART
2508 2508
 	// Test for invalid characters
2509
-	if ( !preg_match( '/^[a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.-]+$/', $local ) ) {
2509
+	if ( ! preg_match('/^[a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.-]+$/', $local)) {
2510 2510
 		/** This filter is documented in wp-includes/formatting.php */
2511
-		return apply_filters( 'is_email', false, $email, 'local_invalid_chars' );
2511
+		return apply_filters('is_email', false, $email, 'local_invalid_chars');
2512 2512
 	}
2513 2513
 
2514 2514
 	// DOMAIN PART
2515 2515
 	// Test for sequences of periods
2516
-	if ( preg_match( '/\.{2,}/', $domain ) ) {
2516
+	if (preg_match('/\.{2,}/', $domain)) {
2517 2517
 		/** This filter is documented in wp-includes/formatting.php */
2518
-		return apply_filters( 'is_email', false, $email, 'domain_period_sequence' );
2518
+		return apply_filters('is_email', false, $email, 'domain_period_sequence');
2519 2519
 	}
2520 2520
 
2521 2521
 	// Test for leading and trailing periods and whitespace
2522
-	if ( trim( $domain, " \t\n\r\0\x0B." ) !== $domain ) {
2522
+	if (trim($domain, " \t\n\r\0\x0B.") !== $domain) {
2523 2523
 		/** This filter is documented in wp-includes/formatting.php */
2524
-		return apply_filters( 'is_email', false, $email, 'domain_period_limits' );
2524
+		return apply_filters('is_email', false, $email, 'domain_period_limits');
2525 2525
 	}
2526 2526
 
2527 2527
 	// Split the domain into subs
2528
-	$subs = explode( '.', $domain );
2528
+	$subs = explode('.', $domain);
2529 2529
 
2530 2530
 	// Assume the domain will have at least two subs
2531
-	if ( 2 > count( $subs ) ) {
2531
+	if (2 > count($subs)) {
2532 2532
 		/** This filter is documented in wp-includes/formatting.php */
2533
-		return apply_filters( 'is_email', false, $email, 'domain_no_periods' );
2533
+		return apply_filters('is_email', false, $email, 'domain_no_periods');
2534 2534
 	}
2535 2535
 
2536 2536
 	// Loop through each sub
2537
-	foreach ( $subs as $sub ) {
2537
+	foreach ($subs as $sub) {
2538 2538
 		// Test for leading and trailing hyphens and whitespace
2539
-		if ( trim( $sub, " \t\n\r\0\x0B-" ) !== $sub ) {
2539
+		if (trim($sub, " \t\n\r\0\x0B-") !== $sub) {
2540 2540
 			/** This filter is documented in wp-includes/formatting.php */
2541
-			return apply_filters( 'is_email', false, $email, 'sub_hyphen_limits' );
2541
+			return apply_filters('is_email', false, $email, 'sub_hyphen_limits');
2542 2542
 		}
2543 2543
 
2544 2544
 		// Test for invalid characters
2545
-		if ( !preg_match('/^[a-z0-9-]+$/i', $sub ) ) {
2545
+		if ( ! preg_match('/^[a-z0-9-]+$/i', $sub)) {
2546 2546
 			/** This filter is documented in wp-includes/formatting.php */
2547
-			return apply_filters( 'is_email', false, $email, 'sub_invalid_chars' );
2547
+			return apply_filters('is_email', false, $email, 'sub_invalid_chars');
2548 2548
 		}
2549 2549
 	}
2550 2550
 
2551 2551
 	// Congratulations your email made it!
2552 2552
 	/** This filter is documented in wp-includes/formatting.php */
2553
-	return apply_filters( 'is_email', $email, $email, null );
2553
+	return apply_filters('is_email', $email, $email, null);
2554 2554
 }
2555 2555
 
2556 2556
 /**
@@ -2561,13 +2561,13 @@  discard block
 block discarded – undo
2561 2561
  * @param string $string Subject line
2562 2562
  * @return string Converted string to ASCII
2563 2563
  */
2564
-function wp_iso_descrambler( $string ) {
2564
+function wp_iso_descrambler($string) {
2565 2565
 	/* this may only work with iso-8859-1, I'm afraid */
2566
-	if (!preg_match('#\=\?(.+)\?Q\?(.+)\?\=#i', $string, $matches)) {
2566
+	if ( ! preg_match('#\=\?(.+)\?Q\?(.+)\?\=#i', $string, $matches)) {
2567 2567
 		return $string;
2568 2568
 	} else {
2569 2569
 		$subject = str_replace('_', ' ', $matches[2]);
2570
-		return preg_replace_callback( '#\=([0-9a-f]{2})#i', '_wp_iso_convert', $subject );
2570
+		return preg_replace_callback('#\=([0-9a-f]{2})#i', '_wp_iso_convert', $subject);
2571 2571
 	}
2572 2572
 }
2573 2573
 
@@ -2580,8 +2580,8 @@  discard block
 block discarded – undo
2580 2580
  * @param array $match The preg_replace_callback matches array
2581 2581
  * @return string Converted chars
2582 2582
  */
2583
-function _wp_iso_convert( $match ) {
2584
-	return chr( hexdec( strtolower( $match[1] ) ) );
2583
+function _wp_iso_convert($match) {
2584
+	return chr(hexdec(strtolower($match[1])));
2585 2585
 }
2586 2586
 
2587 2587
 /**
@@ -2598,25 +2598,25 @@  discard block
 block discarded – undo
2598 2598
  * @param string $format The format string for the returned date (default is Y-m-d H:i:s)
2599 2599
  * @return string GMT version of the date provided.
2600 2600
  */
2601
-function get_gmt_from_date( $string, $format = 'Y-m-d H:i:s' ) {
2602
-	$tz = get_option( 'timezone_string' );
2603
-	if ( $tz ) {
2604
-		$datetime = date_create( $string, new DateTimeZone( $tz ) );
2605
-		if ( ! $datetime ) {
2606
-			return gmdate( $format, 0 );
2601
+function get_gmt_from_date($string, $format = 'Y-m-d H:i:s') {
2602
+	$tz = get_option('timezone_string');
2603
+	if ($tz) {
2604
+		$datetime = date_create($string, new DateTimeZone($tz));
2605
+		if ( ! $datetime) {
2606
+			return gmdate($format, 0);
2607 2607
 		}
2608
-		$datetime->setTimezone( new DateTimeZone( 'UTC' ) );
2609
-		$string_gmt = $datetime->format( $format );
2608
+		$datetime->setTimezone(new DateTimeZone('UTC'));
2609
+		$string_gmt = $datetime->format($format);
2610 2610
 	} else {
2611
-		if ( ! preg_match( '#([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})#', $string, $matches ) ) {
2612
-			$datetime = strtotime( $string );
2613
-			if ( false === $datetime ) {
2614
-				return gmdate( $format, 0 );
2611
+		if ( ! preg_match('#([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})#', $string, $matches)) {
2612
+			$datetime = strtotime($string);
2613
+			if (false === $datetime) {
2614
+				return gmdate($format, 0);
2615 2615
 			}
2616
-			return gmdate( $format, $datetime );
2616
+			return gmdate($format, $datetime);
2617 2617
 		}
2618
-		$string_time = gmmktime( $matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1] );
2619
-		$string_gmt = gmdate( $format, $string_time - get_option( 'gmt_offset' ) * HOUR_IN_SECONDS );
2618
+		$string_time = gmmktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
2619
+		$string_gmt = gmdate($format, $string_time - get_option('gmt_offset') * HOUR_IN_SECONDS);
2620 2620
 	}
2621 2621
 	return $string_gmt;
2622 2622
 }
@@ -2635,19 +2635,19 @@  discard block
 block discarded – undo
2635 2635
  * @param string $format The format string for the returned date (default is Y-m-d H:i:s)
2636 2636
  * @return string Formatted date relative to the timezone / GMT offset.
2637 2637
  */
2638
-function get_date_from_gmt( $string, $format = 'Y-m-d H:i:s' ) {
2639
-	$tz = get_option( 'timezone_string' );
2640
-	if ( $tz ) {
2641
-		$datetime = date_create( $string, new DateTimeZone( 'UTC' ) );
2642
-		if ( ! $datetime )
2643
-			return date( $format, 0 );
2644
-		$datetime->setTimezone( new DateTimeZone( $tz ) );
2645
-		$string_localtime = $datetime->format( $format );
2638
+function get_date_from_gmt($string, $format = 'Y-m-d H:i:s') {
2639
+	$tz = get_option('timezone_string');
2640
+	if ($tz) {
2641
+		$datetime = date_create($string, new DateTimeZone('UTC'));
2642
+		if ( ! $datetime)
2643
+			return date($format, 0);
2644
+		$datetime->setTimezone(new DateTimeZone($tz));
2645
+		$string_localtime = $datetime->format($format);
2646 2646
 	} else {
2647
-		if ( ! preg_match('#([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})#', $string, $matches) )
2648
-			return date( $format, 0 );
2649
-		$string_time = gmmktime( $matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1] );
2650
-		$string_localtime = gmdate( $format, $string_time + get_option( 'gmt_offset' ) * HOUR_IN_SECONDS );
2647
+		if ( ! preg_match('#([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})#', $string, $matches))
2648
+			return date($format, 0);
2649
+		$string_time = gmmktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
2650
+		$string_localtime = gmdate($format, $string_time + get_option('gmt_offset') * HOUR_IN_SECONDS);
2651 2651
 	}
2652 2652
 	return $string_localtime;
2653 2653
 }
@@ -2660,7 +2660,7 @@  discard block
 block discarded – undo
2660 2660
  * @param string $timezone Either 'Z' for 0 offset or '±hhmm'.
2661 2661
  * @return int|float The offset in seconds.
2662 2662
  */
2663
-function iso8601_timezone_to_offset( $timezone ) {
2663
+function iso8601_timezone_to_offset($timezone) {
2664 2664
 	// $timezone is either 'Z' or '[+|-]hhmm'
2665 2665
 	if ($timezone == 'Z') {
2666 2666
 		$offset = 0;
@@ -2682,14 +2682,14 @@  discard block
 block discarded – undo
2682 2682
  * @param string $timezone    Optional. If set to GMT returns the time minus gmt_offset. Default is 'user'.
2683 2683
  * @return string The date and time in MySQL DateTime format - Y-m-d H:i:s.
2684 2684
  */
2685
-function iso8601_to_datetime( $date_string, $timezone = 'user' ) {
2685
+function iso8601_to_datetime($date_string, $timezone = 'user') {
2686 2686
 	$timezone = strtolower($timezone);
2687 2687
 
2688 2688
 	if ($timezone == 'gmt') {
2689 2689
 
2690 2690
 		preg_match('#([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(Z|[\+|\-][0-9]{2,4}){0,1}#', $date_string, $date_bits);
2691 2691
 
2692
-		if (!empty($date_bits[7])) { // we have a timezone, so let's compute an offset
2692
+		if ( ! empty($date_bits[7])) { // we have a timezone, so let's compute an offset
2693 2693
 			$offset = iso8601_timezone_to_offset($date_bits[7]);
2694 2694
 		} else { // we don't have a timezone, so we assume user local timezone (not server's!)
2695 2695
 			$offset = HOUR_IN_SECONDS * get_option('gmt_offset');
@@ -2713,9 +2713,9 @@  discard block
 block discarded – undo
2713 2713
  * @param string $email Email address to filter.
2714 2714
  * @return string Filtered email address.
2715 2715
  */
2716
-function sanitize_email( $email ) {
2716
+function sanitize_email($email) {
2717 2717
 	// Test for the minimum length the email can be
2718
-	if ( strlen( $email ) < 3 ) {
2718
+	if (strlen($email) < 3) {
2719 2719
 		/**
2720 2720
 		 * Filter a sanitized email address.
2721 2721
 		 *
@@ -2729,82 +2729,82 @@  discard block
 block discarded – undo
2729 2729
 		 * @param string $email   The email address, as provided to sanitize_email().
2730 2730
 		 * @param string $message A message to pass to the user.
2731 2731
 		 */
2732
-		return apply_filters( 'sanitize_email', '', $email, 'email_too_short' );
2732
+		return apply_filters('sanitize_email', '', $email, 'email_too_short');
2733 2733
 	}
2734 2734
 
2735 2735
 	// Test for an @ character after the first position
2736
-	if ( strpos( $email, '@', 1 ) === false ) {
2736
+	if (strpos($email, '@', 1) === false) {
2737 2737
 		/** This filter is documented in wp-includes/formatting.php */
2738
-		return apply_filters( 'sanitize_email', '', $email, 'email_no_at' );
2738
+		return apply_filters('sanitize_email', '', $email, 'email_no_at');
2739 2739
 	}
2740 2740
 
2741 2741
 	// Split out the local and domain parts
2742
-	list( $local, $domain ) = explode( '@', $email, 2 );
2742
+	list($local, $domain) = explode('@', $email, 2);
2743 2743
 
2744 2744
 	// LOCAL PART
2745 2745
 	// Test for invalid characters
2746
-	$local = preg_replace( '/[^a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.-]/', '', $local );
2747
-	if ( '' === $local ) {
2746
+	$local = preg_replace('/[^a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.-]/', '', $local);
2747
+	if ('' === $local) {
2748 2748
 		/** This filter is documented in wp-includes/formatting.php */
2749
-		return apply_filters( 'sanitize_email', '', $email, 'local_invalid_chars' );
2749
+		return apply_filters('sanitize_email', '', $email, 'local_invalid_chars');
2750 2750
 	}
2751 2751
 
2752 2752
 	// DOMAIN PART
2753 2753
 	// Test for sequences of periods
2754
-	$domain = preg_replace( '/\.{2,}/', '', $domain );
2755
-	if ( '' === $domain ) {
2754
+	$domain = preg_replace('/\.{2,}/', '', $domain);
2755
+	if ('' === $domain) {
2756 2756
 		/** This filter is documented in wp-includes/formatting.php */
2757
-		return apply_filters( 'sanitize_email', '', $email, 'domain_period_sequence' );
2757
+		return apply_filters('sanitize_email', '', $email, 'domain_period_sequence');
2758 2758
 	}
2759 2759
 
2760 2760
 	// Test for leading and trailing periods and whitespace
2761
-	$domain = trim( $domain, " \t\n\r\0\x0B." );
2762
-	if ( '' === $domain ) {
2761
+	$domain = trim($domain, " \t\n\r\0\x0B.");
2762
+	if ('' === $domain) {
2763 2763
 		/** This filter is documented in wp-includes/formatting.php */
2764
-		return apply_filters( 'sanitize_email', '', $email, 'domain_period_limits' );
2764
+		return apply_filters('sanitize_email', '', $email, 'domain_period_limits');
2765 2765
 	}
2766 2766
 
2767 2767
 	// Split the domain into subs
2768
-	$subs = explode( '.', $domain );
2768
+	$subs = explode('.', $domain);
2769 2769
 
2770 2770
 	// Assume the domain will have at least two subs
2771
-	if ( 2 > count( $subs ) ) {
2771
+	if (2 > count($subs)) {
2772 2772
 		/** This filter is documented in wp-includes/formatting.php */
2773
-		return apply_filters( 'sanitize_email', '', $email, 'domain_no_periods' );
2773
+		return apply_filters('sanitize_email', '', $email, 'domain_no_periods');
2774 2774
 	}
2775 2775
 
2776 2776
 	// Create an array that will contain valid subs
2777 2777
 	$new_subs = array();
2778 2778
 
2779 2779
 	// Loop through each sub
2780
-	foreach ( $subs as $sub ) {
2780
+	foreach ($subs as $sub) {
2781 2781
 		// Test for leading and trailing hyphens
2782
-		$sub = trim( $sub, " \t\n\r\0\x0B-" );
2782
+		$sub = trim($sub, " \t\n\r\0\x0B-");
2783 2783
 
2784 2784
 		// Test for invalid characters
2785
-		$sub = preg_replace( '/[^a-z0-9-]+/i', '', $sub );
2785
+		$sub = preg_replace('/[^a-z0-9-]+/i', '', $sub);
2786 2786
 
2787 2787
 		// If there's anything left, add it to the valid subs
2788
-		if ( '' !== $sub ) {
2788
+		if ('' !== $sub) {
2789 2789
 			$new_subs[] = $sub;
2790 2790
 		}
2791 2791
 	}
2792 2792
 
2793 2793
 	// If there aren't 2 or more valid subs
2794
-	if ( 2 > count( $new_subs ) ) {
2794
+	if (2 > count($new_subs)) {
2795 2795
 		/** This filter is documented in wp-includes/formatting.php */
2796
-		return apply_filters( 'sanitize_email', '', $email, 'domain_no_valid_subs' );
2796
+		return apply_filters('sanitize_email', '', $email, 'domain_no_valid_subs');
2797 2797
 	}
2798 2798
 
2799 2799
 	// Join valid subs into the new domain
2800
-	$domain = join( '.', $new_subs );
2800
+	$domain = join('.', $new_subs);
2801 2801
 
2802 2802
 	// Put the email back together
2803
-	$email = $local . '@' . $domain;
2803
+	$email = $local.'@'.$domain;
2804 2804
 
2805 2805
 	// Congratulations your email made it!
2806 2806
 	/** This filter is documented in wp-includes/formatting.php */
2807
-	return apply_filters( 'sanitize_email', $email, $email, null );
2807
+	return apply_filters('sanitize_email', $email, $email, null);
2808 2808
 }
2809 2809
 
2810 2810
 /**
@@ -2819,44 +2819,44 @@  discard block
 block discarded – undo
2819 2819
  * @param int $to   Optional. Unix timestamp to end the time difference. Default becomes time() if not set.
2820 2820
  * @return string Human readable time difference.
2821 2821
  */
2822
-function human_time_diff( $from, $to = '' ) {
2823
-	if ( empty( $to ) ) {
2822
+function human_time_diff($from, $to = '') {
2823
+	if (empty($to)) {
2824 2824
 		$to = time();
2825 2825
 	}
2826 2826
 
2827
-	$diff = (int) abs( $to - $from );
2827
+	$diff = (int) abs($to - $from);
2828 2828
 
2829
-	if ( $diff < HOUR_IN_SECONDS ) {
2830
-		$mins = round( $diff / MINUTE_IN_SECONDS );
2831
-		if ( $mins <= 1 )
2829
+	if ($diff < HOUR_IN_SECONDS) {
2830
+		$mins = round($diff / MINUTE_IN_SECONDS);
2831
+		if ($mins <= 1)
2832 2832
 			$mins = 1;
2833 2833
 		/* translators: min=minute */
2834
-		$since = sprintf( _n( '%s min', '%s mins', $mins ), $mins );
2835
-	} elseif ( $diff < DAY_IN_SECONDS && $diff >= HOUR_IN_SECONDS ) {
2836
-		$hours = round( $diff / HOUR_IN_SECONDS );
2837
-		if ( $hours <= 1 )
2834
+		$since = sprintf(_n('%s min', '%s mins', $mins), $mins);
2835
+	} elseif ($diff < DAY_IN_SECONDS && $diff >= HOUR_IN_SECONDS) {
2836
+		$hours = round($diff / HOUR_IN_SECONDS);
2837
+		if ($hours <= 1)
2838 2838
 			$hours = 1;
2839
-		$since = sprintf( _n( '%s hour', '%s hours', $hours ), $hours );
2840
-	} elseif ( $diff < WEEK_IN_SECONDS && $diff >= DAY_IN_SECONDS ) {
2841
-		$days = round( $diff / DAY_IN_SECONDS );
2842
-		if ( $days <= 1 )
2839
+		$since = sprintf(_n('%s hour', '%s hours', $hours), $hours);
2840
+	} elseif ($diff < WEEK_IN_SECONDS && $diff >= DAY_IN_SECONDS) {
2841
+		$days = round($diff / DAY_IN_SECONDS);
2842
+		if ($days <= 1)
2843 2843
 			$days = 1;
2844
-		$since = sprintf( _n( '%s day', '%s days', $days ), $days );
2845
-	} elseif ( $diff < MONTH_IN_SECONDS && $diff >= WEEK_IN_SECONDS ) {
2846
-		$weeks = round( $diff / WEEK_IN_SECONDS );
2847
-		if ( $weeks <= 1 )
2844
+		$since = sprintf(_n('%s day', '%s days', $days), $days);
2845
+	} elseif ($diff < MONTH_IN_SECONDS && $diff >= WEEK_IN_SECONDS) {
2846
+		$weeks = round($diff / WEEK_IN_SECONDS);
2847
+		if ($weeks <= 1)
2848 2848
 			$weeks = 1;
2849
-		$since = sprintf( _n( '%s week', '%s weeks', $weeks ), $weeks );
2850
-	} elseif ( $diff < YEAR_IN_SECONDS && $diff >= MONTH_IN_SECONDS ) {
2851
-		$months = round( $diff / MONTH_IN_SECONDS );
2852
-		if ( $months <= 1 )
2849
+		$since = sprintf(_n('%s week', '%s weeks', $weeks), $weeks);
2850
+	} elseif ($diff < YEAR_IN_SECONDS && $diff >= MONTH_IN_SECONDS) {
2851
+		$months = round($diff / MONTH_IN_SECONDS);
2852
+		if ($months <= 1)
2853 2853
 			$months = 1;
2854
-		$since = sprintf( _n( '%s month', '%s months', $months ), $months );
2855
-	} elseif ( $diff >= YEAR_IN_SECONDS ) {
2856
-		$years = round( $diff / YEAR_IN_SECONDS );
2857
-		if ( $years <= 1 )
2854
+		$since = sprintf(_n('%s month', '%s months', $months), $months);
2855
+	} elseif ($diff >= YEAR_IN_SECONDS) {
2856
+		$years = round($diff / YEAR_IN_SECONDS);
2857
+		if ($years <= 1)
2858 2858
 			$years = 1;
2859
-		$since = sprintf( _n( '%s year', '%s years', $years ), $years );
2859
+		$since = sprintf(_n('%s year', '%s years', $years), $years);
2860 2860
 	}
2861 2861
 
2862 2862
 	/**
@@ -2869,7 +2869,7 @@  discard block
 block discarded – undo
2869 2869
 	 * @param int    $from  Unix timestamp from which the difference begins.
2870 2870
 	 * @param int    $to    Unix timestamp to end the time difference.
2871 2871
 	 */
2872
-	return apply_filters( 'human_time_diff', $since, $diff, $from, $to );
2872
+	return apply_filters('human_time_diff', $since, $diff, $from, $to);
2873 2873
 }
2874 2874
 
2875 2875
 /**
@@ -2887,15 +2887,15 @@  discard block
 block discarded – undo
2887 2887
  * @param string $text Optional. The excerpt. If set to empty, an excerpt is generated.
2888 2888
  * @return string The excerpt.
2889 2889
  */
2890
-function wp_trim_excerpt( $text = '' ) {
2890
+function wp_trim_excerpt($text = '') {
2891 2891
 	$raw_excerpt = $text;
2892
-	if ( '' == $text ) {
2892
+	if ('' == $text) {
2893 2893
 		$text = get_the_content('');
2894 2894
 
2895
-		$text = strip_shortcodes( $text );
2895
+		$text = strip_shortcodes($text);
2896 2896
 
2897 2897
 		/** This filter is documented in wp-includes/post-template.php */
2898
-		$text = apply_filters( 'the_content', $text );
2898
+		$text = apply_filters('the_content', $text);
2899 2899
 		$text = str_replace(']]>', ']]&gt;', $text);
2900 2900
 
2901 2901
 		/**
@@ -2905,7 +2905,7 @@  discard block
 block discarded – undo
2905 2905
 		 *
2906 2906
 		 * @param int $number The number of words. Default 55.
2907 2907
 		 */
2908
-		$excerpt_length = apply_filters( 'excerpt_length', 55 );
2908
+		$excerpt_length = apply_filters('excerpt_length', 55);
2909 2909
 		/**
2910 2910
 		 * Filter the string in the "more" link displayed after a trimmed excerpt.
2911 2911
 		 *
@@ -2913,8 +2913,8 @@  discard block
 block discarded – undo
2913 2913
 		 *
2914 2914
 		 * @param string $more_string The string shown within the more link.
2915 2915
 		 */
2916
-		$excerpt_more = apply_filters( 'excerpt_more', ' ' . '[&hellip;]' );
2917
-		$text = wp_trim_words( $text, $excerpt_length, $excerpt_more );
2916
+		$excerpt_more = apply_filters('excerpt_more', ' '.'[&hellip;]');
2917
+		$text = wp_trim_words($text, $excerpt_length, $excerpt_more);
2918 2918
 	}
2919 2919
 	/**
2920 2920
 	 * Filter the trimmed excerpt string.
@@ -2924,7 +2924,7 @@  discard block
 block discarded – undo
2924 2924
 	 * @param string $text        The trimmed text.
2925 2925
 	 * @param string $raw_excerpt The text prior to trimming.
2926 2926
 	 */
2927
-	return apply_filters( 'wp_trim_excerpt', $text, $raw_excerpt );
2927
+	return apply_filters('wp_trim_excerpt', $text, $raw_excerpt);
2928 2928
 }
2929 2929
 
2930 2930
 /**
@@ -2941,35 +2941,35 @@  discard block
 block discarded – undo
2941 2941
  * @param string $more      Optional. What to append if $text needs to be trimmed. Default '&hellip;'.
2942 2942
  * @return string Trimmed text.
2943 2943
  */
2944
-function wp_trim_words( $text, $num_words = 55, $more = null ) {
2945
-	if ( null === $more ) {
2946
-		$more = __( '&hellip;' );
2944
+function wp_trim_words($text, $num_words = 55, $more = null) {
2945
+	if (null === $more) {
2946
+		$more = __('&hellip;');
2947 2947
 	}
2948 2948
 
2949 2949
 	$original_text = $text;
2950
-	$text = wp_strip_all_tags( $text );
2950
+	$text = wp_strip_all_tags($text);
2951 2951
 
2952 2952
 	/*
2953 2953
 	 * translators: If your word count is based on single characters (e.g. East Asian characters),
2954 2954
 	 * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.
2955 2955
 	 * Do not translate into your own language.
2956 2956
 	 */
2957
-	if ( strpos( _x( 'words', 'Word count type. Do not translate!' ), 'characters' ) === 0 && preg_match( '/^utf\-?8$/i', get_option( 'blog_charset' ) ) ) {
2958
-		$text = trim( preg_replace( "/[\n\r\t ]+/", ' ', $text ), ' ' );
2959
-		preg_match_all( '/./u', $text, $words_array );
2960
-		$words_array = array_slice( $words_array[0], 0, $num_words + 1 );
2957
+	if (strpos(_x('words', 'Word count type. Do not translate!'), 'characters') === 0 && preg_match('/^utf\-?8$/i', get_option('blog_charset'))) {
2958
+		$text = trim(preg_replace("/[\n\r\t ]+/", ' ', $text), ' ');
2959
+		preg_match_all('/./u', $text, $words_array);
2960
+		$words_array = array_slice($words_array[0], 0, $num_words + 1);
2961 2961
 		$sep = '';
2962 2962
 	} else {
2963
-		$words_array = preg_split( "/[\n\r\t ]+/", $text, $num_words + 1, PREG_SPLIT_NO_EMPTY );
2963
+		$words_array = preg_split("/[\n\r\t ]+/", $text, $num_words + 1, PREG_SPLIT_NO_EMPTY);
2964 2964
 		$sep = ' ';
2965 2965
 	}
2966 2966
 
2967
-	if ( count( $words_array ) > $num_words ) {
2968
-		array_pop( $words_array );
2969
-		$text = implode( $sep, $words_array );
2970
-		$text = $text . $more;
2967
+	if (count($words_array) > $num_words) {
2968
+		array_pop($words_array);
2969
+		$text = implode($sep, $words_array);
2970
+		$text = $text.$more;
2971 2971
 	} else {
2972
-		$text = implode( $sep, $words_array );
2972
+		$text = implode($sep, $words_array);
2973 2973
 	}
2974 2974
 
2975 2975
 	/**
@@ -2982,7 +2982,7 @@  discard block
 block discarded – undo
2982 2982
 	 * @param string $more          An optional string to append to the end of the trimmed text, e.g. &hellip;.
2983 2983
 	 * @param string $original_text The text before it was trimmed.
2984 2984
 	 */
2985
-	return apply_filters( 'wp_trim_words', $text, $num_words, $more, $original_text );
2985
+	return apply_filters('wp_trim_words', $text, $num_words, $more, $original_text);
2986 2986
 }
2987 2987
 
2988 2988
 /**
@@ -2993,7 +2993,7 @@  discard block
 block discarded – undo
2993 2993
  * @param string $text The text within which entities will be converted.
2994 2994
  * @return string Text with converted entities.
2995 2995
  */
2996
-function ent2ncr( $text ) {
2996
+function ent2ncr($text) {
2997 2997
 
2998 2998
 	/**
2999 2999
 	 * Filter text before named entities are converted into numbered entities.
@@ -3005,8 +3005,8 @@  discard block
 block discarded – undo
3005 3005
 	 * @param null   $converted_text The text to be converted. Default null.
3006 3006
 	 * @param string $text           The text prior to entity conversion.
3007 3007
 	 */
3008
-	$filtered = apply_filters( 'pre_ent2ncr', null, $text );
3009
-	if ( null !== $filtered )
3008
+	$filtered = apply_filters('pre_ent2ncr', null, $text);
3009
+	if (null !== $filtered)
3010 3010
 		return $filtered;
3011 3011
 
3012 3012
 	$to_ncr = array(
@@ -3268,7 +3268,7 @@  discard block
 block discarded – undo
3268 3268
 		'&diams;' => '&#9830;'
3269 3269
 	);
3270 3270
 
3271
-	return str_replace( array_keys($to_ncr), array_values($to_ncr), $text );
3271
+	return str_replace(array_keys($to_ncr), array_values($to_ncr), $text);
3272 3272
 }
3273 3273
 
3274 3274
 /**
@@ -3289,9 +3289,9 @@  discard block
 block discarded – undo
3289 3289
  *                               It is usually either 'html' or 'tinymce'.
3290 3290
  * @return string The formatted text after filter is applied.
3291 3291
  */
3292
-function format_for_editor( $text, $default_editor = null ) {
3293
-	if ( $text ) {
3294
-		$text = htmlspecialchars( $text, ENT_NOQUOTES, get_option( 'blog_charset' ) );
3292
+function format_for_editor($text, $default_editor = null) {
3293
+	if ($text) {
3294
+		$text = htmlspecialchars($text, ENT_NOQUOTES, get_option('blog_charset'));
3295 3295
 	}
3296 3296
 
3297 3297
 	/**
@@ -3303,7 +3303,7 @@  discard block
 block discarded – undo
3303 3303
 	 * @param string $default_editor The default editor for the current user.
3304 3304
 	 *                               It is usually either 'html' or 'tinymce'.
3305 3305
 	 */
3306
-	return apply_filters( 'format_for_editor', $text, $default_editor );
3306
+	return apply_filters('format_for_editor', $text, $default_editor);
3307 3307
 }
3308 3308
 
3309 3309
 /**
@@ -3321,12 +3321,12 @@  discard block
 block discarded – undo
3321 3321
  * @param string       $subject The string being searched and replaced on, otherwise known as the haystack.
3322 3322
  * @return string The string with the replaced svalues.
3323 3323
  */
3324
-function _deep_replace( $search, $subject ) {
3324
+function _deep_replace($search, $subject) {
3325 3325
 	$subject = (string) $subject;
3326 3326
 
3327 3327
 	$count = 1;
3328
-	while ( $count ) {
3329
-		$subject = str_replace( $search, '', $subject, $count );
3328
+	while ($count) {
3329
+		$subject = str_replace($search, '', $subject, $count);
3330 3330
 	}
3331 3331
 
3332 3332
 	return $subject;
@@ -3346,9 +3346,9 @@  discard block
 block discarded – undo
3346 3346
  * @param string|array $data Unescaped data
3347 3347
  * @return string|array Escaped data
3348 3348
  */
3349
-function esc_sql( $data ) {
3349
+function esc_sql($data) {
3350 3350
 	global $wpdb;
3351
-	return $wpdb->_escape( $data );
3351
+	return $wpdb->_escape($data);
3352 3352
 }
3353 3353
 
3354 3354
 /**
@@ -3366,20 +3366,20 @@  discard block
 block discarded – undo
3366 3366
  * @param string $_context  Private. Use esc_url_raw() for database usage.
3367 3367
  * @return string The cleaned $url after the 'clean_url' filter is applied.
3368 3368
  */
3369
-function esc_url( $url, $protocols = null, $_context = 'display' ) {
3369
+function esc_url($url, $protocols = null, $_context = 'display') {
3370 3370
 	$original_url = $url;
3371 3371
 
3372
-	if ( '' == $url )
3372
+	if ('' == $url)
3373 3373
 		return $url;
3374 3374
 
3375
-	$url = str_replace( ' ', '%20', $url );
3375
+	$url = str_replace(' ', '%20', $url);
3376 3376
 	$url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\[\]\\x80-\\xff]|i', '', $url);
3377 3377
 
3378
-	if ( '' === $url ) {
3378
+	if ('' === $url) {
3379 3379
 		return $url;
3380 3380
 	}
3381 3381
 
3382
-	if ( 0 !== stripos( $url, 'mailto:' ) ) {
3382
+	if (0 !== stripos($url, 'mailto:')) {
3383 3383
 		$strip = array('%0d', '%0a', '%0D', '%0A');
3384 3384
 		$url = _deep_replace($strip, $url);
3385 3385
 	}
@@ -3389,61 +3389,61 @@  discard block
 block discarded – undo
3389 3389
 	 * presume it needs http:// prepended (unless a relative
3390 3390
 	 * link starting with /, # or ? or a php file).
3391 3391
 	 */
3392
-	if ( strpos($url, ':') === false && ! in_array( $url[0], array( '/', '#', '?' ) ) &&
3393
-		! preg_match('/^[a-z0-9-]+?\.php/i', $url) )
3394
-		$url = 'http://' . $url;
3392
+	if (strpos($url, ':') === false && ! in_array($url[0], array('/', '#', '?')) &&
3393
+		! preg_match('/^[a-z0-9-]+?\.php/i', $url))
3394
+		$url = 'http://'.$url;
3395 3395
 
3396 3396
 	// Replace ampersands and single quotes only when displaying.
3397
-	if ( 'display' == $_context ) {
3398
-		$url = wp_kses_normalize_entities( $url );
3399
-		$url = str_replace( '&amp;', '&#038;', $url );
3400
-		$url = str_replace( "'", '&#039;', $url );
3397
+	if ('display' == $_context) {
3398
+		$url = wp_kses_normalize_entities($url);
3399
+		$url = str_replace('&amp;', '&#038;', $url);
3400
+		$url = str_replace("'", '&#039;', $url);
3401 3401
 	}
3402 3402
 
3403
-	if ( ( false !== strpos( $url, '[' ) ) || ( false !== strpos( $url, ']' ) ) ) {
3403
+	if ((false !== strpos($url, '[')) || (false !== strpos($url, ']'))) {
3404 3404
 
3405
-		$parsed = wp_parse_url( $url );
3405
+		$parsed = wp_parse_url($url);
3406 3406
 		$front  = '';
3407 3407
 
3408
-		if ( isset( $parsed['scheme'] ) ) {
3409
-			$front .= $parsed['scheme'] . '://';
3410
-		} elseif ( '/' === $url[0] ) {
3408
+		if (isset($parsed['scheme'])) {
3409
+			$front .= $parsed['scheme'].'://';
3410
+		} elseif ('/' === $url[0]) {
3411 3411
 			$front .= '//';
3412 3412
 		}
3413 3413
 
3414
-		if ( isset( $parsed['user'] ) ) {
3414
+		if (isset($parsed['user'])) {
3415 3415
 			$front .= $parsed['user'];
3416 3416
 		}
3417 3417
 
3418
-		if ( isset( $parsed['pass'] ) ) {
3419
-			$front .= ':' . $parsed['pass'];
3418
+		if (isset($parsed['pass'])) {
3419
+			$front .= ':'.$parsed['pass'];
3420 3420
 		}
3421 3421
 
3422
-		if ( isset( $parsed['user'] ) || isset( $parsed['pass'] ) ) {
3422
+		if (isset($parsed['user']) || isset($parsed['pass'])) {
3423 3423
 			$front .= '@';
3424 3424
 		}
3425 3425
 
3426
-		if ( isset( $parsed['host'] ) ) {
3426
+		if (isset($parsed['host'])) {
3427 3427
 			$front .= $parsed['host'];
3428 3428
 		}
3429 3429
 
3430
-		if ( isset( $parsed['port'] ) ) {
3431
-			$front .= ':' . $parsed['port'];
3430
+		if (isset($parsed['port'])) {
3431
+			$front .= ':'.$parsed['port'];
3432 3432
 		}
3433 3433
 
3434
-		$end_dirty = str_replace( $front, '', $url );
3435
-		$end_clean = str_replace( array( '[', ']' ), array( '%5B', '%5D' ), $end_dirty );
3436
-		$url       = str_replace( $end_dirty, $end_clean, $url );
3434
+		$end_dirty = str_replace($front, '', $url);
3435
+		$end_clean = str_replace(array('[', ']'), array('%5B', '%5D'), $end_dirty);
3436
+		$url       = str_replace($end_dirty, $end_clean, $url);
3437 3437
 
3438 3438
 	}
3439 3439
 
3440
-	if ( '/' === $url[0] ) {
3440
+	if ('/' === $url[0]) {
3441 3441
 		$good_protocol_url = $url;
3442 3442
 	} else {
3443
-		if ( ! is_array( $protocols ) )
3443
+		if ( ! is_array($protocols))
3444 3444
 			$protocols = wp_allowed_protocols();
3445
-		$good_protocol_url = wp_kses_bad_protocol( $url, $protocols );
3446
-		if ( strtolower( $good_protocol_url ) != strtolower( $url ) )
3445
+		$good_protocol_url = wp_kses_bad_protocol($url, $protocols);
3446
+		if (strtolower($good_protocol_url) != strtolower($url))
3447 3447
 			return '';
3448 3448
 	}
3449 3449
 
@@ -3456,7 +3456,7 @@  discard block
 block discarded – undo
3456 3456
 	 * @param string $original_url      The URL prior to cleaning.
3457 3457
 	 * @param string $_context          If 'display', replace ampersands and single quotes only.
3458 3458
 	 */
3459
-	return apply_filters( 'clean_url', $good_protocol_url, $original_url, $_context );
3459
+	return apply_filters('clean_url', $good_protocol_url, $original_url, $_context);
3460 3460
 }
3461 3461
 
3462 3462
 /**
@@ -3468,8 +3468,8 @@  discard block
 block discarded – undo
3468 3468
  * @param array  $protocols An array of acceptable protocols.
3469 3469
  * @return string The cleaned URL.
3470 3470
  */
3471
-function esc_url_raw( $url, $protocols = null ) {
3472
-	return esc_url( $url, $protocols, 'db' );
3471
+function esc_url_raw($url, $protocols = null) {
3472
+	return esc_url($url, $protocols, 'db');
3473 3473
 }
3474 3474
 
3475 3475
 /**
@@ -3482,10 +3482,10 @@  discard block
 block discarded – undo
3482 3482
  * @param string $myHTML The text to be converted.
3483 3483
  * @return string Converted text.
3484 3484
  */
3485
-function htmlentities2( $myHTML ) {
3486
-	$translation_table = get_html_translation_table( HTML_ENTITIES, ENT_QUOTES );
3485
+function htmlentities2($myHTML) {
3486
+	$translation_table = get_html_translation_table(HTML_ENTITIES, ENT_QUOTES);
3487 3487
 	$translation_table[chr(38)] = '&';
3488
-	return preg_replace( "/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/", "&amp;", strtr($myHTML, $translation_table) );
3488
+	return preg_replace("/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/", "&amp;", strtr($myHTML, $translation_table));
3489 3489
 }
3490 3490
 
3491 3491
 /**
@@ -3500,12 +3500,12 @@  discard block
 block discarded – undo
3500 3500
  * @param string $text The text to be escaped.
3501 3501
  * @return string Escaped text.
3502 3502
  */
3503
-function esc_js( $text ) {
3504
-	$safe_text = wp_check_invalid_utf8( $text );
3505
-	$safe_text = _wp_specialchars( $safe_text, ENT_COMPAT );
3506
-	$safe_text = preg_replace( '/&#(x)?0*(?(1)27|39);?/i', "'", stripslashes( $safe_text ) );
3507
-	$safe_text = str_replace( "\r", '', $safe_text );
3508
-	$safe_text = str_replace( "\n", '\\n', addslashes( $safe_text ) );
3503
+function esc_js($text) {
3504
+	$safe_text = wp_check_invalid_utf8($text);
3505
+	$safe_text = _wp_specialchars($safe_text, ENT_COMPAT);
3506
+	$safe_text = preg_replace('/&#(x)?0*(?(1)27|39);?/i', "'", stripslashes($safe_text));
3507
+	$safe_text = str_replace("\r", '', $safe_text);
3508
+	$safe_text = str_replace("\n", '\\n', addslashes($safe_text));
3509 3509
 	/**
3510 3510
 	 * Filter a string cleaned and escaped for output in JavaScript.
3511 3511
 	 *
@@ -3517,7 +3517,7 @@  discard block
 block discarded – undo
3517 3517
 	 * @param string $safe_text The text after it has been escaped.
3518 3518
  	 * @param string $text      The text prior to being escaped.
3519 3519
 	 */
3520
-	return apply_filters( 'js_escape', $safe_text, $text );
3520
+	return apply_filters('js_escape', $safe_text, $text);
3521 3521
 }
3522 3522
 
3523 3523
 /**
@@ -3528,9 +3528,9 @@  discard block
 block discarded – undo
3528 3528
  * @param string $text
3529 3529
  * @return string
3530 3530
  */
3531
-function esc_html( $text ) {
3532
-	$safe_text = wp_check_invalid_utf8( $text );
3533
-	$safe_text = _wp_specialchars( $safe_text, ENT_QUOTES );
3531
+function esc_html($text) {
3532
+	$safe_text = wp_check_invalid_utf8($text);
3533
+	$safe_text = _wp_specialchars($safe_text, ENT_QUOTES);
3534 3534
 	/**
3535 3535
 	 * Filter a string cleaned and escaped for output in HTML.
3536 3536
 	 *
@@ -3542,7 +3542,7 @@  discard block
 block discarded – undo
3542 3542
 	 * @param string $safe_text The text after it has been escaped.
3543 3543
  	 * @param string $text      The text prior to being escaped.
3544 3544
 	 */
3545
-	return apply_filters( 'esc_html', $safe_text, $text );
3545
+	return apply_filters('esc_html', $safe_text, $text);
3546 3546
 }
3547 3547
 
3548 3548
 /**
@@ -3553,9 +3553,9 @@  discard block
 block discarded – undo
3553 3553
  * @param string $text
3554 3554
  * @return string
3555 3555
  */
3556
-function esc_attr( $text ) {
3557
-	$safe_text = wp_check_invalid_utf8( $text );
3558
-	$safe_text = _wp_specialchars( $safe_text, ENT_QUOTES );
3556
+function esc_attr($text) {
3557
+	$safe_text = wp_check_invalid_utf8($text);
3558
+	$safe_text = _wp_specialchars($safe_text, ENT_QUOTES);
3559 3559
 	/**
3560 3560
 	 * Filter a string cleaned and escaped for output in an HTML attribute.
3561 3561
 	 *
@@ -3567,7 +3567,7 @@  discard block
 block discarded – undo
3567 3567
 	 * @param string $safe_text The text after it has been escaped.
3568 3568
  	 * @param string $text      The text prior to being escaped.
3569 3569
 	 */
3570
-	return apply_filters( 'attribute_escape', $safe_text, $text );
3570
+	return apply_filters('attribute_escape', $safe_text, $text);
3571 3571
 }
3572 3572
 
3573 3573
 /**
@@ -3578,8 +3578,8 @@  discard block
 block discarded – undo
3578 3578
  * @param string $text
3579 3579
  * @return string
3580 3580
  */
3581
-function esc_textarea( $text ) {
3582
-	$safe_text = htmlspecialchars( $text, ENT_QUOTES, get_option( 'blog_charset' ) );
3581
+function esc_textarea($text) {
3582
+	$safe_text = htmlspecialchars($text, ENT_QUOTES, get_option('blog_charset'));
3583 3583
 	/**
3584 3584
 	 * Filter a string cleaned and escaped for output in a textarea element.
3585 3585
 	 *
@@ -3588,7 +3588,7 @@  discard block
 block discarded – undo
3588 3588
 	 * @param string $safe_text The text after it has been escaped.
3589 3589
  	 * @param string $text      The text prior to being escaped.
3590 3590
 	 */
3591
-	return apply_filters( 'esc_textarea', $safe_text, $text );
3591
+	return apply_filters('esc_textarea', $safe_text, $text);
3592 3592
 }
3593 3593
 
3594 3594
 /**
@@ -3599,8 +3599,8 @@  discard block
 block discarded – undo
3599 3599
  * @param string $tag_name
3600 3600
  * @return string
3601 3601
  */
3602
-function tag_escape( $tag_name ) {
3603
-	$safe_tag = strtolower( preg_replace('/[^a-zA-Z0-9_:]/', '', $tag_name) );
3602
+function tag_escape($tag_name) {
3603
+	$safe_tag = strtolower(preg_replace('/[^a-zA-Z0-9_:]/', '', $tag_name));
3604 3604
 	/**
3605 3605
 	 * Filter a string cleaned and escaped for output as an HTML tag.
3606 3606
 	 *
@@ -3609,7 +3609,7 @@  discard block
 block discarded – undo
3609 3609
 	 * @param string $safe_tag The tag name after it has been escaped.
3610 3610
  	 * @param string $tag_name The text before it was escaped.
3611 3611
 	 */
3612
-	return apply_filters( 'tag_escape', $safe_tag, $tag_name );
3612
+	return apply_filters('tag_escape', $safe_tag, $tag_name);
3613 3613
 }
3614 3614
 
3615 3615
 /**
@@ -3624,8 +3624,8 @@  discard block
 block discarded – undo
3624 3624
  * @param string $link Full URL path.
3625 3625
  * @return string Absolute path.
3626 3626
  */
3627
-function wp_make_link_relative( $link ) {
3628
-	return preg_replace( '|^(https?:)?//[^/]+(/?.*)|i', '$2', $link );
3627
+function wp_make_link_relative($link) {
3628
+	return preg_replace('|^(https?:)?//[^/]+(/?.*)|i', '$2', $link);
3629 3629
 }
3630 3630
 
3631 3631
 /**
@@ -3642,22 +3642,22 @@  discard block
 block discarded – undo
3642 3642
  * @param string $value  The unsanitised value.
3643 3643
  * @return string Sanitized value.
3644 3644
  */
3645
-function sanitize_option( $option, $value ) {
3645
+function sanitize_option($option, $value) {
3646 3646
 	global $wpdb;
3647 3647
 
3648 3648
 	$original_value = $value;
3649 3649
 	$error = '';
3650 3650
 
3651
-	switch ( $option ) {
3651
+	switch ($option) {
3652 3652
 		case 'admin_email' :
3653 3653
 		case 'new_admin_email' :
3654
-			$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
3655
-			if ( is_wp_error( $value ) ) {
3654
+			$value = $wpdb->strip_invalid_text_for_column($wpdb->options, 'option_value', $value);
3655
+			if (is_wp_error($value)) {
3656 3656
 				$error = $value->get_error_message();
3657 3657
 			} else {
3658
-				$value = sanitize_email( $value );
3659
-				if ( ! is_email( $value ) ) {
3660
-					$error = __( 'The email address entered did not appear to be a valid email address. Please enter a valid email address.' );
3658
+				$value = sanitize_email($value);
3659
+				if ( ! is_email($value)) {
3660
+					$error = __('The email address entered did not appear to be a valid email address. Please enter a valid email address.');
3661 3661
 				}
3662 3662
 			}
3663 3663
 			break;
@@ -3684,32 +3684,32 @@  discard block
 block discarded – undo
3684 3684
 		case 'users_can_register':
3685 3685
 		case 'start_of_week':
3686 3686
 		case 'site_icon':
3687
-			$value = absint( $value );
3687
+			$value = absint($value);
3688 3688
 			break;
3689 3689
 
3690 3690
 		case 'posts_per_page':
3691 3691
 		case 'posts_per_rss':
3692 3692
 			$value = (int) $value;
3693
-			if ( empty($value) )
3693
+			if (empty($value))
3694 3694
 				$value = 1;
3695
-			if ( $value < -1 )
3695
+			if ($value < -1)
3696 3696
 				$value = abs($value);
3697 3697
 			break;
3698 3698
 
3699 3699
 		case 'default_ping_status':
3700 3700
 		case 'default_comment_status':
3701 3701
 			// Options that if not there have 0 value but need to be something like "closed"
3702
-			if ( $value == '0' || $value == '')
3702
+			if ($value == '0' || $value == '')
3703 3703
 				$value = 'closed';
3704 3704
 			break;
3705 3705
 
3706 3706
 		case 'blogdescription':
3707 3707
 		case 'blogname':
3708
-			$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
3709
-			if ( is_wp_error( $value ) ) {
3708
+			$value = $wpdb->strip_invalid_text_for_column($wpdb->options, 'option_value', $value);
3709
+			if (is_wp_error($value)) {
3710 3710
 				$error = $value->get_error_message();
3711 3711
 			} else {
3712
-				$value = esc_html( $value );
3712
+				$value = esc_html($value);
3713 3713
 			}
3714 3714
 			break;
3715 3715
 
@@ -3719,10 +3719,10 @@  discard block
 block discarded – undo
3719 3719
 
3720 3720
 		case 'blog_public':
3721 3721
 			// This is the value if the settings checkbox is not checked on POST. Don't rely on this.
3722
-			if ( null === $value )
3722
+			if (null === $value)
3723 3723
 				$value = 1;
3724 3724
 			else
3725
-				$value = intval( $value );
3725
+				$value = intval($value);
3726 3726
 			break;
3727 3727
 
3728 3728
 		case 'date_format':
@@ -3731,20 +3731,20 @@  discard block
 block discarded – undo
3731 3731
 		case 'mailserver_login':
3732 3732
 		case 'mailserver_pass':
3733 3733
 		case 'upload_path':
3734
-			$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
3735
-			if ( is_wp_error( $value ) ) {
3734
+			$value = $wpdb->strip_invalid_text_for_column($wpdb->options, 'option_value', $value);
3735
+			if (is_wp_error($value)) {
3736 3736
 				$error = $value->get_error_message();
3737 3737
 			} else {
3738
-				$value = strip_tags( $value );
3739
-				$value = wp_kses_data( $value );
3738
+				$value = strip_tags($value);
3739
+				$value = wp_kses_data($value);
3740 3740
 			}
3741 3741
 			break;
3742 3742
 
3743 3743
 		case 'ping_sites':
3744
-			$value = explode( "\n", $value );
3745
-			$value = array_filter( array_map( 'trim', $value ) );
3746
-			$value = array_filter( array_map( 'esc_url_raw', $value ) );
3747
-			$value = implode( "\n", $value );
3744
+			$value = explode("\n", $value);
3745
+			$value = array_filter(array_map('trim', $value));
3746
+			$value = array_filter(array_map('esc_url_raw', $value));
3747
+			$value = implode("\n", $value);
3748 3748
 			break;
3749 3749
 
3750 3750
 		case 'gmt_offset':
@@ -3752,120 +3752,120 @@  discard block
 block discarded – undo
3752 3752
 			break;
3753 3753
 
3754 3754
 		case 'siteurl':
3755
-			$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
3756
-			if ( is_wp_error( $value ) ) {
3755
+			$value = $wpdb->strip_invalid_text_for_column($wpdb->options, 'option_value', $value);
3756
+			if (is_wp_error($value)) {
3757 3757
 				$error = $value->get_error_message();
3758 3758
 			} else {
3759
-				if ( preg_match( '#http(s?)://(.+)#i', $value ) ) {
3760
-					$value = esc_url_raw( $value );
3759
+				if (preg_match('#http(s?)://(.+)#i', $value)) {
3760
+					$value = esc_url_raw($value);
3761 3761
 				} else {
3762
-					$error = __( 'The WordPress address you entered did not appear to be a valid URL. Please enter a valid URL.' );
3762
+					$error = __('The WordPress address you entered did not appear to be a valid URL. Please enter a valid URL.');
3763 3763
 				}
3764 3764
 			}
3765 3765
 			break;
3766 3766
 
3767 3767
 		case 'home':
3768
-			$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
3769
-			if ( is_wp_error( $value ) ) {
3768
+			$value = $wpdb->strip_invalid_text_for_column($wpdb->options, 'option_value', $value);
3769
+			if (is_wp_error($value)) {
3770 3770
 				$error = $value->get_error_message();
3771 3771
 			} else {
3772
-				if ( preg_match( '#http(s?)://(.+)#i', $value ) ) {
3773
-					$value = esc_url_raw( $value );
3772
+				if (preg_match('#http(s?)://(.+)#i', $value)) {
3773
+					$value = esc_url_raw($value);
3774 3774
 				} else {
3775
-					$error = __( 'The Site address you entered did not appear to be a valid URL. Please enter a valid URL.' );
3775
+					$error = __('The Site address you entered did not appear to be a valid URL. Please enter a valid URL.');
3776 3776
 				}
3777 3777
 			}
3778 3778
 			break;
3779 3779
 
3780 3780
 		case 'WPLANG':
3781 3781
 			$allowed = get_available_languages();
3782
-			if ( ! is_multisite() && defined( 'WPLANG' ) && '' !== WPLANG && 'en_US' !== WPLANG ) {
3782
+			if ( ! is_multisite() && defined('WPLANG') && '' !== WPLANG && 'en_US' !== WPLANG) {
3783 3783
 				$allowed[] = WPLANG;
3784 3784
 			}
3785
-			if ( ! in_array( $value, $allowed ) && ! empty( $value ) ) {
3786
-				$value = get_option( $option );
3785
+			if ( ! in_array($value, $allowed) && ! empty($value)) {
3786
+				$value = get_option($option);
3787 3787
 			}
3788 3788
 			break;
3789 3789
 
3790 3790
 		case 'illegal_names':
3791
-			$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
3792
-			if ( is_wp_error( $value ) ) {
3791
+			$value = $wpdb->strip_invalid_text_for_column($wpdb->options, 'option_value', $value);
3792
+			if (is_wp_error($value)) {
3793 3793
 				$error = $value->get_error_message();
3794 3794
 			} else {
3795
-				if ( ! is_array( $value ) )
3796
-					$value = explode( ' ', $value );
3795
+				if ( ! is_array($value))
3796
+					$value = explode(' ', $value);
3797 3797
 
3798
-				$value = array_values( array_filter( array_map( 'trim', $value ) ) );
3798
+				$value = array_values(array_filter(array_map('trim', $value)));
3799 3799
 
3800
-				if ( ! $value )
3800
+				if ( ! $value)
3801 3801
 					$value = '';
3802 3802
 			}
3803 3803
 			break;
3804 3804
 
3805 3805
 		case 'limited_email_domains':
3806 3806
 		case 'banned_email_domains':
3807
-			$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
3808
-			if ( is_wp_error( $value ) ) {
3807
+			$value = $wpdb->strip_invalid_text_for_column($wpdb->options, 'option_value', $value);
3808
+			if (is_wp_error($value)) {
3809 3809
 				$error = $value->get_error_message();
3810 3810
 			} else {
3811
-				if ( ! is_array( $value ) )
3812
-					$value = explode( "\n", $value );
3811
+				if ( ! is_array($value))
3812
+					$value = explode("\n", $value);
3813 3813
 
3814
-				$domains = array_values( array_filter( array_map( 'trim', $value ) ) );
3814
+				$domains = array_values(array_filter(array_map('trim', $value)));
3815 3815
 				$value = array();
3816 3816
 
3817
-				foreach ( $domains as $domain ) {
3818
-					if ( ! preg_match( '/(--|\.\.)/', $domain ) && preg_match( '|^([a-zA-Z0-9-\.])+$|', $domain ) ) {
3817
+				foreach ($domains as $domain) {
3818
+					if ( ! preg_match('/(--|\.\.)/', $domain) && preg_match('|^([a-zA-Z0-9-\.])+$|', $domain)) {
3819 3819
 						$value[] = $domain;
3820 3820
 					}
3821 3821
 				}
3822
-				if ( ! $value )
3822
+				if ( ! $value)
3823 3823
 					$value = '';
3824 3824
 			}
3825 3825
 			break;
3826 3826
 
3827 3827
 		case 'timezone_string':
3828 3828
 			$allowed_zones = timezone_identifiers_list();
3829
-			if ( ! in_array( $value, $allowed_zones ) && ! empty( $value ) ) {
3830
-				$error = __( 'The timezone you have entered is not valid. Please select a valid timezone.' );
3829
+			if ( ! in_array($value, $allowed_zones) && ! empty($value)) {
3830
+				$error = __('The timezone you have entered is not valid. Please select a valid timezone.');
3831 3831
 			}
3832 3832
 			break;
3833 3833
 
3834 3834
 		case 'permalink_structure':
3835 3835
 		case 'category_base':
3836 3836
 		case 'tag_base':
3837
-			$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
3838
-			if ( is_wp_error( $value ) ) {
3837
+			$value = $wpdb->strip_invalid_text_for_column($wpdb->options, 'option_value', $value);
3838
+			if (is_wp_error($value)) {
3839 3839
 				$error = $value->get_error_message();
3840 3840
 			} else {
3841
-				$value = esc_url_raw( $value );
3842
-				$value = str_replace( 'http://', '', $value );
3841
+				$value = esc_url_raw($value);
3842
+				$value = str_replace('http://', '', $value);
3843 3843
 			}
3844 3844
 			break;
3845 3845
 
3846 3846
 		case 'default_role' :
3847
-			if ( ! get_role( $value ) && get_role( 'subscriber' ) )
3847
+			if ( ! get_role($value) && get_role('subscriber'))
3848 3848
 				$value = 'subscriber';
3849 3849
 			break;
3850 3850
 
3851 3851
 		case 'moderation_keys':
3852 3852
 		case 'blacklist_keys':
3853
-			$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
3854
-			if ( is_wp_error( $value ) ) {
3853
+			$value = $wpdb->strip_invalid_text_for_column($wpdb->options, 'option_value', $value);
3854
+			if (is_wp_error($value)) {
3855 3855
 				$error = $value->get_error_message();
3856 3856
 			} else {
3857
-				$value = explode( "\n", $value );
3858
-				$value = array_filter( array_map( 'trim', $value ) );
3859
-				$value = array_unique( $value );
3860
-				$value = implode( "\n", $value );
3857
+				$value = explode("\n", $value);
3858
+				$value = array_filter(array_map('trim', $value));
3859
+				$value = array_unique($value);
3860
+				$value = implode("\n", $value);
3861 3861
 			}
3862 3862
 			break;
3863 3863
 	}
3864 3864
 
3865
-	if ( ! empty( $error ) ) {
3866
-		$value = get_option( $option );
3867
-		if ( function_exists( 'add_settings_error' ) ) {
3868
-			add_settings_error( $option, "invalid_{$option}", $error );
3865
+	if ( ! empty($error)) {
3866
+		$value = get_option($option);
3867
+		if (function_exists('add_settings_error')) {
3868
+			add_settings_error($option, "invalid_{$option}", $error);
3869 3869
 		}
3870 3870
 	}
3871 3871
 
@@ -3879,7 +3879,7 @@  discard block
 block discarded – undo
3879 3879
 	 * @param string $option         The option name.
3880 3880
 	 * @param string $original_value The original value passed to the function.
3881 3881
 	 */
3882
-	return apply_filters( "sanitize_option_{$option}", $value, $option, $original_value );
3882
+	return apply_filters("sanitize_option_{$option}", $value, $option, $original_value);
3883 3883
 }
3884 3884
 
3885 3885
 /**
@@ -3893,18 +3893,18 @@  discard block
 block discarded – undo
3893 3893
  * @param callable $callback The function to map onto $value.
3894 3894
  * @return mixed The value with the callback applied to all non-arrays and non-objects inside it.
3895 3895
  */
3896
-function map_deep( $value, $callback ) {
3897
-	if ( is_array( $value ) ) {
3898
-		foreach ( $value as $index => $item ) {
3899
-			$value[ $index ] = map_deep( $item, $callback );
3896
+function map_deep($value, $callback) {
3897
+	if (is_array($value)) {
3898
+		foreach ($value as $index => $item) {
3899
+			$value[$index] = map_deep($item, $callback);
3900 3900
 		}
3901
-	} elseif ( is_object( $value ) ) {
3902
-		$object_vars = get_object_vars( $value );
3903
-		foreach ( $object_vars as $property_name => $property_value ) {
3904
-			$value->$property_name = map_deep( $property_value, $callback );
3901
+	} elseif (is_object($value)) {
3902
+		$object_vars = get_object_vars($value);
3903
+		foreach ($object_vars as $property_name => $property_value) {
3904
+			$value->$property_name = map_deep($property_value, $callback);
3905 3905
 		}
3906 3906
 	} else {
3907
-		$value = call_user_func( $callback, $value );
3907
+		$value = call_user_func($callback, $value);
3908 3908
 	}
3909 3909
 
3910 3910
 	return $value;
@@ -3921,10 +3921,10 @@  discard block
 block discarded – undo
3921 3921
  * @param string $string The string to be parsed.
3922 3922
  * @param array  $array  Variables will be stored in this array.
3923 3923
  */
3924
-function wp_parse_str( $string, &$array ) {
3925
-	parse_str( $string, $array );
3926
-	if ( get_magic_quotes_gpc() )
3927
-		$array = stripslashes_deep( $array );
3924
+function wp_parse_str($string, &$array) {
3925
+	parse_str($string, $array);
3926
+	if (get_magic_quotes_gpc())
3927
+		$array = stripslashes_deep($array);
3928 3928
 	/**
3929 3929
 	 * Filter the array of variables derived from a parsed string.
3930 3930
 	 *
@@ -3932,7 +3932,7 @@  discard block
 block discarded – undo
3932 3932
 	 *
3933 3933
 	 * @param array $array The array populated with variables.
3934 3934
 	 */
3935
-	$array = apply_filters( 'wp_parse_str', $array );
3935
+	$array = apply_filters('wp_parse_str', $array);
3936 3936
 }
3937 3937
 
3938 3938
 /**
@@ -3945,7 +3945,7 @@  discard block
 block discarded – undo
3945 3945
  * @param string $text Text to be converted.
3946 3946
  * @return string Converted text.
3947 3947
  */
3948
-function wp_pre_kses_less_than( $text ) {
3948
+function wp_pre_kses_less_than($text) {
3949 3949
 	return preg_replace_callback('%<[^>]*?((?=<)|>|$)%', 'wp_pre_kses_less_than_callback', $text);
3950 3950
 }
3951 3951
 
@@ -3957,8 +3957,8 @@  discard block
 block discarded – undo
3957 3957
  * @param array $matches Populated by matches to preg_replace.
3958 3958
  * @return string The text returned after esc_html if needed.
3959 3959
  */
3960
-function wp_pre_kses_less_than_callback( $matches ) {
3961
-	if ( false === strpos($matches[0], '>') )
3960
+function wp_pre_kses_less_than_callback($matches) {
3961
+	if (false === strpos($matches[0], '>'))
3962 3962
 		return esc_html($matches[0]);
3963 3963
 	return $matches[0];
3964 3964
 }
@@ -3973,21 +3973,21 @@  discard block
 block discarded – undo
3973 3973
  * @param mixed  $args ,... Arguments to be formatted into the $pattern string.
3974 3974
  * @return string The formatted string.
3975 3975
  */
3976
-function wp_sprintf( $pattern ) {
3976
+function wp_sprintf($pattern) {
3977 3977
 	$args = func_get_args();
3978 3978
 	$len = strlen($pattern);
3979 3979
 	$start = 0;
3980 3980
 	$result = '';
3981 3981
 	$arg_index = 0;
3982
-	while ( $len > $start ) {
3982
+	while ($len > $start) {
3983 3983
 		// Last character: append and break
3984
-		if ( strlen($pattern) - 1 == $start ) {
3984
+		if (strlen($pattern) - 1 == $start) {
3985 3985
 			$result .= substr($pattern, -1);
3986 3986
 			break;
3987 3987
 		}
3988 3988
 
3989 3989
 		// Literal %: append and continue
3990
-		if ( substr($pattern, $start, 2) == '%%' ) {
3990
+		if (substr($pattern, $start, 2) == '%%') {
3991 3991
 			$start += 2;
3992 3992
 			$result .= '%';
3993 3993
 			continue;
@@ -3995,14 +3995,14 @@  discard block
 block discarded – undo
3995 3995
 
3996 3996
 		// Get fragment before next %
3997 3997
 		$end = strpos($pattern, '%', $start + 1);
3998
-		if ( false === $end )
3998
+		if (false === $end)
3999 3999
 			$end = $len;
4000 4000
 		$fragment = substr($pattern, $start, $end - $start);
4001 4001
 
4002 4002
 		// Fragment has a specifier
4003
-		if ( $pattern[$start] == '%' ) {
4003
+		if ($pattern[$start] == '%') {
4004 4004
 			// Find numbered arguments or take the next one in order
4005
-			if ( preg_match('/^%(\d+)\$/', $fragment, $matches) ) {
4005
+			if (preg_match('/^%(\d+)\$/', $fragment, $matches)) {
4006 4006
 				$arg = isset($args[$matches[1]]) ? $args[$matches[1]] : '';
4007 4007
 				$fragment = str_replace("%{$matches[1]}$", '%', $fragment);
4008 4008
 			} else {
@@ -4020,11 +4020,11 @@  discard block
 block discarded – undo
4020 4020
 			 * @param string $fragment A fragment from the pattern.
4021 4021
 			 * @param string $arg      The argument.
4022 4022
 			 */
4023
-			$_fragment = apply_filters( 'wp_sprintf', $fragment, $arg );
4024
-			if ( $_fragment != $fragment )
4023
+			$_fragment = apply_filters('wp_sprintf', $fragment, $arg);
4024
+			if ($_fragment != $fragment)
4025 4025
 				$fragment = $_fragment;
4026 4026
 			else
4027
-				$fragment = sprintf($fragment, strval($arg) );
4027
+				$fragment = sprintf($fragment, strval($arg));
4028 4028
 		}
4029 4029
 
4030 4030
 		// Append to result and move to next fragment
@@ -4047,13 +4047,13 @@  discard block
 block discarded – undo
4047 4047
  * @param array  $args    List items to prepend to the content and replace '%l'.
4048 4048
  * @return string Localized list items and rest of the content.
4049 4049
  */
4050
-function wp_sprintf_l( $pattern, $args ) {
4050
+function wp_sprintf_l($pattern, $args) {
4051 4051
 	// Not a match
4052
-	if ( substr($pattern, 0, 2) != '%l' )
4052
+	if (substr($pattern, 0, 2) != '%l')
4053 4053
 		return $pattern;
4054 4054
 
4055 4055
 	// Nothing to work with
4056
-	if ( empty($args) )
4056
+	if (empty($args))
4057 4057
 		return '';
4058 4058
 
4059 4059
 	/**
@@ -4067,30 +4067,30 @@  discard block
 block discarded – undo
4067 4067
 	 *
4068 4068
 	 * @param array $delimiters An array of translated delimiters.
4069 4069
 	 */
4070
-	$l = apply_filters( 'wp_sprintf_l', array(
4070
+	$l = apply_filters('wp_sprintf_l', array(
4071 4071
 		/* translators: used to join items in a list with more than 2 items */
4072
-		'between'          => sprintf( __('%s, %s'), '', '' ),
4072
+		'between'          => sprintf(__('%s, %s'), '', ''),
4073 4073
 		/* translators: used to join last two items in a list with more than 2 times */
4074
-		'between_last_two' => sprintf( __('%s, and %s'), '', '' ),
4074
+		'between_last_two' => sprintf(__('%s, and %s'), '', ''),
4075 4075
 		/* translators: used to join items in a list with only 2 items */
4076
-		'between_only_two' => sprintf( __('%s and %s'), '', '' ),
4077
-	) );
4076
+		'between_only_two' => sprintf(__('%s and %s'), '', ''),
4077
+	));
4078 4078
 
4079 4079
 	$args = (array) $args;
4080 4080
 	$result = array_shift($args);
4081
-	if ( count($args) == 1 )
4082
-		$result .= $l['between_only_two'] . array_shift($args);
4081
+	if (count($args) == 1)
4082
+		$result .= $l['between_only_two'].array_shift($args);
4083 4083
 	// Loop when more than two args
4084 4084
 	$i = count($args);
4085
-	while ( $i ) {
4085
+	while ($i) {
4086 4086
 		$arg = array_shift($args);
4087 4087
 		$i--;
4088
-		if ( 0 == $i )
4089
-			$result .= $l['between_last_two'] . $arg;
4088
+		if (0 == $i)
4089
+			$result .= $l['between_last_two'].$arg;
4090 4090
 		else
4091
-			$result .= $l['between'] . $arg;
4091
+			$result .= $l['between'].$arg;
4092 4092
 	}
4093
-	return $result . substr($pattern, 2);
4093
+	return $result.substr($pattern, 2);
4094 4094
 }
4095 4095
 
4096 4096
 /**
@@ -4107,15 +4107,15 @@  discard block
 block discarded – undo
4107 4107
  * @param string $more  Optional. What to append if $str needs to be trimmed. Defaults to empty string.
4108 4108
  * @return string The excerpt.
4109 4109
  */
4110
-function wp_html_excerpt( $str, $count, $more = null ) {
4111
-	if ( null === $more )
4110
+function wp_html_excerpt($str, $count, $more = null) {
4111
+	if (null === $more)
4112 4112
 		$more = '';
4113
-	$str = wp_strip_all_tags( $str, true );
4114
-	$excerpt = mb_substr( $str, 0, $count );
4113
+	$str = wp_strip_all_tags($str, true);
4114
+	$excerpt = mb_substr($str, 0, $count);
4115 4115
 	// remove part of an entity at the end
4116
-	$excerpt = preg_replace( '/&[^;\s]{0,6}$/', '', $excerpt );
4117
-	if ( $str != $excerpt )
4118
-		$excerpt = trim( $excerpt ) . $more;
4116
+	$excerpt = preg_replace('/&[^;\s]{0,6}$/', '', $excerpt);
4117
+	if ($str != $excerpt)
4118
+		$excerpt = trim($excerpt).$more;
4119 4119
 	return $excerpt;
4120 4120
 }
4121 4121
 
@@ -4134,11 +4134,11 @@  discard block
 block discarded – undo
4134 4134
  * @param array  $attrs   The attributes which should be processed.
4135 4135
  * @return string The processed content.
4136 4136
  */
4137
-function links_add_base_url( $content, $base, $attrs = array('src', 'href') ) {
4137
+function links_add_base_url($content, $base, $attrs = array('src', 'href')) {
4138 4138
 	global $_links_add_base;
4139 4139
 	$_links_add_base = $base;
4140
-	$attrs = implode('|', (array)$attrs);
4141
-	return preg_replace_callback( "!($attrs)=(['\"])(.+?)\\2!i", '_links_add_base', $content );
4140
+	$attrs = implode('|', (array) $attrs);
4141
+	return preg_replace_callback("!($attrs)=(['\"])(.+?)\\2!i", '_links_add_base', $content);
4142 4142
 }
4143 4143
 
4144 4144
 /**
@@ -4152,13 +4152,12 @@  discard block
 block discarded – undo
4152 4152
  * @param string $m The matched link.
4153 4153
  * @return string The processed link.
4154 4154
  */
4155
-function _links_add_base( $m ) {
4155
+function _links_add_base($m) {
4156 4156
 	global $_links_add_base;
4157 4157
 	//1 = attribute name  2 = quotation mark  3 = URL
4158
-	return $m[1] . '=' . $m[2] .
4159
-		( preg_match( '#^(\w{1,20}):#', $m[3], $protocol ) && in_array( $protocol[1], wp_allowed_protocols() ) ?
4160
-			$m[3] :
4161
-			WP_Http::make_absolute_url( $m[3], $_links_add_base )
4158
+	return $m[1].'='.$m[2].
4159
+		(preg_match('#^(\w{1,20}):#', $m[3], $protocol) && in_array($protocol[1], wp_allowed_protocols()) ?
4160
+			$m[3] : WP_Http::make_absolute_url($m[3], $_links_add_base)
4162 4161
 		)
4163 4162
 		. $m[2];
4164 4163
 }
@@ -4180,11 +4179,11 @@  discard block
 block discarded – undo
4180 4179
  * @param array  $tags    An array of tags to apply to.
4181 4180
  * @return string The processed content.
4182 4181
  */
4183
-function links_add_target( $content, $target = '_blank', $tags = array('a') ) {
4182
+function links_add_target($content, $target = '_blank', $tags = array('a')) {
4184 4183
 	global $_links_add_target;
4185 4184
 	$_links_add_target = $target;
4186
-	$tags = implode('|', (array)$tags);
4187
-	return preg_replace_callback( "!<($tags)([^>]*)>!i", '_links_add_target', $content );
4185
+	$tags = implode('|', (array) $tags);
4186
+	return preg_replace_callback("!<($tags)([^>]*)>!i", '_links_add_target', $content);
4188 4187
 }
4189 4188
 
4190 4189
 /**
@@ -4198,11 +4197,11 @@  discard block
 block discarded – undo
4198 4197
  * @param string $m The matched link.
4199 4198
  * @return string The processed link.
4200 4199
  */
4201
-function _links_add_target( $m ) {
4200
+function _links_add_target($m) {
4202 4201
 	global $_links_add_target;
4203 4202
 	$tag = $m[1];
4204 4203
 	$link = preg_replace('|( target=([\'"])(.*?)\2)|i', '', $m[2]);
4205
-	return '<' . $tag . $link . ' target="' . esc_attr( $_links_add_target ) . '">';
4204
+	return '<'.$tag.$link.' target="'.esc_attr($_links_add_target).'">';
4206 4205
 }
4207 4206
 
4208 4207
 /**
@@ -4213,10 +4212,10 @@  discard block
 block discarded – undo
4213 4212
  * @param string $str The string to normalize.
4214 4213
  * @return string The normalized string.
4215 4214
  */
4216
-function normalize_whitespace( $str ) {
4217
-	$str  = trim( $str );
4218
-	$str  = str_replace( "\r", "\n", $str );
4219
-	$str  = preg_replace( array( '/\n+/', '/[ \t]+/' ), array( "\n", ' ' ), $str );
4215
+function normalize_whitespace($str) {
4216
+	$str  = trim($str);
4217
+	$str  = str_replace("\r", "\n", $str);
4218
+	$str  = preg_replace(array('/\n+/', '/[ \t]+/'), array("\n", ' '), $str);
4220 4219
 	return $str;
4221 4220
 }
4222 4221
 
@@ -4234,13 +4233,13 @@  discard block
 block discarded – undo
4234 4233
  * @return string The processed string.
4235 4234
  */
4236 4235
 function wp_strip_all_tags($string, $remove_breaks = false) {
4237
-	$string = preg_replace( '@<(script|style)[^>]*?>.*?</\\1>@si', '', $string );
4236
+	$string = preg_replace('@<(script|style)[^>]*?>.*?</\\1>@si', '', $string);
4238 4237
 	$string = strip_tags($string);
4239 4238
 
4240
-	if ( $remove_breaks )
4239
+	if ($remove_breaks)
4241 4240
 		$string = preg_replace('/[\r\n\t ]+/', ' ', $string);
4242 4241
 
4243
-	return trim( $string );
4242
+	return trim($string);
4244 4243
 }
4245 4244
 
4246 4245
 /**
@@ -4257,26 +4256,26 @@  discard block
 block discarded – undo
4257 4256
  * @param string $str
4258 4257
  * @return string
4259 4258
  */
4260
-function sanitize_text_field( $str ) {
4261
-	$filtered = wp_check_invalid_utf8( $str );
4259
+function sanitize_text_field($str) {
4260
+	$filtered = wp_check_invalid_utf8($str);
4262 4261
 
4263
-	if ( strpos($filtered, '<') !== false ) {
4264
-		$filtered = wp_pre_kses_less_than( $filtered );
4262
+	if (strpos($filtered, '<') !== false) {
4263
+		$filtered = wp_pre_kses_less_than($filtered);
4265 4264
 		// This will strip extra whitespace for us.
4266
-		$filtered = wp_strip_all_tags( $filtered, true );
4265
+		$filtered = wp_strip_all_tags($filtered, true);
4267 4266
 	} else {
4268
-		$filtered = trim( preg_replace('/[\r\n\t ]+/', ' ', $filtered) );
4267
+		$filtered = trim(preg_replace('/[\r\n\t ]+/', ' ', $filtered));
4269 4268
 	}
4270 4269
 
4271 4270
 	$found = false;
4272
-	while ( preg_match('/%[a-f0-9]{2}/i', $filtered, $match) ) {
4271
+	while (preg_match('/%[a-f0-9]{2}/i', $filtered, $match)) {
4273 4272
 		$filtered = str_replace($match[0], '', $filtered);
4274 4273
 		$found = true;
4275 4274
 	}
4276 4275
 
4277
-	if ( $found ) {
4276
+	if ($found) {
4278 4277
 		// Strip out the whitespace that may now exist after removing the octets.
4279
-		$filtered = trim( preg_replace('/ +/', ' ', $filtered) );
4278
+		$filtered = trim(preg_replace('/ +/', ' ', $filtered));
4280 4279
 	}
4281 4280
 
4282 4281
 	/**
@@ -4287,7 +4286,7 @@  discard block
 block discarded – undo
4287 4286
 	 * @param string $filtered The sanitized string.
4288 4287
 	 * @param string $str      The string prior to being sanitized.
4289 4288
 	 */
4290
-	return apply_filters( 'sanitize_text_field', $filtered, $str );
4289
+	return apply_filters('sanitize_text_field', $filtered, $str);
4291 4290
 }
4292 4291
 
4293 4292
 /**
@@ -4299,8 +4298,8 @@  discard block
 block discarded – undo
4299 4298
  * @param string $suffix If the filename ends in suffix this will also be cut off.
4300 4299
  * @return string
4301 4300
  */
4302
-function wp_basename( $path, $suffix = '' ) {
4303
-	return urldecode( basename( str_replace( array( '%2F', '%5C' ), '/', urlencode( $path ) ), $suffix ) );
4301
+function wp_basename($path, $suffix = '') {
4302
+	return urldecode(basename(str_replace(array('%2F', '%5C'), '/', urlencode($path)), $suffix));
4304 4303
 }
4305 4304
 
4306 4305
 /**
@@ -4315,19 +4314,19 @@  discard block
 block discarded – undo
4315 4314
  * @param string $text The text to be modified.
4316 4315
  * @return string The modified text.
4317 4316
  */
4318
-function capital_P_dangit( $text ) {
4317
+function capital_P_dangit($text) {
4319 4318
 	// Simple replacement for titles
4320 4319
 	$current_filter = current_filter();
4321
-	if ( 'the_title' === $current_filter || 'wp_title' === $current_filter )
4322
-		return str_replace( 'Wordpress', 'WordPress', $text );
4320
+	if ('the_title' === $current_filter || 'wp_title' === $current_filter)
4321
+		return str_replace('Wordpress', 'WordPress', $text);
4323 4322
 	// Still here? Use the more judicious replacement
4324 4323
 	static $dblq = false;
4325
-	if ( false === $dblq ) {
4326
-		$dblq = _x( '&#8220;', 'opening curly double quote' );
4324
+	if (false === $dblq) {
4325
+		$dblq = _x('&#8220;', 'opening curly double quote');
4327 4326
 	}
4328 4327
 	return str_replace(
4329
-		array( ' Wordpress', '&#8216;Wordpress', $dblq . 'Wordpress', '>Wordpress', '(Wordpress' ),
4330
-		array( ' WordPress', '&#8216;WordPress', $dblq . 'WordPress', '>WordPress', '(WordPress' ),
4328
+		array(' Wordpress', '&#8216;Wordpress', $dblq.'Wordpress', '>Wordpress', '(Wordpress'),
4329
+		array(' WordPress', '&#8216;WordPress', $dblq.'WordPress', '>WordPress', '(WordPress'),
4331 4330
 	$text );
4332 4331
 }
4333 4332
 
@@ -4339,8 +4338,8 @@  discard block
 block discarded – undo
4339 4338
  * @param string $mime_type Mime type
4340 4339
  * @return string Sanitized mime type
4341 4340
  */
4342
-function sanitize_mime_type( $mime_type ) {
4343
-	$sani_mime_type = preg_replace( '/[^-+*.a-zA-Z0-9\/]/', '', $mime_type );
4341
+function sanitize_mime_type($mime_type) {
4342
+	$sani_mime_type = preg_replace('/[^-+*.a-zA-Z0-9\/]/', '', $mime_type);
4344 4343
 	/**
4345 4344
 	 * Filter a mime type following sanitization.
4346 4345
 	 *
@@ -4349,7 +4348,7 @@  discard block
 block discarded – undo
4349 4348
 	 * @param string $sani_mime_type The sanitized mime type.
4350 4349
 	 * @param string $mime_type      The mime type prior to sanitization.
4351 4350
 	 */
4352
-	return apply_filters( 'sanitize_mime_type', $sani_mime_type, $mime_type );
4351
+	return apply_filters('sanitize_mime_type', $sani_mime_type, $mime_type);
4353 4352
 }
4354 4353
 
4355 4354
 /**
@@ -4360,14 +4359,14 @@  discard block
 block discarded – undo
4360 4359
  * @param string $to_ping Space or carriage return separated URLs
4361 4360
  * @return string URLs starting with the http or https protocol, separated by a carriage return.
4362 4361
  */
4363
-function sanitize_trackback_urls( $to_ping ) {
4364
-	$urls_to_ping = preg_split( '/[\r\n\t ]/', trim( $to_ping ), -1, PREG_SPLIT_NO_EMPTY );
4365
-	foreach ( $urls_to_ping as $k => $url ) {
4366
-		if ( !preg_match( '#^https?://.#i', $url ) )
4367
-			unset( $urls_to_ping[$k] );
4362
+function sanitize_trackback_urls($to_ping) {
4363
+	$urls_to_ping = preg_split('/[\r\n\t ]/', trim($to_ping), -1, PREG_SPLIT_NO_EMPTY);
4364
+	foreach ($urls_to_ping as $k => $url) {
4365
+		if ( ! preg_match('#^https?://.#i', $url))
4366
+			unset($urls_to_ping[$k]);
4368 4367
 	}
4369
-	$urls_to_ping = array_map( 'esc_url_raw', $urls_to_ping );
4370
-	$urls_to_ping = implode( "\n", $urls_to_ping );
4368
+	$urls_to_ping = array_map('esc_url_raw', $urls_to_ping);
4369
+	$urls_to_ping = implode("\n", $urls_to_ping);
4371 4370
 	/**
4372 4371
 	 * Filter a list of trackback URLs following sanitization.
4373 4372
 	 *
@@ -4379,7 +4378,7 @@  discard block
 block discarded – undo
4379 4378
 	 * @param string $urls_to_ping Sanitized space or carriage return separated URLs.
4380 4379
 	 * @param string $to_ping      Space or carriage return separated URLs before sanitization.
4381 4380
 	 */
4382
-	return apply_filters( 'sanitize_trackback_urls', $urls_to_ping, $to_ping );
4381
+	return apply_filters('sanitize_trackback_urls', $urls_to_ping, $to_ping);
4383 4382
 }
4384 4383
 
4385 4384
 /**
@@ -4393,17 +4392,17 @@  discard block
 block discarded – undo
4393 4392
  * @param string|array $value String or array of strings to slash.
4394 4393
  * @return string|array Slashed $value
4395 4394
  */
4396
-function wp_slash( $value ) {
4397
-	if ( is_array( $value ) ) {
4398
-		foreach ( $value as $k => $v ) {
4399
-			if ( is_array( $v ) ) {
4400
-				$value[$k] = wp_slash( $v );
4395
+function wp_slash($value) {
4396
+	if (is_array($value)) {
4397
+		foreach ($value as $k => $v) {
4398
+			if (is_array($v)) {
4399
+				$value[$k] = wp_slash($v);
4401 4400
 			} else {
4402
-				$value[$k] = addslashes( $v );
4401
+				$value[$k] = addslashes($v);
4403 4402
 			}
4404 4403
 		}
4405 4404
 	} else {
4406
-		$value = addslashes( $value );
4405
+		$value = addslashes($value);
4407 4406
 	}
4408 4407
 
4409 4408
 	return $value;
@@ -4420,8 +4419,8 @@  discard block
 block discarded – undo
4420 4419
  * @param string|array $value String or array of strings to unslash.
4421 4420
  * @return string|array Unslashed $value
4422 4421
  */
4423
-function wp_unslash( $value ) {
4424
-	return stripslashes_deep( $value );
4422
+function wp_unslash($value) {
4423
+	return stripslashes_deep($value);
4425 4424
 }
4426 4425
 
4427 4426
 /**
@@ -4432,13 +4431,13 @@  discard block
 block discarded – undo
4432 4431
  * @param string $content A string which might contain a URL.
4433 4432
  * @return string|false The found URL.
4434 4433
  */
4435
-function get_url_in_content( $content ) {
4436
-	if ( empty( $content ) ) {
4434
+function get_url_in_content($content) {
4435
+	if (empty($content)) {
4437 4436
 		return false;
4438 4437
 	}
4439 4438
 
4440
-	if ( preg_match( '/<a\s[^>]*?href=([\'"])(.+?)\1/is', $content, $matches ) ) {
4441
-		return esc_url_raw( $matches[2] );
4439
+	if (preg_match('/<a\s[^>]*?href=([\'"])(.+?)\1/is', $content, $matches)) {
4440
+		return esc_url_raw($matches[2]);
4442 4441
 	}
4443 4442
 
4444 4443
 	return false;
@@ -4460,7 +4459,7 @@  discard block
 block discarded – undo
4460 4459
 function wp_spaces_regexp() {
4461 4460
 	static $spaces = '';
4462 4461
 
4463
-	if ( empty( $spaces ) ) {
4462
+	if (empty($spaces)) {
4464 4463
 		/**
4465 4464
 		 * Filter the regexp for common whitespace characters.
4466 4465
 		 *
@@ -4473,7 +4472,7 @@  discard block
 block discarded – undo
4473 4472
 		 *
4474 4473
 		 * @param string $spaces Regexp pattern for matching common whitespace characters.
4475 4474
 		 */
4476
-		$spaces = apply_filters( 'wp_spaces_regexp', '[\r\n\t ]|\xC2\xA0|&nbsp;' );
4475
+		$spaces = apply_filters('wp_spaces_regexp', '[\r\n\t ]|\xC2\xA0|&nbsp;');
4477 4476
 	}
4478 4477
 
4479 4478
 	return $spaces;
@@ -4489,7 +4488,7 @@  discard block
 block discarded – undo
4489 4488
 function print_emoji_styles() {
4490 4489
 	static $printed = false;
4491 4490
 
4492
-	if ( $printed ) {
4491
+	if ($printed) {
4493 4492
 		return;
4494 4493
 	}
4495 4494
 
@@ -4521,7 +4520,7 @@  discard block
 block discarded – undo
4521 4520
 	global $wp_version;
4522 4521
 	static $printed = false;
4523 4522
 
4524
-	if ( $printed ) {
4523
+	if ($printed) {
4525 4524
 		return;
4526 4525
 	}
4527 4526
 
@@ -4535,7 +4534,7 @@  discard block
 block discarded – undo
4535 4534
 		 *
4536 4535
 		 * @param string The emoji base URL.
4537 4536
 		 */
4538
-		'baseUrl' => apply_filters( 'emoji_url', 'https://s.w.org/images/core/emoji/72x72/' ),
4537
+		'baseUrl' => apply_filters('emoji_url', 'https://s.w.org/images/core/emoji/72x72/'),
4539 4538
 
4540 4539
 		/**
4541 4540
 		 * Filter the extension of the emoji files.
@@ -4544,29 +4543,29 @@  discard block
 block discarded – undo
4544 4543
 		 *
4545 4544
 		 * @param string The emoji extension. Default .png.
4546 4545
 		 */
4547
-		'ext' => apply_filters( 'emoji_ext', '.png' ),
4546
+		'ext' => apply_filters('emoji_ext', '.png'),
4548 4547
 	);
4549 4548
 
4550
-	$version = 'ver=' . $wp_version;
4549
+	$version = 'ver='.$wp_version;
4551 4550
 
4552
-	if ( SCRIPT_DEBUG ) {
4551
+	if (SCRIPT_DEBUG) {
4553 4552
 		$settings['source'] = array(
4554 4553
 			/** This filter is documented in wp-includes/class.wp-scripts.php */
4555
-			'wpemoji' => apply_filters( 'script_loader_src', includes_url( "js/wp-emoji.js?$version" ), 'wpemoji' ),
4554
+			'wpemoji' => apply_filters('script_loader_src', includes_url("js/wp-emoji.js?$version"), 'wpemoji'),
4556 4555
 			/** This filter is documented in wp-includes/class.wp-scripts.php */
4557
-			'twemoji' => apply_filters( 'script_loader_src', includes_url( "js/twemoji.js?$version" ), 'twemoji' ),
4556
+			'twemoji' => apply_filters('script_loader_src', includes_url("js/twemoji.js?$version"), 'twemoji'),
4558 4557
 		);
4559 4558
 
4560 4559
 		?>
4561 4560
 		<script type="text/javascript">
4562
-			window._wpemojiSettings = <?php echo wp_json_encode( $settings ); ?>;
4563
-			<?php readfile( ABSPATH . WPINC . "/js/wp-emoji-loader.js" ); ?>
4561
+			window._wpemojiSettings = <?php echo wp_json_encode($settings); ?>;
4562
+			<?php readfile(ABSPATH.WPINC."/js/wp-emoji-loader.js"); ?>
4564 4563
 		</script>
4565 4564
 		<?php
4566 4565
 	} else {
4567 4566
 		$settings['source'] = array(
4568 4567
 			/** This filter is documented in wp-includes/class.wp-scripts.php */
4569
-			'concatemoji' => apply_filters( 'script_loader_src', includes_url( "js/wp-emoji-release.min.js?$version" ), 'concatemoji' ),
4568
+			'concatemoji' => apply_filters('script_loader_src', includes_url("js/wp-emoji-release.min.js?$version"), 'concatemoji'),
4570 4569
 		);
4571 4570
 
4572 4571
 		/*
@@ -4581,7 +4580,7 @@  discard block
 block discarded – undo
4581 4580
 		 */
4582 4581
 		?>
4583 4582
 		<script type="text/javascript">
4584
-			window._wpemojiSettings = <?php echo wp_json_encode( $settings ); ?>;
4583
+			window._wpemojiSettings = <?php echo wp_json_encode($settings); ?>;
4585 4584
 			include "js/wp-emoji-loader.min.js"
4586 4585
 		</script>
4587 4586
 		<?php
@@ -4601,8 +4600,8 @@  discard block
 block discarded – undo
4601 4600
  * @param string $content The content to encode.
4602 4601
  * @return string The encoded content.
4603 4602
  */
4604
-function wp_encode_emoji( $content ) {
4605
-	if ( function_exists( 'mb_convert_encoding' ) ) {
4603
+function wp_encode_emoji($content) {
4604
+	if (function_exists('mb_convert_encoding')) {
4606 4605
 		$regex = '/(
4607 4606
 		     \x23\xE2\x83\xA3               # Digits
4608 4607
 		     [\x30-\x39]\xE2\x83\xA3
@@ -4614,18 +4613,18 @@  discard block
 block discarded – undo
4614 4613
 		)/x';
4615 4614
 
4616 4615
 		$matches = array();
4617
-		if ( preg_match_all( $regex, $content, $matches ) ) {
4618
-			if ( ! empty( $matches[1] ) ) {
4619
-				foreach ( $matches[1] as $emoji ) {
4616
+		if (preg_match_all($regex, $content, $matches)) {
4617
+			if ( ! empty($matches[1])) {
4618
+				foreach ($matches[1] as $emoji) {
4620 4619
 					/*
4621 4620
 					 * UTF-32's hex encoding is the same as HTML's hex encoding.
4622 4621
 					 * So, by converting the emoji from UTF-8 to UTF-32, we magically
4623 4622
 					 * get the correct hex encoding.
4624 4623
 					 */
4625
-					$unpacked = unpack( 'H*', mb_convert_encoding( $emoji, 'UTF-32', 'UTF-8' ) );
4626
-					if ( isset( $unpacked[1] ) ) {
4627
-						$entity = '&#x' . ltrim( $unpacked[1], '0' ) . ';';
4628
-						$content = str_replace( $emoji, $entity, $content );
4624
+					$unpacked = unpack('H*', mb_convert_encoding($emoji, 'UTF-32', 'UTF-8'));
4625
+					if (isset($unpacked[1])) {
4626
+						$entity = '&#x'.ltrim($unpacked[1], '0').';';
4627
+						$content = str_replace($emoji, $entity, $content);
4629 4628
 					}
4630 4629
 				}
4631 4630
 			}
@@ -4643,14 +4642,14 @@  discard block
 block discarded – undo
4643 4642
  * @param string $text The content to encode.
4644 4643
  * @return string The encoded content.
4645 4644
  */
4646
-function wp_staticize_emoji( $text ) {
4647
-	$text = wp_encode_emoji( $text );
4645
+function wp_staticize_emoji($text) {
4646
+	$text = wp_encode_emoji($text);
4648 4647
 
4649 4648
 	/** This filter is documented in wp-includes/formatting.php */
4650
-	$cdn_url = apply_filters( 'emoji_url', 'https://s.w.org/images/core/emoji/72x72/' );
4649
+	$cdn_url = apply_filters('emoji_url', 'https://s.w.org/images/core/emoji/72x72/');
4651 4650
 
4652 4651
 	/** This filter is documented in wp-includes/formatting.php */
4653
-	$ext = apply_filters( 'emoji_ext', '.png' );
4652
+	$ext = apply_filters('emoji_ext', '.png');
4654 4653
 
4655 4654
 	$output = '';
4656 4655
 	/*
@@ -4659,33 +4658,33 @@  discard block
 block discarded – undo
4659 4658
 	 *
4660 4659
 	 * First, capture the tags as well as in between.
4661 4660
 	 */
4662
-	$textarr = preg_split( '/(<.*>)/U', $text, -1, PREG_SPLIT_DELIM_CAPTURE );
4663
-	$stop = count( $textarr );
4661
+	$textarr = preg_split('/(<.*>)/U', $text, -1, PREG_SPLIT_DELIM_CAPTURE);
4662
+	$stop = count($textarr);
4664 4663
 
4665 4664
 	// Ignore processing of specific tags.
4666 4665
 	$tags_to_ignore = 'code|pre|style|script|textarea';
4667 4666
 	$ignore_block_element = '';
4668 4667
 
4669
-	for ( $i = 0; $i < $stop; $i++ ) {
4668
+	for ($i = 0; $i < $stop; $i++) {
4670 4669
 		$content = $textarr[$i];
4671 4670
 
4672 4671
 		// If we're in an ignore block, wait until we find its closing tag.
4673
-		if ( '' == $ignore_block_element && preg_match( '/^<(' . $tags_to_ignore . ')>/', $content, $matches ) )  {
4672
+		if ('' == $ignore_block_element && preg_match('/^<('.$tags_to_ignore.')>/', $content, $matches)) {
4674 4673
 			$ignore_block_element = $matches[1];
4675 4674
 		}
4676 4675
 
4677 4676
 		// If it's not a tag and not in ignore block.
4678
-		if ( '' ==  $ignore_block_element && strlen( $content ) > 0 && '<' != $content[0] ) {
4677
+		if ('' == $ignore_block_element && strlen($content) > 0 && '<' != $content[0]) {
4679 4678
 			$matches = array();
4680
-			if ( preg_match_all( '/(&#x1f1(e[6-9a-f]|f[0-9a-f]);){2}/', $content, $matches ) ) {
4681
-				if ( ! empty( $matches[0] ) ) {
4682
-					foreach ( $matches[0] as $flag ) {
4683
-						$chars = str_replace( array( '&#x', ';'), '', $flag );
4679
+			if (preg_match_all('/(&#x1f1(e[6-9a-f]|f[0-9a-f]);){2}/', $content, $matches)) {
4680
+				if ( ! empty($matches[0])) {
4681
+					foreach ($matches[0] as $flag) {
4682
+						$chars = str_replace(array('&#x', ';'), '', $flag);
4684 4683
 
4685
-						list( $char1, $char2 ) = str_split( $chars, 5 );
4686
-						$entity = sprintf( '<img src="%s" alt="%s" class="wp-smiley" style="height: 1em; max-height: 1em;" />', $cdn_url . $char1 . '-' . $char2 . $ext, html_entity_decode( $flag ) );
4684
+						list($char1, $char2) = str_split($chars, 5);
4685
+						$entity = sprintf('<img src="%s" alt="%s" class="wp-smiley" style="height: 1em; max-height: 1em;" />', $cdn_url.$char1.'-'.$char2.$ext, html_entity_decode($flag));
4687 4686
 
4688
-						$content = str_replace( $flag, $entity, $content );
4687
+						$content = str_replace($flag, $entity, $content);
4689 4688
 					}
4690 4689
 				}
4691 4690
 			}
@@ -4694,20 +4693,20 @@  discard block
 block discarded – undo
4694 4693
 			$regex = '/(&#x[2-3][0-9a-f]{3};|&#x1f[1-6][0-9a-f]{2};)/';
4695 4694
 
4696 4695
 			$matches = array();
4697
-			if ( preg_match_all( $regex, $content, $matches ) ) {
4698
-				if ( ! empty( $matches[1] ) ) {
4699
-					foreach ( $matches[1] as $emoji ) {
4700
-						$char = str_replace( array( '&#x', ';'), '', $emoji );
4701
-						$entity = sprintf( '<img src="%s" alt="%s" class="wp-smiley" style="height: 1em; max-height: 1em;" />', $cdn_url . $char . $ext, html_entity_decode( $emoji ) );
4696
+			if (preg_match_all($regex, $content, $matches)) {
4697
+				if ( ! empty($matches[1])) {
4698
+					foreach ($matches[1] as $emoji) {
4699
+						$char = str_replace(array('&#x', ';'), '', $emoji);
4700
+						$entity = sprintf('<img src="%s" alt="%s" class="wp-smiley" style="height: 1em; max-height: 1em;" />', $cdn_url.$char.$ext, html_entity_decode($emoji));
4702 4701
 
4703
-						$content = str_replace( $emoji, $entity, $content );
4702
+						$content = str_replace($emoji, $entity, $content);
4704 4703
 					}
4705 4704
 				}
4706 4705
 			}
4707 4706
 		}
4708 4707
 
4709 4708
 		// Did we exit ignore block.
4710
-		if ( '' != $ignore_block_element && '</' . $ignore_block_element . '>' == $content )  {
4709
+		if ('' != $ignore_block_element && '</'.$ignore_block_element.'>' == $content) {
4711 4710
 			$ignore_block_element = '';
4712 4711
 		}
4713 4712
 
@@ -4725,8 +4724,8 @@  discard block
 block discarded – undo
4725 4724
  * @param array $mail The email data array.
4726 4725
  * @return array The email data array, with emoji in the message staticized.
4727 4726
  */
4728
-function wp_staticize_emoji_for_email( $mail ) {
4729
-	if ( ! isset( $mail['message'] ) ) {
4727
+function wp_staticize_emoji_for_email($mail) {
4728
+	if ( ! isset($mail['message'])) {
4730 4729
 		return $mail;
4731 4730
 	}
4732 4731
 
@@ -4738,47 +4737,47 @@  discard block
 block discarded – undo
4738 4737
 	 * is handling changing the Content-Type.
4739 4738
 	 */
4740 4739
 	$headers = array();
4741
-	if ( isset( $mail['headers'] ) ) {
4742
-		if ( is_array( $mail['headers'] ) ) {
4740
+	if (isset($mail['headers'])) {
4741
+		if (is_array($mail['headers'])) {
4743 4742
 			$headers = $mail['headers'];
4744 4743
 		} else {
4745
-			$headers = explode( "\n", str_replace( "\r\n", "\n", $mail['headers'] ) );
4744
+			$headers = explode("\n", str_replace("\r\n", "\n", $mail['headers']));
4746 4745
 		}
4747 4746
 	}
4748 4747
 
4749
-	foreach ( $headers as $header ) {
4750
-		if ( strpos($header, ':') === false ) {
4748
+	foreach ($headers as $header) {
4749
+		if (strpos($header, ':') === false) {
4751 4750
 			continue;
4752 4751
 		}
4753 4752
 
4754 4753
 		// Explode them out.
4755
-		list( $name, $content ) = explode( ':', trim( $header ), 2 );
4754
+		list($name, $content) = explode(':', trim($header), 2);
4756 4755
 
4757 4756
 		// Cleanup crew.
4758
-		$name    = trim( $name    );
4759
-		$content = trim( $content );
4757
+		$name    = trim($name);
4758
+		$content = trim($content);
4760 4759
 
4761
-		if ( 'content-type' === strtolower( $name ) ) {
4762
-			if ( strpos( $content, ';' ) !== false ) {
4763
-				list( $type, $charset ) = explode( ';', $content );
4764
-				$content_type = trim( $type );
4760
+		if ('content-type' === strtolower($name)) {
4761
+			if (strpos($content, ';') !== false) {
4762
+				list($type, $charset) = explode(';', $content);
4763
+				$content_type = trim($type);
4765 4764
 			} else {
4766
-				$content_type = trim( $content );
4765
+				$content_type = trim($content);
4767 4766
 			}
4768 4767
 			break;
4769 4768
 		}
4770 4769
 	}
4771 4770
 
4772 4771
 	// Set Content-Type if we don't have a content-type from the input headers.
4773
-	if ( ! isset( $content_type ) ) {
4772
+	if ( ! isset($content_type)) {
4774 4773
 		$content_type = 'text/plain';
4775 4774
 	}
4776 4775
 
4777 4776
 	/** This filter is documented in wp-includes/pluggable.php */
4778
-	$content_type = apply_filters( 'wp_mail_content_type', $content_type );
4777
+	$content_type = apply_filters('wp_mail_content_type', $content_type);
4779 4778
 
4780
-	if ( 'text/html' === $content_type ) {
4781
-		$mail['message'] = wp_staticize_emoji( $mail['message'] );
4779
+	if ('text/html' === $content_type) {
4780
+		$mail['message'] = wp_staticize_emoji($mail['message']);
4782 4781
 	}
4783 4782
 
4784 4783
 	return $mail;
@@ -4794,12 +4793,12 @@  discard block
 block discarded – undo
4794 4793
  * @param int    $length Optional. Maximum length of the shortened URL. Default 35 characters.
4795 4794
  * @return string Shortened URL.
4796 4795
  */
4797
-function url_shorten( $url, $length = 35 ) {
4798
-	$stripped = str_replace( array( 'https://', 'http://', 'www.' ), '', $url );
4799
-	$short_url = untrailingslashit( $stripped );
4796
+function url_shorten($url, $length = 35) {
4797
+	$stripped = str_replace(array('https://', 'http://', 'www.'), '', $url);
4798
+	$short_url = untrailingslashit($stripped);
4800 4799
 
4801
-	if ( strlen( $short_url ) > $length ) {
4802
-		$short_url = substr( $short_url, 0, $length - 3 ) . '&hellip;';
4800
+	if (strlen($short_url) > $length) {
4801
+		$short_url = substr($short_url, 0, $length - 3).'&hellip;';
4803 4802
 	}
4804 4803
 	return $short_url;
4805 4804
 }
Please login to merge, or discard this patch.
Braces   +222 added lines, -139 removed lines patch added patch discarded remove patch
@@ -429,8 +429,9 @@  discard block
 block discarded – undo
429 429
 function wpautop( $pee, $br = true ) {
430 430
 	$pre_tags = array();
431 431
 
432
-	if ( trim($pee) === '' )
433
-		return '';
432
+	if ( trim($pee) === '' ) {
433
+			return '';
434
+	}
434 435
 
435 436
 	// Just to make things a little easier, pad the end.
436 437
 	$pee = $pee . "\n";
@@ -565,8 +566,9 @@  discard block
 block discarded – undo
565 566
 	$pee = preg_replace( "|\n</p>$|", '</p>', $pee );
566 567
 
567 568
 	// Replace placeholder <pre> tags with their original content.
568
-	if ( !empty($pre_tags) )
569
-		$pee = str_replace(array_keys($pre_tags), array_values($pre_tags), $pee);
569
+	if ( !empty($pre_tags) ) {
570
+			$pee = str_replace(array_keys($pre_tags), array_values($pre_tags), $pee);
571
+	}
570 572
 
571 573
 	// Restore newlines in all elements.
572 574
 	if ( false !== strpos( $pee, '<!-- wpnl -->' ) ) {
@@ -850,16 +852,38 @@  discard block
 block discarded – undo
850 852
 	reset_mbstring_encoding();
851 853
 	for ($i=0; $i < $length; $i++) {
852 854
 		$c = ord($str[$i]);
853
-		if ($c < 0x80) $n = 0; // 0bbbbbbb
854
-		elseif (($c & 0xE0) == 0xC0) $n=1; // 110bbbbb
855
-		elseif (($c & 0xF0) == 0xE0) $n=2; // 1110bbbb
856
-		elseif (($c & 0xF8) == 0xF0) $n=3; // 11110bbb
857
-		elseif (($c & 0xFC) == 0xF8) $n=4; // 111110bb
858
-		elseif (($c & 0xFE) == 0xFC) $n=5; // 1111110b
859
-		else return false; // Does not match any model
855
+		if ($c < 0x80) {
856
+			$n = 0;
857
+		}
858
+		// 0bbbbbbb
859
+		elseif (($c & 0xE0) == 0xC0) {
860
+			$n=1;
861
+		}
862
+		// 110bbbbb
863
+		elseif (($c & 0xF0) == 0xE0) {
864
+			$n=2;
865
+		}
866
+		// 1110bbbb
867
+		elseif (($c & 0xF8) == 0xF0) {
868
+			$n=3;
869
+		}
870
+		// 11110bbb
871
+		elseif (($c & 0xFC) == 0xF8) {
872
+			$n=4;
873
+		}
874
+		// 111110bb
875
+		elseif (($c & 0xFE) == 0xFC) {
876
+			$n=5;
877
+		}
878
+		// 1111110b
879
+		else {
880
+			return false;
881
+		}
882
+		// Does not match any model
860 883
 		for ($j=0; $j<$n; $j++) { // n bytes matching 10bbbbbb follow ?
861
-			if ((++$i == $length) || ((ord($str[$i]) & 0xC0) != 0x80))
862
-				return false;
884
+			if ((++$i == $length) || ((ord($str[$i]) & 0xC0) != 0x80)) {
885
+							return false;
886
+			}
863 887
 		}
864 888
 	}
865 889
 	return true;
@@ -891,18 +915,21 @@  discard block
 block discarded – undo
891 915
 function _wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) {
892 916
 	$string = (string) $string;
893 917
 
894
-	if ( 0 === strlen( $string ) )
895
-		return '';
918
+	if ( 0 === strlen( $string ) ) {
919
+			return '';
920
+	}
896 921
 
897 922
 	// Don't bother if there are no specialchars - saves some processing
898
-	if ( ! preg_match( '/[&<>"\']/', $string ) )
899
-		return $string;
923
+	if ( ! preg_match( '/[&<>"\']/', $string ) ) {
924
+			return $string;
925
+	}
900 926
 
901 927
 	// Account for the previous behaviour of the function when the $quote_style is not an accepted value
902
-	if ( empty( $quote_style ) )
903
-		$quote_style = ENT_NOQUOTES;
904
-	elseif ( ! in_array( $quote_style, array( 0, 2, 3, 'single', 'double' ), true ) )
905
-		$quote_style = ENT_QUOTES;
928
+	if ( empty( $quote_style ) ) {
929
+			$quote_style = ENT_NOQUOTES;
930
+	} elseif ( ! in_array( $quote_style, array( 0, 2, 3, 'single', 'double' ), true ) ) {
931
+			$quote_style = ENT_QUOTES;
932
+	}
906 933
 
907 934
 	// Store the site charset as a static to avoid multiple calls to wp_load_alloptions()
908 935
 	if ( ! $charset ) {
@@ -914,8 +941,9 @@  discard block
 block discarded – undo
914 941
 		$charset = $_charset;
915 942
 	}
916 943
 
917
-	if ( in_array( $charset, array( 'utf8', 'utf-8', 'UTF8' ) ) )
918
-		$charset = 'UTF-8';
944
+	if ( in_array( $charset, array( 'utf8', 'utf-8', 'UTF8' ) ) ) {
945
+			$charset = 'UTF-8';
946
+	}
919 947
 
920 948
 	$_quote_style = $quote_style;
921 949
 
@@ -935,8 +963,9 @@  discard block
 block discarded – undo
935 963
 	$string = @htmlspecialchars( $string, $quote_style, $charset, $double_encode );
936 964
 
937 965
 	// Backwards compatibility
938
-	if ( 'single' === $_quote_style )
939
-		$string = str_replace( "'", '&#039;', $string );
966
+	if ( 'single' === $_quote_style ) {
967
+			$string = str_replace( "'", '&#039;', $string );
968
+	}
940 969
 
941 970
 	return $string;
942 971
 }
@@ -1084,8 +1113,9 @@  discard block
 block discarded – undo
1084 1113
 		$value = ord( $utf8_string[ $i ] );
1085 1114
 
1086 1115
 		if ( $value < 128 ) {
1087
-			if ( $length && ( $unicode_length >= $length ) )
1088
-				break;
1116
+			if ( $length && ( $unicode_length >= $length ) ) {
1117
+							break;
1118
+			}
1089 1119
 			$unicode .= chr($value);
1090 1120
 			$unicode_length++;
1091 1121
 		} else {
@@ -1101,8 +1131,9 @@  discard block
 block discarded – undo
1101 1131
 
1102 1132
 			$values[] = $value;
1103 1133
 
1104
-			if ( $length && ( $unicode_length + ($num_octets * 3) ) > $length )
1105
-				break;
1134
+			if ( $length && ( $unicode_length + ($num_octets * 3) ) > $length ) {
1135
+							break;
1136
+			}
1106 1137
 			if ( count( $values ) == $num_octets ) {
1107 1138
 				for ( $j = 0; $j < $num_octets; $j++ ) {
1108 1139
 					$unicode .= '%' . dechex( $values[ $j ] );
@@ -1130,8 +1161,9 @@  discard block
 block discarded – undo
1130 1161
  * @return string Filtered string with replaced "nice" characters.
1131 1162
  */
1132 1163
 function remove_accents( $string ) {
1133
-	if ( !preg_match('/[\x80-\xff]/', $string) )
1134
-		return $string;
1164
+	if ( !preg_match('/[\x80-\xff]/', $string) ) {
1165
+			return $string;
1166
+	}
1135 1167
 
1136 1168
 	if (seems_utf8($string)) {
1137 1169
 		$chars = array(
@@ -1426,8 +1458,9 @@  discard block
 block discarded – undo
1426 1458
 					break;
1427 1459
 				}
1428 1460
 			}
1429
-			if ( !$allowed )
1430
-				$filename .= '_';
1461
+			if ( !$allowed ) {
1462
+							$filename .= '_';
1463
+			}
1431 1464
 		}
1432 1465
 	}
1433 1466
 	$filename .= '.' . $extension;
@@ -1458,8 +1491,9 @@  discard block
 block discarded – undo
1458 1491
 	$username = preg_replace( '/&.+?;/', '', $username ); // Kill entities
1459 1492
 
1460 1493
 	// If strict, reduce to ASCII for max portability.
1461
-	if ( $strict )
1462
-		$username = preg_replace( '|[^a-z0-9 _.\-@]|i', '', $username );
1494
+	if ( $strict ) {
1495
+			$username = preg_replace( '|[^a-z0-9 _.\-@]|i', '', $username );
1496
+	}
1463 1497
 
1464 1498
 	$username = trim( $username );
1465 1499
 	// Consolidate contiguous whitespace
@@ -1520,8 +1554,9 @@  discard block
 block discarded – undo
1520 1554
 function sanitize_title( $title, $fallback_title = '', $context = 'save' ) {
1521 1555
 	$raw_title = $title;
1522 1556
 
1523
-	if ( 'save' == $context )
1524
-		$title = remove_accents($title);
1557
+	if ( 'save' == $context ) {
1558
+			$title = remove_accents($title);
1559
+	}
1525 1560
 
1526 1561
 	/**
1527 1562
 	 * Filter a sanitized title string.
@@ -1534,8 +1569,9 @@  discard block
 block discarded – undo
1534 1569
 	 */
1535 1570
 	$title = apply_filters( 'sanitize_title', $title, $raw_title, $context );
1536 1571
 
1537
-	if ( '' === $title || false === $title )
1538
-		$title = $fallback_title;
1572
+	if ( '' === $title || false === $title ) {
1573
+			$title = $fallback_title;
1574
+	}
1539 1575
 
1540 1576
 	return $title;
1541 1577
 }
@@ -1850,8 +1886,9 @@  discard block
 block discarded – undo
1850 1886
 			elseif ( substr( $regex[2], -1 ) == '/' ) {
1851 1887
 				// ...but it isn't a known single-entity self-closing tag, then don't let it be treated as such and
1852 1888
 				// immediately close it with a closing tag (the tag will encapsulate no text as a result)
1853
-				if ( ! in_array( $tag, $single_tags ) )
1854
-					$regex[2] = trim( substr( $regex[2], 0, -1 ) ) . "></$tag";
1889
+				if ( ! in_array( $tag, $single_tags ) ) {
1890
+									$regex[2] = trim( substr( $regex[2], 0, -1 ) ) . "></$tag";
1891
+				}
1855 1892
 			}
1856 1893
 			// ElseIf it's a known single-entity tag but it doesn't close itself, do so
1857 1894
 			elseif ( in_array($tag, $single_tags) ) {
@@ -1869,8 +1906,9 @@  discard block
 block discarded – undo
1869 1906
 
1870 1907
 			// Attributes
1871 1908
 			$attributes = $regex[2];
1872
-			if ( ! empty( $attributes ) && $attributes[0] != '>' )
1873
-				$attributes = ' ' . $attributes;
1909
+			if ( ! empty( $attributes ) && $attributes[0] != '>' ) {
1910
+							$attributes = ' ' . $attributes;
1911
+			}
1874 1912
 
1875 1913
 			$tag = '<' . $tag . $attributes . '>';
1876 1914
 			//If already queuing a close tag, then put this tag on, too
@@ -1890,8 +1928,10 @@  discard block
 block discarded – undo
1890 1928
 	$newtext .= $text;
1891 1929
 
1892 1930
 	// Empty Stack
1893
-	while( $x = array_pop($tagstack) )
1894
-		$newtext .= '</' . $x . '>'; // Add remaining tags to close
1931
+	while( $x = array_pop($tagstack) ) {
1932
+			$newtext .= '</' . $x . '>';
1933
+	}
1934
+	// Add remaining tags to close
1895 1935
 
1896 1936
 	// WP fix for the bug with HTML comments
1897 1937
 	$newtext = str_replace("< !--","<!--",$newtext);
@@ -1925,8 +1965,9 @@  discard block
 block discarded – undo
1925 1965
 	 * @param string $content The text, prior to formatting for editing.
1926 1966
 	 */
1927 1967
 	$content = apply_filters( 'format_to_edit', $content );
1928
-	if ( ! $rich_text )
1929
-		$content = esc_textarea( $content );
1968
+	if ( ! $rich_text ) {
1969
+			$content = esc_textarea( $content );
1970
+	}
1930 1971
 	return $content;
1931 1972
 }
1932 1973
 
@@ -1960,8 +2001,9 @@  discard block
 block discarded – undo
1960 2001
  * @return string String with backslashes inserted.
1961 2002
  */
1962 2003
 function backslashit( $string ) {
1963
-	if ( isset( $string[0] ) && $string[0] >= '0' && $string[0] <= '9' )
1964
-		$string = '\\\\' . $string;
2004
+	if ( isset( $string[0] ) && $string[0] >= '0' && $string[0] <= '9' ) {
2005
+			$string = '\\\\' . $string;
2006
+	}
1965 2007
 	return addcslashes( $string, 'A..Za..z' );
1966 2008
 }
1967 2009
 
@@ -2010,8 +2052,9 @@  discard block
 block discarded – undo
2010 2052
  * @return string Returns a string escaped with slashes.
2011 2053
  */
2012 2054
 function addslashes_gpc($gpc) {
2013
-	if ( get_magic_quotes_gpc() )
2014
-		$gpc = stripslashes($gpc);
2055
+	if ( get_magic_quotes_gpc() ) {
2056
+			$gpc = stripslashes($gpc);
2057
+	}
2015 2058
 
2016 2059
 	return wp_slash($gpc);
2017 2060
 }
@@ -2132,8 +2175,9 @@  discard block
 block discarded – undo
2132 2175
 	}
2133 2176
 
2134 2177
 	$url = esc_url($url);
2135
-	if ( empty($url) )
2136
-		return $matches[0];
2178
+	if ( empty($url) ) {
2179
+			return $matches[0];
2180
+	}
2137 2181
 
2138 2182
 	return $matches[1] . "<a href=\"$url\" rel=\"nofollow\">$url</a>" . $suffix;
2139 2183
 }
@@ -2162,8 +2206,9 @@  discard block
 block discarded – undo
2162 2206
 	}
2163 2207
 
2164 2208
 	$dest = esc_url($dest);
2165
-	if ( empty($dest) )
2166
-		return $matches[0];
2209
+	if ( empty($dest) ) {
2210
+			return $matches[0];
2211
+	}
2167 2212
 
2168 2213
 	return $matches[1] . "<a href=\"$dest\" rel=\"nofollow\">$dest</a>$ret";
2169 2214
 }
@@ -2202,10 +2247,11 @@  discard block
 block discarded – undo
2202 2247
 	$nested_code_pre = 0; // Keep track of how many levels link is nested inside <pre> or <code>
2203 2248
 	foreach ( $textarr as $piece ) {
2204 2249
 
2205
-		if ( preg_match( '|^<code[\s>]|i', $piece ) || preg_match( '|^<pre[\s>]|i', $piece ) || preg_match( '|^<script[\s>]|i', $piece ) || preg_match( '|^<style[\s>]|i', $piece ) )
2206
-			$nested_code_pre++;
2207
-		elseif ( $nested_code_pre && ( '</code>' === strtolower( $piece ) || '</pre>' === strtolower( $piece ) || '</script>' === strtolower( $piece ) || '</style>' === strtolower( $piece ) ) )
2208
-			$nested_code_pre--;
2250
+		if ( preg_match( '|^<code[\s>]|i', $piece ) || preg_match( '|^<pre[\s>]|i', $piece ) || preg_match( '|^<script[\s>]|i', $piece ) || preg_match( '|^<style[\s>]|i', $piece ) ) {
2251
+					$nested_code_pre++;
2252
+		} elseif ( $nested_code_pre && ( '</code>' === strtolower( $piece ) || '</pre>' === strtolower( $piece ) || '</script>' === strtolower( $piece ) || '</style>' === strtolower( $piece ) ) ) {
2253
+					$nested_code_pre--;
2254
+		}
2209 2255
 
2210 2256
 		if ( $nested_code_pre || empty( $piece ) || ( $piece[0] === '<' && ! preg_match( '|^<\s*[\w]{1,20}+://|', $piece ) ) ) {
2211 2257
 			$r .= $piece;
@@ -2381,8 +2427,9 @@  discard block
 block discarded – undo
2381 2427
 function translate_smiley( $matches ) {
2382 2428
 	global $wpsmiliestrans;
2383 2429
 
2384
-	if ( count( $matches ) == 0 )
2385
-		return '';
2430
+	if ( count( $matches ) == 0 ) {
2431
+			return '';
2432
+	}
2386 2433
 
2387 2434
 	$smiley = trim( reset( $matches ) );
2388 2435
 	$img = $wpsmiliestrans[ $smiley ];
@@ -2474,8 +2521,9 @@  discard block
 block discarded – undo
2474 2521
  * @return string|bool Either false or the valid email address.
2475 2522
  */
2476 2523
 function is_email( $email, $deprecated = false ) {
2477
-	if ( ! empty( $deprecated ) )
2478
-		_deprecated_argument( __FUNCTION__, '3.0' );
2524
+	if ( ! empty( $deprecated ) ) {
2525
+			_deprecated_argument( __FUNCTION__, '3.0' );
2526
+	}
2479 2527
 
2480 2528
 	// Test for the minimum length the email can be
2481 2529
 	if ( strlen( $email ) < 3 ) {
@@ -2639,13 +2687,15 @@  discard block
 block discarded – undo
2639 2687
 	$tz = get_option( 'timezone_string' );
2640 2688
 	if ( $tz ) {
2641 2689
 		$datetime = date_create( $string, new DateTimeZone( 'UTC' ) );
2642
-		if ( ! $datetime )
2643
-			return date( $format, 0 );
2690
+		if ( ! $datetime ) {
2691
+					return date( $format, 0 );
2692
+		}
2644 2693
 		$datetime->setTimezone( new DateTimeZone( $tz ) );
2645 2694
 		$string_localtime = $datetime->format( $format );
2646 2695
 	} else {
2647
-		if ( ! preg_match('#([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})#', $string, $matches) )
2648
-			return date( $format, 0 );
2696
+		if ( ! preg_match('#([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})#', $string, $matches) ) {
2697
+					return date( $format, 0 );
2698
+		}
2649 2699
 		$string_time = gmmktime( $matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1] );
2650 2700
 		$string_localtime = gmdate( $format, $string_time + get_option( 'gmt_offset' ) * HOUR_IN_SECONDS );
2651 2701
 	}
@@ -2828,34 +2878,40 @@  discard block
 block discarded – undo
2828 2878
 
2829 2879
 	if ( $diff < HOUR_IN_SECONDS ) {
2830 2880
 		$mins = round( $diff / MINUTE_IN_SECONDS );
2831
-		if ( $mins <= 1 )
2832
-			$mins = 1;
2881
+		if ( $mins <= 1 ) {
2882
+					$mins = 1;
2883
+		}
2833 2884
 		/* translators: min=minute */
2834 2885
 		$since = sprintf( _n( '%s min', '%s mins', $mins ), $mins );
2835 2886
 	} elseif ( $diff < DAY_IN_SECONDS && $diff >= HOUR_IN_SECONDS ) {
2836 2887
 		$hours = round( $diff / HOUR_IN_SECONDS );
2837
-		if ( $hours <= 1 )
2838
-			$hours = 1;
2888
+		if ( $hours <= 1 ) {
2889
+					$hours = 1;
2890
+		}
2839 2891
 		$since = sprintf( _n( '%s hour', '%s hours', $hours ), $hours );
2840 2892
 	} elseif ( $diff < WEEK_IN_SECONDS && $diff >= DAY_IN_SECONDS ) {
2841 2893
 		$days = round( $diff / DAY_IN_SECONDS );
2842
-		if ( $days <= 1 )
2843
-			$days = 1;
2894
+		if ( $days <= 1 ) {
2895
+					$days = 1;
2896
+		}
2844 2897
 		$since = sprintf( _n( '%s day', '%s days', $days ), $days );
2845 2898
 	} elseif ( $diff < MONTH_IN_SECONDS && $diff >= WEEK_IN_SECONDS ) {
2846 2899
 		$weeks = round( $diff / WEEK_IN_SECONDS );
2847
-		if ( $weeks <= 1 )
2848
-			$weeks = 1;
2900
+		if ( $weeks <= 1 ) {
2901
+					$weeks = 1;
2902
+		}
2849 2903
 		$since = sprintf( _n( '%s week', '%s weeks', $weeks ), $weeks );
2850 2904
 	} elseif ( $diff < YEAR_IN_SECONDS && $diff >= MONTH_IN_SECONDS ) {
2851 2905
 		$months = round( $diff / MONTH_IN_SECONDS );
2852
-		if ( $months <= 1 )
2853
-			$months = 1;
2906
+		if ( $months <= 1 ) {
2907
+					$months = 1;
2908
+		}
2854 2909
 		$since = sprintf( _n( '%s month', '%s months', $months ), $months );
2855 2910
 	} elseif ( $diff >= YEAR_IN_SECONDS ) {
2856 2911
 		$years = round( $diff / YEAR_IN_SECONDS );
2857
-		if ( $years <= 1 )
2858
-			$years = 1;
2912
+		if ( $years <= 1 ) {
2913
+					$years = 1;
2914
+		}
2859 2915
 		$since = sprintf( _n( '%s year', '%s years', $years ), $years );
2860 2916
 	}
2861 2917
 
@@ -3006,8 +3062,9 @@  discard block
 block discarded – undo
3006 3062
 	 * @param string $text           The text prior to entity conversion.
3007 3063
 	 */
3008 3064
 	$filtered = apply_filters( 'pre_ent2ncr', null, $text );
3009
-	if ( null !== $filtered )
3010
-		return $filtered;
3065
+	if ( null !== $filtered ) {
3066
+			return $filtered;
3067
+	}
3011 3068
 
3012 3069
 	$to_ncr = array(
3013 3070
 		'&quot;' => '&#34;',
@@ -3369,8 +3426,9 @@  discard block
 block discarded – undo
3369 3426
 function esc_url( $url, $protocols = null, $_context = 'display' ) {
3370 3427
 	$original_url = $url;
3371 3428
 
3372
-	if ( '' == $url )
3373
-		return $url;
3429
+	if ( '' == $url ) {
3430
+			return $url;
3431
+	}
3374 3432
 
3375 3433
 	$url = str_replace( ' ', '%20', $url );
3376 3434
 	$url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\[\]\\x80-\\xff]|i', '', $url);
@@ -3390,8 +3448,9 @@  discard block
 block discarded – undo
3390 3448
 	 * link starting with /, # or ? or a php file).
3391 3449
 	 */
3392 3450
 	if ( strpos($url, ':') === false && ! in_array( $url[0], array( '/', '#', '?' ) ) &&
3393
-		! preg_match('/^[a-z0-9-]+?\.php/i', $url) )
3394
-		$url = 'http://' . $url;
3451
+		! preg_match('/^[a-z0-9-]+?\.php/i', $url) ) {
3452
+			$url = 'http://' . $url;
3453
+	}
3395 3454
 
3396 3455
 	// Replace ampersands and single quotes only when displaying.
3397 3456
 	if ( 'display' == $_context ) {
@@ -3440,11 +3499,13 @@  discard block
 block discarded – undo
3440 3499
 	if ( '/' === $url[0] ) {
3441 3500
 		$good_protocol_url = $url;
3442 3501
 	} else {
3443
-		if ( ! is_array( $protocols ) )
3444
-			$protocols = wp_allowed_protocols();
3502
+		if ( ! is_array( $protocols ) ) {
3503
+					$protocols = wp_allowed_protocols();
3504
+		}
3445 3505
 		$good_protocol_url = wp_kses_bad_protocol( $url, $protocols );
3446
-		if ( strtolower( $good_protocol_url ) != strtolower( $url ) )
3447
-			return '';
3506
+		if ( strtolower( $good_protocol_url ) != strtolower( $url ) ) {
3507
+					return '';
3508
+		}
3448 3509
 	}
3449 3510
 
3450 3511
 	/**
@@ -3690,17 +3751,20 @@  discard block
 block discarded – undo
3690 3751
 		case 'posts_per_page':
3691 3752
 		case 'posts_per_rss':
3692 3753
 			$value = (int) $value;
3693
-			if ( empty($value) )
3694
-				$value = 1;
3695
-			if ( $value < -1 )
3696
-				$value = abs($value);
3754
+			if ( empty($value) ) {
3755
+							$value = 1;
3756
+			}
3757
+			if ( $value < -1 ) {
3758
+							$value = abs($value);
3759
+			}
3697 3760
 			break;
3698 3761
 
3699 3762
 		case 'default_ping_status':
3700 3763
 		case 'default_comment_status':
3701 3764
 			// Options that if not there have 0 value but need to be something like "closed"
3702
-			if ( $value == '0' || $value == '')
3703
-				$value = 'closed';
3765
+			if ( $value == '0' || $value == '') {
3766
+							$value = 'closed';
3767
+			}
3704 3768
 			break;
3705 3769
 
3706 3770
 		case 'blogdescription':
@@ -3719,10 +3783,11 @@  discard block
 block discarded – undo
3719 3783
 
3720 3784
 		case 'blog_public':
3721 3785
 			// This is the value if the settings checkbox is not checked on POST. Don't rely on this.
3722
-			if ( null === $value )
3723
-				$value = 1;
3724
-			else
3725
-				$value = intval( $value );
3786
+			if ( null === $value ) {
3787
+							$value = 1;
3788
+			} else {
3789
+							$value = intval( $value );
3790
+			}
3726 3791
 			break;
3727 3792
 
3728 3793
 		case 'date_format':
@@ -3792,13 +3857,15 @@  discard block
 block discarded – undo
3792 3857
 			if ( is_wp_error( $value ) ) {
3793 3858
 				$error = $value->get_error_message();
3794 3859
 			} else {
3795
-				if ( ! is_array( $value ) )
3796
-					$value = explode( ' ', $value );
3860
+				if ( ! is_array( $value ) ) {
3861
+									$value = explode( ' ', $value );
3862
+				}
3797 3863
 
3798 3864
 				$value = array_values( array_filter( array_map( 'trim', $value ) ) );
3799 3865
 
3800
-				if ( ! $value )
3801
-					$value = '';
3866
+				if ( ! $value ) {
3867
+									$value = '';
3868
+				}
3802 3869
 			}
3803 3870
 			break;
3804 3871
 
@@ -3808,8 +3875,9 @@  discard block
 block discarded – undo
3808 3875
 			if ( is_wp_error( $value ) ) {
3809 3876
 				$error = $value->get_error_message();
3810 3877
 			} else {
3811
-				if ( ! is_array( $value ) )
3812
-					$value = explode( "\n", $value );
3878
+				if ( ! is_array( $value ) ) {
3879
+									$value = explode( "\n", $value );
3880
+				}
3813 3881
 
3814 3882
 				$domains = array_values( array_filter( array_map( 'trim', $value ) ) );
3815 3883
 				$value = array();
@@ -3819,8 +3887,9 @@  discard block
 block discarded – undo
3819 3887
 						$value[] = $domain;
3820 3888
 					}
3821 3889
 				}
3822
-				if ( ! $value )
3823
-					$value = '';
3890
+				if ( ! $value ) {
3891
+									$value = '';
3892
+				}
3824 3893
 			}
3825 3894
 			break;
3826 3895
 
@@ -3844,8 +3913,9 @@  discard block
 block discarded – undo
3844 3913
 			break;
3845 3914
 
3846 3915
 		case 'default_role' :
3847
-			if ( ! get_role( $value ) && get_role( 'subscriber' ) )
3848
-				$value = 'subscriber';
3916
+			if ( ! get_role( $value ) && get_role( 'subscriber' ) ) {
3917
+							$value = 'subscriber';
3918
+			}
3849 3919
 			break;
3850 3920
 
3851 3921
 		case 'moderation_keys':
@@ -3923,8 +3993,9 @@  discard block
 block discarded – undo
3923 3993
  */
3924 3994
 function wp_parse_str( $string, &$array ) {
3925 3995
 	parse_str( $string, $array );
3926
-	if ( get_magic_quotes_gpc() )
3927
-		$array = stripslashes_deep( $array );
3996
+	if ( get_magic_quotes_gpc() ) {
3997
+			$array = stripslashes_deep( $array );
3998
+	}
3928 3999
 	/**
3929 4000
 	 * Filter the array of variables derived from a parsed string.
3930 4001
 	 *
@@ -3958,8 +4029,9 @@  discard block
 block discarded – undo
3958 4029
  * @return string The text returned after esc_html if needed.
3959 4030
  */
3960 4031
 function wp_pre_kses_less_than_callback( $matches ) {
3961
-	if ( false === strpos($matches[0], '>') )
3962
-		return esc_html($matches[0]);
4032
+	if ( false === strpos($matches[0], '>') ) {
4033
+			return esc_html($matches[0]);
4034
+	}
3963 4035
 	return $matches[0];
3964 4036
 }
3965 4037
 
@@ -3995,8 +4067,9 @@  discard block
 block discarded – undo
3995 4067
 
3996 4068
 		// Get fragment before next %
3997 4069
 		$end = strpos($pattern, '%', $start + 1);
3998
-		if ( false === $end )
3999
-			$end = $len;
4070
+		if ( false === $end ) {
4071
+					$end = $len;
4072
+		}
4000 4073
 		$fragment = substr($pattern, $start, $end - $start);
4001 4074
 
4002 4075
 		// Fragment has a specifier
@@ -4021,10 +4094,11 @@  discard block
 block discarded – undo
4021 4094
 			 * @param string $arg      The argument.
4022 4095
 			 */
4023 4096
 			$_fragment = apply_filters( 'wp_sprintf', $fragment, $arg );
4024
-			if ( $_fragment != $fragment )
4025
-				$fragment = $_fragment;
4026
-			else
4027
-				$fragment = sprintf($fragment, strval($arg) );
4097
+			if ( $_fragment != $fragment ) {
4098
+							$fragment = $_fragment;
4099
+			} else {
4100
+							$fragment = sprintf($fragment, strval($arg) );
4101
+			}
4028 4102
 		}
4029 4103
 
4030 4104
 		// Append to result and move to next fragment
@@ -4049,12 +4123,14 @@  discard block
 block discarded – undo
4049 4123
  */
4050 4124
 function wp_sprintf_l( $pattern, $args ) {
4051 4125
 	// Not a match
4052
-	if ( substr($pattern, 0, 2) != '%l' )
4053
-		return $pattern;
4126
+	if ( substr($pattern, 0, 2) != '%l' ) {
4127
+			return $pattern;
4128
+	}
4054 4129
 
4055 4130
 	// Nothing to work with
4056
-	if ( empty($args) )
4057
-		return '';
4131
+	if ( empty($args) ) {
4132
+			return '';
4133
+	}
4058 4134
 
4059 4135
 	/**
4060 4136
 	 * Filter the translated delimiters used by wp_sprintf_l().
@@ -4078,17 +4154,19 @@  discard block
 block discarded – undo
4078 4154
 
4079 4155
 	$args = (array) $args;
4080 4156
 	$result = array_shift($args);
4081
-	if ( count($args) == 1 )
4082
-		$result .= $l['between_only_two'] . array_shift($args);
4157
+	if ( count($args) == 1 ) {
4158
+			$result .= $l['between_only_two'] . array_shift($args);
4159
+	}
4083 4160
 	// Loop when more than two args
4084 4161
 	$i = count($args);
4085 4162
 	while ( $i ) {
4086 4163
 		$arg = array_shift($args);
4087 4164
 		$i--;
4088
-		if ( 0 == $i )
4089
-			$result .= $l['between_last_two'] . $arg;
4090
-		else
4091
-			$result .= $l['between'] . $arg;
4165
+		if ( 0 == $i ) {
4166
+					$result .= $l['between_last_two'] . $arg;
4167
+		} else {
4168
+					$result .= $l['between'] . $arg;
4169
+		}
4092 4170
 	}
4093 4171
 	return $result . substr($pattern, 2);
4094 4172
 }
@@ -4108,14 +4186,16 @@  discard block
 block discarded – undo
4108 4186
  * @return string The excerpt.
4109 4187
  */
4110 4188
 function wp_html_excerpt( $str, $count, $more = null ) {
4111
-	if ( null === $more )
4112
-		$more = '';
4189
+	if ( null === $more ) {
4190
+			$more = '';
4191
+	}
4113 4192
 	$str = wp_strip_all_tags( $str, true );
4114 4193
 	$excerpt = mb_substr( $str, 0, $count );
4115 4194
 	// remove part of an entity at the end
4116 4195
 	$excerpt = preg_replace( '/&[^;\s]{0,6}$/', '', $excerpt );
4117
-	if ( $str != $excerpt )
4118
-		$excerpt = trim( $excerpt ) . $more;
4196
+	if ( $str != $excerpt ) {
4197
+			$excerpt = trim( $excerpt ) . $more;
4198
+	}
4119 4199
 	return $excerpt;
4120 4200
 }
4121 4201
 
@@ -4237,8 +4317,9 @@  discard block
 block discarded – undo
4237 4317
 	$string = preg_replace( '@<(script|style)[^>]*?>.*?</\\1>@si', '', $string );
4238 4318
 	$string = strip_tags($string);
4239 4319
 
4240
-	if ( $remove_breaks )
4241
-		$string = preg_replace('/[\r\n\t ]+/', ' ', $string);
4320
+	if ( $remove_breaks ) {
4321
+			$string = preg_replace('/[\r\n\t ]+/', ' ', $string);
4322
+	}
4242 4323
 
4243 4324
 	return trim( $string );
4244 4325
 }
@@ -4318,8 +4399,9 @@  discard block
 block discarded – undo
4318 4399
 function capital_P_dangit( $text ) {
4319 4400
 	// Simple replacement for titles
4320 4401
 	$current_filter = current_filter();
4321
-	if ( 'the_title' === $current_filter || 'wp_title' === $current_filter )
4322
-		return str_replace( 'Wordpress', 'WordPress', $text );
4402
+	if ( 'the_title' === $current_filter || 'wp_title' === $current_filter ) {
4403
+			return str_replace( 'Wordpress', 'WordPress', $text );
4404
+	}
4323 4405
 	// Still here? Use the more judicious replacement
4324 4406
 	static $dblq = false;
4325 4407
 	if ( false === $dblq ) {
@@ -4363,8 +4445,9 @@  discard block
 block discarded – undo
4363 4445
 function sanitize_trackback_urls( $to_ping ) {
4364 4446
 	$urls_to_ping = preg_split( '/[\r\n\t ]/', trim( $to_ping ), -1, PREG_SPLIT_NO_EMPTY );
4365 4447
 	foreach ( $urls_to_ping as $k => $url ) {
4366
-		if ( !preg_match( '#^https?://.#i', $url ) )
4367
-			unset( $urls_to_ping[$k] );
4448
+		if ( !preg_match( '#^https?://.#i', $url ) ) {
4449
+					unset( $urls_to_ping[$k] );
4450
+		}
4368 4451
 	}
4369 4452
 	$urls_to_ping = array_map( 'esc_url_raw', $urls_to_ping );
4370 4453
 	$urls_to_ping = implode( "\n", $urls_to_ping );
Please login to merge, or discard this patch.
src/wp-includes/functions.wp-scripts.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -243,7 +243,7 @@
 block discarded – undo
243 243
  * @param string           $handle    Name of the script. Should be unique.
244 244
  * @param string           $src       Full URL of the script, or path of the script relative to the WordPress root directory.
245 245
  * @param array            $deps      Optional. An array of registered script handles this script depends on. Default empty array.
246
- * @param string|bool|null $ver       Optional. String specifying script version number, if it has one, which is added to the URL
246
+ * @param string $ver       Optional. String specifying script version number, if it has one, which is added to the URL
247 247
  *                                    as a query string for cache busting purposes. If version is set to false, a version
248 248
  *                                    number is automatically added equal to current installed WordPress version.
249 249
  *                                    If set to null, no version is added.
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Dependencies API: Scripts functions
4
- *
5
- * @since 2.6.0
6
- *
7
- * @package WordPress
8
- * @subpackage Dependencies
9
- */
3
+	 * Dependencies API: Scripts functions
4
+	 *
5
+	 * @since 2.6.0
6
+	 *
7
+	 * @package WordPress
8
+	 * @subpackage Dependencies
9
+	 */
10 10
 
11 11
 /**
12 12
  * Initialize $wp_scripts if it has not been set.
Please login to merge, or discard this patch.
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
  */
20 20
 function wp_scripts() {
21 21
 	global $wp_scripts;
22
-	if ( ! ( $wp_scripts instanceof WP_Scripts ) ) {
22
+	if ( ! ($wp_scripts instanceof WP_Scripts)) {
23 23
 		$wp_scripts = new WP_Scripts();
24 24
 	}
25 25
 	return $wp_scripts;
@@ -33,17 +33,17 @@  discard block
 block discarded – undo
33 33
  *
34 34
  * @param string $function Function name.
35 35
  */
36
-function _wp_scripts_maybe_doing_it_wrong( $function ) {
37
-	if ( did_action( 'init' ) ) {
36
+function _wp_scripts_maybe_doing_it_wrong($function) {
37
+	if (did_action('init')) {
38 38
 		return;
39 39
 	}
40 40
 
41
-	_doing_it_wrong( $function, sprintf(
42
-		__( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),
41
+	_doing_it_wrong($function, sprintf(
42
+		__('Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.'),
43 43
 		'<code>wp_enqueue_scripts</code>',
44 44
 		'<code>admin_enqueue_scripts</code>',
45 45
 		'<code>login_enqueue_scripts</code>'
46
-	), '3.3' );
46
+	), '3.3');
47 47
 }
48 48
 
49 49
 /**
@@ -62,27 +62,27 @@  discard block
 block discarded – undo
62 62
  * @param string|bool|array $handles Optional. Scripts to be printed. Default 'false'.
63 63
  * @return array On success, a processed array of WP_Dependencies items; otherwise, an empty array.
64 64
  */
65
-function wp_print_scripts( $handles = false ) {
65
+function wp_print_scripts($handles = false) {
66 66
 	/**
67 67
 	 * Fires before scripts in the $handles queue are printed.
68 68
 	 *
69 69
 	 * @since 2.1.0
70 70
 	 */
71
-	do_action( 'wp_print_scripts' );
72
-	if ( '' === $handles ) { // for wp_head
71
+	do_action('wp_print_scripts');
72
+	if ('' === $handles) { // for wp_head
73 73
 		$handles = false;
74 74
 	}
75 75
 
76
-	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
76
+	_wp_scripts_maybe_doing_it_wrong(__FUNCTION__);
77 77
 
78 78
 	global $wp_scripts;
79
-	if ( ! ( $wp_scripts instanceof WP_Scripts ) ) {
80
-		if ( ! $handles ) {
79
+	if ( ! ($wp_scripts instanceof WP_Scripts)) {
80
+		if ( ! $handles) {
81 81
 			return array(); // No need to instantiate if nothing is there.
82 82
 		}
83 83
 	}
84 84
 
85
-	return wp_scripts()->do_items( $handles );
85
+	return wp_scripts()->do_items($handles);
86 86
 }
87 87
 
88 88
 /**
@@ -103,15 +103,15 @@  discard block
 block discarded – undo
103 103
  *                         or after. Default 'after'.
104 104
  * @return bool True on success, false on failure.
105 105
  */
106
-function wp_add_inline_script( $handle, $data, $position = 'after' ) {
107
-	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
106
+function wp_add_inline_script($handle, $data, $position = 'after') {
107
+	_wp_scripts_maybe_doing_it_wrong(__FUNCTION__);
108 108
 
109
-	if ( false !== stripos( $data, '</script>' ) ) {
110
-		_doing_it_wrong( __FUNCTION__, __( 'Do not pass script tags to wp_add_inline_script().' ), '4.5.0' );
111
-		$data = trim( preg_replace( '#<script[^>]*>(.*)</script>#is', '$1', $data ) );
109
+	if (false !== stripos($data, '</script>')) {
110
+		_doing_it_wrong(__FUNCTION__, __('Do not pass script tags to wp_add_inline_script().'), '4.5.0');
111
+		$data = trim(preg_replace('#<script[^>]*>(.*)</script>#is', '$1', $data));
112 112
 	}
113 113
 
114
-	return wp_scripts()->add_inline_script( $handle, $data, $position );
114
+	return wp_scripts()->add_inline_script($handle, $data, $position);
115 115
 }
116 116
 
117 117
 /**
@@ -136,13 +136,13 @@  discard block
 block discarded – undo
136 136
  *                                    Default 'false'.
137 137
  * @return bool Whether the script has been registered. True on success, false on failure.
138 138
  */
139
-function wp_register_script( $handle, $src, $deps = array(), $ver = false, $in_footer = false ) {
139
+function wp_register_script($handle, $src, $deps = array(), $ver = false, $in_footer = false) {
140 140
 	$wp_scripts = wp_scripts();
141
-	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
141
+	_wp_scripts_maybe_doing_it_wrong(__FUNCTION__);
142 142
 
143
-	$registered = $wp_scripts->add( $handle, $src, $deps, $ver );
144
-	if ( $in_footer ) {
145
-		$wp_scripts->add_data( $handle, 'group', 1 );
143
+	$registered = $wp_scripts->add($handle, $src, $deps, $ver);
144
+	if ($in_footer) {
145
+		$wp_scripts->add_data($handle, 'group', 1);
146 146
 	}
147 147
 
148 148
 	return $registered;
@@ -176,14 +176,14 @@  discard block
 block discarded – undo
176 176
  * @param array $l10n         The data itself. The data can be either a single or multi-dimensional array.
177 177
  * @return bool True if the script was successfully localized, false otherwise.
178 178
  */
179
-function wp_localize_script( $handle, $object_name, $l10n ) {
179
+function wp_localize_script($handle, $object_name, $l10n) {
180 180
 	global $wp_scripts;
181
-	if ( ! ( $wp_scripts instanceof WP_Scripts ) ) {
182
-		_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
181
+	if ( ! ($wp_scripts instanceof WP_Scripts)) {
182
+		_wp_scripts_maybe_doing_it_wrong(__FUNCTION__);
183 183
 		return false;
184 184
 	}
185 185
 
186
-	return $wp_scripts->localize( $handle, $object_name, $l10n );
186
+	return $wp_scripts->localize($handle, $object_name, $l10n);
187 187
 }
188 188
 
189 189
 /**
@@ -198,16 +198,16 @@  discard block
 block discarded – undo
198 198
  *
199 199
  * @param string $handle Name of the script to be removed.
200 200
  */
201
-function wp_deregister_script( $handle ) {
202
-	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
201
+function wp_deregister_script($handle) {
202
+	_wp_scripts_maybe_doing_it_wrong(__FUNCTION__);
203 203
 
204 204
 	/**
205 205
 	 * Do not allow accidental or negligent de-registering of critical scripts in the admin.
206 206
 	 * Show minimal remorse if the correct hook is used.
207 207
 	 */
208 208
 	$current_filter = current_filter();
209
-	if ( ( is_admin() && 'admin_enqueue_scripts' !== $current_filter ) ||
210
-		( 'wp-login.php' === $GLOBALS['pagenow'] && 'login_enqueue_scripts' !== $current_filter )
209
+	if ((is_admin() && 'admin_enqueue_scripts' !== $current_filter) ||
210
+		('wp-login.php' === $GLOBALS['pagenow'] && 'login_enqueue_scripts' !== $current_filter)
211 211
 	) {
212 212
 		$no = array(
213 213
 			'jquery', 'jquery-core', 'jquery-migrate', 'jquery-ui-core', 'jquery-ui-accordion',
@@ -218,15 +218,15 @@  discard block
 block discarded – undo
218 218
 			'jquery-ui-tooltip', 'jquery-ui-widget', 'underscore', 'backbone',
219 219
 		);
220 220
 
221
-		if ( in_array( $handle, $no ) ) {
222
-			$message = sprintf( __( 'Do not deregister the %1$s script in the administration area. To target the front-end theme, use the %2$s hook.' ),
223
-				"<code>$handle</code>", '<code>wp_enqueue_scripts</code>' );
224
-			_doing_it_wrong( __FUNCTION__, $message, '3.6' );
221
+		if (in_array($handle, $no)) {
222
+			$message = sprintf(__('Do not deregister the %1$s script in the administration area. To target the front-end theme, use the %2$s hook.'),
223
+				"<code>$handle</code>", '<code>wp_enqueue_scripts</code>');
224
+			_doing_it_wrong(__FUNCTION__, $message, '3.6');
225 225
 			return;
226 226
 		}
227 227
 	}
228 228
 
229
-	wp_scripts()->remove( $handle );
229
+	wp_scripts()->remove($handle);
230 230
 }
231 231
 
232 232
 /**
@@ -250,25 +250,25 @@  discard block
 block discarded – undo
250 250
  * @param bool             $in_footer Optional. Whether to enqueue the script before </body> instead of in the <head>.
251 251
  *                                    Default 'false'.
252 252
  */
253
-function wp_enqueue_script( $handle, $src = false, $deps = array(), $ver = false, $in_footer = false ) {
253
+function wp_enqueue_script($handle, $src = false, $deps = array(), $ver = false, $in_footer = false) {
254 254
 	$wp_scripts = wp_scripts();
255 255
 
256
-	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
256
+	_wp_scripts_maybe_doing_it_wrong(__FUNCTION__);
257 257
 
258 258
 
259
-	if ( $src || $in_footer ) {
260
-		$_handle = explode( '?', $handle );
259
+	if ($src || $in_footer) {
260
+		$_handle = explode('?', $handle);
261 261
 
262
-		if ( $src ) {
263
-			$wp_scripts->add( $_handle[0], $src, $deps, $ver );
262
+		if ($src) {
263
+			$wp_scripts->add($_handle[0], $src, $deps, $ver);
264 264
 		}
265 265
 
266
-		if ( $in_footer ) {
267
-			$wp_scripts->add_data( $_handle[0], 'group', 1 );
266
+		if ($in_footer) {
267
+			$wp_scripts->add_data($_handle[0], 'group', 1);
268 268
 		}
269 269
 	}
270 270
 
271
-	$wp_scripts->enqueue( $handle );
271
+	$wp_scripts->enqueue($handle);
272 272
 }
273 273
 
274 274
 /**
@@ -280,10 +280,10 @@  discard block
 block discarded – undo
280 280
  *
281 281
  * @param string $handle Name of the script to be removed.
282 282
  */
283
-function wp_dequeue_script( $handle ) {
284
-	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
283
+function wp_dequeue_script($handle) {
284
+	_wp_scripts_maybe_doing_it_wrong(__FUNCTION__);
285 285
 
286
-	wp_scripts()->dequeue( $handle );
286
+	wp_scripts()->dequeue($handle);
287 287
 }
288 288
 
289 289
 /**
@@ -297,10 +297,10 @@  discard block
 block discarded – undo
297 297
  *                       Accepts 'enqueued', 'registered', 'queue', 'to_do', and 'done'.
298 298
  * @return bool Whether the script is queued.
299 299
  */
300
-function wp_script_is( $handle, $list = 'enqueued' ) {
301
-	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
300
+function wp_script_is($handle, $list = 'enqueued') {
301
+	_wp_scripts_maybe_doing_it_wrong(__FUNCTION__);
302 302
 
303
-	return (bool) wp_scripts()->query( $handle, $list );
303
+	return (bool) wp_scripts()->query($handle, $list);
304 304
 }
305 305
 
306 306
 /**
@@ -320,6 +320,6 @@  discard block
 block discarded – undo
320 320
  * @param mixed  $value  String containing the data to be added.
321 321
  * @return bool True on success, false on failure.
322 322
  */
323
-function wp_script_add_data( $handle, $key, $value ){
324
-	return wp_scripts()->add_data( $handle, $key, $value );
323
+function wp_script_add_data($handle, $key, $value) {
324
+	return wp_scripts()->add_data($handle, $key, $value);
325 325
 }
Please login to merge, or discard this patch.
src/wp-includes/media.php 4 patches
Doc Comments   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
  *
300 300
  * @param int        $width  Image width in pixels.
301 301
  * @param int        $height Image height in pixels.
302
- * @param bool|array $crop   Optional. Whether to crop images to specified width and height or resize.
302
+ * @param boolean $crop   Optional. Whether to crop images to specified width and height or resize.
303 303
  *                           An array can specify positioning of the crop area. Default false.
304 304
  */
305 305
 function set_post_thumbnail_size( $width = 0, $height = 0, $crop = false ) {
@@ -943,7 +943,7 @@  discard block
 block discarded – undo
943 943
  *                                    width and height values in pixels (in that order). Default 'medium'.
944 944
  * @param array        $image_meta    Optional. The image meta data as returned by 'wp_get_attachment_metadata()'.
945 945
  *                                    Default null.
946
- * @return string|bool A 'srcset' value string or false.
946
+ * @return false|string A 'srcset' value string or false.
947 947
  */
948 948
 function wp_get_attachment_image_srcset( $attachment_id, $size = 'medium', $image_meta = null ) {
949 949
 	if ( ! $image = wp_get_attachment_image_src( $attachment_id, $size ) ) {
@@ -972,7 +972,7 @@  discard block
 block discarded – undo
972 972
  * @param string $image_src     The 'src' of the image.
973 973
  * @param array  $image_meta    The image meta data as returned by 'wp_get_attachment_metadata()'.
974 974
  * @param int    $attachment_id Optional. The image attachment ID to pass to the filter. Default 0.
975
- * @return string|bool          The 'srcset' attribute value. False on error or when only one source exists.
975
+ * @return false|string          The 'srcset' attribute value. False on error or when only one source exists.
976 976
  */
977 977
 function wp_calculate_image_srcset( $size_array, $image_src, $image_meta, $attachment_id = 0 ) {
978 978
 	/**
@@ -3495,7 +3495,7 @@  discard block
 block discarded – undo
3495 3495
  * @since 3.6.0
3496 3496
  *
3497 3497
  * @param string      $type Mime type.
3498
- * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
3498
+ * @param integer $post Optional. Post ID or WP_Post object. Default is global $post.
3499 3499
  * @return array Found attachments.
3500 3500
  */
3501 3501
 function get_attached_media( $type, $post = 0 ) {
@@ -3634,7 +3634,7 @@  discard block
 block discarded – undo
3634 3634
  *
3635 3635
  * @since 3.6.0
3636 3636
  *
3637
- * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
3637
+ * @param integer $post Optional. Post ID or WP_Post object. Default is global $post.
3638 3638
  * @param bool        $html Optional. Whether to return HTML or data. Default is true.
3639 3639
  * @return string|array Gallery data and srcs parsed from the expanded shortcode.
3640 3640
  */
@@ -3661,7 +3661,7 @@  discard block
 block discarded – undo
3661 3661
  *
3662 3662
  * @see get_post_galleries()
3663 3663
  *
3664
- * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`.
3664
+ * @param integer $post Optional. Post ID or WP_Post object. Default is global `$post`.
3665 3665
  * @return array A list of lists, each containing image srcs parsed.
3666 3666
  *               from an expanded shortcode
3667 3667
  */
@@ -3677,7 +3677,7 @@  discard block
 block discarded – undo
3677 3677
  *
3678 3678
  * @see get_post_gallery()
3679 3679
  *
3680
- * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`.
3680
+ * @param integer $post Optional. Post ID or WP_Post object. Default is global `$post`.
3681 3681
  * @return array A list of a gallery's image srcs in order.
3682 3682
  */
3683 3683
 function get_post_gallery_images( $post = 0 ) {
@@ -3762,7 +3762,7 @@  discard block
 block discarded – undo
3762 3762
  *
3763 3763
  * @global string $wp_version
3764 3764
  *
3765
- * @return array The relevant CSS file URLs.
3765
+ * @return string[] The relevant CSS file URLs.
3766 3766
  */
3767 3767
 function wpview_media_sandbox_styles() {
3768 3768
  	$version = 'ver=' . $GLOBALS['wp_version'];
Please login to merge, or discard this patch.
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * WordPress API for media display.
4
- *
5
- * @package WordPress
6
- * @subpackage Media
7
- */
3
+	 * WordPress API for media display.
4
+	 *
5
+	 * @package WordPress
6
+	 * @subpackage Media
7
+	 */
8 8
 
9 9
 /**
10 10
  * Scale down the default size of an image.
@@ -663,8 +663,8 @@  discard block
 block discarded – undo
663 663
 				// If the size doesn't match within one pixel, then it is of a different aspect ratio, so we skip it, unless it's the thumbnail size
664 664
 				if ( 'thumbnail' != $_size &&
665 665
 				  ( ! $maybe_cropped
666
-				    || ( $maybe_cropped[4] != $data['width'] && $maybe_cropped[4] + 1 != $data['width'] )
667
-				    || ( $maybe_cropped[5] != $data['height'] && $maybe_cropped[5] + 1 != $data['height'] )
666
+					|| ( $maybe_cropped[4] != $data['width'] && $maybe_cropped[4] + 1 != $data['width'] )
667
+					|| ( $maybe_cropped[5] != $data['height'] && $maybe_cropped[5] + 1 != $data['height'] )
668 668
 				  ) ) {
669 669
 				  continue;
670 670
 				}
@@ -1128,7 +1128,7 @@  discard block
 block discarded – undo
1128 1128
 	 * @param array  $size_array    Array of width and height values in pixels (in that order).
1129 1129
 	 * @param string $image_src     The 'src' of the image.
1130 1130
 	 * @param array  $image_meta    The image meta data as returned by 'wp_get_attachment_metadata()'.
1131
- 	 * @param int    $attachment_id Image attachment ID or 0.
1131
+	 * @param int    $attachment_id Image attachment ID or 0.
1132 1132
 	 */
1133 1133
 	$sources = apply_filters( 'wp_calculate_image_srcset', $sources, $size_array, $image_src, $image_meta, $attachment_id );
1134 1134
 
@@ -2132,28 +2132,28 @@  discard block
 block discarded – undo
2132 2132
 	return apply_filters( 'wp_get_attachment_id3_keys', $fields, $attachment, $context );
2133 2133
 }
2134 2134
 /**
2135
- * Builds the Audio shortcode output.
2136
- *
2137
- * This implements the functionality of the Audio Shortcode for displaying
2138
- * WordPress mp3s in a post.
2139
- *
2140
- * @since 3.6.0
2141
- *
2142
- * @staticvar int $instance
2143
- *
2144
- * @param array  $attr {
2145
- *     Attributes of the audio shortcode.
2146
- *
2147
- *     @type string $src      URL to the source of the audio file. Default empty.
2148
- *     @type string $loop     The 'loop' attribute for the `<audio>` element. Default empty.
2149
- *     @type string $autoplay The 'autoplay' attribute for the `<audio>` element. Default empty.
2150
- *     @type string $preload  The 'preload' attribute for the `<audio>` element. Default 'none'.
2151
- *     @type string $class    The 'class' attribute for the `<audio>` element. Default 'wp-audio-shortcode'.
2152
- *     @type string $style    The 'style' attribute for the `<audio>` element. Default 'width: 100%; visibility: hidden;'.
2153
- * }
2154
- * @param string $content Shortcode content.
2155
- * @return string|void HTML content to display audio.
2156
- */
2135
+	 * Builds the Audio shortcode output.
2136
+	 *
2137
+	 * This implements the functionality of the Audio Shortcode for displaying
2138
+	 * WordPress mp3s in a post.
2139
+	 *
2140
+	 * @since 3.6.0
2141
+	 *
2142
+	 * @staticvar int $instance
2143
+	 *
2144
+	 * @param array  $attr {
2145
+	 *     Attributes of the audio shortcode.
2146
+	 *
2147
+	 *     @type string $src      URL to the source of the audio file. Default empty.
2148
+	 *     @type string $loop     The 'loop' attribute for the `<audio>` element. Default empty.
2149
+	 *     @type string $autoplay The 'autoplay' attribute for the `<audio>` element. Default empty.
2150
+	 *     @type string $preload  The 'preload' attribute for the `<audio>` element. Default 'none'.
2151
+	 *     @type string $class    The 'class' attribute for the `<audio>` element. Default 'wp-audio-shortcode'.
2152
+	 *     @type string $style    The 'style' attribute for the `<audio>` element. Default 'width: 100%; visibility: hidden;'.
2153
+	 * }
2154
+	 * @param string $content Shortcode content.
2155
+	 * @return string|void HTML content to display audio.
2156
+	 */
2157 2157
 function wp_audio_shortcode( $attr, $content = '' ) {
2158 2158
 	$post_id = get_post() ? get_the_ID() : 0;
2159 2159
 
Please login to merge, or discard this patch.
Spacing   +895 added lines, -895 removed lines patch added patch discarded remove patch
@@ -38,39 +38,39 @@  discard block
 block discarded – undo
38 38
  *                              (like inserting into an editor). Default null.
39 39
  * @return array Width and height of what the result image should resize to.
40 40
  */
41
-function image_constrain_size_for_editor( $width, $height, $size = 'medium', $context = null ) {
41
+function image_constrain_size_for_editor($width, $height, $size = 'medium', $context = null) {
42 42
 	global $content_width, $_wp_additional_image_sizes;
43 43
 
44
-	if ( ! $context )
44
+	if ( ! $context)
45 45
 		$context = is_admin() ? 'edit' : 'display';
46 46
 
47
-	if ( is_array($size) ) {
47
+	if (is_array($size)) {
48 48
 		$max_width = $size[0];
49 49
 		$max_height = $size[1];
50 50
 	}
51
-	elseif ( $size == 'thumb' || $size == 'thumbnail' ) {
51
+	elseif ($size == 'thumb' || $size == 'thumbnail') {
52 52
 		$max_width = intval(get_option('thumbnail_size_w'));
53 53
 		$max_height = intval(get_option('thumbnail_size_h'));
54 54
 		// last chance thumbnail size defaults
55
-		if ( !$max_width && !$max_height ) {
55
+		if ( ! $max_width && ! $max_height) {
56 56
 			$max_width = 128;
57 57
 			$max_height = 96;
58 58
 		}
59 59
 	}
60
-	elseif ( $size == 'medium' ) {
60
+	elseif ($size == 'medium') {
61 61
 		$max_width = intval(get_option('medium_size_w'));
62 62
 		$max_height = intval(get_option('medium_size_h'));
63 63
 
64 64
 	}
65
-	elseif ( $size == 'medium_large' ) {
66
-		$max_width = intval( get_option( 'medium_large_size_w' ) );
67
-		$max_height = intval( get_option( 'medium_large_size_h' ) );
65
+	elseif ($size == 'medium_large') {
66
+		$max_width = intval(get_option('medium_large_size_w'));
67
+		$max_height = intval(get_option('medium_large_size_h'));
68 68
 
69
-		if ( intval( $content_width ) > 0 ) {
70
-			$max_width = min( intval( $content_width ), $max_width );
69
+		if (intval($content_width) > 0) {
70
+			$max_width = min(intval($content_width), $max_width);
71 71
 		}
72 72
 	}
73
-	elseif ( $size == 'large' ) {
73
+	elseif ($size == 'large') {
74 74
 		/*
75 75
 		 * We're inserting a large size image into the editor. If it's a really
76 76
 		 * big image we'll scale it down to fit reasonably within the editor
@@ -79,14 +79,14 @@  discard block
 block discarded – undo
79 79
 		 */
80 80
 		$max_width = intval(get_option('large_size_w'));
81 81
 		$max_height = intval(get_option('large_size_h'));
82
-		if ( intval($content_width) > 0 ) {
83
-			$max_width = min( intval($content_width), $max_width );
82
+		if (intval($content_width) > 0) {
83
+			$max_width = min(intval($content_width), $max_width);
84 84
 		}
85
-	} elseif ( isset( $_wp_additional_image_sizes ) && count( $_wp_additional_image_sizes ) && in_array( $size, array_keys( $_wp_additional_image_sizes ) ) ) {
86
-		$max_width = intval( $_wp_additional_image_sizes[$size]['width'] );
87
-		$max_height = intval( $_wp_additional_image_sizes[$size]['height'] );
88
-		if ( intval($content_width) > 0 && 'edit' == $context ) // Only in admin. Assume that theme authors know what they're doing.
89
-			$max_width = min( intval($content_width), $max_width );
85
+	} elseif (isset($_wp_additional_image_sizes) && count($_wp_additional_image_sizes) && in_array($size, array_keys($_wp_additional_image_sizes))) {
86
+		$max_width = intval($_wp_additional_image_sizes[$size]['width']);
87
+		$max_height = intval($_wp_additional_image_sizes[$size]['height']);
88
+		if (intval($content_width) > 0 && 'edit' == $context) // Only in admin. Assume that theme authors know what they're doing.
89
+			$max_width = min(intval($content_width), $max_width);
90 90
 	}
91 91
 	// $size == 'full' has no constraint
92 92
 	else {
@@ -106,9 +106,9 @@  discard block
 block discarded – undo
106 106
 	 *                                     Possible values are 'display' (like in a theme)
107 107
 	 *                                     or 'edit' (like inserting into an editor).
108 108
 	 */
109
-	list( $max_width, $max_height ) = apply_filters( 'editor_max_image_size', array( $max_width, $max_height ), $size, $context );
109
+	list($max_width, $max_height) = apply_filters('editor_max_image_size', array($max_width, $max_height), $size, $context);
110 110
 
111
-	return wp_constrain_dimensions( $width, $height, $max_width, $max_height );
111
+	return wp_constrain_dimensions($width, $height, $max_width, $max_height);
112 112
 }
113 113
 
114 114
 /**
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
  * @param int|string $height Image height in pixels.
129 129
  * @return string HTML attributes for width and, or height.
130 130
  */
131
-function image_hwstring( $width, $height ) {
131
+function image_hwstring($width, $height) {
132 132
 	$out = '';
133 133
 	if ($width)
134 134
 		$out .= 'width="'.intval($width).'" ';
@@ -162,9 +162,9 @@  discard block
 block discarded – undo
162 162
  * @return false|array Array containing the image URL, width, height, and boolean for whether
163 163
  *                     the image is an intermediate size. False on failure.
164 164
  */
165
-function image_downsize( $id, $size = 'medium' ) {
165
+function image_downsize($id, $size = 'medium') {
166 166
 
167
-	if ( !wp_attachment_is_image($id) )
167
+	if ( ! wp_attachment_is_image($id))
168 168
 		return false;
169 169
 
170 170
 	/**
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 	 * @param array|string $size     Size of image. Image size or array of width and height values (in that order).
181 181
 	 *                               Default 'medium'.
182 182
 	 */
183
-	if ( $out = apply_filters( 'image_downsize', false, $id, $size ) ) {
183
+	if ($out = apply_filters('image_downsize', false, $id, $size)) {
184 184
 		return $out;
185 185
 	}
186 186
 
@@ -191,32 +191,32 @@  discard block
 block discarded – undo
191 191
 	$img_url_basename = wp_basename($img_url);
192 192
 
193 193
 	// try for a new style intermediate size
194
-	if ( $intermediate = image_get_intermediate_size($id, $size) ) {
194
+	if ($intermediate = image_get_intermediate_size($id, $size)) {
195 195
 		$img_url = str_replace($img_url_basename, $intermediate['file'], $img_url);
196 196
 		$width = $intermediate['width'];
197 197
 		$height = $intermediate['height'];
198 198
 		$is_intermediate = true;
199 199
 	}
200
-	elseif ( $size == 'thumbnail' ) {
200
+	elseif ($size == 'thumbnail') {
201 201
 		// fall back to the old thumbnail
202
-		if ( ($thumb_file = wp_get_attachment_thumb_file($id)) && $info = getimagesize($thumb_file) ) {
202
+		if (($thumb_file = wp_get_attachment_thumb_file($id)) && $info = getimagesize($thumb_file)) {
203 203
 			$img_url = str_replace($img_url_basename, wp_basename($thumb_file), $img_url);
204 204
 			$width = $info[0];
205 205
 			$height = $info[1];
206 206
 			$is_intermediate = true;
207 207
 		}
208 208
 	}
209
-	if ( !$width && !$height && isset( $meta['width'], $meta['height'] ) ) {
209
+	if ( ! $width && ! $height && isset($meta['width'], $meta['height'])) {
210 210
 		// any other type: use the real image
211 211
 		$width = $meta['width'];
212 212
 		$height = $meta['height'];
213 213
 	}
214 214
 
215
-	if ( $img_url) {
215
+	if ($img_url) {
216 216
 		// we have the actual image size, but might need to further constrain it if content_width is narrower
217
-		list( $width, $height ) = image_constrain_size_for_editor( $width, $height, $size );
217
+		list($width, $height) = image_constrain_size_for_editor($width, $height, $size);
218 218
 
219
-		return array( $img_url, $width, $height, $is_intermediate );
219
+		return array($img_url, $width, $height, $is_intermediate);
220 220
 	}
221 221
 	return false;
222 222
 
@@ -243,12 +243,12 @@  discard block
 block discarded – undo
243 243
  * @param bool|array $crop   Optional. Whether to crop images to specified width and height or resize.
244 244
  *                           An array can specify positioning of the crop area. Default false.
245 245
  */
246
-function add_image_size( $name, $width = 0, $height = 0, $crop = false ) {
246
+function add_image_size($name, $width = 0, $height = 0, $crop = false) {
247 247
 	global $_wp_additional_image_sizes;
248 248
 
249
-	$_wp_additional_image_sizes[ $name ] = array(
250
-		'width'  => absint( $width ),
251
-		'height' => absint( $height ),
249
+	$_wp_additional_image_sizes[$name] = array(
250
+		'width'  => absint($width),
251
+		'height' => absint($height),
252 252
 		'crop'   => $crop,
253 253
 	);
254 254
 }
@@ -263,10 +263,10 @@  discard block
 block discarded – undo
263 263
  * @param string $name The image size to check.
264 264
  * @return bool True if the image size exists, false if not.
265 265
  */
266
-function has_image_size( $name ) {
266
+function has_image_size($name) {
267 267
 	global $_wp_additional_image_sizes;
268 268
 
269
-	return isset( $_wp_additional_image_sizes[ $name ] );
269
+	return isset($_wp_additional_image_sizes[$name]);
270 270
 }
271 271
 
272 272
 /**
@@ -279,11 +279,11 @@  discard block
 block discarded – undo
279 279
  * @param string $name The image size to remove.
280 280
  * @return bool True if the image size was successfully removed, false on failure.
281 281
  */
282
-function remove_image_size( $name ) {
282
+function remove_image_size($name) {
283 283
 	global $_wp_additional_image_sizes;
284 284
 
285
-	if ( isset( $_wp_additional_image_sizes[ $name ] ) ) {
286
-		unset( $_wp_additional_image_sizes[ $name ] );
285
+	if (isset($_wp_additional_image_sizes[$name])) {
286
+		unset($_wp_additional_image_sizes[$name]);
287 287
 		return true;
288 288
 	}
289 289
 
@@ -302,8 +302,8 @@  discard block
 block discarded – undo
302 302
  * @param bool|array $crop   Optional. Whether to crop images to specified width and height or resize.
303 303
  *                           An array can specify positioning of the crop area. Default false.
304 304
  */
305
-function set_post_thumbnail_size( $width = 0, $height = 0, $crop = false ) {
306
-	add_image_size( 'post-thumbnail', $width, $height, $crop );
305
+function set_post_thumbnail_size($width = 0, $height = 0, $crop = false) {
306
+	add_image_size('post-thumbnail', $width, $height, $crop);
307 307
 }
308 308
 
309 309
 /**
@@ -329,14 +329,14 @@  discard block
 block discarded – undo
329 329
  *                            (in that order). Default 'medium'.
330 330
  * @return string HTML IMG element for given image attachment
331 331
  */
332
-function get_image_tag( $id, $alt, $title, $align, $size = 'medium' ) {
332
+function get_image_tag($id, $alt, $title, $align, $size = 'medium') {
333 333
 
334
-	list( $img_src, $width, $height ) = image_downsize($id, $size);
334
+	list($img_src, $width, $height) = image_downsize($id, $size);
335 335
 	$hwstring = image_hwstring($width, $height);
336 336
 
337
-	$title = $title ? 'title="' . esc_attr( $title ) . '" ' : '';
337
+	$title = $title ? 'title="'.esc_attr($title).'" ' : '';
338 338
 
339
-	$class = 'align' . esc_attr($align) .' size-' . esc_attr($size) . ' wp-image-' . $id;
339
+	$class = 'align'.esc_attr($align).' size-'.esc_attr($size).' wp-image-'.$id;
340 340
 
341 341
 	/**
342 342
 	 * Filter the value of the attachment's image tag class attribute.
@@ -349,9 +349,9 @@  discard block
 block discarded – undo
349 349
 	 * @param string|array $size  Size of image. Image size or array of width and height values (in that order).
350 350
 	 *                            Default 'medium'.
351 351
 	 */
352
-	$class = apply_filters( 'get_image_tag_class', $class, $id, $align, $size );
352
+	$class = apply_filters('get_image_tag_class', $class, $id, $align, $size);
353 353
 
354
-	$html = '<img src="' . esc_attr($img_src) . '" alt="' . esc_attr($alt) . '" ' . $title . $hwstring . 'class="' . $class . '" />';
354
+	$html = '<img src="'.esc_attr($img_src).'" alt="'.esc_attr($alt).'" '.$title.$hwstring.'class="'.$class.'" />';
355 355
 
356 356
 	/**
357 357
 	 * Filter the HTML content for the image tag.
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 	 * @param string|array $size  Size of image. Image size or array of width and height values (in that order).
367 367
 	 *                            Default 'medium'.
368 368
 	 */
369
-	return apply_filters( 'get_image_tag', $html, $id, $alt, $title, $align, $size );
369
+	return apply_filters('get_image_tag', $html, $id, $alt, $title, $align, $size);
370 370
 }
371 371
 
372 372
 /**
@@ -383,28 +383,28 @@  discard block
 block discarded – undo
383 383
  * @param int $max_height     Optional. Max height in pixels to constrain to. Default 0.
384 384
  * @return array First item is the width, the second item is the height.
385 385
  */
386
-function wp_constrain_dimensions( $current_width, $current_height, $max_width = 0, $max_height = 0 ) {
387
-	if ( !$max_width && !$max_height )
388
-		return array( $current_width, $current_height );
386
+function wp_constrain_dimensions($current_width, $current_height, $max_width = 0, $max_height = 0) {
387
+	if ( ! $max_width && ! $max_height)
388
+		return array($current_width, $current_height);
389 389
 
390 390
 	$width_ratio = $height_ratio = 1.0;
391 391
 	$did_width = $did_height = false;
392 392
 
393
-	if ( $max_width > 0 && $current_width > 0 && $current_width > $max_width ) {
393
+	if ($max_width > 0 && $current_width > 0 && $current_width > $max_width) {
394 394
 		$width_ratio = $max_width / $current_width;
395 395
 		$did_width = true;
396 396
 	}
397 397
 
398
-	if ( $max_height > 0 && $current_height > 0 && $current_height > $max_height ) {
398
+	if ($max_height > 0 && $current_height > 0 && $current_height > $max_height) {
399 399
 		$height_ratio = $max_height / $current_height;
400 400
 		$did_height = true;
401 401
 	}
402 402
 
403 403
 	// Calculate the larger/smaller ratios
404
-	$smaller_ratio = min( $width_ratio, $height_ratio );
405
-	$larger_ratio  = max( $width_ratio, $height_ratio );
404
+	$smaller_ratio = min($width_ratio, $height_ratio);
405
+	$larger_ratio  = max($width_ratio, $height_ratio);
406 406
 
407
-	if ( (int) round( $current_width * $larger_ratio ) > $max_width || (int) round( $current_height * $larger_ratio ) > $max_height ) {
407
+	if ((int) round($current_width * $larger_ratio) > $max_width || (int) round($current_height * $larger_ratio) > $max_height) {
408 408
  		// The larger ratio is too big. It would result in an overflow.
409 409
 		$ratio = $smaller_ratio;
410 410
 	} else {
@@ -413,20 +413,20 @@  discard block
 block discarded – undo
413 413
 	}
414 414
 
415 415
 	// Very small dimensions may result in 0, 1 should be the minimum.
416
-	$w = max ( 1, (int) round( $current_width  * $ratio ) );
417
-	$h = max ( 1, (int) round( $current_height * $ratio ) );
416
+	$w = max(1, (int) round($current_width * $ratio));
417
+	$h = max(1, (int) round($current_height * $ratio));
418 418
 
419 419
 	// Sometimes, due to rounding, we'll end up with a result like this: 465x700 in a 177x177 box is 117x176... a pixel short
420 420
 	// We also have issues with recursive calls resulting in an ever-changing result. Constraining to the result of a constraint should yield the original result.
421 421
 	// Thus we look for dimensions that are one pixel shy of the max value and bump them up
422 422
 
423 423
 	// Note: $did_width means it is possible $smaller_ratio == $width_ratio.
424
-	if ( $did_width && $w == $max_width - 1 ) {
424
+	if ($did_width && $w == $max_width - 1) {
425 425
 		$w = $max_width; // Round it up
426 426
 	}
427 427
 
428 428
 	// Note: $did_height means it is possible $smaller_ratio == $height_ratio.
429
-	if ( $did_height && $h == $max_height - 1 ) {
429
+	if ($did_height && $h == $max_height - 1) {
430 430
 		$h = $max_height; // Round it up
431 431
 	}
432 432
 
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
 	 * @param int 	$max_width      The maximum width permitted.
442 442
 	 * @param int 	$max_height     The maximum height permitted.
443 443
 	 */
444
-	return apply_filters( 'wp_constrain_dimensions', array( $w, $h ), $current_width, $current_height, $max_width, $max_height );
444
+	return apply_filters('wp_constrain_dimensions', array($w, $h), $current_width, $current_height, $max_width, $max_height);
445 445
 }
446 446
 
447 447
 /**
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
  *                           An array can specify positioning of the crop area. Default false.
469 469
  * @return false|array False on failure. Returned array matches parameters for `imagecopyresampled()`.
470 470
  */
471
-function image_resize_dimensions( $orig_w, $orig_h, $dest_w, $dest_h, $crop = false ) {
471
+function image_resize_dimensions($orig_w, $orig_h, $dest_w, $dest_h, $crop = false) {
472 472
 
473 473
 	if ($orig_w <= 0 || $orig_h <= 0)
474 474
 		return false;
@@ -492,22 +492,22 @@  discard block
 block discarded – undo
492 492
 	 * @param bool|array $crop   Whether to crop image to specified width and height or resize.
493 493
 	 *                           An array can specify positioning of the crop area. Default false.
494 494
 	 */
495
-	$output = apply_filters( 'image_resize_dimensions', null, $orig_w, $orig_h, $dest_w, $dest_h, $crop );
496
-	if ( null !== $output )
495
+	$output = apply_filters('image_resize_dimensions', null, $orig_w, $orig_h, $dest_w, $dest_h, $crop);
496
+	if (null !== $output)
497 497
 		return $output;
498 498
 
499
-	if ( $crop ) {
499
+	if ($crop) {
500 500
 		// crop the largest possible portion of the original image that we can size to $dest_w x $dest_h
501 501
 		$aspect_ratio = $orig_w / $orig_h;
502 502
 		$new_w = min($dest_w, $orig_w);
503 503
 		$new_h = min($dest_h, $orig_h);
504 504
 
505
-		if ( ! $new_w ) {
506
-			$new_w = (int) round( $new_h * $aspect_ratio );
505
+		if ( ! $new_w) {
506
+			$new_w = (int) round($new_h * $aspect_ratio);
507 507
 		}
508 508
 
509
-		if ( ! $new_h ) {
510
-			$new_h = (int) round( $new_w / $aspect_ratio );
509
+		if ( ! $new_h) {
510
+			$new_h = (int) round($new_w / $aspect_ratio);
511 511
 		}
512 512
 
513 513
 		$size_ratio = max($new_w / $orig_w, $new_h / $orig_h);
@@ -515,26 +515,26 @@  discard block
 block discarded – undo
515 515
 		$crop_w = round($new_w / $size_ratio);
516 516
 		$crop_h = round($new_h / $size_ratio);
517 517
 
518
-		if ( ! is_array( $crop ) || count( $crop ) !== 2 ) {
519
-			$crop = array( 'center', 'center' );
518
+		if ( ! is_array($crop) || count($crop) !== 2) {
519
+			$crop = array('center', 'center');
520 520
 		}
521 521
 
522
-		list( $x, $y ) = $crop;
522
+		list($x, $y) = $crop;
523 523
 
524
-		if ( 'left' === $x ) {
524
+		if ('left' === $x) {
525 525
 			$s_x = 0;
526
-		} elseif ( 'right' === $x ) {
526
+		} elseif ('right' === $x) {
527 527
 			$s_x = $orig_w - $crop_w;
528 528
 		} else {
529
-			$s_x = floor( ( $orig_w - $crop_w ) / 2 );
529
+			$s_x = floor(($orig_w - $crop_w) / 2);
530 530
 		}
531 531
 
532
-		if ( 'top' === $y ) {
532
+		if ('top' === $y) {
533 533
 			$s_y = 0;
534
-		} elseif ( 'bottom' === $y ) {
534
+		} elseif ('bottom' === $y) {
535 535
 			$s_y = $orig_h - $crop_h;
536 536
 		} else {
537
-			$s_y = floor( ( $orig_h - $crop_h ) / 2 );
537
+			$s_y = floor(($orig_h - $crop_h) / 2);
538 538
 		}
539 539
 	} else {
540 540
 		// don't crop, just resize using $dest_w x $dest_h as a maximum bounding box
@@ -544,17 +544,17 @@  discard block
 block discarded – undo
544 544
 		$s_x = 0;
545 545
 		$s_y = 0;
546 546
 
547
-		list( $new_w, $new_h ) = wp_constrain_dimensions( $orig_w, $orig_h, $dest_w, $dest_h );
547
+		list($new_w, $new_h) = wp_constrain_dimensions($orig_w, $orig_h, $dest_w, $dest_h);
548 548
 	}
549 549
 
550 550
 	// if the resulting image would be the same size or larger we don't want to resize it
551
-	if ( $new_w >= $orig_w && $new_h >= $orig_h && $dest_w != $orig_w && $dest_h != $orig_h ) {
551
+	if ($new_w >= $orig_w && $new_h >= $orig_h && $dest_w != $orig_w && $dest_h != $orig_h) {
552 552
 		return false;
553 553
 	}
554 554
 
555 555
 	// the return array matches the parameters to imagecopyresampled()
556 556
 	// int dst_x, int dst_y, int src_x, int src_y, int dst_w, int dst_h, int src_w, int src_h
557
-	return array( 0, 0, (int) $s_x, (int) $s_y, (int) $new_w, (int) $new_h, (int) $crop_w, (int) $crop_h );
557
+	return array(0, 0, (int) $s_x, (int) $s_y, (int) $new_w, (int) $new_h, (int) $crop_w, (int) $crop_h);
558 558
 
559 559
 }
560 560
 
@@ -574,17 +574,17 @@  discard block
 block discarded – undo
574 574
  *                       Default false.
575 575
  * @return false|array False, if no image was created. Metadata array on success.
576 576
  */
577
-function image_make_intermediate_size( $file, $width, $height, $crop = false ) {
578
-	if ( $width || $height ) {
579
-		$editor = wp_get_image_editor( $file );
577
+function image_make_intermediate_size($file, $width, $height, $crop = false) {
578
+	if ($width || $height) {
579
+		$editor = wp_get_image_editor($file);
580 580
 
581
-		if ( is_wp_error( $editor ) || is_wp_error( $editor->resize( $width, $height, $crop ) ) )
581
+		if (is_wp_error($editor) || is_wp_error($editor->resize($width, $height, $crop)))
582 582
 			return false;
583 583
 
584 584
 		$resized_file = $editor->save();
585 585
 
586
-		if ( ! is_wp_error( $resized_file ) && $resized_file ) {
587
-			unset( $resized_file['path'] );
586
+		if ( ! is_wp_error($resized_file) && $resized_file) {
587
+			unset($resized_file['path']);
588 588
 			return $resized_file;
589 589
 		}
590 590
 	}
@@ -629,63 +629,63 @@  discard block
 block discarded – undo
629 629
  *                          parameter.
630 630
  * }
631 631
  */
632
-function image_get_intermediate_size( $post_id, $size = 'thumbnail' ) {
633
-	if ( !is_array( $imagedata = wp_get_attachment_metadata( $post_id ) ) )
632
+function image_get_intermediate_size($post_id, $size = 'thumbnail') {
633
+	if ( ! is_array($imagedata = wp_get_attachment_metadata($post_id)))
634 634
 		return false;
635 635
 
636 636
 	// get the best one for a specified set of dimensions
637
-	if ( is_array($size) && !empty($imagedata['sizes']) ) {
637
+	if (is_array($size) && ! empty($imagedata['sizes'])) {
638 638
 		$candidates = array();
639 639
 
640
-		foreach ( $imagedata['sizes'] as $_size => $data ) {
640
+		foreach ($imagedata['sizes'] as $_size => $data) {
641 641
 			// If there's an exact match to an existing image size, short circuit.
642
-			if ( $data['width'] == $size[0] && $data['height'] == $size[1] ) {
643
-				list( $data['width'], $data['height'] ) = image_constrain_size_for_editor( $data['width'], $data['height'], $size );
642
+			if ($data['width'] == $size[0] && $data['height'] == $size[1]) {
643
+				list($data['width'], $data['height']) = image_constrain_size_for_editor($data['width'], $data['height'], $size);
644 644
 
645 645
 				/** This filter is documented in wp-includes/media.php */
646
-				return apply_filters( 'image_get_intermediate_size', $data, $post_id, $size );
646
+				return apply_filters('image_get_intermediate_size', $data, $post_id, $size);
647 647
 			}
648 648
 			// If it's not an exact match but it's at least the dimensions requested.
649
-			if ( $data['width'] >= $size[0] && $data['height'] >= $size[1] ) {
650
-				$candidates[ $data['width'] * $data['height'] ] = $_size;
649
+			if ($data['width'] >= $size[0] && $data['height'] >= $size[1]) {
650
+				$candidates[$data['width'] * $data['height']] = $_size;
651 651
 			}
652 652
 		}
653 653
 
654
-		if ( ! empty( $candidates ) ) {
654
+		if ( ! empty($candidates)) {
655 655
 			// find for the smallest image not smaller than the desired size
656
-			ksort( $candidates );
657
-			foreach ( $candidates as $_size ) {
656
+			ksort($candidates);
657
+			foreach ($candidates as $_size) {
658 658
 				$data = $imagedata['sizes'][$_size];
659 659
 
660 660
 				// Skip images with unexpectedly divergent aspect ratios (crops)
661 661
 				// First, we calculate what size the original image would be if constrained to a box the size of the current image in the loop
662
-				$maybe_cropped = image_resize_dimensions($imagedata['width'], $imagedata['height'], $data['width'], $data['height'], false );
662
+				$maybe_cropped = image_resize_dimensions($imagedata['width'], $imagedata['height'], $data['width'], $data['height'], false);
663 663
 				// If the size doesn't match within one pixel, then it is of a different aspect ratio, so we skip it, unless it's the thumbnail size
664
-				if ( 'thumbnail' != $_size &&
664
+				if ('thumbnail' != $_size &&
665 665
 				  ( ! $maybe_cropped
666
-				    || ( $maybe_cropped[4] != $data['width'] && $maybe_cropped[4] + 1 != $data['width'] )
667
-				    || ( $maybe_cropped[5] != $data['height'] && $maybe_cropped[5] + 1 != $data['height'] )
668
-				  ) ) {
666
+				    || ($maybe_cropped[4] != $data['width'] && $maybe_cropped[4] + 1 != $data['width'])
667
+				    || ($maybe_cropped[5] != $data['height'] && $maybe_cropped[5] + 1 != $data['height'])
668
+				  )) {
669 669
 				  continue;
670 670
 				}
671 671
 				// If we're still here, then we're going to use this size.
672
-				list( $data['width'], $data['height'] ) = image_constrain_size_for_editor( $data['width'], $data['height'], $size );
672
+				list($data['width'], $data['height']) = image_constrain_size_for_editor($data['width'], $data['height'], $size);
673 673
 
674 674
 				/** This filter is documented in wp-includes/media.php */
675
-				return apply_filters( 'image_get_intermediate_size', $data, $post_id, $size );
675
+				return apply_filters('image_get_intermediate_size', $data, $post_id, $size);
676 676
 			}
677 677
 		}
678 678
 	}
679 679
 
680
-	if ( is_array($size) || empty($size) || empty($imagedata['sizes'][$size]) )
680
+	if (is_array($size) || empty($size) || empty($imagedata['sizes'][$size]))
681 681
 		return false;
682 682
 
683 683
 	$data = $imagedata['sizes'][$size];
684 684
 	// include the full filesystem path of the intermediate file
685
-	if ( empty($data['path']) && !empty($data['file']) ) {
685
+	if (empty($data['path']) && ! empty($data['file'])) {
686 686
 		$file_url = wp_get_attachment_url($post_id);
687
-		$data['path'] = path_join( dirname($imagedata['file']), $data['file'] );
688
-		$data['url'] = path_join( dirname($file_url), $data['file'] );
687
+		$data['path'] = path_join(dirname($imagedata['file']), $data['file']);
688
+		$data['url'] = path_join(dirname($file_url), $data['file']);
689 689
 	}
690 690
 
691 691
 	/**
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
 	 * @param string|array $size    Registered image size or flat array of initially-requested height and width
702 702
 	 *                              dimensions (in that order).
703 703
 	 */
704
-	return apply_filters( 'image_get_intermediate_size', $data, $post_id, $size );
704
+	return apply_filters('image_get_intermediate_size', $data, $post_id, $size);
705 705
 }
706 706
 
707 707
 /**
@@ -716,8 +716,8 @@  discard block
 block discarded – undo
716 716
 function get_intermediate_image_sizes() {
717 717
 	global $_wp_additional_image_sizes;
718 718
 	$image_sizes = array('thumbnail', 'medium', 'medium_large', 'large'); // Standard sizes
719
-	if ( isset( $_wp_additional_image_sizes ) && count( $_wp_additional_image_sizes ) )
720
-		$image_sizes = array_merge( $image_sizes, array_keys( $_wp_additional_image_sizes ) );
719
+	if (isset($_wp_additional_image_sizes) && count($_wp_additional_image_sizes))
720
+		$image_sizes = array_merge($image_sizes, array_keys($_wp_additional_image_sizes));
721 721
 
722 722
 	/**
723 723
 	 * Filter the list of intermediate image sizes.
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
 	 * @param array $image_sizes An array of intermediate image sizes. Defaults
728 728
 	 *                           are 'thumbnail', 'medium', 'medium_large', 'large'.
729 729
 	 */
730
-	return apply_filters( 'intermediate_image_sizes', $image_sizes );
730
+	return apply_filters('intermediate_image_sizes', $image_sizes);
731 731
 }
732 732
 
733 733
 /**
@@ -748,22 +748,22 @@  discard block
 block discarded – undo
748 748
  * @param bool         $icon          Optional. Whether the image should be treated as an icon. Default false.
749 749
  * @return false|array Returns an array (url, width, height, is_intermediate), or false, if no image is available.
750 750
  */
751
-function wp_get_attachment_image_src( $attachment_id, $size = 'thumbnail', $icon = false ) {
751
+function wp_get_attachment_image_src($attachment_id, $size = 'thumbnail', $icon = false) {
752 752
 	// get a thumbnail or intermediate image if there is one
753
-	$image = image_downsize( $attachment_id, $size );
754
-	if ( ! $image ) {
753
+	$image = image_downsize($attachment_id, $size);
754
+	if ( ! $image) {
755 755
 		$src = false;
756 756
 
757
-		if ( $icon && $src = wp_mime_type_icon( $attachment_id ) ) {
757
+		if ($icon && $src = wp_mime_type_icon($attachment_id)) {
758 758
 			/** This filter is documented in wp-includes/post.php */
759
-			$icon_dir = apply_filters( 'icon_dir', ABSPATH . WPINC . '/images/media' );
759
+			$icon_dir = apply_filters('icon_dir', ABSPATH.WPINC.'/images/media');
760 760
 
761
-			$src_file = $icon_dir . '/' . wp_basename( $src );
762
-			@list( $width, $height ) = getimagesize( $src_file );
761
+			$src_file = $icon_dir.'/'.wp_basename($src);
762
+			@list($width, $height) = getimagesize($src_file);
763 763
 		}
764 764
 
765
-		if ( $src && $width && $height ) {
766
-			$image = array( $src, $width, $height );
765
+		if ($src && $width && $height) {
766
+			$image = array($src, $width, $height);
767 767
 		}
768 768
 	}
769 769
 	/**
@@ -777,7 +777,7 @@  discard block
 block discarded – undo
777 777
 	 *                                    (in that order). Default 'thumbnail'.
778 778
 	 * @param bool         $icon          Whether the image should be treated as an icon. Default false.
779 779
 	 */
780
-	return apply_filters( 'wp_get_attachment_image_src', $image, $attachment_id, $size, $icon );
780
+	return apply_filters('wp_get_attachment_image_src', $image, $attachment_id, $size, $icon);
781 781
 }
782 782
 
783 783
 /**
@@ -800,39 +800,39 @@  discard block
 block discarded – undo
800 800
 function wp_get_attachment_image($attachment_id, $size = 'thumbnail', $icon = false, $attr = '') {
801 801
 	$html = '';
802 802
 	$image = wp_get_attachment_image_src($attachment_id, $size, $icon);
803
-	if ( $image ) {
803
+	if ($image) {
804 804
 		list($src, $width, $height) = $image;
805 805
 		$hwstring = image_hwstring($width, $height);
806 806
 		$size_class = $size;
807
-		if ( is_array( $size_class ) ) {
808
-			$size_class = join( 'x', $size_class );
807
+		if (is_array($size_class)) {
808
+			$size_class = join('x', $size_class);
809 809
 		}
810 810
 		$attachment = get_post($attachment_id);
811 811
 		$default_attr = array(
812 812
 			'src'	=> $src,
813 813
 			'class'	=> "attachment-$size_class size-$size_class",
814
-			'alt'	=> trim(strip_tags( get_post_meta($attachment_id, '_wp_attachment_image_alt', true) )), // Use Alt field first
814
+			'alt'	=> trim(strip_tags(get_post_meta($attachment_id, '_wp_attachment_image_alt', true))), // Use Alt field first
815 815
 		);
816
-		if ( empty($default_attr['alt']) )
817
-			$default_attr['alt'] = trim(strip_tags( $attachment->post_excerpt )); // If not, Use the Caption
818
-		if ( empty($default_attr['alt']) )
819
-			$default_attr['alt'] = trim(strip_tags( $attachment->post_title )); // Finally, use the title
816
+		if (empty($default_attr['alt']))
817
+			$default_attr['alt'] = trim(strip_tags($attachment->post_excerpt)); // If not, Use the Caption
818
+		if (empty($default_attr['alt']))
819
+			$default_attr['alt'] = trim(strip_tags($attachment->post_title)); // Finally, use the title
820 820
 
821
-		$attr = wp_parse_args( $attr, $default_attr );
821
+		$attr = wp_parse_args($attr, $default_attr);
822 822
 
823 823
 		// Generate 'srcset' and 'sizes' if not already present.
824
-		if ( empty( $attr['srcset'] ) ) {
825
-			$image_meta = get_post_meta( $attachment_id, '_wp_attachment_metadata', true );
824
+		if (empty($attr['srcset'])) {
825
+			$image_meta = get_post_meta($attachment_id, '_wp_attachment_metadata', true);
826 826
 
827
-			if ( is_array( $image_meta ) ) {
828
-				$size_array = array( absint( $width ), absint( $height ) );
829
-				$srcset = wp_calculate_image_srcset( $size_array, $src, $image_meta, $attachment_id );
830
-				$sizes = wp_calculate_image_sizes( $size_array, $src, $image_meta, $attachment_id );
827
+			if (is_array($image_meta)) {
828
+				$size_array = array(absint($width), absint($height));
829
+				$srcset = wp_calculate_image_srcset($size_array, $src, $image_meta, $attachment_id);
830
+				$sizes = wp_calculate_image_sizes($size_array, $src, $image_meta, $attachment_id);
831 831
 
832
-				if ( $srcset && ( $sizes || ! empty( $attr['sizes'] ) ) ) {
832
+				if ($srcset && ($sizes || ! empty($attr['sizes']))) {
833 833
 					$attr['srcset'] = $srcset;
834 834
 
835
-					if ( empty( $attr['sizes'] ) ) {
835
+					if (empty($attr['sizes'])) {
836 836
 						$attr['sizes'] = $sizes;
837 837
 					}
838 838
 				}
@@ -849,11 +849,11 @@  discard block
 block discarded – undo
849 849
 		 * @param string|array $size       Requested size. Image size or array of width and height values
850 850
 		 *                                 (in that order). Default 'thumbnail'.
851 851
 		 */
852
-		$attr = apply_filters( 'wp_get_attachment_image_attributes', $attr, $attachment, $size );
853
-		$attr = array_map( 'esc_attr', $attr );
852
+		$attr = apply_filters('wp_get_attachment_image_attributes', $attr, $attachment, $size);
853
+		$attr = array_map('esc_attr', $attr);
854 854
 		$html = rtrim("<img $hwstring");
855
-		foreach ( $attr as $name => $value ) {
856
-			$html .= " $name=" . '"' . $value . '"';
855
+		foreach ($attr as $name => $value) {
856
+			$html .= " $name=".'"'.$value.'"';
857 857
 		}
858 858
 		$html .= ' />';
859 859
 	}
@@ -872,9 +872,9 @@  discard block
 block discarded – undo
872 872
  * @param bool         $icon          Optional. Whether the image should be treated as an icon. Default false.
873 873
  * @return string|false Attachment URL or false if no image is available.
874 874
  */
875
-function wp_get_attachment_image_url( $attachment_id, $size = 'thumbnail', $icon = false ) {
876
-	$image = wp_get_attachment_image_src( $attachment_id, $size, $icon );
877
-	return isset( $image['0'] ) ? $image['0'] : false;
875
+function wp_get_attachment_image_url($attachment_id, $size = 'thumbnail', $icon = false) {
876
+	$image = wp_get_attachment_image_src($attachment_id, $size, $icon);
877
+	return isset($image['0']) ? $image['0'] : false;
878 878
 }
879 879
 
880 880
 /**
@@ -886,17 +886,17 @@  discard block
 block discarded – undo
886 886
  * @param string $file Attachment file name.
887 887
  * @return string Attachment path relative to the upload directory.
888 888
  */
889
-function _wp_get_attachment_relative_path( $file ) {
890
-	$dirname = dirname( $file );
889
+function _wp_get_attachment_relative_path($file) {
890
+	$dirname = dirname($file);
891 891
 
892
-	if ( '.' === $dirname ) {
892
+	if ('.' === $dirname) {
893 893
 		return '';
894 894
 	}
895 895
 
896
-	if ( false !== strpos( $dirname, 'wp-content/uploads' ) ) {
896
+	if (false !== strpos($dirname, 'wp-content/uploads')) {
897 897
 		// Get the directory name relative to the upload directory (back compat for pre-2.7 uploads)
898
-		$dirname = substr( $dirname, strpos( $dirname, 'wp-content/uploads' ) + 18 );
899
-		$dirname = ltrim( $dirname, '/' );
898
+		$dirname = substr($dirname, strpos($dirname, 'wp-content/uploads') + 18);
899
+		$dirname = ltrim($dirname, '/');
900 900
 	}
901 901
 
902 902
 	return $dirname;
@@ -915,16 +915,16 @@  discard block
 block discarded – undo
915 915
  * @return array|bool Array of width and height values in pixels (in that order)
916 916
  *                    or false if the size doesn't exist.
917 917
  */
918
-function _wp_get_image_size_from_meta( $size_name, $image_meta ) {
919
-	if ( $size_name === 'full' ) {
918
+function _wp_get_image_size_from_meta($size_name, $image_meta) {
919
+	if ($size_name === 'full') {
920 920
 		return array(
921
-			absint( $image_meta['width'] ),
922
-			absint( $image_meta['height'] ),
921
+			absint($image_meta['width']),
922
+			absint($image_meta['height']),
923 923
 		);
924
-	} elseif ( ! empty( $image_meta['sizes'][$size_name] ) ) {
924
+	} elseif ( ! empty($image_meta['sizes'][$size_name])) {
925 925
 		return array(
926
-			absint( $image_meta['sizes'][$size_name]['width'] ),
927
-			absint( $image_meta['sizes'][$size_name]['height'] ),
926
+			absint($image_meta['sizes'][$size_name]['width']),
927
+			absint($image_meta['sizes'][$size_name]['height']),
928 928
 		);
929 929
 	}
930 930
 
@@ -945,22 +945,22 @@  discard block
 block discarded – undo
945 945
  *                                    Default null.
946 946
  * @return string|bool A 'srcset' value string or false.
947 947
  */
948
-function wp_get_attachment_image_srcset( $attachment_id, $size = 'medium', $image_meta = null ) {
949
-	if ( ! $image = wp_get_attachment_image_src( $attachment_id, $size ) ) {
948
+function wp_get_attachment_image_srcset($attachment_id, $size = 'medium', $image_meta = null) {
949
+	if ( ! $image = wp_get_attachment_image_src($attachment_id, $size)) {
950 950
 		return false;
951 951
 	}
952 952
 
953
-	if ( ! is_array( $image_meta ) ) {
954
-		$image_meta = get_post_meta( $attachment_id, '_wp_attachment_metadata', true );
953
+	if ( ! is_array($image_meta)) {
954
+		$image_meta = get_post_meta($attachment_id, '_wp_attachment_metadata', true);
955 955
 	}
956 956
 
957 957
 	$image_src = $image[0];
958 958
 	$size_array = array(
959
-		absint( $image[1] ),
960
-		absint( $image[2] )
959
+		absint($image[1]),
960
+		absint($image[2])
961 961
 	);
962 962
 
963
-	return wp_calculate_image_srcset( $size_array, $image_src, $image_meta, $attachment_id );
963
+	return wp_calculate_image_srcset($size_array, $image_src, $image_meta, $attachment_id);
964 964
 }
965 965
 
966 966
 /**
@@ -974,7 +974,7 @@  discard block
 block discarded – undo
974 974
  * @param int    $attachment_id Optional. The image attachment ID to pass to the filter. Default 0.
975 975
  * @return string|bool          The 'srcset' attribute value. False on error or when only one source exists.
976 976
  */
977
-function wp_calculate_image_srcset( $size_array, $image_src, $image_meta, $attachment_id = 0 ) {
977
+function wp_calculate_image_srcset($size_array, $image_src, $image_meta, $attachment_id = 0) {
978 978
 	/**
979 979
 	 * Let plugins pre-filter the image meta to be able to fix inconsistencies in the stored data.
980 980
 	 *
@@ -983,9 +983,9 @@  discard block
 block discarded – undo
983 983
 	 * @param string $image_src     The 'src' of the image.
984 984
 	 * @param int    $attachment_id The image attachment ID or 0 if not supplied.
985 985
 	 */
986
-	$image_meta = apply_filters( 'wp_calculate_image_srcset_meta', $image_meta, $size_array, $image_src, $attachment_id );
986
+	$image_meta = apply_filters('wp_calculate_image_srcset_meta', $image_meta, $size_array, $image_src, $attachment_id);
987 987
 
988
-	if ( empty( $image_meta['sizes'] ) || ! isset( $image_meta['file'] ) || strlen( $image_meta['file'] ) < 4 ) {
988
+	if (empty($image_meta['sizes']) || ! isset($image_meta['file']) || strlen($image_meta['file']) < 4) {
989 989
 		return false;
990 990
 	}
991 991
 
@@ -996,43 +996,43 @@  discard block
 block discarded – undo
996 996
 	$image_height = (int) $size_array[1];
997 997
 
998 998
 	// Bail early if error/no width.
999
-	if ( $image_width < 1 ) {
999
+	if ($image_width < 1) {
1000 1000
 		return false;
1001 1001
 	}
1002 1002
 
1003
-	$image_basename = wp_basename( $image_meta['file'] );
1003
+	$image_basename = wp_basename($image_meta['file']);
1004 1004
 
1005 1005
 	/*
1006 1006
 	 * WordPress flattens animated GIFs into one frame when generating intermediate sizes.
1007 1007
 	 * To avoid hiding animation in user content, if src is a full size GIF, a srcset attribute is not generated.
1008 1008
 	 * If src is an intermediate size GIF, the full size is excluded from srcset to keep a flattened GIF from becoming animated.
1009 1009
 	 */
1010
-	if ( ! isset( $image_sizes['thumbnail']['mime-type'] ) || 'image/gif' !== $image_sizes['thumbnail']['mime-type'] ) {
1010
+	if ( ! isset($image_sizes['thumbnail']['mime-type']) || 'image/gif' !== $image_sizes['thumbnail']['mime-type']) {
1011 1011
 		$image_sizes['full'] = array(
1012 1012
 			'width'  => $image_meta['width'],
1013 1013
 			'height' => $image_meta['height'],
1014 1014
 			'file'   => $image_basename,
1015 1015
 		);
1016
-	} elseif ( strpos( $image_src, $image_meta['file'] ) ) {
1016
+	} elseif (strpos($image_src, $image_meta['file'])) {
1017 1017
 		return false;
1018 1018
 	}
1019 1019
 
1020 1020
 	// Retrieve the uploads sub-directory from the full size image.
1021
-	$dirname = _wp_get_attachment_relative_path( $image_meta['file'] );
1021
+	$dirname = _wp_get_attachment_relative_path($image_meta['file']);
1022 1022
 
1023
-	if ( $dirname ) {
1024
-		$dirname = trailingslashit( $dirname );
1023
+	if ($dirname) {
1024
+		$dirname = trailingslashit($dirname);
1025 1025
 	}
1026 1026
 
1027 1027
 	$upload_dir = wp_get_upload_dir();
1028
-	$image_baseurl = trailingslashit( $upload_dir['baseurl'] ) . $dirname;
1028
+	$image_baseurl = trailingslashit($upload_dir['baseurl']).$dirname;
1029 1029
 
1030 1030
 	/*
1031 1031
 	 * Images that have been edited in WordPress after being uploaded will
1032 1032
 	 * contain a unique hash. Look for that hash and use it later to filter
1033 1033
 	 * out images that are leftovers from previous versions.
1034 1034
 	 */
1035
-	$image_edited = preg_match( '/-e[0-9]{13}/', wp_basename( $image_src ), $image_edit_hash );
1035
+	$image_edited = preg_match('/-e[0-9]{13}/', wp_basename($image_src), $image_edit_hash);
1036 1036
 
1037 1037
 	/**
1038 1038
 	 * Filter the maximum image width to be included in a 'srcset' attribute.
@@ -1042,7 +1042,7 @@  discard block
 block discarded – undo
1042 1042
 	 * @param int   $max_width  The maximum image width to be included in the 'srcset'. Default '1600'.
1043 1043
 	 * @param array $size_array Array of width and height values in pixels (in that order).
1044 1044
 	 */
1045
-	$max_srcset_image_width = apply_filters( 'max_srcset_image_width', 1600, $size_array );
1045
+	$max_srcset_image_width = apply_filters('max_srcset_image_width', 1600, $size_array);
1046 1046
 
1047 1047
 	// Array to hold URL candidates.
1048 1048
 	$sources = array();
@@ -1058,20 +1058,20 @@  discard block
 block discarded – undo
1058 1058
 	 * Loop through available images. Only use images that are resized
1059 1059
 	 * versions of the same edit.
1060 1060
 	 */
1061
-	foreach ( $image_sizes as $image ) {
1061
+	foreach ($image_sizes as $image) {
1062 1062
 
1063 1063
 		// Check if image meta isn't corrupted.
1064
-		if ( ! is_array( $image ) ) {
1064
+		if ( ! is_array($image)) {
1065 1065
 			continue;
1066 1066
 		}
1067 1067
 
1068 1068
 		// If the file name is part of the `src`, we've confirmed a match.
1069
-		if ( ! $src_matched && false !== strpos( $image_src, $dirname . $image['file'] ) ) {
1069
+		if ( ! $src_matched && false !== strpos($image_src, $dirname.$image['file'])) {
1070 1070
 			$src_matched = true;
1071 1071
 		}
1072 1072
 
1073 1073
 		// Filter out images that are from previous edits.
1074
-		if ( $image_edited && ! strpos( $image['file'], $image_edit_hash[0] ) ) {
1074
+		if ($image_edited && ! strpos($image['file'], $image_edit_hash[0])) {
1075 1075
 			continue;
1076 1076
 		}
1077 1077
 
@@ -1079,8 +1079,8 @@  discard block
 block discarded – undo
1079 1079
 		 * Filter out images that are wider than '$max_srcset_image_width' unless
1080 1080
 		 * that file is in the 'src' attribute.
1081 1081
 		 */
1082
-		if ( $max_srcset_image_width && $image['width'] > $max_srcset_image_width &&
1083
-			false === strpos( $image_src, $image['file'] ) ) {
1082
+		if ($max_srcset_image_width && $image['width'] > $max_srcset_image_width &&
1083
+			false === strpos($image_src, $image['file'])) {
1084 1084
 
1085 1085
 			continue;
1086 1086
 		}
@@ -1090,19 +1090,19 @@  discard block
 block discarded – undo
1090 1090
 		 * image if the larger were constrained by the width of the smaller and then
1091 1091
 		 * see if it matches what we're expecting.
1092 1092
 		 */
1093
-		if ( $image_width > $image['width'] ) {
1094
-			$constrained_size = wp_constrain_dimensions( $image_width, $image_height, $image['width'] );
1095
-			$expected_size = array( $image['width'], $image['height'] );
1093
+		if ($image_width > $image['width']) {
1094
+			$constrained_size = wp_constrain_dimensions($image_width, $image_height, $image['width']);
1095
+			$expected_size = array($image['width'], $image['height']);
1096 1096
 		} else {
1097
-			$constrained_size = wp_constrain_dimensions( $image['width'], $image['height'], $image_width );
1098
-			$expected_size = array( $image_width, $image_height );
1097
+			$constrained_size = wp_constrain_dimensions($image['width'], $image['height'], $image_width);
1098
+			$expected_size = array($image_width, $image_height);
1099 1099
 		}
1100 1100
 
1101 1101
 		// If the image dimensions are within 1px of the expected size, use it.
1102
-		if ( abs( $constrained_size[0] - $expected_size[0] ) <= 1 && abs( $constrained_size[1] - $expected_size[1] ) <= 1 ) {
1102
+		if (abs($constrained_size[0] - $expected_size[0]) <= 1 && abs($constrained_size[1] - $expected_size[1]) <= 1) {
1103 1103
 			// Add the URL, descriptor, and value to the sources array to be returned.
1104
-			$sources[ $image['width'] ] = array(
1105
-				'url'        => $image_baseurl . $image['file'],
1104
+			$sources[$image['width']] = array(
1105
+				'url'        => $image_baseurl.$image['file'],
1106 1106
 				'descriptor' => 'w',
1107 1107
 				'value'      => $image['width'],
1108 1108
 			);
@@ -1130,20 +1130,20 @@  discard block
 block discarded – undo
1130 1130
 	 * @param array  $image_meta    The image meta data as returned by 'wp_get_attachment_metadata()'.
1131 1131
  	 * @param int    $attachment_id Image attachment ID or 0.
1132 1132
 	 */
1133
-	$sources = apply_filters( 'wp_calculate_image_srcset', $sources, $size_array, $image_src, $image_meta, $attachment_id );
1133
+	$sources = apply_filters('wp_calculate_image_srcset', $sources, $size_array, $image_src, $image_meta, $attachment_id);
1134 1134
 
1135 1135
 	// Only return a 'srcset' value if there is more than one source.
1136
-	if ( ! $src_matched || count( $sources ) < 2 ) {
1136
+	if ( ! $src_matched || count($sources) < 2) {
1137 1137
 		return false;
1138 1138
 	}
1139 1139
 
1140 1140
 	$srcset = '';
1141 1141
 
1142
-	foreach ( $sources as $source ) {
1143
-		$srcset .= $source['url'] . ' ' . $source['value'] . $source['descriptor'] . ', ';
1142
+	foreach ($sources as $source) {
1143
+		$srcset .= $source['url'].' '.$source['value'].$source['descriptor'].', ';
1144 1144
 	}
1145 1145
 
1146
-	return rtrim( $srcset, ', ' );
1146
+	return rtrim($srcset, ', ');
1147 1147
 }
1148 1148
 
1149 1149
 /**
@@ -1160,22 +1160,22 @@  discard block
 block discarded – undo
1160 1160
  *                                    Default null.
1161 1161
  * @return string|bool A valid source size value for use in a 'sizes' attribute or false.
1162 1162
  */
1163
-function wp_get_attachment_image_sizes( $attachment_id, $size = 'medium', $image_meta = null ) {
1164
-	if ( ! $image = wp_get_attachment_image_src( $attachment_id, $size ) ) {
1163
+function wp_get_attachment_image_sizes($attachment_id, $size = 'medium', $image_meta = null) {
1164
+	if ( ! $image = wp_get_attachment_image_src($attachment_id, $size)) {
1165 1165
 		return false;
1166 1166
 	}
1167 1167
 
1168
-	if ( ! is_array( $image_meta ) ) {
1169
-		$image_meta = get_post_meta( $attachment_id, '_wp_attachment_metadata', true );
1168
+	if ( ! is_array($image_meta)) {
1169
+		$image_meta = get_post_meta($attachment_id, '_wp_attachment_metadata', true);
1170 1170
 	}
1171 1171
 
1172 1172
 	$image_src = $image[0];
1173 1173
 	$size_array = array(
1174
-		absint( $image[1] ),
1175
-		absint( $image[2] )
1174
+		absint($image[1]),
1175
+		absint($image[2])
1176 1176
 	);
1177 1177
 
1178
-	return wp_calculate_image_sizes( $size_array, $image_src, $image_meta, $attachment_id );
1178
+	return wp_calculate_image_sizes($size_array, $image_src, $image_meta, $attachment_id);
1179 1179
 }
1180 1180
 
1181 1181
 /**
@@ -1192,30 +1192,30 @@  discard block
 block discarded – undo
1192 1192
  *                                    is needed when using the image size name as argument for `$size`. Default 0.
1193 1193
  * @return string|bool A valid source size value for use in a 'sizes' attribute or false.
1194 1194
  */
1195
-function wp_calculate_image_sizes( $size, $image_src = null, $image_meta = null, $attachment_id = 0 ) {
1195
+function wp_calculate_image_sizes($size, $image_src = null, $image_meta = null, $attachment_id = 0) {
1196 1196
 	$width = 0;
1197 1197
 
1198
-	if ( is_array( $size ) ) {
1199
-		$width = absint( $size[0] );
1200
-	} elseif ( is_string( $size ) ) {
1201
-		if ( ! $image_meta && $attachment_id ) {
1202
-			$image_meta = get_post_meta( $attachment_id, '_wp_attachment_metadata', true );
1198
+	if (is_array($size)) {
1199
+		$width = absint($size[0]);
1200
+	} elseif (is_string($size)) {
1201
+		if ( ! $image_meta && $attachment_id) {
1202
+			$image_meta = get_post_meta($attachment_id, '_wp_attachment_metadata', true);
1203 1203
 		}
1204 1204
 
1205
-		if ( is_array( $image_meta ) ) {
1206
-			$size_array = _wp_get_image_size_from_meta( $size, $image_meta );
1207
-			if ( $size_array ) {
1208
-				$width = absint( $size_array[0] );
1205
+		if (is_array($image_meta)) {
1206
+			$size_array = _wp_get_image_size_from_meta($size, $image_meta);
1207
+			if ($size_array) {
1208
+				$width = absint($size_array[0]);
1209 1209
 			}
1210 1210
 		}
1211 1211
 	}
1212 1212
 
1213
-	if ( ! $width ) {
1213
+	if ( ! $width) {
1214 1214
 		return false;
1215 1215
 	}
1216 1216
 
1217 1217
 	// Setup the default 'sizes' attribute.
1218
-	$sizes = sprintf( '(max-width: %1$dpx) 100vw, %1$dpx', $width );
1218
+	$sizes = sprintf('(max-width: %1$dpx) 100vw, %1$dpx', $width);
1219 1219
 
1220 1220
 	/**
1221 1221
 	 * Filter the output of 'wp_calculate_image_sizes()'.
@@ -1229,7 +1229,7 @@  discard block
 block discarded – undo
1229 1229
 	 * @param array|null   $image_meta    The image meta data as returned by wp_get_attachment_metadata() or null.
1230 1230
 	 * @param int          $attachment_id Image attachment ID of the original image or 0.
1231 1231
 	 */
1232
-	return apply_filters( 'wp_calculate_image_sizes', $sizes, $size, $image_src, $image_meta, $attachment_id );
1232
+	return apply_filters('wp_calculate_image_sizes', $sizes, $size, $image_src, $image_meta, $attachment_id);
1233 1233
 }
1234 1234
 
1235 1235
 /**
@@ -1242,40 +1242,40 @@  discard block
 block discarded – undo
1242 1242
  * @param string $content The raw post content to be filtered.
1243 1243
  * @return string Converted content with 'srcset' and 'sizes' attributes added to images.
1244 1244
  */
1245
-function wp_make_content_images_responsive( $content ) {
1246
-	if ( ! preg_match_all( '/<img [^>]+>/', $content, $matches ) ) {
1245
+function wp_make_content_images_responsive($content) {
1246
+	if ( ! preg_match_all('/<img [^>]+>/', $content, $matches)) {
1247 1247
 		return $content;
1248 1248
 	}
1249 1249
 
1250 1250
 	$selected_images = $attachment_ids = array();
1251 1251
 
1252
-	foreach( $matches[0] as $image ) {
1253
-		if ( false === strpos( $image, ' srcset=' ) && preg_match( '/wp-image-([0-9]+)/i', $image, $class_id ) &&
1254
-			( $attachment_id = absint( $class_id[1] ) ) ) {
1252
+	foreach ($matches[0] as $image) {
1253
+		if (false === strpos($image, ' srcset=') && preg_match('/wp-image-([0-9]+)/i', $image, $class_id) &&
1254
+			($attachment_id = absint($class_id[1]))) {
1255 1255
 
1256 1256
 			/*
1257 1257
 			 * If exactly the same image tag is used more than once, overwrite it.
1258 1258
 			 * All identical tags will be replaced later with 'str_replace()'.
1259 1259
 			 */
1260
-			$selected_images[ $image ] = $attachment_id;
1260
+			$selected_images[$image] = $attachment_id;
1261 1261
 			// Overwrite the ID when the same image is included more than once.
1262
-			$attachment_ids[ $attachment_id ] = true;
1262
+			$attachment_ids[$attachment_id] = true;
1263 1263
 		}
1264 1264
 	}
1265 1265
 
1266
-	if ( count( $attachment_ids ) > 1 ) {
1266
+	if (count($attachment_ids) > 1) {
1267 1267
 		/*
1268 1268
 		 * Warm object cache for use with 'get_post_meta()'.
1269 1269
 		 *
1270 1270
 		 * To avoid making a database call for each image, a single query
1271 1271
 		 * warms the object cache with the meta information for all images.
1272 1272
 		 */
1273
-		update_meta_cache( 'post', array_keys( $attachment_ids ) );
1273
+		update_meta_cache('post', array_keys($attachment_ids));
1274 1274
 	}
1275 1275
 
1276
-	foreach ( $selected_images as $image => $attachment_id ) {
1277
-		$image_meta = get_post_meta( $attachment_id, '_wp_attachment_metadata', true );
1278
-		$content = str_replace( $image, wp_image_add_srcset_and_sizes( $image, $image_meta, $attachment_id ), $content );
1276
+	foreach ($selected_images as $image => $attachment_id) {
1277
+		$image_meta = get_post_meta($attachment_id, '_wp_attachment_metadata', true);
1278
+		$content = str_replace($image, wp_image_add_srcset_and_sizes($image, $image_meta, $attachment_id), $content);
1279 1279
 	}
1280 1280
 
1281 1281
 	return $content;
@@ -1294,43 +1294,43 @@  discard block
 block discarded – undo
1294 1294
  * @param int    $attachment_id Image attachment ID.
1295 1295
  * @return string Converted 'img' element with 'srcset' and 'sizes' attributes added.
1296 1296
  */
1297
-function wp_image_add_srcset_and_sizes( $image, $image_meta, $attachment_id ) {
1297
+function wp_image_add_srcset_and_sizes($image, $image_meta, $attachment_id) {
1298 1298
 	// Ensure the image meta exists.
1299
-	if ( empty( $image_meta['sizes'] ) ) {
1299
+	if (empty($image_meta['sizes'])) {
1300 1300
 		return $image;
1301 1301
 	}
1302 1302
 
1303
-	$image_src = preg_match( '/src="([^"]+)"/', $image, $match_src ) ? $match_src[1] : '';
1304
-	list( $image_src ) = explode( '?', $image_src );
1303
+	$image_src = preg_match('/src="([^"]+)"/', $image, $match_src) ? $match_src[1] : '';
1304
+	list($image_src) = explode('?', $image_src);
1305 1305
 
1306 1306
 	// Return early if we couldn't get the image source.
1307
-	if ( ! $image_src ) {
1307
+	if ( ! $image_src) {
1308 1308
 		return $image;
1309 1309
 	}
1310 1310
 
1311 1311
 	// Bail early if an image has been inserted and later edited.
1312
-	if ( preg_match( '/-e[0-9]{13}/', $image_meta['file'], $img_edit_hash ) &&
1313
-		strpos( wp_basename( $image_src ), $img_edit_hash[0] ) === false ) {
1312
+	if (preg_match('/-e[0-9]{13}/', $image_meta['file'], $img_edit_hash) &&
1313
+		strpos(wp_basename($image_src), $img_edit_hash[0]) === false) {
1314 1314
 
1315 1315
 		return $image;
1316 1316
 	}
1317 1317
 
1318
-	$width  = preg_match( '/ width="([0-9]+)"/',  $image, $match_width  ) ? (int) $match_width[1]  : 0;
1319
-	$height = preg_match( '/ height="([0-9]+)"/', $image, $match_height ) ? (int) $match_height[1] : 0;
1318
+	$width  = preg_match('/ width="([0-9]+)"/', $image, $match_width) ? (int) $match_width[1] : 0;
1319
+	$height = preg_match('/ height="([0-9]+)"/', $image, $match_height) ? (int) $match_height[1] : 0;
1320 1320
 
1321
-	if ( ! $width || ! $height ) {
1321
+	if ( ! $width || ! $height) {
1322 1322
 		/*
1323 1323
 		 * If attempts to parse the size value failed, attempt to use the image meta data to match
1324 1324
 		 * the image file name from 'src' against the available sizes for an attachment.
1325 1325
 		 */
1326
-		$image_filename = wp_basename( $image_src );
1326
+		$image_filename = wp_basename($image_src);
1327 1327
 
1328
-		if ( $image_filename === wp_basename( $image_meta['file'] ) ) {
1328
+		if ($image_filename === wp_basename($image_meta['file'])) {
1329 1329
 			$width = (int) $image_meta['width'];
1330 1330
 			$height = (int) $image_meta['height'];
1331 1331
 		} else {
1332
-			foreach( $image_meta['sizes'] as $image_size_data ) {
1333
-				if ( $image_filename === $image_size_data['file'] ) {
1332
+			foreach ($image_meta['sizes'] as $image_size_data) {
1333
+				if ($image_filename === $image_size_data['file']) {
1334 1334
 					$width = (int) $image_size_data['width'];
1335 1335
 					$height = (int) $image_size_data['height'];
1336 1336
 					break;
@@ -1339,32 +1339,32 @@  discard block
 block discarded – undo
1339 1339
 		}
1340 1340
 	}
1341 1341
 
1342
-	if ( ! $width || ! $height ) {
1342
+	if ( ! $width || ! $height) {
1343 1343
 		return $image;
1344 1344
 	}
1345 1345
 
1346
-	$size_array = array( $width, $height );
1347
-	$srcset = wp_calculate_image_srcset( $size_array, $image_src, $image_meta, $attachment_id );
1346
+	$size_array = array($width, $height);
1347
+	$srcset = wp_calculate_image_srcset($size_array, $image_src, $image_meta, $attachment_id);
1348 1348
 
1349
-	if ( $srcset ) {
1349
+	if ($srcset) {
1350 1350
 		// Check if there is already a 'sizes' attribute.
1351
-		$sizes = strpos( $image, ' sizes=' );
1351
+		$sizes = strpos($image, ' sizes=');
1352 1352
 
1353
-		if ( ! $sizes ) {
1354
-			$sizes = wp_calculate_image_sizes( $size_array, $image_src, $image_meta, $attachment_id );
1353
+		if ( ! $sizes) {
1354
+			$sizes = wp_calculate_image_sizes($size_array, $image_src, $image_meta, $attachment_id);
1355 1355
 		}
1356 1356
 	}
1357 1357
 
1358
-	if ( $srcset && $sizes ) {
1358
+	if ($srcset && $sizes) {
1359 1359
 		// Format the 'srcset' and 'sizes' string and escape attributes.
1360
-		$attr = sprintf( ' srcset="%s"', esc_attr( $srcset ) );
1360
+		$attr = sprintf(' srcset="%s"', esc_attr($srcset));
1361 1361
 
1362
-		if ( is_string( $sizes ) ) {
1363
-			$attr .= sprintf( ' sizes="%s"', esc_attr( $sizes ) );
1362
+		if (is_string($sizes)) {
1363
+			$attr .= sprintf(' sizes="%s"', esc_attr($sizes));
1364 1364
 		}
1365 1365
 
1366 1366
 		// Add 'srcset' and 'sizes' attributes to the image markup.
1367
-		$image = preg_replace( '/<img ([^>]+?)[\/ ]*>/', '<img $1' . $attr . ' />', $image );
1367
+		$image = preg_replace('/<img ([^>]+?)[\/ ]*>/', '<img $1'.$attr.' />', $image);
1368 1368
 	}
1369 1369
 
1370 1370
 	return $image;
@@ -1382,7 +1382,7 @@  discard block
 block discarded – undo
1382 1382
  * @param array $attr Thumbnail attributes including src, class, alt, title.
1383 1383
  * @return array Modified array of attributes including the new 'wp-post-image' class.
1384 1384
  */
1385
-function _wp_post_thumbnail_class_filter( $attr ) {
1385
+function _wp_post_thumbnail_class_filter($attr) {
1386 1386
 	$attr['class'] .= ' wp-post-image';
1387 1387
 	return $attr;
1388 1388
 }
@@ -1396,8 +1396,8 @@  discard block
 block discarded – undo
1396 1396
  *
1397 1397
  * @param array $attr Thumbnail attributes including src, class, alt, title.
1398 1398
  */
1399
-function _wp_post_thumbnail_class_filter_add( $attr ) {
1400
-	add_filter( 'wp_get_attachment_image_attributes', '_wp_post_thumbnail_class_filter' );
1399
+function _wp_post_thumbnail_class_filter_add($attr) {
1400
+	add_filter('wp_get_attachment_image_attributes', '_wp_post_thumbnail_class_filter');
1401 1401
 }
1402 1402
 
1403 1403
 /**
@@ -1409,8 +1409,8 @@  discard block
 block discarded – undo
1409 1409
  *
1410 1410
  * @param array $attr Thumbnail attributes including src, class, alt, title.
1411 1411
  */
1412
-function _wp_post_thumbnail_class_filter_remove( $attr ) {
1413
-	remove_filter( 'wp_get_attachment_image_attributes', '_wp_post_thumbnail_class_filter' );
1412
+function _wp_post_thumbnail_class_filter_remove($attr) {
1413
+	remove_filter('wp_get_attachment_image_attributes', '_wp_post_thumbnail_class_filter');
1414 1414
 }
1415 1415
 
1416 1416
 add_shortcode('wp_caption', 'img_caption_shortcode');
@@ -1441,15 +1441,15 @@  discard block
 block discarded – undo
1441 1441
  * @param string $content Shortcode content.
1442 1442
  * @return string HTML content to display the caption.
1443 1443
  */
1444
-function img_caption_shortcode( $attr, $content = null ) {
1444
+function img_caption_shortcode($attr, $content = null) {
1445 1445
 	// New-style shortcode with the caption inside the shortcode with the link and image tags.
1446
-	if ( ! isset( $attr['caption'] ) ) {
1447
-		if ( preg_match( '#((?:<a [^>]+>\s*)?<img [^>]+>(?:\s*</a>)?)(.*)#is', $content, $matches ) ) {
1446
+	if ( ! isset($attr['caption'])) {
1447
+		if (preg_match('#((?:<a [^>]+>\s*)?<img [^>]+>(?:\s*</a>)?)(.*)#is', $content, $matches)) {
1448 1448
 			$content = $matches[1];
1449
-			$attr['caption'] = trim( $matches[2] );
1449
+			$attr['caption'] = trim($matches[2]);
1450 1450
 		}
1451
-	} elseif ( strpos( $attr['caption'], '<' ) !== false ) {
1452
-		$attr['caption'] = wp_kses( $attr['caption'], 'post' );
1451
+	} elseif (strpos($attr['caption'], '<') !== false) {
1452
+		$attr['caption'] = wp_kses($attr['caption'], 'post');
1453 1453
 	}
1454 1454
 
1455 1455
 	/**
@@ -1466,30 +1466,30 @@  discard block
 block discarded – undo
1466 1466
 	 * @param array  $attr    Attributes of the caption shortcode.
1467 1467
 	 * @param string $content The image element, possibly wrapped in a hyperlink.
1468 1468
 	 */
1469
-	$output = apply_filters( 'img_caption_shortcode', '', $attr, $content );
1470
-	if ( $output != '' )
1469
+	$output = apply_filters('img_caption_shortcode', '', $attr, $content);
1470
+	if ($output != '')
1471 1471
 		return $output;
1472 1472
 
1473
-	$atts = shortcode_atts( array(
1473
+	$atts = shortcode_atts(array(
1474 1474
 		'id'	  => '',
1475 1475
 		'align'	  => 'alignnone',
1476 1476
 		'width'	  => '',
1477 1477
 		'caption' => '',
1478 1478
 		'class'   => '',
1479
-	), $attr, 'caption' );
1479
+	), $attr, 'caption');
1480 1480
 
1481 1481
 	$atts['width'] = (int) $atts['width'];
1482
-	if ( $atts['width'] < 1 || empty( $atts['caption'] ) )
1482
+	if ($atts['width'] < 1 || empty($atts['caption']))
1483 1483
 		return $content;
1484 1484
 
1485
-	if ( ! empty( $atts['id'] ) )
1486
-		$atts['id'] = 'id="' . esc_attr( sanitize_html_class( $atts['id'] ) ) . '" ';
1485
+	if ( ! empty($atts['id']))
1486
+		$atts['id'] = 'id="'.esc_attr(sanitize_html_class($atts['id'])).'" ';
1487 1487
 
1488
-	$class = trim( 'wp-caption ' . $atts['align'] . ' ' . $atts['class'] );
1488
+	$class = trim('wp-caption '.$atts['align'].' '.$atts['class']);
1489 1489
 
1490
-	$html5 = current_theme_supports( 'html5', 'caption' );
1490
+	$html5 = current_theme_supports('html5', 'caption');
1491 1491
 	// HTML5 captions never added the extra 10px to the image width
1492
-	$width = $html5 ? $atts['width'] : ( 10 + $atts['width'] );
1492
+	$width = $html5 ? $atts['width'] : (10 + $atts['width']);
1493 1493
 
1494 1494
 	/**
1495 1495
 	 * Filter the width of an image's caption.
@@ -1506,19 +1506,19 @@  discard block
 block discarded – undo
1506 1506
 	 * @param array  $atts     Attributes of the caption shortcode.
1507 1507
 	 * @param string $content  The image element, possibly wrapped in a hyperlink.
1508 1508
 	 */
1509
-	$caption_width = apply_filters( 'img_caption_shortcode_width', $width, $atts, $content );
1509
+	$caption_width = apply_filters('img_caption_shortcode_width', $width, $atts, $content);
1510 1510
 
1511 1511
 	$style = '';
1512
-	if ( $caption_width )
1513
-		$style = 'style="width: ' . (int) $caption_width . 'px" ';
1512
+	if ($caption_width)
1513
+		$style = 'style="width: '.(int) $caption_width.'px" ';
1514 1514
 
1515 1515
 	$html = '';
1516
-	if ( $html5 ) {
1517
-		$html = '<figure ' . $atts['id'] . $style . 'class="' . esc_attr( $class ) . '">'
1518
-		. do_shortcode( $content ) . '<figcaption class="wp-caption-text">' . $atts['caption'] . '</figcaption></figure>';
1516
+	if ($html5) {
1517
+		$html = '<figure '.$atts['id'].$style.'class="'.esc_attr($class).'">'
1518
+		. do_shortcode($content).'<figcaption class="wp-caption-text">'.$atts['caption'].'</figcaption></figure>';
1519 1519
 	} else {
1520
-		$html = '<div ' . $atts['id'] . $style . 'class="' . esc_attr( $class ) . '">'
1521
-		. do_shortcode( $content ) . '<p class="wp-caption-text">' . $atts['caption'] . '</p></div>';
1520
+		$html = '<div '.$atts['id'].$style.'class="'.esc_attr($class).'">'
1521
+		. do_shortcode($content).'<p class="wp-caption-text">'.$atts['caption'].'</p></div>';
1522 1522
 	}
1523 1523
 
1524 1524
 	return $html;
@@ -1560,15 +1560,15 @@  discard block
 block discarded – undo
1560 1560
  * }
1561 1561
  * @return string HTML content to display gallery.
1562 1562
  */
1563
-function gallery_shortcode( $attr ) {
1563
+function gallery_shortcode($attr) {
1564 1564
 	$post = get_post();
1565 1565
 
1566 1566
 	static $instance = 0;
1567 1567
 	$instance++;
1568 1568
 
1569
-	if ( ! empty( $attr['ids'] ) ) {
1569
+	if ( ! empty($attr['ids'])) {
1570 1570
 		// 'ids' is explicitly ordered, unless you specify otherwise.
1571
-		if ( empty( $attr['orderby'] ) ) {
1571
+		if (empty($attr['orderby'])) {
1572 1572
 			$attr['orderby'] = 'post__in';
1573 1573
 		}
1574 1574
 		$attr['include'] = $attr['ids'];
@@ -1589,69 +1589,69 @@  discard block
 block discarded – undo
1589 1589
 	 * @param array  $attr     Attributes of the gallery shortcode.
1590 1590
 	 * @param int    $instance Unique numeric ID of this gallery shortcode instance.
1591 1591
 	 */
1592
-	$output = apply_filters( 'post_gallery', '', $attr, $instance );
1593
-	if ( $output != '' ) {
1592
+	$output = apply_filters('post_gallery', '', $attr, $instance);
1593
+	if ($output != '') {
1594 1594
 		return $output;
1595 1595
 	}
1596 1596
 
1597
-	$html5 = current_theme_supports( 'html5', 'gallery' );
1598
-	$atts = shortcode_atts( array(
1597
+	$html5 = current_theme_supports('html5', 'gallery');
1598
+	$atts = shortcode_atts(array(
1599 1599
 		'order'      => 'ASC',
1600 1600
 		'orderby'    => 'menu_order ID',
1601 1601
 		'id'         => $post ? $post->ID : 0,
1602
-		'itemtag'    => $html5 ? 'figure'     : 'dl',
1603
-		'icontag'    => $html5 ? 'div'        : 'dt',
1602
+		'itemtag'    => $html5 ? 'figure' : 'dl',
1603
+		'icontag'    => $html5 ? 'div' : 'dt',
1604 1604
 		'captiontag' => $html5 ? 'figcaption' : 'dd',
1605 1605
 		'columns'    => 3,
1606 1606
 		'size'       => 'thumbnail',
1607 1607
 		'include'    => '',
1608 1608
 		'exclude'    => '',
1609 1609
 		'link'       => ''
1610
-	), $attr, 'gallery' );
1610
+	), $attr, 'gallery');
1611 1611
 
1612
-	$id = intval( $atts['id'] );
1612
+	$id = intval($atts['id']);
1613 1613
 
1614
-	if ( ! empty( $atts['include'] ) ) {
1615
-		$_attachments = get_posts( array( 'include' => $atts['include'], 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby'] ) );
1614
+	if ( ! empty($atts['include'])) {
1615
+		$_attachments = get_posts(array('include' => $atts['include'], 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby']));
1616 1616
 
1617 1617
 		$attachments = array();
1618
-		foreach ( $_attachments as $key => $val ) {
1618
+		foreach ($_attachments as $key => $val) {
1619 1619
 			$attachments[$val->ID] = $_attachments[$key];
1620 1620
 		}
1621
-	} elseif ( ! empty( $atts['exclude'] ) ) {
1622
-		$attachments = get_children( array( 'post_parent' => $id, 'exclude' => $atts['exclude'], 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby'] ) );
1621
+	} elseif ( ! empty($atts['exclude'])) {
1622
+		$attachments = get_children(array('post_parent' => $id, 'exclude' => $atts['exclude'], 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby']));
1623 1623
 	} else {
1624
-		$attachments = get_children( array( 'post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby'] ) );
1624
+		$attachments = get_children(array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby']));
1625 1625
 	}
1626 1626
 
1627
-	if ( empty( $attachments ) ) {
1627
+	if (empty($attachments)) {
1628 1628
 		return '';
1629 1629
 	}
1630 1630
 
1631
-	if ( is_feed() ) {
1631
+	if (is_feed()) {
1632 1632
 		$output = "\n";
1633
-		foreach ( $attachments as $att_id => $attachment ) {
1634
-			$output .= wp_get_attachment_link( $att_id, $atts['size'], true ) . "\n";
1633
+		foreach ($attachments as $att_id => $attachment) {
1634
+			$output .= wp_get_attachment_link($att_id, $atts['size'], true)."\n";
1635 1635
 		}
1636 1636
 		return $output;
1637 1637
 	}
1638 1638
 
1639
-	$itemtag = tag_escape( $atts['itemtag'] );
1640
-	$captiontag = tag_escape( $atts['captiontag'] );
1641
-	$icontag = tag_escape( $atts['icontag'] );
1642
-	$valid_tags = wp_kses_allowed_html( 'post' );
1643
-	if ( ! isset( $valid_tags[ $itemtag ] ) ) {
1639
+	$itemtag = tag_escape($atts['itemtag']);
1640
+	$captiontag = tag_escape($atts['captiontag']);
1641
+	$icontag = tag_escape($atts['icontag']);
1642
+	$valid_tags = wp_kses_allowed_html('post');
1643
+	if ( ! isset($valid_tags[$itemtag])) {
1644 1644
 		$itemtag = 'dl';
1645 1645
 	}
1646
-	if ( ! isset( $valid_tags[ $captiontag ] ) ) {
1646
+	if ( ! isset($valid_tags[$captiontag])) {
1647 1647
 		$captiontag = 'dd';
1648 1648
 	}
1649
-	if ( ! isset( $valid_tags[ $icontag ] ) ) {
1649
+	if ( ! isset($valid_tags[$icontag])) {
1650 1650
 		$icontag = 'dt';
1651 1651
 	}
1652 1652
 
1653
-	$columns = intval( $atts['columns'] );
1654
-	$itemwidth = $columns > 0 ? floor(100/$columns) : 100;
1653
+	$columns = intval($atts['columns']);
1654
+	$itemwidth = $columns > 0 ? floor(100 / $columns) : 100;
1655 1655
 	$float = is_rtl() ? 'right' : 'left';
1656 1656
 
1657 1657
 	$selector = "gallery-{$instance}";
@@ -1667,7 +1667,7 @@  discard block
 block discarded – undo
1667 1667
 	 *                    Defaults to false if the theme supports HTML5 galleries.
1668 1668
 	 *                    Otherwise, defaults to true.
1669 1669
 	 */
1670
-	if ( apply_filters( 'use_default_gallery_style', ! $html5 ) ) {
1670
+	if (apply_filters('use_default_gallery_style', ! $html5)) {
1671 1671
 		$gallery_style = "
1672 1672
 		<style type='text/css'>
1673 1673
 			#{$selector} {
@@ -1689,7 +1689,7 @@  discard block
 block discarded – undo
1689 1689
 		</style>\n\t\t";
1690 1690
 	}
1691 1691
 
1692
-	$size_class = sanitize_html_class( $atts['size'] );
1692
+	$size_class = sanitize_html_class($atts['size']);
1693 1693
 	$gallery_div = "<div id='$selector' class='gallery galleryid-{$id} gallery-columns-{$columns} gallery-size-{$size_class}'>";
1694 1694
 
1695 1695
 	/**
@@ -1700,43 +1700,43 @@  discard block
 block discarded – undo
1700 1700
 	 * @param string $gallery_style Default CSS styles and opening HTML div container
1701 1701
 	 *                              for the gallery shortcode output.
1702 1702
 	 */
1703
-	$output = apply_filters( 'gallery_style', $gallery_style . $gallery_div );
1703
+	$output = apply_filters('gallery_style', $gallery_style.$gallery_div);
1704 1704
 
1705 1705
 	$i = 0;
1706
-	foreach ( $attachments as $id => $attachment ) {
1706
+	foreach ($attachments as $id => $attachment) {
1707 1707
 
1708
-		$attr = ( trim( $attachment->post_excerpt ) ) ? array( 'aria-describedby' => "$selector-$id" ) : '';
1709
-		if ( ! empty( $atts['link'] ) && 'file' === $atts['link'] ) {
1710
-			$image_output = wp_get_attachment_link( $id, $atts['size'], false, false, false, $attr );
1711
-		} elseif ( ! empty( $atts['link'] ) && 'none' === $atts['link'] ) {
1712
-			$image_output = wp_get_attachment_image( $id, $atts['size'], false, $attr );
1708
+		$attr = (trim($attachment->post_excerpt)) ? array('aria-describedby' => "$selector-$id") : '';
1709
+		if ( ! empty($atts['link']) && 'file' === $atts['link']) {
1710
+			$image_output = wp_get_attachment_link($id, $atts['size'], false, false, false, $attr);
1711
+		} elseif ( ! empty($atts['link']) && 'none' === $atts['link']) {
1712
+			$image_output = wp_get_attachment_image($id, $atts['size'], false, $attr);
1713 1713
 		} else {
1714
-			$image_output = wp_get_attachment_link( $id, $atts['size'], true, false, false, $attr );
1714
+			$image_output = wp_get_attachment_link($id, $atts['size'], true, false, false, $attr);
1715 1715
 		}
1716
-		$image_meta  = wp_get_attachment_metadata( $id );
1716
+		$image_meta  = wp_get_attachment_metadata($id);
1717 1717
 
1718 1718
 		$orientation = '';
1719
-		if ( isset( $image_meta['height'], $image_meta['width'] ) ) {
1720
-			$orientation = ( $image_meta['height'] > $image_meta['width'] ) ? 'portrait' : 'landscape';
1719
+		if (isset($image_meta['height'], $image_meta['width'])) {
1720
+			$orientation = ($image_meta['height'] > $image_meta['width']) ? 'portrait' : 'landscape';
1721 1721
 		}
1722 1722
 		$output .= "<{$itemtag} class='gallery-item'>";
1723 1723
 		$output .= "
1724 1724
 			<{$icontag} class='gallery-icon {$orientation}'>
1725 1725
 				$image_output
1726 1726
 			</{$icontag}>";
1727
-		if ( $captiontag && trim($attachment->post_excerpt) ) {
1727
+		if ($captiontag && trim($attachment->post_excerpt)) {
1728 1728
 			$output .= "
1729 1729
 				<{$captiontag} class='wp-caption-text gallery-caption' id='$selector-$id'>
1730
-				" . wptexturize($attachment->post_excerpt) . "
1730
+				".wptexturize($attachment->post_excerpt)."
1731 1731
 				</{$captiontag}>";
1732 1732
 		}
1733 1733
 		$output .= "</{$itemtag}>";
1734
-		if ( ! $html5 && $columns > 0 && ++$i % $columns == 0 ) {
1734
+		if ( ! $html5 && $columns > 0 && ++$i % $columns == 0) {
1735 1735
 			$output .= '<br style="clear: both" />';
1736 1736
 		}
1737 1737
 	}
1738 1738
 
1739
-	if ( ! $html5 && $columns > 0 && $i % $columns !== 0 ) {
1739
+	if ( ! $html5 && $columns > 0 && $i % $columns !== 0) {
1740 1740
 		$output .= "
1741 1741
 			<br style='clear: both' />";
1742 1742
 	}
@@ -1761,7 +1761,7 @@  discard block
 block discarded – undo
1761 1761
 	<div class="wp-playlist-caption">
1762 1762
 		<span class="wp-playlist-item-meta wp-playlist-item-title"><?php
1763 1763
 			/* translators: playlist item title */
1764
-			printf( _x( '&#8220;%s&#8221;', 'playlist item title' ), '{{ data.title }}' );
1764
+			printf(_x('&#8220;%s&#8221;', 'playlist item title'), '{{ data.title }}');
1765 1765
 		?></span>
1766 1766
 		<# if ( data.meta.album ) { #><span class="wp-playlist-item-meta wp-playlist-item-album">{{ data.meta.album }}</span><# } #>
1767 1767
 		<# if ( data.meta.artist ) { #><span class="wp-playlist-item-meta wp-playlist-item-artist">{{ data.meta.artist }}</span><# } #>
@@ -1776,7 +1776,7 @@  discard block
 block discarded – undo
1776 1776
 			<# } else { #>
1777 1777
 				<span class="wp-playlist-item-title"><?php
1778 1778
 					/* translators: playlist item title */
1779
-					printf( _x( '&#8220;%s&#8221;', 'playlist item title' ), '{{{ data.title }}}' );
1779
+					printf(_x('&#8220;%s&#8221;', 'playlist item title'), '{{{ data.title }}}');
1780 1780
 				?></span>
1781 1781
 				<# if ( data.artists && data.meta.artist ) { #>
1782 1782
 				<span class="wp-playlist-item-artist"> &mdash; {{ data.meta.artist }}</span>
@@ -1798,14 +1798,14 @@  discard block
 block discarded – undo
1798 1798
  *
1799 1799
  * @param string $type Type of playlist. Accepts 'audio' or 'video'.
1800 1800
  */
1801
-function wp_playlist_scripts( $type ) {
1802
-	wp_enqueue_style( 'wp-mediaelement' );
1803
-	wp_enqueue_script( 'wp-playlist' );
1801
+function wp_playlist_scripts($type) {
1802
+	wp_enqueue_style('wp-mediaelement');
1803
+	wp_enqueue_script('wp-playlist');
1804 1804
 ?>
1805
-<!--[if lt IE 9]><script>document.createElement('<?php echo esc_js( $type ) ?>');</script><![endif]-->
1805
+<!--[if lt IE 9]><script>document.createElement('<?php echo esc_js($type) ?>');</script><![endif]-->
1806 1806
 <?php
1807
-	add_action( 'wp_footer', 'wp_underscore_playlist_templates', 0 );
1808
-	add_action( 'admin_footer', 'wp_underscore_playlist_templates', 0 );
1807
+	add_action('wp_footer', 'wp_underscore_playlist_templates', 0);
1808
+	add_action('admin_footer', 'wp_underscore_playlist_templates', 0);
1809 1809
 }
1810 1810
 
1811 1811
 /**
@@ -1845,16 +1845,16 @@  discard block
 block discarded – undo
1845 1845
  *
1846 1846
  * @return string Playlist output. Empty string if the passed type is unsupported.
1847 1847
  */
1848
-function wp_playlist_shortcode( $attr ) {
1848
+function wp_playlist_shortcode($attr) {
1849 1849
 	global $content_width;
1850 1850
 	$post = get_post();
1851 1851
 
1852 1852
 	static $instance = 0;
1853 1853
 	$instance++;
1854 1854
 
1855
-	if ( ! empty( $attr['ids'] ) ) {
1855
+	if ( ! empty($attr['ids'])) {
1856 1856
 		// 'ids' is explicitly ordered, unless you specify otherwise.
1857
-		if ( empty( $attr['orderby'] ) ) {
1857
+		if (empty($attr['orderby'])) {
1858 1858
 			$attr['orderby'] = 'post__in';
1859 1859
 		}
1860 1860
 		$attr['include'] = $attr['ids'];
@@ -1873,12 +1873,12 @@  discard block
 block discarded – undo
1873 1873
 	 * @param array  $attr     An array of shortcode attributes.
1874 1874
 	 * @param int    $instance Unique numeric ID of this playlist shortcode instance.
1875 1875
 	 */
1876
-	$output = apply_filters( 'post_playlist', '', $attr, $instance );
1877
-	if ( $output != '' ) {
1876
+	$output = apply_filters('post_playlist', '', $attr, $instance);
1877
+	if ($output != '') {
1878 1878
 		return $output;
1879 1879
 	}
1880 1880
 
1881
-	$atts = shortcode_atts( array(
1881
+	$atts = shortcode_atts(array(
1882 1882
 		'type'		=> 'audio',
1883 1883
 		'order'		=> 'ASC',
1884 1884
 		'orderby'	=> 'menu_order ID',
@@ -1890,11 +1890,11 @@  discard block
 block discarded – undo
1890 1890
 		'tracknumbers' => true,
1891 1891
 		'images'	=> true,
1892 1892
 		'artists'	=> true
1893
-	), $attr, 'playlist' );
1893
+	), $attr, 'playlist');
1894 1894
 
1895
-	$id = intval( $atts['id'] );
1895
+	$id = intval($atts['id']);
1896 1896
 
1897
-	if ( $atts['type'] !== 'audio' ) {
1897
+	if ($atts['type'] !== 'audio') {
1898 1898
 		$atts['type'] = 'video';
1899 1899
 	}
1900 1900
 
@@ -1906,31 +1906,31 @@  discard block
 block discarded – undo
1906 1906
 		'orderby' => $atts['orderby']
1907 1907
 	);
1908 1908
 
1909
-	if ( ! empty( $atts['include'] ) ) {
1909
+	if ( ! empty($atts['include'])) {
1910 1910
 		$args['include'] = $atts['include'];
1911
-		$_attachments = get_posts( $args );
1911
+		$_attachments = get_posts($args);
1912 1912
 
1913 1913
 		$attachments = array();
1914
-		foreach ( $_attachments as $key => $val ) {
1914
+		foreach ($_attachments as $key => $val) {
1915 1915
 			$attachments[$val->ID] = $_attachments[$key];
1916 1916
 		}
1917
-	} elseif ( ! empty( $atts['exclude'] ) ) {
1917
+	} elseif ( ! empty($atts['exclude'])) {
1918 1918
 		$args['post_parent'] = $id;
1919 1919
 		$args['exclude'] = $atts['exclude'];
1920
-		$attachments = get_children( $args );
1920
+		$attachments = get_children($args);
1921 1921
 	} else {
1922 1922
 		$args['post_parent'] = $id;
1923
-		$attachments = get_children( $args );
1923
+		$attachments = get_children($args);
1924 1924
 	}
1925 1925
 
1926
-	if ( empty( $attachments ) ) {
1926
+	if (empty($attachments)) {
1927 1927
 		return '';
1928 1928
 	}
1929 1929
 
1930
-	if ( is_feed() ) {
1930
+	if (is_feed()) {
1931 1931
 		$output = "\n";
1932
-		foreach ( $attachments as $att_id => $attachment ) {
1933
-			$output .= wp_get_attachment_link( $att_id ) . "\n";
1932
+		foreach ($attachments as $att_id => $attachment) {
1933
+			$output .= wp_get_attachment_link($att_id)."\n";
1934 1934
 		}
1935 1935
 		return $output;
1936 1936
 	}
@@ -1940,22 +1940,22 @@  discard block
 block discarded – undo
1940 1940
 	$default_width = 640;
1941 1941
 	$default_height = 360;
1942 1942
 
1943
-	$theme_width = empty( $content_width ) ? $default_width : ( $content_width - $outer );
1944
-	$theme_height = empty( $content_width ) ? $default_height : round( ( $default_height * $theme_width ) / $default_width );
1943
+	$theme_width = empty($content_width) ? $default_width : ($content_width - $outer);
1944
+	$theme_height = empty($content_width) ? $default_height : round(($default_height * $theme_width) / $default_width);
1945 1945
 
1946 1946
 	$data = array(
1947 1947
 		'type' => $atts['type'],
1948 1948
 		// don't pass strings to JSON, will be truthy in JS
1949
-		'tracklist' => wp_validate_boolean( $atts['tracklist'] ),
1950
-		'tracknumbers' => wp_validate_boolean( $atts['tracknumbers'] ),
1951
-		'images' => wp_validate_boolean( $atts['images'] ),
1952
-		'artists' => wp_validate_boolean( $atts['artists'] ),
1949
+		'tracklist' => wp_validate_boolean($atts['tracklist']),
1950
+		'tracknumbers' => wp_validate_boolean($atts['tracknumbers']),
1951
+		'images' => wp_validate_boolean($atts['images']),
1952
+		'artists' => wp_validate_boolean($atts['artists']),
1953 1953
 	);
1954 1954
 
1955 1955
 	$tracks = array();
1956
-	foreach ( $attachments as $attachment ) {
1957
-		$url = wp_get_attachment_url( $attachment->ID );
1958
-		$ftype = wp_check_filetype( $url, wp_get_mime_types() );
1956
+	foreach ($attachments as $attachment) {
1957
+		$url = wp_get_attachment_url($attachment->ID);
1958
+		$ftype = wp_check_filetype($url, wp_get_mime_types());
1959 1959
 		$track = array(
1960 1960
 			'src' => $url,
1961 1961
 			'type' => $ftype['type'],
@@ -1965,27 +1965,27 @@  discard block
 block discarded – undo
1965 1965
 		);
1966 1966
 
1967 1967
 		$track['meta'] = array();
1968
-		$meta = wp_get_attachment_metadata( $attachment->ID );
1969
-		if ( ! empty( $meta ) ) {
1968
+		$meta = wp_get_attachment_metadata($attachment->ID);
1969
+		if ( ! empty($meta)) {
1970 1970
 
1971
-			foreach ( wp_get_attachment_id3_keys( $attachment ) as $key => $label ) {
1972
-				if ( ! empty( $meta[ $key ] ) ) {
1973
-					$track['meta'][ $key ] = $meta[ $key ];
1971
+			foreach (wp_get_attachment_id3_keys($attachment) as $key => $label) {
1972
+				if ( ! empty($meta[$key])) {
1973
+					$track['meta'][$key] = $meta[$key];
1974 1974
 				}
1975 1975
 			}
1976 1976
 
1977
-			if ( 'video' === $atts['type'] ) {
1978
-				if ( ! empty( $meta['width'] ) && ! empty( $meta['height'] ) ) {
1977
+			if ('video' === $atts['type']) {
1978
+				if ( ! empty($meta['width']) && ! empty($meta['height'])) {
1979 1979
 					$width = $meta['width'];
1980 1980
 					$height = $meta['height'];
1981
-					$theme_height = round( ( $height * $theme_width ) / $width );
1981
+					$theme_height = round(($height * $theme_width) / $width);
1982 1982
 				} else {
1983 1983
 					$width = $default_width;
1984 1984
 					$height = $default_height;
1985 1985
 				}
1986 1986
 
1987 1987
 				$track['dimensions'] = array(
1988
-					'original' => compact( 'width', 'height' ),
1988
+					'original' => compact('width', 'height'),
1989 1989
 					'resized' => array(
1990 1990
 						'width' => $theme_width,
1991 1991
 						'height' => $theme_height
@@ -1994,19 +1994,19 @@  discard block
 block discarded – undo
1994 1994
 			}
1995 1995
 		}
1996 1996
 
1997
-		if ( $atts['images'] ) {
1998
-			$thumb_id = get_post_thumbnail_id( $attachment->ID );
1999
-			if ( ! empty( $thumb_id ) ) {
2000
-				list( $src, $width, $height ) = wp_get_attachment_image_src( $thumb_id, 'full' );
2001
-				$track['image'] = compact( 'src', 'width', 'height' );
2002
-				list( $src, $width, $height ) = wp_get_attachment_image_src( $thumb_id, 'thumbnail' );
2003
-				$track['thumb'] = compact( 'src', 'width', 'height' );
1997
+		if ($atts['images']) {
1998
+			$thumb_id = get_post_thumbnail_id($attachment->ID);
1999
+			if ( ! empty($thumb_id)) {
2000
+				list($src, $width, $height) = wp_get_attachment_image_src($thumb_id, 'full');
2001
+				$track['image'] = compact('src', 'width', 'height');
2002
+				list($src, $width, $height) = wp_get_attachment_image_src($thumb_id, 'thumbnail');
2003
+				$track['thumb'] = compact('src', 'width', 'height');
2004 2004
 			} else {
2005
-				$src = wp_mime_type_icon( $attachment->ID );
2005
+				$src = wp_mime_type_icon($attachment->ID);
2006 2006
 				$width = 48;
2007 2007
 				$height = 64;
2008
-				$track['image'] = compact( 'src', 'width', 'height' );
2009
-				$track['thumb'] = compact( 'src', 'width', 'height' );
2008
+				$track['image'] = compact('src', 'width', 'height');
2009
+				$track['thumb'] = compact('src', 'width', 'height');
2010 2010
 			}
2011 2011
 		}
2012 2012
 
@@ -2014,12 +2014,12 @@  discard block
 block discarded – undo
2014 2014
 	}
2015 2015
 	$data['tracks'] = $tracks;
2016 2016
 
2017
-	$safe_type = esc_attr( $atts['type'] );
2018
-	$safe_style = esc_attr( $atts['style'] );
2017
+	$safe_type = esc_attr($atts['type']);
2018
+	$safe_style = esc_attr($atts['style']);
2019 2019
 
2020 2020
 	ob_start();
2021 2021
 
2022
-	if ( 1 === $instance ) {
2022
+	if (1 === $instance) {
2023 2023
 		/**
2024 2024
 		 * Print and enqueue playlist scripts, styles, and JavaScript templates.
2025 2025
 		 *
@@ -2028,15 +2028,15 @@  discard block
 block discarded – undo
2028 2028
 		 * @param string $type  Type of playlist. Possible values are 'audio' or 'video'.
2029 2029
 		 * @param string $style The 'theme' for the playlist. Core provides 'light' and 'dark'.
2030 2030
 		 */
2031
-		do_action( 'wp_playlist_scripts', $atts['type'], $atts['style'] );
2031
+		do_action('wp_playlist_scripts', $atts['type'], $atts['style']);
2032 2032
 	} ?>
2033 2033
 <div class="wp-playlist wp-<?php echo $safe_type ?>-playlist wp-playlist-<?php echo $safe_style ?>">
2034
-	<?php if ( 'audio' === $atts['type'] ): ?>
2034
+	<?php if ('audio' === $atts['type']): ?>
2035 2035
 	<div class="wp-playlist-current-item"></div>
2036 2036
 	<?php endif ?>
2037 2037
 	<<?php echo $safe_type ?> controls="controls" preload="none" width="<?php
2038 2038
 		echo (int) $theme_width;
2039
-	?>"<?php if ( 'video' === $safe_type ):
2039
+	?>"<?php if ('video' === $safe_type):
2040 2040
 		echo ' height="', (int) $theme_height, '"';
2041 2041
 	else:
2042 2042
 		echo ' style="visibility: hidden"';
@@ -2045,17 +2045,17 @@  discard block
 block discarded – undo
2045 2045
 	<div class="wp-playlist-prev"></div>
2046 2046
 	<noscript>
2047 2047
 	<ol><?php
2048
-	foreach ( $attachments as $att_id => $attachment ) {
2049
-		printf( '<li>%s</li>', wp_get_attachment_link( $att_id ) );
2048
+	foreach ($attachments as $att_id => $attachment) {
2049
+		printf('<li>%s</li>', wp_get_attachment_link($att_id));
2050 2050
 	}
2051 2051
 	?></ol>
2052 2052
 	</noscript>
2053
-	<script type="application/json" class="wp-playlist-script"><?php echo wp_json_encode( $data ) ?></script>
2053
+	<script type="application/json" class="wp-playlist-script"><?php echo wp_json_encode($data) ?></script>
2054 2054
 </div>
2055 2055
 	<?php
2056 2056
 	return ob_get_clean();
2057 2057
 }
2058
-add_shortcode( 'playlist', 'wp_playlist_shortcode' );
2058
+add_shortcode('playlist', 'wp_playlist_shortcode');
2059 2059
 
2060 2060
 /**
2061 2061
  * Provides a No-JS Flash fallback as a last resort for audio / video.
@@ -2065,7 +2065,7 @@  discard block
 block discarded – undo
2065 2065
  * @param string $url The media element URL.
2066 2066
  * @return string Fallback HTML.
2067 2067
  */
2068
-function wp_mediaelement_fallback( $url ) {
2068
+function wp_mediaelement_fallback($url) {
2069 2069
 	/**
2070 2070
 	 * Filter the Mediaelement fallback output for no-JS.
2071 2071
 	 *
@@ -2074,7 +2074,7 @@  discard block
 block discarded – undo
2074 2074
 	 * @param string $output Fallback output for no-JS.
2075 2075
 	 * @param string $url    Media file URL.
2076 2076
 	 */
2077
-	return apply_filters( 'wp_mediaelement_fallback', sprintf( '<a href="%1$s">%1$s</a>', esc_url( $url ) ), $url );
2077
+	return apply_filters('wp_mediaelement_fallback', sprintf('<a href="%1$s">%1$s</a>', esc_url($url)), $url);
2078 2078
 }
2079 2079
 
2080 2080
 /**
@@ -2093,7 +2093,7 @@  discard block
 block discarded – undo
2093 2093
 	 * @param array $extensions An array of support audio formats. Defaults are
2094 2094
 	 *                          'mp3', 'ogg', 'wma', 'm4a', 'wav'.
2095 2095
 	 */
2096
-	return apply_filters( 'wp_audio_extensions', array( 'mp3', 'ogg', 'wma', 'm4a', 'wav' ) );
2096
+	return apply_filters('wp_audio_extensions', array('mp3', 'ogg', 'wma', 'm4a', 'wav'));
2097 2097
 }
2098 2098
 
2099 2099
 /**
@@ -2105,19 +2105,19 @@  discard block
 block discarded – undo
2105 2105
  * @param string  $context    Optional. The context. Accepts 'edit', 'display'. Default 'display'.
2106 2106
  * @return array Key/value pairs of field keys to labels.
2107 2107
  */
2108
-function wp_get_attachment_id3_keys( $attachment, $context = 'display' ) {
2108
+function wp_get_attachment_id3_keys($attachment, $context = 'display') {
2109 2109
 	$fields = array(
2110
-		'artist' => __( 'Artist' ),
2111
-		'album' => __( 'Album' ),
2110
+		'artist' => __('Artist'),
2111
+		'album' => __('Album'),
2112 2112
 	);
2113 2113
 
2114
-	if ( 'display' === $context ) {
2115
-		$fields['genre']            = __( 'Genre' );
2116
-		$fields['year']             = __( 'Year' );
2117
-		$fields['length_formatted'] = _x( 'Length', 'video or audio' );
2118
-	} elseif ( 'js' === $context ) {
2119
-		$fields['bitrate']          = __( 'Bitrate' );
2120
-		$fields['bitrate_mode']     = __( 'Bitrate Mode' );
2114
+	if ('display' === $context) {
2115
+		$fields['genre']            = __('Genre');
2116
+		$fields['year']             = __('Year');
2117
+		$fields['length_formatted'] = _x('Length', 'video or audio');
2118
+	} elseif ('js' === $context) {
2119
+		$fields['bitrate']          = __('Bitrate');
2120
+		$fields['bitrate_mode']     = __('Bitrate Mode');
2121 2121
 	}
2122 2122
 
2123 2123
 	/**
@@ -2129,7 +2129,7 @@  discard block
 block discarded – undo
2129 2129
 	 * @param WP_Post $attachment Attachment object.
2130 2130
 	 * @param string  $context    The context. Accepts 'edit', 'display'. Default 'display'.
2131 2131
 	 */
2132
-	return apply_filters( 'wp_get_attachment_id3_keys', $fields, $attachment, $context );
2132
+	return apply_filters('wp_get_attachment_id3_keys', $fields, $attachment, $context);
2133 2133
 }
2134 2134
 /**
2135 2135
  * Builds the Audio shortcode output.
@@ -2154,7 +2154,7 @@  discard block
 block discarded – undo
2154 2154
  * @param string $content Shortcode content.
2155 2155
  * @return string|void HTML content to display audio.
2156 2156
  */
2157
-function wp_audio_shortcode( $attr, $content = '' ) {
2157
+function wp_audio_shortcode($attr, $content = '') {
2158 2158
 	$post_id = get_post() ? get_the_ID() : 0;
2159 2159
 
2160 2160
 	static $instance = 0;
@@ -2172,8 +2172,8 @@  discard block
 block discarded – undo
2172 2172
 	 * @param string $content  Shortcode content.
2173 2173
 	 * @param int    $instance Unique numeric ID of this audio shortcode instance.
2174 2174
 	 */
2175
-	$override = apply_filters( 'wp_audio_shortcode_override', '', $attr, $content, $instance );
2176
-	if ( '' !== $override ) {
2175
+	$override = apply_filters('wp_audio_shortcode_override', '', $attr, $content, $instance);
2176
+	if ('' !== $override) {
2177 2177
 		return $override;
2178 2178
 	}
2179 2179
 
@@ -2188,44 +2188,44 @@  discard block
 block discarded – undo
2188 2188
 		'class'    => 'wp-audio-shortcode',
2189 2189
 		'style'    => 'width: 100%; visibility: hidden;'
2190 2190
 	);
2191
-	foreach ( $default_types as $type ) {
2191
+	foreach ($default_types as $type) {
2192 2192
 		$defaults_atts[$type] = '';
2193 2193
 	}
2194 2194
 
2195
-	$atts = shortcode_atts( $defaults_atts, $attr, 'audio' );
2195
+	$atts = shortcode_atts($defaults_atts, $attr, 'audio');
2196 2196
 
2197 2197
 	$primary = false;
2198
-	if ( ! empty( $atts['src'] ) ) {
2199
-		$type = wp_check_filetype( $atts['src'], wp_get_mime_types() );
2200
-		if ( ! in_array( strtolower( $type['ext'] ), $default_types ) ) {
2201
-			return sprintf( '<a class="wp-embedded-audio" href="%s">%s</a>', esc_url( $atts['src'] ), esc_html( $atts['src'] ) );
2198
+	if ( ! empty($atts['src'])) {
2199
+		$type = wp_check_filetype($atts['src'], wp_get_mime_types());
2200
+		if ( ! in_array(strtolower($type['ext']), $default_types)) {
2201
+			return sprintf('<a class="wp-embedded-audio" href="%s">%s</a>', esc_url($atts['src']), esc_html($atts['src']));
2202 2202
 		}
2203 2203
 		$primary = true;
2204
-		array_unshift( $default_types, 'src' );
2204
+		array_unshift($default_types, 'src');
2205 2205
 	} else {
2206
-		foreach ( $default_types as $ext ) {
2207
-			if ( ! empty( $atts[ $ext ] ) ) {
2208
-				$type = wp_check_filetype( $atts[ $ext ], wp_get_mime_types() );
2209
-				if ( strtolower( $type['ext'] ) === $ext ) {
2206
+		foreach ($default_types as $ext) {
2207
+			if ( ! empty($atts[$ext])) {
2208
+				$type = wp_check_filetype($atts[$ext], wp_get_mime_types());
2209
+				if (strtolower($type['ext']) === $ext) {
2210 2210
 					$primary = true;
2211 2211
 				}
2212 2212
 			}
2213 2213
 		}
2214 2214
 	}
2215 2215
 
2216
-	if ( ! $primary ) {
2217
-		$audios = get_attached_media( 'audio', $post_id );
2218
-		if ( empty( $audios ) ) {
2216
+	if ( ! $primary) {
2217
+		$audios = get_attached_media('audio', $post_id);
2218
+		if (empty($audios)) {
2219 2219
 			return;
2220 2220
 		}
2221 2221
 
2222
-		$audio = reset( $audios );
2223
-		$atts['src'] = wp_get_attachment_url( $audio->ID );
2224
-		if ( empty( $atts['src'] ) ) {
2222
+		$audio = reset($audios);
2223
+		$atts['src'] = wp_get_attachment_url($audio->ID);
2224
+		if (empty($atts['src'])) {
2225 2225
 			return;
2226 2226
 		}
2227 2227
 
2228
-		array_unshift( $default_types, 'src' );
2228
+		array_unshift($default_types, 'src');
2229 2229
 	}
2230 2230
 
2231 2231
 	/**
@@ -2235,10 +2235,10 @@  discard block
 block discarded – undo
2235 2235
 	 *
2236 2236
 	 * @param string $library Media library used for the audio shortcode.
2237 2237
 	 */
2238
-	$library = apply_filters( 'wp_audio_shortcode_library', 'mediaelement' );
2239
-	if ( 'mediaelement' === $library && did_action( 'init' ) ) {
2240
-		wp_enqueue_style( 'wp-mediaelement' );
2241
-		wp_enqueue_script( 'wp-mediaelement' );
2238
+	$library = apply_filters('wp_audio_shortcode_library', 'mediaelement');
2239
+	if ('mediaelement' === $library && did_action('init')) {
2240
+		wp_enqueue_style('wp-mediaelement');
2241
+		wp_enqueue_script('wp-mediaelement');
2242 2242
 	}
2243 2243
 
2244 2244
 	/**
@@ -2248,50 +2248,50 @@  discard block
 block discarded – undo
2248 2248
 	 *
2249 2249
 	 * @param string $class CSS class or list of space-separated classes.
2250 2250
 	 */
2251
-	$atts['class'] = apply_filters( 'wp_audio_shortcode_class', $atts['class'] );
2251
+	$atts['class'] = apply_filters('wp_audio_shortcode_class', $atts['class']);
2252 2252
 
2253 2253
 	$html_atts = array(
2254 2254
 		'class'    => $atts['class'],
2255
-		'id'       => sprintf( 'audio-%d-%d', $post_id, $instance ),
2256
-		'loop'     => wp_validate_boolean( $atts['loop'] ),
2257
-		'autoplay' => wp_validate_boolean( $atts['autoplay'] ),
2255
+		'id'       => sprintf('audio-%d-%d', $post_id, $instance),
2256
+		'loop'     => wp_validate_boolean($atts['loop']),
2257
+		'autoplay' => wp_validate_boolean($atts['autoplay']),
2258 2258
 		'preload'  => $atts['preload'],
2259 2259
 		'style'    => $atts['style'],
2260 2260
 	);
2261 2261
 
2262 2262
 	// These ones should just be omitted altogether if they are blank
2263
-	foreach ( array( 'loop', 'autoplay', 'preload' ) as $a ) {
2264
-		if ( empty( $html_atts[$a] ) ) {
2265
-			unset( $html_atts[$a] );
2263
+	foreach (array('loop', 'autoplay', 'preload') as $a) {
2264
+		if (empty($html_atts[$a])) {
2265
+			unset($html_atts[$a]);
2266 2266
 		}
2267 2267
 	}
2268 2268
 
2269 2269
 	$attr_strings = array();
2270
-	foreach ( $html_atts as $k => $v ) {
2271
-		$attr_strings[] = $k . '="' . esc_attr( $v ) . '"';
2270
+	foreach ($html_atts as $k => $v) {
2271
+		$attr_strings[] = $k.'="'.esc_attr($v).'"';
2272 2272
 	}
2273 2273
 
2274 2274
 	$html = '';
2275
-	if ( 'mediaelement' === $library && 1 === $instance ) {
2275
+	if ('mediaelement' === $library && 1 === $instance) {
2276 2276
 		$html .= "<!--[if lt IE 9]><script>document.createElement('audio');</script><![endif]-->\n";
2277 2277
 	}
2278
-	$html .= sprintf( '<audio %s controls="controls">', join( ' ', $attr_strings ) );
2278
+	$html .= sprintf('<audio %s controls="controls">', join(' ', $attr_strings));
2279 2279
 
2280 2280
 	$fileurl = '';
2281 2281
 	$source = '<source type="%s" src="%s" />';
2282
-	foreach ( $default_types as $fallback ) {
2283
-		if ( ! empty( $atts[ $fallback ] ) ) {
2284
-			if ( empty( $fileurl ) ) {
2285
-				$fileurl = $atts[ $fallback ];
2282
+	foreach ($default_types as $fallback) {
2283
+		if ( ! empty($atts[$fallback])) {
2284
+			if (empty($fileurl)) {
2285
+				$fileurl = $atts[$fallback];
2286 2286
 			}
2287
-			$type = wp_check_filetype( $atts[ $fallback ], wp_get_mime_types() );
2288
-			$url = add_query_arg( '_', $instance, $atts[ $fallback ] );
2289
-			$html .= sprintf( $source, $type['type'], esc_url( $url ) );
2287
+			$type = wp_check_filetype($atts[$fallback], wp_get_mime_types());
2288
+			$url = add_query_arg('_', $instance, $atts[$fallback]);
2289
+			$html .= sprintf($source, $type['type'], esc_url($url));
2290 2290
 		}
2291 2291
 	}
2292 2292
 
2293
-	if ( 'mediaelement' === $library ) {
2294
-		$html .= wp_mediaelement_fallback( $fileurl );
2293
+	if ('mediaelement' === $library) {
2294
+		$html .= wp_mediaelement_fallback($fileurl);
2295 2295
 	}
2296 2296
 	$html .= '</audio>';
2297 2297
 
@@ -2306,9 +2306,9 @@  discard block
 block discarded – undo
2306 2306
 	 * @param int    $post_id Post ID.
2307 2307
 	 * @param string $library Media library used for the audio shortcode.
2308 2308
 	 */
2309
-	return apply_filters( 'wp_audio_shortcode', $html, $atts, $audio, $post_id, $library );
2309
+	return apply_filters('wp_audio_shortcode', $html, $atts, $audio, $post_id, $library);
2310 2310
 }
2311
-add_shortcode( 'audio', 'wp_audio_shortcode' );
2311
+add_shortcode('audio', 'wp_audio_shortcode');
2312 2312
 
2313 2313
 /**
2314 2314
  * Returns a filtered list of WP-supported video formats.
@@ -2326,7 +2326,7 @@  discard block
 block discarded – undo
2326 2326
 	 * @param array $extensions An array of support video formats. Defaults are
2327 2327
 	 *                          'mp4', 'm4v', 'webm', 'ogv', 'wmv', 'flv'.
2328 2328
 	 */
2329
-	return apply_filters( 'wp_video_extensions', array( 'mp4', 'm4v', 'webm', 'ogv', 'wmv', 'flv' ) );
2329
+	return apply_filters('wp_video_extensions', array('mp4', 'm4v', 'webm', 'ogv', 'wmv', 'flv'));
2330 2330
 }
2331 2331
 
2332 2332
 /**
@@ -2357,7 +2357,7 @@  discard block
 block discarded – undo
2357 2357
  * @param string $content Shortcode content.
2358 2358
  * @return string|void HTML content to display video.
2359 2359
  */
2360
-function wp_video_shortcode( $attr, $content = '' ) {
2360
+function wp_video_shortcode($attr, $content = '') {
2361 2361
 	global $content_width;
2362 2362
 	$post_id = get_post() ? get_the_ID() : 0;
2363 2363
 
@@ -2379,8 +2379,8 @@  discard block
 block discarded – undo
2379 2379
 	 * @param string $content  Video shortcode content.
2380 2380
 	 * @param int    $instance Unique numeric ID of this video shortcode instance.
2381 2381
 	 */
2382
-	$override = apply_filters( 'wp_video_shortcode_override', '', $attr, $content, $instance );
2383
-	if ( '' !== $override ) {
2382
+	$override = apply_filters('wp_video_shortcode_override', '', $attr, $content, $instance);
2383
+	if ('' !== $override) {
2384 2384
 		return $override;
2385 2385
 	}
2386 2386
 
@@ -2398,22 +2398,22 @@  discard block
 block discarded – undo
2398 2398
 		'class'    => 'wp-video-shortcode',
2399 2399
 	);
2400 2400
 
2401
-	foreach ( $default_types as $type ) {
2401
+	foreach ($default_types as $type) {
2402 2402
 		$defaults_atts[$type] = '';
2403 2403
 	}
2404 2404
 
2405
-	$atts = shortcode_atts( $defaults_atts, $attr, 'video' );
2405
+	$atts = shortcode_atts($defaults_atts, $attr, 'video');
2406 2406
 
2407
-	if ( is_admin() ) {
2407
+	if (is_admin()) {
2408 2408
 		// shrink the video so it isn't huge in the admin
2409
-		if ( $atts['width'] > $defaults_atts['width'] ) {
2410
-			$atts['height'] = round( ( $atts['height'] * $defaults_atts['width'] ) / $atts['width'] );
2409
+		if ($atts['width'] > $defaults_atts['width']) {
2410
+			$atts['height'] = round(($atts['height'] * $defaults_atts['width']) / $atts['width']);
2411 2411
 			$atts['width'] = $defaults_atts['width'];
2412 2412
 		}
2413 2413
 	} else {
2414 2414
 		// if the video is bigger than the theme
2415
-		if ( ! empty( $content_width ) && $atts['width'] > $content_width ) {
2416
-			$atts['height'] = round( ( $atts['height'] * $content_width ) / $atts['width'] );
2415
+		if ( ! empty($content_width) && $atts['width'] > $content_width) {
2416
+			$atts['height'] = round(($atts['height'] * $content_width) / $atts['width']);
2417 2417
 			$atts['width'] = $content_width;
2418 2418
 		}
2419 2419
 	}
@@ -2423,46 +2423,46 @@  discard block
 block discarded – undo
2423 2423
 	$vimeo_pattern = '#^https?://(.+\.)?vimeo\.com/.*#';
2424 2424
 
2425 2425
 	$primary = false;
2426
-	if ( ! empty( $atts['src'] ) ) {
2427
-		$is_vimeo = ( preg_match( $vimeo_pattern, $atts['src'] ) );
2428
-		$is_youtube = (  preg_match( $yt_pattern, $atts['src'] ) );
2429
-		if ( ! $is_youtube && ! $is_vimeo ) {
2430
-			$type = wp_check_filetype( $atts['src'], wp_get_mime_types() );
2431
-			if ( ! in_array( strtolower( $type['ext'] ), $default_types ) ) {
2432
-				return sprintf( '<a class="wp-embedded-video" href="%s">%s</a>', esc_url( $atts['src'] ), esc_html( $atts['src'] ) );
2426
+	if ( ! empty($atts['src'])) {
2427
+		$is_vimeo = (preg_match($vimeo_pattern, $atts['src']));
2428
+		$is_youtube = (preg_match($yt_pattern, $atts['src']));
2429
+		if ( ! $is_youtube && ! $is_vimeo) {
2430
+			$type = wp_check_filetype($atts['src'], wp_get_mime_types());
2431
+			if ( ! in_array(strtolower($type['ext']), $default_types)) {
2432
+				return sprintf('<a class="wp-embedded-video" href="%s">%s</a>', esc_url($atts['src']), esc_html($atts['src']));
2433 2433
 			}
2434 2434
 		}
2435 2435
 
2436
-		if ( $is_vimeo ) {
2437
-			wp_enqueue_script( 'froogaloop' );
2436
+		if ($is_vimeo) {
2437
+			wp_enqueue_script('froogaloop');
2438 2438
 		}
2439 2439
 
2440 2440
 		$primary = true;
2441
-		array_unshift( $default_types, 'src' );
2441
+		array_unshift($default_types, 'src');
2442 2442
 	} else {
2443
-		foreach ( $default_types as $ext ) {
2444
-			if ( ! empty( $atts[ $ext ] ) ) {
2445
-				$type = wp_check_filetype( $atts[ $ext ], wp_get_mime_types() );
2446
-				if ( strtolower( $type['ext'] ) === $ext ) {
2443
+		foreach ($default_types as $ext) {
2444
+			if ( ! empty($atts[$ext])) {
2445
+				$type = wp_check_filetype($atts[$ext], wp_get_mime_types());
2446
+				if (strtolower($type['ext']) === $ext) {
2447 2447
 					$primary = true;
2448 2448
 				}
2449 2449
 			}
2450 2450
 		}
2451 2451
 	}
2452 2452
 
2453
-	if ( ! $primary ) {
2454
-		$videos = get_attached_media( 'video', $post_id );
2455
-		if ( empty( $videos ) ) {
2453
+	if ( ! $primary) {
2454
+		$videos = get_attached_media('video', $post_id);
2455
+		if (empty($videos)) {
2456 2456
 			return;
2457 2457
 		}
2458 2458
 
2459
-		$video = reset( $videos );
2460
-		$atts['src'] = wp_get_attachment_url( $video->ID );
2461
-		if ( empty( $atts['src'] ) ) {
2459
+		$video = reset($videos);
2460
+		$atts['src'] = wp_get_attachment_url($video->ID);
2461
+		if (empty($atts['src'])) {
2462 2462
 			return;
2463 2463
 		}
2464 2464
 
2465
-		array_unshift( $default_types, 'src' );
2465
+		array_unshift($default_types, 'src');
2466 2466
 	}
2467 2467
 
2468 2468
 	/**
@@ -2472,10 +2472,10 @@  discard block
 block discarded – undo
2472 2472
 	 *
2473 2473
 	 * @param string $library Media library used for the video shortcode.
2474 2474
 	 */
2475
-	$library = apply_filters( 'wp_video_shortcode_library', 'mediaelement' );
2476
-	if ( 'mediaelement' === $library && did_action( 'init' ) ) {
2477
-		wp_enqueue_style( 'wp-mediaelement' );
2478
-		wp_enqueue_script( 'wp-mediaelement' );
2475
+	$library = apply_filters('wp_video_shortcode_library', 'mediaelement');
2476
+	if ('mediaelement' === $library && did_action('init')) {
2477
+		wp_enqueue_style('wp-mediaelement');
2478
+		wp_enqueue_script('wp-mediaelement');
2479 2479
 	}
2480 2480
 
2481 2481
 	/**
@@ -2485,73 +2485,73 @@  discard block
 block discarded – undo
2485 2485
 	 *
2486 2486
 	 * @param string $class CSS class or list of space-separated classes.
2487 2487
 	 */
2488
-	$atts['class'] = apply_filters( 'wp_video_shortcode_class', $atts['class'] );
2488
+	$atts['class'] = apply_filters('wp_video_shortcode_class', $atts['class']);
2489 2489
 
2490 2490
 	$html_atts = array(
2491 2491
 		'class'    => $atts['class'],
2492
-		'id'       => sprintf( 'video-%d-%d', $post_id, $instance ),
2493
-		'width'    => absint( $atts['width'] ),
2494
-		'height'   => absint( $atts['height'] ),
2495
-		'poster'   => esc_url( $atts['poster'] ),
2496
-		'loop'     => wp_validate_boolean( $atts['loop'] ),
2497
-		'autoplay' => wp_validate_boolean( $atts['autoplay'] ),
2492
+		'id'       => sprintf('video-%d-%d', $post_id, $instance),
2493
+		'width'    => absint($atts['width']),
2494
+		'height'   => absint($atts['height']),
2495
+		'poster'   => esc_url($atts['poster']),
2496
+		'loop'     => wp_validate_boolean($atts['loop']),
2497
+		'autoplay' => wp_validate_boolean($atts['autoplay']),
2498 2498
 		'preload'  => $atts['preload'],
2499 2499
 	);
2500 2500
 
2501 2501
 	// These ones should just be omitted altogether if they are blank
2502
-	foreach ( array( 'poster', 'loop', 'autoplay', 'preload' ) as $a ) {
2503
-		if ( empty( $html_atts[$a] ) ) {
2504
-			unset( $html_atts[$a] );
2502
+	foreach (array('poster', 'loop', 'autoplay', 'preload') as $a) {
2503
+		if (empty($html_atts[$a])) {
2504
+			unset($html_atts[$a]);
2505 2505
 		}
2506 2506
 	}
2507 2507
 
2508 2508
 	$attr_strings = array();
2509
-	foreach ( $html_atts as $k => $v ) {
2510
-		$attr_strings[] = $k . '="' . esc_attr( $v ) . '"';
2509
+	foreach ($html_atts as $k => $v) {
2510
+		$attr_strings[] = $k.'="'.esc_attr($v).'"';
2511 2511
 	}
2512 2512
 
2513 2513
 	$html = '';
2514
-	if ( 'mediaelement' === $library && 1 === $instance ) {
2514
+	if ('mediaelement' === $library && 1 === $instance) {
2515 2515
 		$html .= "<!--[if lt IE 9]><script>document.createElement('video');</script><![endif]-->\n";
2516 2516
 	}
2517
-	$html .= sprintf( '<video %s controls="controls">', join( ' ', $attr_strings ) );
2517
+	$html .= sprintf('<video %s controls="controls">', join(' ', $attr_strings));
2518 2518
 
2519 2519
 	$fileurl = '';
2520 2520
 	$source = '<source type="%s" src="%s" />';
2521
-	foreach ( $default_types as $fallback ) {
2522
-		if ( ! empty( $atts[ $fallback ] ) ) {
2523
-			if ( empty( $fileurl ) ) {
2524
-				$fileurl = $atts[ $fallback ];
2521
+	foreach ($default_types as $fallback) {
2522
+		if ( ! empty($atts[$fallback])) {
2523
+			if (empty($fileurl)) {
2524
+				$fileurl = $atts[$fallback];
2525 2525
 			}
2526
-			if ( 'src' === $fallback && $is_youtube ) {
2527
-				$type = array( 'type' => 'video/youtube' );
2528
-			} elseif ( 'src' === $fallback && $is_vimeo ) {
2529
-				$type = array( 'type' => 'video/vimeo' );
2526
+			if ('src' === $fallback && $is_youtube) {
2527
+				$type = array('type' => 'video/youtube');
2528
+			} elseif ('src' === $fallback && $is_vimeo) {
2529
+				$type = array('type' => 'video/vimeo');
2530 2530
 			} else {
2531
-				$type = wp_check_filetype( $atts[ $fallback ], wp_get_mime_types() );
2531
+				$type = wp_check_filetype($atts[$fallback], wp_get_mime_types());
2532 2532
 			}
2533
-			$url = add_query_arg( '_', $instance, $atts[ $fallback ] );
2534
-			$html .= sprintf( $source, $type['type'], esc_url( $url ) );
2533
+			$url = add_query_arg('_', $instance, $atts[$fallback]);
2534
+			$html .= sprintf($source, $type['type'], esc_url($url));
2535 2535
 		}
2536 2536
 	}
2537 2537
 
2538
-	if ( ! empty( $content ) ) {
2539
-		if ( false !== strpos( $content, "\n" ) ) {
2540
-			$content = str_replace( array( "\r\n", "\n", "\t" ), '', $content );
2538
+	if ( ! empty($content)) {
2539
+		if (false !== strpos($content, "\n")) {
2540
+			$content = str_replace(array("\r\n", "\n", "\t"), '', $content);
2541 2541
 		}
2542
-		$html .= trim( $content );
2542
+		$html .= trim($content);
2543 2543
 	}
2544 2544
 
2545
-	if ( 'mediaelement' === $library ) {
2546
-		$html .= wp_mediaelement_fallback( $fileurl );
2545
+	if ('mediaelement' === $library) {
2546
+		$html .= wp_mediaelement_fallback($fileurl);
2547 2547
 	}
2548 2548
 	$html .= '</video>';
2549 2549
 
2550 2550
 	$width_rule = '';
2551
-	if ( ! empty( $atts['width'] ) ) {
2552
-		$width_rule = sprintf( 'width: %dpx; ', $atts['width'] );
2551
+	if ( ! empty($atts['width'])) {
2552
+		$width_rule = sprintf('width: %dpx; ', $atts['width']);
2553 2553
 	}
2554
-	$output = sprintf( '<div style="%s" class="wp-video">%s</div>', $width_rule, $html );
2554
+	$output = sprintf('<div style="%s" class="wp-video">%s</div>', $width_rule, $html);
2555 2555
 
2556 2556
 	/**
2557 2557
 	 * Filter the output of the video shortcode.
@@ -2564,9 +2564,9 @@  discard block
 block discarded – undo
2564 2564
 	 * @param int    $post_id Post ID.
2565 2565
 	 * @param string $library Media library used for the video shortcode.
2566 2566
 	 */
2567
-	return apply_filters( 'wp_video_shortcode', $output, $atts, $video, $post_id, $library );
2567
+	return apply_filters('wp_video_shortcode', $output, $atts, $video, $post_id, $library);
2568 2568
 }
2569
-add_shortcode( 'video', 'wp_video_shortcode' );
2569
+add_shortcode('video', 'wp_video_shortcode');
2570 2570
 
2571 2571
 /**
2572 2572
  * Displays previous image link that has the same post parent.
@@ -2580,7 +2580,7 @@  discard block
 block discarded – undo
2580 2580
  *                           default to 'post_title' or `$text`. Default 'thumbnail'.
2581 2581
  * @param string       $text Optional. Link text. Default false.
2582 2582
  */
2583
-function previous_image_link( $size = 'thumbnail', $text = false ) {
2583
+function previous_image_link($size = 'thumbnail', $text = false) {
2584 2584
 	adjacent_image_link(true, $size, $text);
2585 2585
 }
2586 2586
 
@@ -2596,7 +2596,7 @@  discard block
 block discarded – undo
2596 2596
  *                           default to 'post_title' or `$text`. Default 'thumbnail'.
2597 2597
  * @param string       $text Optional. Link text. Default false.
2598 2598
  */
2599
-function next_image_link( $size = 'thumbnail', $text = false ) {
2599
+function next_image_link($size = 'thumbnail', $text = false) {
2600 2600
 	adjacent_image_link(false, $size, $text);
2601 2601
 }
2602 2602
 
@@ -2612,12 +2612,12 @@  discard block
 block discarded – undo
2612 2612
  *                           values in pixels (in that order). Default 'thumbnail'.
2613 2613
  * @param bool         $text Optional. Link text. Default false.
2614 2614
  */
2615
-function adjacent_image_link( $prev = true, $size = 'thumbnail', $text = false ) {
2615
+function adjacent_image_link($prev = true, $size = 'thumbnail', $text = false) {
2616 2616
 	$post = get_post();
2617
-	$attachments = array_values( get_children( array( 'post_parent' => $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID' ) ) );
2617
+	$attachments = array_values(get_children(array('post_parent' => $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID')));
2618 2618
 
2619
-	foreach ( $attachments as $k => $attachment ) {
2620
-		if ( $attachment->ID == $post->ID ) {
2619
+	foreach ($attachments as $k => $attachment) {
2620
+		if ($attachment->ID == $post->ID) {
2621 2621
 			break;
2622 2622
 		}
2623 2623
 	}
@@ -2625,12 +2625,12 @@  discard block
 block discarded – undo
2625 2625
 	$output = '';
2626 2626
 	$attachment_id = 0;
2627 2627
 
2628
-	if ( $attachments ) {
2628
+	if ($attachments) {
2629 2629
 		$k = $prev ? $k - 1 : $k + 1;
2630 2630
 
2631
-		if ( isset( $attachments[ $k ] ) ) {
2632
-			$attachment_id = $attachments[ $k ]->ID;
2633
-			$output = wp_get_attachment_link( $attachment_id, $size, true, false, $text );
2631
+		if (isset($attachments[$k])) {
2632
+			$attachment_id = $attachments[$k]->ID;
2633
+			$output = wp_get_attachment_link($attachment_id, $size, true, false, $text);
2634 2634
 		}
2635 2635
 	}
2636 2636
 
@@ -2649,7 +2649,7 @@  discard block
 block discarded – undo
2649 2649
 	 * @param string $size          Image size.
2650 2650
 	 * @param string $text          Link text.
2651 2651
 	 */
2652
-	echo apply_filters( "{$adjacent}_image_link", $output, $attachment_id, $size, $text );
2652
+	echo apply_filters("{$adjacent}_image_link", $output, $attachment_id, $size, $text);
2653 2653
 }
2654 2654
 
2655 2655
 /**
@@ -2660,33 +2660,33 @@  discard block
 block discarded – undo
2660 2660
  * @param int|array|object $attachment Attachment ID, data array, or data object.
2661 2661
  * @return array Empty array on failure. List of taxonomies on success.
2662 2662
  */
2663
-function get_attachment_taxonomies( $attachment ) {
2664
-	if ( is_int( $attachment ) ) {
2665
-		$attachment = get_post( $attachment );
2666
-	} elseif ( is_array( $attachment ) ) {
2663
+function get_attachment_taxonomies($attachment) {
2664
+	if (is_int($attachment)) {
2665
+		$attachment = get_post($attachment);
2666
+	} elseif (is_array($attachment)) {
2667 2667
 		$attachment = (object) $attachment;
2668 2668
 	}
2669
-	if ( ! is_object($attachment) )
2669
+	if ( ! is_object($attachment))
2670 2670
 		return array();
2671 2671
 
2672
-	$file = get_attached_file( $attachment->ID );
2673
-	$filename = basename( $file );
2672
+	$file = get_attached_file($attachment->ID);
2673
+	$filename = basename($file);
2674 2674
 
2675 2675
 	$objects = array('attachment');
2676 2676
 
2677
-	if ( false !== strpos($filename, '.') )
2678
-		$objects[] = 'attachment:' . substr($filename, strrpos($filename, '.') + 1);
2679
-	if ( !empty($attachment->post_mime_type) ) {
2680
-		$objects[] = 'attachment:' . $attachment->post_mime_type;
2681
-		if ( false !== strpos($attachment->post_mime_type, '/') )
2682
-			foreach ( explode('/', $attachment->post_mime_type) as $token )
2683
-				if ( !empty($token) )
2677
+	if (false !== strpos($filename, '.'))
2678
+		$objects[] = 'attachment:'.substr($filename, strrpos($filename, '.') + 1);
2679
+	if ( ! empty($attachment->post_mime_type)) {
2680
+		$objects[] = 'attachment:'.$attachment->post_mime_type;
2681
+		if (false !== strpos($attachment->post_mime_type, '/'))
2682
+			foreach (explode('/', $attachment->post_mime_type) as $token)
2683
+				if ( ! empty($token))
2684 2684
 					$objects[] = "attachment:$token";
2685 2685
 	}
2686 2686
 
2687 2687
 	$taxonomies = array();
2688
-	foreach ( $objects as $object )
2689
-		if ( $taxes = get_object_taxonomies($object) )
2688
+	foreach ($objects as $object)
2689
+		if ($taxes = get_object_taxonomies($object))
2690 2690
 			$taxonomies = array_merge($taxonomies, $taxes);
2691 2691
 
2692 2692
 	return array_unique($taxonomies);
@@ -2705,15 +2705,15 @@  discard block
 block discarded – undo
2705 2705
  *                       Default 'names'.
2706 2706
  * @return array The names of all taxonomy of $object_type.
2707 2707
  */
2708
-function get_taxonomies_for_attachments( $output = 'names' ) {
2708
+function get_taxonomies_for_attachments($output = 'names') {
2709 2709
 	$taxonomies = array();
2710
-	foreach ( get_taxonomies( array(), 'objects' ) as $taxonomy ) {
2711
-		foreach ( $taxonomy->object_type as $object_type ) {
2712
-			if ( 'attachment' == $object_type || 0 === strpos( $object_type, 'attachment:' ) ) {
2713
-				if ( 'names' == $output )
2710
+	foreach (get_taxonomies(array(), 'objects') as $taxonomy) {
2711
+		foreach ($taxonomy->object_type as $object_type) {
2712
+			if ('attachment' == $object_type || 0 === strpos($object_type, 'attachment:')) {
2713
+				if ('names' == $output)
2714 2714
 					$taxonomies[] = $taxonomy->name;
2715 2715
 				else
2716
-					$taxonomies[ $taxonomy->name ] = $taxonomy;
2716
+					$taxonomies[$taxonomy->name] = $taxonomy;
2717 2717
 				break;
2718 2718
 			}
2719 2719
 		}
@@ -2735,7 +2735,7 @@  discard block
 block discarded – undo
2735 2735
  */
2736 2736
 function wp_imagecreatetruecolor($width, $height) {
2737 2737
 	$img = imagecreatetruecolor($width, $height);
2738
-	if ( is_resource($img) && function_exists('imagealphablending') && function_exists('imagesavealpha') ) {
2738
+	if (is_resource($img) && function_exists('imagealphablending') && function_exists('imagesavealpha')) {
2739 2739
 		imagealphablending($img, false);
2740 2740
 		imagesavealpha($img, true);
2741 2741
 	}
@@ -2755,13 +2755,13 @@  discard block
 block discarded – undo
2755 2755
  * @param int $max_height     The maximum allowed height.
2756 2756
  * @return array The maximum possible width and height based on the example ratio.
2757 2757
  */
2758
-function wp_expand_dimensions( $example_width, $example_height, $max_width, $max_height ) {
2758
+function wp_expand_dimensions($example_width, $example_height, $max_width, $max_height) {
2759 2759
 	$example_width  = (int) $example_width;
2760 2760
 	$example_height = (int) $example_height;
2761 2761
 	$max_width      = (int) $max_width;
2762 2762
 	$max_height     = (int) $max_height;
2763 2763
 
2764
-	return wp_constrain_dimensions( $example_width * 1000000, $example_height * 1000000, $max_width, $max_height );
2764
+	return wp_constrain_dimensions($example_width * 1000000, $example_height * 1000000, $max_width, $max_height);
2765 2765
 }
2766 2766
 
2767 2767
 /**
@@ -2772,15 +2772,15 @@  discard block
 block discarded – undo
2772 2772
  * @param string $size A shorthand byte value.
2773 2773
  * @return int An integer byte value.
2774 2774
  */
2775
-function wp_convert_hr_to_bytes( $size ) {
2776
-	$size  = strtolower( $size );
2775
+function wp_convert_hr_to_bytes($size) {
2776
+	$size  = strtolower($size);
2777 2777
 	$bytes = (int) $size;
2778
-	if ( strpos( $size, 'k' ) !== false )
2779
-		$bytes = intval( $size ) * KB_IN_BYTES;
2780
-	elseif ( strpos( $size, 'm' ) !== false )
2778
+	if (strpos($size, 'k') !== false)
2779
+		$bytes = intval($size) * KB_IN_BYTES;
2780
+	elseif (strpos($size, 'm') !== false)
2781 2781
 		$bytes = intval($size) * MB_IN_BYTES;
2782
-	elseif ( strpos( $size, 'g' ) !== false )
2783
-		$bytes = intval( $size ) * GB_IN_BYTES;
2782
+	elseif (strpos($size, 'g') !== false)
2783
+		$bytes = intval($size) * GB_IN_BYTES;
2784 2784
 	return $bytes;
2785 2785
 }
2786 2786
 
@@ -2792,8 +2792,8 @@  discard block
 block discarded – undo
2792 2792
  * @return int Allowed upload size.
2793 2793
  */
2794 2794
 function wp_max_upload_size() {
2795
-	$u_bytes = wp_convert_hr_to_bytes( ini_get( 'upload_max_filesize' ) );
2796
-	$p_bytes = wp_convert_hr_to_bytes( ini_get( 'post_max_size' ) );
2795
+	$u_bytes = wp_convert_hr_to_bytes(ini_get('upload_max_filesize'));
2796
+	$p_bytes = wp_convert_hr_to_bytes(ini_get('post_max_size'));
2797 2797
 
2798 2798
 	/**
2799 2799
 	 * Filter the maximum upload size allowed in php.ini.
@@ -2804,7 +2804,7 @@  discard block
 block discarded – undo
2804 2804
 	 * @param int $u_bytes Maximum upload filesize in bytes.
2805 2805
 	 * @param int $p_bytes Maximum size of POST data in bytes.
2806 2806
 	 */
2807
-	return apply_filters( 'upload_size_limit', min( $u_bytes, $p_bytes ), $u_bytes, $p_bytes );
2807
+	return apply_filters('upload_size_limit', min($u_bytes, $p_bytes), $u_bytes, $p_bytes);
2808 2808
 }
2809 2809
 
2810 2810
 /**
@@ -2818,31 +2818,31 @@  discard block
 block discarded – undo
2818 2818
  * @return WP_Image_Editor|WP_Error The WP_Image_Editor object if successful, an WP_Error
2819 2819
  *                                  object otherwise.
2820 2820
  */
2821
-function wp_get_image_editor( $path, $args = array() ) {
2821
+function wp_get_image_editor($path, $args = array()) {
2822 2822
 	$args['path'] = $path;
2823 2823
 
2824
-	if ( ! isset( $args['mime_type'] ) ) {
2825
-		$file_info = wp_check_filetype( $args['path'] );
2824
+	if ( ! isset($args['mime_type'])) {
2825
+		$file_info = wp_check_filetype($args['path']);
2826 2826
 
2827 2827
 		// If $file_info['type'] is false, then we let the editor attempt to
2828 2828
 		// figure out the file type, rather than forcing a failure based on extension.
2829
-		if ( isset( $file_info ) && $file_info['type'] )
2829
+		if (isset($file_info) && $file_info['type'])
2830 2830
 			$args['mime_type'] = $file_info['type'];
2831 2831
 	}
2832 2832
 
2833
-	$implementation = _wp_image_editor_choose( $args );
2833
+	$implementation = _wp_image_editor_choose($args);
2834 2834
 
2835
-	if ( $implementation ) {
2836
-		$editor = new $implementation( $path );
2835
+	if ($implementation) {
2836
+		$editor = new $implementation($path);
2837 2837
 		$loaded = $editor->load();
2838 2838
 
2839
-		if ( is_wp_error( $loaded ) )
2839
+		if (is_wp_error($loaded))
2840 2840
 			return $loaded;
2841 2841
 
2842 2842
 		return $editor;
2843 2843
 	}
2844 2844
 
2845
-	return new WP_Error( 'image_no_editor', __('No editor could be selected.') );
2845
+	return new WP_Error('image_no_editor', __('No editor could be selected.'));
2846 2846
 }
2847 2847
 
2848 2848
 /**
@@ -2854,8 +2854,8 @@  discard block
 block discarded – undo
2854 2854
  *                           Default empty array.
2855 2855
  * @return bool True if an eligible editor is found; false otherwise.
2856 2856
  */
2857
-function wp_image_editor_supports( $args = array() ) {
2858
-	return (bool) _wp_image_editor_choose( $args );
2857
+function wp_image_editor_supports($args = array()) {
2858
+	return (bool) _wp_image_editor_choose($args);
2859 2859
 }
2860 2860
 
2861 2861
 /**
@@ -2868,10 +2868,10 @@  discard block
 block discarded – undo
2868 2868
  * @return string|false Class name for the first editor that claims to support the request. False if no
2869 2869
  *                     editor claims to support the request.
2870 2870
  */
2871
-function _wp_image_editor_choose( $args = array() ) {
2872
-	require_once ABSPATH . WPINC . '/class-wp-image-editor.php';
2873
-	require_once ABSPATH . WPINC . '/class-wp-image-editor-gd.php';
2874
-	require_once ABSPATH . WPINC . '/class-wp-image-editor-imagick.php';
2871
+function _wp_image_editor_choose($args = array()) {
2872
+	require_once ABSPATH.WPINC.'/class-wp-image-editor.php';
2873
+	require_once ABSPATH.WPINC.'/class-wp-image-editor-gd.php';
2874
+	require_once ABSPATH.WPINC.'/class-wp-image-editor-imagick.php';
2875 2875
 
2876 2876
 	/**
2877 2877
 	 * Filter the list of image editing library classes.
@@ -2881,21 +2881,21 @@  discard block
 block discarded – undo
2881 2881
 	 * @param array $image_editors List of available image editors. Defaults are
2882 2882
 	 *                             'WP_Image_Editor_Imagick', 'WP_Image_Editor_GD'.
2883 2883
 	 */
2884
-	$implementations = apply_filters( 'wp_image_editors', array( 'WP_Image_Editor_Imagick', 'WP_Image_Editor_GD' ) );
2884
+	$implementations = apply_filters('wp_image_editors', array('WP_Image_Editor_Imagick', 'WP_Image_Editor_GD'));
2885 2885
 
2886
-	foreach ( $implementations as $implementation ) {
2887
-		if ( ! call_user_func( array( $implementation, 'test' ), $args ) )
2886
+	foreach ($implementations as $implementation) {
2887
+		if ( ! call_user_func(array($implementation, 'test'), $args))
2888 2888
 			continue;
2889 2889
 
2890
-		if ( isset( $args['mime_type'] ) &&
2890
+		if (isset($args['mime_type']) &&
2891 2891
 			! call_user_func(
2892
-				array( $implementation, 'supports_mime_type' ),
2893
-				$args['mime_type'] ) ) {
2892
+				array($implementation, 'supports_mime_type'),
2893
+				$args['mime_type'] )) {
2894 2894
 			continue;
2895 2895
 		}
2896 2896
 
2897
-		if ( isset( $args['methods'] ) &&
2898
-			 array_diff( $args['methods'], get_class_methods( $implementation ) ) ) {
2897
+		if (isset($args['methods']) &&
2898
+			 array_diff($args['methods'], get_class_methods($implementation))) {
2899 2899
 			continue;
2900 2900
 		}
2901 2901
 
@@ -2913,8 +2913,8 @@  discard block
 block discarded – undo
2913 2913
 function wp_plupload_default_settings() {
2914 2914
 	$wp_scripts = wp_scripts();
2915 2915
 
2916
-	$data = $wp_scripts->get_data( 'wp-plupload', 'data' );
2917
-	if ( $data && false !== strpos( $data, '_wpPluploadSettings' ) )
2916
+	$data = $wp_scripts->get_data('wp-plupload', 'data');
2917
+	if ($data && false !== strpos($data, '_wpPluploadSettings'))
2918 2918
 		return;
2919 2919
 
2920 2920
 	$max_upload_size = wp_max_upload_size();
@@ -2922,18 +2922,18 @@  discard block
 block discarded – undo
2922 2922
 	$defaults = array(
2923 2923
 		'runtimes'            => 'html5,flash,silverlight,html4',
2924 2924
 		'file_data_name'      => 'async-upload', // key passed to $_FILE.
2925
-		'url'                 => admin_url( 'async-upload.php', 'relative' ),
2926
-		'flash_swf_url'       => includes_url( 'js/plupload/plupload.flash.swf' ),
2927
-		'silverlight_xap_url' => includes_url( 'js/plupload/plupload.silverlight.xap' ),
2925
+		'url'                 => admin_url('async-upload.php', 'relative'),
2926
+		'flash_swf_url'       => includes_url('js/plupload/plupload.flash.swf'),
2927
+		'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
2928 2928
 		'filters' => array(
2929
-			'max_file_size'   => $max_upload_size . 'b',
2929
+			'max_file_size'   => $max_upload_size.'b',
2930 2930
 		),
2931 2931
 	);
2932 2932
 
2933 2933
 	// Currently only iOS Safari supports multiple files uploading but iOS 7.x has a bug that prevents uploading of videos
2934 2934
 	// when enabled. See #29602.
2935
-	if ( wp_is_mobile() && strpos( $_SERVER['HTTP_USER_AGENT'], 'OS 7_' ) !== false &&
2936
-		strpos( $_SERVER['HTTP_USER_AGENT'], 'like Mac OS X' ) !== false ) {
2935
+	if (wp_is_mobile() && strpos($_SERVER['HTTP_USER_AGENT'], 'OS 7_') !== false &&
2936
+		strpos($_SERVER['HTTP_USER_AGENT'], 'like Mac OS X') !== false) {
2937 2937
 
2938 2938
 		$defaults['multi_selection'] = false;
2939 2939
 	}
@@ -2945,7 +2945,7 @@  discard block
 block discarded – undo
2945 2945
 	 *
2946 2946
 	 * @param array $defaults Default Plupload settings array.
2947 2947
 	 */
2948
-	$defaults = apply_filters( 'plupload_default_settings', $defaults );
2948
+	$defaults = apply_filters('plupload_default_settings', $defaults);
2949 2949
 
2950 2950
 	$params = array(
2951 2951
 		'action' => 'upload-attachment',
@@ -2958,8 +2958,8 @@  discard block
 block discarded – undo
2958 2958
 	 *
2959 2959
 	 * @param array $params Default Plupload parameters array.
2960 2960
 	 */
2961
-	$params = apply_filters( 'plupload_default_params', $params );
2962
-	$params['_wpnonce'] = wp_create_nonce( 'media-form' );
2961
+	$params = apply_filters('plupload_default_params', $params);
2962
+	$params['_wpnonce'] = wp_create_nonce('media-form');
2963 2963
 	$defaults['multipart_params'] = $params;
2964 2964
 
2965 2965
 	$settings = array(
@@ -2971,12 +2971,12 @@  discard block
 block discarded – undo
2971 2971
 		'limitExceeded' => is_multisite() && ! is_upload_space_available()
2972 2972
 	);
2973 2973
 
2974
-	$script = 'var _wpPluploadSettings = ' . wp_json_encode( $settings ) . ';';
2974
+	$script = 'var _wpPluploadSettings = '.wp_json_encode($settings).';';
2975 2975
 
2976
-	if ( $data )
2976
+	if ($data)
2977 2977
 		$script = "$data\n$script";
2978 2978
 
2979
-	$wp_scripts->add_data( 'wp-plupload', 'data', $script );
2979
+	$wp_scripts->add_data('wp-plupload', 'data', $script);
2980 2980
 }
2981 2981
 
2982 2982
 /**
@@ -2988,42 +2988,42 @@  discard block
 block discarded – undo
2988 2988
  * @param mixed $attachment Attachment ID or object.
2989 2989
  * @return array|void Array of attachment details.
2990 2990
  */
2991
-function wp_prepare_attachment_for_js( $attachment ) {
2992
-	if ( ! $attachment = get_post( $attachment ) )
2991
+function wp_prepare_attachment_for_js($attachment) {
2992
+	if ( ! $attachment = get_post($attachment))
2993 2993
 		return;
2994 2994
 
2995
-	if ( 'attachment' != $attachment->post_type )
2995
+	if ('attachment' != $attachment->post_type)
2996 2996
 		return;
2997 2997
 
2998
-	$meta = wp_get_attachment_metadata( $attachment->ID );
2999
-	if ( false !== strpos( $attachment->post_mime_type, '/' ) )
3000
-		list( $type, $subtype ) = explode( '/', $attachment->post_mime_type );
2998
+	$meta = wp_get_attachment_metadata($attachment->ID);
2999
+	if (false !== strpos($attachment->post_mime_type, '/'))
3000
+		list($type, $subtype) = explode('/', $attachment->post_mime_type);
3001 3001
 	else
3002
-		list( $type, $subtype ) = array( $attachment->post_mime_type, '' );
3002
+		list($type, $subtype) = array($attachment->post_mime_type, '');
3003 3003
 
3004
-	$attachment_url = wp_get_attachment_url( $attachment->ID );
3004
+	$attachment_url = wp_get_attachment_url($attachment->ID);
3005 3005
 
3006 3006
 	$response = array(
3007 3007
 		'id'          => $attachment->ID,
3008 3008
 		'title'       => $attachment->post_title,
3009
-		'filename'    => wp_basename( get_attached_file( $attachment->ID ) ),
3009
+		'filename'    => wp_basename(get_attached_file($attachment->ID)),
3010 3010
 		'url'         => $attachment_url,
3011
-		'link'        => get_attachment_link( $attachment->ID ),
3012
-		'alt'         => get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true ),
3011
+		'link'        => get_attachment_link($attachment->ID),
3012
+		'alt'         => get_post_meta($attachment->ID, '_wp_attachment_image_alt', true),
3013 3013
 		'author'      => $attachment->post_author,
3014 3014
 		'description' => $attachment->post_content,
3015 3015
 		'caption'     => $attachment->post_excerpt,
3016 3016
 		'name'        => $attachment->post_name,
3017 3017
 		'status'      => $attachment->post_status,
3018 3018
 		'uploadedTo'  => $attachment->post_parent,
3019
-		'date'        => strtotime( $attachment->post_date_gmt ) * 1000,
3020
-		'modified'    => strtotime( $attachment->post_modified_gmt ) * 1000,
3019
+		'date'        => strtotime($attachment->post_date_gmt) * 1000,
3020
+		'modified'    => strtotime($attachment->post_modified_gmt) * 1000,
3021 3021
 		'menuOrder'   => $attachment->menu_order,
3022 3022
 		'mime'        => $attachment->post_mime_type,
3023 3023
 		'type'        => $type,
3024 3024
 		'subtype'     => $subtype,
3025
-		'icon'        => wp_mime_type_icon( $attachment->ID ),
3026
-		'dateFormatted' => mysql2date( __( 'F j, Y' ), $attachment->post_date ),
3025
+		'icon'        => wp_mime_type_icon($attachment->ID),
3026
+		'dateFormatted' => mysql2date(__('F j, Y'), $attachment->post_date),
3027 3027
 		'nonces'      => array(
3028 3028
 			'update' => false,
3029 3029
 			'delete' => false,
@@ -3033,141 +3033,141 @@  discard block
 block discarded – undo
3033 3033
 		'meta'       => false,
3034 3034
 	);
3035 3035
 
3036
-	$author = new WP_User( $attachment->post_author );
3036
+	$author = new WP_User($attachment->post_author);
3037 3037
 	$response['authorName'] = $author->display_name;
3038 3038
 
3039
-	if ( $attachment->post_parent ) {
3040
-		$post_parent = get_post( $attachment->post_parent );
3039
+	if ($attachment->post_parent) {
3040
+		$post_parent = get_post($attachment->post_parent);
3041 3041
 	} else {
3042 3042
 		$post_parent = false;
3043 3043
 	}
3044 3044
 
3045
-	if ( $post_parent ) {
3046
-		$parent_type = get_post_type_object( $post_parent->post_type );
3047
-		if ( $parent_type && $parent_type->show_ui && current_user_can( 'edit_post', $attachment->post_parent ) ) {
3048
-			$response['uploadedToLink'] = get_edit_post_link( $attachment->post_parent, 'raw' );
3045
+	if ($post_parent) {
3046
+		$parent_type = get_post_type_object($post_parent->post_type);
3047
+		if ($parent_type && $parent_type->show_ui && current_user_can('edit_post', $attachment->post_parent)) {
3048
+			$response['uploadedToLink'] = get_edit_post_link($attachment->post_parent, 'raw');
3049 3049
 		}
3050
-		$response['uploadedToTitle'] = $post_parent->post_title ? $post_parent->post_title : __( '(no title)' );
3050
+		$response['uploadedToTitle'] = $post_parent->post_title ? $post_parent->post_title : __('(no title)');
3051 3051
 	}
3052 3052
 
3053
-	$attached_file = get_attached_file( $attachment->ID );
3053
+	$attached_file = get_attached_file($attachment->ID);
3054 3054
 
3055
-	if ( isset( $meta['filesize'] ) ) {
3055
+	if (isset($meta['filesize'])) {
3056 3056
 		$bytes = $meta['filesize'];
3057
-	} elseif ( file_exists( $attached_file ) ) {
3058
-		$bytes = filesize( $attached_file );
3057
+	} elseif (file_exists($attached_file)) {
3058
+		$bytes = filesize($attached_file);
3059 3059
 	} else {
3060 3060
 		$bytes = '';
3061 3061
 	}
3062 3062
 
3063
-	if ( $bytes ) {
3063
+	if ($bytes) {
3064 3064
 		$response['filesizeInBytes'] = $bytes;
3065
-		$response['filesizeHumanReadable'] = size_format( $bytes );
3065
+		$response['filesizeHumanReadable'] = size_format($bytes);
3066 3066
 	}
3067 3067
 
3068
-	if ( current_user_can( 'edit_post', $attachment->ID ) ) {
3069
-		$response['nonces']['update'] = wp_create_nonce( 'update-post_' . $attachment->ID );
3070
-		$response['nonces']['edit'] = wp_create_nonce( 'image_editor-' . $attachment->ID );
3071
-		$response['editLink'] = get_edit_post_link( $attachment->ID, 'raw' );
3068
+	if (current_user_can('edit_post', $attachment->ID)) {
3069
+		$response['nonces']['update'] = wp_create_nonce('update-post_'.$attachment->ID);
3070
+		$response['nonces']['edit'] = wp_create_nonce('image_editor-'.$attachment->ID);
3071
+		$response['editLink'] = get_edit_post_link($attachment->ID, 'raw');
3072 3072
 	}
3073 3073
 
3074
-	if ( current_user_can( 'delete_post', $attachment->ID ) )
3075
-		$response['nonces']['delete'] = wp_create_nonce( 'delete-post_' . $attachment->ID );
3074
+	if (current_user_can('delete_post', $attachment->ID))
3075
+		$response['nonces']['delete'] = wp_create_nonce('delete-post_'.$attachment->ID);
3076 3076
 
3077
-	if ( $meta && 'image' === $type ) {
3077
+	if ($meta && 'image' === $type) {
3078 3078
 		$sizes = array();
3079 3079
 
3080 3080
 		/** This filter is documented in wp-admin/includes/media.php */
3081
-		$possible_sizes = apply_filters( 'image_size_names_choose', array(
3081
+		$possible_sizes = apply_filters('image_size_names_choose', array(
3082 3082
 			'thumbnail' => __('Thumbnail'),
3083 3083
 			'medium'    => __('Medium'),
3084 3084
 			'large'     => __('Large'),
3085 3085
 			'full'      => __('Full Size'),
3086
-		) );
3087
-		unset( $possible_sizes['full'] );
3086
+		));
3087
+		unset($possible_sizes['full']);
3088 3088
 
3089 3089
 		// Loop through all potential sizes that may be chosen. Try to do this with some efficiency.
3090 3090
 		// First: run the image_downsize filter. If it returns something, we can use its data.
3091 3091
 		// If the filter does not return something, then image_downsize() is just an expensive
3092 3092
 		// way to check the image metadata, which we do second.
3093
-		foreach ( $possible_sizes as $size => $label ) {
3093
+		foreach ($possible_sizes as $size => $label) {
3094 3094
 
3095 3095
 			/** This filter is documented in wp-includes/media.php */
3096
-			if ( $downsize = apply_filters( 'image_downsize', false, $attachment->ID, $size ) ) {
3097
-				if ( ! $downsize[3] )
3096
+			if ($downsize = apply_filters('image_downsize', false, $attachment->ID, $size)) {
3097
+				if ( ! $downsize[3])
3098 3098
 					continue;
3099
-				$sizes[ $size ] = array(
3099
+				$sizes[$size] = array(
3100 3100
 					'height'      => $downsize[2],
3101 3101
 					'width'       => $downsize[1],
3102 3102
 					'url'         => $downsize[0],
3103 3103
 					'orientation' => $downsize[2] > $downsize[1] ? 'portrait' : 'landscape',
3104 3104
 				);
3105
-			} elseif ( isset( $meta['sizes'][ $size ] ) ) {
3106
-				if ( ! isset( $base_url ) )
3107
-					$base_url = str_replace( wp_basename( $attachment_url ), '', $attachment_url );
3105
+			} elseif (isset($meta['sizes'][$size])) {
3106
+				if ( ! isset($base_url))
3107
+					$base_url = str_replace(wp_basename($attachment_url), '', $attachment_url);
3108 3108
 
3109 3109
 				// Nothing from the filter, so consult image metadata if we have it.
3110
-				$size_meta = $meta['sizes'][ $size ];
3110
+				$size_meta = $meta['sizes'][$size];
3111 3111
 
3112 3112
 				// We have the actual image size, but might need to further constrain it if content_width is narrower.
3113 3113
 				// Thumbnail, medium, and full sizes are also checked against the site's height/width options.
3114
-				list( $width, $height ) = image_constrain_size_for_editor( $size_meta['width'], $size_meta['height'], $size, 'edit' );
3114
+				list($width, $height) = image_constrain_size_for_editor($size_meta['width'], $size_meta['height'], $size, 'edit');
3115 3115
 
3116
-				$sizes[ $size ] = array(
3116
+				$sizes[$size] = array(
3117 3117
 					'height'      => $height,
3118 3118
 					'width'       => $width,
3119
-					'url'         => $base_url . $size_meta['file'],
3119
+					'url'         => $base_url.$size_meta['file'],
3120 3120
 					'orientation' => $height > $width ? 'portrait' : 'landscape',
3121 3121
 				);
3122 3122
 			}
3123 3123
 		}
3124 3124
 
3125
-		$sizes['full'] = array( 'url' => $attachment_url );
3125
+		$sizes['full'] = array('url' => $attachment_url);
3126 3126
 
3127
-		if ( isset( $meta['height'], $meta['width'] ) ) {
3127
+		if (isset($meta['height'], $meta['width'])) {
3128 3128
 			$sizes['full']['height'] = $meta['height'];
3129 3129
 			$sizes['full']['width'] = $meta['width'];
3130 3130
 			$sizes['full']['orientation'] = $meta['height'] > $meta['width'] ? 'portrait' : 'landscape';
3131 3131
 		}
3132 3132
 
3133
-		$response = array_merge( $response, array( 'sizes' => $sizes ), $sizes['full'] );
3134
-	} elseif ( $meta && 'video' === $type ) {
3135
-		if ( isset( $meta['width'] ) )
3133
+		$response = array_merge($response, array('sizes' => $sizes), $sizes['full']);
3134
+	} elseif ($meta && 'video' === $type) {
3135
+		if (isset($meta['width']))
3136 3136
 			$response['width'] = (int) $meta['width'];
3137
-		if ( isset( $meta['height'] ) )
3137
+		if (isset($meta['height']))
3138 3138
 			$response['height'] = (int) $meta['height'];
3139 3139
 	}
3140 3140
 
3141
-	if ( $meta && ( 'audio' === $type || 'video' === $type ) ) {
3142
-		if ( isset( $meta['length_formatted'] ) )
3141
+	if ($meta && ('audio' === $type || 'video' === $type)) {
3142
+		if (isset($meta['length_formatted']))
3143 3143
 			$response['fileLength'] = $meta['length_formatted'];
3144 3144
 
3145 3145
 		$response['meta'] = array();
3146
-		foreach ( wp_get_attachment_id3_keys( $attachment, 'js' ) as $key => $label ) {
3147
-			$response['meta'][ $key ] = false;
3146
+		foreach (wp_get_attachment_id3_keys($attachment, 'js') as $key => $label) {
3147
+			$response['meta'][$key] = false;
3148 3148
 
3149
-			if ( ! empty( $meta[ $key ] ) ) {
3150
-				$response['meta'][ $key ] = $meta[ $key ];
3149
+			if ( ! empty($meta[$key])) {
3150
+				$response['meta'][$key] = $meta[$key];
3151 3151
 			}
3152 3152
 		}
3153 3153
 
3154
-		$id = get_post_thumbnail_id( $attachment->ID );
3155
-		if ( ! empty( $id ) ) {
3156
-			list( $src, $width, $height ) = wp_get_attachment_image_src( $id, 'full' );
3157
-			$response['image'] = compact( 'src', 'width', 'height' );
3158
-			list( $src, $width, $height ) = wp_get_attachment_image_src( $id, 'thumbnail' );
3159
-			$response['thumb'] = compact( 'src', 'width', 'height' );
3154
+		$id = get_post_thumbnail_id($attachment->ID);
3155
+		if ( ! empty($id)) {
3156
+			list($src, $width, $height) = wp_get_attachment_image_src($id, 'full');
3157
+			$response['image'] = compact('src', 'width', 'height');
3158
+			list($src, $width, $height) = wp_get_attachment_image_src($id, 'thumbnail');
3159
+			$response['thumb'] = compact('src', 'width', 'height');
3160 3160
 		} else {
3161
-			$src = wp_mime_type_icon( $attachment->ID );
3161
+			$src = wp_mime_type_icon($attachment->ID);
3162 3162
 			$width = 48;
3163 3163
 			$height = 64;
3164
-			$response['image'] = compact( 'src', 'width', 'height' );
3165
-			$response['thumb'] = compact( 'src', 'width', 'height' );
3164
+			$response['image'] = compact('src', 'width', 'height');
3165
+			$response['thumb'] = compact('src', 'width', 'height');
3166 3166
 		}
3167 3167
 	}
3168 3168
 
3169
-	if ( function_exists('get_compat_media_markup') )
3170
-		$response['compat'] = get_compat_media_markup( $attachment->ID, array( 'in_modal' => true ) );
3169
+	if (function_exists('get_compat_media_markup'))
3170
+		$response['compat'] = get_compat_media_markup($attachment->ID, array('in_modal' => true));
3171 3171
 
3172 3172
 	/**
3173 3173
 	 * Filter the attachment data prepared for JavaScript.
@@ -3178,7 +3178,7 @@  discard block
 block discarded – undo
3178 3178
 	 * @param int|object $attachment Attachment ID or object.
3179 3179
 	 * @param array      $meta       Array of attachment meta data.
3180 3180
 	 */
3181
-	return apply_filters( 'wp_prepare_attachment_for_js', $response, $attachment, $meta );
3181
+	return apply_filters('wp_prepare_attachment_for_js', $response, $attachment, $meta);
3182 3182
 }
3183 3183
 
3184 3184
 /**
@@ -3197,9 +3197,9 @@  discard block
 block discarded – undo
3197 3197
  *     @type int|WP_Post A post object or ID.
3198 3198
  * }
3199 3199
  */
3200
-function wp_enqueue_media( $args = array() ) {
3200
+function wp_enqueue_media($args = array()) {
3201 3201
 	// Enqueue me just once per page, please.
3202
-	if ( did_action( 'wp_enqueue_media' ) )
3202
+	if (did_action('wp_enqueue_media'))
3203 3203
 		return;
3204 3204
 
3205 3205
 	global $content_width, $wpdb, $wp_locale;
@@ -3207,7 +3207,7 @@  discard block
 block discarded – undo
3207 3207
 	$defaults = array(
3208 3208
 		'post' => null,
3209 3209
 	);
3210
-	$args = wp_parse_args( $args, $defaults );
3210
+	$args = wp_parse_args($args, $defaults);
3211 3211
 
3212 3212
 	// We're going to pass the old thickbox media tabs to `media_upload_tabs`
3213 3213
 	// to ensure plugins will work. We will then unset those tabs.
@@ -3220,67 +3220,67 @@  discard block
 block discarded – undo
3220 3220
 	);
3221 3221
 
3222 3222
 	/** This filter is documented in wp-admin/includes/media.php */
3223
-	$tabs = apply_filters( 'media_upload_tabs', $tabs );
3224
-	unset( $tabs['type'], $tabs['type_url'], $tabs['gallery'], $tabs['library'] );
3223
+	$tabs = apply_filters('media_upload_tabs', $tabs);
3224
+	unset($tabs['type'], $tabs['type_url'], $tabs['gallery'], $tabs['library']);
3225 3225
 
3226 3226
 	$props = array(
3227
-		'link'  => get_option( 'image_default_link_type' ), // db default is 'file'
3228
-		'align' => get_option( 'image_default_align' ), // empty default
3229
-		'size'  => get_option( 'image_default_size' ),  // empty default
3227
+		'link'  => get_option('image_default_link_type'), // db default is 'file'
3228
+		'align' => get_option('image_default_align'), // empty default
3229
+		'size'  => get_option('image_default_size'), // empty default
3230 3230
 	);
3231 3231
 
3232
-	$exts = array_merge( wp_get_audio_extensions(), wp_get_video_extensions() );
3232
+	$exts = array_merge(wp_get_audio_extensions(), wp_get_video_extensions());
3233 3233
 	$mimes = get_allowed_mime_types();
3234 3234
 	$ext_mimes = array();
3235
-	foreach ( $exts as $ext ) {
3236
-		foreach ( $mimes as $ext_preg => $mime_match ) {
3237
-			if ( preg_match( '#' . $ext . '#i', $ext_preg ) ) {
3238
-				$ext_mimes[ $ext ] = $mime_match;
3235
+	foreach ($exts as $ext) {
3236
+		foreach ($mimes as $ext_preg => $mime_match) {
3237
+			if (preg_match('#'.$ext.'#i', $ext_preg)) {
3238
+				$ext_mimes[$ext] = $mime_match;
3239 3239
 				break;
3240 3240
 			}
3241 3241
 		}
3242 3242
 	}
3243 3243
 
3244
-	$has_audio = $wpdb->get_var( "
3244
+	$has_audio = $wpdb->get_var("
3245 3245
 		SELECT ID
3246 3246
 		FROM $wpdb->posts
3247 3247
 		WHERE post_type = 'attachment'
3248 3248
 		AND post_mime_type LIKE 'audio%'
3249 3249
 		LIMIT 1
3250
-	" );
3251
-	$has_video = $wpdb->get_var( "
3250
+	");
3251
+	$has_video = $wpdb->get_var("
3252 3252
 		SELECT ID
3253 3253
 		FROM $wpdb->posts
3254 3254
 		WHERE post_type = 'attachment'
3255 3255
 		AND post_mime_type LIKE 'video%'
3256 3256
 		LIMIT 1
3257
-	" );
3258
-	$months = $wpdb->get_results( $wpdb->prepare( "
3257
+	");
3258
+	$months = $wpdb->get_results($wpdb->prepare("
3259 3259
 		SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month
3260 3260
 		FROM $wpdb->posts
3261 3261
 		WHERE post_type = %s
3262 3262
 		ORDER BY post_date DESC
3263
-	", 'attachment' ) );
3264
-	foreach ( $months as $month_year ) {
3265
-		$month_year->text = sprintf( __( '%1$s %2$d' ), $wp_locale->get_month( $month_year->month ), $month_year->year );
3263
+	", 'attachment'));
3264
+	foreach ($months as $month_year) {
3265
+		$month_year->text = sprintf(__('%1$s %2$d'), $wp_locale->get_month($month_year->month), $month_year->year);
3266 3266
 	}
3267 3267
 
3268 3268
 	$settings = array(
3269 3269
 		'tabs'      => $tabs,
3270
-		'tabUrl'    => add_query_arg( array( 'chromeless' => true ), admin_url('media-upload.php') ),
3271
-		'mimeTypes' => wp_list_pluck( get_post_mime_types(), 0 ),
3270
+		'tabUrl'    => add_query_arg(array('chromeless' => true), admin_url('media-upload.php')),
3271
+		'mimeTypes' => wp_list_pluck(get_post_mime_types(), 0),
3272 3272
 		/** This filter is documented in wp-admin/includes/media.php */
3273
-		'captions'  => ! apply_filters( 'disable_captions', '' ),
3273
+		'captions'  => ! apply_filters('disable_captions', ''),
3274 3274
 		'nonce'     => array(
3275
-			'sendToEditor' => wp_create_nonce( 'media-send-to-editor' ),
3275
+			'sendToEditor' => wp_create_nonce('media-send-to-editor'),
3276 3276
 		),
3277 3277
 		'post'    => array(
3278 3278
 			'id' => 0,
3279 3279
 		),
3280 3280
 		'defaultProps' => $props,
3281 3281
 		'attachmentCounts' => array(
3282
-			'audio' => ( $has_audio ) ? 1 : 0,
3283
-			'video' => ( $has_video ) ? 1 : 0
3282
+			'audio' => ($has_audio) ? 1 : 0,
3283
+			'video' => ($has_video) ? 1 : 0
3284 3284
 		),
3285 3285
 		'embedExts'    => $exts,
3286 3286
 		'embedMimes'   => $ext_mimes,
@@ -3290,154 +3290,154 @@  discard block
 block discarded – undo
3290 3290
 	);
3291 3291
 
3292 3292
 	$post = null;
3293
-	if ( isset( $args['post'] ) ) {
3294
-		$post = get_post( $args['post'] );
3293
+	if (isset($args['post'])) {
3294
+		$post = get_post($args['post']);
3295 3295
 		$settings['post'] = array(
3296 3296
 			'id' => $post->ID,
3297
-			'nonce' => wp_create_nonce( 'update-post_' . $post->ID ),
3297
+			'nonce' => wp_create_nonce('update-post_'.$post->ID),
3298 3298
 		);
3299 3299
 
3300
-		$thumbnail_support = current_theme_supports( 'post-thumbnails', $post->post_type ) && post_type_supports( $post->post_type, 'thumbnail' );
3301
-		if ( ! $thumbnail_support && 'attachment' === $post->post_type && $post->post_mime_type ) {
3302
-			if ( wp_attachment_is( 'audio', $post ) ) {
3303
-				$thumbnail_support = post_type_supports( 'attachment:audio', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:audio' );
3304
-			} elseif ( wp_attachment_is( 'video', $post ) ) {
3305
-				$thumbnail_support = post_type_supports( 'attachment:video', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:video' );
3300
+		$thumbnail_support = current_theme_supports('post-thumbnails', $post->post_type) && post_type_supports($post->post_type, 'thumbnail');
3301
+		if ( ! $thumbnail_support && 'attachment' === $post->post_type && $post->post_mime_type) {
3302
+			if (wp_attachment_is('audio', $post)) {
3303
+				$thumbnail_support = post_type_supports('attachment:audio', 'thumbnail') || current_theme_supports('post-thumbnails', 'attachment:audio');
3304
+			} elseif (wp_attachment_is('video', $post)) {
3305
+				$thumbnail_support = post_type_supports('attachment:video', 'thumbnail') || current_theme_supports('post-thumbnails', 'attachment:video');
3306 3306
 			}
3307 3307
 		}
3308 3308
 
3309
-		if ( $thumbnail_support ) {
3310
-			$featured_image_id = get_post_meta( $post->ID, '_thumbnail_id', true );
3309
+		if ($thumbnail_support) {
3310
+			$featured_image_id = get_post_meta($post->ID, '_thumbnail_id', true);
3311 3311
 			$settings['post']['featuredImageId'] = $featured_image_id ? $featured_image_id : -1;
3312 3312
 		}
3313 3313
 	}
3314 3314
 
3315
-	if ( $post ) {
3316
-		$post_type_object = get_post_type_object( $post->post_type );
3315
+	if ($post) {
3316
+		$post_type_object = get_post_type_object($post->post_type);
3317 3317
 	} else {
3318
-		$post_type_object = get_post_type_object( 'post' );
3318
+		$post_type_object = get_post_type_object('post');
3319 3319
 	}
3320 3320
 
3321 3321
 	$strings = array(
3322 3322
 		// Generic
3323
-		'url'         => __( 'URL' ),
3324
-		'addMedia'    => __( 'Add Media' ),
3325
-		'search'      => __( 'Search' ),
3326
-		'select'      => __( 'Select' ),
3327
-		'cancel'      => __( 'Cancel' ),
3328
-		'update'      => __( 'Update' ),
3329
-		'replace'     => __( 'Replace' ),
3330
-		'remove'      => __( 'Remove' ),
3331
-		'back'        => __( 'Back' ),
3323
+		'url'         => __('URL'),
3324
+		'addMedia'    => __('Add Media'),
3325
+		'search'      => __('Search'),
3326
+		'select'      => __('Select'),
3327
+		'cancel'      => __('Cancel'),
3328
+		'update'      => __('Update'),
3329
+		'replace'     => __('Replace'),
3330
+		'remove'      => __('Remove'),
3331
+		'back'        => __('Back'),
3332 3332
 		/* translators: This is a would-be plural string used in the media manager.
3333 3333
 		   If there is not a word you can use in your language to avoid issues with the
3334 3334
 		   lack of plural support here, turn it into "selected: %d" then translate it.
3335 3335
 		 */
3336
-		'selected'    => __( '%d selected' ),
3337
-		'dragInfo'    => __( 'Drag and drop to reorder media files.' ),
3336
+		'selected'    => __('%d selected'),
3337
+		'dragInfo'    => __('Drag and drop to reorder media files.'),
3338 3338
 
3339 3339
 		// Upload
3340
-		'uploadFilesTitle'  => __( 'Upload Files' ),
3341
-		'uploadImagesTitle' => __( 'Upload Images' ),
3340
+		'uploadFilesTitle'  => __('Upload Files'),
3341
+		'uploadImagesTitle' => __('Upload Images'),
3342 3342
 
3343 3343
 		// Library
3344
-		'mediaLibraryTitle'      => __( 'Media Library' ),
3345
-		'insertMediaTitle'       => __( 'Insert Media' ),
3346
-		'createNewGallery'       => __( 'Create a new gallery' ),
3347
-		'createNewPlaylist'      => __( 'Create a new playlist' ),
3348
-		'createNewVideoPlaylist' => __( 'Create a new video playlist' ),
3349
-		'returnToLibrary'        => __( '&#8592; Return to library' ),
3350
-		'allMediaItems'          => __( 'All media items' ),
3351
-		'allDates'               => __( 'All dates' ),
3352
-		'noItemsFound'           => __( 'No items found.' ),
3344
+		'mediaLibraryTitle'      => __('Media Library'),
3345
+		'insertMediaTitle'       => __('Insert Media'),
3346
+		'createNewGallery'       => __('Create a new gallery'),
3347
+		'createNewPlaylist'      => __('Create a new playlist'),
3348
+		'createNewVideoPlaylist' => __('Create a new video playlist'),
3349
+		'returnToLibrary'        => __('&#8592; Return to library'),
3350
+		'allMediaItems'          => __('All media items'),
3351
+		'allDates'               => __('All dates'),
3352
+		'noItemsFound'           => __('No items found.'),
3353 3353
 		'insertIntoPost'         => $post_type_object->labels->insert_into_item,
3354
-		'unattached'             => __( 'Unattached' ),
3355
-		'trash'                  => _x( 'Trash', 'noun' ),
3354
+		'unattached'             => __('Unattached'),
3355
+		'trash'                  => _x('Trash', 'noun'),
3356 3356
 		'uploadedToThisPost'     => $post_type_object->labels->uploaded_to_this_item,
3357
-		'warnDelete'             => __( "You are about to permanently delete this item.\n  'Cancel' to stop, 'OK' to delete." ),
3358
-		'warnBulkDelete'         => __( "You are about to permanently delete these items.\n  'Cancel' to stop, 'OK' to delete." ),
3359
-		'warnBulkTrash'          => __( "You are about to trash these items.\n  'Cancel' to stop, 'OK' to delete." ),
3360
-		'bulkSelect'             => __( 'Bulk Select' ),
3361
-		'cancelSelection'        => __( 'Cancel Selection' ),
3362
-		'trashSelected'          => __( 'Trash Selected' ),
3363
-		'untrashSelected'        => __( 'Untrash Selected' ),
3364
-		'deleteSelected'         => __( 'Delete Selected' ),
3365
-		'deletePermanently'      => __( 'Delete Permanently' ),
3366
-		'apply'                  => __( 'Apply' ),
3367
-		'filterByDate'           => __( 'Filter by date' ),
3368
-		'filterByType'           => __( 'Filter by type' ),
3369
-		'searchMediaLabel'       => __( 'Search Media' ),
3370
-		'noMedia'                => __( 'No media files found.' ),
3357
+		'warnDelete'             => __("You are about to permanently delete this item.\n  'Cancel' to stop, 'OK' to delete."),
3358
+		'warnBulkDelete'         => __("You are about to permanently delete these items.\n  'Cancel' to stop, 'OK' to delete."),
3359
+		'warnBulkTrash'          => __("You are about to trash these items.\n  'Cancel' to stop, 'OK' to delete."),
3360
+		'bulkSelect'             => __('Bulk Select'),
3361
+		'cancelSelection'        => __('Cancel Selection'),
3362
+		'trashSelected'          => __('Trash Selected'),
3363
+		'untrashSelected'        => __('Untrash Selected'),
3364
+		'deleteSelected'         => __('Delete Selected'),
3365
+		'deletePermanently'      => __('Delete Permanently'),
3366
+		'apply'                  => __('Apply'),
3367
+		'filterByDate'           => __('Filter by date'),
3368
+		'filterByType'           => __('Filter by type'),
3369
+		'searchMediaLabel'       => __('Search Media'),
3370
+		'noMedia'                => __('No media files found.'),
3371 3371
 
3372 3372
 		// Library Details
3373
-		'attachmentDetails'  => __( 'Attachment Details' ),
3373
+		'attachmentDetails'  => __('Attachment Details'),
3374 3374
 
3375 3375
 		// From URL
3376
-		'insertFromUrlTitle' => __( 'Insert from URL' ),
3376
+		'insertFromUrlTitle' => __('Insert from URL'),
3377 3377
 
3378 3378
 		// Featured Images
3379 3379
 		'setFeaturedImageTitle' => $post_type_object->labels->featured_image,
3380 3380
 		'setFeaturedImage'      => $post_type_object->labels->set_featured_image,
3381 3381
 
3382 3382
 		// Gallery
3383
-		'createGalleryTitle' => __( 'Create Gallery' ),
3384
-		'editGalleryTitle'   => __( 'Edit Gallery' ),
3385
-		'cancelGalleryTitle' => __( '&#8592; Cancel Gallery' ),
3386
-		'insertGallery'      => __( 'Insert gallery' ),
3387
-		'updateGallery'      => __( 'Update gallery' ),
3388
-		'addToGallery'       => __( 'Add to gallery' ),
3389
-		'addToGalleryTitle'  => __( 'Add to Gallery' ),
3390
-		'reverseOrder'       => __( 'Reverse order' ),
3383
+		'createGalleryTitle' => __('Create Gallery'),
3384
+		'editGalleryTitle'   => __('Edit Gallery'),
3385
+		'cancelGalleryTitle' => __('&#8592; Cancel Gallery'),
3386
+		'insertGallery'      => __('Insert gallery'),
3387
+		'updateGallery'      => __('Update gallery'),
3388
+		'addToGallery'       => __('Add to gallery'),
3389
+		'addToGalleryTitle'  => __('Add to Gallery'),
3390
+		'reverseOrder'       => __('Reverse order'),
3391 3391
 
3392 3392
 		// Edit Image
3393
-		'imageDetailsTitle'     => __( 'Image Details' ),
3394
-		'imageReplaceTitle'     => __( 'Replace Image' ),
3395
-		'imageDetailsCancel'    => __( 'Cancel Edit' ),
3396
-		'editImage'             => __( 'Edit Image' ),
3393
+		'imageDetailsTitle'     => __('Image Details'),
3394
+		'imageReplaceTitle'     => __('Replace Image'),
3395
+		'imageDetailsCancel'    => __('Cancel Edit'),
3396
+		'editImage'             => __('Edit Image'),
3397 3397
 
3398 3398
 		// Crop Image
3399
-		'chooseImage' => __( 'Choose Image' ),
3400
-		'selectAndCrop' => __( 'Select and Crop' ),
3401
-		'skipCropping' => __( 'Skip Cropping' ),
3402
-		'cropImage' => __( 'Crop Image' ),
3403
-		'cropYourImage' => __( 'Crop your image' ),
3404
-		'cropping' => __( 'Cropping&hellip;' ),
3405
-		'suggestedDimensions' => __( 'Suggested image dimensions:' ),
3406
-		'cropError' => __( 'There has been an error cropping your image.' ),
3399
+		'chooseImage' => __('Choose Image'),
3400
+		'selectAndCrop' => __('Select and Crop'),
3401
+		'skipCropping' => __('Skip Cropping'),
3402
+		'cropImage' => __('Crop Image'),
3403
+		'cropYourImage' => __('Crop your image'),
3404
+		'cropping' => __('Cropping&hellip;'),
3405
+		'suggestedDimensions' => __('Suggested image dimensions:'),
3406
+		'cropError' => __('There has been an error cropping your image.'),
3407 3407
 
3408 3408
 		// Edit Audio
3409
-		'audioDetailsTitle'     => __( 'Audio Details' ),
3410
-		'audioReplaceTitle'     => __( 'Replace Audio' ),
3411
-		'audioAddSourceTitle'   => __( 'Add Audio Source' ),
3412
-		'audioDetailsCancel'    => __( 'Cancel Edit' ),
3409
+		'audioDetailsTitle'     => __('Audio Details'),
3410
+		'audioReplaceTitle'     => __('Replace Audio'),
3411
+		'audioAddSourceTitle'   => __('Add Audio Source'),
3412
+		'audioDetailsCancel'    => __('Cancel Edit'),
3413 3413
 
3414 3414
 		// Edit Video
3415
-		'videoDetailsTitle'     => __( 'Video Details' ),
3416
-		'videoReplaceTitle'     => __( 'Replace Video' ),
3417
-		'videoAddSourceTitle'   => __( 'Add Video Source' ),
3418
-		'videoDetailsCancel'    => __( 'Cancel Edit' ),
3419
-		'videoSelectPosterImageTitle' => __( 'Select Poster Image' ),
3420
-		'videoAddTrackTitle'	=> __( 'Add Subtitles' ),
3415
+		'videoDetailsTitle'     => __('Video Details'),
3416
+		'videoReplaceTitle'     => __('Replace Video'),
3417
+		'videoAddSourceTitle'   => __('Add Video Source'),
3418
+		'videoDetailsCancel'    => __('Cancel Edit'),
3419
+		'videoSelectPosterImageTitle' => __('Select Poster Image'),
3420
+		'videoAddTrackTitle'	=> __('Add Subtitles'),
3421 3421
 
3422 3422
  		// Playlist
3423
- 		'playlistDragInfo'    => __( 'Drag and drop to reorder tracks.' ),
3424
- 		'createPlaylistTitle' => __( 'Create Audio Playlist' ),
3425
- 		'editPlaylistTitle'   => __( 'Edit Audio Playlist' ),
3426
- 		'cancelPlaylistTitle' => __( '&#8592; Cancel Audio Playlist' ),
3427
- 		'insertPlaylist'      => __( 'Insert audio playlist' ),
3428
- 		'updatePlaylist'      => __( 'Update audio playlist' ),
3429
- 		'addToPlaylist'       => __( 'Add to audio playlist' ),
3430
- 		'addToPlaylistTitle'  => __( 'Add to Audio Playlist' ),
3423
+ 		'playlistDragInfo'    => __('Drag and drop to reorder tracks.'),
3424
+ 		'createPlaylistTitle' => __('Create Audio Playlist'),
3425
+ 		'editPlaylistTitle'   => __('Edit Audio Playlist'),
3426
+ 		'cancelPlaylistTitle' => __('&#8592; Cancel Audio Playlist'),
3427
+ 		'insertPlaylist'      => __('Insert audio playlist'),
3428
+ 		'updatePlaylist'      => __('Update audio playlist'),
3429
+ 		'addToPlaylist'       => __('Add to audio playlist'),
3430
+ 		'addToPlaylistTitle'  => __('Add to Audio Playlist'),
3431 3431
 
3432 3432
  		// Video Playlist
3433
- 		'videoPlaylistDragInfo'    => __( 'Drag and drop to reorder videos.' ),
3434
- 		'createVideoPlaylistTitle' => __( 'Create Video Playlist' ),
3435
- 		'editVideoPlaylistTitle'   => __( 'Edit Video Playlist' ),
3436
- 		'cancelVideoPlaylistTitle' => __( '&#8592; Cancel Video Playlist' ),
3437
- 		'insertVideoPlaylist'      => __( 'Insert video playlist' ),
3438
- 		'updateVideoPlaylist'      => __( 'Update video playlist' ),
3439
- 		'addToVideoPlaylist'       => __( 'Add to video playlist' ),
3440
- 		'addToVideoPlaylistTitle'  => __( 'Add to Video Playlist' ),
3433
+ 		'videoPlaylistDragInfo'    => __('Drag and drop to reorder videos.'),
3434
+ 		'createVideoPlaylistTitle' => __('Create Video Playlist'),
3435
+ 		'editVideoPlaylistTitle'   => __('Edit Video Playlist'),
3436
+ 		'cancelVideoPlaylistTitle' => __('&#8592; Cancel Video Playlist'),
3437
+ 		'insertVideoPlaylist'      => __('Insert video playlist'),
3438
+ 		'updateVideoPlaylist'      => __('Update video playlist'),
3439
+ 		'addToVideoPlaylist'       => __('Add to video playlist'),
3440
+ 		'addToVideoPlaylistTitle'  => __('Add to Video Playlist'),
3441 3441
 	);
3442 3442
 
3443 3443
 	/**
@@ -3448,7 +3448,7 @@  discard block
 block discarded – undo
3448 3448
 	 * @param array   $settings List of media view settings.
3449 3449
 	 * @param WP_Post $post     Post object.
3450 3450
 	 */
3451
-	$settings = apply_filters( 'media_view_settings', $settings, $post );
3451
+	$settings = apply_filters('media_view_settings', $settings, $post);
3452 3452
 
3453 3453
 	/**
3454 3454
 	 * Filter the media view strings.
@@ -3458,35 +3458,35 @@  discard block
 block discarded – undo
3458 3458
 	 * @param array   $strings List of media view strings.
3459 3459
 	 * @param WP_Post $post    Post object.
3460 3460
 	 */
3461
-	$strings = apply_filters( 'media_view_strings', $strings,  $post );
3461
+	$strings = apply_filters('media_view_strings', $strings, $post);
3462 3462
 
3463 3463
 	$strings['settings'] = $settings;
3464 3464
 
3465 3465
 	// Ensure we enqueue media-editor first, that way media-views is
3466 3466
 	// registered internally before we try to localize it. see #24724.
3467
-	wp_enqueue_script( 'media-editor' );
3468
-	wp_localize_script( 'media-views', '_wpMediaViewsL10n', $strings );
3467
+	wp_enqueue_script('media-editor');
3468
+	wp_localize_script('media-views', '_wpMediaViewsL10n', $strings);
3469 3469
 
3470
-	wp_enqueue_script( 'media-audiovideo' );
3471
-	wp_enqueue_style( 'media-views' );
3472
-	if ( is_admin() ) {
3473
-		wp_enqueue_script( 'mce-view' );
3474
-		wp_enqueue_script( 'image-edit' );
3470
+	wp_enqueue_script('media-audiovideo');
3471
+	wp_enqueue_style('media-views');
3472
+	if (is_admin()) {
3473
+		wp_enqueue_script('mce-view');
3474
+		wp_enqueue_script('image-edit');
3475 3475
 	}
3476
-	wp_enqueue_style( 'imgareaselect' );
3476
+	wp_enqueue_style('imgareaselect');
3477 3477
 	wp_plupload_default_settings();
3478 3478
 
3479
-	require_once ABSPATH . WPINC . '/media-template.php';
3480
-	add_action( 'admin_footer', 'wp_print_media_templates' );
3481
-	add_action( 'wp_footer', 'wp_print_media_templates' );
3482
-	add_action( 'customize_controls_print_footer_scripts', 'wp_print_media_templates' );
3479
+	require_once ABSPATH.WPINC.'/media-template.php';
3480
+	add_action('admin_footer', 'wp_print_media_templates');
3481
+	add_action('wp_footer', 'wp_print_media_templates');
3482
+	add_action('customize_controls_print_footer_scripts', 'wp_print_media_templates');
3483 3483
 
3484 3484
 	/**
3485 3485
 	 * Fires at the conclusion of wp_enqueue_media().
3486 3486
 	 *
3487 3487
 	 * @since 3.5.0
3488 3488
 	 */
3489
-	do_action( 'wp_enqueue_media' );
3489
+	do_action('wp_enqueue_media');
3490 3490
 }
3491 3491
 
3492 3492
 /**
@@ -3498,8 +3498,8 @@  discard block
 block discarded – undo
3498 3498
  * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
3499 3499
  * @return array Found attachments.
3500 3500
  */
3501
-function get_attached_media( $type, $post = 0 ) {
3502
-	if ( ! $post = get_post( $post ) )
3501
+function get_attached_media($type, $post = 0) {
3502
+	if ( ! $post = get_post($post))
3503 3503
 		return array();
3504 3504
 
3505 3505
 	$args = array(
@@ -3520,9 +3520,9 @@  discard block
 block discarded – undo
3520 3520
 	 * @param string $type Mime type of the desired media.
3521 3521
 	 * @param mixed  $post Post ID or object.
3522 3522
 	 */
3523
-	$args = apply_filters( 'get_attached_media_args', $args, $type, $post );
3523
+	$args = apply_filters('get_attached_media_args', $args, $type, $post);
3524 3524
 
3525
-	$children = get_children( $args );
3525
+	$children = get_children($args);
3526 3526
 
3527 3527
 	/**
3528 3528
 	 * Filter the list of media attached to the given post.
@@ -3533,7 +3533,7 @@  discard block
 block discarded – undo
3533 3533
 	 * @param string $type     Mime type of the media desired.
3534 3534
 	 * @param mixed  $post     Post ID or object.
3535 3535
 	 */
3536
-	return (array) apply_filters( 'get_attached_media', $children, $type, $post );
3536
+	return (array) apply_filters('get_attached_media', $children, $type, $post);
3537 3537
 }
3538 3538
 
3539 3539
 /**
@@ -3545,7 +3545,7 @@  discard block
 block discarded – undo
3545 3545
  * @param array  $types   An array of media types: 'audio', 'video', 'object', 'embed', or 'iframe'.
3546 3546
  * @return array A list of found HTML media embeds.
3547 3547
  */
3548
-function get_media_embedded_in_content( $content, $types = null ) {
3548
+function get_media_embedded_in_content($content, $types = null) {
3549 3549
 	$html = array();
3550 3550
 
3551 3551
 	/**
@@ -3556,20 +3556,20 @@  discard block
 block discarded – undo
3556 3556
 	 * @param array $allowed_media_types An array of allowed media types. Default media types are
3557 3557
 	 *                                   'audio', 'video', 'object', 'embed', and 'iframe'.
3558 3558
 	 */
3559
-	$allowed_media_types = apply_filters( 'media_embedded_in_content_allowed_types', array( 'audio', 'video', 'object', 'embed', 'iframe' ) );
3559
+	$allowed_media_types = apply_filters('media_embedded_in_content_allowed_types', array('audio', 'video', 'object', 'embed', 'iframe'));
3560 3560
 
3561
-	if ( ! empty( $types ) ) {
3562
-		if ( ! is_array( $types ) ) {
3563
-			$types = array( $types );
3561
+	if ( ! empty($types)) {
3562
+		if ( ! is_array($types)) {
3563
+			$types = array($types);
3564 3564
 		}
3565 3565
 
3566
-		$allowed_media_types = array_intersect( $allowed_media_types, $types );
3566
+		$allowed_media_types = array_intersect($allowed_media_types, $types);
3567 3567
 	}
3568 3568
 
3569
-	$tags = implode( '|', $allowed_media_types );
3569
+	$tags = implode('|', $allowed_media_types);
3570 3570
 
3571
-	if ( preg_match_all( '#<(?P<tag>' . $tags . ')[^<]*?(?:>[\s\S]*?<\/(?P=tag)>|\s*\/>)#', $content, $matches ) ) {
3572
-		foreach ( $matches[0] as $match ) {
3571
+	if (preg_match_all('#<(?P<tag>'.$tags.')[^<]*?(?:>[\s\S]*?<\/(?P=tag)>|\s*\/>)#', $content, $matches)) {
3572
+		foreach ($matches[0] as $match) {
3573 3573
 			$html[] = $match;
3574 3574
 		}
3575 3575
 	}
@@ -3587,31 +3587,31 @@  discard block
 block discarded – undo
3587 3587
  * @return array A list of arrays, each containing gallery data and srcs parsed
3588 3588
  *               from the expanded shortcode.
3589 3589
  */
3590
-function get_post_galleries( $post, $html = true ) {
3591
-	if ( ! $post = get_post( $post ) )
3590
+function get_post_galleries($post, $html = true) {
3591
+	if ( ! $post = get_post($post))
3592 3592
 		return array();
3593 3593
 
3594
-	if ( ! has_shortcode( $post->post_content, 'gallery' ) )
3594
+	if ( ! has_shortcode($post->post_content, 'gallery'))
3595 3595
 		return array();
3596 3596
 
3597 3597
 	$galleries = array();
3598
-	if ( preg_match_all( '/' . get_shortcode_regex() . '/s', $post->post_content, $matches, PREG_SET_ORDER ) ) {
3599
-		foreach ( $matches as $shortcode ) {
3600
-			if ( 'gallery' === $shortcode[2] ) {
3598
+	if (preg_match_all('/'.get_shortcode_regex().'/s', $post->post_content, $matches, PREG_SET_ORDER)) {
3599
+		foreach ($matches as $shortcode) {
3600
+			if ('gallery' === $shortcode[2]) {
3601 3601
 				$srcs = array();
3602 3602
 
3603
-				$gallery = do_shortcode_tag( $shortcode );
3604
-				if ( $html ) {
3603
+				$gallery = do_shortcode_tag($shortcode);
3604
+				if ($html) {
3605 3605
 					$galleries[] = $gallery;
3606 3606
 				} else {
3607
-					preg_match_all( '#src=([\'"])(.+?)\1#is', $gallery, $src, PREG_SET_ORDER );
3608
-					if ( ! empty( $src ) ) {
3609
-						foreach ( $src as $s )
3607
+					preg_match_all('#src=([\'"])(.+?)\1#is', $gallery, $src, PREG_SET_ORDER);
3608
+					if ( ! empty($src)) {
3609
+						foreach ($src as $s)
3610 3610
 							$srcs[] = $s[2];
3611 3611
 					}
3612 3612
 
3613
-					$data = shortcode_parse_atts( $shortcode[3] );
3614
-					$data['src'] = array_values( array_unique( $srcs ) );
3613
+					$data = shortcode_parse_atts($shortcode[3]);
3614
+					$data['src'] = array_values(array_unique($srcs));
3615 3615
 					$galleries[] = $data;
3616 3616
 				}
3617 3617
 			}
@@ -3626,7 +3626,7 @@  discard block
 block discarded – undo
3626 3626
 	 * @param array   $galleries Associative array of all found post galleries.
3627 3627
 	 * @param WP_Post $post      Post object.
3628 3628
 	 */
3629
-	return apply_filters( 'get_post_galleries', $galleries, $post );
3629
+	return apply_filters('get_post_galleries', $galleries, $post);
3630 3630
 }
3631 3631
 
3632 3632
 /**
@@ -3638,9 +3638,9 @@  discard block
 block discarded – undo
3638 3638
  * @param bool        $html Optional. Whether to return HTML or data. Default is true.
3639 3639
  * @return string|array Gallery data and srcs parsed from the expanded shortcode.
3640 3640
  */
3641
-function get_post_gallery( $post = 0, $html = true ) {
3642
-	$galleries = get_post_galleries( $post, $html );
3643
-	$gallery = reset( $galleries );
3641
+function get_post_gallery($post = 0, $html = true) {
3642
+	$galleries = get_post_galleries($post, $html);
3643
+	$gallery = reset($galleries);
3644 3644
 
3645 3645
 	/**
3646 3646
 	 * Filter the first-found post gallery.
@@ -3651,7 +3651,7 @@  discard block
 block discarded – undo
3651 3651
 	 * @param int|WP_Post $post      Post ID or object.
3652 3652
 	 * @param array       $galleries Associative array of all found post galleries.
3653 3653
 	 */
3654
-	return apply_filters( 'get_post_gallery', $gallery, $post, $galleries );
3654
+	return apply_filters('get_post_gallery', $gallery, $post, $galleries);
3655 3655
 }
3656 3656
 
3657 3657
 /**
@@ -3665,9 +3665,9 @@  discard block
 block discarded – undo
3665 3665
  * @return array A list of lists, each containing image srcs parsed.
3666 3666
  *               from an expanded shortcode
3667 3667
  */
3668
-function get_post_galleries_images( $post = 0 ) {
3669
-	$galleries = get_post_galleries( $post, false );
3670
-	return wp_list_pluck( $galleries, 'src' );
3668
+function get_post_galleries_images($post = 0) {
3669
+	$galleries = get_post_galleries($post, false);
3670
+	return wp_list_pluck($galleries, 'src');
3671 3671
 }
3672 3672
 
3673 3673
 /**
@@ -3680,9 +3680,9 @@  discard block
 block discarded – undo
3680 3680
  * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`.
3681 3681
  * @return array A list of a gallery's image srcs in order.
3682 3682
  */
3683
-function get_post_gallery_images( $post = 0 ) {
3684
-	$gallery = get_post_gallery( $post, false );
3685
-	return empty( $gallery['src'] ) ? array() : $gallery['src'];
3683
+function get_post_gallery_images($post = 0) {
3684
+	$gallery = get_post_gallery($post, false);
3685
+	return empty($gallery['src']) ? array() : $gallery['src'];
3686 3686
 }
3687 3687
 
3688 3688
 /**
@@ -3692,20 +3692,20 @@  discard block
 block discarded – undo
3692 3692
  *
3693 3693
  * @param WP_Post $attachment Attachment object.
3694 3694
  */
3695
-function wp_maybe_generate_attachment_metadata( $attachment ) {
3696
-	if ( empty( $attachment ) || ( empty( $attachment->ID ) || ! $attachment_id = (int) $attachment->ID ) ) {
3695
+function wp_maybe_generate_attachment_metadata($attachment) {
3696
+	if (empty($attachment) || (empty($attachment->ID) || ! $attachment_id = (int) $attachment->ID)) {
3697 3697
 		return;
3698 3698
 	}
3699 3699
 
3700
-	$file = get_attached_file( $attachment_id );
3701
-	$meta = wp_get_attachment_metadata( $attachment_id );
3702
-	if ( empty( $meta ) && file_exists( $file ) ) {
3703
-		$_meta = get_post_meta( $attachment_id );
3704
-		$regeneration_lock = 'wp_generating_att_' . $attachment_id;
3705
-		if ( ! array_key_exists( '_wp_attachment_metadata', $_meta ) && ! get_transient( $regeneration_lock ) ) {
3706
-			set_transient( $regeneration_lock, $file );
3707
-			wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $file ) );
3708
-			delete_transient( $regeneration_lock );
3700
+	$file = get_attached_file($attachment_id);
3701
+	$meta = wp_get_attachment_metadata($attachment_id);
3702
+	if (empty($meta) && file_exists($file)) {
3703
+		$_meta = get_post_meta($attachment_id);
3704
+		$regeneration_lock = 'wp_generating_att_'.$attachment_id;
3705
+		if ( ! array_key_exists('_wp_attachment_metadata', $_meta) && ! get_transient($regeneration_lock)) {
3706
+			set_transient($regeneration_lock, $file);
3707
+			wp_update_attachment_metadata($attachment_id, wp_generate_attachment_metadata($attachment_id, $file));
3708
+			delete_transient($regeneration_lock);
3709 3709
 		}
3710 3710
 	}
3711 3711
 }
@@ -3720,29 +3720,29 @@  discard block
 block discarded – undo
3720 3720
  * @param string $url The URL to resolve.
3721 3721
  * @return int The found post ID, or 0 on failure.
3722 3722
  */
3723
-function attachment_url_to_postid( $url ) {
3723
+function attachment_url_to_postid($url) {
3724 3724
 	global $wpdb;
3725 3725
 
3726 3726
 	$dir = wp_get_upload_dir();
3727 3727
 	$path = $url;
3728 3728
 
3729
-	$site_url = parse_url( $dir['url'] );
3730
-	$image_path = parse_url( $path );
3729
+	$site_url = parse_url($dir['url']);
3730
+	$image_path = parse_url($path);
3731 3731
 
3732 3732
 	//force the protocols to match if needed
3733
-	if ( isset( $image_path['scheme'] ) && ( $image_path['scheme'] !== $site_url['scheme'] ) ) {
3734
-		$path = str_replace( $image_path['scheme'], $site_url['scheme'], $path );
3733
+	if (isset($image_path['scheme']) && ($image_path['scheme'] !== $site_url['scheme'])) {
3734
+		$path = str_replace($image_path['scheme'], $site_url['scheme'], $path);
3735 3735
 	}
3736 3736
 
3737
-	if ( 0 === strpos( $path, $dir['baseurl'] . '/' ) ) {
3738
-		$path = substr( $path, strlen( $dir['baseurl'] . '/' ) );
3737
+	if (0 === strpos($path, $dir['baseurl'].'/')) {
3738
+		$path = substr($path, strlen($dir['baseurl'].'/'));
3739 3739
 	}
3740 3740
 
3741 3741
 	$sql = $wpdb->prepare(
3742 3742
 		"SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_wp_attached_file' AND meta_value = %s",
3743 3743
 		$path
3744 3744
 	);
3745
-	$post_id = $wpdb->get_var( $sql );
3745
+	$post_id = $wpdb->get_var($sql);
3746 3746
 
3747 3747
 	/**
3748 3748
 	 * Filter an attachment id found by URL.
@@ -3752,7 +3752,7 @@  discard block
 block discarded – undo
3752 3752
 	 * @param int|null $post_id The post_id (if any) found by the function.
3753 3753
 	 * @param string   $url     The URL being looked up.
3754 3754
 	 */
3755
-	return (int) apply_filters( 'attachment_url_to_postid', $post_id, $url );
3755
+	return (int) apply_filters('attachment_url_to_postid', $post_id, $url);
3756 3756
 }
3757 3757
 
3758 3758
 /**
@@ -3765,9 +3765,9 @@  discard block
 block discarded – undo
3765 3765
  * @return array The relevant CSS file URLs.
3766 3766
  */
3767 3767
 function wpview_media_sandbox_styles() {
3768
- 	$version = 'ver=' . $GLOBALS['wp_version'];
3769
- 	$mediaelement = includes_url( "js/mediaelement/mediaelementplayer.min.css?$version" );
3770
- 	$wpmediaelement = includes_url( "js/mediaelement/wp-mediaelement.css?$version" );
3768
+ 	$version = 'ver='.$GLOBALS['wp_version'];
3769
+ 	$mediaelement = includes_url("js/mediaelement/mediaelementplayer.min.css?$version");
3770
+ 	$wpmediaelement = includes_url("js/mediaelement/wp-mediaelement.css?$version");
3771 3771
 
3772
-	return array( $mediaelement, $wpmediaelement );
3772
+	return array($mediaelement, $wpmediaelement);
3773 3773
 }
Please login to merge, or discard this patch.
Braces   +153 added lines, -108 removed lines patch added patch discarded remove patch
@@ -41,14 +41,14 @@  discard block
 block discarded – undo
41 41
 function image_constrain_size_for_editor( $width, $height, $size = 'medium', $context = null ) {
42 42
 	global $content_width, $_wp_additional_image_sizes;
43 43
 
44
-	if ( ! $context )
45
-		$context = is_admin() ? 'edit' : 'display';
44
+	if ( ! $context ) {
45
+			$context = is_admin() ? 'edit' : 'display';
46
+	}
46 47
 
47 48
 	if ( is_array($size) ) {
48 49
 		$max_width = $size[0];
49 50
 		$max_height = $size[1];
50
-	}
51
-	elseif ( $size == 'thumb' || $size == 'thumbnail' ) {
51
+	} elseif ( $size == 'thumb' || $size == 'thumbnail' ) {
52 52
 		$max_width = intval(get_option('thumbnail_size_w'));
53 53
 		$max_height = intval(get_option('thumbnail_size_h'));
54 54
 		// last chance thumbnail size defaults
@@ -56,21 +56,18 @@  discard block
 block discarded – undo
56 56
 			$max_width = 128;
57 57
 			$max_height = 96;
58 58
 		}
59
-	}
60
-	elseif ( $size == 'medium' ) {
59
+	} elseif ( $size == 'medium' ) {
61 60
 		$max_width = intval(get_option('medium_size_w'));
62 61
 		$max_height = intval(get_option('medium_size_h'));
63 62
 
64
-	}
65
-	elseif ( $size == 'medium_large' ) {
63
+	} elseif ( $size == 'medium_large' ) {
66 64
 		$max_width = intval( get_option( 'medium_large_size_w' ) );
67 65
 		$max_height = intval( get_option( 'medium_large_size_h' ) );
68 66
 
69 67
 		if ( intval( $content_width ) > 0 ) {
70 68
 			$max_width = min( intval( $content_width ), $max_width );
71 69
 		}
72
-	}
73
-	elseif ( $size == 'large' ) {
70
+	} elseif ( $size == 'large' ) {
74 71
 		/*
75 72
 		 * We're inserting a large size image into the editor. If it's a really
76 73
 		 * big image we'll scale it down to fit reasonably within the editor
@@ -85,8 +82,10 @@  discard block
 block discarded – undo
85 82
 	} elseif ( isset( $_wp_additional_image_sizes ) && count( $_wp_additional_image_sizes ) && in_array( $size, array_keys( $_wp_additional_image_sizes ) ) ) {
86 83
 		$max_width = intval( $_wp_additional_image_sizes[$size]['width'] );
87 84
 		$max_height = intval( $_wp_additional_image_sizes[$size]['height'] );
88
-		if ( intval($content_width) > 0 && 'edit' == $context ) // Only in admin. Assume that theme authors know what they're doing.
85
+		if ( intval($content_width) > 0 && 'edit' == $context ) {
86
+			// Only in admin. Assume that theme authors know what they're doing.
89 87
 			$max_width = min( intval($content_width), $max_width );
88
+		}
90 89
 	}
91 90
 	// $size == 'full' has no constraint
92 91
 	else {
@@ -130,10 +129,12 @@  discard block
 block discarded – undo
130 129
  */
131 130
 function image_hwstring( $width, $height ) {
132 131
 	$out = '';
133
-	if ($width)
134
-		$out .= 'width="'.intval($width).'" ';
135
-	if ($height)
136
-		$out .= 'height="'.intval($height).'" ';
132
+	if ($width) {
133
+			$out .= 'width="'.intval($width).'" ';
134
+	}
135
+	if ($height) {
136
+			$out .= 'height="'.intval($height).'" ';
137
+	}
137 138
 	return $out;
138 139
 }
139 140
 
@@ -164,8 +165,9 @@  discard block
 block discarded – undo
164 165
  */
165 166
 function image_downsize( $id, $size = 'medium' ) {
166 167
 
167
-	if ( !wp_attachment_is_image($id) )
168
-		return false;
168
+	if ( !wp_attachment_is_image($id) ) {
169
+			return false;
170
+	}
169 171
 
170 172
 	/**
171 173
 	 * Filter whether to preempt the output of image_downsize().
@@ -196,8 +198,7 @@  discard block
 block discarded – undo
196 198
 		$width = $intermediate['width'];
197 199
 		$height = $intermediate['height'];
198 200
 		$is_intermediate = true;
199
-	}
200
-	elseif ( $size == 'thumbnail' ) {
201
+	} elseif ( $size == 'thumbnail' ) {
201 202
 		// fall back to the old thumbnail
202 203
 		if ( ($thumb_file = wp_get_attachment_thumb_file($id)) && $info = getimagesize($thumb_file) ) {
203 204
 			$img_url = str_replace($img_url_basename, wp_basename($thumb_file), $img_url);
@@ -384,8 +385,9 @@  discard block
 block discarded – undo
384 385
  * @return array First item is the width, the second item is the height.
385 386
  */
386 387
 function wp_constrain_dimensions( $current_width, $current_height, $max_width = 0, $max_height = 0 ) {
387
-	if ( !$max_width && !$max_height )
388
-		return array( $current_width, $current_height );
388
+	if ( !$max_width && !$max_height ) {
389
+			return array( $current_width, $current_height );
390
+	}
389 391
 
390 392
 	$width_ratio = $height_ratio = 1.0;
391 393
 	$did_width = $did_height = false;
@@ -470,11 +472,13 @@  discard block
 block discarded – undo
470 472
  */
471 473
 function image_resize_dimensions( $orig_w, $orig_h, $dest_w, $dest_h, $crop = false ) {
472 474
 
473
-	if ($orig_w <= 0 || $orig_h <= 0)
474
-		return false;
475
+	if ($orig_w <= 0 || $orig_h <= 0) {
476
+			return false;
477
+	}
475 478
 	// at least one of dest_w or dest_h must be specific
476
-	if ($dest_w <= 0 && $dest_h <= 0)
477
-		return false;
479
+	if ($dest_w <= 0 && $dest_h <= 0) {
480
+			return false;
481
+	}
478 482
 
479 483
 	/**
480 484
 	 * Filter whether to preempt calculating the image resize dimensions.
@@ -493,8 +497,9 @@  discard block
 block discarded – undo
493 497
 	 *                           An array can specify positioning of the crop area. Default false.
494 498
 	 */
495 499
 	$output = apply_filters( 'image_resize_dimensions', null, $orig_w, $orig_h, $dest_w, $dest_h, $crop );
496
-	if ( null !== $output )
497
-		return $output;
500
+	if ( null !== $output ) {
501
+			return $output;
502
+	}
498 503
 
499 504
 	if ( $crop ) {
500 505
 		// crop the largest possible portion of the original image that we can size to $dest_w x $dest_h
@@ -578,8 +583,9 @@  discard block
 block discarded – undo
578 583
 	if ( $width || $height ) {
579 584
 		$editor = wp_get_image_editor( $file );
580 585
 
581
-		if ( is_wp_error( $editor ) || is_wp_error( $editor->resize( $width, $height, $crop ) ) )
582
-			return false;
586
+		if ( is_wp_error( $editor ) || is_wp_error( $editor->resize( $width, $height, $crop ) ) ) {
587
+					return false;
588
+		}
583 589
 
584 590
 		$resized_file = $editor->save();
585 591
 
@@ -630,8 +636,9 @@  discard block
 block discarded – undo
630 636
  * }
631 637
  */
632 638
 function image_get_intermediate_size( $post_id, $size = 'thumbnail' ) {
633
-	if ( !is_array( $imagedata = wp_get_attachment_metadata( $post_id ) ) )
634
-		return false;
639
+	if ( !is_array( $imagedata = wp_get_attachment_metadata( $post_id ) ) ) {
640
+			return false;
641
+	}
635 642
 
636 643
 	// get the best one for a specified set of dimensions
637 644
 	if ( is_array($size) && !empty($imagedata['sizes']) ) {
@@ -677,8 +684,9 @@  discard block
 block discarded – undo
677 684
 		}
678 685
 	}
679 686
 
680
-	if ( is_array($size) || empty($size) || empty($imagedata['sizes'][$size]) )
681
-		return false;
687
+	if ( is_array($size) || empty($size) || empty($imagedata['sizes'][$size]) ) {
688
+			return false;
689
+	}
682 690
 
683 691
 	$data = $imagedata['sizes'][$size];
684 692
 	// include the full filesystem path of the intermediate file
@@ -716,8 +724,9 @@  discard block
 block discarded – undo
716 724
 function get_intermediate_image_sizes() {
717 725
 	global $_wp_additional_image_sizes;
718 726
 	$image_sizes = array('thumbnail', 'medium', 'medium_large', 'large'); // Standard sizes
719
-	if ( isset( $_wp_additional_image_sizes ) && count( $_wp_additional_image_sizes ) )
720
-		$image_sizes = array_merge( $image_sizes, array_keys( $_wp_additional_image_sizes ) );
727
+	if ( isset( $_wp_additional_image_sizes ) && count( $_wp_additional_image_sizes ) ) {
728
+			$image_sizes = array_merge( $image_sizes, array_keys( $_wp_additional_image_sizes ) );
729
+	}
721 730
 
722 731
 	/**
723 732
 	 * Filter the list of intermediate image sizes.
@@ -813,10 +822,14 @@  discard block
 block discarded – undo
813 822
 			'class'	=> "attachment-$size_class size-$size_class",
814 823
 			'alt'	=> trim(strip_tags( get_post_meta($attachment_id, '_wp_attachment_image_alt', true) )), // Use Alt field first
815 824
 		);
816
-		if ( empty($default_attr['alt']) )
817
-			$default_attr['alt'] = trim(strip_tags( $attachment->post_excerpt )); // If not, Use the Caption
818
-		if ( empty($default_attr['alt']) )
819
-			$default_attr['alt'] = trim(strip_tags( $attachment->post_title )); // Finally, use the title
825
+		if ( empty($default_attr['alt']) ) {
826
+					$default_attr['alt'] = trim(strip_tags( $attachment->post_excerpt ));
827
+		}
828
+		// If not, Use the Caption
829
+		if ( empty($default_attr['alt']) ) {
830
+					$default_attr['alt'] = trim(strip_tags( $attachment->post_title ));
831
+		}
832
+		// Finally, use the title
820 833
 
821 834
 		$attr = wp_parse_args( $attr, $default_attr );
822 835
 
@@ -1467,8 +1480,9 @@  discard block
 block discarded – undo
1467 1480
 	 * @param string $content The image element, possibly wrapped in a hyperlink.
1468 1481
 	 */
1469 1482
 	$output = apply_filters( 'img_caption_shortcode', '', $attr, $content );
1470
-	if ( $output != '' )
1471
-		return $output;
1483
+	if ( $output != '' ) {
1484
+			return $output;
1485
+	}
1472 1486
 
1473 1487
 	$atts = shortcode_atts( array(
1474 1488
 		'id'	  => '',
@@ -1479,11 +1493,13 @@  discard block
 block discarded – undo
1479 1493
 	), $attr, 'caption' );
1480 1494
 
1481 1495
 	$atts['width'] = (int) $atts['width'];
1482
-	if ( $atts['width'] < 1 || empty( $atts['caption'] ) )
1483
-		return $content;
1496
+	if ( $atts['width'] < 1 || empty( $atts['caption'] ) ) {
1497
+			return $content;
1498
+	}
1484 1499
 
1485
-	if ( ! empty( $atts['id'] ) )
1486
-		$atts['id'] = 'id="' . esc_attr( sanitize_html_class( $atts['id'] ) ) . '" ';
1500
+	if ( ! empty( $atts['id'] ) ) {
1501
+			$atts['id'] = 'id="' . esc_attr( sanitize_html_class( $atts['id'] ) ) . '" ';
1502
+	}
1487 1503
 
1488 1504
 	$class = trim( 'wp-caption ' . $atts['align'] . ' ' . $atts['class'] );
1489 1505
 
@@ -1509,8 +1525,9 @@  discard block
 block discarded – undo
1509 1525
 	$caption_width = apply_filters( 'img_caption_shortcode_width', $width, $atts, $content );
1510 1526
 
1511 1527
 	$style = '';
1512
-	if ( $caption_width )
1513
-		$style = 'style="width: ' . (int) $caption_width . 'px" ';
1528
+	if ( $caption_width ) {
1529
+			$style = 'style="width: ' . (int) $caption_width . 'px" ';
1530
+	}
1514 1531
 
1515 1532
 	$html = '';
1516 1533
 	if ( $html5 ) {
@@ -2038,8 +2055,10 @@  discard block
 block discarded – undo
2038 2055
 		echo (int) $theme_width;
2039 2056
 	?>"<?php if ( 'video' === $safe_type ):
2040 2057
 		echo ' height="', (int) $theme_height, '"';
2041
-	else:
2058
+	else {
2059
+		:
2042 2060
 		echo ' style="visibility: hidden"';
2061
+	}
2043 2062
 	endif; ?>></<?php echo $safe_type ?>>
2044 2063
 	<div class="wp-playlist-next"></div>
2045 2064
 	<div class="wp-playlist-prev"></div>
@@ -2666,28 +2685,32 @@  discard block
 block discarded – undo
2666 2685
 	} elseif ( is_array( $attachment ) ) {
2667 2686
 		$attachment = (object) $attachment;
2668 2687
 	}
2669
-	if ( ! is_object($attachment) )
2670
-		return array();
2688
+	if ( ! is_object($attachment) ) {
2689
+			return array();
2690
+	}
2671 2691
 
2672 2692
 	$file = get_attached_file( $attachment->ID );
2673 2693
 	$filename = basename( $file );
2674 2694
 
2675 2695
 	$objects = array('attachment');
2676 2696
 
2677
-	if ( false !== strpos($filename, '.') )
2678
-		$objects[] = 'attachment:' . substr($filename, strrpos($filename, '.') + 1);
2697
+	if ( false !== strpos($filename, '.') ) {
2698
+			$objects[] = 'attachment:' . substr($filename, strrpos($filename, '.') + 1);
2699
+	}
2679 2700
 	if ( !empty($attachment->post_mime_type) ) {
2680 2701
 		$objects[] = 'attachment:' . $attachment->post_mime_type;
2681
-		if ( false !== strpos($attachment->post_mime_type, '/') )
2682
-			foreach ( explode('/', $attachment->post_mime_type) as $token )
2702
+		if ( false !== strpos($attachment->post_mime_type, '/') ) {
2703
+					foreach ( explode('/', $attachment->post_mime_type) as $token )
2683 2704
 				if ( !empty($token) )
2684 2705
 					$objects[] = "attachment:$token";
2706
+		}
2685 2707
 	}
2686 2708
 
2687 2709
 	$taxonomies = array();
2688
-	foreach ( $objects as $object )
2689
-		if ( $taxes = get_object_taxonomies($object) )
2710
+	foreach ( $objects as $object ) {
2711
+			if ( $taxes = get_object_taxonomies($object) )
2690 2712
 			$taxonomies = array_merge($taxonomies, $taxes);
2713
+	}
2691 2714
 
2692 2715
 	return array_unique($taxonomies);
2693 2716
 }
@@ -2710,10 +2733,11 @@  discard block
 block discarded – undo
2710 2733
 	foreach ( get_taxonomies( array(), 'objects' ) as $taxonomy ) {
2711 2734
 		foreach ( $taxonomy->object_type as $object_type ) {
2712 2735
 			if ( 'attachment' == $object_type || 0 === strpos( $object_type, 'attachment:' ) ) {
2713
-				if ( 'names' == $output )
2714
-					$taxonomies[] = $taxonomy->name;
2715
-				else
2716
-					$taxonomies[ $taxonomy->name ] = $taxonomy;
2736
+				if ( 'names' == $output ) {
2737
+									$taxonomies[] = $taxonomy->name;
2738
+				} else {
2739
+									$taxonomies[ $taxonomy->name ] = $taxonomy;
2740
+				}
2717 2741
 				break;
2718 2742
 			}
2719 2743
 		}
@@ -2775,12 +2799,13 @@  discard block
 block discarded – undo
2775 2799
 function wp_convert_hr_to_bytes( $size ) {
2776 2800
 	$size  = strtolower( $size );
2777 2801
 	$bytes = (int) $size;
2778
-	if ( strpos( $size, 'k' ) !== false )
2779
-		$bytes = intval( $size ) * KB_IN_BYTES;
2780
-	elseif ( strpos( $size, 'm' ) !== false )
2781
-		$bytes = intval($size) * MB_IN_BYTES;
2782
-	elseif ( strpos( $size, 'g' ) !== false )
2783
-		$bytes = intval( $size ) * GB_IN_BYTES;
2802
+	if ( strpos( $size, 'k' ) !== false ) {
2803
+			$bytes = intval( $size ) * KB_IN_BYTES;
2804
+	} elseif ( strpos( $size, 'm' ) !== false ) {
2805
+			$bytes = intval($size) * MB_IN_BYTES;
2806
+	} elseif ( strpos( $size, 'g' ) !== false ) {
2807
+			$bytes = intval( $size ) * GB_IN_BYTES;
2808
+	}
2784 2809
 	return $bytes;
2785 2810
 }
2786 2811
 
@@ -2826,8 +2851,9 @@  discard block
 block discarded – undo
2826 2851
 
2827 2852
 		// If $file_info['type'] is false, then we let the editor attempt to
2828 2853
 		// figure out the file type, rather than forcing a failure based on extension.
2829
-		if ( isset( $file_info ) && $file_info['type'] )
2830
-			$args['mime_type'] = $file_info['type'];
2854
+		if ( isset( $file_info ) && $file_info['type'] ) {
2855
+					$args['mime_type'] = $file_info['type'];
2856
+		}
2831 2857
 	}
2832 2858
 
2833 2859
 	$implementation = _wp_image_editor_choose( $args );
@@ -2836,8 +2862,9 @@  discard block
 block discarded – undo
2836 2862
 		$editor = new $implementation( $path );
2837 2863
 		$loaded = $editor->load();
2838 2864
 
2839
-		if ( is_wp_error( $loaded ) )
2840
-			return $loaded;
2865
+		if ( is_wp_error( $loaded ) ) {
2866
+					return $loaded;
2867
+		}
2841 2868
 
2842 2869
 		return $editor;
2843 2870
 	}
@@ -2884,8 +2911,9 @@  discard block
 block discarded – undo
2884 2911
 	$implementations = apply_filters( 'wp_image_editors', array( 'WP_Image_Editor_Imagick', 'WP_Image_Editor_GD' ) );
2885 2912
 
2886 2913
 	foreach ( $implementations as $implementation ) {
2887
-		if ( ! call_user_func( array( $implementation, 'test' ), $args ) )
2888
-			continue;
2914
+		if ( ! call_user_func( array( $implementation, 'test' ), $args ) ) {
2915
+					continue;
2916
+		}
2889 2917
 
2890 2918
 		if ( isset( $args['mime_type'] ) &&
2891 2919
 			! call_user_func(
@@ -2914,8 +2942,9 @@  discard block
 block discarded – undo
2914 2942
 	$wp_scripts = wp_scripts();
2915 2943
 
2916 2944
 	$data = $wp_scripts->get_data( 'wp-plupload', 'data' );
2917
-	if ( $data && false !== strpos( $data, '_wpPluploadSettings' ) )
2918
-		return;
2945
+	if ( $data && false !== strpos( $data, '_wpPluploadSettings' ) ) {
2946
+			return;
2947
+	}
2919 2948
 
2920 2949
 	$max_upload_size = wp_max_upload_size();
2921 2950
 
@@ -2973,8 +3002,9 @@  discard block
 block discarded – undo
2973 3002
 
2974 3003
 	$script = 'var _wpPluploadSettings = ' . wp_json_encode( $settings ) . ';';
2975 3004
 
2976
-	if ( $data )
2977
-		$script = "$data\n$script";
3005
+	if ( $data ) {
3006
+			$script = "$data\n$script";
3007
+	}
2978 3008
 
2979 3009
 	$wp_scripts->add_data( 'wp-plupload', 'data', $script );
2980 3010
 }
@@ -2989,17 +3019,20 @@  discard block
 block discarded – undo
2989 3019
  * @return array|void Array of attachment details.
2990 3020
  */
2991 3021
 function wp_prepare_attachment_for_js( $attachment ) {
2992
-	if ( ! $attachment = get_post( $attachment ) )
2993
-		return;
3022
+	if ( ! $attachment = get_post( $attachment ) ) {
3023
+			return;
3024
+	}
2994 3025
 
2995
-	if ( 'attachment' != $attachment->post_type )
2996
-		return;
3026
+	if ( 'attachment' != $attachment->post_type ) {
3027
+			return;
3028
+	}
2997 3029
 
2998 3030
 	$meta = wp_get_attachment_metadata( $attachment->ID );
2999
-	if ( false !== strpos( $attachment->post_mime_type, '/' ) )
3000
-		list( $type, $subtype ) = explode( '/', $attachment->post_mime_type );
3001
-	else
3002
-		list( $type, $subtype ) = array( $attachment->post_mime_type, '' );
3031
+	if ( false !== strpos( $attachment->post_mime_type, '/' ) ) {
3032
+			list( $type, $subtype ) = explode( '/', $attachment->post_mime_type );
3033
+	} else {
3034
+			list( $type, $subtype ) = array( $attachment->post_mime_type, '' );
3035
+	}
3003 3036
 
3004 3037
 	$attachment_url = wp_get_attachment_url( $attachment->ID );
3005 3038
 
@@ -3071,8 +3104,9 @@  discard block
 block discarded – undo
3071 3104
 		$response['editLink'] = get_edit_post_link( $attachment->ID, 'raw' );
3072 3105
 	}
3073 3106
 
3074
-	if ( current_user_can( 'delete_post', $attachment->ID ) )
3075
-		$response['nonces']['delete'] = wp_create_nonce( 'delete-post_' . $attachment->ID );
3107
+	if ( current_user_can( 'delete_post', $attachment->ID ) ) {
3108
+			$response['nonces']['delete'] = wp_create_nonce( 'delete-post_' . $attachment->ID );
3109
+	}
3076 3110
 
3077 3111
 	if ( $meta && 'image' === $type ) {
3078 3112
 		$sizes = array();
@@ -3094,8 +3128,9 @@  discard block
 block discarded – undo
3094 3128
 
3095 3129
 			/** This filter is documented in wp-includes/media.php */
3096 3130
 			if ( $downsize = apply_filters( 'image_downsize', false, $attachment->ID, $size ) ) {
3097
-				if ( ! $downsize[3] )
3098
-					continue;
3131
+				if ( ! $downsize[3] ) {
3132
+									continue;
3133
+				}
3099 3134
 				$sizes[ $size ] = array(
3100 3135
 					'height'      => $downsize[2],
3101 3136
 					'width'       => $downsize[1],
@@ -3103,8 +3138,9 @@  discard block
 block discarded – undo
3103 3138
 					'orientation' => $downsize[2] > $downsize[1] ? 'portrait' : 'landscape',
3104 3139
 				);
3105 3140
 			} elseif ( isset( $meta['sizes'][ $size ] ) ) {
3106
-				if ( ! isset( $base_url ) )
3107
-					$base_url = str_replace( wp_basename( $attachment_url ), '', $attachment_url );
3141
+				if ( ! isset( $base_url ) ) {
3142
+									$base_url = str_replace( wp_basename( $attachment_url ), '', $attachment_url );
3143
+				}
3108 3144
 
3109 3145
 				// Nothing from the filter, so consult image metadata if we have it.
3110 3146
 				$size_meta = $meta['sizes'][ $size ];
@@ -3132,15 +3168,18 @@  discard block
 block discarded – undo
3132 3168
 
3133 3169
 		$response = array_merge( $response, array( 'sizes' => $sizes ), $sizes['full'] );
3134 3170
 	} elseif ( $meta && 'video' === $type ) {
3135
-		if ( isset( $meta['width'] ) )
3136
-			$response['width'] = (int) $meta['width'];
3137
-		if ( isset( $meta['height'] ) )
3138
-			$response['height'] = (int) $meta['height'];
3171
+		if ( isset( $meta['width'] ) ) {
3172
+					$response['width'] = (int) $meta['width'];
3173
+		}
3174
+		if ( isset( $meta['height'] ) ) {
3175
+					$response['height'] = (int) $meta['height'];
3176
+		}
3139 3177
 	}
3140 3178
 
3141 3179
 	if ( $meta && ( 'audio' === $type || 'video' === $type ) ) {
3142
-		if ( isset( $meta['length_formatted'] ) )
3143
-			$response['fileLength'] = $meta['length_formatted'];
3180
+		if ( isset( $meta['length_formatted'] ) ) {
3181
+					$response['fileLength'] = $meta['length_formatted'];
3182
+		}
3144 3183
 
3145 3184
 		$response['meta'] = array();
3146 3185
 		foreach ( wp_get_attachment_id3_keys( $attachment, 'js' ) as $key => $label ) {
@@ -3166,8 +3205,9 @@  discard block
 block discarded – undo
3166 3205
 		}
3167 3206
 	}
3168 3207
 
3169
-	if ( function_exists('get_compat_media_markup') )
3170
-		$response['compat'] = get_compat_media_markup( $attachment->ID, array( 'in_modal' => true ) );
3208
+	if ( function_exists('get_compat_media_markup') ) {
3209
+			$response['compat'] = get_compat_media_markup( $attachment->ID, array( 'in_modal' => true ) );
3210
+	}
3171 3211
 
3172 3212
 	/**
3173 3213
 	 * Filter the attachment data prepared for JavaScript.
@@ -3199,8 +3239,9 @@  discard block
 block discarded – undo
3199 3239
  */
3200 3240
 function wp_enqueue_media( $args = array() ) {
3201 3241
 	// Enqueue me just once per page, please.
3202
-	if ( did_action( 'wp_enqueue_media' ) )
3203
-		return;
3242
+	if ( did_action( 'wp_enqueue_media' ) ) {
3243
+			return;
3244
+	}
3204 3245
 
3205 3246
 	global $content_width, $wpdb, $wp_locale;
3206 3247
 
@@ -3499,8 +3540,9 @@  discard block
 block discarded – undo
3499 3540
  * @return array Found attachments.
3500 3541
  */
3501 3542
 function get_attached_media( $type, $post = 0 ) {
3502
-	if ( ! $post = get_post( $post ) )
3503
-		return array();
3543
+	if ( ! $post = get_post( $post ) ) {
3544
+			return array();
3545
+	}
3504 3546
 
3505 3547
 	$args = array(
3506 3548
 		'post_parent' => $post->ID,
@@ -3588,11 +3630,13 @@  discard block
 block discarded – undo
3588 3630
  *               from the expanded shortcode.
3589 3631
  */
3590 3632
 function get_post_galleries( $post, $html = true ) {
3591
-	if ( ! $post = get_post( $post ) )
3592
-		return array();
3633
+	if ( ! $post = get_post( $post ) ) {
3634
+			return array();
3635
+	}
3593 3636
 
3594
-	if ( ! has_shortcode( $post->post_content, 'gallery' ) )
3595
-		return array();
3637
+	if ( ! has_shortcode( $post->post_content, 'gallery' ) ) {
3638
+			return array();
3639
+	}
3596 3640
 
3597 3641
 	$galleries = array();
3598 3642
 	if ( preg_match_all( '/' . get_shortcode_regex() . '/s', $post->post_content, $matches, PREG_SET_ORDER ) ) {
@@ -3606,8 +3650,9 @@  discard block
 block discarded – undo
3606 3650
 				} else {
3607 3651
 					preg_match_all( '#src=([\'"])(.+?)\1#is', $gallery, $src, PREG_SET_ORDER );
3608 3652
 					if ( ! empty( $src ) ) {
3609
-						foreach ( $src as $s )
3610
-							$srcs[] = $s[2];
3653
+						foreach ( $src as $s ) {
3654
+													$srcs[] = $s[2];
3655
+						}
3611 3656
 					}
3612 3657
 
3613 3658
 					$data = shortcode_parse_atts( $shortcode[3] );
Please login to merge, or discard this patch.
src/wp-includes/option.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1071,7 +1071,7 @@
 block discarded – undo
1071 1071
  * @param int      $network_id ID of the network. Can be null to default to the current network ID.
1072 1072
  * @param string   $option     Name of option to retrieve. Expected to not be SQL-escaped.
1073 1073
  * @param mixed    $default    Optional. Value to return if the option doesn't exist. Default false.
1074
- * @return mixed Value set for the option.
1074
+ * @return string Value set for the option.
1075 1075
  */
1076 1076
 function get_network_option( $network_id, $option, $default = false ) {
1077 1077
 	global $wpdb, $current_site;
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
- * Option API
4
- *
5
- * @package WordPress
6
- * @subpackage Option
7
- */
3
+	 * Option API
4
+	 *
5
+	 * @package WordPress
6
+	 * @subpackage Option
7
+	 */
8 8
 
9 9
 /**
10 10
  * Retrieve option value based on name of option.
Please login to merge, or discard this patch.
Spacing   +354 added lines, -354 removed lines patch added patch discarded remove patch
@@ -27,11 +27,11 @@  discard block
 block discarded – undo
27 27
  * @param mixed  $default Optional. Default value to return if the option does not exist.
28 28
  * @return mixed Value set for the option.
29 29
  */
30
-function get_option( $option, $default = false ) {
30
+function get_option($option, $default = false) {
31 31
 	global $wpdb;
32 32
 
33
-	$option = trim( $option );
34
-	if ( empty( $option ) )
33
+	$option = trim($option);
34
+	if (empty($option))
35 35
 		return false;
36 36
 
37 37
 	/**
@@ -49,17 +49,17 @@  discard block
 block discarded – undo
49 49
 	 *                               Default false to skip it.
50 50
 	 * @param string     $option     Option name.
51 51
 	 */
52
-	$pre = apply_filters( 'pre_option_' . $option, false, $option );
53
-	if ( false !== $pre )
52
+	$pre = apply_filters('pre_option_'.$option, false, $option);
53
+	if (false !== $pre)
54 54
 		return $pre;
55 55
 
56
-	if ( defined( 'WP_SETUP_CONFIG' ) )
56
+	if (defined('WP_SETUP_CONFIG'))
57 57
 		return false;
58 58
 
59
-	if ( ! wp_installing() ) {
59
+	if ( ! wp_installing()) {
60 60
 		// prevent non-existent options from triggering multiple queries
61
-		$notoptions = wp_cache_get( 'notoptions', 'options' );
62
-		if ( isset( $notoptions[ $option ] ) ) {
61
+		$notoptions = wp_cache_get('notoptions', 'options');
62
+		if (isset($notoptions[$option])) {
63 63
 			/**
64 64
 			 * Filter the default value for an option.
65 65
 			 *
@@ -72,53 +72,53 @@  discard block
 block discarded – undo
72 72
 			 *                        in the database.
73 73
 			 * @param string $option  Option name.
74 74
 			 */
75
-			return apply_filters( 'default_option_' . $option, $default, $option );
75
+			return apply_filters('default_option_'.$option, $default, $option);
76 76
 		}
77 77
 
78 78
 		$alloptions = wp_load_alloptions();
79 79
 
80
-		if ( isset( $alloptions[$option] ) ) {
80
+		if (isset($alloptions[$option])) {
81 81
 			$value = $alloptions[$option];
82 82
 		} else {
83
-			$value = wp_cache_get( $option, 'options' );
83
+			$value = wp_cache_get($option, 'options');
84 84
 
85
-			if ( false === $value ) {
86
-				$row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", $option ) );
85
+			if (false === $value) {
86
+				$row = $wpdb->get_row($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", $option));
87 87
 
88 88
 				// Has to be get_row instead of get_var because of funkiness with 0, false, null values
89
-				if ( is_object( $row ) ) {
89
+				if (is_object($row)) {
90 90
 					$value = $row->option_value;
91
-					wp_cache_add( $option, $value, 'options' );
91
+					wp_cache_add($option, $value, 'options');
92 92
 				} else { // option does not exist, so we must cache its non-existence
93
-					if ( ! is_array( $notoptions ) ) {
93
+					if ( ! is_array($notoptions)) {
94 94
 						 $notoptions = array();
95 95
 					}
96 96
 					$notoptions[$option] = true;
97
-					wp_cache_set( 'notoptions', $notoptions, 'options' );
97
+					wp_cache_set('notoptions', $notoptions, 'options');
98 98
 
99 99
 					/** This filter is documented in wp-includes/option.php */
100
-					return apply_filters( 'default_option_' . $option, $default, $option );
100
+					return apply_filters('default_option_'.$option, $default, $option);
101 101
 				}
102 102
 			}
103 103
 		}
104 104
 	} else {
105 105
 		$suppress = $wpdb->suppress_errors();
106
-		$row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", $option ) );
107
-		$wpdb->suppress_errors( $suppress );
108
-		if ( is_object( $row ) ) {
106
+		$row = $wpdb->get_row($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", $option));
107
+		$wpdb->suppress_errors($suppress);
108
+		if (is_object($row)) {
109 109
 			$value = $row->option_value;
110 110
 		} else {
111 111
 			/** This filter is documented in wp-includes/option.php */
112
-			return apply_filters( 'default_option_' . $option, $default, $option );
112
+			return apply_filters('default_option_'.$option, $default, $option);
113 113
 		}
114 114
 	}
115 115
 
116 116
 	// If home is not set use siteurl.
117
-	if ( 'home' == $option && '' == $value )
118
-		return get_option( 'siteurl' );
117
+	if ('home' == $option && '' == $value)
118
+		return get_option('siteurl');
119 119
 
120
-	if ( in_array( $option, array('siteurl', 'home', 'category_base', 'tag_base') ) )
121
-		$value = untrailingslashit( $value );
120
+	if (in_array($option, array('siteurl', 'home', 'category_base', 'tag_base')))
121
+		$value = untrailingslashit($value);
122 122
 
123 123
 	/**
124 124
 	 * Filter the value of an existing option.
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 *                       unserialized prior to being returned.
134 134
 	 * @param string $option Option name.
135 135
 	 */
136
-	return apply_filters( 'option_' . $option, maybe_unserialize( $value ), $option );
136
+	return apply_filters('option_'.$option, maybe_unserialize($value), $option);
137 137
 }
138 138
 
139 139
 /**
@@ -146,9 +146,9 @@  discard block
 block discarded – undo
146 146
  *
147 147
  * @param string $option Option name.
148 148
  */
149
-function wp_protect_special_option( $option ) {
150
-	if ( 'alloptions' === $option || 'notoptions' === $option )
151
-		wp_die( sprintf( __( '%s is a protected WP option and may not be modified' ), esc_html( $option ) ) );
149
+function wp_protect_special_option($option) {
150
+	if ('alloptions' === $option || 'notoptions' === $option)
151
+		wp_die(sprintf(__('%s is a protected WP option and may not be modified'), esc_html($option)));
152 152
 }
153 153
 
154 154
 /**
@@ -158,8 +158,8 @@  discard block
 block discarded – undo
158 158
  *
159 159
  * @param string $option Option name.
160 160
  */
161
-function form_option( $option ) {
162
-	echo esc_attr( get_option( $option ) );
161
+function form_option($option) {
162
+	echo esc_attr(get_option($option));
163 163
 }
164 164
 
165 165
 /**
@@ -174,22 +174,22 @@  discard block
 block discarded – undo
174 174
 function wp_load_alloptions() {
175 175
 	global $wpdb;
176 176
 
177
-	if ( ! wp_installing() || ! is_multisite() )
178
-		$alloptions = wp_cache_get( 'alloptions', 'options' );
177
+	if ( ! wp_installing() || ! is_multisite())
178
+		$alloptions = wp_cache_get('alloptions', 'options');
179 179
 	else
180 180
 		$alloptions = false;
181 181
 
182
-	if ( !$alloptions ) {
182
+	if ( ! $alloptions) {
183 183
 		$suppress = $wpdb->suppress_errors();
184
-		if ( !$alloptions_db = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options WHERE autoload = 'yes'" ) )
185
-			$alloptions_db = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options" );
184
+		if ( ! $alloptions_db = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options WHERE autoload = 'yes'"))
185
+			$alloptions_db = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options");
186 186
 		$wpdb->suppress_errors($suppress);
187 187
 		$alloptions = array();
188
-		foreach ( (array) $alloptions_db as $o ) {
188
+		foreach ((array) $alloptions_db as $o) {
189 189
 			$alloptions[$o->option_name] = $o->option_value;
190 190
 		}
191
-		if ( ! wp_installing() || ! is_multisite() )
192
-			wp_cache_add( 'alloptions', $alloptions, 'options' );
191
+		if ( ! wp_installing() || ! is_multisite())
192
+			wp_cache_add('alloptions', $alloptions, 'options');
193 193
 	}
194 194
 
195 195
 	return $alloptions;
@@ -204,26 +204,26 @@  discard block
 block discarded – undo
204 204
  *
205 205
  * @param int $site_id Optional site ID for which to query the options. Defaults to the current site.
206 206
  */
207
-function wp_load_core_site_options( $site_id = null ) {
207
+function wp_load_core_site_options($site_id = null) {
208 208
 	global $wpdb;
209 209
 
210
-	if ( ! is_multisite() || wp_using_ext_object_cache() || wp_installing() )
210
+	if ( ! is_multisite() || wp_using_ext_object_cache() || wp_installing())
211 211
 		return;
212 212
 
213
-	if ( empty($site_id) )
213
+	if (empty($site_id))
214 214
 		$site_id = $wpdb->siteid;
215 215
 
216
-	$core_options = array('site_name', 'siteurl', 'active_sitewide_plugins', '_site_transient_timeout_theme_roots', '_site_transient_theme_roots', 'site_admins', 'can_compress_scripts', 'global_terms_enabled', 'ms_files_rewriting' );
216
+	$core_options = array('site_name', 'siteurl', 'active_sitewide_plugins', '_site_transient_timeout_theme_roots', '_site_transient_theme_roots', 'site_admins', 'can_compress_scripts', 'global_terms_enabled', 'ms_files_rewriting');
217 217
 
218
-	$core_options_in = "'" . implode("', '", $core_options) . "'";
219
-	$options = $wpdb->get_results( $wpdb->prepare("SELECT meta_key, meta_value FROM $wpdb->sitemeta WHERE meta_key IN ($core_options_in) AND site_id = %d", $site_id) );
218
+	$core_options_in = "'".implode("', '", $core_options)."'";
219
+	$options = $wpdb->get_results($wpdb->prepare("SELECT meta_key, meta_value FROM $wpdb->sitemeta WHERE meta_key IN ($core_options_in) AND site_id = %d", $site_id));
220 220
 
221
-	foreach ( $options as $option ) {
221
+	foreach ($options as $option) {
222 222
 		$key = $option->meta_key;
223 223
 		$cache_key = "{$site_id}:$key";
224
-		$option->meta_value = maybe_unserialize( $option->meta_value );
224
+		$option->meta_value = maybe_unserialize($option->meta_value);
225 225
 
226
-		wp_cache_set( $cache_key, $option->meta_value, 'site-options' );
226
+		wp_cache_set($cache_key, $option->meta_value, 'site-options');
227 227
 	}
228 228
 }
229 229
 
@@ -250,20 +250,20 @@  discard block
 block discarded – undo
250 250
  *                              the default value is 'yes'. Default null.
251 251
  * @return bool False if value was not updated and true if value was updated.
252 252
  */
253
-function update_option( $option, $value, $autoload = null ) {
253
+function update_option($option, $value, $autoload = null) {
254 254
 	global $wpdb;
255 255
 
256 256
 	$option = trim($option);
257
-	if ( empty($option) )
257
+	if (empty($option))
258 258
 		return false;
259 259
 
260
-	wp_protect_special_option( $option );
260
+	wp_protect_special_option($option);
261 261
 
262
-	if ( is_object( $value ) )
262
+	if (is_object($value))
263 263
 		$value = clone $value;
264 264
 
265
-	$value = sanitize_option( $option, $value );
266
-	$old_value = get_option( $option );
265
+	$value = sanitize_option($option, $value);
266
+	$old_value = get_option($option);
267 267
 
268 268
 	/**
269 269
 	 * Filter a specific option before its value is (maybe) serialized and updated.
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 	 * @param mixed  $old_value The old option value.
278 278
 	 * @param string $option    Option name.
279 279
 	 */
280
-	$value = apply_filters( 'pre_update_option_' . $option, $value, $old_value, $option );
280
+	$value = apply_filters('pre_update_option_'.$option, $value, $old_value, $option);
281 281
 
282 282
 	/**
283 283
 	 * Filter an option before its value is (maybe) serialized and updated.
@@ -288,23 +288,23 @@  discard block
 block discarded – undo
288 288
 	 * @param string $option    Name of the option.
289 289
 	 * @param mixed  $old_value The old option value.
290 290
 	 */
291
-	$value = apply_filters( 'pre_update_option', $value, $option, $old_value );
291
+	$value = apply_filters('pre_update_option', $value, $option, $old_value);
292 292
 
293 293
 	// If the new and old values are the same, no need to update.
294
-	if ( $value === $old_value )
294
+	if ($value === $old_value)
295 295
 		return false;
296 296
 
297 297
 	/** This filter is documented in wp-includes/option.php */
298
-	if ( apply_filters( 'default_option_' . $option, false ) === $old_value ) {
298
+	if (apply_filters('default_option_'.$option, false) === $old_value) {
299 299
 		// Default setting for new options is 'yes'.
300
-		if ( null === $autoload ) {
300
+		if (null === $autoload) {
301 301
 			$autoload = 'yes';
302 302
 		}
303 303
 
304
-		return add_option( $option, $value, '', $autoload );
304
+		return add_option($option, $value, '', $autoload);
305 305
 	}
306 306
 
307
-	$serialized_value = maybe_serialize( $value );
307
+	$serialized_value = maybe_serialize($value);
308 308
 
309 309
 	/**
310 310
 	 * Fires immediately before an option value is updated.
@@ -315,33 +315,33 @@  discard block
 block discarded – undo
315 315
 	 * @param mixed  $old_value The old option value.
316 316
 	 * @param mixed  $value     The new option value.
317 317
 	 */
318
-	do_action( 'update_option', $option, $old_value, $value );
318
+	do_action('update_option', $option, $old_value, $value);
319 319
 
320 320
 	$update_args = array(
321 321
 		'option_value' => $serialized_value,
322 322
 	);
323 323
 
324
-	if ( null !== $autoload ) {
325
-		$update_args['autoload'] = ( 'no' === $autoload || false === $autoload ) ? 'no' : 'yes';
324
+	if (null !== $autoload) {
325
+		$update_args['autoload'] = ('no' === $autoload || false === $autoload) ? 'no' : 'yes';
326 326
 	}
327 327
 
328
-	$result = $wpdb->update( $wpdb->options, $update_args, array( 'option_name' => $option ) );
329
-	if ( ! $result )
328
+	$result = $wpdb->update($wpdb->options, $update_args, array('option_name' => $option));
329
+	if ( ! $result)
330 330
 		return false;
331 331
 
332
-	$notoptions = wp_cache_get( 'notoptions', 'options' );
333
-	if ( is_array( $notoptions ) && isset( $notoptions[$option] ) ) {
334
-		unset( $notoptions[$option] );
335
-		wp_cache_set( 'notoptions', $notoptions, 'options' );
332
+	$notoptions = wp_cache_get('notoptions', 'options');
333
+	if (is_array($notoptions) && isset($notoptions[$option])) {
334
+		unset($notoptions[$option]);
335
+		wp_cache_set('notoptions', $notoptions, 'options');
336 336
 	}
337 337
 
338
-	if ( ! wp_installing() ) {
338
+	if ( ! wp_installing()) {
339 339
 		$alloptions = wp_load_alloptions();
340
-		if ( isset( $alloptions[$option] ) ) {
341
-			$alloptions[ $option ] = $serialized_value;
342
-			wp_cache_set( 'alloptions', $alloptions, 'options' );
340
+		if (isset($alloptions[$option])) {
341
+			$alloptions[$option] = $serialized_value;
342
+			wp_cache_set('alloptions', $alloptions, 'options');
343 343
 		} else {
344
-			wp_cache_set( $option, $serialized_value, 'options' );
344
+			wp_cache_set($option, $serialized_value, 'options');
345 345
 		}
346 346
 	}
347 347
 
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
 	 * @param mixed  $value     The new option value.
358 358
 	 * @param string $option    Option name.
359 359
 	 */
360
-	do_action( "update_option_{$option}", $old_value, $value, $option );
360
+	do_action("update_option_{$option}", $old_value, $value, $option);
361 361
 
362 362
 	/**
363 363
 	 * Fires after the value of an option has been successfully updated.
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 	 * @param mixed  $old_value The old option value.
369 369
 	 * @param mixed  $value     The new option value.
370 370
 	 */
371
-	do_action( 'updated_option', $option, $old_value, $value );
371
+	do_action('updated_option', $option, $old_value, $value);
372 372
 	return true;
373 373
 }
374 374
 
@@ -395,32 +395,32 @@  discard block
 block discarded – undo
395 395
  *                                    Default is enabled. Accepts 'no' to disable for legacy reasons.
396 396
  * @return bool False if option was not added and true if option was added.
397 397
  */
398
-function add_option( $option, $value = '', $deprecated = '', $autoload = 'yes' ) {
398
+function add_option($option, $value = '', $deprecated = '', $autoload = 'yes') {
399 399
 	global $wpdb;
400 400
 
401
-	if ( !empty( $deprecated ) )
402
-		_deprecated_argument( __FUNCTION__, '2.3' );
401
+	if ( ! empty($deprecated))
402
+		_deprecated_argument(__FUNCTION__, '2.3');
403 403
 
404 404
 	$option = trim($option);
405
-	if ( empty($option) )
405
+	if (empty($option))
406 406
 		return false;
407 407
 
408
-	wp_protect_special_option( $option );
408
+	wp_protect_special_option($option);
409 409
 
410
-	if ( is_object($value) )
410
+	if (is_object($value))
411 411
 		$value = clone $value;
412 412
 
413
-	$value = sanitize_option( $option, $value );
413
+	$value = sanitize_option($option, $value);
414 414
 
415 415
 	// Make sure the option doesn't already exist. We can check the 'notoptions' cache before we ask for a db query
416
-	$notoptions = wp_cache_get( 'notoptions', 'options' );
417
-	if ( !is_array( $notoptions ) || !isset( $notoptions[$option] ) )
416
+	$notoptions = wp_cache_get('notoptions', 'options');
417
+	if ( ! is_array($notoptions) || ! isset($notoptions[$option]))
418 418
 		/** This filter is documented in wp-includes/option.php */
419
-		if ( apply_filters( 'default_option_' . $option, false ) !== get_option( $option ) )
419
+		if (apply_filters('default_option_'.$option, false) !== get_option($option))
420 420
 			return false;
421 421
 
422
-	$serialized_value = maybe_serialize( $value );
423
-	$autoload = ( 'no' === $autoload || false === $autoload ) ? 'no' : 'yes';
422
+	$serialized_value = maybe_serialize($value);
423
+	$autoload = ('no' === $autoload || false === $autoload) ? 'no' : 'yes';
424 424
 
425 425
 	/**
426 426
 	 * Fires before an option is added.
@@ -430,27 +430,27 @@  discard block
 block discarded – undo
430 430
 	 * @param string $option Name of the option to add.
431 431
 	 * @param mixed  $value  Value of the option.
432 432
 	 */
433
-	do_action( 'add_option', $option, $value );
433
+	do_action('add_option', $option, $value);
434 434
 
435
-	$result = $wpdb->query( $wpdb->prepare( "INSERT INTO `$wpdb->options` (`option_name`, `option_value`, `autoload`) VALUES (%s, %s, %s) ON DUPLICATE KEY UPDATE `option_name` = VALUES(`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES(`autoload`)", $option, $serialized_value, $autoload ) );
436
-	if ( ! $result )
435
+	$result = $wpdb->query($wpdb->prepare("INSERT INTO `$wpdb->options` (`option_name`, `option_value`, `autoload`) VALUES (%s, %s, %s) ON DUPLICATE KEY UPDATE `option_name` = VALUES(`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES(`autoload`)", $option, $serialized_value, $autoload));
436
+	if ( ! $result)
437 437
 		return false;
438 438
 
439
-	if ( ! wp_installing() ) {
440
-		if ( 'yes' == $autoload ) {
439
+	if ( ! wp_installing()) {
440
+		if ('yes' == $autoload) {
441 441
 			$alloptions = wp_load_alloptions();
442
-			$alloptions[ $option ] = $serialized_value;
443
-			wp_cache_set( 'alloptions', $alloptions, 'options' );
442
+			$alloptions[$option] = $serialized_value;
443
+			wp_cache_set('alloptions', $alloptions, 'options');
444 444
 		} else {
445
-			wp_cache_set( $option, $serialized_value, 'options' );
445
+			wp_cache_set($option, $serialized_value, 'options');
446 446
 		}
447 447
 	}
448 448
 
449 449
 	// This option exists now
450
-	$notoptions = wp_cache_get( 'notoptions', 'options' ); // yes, again... we need it to be fresh
451
-	if ( is_array( $notoptions ) && isset( $notoptions[$option] ) ) {
452
-		unset( $notoptions[$option] );
453
-		wp_cache_set( 'notoptions', $notoptions, 'options' );
450
+	$notoptions = wp_cache_get('notoptions', 'options'); // yes, again... we need it to be fresh
451
+	if (is_array($notoptions) && isset($notoptions[$option])) {
452
+		unset($notoptions[$option]);
453
+		wp_cache_set('notoptions', $notoptions, 'options');
454 454
 	}
455 455
 
456 456
 	/**
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
 	 * @param string $option Name of the option to add.
465 465
 	 * @param mixed  $value  Value of the option.
466 466
 	 */
467
-	do_action( "add_option_{$option}", $option, $value );
467
+	do_action("add_option_{$option}", $option, $value);
468 468
 
469 469
 	/**
470 470
 	 * Fires after an option has been added.
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
 	 * @param string $option Name of the added option.
475 475
 	 * @param mixed  $value  Value of the option.
476 476
 	 */
477
-	do_action( 'added_option', $option, $value );
477
+	do_action('added_option', $option, $value);
478 478
 	return true;
479 479
 }
480 480
 
@@ -488,18 +488,18 @@  discard block
 block discarded – undo
488 488
  * @param string $option Name of option to remove. Expected to not be SQL-escaped.
489 489
  * @return bool True, if option is successfully deleted. False on failure.
490 490
  */
491
-function delete_option( $option ) {
491
+function delete_option($option) {
492 492
 	global $wpdb;
493 493
 
494
-	$option = trim( $option );
495
-	if ( empty( $option ) )
494
+	$option = trim($option);
495
+	if (empty($option))
496 496
 		return false;
497 497
 
498
-	wp_protect_special_option( $option );
498
+	wp_protect_special_option($option);
499 499
 
500 500
 	// Get the ID, if no ID then return
501
-	$row = $wpdb->get_row( $wpdb->prepare( "SELECT autoload FROM $wpdb->options WHERE option_name = %s", $option ) );
502
-	if ( is_null( $row ) )
501
+	$row = $wpdb->get_row($wpdb->prepare("SELECT autoload FROM $wpdb->options WHERE option_name = %s", $option));
502
+	if (is_null($row))
503 503
 		return false;
504 504
 
505 505
 	/**
@@ -509,21 +509,21 @@  discard block
 block discarded – undo
509 509
 	 *
510 510
 	 * @param string $option Name of the option to delete.
511 511
 	 */
512
-	do_action( 'delete_option', $option );
512
+	do_action('delete_option', $option);
513 513
 
514
-	$result = $wpdb->delete( $wpdb->options, array( 'option_name' => $option ) );
515
-	if ( ! wp_installing() ) {
516
-		if ( 'yes' == $row->autoload ) {
514
+	$result = $wpdb->delete($wpdb->options, array('option_name' => $option));
515
+	if ( ! wp_installing()) {
516
+		if ('yes' == $row->autoload) {
517 517
 			$alloptions = wp_load_alloptions();
518
-			if ( is_array( $alloptions ) && isset( $alloptions[$option] ) ) {
519
-				unset( $alloptions[$option] );
520
-				wp_cache_set( 'alloptions', $alloptions, 'options' );
518
+			if (is_array($alloptions) && isset($alloptions[$option])) {
519
+				unset($alloptions[$option]);
520
+				wp_cache_set('alloptions', $alloptions, 'options');
521 521
 			}
522 522
 		} else {
523
-			wp_cache_delete( $option, 'options' );
523
+			wp_cache_delete($option, 'options');
524 524
 		}
525 525
 	}
526
-	if ( $result ) {
526
+	if ($result) {
527 527
 
528 528
 		/**
529 529
 		 * Fires after a specific option has been deleted.
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
 		 *
535 535
 		 * @param string $option Name of the deleted option.
536 536
 		 */
537
-		do_action( "delete_option_$option", $option );
537
+		do_action("delete_option_$option", $option);
538 538
 
539 539
 		/**
540 540
 		 * Fires after an option has been deleted.
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
 		 *
544 544
 		 * @param string $option Name of the deleted option.
545 545
 		 */
546
-		do_action( 'deleted_option', $option );
546
+		do_action('deleted_option', $option);
547 547
 		return true;
548 548
 	}
549 549
 	return false;
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
  * @param string $transient Transient name. Expected to not be SQL-escaped.
558 558
  * @return bool true if successful, false otherwise
559 559
  */
560
-function delete_transient( $transient ) {
560
+function delete_transient($transient) {
561 561
 
562 562
 	/**
563 563
 	 * Fires immediately before a specific transient is deleted.
@@ -568,19 +568,19 @@  discard block
 block discarded – undo
568 568
 	 *
569 569
 	 * @param string $transient Transient name.
570 570
 	 */
571
-	do_action( 'delete_transient_' . $transient, $transient );
571
+	do_action('delete_transient_'.$transient, $transient);
572 572
 
573
-	if ( wp_using_ext_object_cache() ) {
574
-		$result = wp_cache_delete( $transient, 'transient' );
573
+	if (wp_using_ext_object_cache()) {
574
+		$result = wp_cache_delete($transient, 'transient');
575 575
 	} else {
576
-		$option_timeout = '_transient_timeout_' . $transient;
577
-		$option = '_transient_' . $transient;
578
-		$result = delete_option( $option );
579
-		if ( $result )
580
-			delete_option( $option_timeout );
576
+		$option_timeout = '_transient_timeout_'.$transient;
577
+		$option = '_transient_'.$transient;
578
+		$result = delete_option($option);
579
+		if ($result)
580
+			delete_option($option_timeout);
581 581
 	}
582 582
 
583
-	if ( $result ) {
583
+	if ($result) {
584 584
 
585 585
 		/**
586 586
 		 * Fires after a transient is deleted.
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
 		 *
590 590
 		 * @param string $transient Deleted transient name.
591 591
 		 */
592
-		do_action( 'deleted_transient', $transient );
592
+		do_action('deleted_transient', $transient);
593 593
 	}
594 594
 
595 595
 	return $result;
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
  * @param string $transient Transient name. Expected to not be SQL-escaped.
607 607
  * @return mixed Value of transient.
608 608
  */
609
-function get_transient( $transient ) {
609
+function get_transient($transient) {
610 610
 
611 611
 	/**
612 612
 	 * Filter the value of an existing transient.
@@ -624,30 +624,30 @@  discard block
 block discarded – undo
624 624
 	 *                              of the transient, and return the returned value.
625 625
 	 * @param string $transient     Transient name.
626 626
 	 */
627
-	$pre = apply_filters( 'pre_transient_' . $transient, false, $transient );
628
-	if ( false !== $pre )
627
+	$pre = apply_filters('pre_transient_'.$transient, false, $transient);
628
+	if (false !== $pre)
629 629
 		return $pre;
630 630
 
631
-	if ( wp_using_ext_object_cache() ) {
632
-		$value = wp_cache_get( $transient, 'transient' );
631
+	if (wp_using_ext_object_cache()) {
632
+		$value = wp_cache_get($transient, 'transient');
633 633
 	} else {
634
-		$transient_option = '_transient_' . $transient;
635
-		if ( ! wp_installing() ) {
634
+		$transient_option = '_transient_'.$transient;
635
+		if ( ! wp_installing()) {
636 636
 			// If option is not in alloptions, it is not autoloaded and thus has a timeout
637 637
 			$alloptions = wp_load_alloptions();
638
-			if ( !isset( $alloptions[$transient_option] ) ) {
639
-				$transient_timeout = '_transient_timeout_' . $transient;
640
-				$timeout = get_option( $transient_timeout );
641
-				if ( false !== $timeout && $timeout < time() ) {
642
-					delete_option( $transient_option  );
643
-					delete_option( $transient_timeout );
638
+			if ( ! isset($alloptions[$transient_option])) {
639
+				$transient_timeout = '_transient_timeout_'.$transient;
640
+				$timeout = get_option($transient_timeout);
641
+				if (false !== $timeout && $timeout < time()) {
642
+					delete_option($transient_option);
643
+					delete_option($transient_timeout);
644 644
 					$value = false;
645 645
 				}
646 646
 			}
647 647
 		}
648 648
 
649
-		if ( ! isset( $value ) )
650
-			$value = get_option( $transient_option );
649
+		if ( ! isset($value))
650
+			$value = get_option($transient_option);
651 651
 	}
652 652
 
653 653
 	/**
@@ -661,7 +661,7 @@  discard block
 block discarded – undo
661 661
 	 * @param mixed  $value     Value of transient.
662 662
 	 * @param string $transient Transient name.
663 663
 	 */
664
-	return apply_filters( 'transient_' . $transient, $value, $transient );
664
+	return apply_filters('transient_'.$transient, $value, $transient);
665 665
 }
666 666
 
667 667
 /**
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
  * @param int    $expiration Optional. Time until expiration in seconds. Default 0 (no expiration).
680 680
  * @return bool False if value was not set and true if value was set.
681 681
  */
682
-function set_transient( $transient, $value, $expiration = 0 ) {
682
+function set_transient($transient, $value, $expiration = 0) {
683 683
 
684 684
 	$expiration = (int) $expiration;
685 685
 
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
 	 * @param int    $expiration Time until expiration in seconds.
697 697
 	 * @param string $transient  Transient name.
698 698
 	 */
699
-	$value = apply_filters( 'pre_set_transient_' . $transient, $value, $expiration, $transient );
699
+	$value = apply_filters('pre_set_transient_'.$transient, $value, $expiration, $transient);
700 700
 
701 701
 	/**
702 702
 	 * Filter the expiration for a transient before its value is set.
@@ -709,41 +709,41 @@  discard block
 block discarded – undo
709 709
 	 * @param mixed  $value      New value of transient.
710 710
 	 * @param string $transient  Transient name.
711 711
 	 */
712
-	$expiration = apply_filters( 'expiration_of_transient_' . $transient, $expiration, $value, $transient );
712
+	$expiration = apply_filters('expiration_of_transient_'.$transient, $expiration, $value, $transient);
713 713
 
714
-	if ( wp_using_ext_object_cache() ) {
715
-		$result = wp_cache_set( $transient, $value, 'transient', $expiration );
714
+	if (wp_using_ext_object_cache()) {
715
+		$result = wp_cache_set($transient, $value, 'transient', $expiration);
716 716
 	} else {
717
-		$transient_timeout = '_transient_timeout_' . $transient;
718
-		$transient_option = '_transient_' . $transient;
719
-		if ( false === get_option( $transient_option ) ) {
717
+		$transient_timeout = '_transient_timeout_'.$transient;
718
+		$transient_option = '_transient_'.$transient;
719
+		if (false === get_option($transient_option)) {
720 720
 			$autoload = 'yes';
721
-			if ( $expiration ) {
721
+			if ($expiration) {
722 722
 				$autoload = 'no';
723
-				add_option( $transient_timeout, time() + $expiration, '', 'no' );
723
+				add_option($transient_timeout, time() + $expiration, '', 'no');
724 724
 			}
725
-			$result = add_option( $transient_option, $value, '', $autoload );
725
+			$result = add_option($transient_option, $value, '', $autoload);
726 726
 		} else {
727 727
 			// If expiration is requested, but the transient has no timeout option,
728 728
 			// delete, then re-create transient rather than update.
729 729
 			$update = true;
730
-			if ( $expiration ) {
731
-				if ( false === get_option( $transient_timeout ) ) {
732
-					delete_option( $transient_option );
733
-					add_option( $transient_timeout, time() + $expiration, '', 'no' );
734
-					$result = add_option( $transient_option, $value, '', 'no' );
730
+			if ($expiration) {
731
+				if (false === get_option($transient_timeout)) {
732
+					delete_option($transient_option);
733
+					add_option($transient_timeout, time() + $expiration, '', 'no');
734
+					$result = add_option($transient_option, $value, '', 'no');
735 735
 					$update = false;
736 736
 				} else {
737
-					update_option( $transient_timeout, time() + $expiration );
737
+					update_option($transient_timeout, time() + $expiration);
738 738
 				}
739 739
 			}
740
-			if ( $update ) {
741
-				$result = update_option( $transient_option, $value );
740
+			if ($update) {
741
+				$result = update_option($transient_option, $value);
742 742
 			}
743 743
 		}
744 744
 	}
745 745
 
746
-	if ( $result ) {
746
+	if ($result) {
747 747
 
748 748
 		/**
749 749
 		 * Fires after the value for a specific transient has been set.
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
 		 * @param int    $expiration Time until expiration in seconds.
759 759
 		 * @param string $transient  The name of the transient.
760 760
 		 */
761
-		do_action( 'set_transient_' . $transient, $value, $expiration, $transient );
761
+		do_action('set_transient_'.$transient, $value, $expiration, $transient);
762 762
 
763 763
 		/**
764 764
 		 * Fires after the value for a transient has been set.
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
 		 * @param mixed  $value      Transient value.
771 771
 		 * @param int    $expiration Time until expiration in seconds.
772 772
 		 */
773
-		do_action( 'setted_transient', $transient, $value, $expiration );
773
+		do_action('setted_transient', $transient, $value, $expiration);
774 774
 	}
775 775
 	return $result;
776 776
 }
@@ -786,43 +786,43 @@  discard block
 block discarded – undo
786 786
  */
787 787
 function wp_user_settings() {
788 788
 
789
-	if ( ! is_admin() || defined( 'DOING_AJAX' ) ) {
789
+	if ( ! is_admin() || defined('DOING_AJAX')) {
790 790
 		return;
791 791
 	}
792 792
 
793
-	if ( ! $user_id = get_current_user_id() ) {
793
+	if ( ! $user_id = get_current_user_id()) {
794 794
 		return;
795 795
 	}
796 796
 
797
-	if ( is_super_admin() && ! is_user_member_of_blog() ) {
797
+	if (is_super_admin() && ! is_user_member_of_blog()) {
798 798
 		return;
799 799
 	}
800 800
 
801
-	$settings = (string) get_user_option( 'user-settings', $user_id );
801
+	$settings = (string) get_user_option('user-settings', $user_id);
802 802
 
803
-	if ( isset( $_COOKIE['wp-settings-' . $user_id] ) ) {
804
-		$cookie = preg_replace( '/[^A-Za-z0-9=&_]/', '', $_COOKIE['wp-settings-' . $user_id] );
803
+	if (isset($_COOKIE['wp-settings-'.$user_id])) {
804
+		$cookie = preg_replace('/[^A-Za-z0-9=&_]/', '', $_COOKIE['wp-settings-'.$user_id]);
805 805
 
806 806
 		// No change or both empty
807
-		if ( $cookie == $settings )
807
+		if ($cookie == $settings)
808 808
 			return;
809 809
 
810
-		$last_saved = (int) get_user_option( 'user-settings-time', $user_id );
811
-		$current = isset( $_COOKIE['wp-settings-time-' . $user_id]) ? preg_replace( '/[^0-9]/', '', $_COOKIE['wp-settings-time-' . $user_id] ) : 0;
810
+		$last_saved = (int) get_user_option('user-settings-time', $user_id);
811
+		$current = isset($_COOKIE['wp-settings-time-'.$user_id]) ? preg_replace('/[^0-9]/', '', $_COOKIE['wp-settings-time-'.$user_id]) : 0;
812 812
 
813 813
 		// The cookie is newer than the saved value. Update the user_option and leave the cookie as-is
814
-		if ( $current > $last_saved ) {
815
-			update_user_option( $user_id, 'user-settings', $cookie, false );
816
-			update_user_option( $user_id, 'user-settings-time', time() - 5, false );
814
+		if ($current > $last_saved) {
815
+			update_user_option($user_id, 'user-settings', $cookie, false);
816
+			update_user_option($user_id, 'user-settings-time', time() - 5, false);
817 817
 			return;
818 818
 		}
819 819
 	}
820 820
 
821 821
 	// The cookie is not set in the current browser or the saved value is newer.
822
-	$secure = ( 'https' === parse_url( admin_url(), PHP_URL_SCHEME ) );
823
-	setcookie( 'wp-settings-' . $user_id, $settings, time() + YEAR_IN_SECONDS, SITECOOKIEPATH, null, $secure );
824
-	setcookie( 'wp-settings-time-' . $user_id, time(), time() + YEAR_IN_SECONDS, SITECOOKIEPATH, null, $secure );
825
-	$_COOKIE['wp-settings-' . $user_id] = $settings;
822
+	$secure = ('https' === parse_url(admin_url(), PHP_URL_SCHEME));
823
+	setcookie('wp-settings-'.$user_id, $settings, time() + YEAR_IN_SECONDS, SITECOOKIEPATH, null, $secure);
824
+	setcookie('wp-settings-time-'.$user_id, time(), time() + YEAR_IN_SECONDS, SITECOOKIEPATH, null, $secure);
825
+	$_COOKIE['wp-settings-'.$user_id] = $settings;
826 826
 }
827 827
 
828 828
 /**
@@ -834,10 +834,10 @@  discard block
 block discarded – undo
834 834
  * @param string $default Optional default value to return when $name is not set.
835 835
  * @return mixed the last saved user setting or the default value/false if it doesn't exist.
836 836
  */
837
-function get_user_setting( $name, $default = false ) {
837
+function get_user_setting($name, $default = false) {
838 838
 	$all_user_settings = get_all_user_settings();
839 839
 
840
-	return isset( $all_user_settings[$name] ) ? $all_user_settings[$name] : $default;
840
+	return isset($all_user_settings[$name]) ? $all_user_settings[$name] : $default;
841 841
 }
842 842
 
843 843
 /**
@@ -852,15 +852,15 @@  discard block
 block discarded – undo
852 852
  * @param string $value The value for the setting.
853 853
  * @return bool|void true if set successfully/false if not.
854 854
  */
855
-function set_user_setting( $name, $value ) {
856
-	if ( headers_sent() ) {
855
+function set_user_setting($name, $value) {
856
+	if (headers_sent()) {
857 857
 		return false;
858 858
 	}
859 859
 
860 860
 	$all_user_settings = get_all_user_settings();
861 861
 	$all_user_settings[$name] = $value;
862 862
 
863
-	return wp_set_all_user_settings( $all_user_settings );
863
+	return wp_set_all_user_settings($all_user_settings);
864 864
 }
865 865
 
866 866
 /**
@@ -874,8 +874,8 @@  discard block
 block discarded – undo
874 874
  * @param string $names The name or array of names of the setting to be deleted.
875 875
  * @return bool|void true if deleted successfully/false if not.
876 876
  */
877
-function delete_user_setting( $names ) {
878
-	if ( headers_sent() ) {
877
+function delete_user_setting($names) {
878
+	if (headers_sent()) {
879 879
 		return false;
880 880
 	}
881 881
 
@@ -883,15 +883,15 @@  discard block
 block discarded – undo
883 883
 	$names = (array) $names;
884 884
 	$deleted = false;
885 885
 
886
-	foreach ( $names as $name ) {
887
-		if ( isset( $all_user_settings[$name] ) ) {
888
-			unset( $all_user_settings[$name] );
886
+	foreach ($names as $name) {
887
+		if (isset($all_user_settings[$name])) {
888
+			unset($all_user_settings[$name]);
889 889
 			$deleted = true;
890 890
 		}
891 891
 	}
892 892
 
893
-	if ( $deleted ) {
894
-		return wp_set_all_user_settings( $all_user_settings );
893
+	if ($deleted) {
894
+		return wp_set_all_user_settings($all_user_settings);
895 895
 	}
896 896
 
897 897
 	return false;
@@ -909,27 +909,27 @@  discard block
 block discarded – undo
909 909
 function get_all_user_settings() {
910 910
 	global $_updated_user_settings;
911 911
 
912
-	if ( ! $user_id = get_current_user_id() ) {
912
+	if ( ! $user_id = get_current_user_id()) {
913 913
 		return array();
914 914
 	}
915 915
 
916
-	if ( isset( $_updated_user_settings ) && is_array( $_updated_user_settings ) ) {
916
+	if (isset($_updated_user_settings) && is_array($_updated_user_settings)) {
917 917
 		return $_updated_user_settings;
918 918
 	}
919 919
 
920 920
 	$user_settings = array();
921 921
 
922
-	if ( isset( $_COOKIE['wp-settings-' . $user_id] ) ) {
923
-		$cookie = preg_replace( '/[^A-Za-z0-9=&_-]/', '', $_COOKIE['wp-settings-' . $user_id] );
922
+	if (isset($_COOKIE['wp-settings-'.$user_id])) {
923
+		$cookie = preg_replace('/[^A-Za-z0-9=&_-]/', '', $_COOKIE['wp-settings-'.$user_id]);
924 924
 
925
-		if ( strpos( $cookie, '=' ) ) { // '=' cannot be 1st char
926
-			parse_str( $cookie, $user_settings );
925
+		if (strpos($cookie, '=')) { // '=' cannot be 1st char
926
+			parse_str($cookie, $user_settings);
927 927
 		}
928 928
 	} else {
929
-		$option = get_user_option( 'user-settings', $user_id );
929
+		$option = get_user_option('user-settings', $user_id);
930 930
 
931
-		if ( $option && is_string( $option ) ) {
932
-			parse_str( $option, $user_settings );
931
+		if ($option && is_string($option)) {
932
+			parse_str($option, $user_settings);
933 933
 		}
934 934
 	}
935 935
 
@@ -947,32 +947,32 @@  discard block
 block discarded – undo
947 947
  * @param array $user_settings
948 948
  * @return bool|void
949 949
  */
950
-function wp_set_all_user_settings( $user_settings ) {
950
+function wp_set_all_user_settings($user_settings) {
951 951
 	global $_updated_user_settings;
952 952
 
953
-	if ( ! $user_id = get_current_user_id() ) {
953
+	if ( ! $user_id = get_current_user_id()) {
954 954
 		return false;
955 955
 	}
956 956
 
957
-	if ( is_super_admin() && ! is_user_member_of_blog() ) {
957
+	if (is_super_admin() && ! is_user_member_of_blog()) {
958 958
 		return;
959 959
 	}
960 960
 
961 961
 	$settings = '';
962
-	foreach ( $user_settings as $name => $value ) {
963
-		$_name = preg_replace( '/[^A-Za-z0-9_-]+/', '', $name );
964
-		$_value = preg_replace( '/[^A-Za-z0-9_-]+/', '', $value );
962
+	foreach ($user_settings as $name => $value) {
963
+		$_name = preg_replace('/[^A-Za-z0-9_-]+/', '', $name);
964
+		$_value = preg_replace('/[^A-Za-z0-9_-]+/', '', $value);
965 965
 
966
-		if ( ! empty( $_name ) ) {
967
-			$settings .= $_name . '=' . $_value . '&';
966
+		if ( ! empty($_name)) {
967
+			$settings .= $_name.'='.$_value.'&';
968 968
 		}
969 969
 	}
970 970
 
971
-	$settings = rtrim( $settings, '&' );
972
-	parse_str( $settings, $_updated_user_settings );
971
+	$settings = rtrim($settings, '&');
972
+	parse_str($settings, $_updated_user_settings);
973 973
 
974
-	update_user_option( $user_id, 'user-settings', $settings, false );
975
-	update_user_option( $user_id, 'user-settings-time', time(), false );
974
+	update_user_option($user_id, 'user-settings', $settings, false);
975
+	update_user_option($user_id, 'user-settings-time', time(), false);
976 976
 
977 977
 	return true;
978 978
 }
@@ -983,12 +983,12 @@  discard block
 block discarded – undo
983 983
  * @since 2.7.0
984 984
  */
985 985
 function delete_all_user_settings() {
986
-	if ( ! $user_id = get_current_user_id() ) {
986
+	if ( ! $user_id = get_current_user_id()) {
987 987
 		return;
988 988
 	}
989 989
 
990
-	update_user_option( $user_id, 'user-settings', '', false );
991
-	setcookie( 'wp-settings-' . $user_id, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH );
990
+	update_user_option($user_id, 'user-settings', '', false);
991
+	setcookie('wp-settings-'.$user_id, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH);
992 992
 }
993 993
 
994 994
 /**
@@ -1005,8 +1005,8 @@  discard block
 block discarded – undo
1005 1005
  * @param bool   $deprecated Whether to use cache. Multisite only. Always set to true.
1006 1006
  * @return mixed Value set for the option.
1007 1007
  */
1008
-function get_site_option( $option, $default = false, $deprecated = true ) {
1009
-	return get_network_option( null, $option, $default );
1008
+function get_site_option($option, $default = false, $deprecated = true) {
1009
+	return get_network_option(null, $option, $default);
1010 1010
 }
1011 1011
 
1012 1012
 /**
@@ -1023,8 +1023,8 @@  discard block
 block discarded – undo
1023 1023
  * @param mixed  $value  Option value, can be anything. Expected to not be SQL-escaped.
1024 1024
  * @return bool False if the option was not added. True if the option was added.
1025 1025
  */
1026
-function add_site_option( $option, $value ) {
1027
-	return add_network_option( null, $option, $value );
1026
+function add_site_option($option, $value) {
1027
+	return add_network_option(null, $option, $value);
1028 1028
 }
1029 1029
 
1030 1030
 /**
@@ -1038,8 +1038,8 @@  discard block
 block discarded – undo
1038 1038
  * @param string $option Name of option to remove. Expected to not be SQL-escaped.
1039 1039
  * @return bool True, if succeed. False, if failure.
1040 1040
  */
1041
-function delete_site_option( $option ) {
1042
-	return delete_network_option( null, $option );
1041
+function delete_site_option($option) {
1042
+	return delete_network_option(null, $option);
1043 1043
 }
1044 1044
 
1045 1045
 /**
@@ -1054,8 +1054,8 @@  discard block
 block discarded – undo
1054 1054
  * @param mixed  $value  Option value. Expected to not be SQL-escaped.
1055 1055
  * @return bool False if value was not updated. True if value was updated.
1056 1056
  */
1057
-function update_site_option( $option, $value ) {
1058
-	return update_network_option( null, $option, $value );
1057
+function update_site_option($option, $value) {
1058
+	return update_network_option(null, $option, $value);
1059 1059
 }
1060 1060
 
1061 1061
 /**
@@ -1073,17 +1073,17 @@  discard block
 block discarded – undo
1073 1073
  * @param mixed    $default    Optional. Value to return if the option doesn't exist. Default false.
1074 1074
  * @return mixed Value set for the option.
1075 1075
  */
1076
-function get_network_option( $network_id, $option, $default = false ) {
1076
+function get_network_option($network_id, $option, $default = false) {
1077 1077
 	global $wpdb, $current_site;
1078 1078
 
1079
-	if ( $network_id && ! is_numeric( $network_id ) ) {
1079
+	if ($network_id && ! is_numeric($network_id)) {
1080 1080
 		return false;
1081 1081
 	}
1082 1082
 
1083 1083
 	$network_id = (int) $network_id;
1084 1084
 
1085 1085
 	// Fallback to the current network if a network ID is not specified.
1086
-	if ( ! $network_id && is_multisite() ) {
1086
+	if ( ! $network_id && is_multisite()) {
1087 1087
 		$network_id = $current_site->id;
1088 1088
 	}
1089 1089
 
@@ -1102,17 +1102,17 @@  discard block
 block discarded – undo
1102 1102
 	 * @param mixed  $pre_option The default value to return if the option does not exist.
1103 1103
 	 * @param string $option     Option name.
1104 1104
 	 */
1105
-	$pre = apply_filters( 'pre_site_option_' . $option, false, $option );
1105
+	$pre = apply_filters('pre_site_option_'.$option, false, $option);
1106 1106
 
1107
-	if ( false !== $pre ) {
1107
+	if (false !== $pre) {
1108 1108
 		return $pre;
1109 1109
 	}
1110 1110
 
1111 1111
 	// prevent non-existent options from triggering multiple queries
1112 1112
 	$notoptions_key = "$network_id:notoptions";
1113
-	$notoptions = wp_cache_get( $notoptions_key, 'site-options' );
1113
+	$notoptions = wp_cache_get($notoptions_key, 'site-options');
1114 1114
 
1115
-	if ( isset( $notoptions[ $option ] ) ) {
1115
+	if (isset($notoptions[$option])) {
1116 1116
 
1117 1117
 		/**
1118 1118
 		 * Filter a specific default network option.
@@ -1126,34 +1126,34 @@  discard block
 block discarded – undo
1126 1126
 		 *                        in the database.
1127 1127
 		 * @param string $option  Option name.
1128 1128
 		 */
1129
-		return apply_filters( 'default_site_option_' . $option, $default, $option );
1129
+		return apply_filters('default_site_option_'.$option, $default, $option);
1130 1130
 	}
1131 1131
 
1132
-	if ( ! is_multisite() ) {
1132
+	if ( ! is_multisite()) {
1133 1133
 		/** This filter is documented in wp-includes/option.php */
1134
-		$default = apply_filters( 'default_site_option_' . $option, $default, $option );
1135
-		$value = get_option( $option, $default );
1134
+		$default = apply_filters('default_site_option_'.$option, $default, $option);
1135
+		$value = get_option($option, $default);
1136 1136
 	} else {
1137 1137
 		$cache_key = "$network_id:$option";
1138
-		$value = wp_cache_get( $cache_key, 'site-options' );
1138
+		$value = wp_cache_get($cache_key, 'site-options');
1139 1139
 
1140
-		if ( ! isset( $value ) || false === $value ) {
1141
-			$row = $wpdb->get_row( $wpdb->prepare( "SELECT meta_value FROM $wpdb->sitemeta WHERE meta_key = %s AND site_id = %d", $option, $network_id ) );
1140
+		if ( ! isset($value) || false === $value) {
1141
+			$row = $wpdb->get_row($wpdb->prepare("SELECT meta_value FROM $wpdb->sitemeta WHERE meta_key = %s AND site_id = %d", $option, $network_id));
1142 1142
 
1143 1143
 			// Has to be get_row instead of get_var because of funkiness with 0, false, null values
1144
-			if ( is_object( $row ) ) {
1144
+			if (is_object($row)) {
1145 1145
 				$value = $row->meta_value;
1146
-				$value = maybe_unserialize( $value );
1147
-				wp_cache_set( $cache_key, $value, 'site-options' );
1146
+				$value = maybe_unserialize($value);
1147
+				wp_cache_set($cache_key, $value, 'site-options');
1148 1148
 			} else {
1149
-				if ( ! is_array( $notoptions ) ) {
1149
+				if ( ! is_array($notoptions)) {
1150 1150
 					$notoptions = array();
1151 1151
 				}
1152
-				$notoptions[ $option ] = true;
1153
-				wp_cache_set( $notoptions_key, $notoptions, 'site-options' );
1152
+				$notoptions[$option] = true;
1153
+				wp_cache_set($notoptions_key, $notoptions, 'site-options');
1154 1154
 
1155 1155
 				/** This filter is documented in wp-includes/option.php */
1156
-				$value = apply_filters( 'default_site_option_' . $option, $default, $option );
1156
+				$value = apply_filters('default_site_option_'.$option, $default, $option);
1157 1157
 			}
1158 1158
 		}
1159 1159
 	}
@@ -1170,7 +1170,7 @@  discard block
 block discarded – undo
1170 1170
 	 * @param mixed  $value  Value of network option.
1171 1171
 	 * @param string $option Option name.
1172 1172
 	 */
1173
-	return apply_filters( 'site_option_' . $option, $value, $option );
1173
+	return apply_filters('site_option_'.$option, $value, $option);
1174 1174
 }
1175 1175
 
1176 1176
 /**
@@ -1190,21 +1190,21 @@  discard block
 block discarded – undo
1190 1190
  * @param mixed  $value      Option value, can be anything. Expected to not be SQL-escaped.
1191 1191
  * @return bool False if option was not added and true if option was added.
1192 1192
  */
1193
-function add_network_option( $network_id, $option, $value ) {
1193
+function add_network_option($network_id, $option, $value) {
1194 1194
 	global $wpdb, $current_site;
1195 1195
 
1196
-	if ( $network_id && ! is_numeric( $network_id ) ) {
1196
+	if ($network_id && ! is_numeric($network_id)) {
1197 1197
 		return false;
1198 1198
 	}
1199 1199
 
1200 1200
 	$network_id = (int) $network_id;
1201 1201
 
1202 1202
 	// Fallback to the current network if a network ID is not specified.
1203
-	if ( ! $network_id && is_multisite() ) {
1203
+	if ( ! $network_id && is_multisite()) {
1204 1204
 		$network_id = $current_site->id;
1205 1205
 	}
1206 1206
 
1207
-	wp_protect_special_option( $option );
1207
+	wp_protect_special_option($option);
1208 1208
 
1209 1209
 	/**
1210 1210
 	 * Filter the value of a specific network option before it is added.
@@ -1218,43 +1218,43 @@  discard block
 block discarded – undo
1218 1218
 	 * @param mixed  $value  Value of network option.
1219 1219
 	 * @param string $option Option name.
1220 1220
 	 */
1221
-	$value = apply_filters( 'pre_add_site_option_' . $option, $value, $option );
1221
+	$value = apply_filters('pre_add_site_option_'.$option, $value, $option);
1222 1222
 
1223 1223
 	$notoptions_key = "$network_id:notoptions";
1224 1224
 
1225
-	if ( ! is_multisite() ) {
1226
-		$result = add_option( $option, $value );
1225
+	if ( ! is_multisite()) {
1226
+		$result = add_option($option, $value);
1227 1227
 	} else {
1228 1228
 		$cache_key = "$network_id:$option";
1229 1229
 
1230 1230
 		// Make sure the option doesn't already exist. We can check the 'notoptions' cache before we ask for a db query
1231
-		$notoptions = wp_cache_get( $notoptions_key, 'site-options' );
1232
-		if ( ! is_array( $notoptions ) || ! isset( $notoptions[ $option ] ) ) {
1233
-			if ( false !== get_network_option( $network_id, $option, false ) ) {
1231
+		$notoptions = wp_cache_get($notoptions_key, 'site-options');
1232
+		if ( ! is_array($notoptions) || ! isset($notoptions[$option])) {
1233
+			if (false !== get_network_option($network_id, $option, false)) {
1234 1234
 				return false;
1235 1235
 			}
1236 1236
 		}
1237 1237
 
1238
-		$value = sanitize_option( $option, $value );
1238
+		$value = sanitize_option($option, $value);
1239 1239
 
1240
-		$serialized_value = maybe_serialize( $value );
1241
-		$result = $wpdb->insert( $wpdb->sitemeta, array( 'site_id'    => $network_id, 'meta_key'   => $option, 'meta_value' => $serialized_value ) );
1240
+		$serialized_value = maybe_serialize($value);
1241
+		$result = $wpdb->insert($wpdb->sitemeta, array('site_id'    => $network_id, 'meta_key'   => $option, 'meta_value' => $serialized_value));
1242 1242
 
1243
-		if ( ! $result ) {
1243
+		if ( ! $result) {
1244 1244
 			return false;
1245 1245
 		}
1246 1246
 
1247
-		wp_cache_set( $cache_key, $value, 'site-options' );
1247
+		wp_cache_set($cache_key, $value, 'site-options');
1248 1248
 
1249 1249
 		// This option exists now
1250
-		$notoptions = wp_cache_get( $notoptions_key, 'site-options' ); // yes, again... we need it to be fresh
1251
-		if ( is_array( $notoptions ) && isset( $notoptions[ $option ] ) ) {
1252
-			unset( $notoptions[ $option ] );
1253
-			wp_cache_set( $notoptions_key, $notoptions, 'site-options' );
1250
+		$notoptions = wp_cache_get($notoptions_key, 'site-options'); // yes, again... we need it to be fresh
1251
+		if (is_array($notoptions) && isset($notoptions[$option])) {
1252
+			unset($notoptions[$option]);
1253
+			wp_cache_set($notoptions_key, $notoptions, 'site-options');
1254 1254
 		}
1255 1255
 	}
1256 1256
 
1257
-	if ( $result ) {
1257
+	if ($result) {
1258 1258
 
1259 1259
 		/**
1260 1260
 		 * Fires after a specific network option has been successfully added.
@@ -1267,7 +1267,7 @@  discard block
 block discarded – undo
1267 1267
 		 * @param string $option Name of the network option.
1268 1268
 		 * @param mixed  $value  Value of the network option.
1269 1269
 		 */
1270
-		do_action( 'add_site_option_' . $option, $option, $value );
1270
+		do_action('add_site_option_'.$option, $option, $value);
1271 1271
 
1272 1272
 		/**
1273 1273
 		 * Fires after a network option has been successfully added.
@@ -1277,7 +1277,7 @@  discard block
 block discarded – undo
1277 1277
 		 * @param string $option Name of the network option.
1278 1278
 		 * @param mixed  $value  Value of the network option.
1279 1279
 		 */
1280
-		do_action( 'add_site_option', $option, $value );
1280
+		do_action('add_site_option', $option, $value);
1281 1281
 
1282 1282
 		return true;
1283 1283
 	}
@@ -1299,17 +1299,17 @@  discard block
 block discarded – undo
1299 1299
  * @param string $option     Name of option to remove. Expected to not be SQL-escaped.
1300 1300
  * @return bool True, if succeed. False, if failure.
1301 1301
  */
1302
-function delete_network_option( $network_id, $option ) {
1302
+function delete_network_option($network_id, $option) {
1303 1303
 	global $wpdb, $current_site;
1304 1304
 
1305
-	if ( $network_id && ! is_numeric( $network_id ) ) {
1305
+	if ($network_id && ! is_numeric($network_id)) {
1306 1306
 		return false;
1307 1307
 	}
1308 1308
 
1309 1309
 	$network_id = (int) $network_id;
1310 1310
 
1311 1311
 	// Fallback to the current network if a network ID is not specified.
1312
-	if ( ! $network_id && is_multisite() ) {
1312
+	if ( ! $network_id && is_multisite()) {
1313 1313
 		$network_id = $current_site->id;
1314 1314
 	}
1315 1315
 
@@ -1323,22 +1323,22 @@  discard block
 block discarded – undo
1323 1323
 	 *
1324 1324
 	 * @param string $option Option name.
1325 1325
 	 */
1326
-	do_action( 'pre_delete_site_option_' . $option, $option );
1326
+	do_action('pre_delete_site_option_'.$option, $option);
1327 1327
 
1328
-	if ( ! is_multisite() ) {
1329
-		$result = delete_option( $option );
1328
+	if ( ! is_multisite()) {
1329
+		$result = delete_option($option);
1330 1330
 	} else {
1331
-		$row = $wpdb->get_row( $wpdb->prepare( "SELECT meta_id FROM {$wpdb->sitemeta} WHERE meta_key = %s AND site_id = %d", $option, $network_id ) );
1332
-		if ( is_null( $row ) || ! $row->meta_id ) {
1331
+		$row = $wpdb->get_row($wpdb->prepare("SELECT meta_id FROM {$wpdb->sitemeta} WHERE meta_key = %s AND site_id = %d", $option, $network_id));
1332
+		if (is_null($row) || ! $row->meta_id) {
1333 1333
 			return false;
1334 1334
 		}
1335 1335
 		$cache_key = "$network_id:$option";
1336
-		wp_cache_delete( $cache_key, 'site-options' );
1336
+		wp_cache_delete($cache_key, 'site-options');
1337 1337
 
1338
-		$result = $wpdb->delete( $wpdb->sitemeta, array( 'meta_key' => $option, 'site_id' => $network_id ) );
1338
+		$result = $wpdb->delete($wpdb->sitemeta, array('meta_key' => $option, 'site_id' => $network_id));
1339 1339
 	}
1340 1340
 
1341
-	if ( $result ) {
1341
+	if ($result) {
1342 1342
 
1343 1343
 		/**
1344 1344
 		 * Fires after a specific network option has been deleted.
@@ -1350,7 +1350,7 @@  discard block
 block discarded – undo
1350 1350
 		 *
1351 1351
 		 * @param string $option Name of the network option.
1352 1352
 		 */
1353
-		do_action( 'delete_site_option_' . $option, $option );
1353
+		do_action('delete_site_option_'.$option, $option);
1354 1354
 
1355 1355
 		/**
1356 1356
 		 * Fires after a network option has been deleted.
@@ -1359,7 +1359,7 @@  discard block
 block discarded – undo
1359 1359
 		 *
1360 1360
 		 * @param string $option Name of the network option.
1361 1361
 		 */
1362
-		do_action( 'delete_site_option', $option );
1362
+		do_action('delete_site_option', $option);
1363 1363
 
1364 1364
 		return true;
1365 1365
 	}
@@ -1382,23 +1382,23 @@  discard block
 block discarded – undo
1382 1382
  * @param mixed    $value      Option value. Expected to not be SQL-escaped.
1383 1383
  * @return bool False if value was not updated and true if value was updated.
1384 1384
  */
1385
-function update_network_option( $network_id, $option, $value ) {
1385
+function update_network_option($network_id, $option, $value) {
1386 1386
 	global $wpdb, $current_site;
1387 1387
 
1388
-	if ( $network_id && ! is_numeric( $network_id ) ) {
1388
+	if ($network_id && ! is_numeric($network_id)) {
1389 1389
 		return false;
1390 1390
 	}
1391 1391
 
1392 1392
 	$network_id = (int) $network_id;
1393 1393
 
1394 1394
 	// Fallback to the current network if a network ID is not specified.
1395
-	if ( ! $network_id && is_multisite() ) {
1395
+	if ( ! $network_id && is_multisite()) {
1396 1396
 		$network_id = $current_site->id;
1397 1397
 	}
1398 1398
 
1399
-	wp_protect_special_option( $option );
1399
+	wp_protect_special_option($option);
1400 1400
 
1401
-	$old_value = get_network_option( $network_id, $option, false );
1401
+	$old_value = get_network_option($network_id, $option, false);
1402 1402
 
1403 1403
 	/**
1404 1404
 	 * Filter a specific network option before its value is updated.
@@ -1413,38 +1413,38 @@  discard block
 block discarded – undo
1413 1413
 	 * @param mixed  $old_value Old value of the network option.
1414 1414
 	 * @param string $option    Option name.
1415 1415
 	 */
1416
-	$value = apply_filters( 'pre_update_site_option_' . $option, $value, $old_value, $option );
1416
+	$value = apply_filters('pre_update_site_option_'.$option, $value, $old_value, $option);
1417 1417
 
1418
-	if ( $value === $old_value ) {
1418
+	if ($value === $old_value) {
1419 1419
 		return false;
1420 1420
 	}
1421 1421
 
1422
-	if ( false === $old_value ) {
1423
-		return add_network_option( $network_id, $option, $value );
1422
+	if (false === $old_value) {
1423
+		return add_network_option($network_id, $option, $value);
1424 1424
 	}
1425 1425
 
1426 1426
 	$notoptions_key = "$network_id:notoptions";
1427
-	$notoptions = wp_cache_get( $notoptions_key, 'site-options' );
1428
-	if ( is_array( $notoptions ) && isset( $notoptions[ $option ] ) ) {
1429
-		unset( $notoptions[ $option ] );
1430
-		wp_cache_set( $notoptions_key, $notoptions, 'site-options' );
1427
+	$notoptions = wp_cache_get($notoptions_key, 'site-options');
1428
+	if (is_array($notoptions) && isset($notoptions[$option])) {
1429
+		unset($notoptions[$option]);
1430
+		wp_cache_set($notoptions_key, $notoptions, 'site-options');
1431 1431
 	}
1432 1432
 
1433
-	if ( ! is_multisite() ) {
1434
-		$result = update_option( $option, $value );
1433
+	if ( ! is_multisite()) {
1434
+		$result = update_option($option, $value);
1435 1435
 	} else {
1436
-		$value = sanitize_option( $option, $value );
1436
+		$value = sanitize_option($option, $value);
1437 1437
 
1438
-		$serialized_value = maybe_serialize( $value );
1439
-		$result = $wpdb->update( $wpdb->sitemeta, array( 'meta_value' => $serialized_value ), array( 'site_id' => $network_id, 'meta_key' => $option ) );
1438
+		$serialized_value = maybe_serialize($value);
1439
+		$result = $wpdb->update($wpdb->sitemeta, array('meta_value' => $serialized_value), array('site_id' => $network_id, 'meta_key' => $option));
1440 1440
 
1441
-		if ( $result ) {
1441
+		if ($result) {
1442 1442
 			$cache_key = "$network_id:$option";
1443
-			wp_cache_set( $cache_key, $value, 'site-options' );
1443
+			wp_cache_set($cache_key, $value, 'site-options');
1444 1444
 		}
1445 1445
 	}
1446 1446
 
1447
-	if ( $result ) {
1447
+	if ($result) {
1448 1448
 
1449 1449
 		/**
1450 1450
 		 * Fires after the value of a specific network option has been successfully updated.
@@ -1458,7 +1458,7 @@  discard block
 block discarded – undo
1458 1458
 		 * @param mixed  $value     Current value of the network option.
1459 1459
 		 * @param mixed  $old_value Old value of the network option.
1460 1460
 		 */
1461
-		do_action( 'update_site_option_' . $option, $option, $value, $old_value );
1461
+		do_action('update_site_option_'.$option, $option, $value, $old_value);
1462 1462
 
1463 1463
 		/**
1464 1464
 		 * Fires after the value of a network option has been successfully updated.
@@ -1469,7 +1469,7 @@  discard block
 block discarded – undo
1469 1469
 		 * @param mixed  $value     Current value of the network option.
1470 1470
 		 * @param mixed  $old_value Old value of the network option.
1471 1471
 		 */
1472
-		do_action( 'update_site_option', $option, $value, $old_value );
1472
+		do_action('update_site_option', $option, $value, $old_value);
1473 1473
 
1474 1474
 		return true;
1475 1475
 	}
@@ -1485,7 +1485,7 @@  discard block
 block discarded – undo
1485 1485
  * @param string $transient Transient name. Expected to not be SQL-escaped.
1486 1486
  * @return bool True if successful, false otherwise
1487 1487
  */
1488
-function delete_site_transient( $transient ) {
1488
+function delete_site_transient($transient) {
1489 1489
 
1490 1490
 	/**
1491 1491
 	 * Fires immediately before a specific site transient is deleted.
@@ -1496,18 +1496,18 @@  discard block
 block discarded – undo
1496 1496
 	 *
1497 1497
 	 * @param string $transient Transient name.
1498 1498
 	 */
1499
-	do_action( 'delete_site_transient_' . $transient, $transient );
1499
+	do_action('delete_site_transient_'.$transient, $transient);
1500 1500
 
1501
-	if ( wp_using_ext_object_cache() ) {
1502
-		$result = wp_cache_delete( $transient, 'site-transient' );
1501
+	if (wp_using_ext_object_cache()) {
1502
+		$result = wp_cache_delete($transient, 'site-transient');
1503 1503
 	} else {
1504
-		$option_timeout = '_site_transient_timeout_' . $transient;
1505
-		$option = '_site_transient_' . $transient;
1506
-		$result = delete_site_option( $option );
1507
-		if ( $result )
1508
-			delete_site_option( $option_timeout );
1504
+		$option_timeout = '_site_transient_timeout_'.$transient;
1505
+		$option = '_site_transient_'.$transient;
1506
+		$result = delete_site_option($option);
1507
+		if ($result)
1508
+			delete_site_option($option_timeout);
1509 1509
 	}
1510
-	if ( $result ) {
1510
+	if ($result) {
1511 1511
 
1512 1512
 		/**
1513 1513
 		 * Fires after a transient is deleted.
@@ -1516,7 +1516,7 @@  discard block
 block discarded – undo
1516 1516
 		 *
1517 1517
 		 * @param string $transient Deleted transient name.
1518 1518
 		 */
1519
-		do_action( 'deleted_site_transient', $transient );
1519
+		do_action('deleted_site_transient', $transient);
1520 1520
 	}
1521 1521
 
1522 1522
 	return $result;
@@ -1535,7 +1535,7 @@  discard block
 block discarded – undo
1535 1535
  * @param string $transient Transient name. Expected to not be SQL-escaped.
1536 1536
  * @return mixed Value of transient.
1537 1537
  */
1538
-function get_site_transient( $transient ) {
1538
+function get_site_transient($transient) {
1539 1539
 
1540 1540
 	/**
1541 1541
 	 * Filter the value of an existing site transient.
@@ -1553,29 +1553,29 @@  discard block
 block discarded – undo
1553 1553
 	 *                                   of the transient, and return the returned value.
1554 1554
 	 * @param string $transient          Transient name.
1555 1555
 	 */
1556
-	$pre = apply_filters( 'pre_site_transient_' . $transient, false, $transient );
1556
+	$pre = apply_filters('pre_site_transient_'.$transient, false, $transient);
1557 1557
 
1558
-	if ( false !== $pre )
1558
+	if (false !== $pre)
1559 1559
 		return $pre;
1560 1560
 
1561
-	if ( wp_using_ext_object_cache() ) {
1562
-		$value = wp_cache_get( $transient, 'site-transient' );
1561
+	if (wp_using_ext_object_cache()) {
1562
+		$value = wp_cache_get($transient, 'site-transient');
1563 1563
 	} else {
1564 1564
 		// Core transients that do not have a timeout. Listed here so querying timeouts can be avoided.
1565 1565
 		$no_timeout = array('update_core', 'update_plugins', 'update_themes');
1566
-		$transient_option = '_site_transient_' . $transient;
1567
-		if ( ! in_array( $transient, $no_timeout ) ) {
1568
-			$transient_timeout = '_site_transient_timeout_' . $transient;
1569
-			$timeout = get_site_option( $transient_timeout );
1570
-			if ( false !== $timeout && $timeout < time() ) {
1571
-				delete_site_option( $transient_option  );
1572
-				delete_site_option( $transient_timeout );
1566
+		$transient_option = '_site_transient_'.$transient;
1567
+		if ( ! in_array($transient, $no_timeout)) {
1568
+			$transient_timeout = '_site_transient_timeout_'.$transient;
1569
+			$timeout = get_site_option($transient_timeout);
1570
+			if (false !== $timeout && $timeout < time()) {
1571
+				delete_site_option($transient_option);
1572
+				delete_site_option($transient_timeout);
1573 1573
 				$value = false;
1574 1574
 			}
1575 1575
 		}
1576 1576
 
1577
-		if ( ! isset( $value ) )
1578
-			$value = get_site_option( $transient_option );
1577
+		if ( ! isset($value))
1578
+			$value = get_site_option($transient_option);
1579 1579
 	}
1580 1580
 
1581 1581
 	/**
@@ -1589,7 +1589,7 @@  discard block
 block discarded – undo
1589 1589
 	 * @param mixed  $value     Value of site transient.
1590 1590
 	 * @param string $transient Transient name.
1591 1591
 	 */
1592
-	return apply_filters( 'site_transient_' . $transient, $value, $transient );
1592
+	return apply_filters('site_transient_'.$transient, $value, $transient);
1593 1593
 }
1594 1594
 
1595 1595
 /**
@@ -1608,7 +1608,7 @@  discard block
 block discarded – undo
1608 1608
  * @param int    $expiration Optional. Time until expiration in seconds. Default 0 (no expiration).
1609 1609
  * @return bool False if value was not set and true if value was set.
1610 1610
  */
1611
-function set_site_transient( $transient, $value, $expiration = 0 ) {
1611
+function set_site_transient($transient, $value, $expiration = 0) {
1612 1612
 
1613 1613
 	/**
1614 1614
 	 * Filter the value of a specific site transient before it is set.
@@ -1621,7 +1621,7 @@  discard block
 block discarded – undo
1621 1621
 	 * @param mixed  $value     New value of site transient.
1622 1622
 	 * @param string $transient Transient name.
1623 1623
 	 */
1624
-	$value = apply_filters( 'pre_set_site_transient_' . $transient, $value, $transient );
1624
+	$value = apply_filters('pre_set_site_transient_'.$transient, $value, $transient);
1625 1625
 
1626 1626
 	$expiration = (int) $expiration;
1627 1627
 
@@ -1636,24 +1636,24 @@  discard block
 block discarded – undo
1636 1636
 	 * @param mixed  $value      New value of site transient.
1637 1637
 	 * @param string $transient  Transient name.
1638 1638
 	 */
1639
-	$expiration = apply_filters( 'expiration_of_site_transient_' . $transient, $expiration, $value, $transient );
1639
+	$expiration = apply_filters('expiration_of_site_transient_'.$transient, $expiration, $value, $transient);
1640 1640
 
1641
-	if ( wp_using_ext_object_cache() ) {
1642
-		$result = wp_cache_set( $transient, $value, 'site-transient', $expiration );
1641
+	if (wp_using_ext_object_cache()) {
1642
+		$result = wp_cache_set($transient, $value, 'site-transient', $expiration);
1643 1643
 	} else {
1644
-		$transient_timeout = '_site_transient_timeout_' . $transient;
1645
-		$option = '_site_transient_' . $transient;
1646
-		if ( false === get_site_option( $option ) ) {
1647
-			if ( $expiration )
1648
-				add_site_option( $transient_timeout, time() + $expiration );
1649
-			$result = add_site_option( $option, $value );
1644
+		$transient_timeout = '_site_transient_timeout_'.$transient;
1645
+		$option = '_site_transient_'.$transient;
1646
+		if (false === get_site_option($option)) {
1647
+			if ($expiration)
1648
+				add_site_option($transient_timeout, time() + $expiration);
1649
+			$result = add_site_option($option, $value);
1650 1650
 		} else {
1651
-			if ( $expiration )
1652
-				update_site_option( $transient_timeout, time() + $expiration );
1653
-			$result = update_site_option( $option, $value );
1651
+			if ($expiration)
1652
+				update_site_option($transient_timeout, time() + $expiration);
1653
+			$result = update_site_option($option, $value);
1654 1654
 		}
1655 1655
 	}
1656
-	if ( $result ) {
1656
+	if ($result) {
1657 1657
 
1658 1658
 		/**
1659 1659
 		 * Fires after the value for a specific site transient has been set.
@@ -1667,7 +1667,7 @@  discard block
 block discarded – undo
1667 1667
 		 * @param int    $expiration Time until expiration in seconds.
1668 1668
 		 * @param string $transient  Transient name.
1669 1669
 		 */
1670
-		do_action( 'set_site_transient_' . $transient, $value, $expiration, $transient );
1670
+		do_action('set_site_transient_'.$transient, $value, $expiration, $transient);
1671 1671
 
1672 1672
 		/**
1673 1673
 		 * Fires after the value for a site transient has been set.
@@ -1678,7 +1678,7 @@  discard block
 block discarded – undo
1678 1678
 		 * @param mixed  $value      Site transient value.
1679 1679
 		 * @param int    $expiration Time until expiration in seconds.
1680 1680
 		 */
1681
-		do_action( 'setted_site_transient', $transient, $value, $expiration );
1681
+		do_action('setted_site_transient', $transient, $value, $expiration);
1682 1682
 	}
1683 1683
 	return $result;
1684 1684
 }
Please login to merge, or discard this patch.
Braces   +96 added lines, -65 removed lines patch added patch discarded remove patch
@@ -31,8 +31,9 @@  discard block
 block discarded – undo
31 31
 	global $wpdb;
32 32
 
33 33
 	$option = trim( $option );
34
-	if ( empty( $option ) )
35
-		return false;
34
+	if ( empty( $option ) ) {
35
+			return false;
36
+	}
36 37
 
37 38
 	/**
38 39
 	 * Filter the value of an existing option before it is retrieved.
@@ -50,11 +51,13 @@  discard block
 block discarded – undo
50 51
 	 * @param string     $option     Option name.
51 52
 	 */
52 53
 	$pre = apply_filters( 'pre_option_' . $option, false, $option );
53
-	if ( false !== $pre )
54
-		return $pre;
54
+	if ( false !== $pre ) {
55
+			return $pre;
56
+	}
55 57
 
56
-	if ( defined( 'WP_SETUP_CONFIG' ) )
57
-		return false;
58
+	if ( defined( 'WP_SETUP_CONFIG' ) ) {
59
+			return false;
60
+	}
58 61
 
59 62
 	if ( ! wp_installing() ) {
60 63
 		// prevent non-existent options from triggering multiple queries
@@ -114,11 +117,13 @@  discard block
 block discarded – undo
114 117
 	}
115 118
 
116 119
 	// If home is not set use siteurl.
117
-	if ( 'home' == $option && '' == $value )
118
-		return get_option( 'siteurl' );
120
+	if ( 'home' == $option && '' == $value ) {
121
+			return get_option( 'siteurl' );
122
+	}
119 123
 
120
-	if ( in_array( $option, array('siteurl', 'home', 'category_base', 'tag_base') ) )
121
-		$value = untrailingslashit( $value );
124
+	if ( in_array( $option, array('siteurl', 'home', 'category_base', 'tag_base') ) ) {
125
+			$value = untrailingslashit( $value );
126
+	}
122 127
 
123 128
 	/**
124 129
 	 * Filter the value of an existing option.
@@ -147,9 +152,10 @@  discard block
 block discarded – undo
147 152
  * @param string $option Option name.
148 153
  */
149 154
 function wp_protect_special_option( $option ) {
150
-	if ( 'alloptions' === $option || 'notoptions' === $option )
151
-		wp_die( sprintf( __( '%s is a protected WP option and may not be modified' ), esc_html( $option ) ) );
152
-}
155
+	if ( 'alloptions' === $option || 'notoptions' === $option ) {
156
+			wp_die( sprintf( __( '%s is a protected WP option and may not be modified' ), esc_html( $option ) ) );
157
+	}
158
+	}
153 159
 
154 160
 /**
155 161
  * Print option value after sanitizing for forms.
@@ -174,22 +180,25 @@  discard block
 block discarded – undo
174 180
 function wp_load_alloptions() {
175 181
 	global $wpdb;
176 182
 
177
-	if ( ! wp_installing() || ! is_multisite() )
178
-		$alloptions = wp_cache_get( 'alloptions', 'options' );
179
-	else
180
-		$alloptions = false;
183
+	if ( ! wp_installing() || ! is_multisite() ) {
184
+			$alloptions = wp_cache_get( 'alloptions', 'options' );
185
+	} else {
186
+			$alloptions = false;
187
+	}
181 188
 
182 189
 	if ( !$alloptions ) {
183 190
 		$suppress = $wpdb->suppress_errors();
184
-		if ( !$alloptions_db = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options WHERE autoload = 'yes'" ) )
185
-			$alloptions_db = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options" );
191
+		if ( !$alloptions_db = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options WHERE autoload = 'yes'" ) ) {
192
+					$alloptions_db = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options" );
193
+		}
186 194
 		$wpdb->suppress_errors($suppress);
187 195
 		$alloptions = array();
188 196
 		foreach ( (array) $alloptions_db as $o ) {
189 197
 			$alloptions[$o->option_name] = $o->option_value;
190 198
 		}
191
-		if ( ! wp_installing() || ! is_multisite() )
192
-			wp_cache_add( 'alloptions', $alloptions, 'options' );
199
+		if ( ! wp_installing() || ! is_multisite() ) {
200
+					wp_cache_add( 'alloptions', $alloptions, 'options' );
201
+		}
193 202
 	}
194 203
 
195 204
 	return $alloptions;
@@ -207,11 +216,13 @@  discard block
 block discarded – undo
207 216
 function wp_load_core_site_options( $site_id = null ) {
208 217
 	global $wpdb;
209 218
 
210
-	if ( ! is_multisite() || wp_using_ext_object_cache() || wp_installing() )
211
-		return;
219
+	if ( ! is_multisite() || wp_using_ext_object_cache() || wp_installing() ) {
220
+			return;
221
+	}
212 222
 
213
-	if ( empty($site_id) )
214
-		$site_id = $wpdb->siteid;
223
+	if ( empty($site_id) ) {
224
+			$site_id = $wpdb->siteid;
225
+	}
215 226
 
216 227
 	$core_options = array('site_name', 'siteurl', 'active_sitewide_plugins', '_site_transient_timeout_theme_roots', '_site_transient_theme_roots', 'site_admins', 'can_compress_scripts', 'global_terms_enabled', 'ms_files_rewriting' );
217 228
 
@@ -254,13 +265,15 @@  discard block
 block discarded – undo
254 265
 	global $wpdb;
255 266
 
256 267
 	$option = trim($option);
257
-	if ( empty($option) )
258
-		return false;
268
+	if ( empty($option) ) {
269
+			return false;
270
+	}
259 271
 
260 272
 	wp_protect_special_option( $option );
261 273
 
262
-	if ( is_object( $value ) )
263
-		$value = clone $value;
274
+	if ( is_object( $value ) ) {
275
+			$value = clone $value;
276
+	}
264 277
 
265 278
 	$value = sanitize_option( $option, $value );
266 279
 	$old_value = get_option( $option );
@@ -291,8 +304,9 @@  discard block
 block discarded – undo
291 304
 	$value = apply_filters( 'pre_update_option', $value, $option, $old_value );
292 305
 
293 306
 	// If the new and old values are the same, no need to update.
294
-	if ( $value === $old_value )
295
-		return false;
307
+	if ( $value === $old_value ) {
308
+			return false;
309
+	}
296 310
 
297 311
 	/** This filter is documented in wp-includes/option.php */
298 312
 	if ( apply_filters( 'default_option_' . $option, false ) === $old_value ) {
@@ -326,8 +340,9 @@  discard block
 block discarded – undo
326 340
 	}
327 341
 
328 342
 	$result = $wpdb->update( $wpdb->options, $update_args, array( 'option_name' => $option ) );
329
-	if ( ! $result )
330
-		return false;
343
+	if ( ! $result ) {
344
+			return false;
345
+	}
331 346
 
332 347
 	$notoptions = wp_cache_get( 'notoptions', 'options' );
333 348
 	if ( is_array( $notoptions ) && isset( $notoptions[$option] ) ) {
@@ -398,26 +413,30 @@  discard block
 block discarded – undo
398 413
 function add_option( $option, $value = '', $deprecated = '', $autoload = 'yes' ) {
399 414
 	global $wpdb;
400 415
 
401
-	if ( !empty( $deprecated ) )
402
-		_deprecated_argument( __FUNCTION__, '2.3' );
416
+	if ( !empty( $deprecated ) ) {
417
+			_deprecated_argument( __FUNCTION__, '2.3' );
418
+	}
403 419
 
404 420
 	$option = trim($option);
405
-	if ( empty($option) )
406
-		return false;
421
+	if ( empty($option) ) {
422
+			return false;
423
+	}
407 424
 
408 425
 	wp_protect_special_option( $option );
409 426
 
410
-	if ( is_object($value) )
411
-		$value = clone $value;
427
+	if ( is_object($value) ) {
428
+			$value = clone $value;
429
+	}
412 430
 
413 431
 	$value = sanitize_option( $option, $value );
414 432
 
415 433
 	// Make sure the option doesn't already exist. We can check the 'notoptions' cache before we ask for a db query
416 434
 	$notoptions = wp_cache_get( 'notoptions', 'options' );
417
-	if ( !is_array( $notoptions ) || !isset( $notoptions[$option] ) )
418
-		/** This filter is documented in wp-includes/option.php */
435
+	if ( !is_array( $notoptions ) || !isset( $notoptions[$option] ) ) {
436
+			/** This filter is documented in wp-includes/option.php */
419 437
 		if ( apply_filters( 'default_option_' . $option, false ) !== get_option( $option ) )
420 438
 			return false;
439
+	}
421 440
 
422 441
 	$serialized_value = maybe_serialize( $value );
423 442
 	$autoload = ( 'no' === $autoload || false === $autoload ) ? 'no' : 'yes';
@@ -433,8 +452,9 @@  discard block
 block discarded – undo
433 452
 	do_action( 'add_option', $option, $value );
434 453
 
435 454
 	$result = $wpdb->query( $wpdb->prepare( "INSERT INTO `$wpdb->options` (`option_name`, `option_value`, `autoload`) VALUES (%s, %s, %s) ON DUPLICATE KEY UPDATE `option_name` = VALUES(`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES(`autoload`)", $option, $serialized_value, $autoload ) );
436
-	if ( ! $result )
437
-		return false;
455
+	if ( ! $result ) {
456
+			return false;
457
+	}
438 458
 
439 459
 	if ( ! wp_installing() ) {
440 460
 		if ( 'yes' == $autoload ) {
@@ -492,15 +512,17 @@  discard block
 block discarded – undo
492 512
 	global $wpdb;
493 513
 
494 514
 	$option = trim( $option );
495
-	if ( empty( $option ) )
496
-		return false;
515
+	if ( empty( $option ) ) {
516
+			return false;
517
+	}
497 518
 
498 519
 	wp_protect_special_option( $option );
499 520
 
500 521
 	// Get the ID, if no ID then return
501 522
 	$row = $wpdb->get_row( $wpdb->prepare( "SELECT autoload FROM $wpdb->options WHERE option_name = %s", $option ) );
502
-	if ( is_null( $row ) )
503
-		return false;
523
+	if ( is_null( $row ) ) {
524
+			return false;
525
+	}
504 526
 
505 527
 	/**
506 528
 	 * Fires immediately before an option is deleted.
@@ -576,8 +598,9 @@  discard block
 block discarded – undo
576 598
 		$option_timeout = '_transient_timeout_' . $transient;
577 599
 		$option = '_transient_' . $transient;
578 600
 		$result = delete_option( $option );
579
-		if ( $result )
580
-			delete_option( $option_timeout );
601
+		if ( $result ) {
602
+					delete_option( $option_timeout );
603
+		}
581 604
 	}
582 605
 
583 606
 	if ( $result ) {
@@ -625,8 +648,9 @@  discard block
 block discarded – undo
625 648
 	 * @param string $transient     Transient name.
626 649
 	 */
627 650
 	$pre = apply_filters( 'pre_transient_' . $transient, false, $transient );
628
-	if ( false !== $pre )
629
-		return $pre;
651
+	if ( false !== $pre ) {
652
+			return $pre;
653
+	}
630 654
 
631 655
 	if ( wp_using_ext_object_cache() ) {
632 656
 		$value = wp_cache_get( $transient, 'transient' );
@@ -646,8 +670,9 @@  discard block
 block discarded – undo
646 670
 			}
647 671
 		}
648 672
 
649
-		if ( ! isset( $value ) )
650
-			$value = get_option( $transient_option );
673
+		if ( ! isset( $value ) ) {
674
+					$value = get_option( $transient_option );
675
+		}
651 676
 	}
652 677
 
653 678
 	/**
@@ -804,8 +829,9 @@  discard block
 block discarded – undo
804 829
 		$cookie = preg_replace( '/[^A-Za-z0-9=&_]/', '', $_COOKIE['wp-settings-' . $user_id] );
805 830
 
806 831
 		// No change or both empty
807
-		if ( $cookie == $settings )
808
-			return;
832
+		if ( $cookie == $settings ) {
833
+					return;
834
+		}
809 835
 
810 836
 		$last_saved = (int) get_user_option( 'user-settings-time', $user_id );
811 837
 		$current = isset( $_COOKIE['wp-settings-time-' . $user_id]) ? preg_replace( '/[^0-9]/', '', $_COOKIE['wp-settings-time-' . $user_id] ) : 0;
@@ -1504,8 +1530,9 @@  discard block
 block discarded – undo
1504 1530
 		$option_timeout = '_site_transient_timeout_' . $transient;
1505 1531
 		$option = '_site_transient_' . $transient;
1506 1532
 		$result = delete_site_option( $option );
1507
-		if ( $result )
1508
-			delete_site_option( $option_timeout );
1533
+		if ( $result ) {
1534
+					delete_site_option( $option_timeout );
1535
+		}
1509 1536
 	}
1510 1537
 	if ( $result ) {
1511 1538
 
@@ -1555,8 +1582,9 @@  discard block
 block discarded – undo
1555 1582
 	 */
1556 1583
 	$pre = apply_filters( 'pre_site_transient_' . $transient, false, $transient );
1557 1584
 
1558
-	if ( false !== $pre )
1559
-		return $pre;
1585
+	if ( false !== $pre ) {
1586
+			return $pre;
1587
+	}
1560 1588
 
1561 1589
 	if ( wp_using_ext_object_cache() ) {
1562 1590
 		$value = wp_cache_get( $transient, 'site-transient' );
@@ -1574,8 +1602,9 @@  discard block
 block discarded – undo
1574 1602
 			}
1575 1603
 		}
1576 1604
 
1577
-		if ( ! isset( $value ) )
1578
-			$value = get_site_option( $transient_option );
1605
+		if ( ! isset( $value ) ) {
1606
+					$value = get_site_option( $transient_option );
1607
+		}
1579 1608
 	}
1580 1609
 
1581 1610
 	/**
@@ -1644,12 +1673,14 @@  discard block
 block discarded – undo
1644 1673
 		$transient_timeout = '_site_transient_timeout_' . $transient;
1645 1674
 		$option = '_site_transient_' . $transient;
1646 1675
 		if ( false === get_site_option( $option ) ) {
1647
-			if ( $expiration )
1648
-				add_site_option( $transient_timeout, time() + $expiration );
1676
+			if ( $expiration ) {
1677
+							add_site_option( $transient_timeout, time() + $expiration );
1678
+			}
1649 1679
 			$result = add_site_option( $option, $value );
1650 1680
 		} else {
1651
-			if ( $expiration )
1652
-				update_site_option( $transient_timeout, time() + $expiration );
1681
+			if ( $expiration ) {
1682
+							update_site_option( $transient_timeout, time() + $expiration );
1683
+			}
1653 1684
 			$result = update_site_option( $option, $value );
1654 1685
 		}
1655 1686
 	}
Please login to merge, or discard this patch.
src/wp-includes/plugin.php 4 patches
Doc Comments   +4 added lines, -7 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
  *                                  and functions with the same priority are executed
99 99
  *                                  in the order in which they were added to the action.
100 100
  * @param int      $accepted_args   Optional. The number of arguments the function accepts. Default 1.
101
- * @return true
101
+ * @return boolean
102 102
  */
103 103
 function add_filter( $tag, $function_to_add, $priority = 10, $accepted_args = 1 ) {
104 104
 	global $wp_filter, $merged_filters;
@@ -193,7 +193,6 @@  discard block
 block discarded – undo
193 193
  *
194 194
  * @param string $tag     The name of the filter hook.
195 195
  * @param mixed  $value   The value on which the filters hooked to `$tag` are applied on.
196
- * @param mixed  $var,... Additional variables passed to the functions hooked to `$tag`.
197 196
  * @return mixed The filtered value after all hooked functions are applied to it.
198 197
  */
199 198
 function apply_filters( $tag, $value ) {
@@ -347,7 +346,7 @@  discard block
 block discarded – undo
347 346
  *
348 347
  * @param string   $tag      The filter to remove hooks from.
349 348
  * @param int|bool $priority Optional. The priority number to remove. Default false.
350
- * @return true True when finished.
349
+ * @return boolean True when finished.
351 350
  */
352 351
 function remove_all_filters( $tag, $priority = false ) {
353 352
 	global $wp_filter, $merged_filters;
@@ -452,7 +451,7 @@  discard block
 block discarded – undo
452 451
  *                                  and functions with the same priority are executed
453 452
  *                                  in the order in which they were added to the action.
454 453
  * @param int      $accepted_args   Optional. The number of arguments the function accepts. Default 1.
455
- * @return true Will always return true.
454
+ * @return boolean Will always return true.
456 455
  */
457 456
 function add_action($tag, $function_to_add, $priority = 10, $accepted_args = 1) {
458 457
 	return add_filter($tag, $function_to_add, $priority, $accepted_args);
@@ -476,8 +475,6 @@  discard block
 block discarded – undo
476 475
  * @global array $wp_current_filter Stores the list of current filters with the current one last
477 476
  *
478 477
  * @param string $tag     The name of the action to be executed.
479
- * @param mixed  $arg,... Optional. Additional arguments which are passed on to the
480
- *                        functions hooked to the action. Default empty.
481 478
  */
482 479
 function do_action($tag, $arg = '') {
483 480
 	global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter;
@@ -650,7 +647,7 @@  discard block
 block discarded – undo
650 647
  *
651 648
  * @param string   $tag      The action to remove hooks from.
652 649
  * @param int|bool $priority The priority number to remove them from. Default false.
653
- * @return true True when finished.
650
+ * @return boolean True when finished.
654 651
  */
655 652
 function remove_all_actions($tag, $priority = false) {
656 653
 	return remove_all_filters($tag, $priority);
Please login to merge, or discard this patch.
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -1,23 +1,23 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * The plugin API is located in this file, which allows for creating actions
4
- * and filters and hooking functions, and methods. The functions or methods will
5
- * then be run when the action or filter is called.
6
- *
7
- * The API callback examples reference functions, but can be methods of classes.
8
- * To hook methods, you'll need to pass an array one of two ways.
9
- *
10
- * Any of the syntaxes explained in the PHP documentation for the
11
- * {@link http://us2.php.net/manual/en/language.pseudo-types.php#language.types.callback 'callback'}
12
- * type are valid.
13
- *
14
- * Also see the {@link https://codex.wordpress.org/Plugin_API Plugin API} for
15
- * more information and examples on how to use a lot of these functions.
16
- *
17
- * @package WordPress
18
- * @subpackage Plugin
19
- * @since 1.5.0
20
- */
3
+	 * The plugin API is located in this file, which allows for creating actions
4
+	 * and filters and hooking functions, and methods. The functions or methods will
5
+	 * then be run when the action or filter is called.
6
+	 *
7
+	 * The API callback examples reference functions, but can be methods of classes.
8
+	 * To hook methods, you'll need to pass an array one of two ways.
9
+	 *
10
+	 * Any of the syntaxes explained in the PHP documentation for the
11
+	 * {@link http://us2.php.net/manual/en/language.pseudo-types.php#language.types.callback 'callback'}
12
+	 * type are valid.
13
+	 *
14
+	 * Also see the {@link https://codex.wordpress.org/Plugin_API Plugin API} for
15
+	 * more information and examples on how to use a lot of these functions.
16
+	 *
17
+	 * @package WordPress
18
+	 * @subpackage Plugin
19
+	 * @since 1.5.0
20
+	 */
21 21
 
22 22
 // Initialize the filter globals.
23 23
 global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter;
Please login to merge, or discard this patch.
Spacing   +132 added lines, -132 removed lines patch added patch discarded remove patch
@@ -22,16 +22,16 @@  discard block
 block discarded – undo
22 22
 // Initialize the filter globals.
23 23
 global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter;
24 24
 
25
-if ( ! isset( $wp_filter ) )
25
+if ( ! isset($wp_filter))
26 26
 	$wp_filter = array();
27 27
 
28
-if ( ! isset( $wp_actions ) )
28
+if ( ! isset($wp_actions))
29 29
 	$wp_actions = array();
30 30
 
31
-if ( ! isset( $merged_filters ) )
31
+if ( ! isset($merged_filters))
32 32
 	$merged_filters = array();
33 33
 
34
-if ( ! isset( $wp_current_filter ) )
34
+if ( ! isset($wp_current_filter))
35 35
 	$wp_current_filter = array();
36 36
 
37 37
 /**
@@ -100,12 +100,12 @@  discard block
 block discarded – undo
100 100
  * @param int      $accepted_args   Optional. The number of arguments the function accepts. Default 1.
101 101
  * @return true
102 102
  */
103
-function add_filter( $tag, $function_to_add, $priority = 10, $accepted_args = 1 ) {
103
+function add_filter($tag, $function_to_add, $priority = 10, $accepted_args = 1) {
104 104
 	global $wp_filter, $merged_filters;
105 105
 
106 106
 	$idx = _wp_filter_build_unique_id($tag, $function_to_add, $priority);
107 107
 	$wp_filter[$tag][$priority][$idx] = array('function' => $function_to_add, 'accepted_args' => $accepted_args);
108
-	unset( $merged_filters[ $tag ] );
108
+	unset($merged_filters[$tag]);
109 109
 	return true;
110 110
 }
111 111
 
@@ -129,31 +129,31 @@  discard block
 block discarded – undo
129 129
 	// Don't reset the internal array pointer
130 130
 	$wp_filter = $GLOBALS['wp_filter'];
131 131
 
132
-	$has = ! empty( $wp_filter[ $tag ] );
132
+	$has = ! empty($wp_filter[$tag]);
133 133
 
134 134
 	// Make sure at least one priority has a filter callback
135
-	if ( $has ) {
135
+	if ($has) {
136 136
 		$exists = false;
137
-		foreach ( $wp_filter[ $tag ] as $callbacks ) {
138
-			if ( ! empty( $callbacks ) ) {
137
+		foreach ($wp_filter[$tag] as $callbacks) {
138
+			if ( ! empty($callbacks)) {
139 139
 				$exists = true;
140 140
 				break;
141 141
 			}
142 142
 		}
143 143
 
144
-		if ( ! $exists ) {
144
+		if ( ! $exists) {
145 145
 			$has = false;
146 146
 		}
147 147
 	}
148 148
 
149
-	if ( false === $function_to_check || false === $has )
149
+	if (false === $function_to_check || false === $has)
150 150
 		return $has;
151 151
 
152
-	if ( !$idx = _wp_filter_build_unique_id($tag, $function_to_check, false) )
152
+	if ( ! $idx = _wp_filter_build_unique_id($tag, $function_to_check, false))
153 153
 		return false;
154 154
 
155
-	foreach ( (array) array_keys($wp_filter[$tag]) as $priority ) {
156
-		if ( isset($wp_filter[$tag][$priority][$idx]) )
155
+	foreach ((array) array_keys($wp_filter[$tag]) as $priority) {
156
+		if (isset($wp_filter[$tag][$priority][$idx]))
157 157
 			return $priority;
158 158
 	}
159 159
 
@@ -196,48 +196,48 @@  discard block
 block discarded – undo
196 196
  * @param mixed  $var,... Additional variables passed to the functions hooked to `$tag`.
197 197
  * @return mixed The filtered value after all hooked functions are applied to it.
198 198
  */
199
-function apply_filters( $tag, $value ) {
199
+function apply_filters($tag, $value) {
200 200
 	global $wp_filter, $merged_filters, $wp_current_filter;
201 201
 
202 202
 	$args = array();
203 203
 
204 204
 	// Do 'all' actions first.
205
-	if ( isset($wp_filter['all']) ) {
205
+	if (isset($wp_filter['all'])) {
206 206
 		$wp_current_filter[] = $tag;
207 207
 		$args = func_get_args();
208 208
 		_wp_call_all_hook($args);
209 209
 	}
210 210
 
211
-	if ( !isset($wp_filter[$tag]) ) {
212
-		if ( isset($wp_filter['all']) )
211
+	if ( ! isset($wp_filter[$tag])) {
212
+		if (isset($wp_filter['all']))
213 213
 			array_pop($wp_current_filter);
214 214
 		return $value;
215 215
 	}
216 216
 
217
-	if ( !isset($wp_filter['all']) )
217
+	if ( ! isset($wp_filter['all']))
218 218
 		$wp_current_filter[] = $tag;
219 219
 
220 220
 	// Sort.
221
-	if ( !isset( $merged_filters[ $tag ] ) ) {
221
+	if ( ! isset($merged_filters[$tag])) {
222 222
 		ksort($wp_filter[$tag]);
223
-		$merged_filters[ $tag ] = true;
223
+		$merged_filters[$tag] = true;
224 224
 	}
225 225
 
226
-	reset( $wp_filter[ $tag ] );
226
+	reset($wp_filter[$tag]);
227 227
 
228
-	if ( empty($args) )
228
+	if (empty($args))
229 229
 		$args = func_get_args();
230 230
 
231 231
 	do {
232
-		foreach ( (array) current($wp_filter[$tag]) as $the_ )
233
-			if ( !is_null($the_['function']) ){
232
+		foreach ((array) current($wp_filter[$tag]) as $the_)
233
+			if ( ! is_null($the_['function'])) {
234 234
 				$args[1] = $value;
235 235
 				$value = call_user_func_array($the_['function'], array_slice($args, 1, (int) $the_['accepted_args']));
236 236
 			}
237 237
 
238
-	} while ( next($wp_filter[$tag]) !== false );
238
+	} while (next($wp_filter[$tag]) !== false);
239 239
 
240
-	array_pop( $wp_current_filter );
240
+	array_pop($wp_current_filter);
241 241
 
242 242
 	return $value;
243 243
 }
@@ -262,37 +262,37 @@  discard block
 block discarded – undo
262 262
 	global $wp_filter, $merged_filters, $wp_current_filter;
263 263
 
264 264
 	// Do 'all' actions first
265
-	if ( isset($wp_filter['all']) ) {
265
+	if (isset($wp_filter['all'])) {
266 266
 		$wp_current_filter[] = $tag;
267 267
 		$all_args = func_get_args();
268 268
 		_wp_call_all_hook($all_args);
269 269
 	}
270 270
 
271
-	if ( !isset($wp_filter[$tag]) ) {
272
-		if ( isset($wp_filter['all']) )
271
+	if ( ! isset($wp_filter[$tag])) {
272
+		if (isset($wp_filter['all']))
273 273
 			array_pop($wp_current_filter);
274 274
 		return $args[0];
275 275
 	}
276 276
 
277
-	if ( !isset($wp_filter['all']) )
277
+	if ( ! isset($wp_filter['all']))
278 278
 		$wp_current_filter[] = $tag;
279 279
 
280 280
 	// Sort
281
-	if ( !isset( $merged_filters[ $tag ] ) ) {
281
+	if ( ! isset($merged_filters[$tag])) {
282 282
 		ksort($wp_filter[$tag]);
283
-		$merged_filters[ $tag ] = true;
283
+		$merged_filters[$tag] = true;
284 284
 	}
285 285
 
286
-	reset( $wp_filter[ $tag ] );
286
+	reset($wp_filter[$tag]);
287 287
 
288 288
 	do {
289
-		foreach ( (array) current($wp_filter[$tag]) as $the_ )
290
-			if ( !is_null($the_['function']) )
289
+		foreach ((array) current($wp_filter[$tag]) as $the_)
290
+			if ( ! is_null($the_['function']))
291 291
 				$args[0] = call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args']));
292 292
 
293
-	} while ( next($wp_filter[$tag]) !== false );
293
+	} while (next($wp_filter[$tag]) !== false);
294 294
 
295
-	array_pop( $wp_current_filter );
295
+	array_pop($wp_current_filter);
296 296
 
297 297
 	return $args[0];
298 298
 }
@@ -318,20 +318,20 @@  discard block
 block discarded – undo
318 318
  * @param int      $priority           Optional. The priority of the function. Default 10.
319 319
  * @return bool    Whether the function existed before it was removed.
320 320
  */
321
-function remove_filter( $tag, $function_to_remove, $priority = 10 ) {
322
-	$function_to_remove = _wp_filter_build_unique_id( $tag, $function_to_remove, $priority );
321
+function remove_filter($tag, $function_to_remove, $priority = 10) {
322
+	$function_to_remove = _wp_filter_build_unique_id($tag, $function_to_remove, $priority);
323 323
 
324
-	$r = isset( $GLOBALS['wp_filter'][ $tag ][ $priority ][ $function_to_remove ] );
324
+	$r = isset($GLOBALS['wp_filter'][$tag][$priority][$function_to_remove]);
325 325
 
326
-	if ( true === $r ) {
327
-		unset( $GLOBALS['wp_filter'][ $tag ][ $priority ][ $function_to_remove ] );
328
-		if ( empty( $GLOBALS['wp_filter'][ $tag ][ $priority ] ) ) {
329
-			unset( $GLOBALS['wp_filter'][ $tag ][ $priority ] );
326
+	if (true === $r) {
327
+		unset($GLOBALS['wp_filter'][$tag][$priority][$function_to_remove]);
328
+		if (empty($GLOBALS['wp_filter'][$tag][$priority])) {
329
+			unset($GLOBALS['wp_filter'][$tag][$priority]);
330 330
 		}
331
-		if ( empty( $GLOBALS['wp_filter'][ $tag ] ) ) {
332
-			$GLOBALS['wp_filter'][ $tag ] = array();
331
+		if (empty($GLOBALS['wp_filter'][$tag])) {
332
+			$GLOBALS['wp_filter'][$tag] = array();
333 333
 		}
334
-		unset( $GLOBALS['merged_filters'][ $tag ] );
334
+		unset($GLOBALS['merged_filters'][$tag]);
335 335
 	}
336 336
 
337 337
 	return $r;
@@ -349,18 +349,18 @@  discard block
 block discarded – undo
349 349
  * @param int|bool $priority Optional. The priority number to remove. Default false.
350 350
  * @return true True when finished.
351 351
  */
352
-function remove_all_filters( $tag, $priority = false ) {
352
+function remove_all_filters($tag, $priority = false) {
353 353
 	global $wp_filter, $merged_filters;
354 354
 
355
-	if ( isset( $wp_filter[ $tag ]) ) {
356
-		if ( false === $priority ) {
357
-			$wp_filter[ $tag ] = array();
358
-		} elseif ( isset( $wp_filter[ $tag ][ $priority ] ) ) {
359
-			$wp_filter[ $tag ][ $priority ] = array();
355
+	if (isset($wp_filter[$tag])) {
356
+		if (false === $priority) {
357
+			$wp_filter[$tag] = array();
358
+		} elseif (isset($wp_filter[$tag][$priority])) {
359
+			$wp_filter[$tag][$priority] = array();
360 360
 		}
361 361
 	}
362 362
 
363
-	unset( $merged_filters[ $tag ] );
363
+	unset($merged_filters[$tag]);
364 364
 
365 365
 	return true;
366 366
 }
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
  */
377 377
 function current_filter() {
378 378
 	global $wp_current_filter;
379
-	return end( $wp_current_filter );
379
+	return end($wp_current_filter);
380 380
 }
381 381
 
382 382
 /**
@@ -411,14 +411,14 @@  discard block
 block discarded – undo
411 411
  *                            checks if any filter is currently being run.
412 412
  * @return bool Whether the filter is currently in the stack.
413 413
  */
414
-function doing_filter( $filter = null ) {
414
+function doing_filter($filter = null) {
415 415
 	global $wp_current_filter;
416 416
 
417
-	if ( null === $filter ) {
418
-		return ! empty( $wp_current_filter );
417
+	if (null === $filter) {
418
+		return ! empty($wp_current_filter);
419 419
 	}
420 420
 
421
-	return in_array( $filter, $wp_current_filter );
421
+	return in_array($filter, $wp_current_filter);
422 422
 }
423 423
 
424 424
 /**
@@ -430,8 +430,8 @@  discard block
 block discarded – undo
430 430
  *                            if any action is currently being run.
431 431
  * @return bool Whether the action is currently in the stack.
432 432
  */
433
-function doing_action( $action = null ) {
434
-	return doing_filter( $action );
433
+function doing_action($action = null) {
434
+	return doing_filter($action);
435 435
 }
436 436
 
437 437
 /**
@@ -482,49 +482,49 @@  discard block
 block discarded – undo
482 482
 function do_action($tag, $arg = '') {
483 483
 	global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter;
484 484
 
485
-	if ( ! isset($wp_actions[$tag]) )
485
+	if ( ! isset($wp_actions[$tag]))
486 486
 		$wp_actions[$tag] = 1;
487 487
 	else
488 488
 		++$wp_actions[$tag];
489 489
 
490 490
 	// Do 'all' actions first
491
-	if ( isset($wp_filter['all']) ) {
491
+	if (isset($wp_filter['all'])) {
492 492
 		$wp_current_filter[] = $tag;
493 493
 		$all_args = func_get_args();
494 494
 		_wp_call_all_hook($all_args);
495 495
 	}
496 496
 
497
-	if ( !isset($wp_filter[$tag]) ) {
498
-		if ( isset($wp_filter['all']) )
497
+	if ( ! isset($wp_filter[$tag])) {
498
+		if (isset($wp_filter['all']))
499 499
 			array_pop($wp_current_filter);
500 500
 		return;
501 501
 	}
502 502
 
503
-	if ( !isset($wp_filter['all']) )
503
+	if ( ! isset($wp_filter['all']))
504 504
 		$wp_current_filter[] = $tag;
505 505
 
506 506
 	$args = array();
507
-	if ( is_array($arg) && 1 == count($arg) && isset($arg[0]) && is_object($arg[0]) ) // array(&$this)
508
-		$args[] =& $arg[0];
507
+	if (is_array($arg) && 1 == count($arg) && isset($arg[0]) && is_object($arg[0])) // array(&$this)
508
+		$args[] = & $arg[0];
509 509
 	else
510 510
 		$args[] = $arg;
511
-	for ( $a = 2, $num = func_num_args(); $a < $num; $a++ )
511
+	for ($a = 2, $num = func_num_args(); $a < $num; $a++)
512 512
 		$args[] = func_get_arg($a);
513 513
 
514 514
 	// Sort
515
-	if ( !isset( $merged_filters[ $tag ] ) ) {
515
+	if ( ! isset($merged_filters[$tag])) {
516 516
 		ksort($wp_filter[$tag]);
517
-		$merged_filters[ $tag ] = true;
517
+		$merged_filters[$tag] = true;
518 518
 	}
519 519
 
520
-	reset( $wp_filter[ $tag ] );
520
+	reset($wp_filter[$tag]);
521 521
 
522 522
 	do {
523
-		foreach ( (array) current($wp_filter[$tag]) as $the_ )
524
-			if ( !is_null($the_['function']) )
523
+		foreach ((array) current($wp_filter[$tag]) as $the_)
524
+			if ( ! is_null($the_['function']))
525 525
 				call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args']));
526 526
 
527
-	} while ( next($wp_filter[$tag]) !== false );
527
+	} while (next($wp_filter[$tag]) !== false);
528 528
 
529 529
 	array_pop($wp_current_filter);
530 530
 }
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
 function did_action($tag) {
543 543
 	global $wp_actions;
544 544
 
545
-	if ( ! isset( $wp_actions[ $tag ] ) )
545
+	if ( ! isset($wp_actions[$tag]))
546 546
 		return 0;
547 547
 
548 548
 	return $wp_actions[$tag];
@@ -566,41 +566,41 @@  discard block
 block discarded – undo
566 566
 function do_action_ref_array($tag, $args) {
567 567
 	global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter;
568 568
 
569
-	if ( ! isset($wp_actions[$tag]) )
569
+	if ( ! isset($wp_actions[$tag]))
570 570
 		$wp_actions[$tag] = 1;
571 571
 	else
572 572
 		++$wp_actions[$tag];
573 573
 
574 574
 	// Do 'all' actions first
575
-	if ( isset($wp_filter['all']) ) {
575
+	if (isset($wp_filter['all'])) {
576 576
 		$wp_current_filter[] = $tag;
577 577
 		$all_args = func_get_args();
578 578
 		_wp_call_all_hook($all_args);
579 579
 	}
580 580
 
581
-	if ( !isset($wp_filter[$tag]) ) {
582
-		if ( isset($wp_filter['all']) )
581
+	if ( ! isset($wp_filter[$tag])) {
582
+		if (isset($wp_filter['all']))
583 583
 			array_pop($wp_current_filter);
584 584
 		return;
585 585
 	}
586 586
 
587
-	if ( !isset($wp_filter['all']) )
587
+	if ( ! isset($wp_filter['all']))
588 588
 		$wp_current_filter[] = $tag;
589 589
 
590 590
 	// Sort
591
-	if ( !isset( $merged_filters[ $tag ] ) ) {
591
+	if ( ! isset($merged_filters[$tag])) {
592 592
 		ksort($wp_filter[$tag]);
593
-		$merged_filters[ $tag ] = true;
593
+		$merged_filters[$tag] = true;
594 594
 	}
595 595
 
596
-	reset( $wp_filter[ $tag ] );
596
+	reset($wp_filter[$tag]);
597 597
 
598 598
 	do {
599
-		foreach ( (array) current($wp_filter[$tag]) as $the_ )
600
-			if ( !is_null($the_['function']) )
599
+		foreach ((array) current($wp_filter[$tag]) as $the_)
600
+			if ( ! is_null($the_['function']))
601 601
 				call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args']));
602 602
 
603
-	} while ( next($wp_filter[$tag]) !== false );
603
+	} while (next($wp_filter[$tag]) !== false);
604 604
 
605 605
 	array_pop($wp_current_filter);
606 606
 }
@@ -639,8 +639,8 @@  discard block
 block discarded – undo
639 639
  * @param int      $priority           Optional. The priority of the function. Default 10.
640 640
  * @return bool Whether the function is removed.
641 641
  */
642
-function remove_action( $tag, $function_to_remove, $priority = 10 ) {
643
-	return remove_filter( $tag, $function_to_remove, $priority );
642
+function remove_action($tag, $function_to_remove, $priority = 10) {
643
+	return remove_filter($tag, $function_to_remove, $priority);
644 644
 }
645 645
 
646 646
 /**
@@ -672,20 +672,20 @@  discard block
 block discarded – undo
672 672
  * @param string $file The filename of plugin.
673 673
  * @return string The name of a plugin.
674 674
  */
675
-function plugin_basename( $file ) {
675
+function plugin_basename($file) {
676 676
 	global $wp_plugin_paths;
677 677
 
678
-	foreach ( $wp_plugin_paths as $dir => $realdir ) {
679
-		if ( strpos( $file, $realdir ) === 0 ) {
680
-			$file = $dir . substr( $file, strlen( $realdir ) );
678
+	foreach ($wp_plugin_paths as $dir => $realdir) {
679
+		if (strpos($file, $realdir) === 0) {
680
+			$file = $dir.substr($file, strlen($realdir));
681 681
 		}
682 682
 	}
683 683
 
684
-	$file = wp_normalize_path( $file );
685
-	$plugin_dir = wp_normalize_path( WP_PLUGIN_DIR );
686
-	$mu_plugin_dir = wp_normalize_path( WPMU_PLUGIN_DIR );
684
+	$file = wp_normalize_path($file);
685
+	$plugin_dir = wp_normalize_path(WP_PLUGIN_DIR);
686
+	$mu_plugin_dir = wp_normalize_path(WPMU_PLUGIN_DIR);
687 687
 
688
-	$file = preg_replace('#^' . preg_quote($plugin_dir, '#') . '/|^' . preg_quote($mu_plugin_dir, '#') . '/#','',$file); // get relative path from plugins dir
688
+	$file = preg_replace('#^'.preg_quote($plugin_dir, '#').'/|^'.preg_quote($mu_plugin_dir, '#').'/#', '', $file); // get relative path from plugins dir
689 689
 	$file = trim($file, '/');
690 690
 	return $file;
691 691
 }
@@ -707,25 +707,25 @@  discard block
 block discarded – undo
707 707
  * @param string $file Known path to the file.
708 708
  * @return bool Whether the path was able to be registered.
709 709
  */
710
-function wp_register_plugin_realpath( $file ) {
710
+function wp_register_plugin_realpath($file) {
711 711
 	global $wp_plugin_paths;
712 712
 
713 713
 	// Normalize, but store as static to avoid recalculation of a constant value
714 714
 	static $wp_plugin_path = null, $wpmu_plugin_path = null;
715
-	if ( ! isset( $wp_plugin_path ) ) {
716
-		$wp_plugin_path   = wp_normalize_path( WP_PLUGIN_DIR   );
717
-		$wpmu_plugin_path = wp_normalize_path( WPMU_PLUGIN_DIR );
715
+	if ( ! isset($wp_plugin_path)) {
716
+		$wp_plugin_path   = wp_normalize_path(WP_PLUGIN_DIR);
717
+		$wpmu_plugin_path = wp_normalize_path(WPMU_PLUGIN_DIR);
718 718
 	}
719 719
 
720
-	$plugin_path = wp_normalize_path( dirname( $file ) );
721
-	$plugin_realpath = wp_normalize_path( dirname( realpath( $file ) ) );
720
+	$plugin_path = wp_normalize_path(dirname($file));
721
+	$plugin_realpath = wp_normalize_path(dirname(realpath($file)));
722 722
 
723
-	if ( $plugin_path === $wp_plugin_path || $plugin_path === $wpmu_plugin_path ) {
723
+	if ($plugin_path === $wp_plugin_path || $plugin_path === $wpmu_plugin_path) {
724 724
 		return false;
725 725
 	}
726 726
 
727
-	if ( $plugin_path !== $plugin_realpath ) {
728
-		$wp_plugin_paths[ $plugin_path ] = $plugin_realpath;
727
+	if ($plugin_path !== $plugin_realpath) {
728
+		$wp_plugin_paths[$plugin_path] = $plugin_realpath;
729 729
 	}
730 730
 
731 731
 	return true;
@@ -739,8 +739,8 @@  discard block
 block discarded – undo
739 739
  * @param string $file The filename of the plugin (__FILE__).
740 740
  * @return string the filesystem path of the directory that contains the plugin.
741 741
  */
742
-function plugin_dir_path( $file ) {
743
-	return trailingslashit( dirname( $file ) );
742
+function plugin_dir_path($file) {
743
+	return trailingslashit(dirname($file));
744 744
 }
745 745
 
746 746
 /**
@@ -751,8 +751,8 @@  discard block
 block discarded – undo
751 751
  * @param string $file The filename of the plugin (__FILE__).
752 752
  * @return string the URL path of the directory that contains the plugin.
753 753
  */
754
-function plugin_dir_url( $file ) {
755
-	return trailingslashit( plugins_url( '', $file ) );
754
+function plugin_dir_url($file) {
755
+	return trailingslashit(plugins_url('', $file));
756 756
 }
757 757
 
758 758
 /**
@@ -775,7 +775,7 @@  discard block
 block discarded – undo
775 775
  */
776 776
 function register_activation_hook($file, $function) {
777 777
 	$file = plugin_basename($file);
778
-	add_action('activate_' . $file, $function);
778
+	add_action('activate_'.$file, $function);
779 779
 }
780 780
 
781 781
 /**
@@ -798,7 +798,7 @@  discard block
 block discarded – undo
798 798
  */
799 799
 function register_deactivation_hook($file, $function) {
800 800
 	$file = plugin_basename($file);
801
-	add_action('deactivate_' . $file, $function);
801
+	add_action('deactivate_'.$file, $function);
802 802
 }
803 803
 
804 804
 /**
@@ -827,9 +827,9 @@  discard block
 block discarded – undo
827 827
  * @param callable $callback The callback to run when the hook is called. Must be
828 828
  *                           a static method or function.
829 829
  */
830
-function register_uninstall_hook( $file, $callback ) {
831
-	if ( is_array( $callback ) && is_object( $callback[0] ) ) {
832
-		_doing_it_wrong( __FUNCTION__, __( 'Only a static class method or function can be used in an uninstall hook.' ), '3.1' );
830
+function register_uninstall_hook($file, $callback) {
831
+	if (is_array($callback) && is_object($callback[0])) {
832
+		_doing_it_wrong(__FUNCTION__, __('Only a static class method or function can be used in an uninstall hook.'), '3.1');
833 833
 		return;
834 834
 	}
835 835
 
@@ -865,13 +865,13 @@  discard block
 block discarded – undo
865 865
 function _wp_call_all_hook($args) {
866 866
 	global $wp_filter;
867 867
 
868
-	reset( $wp_filter['all'] );
868
+	reset($wp_filter['all']);
869 869
 	do {
870
-		foreach ( (array) current($wp_filter['all']) as $the_ )
871
-			if ( !is_null($the_['function']) )
870
+		foreach ((array) current($wp_filter['all']) as $the_)
871
+			if ( ! is_null($the_['function']))
872 872
 				call_user_func_array($the_['function'], $args);
873 873
 
874
-	} while ( next($wp_filter['all']) !== false );
874
+	} while (next($wp_filter['all']) !== false);
875 875
 }
876 876
 
877 877
 /**
@@ -912,26 +912,26 @@  discard block
 block discarded – undo
912 912
 	global $wp_filter;
913 913
 	static $filter_id_count = 0;
914 914
 
915
-	if ( is_string($function) )
915
+	if (is_string($function))
916 916
 		return $function;
917 917
 
918
-	if ( is_object($function) ) {
918
+	if (is_object($function)) {
919 919
 		// Closures are currently implemented as objects
920
-		$function = array( $function, '' );
920
+		$function = array($function, '');
921 921
 	} else {
922 922
 		$function = (array) $function;
923 923
 	}
924 924
 
925
-	if (is_object($function[0]) ) {
925
+	if (is_object($function[0])) {
926 926
 		// Object Class Calling
927
-		if ( function_exists('spl_object_hash') ) {
928
-			return spl_object_hash($function[0]) . $function[1];
927
+		if (function_exists('spl_object_hash')) {
928
+			return spl_object_hash($function[0]).$function[1];
929 929
 		} else {
930 930
 			$obj_idx = get_class($function[0]).$function[1];
931
-			if ( !isset($function[0]->wp_filter_id) ) {
932
-				if ( false === $priority )
931
+			if ( ! isset($function[0]->wp_filter_id)) {
932
+				if (false === $priority)
933 933
 					return false;
934
-				$obj_idx .= isset($wp_filter[$tag][$priority]) ? count((array)$wp_filter[$tag][$priority]) : $filter_id_count;
934
+				$obj_idx .= isset($wp_filter[$tag][$priority]) ? count((array) $wp_filter[$tag][$priority]) : $filter_id_count;
935 935
 				$function[0]->wp_filter_id = $filter_id_count;
936 936
 				++$filter_id_count;
937 937
 			} else {
@@ -940,8 +940,8 @@  discard block
 block discarded – undo
940 940
 
941 941
 			return $obj_idx;
942 942
 		}
943
-	} elseif ( is_string( $function[0] ) ) {
943
+	} elseif (is_string($function[0])) {
944 944
 		// Static Calling
945
-		return $function[0] . '::' . $function[1];
945
+		return $function[0].'::'.$function[1];
946 946
 	}
947 947
 }
Please login to merge, or discard this patch.
Braces   +86 added lines, -57 removed lines patch added patch discarded remove patch
@@ -22,17 +22,21 @@  discard block
 block discarded – undo
22 22
 // Initialize the filter globals.
23 23
 global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter;
24 24
 
25
-if ( ! isset( $wp_filter ) )
25
+if ( ! isset( $wp_filter ) ) {
26 26
 	$wp_filter = array();
27
+}
27 28
 
28
-if ( ! isset( $wp_actions ) )
29
+if ( ! isset( $wp_actions ) ) {
29 30
 	$wp_actions = array();
31
+}
30 32
 
31
-if ( ! isset( $merged_filters ) )
33
+if ( ! isset( $merged_filters ) ) {
32 34
 	$merged_filters = array();
35
+}
33 36
 
34
-if ( ! isset( $wp_current_filter ) )
37
+if ( ! isset( $wp_current_filter ) ) {
35 38
 	$wp_current_filter = array();
39
+}
36 40
 
37 41
 /**
38 42
  * Hook a function or method to a specific filter action.
@@ -146,15 +150,18 @@  discard block
 block discarded – undo
146 150
 		}
147 151
 	}
148 152
 
149
-	if ( false === $function_to_check || false === $has )
150
-		return $has;
153
+	if ( false === $function_to_check || false === $has ) {
154
+			return $has;
155
+	}
151 156
 
152
-	if ( !$idx = _wp_filter_build_unique_id($tag, $function_to_check, false) )
153
-		return false;
157
+	if ( !$idx = _wp_filter_build_unique_id($tag, $function_to_check, false) ) {
158
+			return false;
159
+	}
154 160
 
155 161
 	foreach ( (array) array_keys($wp_filter[$tag]) as $priority ) {
156
-		if ( isset($wp_filter[$tag][$priority][$idx]) )
157
-			return $priority;
162
+		if ( isset($wp_filter[$tag][$priority][$idx]) ) {
163
+					return $priority;
164
+		}
158 165
 	}
159 166
 
160 167
 	return false;
@@ -209,13 +216,15 @@  discard block
 block discarded – undo
209 216
 	}
210 217
 
211 218
 	if ( !isset($wp_filter[$tag]) ) {
212
-		if ( isset($wp_filter['all']) )
213
-			array_pop($wp_current_filter);
219
+		if ( isset($wp_filter['all']) ) {
220
+					array_pop($wp_current_filter);
221
+		}
214 222
 		return $value;
215 223
 	}
216 224
 
217
-	if ( !isset($wp_filter['all']) )
218
-		$wp_current_filter[] = $tag;
225
+	if ( !isset($wp_filter['all']) ) {
226
+			$wp_current_filter[] = $tag;
227
+	}
219 228
 
220 229
 	// Sort.
221 230
 	if ( !isset( $merged_filters[ $tag ] ) ) {
@@ -225,13 +234,15 @@  discard block
 block discarded – undo
225 234
 
226 235
 	reset( $wp_filter[ $tag ] );
227 236
 
228
-	if ( empty($args) )
229
-		$args = func_get_args();
237
+	if ( empty($args) ) {
238
+			$args = func_get_args();
239
+	}
230 240
 
231 241
 	do {
232
-		foreach ( (array) current($wp_filter[$tag]) as $the_ )
233
-			if ( !is_null($the_['function']) ){
242
+		foreach ( (array) current($wp_filter[$tag]) as $the_ ) {
243
+					if ( !is_null($the_['function']) ){
234 244
 				$args[1] = $value;
245
+		}
235 246
 				$value = call_user_func_array($the_['function'], array_slice($args, 1, (int) $the_['accepted_args']));
236 247
 			}
237 248
 
@@ -269,13 +280,15 @@  discard block
 block discarded – undo
269 280
 	}
270 281
 
271 282
 	if ( !isset($wp_filter[$tag]) ) {
272
-		if ( isset($wp_filter['all']) )
273
-			array_pop($wp_current_filter);
283
+		if ( isset($wp_filter['all']) ) {
284
+					array_pop($wp_current_filter);
285
+		}
274 286
 		return $args[0];
275 287
 	}
276 288
 
277
-	if ( !isset($wp_filter['all']) )
278
-		$wp_current_filter[] = $tag;
289
+	if ( !isset($wp_filter['all']) ) {
290
+			$wp_current_filter[] = $tag;
291
+	}
279 292
 
280 293
 	// Sort
281 294
 	if ( !isset( $merged_filters[ $tag ] ) ) {
@@ -286,9 +299,10 @@  discard block
 block discarded – undo
286 299
 	reset( $wp_filter[ $tag ] );
287 300
 
288 301
 	do {
289
-		foreach ( (array) current($wp_filter[$tag]) as $the_ )
290
-			if ( !is_null($the_['function']) )
302
+		foreach ( (array) current($wp_filter[$tag]) as $the_ ) {
303
+					if ( !is_null($the_['function']) )
291 304
 				$args[0] = call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args']));
305
+		}
292 306
 
293 307
 	} while ( next($wp_filter[$tag]) !== false );
294 308
 
@@ -482,10 +496,11 @@  discard block
 block discarded – undo
482 496
 function do_action($tag, $arg = '') {
483 497
 	global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter;
484 498
 
485
-	if ( ! isset($wp_actions[$tag]) )
486
-		$wp_actions[$tag] = 1;
487
-	else
488
-		++$wp_actions[$tag];
499
+	if ( ! isset($wp_actions[$tag]) ) {
500
+			$wp_actions[$tag] = 1;
501
+	} else {
502
+			++$wp_actions[$tag];
503
+	}
489 504
 
490 505
 	// Do 'all' actions first
491 506
 	if ( isset($wp_filter['all']) ) {
@@ -495,21 +510,26 @@  discard block
 block discarded – undo
495 510
 	}
496 511
 
497 512
 	if ( !isset($wp_filter[$tag]) ) {
498
-		if ( isset($wp_filter['all']) )
499
-			array_pop($wp_current_filter);
513
+		if ( isset($wp_filter['all']) ) {
514
+					array_pop($wp_current_filter);
515
+		}
500 516
 		return;
501 517
 	}
502 518
 
503
-	if ( !isset($wp_filter['all']) )
504
-		$wp_current_filter[] = $tag;
519
+	if ( !isset($wp_filter['all']) ) {
520
+			$wp_current_filter[] = $tag;
521
+	}
505 522
 
506 523
 	$args = array();
507
-	if ( is_array($arg) && 1 == count($arg) && isset($arg[0]) && is_object($arg[0]) ) // array(&$this)
524
+	if ( is_array($arg) && 1 == count($arg) && isset($arg[0]) && is_object($arg[0]) ) {
525
+		// array(&$this)
508 526
 		$args[] =& $arg[0];
509
-	else
510
-		$args[] = $arg;
511
-	for ( $a = 2, $num = func_num_args(); $a < $num; $a++ )
512
-		$args[] = func_get_arg($a);
527
+	} else {
528
+			$args[] = $arg;
529
+	}
530
+	for ( $a = 2, $num = func_num_args(); $a < $num; $a++ ) {
531
+			$args[] = func_get_arg($a);
532
+	}
513 533
 
514 534
 	// Sort
515 535
 	if ( !isset( $merged_filters[ $tag ] ) ) {
@@ -520,9 +540,10 @@  discard block
 block discarded – undo
520 540
 	reset( $wp_filter[ $tag ] );
521 541
 
522 542
 	do {
523
-		foreach ( (array) current($wp_filter[$tag]) as $the_ )
524
-			if ( !is_null($the_['function']) )
543
+		foreach ( (array) current($wp_filter[$tag]) as $the_ ) {
544
+					if ( !is_null($the_['function']) )
525 545
 				call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args']));
546
+		}
526 547
 
527 548
 	} while ( next($wp_filter[$tag]) !== false );
528 549
 
@@ -542,8 +563,9 @@  discard block
 block discarded – undo
542 563
 function did_action($tag) {
543 564
 	global $wp_actions;
544 565
 
545
-	if ( ! isset( $wp_actions[ $tag ] ) )
546
-		return 0;
566
+	if ( ! isset( $wp_actions[ $tag ] ) ) {
567
+			return 0;
568
+	}
547 569
 
548 570
 	return $wp_actions[$tag];
549 571
 }
@@ -566,10 +588,11 @@  discard block
 block discarded – undo
566 588
 function do_action_ref_array($tag, $args) {
567 589
 	global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter;
568 590
 
569
-	if ( ! isset($wp_actions[$tag]) )
570
-		$wp_actions[$tag] = 1;
571
-	else
572
-		++$wp_actions[$tag];
591
+	if ( ! isset($wp_actions[$tag]) ) {
592
+			$wp_actions[$tag] = 1;
593
+	} else {
594
+			++$wp_actions[$tag];
595
+	}
573 596
 
574 597
 	// Do 'all' actions first
575 598
 	if ( isset($wp_filter['all']) ) {
@@ -579,13 +602,15 @@  discard block
 block discarded – undo
579 602
 	}
580 603
 
581 604
 	if ( !isset($wp_filter[$tag]) ) {
582
-		if ( isset($wp_filter['all']) )
583
-			array_pop($wp_current_filter);
605
+		if ( isset($wp_filter['all']) ) {
606
+					array_pop($wp_current_filter);
607
+		}
584 608
 		return;
585 609
 	}
586 610
 
587
-	if ( !isset($wp_filter['all']) )
588
-		$wp_current_filter[] = $tag;
611
+	if ( !isset($wp_filter['all']) ) {
612
+			$wp_current_filter[] = $tag;
613
+	}
589 614
 
590 615
 	// Sort
591 616
 	if ( !isset( $merged_filters[ $tag ] ) ) {
@@ -596,9 +621,10 @@  discard block
 block discarded – undo
596 621
 	reset( $wp_filter[ $tag ] );
597 622
 
598 623
 	do {
599
-		foreach ( (array) current($wp_filter[$tag]) as $the_ )
600
-			if ( !is_null($the_['function']) )
624
+		foreach ( (array) current($wp_filter[$tag]) as $the_ ) {
625
+					if ( !is_null($the_['function']) )
601 626
 				call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args']));
627
+		}
602 628
 
603 629
 	} while ( next($wp_filter[$tag]) !== false );
604 630
 
@@ -867,9 +893,10 @@  discard block
 block discarded – undo
867 893
 
868 894
 	reset( $wp_filter['all'] );
869 895
 	do {
870
-		foreach ( (array) current($wp_filter['all']) as $the_ )
871
-			if ( !is_null($the_['function']) )
896
+		foreach ( (array) current($wp_filter['all']) as $the_ ) {
897
+					if ( !is_null($the_['function']) )
872 898
 				call_user_func_array($the_['function'], $args);
899
+		}
873 900
 
874 901
 	} while ( next($wp_filter['all']) !== false );
875 902
 }
@@ -912,8 +939,9 @@  discard block
 block discarded – undo
912 939
 	global $wp_filter;
913 940
 	static $filter_id_count = 0;
914 941
 
915
-	if ( is_string($function) )
916
-		return $function;
942
+	if ( is_string($function) ) {
943
+			return $function;
944
+	}
917 945
 
918 946
 	if ( is_object($function) ) {
919 947
 		// Closures are currently implemented as objects
@@ -929,8 +957,9 @@  discard block
 block discarded – undo
929 957
 		} else {
930 958
 			$obj_idx = get_class($function[0]).$function[1];
931 959
 			if ( !isset($function[0]->wp_filter_id) ) {
932
-				if ( false === $priority )
933
-					return false;
960
+				if ( false === $priority ) {
961
+									return false;
962
+				}
934 963
 				$obj_idx .= isset($wp_filter[$tag][$priority]) ? count((array)$wp_filter[$tag][$priority]) : $filter_id_count;
935 964
 				$function[0]->wp_filter_id = $filter_id_count;
936 965
 				++$filter_id_count;
Please login to merge, or discard this patch.
src/wp-includes/pomo/po.php 3 patches
Doc Comments   +7 added lines, -2 removed lines patch added patch discarded remove patch
@@ -87,6 +87,7 @@  discard block
 block discarded – undo
87 87
 	 * Text to include as a comment before the start of the PO contents
88 88
 	 *
89 89
 	 * Doesn't need to include # in the beginning of lines, these are added automatically
90
+	 * @param string $text
90 91
 	 */
91 92
 	function set_comment_before_headers( $text ) {
92 93
 		$this->comments_before_headers = $text;
@@ -196,6 +197,7 @@  discard block
 block discarded – undo
196 197
 	 *
197 198
 	 * @static
198 199
 	 * @param Translation_Entry &$entry the entry to convert to po string
200
+	 * @param Translation_Entry $entry
199 201
 	 * @return false|string PO-style formatted string for the entry or
200 202
 	 * 	false if the entry is empty
201 203
 	 */
@@ -223,6 +225,9 @@  discard block
 block discarded – undo
223 225
 		return implode("\n", $po);
224 226
 	}
225 227
 
228
+	/**
229
+	 * @return string
230
+	 */
226 231
 	public static function match_begin_and_end_newlines( $translation, $original ) {
227 232
 		if ( '' === $translation ) {
228 233
 			return $translation;
@@ -395,7 +400,7 @@  discard block
 block discarded – undo
395 400
 	 *
396 401
 	 * @param     resource $f
397 402
 	 * @param     string   $action
398
-	 * @return boolean
403
+	 * @return boolean|string
399 404
 	 */
400 405
 	function read_line($f, $action = 'read') {
401 406
 		static $last_line = '';
@@ -435,7 +440,7 @@  discard block
 block discarded – undo
435 440
 
436 441
 	/**
437 442
 	 * @param string $s
438
-	 * @return sring
443
+	 * @return string
439 444
 	 */
440 445
 	public static function trim_quotes($s) {
441 446
 		if ( substr($s, 0, 1) == '"') $s = substr($s, 1);
Please login to merge, or discard this patch.
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -7,9 +7,9 @@  discard block
 block discarded – undo
7 7
  * @subpackage po
8 8
  */
9 9
 
10
-require_once dirname(__FILE__) . '/translations.php';
10
+require_once dirname(__FILE__).'/translations.php';
11 11
 
12
-if ( ! defined( 'PO_MAX_LINE_LEN' ) ) {
12
+if ( ! defined('PO_MAX_LINE_LEN')) {
13 13
 	define('PO_MAX_LINE_LEN', 79);
14 14
 }
15 15
 
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 /**
19 19
  * Routines for working with PO files
20 20
  */
21
-if ( ! class_exists( 'PO', false ) ):
21
+if ( ! class_exists('PO', false)):
22 22
 class PO extends Gettext_Translations {
23 23
 
24 24
 	var $comments_before_headers = '';
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
30 30
 	 */
31 31
 	function export_headers() {
32 32
 		$header_string = '';
33
-		foreach($this->headers as $header => $value) {
34
-			$header_string.= "$header: $value\n";
33
+		foreach ($this->headers as $header => $value) {
34
+			$header_string .= "$header: $value\n";
35 35
 		}
36 36
 		$poified = PO::poify($header_string);
37 37
 		if ($this->comments_before_headers)
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	 *
89 89
 	 * Doesn't need to include # in the beginning of lines, these are added automatically
90 90
 	 */
91
-	function set_comment_before_headers( $text ) {
91
+	function set_comment_before_headers($text) {
92 92
 		$this->comments_before_headers = $text;
93 93
 	}
94 94
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 		$po = $quote.implode("${slash}n$quote$newline$quote", explode($newline, $string)).$quote;
116 116
 		// add empty string on first line for readbility
117 117
 		if (false !== strpos($string, $newline) &&
118
-				(substr_count($string, $newline) > 1 || !($newline === substr($string, -strlen($newline))))) {
118
+				(substr_count($string, $newline) > 1 || ! ($newline === substr($string, -strlen($newline))))) {
119 119
 			$po = "$quote$quote$newline$po";
120 120
 		}
121 121
 		// remove empty strings
@@ -136,24 +136,24 @@  discard block
 block discarded – undo
136 136
 		$lines = array_map(array('PO', 'trim_quotes'), $lines);
137 137
 		$unpoified = '';
138 138
 		$previous_is_backslash = false;
139
-		foreach($lines as $line) {
139
+		foreach ($lines as $line) {
140 140
 			preg_match_all('/./u', $line, $chars);
141 141
 			$chars = $chars[0];
142
-			foreach($chars as $char) {
143
-				if (!$previous_is_backslash) {
142
+			foreach ($chars as $char) {
143
+				if ( ! $previous_is_backslash) {
144 144
 					if ('\\' == $char)
145 145
 						$previous_is_backslash = true;
146 146
 					else
147 147
 						$unpoified .= $char;
148 148
 				} else {
149 149
 					$previous_is_backslash = false;
150
-					$unpoified .= isset($escapes[$char])? $escapes[$char] : $char;
150
+					$unpoified .= isset($escapes[$char]) ? $escapes[$char] : $char;
151 151
 				}
152 152
 			}
153 153
 		}
154 154
 
155 155
 		// Standardise the line endings on imported content, technically PO files shouldn't contain \r
156
-		$unpoified = str_replace( array( "\r\n", "\r" ), "\n", $unpoified );
156
+		$unpoified = str_replace(array("\r\n", "\r"), "\n", $unpoified);
157 157
 
158 158
 		return $unpoified;
159 159
 	}
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 	 * @param string $char character to denote a special PO comment,
187 187
 	 * 	like :, default is a space
188 188
 	 */
189
-	public static function comment_block($text, $char=' ') {
189
+	public static function comment_block($text, $char = ' ') {
190 190
 		$text = wordwrap($text, PO_MAX_LINE_LEN - 3);
191 191
 		return PO::prepend_each_line($text, "#$char ");
192 192
 	}
@@ -200,53 +200,53 @@  discard block
 block discarded – undo
200 200
 	 * 	false if the entry is empty
201 201
 	 */
202 202
 	public static function export_entry(&$entry) {
203
-		if ( null === $entry->singular || '' === $entry->singular ) return false;
203
+		if (null === $entry->singular || '' === $entry->singular) return false;
204 204
 		$po = array();
205
-		if (!empty($entry->translator_comments)) $po[] = PO::comment_block($entry->translator_comments);
206
-		if (!empty($entry->extracted_comments)) $po[] = PO::comment_block($entry->extracted_comments, '.');
207
-		if (!empty($entry->references)) $po[] = PO::comment_block(implode(' ', $entry->references), ':');
208
-		if (!empty($entry->flags)) $po[] = PO::comment_block(implode(", ", $entry->flags), ',');
205
+		if ( ! empty($entry->translator_comments)) $po[] = PO::comment_block($entry->translator_comments);
206
+		if ( ! empty($entry->extracted_comments)) $po[] = PO::comment_block($entry->extracted_comments, '.');
207
+		if ( ! empty($entry->references)) $po[] = PO::comment_block(implode(' ', $entry->references), ':');
208
+		if ( ! empty($entry->flags)) $po[] = PO::comment_block(implode(", ", $entry->flags), ',');
209 209
 		if ($entry->context) $po[] = 'msgctxt '.PO::poify($entry->context);
210 210
 		$po[] = 'msgid '.PO::poify($entry->singular);
211
-		if (!$entry->is_plural) {
212
-			$translation = empty($entry->translations)? '' : $entry->translations[0];
213
-			$translation = PO::match_begin_and_end_newlines( $translation, $entry->singular );
211
+		if ( ! $entry->is_plural) {
212
+			$translation = empty($entry->translations) ? '' : $entry->translations[0];
213
+			$translation = PO::match_begin_and_end_newlines($translation, $entry->singular);
214 214
 			$po[] = 'msgstr '.PO::poify($translation);
215 215
 		} else {
216 216
 			$po[] = 'msgid_plural '.PO::poify($entry->plural);
217
-			$translations = empty($entry->translations)? array('', '') : $entry->translations;
218
-			foreach($translations as $i => $translation) {
219
-				$translation = PO::match_begin_and_end_newlines( $translation, $entry->plural );
217
+			$translations = empty($entry->translations) ? array('', '') : $entry->translations;
218
+			foreach ($translations as $i => $translation) {
219
+				$translation = PO::match_begin_and_end_newlines($translation, $entry->plural);
220 220
 				$po[] = "msgstr[$i] ".PO::poify($translation);
221 221
 			}
222 222
 		}
223 223
 		return implode("\n", $po);
224 224
 	}
225 225
 
226
-	public static function match_begin_and_end_newlines( $translation, $original ) {
227
-		if ( '' === $translation ) {
226
+	public static function match_begin_and_end_newlines($translation, $original) {
227
+		if ('' === $translation) {
228 228
 			return $translation;
229 229
 		}
230 230
 
231
-		$original_begin = "\n" === substr( $original, 0, 1 );
232
-		$original_end = "\n" === substr( $original, -1 );
233
-		$translation_begin = "\n" === substr( $translation, 0, 1 );
234
-		$translation_end = "\n" === substr( $translation, -1 );
231
+		$original_begin = "\n" === substr($original, 0, 1);
232
+		$original_end = "\n" === substr($original, -1);
233
+		$translation_begin = "\n" === substr($translation, 0, 1);
234
+		$translation_end = "\n" === substr($translation, -1);
235 235
 
236
-		if ( $original_begin ) {
237
-			if ( ! $translation_begin ) {
238
-				$translation = "\n" . $translation;
236
+		if ($original_begin) {
237
+			if ( ! $translation_begin) {
238
+				$translation = "\n".$translation;
239 239
 			}
240
-		} elseif ( $translation_begin ) {
241
-			$translation = ltrim( $translation, "\n" );
240
+		} elseif ($translation_begin) {
241
+			$translation = ltrim($translation, "\n");
242 242
 		}
243 243
 
244
-		if ( $original_end ) {
245
-			if ( ! $translation_end ) {
244
+		if ($original_end) {
245
+			if ( ! $translation_end) {
246 246
 				$translation .= "\n";
247 247
 			}
248
-		} elseif ( $translation_end ) {
249
-			$translation = rtrim( $translation, "\n" );
248
+		} elseif ($translation_end) {
249
+			$translation = rtrim($translation, "\n");
250 250
 		}
251 251
 
252 252
 		return $translation;
@@ -258,11 +258,11 @@  discard block
 block discarded – undo
258 258
 	 */
259 259
 	function import_from_file($filename) {
260 260
 		$f = fopen($filename, 'r');
261
-		if (!$f) return false;
261
+		if ( ! $f) return false;
262 262
 		$lineno = 0;
263 263
 		while (true) {
264 264
 			$res = $this->read_entry($f, $lineno);
265
-			if (!$res) break;
265
+			if ( ! $res) break;
266 266
 			if ($res['entry']->singular == '') {
267 267
 				$this->set_headers($this->make_headers($res['entry']->translations[0]));
268 268
 			} else {
@@ -270,10 +270,10 @@  discard block
 block discarded – undo
270 270
 			}
271 271
 		}
272 272
 		PO::read_line($f, 'clear');
273
-		if ( false === $res ) {
273
+		if (false === $res) {
274 274
 			return false;
275 275
 		}
276
-		if ( ! $this->headers && ! $this->entries ) {
276
+		if ( ! $this->headers && ! $this->entries) {
277 277
 			return false;
278 278
 		}
279 279
 		return true;
@@ -294,11 +294,11 @@  discard block
 block discarded – undo
294 294
 		while (true) {
295 295
 			$lineno++;
296 296
 			$line = PO::read_line($f);
297
-			if (!$line)  {
297
+			if ( ! $line) {
298 298
 				if (feof($f)) {
299 299
 					if ($is_final($context))
300 300
 						break;
301
-					elseif (!$context) // we haven't read a line and eof came
301
+					elseif ( ! $context) // we haven't read a line and eof came
302 302
 						return null;
303 303
 					else
304 304
 						return false;
@@ -408,8 +408,8 @@  discard block
 block discarded – undo
408 408
 			$use_last_line = true;
409 409
 			return true;
410 410
 		}
411
-		$line = $use_last_line? $last_line : fgets($f);
412
-		$line = ( "\r\n" == substr( $line, -2 ) ) ? rtrim( $line, "\r\n" ) . "\n" : $line;
411
+		$line = $use_last_line ? $last_line : fgets($f);
412
+		$line = ("\r\n" == substr($line, -2)) ? rtrim($line, "\r\n")."\n" : $line;
413 413
 		$last_line = $line;
414 414
 		$use_last_line = false;
415 415
 		return $line;
@@ -425,11 +425,11 @@  discard block
 block discarded – undo
425 425
 		if ('#:' == $first_two) {
426 426
 			$entry->references = array_merge($entry->references, preg_split('/\s+/', $comment));
427 427
 		} elseif ('#.' == $first_two) {
428
-			$entry->extracted_comments = trim($entry->extracted_comments . "\n" . $comment);
428
+			$entry->extracted_comments = trim($entry->extracted_comments."\n".$comment);
429 429
 		} elseif ('#,' == $first_two) {
430 430
 			$entry->flags = array_merge($entry->flags, preg_split('/,\s*/', $comment));
431 431
 		} else {
432
-			$entry->translator_comments = trim($entry->translator_comments . "\n" . $comment);
432
+			$entry->translator_comments = trim($entry->translator_comments."\n".$comment);
433 433
 		}
434 434
 	}
435 435
 
@@ -438,8 +438,8 @@  discard block
 block discarded – undo
438 438
 	 * @return sring
439 439
 	 */
440 440
 	public static function trim_quotes($s) {
441
-		if ( substr($s, 0, 1) == '"') $s = substr($s, 1);
442
-		if ( substr($s, -1, 1) == '"') $s = substr($s, 0, -1);
441
+		if (substr($s, 0, 1) == '"') $s = substr($s, 1);
442
+		if (substr($s, -1, 1) == '"') $s = substr($s, 0, -1);
443 443
 		return $s;
444 444
 	}
445 445
 }
Please login to merge, or discard this patch.
Braces   +62 added lines, -28 removed lines patch added patch discarded remove patch
@@ -34,10 +34,11 @@  discard block
 block discarded – undo
34 34
 			$header_string.= "$header: $value\n";
35 35
 		}
36 36
 		$poified = PO::poify($header_string);
37
-		if ($this->comments_before_headers)
38
-			$before_headers = $this->prepend_each_line(rtrim($this->comments_before_headers)."\n", '# ');
39
-		else
40
-			$before_headers = '';
37
+		if ($this->comments_before_headers) {
38
+					$before_headers = $this->prepend_each_line(rtrim($this->comments_before_headers)."\n", '# ');
39
+		} else {
40
+					$before_headers = '';
41
+		}
41 42
 		return rtrim("{$before_headers}msgid \"\"\nmsgstr $poified");
42 43
 	}
43 44
 
@@ -76,10 +77,14 @@  discard block
 block discarded – undo
76 77
 	 */
77 78
 	function export_to_file($filename, $include_headers = true) {
78 79
 		$fh = fopen($filename, 'w');
79
-		if (false === $fh) return false;
80
+		if (false === $fh) {
81
+			return false;
82
+		}
80 83
 		$export = $this->export($include_headers);
81 84
 		$res = fwrite($fh, $export);
82
-		if (false === $res) return false;
85
+		if (false === $res) {
86
+			return false;
87
+		}
83 88
 		return fclose($fh);
84 89
 	}
85 90
 
@@ -141,10 +146,11 @@  discard block
 block discarded – undo
141 146
 			$chars = $chars[0];
142 147
 			foreach($chars as $char) {
143 148
 				if (!$previous_is_backslash) {
144
-					if ('\\' == $char)
145
-						$previous_is_backslash = true;
146
-					else
147
-						$unpoified .= $char;
149
+					if ('\\' == $char) {
150
+											$previous_is_backslash = true;
151
+					} else {
152
+											$unpoified .= $char;
153
+					}
148 154
 				} else {
149 155
 					$previous_is_backslash = false;
150 156
 					$unpoified .= isset($escapes[$char])? $escapes[$char] : $char;
@@ -170,10 +176,14 @@  discard block
 block discarded – undo
170 176
 		$php_with = var_export($with, true);
171 177
 		$lines = explode("\n", $string);
172 178
 		// do not prepend the string on the last empty line, artefact by explode
173
-		if ("\n" == substr($string, -1)) unset($lines[count($lines) - 1]);
179
+		if ("\n" == substr($string, -1)) {
180
+			unset($lines[count($lines) - 1]);
181
+		}
174 182
 		$res = implode("\n", array_map(create_function('$x', "return $php_with.\$x;"), $lines));
175 183
 		// give back the empty line, we ignored above
176
-		if ("\n" == substr($string, -1)) $res .= "\n";
184
+		if ("\n" == substr($string, -1)) {
185
+			$res .= "\n";
186
+		}
177 187
 		return $res;
178 188
 	}
179 189
 
@@ -200,13 +210,25 @@  discard block
 block discarded – undo
200 210
 	 * 	false if the entry is empty
201 211
 	 */
202 212
 	public static function export_entry(&$entry) {
203
-		if ( null === $entry->singular || '' === $entry->singular ) return false;
213
+		if ( null === $entry->singular || '' === $entry->singular ) {
214
+			return false;
215
+		}
204 216
 		$po = array();
205
-		if (!empty($entry->translator_comments)) $po[] = PO::comment_block($entry->translator_comments);
206
-		if (!empty($entry->extracted_comments)) $po[] = PO::comment_block($entry->extracted_comments, '.');
207
-		if (!empty($entry->references)) $po[] = PO::comment_block(implode(' ', $entry->references), ':');
208
-		if (!empty($entry->flags)) $po[] = PO::comment_block(implode(", ", $entry->flags), ',');
209
-		if ($entry->context) $po[] = 'msgctxt '.PO::poify($entry->context);
217
+		if (!empty($entry->translator_comments)) {
218
+			$po[] = PO::comment_block($entry->translator_comments);
219
+		}
220
+		if (!empty($entry->extracted_comments)) {
221
+			$po[] = PO::comment_block($entry->extracted_comments, '.');
222
+		}
223
+		if (!empty($entry->references)) {
224
+			$po[] = PO::comment_block(implode(' ', $entry->references), ':');
225
+		}
226
+		if (!empty($entry->flags)) {
227
+			$po[] = PO::comment_block(implode(", ", $entry->flags), ',');
228
+		}
229
+		if ($entry->context) {
230
+			$po[] = 'msgctxt '.PO::poify($entry->context);
231
+		}
210 232
 		$po[] = 'msgid '.PO::poify($entry->singular);
211 233
 		if (!$entry->is_plural) {
212 234
 			$translation = empty($entry->translations)? '' : $entry->translations[0];
@@ -258,11 +280,15 @@  discard block
 block discarded – undo
258 280
 	 */
259 281
 	function import_from_file($filename) {
260 282
 		$f = fopen($filename, 'r');
261
-		if (!$f) return false;
283
+		if (!$f) {
284
+			return false;
285
+		}
262 286
 		$lineno = 0;
263 287
 		while (true) {
264 288
 			$res = $this->read_entry($f, $lineno);
265
-			if (!$res) break;
289
+			if (!$res) {
290
+				break;
291
+			}
266 292
 			if ($res['entry']->singular == '') {
267 293
 				$this->set_headers($this->make_headers($res['entry']->translations[0]));
268 294
 			} else {
@@ -296,17 +322,21 @@  discard block
 block discarded – undo
296 322
 			$line = PO::read_line($f);
297 323
 			if (!$line)  {
298 324
 				if (feof($f)) {
299
-					if ($is_final($context))
300
-						break;
301
-					elseif (!$context) // we haven't read a line and eof came
325
+					if ($is_final($context)) {
326
+											break;
327
+					} elseif (!$context) {
328
+						// we haven't read a line and eof came
302 329
 						return null;
303
-					else
304
-						return false;
330
+					} else {
331
+											return false;
332
+					}
305 333
 				} else {
306 334
 					return false;
307 335
 				}
308 336
 			}
309
-			if ($line == "\n") continue;
337
+			if ($line == "\n") {
338
+				continue;
339
+			}
310 340
 			$line = trim($line);
311 341
 			if (preg_match('/^#/', $line, $m)) {
312 342
 				// the comment is the start of a new entry
@@ -438,8 +468,12 @@  discard block
 block discarded – undo
438 468
 	 * @return sring
439 469
 	 */
440 470
 	public static function trim_quotes($s) {
441
-		if ( substr($s, 0, 1) == '"') $s = substr($s, 1);
442
-		if ( substr($s, -1, 1) == '"') $s = substr($s, 0, -1);
471
+		if ( substr($s, 0, 1) == '"') {
472
+			$s = substr($s, 1);
473
+		}
474
+		if ( substr($s, -1, 1) == '"') {
475
+			$s = substr($s, 0, -1);
476
+		}
443 477
 		return $s;
444 478
 	}
445 479
 }
Please login to merge, or discard this patch.
src/wp-includes/post-template.php 4 patches
Doc Comments   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
  *
105 105
  * @since 0.71
106 106
  *
107
- * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
107
+ * @param integer $post Optional. Post ID or WP_Post object. Default is global $post.
108 108
  * @return string
109 109
  */
110 110
 function get_the_title( $post = 0 ) {
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
  *
170 170
  * @since 1.5.0
171 171
  *
172
- * @param int|WP_Post $post Optional. Post ID or post object. Default is global $post.
172
+ * @param integer $post Optional. Post ID or post object. Default is global $post.
173 173
  */
174 174
 function the_guid( $post = 0 ) {
175 175
 	$post = get_post( $post );
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
  *
200 200
  * @since 1.5.0
201 201
  *
202
- * @param int|WP_Post $post Optional. Post ID or post object. Default is global $post.
202
+ * @param integer $post Optional. Post ID or post object. Default is global $post.
203 203
  * @return string
204 204
  */
205 205
 function get_the_guid( $post = 0 ) {
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
  *
394 394
  * @since 2.3.0
395 395
  *
396
- * @param int|WP_Post $id Optional. Post ID or post object.
396
+ * @param integer $id Optional. Post ID or post object.
397 397
  * @return bool
398 398
  */
399 399
 function has_excerpt( $id = 0 ) {
@@ -1403,7 +1403,7 @@  discard block
 block discarded – undo
1403 1403
  *
1404 1404
  * @since 2.0.0
1405 1405
  *
1406
- * @param int|WP_Post $id Optional. Post ID or post object.
1406
+ * @param integer $id Optional. Post ID or post object.
1407 1407
  * @param bool        $fullsize     Optional, default is false. Whether to use full size.
1408 1408
  * @param bool        $deprecated   Deprecated. Not used.
1409 1409
  * @param bool        $permalink    Optional, default is false. Whether to include permalink.
@@ -1424,7 +1424,7 @@  discard block
 block discarded – undo
1424 1424
  * @since 2.5.0
1425 1425
  * @since 4.4.0 The `$id` parameter can now accept either a post ID or `WP_Post` object.
1426 1426
  *
1427
- * @param int|WP_Post  $id        Optional. Post ID or post object.
1427
+ * @param integer  $id        Optional. Post ID or post object.
1428 1428
  * @param string|array $size      Optional. Image size. Accepts any valid image size, or an array
1429 1429
  *                                of width and height values in pixels (in that order).
1430 1430
  *                                Default 'thumbnail'.
@@ -1528,7 +1528,7 @@  discard block
 block discarded – undo
1528 1528
  *
1529 1529
  * @since 1.0.0
1530 1530
  *
1531
- * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
1531
+ * @param integer $post Optional. Post ID or WP_Post object. Default is global $post.
1532 1532
  * @return string HTML content for password form for password protected post.
1533 1533
  */
1534 1534
 function get_the_password_form( $post = 0 ) {
@@ -1563,7 +1563,7 @@  discard block
 block discarded – undo
1563 1563
  * @since 2.5.0
1564 1564
  * @since 4.2.0 The `$template` parameter was changed to also accept an array of page templates.
1565 1565
  *
1566
- * @param string|array $template The specific template name or array of templates to match.
1566
+ * @param string $template The specific template name or array of templates to match.
1567 1567
  * @return bool True on success, false on failure.
1568 1568
  */
1569 1569
 function is_page_template( $template = '' ) {
@@ -1707,7 +1707,7 @@  discard block
 block discarded – undo
1707 1707
  *
1708 1708
  * @since 2.6.0
1709 1709
  *
1710
- * @param int|WP_Post $post_id Optional. Post ID or WP_Post object. Default is global $post.
1710
+ * @param integer $post_id Optional. Post ID or WP_Post object. Default is global $post.
1711 1711
  * @param string      $type    'all' (default), 'revision' or 'autosave'
1712 1712
  */
1713 1713
 function wp_list_post_revisions( $post_id = 0, $type = 'all' ) {
Please login to merge, or discard this patch.
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * WordPress Post Template Functions.
4
- *
5
- * Gets content for the current post in the loop.
6
- *
7
- * @package WordPress
8
- * @subpackage Template
9
- */
3
+	 * WordPress Post Template Functions.
4
+	 *
5
+	 * Gets content for the current post in the loop.
6
+	 *
7
+	 * @package WordPress
8
+	 * @subpackage Template
9
+	 */
10 10
 
11 11
 /**
12 12
  * Display the ID of the current item in the WordPress Loop.
@@ -1089,7 +1089,7 @@  discard block
 block discarded – undo
1089 1089
 	 * @param string $output HTML output for drop down list of pages.
1090 1090
 	 * @param array  $r      The parsed arguments array.
1091 1091
 	 * @param array  $pages  List of WP_Post objects returned by `get_pages()`
1092
- 	 */
1092
+	 */
1093 1093
 	$html = apply_filters( 'wp_dropdown_pages', $output, $r, $pages );
1094 1094
 
1095 1095
 	if ( $r['echo'] ) {
Please login to merge, or discard this patch.
Spacing   +414 added lines, -414 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
  */
27 27
 function get_the_ID() {
28 28
 	$post = get_post();
29
-	return ! empty( $post ) ? $post->ID : false;
29
+	return ! empty($post) ? $post->ID : false;
30 30
 }
31 31
 
32 32
 /**
@@ -39,15 +39,15 @@  discard block
 block discarded – undo
39 39
  * @param bool   $echo   Optional, default to true.Whether to display or return.
40 40
  * @return string|void String if $echo parameter is false.
41 41
  */
42
-function the_title( $before = '', $after = '', $echo = true ) {
42
+function the_title($before = '', $after = '', $echo = true) {
43 43
 	$title = get_the_title();
44 44
 
45
-	if ( strlen($title) == 0 )
45
+	if (strlen($title) == 0)
46 46
 		return;
47 47
 
48
-	$title = $before . $title . $after;
48
+	$title = $before.$title.$after;
49 49
 
50
-	if ( $echo )
50
+	if ($echo)
51 51
 		echo $title;
52 52
 	else
53 53
 		return $title;
@@ -75,20 +75,20 @@  discard block
 block discarded – undo
75 75
  * }
76 76
  * @return string|void String when echo is false.
77 77
  */
78
-function the_title_attribute( $args = '' ) {
79
-	$defaults = array( 'before' => '', 'after' =>  '', 'echo' => true, 'post' => get_post() );
80
-	$r = wp_parse_args( $args, $defaults );
78
+function the_title_attribute($args = '') {
79
+	$defaults = array('before' => '', 'after' =>  '', 'echo' => true, 'post' => get_post());
80
+	$r = wp_parse_args($args, $defaults);
81 81
 
82
-	$title = get_the_title( $r['post'] );
82
+	$title = get_the_title($r['post']);
83 83
 
84
-	if ( strlen( $title ) == 0 ) {
84
+	if (strlen($title) == 0) {
85 85
 		return;
86 86
 	}
87 87
 
88
-	$title = $r['before'] . $title . $r['after'];
89
-	$title = esc_attr( strip_tags( $title ) );
88
+	$title = $r['before'].$title.$r['after'];
89
+	$title = esc_attr(strip_tags($title));
90 90
 
91
-	if ( $r['echo'] ) {
91
+	if ($r['echo']) {
92 92
 		echo $title;
93 93
 	} else {
94 94
 		return $title;
@@ -107,14 +107,14 @@  discard block
 block discarded – undo
107 107
  * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
108 108
  * @return string
109 109
  */
110
-function get_the_title( $post = 0 ) {
111
-	$post = get_post( $post );
110
+function get_the_title($post = 0) {
111
+	$post = get_post($post);
112 112
 
113
-	$title = isset( $post->post_title ) ? $post->post_title : '';
114
-	$id = isset( $post->ID ) ? $post->ID : 0;
113
+	$title = isset($post->post_title) ? $post->post_title : '';
114
+	$id = isset($post->ID) ? $post->ID : 0;
115 115
 
116
-	if ( ! is_admin() ) {
117
-		if ( ! empty( $post->post_password ) ) {
116
+	if ( ! is_admin()) {
117
+		if ( ! empty($post->post_password)) {
118 118
 
119 119
 			/**
120 120
 			 * Filter the text prepended to the post title for protected posts.
@@ -127,9 +127,9 @@  discard block
 block discarded – undo
127 127
 			 *                         Default 'Protected: %s'.
128 128
 			 * @param WP_Post $post    Current post object.
129 129
 			 */
130
-			$protected_title_format = apply_filters( 'protected_title_format', __( 'Protected: %s' ), $post );
131
-			$title = sprintf( $protected_title_format, $title );
132
-		} elseif ( isset( $post->post_status ) && 'private' == $post->post_status ) {
130
+			$protected_title_format = apply_filters('protected_title_format', __('Protected: %s'), $post);
131
+			$title = sprintf($protected_title_format, $title);
132
+		} elseif (isset($post->post_status) && 'private' == $post->post_status) {
133 133
 
134 134
 			/**
135 135
 			 * Filter the text prepended to the post title of private posts.
@@ -142,8 +142,8 @@  discard block
 block discarded – undo
142 142
 			 *                         Default 'Private: %s'.
143 143
 			 * @param WP_Post $post    Current post object.
144 144
 			 */
145
-			$private_title_format = apply_filters( 'private_title_format', __( 'Private: %s' ), $post );
146
-			$title = sprintf( $private_title_format, $title );
145
+			$private_title_format = apply_filters('private_title_format', __('Private: %s'), $post);
146
+			$title = sprintf($private_title_format, $title);
147 147
 		}
148 148
 	}
149 149
 
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	 * @param string $title The post title.
156 156
 	 * @param int    $id    The post ID.
157 157
 	 */
158
-	return apply_filters( 'the_title', $title, $id );
158
+	return apply_filters('the_title', $title, $id);
159 159
 }
160 160
 
161 161
 /**
@@ -171,11 +171,11 @@  discard block
 block discarded – undo
171 171
  *
172 172
  * @param int|WP_Post $post Optional. Post ID or post object. Default is global $post.
173 173
  */
174
-function the_guid( $post = 0 ) {
175
-	$post = get_post( $post );
174
+function the_guid($post = 0) {
175
+	$post = get_post($post);
176 176
 
177
-	$guid = isset( $post->guid ) ? get_the_guid( $post ) : '';
178
-	$id   = isset( $post->ID ) ? $post->ID : 0;
177
+	$guid = isset($post->guid) ? get_the_guid($post) : '';
178
+	$id   = isset($post->ID) ? $post->ID : 0;
179 179
 
180 180
 	/**
181 181
 	 * Filter the escaped Global Unique Identifier (guid) of the post.
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 	 * @param string $guid Escaped Global Unique Identifier (guid) of the post.
188 188
 	 * @param int    $id   The post ID.
189 189
 	 */
190
-	echo apply_filters( 'the_guid', $guid, $id );
190
+	echo apply_filters('the_guid', $guid, $id);
191 191
 }
192 192
 
193 193
 /**
@@ -202,11 +202,11 @@  discard block
 block discarded – undo
202 202
  * @param int|WP_Post $post Optional. Post ID or post object. Default is global $post.
203 203
  * @return string
204 204
  */
205
-function get_the_guid( $post = 0 ) {
206
-	$post = get_post( $post );
205
+function get_the_guid($post = 0) {
206
+	$post = get_post($post);
207 207
 
208
-	$guid = isset( $post->guid ) ? $post->guid : '';
209
-	$id   = isset( $post->ID ) ? $post->ID : 0;
208
+	$guid = isset($post->guid) ? $post->guid : '';
209
+	$id   = isset($post->ID) ? $post->ID : 0;
210 210
 
211 211
 	/**
212 212
 	 * Filter the Global Unique Identifier (guid) of the post.
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 	 * @param string $guid Global Unique Identifier (guid) of the post.
217 217
 	 * @param int    $id   The post ID.
218 218
 	 */
219
-	return apply_filters( 'get_the_guid', $guid, $id );
219
+	return apply_filters('get_the_guid', $guid, $id);
220 220
 }
221 221
 
222 222
 /**
@@ -227,8 +227,8 @@  discard block
 block discarded – undo
227 227
  * @param string $more_link_text Optional. Content for when there is more text.
228 228
  * @param bool   $strip_teaser   Optional. Strip teaser content before the more text. Default is false.
229 229
  */
230
-function the_content( $more_link_text = null, $strip_teaser = false) {
231
-	$content = get_the_content( $more_link_text, $strip_teaser );
230
+function the_content($more_link_text = null, $strip_teaser = false) {
231
+	$content = get_the_content($more_link_text, $strip_teaser);
232 232
 
233 233
 	/**
234 234
 	 * Filter the post content.
@@ -237,8 +237,8 @@  discard block
 block discarded – undo
237 237
 	 *
238 238
 	 * @param string $content Content of the current post.
239 239
 	 */
240
-	$content = apply_filters( 'the_content', $content );
241
-	$content = str_replace( ']]>', ']]&gt;', $content );
240
+	$content = apply_filters('the_content', $content);
241
+	$content = str_replace(']]>', ']]&gt;', $content);
242 242
 	echo $content;
243 243
 }
244 244
 
@@ -257,50 +257,50 @@  discard block
 block discarded – undo
257 257
  * @param bool   $strip_teaser   Optional. Strip teaser content before the more text. Default is false.
258 258
  * @return string
259 259
  */
260
-function get_the_content( $more_link_text = null, $strip_teaser = false ) {
260
+function get_the_content($more_link_text = null, $strip_teaser = false) {
261 261
 	global $page, $more, $preview, $pages, $multipage;
262 262
 
263 263
 	$post = get_post();
264 264
 
265
-	if ( null === $more_link_text )
266
-		$more_link_text = __( '(more&hellip;)' );
265
+	if (null === $more_link_text)
266
+		$more_link_text = __('(more&hellip;)');
267 267
 
268 268
 	$output = '';
269 269
 	$has_teaser = false;
270 270
 
271 271
 	// If post password required and it doesn't match the cookie.
272
-	if ( post_password_required( $post ) )
273
-		return get_the_password_form( $post );
272
+	if (post_password_required($post))
273
+		return get_the_password_form($post);
274 274
 
275
-	if ( $page > count( $pages ) ) // if the requested page doesn't exist
276
-		$page = count( $pages ); // give them the highest numbered page that DOES exist
275
+	if ($page > count($pages)) // if the requested page doesn't exist
276
+		$page = count($pages); // give them the highest numbered page that DOES exist
277 277
 
278 278
 	$content = $pages[$page - 1];
279
-	if ( preg_match( '/<!--more(.*?)?-->/', $content, $matches ) ) {
280
-		$content = explode( $matches[0], $content, 2 );
281
-		if ( ! empty( $matches[1] ) && ! empty( $more_link_text ) )
282
-			$more_link_text = strip_tags( wp_kses_no_null( trim( $matches[1] ) ) );
279
+	if (preg_match('/<!--more(.*?)?-->/', $content, $matches)) {
280
+		$content = explode($matches[0], $content, 2);
281
+		if ( ! empty($matches[1]) && ! empty($more_link_text))
282
+			$more_link_text = strip_tags(wp_kses_no_null(trim($matches[1])));
283 283
 
284 284
 		$has_teaser = true;
285 285
 	} else {
286
-		$content = array( $content );
286
+		$content = array($content);
287 287
 	}
288 288
 
289
-	if ( false !== strpos( $post->post_content, '<!--noteaser-->' ) && ( ! $multipage || $page == 1 ) )
289
+	if (false !== strpos($post->post_content, '<!--noteaser-->') && ( ! $multipage || $page == 1))
290 290
 		$strip_teaser = true;
291 291
 
292 292
 	$teaser = $content[0];
293 293
 
294
-	if ( $more && $strip_teaser && $has_teaser )
294
+	if ($more && $strip_teaser && $has_teaser)
295 295
 		$teaser = '';
296 296
 
297 297
 	$output .= $teaser;
298 298
 
299
-	if ( count( $content ) > 1 ) {
300
-		if ( $more ) {
301
-			$output .= '<span id="more-' . $post->ID . '"></span>' . $content[1];
299
+	if (count($content) > 1) {
300
+		if ($more) {
301
+			$output .= '<span id="more-'.$post->ID.'"></span>'.$content[1];
302 302
 		} else {
303
-			if ( ! empty( $more_link_text ) )
303
+			if ( ! empty($more_link_text))
304 304
 
305 305
 				/**
306 306
 				 * Filter the Read More link text.
@@ -310,13 +310,13 @@  discard block
 block discarded – undo
310 310
 				 * @param string $more_link_element Read More link element.
311 311
 				 * @param string $more_link_text    Read More text.
312 312
 				 */
313
-				$output .= apply_filters( 'the_content_more_link', ' <a href="' . get_permalink() . "#more-{$post->ID}\" class=\"more-link\">$more_link_text</a>", $more_link_text );
314
-			$output = force_balance_tags( $output );
313
+				$output .= apply_filters('the_content_more_link', ' <a href="'.get_permalink()."#more-{$post->ID}\" class=\"more-link\">$more_link_text</a>", $more_link_text);
314
+			$output = force_balance_tags($output);
315 315
 		}
316 316
 	}
317 317
 
318
-	if ( $preview ) // Preview fix for JavaScript bug with foreign languages.
319
-		$output =	preg_replace_callback( '/\%u([0-9A-F]{4})/', '_convert_urlencoded_to_entities', $output );
318
+	if ($preview) // Preview fix for JavaScript bug with foreign languages.
319
+		$output = preg_replace_callback('/\%u([0-9A-F]{4})/', '_convert_urlencoded_to_entities', $output);
320 320
 
321 321
 	return $output;
322 322
 }
@@ -330,8 +330,8 @@  discard block
 block discarded – undo
330 330
  * @param array $match Match array from preg_replace_callback.
331 331
  * @return string
332 332
  */
333
-function _convert_urlencoded_to_entities( $match ) {
334
-	return '&#' . base_convert( $match[1], 16, 10 ) . ';';
333
+function _convert_urlencoded_to_entities($match) {
334
+	return '&#'.base_convert($match[1], 16, 10).';';
335 335
 }
336 336
 
337 337
 /**
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 	 *
351 351
 	 * @param string $post_excerpt The post excerpt.
352 352
 	 */
353
-	echo apply_filters( 'the_excerpt', get_the_excerpt() );
353
+	echo apply_filters('the_excerpt', get_the_excerpt());
354 354
 }
355 355
 
356 356
 /**
@@ -362,18 +362,18 @@  discard block
 block discarded – undo
362 362
  * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
363 363
  * @return string Post excerpt.
364 364
  */
365
-function get_the_excerpt( $post = null ) {
366
-	if ( is_bool( $post ) ) {
367
-		_deprecated_argument( __FUNCTION__, '2.3' );
365
+function get_the_excerpt($post = null) {
366
+	if (is_bool($post)) {
367
+		_deprecated_argument(__FUNCTION__, '2.3');
368 368
 	}
369 369
 
370
-	$post = get_post( $post );
371
-	if ( empty( $post ) ) {
370
+	$post = get_post($post);
371
+	if (empty($post)) {
372 372
 		return '';
373 373
 	}
374 374
 
375
-	if ( post_password_required( $post ) ) {
376
-		return __( 'There is no excerpt because this is a protected post.' );
375
+	if (post_password_required($post)) {
376
+		return __('There is no excerpt because this is a protected post.');
377 377
 	}
378 378
 
379 379
 	/**
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
 	 * @param string $post_excerpt The post excerpt.
386 386
 	 * @param WP_Post $post Post object.
387 387
 	 */
388
-	return apply_filters( 'get_the_excerpt', $post->post_excerpt, $post );
388
+	return apply_filters('get_the_excerpt', $post->post_excerpt, $post);
389 389
 }
390 390
 
391 391
 /**
@@ -396,9 +396,9 @@  discard block
 block discarded – undo
396 396
  * @param int|WP_Post $id Optional. Post ID or post object.
397 397
  * @return bool
398 398
  */
399
-function has_excerpt( $id = 0 ) {
400
-	$post = get_post( $id );
401
-	return ( !empty( $post->post_excerpt ) );
399
+function has_excerpt($id = 0) {
400
+	$post = get_post($id);
401
+	return ( ! empty($post->post_excerpt));
402 402
 }
403 403
 
404 404
 /**
@@ -409,9 +409,9 @@  discard block
 block discarded – undo
409 409
  * @param string|array $class   One or more classes to add to the class list.
410 410
  * @param int|WP_Post  $post_id Optional. Post ID or post object. Defaults to the global `$post`.
411 411
  */
412
-function post_class( $class = '', $post_id = null ) {
412
+function post_class($class = '', $post_id = null) {
413 413
 	// Separates classes with a single space, collates classes for post DIV
414
-	echo 'class="' . join( ' ', get_post_class( $class, $post_id ) ) . '"';
414
+	echo 'class="'.join(' ', get_post_class($class, $post_id)).'"';
415 415
 }
416 416
 
417 417
 /**
@@ -433,60 +433,60 @@  discard block
 block discarded – undo
433 433
  * @param int|WP_Post  $post_id Optional. Post ID or post object.
434 434
  * @return array Array of classes.
435 435
  */
436
-function get_post_class( $class = '', $post_id = null ) {
437
-	$post = get_post( $post_id );
436
+function get_post_class($class = '', $post_id = null) {
437
+	$post = get_post($post_id);
438 438
 
439 439
 	$classes = array();
440 440
 
441
-	if ( $class ) {
442
-		if ( ! is_array( $class ) ) {
443
-			$class = preg_split( '#\s+#', $class );
441
+	if ($class) {
442
+		if ( ! is_array($class)) {
443
+			$class = preg_split('#\s+#', $class);
444 444
 		}
445
-		$classes = array_map( 'esc_attr', $class );
445
+		$classes = array_map('esc_attr', $class);
446 446
 	} else {
447 447
 		// Ensure that we always coerce class to being an array.
448 448
 		$class = array();
449 449
 	}
450 450
 
451
-	if ( ! $post ) {
451
+	if ( ! $post) {
452 452
 		return $classes;
453 453
 	}
454 454
 
455
-	$classes[] = 'post-' . $post->ID;
456
-	if ( ! is_admin() )
455
+	$classes[] = 'post-'.$post->ID;
456
+	if ( ! is_admin())
457 457
 		$classes[] = $post->post_type;
458
-	$classes[] = 'type-' . $post->post_type;
459
-	$classes[] = 'status-' . $post->post_status;
458
+	$classes[] = 'type-'.$post->post_type;
459
+	$classes[] = 'status-'.$post->post_status;
460 460
 
461 461
 	// Post Format
462
-	if ( post_type_supports( $post->post_type, 'post-formats' ) ) {
463
-		$post_format = get_post_format( $post->ID );
462
+	if (post_type_supports($post->post_type, 'post-formats')) {
463
+		$post_format = get_post_format($post->ID);
464 464
 
465
-		if ( $post_format && !is_wp_error($post_format) )
466
-			$classes[] = 'format-' . sanitize_html_class( $post_format );
465
+		if ($post_format && ! is_wp_error($post_format))
466
+			$classes[] = 'format-'.sanitize_html_class($post_format);
467 467
 		else
468 468
 			$classes[] = 'format-standard';
469 469
 	}
470 470
 
471
-	$post_password_required = post_password_required( $post->ID );
471
+	$post_password_required = post_password_required($post->ID);
472 472
 
473 473
 	// Post requires password.
474
-	if ( $post_password_required ) {
474
+	if ($post_password_required) {
475 475
 		$classes[] = 'post-password-required';
476
-	} elseif ( ! empty( $post->post_password ) ) {
476
+	} elseif ( ! empty($post->post_password)) {
477 477
 		$classes[] = 'post-password-protected';
478 478
 	}
479 479
 
480 480
 	// Post thumbnails.
481
-	if ( current_theme_supports( 'post-thumbnails' ) && has_post_thumbnail( $post->ID ) && ! is_attachment( $post ) && ! $post_password_required ) {
481
+	if (current_theme_supports('post-thumbnails') && has_post_thumbnail($post->ID) && ! is_attachment($post) && ! $post_password_required) {
482 482
 		$classes[] = 'has-post-thumbnail';
483 483
 	}
484 484
 
485 485
 	// sticky for Sticky Posts
486
-	if ( is_sticky( $post->ID ) ) {
487
-		if ( is_home() && ! is_paged() ) {
486
+	if (is_sticky($post->ID)) {
487
+		if (is_home() && ! is_paged()) {
488 488
 			$classes[] = 'sticky';
489
-		} elseif ( is_admin() ) {
489
+		} elseif (is_admin()) {
490 490
 			$classes[] = 'status-sticky';
491 491
 		}
492 492
 	}
@@ -495,30 +495,30 @@  discard block
 block discarded – undo
495 495
 	$classes[] = 'hentry';
496 496
 
497 497
 	// All public taxonomies
498
-	$taxonomies = get_taxonomies( array( 'public' => true ) );
499
-	foreach ( (array) $taxonomies as $taxonomy ) {
500
-		if ( is_object_in_taxonomy( $post->post_type, $taxonomy ) ) {
501
-			foreach ( (array) get_the_terms( $post->ID, $taxonomy ) as $term ) {
502
-				if ( empty( $term->slug ) ) {
498
+	$taxonomies = get_taxonomies(array('public' => true));
499
+	foreach ((array) $taxonomies as $taxonomy) {
500
+		if (is_object_in_taxonomy($post->post_type, $taxonomy)) {
501
+			foreach ((array) get_the_terms($post->ID, $taxonomy) as $term) {
502
+				if (empty($term->slug)) {
503 503
 					continue;
504 504
 				}
505 505
 
506
-				$term_class = sanitize_html_class( $term->slug, $term->term_id );
507
-				if ( is_numeric( $term_class ) || ! trim( $term_class, '-' ) ) {
506
+				$term_class = sanitize_html_class($term->slug, $term->term_id);
507
+				if (is_numeric($term_class) || ! trim($term_class, '-')) {
508 508
 					$term_class = $term->term_id;
509 509
 				}
510 510
 
511 511
 				// 'post_tag' uses the 'tag' prefix for backward compatibility.
512
-				if ( 'post_tag' == $taxonomy ) {
513
-					$classes[] = 'tag-' . $term_class;
512
+				if ('post_tag' == $taxonomy) {
513
+					$classes[] = 'tag-'.$term_class;
514 514
 				} else {
515
-					$classes[] = sanitize_html_class( $taxonomy . '-' . $term_class, $taxonomy . '-' . $term->term_id );
515
+					$classes[] = sanitize_html_class($taxonomy.'-'.$term_class, $taxonomy.'-'.$term->term_id);
516 516
 				}
517 517
 			}
518 518
 		}
519 519
 	}
520 520
 
521
-	$classes = array_map( 'esc_attr', $classes );
521
+	$classes = array_map('esc_attr', $classes);
522 522
 
523 523
 	/**
524 524
 	 * Filter the list of CSS classes for the current post.
@@ -529,9 +529,9 @@  discard block
 block discarded – undo
529 529
 	 * @param array $class   An array of additional classes added to the post.
530 530
 	 * @param int   $post_id The post ID.
531 531
 	 */
532
-	$classes = apply_filters( 'post_class', $classes, $class, $post->ID );
532
+	$classes = apply_filters('post_class', $classes, $class, $post->ID);
533 533
 
534
-	return array_unique( $classes );
534
+	return array_unique($classes);
535 535
 }
536 536
 
537 537
 /**
@@ -541,9 +541,9 @@  discard block
 block discarded – undo
541 541
  *
542 542
  * @param string|array $class One or more classes to add to the class list.
543 543
  */
544
-function body_class( $class = '' ) {
544
+function body_class($class = '') {
545 545
 	// Separates classes with a single space, collates classes for body element
546
-	echo 'class="' . join( ' ', get_body_class( $class ) ) . '"';
546
+	echo 'class="'.join(' ', get_body_class($class)).'"';
547 547
 }
548 548
 
549 549
 /**
@@ -556,196 +556,196 @@  discard block
 block discarded – undo
556 556
  * @param string|array $class One or more classes to add to the class list.
557 557
  * @return array Array of classes.
558 558
  */
559
-function get_body_class( $class = '' ) {
559
+function get_body_class($class = '') {
560 560
 	global $wp_query;
561 561
 
562 562
 	$classes = array();
563 563
 
564
-	if ( is_rtl() )
564
+	if (is_rtl())
565 565
 		$classes[] = 'rtl';
566 566
 
567
-	if ( is_front_page() )
567
+	if (is_front_page())
568 568
 		$classes[] = 'home';
569
-	if ( is_home() )
569
+	if (is_home())
570 570
 		$classes[] = 'blog';
571
-	if ( is_archive() )
571
+	if (is_archive())
572 572
 		$classes[] = 'archive';
573
-	if ( is_date() )
573
+	if (is_date())
574 574
 		$classes[] = 'date';
575
-	if ( is_search() ) {
575
+	if (is_search()) {
576 576
 		$classes[] = 'search';
577 577
 		$classes[] = $wp_query->posts ? 'search-results' : 'search-no-results';
578 578
 	}
579
-	if ( is_paged() )
579
+	if (is_paged())
580 580
 		$classes[] = 'paged';
581
-	if ( is_attachment() )
581
+	if (is_attachment())
582 582
 		$classes[] = 'attachment';
583
-	if ( is_404() )
583
+	if (is_404())
584 584
 		$classes[] = 'error404';
585
-	if ( is_singular() ) {
585
+	if (is_singular()) {
586 586
 		$classes[] = 'singular';
587 587
 	}
588 588
 
589
-	if ( is_single() ) {
589
+	if (is_single()) {
590 590
 		$post_id = $wp_query->get_queried_object_id();
591 591
 		$post = $wp_query->get_queried_object();
592 592
 
593 593
 		$classes[] = 'single';
594
-		if ( isset( $post->post_type ) ) {
595
-			$classes[] = 'single-' . sanitize_html_class($post->post_type, $post_id);
596
-			$classes[] = 'postid-' . $post_id;
594
+		if (isset($post->post_type)) {
595
+			$classes[] = 'single-'.sanitize_html_class($post->post_type, $post_id);
596
+			$classes[] = 'postid-'.$post_id;
597 597
 
598 598
 			// Post Format
599
-			if ( post_type_supports( $post->post_type, 'post-formats' ) ) {
600
-				$post_format = get_post_format( $post->ID );
599
+			if (post_type_supports($post->post_type, 'post-formats')) {
600
+				$post_format = get_post_format($post->ID);
601 601
 
602
-				if ( $post_format && !is_wp_error($post_format) )
603
-					$classes[] = 'single-format-' . sanitize_html_class( $post_format );
602
+				if ($post_format && ! is_wp_error($post_format))
603
+					$classes[] = 'single-format-'.sanitize_html_class($post_format);
604 604
 				else
605 605
 					$classes[] = 'single-format-standard';
606 606
 			}
607 607
 		}
608 608
 
609
-		if ( is_attachment() ) {
609
+		if (is_attachment()) {
610 610
 			$mime_type = get_post_mime_type($post_id);
611
-			$mime_prefix = array( 'application/', 'image/', 'text/', 'audio/', 'video/', 'music/' );
612
-			$classes[] = 'attachmentid-' . $post_id;
613
-			$classes[] = 'attachment-' . str_replace( $mime_prefix, '', $mime_type );
611
+			$mime_prefix = array('application/', 'image/', 'text/', 'audio/', 'video/', 'music/');
612
+			$classes[] = 'attachmentid-'.$post_id;
613
+			$classes[] = 'attachment-'.str_replace($mime_prefix, '', $mime_type);
614 614
 		}
615
-	} elseif ( is_archive() ) {
616
-		if ( is_post_type_archive() ) {
615
+	} elseif (is_archive()) {
616
+		if (is_post_type_archive()) {
617 617
 			$classes[] = 'post-type-archive';
618
-			$post_type = get_query_var( 'post_type' );
619
-			if ( is_array( $post_type ) )
620
-				$post_type = reset( $post_type );
621
-			$classes[] = 'post-type-archive-' . sanitize_html_class( $post_type );
622
-		} elseif ( is_author() ) {
618
+			$post_type = get_query_var('post_type');
619
+			if (is_array($post_type))
620
+				$post_type = reset($post_type);
621
+			$classes[] = 'post-type-archive-'.sanitize_html_class($post_type);
622
+		} elseif (is_author()) {
623 623
 			$author = $wp_query->get_queried_object();
624 624
 			$classes[] = 'author';
625
-			if ( isset( $author->user_nicename ) ) {
626
-				$classes[] = 'author-' . sanitize_html_class( $author->user_nicename, $author->ID );
627
-				$classes[] = 'author-' . $author->ID;
625
+			if (isset($author->user_nicename)) {
626
+				$classes[] = 'author-'.sanitize_html_class($author->user_nicename, $author->ID);
627
+				$classes[] = 'author-'.$author->ID;
628 628
 			}
629
-		} elseif ( is_category() ) {
629
+		} elseif (is_category()) {
630 630
 			$cat = $wp_query->get_queried_object();
631 631
 			$classes[] = 'category';
632
-			if ( isset( $cat->term_id ) ) {
633
-				$cat_class = sanitize_html_class( $cat->slug, $cat->term_id );
634
-				if ( is_numeric( $cat_class ) || ! trim( $cat_class, '-' ) ) {
632
+			if (isset($cat->term_id)) {
633
+				$cat_class = sanitize_html_class($cat->slug, $cat->term_id);
634
+				if (is_numeric($cat_class) || ! trim($cat_class, '-')) {
635 635
 					$cat_class = $cat->term_id;
636 636
 				}
637 637
 
638
-				$classes[] = 'category-' . $cat_class;
639
-				$classes[] = 'category-' . $cat->term_id;
638
+				$classes[] = 'category-'.$cat_class;
639
+				$classes[] = 'category-'.$cat->term_id;
640 640
 			}
641
-		} elseif ( is_tag() ) {
641
+		} elseif (is_tag()) {
642 642
 			$tag = $wp_query->get_queried_object();
643 643
 			$classes[] = 'tag';
644
-			if ( isset( $tag->term_id ) ) {
645
-				$tag_class = sanitize_html_class( $tag->slug, $tag->term_id );
646
-				if ( is_numeric( $tag_class ) || ! trim( $tag_class, '-' ) ) {
644
+			if (isset($tag->term_id)) {
645
+				$tag_class = sanitize_html_class($tag->slug, $tag->term_id);
646
+				if (is_numeric($tag_class) || ! trim($tag_class, '-')) {
647 647
 					$tag_class = $tag->term_id;
648 648
 				}
649 649
 
650
-				$classes[] = 'tag-' . $tag_class;
651
-				$classes[] = 'tag-' . $tag->term_id;
650
+				$classes[] = 'tag-'.$tag_class;
651
+				$classes[] = 'tag-'.$tag->term_id;
652 652
 			}
653
-		} elseif ( is_tax() ) {
653
+		} elseif (is_tax()) {
654 654
 			$term = $wp_query->get_queried_object();
655
-			if ( isset( $term->term_id ) ) {
656
-				$term_class = sanitize_html_class( $term->slug, $term->term_id );
657
-				if ( is_numeric( $term_class ) || ! trim( $term_class, '-' ) ) {
655
+			if (isset($term->term_id)) {
656
+				$term_class = sanitize_html_class($term->slug, $term->term_id);
657
+				if (is_numeric($term_class) || ! trim($term_class, '-')) {
658 658
 					$term_class = $term->term_id;
659 659
 				}
660 660
 
661
-				$classes[] = 'tax-' . sanitize_html_class( $term->taxonomy );
662
-				$classes[] = 'term-' . $term_class;
663
-				$classes[] = 'term-' . $term->term_id;
661
+				$classes[] = 'tax-'.sanitize_html_class($term->taxonomy);
662
+				$classes[] = 'term-'.$term_class;
663
+				$classes[] = 'term-'.$term->term_id;
664 664
 			}
665 665
 		}
666
-	} elseif ( is_page() ) {
666
+	} elseif (is_page()) {
667 667
 		$classes[] = 'page';
668 668
 
669 669
 		$page_id = $wp_query->get_queried_object_id();
670 670
 
671 671
 		$post = get_post($page_id);
672 672
 
673
-		$classes[] = 'page-id-' . $page_id;
673
+		$classes[] = 'page-id-'.$page_id;
674 674
 
675
-		if ( get_pages( array( 'parent' => $page_id, 'number' => 1 ) ) ) {
675
+		if (get_pages(array('parent' => $page_id, 'number' => 1))) {
676 676
 			$classes[] = 'page-parent';
677 677
 		}
678 678
 
679
-		if ( $post->post_parent ) {
679
+		if ($post->post_parent) {
680 680
 			$classes[] = 'page-child';
681
-			$classes[] = 'parent-pageid-' . $post->post_parent;
681
+			$classes[] = 'parent-pageid-'.$post->post_parent;
682 682
 		}
683
-		if ( is_page_template() ) {
683
+		if (is_page_template()) {
684 684
 			$classes[] = 'page-template';
685 685
 
686
-			$template_slug  = get_page_template_slug( $page_id );
687
-			$template_parts = explode( '/', $template_slug );
686
+			$template_slug  = get_page_template_slug($page_id);
687
+			$template_parts = explode('/', $template_slug);
688 688
 
689
-			foreach ( $template_parts as $part ) {
690
-				$classes[] = 'page-template-' . sanitize_html_class( str_replace( array( '.', '/' ), '-', basename( $part, '.php' ) ) );
689
+			foreach ($template_parts as $part) {
690
+				$classes[] = 'page-template-'.sanitize_html_class(str_replace(array('.', '/'), '-', basename($part, '.php')));
691 691
 			}
692
-			$classes[] = 'page-template-' . sanitize_html_class( str_replace( '.', '-', $template_slug ) );
692
+			$classes[] = 'page-template-'.sanitize_html_class(str_replace('.', '-', $template_slug));
693 693
 		} else {
694 694
 			$classes[] = 'page-template-default';
695 695
 		}
696 696
 	}
697 697
 
698
-	if ( is_user_logged_in() )
698
+	if (is_user_logged_in())
699 699
 		$classes[] = 'logged-in';
700 700
 
701
-	if ( is_admin_bar_showing() ) {
701
+	if (is_admin_bar_showing()) {
702 702
 		$classes[] = 'admin-bar';
703 703
 		$classes[] = 'no-customize-support';
704 704
 	}
705 705
 
706
-	if ( get_background_color() !== get_theme_support( 'custom-background', 'default-color' ) || get_background_image() )
706
+	if (get_background_color() !== get_theme_support('custom-background', 'default-color') || get_background_image())
707 707
 		$classes[] = 'custom-background';
708 708
 
709
-	if ( has_custom_logo() ) {
709
+	if (has_custom_logo()) {
710 710
 		$classes[] = 'wp-custom-logo';
711 711
 	}
712 712
 
713
-	$page = $wp_query->get( 'page' );
714
-
715
-	if ( ! $page || $page < 2 )
716
-		$page = $wp_query->get( 'paged' );
717
-
718
-	if ( $page && $page > 1 && ! is_404() ) {
719
-		$classes[] = 'paged-' . $page;
720
-
721
-		if ( is_single() )
722
-			$classes[] = 'single-paged-' . $page;
723
-		elseif ( is_page() )
724
-			$classes[] = 'page-paged-' . $page;
725
-		elseif ( is_category() )
726
-			$classes[] = 'category-paged-' . $page;
727
-		elseif ( is_tag() )
728
-			$classes[] = 'tag-paged-' . $page;
729
-		elseif ( is_date() )
730
-			$classes[] = 'date-paged-' . $page;
731
-		elseif ( is_author() )
732
-			$classes[] = 'author-paged-' . $page;
733
-		elseif ( is_search() )
734
-			$classes[] = 'search-paged-' . $page;
735
-		elseif ( is_post_type_archive() )
736
-			$classes[] = 'post-type-paged-' . $page;
713
+	$page = $wp_query->get('page');
714
+
715
+	if ( ! $page || $page < 2)
716
+		$page = $wp_query->get('paged');
717
+
718
+	if ($page && $page > 1 && ! is_404()) {
719
+		$classes[] = 'paged-'.$page;
720
+
721
+		if (is_single())
722
+			$classes[] = 'single-paged-'.$page;
723
+		elseif (is_page())
724
+			$classes[] = 'page-paged-'.$page;
725
+		elseif (is_category())
726
+			$classes[] = 'category-paged-'.$page;
727
+		elseif (is_tag())
728
+			$classes[] = 'tag-paged-'.$page;
729
+		elseif (is_date())
730
+			$classes[] = 'date-paged-'.$page;
731
+		elseif (is_author())
732
+			$classes[] = 'author-paged-'.$page;
733
+		elseif (is_search())
734
+			$classes[] = 'search-paged-'.$page;
735
+		elseif (is_post_type_archive())
736
+			$classes[] = 'post-type-paged-'.$page;
737 737
 	}
738 738
 
739
-	if ( ! empty( $class ) ) {
740
-		if ( !is_array( $class ) )
741
-			$class = preg_split( '#\s+#', $class );
742
-		$classes = array_merge( $classes, $class );
739
+	if ( ! empty($class)) {
740
+		if ( ! is_array($class))
741
+			$class = preg_split('#\s+#', $class);
742
+		$classes = array_merge($classes, $class);
743 743
 	} else {
744 744
 		// Ensure that we always coerce class to being an array.
745 745
 		$class = array();
746 746
 	}
747 747
 
748
-	$classes = array_map( 'esc_attr', $classes );
748
+	$classes = array_map('esc_attr', $classes);
749 749
 
750 750
 	/**
751 751
 	 * Filter the list of CSS body classes for the current post or page.
@@ -755,9 +755,9 @@  discard block
 block discarded – undo
755 755
 	 * @param array $classes An array of body classes.
756 756
 	 * @param array $class   An array of additional classes added to the body.
757 757
 	 */
758
-	$classes = apply_filters( 'body_class', $classes, $class );
758
+	$classes = apply_filters('body_class', $classes, $class);
759 759
 
760
-	return array_unique( $classes );
760
+	return array_unique($classes);
761 761
 }
762 762
 
763 763
 /**
@@ -768,23 +768,23 @@  discard block
 block discarded – undo
768 768
  * @param int|WP_Post|null $post An optional post. Global $post used if not provided.
769 769
  * @return bool false if a password is not required or the correct password cookie is present, true otherwise.
770 770
  */
771
-function post_password_required( $post = null ) {
771
+function post_password_required($post = null) {
772 772
 	$post = get_post($post);
773 773
 
774
-	if ( empty( $post->post_password ) )
774
+	if (empty($post->post_password))
775 775
 		return false;
776 776
 
777
-	if ( ! isset( $_COOKIE['wp-postpass_' . COOKIEHASH] ) )
777
+	if ( ! isset($_COOKIE['wp-postpass_'.COOKIEHASH]))
778 778
 		return true;
779 779
 
780
-	require_once ABSPATH . WPINC . '/class-phpass.php';
781
-	$hasher = new PasswordHash( 8, true );
780
+	require_once ABSPATH.WPINC.'/class-phpass.php';
781
+	$hasher = new PasswordHash(8, true);
782 782
 
783
-	$hash = wp_unslash( $_COOKIE[ 'wp-postpass_' . COOKIEHASH ] );
784
-	if ( 0 !== strpos( $hash, '$P$B' ) )
783
+	$hash = wp_unslash($_COOKIE['wp-postpass_'.COOKIEHASH]);
784
+	if (0 !== strpos($hash, '$P$B'))
785 785
 		return true;
786 786
 
787
-	return ! $hasher->CheckPassword( $post->post_password, $hash );
787
+	return ! $hasher->CheckPassword($post->post_password, $hash);
788 788
 }
789 789
 
790 790
 //
@@ -825,23 +825,23 @@  discard block
 block discarded – undo
825 825
  * }
826 826
  * @return string Formatted output in HTML.
827 827
  */
828
-function wp_link_pages( $args = '' ) {
828
+function wp_link_pages($args = '') {
829 829
 	global $page, $numpages, $multipage, $more;
830 830
 
831 831
 	$defaults = array(
832
-		'before'           => '<p>' . __( 'Pages:' ),
832
+		'before'           => '<p>'.__('Pages:'),
833 833
 		'after'            => '</p>',
834 834
 		'link_before'      => '',
835 835
 		'link_after'       => '',
836 836
 		'next_or_number'   => 'number',
837 837
 		'separator'        => ' ',
838
-		'nextpagelink'     => __( 'Next page' ),
839
-		'previouspagelink' => __( 'Previous page' ),
838
+		'nextpagelink'     => __('Next page'),
839
+		'previouspagelink' => __('Previous page'),
840 840
 		'pagelink'         => '%',
841 841
 		'echo'             => 1
842 842
 	);
843 843
 
844
-	$params = wp_parse_args( $args, $defaults );
844
+	$params = wp_parse_args($args, $defaults);
845 845
 
846 846
 	/**
847 847
 	 * Filter the arguments used in retrieving page links for paginated posts.
@@ -850,16 +850,16 @@  discard block
 block discarded – undo
850 850
 	 *
851 851
 	 * @param array $params An array of arguments for page links for paginated posts.
852 852
 	 */
853
-	$r = apply_filters( 'wp_link_pages_args', $params );
853
+	$r = apply_filters('wp_link_pages_args', $params);
854 854
 
855 855
 	$output = '';
856
-	if ( $multipage ) {
857
-		if ( 'number' == $r['next_or_number'] ) {
856
+	if ($multipage) {
857
+		if ('number' == $r['next_or_number']) {
858 858
 			$output .= $r['before'];
859
-			for ( $i = 1; $i <= $numpages; $i++ ) {
860
-				$link = $r['link_before'] . str_replace( '%', $i, $r['pagelink'] ) . $r['link_after'];
861
-				if ( $i != $page || ! $more && 1 == $page ) {
862
-					$link = _wp_link_page( $i ) . $link . '</a>';
859
+			for ($i = 1; $i <= $numpages; $i++) {
860
+				$link = $r['link_before'].str_replace('%', $i, $r['pagelink']).$r['link_after'];
861
+				if ($i != $page || ! $more && 1 == $page) {
862
+					$link = _wp_link_page($i).$link.'</a>';
863 863
 				}
864 864
 				/**
865 865
 				 * Filter the HTML output of individual page number links.
@@ -869,31 +869,31 @@  discard block
 block discarded – undo
869 869
 				 * @param string $link The page number HTML output.
870 870
 				 * @param int    $i    Page number for paginated posts' page links.
871 871
 				 */
872
-				$link = apply_filters( 'wp_link_pages_link', $link, $i );
872
+				$link = apply_filters('wp_link_pages_link', $link, $i);
873 873
 
874 874
 				// Use the custom links separator beginning with the second link.
875
-				$output .= ( 1 === $i ) ? ' ' : $r['separator'];
875
+				$output .= (1 === $i) ? ' ' : $r['separator'];
876 876
 				$output .= $link;
877 877
 			}
878 878
 			$output .= $r['after'];
879
-		} elseif ( $more ) {
879
+		} elseif ($more) {
880 880
 			$output .= $r['before'];
881 881
 			$prev = $page - 1;
882
-			if ( $prev > 0 ) {
883
-				$link = _wp_link_page( $prev ) . $r['link_before'] . $r['previouspagelink'] . $r['link_after'] . '</a>';
882
+			if ($prev > 0) {
883
+				$link = _wp_link_page($prev).$r['link_before'].$r['previouspagelink'].$r['link_after'].'</a>';
884 884
 
885 885
 				/** This filter is documented in wp-includes/post-template.php */
886
-				$output .= apply_filters( 'wp_link_pages_link', $link, $prev );
886
+				$output .= apply_filters('wp_link_pages_link', $link, $prev);
887 887
 			}
888 888
 			$next = $page + 1;
889
-			if ( $next <= $numpages ) {
890
-				if ( $prev ) {
889
+			if ($next <= $numpages) {
890
+				if ($prev) {
891 891
 					$output .= $r['separator'];
892 892
 				}
893
-				$link = _wp_link_page( $next ) . $r['link_before'] . $r['nextpagelink'] . $r['link_after'] . '</a>';
893
+				$link = _wp_link_page($next).$r['link_before'].$r['nextpagelink'].$r['link_after'].'</a>';
894 894
 
895 895
 				/** This filter is documented in wp-includes/post-template.php */
896
-				$output .= apply_filters( 'wp_link_pages_link', $link, $next );
896
+				$output .= apply_filters('wp_link_pages_link', $link, $next);
897 897
 			}
898 898
 			$output .= $r['after'];
899 899
 		}
@@ -907,9 +907,9 @@  discard block
 block discarded – undo
907 907
 	 * @param string $output HTML output of paginated posts' page links.
908 908
 	 * @param array  $args   An array of arguments.
909 909
 	 */
910
-	$html = apply_filters( 'wp_link_pages', $output, $args );
910
+	$html = apply_filters('wp_link_pages', $output, $args);
911 911
 
912
-	if ( $r['echo'] ) {
912
+	if ($r['echo']) {
913 913
 		echo $html;
914 914
 	}
915 915
 	return $html;
@@ -926,33 +926,33 @@  discard block
 block discarded – undo
926 926
  * @param int $i Page number.
927 927
  * @return string Link.
928 928
  */
929
-function _wp_link_page( $i ) {
929
+function _wp_link_page($i) {
930 930
 	global $wp_rewrite;
931 931
 	$post = get_post();
932 932
 	$query_args = array();
933 933
 
934
-	if ( 1 == $i ) {
934
+	if (1 == $i) {
935 935
 		$url = get_permalink();
936 936
 	} else {
937
-		if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) )
938
-			$url = add_query_arg( 'page', $i, get_permalink() );
939
-		elseif ( 'page' == get_option('show_on_front') && get_option('page_on_front') == $post->ID )
940
-			$url = trailingslashit(get_permalink()) . user_trailingslashit("$wp_rewrite->pagination_base/" . $i, 'single_paged');
937
+		if ('' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')))
938
+			$url = add_query_arg('page', $i, get_permalink());
939
+		elseif ('page' == get_option('show_on_front') && get_option('page_on_front') == $post->ID)
940
+			$url = trailingslashit(get_permalink()).user_trailingslashit("$wp_rewrite->pagination_base/".$i, 'single_paged');
941 941
 		else
942
-			$url = trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged');
942
+			$url = trailingslashit(get_permalink()).user_trailingslashit($i, 'single_paged');
943 943
 	}
944 944
 
945
-	if ( is_preview() ) {
945
+	if (is_preview()) {
946 946
 
947
-		if ( ( 'draft' !== $post->post_status ) && isset( $_GET['preview_id'], $_GET['preview_nonce'] ) ) {
948
-			$query_args['preview_id'] = wp_unslash( $_GET['preview_id'] );
949
-			$query_args['preview_nonce'] = wp_unslash( $_GET['preview_nonce'] );
947
+		if (('draft' !== $post->post_status) && isset($_GET['preview_id'], $_GET['preview_nonce'])) {
948
+			$query_args['preview_id'] = wp_unslash($_GET['preview_id']);
949
+			$query_args['preview_nonce'] = wp_unslash($_GET['preview_nonce']);
950 950
 		}
951 951
 
952
-		$url = get_preview_post_link( $post, $query_args, $url );
952
+		$url = get_preview_post_link($post, $query_args, $url);
953 953
 	}
954 954
 
955
-	return '<a href="' . esc_url( $url ) . '">';
955
+	return '<a href="'.esc_url($url).'">';
956 956
 }
957 957
 
958 958
 //
@@ -967,12 +967,12 @@  discard block
 block discarded – undo
967 967
  * @param string $key Meta data key name.
968 968
  * @return false|string|array Array of values or single value, if only one element exists. False will be returned if key does not exist.
969 969
  */
970
-function post_custom( $key = '' ) {
970
+function post_custom($key = '') {
971 971
 	$custom = get_post_custom();
972 972
 
973
-	if ( !isset( $custom[$key] ) )
973
+	if ( ! isset($custom[$key]))
974 974
 		return false;
975
-	elseif ( 1 == count($custom[$key]) )
975
+	elseif (1 == count($custom[$key]))
976 976
 		return $custom[$key][0];
977 977
 	else
978 978
 		return $custom[$key];
@@ -987,14 +987,14 @@  discard block
 block discarded – undo
987 987
  *
988 988
  */
989 989
 function the_meta() {
990
-	if ( $keys = get_post_custom_keys() ) {
990
+	if ($keys = get_post_custom_keys()) {
991 991
 		echo "<ul class='post-meta'>\n";
992
-		foreach ( (array) $keys as $key ) {
992
+		foreach ((array) $keys as $key) {
993 993
 			$keyt = trim($key);
994
-			if ( is_protected_meta( $keyt, 'post' ) )
994
+			if (is_protected_meta($keyt, 'post'))
995 995
 				continue;
996 996
 			$values = array_map('trim', get_post_custom_values($key));
997
-			$value = implode($values,', ');
997
+			$value = implode($values, ', ');
998 998
 
999 999
 			/**
1000 1000
 			 * Filter the HTML output of the li element in the post custom fields list.
@@ -1005,7 +1005,7 @@  discard block
 block discarded – undo
1005 1005
 			 * @param string $key   Meta key.
1006 1006
 			 * @param string $value Meta value.
1007 1007
 			 */
1008
-			echo apply_filters( 'the_meta_key', "<li><span class='post-meta-key'>$key:</span> $value</li>\n", $key, $value );
1008
+			echo apply_filters('the_meta_key', "<li><span class='post-meta-key'>$key:</span> $value</li>\n", $key, $value);
1009 1009
 		}
1010 1010
 		echo "</ul>\n";
1011 1011
 	}
@@ -1043,7 +1043,7 @@  discard block
 block discarded – undo
1043 1043
  * }
1044 1044
  * @return string HTML content, if not displaying.
1045 1045
  */
1046
-function wp_dropdown_pages( $args = '' ) {
1046
+function wp_dropdown_pages($args = '') {
1047 1047
 	$defaults = array(
1048 1048
 		'depth' => 0, 'child_of' => 0,
1049 1049
 		'selected' => 0, 'echo' => 1,
@@ -1054,29 +1054,29 @@  discard block
 block discarded – undo
1054 1054
 		'value_field' => 'ID',
1055 1055
 	);
1056 1056
 
1057
-	$r = wp_parse_args( $args, $defaults );
1057
+	$r = wp_parse_args($args, $defaults);
1058 1058
 
1059
-	$pages = get_pages( $r );
1059
+	$pages = get_pages($r);
1060 1060
 	$output = '';
1061 1061
 	// Back-compat with old system where both id and name were based on $name argument
1062
-	if ( empty( $r['id'] ) ) {
1062
+	if (empty($r['id'])) {
1063 1063
 		$r['id'] = $r['name'];
1064 1064
 	}
1065 1065
 
1066
-	if ( ! empty( $pages ) ) {
1066
+	if ( ! empty($pages)) {
1067 1067
 		$class = '';
1068
-		if ( ! empty( $r['class'] ) ) {
1069
-			$class = " class='" . esc_attr( $r['class'] ) . "'";
1068
+		if ( ! empty($r['class'])) {
1069
+			$class = " class='".esc_attr($r['class'])."'";
1070 1070
 		}
1071 1071
 
1072
-		$output = "<select name='" . esc_attr( $r['name'] ) . "'" . $class . " id='" . esc_attr( $r['id'] ) . "'>\n";
1073
-		if ( $r['show_option_no_change'] ) {
1074
-			$output .= "\t<option value=\"-1\">" . $r['show_option_no_change'] . "</option>\n";
1072
+		$output = "<select name='".esc_attr($r['name'])."'".$class." id='".esc_attr($r['id'])."'>\n";
1073
+		if ($r['show_option_no_change']) {
1074
+			$output .= "\t<option value=\"-1\">".$r['show_option_no_change']."</option>\n";
1075 1075
 		}
1076
-		if ( $r['show_option_none'] ) {
1077
-			$output .= "\t<option value=\"" . esc_attr( $r['option_none_value'] ) . '">' . $r['show_option_none'] . "</option>\n";
1076
+		if ($r['show_option_none']) {
1077
+			$output .= "\t<option value=\"".esc_attr($r['option_none_value']).'">'.$r['show_option_none']."</option>\n";
1078 1078
 		}
1079
-		$output .= walk_page_dropdown_tree( $pages, $r['depth'], $r );
1079
+		$output .= walk_page_dropdown_tree($pages, $r['depth'], $r);
1080 1080
 		$output .= "</select>\n";
1081 1081
 	}
1082 1082
 
@@ -1090,9 +1090,9 @@  discard block
 block discarded – undo
1090 1090
 	 * @param array  $r      The parsed arguments array.
1091 1091
 	 * @param array  $pages  List of WP_Post objects returned by `get_pages()`
1092 1092
  	 */
1093
-	$html = apply_filters( 'wp_dropdown_pages', $output, $r, $pages );
1093
+	$html = apply_filters('wp_dropdown_pages', $output, $r, $pages);
1094 1094
 
1095
-	if ( $r['echo'] ) {
1095
+	if ($r['echo']) {
1096 1096
 		echo $html;
1097 1097
 	}
1098 1098
 	return $html;
@@ -1135,26 +1135,26 @@  discard block
 block discarded – undo
1135 1135
  * }
1136 1136
  * @return string|void HTML list of pages.
1137 1137
  */
1138
-function wp_list_pages( $args = '' ) {
1138
+function wp_list_pages($args = '') {
1139 1139
 	$defaults = array(
1140 1140
 		'depth' => 0, 'show_date' => '',
1141
-		'date_format' => get_option( 'date_format' ),
1141
+		'date_format' => get_option('date_format'),
1142 1142
 		'child_of' => 0, 'exclude' => '',
1143
-		'title_li' => __( 'Pages' ), 'echo' => 1,
1143
+		'title_li' => __('Pages'), 'echo' => 1,
1144 1144
 		'authors' => '', 'sort_column' => 'menu_order, post_title',
1145 1145
 		'link_before' => '', 'link_after' => '', 'walker' => '',
1146 1146
 	);
1147 1147
 
1148
-	$r = wp_parse_args( $args, $defaults );
1148
+	$r = wp_parse_args($args, $defaults);
1149 1149
 
1150 1150
 	$output = '';
1151 1151
 	$current_page = 0;
1152 1152
 
1153 1153
 	// sanitize, mostly to keep spaces out
1154
-	$r['exclude'] = preg_replace( '/[^0-9,]/', '', $r['exclude'] );
1154
+	$r['exclude'] = preg_replace('/[^0-9,]/', '', $r['exclude']);
1155 1155
 
1156 1156
 	// Allow plugins to filter an array of excluded pages (but don't put a nullstring into the array)
1157
-	$exclude_array = ( $r['exclude'] ) ? explode( ',', $r['exclude'] ) : array();
1157
+	$exclude_array = ($r['exclude']) ? explode(',', $r['exclude']) : array();
1158 1158
 
1159 1159
 	/**
1160 1160
 	 * Filter the array of pages to exclude from the pages list.
@@ -1163,29 +1163,29 @@  discard block
 block discarded – undo
1163 1163
 	 *
1164 1164
 	 * @param array $exclude_array An array of page IDs to exclude.
1165 1165
 	 */
1166
-	$r['exclude'] = implode( ',', apply_filters( 'wp_list_pages_excludes', $exclude_array ) );
1166
+	$r['exclude'] = implode(',', apply_filters('wp_list_pages_excludes', $exclude_array));
1167 1167
 
1168 1168
 	// Query pages.
1169 1169
 	$r['hierarchical'] = 0;
1170
-	$pages = get_pages( $r );
1170
+	$pages = get_pages($r);
1171 1171
 
1172
-	if ( ! empty( $pages ) ) {
1173
-		if ( $r['title_li'] ) {
1174
-			$output .= '<li class="pagenav">' . $r['title_li'] . '<ul>';
1172
+	if ( ! empty($pages)) {
1173
+		if ($r['title_li']) {
1174
+			$output .= '<li class="pagenav">'.$r['title_li'].'<ul>';
1175 1175
 		}
1176 1176
 		global $wp_query;
1177
-		if ( is_page() || is_attachment() || $wp_query->is_posts_page ) {
1177
+		if (is_page() || is_attachment() || $wp_query->is_posts_page) {
1178 1178
 			$current_page = get_queried_object_id();
1179
-		} elseif ( is_singular() ) {
1179
+		} elseif (is_singular()) {
1180 1180
 			$queried_object = get_queried_object();
1181
-			if ( is_post_type_hierarchical( $queried_object->post_type ) ) {
1181
+			if (is_post_type_hierarchical($queried_object->post_type)) {
1182 1182
 				$current_page = $queried_object->ID;
1183 1183
 			}
1184 1184
 		}
1185 1185
 
1186
-		$output .= walk_page_tree( $pages, $r['depth'], $current_page, $r );
1186
+		$output .= walk_page_tree($pages, $r['depth'], $current_page, $r);
1187 1187
 
1188
-		if ( $r['title_li'] ) {
1188
+		if ($r['title_li']) {
1189 1189
 			$output .= '</ul></li>';
1190 1190
 		}
1191 1191
 	}
@@ -1202,9 +1202,9 @@  discard block
 block discarded – undo
1202 1202
 	 * @param array  $r      An array of page-listing arguments.
1203 1203
 	 * @param array  $pages  List of WP_Post objects returned by `get_pages()`
1204 1204
 	 */
1205
-	$html = apply_filters( 'wp_list_pages', $output, $r, $pages );
1205
+	$html = apply_filters('wp_list_pages', $output, $r, $pages);
1206 1206
 
1207
-	if ( $r['echo'] ) {
1207
+	if ($r['echo']) {
1208 1208
 		echo $html;
1209 1209
 	} else {
1210 1210
 		return $html;
@@ -1241,7 +1241,7 @@  discard block
 block discarded – undo
1241 1241
  * }
1242 1242
  * @return string|void HTML menu
1243 1243
  */
1244
-function wp_page_menu( $args = array() ) {
1244
+function wp_page_menu($args = array()) {
1245 1245
 	$defaults = array(
1246 1246
 		'sort_column' => 'menu_order, post_title',
1247 1247
 		'menu_id'     => '',
@@ -1254,7 +1254,7 @@  discard block
 block discarded – undo
1254 1254
 		'after'       => '</ul>',
1255 1255
 		'walker'      => '',
1256 1256
 	);
1257
-	$args = wp_parse_args( $args, $defaults );
1257
+	$args = wp_parse_args($args, $defaults);
1258 1258
 
1259 1259
 	/**
1260 1260
 	 * Filter the arguments used to generate a page-based menu.
@@ -1265,25 +1265,25 @@  discard block
 block discarded – undo
1265 1265
 	 *
1266 1266
 	 * @param array $args An array of page menu arguments.
1267 1267
 	 */
1268
-	$args = apply_filters( 'wp_page_menu_args', $args );
1268
+	$args = apply_filters('wp_page_menu_args', $args);
1269 1269
 
1270 1270
 	$menu = '';
1271 1271
 
1272 1272
 	$list_args = $args;
1273 1273
 
1274 1274
 	// Show Home in the menu
1275
-	if ( ! empty($args['show_home']) ) {
1276
-		if ( true === $args['show_home'] || '1' === $args['show_home'] || 1 === $args['show_home'] )
1275
+	if ( ! empty($args['show_home'])) {
1276
+		if (true === $args['show_home'] || '1' === $args['show_home'] || 1 === $args['show_home'])
1277 1277
 			$text = __('Home');
1278 1278
 		else
1279 1279
 			$text = $args['show_home'];
1280 1280
 		$class = '';
1281
-		if ( is_front_page() && !is_paged() )
1281
+		if (is_front_page() && ! is_paged())
1282 1282
 			$class = 'class="current_page_item"';
1283
-		$menu .= '<li ' . $class . '><a href="' . home_url( '/' ) . '">' . $args['link_before'] . $text . $args['link_after'] . '</a></li>';
1283
+		$menu .= '<li '.$class.'><a href="'.home_url('/').'">'.$args['link_before'].$text.$args['link_after'].'</a></li>';
1284 1284
 		// If the front page is a page, add it to the exclude list
1285 1285
 		if (get_option('show_on_front') == 'page') {
1286
-			if ( !empty( $list_args['exclude'] ) ) {
1286
+			if ( ! empty($list_args['exclude'])) {
1287 1287
 				$list_args['exclude'] .= ',';
1288 1288
 			} else {
1289 1289
 				$list_args['exclude'] = '';
@@ -1294,38 +1294,38 @@  discard block
 block discarded – undo
1294 1294
 
1295 1295
 	$list_args['echo'] = false;
1296 1296
 	$list_args['title_li'] = '';
1297
-	$menu .= str_replace( array( "\r", "\n", "\t" ), '', wp_list_pages($list_args) );
1297
+	$menu .= str_replace(array("\r", "\n", "\t"), '', wp_list_pages($list_args));
1298 1298
 
1299
-	$container = sanitize_text_field( $args['container'] );
1299
+	$container = sanitize_text_field($args['container']);
1300 1300
 
1301 1301
 	// Fallback in case `wp_nav_menu()` was called without a container.
1302
-	if ( empty( $container ) ) {
1302
+	if (empty($container)) {
1303 1303
 		$container = 'div';
1304 1304
 	}
1305 1305
 
1306
-	if ( $menu ) {
1306
+	if ($menu) {
1307 1307
 
1308 1308
 		// wp_nav_menu doesn't set before and after
1309
-		if ( isset( $args['fallback_cb'] ) &&
1309
+		if (isset($args['fallback_cb']) &&
1310 1310
 			'wp_page_menu' === $args['fallback_cb'] &&
1311
-			'ul' !== $container ) {
1311
+			'ul' !== $container) {
1312 1312
 			$args['before'] = '<ul>';
1313 1313
 			$args['after'] = '</ul>';
1314 1314
 		}
1315 1315
 
1316
-		$menu = $args['before'] . $menu . $args['after'];
1316
+		$menu = $args['before'].$menu.$args['after'];
1317 1317
 	}
1318 1318
 
1319 1319
 	$attrs = '';
1320
-	if ( ! empty( $args['menu_id'] ) ) {
1321
-		$attrs .= ' id="' . esc_attr( $args['menu_id'] ) . '"';
1320
+	if ( ! empty($args['menu_id'])) {
1321
+		$attrs .= ' id="'.esc_attr($args['menu_id']).'"';
1322 1322
 	}
1323 1323
 
1324
-	if ( ! empty( $args['menu_class'] ) ) {
1325
-		$attrs .= ' class="' . esc_attr( $args['menu_class'] ) . '"';
1324
+	if ( ! empty($args['menu_class'])) {
1325
+		$attrs .= ' class="'.esc_attr($args['menu_class']).'"';
1326 1326
 	}
1327 1327
 
1328
-	$menu = "<{$container}{$attrs}>" . $menu . "</{$container}>\n";
1328
+	$menu = "<{$container}{$attrs}>".$menu."</{$container}>\n";
1329 1329
 
1330 1330
 	/**
1331 1331
 	 * Filter the HTML output of a page-based menu.
@@ -1337,8 +1337,8 @@  discard block
 block discarded – undo
1337 1337
 	 * @param string $menu The HTML output.
1338 1338
 	 * @param array  $args An array of arguments.
1339 1339
 	 */
1340
-	$menu = apply_filters( 'wp_page_menu', $menu, $args );
1341
-	if ( $args['echo'] )
1340
+	$menu = apply_filters('wp_page_menu', $menu, $args);
1341
+	if ($args['echo'])
1342 1342
 		echo $menu;
1343 1343
 	else
1344 1344
 		return $menu;
@@ -1360,15 +1360,15 @@  discard block
 block discarded – undo
1360 1360
  * @param array $r
1361 1361
  * @return string
1362 1362
  */
1363
-function walk_page_tree( $pages, $depth, $current_page, $r ) {
1364
-	if ( empty($r['walker']) )
1363
+function walk_page_tree($pages, $depth, $current_page, $r) {
1364
+	if (empty($r['walker']))
1365 1365
 		$walker = new Walker_Page;
1366 1366
 	else
1367 1367
 		$walker = $r['walker'];
1368 1368
 
1369
-	foreach ( (array) $pages as $page ) {
1370
-		if ( $page->post_parent )
1371
-			$r['pages_with_children'][ $page->post_parent ] = true;
1369
+	foreach ((array) $pages as $page) {
1370
+		if ($page->post_parent)
1371
+			$r['pages_with_children'][$page->post_parent] = true;
1372 1372
 	}
1373 1373
 
1374 1374
 	$args = array($pages, $depth, $r, $current_page);
@@ -1386,7 +1386,7 @@  discard block
 block discarded – undo
1386 1386
  */
1387 1387
 function walk_page_dropdown_tree() {
1388 1388
 	$args = func_get_args();
1389
-	if ( empty($args[2]['walker']) ) // the user's options are the third parameter
1389
+	if (empty($args[2]['walker'])) // the user's options are the third parameter
1390 1390
 		$walker = new Walker_PageDropdown;
1391 1391
 	else
1392 1392
 		$walker = $args[2]['walker'];
@@ -1408,11 +1408,11 @@  discard block
 block discarded – undo
1408 1408
  * @param bool        $deprecated   Deprecated. Not used.
1409 1409
  * @param bool        $permalink    Optional, default is false. Whether to include permalink.
1410 1410
  */
1411
-function the_attachment_link( $id = 0, $fullsize = false, $deprecated = false, $permalink = false ) {
1412
-	if ( !empty( $deprecated ) )
1413
-		_deprecated_argument( __FUNCTION__, '2.5' );
1411
+function the_attachment_link($id = 0, $fullsize = false, $deprecated = false, $permalink = false) {
1412
+	if ( ! empty($deprecated))
1413
+		_deprecated_argument(__FUNCTION__, '2.5');
1414 1414
 
1415
-	if ( $fullsize )
1415
+	if ($fullsize)
1416 1416
 		echo wp_get_attachment_link($id, 'full', $permalink);
1417 1417
 	else
1418 1418
 		echo wp_get_attachment_link($id, 'thumbnail', $permalink);
@@ -1435,24 +1435,24 @@  discard block
 block discarded – undo
1435 1435
  * @param array|string $attr      Optional. Array or string of attributes. Default empty.
1436 1436
  * @return string HTML content.
1437 1437
  */
1438
-function wp_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false, $attr = '' ) {
1439
-	$_post = get_post( $id );
1438
+function wp_get_attachment_link($id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false, $attr = '') {
1439
+	$_post = get_post($id);
1440 1440
 
1441
-	if ( empty( $_post ) || ( 'attachment' != $_post->post_type ) || ! $url = wp_get_attachment_url( $_post->ID ) )
1442
-		return __( 'Missing Attachment' );
1441
+	if (empty($_post) || ('attachment' != $_post->post_type) || ! $url = wp_get_attachment_url($_post->ID))
1442
+		return __('Missing Attachment');
1443 1443
 
1444
-	if ( $permalink )
1445
-		$url = get_attachment_link( $_post->ID );
1444
+	if ($permalink)
1445
+		$url = get_attachment_link($_post->ID);
1446 1446
 
1447
-	if ( $text ) {
1447
+	if ($text) {
1448 1448
 		$link_text = $text;
1449
-	} elseif ( $size && 'none' != $size ) {
1450
-		$link_text = wp_get_attachment_image( $_post->ID, $size, $icon, $attr );
1449
+	} elseif ($size && 'none' != $size) {
1450
+		$link_text = wp_get_attachment_image($_post->ID, $size, $icon, $attr);
1451 1451
 	} else {
1452 1452
 		$link_text = '';
1453 1453
 	}
1454 1454
 
1455
-	if ( trim( $link_text ) == '' )
1455
+	if (trim($link_text) == '')
1456 1456
 		$link_text = $_post->post_title;
1457 1457
 
1458 1458
 	/**
@@ -1468,7 +1468,7 @@  discard block
 block discarded – undo
1468 1468
 	 * @param bool         $icon      Whether to include an icon. Default false.
1469 1469
 	 * @param string|bool  $text      If string, will be link text. Default false.
1470 1470
 	 */
1471
-	return apply_filters( 'wp_get_attachment_link', "<a href='$url'>$link_text</a>", $id, $size, $permalink, $icon, $text );
1471
+	return apply_filters('wp_get_attachment_link', "<a href='$url'>$link_text</a>", $id, $size, $permalink, $icon, $text);
1472 1472
 }
1473 1473
 
1474 1474
 /**
@@ -1482,22 +1482,22 @@  discard block
 block discarded – undo
1482 1482
 function prepend_attachment($content) {
1483 1483
 	$post = get_post();
1484 1484
 
1485
-	if ( empty($post->post_type) || $post->post_type != 'attachment' )
1485
+	if (empty($post->post_type) || $post->post_type != 'attachment')
1486 1486
 		return $content;
1487 1487
 
1488
-	if ( wp_attachment_is( 'video', $post ) ) {
1489
-		$meta = wp_get_attachment_metadata( get_the_ID() );
1490
-		$atts = array( 'src' => wp_get_attachment_url() );
1491
-		if ( ! empty( $meta['width'] ) && ! empty( $meta['height'] ) ) {
1488
+	if (wp_attachment_is('video', $post)) {
1489
+		$meta = wp_get_attachment_metadata(get_the_ID());
1490
+		$atts = array('src' => wp_get_attachment_url());
1491
+		if ( ! empty($meta['width']) && ! empty($meta['height'])) {
1492 1492
 			$atts['width'] = (int) $meta['width'];
1493 1493
 			$atts['height'] = (int) $meta['height'];
1494 1494
 		}
1495
-		if ( has_post_thumbnail() ) {
1496
-			$atts['poster'] = wp_get_attachment_url( get_post_thumbnail_id() );
1495
+		if (has_post_thumbnail()) {
1496
+			$atts['poster'] = wp_get_attachment_url(get_post_thumbnail_id());
1497 1497
 		}
1498
-		$p = wp_video_shortcode( $atts );
1499
-	} elseif ( wp_attachment_is( 'audio', $post ) ) {
1500
-		$p = wp_audio_shortcode( array( 'src' => wp_get_attachment_url() ) );
1498
+		$p = wp_video_shortcode($atts);
1499
+	} elseif (wp_attachment_is('audio', $post)) {
1500
+		$p = wp_audio_shortcode(array('src' => wp_get_attachment_url()));
1501 1501
 	} else {
1502 1502
 		$p = '<p class="attachment">';
1503 1503
 		// show the medium sized image representation of the attachment if available, and link to the raw file
@@ -1514,7 +1514,7 @@  discard block
 block discarded – undo
1514 1514
 	 *
1515 1515
 	 * @param string $p The attachment HTML output.
1516 1516
 	 */
1517
-	$p = apply_filters( 'prepend_attachment', $p );
1517
+	$p = apply_filters('prepend_attachment', $p);
1518 1518
 
1519 1519
 	return "$p\n$content";
1520 1520
 }
@@ -1531,12 +1531,12 @@  discard block
 block discarded – undo
1531 1531
  * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
1532 1532
  * @return string HTML content for password form for password protected post.
1533 1533
  */
1534
-function get_the_password_form( $post = 0 ) {
1535
-	$post = get_post( $post );
1536
-	$label = 'pwbox-' . ( empty($post->ID) ? rand() : $post->ID );
1537
-	$output = '<form action="' . esc_url( site_url( 'wp-login.php?action=postpass', 'login_post' ) ) . '" class="post-password-form" method="post">
1538
-	<p>' . __( 'This content is password protected. To view it please enter your password below:' ) . '</p>
1539
-	<p><label for="' . $label . '">' . __( 'Password:' ) . ' <input name="post_password" id="' . $label . '" type="password" size="20" /></label> <input type="submit" name="Submit" value="' . esc_attr_x( 'Enter', 'post password form' ) . '" /></p></form>
1534
+function get_the_password_form($post = 0) {
1535
+	$post = get_post($post);
1536
+	$label = 'pwbox-'.(empty($post->ID) ? rand() : $post->ID);
1537
+	$output = '<form action="'.esc_url(site_url('wp-login.php?action=postpass', 'login_post')).'" class="post-password-form" method="post">
1538
+	<p>' . __('This content is password protected. To view it please enter your password below:').'</p>
1539
+	<p><label for="' . $label.'">'.__('Password:').' <input name="post_password" id="'.$label.'" type="password" size="20" /></label> <input type="submit" name="Submit" value="'.esc_attr_x('Enter', 'post password form').'" /></p></form>
1540 1540
 	';
1541 1541
 
1542 1542
 	/**
@@ -1550,7 +1550,7 @@  discard block
 block discarded – undo
1550 1550
 	 *
1551 1551
 	 * @param string $output The password form HTML output.
1552 1552
 	 */
1553
-	return apply_filters( 'the_password_form', $output );
1553
+	return apply_filters('the_password_form', $output);
1554 1554
 }
1555 1555
 
1556 1556
 /**
@@ -1566,27 +1566,27 @@  discard block
 block discarded – undo
1566 1566
  * @param string|array $template The specific template name or array of templates to match.
1567 1567
  * @return bool True on success, false on failure.
1568 1568
  */
1569
-function is_page_template( $template = '' ) {
1570
-	if ( ! is_page() )
1569
+function is_page_template($template = '') {
1570
+	if ( ! is_page())
1571 1571
 		return false;
1572 1572
 
1573
-	$page_template = get_page_template_slug( get_queried_object_id() );
1573
+	$page_template = get_page_template_slug(get_queried_object_id());
1574 1574
 
1575
-	if ( empty( $template ) )
1575
+	if (empty($template))
1576 1576
 		return (bool) $page_template;
1577 1577
 
1578
-	if ( $template == $page_template )
1578
+	if ($template == $page_template)
1579 1579
 		return true;
1580 1580
 
1581
-	if ( is_array( $template ) ) {
1582
-		if ( ( in_array( 'default', $template, true ) && ! $page_template )
1583
-			|| in_array( $page_template, $template, true )
1581
+	if (is_array($template)) {
1582
+		if ((in_array('default', $template, true) && ! $page_template)
1583
+			|| in_array($page_template, $template, true)
1584 1584
 		) {
1585 1585
 			return true;
1586 1586
 		}
1587 1587
 	}
1588 1588
 
1589
-	return ( 'default' === $template && ! $page_template );
1589
+	return ('default' === $template && ! $page_template);
1590 1590
 }
1591 1591
 
1592 1592
 /**
@@ -1598,12 +1598,12 @@  discard block
 block discarded – undo
1598 1598
  * @return string|false Page template filename. Returns an empty string when the default page template
1599 1599
  * 	is in use. Returns false if the post is not a page.
1600 1600
  */
1601
-function get_page_template_slug( $post_id = null ) {
1602
-	$post = get_post( $post_id );
1603
-	if ( ! $post || 'page' != $post->post_type )
1601
+function get_page_template_slug($post_id = null) {
1602
+	$post = get_post($post_id);
1603
+	if ( ! $post || 'page' != $post->post_type)
1604 1604
 		return false;
1605
-	$template = get_post_meta( $post->ID, '_wp_page_template', true );
1606
-	if ( ! $template || 'default' == $template )
1605
+	$template = get_post_meta($post->ID, '_wp_page_template', true);
1606
+	if ( ! $template || 'default' == $template)
1607 1607
 		return '';
1608 1608
 	return $template;
1609 1609
 }
@@ -1617,28 +1617,28 @@  discard block
 block discarded – undo
1617 1617
  * @param bool       $link     Optional, default is true. Link to revisions's page?
1618 1618
  * @return string|false i18n formatted datetimestamp or localized 'Current Revision'.
1619 1619
  */
1620
-function wp_post_revision_title( $revision, $link = true ) {
1621
-	if ( !$revision = get_post( $revision ) )
1620
+function wp_post_revision_title($revision, $link = true) {
1621
+	if ( ! $revision = get_post($revision))
1622 1622
 		return $revision;
1623 1623
 
1624
-	if ( !in_array( $revision->post_type, array( 'post', 'page', 'revision' ) ) )
1624
+	if ( ! in_array($revision->post_type, array('post', 'page', 'revision')))
1625 1625
 		return false;
1626 1626
 
1627 1627
 	/* translators: revision date format, see http://php.net/date */
1628
-	$datef = _x( 'F j, Y @ H:i:s', 'revision date format' );
1628
+	$datef = _x('F j, Y @ H:i:s', 'revision date format');
1629 1629
 	/* translators: 1: date */
1630
-	$autosavef = _x( '%1$s [Autosave]', 'post revision title extra' );
1630
+	$autosavef = _x('%1$s [Autosave]', 'post revision title extra');
1631 1631
 	/* translators: 1: date */
1632
-	$currentf  = _x( '%1$s [Current Revision]', 'post revision title extra' );
1632
+	$currentf  = _x('%1$s [Current Revision]', 'post revision title extra');
1633 1633
 
1634
-	$date = date_i18n( $datef, strtotime( $revision->post_modified ) );
1635
-	if ( $link && current_user_can( 'edit_post', $revision->ID ) && $link = get_edit_post_link( $revision->ID ) )
1634
+	$date = date_i18n($datef, strtotime($revision->post_modified));
1635
+	if ($link && current_user_can('edit_post', $revision->ID) && $link = get_edit_post_link($revision->ID))
1636 1636
 		$date = "<a href='$link'>$date</a>";
1637 1637
 
1638
-	if ( !wp_is_post_revision( $revision ) )
1639
-		$date = sprintf( $currentf, $date );
1640
-	elseif ( wp_is_post_autosave( $revision ) )
1641
-		$date = sprintf( $autosavef, $date );
1638
+	if ( ! wp_is_post_revision($revision))
1639
+		$date = sprintf($currentf, $date);
1640
+	elseif (wp_is_post_autosave($revision))
1641
+		$date = sprintf($autosavef, $date);
1642 1642
 
1643 1643
 	return $date;
1644 1644
 }
@@ -1652,39 +1652,39 @@  discard block
 block discarded – undo
1652 1652
  * @param bool       $link     Optional, default is true. Link to revisions's page?
1653 1653
  * @return string|false gravatar, user, i18n formatted datetimestamp or localized 'Current Revision'.
1654 1654
  */
1655
-function wp_post_revision_title_expanded( $revision, $link = true ) {
1656
-	if ( !$revision = get_post( $revision ) )
1655
+function wp_post_revision_title_expanded($revision, $link = true) {
1656
+	if ( ! $revision = get_post($revision))
1657 1657
 		return $revision;
1658 1658
 
1659
-	if ( !in_array( $revision->post_type, array( 'post', 'page', 'revision' ) ) )
1659
+	if ( ! in_array($revision->post_type, array('post', 'page', 'revision')))
1660 1660
 		return false;
1661 1661
 
1662
-	$author = get_the_author_meta( 'display_name', $revision->post_author );
1662
+	$author = get_the_author_meta('display_name', $revision->post_author);
1663 1663
 	/* translators: revision date format, see http://php.net/date */
1664
-	$datef = _x( 'F j, Y @ H:i:s', 'revision date format' );
1664
+	$datef = _x('F j, Y @ H:i:s', 'revision date format');
1665 1665
 
1666
-	$gravatar = get_avatar( $revision->post_author, 24 );
1666
+	$gravatar = get_avatar($revision->post_author, 24);
1667 1667
 
1668
-	$date = date_i18n( $datef, strtotime( $revision->post_modified ) );
1669
-	if ( $link && current_user_can( 'edit_post', $revision->ID ) && $link = get_edit_post_link( $revision->ID ) )
1668
+	$date = date_i18n($datef, strtotime($revision->post_modified));
1669
+	if ($link && current_user_can('edit_post', $revision->ID) && $link = get_edit_post_link($revision->ID))
1670 1670
 		$date = "<a href='$link'>$date</a>";
1671 1671
 
1672 1672
 	$revision_date_author = sprintf(
1673 1673
 		/* translators: post revision title: 1: author avatar, 2: author name, 3: time ago, 4: date */
1674
-		_x( '%1$s %2$s, %3$s ago (%4$s)', 'post revision title' ),
1674
+		_x('%1$s %2$s, %3$s ago (%4$s)', 'post revision title'),
1675 1675
 		$gravatar,
1676 1676
 		$author,
1677
-		human_time_diff( strtotime( $revision->post_modified ), current_time( 'timestamp' ) ),
1677
+		human_time_diff(strtotime($revision->post_modified), current_time('timestamp')),
1678 1678
 		$date
1679 1679
 	);
1680 1680
 
1681
-	$autosavef = __( '%1$s [Autosave]' );
1682
-	$currentf  = __( '%1$s [Current Revision]' );
1681
+	$autosavef = __('%1$s [Autosave]');
1682
+	$currentf  = __('%1$s [Current Revision]');
1683 1683
 
1684
-	if ( !wp_is_post_revision( $revision ) )
1685
-		$revision_date_author = sprintf( $currentf, $revision_date_author );
1686
-	elseif ( wp_is_post_autosave( $revision ) )
1687
-		$revision_date_author = sprintf( $autosavef, $revision_date_author );
1684
+	if ( ! wp_is_post_revision($revision))
1685
+		$revision_date_author = sprintf($currentf, $revision_date_author);
1686
+	elseif (wp_is_post_autosave($revision))
1687
+		$revision_date_author = sprintf($autosavef, $revision_date_author);
1688 1688
 
1689 1689
 	/**
1690 1690
 	 * Filter the formatted author and date for a revision.
@@ -1696,7 +1696,7 @@  discard block
 block discarded – undo
1696 1696
 	 * @param bool    $link                 Whether to link to the revisions page, as passed into
1697 1697
 	 *                                      wp_post_revision_title_expanded().
1698 1698
 	 */
1699
-	return apply_filters( 'wp_post_revision_title_expanded', $revision_date_author, $revision, $link );
1699
+	return apply_filters('wp_post_revision_title_expanded', $revision_date_author, $revision, $link);
1700 1700
 }
1701 1701
 
1702 1702
 /**
@@ -1710,32 +1710,32 @@  discard block
 block discarded – undo
1710 1710
  * @param int|WP_Post $post_id Optional. Post ID or WP_Post object. Default is global $post.
1711 1711
  * @param string      $type    'all' (default), 'revision' or 'autosave'
1712 1712
  */
1713
-function wp_list_post_revisions( $post_id = 0, $type = 'all' ) {
1714
-	if ( ! $post = get_post( $post_id ) )
1713
+function wp_list_post_revisions($post_id = 0, $type = 'all') {
1714
+	if ( ! $post = get_post($post_id))
1715 1715
 		return;
1716 1716
 
1717 1717
 	// $args array with (parent, format, right, left, type) deprecated since 3.6
1718
-	if ( is_array( $type ) ) {
1719
-		$type = ! empty( $type['type'] ) ? $type['type']  : $type;
1720
-		_deprecated_argument( __FUNCTION__, '3.6' );
1718
+	if (is_array($type)) {
1719
+		$type = ! empty($type['type']) ? $type['type'] : $type;
1720
+		_deprecated_argument(__FUNCTION__, '3.6');
1721 1721
 	}
1722 1722
 
1723
-	if ( ! $revisions = wp_get_post_revisions( $post->ID ) )
1723
+	if ( ! $revisions = wp_get_post_revisions($post->ID))
1724 1724
 		return;
1725 1725
 
1726 1726
 	$rows = '';
1727
-	foreach ( $revisions as $revision ) {
1728
-		if ( ! current_user_can( 'read_post', $revision->ID ) )
1727
+	foreach ($revisions as $revision) {
1728
+		if ( ! current_user_can('read_post', $revision->ID))
1729 1729
 			continue;
1730 1730
 
1731
-		$is_autosave = wp_is_post_autosave( $revision );
1732
-		if ( ( 'revision' === $type && $is_autosave ) || ( 'autosave' === $type && ! $is_autosave ) )
1731
+		$is_autosave = wp_is_post_autosave($revision);
1732
+		if (('revision' === $type && $is_autosave) || ('autosave' === $type && ! $is_autosave))
1733 1733
 			continue;
1734 1734
 
1735
-		$rows .= "\t<li>" . wp_post_revision_title_expanded( $revision ) . "</li>\n";
1735
+		$rows .= "\t<li>".wp_post_revision_title_expanded($revision)."</li>\n";
1736 1736
 	}
1737 1737
 
1738
-	echo "<div class='hide-if-js'><p>" . __( 'JavaScript must be enabled to use this feature.' ) . "</p></div>\n";
1738
+	echo "<div class='hide-if-js'><p>".__('JavaScript must be enabled to use this feature.')."</p></div>\n";
1739 1739
 
1740 1740
 	echo "<ul class='post-revisions hide-if-no-js'>\n";
1741 1741
 	echo $rows;
Please login to merge, or discard this patch.
Braces   +235 added lines, -169 removed lines patch added patch discarded remove patch
@@ -42,16 +42,18 @@  discard block
 block discarded – undo
42 42
 function the_title( $before = '', $after = '', $echo = true ) {
43 43
 	$title = get_the_title();
44 44
 
45
-	if ( strlen($title) == 0 )
46
-		return;
45
+	if ( strlen($title) == 0 ) {
46
+			return;
47
+	}
47 48
 
48 49
 	$title = $before . $title . $after;
49 50
 
50
-	if ( $echo )
51
-		echo $title;
52
-	else
53
-		return $title;
54
-}
51
+	if ( $echo ) {
52
+			echo $title;
53
+	} else {
54
+			return $title;
55
+	}
56
+	}
55 57
 
56 58
 /**
57 59
  * Sanitize the current title when retrieving or displaying.
@@ -262,37 +264,45 @@  discard block
 block discarded – undo
262 264
 
263 265
 	$post = get_post();
264 266
 
265
-	if ( null === $more_link_text )
266
-		$more_link_text = __( '(more&hellip;)' );
267
+	if ( null === $more_link_text ) {
268
+			$more_link_text = __( '(more&hellip;)' );
269
+	}
267 270
 
268 271
 	$output = '';
269 272
 	$has_teaser = false;
270 273
 
271 274
 	// If post password required and it doesn't match the cookie.
272
-	if ( post_password_required( $post ) )
273
-		return get_the_password_form( $post );
275
+	if ( post_password_required( $post ) ) {
276
+			return get_the_password_form( $post );
277
+	}
274 278
 
275
-	if ( $page > count( $pages ) ) // if the requested page doesn't exist
276
-		$page = count( $pages ); // give them the highest numbered page that DOES exist
279
+	if ( $page > count( $pages ) ) {
280
+		// if the requested page doesn't exist
281
+		$page = count( $pages );
282
+	}
283
+	// give them the highest numbered page that DOES exist
277 284
 
278 285
 	$content = $pages[$page - 1];
279 286
 	if ( preg_match( '/<!--more(.*?)?-->/', $content, $matches ) ) {
280 287
 		$content = explode( $matches[0], $content, 2 );
281
-		if ( ! empty( $matches[1] ) && ! empty( $more_link_text ) )
282
-			$more_link_text = strip_tags( wp_kses_no_null( trim( $matches[1] ) ) );
288
+		if ( ! empty( $matches[1] ) && ! empty( $more_link_text ) ) {
289
+					$more_link_text = strip_tags( wp_kses_no_null( trim( $matches[1] ) ) );
290
+		}
283 291
 
284 292
 		$has_teaser = true;
285 293
 	} else {
286 294
 		$content = array( $content );
287 295
 	}
288 296
 
289
-	if ( false !== strpos( $post->post_content, '<!--noteaser-->' ) && ( ! $multipage || $page == 1 ) )
290
-		$strip_teaser = true;
297
+	if ( false !== strpos( $post->post_content, '<!--noteaser-->' ) && ( ! $multipage || $page == 1 ) ) {
298
+			$strip_teaser = true;
299
+	}
291 300
 
292 301
 	$teaser = $content[0];
293 302
 
294
-	if ( $more && $strip_teaser && $has_teaser )
295
-		$teaser = '';
303
+	if ( $more && $strip_teaser && $has_teaser ) {
304
+			$teaser = '';
305
+	}
296 306
 
297 307
 	$output .= $teaser;
298 308
 
@@ -300,8 +310,8 @@  discard block
 block discarded – undo
300 310
 		if ( $more ) {
301 311
 			$output .= '<span id="more-' . $post->ID . '"></span>' . $content[1];
302 312
 		} else {
303
-			if ( ! empty( $more_link_text ) )
304
-
313
+			if ( ! empty( $more_link_text ) ) {
314
+			
305 315
 				/**
306 316
 				 * Filter the Read More link text.
307 317
 				 *
@@ -311,12 +321,15 @@  discard block
 block discarded – undo
311 321
 				 * @param string $more_link_text    Read More text.
312 322
 				 */
313 323
 				$output .= apply_filters( 'the_content_more_link', ' <a href="' . get_permalink() . "#more-{$post->ID}\" class=\"more-link\">$more_link_text</a>", $more_link_text );
324
+			}
314 325
 			$output = force_balance_tags( $output );
315 326
 		}
316 327
 	}
317 328
 
318
-	if ( $preview ) // Preview fix for JavaScript bug with foreign languages.
329
+	if ( $preview ) {
330
+		// Preview fix for JavaScript bug with foreign languages.
319 331
 		$output =	preg_replace_callback( '/\%u([0-9A-F]{4})/', '_convert_urlencoded_to_entities', $output );
332
+	}
320 333
 
321 334
 	return $output;
322 335
 }
@@ -453,8 +466,9 @@  discard block
 block discarded – undo
453 466
 	}
454 467
 
455 468
 	$classes[] = 'post-' . $post->ID;
456
-	if ( ! is_admin() )
457
-		$classes[] = $post->post_type;
469
+	if ( ! is_admin() ) {
470
+			$classes[] = $post->post_type;
471
+	}
458 472
 	$classes[] = 'type-' . $post->post_type;
459 473
 	$classes[] = 'status-' . $post->post_status;
460 474
 
@@ -462,10 +476,11 @@  discard block
 block discarded – undo
462 476
 	if ( post_type_supports( $post->post_type, 'post-formats' ) ) {
463 477
 		$post_format = get_post_format( $post->ID );
464 478
 
465
-		if ( $post_format && !is_wp_error($post_format) )
466
-			$classes[] = 'format-' . sanitize_html_class( $post_format );
467
-		else
468
-			$classes[] = 'format-standard';
479
+		if ( $post_format && !is_wp_error($post_format) ) {
480
+					$classes[] = 'format-' . sanitize_html_class( $post_format );
481
+		} else {
482
+					$classes[] = 'format-standard';
483
+		}
469 484
 	}
470 485
 
471 486
 	$post_password_required = post_password_required( $post->ID );
@@ -561,27 +576,35 @@  discard block
 block discarded – undo
561 576
 
562 577
 	$classes = array();
563 578
 
564
-	if ( is_rtl() )
565
-		$classes[] = 'rtl';
566
-
567
-	if ( is_front_page() )
568
-		$classes[] = 'home';
569
-	if ( is_home() )
570
-		$classes[] = 'blog';
571
-	if ( is_archive() )
572
-		$classes[] = 'archive';
573
-	if ( is_date() )
574
-		$classes[] = 'date';
579
+	if ( is_rtl() ) {
580
+			$classes[] = 'rtl';
581
+	}
582
+
583
+	if ( is_front_page() ) {
584
+			$classes[] = 'home';
585
+	}
586
+	if ( is_home() ) {
587
+			$classes[] = 'blog';
588
+	}
589
+	if ( is_archive() ) {
590
+			$classes[] = 'archive';
591
+	}
592
+	if ( is_date() ) {
593
+			$classes[] = 'date';
594
+	}
575 595
 	if ( is_search() ) {
576 596
 		$classes[] = 'search';
577 597
 		$classes[] = $wp_query->posts ? 'search-results' : 'search-no-results';
578 598
 	}
579
-	if ( is_paged() )
580
-		$classes[] = 'paged';
581
-	if ( is_attachment() )
582
-		$classes[] = 'attachment';
583
-	if ( is_404() )
584
-		$classes[] = 'error404';
599
+	if ( is_paged() ) {
600
+			$classes[] = 'paged';
601
+	}
602
+	if ( is_attachment() ) {
603
+			$classes[] = 'attachment';
604
+	}
605
+	if ( is_404() ) {
606
+			$classes[] = 'error404';
607
+	}
585 608
 	if ( is_singular() ) {
586 609
 		$classes[] = 'singular';
587 610
 	}
@@ -599,10 +622,11 @@  discard block
 block discarded – undo
599 622
 			if ( post_type_supports( $post->post_type, 'post-formats' ) ) {
600 623
 				$post_format = get_post_format( $post->ID );
601 624
 
602
-				if ( $post_format && !is_wp_error($post_format) )
603
-					$classes[] = 'single-format-' . sanitize_html_class( $post_format );
604
-				else
605
-					$classes[] = 'single-format-standard';
625
+				if ( $post_format && !is_wp_error($post_format) ) {
626
+									$classes[] = 'single-format-' . sanitize_html_class( $post_format );
627
+				} else {
628
+									$classes[] = 'single-format-standard';
629
+				}
606 630
 			}
607 631
 		}
608 632
 
@@ -616,8 +640,9 @@  discard block
 block discarded – undo
616 640
 		if ( is_post_type_archive() ) {
617 641
 			$classes[] = 'post-type-archive';
618 642
 			$post_type = get_query_var( 'post_type' );
619
-			if ( is_array( $post_type ) )
620
-				$post_type = reset( $post_type );
643
+			if ( is_array( $post_type ) ) {
644
+							$post_type = reset( $post_type );
645
+			}
621 646
 			$classes[] = 'post-type-archive-' . sanitize_html_class( $post_type );
622 647
 		} elseif ( is_author() ) {
623 648
 			$author = $wp_query->get_queried_object();
@@ -695,16 +720,18 @@  discard block
 block discarded – undo
695 720
 		}
696 721
 	}
697 722
 
698
-	if ( is_user_logged_in() )
699
-		$classes[] = 'logged-in';
723
+	if ( is_user_logged_in() ) {
724
+			$classes[] = 'logged-in';
725
+	}
700 726
 
701 727
 	if ( is_admin_bar_showing() ) {
702 728
 		$classes[] = 'admin-bar';
703 729
 		$classes[] = 'no-customize-support';
704 730
 	}
705 731
 
706
-	if ( get_background_color() !== get_theme_support( 'custom-background', 'default-color' ) || get_background_image() )
707
-		$classes[] = 'custom-background';
732
+	if ( get_background_color() !== get_theme_support( 'custom-background', 'default-color' ) || get_background_image() ) {
733
+			$classes[] = 'custom-background';
734
+	}
708 735
 
709 736
 	if ( has_custom_logo() ) {
710 737
 		$classes[] = 'wp-custom-logo';
@@ -712,33 +739,36 @@  discard block
 block discarded – undo
712 739
 
713 740
 	$page = $wp_query->get( 'page' );
714 741
 
715
-	if ( ! $page || $page < 2 )
716
-		$page = $wp_query->get( 'paged' );
742
+	if ( ! $page || $page < 2 ) {
743
+			$page = $wp_query->get( 'paged' );
744
+	}
717 745
 
718 746
 	if ( $page && $page > 1 && ! is_404() ) {
719 747
 		$classes[] = 'paged-' . $page;
720 748
 
721
-		if ( is_single() )
722
-			$classes[] = 'single-paged-' . $page;
723
-		elseif ( is_page() )
724
-			$classes[] = 'page-paged-' . $page;
725
-		elseif ( is_category() )
726
-			$classes[] = 'category-paged-' . $page;
727
-		elseif ( is_tag() )
728
-			$classes[] = 'tag-paged-' . $page;
729
-		elseif ( is_date() )
730
-			$classes[] = 'date-paged-' . $page;
731
-		elseif ( is_author() )
732
-			$classes[] = 'author-paged-' . $page;
733
-		elseif ( is_search() )
734
-			$classes[] = 'search-paged-' . $page;
735
-		elseif ( is_post_type_archive() )
736
-			$classes[] = 'post-type-paged-' . $page;
749
+		if ( is_single() ) {
750
+					$classes[] = 'single-paged-' . $page;
751
+		} elseif ( is_page() ) {
752
+					$classes[] = 'page-paged-' . $page;
753
+		} elseif ( is_category() ) {
754
+					$classes[] = 'category-paged-' . $page;
755
+		} elseif ( is_tag() ) {
756
+					$classes[] = 'tag-paged-' . $page;
757
+		} elseif ( is_date() ) {
758
+					$classes[] = 'date-paged-' . $page;
759
+		} elseif ( is_author() ) {
760
+					$classes[] = 'author-paged-' . $page;
761
+		} elseif ( is_search() ) {
762
+					$classes[] = 'search-paged-' . $page;
763
+		} elseif ( is_post_type_archive() ) {
764
+					$classes[] = 'post-type-paged-' . $page;
765
+		}
737 766
 	}
738 767
 
739 768
 	if ( ! empty( $class ) ) {
740
-		if ( !is_array( $class ) )
741
-			$class = preg_split( '#\s+#', $class );
769
+		if ( !is_array( $class ) ) {
770
+					$class = preg_split( '#\s+#', $class );
771
+		}
742 772
 		$classes = array_merge( $classes, $class );
743 773
 	} else {
744 774
 		// Ensure that we always coerce class to being an array.
@@ -771,18 +801,21 @@  discard block
 block discarded – undo
771 801
 function post_password_required( $post = null ) {
772 802
 	$post = get_post($post);
773 803
 
774
-	if ( empty( $post->post_password ) )
775
-		return false;
804
+	if ( empty( $post->post_password ) ) {
805
+			return false;
806
+	}
776 807
 
777
-	if ( ! isset( $_COOKIE['wp-postpass_' . COOKIEHASH] ) )
778
-		return true;
808
+	if ( ! isset( $_COOKIE['wp-postpass_' . COOKIEHASH] ) ) {
809
+			return true;
810
+	}
779 811
 
780 812
 	require_once ABSPATH . WPINC . '/class-phpass.php';
781 813
 	$hasher = new PasswordHash( 8, true );
782 814
 
783 815
 	$hash = wp_unslash( $_COOKIE[ 'wp-postpass_' . COOKIEHASH ] );
784
-	if ( 0 !== strpos( $hash, '$P$B' ) )
785
-		return true;
816
+	if ( 0 !== strpos( $hash, '$P$B' ) ) {
817
+			return true;
818
+	}
786 819
 
787 820
 	return ! $hasher->CheckPassword( $post->post_password, $hash );
788 821
 }
@@ -934,12 +967,13 @@  discard block
 block discarded – undo
934 967
 	if ( 1 == $i ) {
935 968
 		$url = get_permalink();
936 969
 	} else {
937
-		if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) )
938
-			$url = add_query_arg( 'page', $i, get_permalink() );
939
-		elseif ( 'page' == get_option('show_on_front') && get_option('page_on_front') == $post->ID )
940
-			$url = trailingslashit(get_permalink()) . user_trailingslashit("$wp_rewrite->pagination_base/" . $i, 'single_paged');
941
-		else
942
-			$url = trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged');
970
+		if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) ) {
971
+					$url = add_query_arg( 'page', $i, get_permalink() );
972
+		} elseif ( 'page' == get_option('show_on_front') && get_option('page_on_front') == $post->ID ) {
973
+					$url = trailingslashit(get_permalink()) . user_trailingslashit("$wp_rewrite->pagination_base/" . $i, 'single_paged');
974
+		} else {
975
+					$url = trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged');
976
+		}
943 977
 	}
944 978
 
945 979
 	if ( is_preview() ) {
@@ -970,13 +1004,14 @@  discard block
 block discarded – undo
970 1004
 function post_custom( $key = '' ) {
971 1005
 	$custom = get_post_custom();
972 1006
 
973
-	if ( !isset( $custom[$key] ) )
974
-		return false;
975
-	elseif ( 1 == count($custom[$key]) )
976
-		return $custom[$key][0];
977
-	else
978
-		return $custom[$key];
979
-}
1007
+	if ( !isset( $custom[$key] ) ) {
1008
+			return false;
1009
+	} elseif ( 1 == count($custom[$key]) ) {
1010
+			return $custom[$key][0];
1011
+	} else {
1012
+			return $custom[$key];
1013
+	}
1014
+	}
980 1015
 
981 1016
 /**
982 1017
  * Display list of post custom fields.
@@ -991,8 +1026,9 @@  discard block
 block discarded – undo
991 1026
 		echo "<ul class='post-meta'>\n";
992 1027
 		foreach ( (array) $keys as $key ) {
993 1028
 			$keyt = trim($key);
994
-			if ( is_protected_meta( $keyt, 'post' ) )
995
-				continue;
1029
+			if ( is_protected_meta( $keyt, 'post' ) ) {
1030
+							continue;
1031
+			}
996 1032
 			$values = array_map('trim', get_post_custom_values($key));
997 1033
 			$value = implode($values,', ');
998 1034
 
@@ -1273,13 +1309,15 @@  discard block
 block discarded – undo
1273 1309
 
1274 1310
 	// Show Home in the menu
1275 1311
 	if ( ! empty($args['show_home']) ) {
1276
-		if ( true === $args['show_home'] || '1' === $args['show_home'] || 1 === $args['show_home'] )
1277
-			$text = __('Home');
1278
-		else
1279
-			$text = $args['show_home'];
1312
+		if ( true === $args['show_home'] || '1' === $args['show_home'] || 1 === $args['show_home'] ) {
1313
+					$text = __('Home');
1314
+		} else {
1315
+					$text = $args['show_home'];
1316
+		}
1280 1317
 		$class = '';
1281
-		if ( is_front_page() && !is_paged() )
1282
-			$class = 'class="current_page_item"';
1318
+		if ( is_front_page() && !is_paged() ) {
1319
+					$class = 'class="current_page_item"';
1320
+		}
1283 1321
 		$menu .= '<li ' . $class . '><a href="' . home_url( '/' ) . '">' . $args['link_before'] . $text . $args['link_after'] . '</a></li>';
1284 1322
 		// If the front page is a page, add it to the exclude list
1285 1323
 		if (get_option('show_on_front') == 'page') {
@@ -1338,11 +1376,12 @@  discard block
 block discarded – undo
1338 1376
 	 * @param array  $args An array of arguments.
1339 1377
 	 */
1340 1378
 	$menu = apply_filters( 'wp_page_menu', $menu, $args );
1341
-	if ( $args['echo'] )
1342
-		echo $menu;
1343
-	else
1344
-		return $menu;
1345
-}
1379
+	if ( $args['echo'] ) {
1380
+			echo $menu;
1381
+	} else {
1382
+			return $menu;
1383
+	}
1384
+	}
1346 1385
 
1347 1386
 //
1348 1387
 // Page helpers
@@ -1361,14 +1400,16 @@  discard block
 block discarded – undo
1361 1400
  * @return string
1362 1401
  */
1363 1402
 function walk_page_tree( $pages, $depth, $current_page, $r ) {
1364
-	if ( empty($r['walker']) )
1365
-		$walker = new Walker_Page;
1366
-	else
1367
-		$walker = $r['walker'];
1403
+	if ( empty($r['walker']) ) {
1404
+			$walker = new Walker_Page;
1405
+	} else {
1406
+			$walker = $r['walker'];
1407
+	}
1368 1408
 
1369 1409
 	foreach ( (array) $pages as $page ) {
1370
-		if ( $page->post_parent )
1371
-			$r['pages_with_children'][ $page->post_parent ] = true;
1410
+		if ( $page->post_parent ) {
1411
+					$r['pages_with_children'][ $page->post_parent ] = true;
1412
+		}
1372 1413
 	}
1373 1414
 
1374 1415
 	$args = array($pages, $depth, $r, $current_page);
@@ -1386,10 +1427,12 @@  discard block
 block discarded – undo
1386 1427
  */
1387 1428
 function walk_page_dropdown_tree() {
1388 1429
 	$args = func_get_args();
1389
-	if ( empty($args[2]['walker']) ) // the user's options are the third parameter
1430
+	if ( empty($args[2]['walker']) ) {
1431
+		// the user's options are the third parameter
1390 1432
 		$walker = new Walker_PageDropdown;
1391
-	else
1392
-		$walker = $args[2]['walker'];
1433
+	} else {
1434
+			$walker = $args[2]['walker'];
1435
+	}
1393 1436
 
1394 1437
 	return call_user_func_array(array($walker, 'walk'), $args);
1395 1438
 }
@@ -1409,14 +1452,16 @@  discard block
 block discarded – undo
1409 1452
  * @param bool        $permalink    Optional, default is false. Whether to include permalink.
1410 1453
  */
1411 1454
 function the_attachment_link( $id = 0, $fullsize = false, $deprecated = false, $permalink = false ) {
1412
-	if ( !empty( $deprecated ) )
1413
-		_deprecated_argument( __FUNCTION__, '2.5' );
1455
+	if ( !empty( $deprecated ) ) {
1456
+			_deprecated_argument( __FUNCTION__, '2.5' );
1457
+	}
1414 1458
 
1415
-	if ( $fullsize )
1416
-		echo wp_get_attachment_link($id, 'full', $permalink);
1417
-	else
1418
-		echo wp_get_attachment_link($id, 'thumbnail', $permalink);
1419
-}
1459
+	if ( $fullsize ) {
1460
+			echo wp_get_attachment_link($id, 'full', $permalink);
1461
+	} else {
1462
+			echo wp_get_attachment_link($id, 'thumbnail', $permalink);
1463
+	}
1464
+	}
1420 1465
 
1421 1466
 /**
1422 1467
  * Retrieve an attachment page link using an image or icon, if possible.
@@ -1438,11 +1483,13 @@  discard block
 block discarded – undo
1438 1483
 function wp_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false, $attr = '' ) {
1439 1484
 	$_post = get_post( $id );
1440 1485
 
1441
-	if ( empty( $_post ) || ( 'attachment' != $_post->post_type ) || ! $url = wp_get_attachment_url( $_post->ID ) )
1442
-		return __( 'Missing Attachment' );
1486
+	if ( empty( $_post ) || ( 'attachment' != $_post->post_type ) || ! $url = wp_get_attachment_url( $_post->ID ) ) {
1487
+			return __( 'Missing Attachment' );
1488
+	}
1443 1489
 
1444
-	if ( $permalink )
1445
-		$url = get_attachment_link( $_post->ID );
1490
+	if ( $permalink ) {
1491
+			$url = get_attachment_link( $_post->ID );
1492
+	}
1446 1493
 
1447 1494
 	if ( $text ) {
1448 1495
 		$link_text = $text;
@@ -1452,8 +1499,9 @@  discard block
 block discarded – undo
1452 1499
 		$link_text = '';
1453 1500
 	}
1454 1501
 
1455
-	if ( trim( $link_text ) == '' )
1456
-		$link_text = $_post->post_title;
1502
+	if ( trim( $link_text ) == '' ) {
1503
+			$link_text = $_post->post_title;
1504
+	}
1457 1505
 
1458 1506
 	/**
1459 1507
 	 * Filter a retrieved attachment page link.
@@ -1482,8 +1530,9 @@  discard block
 block discarded – undo
1482 1530
 function prepend_attachment($content) {
1483 1531
 	$post = get_post();
1484 1532
 
1485
-	if ( empty($post->post_type) || $post->post_type != 'attachment' )
1486
-		return $content;
1533
+	if ( empty($post->post_type) || $post->post_type != 'attachment' ) {
1534
+			return $content;
1535
+	}
1487 1536
 
1488 1537
 	if ( wp_attachment_is( 'video', $post ) ) {
1489 1538
 		$meta = wp_get_attachment_metadata( get_the_ID() );
@@ -1567,16 +1616,19 @@  discard block
 block discarded – undo
1567 1616
  * @return bool True on success, false on failure.
1568 1617
  */
1569 1618
 function is_page_template( $template = '' ) {
1570
-	if ( ! is_page() )
1571
-		return false;
1619
+	if ( ! is_page() ) {
1620
+			return false;
1621
+	}
1572 1622
 
1573 1623
 	$page_template = get_page_template_slug( get_queried_object_id() );
1574 1624
 
1575
-	if ( empty( $template ) )
1576
-		return (bool) $page_template;
1625
+	if ( empty( $template ) ) {
1626
+			return (bool) $page_template;
1627
+	}
1577 1628
 
1578
-	if ( $template == $page_template )
1579
-		return true;
1629
+	if ( $template == $page_template ) {
1630
+			return true;
1631
+	}
1580 1632
 
1581 1633
 	if ( is_array( $template ) ) {
1582 1634
 		if ( ( in_array( 'default', $template, true ) && ! $page_template )
@@ -1600,11 +1652,13 @@  discard block
 block discarded – undo
1600 1652
  */
1601 1653
 function get_page_template_slug( $post_id = null ) {
1602 1654
 	$post = get_post( $post_id );
1603
-	if ( ! $post || 'page' != $post->post_type )
1604
-		return false;
1655
+	if ( ! $post || 'page' != $post->post_type ) {
1656
+			return false;
1657
+	}
1605 1658
 	$template = get_post_meta( $post->ID, '_wp_page_template', true );
1606
-	if ( ! $template || 'default' == $template )
1607
-		return '';
1659
+	if ( ! $template || 'default' == $template ) {
1660
+			return '';
1661
+	}
1608 1662
 	return $template;
1609 1663
 }
1610 1664
 
@@ -1618,11 +1672,13 @@  discard block
 block discarded – undo
1618 1672
  * @return string|false i18n formatted datetimestamp or localized 'Current Revision'.
1619 1673
  */
1620 1674
 function wp_post_revision_title( $revision, $link = true ) {
1621
-	if ( !$revision = get_post( $revision ) )
1622
-		return $revision;
1675
+	if ( !$revision = get_post( $revision ) ) {
1676
+			return $revision;
1677
+	}
1623 1678
 
1624
-	if ( !in_array( $revision->post_type, array( 'post', 'page', 'revision' ) ) )
1625
-		return false;
1679
+	if ( !in_array( $revision->post_type, array( 'post', 'page', 'revision' ) ) ) {
1680
+			return false;
1681
+	}
1626 1682
 
1627 1683
 	/* translators: revision date format, see http://php.net/date */
1628 1684
 	$datef = _x( 'F j, Y @ H:i:s', 'revision date format' );
@@ -1632,13 +1688,15 @@  discard block
 block discarded – undo
1632 1688
 	$currentf  = _x( '%1$s [Current Revision]', 'post revision title extra' );
1633 1689
 
1634 1690
 	$date = date_i18n( $datef, strtotime( $revision->post_modified ) );
1635
-	if ( $link && current_user_can( 'edit_post', $revision->ID ) && $link = get_edit_post_link( $revision->ID ) )
1636
-		$date = "<a href='$link'>$date</a>";
1691
+	if ( $link && current_user_can( 'edit_post', $revision->ID ) && $link = get_edit_post_link( $revision->ID ) ) {
1692
+			$date = "<a href='$link'>$date</a>";
1693
+	}
1637 1694
 
1638
-	if ( !wp_is_post_revision( $revision ) )
1639
-		$date = sprintf( $currentf, $date );
1640
-	elseif ( wp_is_post_autosave( $revision ) )
1641
-		$date = sprintf( $autosavef, $date );
1695
+	if ( !wp_is_post_revision( $revision ) ) {
1696
+			$date = sprintf( $currentf, $date );
1697
+	} elseif ( wp_is_post_autosave( $revision ) ) {
1698
+			$date = sprintf( $autosavef, $date );
1699
+	}
1642 1700
 
1643 1701
 	return $date;
1644 1702
 }
@@ -1653,11 +1711,13 @@  discard block
 block discarded – undo
1653 1711
  * @return string|false gravatar, user, i18n formatted datetimestamp or localized 'Current Revision'.
1654 1712
  */
1655 1713
 function wp_post_revision_title_expanded( $revision, $link = true ) {
1656
-	if ( !$revision = get_post( $revision ) )
1657
-		return $revision;
1714
+	if ( !$revision = get_post( $revision ) ) {
1715
+			return $revision;
1716
+	}
1658 1717
 
1659
-	if ( !in_array( $revision->post_type, array( 'post', 'page', 'revision' ) ) )
1660
-		return false;
1718
+	if ( !in_array( $revision->post_type, array( 'post', 'page', 'revision' ) ) ) {
1719
+			return false;
1720
+	}
1661 1721
 
1662 1722
 	$author = get_the_author_meta( 'display_name', $revision->post_author );
1663 1723
 	/* translators: revision date format, see http://php.net/date */
@@ -1666,8 +1726,9 @@  discard block
 block discarded – undo
1666 1726
 	$gravatar = get_avatar( $revision->post_author, 24 );
1667 1727
 
1668 1728
 	$date = date_i18n( $datef, strtotime( $revision->post_modified ) );
1669
-	if ( $link && current_user_can( 'edit_post', $revision->ID ) && $link = get_edit_post_link( $revision->ID ) )
1670
-		$date = "<a href='$link'>$date</a>";
1729
+	if ( $link && current_user_can( 'edit_post', $revision->ID ) && $link = get_edit_post_link( $revision->ID ) ) {
1730
+			$date = "<a href='$link'>$date</a>";
1731
+	}
1671 1732
 
1672 1733
 	$revision_date_author = sprintf(
1673 1734
 		/* translators: post revision title: 1: author avatar, 2: author name, 3: time ago, 4: date */
@@ -1681,10 +1742,11 @@  discard block
 block discarded – undo
1681 1742
 	$autosavef = __( '%1$s [Autosave]' );
1682 1743
 	$currentf  = __( '%1$s [Current Revision]' );
1683 1744
 
1684
-	if ( !wp_is_post_revision( $revision ) )
1685
-		$revision_date_author = sprintf( $currentf, $revision_date_author );
1686
-	elseif ( wp_is_post_autosave( $revision ) )
1687
-		$revision_date_author = sprintf( $autosavef, $revision_date_author );
1745
+	if ( !wp_is_post_revision( $revision ) ) {
1746
+			$revision_date_author = sprintf( $currentf, $revision_date_author );
1747
+	} elseif ( wp_is_post_autosave( $revision ) ) {
1748
+			$revision_date_author = sprintf( $autosavef, $revision_date_author );
1749
+	}
1688 1750
 
1689 1751
 	/**
1690 1752
 	 * Filter the formatted author and date for a revision.
@@ -1711,8 +1773,9 @@  discard block
 block discarded – undo
1711 1773
  * @param string      $type    'all' (default), 'revision' or 'autosave'
1712 1774
  */
1713 1775
 function wp_list_post_revisions( $post_id = 0, $type = 'all' ) {
1714
-	if ( ! $post = get_post( $post_id ) )
1715
-		return;
1776
+	if ( ! $post = get_post( $post_id ) ) {
1777
+			return;
1778
+	}
1716 1779
 
1717 1780
 	// $args array with (parent, format, right, left, type) deprecated since 3.6
1718 1781
 	if ( is_array( $type ) ) {
@@ -1720,17 +1783,20 @@  discard block
 block discarded – undo
1720 1783
 		_deprecated_argument( __FUNCTION__, '3.6' );
1721 1784
 	}
1722 1785
 
1723
-	if ( ! $revisions = wp_get_post_revisions( $post->ID ) )
1724
-		return;
1786
+	if ( ! $revisions = wp_get_post_revisions( $post->ID ) ) {
1787
+			return;
1788
+	}
1725 1789
 
1726 1790
 	$rows = '';
1727 1791
 	foreach ( $revisions as $revision ) {
1728
-		if ( ! current_user_can( 'read_post', $revision->ID ) )
1729
-			continue;
1792
+		if ( ! current_user_can( 'read_post', $revision->ID ) ) {
1793
+					continue;
1794
+		}
1730 1795
 
1731 1796
 		$is_autosave = wp_is_post_autosave( $revision );
1732
-		if ( ( 'revision' === $type && $is_autosave ) || ( 'autosave' === $type && ! $is_autosave ) )
1733
-			continue;
1797
+		if ( ( 'revision' === $type && $is_autosave ) || ( 'autosave' === $type && ! $is_autosave ) ) {
1798
+					continue;
1799
+		}
1734 1800
 
1735 1801
 		$rows .= "\t<li>" . wp_post_revision_title_expanded( $revision ) . "</li>\n";
1736 1802
 	}
Please login to merge, or discard this patch.
src/wp-includes/query.php 4 patches
Doc Comments   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
  * @global WP_Query $wp_query Global WP_Query instance.
21 21
  *
22 22
  * @param string $var       The variable key to retrieve.
23
- * @param mixed  $default   Optional. Value to return if the query variable is not set. Default empty.
23
+ * @param boolean  $default   Optional. Value to return if the query variable is not set. Default empty.
24 24
  * @return mixed Contents of the query variable.
25 25
  */
26 26
 function get_query_var( $var, $default = '' ) {
@@ -281,8 +281,8 @@  discard block
 block discarded – undo
281 281
  *
282 282
  * @global WP_Query $wp_query Global WP_Query instance.
283 283
  *
284
- * @param string|array     $taxonomy Optional. Taxonomy slug or slugs.
285
- * @param int|string|array $term     Optional. Term ID, name, slug or array of Term IDs, names, and slugs.
284
+ * @param string     $taxonomy Optional. Taxonomy slug or slugs.
285
+ * @param string $term     Optional. Term ID, name, slug or array of Term IDs, names, and slugs.
286 286
  * @return bool
287 287
  */
288 288
 function is_tax( $taxonomy = '', $term = '' ) {
@@ -2178,7 +2178,7 @@  discard block
 block discarded – undo
2178 2178
 	 *
2179 2179
 	 * @since 3.7.0
2180 2180
 	 *
2181
-	 * @param array $terms Terms to check.
2181
+	 * @param string[] $terms Terms to check.
2182 2182
 	 * @return array Terms that are not stopwords.
2183 2183
 	 */
2184 2184
 	protected function parse_search_terms( $terms ) {
@@ -4140,7 +4140,7 @@  discard block
 block discarded – undo
4140 4140
 	 * @access public
4141 4141
 	 *
4142 4142
 	 * @param string $name Property to check if set.
4143
-	 * @return bool Whether the property is set.
4143
+	 * @return boolean|null Whether the property is set.
4144 4144
 	 */
4145 4145
 	public function __isset( $name ) {
4146 4146
 		if ( in_array( $name, $this->compat_fields ) ) {
@@ -4739,8 +4739,8 @@  discard block
 block discarded – undo
4739 4739
 	 * @global int             $more
4740 4740
 	 * @global int             $numpages
4741 4741
 	 *
4742
-	 * @param WP_Post|object|int $post WP_Post instance or Post ID/object.
4743
-	 * @return true True when finished.
4742
+	 * @param WP_Post $post WP_Post instance or Post ID/object.
4743
+	 * @return null|boolean True when finished.
4744 4744
 	 */
4745 4745
 	public function setup_postdata( $post ) {
4746 4746
 		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.
@@ -4166,14 +4166,14 @@  discard block
 block discarded – undo
4166 4166
 	}
4167 4167
 
4168 4168
 	/**
4169
- 	 * Is the query for an existing archive page?
4170
- 	 *
4171
- 	 * Month, Year, Category, Author, Post Type archive...
4172
-	 *
4173
- 	 * @since 3.1.0
4174
- 	 *
4175
- 	 * @return bool
4176
- 	 */
4169
+	 * Is the query for an existing archive page?
4170
+	 *
4171
+	 * Month, Year, Category, Author, Post Type archive...
4172
+	 *
4173
+	 * @since 3.1.0
4174
+	 *
4175
+	 * @return bool
4176
+	 */
4177 4177
 	public function is_archive() {
4178 4178
 		return (bool) $this->is_archive;
4179 4179
 	}
Please login to merge, or discard this patch.
Spacing   +916 added lines, -916 removed lines patch added patch discarded remove patch
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
  * @param mixed  $default   Optional. Value to return if the query variable is not set. Default empty.
24 24
  * @return mixed Contents of the query variable.
25 25
  */
26
-function get_query_var( $var, $default = '' ) {
26
+function get_query_var($var, $default = '') {
27 27
 	global $wp_query;
28
-	return $wp_query->get( $var, $default );
28
+	return $wp_query->get($var, $default);
29 29
 }
30 30
 
31 31
 /**
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
  * @param string $var   Query variable key.
72 72
  * @param mixed  $value Query variable value.
73 73
  */
74
-function set_query_var( $var, $value ) {
74
+function set_query_var($var, $value) {
75 75
 	global $wp_query;
76
-	$wp_query->set( $var, $value );
76
+	$wp_query->set($var, $value);
77 77
 }
78 78
 
79 79
 /**
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 function wp_reset_postdata() {
123 123
 	global $wp_query;
124 124
 
125
-	if ( isset( $wp_query ) ) {
125
+	if (isset($wp_query)) {
126 126
 		$wp_query->reset_postdata();
127 127
 	}
128 128
 }
@@ -145,8 +145,8 @@  discard block
 block discarded – undo
145 145
 function is_archive() {
146 146
 	global $wp_query;
147 147
 
148
-	if ( ! isset( $wp_query ) ) {
149
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
148
+	if ( ! isset($wp_query)) {
149
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
150 150
 		return false;
151 151
 	}
152 152
 
@@ -163,15 +163,15 @@  discard block
 block discarded – undo
163 163
  * @param string|array $post_types Optional. Post type or array of posts types to check against.
164 164
  * @return bool
165 165
  */
166
-function is_post_type_archive( $post_types = '' ) {
166
+function is_post_type_archive($post_types = '') {
167 167
 	global $wp_query;
168 168
 
169
-	if ( ! isset( $wp_query ) ) {
170
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
169
+	if ( ! isset($wp_query)) {
170
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
171 171
 		return false;
172 172
 	}
173 173
 
174
-	return $wp_query->is_post_type_archive( $post_types );
174
+	return $wp_query->is_post_type_archive($post_types);
175 175
 }
176 176
 
177 177
 /**
@@ -184,15 +184,15 @@  discard block
 block discarded – undo
184 184
  * @param int|string|array|object $attachment Attachment ID, title, slug, or array of such.
185 185
  * @return bool
186 186
  */
187
-function is_attachment( $attachment = '' ) {
187
+function is_attachment($attachment = '') {
188 188
 	global $wp_query;
189 189
 
190
-	if ( ! isset( $wp_query ) ) {
191
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
190
+	if ( ! isset($wp_query)) {
191
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
192 192
 		return false;
193 193
 	}
194 194
 
195
-	return $wp_query->is_attachment( $attachment );
195
+	return $wp_query->is_attachment($attachment);
196 196
 }
197 197
 
198 198
 /**
@@ -208,15 +208,15 @@  discard block
 block discarded – undo
208 208
  * @param mixed $author Optional. User ID, nickname, nicename, or array of User IDs, nicknames, and nicenames
209 209
  * @return bool
210 210
  */
211
-function is_author( $author = '' ) {
211
+function is_author($author = '') {
212 212
 	global $wp_query;
213 213
 
214
-	if ( ! isset( $wp_query ) ) {
215
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
214
+	if ( ! isset($wp_query)) {
215
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
216 216
 		return false;
217 217
 	}
218 218
 
219
-	return $wp_query->is_author( $author );
219
+	return $wp_query->is_author($author);
220 220
 }
221 221
 
222 222
 /**
@@ -232,15 +232,15 @@  discard block
 block discarded – undo
232 232
  * @param mixed $category Optional. Category ID, name, slug, or array of Category IDs, names, and slugs.
233 233
  * @return bool
234 234
  */
235
-function is_category( $category = '' ) {
235
+function is_category($category = '') {
236 236
 	global $wp_query;
237 237
 
238
-	if ( ! isset( $wp_query ) ) {
239
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
238
+	if ( ! isset($wp_query)) {
239
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
240 240
 		return false;
241 241
 	}
242 242
 
243
-	return $wp_query->is_category( $category );
243
+	return $wp_query->is_category($category);
244 244
 }
245 245
 
246 246
 /**
@@ -256,15 +256,15 @@  discard block
 block discarded – undo
256 256
  * @param mixed $tag Optional. Tag ID, name, slug, or array of Tag IDs, names, and slugs.
257 257
  * @return bool
258 258
  */
259
-function is_tag( $tag = '' ) {
259
+function is_tag($tag = '') {
260 260
 	global $wp_query;
261 261
 
262
-	if ( ! isset( $wp_query ) ) {
263
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
262
+	if ( ! isset($wp_query)) {
263
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
264 264
 		return false;
265 265
 	}
266 266
 
267
-	return $wp_query->is_tag( $tag );
267
+	return $wp_query->is_tag($tag);
268 268
 }
269 269
 
270 270
 /**
@@ -285,15 +285,15 @@  discard block
 block discarded – undo
285 285
  * @param int|string|array $term     Optional. Term ID, name, slug or array of Term IDs, names, and slugs.
286 286
  * @return bool
287 287
  */
288
-function is_tax( $taxonomy = '', $term = '' ) {
288
+function is_tax($taxonomy = '', $term = '') {
289 289
 	global $wp_query;
290 290
 
291
-	if ( ! isset( $wp_query ) ) {
292
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
291
+	if ( ! isset($wp_query)) {
292
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
293 293
 		return false;
294 294
 	}
295 295
 
296
-	return $wp_query->is_tax( $taxonomy, $term );
296
+	return $wp_query->is_tax($taxonomy, $term);
297 297
 }
298 298
 
299 299
 /**
@@ -308,8 +308,8 @@  discard block
 block discarded – undo
308 308
 function is_date() {
309 309
 	global $wp_query;
310 310
 
311
-	if ( ! isset( $wp_query ) ) {
312
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
311
+	if ( ! isset($wp_query)) {
312
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
313 313
 		return false;
314 314
 	}
315 315
 
@@ -328,8 +328,8 @@  discard block
 block discarded – undo
328 328
 function is_day() {
329 329
 	global $wp_query;
330 330
 
331
-	if ( ! isset( $wp_query ) ) {
332
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
331
+	if ( ! isset($wp_query)) {
332
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
333 333
 		return false;
334 334
 	}
335 335
 
@@ -346,15 +346,15 @@  discard block
 block discarded – undo
346 346
  * @param string|array $feeds Optional feed types to check.
347 347
  * @return bool
348 348
  */
349
-function is_feed( $feeds = '' ) {
349
+function is_feed($feeds = '') {
350 350
 	global $wp_query;
351 351
 
352
-	if ( ! isset( $wp_query ) ) {
353
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
352
+	if ( ! isset($wp_query)) {
353
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
354 354
 		return false;
355 355
 	}
356 356
 
357
-	return $wp_query->is_feed( $feeds );
357
+	return $wp_query->is_feed($feeds);
358 358
 }
359 359
 
360 360
 /**
@@ -369,8 +369,8 @@  discard block
 block discarded – undo
369 369
 function is_comment_feed() {
370 370
 	global $wp_query;
371 371
 
372
-	if ( ! isset( $wp_query ) ) {
373
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
372
+	if ( ! isset($wp_query)) {
373
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
374 374
 		return false;
375 375
 	}
376 376
 
@@ -398,8 +398,8 @@  discard block
 block discarded – undo
398 398
 function is_front_page() {
399 399
 	global $wp_query;
400 400
 
401
-	if ( ! isset( $wp_query ) ) {
402
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
401
+	if ( ! isset($wp_query)) {
402
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
403 403
 		return false;
404 404
 	}
405 405
 
@@ -427,8 +427,8 @@  discard block
 block discarded – undo
427 427
 function is_home() {
428 428
 	global $wp_query;
429 429
 
430
-	if ( ! isset( $wp_query ) ) {
431
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
430
+	if ( ! isset($wp_query)) {
431
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
432 432
 		return false;
433 433
 	}
434 434
 
@@ -447,8 +447,8 @@  discard block
 block discarded – undo
447 447
 function is_month() {
448 448
 	global $wp_query;
449 449
 
450
-	if ( ! isset( $wp_query ) ) {
451
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
450
+	if ( ! isset($wp_query)) {
451
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
452 452
 		return false;
453 453
 	}
454 454
 
@@ -471,15 +471,15 @@  discard block
 block discarded – undo
471 471
  * @param int|string|array $page Optional. Page ID, title, slug, or array of such. Default empty.
472 472
  * @return bool Whether the query is for an existing single page.
473 473
  */
474
-function is_page( $page = '' ) {
474
+function is_page($page = '') {
475 475
 	global $wp_query;
476 476
 
477
-	if ( ! isset( $wp_query ) ) {
478
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
477
+	if ( ! isset($wp_query)) {
478
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
479 479
 		return false;
480 480
 	}
481 481
 
482
-	return $wp_query->is_page( $page );
482
+	return $wp_query->is_page($page);
483 483
 }
484 484
 
485 485
 /**
@@ -494,8 +494,8 @@  discard block
 block discarded – undo
494 494
 function is_paged() {
495 495
 	global $wp_query;
496 496
 
497
-	if ( ! isset( $wp_query ) ) {
498
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
497
+	if ( ! isset($wp_query)) {
498
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
499 499
 		return false;
500 500
 	}
501 501
 
@@ -514,8 +514,8 @@  discard block
 block discarded – undo
514 514
 function is_preview() {
515 515
 	global $wp_query;
516 516
 
517
-	if ( ! isset( $wp_query ) ) {
518
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
517
+	if ( ! isset($wp_query)) {
518
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
519 519
 		return false;
520 520
 	}
521 521
 
@@ -534,8 +534,8 @@  discard block
 block discarded – undo
534 534
 function is_robots() {
535 535
 	global $wp_query;
536 536
 
537
-	if ( ! isset( $wp_query ) ) {
538
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
537
+	if ( ! isset($wp_query)) {
538
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
539 539
 		return false;
540 540
 	}
541 541
 
@@ -554,8 +554,8 @@  discard block
 block discarded – undo
554 554
 function is_search() {
555 555
 	global $wp_query;
556 556
 
557
-	if ( ! isset( $wp_query ) ) {
558
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
557
+	if ( ! isset($wp_query)) {
558
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
559 559
 		return false;
560 560
 	}
561 561
 
@@ -580,15 +580,15 @@  discard block
 block discarded – undo
580 580
  * @param int|string|array $post Optional. Post ID, title, slug, or array of such. Default empty.
581 581
  * @return bool Whether the query is for an existing single post.
582 582
  */
583
-function is_single( $post = '' ) {
583
+function is_single($post = '') {
584 584
 	global $wp_query;
585 585
 
586
-	if ( ! isset( $wp_query ) ) {
587
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
586
+	if ( ! isset($wp_query)) {
587
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
588 588
 		return false;
589 589
 	}
590 590
 
591
-	return $wp_query->is_single( $post );
591
+	return $wp_query->is_single($post);
592 592
 }
593 593
 
594 594
 /**
@@ -607,15 +607,15 @@  discard block
 block discarded – undo
607 607
  * @param string|array $post_types Optional. Post type or array of post types. Default empty.
608 608
  * @return bool Whether the query is for an existing single post of any of the given post types.
609 609
  */
610
-function is_singular( $post_types = '' ) {
610
+function is_singular($post_types = '') {
611 611
 	global $wp_query;
612 612
 
613
-	if ( ! isset( $wp_query ) ) {
614
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
613
+	if ( ! isset($wp_query)) {
614
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
615 615
 		return false;
616 616
 	}
617 617
 
618
-	return $wp_query->is_singular( $post_types );
618
+	return $wp_query->is_singular($post_types);
619 619
 }
620 620
 
621 621
 /**
@@ -630,8 +630,8 @@  discard block
 block discarded – undo
630 630
 function is_time() {
631 631
 	global $wp_query;
632 632
 
633
-	if ( ! isset( $wp_query ) ) {
634
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
633
+	if ( ! isset($wp_query)) {
634
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
635 635
 		return false;
636 636
 	}
637 637
 
@@ -650,8 +650,8 @@  discard block
 block discarded – undo
650 650
 function is_trackback() {
651 651
 	global $wp_query;
652 652
 
653
-	if ( ! isset( $wp_query ) ) {
654
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
653
+	if ( ! isset($wp_query)) {
654
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
655 655
 		return false;
656 656
 	}
657 657
 
@@ -670,8 +670,8 @@  discard block
 block discarded – undo
670 670
 function is_year() {
671 671
 	global $wp_query;
672 672
 
673
-	if ( ! isset( $wp_query ) ) {
674
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
673
+	if ( ! isset($wp_query)) {
674
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
675 675
 		return false;
676 676
 	}
677 677
 
@@ -690,8 +690,8 @@  discard block
 block discarded – undo
690 690
 function is_404() {
691 691
 	global $wp_query;
692 692
 
693
-	if ( ! isset( $wp_query ) ) {
694
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
693
+	if ( ! isset($wp_query)) {
694
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
695 695
 		return false;
696 696
 	}
697 697
 
@@ -710,8 +710,8 @@  discard block
 block discarded – undo
710 710
 function is_embed() {
711 711
 	global $wp_query;
712 712
 
713
-	if ( ! isset( $wp_query ) ) {
714
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
713
+	if ( ! isset($wp_query)) {
714
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
715 715
 		return false;
716 716
 	}
717 717
 
@@ -728,16 +728,16 @@  discard block
 block discarded – undo
728 728
  * @return bool
729 729
  */
730 730
 function is_main_query() {
731
-	if ( 'pre_get_posts' === current_filter() ) {
731
+	if ('pre_get_posts' === current_filter()) {
732 732
 		$message = sprintf(
733 733
 			/* translators: 1: pre_get_posts 2: WP_Query->is_main_query() 3: is_main_query() 4: link to codex is_main_query() page. */
734
-			__( 'In %1$s, use the %2$s method, not the %3$s function. See %4$s.' ),
734
+			__('In %1$s, use the %2$s method, not the %3$s function. See %4$s.'),
735 735
 			'<code>pre_get_posts</code>',
736 736
 			'<code>WP_Query->is_main_query()</code>',
737 737
 			'<code>is_main_query()</code>',
738
-			__( 'https://codex.wordpress.org/Function_Reference/is_main_query' )
738
+			__('https://codex.wordpress.org/Function_Reference/is_main_query')
739 739
 		);
740
-		_doing_it_wrong( __FUNCTION__, $message, '3.7' );
740
+		_doing_it_wrong(__FUNCTION__, $message, '3.7');
741 741
 	}
742 742
 
743 743
 	global $wp_query;
@@ -1311,9 +1311,9 @@  discard block
 block discarded – undo
1311 1311
 	 */
1312 1312
 	private $stopwords;
1313 1313
 
1314
-	private $compat_fields = array( 'query_vars_hash', 'query_vars_changed' );
1314
+	private $compat_fields = array('query_vars_hash', 'query_vars_changed');
1315 1315
 
1316
-	private $compat_methods = array( 'init_query_flags', 'parse_tax_query' );
1316
+	private $compat_methods = array('init_query_flags', 'parse_tax_query');
1317 1317
 
1318 1318
 	/**
1319 1319
 	 * Resets query flags to false.
@@ -1367,10 +1367,10 @@  discard block
 block discarded – undo
1367 1367
 		$this->post_count = 0;
1368 1368
 		$this->current_post = -1;
1369 1369
 		$this->in_the_loop = false;
1370
-		unset( $this->request );
1371
-		unset( $this->post );
1372
-		unset( $this->comments );
1373
-		unset( $this->comment );
1370
+		unset($this->request);
1371
+		unset($this->post);
1372
+		unset($this->comments);
1373
+		unset($this->comment);
1374 1374
 		$this->comment_count = 0;
1375 1375
 		$this->current_comment = -1;
1376 1376
 		$this->found_posts = 0;
@@ -1441,17 +1441,17 @@  discard block
 block discarded – undo
1441 1441
 			, 'embed'
1442 1442
 		);
1443 1443
 
1444
-		foreach ( $keys as $key ) {
1445
-			if ( !isset($array[$key]) )
1444
+		foreach ($keys as $key) {
1445
+			if ( ! isset($array[$key]))
1446 1446
 				$array[$key] = '';
1447 1447
 		}
1448 1448
 
1449
-		$array_keys = array( 'category__in', 'category__not_in', 'category__and', 'post__in', 'post__not_in', 'post_name__in',
1449
+		$array_keys = array('category__in', 'category__not_in', 'category__and', 'post__in', 'post__not_in', 'post_name__in',
1450 1450
 			'tag__in', 'tag__not_in', 'tag__and', 'tag_slug__in', 'tag_slug__and', 'post_parent__in', 'post_parent__not_in',
1451
-			'author__in', 'author__not_in' );
1451
+			'author__in', 'author__not_in');
1452 1452
 
1453
-		foreach ( $array_keys as $key ) {
1454
-			if ( !isset($array[$key]) )
1453
+		foreach ($array_keys as $key) {
1454
+			if ( ! isset($array[$key]))
1455 1455
 				$array[$key] = array();
1456 1456
 		}
1457 1457
 		return $array;
@@ -1570,11 +1570,11 @@  discard block
 block discarded – undo
1570 1570
 	 *     @type int          $year                    The four-digit year. Default empty. Accepts any four-digit year.
1571 1571
 	 * }
1572 1572
 	 */
1573
-	public function parse_query( $query =  '' ) {
1574
-		if ( ! empty( $query ) ) {
1573
+	public function parse_query($query = '') {
1574
+		if ( ! empty($query)) {
1575 1575
 			$this->init();
1576
-			$this->query = $this->query_vars = wp_parse_args( $query );
1577
-		} elseif ( ! isset( $this->query ) ) {
1576
+			$this->query = $this->query_vars = wp_parse_args($query);
1577
+		} elseif ( ! isset($this->query)) {
1578 1578
 			$this->query = $this->query_vars;
1579 1579
 		}
1580 1580
 
@@ -1582,80 +1582,80 @@  discard block
 block discarded – undo
1582 1582
 		$qv = &$this->query_vars;
1583 1583
 		$this->query_vars_changed = true;
1584 1584
 
1585
-		if ( ! empty($qv['robots']) )
1585
+		if ( ! empty($qv['robots']))
1586 1586
 			$this->is_robots = true;
1587 1587
 
1588
-		$qv['p'] =  absint($qv['p']);
1589
-		$qv['page_id'] =  absint($qv['page_id']);
1588
+		$qv['p'] = absint($qv['p']);
1589
+		$qv['page_id'] = absint($qv['page_id']);
1590 1590
 		$qv['year'] = absint($qv['year']);
1591 1591
 		$qv['monthnum'] = absint($qv['monthnum']);
1592 1592
 		$qv['day'] = absint($qv['day']);
1593 1593
 		$qv['w'] = absint($qv['w']);
1594
-		$qv['m'] = preg_replace( '|[^0-9]|', '', $qv['m'] );
1594
+		$qv['m'] = preg_replace('|[^0-9]|', '', $qv['m']);
1595 1595
 		$qv['paged'] = absint($qv['paged']);
1596
-		$qv['cat'] = preg_replace( '|[^0-9,-]|', '', $qv['cat'] ); // comma separated list of positive or negative integers
1597
-		$qv['author'] = preg_replace( '|[^0-9,-]|', '', $qv['author'] ); // comma separated list of positive or negative integers
1598
-		$qv['pagename'] = trim( $qv['pagename'] );
1599
-		$qv['name'] = trim( $qv['name'] );
1600
-		$qv['title'] = trim( $qv['title'] );
1601
-		if ( '' !== $qv['hour'] ) $qv['hour'] = absint($qv['hour']);
1602
-		if ( '' !== $qv['minute'] ) $qv['minute'] = absint($qv['minute']);
1603
-		if ( '' !== $qv['second'] ) $qv['second'] = absint($qv['second']);
1604
-		if ( '' !== $qv['menu_order'] ) $qv['menu_order'] = absint($qv['menu_order']);
1596
+		$qv['cat'] = preg_replace('|[^0-9,-]|', '', $qv['cat']); // comma separated list of positive or negative integers
1597
+		$qv['author'] = preg_replace('|[^0-9,-]|', '', $qv['author']); // comma separated list of positive or negative integers
1598
+		$qv['pagename'] = trim($qv['pagename']);
1599
+		$qv['name'] = trim($qv['name']);
1600
+		$qv['title'] = trim($qv['title']);
1601
+		if ('' !== $qv['hour']) $qv['hour'] = absint($qv['hour']);
1602
+		if ('' !== $qv['minute']) $qv['minute'] = absint($qv['minute']);
1603
+		if ('' !== $qv['second']) $qv['second'] = absint($qv['second']);
1604
+		if ('' !== $qv['menu_order']) $qv['menu_order'] = absint($qv['menu_order']);
1605 1605
 
1606 1606
 		// Fairly insane upper bound for search string lengths.
1607
-		if ( ! is_scalar( $qv['s'] ) || ( ! empty( $qv['s'] ) && strlen( $qv['s'] ) > 1600 ) ) {
1607
+		if ( ! is_scalar($qv['s']) || ( ! empty($qv['s']) && strlen($qv['s']) > 1600)) {
1608 1608
 			$qv['s'] = '';
1609 1609
 		}
1610 1610
 
1611 1611
 		// Compat. Map subpost to attachment.
1612
-		if ( '' != $qv['subpost'] )
1612
+		if ('' != $qv['subpost'])
1613 1613
 			$qv['attachment'] = $qv['subpost'];
1614
-		if ( '' != $qv['subpost_id'] )
1614
+		if ('' != $qv['subpost_id'])
1615 1615
 			$qv['attachment_id'] = $qv['subpost_id'];
1616 1616
 
1617 1617
 		$qv['attachment_id'] = absint($qv['attachment_id']);
1618 1618
 
1619
-		if ( ('' != $qv['attachment']) || !empty($qv['attachment_id']) ) {
1619
+		if (('' != $qv['attachment']) || ! empty($qv['attachment_id'])) {
1620 1620
 			$this->is_single = true;
1621 1621
 			$this->is_attachment = true;
1622
-		} elseif ( '' != $qv['name'] ) {
1622
+		} elseif ('' != $qv['name']) {
1623 1623
 			$this->is_single = true;
1624
-		} elseif ( $qv['p'] ) {
1624
+		} elseif ($qv['p']) {
1625 1625
 			$this->is_single = true;
1626
-		} elseif ( ('' !== $qv['hour']) && ('' !== $qv['minute']) &&('' !== $qv['second']) && ('' != $qv['year']) && ('' != $qv['monthnum']) && ('' != $qv['day']) ) {
1626
+		} elseif (('' !== $qv['hour']) && ('' !== $qv['minute']) && ('' !== $qv['second']) && ('' != $qv['year']) && ('' != $qv['monthnum']) && ('' != $qv['day'])) {
1627 1627
 			// If year, month, day, hour, minute, and second are set, a single
1628 1628
 			// post is being queried.
1629 1629
 			$this->is_single = true;
1630
-		} elseif ( '' != $qv['static'] || '' != $qv['pagename'] || !empty($qv['page_id']) ) {
1630
+		} elseif ('' != $qv['static'] || '' != $qv['pagename'] || ! empty($qv['page_id'])) {
1631 1631
 			$this->is_page = true;
1632 1632
 			$this->is_single = false;
1633 1633
 		} else {
1634 1634
 			// Look for archive queries. Dates, categories, authors, search, post type archives.
1635 1635
 
1636
-			if ( isset( $this->query['s'] ) ) {
1636
+			if (isset($this->query['s'])) {
1637 1637
 				$this->is_search = true;
1638 1638
 			}
1639 1639
 
1640
-			if ( '' !== $qv['second'] ) {
1640
+			if ('' !== $qv['second']) {
1641 1641
 				$this->is_time = true;
1642 1642
 				$this->is_date = true;
1643 1643
 			}
1644 1644
 
1645
-			if ( '' !== $qv['minute'] ) {
1645
+			if ('' !== $qv['minute']) {
1646 1646
 				$this->is_time = true;
1647 1647
 				$this->is_date = true;
1648 1648
 			}
1649 1649
 
1650
-			if ( '' !== $qv['hour'] ) {
1650
+			if ('' !== $qv['hour']) {
1651 1651
 				$this->is_time = true;
1652 1652
 				$this->is_date = true;
1653 1653
 			}
1654 1654
 
1655
-			if ( $qv['day'] ) {
1656
-				if ( ! $this->is_date ) {
1657
-					$date = sprintf( '%04d-%02d-%02d', $qv['year'], $qv['monthnum'], $qv['day'] );
1658
-					if ( $qv['monthnum'] && $qv['year'] && ! wp_checkdate( $qv['monthnum'], $qv['day'], $qv['year'], $date ) ) {
1655
+			if ($qv['day']) {
1656
+				if ( ! $this->is_date) {
1657
+					$date = sprintf('%04d-%02d-%02d', $qv['year'], $qv['monthnum'], $qv['day']);
1658
+					if ($qv['monthnum'] && $qv['year'] && ! wp_checkdate($qv['monthnum'], $qv['day'], $qv['year'], $date)) {
1659 1659
 						$qv['error'] = '404';
1660 1660
 					} else {
1661 1661
 						$this->is_day = true;
@@ -1664,9 +1664,9 @@  discard block
 block discarded – undo
1664 1664
 				}
1665 1665
 			}
1666 1666
 
1667
-			if ( $qv['monthnum'] ) {
1668
-				if ( ! $this->is_date ) {
1669
-					if ( 12 < $qv['monthnum'] ) {
1667
+			if ($qv['monthnum']) {
1668
+				if ( ! $this->is_date) {
1669
+					if (12 < $qv['monthnum']) {
1670 1670
 						$qv['error'] = '404';
1671 1671
 					} else {
1672 1672
 						$this->is_month = true;
@@ -1675,40 +1675,40 @@  discard block
 block discarded – undo
1675 1675
 				}
1676 1676
 			}
1677 1677
 
1678
-			if ( $qv['year'] ) {
1679
-				if ( ! $this->is_date ) {
1678
+			if ($qv['year']) {
1679
+				if ( ! $this->is_date) {
1680 1680
 					$this->is_year = true;
1681 1681
 					$this->is_date = true;
1682 1682
 				}
1683 1683
 			}
1684 1684
 
1685
-			if ( $qv['m'] ) {
1685
+			if ($qv['m']) {
1686 1686
 				$this->is_date = true;
1687
-				if ( strlen($qv['m']) > 9 ) {
1687
+				if (strlen($qv['m']) > 9) {
1688 1688
 					$this->is_time = true;
1689
-				} elseif ( strlen( $qv['m'] ) > 7 ) {
1689
+				} elseif (strlen($qv['m']) > 7) {
1690 1690
 					$this->is_day = true;
1691
-				} elseif ( strlen( $qv['m'] ) > 5 ) {
1691
+				} elseif (strlen($qv['m']) > 5) {
1692 1692
 					$this->is_month = true;
1693 1693
 				} else {
1694 1694
 					$this->is_year = true;
1695 1695
 				}
1696 1696
 			}
1697 1697
 
1698
-			if ( '' != $qv['w'] ) {
1698
+			if ('' != $qv['w']) {
1699 1699
 				$this->is_date = true;
1700 1700
 			}
1701 1701
 
1702 1702
 			$this->query_vars_hash = false;
1703
-			$this->parse_tax_query( $qv );
1703
+			$this->parse_tax_query($qv);
1704 1704
 
1705
-			foreach ( $this->tax_query->queries as $tax_query ) {
1706
-				if ( ! is_array( $tax_query ) ) {
1705
+			foreach ($this->tax_query->queries as $tax_query) {
1706
+				if ( ! is_array($tax_query)) {
1707 1707
 					continue;
1708 1708
 				}
1709 1709
 
1710
-				if ( isset( $tax_query['operator'] ) && 'NOT IN' != $tax_query['operator'] ) {
1711
-					switch ( $tax_query['taxonomy'] ) {
1710
+				if (isset($tax_query['operator']) && 'NOT IN' != $tax_query['operator']) {
1711
+					switch ($tax_query['taxonomy']) {
1712 1712
 						case 'category':
1713 1713
 							$this->is_category = true;
1714 1714
 							break;
@@ -1720,89 +1720,89 @@  discard block
 block discarded – undo
1720 1720
 					}
1721 1721
 				}
1722 1722
 			}
1723
-			unset( $tax_query );
1723
+			unset($tax_query);
1724 1724
 
1725
-			if ( empty($qv['author']) || ($qv['author'] == '0') ) {
1725
+			if (empty($qv['author']) || ($qv['author'] == '0')) {
1726 1726
 				$this->is_author = false;
1727 1727
 			} else {
1728 1728
 				$this->is_author = true;
1729 1729
 			}
1730 1730
 
1731
-			if ( '' != $qv['author_name'] )
1731
+			if ('' != $qv['author_name'])
1732 1732
 				$this->is_author = true;
1733 1733
 
1734
-			if ( !empty( $qv['post_type'] ) && ! is_array( $qv['post_type'] ) ) {
1735
-				$post_type_obj = get_post_type_object( $qv['post_type'] );
1736
-				if ( ! empty( $post_type_obj->has_archive ) )
1734
+			if ( ! empty($qv['post_type']) && ! is_array($qv['post_type'])) {
1735
+				$post_type_obj = get_post_type_object($qv['post_type']);
1736
+				if ( ! empty($post_type_obj->has_archive))
1737 1737
 					$this->is_post_type_archive = true;
1738 1738
 			}
1739 1739
 
1740
-			if ( $this->is_post_type_archive || $this->is_date || $this->is_author || $this->is_category || $this->is_tag || $this->is_tax )
1740
+			if ($this->is_post_type_archive || $this->is_date || $this->is_author || $this->is_category || $this->is_tag || $this->is_tax)
1741 1741
 				$this->is_archive = true;
1742 1742
 		}
1743 1743
 
1744
-		if ( '' != $qv['feed'] )
1744
+		if ('' != $qv['feed'])
1745 1745
 			$this->is_feed = true;
1746 1746
 
1747
-		if ( '' != $qv['embed'] ) {
1747
+		if ('' != $qv['embed']) {
1748 1748
 			$this->is_embed = true;
1749 1749
 		}
1750 1750
 
1751
-		if ( '' != $qv['tb'] )
1751
+		if ('' != $qv['tb'])
1752 1752
 			$this->is_trackback = true;
1753 1753
 
1754
-		if ( '' != $qv['paged'] && ( intval($qv['paged']) > 1 ) )
1754
+		if ('' != $qv['paged'] && (intval($qv['paged']) > 1))
1755 1755
 			$this->is_paged = true;
1756 1756
 
1757 1757
 		// if we're previewing inside the write screen
1758
-		if ( '' != $qv['preview'] )
1758
+		if ('' != $qv['preview'])
1759 1759
 			$this->is_preview = true;
1760 1760
 
1761
-		if ( is_admin() )
1761
+		if (is_admin())
1762 1762
 			$this->is_admin = true;
1763 1763
 
1764
-		if ( false !== strpos($qv['feed'], 'comments-') ) {
1764
+		if (false !== strpos($qv['feed'], 'comments-')) {
1765 1765
 			$qv['feed'] = str_replace('comments-', '', $qv['feed']);
1766 1766
 			$qv['withcomments'] = 1;
1767 1767
 		}
1768 1768
 
1769 1769
 		$this->is_singular = $this->is_single || $this->is_page || $this->is_attachment;
1770 1770
 
1771
-		if ( $this->is_feed && ( !empty($qv['withcomments']) || ( empty($qv['withoutcomments']) && $this->is_singular ) ) )
1771
+		if ($this->is_feed && ( ! empty($qv['withcomments']) || (empty($qv['withoutcomments']) && $this->is_singular)))
1772 1772
 			$this->is_comment_feed = true;
1773 1773
 
1774
-		if ( !( $this->is_singular || $this->is_archive || $this->is_search || $this->is_feed || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) || $this->is_trackback || $this->is_404 || $this->is_admin || $this->is_robots ) )
1774
+		if ( ! ($this->is_singular || $this->is_archive || $this->is_search || $this->is_feed || (defined('REST_REQUEST') && REST_REQUEST) || $this->is_trackback || $this->is_404 || $this->is_admin || $this->is_robots))
1775 1775
 			$this->is_home = true;
1776 1776
 
1777 1777
 		// Correct is_* for page_on_front and page_for_posts
1778
-		if ( $this->is_home && 'page' == get_option('show_on_front') && get_option('page_on_front') ) {
1778
+		if ($this->is_home && 'page' == get_option('show_on_front') && get_option('page_on_front')) {
1779 1779
 			$_query = wp_parse_args($this->query);
1780 1780
 			// pagename can be set and empty depending on matched rewrite rules. Ignore an empty pagename.
1781
-			if ( isset($_query['pagename']) && '' == $_query['pagename'] )
1781
+			if (isset($_query['pagename']) && '' == $_query['pagename'])
1782 1782
 				unset($_query['pagename']);
1783 1783
 
1784
-			unset( $_query['embed'] );
1784
+			unset($_query['embed']);
1785 1785
 
1786
-			if ( empty($_query) || !array_diff( array_keys($_query), array('preview', 'page', 'paged', 'cpage') ) ) {
1786
+			if (empty($_query) || ! array_diff(array_keys($_query), array('preview', 'page', 'paged', 'cpage'))) {
1787 1787
 				$this->is_page = true;
1788 1788
 				$this->is_home = false;
1789 1789
 				$qv['page_id'] = get_option('page_on_front');
1790 1790
 				// Correct <!--nextpage--> for page_on_front
1791
-				if ( !empty($qv['paged']) ) {
1791
+				if ( ! empty($qv['paged'])) {
1792 1792
 					$qv['page'] = $qv['paged'];
1793 1793
 					unset($qv['paged']);
1794 1794
 				}
1795 1795
 			}
1796 1796
 		}
1797 1797
 
1798
-		if ( '' != $qv['pagename'] ) {
1799
-			$this->queried_object = get_page_by_path( $qv['pagename'] );
1798
+		if ('' != $qv['pagename']) {
1799
+			$this->queried_object = get_page_by_path($qv['pagename']);
1800 1800
 
1801
-			if ( $this->queried_object && 'attachment' == $this->queried_object->post_type ) {
1802
-				if ( preg_match( "/^[^%]*%(?:postname)%/", get_option( 'permalink_structure' ) ) ) {
1801
+			if ($this->queried_object && 'attachment' == $this->queried_object->post_type) {
1802
+				if (preg_match("/^[^%]*%(?:postname)%/", get_option('permalink_structure'))) {
1803 1803
 					// See if we also have a post with the same slug
1804
-					$post = get_page_by_path( $qv['pagename'], OBJECT, 'post' );
1805
-					if ( $post ) {
1804
+					$post = get_page_by_path($qv['pagename'], OBJECT, 'post');
1805
+					if ($post) {
1806 1806
 						$this->queried_object = $post;
1807 1807
 						$this->is_page = false;
1808 1808
 						$this->is_single = true;
@@ -1810,53 +1810,53 @@  discard block
 block discarded – undo
1810 1810
 				}
1811 1811
 			}
1812 1812
 
1813
-			if ( ! empty( $this->queried_object ) ) {
1813
+			if ( ! empty($this->queried_object)) {
1814 1814
 				$this->queried_object_id = (int) $this->queried_object->ID;
1815 1815
 			} else {
1816
-				unset( $this->queried_object );
1816
+				unset($this->queried_object);
1817 1817
 			}
1818 1818
 
1819
-			if  ( 'page' == get_option('show_on_front') && isset($this->queried_object_id) && $this->queried_object_id == get_option('page_for_posts') ) {
1819
+			if ('page' == get_option('show_on_front') && isset($this->queried_object_id) && $this->queried_object_id == get_option('page_for_posts')) {
1820 1820
 				$this->is_page = false;
1821 1821
 				$this->is_home = true;
1822 1822
 				$this->is_posts_page = true;
1823 1823
 			}
1824 1824
 		}
1825 1825
 
1826
-		if ( $qv['page_id'] ) {
1827
-			if  ( 'page' == get_option('show_on_front') && $qv['page_id'] == get_option('page_for_posts') ) {
1826
+		if ($qv['page_id']) {
1827
+			if ('page' == get_option('show_on_front') && $qv['page_id'] == get_option('page_for_posts')) {
1828 1828
 				$this->is_page = false;
1829 1829
 				$this->is_home = true;
1830 1830
 				$this->is_posts_page = true;
1831 1831
 			}
1832 1832
 		}
1833 1833
 
1834
-		if ( !empty($qv['post_type']) ) {
1835
-			if ( is_array($qv['post_type']) )
1834
+		if ( ! empty($qv['post_type'])) {
1835
+			if (is_array($qv['post_type']))
1836 1836
 				$qv['post_type'] = array_map('sanitize_key', $qv['post_type']);
1837 1837
 			else
1838 1838
 				$qv['post_type'] = sanitize_key($qv['post_type']);
1839 1839
 		}
1840 1840
 
1841
-		if ( ! empty( $qv['post_status'] ) ) {
1842
-			if ( is_array( $qv['post_status'] ) )
1841
+		if ( ! empty($qv['post_status'])) {
1842
+			if (is_array($qv['post_status']))
1843 1843
 				$qv['post_status'] = array_map('sanitize_key', $qv['post_status']);
1844 1844
 			else
1845 1845
 				$qv['post_status'] = preg_replace('|[^a-z0-9_,-]|', '', $qv['post_status']);
1846 1846
 		}
1847 1847
 
1848
-		if ( $this->is_posts_page && ( ! isset($qv['withcomments']) || ! $qv['withcomments'] ) )
1848
+		if ($this->is_posts_page && ( ! isset($qv['withcomments']) || ! $qv['withcomments']))
1849 1849
 			$this->is_comment_feed = false;
1850 1850
 
1851 1851
 		$this->is_singular = $this->is_single || $this->is_page || $this->is_attachment;
1852 1852
 		// Done correcting is_* for page_on_front and page_for_posts
1853 1853
 
1854
-		if ( '404' == $qv['error'] )
1854
+		if ('404' == $qv['error'])
1855 1855
 			$this->set_404();
1856 1856
 
1857
-		$this->is_embed = $this->is_embed && ( $this->is_singular || $this->is_404 );
1857
+		$this->is_embed = $this->is_embed && ($this->is_singular || $this->is_404);
1858 1858
 
1859
-		$this->query_vars_hash = md5( serialize( $this->query_vars ) );
1859
+		$this->query_vars_hash = md5(serialize($this->query_vars));
1860 1860
 		$this->query_vars_changed = false;
1861 1861
 
1862 1862
 		/**
@@ -1866,7 +1866,7 @@  discard block
 block discarded – undo
1866 1866
 		 *
1867 1867
 		 * @param WP_Query &$this The WP_Query instance (passed by reference).
1868 1868
 		 */
1869
-		do_action_ref_array( 'parse_query', array( &$this ) );
1869
+		do_action_ref_array('parse_query', array(&$this));
1870 1870
 	}
1871 1871
 
1872 1872
 	/**
@@ -1879,77 +1879,77 @@  discard block
 block discarded – undo
1879 1879
 	 *
1880 1880
 	 * @param array $q The query variables. Passed by reference.
1881 1881
 	 */
1882
-	public function parse_tax_query( &$q ) {
1883
-		if ( ! empty( $q['tax_query'] ) && is_array( $q['tax_query'] ) ) {
1882
+	public function parse_tax_query(&$q) {
1883
+		if ( ! empty($q['tax_query']) && is_array($q['tax_query'])) {
1884 1884
 			$tax_query = $q['tax_query'];
1885 1885
 		} else {
1886 1886
 			$tax_query = array();
1887 1887
 		}
1888 1888
 
1889
-		if ( !empty($q['taxonomy']) && !empty($q['term']) ) {
1889
+		if ( ! empty($q['taxonomy']) && ! empty($q['term'])) {
1890 1890
 			$tax_query[] = array(
1891 1891
 				'taxonomy' => $q['taxonomy'],
1892
-				'terms' => array( $q['term'] ),
1892
+				'terms' => array($q['term']),
1893 1893
 				'field' => 'slug',
1894 1894
 			);
1895 1895
 		}
1896 1896
 
1897
-		foreach ( get_taxonomies( array() , 'objects' ) as $taxonomy => $t ) {
1898
-			if ( 'post_tag' == $taxonomy )
1899
-				continue;	// Handled further down in the $q['tag'] block
1897
+		foreach (get_taxonomies(array(), 'objects') as $taxonomy => $t) {
1898
+			if ('post_tag' == $taxonomy)
1899
+				continue; // Handled further down in the $q['tag'] block
1900 1900
 
1901
-			if ( $t->query_var && !empty( $q[$t->query_var] ) ) {
1901
+			if ($t->query_var && ! empty($q[$t->query_var])) {
1902 1902
 				$tax_query_defaults = array(
1903 1903
 					'taxonomy' => $taxonomy,
1904 1904
 					'field' => 'slug',
1905 1905
 				);
1906 1906
 
1907
- 				if ( isset( $t->rewrite['hierarchical'] ) && $t->rewrite['hierarchical'] ) {
1908
-					$q[$t->query_var] = wp_basename( $q[$t->query_var] );
1907
+ 				if (isset($t->rewrite['hierarchical']) && $t->rewrite['hierarchical']) {
1908
+					$q[$t->query_var] = wp_basename($q[$t->query_var]);
1909 1909
 				}
1910 1910
 
1911 1911
 				$term = $q[$t->query_var];
1912 1912
 
1913
-				if ( is_array( $term ) ) {
1914
-					$term = implode( ',', $term );
1913
+				if (is_array($term)) {
1914
+					$term = implode(',', $term);
1915 1915
 				}
1916 1916
 
1917
-				if ( strpos($term, '+') !== false ) {
1918
-					$terms = preg_split( '/[+]+/', $term );
1919
-					foreach ( $terms as $term ) {
1920
-						$tax_query[] = array_merge( $tax_query_defaults, array(
1921
-							'terms' => array( $term )
1922
-						) );
1917
+				if (strpos($term, '+') !== false) {
1918
+					$terms = preg_split('/[+]+/', $term);
1919
+					foreach ($terms as $term) {
1920
+						$tax_query[] = array_merge($tax_query_defaults, array(
1921
+							'terms' => array($term)
1922
+						));
1923 1923
 					}
1924 1924
 				} else {
1925
-					$tax_query[] = array_merge( $tax_query_defaults, array(
1926
-						'terms' => preg_split( '/[,]+/', $term )
1927
-					) );
1925
+					$tax_query[] = array_merge($tax_query_defaults, array(
1926
+						'terms' => preg_split('/[,]+/', $term)
1927
+					));
1928 1928
 				}
1929 1929
 			}
1930 1930
 		}
1931 1931
 
1932 1932
 		// If querystring 'cat' is an array, implode it.
1933
-		if ( is_array( $q['cat'] ) ) {
1934
-			$q['cat'] = implode( ',', $q['cat'] );
1933
+		if (is_array($q['cat'])) {
1934
+			$q['cat'] = implode(',', $q['cat']);
1935 1935
 		}
1936 1936
 
1937 1937
 		// Category stuff
1938
-		if ( ! empty( $q['cat'] ) && ! $this->is_singular ) {
1938
+		if ( ! empty($q['cat']) && ! $this->is_singular) {
1939 1939
 			$cat_in = $cat_not_in = array();
1940 1940
 
1941
-			$cat_array = preg_split( '/[,\s]+/', urldecode( $q['cat'] ) );
1942
-			$cat_array = array_map( 'intval', $cat_array );
1943
-			$q['cat'] = implode( ',', $cat_array );
1941
+			$cat_array = preg_split('/[,\s]+/', urldecode($q['cat']));
1942
+			$cat_array = array_map('intval', $cat_array);
1943
+			$q['cat'] = implode(',', $cat_array);
1944 1944
 
1945
-			foreach ( $cat_array as $cat ) {
1946
-				if ( $cat > 0 )
1945
+			foreach ($cat_array as $cat) {
1946
+				if ($cat > 0)
1947 1947
 					$cat_in[] = $cat;
1948
-				elseif ( $cat < 0 )
1949
-					$cat_not_in[] = abs( $cat );
1948
+				elseif ($cat < 0)
1949
+					$cat_not_in[] = abs($cat);
1950 1950
 			}
1951 1951
 
1952
-			if ( ! empty( $cat_in ) ) {
1952
+			if ( ! empty($cat_in)) {
1953 1953
 				$tax_query[] = array(
1954 1954
 					'taxonomy' => 'category',
1955 1955
 					'terms' => $cat_in,
@@ -1958,7 +1958,7 @@  discard block
 block discarded – undo
1958 1958
 				);
1959 1959
 			}
1960 1960
 
1961
-			if ( ! empty( $cat_not_in ) ) {
1961
+			if ( ! empty($cat_not_in)) {
1962 1962
 				$tax_query[] = array(
1963 1963
 					'taxonomy' => 'category',
1964 1964
 					'terms' => $cat_not_in,
@@ -1967,19 +1967,19 @@  discard block
 block discarded – undo
1967 1967
 					'include_children' => true
1968 1968
 				);
1969 1969
 			}
1970
-			unset( $cat_array, $cat_in, $cat_not_in );
1970
+			unset($cat_array, $cat_in, $cat_not_in);
1971 1971
 		}
1972 1972
 
1973
-		if ( ! empty( $q['category__and'] ) && 1 === count( (array) $q['category__and'] ) ) {
1973
+		if ( ! empty($q['category__and']) && 1 === count((array) $q['category__and'])) {
1974 1974
 			$q['category__and'] = (array) $q['category__and'];
1975
-			if ( ! isset( $q['category__in'] ) )
1975
+			if ( ! isset($q['category__in']))
1976 1976
 				$q['category__in'] = array();
1977
-			$q['category__in'][] = absint( reset( $q['category__and'] ) );
1978
-			unset( $q['category__and'] );
1977
+			$q['category__in'][] = absint(reset($q['category__and']));
1978
+			unset($q['category__and']);
1979 1979
 		}
1980 1980
 
1981
-		if ( ! empty( $q['category__in'] ) ) {
1982
-			$q['category__in'] = array_map( 'absint', array_unique( (array) $q['category__in'] ) );
1981
+		if ( ! empty($q['category__in'])) {
1982
+			$q['category__in'] = array_map('absint', array_unique((array) $q['category__in']));
1983 1983
 			$tax_query[] = array(
1984 1984
 				'taxonomy' => 'category',
1985 1985
 				'terms' => $q['category__in'],
@@ -1988,8 +1988,8 @@  discard block
 block discarded – undo
1988 1988
 			);
1989 1989
 		}
1990 1990
 
1991
-		if ( ! empty($q['category__not_in']) ) {
1992
-			$q['category__not_in'] = array_map( 'absint', array_unique( (array) $q['category__not_in'] ) );
1991
+		if ( ! empty($q['category__not_in'])) {
1992
+			$q['category__not_in'] = array_map('absint', array_unique((array) $q['category__not_in']));
1993 1993
 			$tax_query[] = array(
1994 1994
 				'taxonomy' => 'category',
1995 1995
 				'terms' => $q['category__not_in'],
@@ -1998,8 +1998,8 @@  discard block
 block discarded – undo
1998 1998
 			);
1999 1999
 		}
2000 2000
 
2001
-		if ( ! empty($q['category__and']) ) {
2002
-			$q['category__and'] = array_map( 'absint', array_unique( (array) $q['category__and'] ) );
2001
+		if ( ! empty($q['category__and'])) {
2002
+			$q['category__and'] = array_map('absint', array_unique((array) $q['category__and']));
2003 2003
 			$tax_query[] = array(
2004 2004
 				'taxonomy' => 'category',
2005 2005
 				'terms' => $q['category__and'],
@@ -2010,21 +2010,21 @@  discard block
 block discarded – undo
2010 2010
 		}
2011 2011
 
2012 2012
 		// If querystring 'tag' is array, implode it.
2013
-		if ( is_array( $q['tag'] ) ) {
2014
-			$q['tag'] = implode( ',', $q['tag'] );
2013
+		if (is_array($q['tag'])) {
2014
+			$q['tag'] = implode(',', $q['tag']);
2015 2015
 		}
2016 2016
 
2017 2017
 		// Tag stuff
2018
-		if ( '' != $q['tag'] && !$this->is_singular && $this->query_vars_changed ) {
2019
-			if ( strpos($q['tag'], ',') !== false ) {
2018
+		if ('' != $q['tag'] && ! $this->is_singular && $this->query_vars_changed) {
2019
+			if (strpos($q['tag'], ',') !== false) {
2020 2020
 				$tags = preg_split('/[,\r\n\t ]+/', $q['tag']);
2021
-				foreach ( (array) $tags as $tag ) {
2021
+				foreach ((array) $tags as $tag) {
2022 2022
 					$tag = sanitize_term_field('slug', $tag, 0, 'post_tag', 'db');
2023 2023
 					$q['tag_slug__in'][] = $tag;
2024 2024
 				}
2025
-			} elseif ( preg_match('/[+\r\n\t ]+/', $q['tag'] ) || ! empty( $q['cat'] ) ) {
2025
+			} elseif (preg_match('/[+\r\n\t ]+/', $q['tag']) || ! empty($q['cat'])) {
2026 2026
 				$tags = preg_split('/[+\r\n\t ]+/', $q['tag']);
2027
-				foreach ( (array) $tags as $tag ) {
2027
+				foreach ((array) $tags as $tag) {
2028 2028
 					$tag = sanitize_term_field('slug', $tag, 0, 'post_tag', 'db');
2029 2029
 					$q['tag_slug__and'][] = $tag;
2030 2030
 				}
@@ -2034,24 +2034,24 @@  discard block
 block discarded – undo
2034 2034
 			}
2035 2035
 		}
2036 2036
 
2037
-		if ( !empty($q['tag_id']) ) {
2038
-			$q['tag_id'] = absint( $q['tag_id'] );
2037
+		if ( ! empty($q['tag_id'])) {
2038
+			$q['tag_id'] = absint($q['tag_id']);
2039 2039
 			$tax_query[] = array(
2040 2040
 				'taxonomy' => 'post_tag',
2041 2041
 				'terms' => $q['tag_id']
2042 2042
 			);
2043 2043
 		}
2044 2044
 
2045
-		if ( !empty($q['tag__in']) ) {
2046
-			$q['tag__in'] = array_map('absint', array_unique( (array) $q['tag__in'] ) );
2045
+		if ( ! empty($q['tag__in'])) {
2046
+			$q['tag__in'] = array_map('absint', array_unique((array) $q['tag__in']));
2047 2047
 			$tax_query[] = array(
2048 2048
 				'taxonomy' => 'post_tag',
2049 2049
 				'terms' => $q['tag__in']
2050 2050
 			);
2051 2051
 		}
2052 2052
 
2053
-		if ( !empty($q['tag__not_in']) ) {
2054
-			$q['tag__not_in'] = array_map('absint', array_unique( (array) $q['tag__not_in'] ) );
2053
+		if ( ! empty($q['tag__not_in'])) {
2054
+			$q['tag__not_in'] = array_map('absint', array_unique((array) $q['tag__not_in']));
2055 2055
 			$tax_query[] = array(
2056 2056
 				'taxonomy' => 'post_tag',
2057 2057
 				'terms' => $q['tag__not_in'],
@@ -2059,8 +2059,8 @@  discard block
 block discarded – undo
2059 2059
 			);
2060 2060
 		}
2061 2061
 
2062
-		if ( !empty($q['tag__and']) ) {
2063
-			$q['tag__and'] = array_map('absint', array_unique( (array) $q['tag__and'] ) );
2062
+		if ( ! empty($q['tag__and'])) {
2063
+			$q['tag__and'] = array_map('absint', array_unique((array) $q['tag__and']));
2064 2064
 			$tax_query[] = array(
2065 2065
 				'taxonomy' => 'post_tag',
2066 2066
 				'terms' => $q['tag__and'],
@@ -2068,8 +2068,8 @@  discard block
 block discarded – undo
2068 2068
 			);
2069 2069
 		}
2070 2070
 
2071
-		if ( !empty($q['tag_slug__in']) ) {
2072
-			$q['tag_slug__in'] = array_map('sanitize_title_for_query', array_unique( (array) $q['tag_slug__in'] ) );
2071
+		if ( ! empty($q['tag_slug__in'])) {
2072
+			$q['tag_slug__in'] = array_map('sanitize_title_for_query', array_unique((array) $q['tag_slug__in']));
2073 2073
 			$tax_query[] = array(
2074 2074
 				'taxonomy' => 'post_tag',
2075 2075
 				'terms' => $q['tag_slug__in'],
@@ -2077,8 +2077,8 @@  discard block
 block discarded – undo
2077 2077
 			);
2078 2078
 		}
2079 2079
 
2080
-		if ( !empty($q['tag_slug__and']) ) {
2081
-			$q['tag_slug__and'] = array_map('sanitize_title_for_query', array_unique( (array) $q['tag_slug__and'] ) );
2080
+		if ( ! empty($q['tag_slug__and'])) {
2081
+			$q['tag_slug__and'] = array_map('sanitize_title_for_query', array_unique((array) $q['tag_slug__and']));
2082 2082
 			$tax_query[] = array(
2083 2083
 				'taxonomy' => 'post_tag',
2084 2084
 				'terms' => $q['tag_slug__and'],
@@ -2087,7 +2087,7 @@  discard block
 block discarded – undo
2087 2087
 			);
2088 2088
 		}
2089 2089
 
2090
-		$this->tax_query = new WP_Tax_Query( $tax_query );
2090
+		$this->tax_query = new WP_Tax_Query($tax_query);
2091 2091
 
2092 2092
 		/**
2093 2093
 		 * Fires after taxonomy-related query vars have been parsed.
@@ -2096,7 +2096,7 @@  discard block
 block discarded – undo
2096 2096
 		 *
2097 2097
 		 * @param WP_Query $this The WP_Query instance.
2098 2098
 		 */
2099
-		do_action( 'parse_tax_query', $this );
2099
+		do_action('parse_tax_query', $this);
2100 2100
 	}
2101 2101
 
2102 2102
 	/**
@@ -2109,60 +2109,60 @@  discard block
 block discarded – undo
2109 2109
 	 * @param array $q Query variables.
2110 2110
 	 * @return string WHERE clause.
2111 2111
 	 */
2112
-	protected function parse_search( &$q ) {
2112
+	protected function parse_search(&$q) {
2113 2113
 		global $wpdb;
2114 2114
 
2115 2115
 		$search = '';
2116 2116
 
2117 2117
 		// added slashes screw with quote grouping when done early, so done later
2118
-		$q['s'] = stripslashes( $q['s'] );
2119
-		if ( empty( $_GET['s'] ) && $this->is_main_query() )
2120
-			$q['s'] = urldecode( $q['s'] );
2118
+		$q['s'] = stripslashes($q['s']);
2119
+		if (empty($_GET['s']) && $this->is_main_query())
2120
+			$q['s'] = urldecode($q['s']);
2121 2121
 		// there are no line breaks in <input /> fields
2122
-		$q['s'] = str_replace( array( "\r", "\n" ), '', $q['s'] );
2122
+		$q['s'] = str_replace(array("\r", "\n"), '', $q['s']);
2123 2123
 		$q['search_terms_count'] = 1;
2124
-		if ( ! empty( $q['sentence'] ) ) {
2125
-			$q['search_terms'] = array( $q['s'] );
2124
+		if ( ! empty($q['sentence'])) {
2125
+			$q['search_terms'] = array($q['s']);
2126 2126
 		} else {
2127
-			if ( preg_match_all( '/".*?("|$)|((?<=[\t ",+])|^)[^\t ",+]+/', $q['s'], $matches ) ) {
2128
-				$q['search_terms_count'] = count( $matches[0] );
2129
-				$q['search_terms'] = $this->parse_search_terms( $matches[0] );
2127
+			if (preg_match_all('/".*?("|$)|((?<=[\t ",+])|^)[^\t ",+]+/', $q['s'], $matches)) {
2128
+				$q['search_terms_count'] = count($matches[0]);
2129
+				$q['search_terms'] = $this->parse_search_terms($matches[0]);
2130 2130
 				// if the search string has only short terms or stopwords, or is 10+ terms long, match it as sentence
2131
-				if ( empty( $q['search_terms'] ) || count( $q['search_terms'] ) > 9 )
2132
-					$q['search_terms'] = array( $q['s'] );
2131
+				if (empty($q['search_terms']) || count($q['search_terms']) > 9)
2132
+					$q['search_terms'] = array($q['s']);
2133 2133
 			} else {
2134
-				$q['search_terms'] = array( $q['s'] );
2134
+				$q['search_terms'] = array($q['s']);
2135 2135
 			}
2136 2136
 		}
2137 2137
 
2138
-		$n = ! empty( $q['exact'] ) ? '' : '%';
2138
+		$n = ! empty($q['exact']) ? '' : '%';
2139 2139
 		$searchand = '';
2140 2140
 		$q['search_orderby_title'] = array();
2141
-		foreach ( $q['search_terms'] as $term ) {
2141
+		foreach ($q['search_terms'] as $term) {
2142 2142
 			// Terms prefixed with '-' should be excluded.
2143
-			$include = '-' !== substr( $term, 0, 1 );
2144
-			if ( $include ) {
2143
+			$include = '-' !== substr($term, 0, 1);
2144
+			if ($include) {
2145 2145
 				$like_op  = 'LIKE';
2146 2146
 				$andor_op = 'OR';
2147 2147
 			} else {
2148 2148
 				$like_op  = 'NOT LIKE';
2149 2149
 				$andor_op = 'AND';
2150
-				$term     = substr( $term, 1 );
2150
+				$term     = substr($term, 1);
2151 2151
 			}
2152 2152
 
2153
-			if ( $n && $include ) {
2154
-				$like = '%' . $wpdb->esc_like( $term ) . '%';
2155
-				$q['search_orderby_title'][] = $wpdb->prepare( "$wpdb->posts.post_title LIKE %s", $like );
2153
+			if ($n && $include) {
2154
+				$like = '%'.$wpdb->esc_like($term).'%';
2155
+				$q['search_orderby_title'][] = $wpdb->prepare("$wpdb->posts.post_title LIKE %s", $like);
2156 2156
 			}
2157 2157
 
2158
-			$like = $n . $wpdb->esc_like( $term ) . $n;
2159
-			$search .= $wpdb->prepare( "{$searchand}(($wpdb->posts.post_title $like_op %s) $andor_op ($wpdb->posts.post_excerpt $like_op %s) $andor_op ($wpdb->posts.post_content $like_op %s))", $like, $like, $like );
2158
+			$like = $n.$wpdb->esc_like($term).$n;
2159
+			$search .= $wpdb->prepare("{$searchand}(($wpdb->posts.post_title $like_op %s) $andor_op ($wpdb->posts.post_excerpt $like_op %s) $andor_op ($wpdb->posts.post_content $like_op %s))", $like, $like, $like);
2160 2160
 			$searchand = ' AND ';
2161 2161
 		}
2162 2162
 
2163
-		if ( ! empty( $search ) ) {
2163
+		if ( ! empty($search)) {
2164 2164
 			$search = " AND ({$search}) ";
2165
-			if ( ! is_user_logged_in() )
2165
+			if ( ! is_user_logged_in())
2166 2166
 				$search .= " AND ($wpdb->posts.post_password = '') ";
2167 2167
 		}
2168 2168
 
@@ -2181,24 +2181,24 @@  discard block
 block discarded – undo
2181 2181
 	 * @param array $terms Terms to check.
2182 2182
 	 * @return array Terms that are not stopwords.
2183 2183
 	 */
2184
-	protected function parse_search_terms( $terms ) {
2185
-		$strtolower = function_exists( 'mb_strtolower' ) ? 'mb_strtolower' : 'strtolower';
2184
+	protected function parse_search_terms($terms) {
2185
+		$strtolower = function_exists('mb_strtolower') ? 'mb_strtolower' : 'strtolower';
2186 2186
 		$checked = array();
2187 2187
 
2188 2188
 		$stopwords = $this->get_search_stopwords();
2189 2189
 
2190
-		foreach ( $terms as $term ) {
2190
+		foreach ($terms as $term) {
2191 2191
 			// keep before/after spaces when term is for exact match
2192
-			if ( preg_match( '/^".+"$/', $term ) )
2193
-				$term = trim( $term, "\"'" );
2192
+			if (preg_match('/^".+"$/', $term))
2193
+				$term = trim($term, "\"'");
2194 2194
 			else
2195
-				$term = trim( $term, "\"' " );
2195
+				$term = trim($term, "\"' ");
2196 2196
 
2197 2197
 			// Avoid single A-Z and single dashes.
2198
-			if ( ! $term || ( 1 === strlen( $term ) && preg_match( '/^[a-z\-]$/i', $term ) ) )
2198
+			if ( ! $term || (1 === strlen($term) && preg_match('/^[a-z\-]$/i', $term)))
2199 2199
 				continue;
2200 2200
 
2201
-			if ( in_array( call_user_func( $strtolower, $term ), $stopwords, true ) )
2201
+			if (in_array(call_user_func($strtolower, $term), $stopwords, true))
2202 2202
 				continue;
2203 2203
 
2204 2204
 			$checked[] = $term;
@@ -2215,20 +2215,20 @@  discard block
 block discarded – undo
2215 2215
 	 * @return array Stopwords.
2216 2216
 	 */
2217 2217
 	protected function get_search_stopwords() {
2218
-		if ( isset( $this->stopwords ) )
2218
+		if (isset($this->stopwords))
2219 2219
 			return $this->stopwords;
2220 2220
 
2221 2221
 		/* translators: This is a comma-separated list of very common words that should be excluded from a search,
2222 2222
 		 * like a, an, and the. These are usually called "stopwords". You should not simply translate these individual
2223 2223
 		 * words into your language. Instead, look for and provide commonly accepted stopwords in your language.
2224 2224
 		 */
2225
-		$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',
2226
-			'Comma-separated list of search stopwords in your language' ) );
2225
+		$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',
2226
+			'Comma-separated list of search stopwords in your language'));
2227 2227
 
2228 2228
 		$stopwords = array();
2229
-		foreach ( $words as $word ) {
2230
-			$word = trim( $word, "\r\n\t " );
2231
-			if ( $word )
2229
+		foreach ($words as $word) {
2230
+			$word = trim($word, "\r\n\t ");
2231
+			if ($word)
2232 2232
 				$stopwords[] = $word;
2233 2233
 		}
2234 2234
 
@@ -2239,7 +2239,7 @@  discard block
 block discarded – undo
2239 2239
 		 *
2240 2240
 		 * @param array $stopwords Stopwords.
2241 2241
 		 */
2242
-		$this->stopwords = apply_filters( 'wp_search_stopwords', $stopwords );
2242
+		$this->stopwords = apply_filters('wp_search_stopwords', $stopwords);
2243 2243
 		return $this->stopwords;
2244 2244
 	}
2245 2245
 
@@ -2251,47 +2251,47 @@  discard block
 block discarded – undo
2251 2251
 	 * @param array $q Query variables.
2252 2252
 	 * @return string ORDER BY clause.
2253 2253
 	 */
2254
-	protected function parse_search_order( &$q ) {
2254
+	protected function parse_search_order(&$q) {
2255 2255
 		global $wpdb;
2256 2256
 
2257
-		if ( $q['search_terms_count'] > 1 ) {
2258
-			$num_terms = count( $q['search_orderby_title'] );
2257
+		if ($q['search_terms_count'] > 1) {
2258
+			$num_terms = count($q['search_orderby_title']);
2259 2259
 
2260 2260
 			// If the search terms contain negative queries, don't bother ordering by sentence matches.
2261 2261
 			$like = '';
2262
-			if ( ! preg_match( '/(?:\s|^)\-/', $q['s'] ) ) {
2263
-				$like = '%' . $wpdb->esc_like( $q['s'] ) . '%';
2262
+			if ( ! preg_match('/(?:\s|^)\-/', $q['s'])) {
2263
+				$like = '%'.$wpdb->esc_like($q['s']).'%';
2264 2264
 			}
2265 2265
 
2266 2266
 			$search_orderby = '';
2267 2267
 
2268 2268
 			// sentence match in 'post_title'
2269
-			if ( $like ) {
2270
-				$search_orderby .= $wpdb->prepare( "WHEN $wpdb->posts.post_title LIKE %s THEN 1 ", $like );
2269
+			if ($like) {
2270
+				$search_orderby .= $wpdb->prepare("WHEN $wpdb->posts.post_title LIKE %s THEN 1 ", $like);
2271 2271
 			}
2272 2272
 
2273 2273
 			// sanity limit, sort as sentence when more than 6 terms
2274 2274
 			// (few searches are longer than 6 terms and most titles are not)
2275
-			if ( $num_terms < 7 ) {
2275
+			if ($num_terms < 7) {
2276 2276
 				// all words in title
2277
-				$search_orderby .= 'WHEN ' . implode( ' AND ', $q['search_orderby_title'] ) . ' THEN 2 ';
2277
+				$search_orderby .= 'WHEN '.implode(' AND ', $q['search_orderby_title']).' THEN 2 ';
2278 2278
 				// any word in title, not needed when $num_terms == 1
2279
-				if ( $num_terms > 1 )
2280
-					$search_orderby .= 'WHEN ' . implode( ' OR ', $q['search_orderby_title'] ) . ' THEN 3 ';
2279
+				if ($num_terms > 1)
2280
+					$search_orderby .= 'WHEN '.implode(' OR ', $q['search_orderby_title']).' THEN 3 ';
2281 2281
 			}
2282 2282
 
2283 2283
 			// Sentence match in 'post_content' and 'post_excerpt'.
2284
-			if ( $like ) {
2285
-				$search_orderby .= $wpdb->prepare( "WHEN $wpdb->posts.post_excerpt LIKE %s THEN 4 ", $like );
2286
-				$search_orderby .= $wpdb->prepare( "WHEN $wpdb->posts.post_content LIKE %s THEN 5 ", $like );
2284
+			if ($like) {
2285
+				$search_orderby .= $wpdb->prepare("WHEN $wpdb->posts.post_excerpt LIKE %s THEN 4 ", $like);
2286
+				$search_orderby .= $wpdb->prepare("WHEN $wpdb->posts.post_content LIKE %s THEN 5 ", $like);
2287 2287
 			}
2288 2288
 
2289
-			if ( $search_orderby ) {
2290
-				$search_orderby = '(CASE ' . $search_orderby . 'ELSE 6 END)';
2289
+			if ($search_orderby) {
2290
+				$search_orderby = '(CASE '.$search_orderby.'ELSE 6 END)';
2291 2291
 			}
2292 2292
 		} else {
2293 2293
 			// single word or sentence search
2294
-			$search_orderby = reset( $q['search_orderby_title'] ) . ' DESC';
2294
+			$search_orderby = reset($q['search_orderby_title']).' DESC';
2295 2295
 		}
2296 2296
 
2297 2297
 		return $search_orderby;
@@ -2309,7 +2309,7 @@  discard block
 block discarded – undo
2309 2309
 	 * @param string $orderby Alias for the field to order by.
2310 2310
 	 * @return string|false Table-prefixed value to used in the ORDER clause. False otherwise.
2311 2311
 	 */
2312
-	protected function parse_orderby( $orderby ) {
2312
+	protected function parse_orderby($orderby) {
2313 2313
 		global $wpdb;
2314 2314
 
2315 2315
 		// Used to filter values.
@@ -2322,32 +2322,32 @@  discard block
 block discarded – undo
2322 2322
 		$primary_meta_key = '';
2323 2323
 		$primary_meta_query = false;
2324 2324
 		$meta_clauses = $this->meta_query->get_clauses();
2325
-		if ( ! empty( $meta_clauses ) ) {
2326
-			$primary_meta_query = reset( $meta_clauses );
2325
+		if ( ! empty($meta_clauses)) {
2326
+			$primary_meta_query = reset($meta_clauses);
2327 2327
 
2328
-			if ( ! empty( $primary_meta_query['key'] ) ) {
2328
+			if ( ! empty($primary_meta_query['key'])) {
2329 2329
 				$primary_meta_key = $primary_meta_query['key'];
2330 2330
 				$allowed_keys[] = $primary_meta_key;
2331 2331
 			}
2332 2332
 
2333 2333
 			$allowed_keys[] = 'meta_value';
2334 2334
 			$allowed_keys[] = 'meta_value_num';
2335
-			$allowed_keys   = array_merge( $allowed_keys, array_keys( $meta_clauses ) );
2335
+			$allowed_keys   = array_merge($allowed_keys, array_keys($meta_clauses));
2336 2336
 		}
2337 2337
 
2338 2338
 		// If RAND() contains a seed value, sanitize and add to allowed keys.
2339 2339
 		$rand_with_seed = false;
2340
-		if ( preg_match( '/RAND\(([0-9]+)\)/i', $orderby, $matches ) ) {
2341
-			$orderby = sprintf( 'RAND(%s)', intval( $matches[1] ) );
2340
+		if (preg_match('/RAND\(([0-9]+)\)/i', $orderby, $matches)) {
2341
+			$orderby = sprintf('RAND(%s)', intval($matches[1]));
2342 2342
 			$allowed_keys[] = $orderby;
2343 2343
 			$rand_with_seed = true;
2344 2344
 		}
2345 2345
 
2346
-		if ( ! in_array( $orderby, $allowed_keys, true ) ) {
2346
+		if ( ! in_array($orderby, $allowed_keys, true)) {
2347 2347
 			return false;
2348 2348
 		}
2349 2349
 
2350
-		switch ( $orderby ) {
2350
+		switch ($orderby) {
2351 2351
 			case 'post_name':
2352 2352
 			case 'post_author':
2353 2353
 			case 'post_date':
@@ -2365,7 +2365,7 @@  discard block
 block discarded – undo
2365 2365
 				break;
2366 2366
 			case $primary_meta_key:
2367 2367
 			case 'meta_value':
2368
-				if ( ! empty( $primary_meta_query['type'] ) ) {
2368
+				if ( ! empty($primary_meta_query['type'])) {
2369 2369
 					$orderby_clause = "CAST({$primary_meta_query['alias']}.meta_value AS {$primary_meta_query['cast']})";
2370 2370
 				} else {
2371 2371
 					$orderby_clause = "{$primary_meta_query['alias']}.meta_value";
@@ -2375,15 +2375,15 @@  discard block
 block discarded – undo
2375 2375
 				$orderby_clause = "{$primary_meta_query['alias']}.meta_value+0";
2376 2376
 				break;
2377 2377
 			default:
2378
-				if ( array_key_exists( $orderby, $meta_clauses ) ) {
2378
+				if (array_key_exists($orderby, $meta_clauses)) {
2379 2379
 					// $orderby corresponds to a meta_query clause.
2380
-					$meta_clause = $meta_clauses[ $orderby ];
2380
+					$meta_clause = $meta_clauses[$orderby];
2381 2381
 					$orderby_clause = "CAST({$meta_clause['alias']}.meta_value AS {$meta_clause['cast']})";
2382
-				} elseif ( $rand_with_seed ) {
2382
+				} elseif ($rand_with_seed) {
2383 2383
 					$orderby_clause = $orderby;
2384 2384
 				} else {
2385 2385
 					// Default: order by post field.
2386
-					$orderby_clause = "$wpdb->posts.post_" . sanitize_key( $orderby );
2386
+					$orderby_clause = "$wpdb->posts.post_".sanitize_key($orderby);
2387 2387
 				}
2388 2388
 
2389 2389
 				break;
@@ -2401,12 +2401,12 @@  discard block
 block discarded – undo
2401 2401
 	 * @param string $order The 'order' query variable.
2402 2402
 	 * @return string The sanitized 'order' query variable.
2403 2403
 	 */
2404
-	protected function parse_order( $order ) {
2405
-		if ( ! is_string( $order ) || empty( $order ) ) {
2404
+	protected function parse_order($order) {
2405
+		if ( ! is_string($order) || empty($order)) {
2406 2406
 			return 'DESC';
2407 2407
 		}
2408 2408
 
2409
-		if ( 'ASC' === strtoupper( $order ) ) {
2409
+		if ('ASC' === strtoupper($order)) {
2410 2410
 			return 'ASC';
2411 2411
 		} else {
2412 2412
 			return 'DESC';
@@ -2440,9 +2440,9 @@  discard block
 block discarded – undo
2440 2440
 	 * @param mixed  $default   Optional. Value to return if the query variable is not set. Default empty.
2441 2441
 	 * @return mixed Contents of the query variable.
2442 2442
 	 */
2443
-	public function get( $query_var, $default = '' ) {
2444
-		if ( isset( $this->query_vars[ $query_var ] ) ) {
2445
-			return $this->query_vars[ $query_var ];
2443
+	public function get($query_var, $default = '') {
2444
+		if (isset($this->query_vars[$query_var])) {
2445
+			return $this->query_vars[$query_var];
2446 2446
 		}
2447 2447
 
2448 2448
 		return $default;
@@ -2490,7 +2490,7 @@  discard block
 block discarded – undo
2490 2490
 		 *
2491 2491
 		 * @param WP_Query &$this The WP_Query instance (passed by reference).
2492 2492
 		 */
2493
-		do_action_ref_array( 'pre_get_posts', array( &$this ) );
2493
+		do_action_ref_array('pre_get_posts', array(&$this));
2494 2494
 
2495 2495
 		// Shorthand.
2496 2496
 		$q = &$this->query_vars;
@@ -2500,11 +2500,11 @@  discard block
 block discarded – undo
2500 2500
 
2501 2501
 		// Parse meta query
2502 2502
 		$this->meta_query = new WP_Meta_Query();
2503
-		$this->meta_query->parse_query_vars( $q );
2503
+		$this->meta_query->parse_query_vars($q);
2504 2504
 
2505 2505
 		// Set a flag if a pre_get_posts hook changed the query vars.
2506
-		$hash = md5( serialize( $this->query_vars ) );
2507
-		if ( $hash != $this->query_vars_hash ) {
2506
+		$hash = md5(serialize($this->query_vars));
2507
+		if ($hash != $this->query_vars_hash) {
2508 2508
 			$this->query_vars_changed = true;
2509 2509
 			$this->query_vars_hash = $hash;
2510 2510
 		}
@@ -2522,91 +2522,91 @@  discard block
 block discarded – undo
2522 2522
 		$post_status_join = false;
2523 2523
 		$page = 1;
2524 2524
 
2525
-		if ( isset( $q['caller_get_posts'] ) ) {
2526
-			_deprecated_argument( 'WP_Query', '3.1', __( '"caller_get_posts" is deprecated. Use "ignore_sticky_posts" instead.' ) );
2527
-			if ( !isset( $q['ignore_sticky_posts'] ) )
2525
+		if (isset($q['caller_get_posts'])) {
2526
+			_deprecated_argument('WP_Query', '3.1', __('"caller_get_posts" is deprecated. Use "ignore_sticky_posts" instead.'));
2527
+			if ( ! isset($q['ignore_sticky_posts']))
2528 2528
 				$q['ignore_sticky_posts'] = $q['caller_get_posts'];
2529 2529
 		}
2530 2530
 
2531
-		if ( !isset( $q['ignore_sticky_posts'] ) )
2531
+		if ( ! isset($q['ignore_sticky_posts']))
2532 2532
 			$q['ignore_sticky_posts'] = false;
2533 2533
 
2534
-		if ( !isset($q['suppress_filters']) )
2534
+		if ( ! isset($q['suppress_filters']))
2535 2535
 			$q['suppress_filters'] = false;
2536 2536
 
2537
-		if ( !isset($q['cache_results']) ) {
2538
-			if ( wp_using_ext_object_cache() )
2537
+		if ( ! isset($q['cache_results'])) {
2538
+			if (wp_using_ext_object_cache())
2539 2539
 				$q['cache_results'] = false;
2540 2540
 			else
2541 2541
 				$q['cache_results'] = true;
2542 2542
 		}
2543 2543
 
2544
-		if ( !isset($q['update_post_term_cache']) )
2544
+		if ( ! isset($q['update_post_term_cache']))
2545 2545
 			$q['update_post_term_cache'] = true;
2546 2546
 
2547
-		if ( !isset($q['update_post_meta_cache']) )
2547
+		if ( ! isset($q['update_post_meta_cache']))
2548 2548
 			$q['update_post_meta_cache'] = true;
2549 2549
 
2550
-		if ( !isset($q['post_type']) ) {
2551
-			if ( $this->is_search )
2550
+		if ( ! isset($q['post_type'])) {
2551
+			if ($this->is_search)
2552 2552
 				$q['post_type'] = 'any';
2553 2553
 			else
2554 2554
 				$q['post_type'] = '';
2555 2555
 		}
2556 2556
 		$post_type = $q['post_type'];
2557
-		if ( empty( $q['posts_per_page'] ) ) {
2558
-			$q['posts_per_page'] = get_option( 'posts_per_page' );
2557
+		if (empty($q['posts_per_page'])) {
2558
+			$q['posts_per_page'] = get_option('posts_per_page');
2559 2559
 		}
2560
-		if ( isset($q['showposts']) && $q['showposts'] ) {
2560
+		if (isset($q['showposts']) && $q['showposts']) {
2561 2561
 			$q['showposts'] = (int) $q['showposts'];
2562 2562
 			$q['posts_per_page'] = $q['showposts'];
2563 2563
 		}
2564
-		if ( (isset($q['posts_per_archive_page']) && $q['posts_per_archive_page'] != 0) && ($this->is_archive || $this->is_search) )
2564
+		if ((isset($q['posts_per_archive_page']) && $q['posts_per_archive_page'] != 0) && ($this->is_archive || $this->is_search))
2565 2565
 			$q['posts_per_page'] = $q['posts_per_archive_page'];
2566
-		if ( !isset($q['nopaging']) ) {
2567
-			if ( $q['posts_per_page'] == -1 ) {
2566
+		if ( ! isset($q['nopaging'])) {
2567
+			if ($q['posts_per_page'] == -1) {
2568 2568
 				$q['nopaging'] = true;
2569 2569
 			} else {
2570 2570
 				$q['nopaging'] = false;
2571 2571
 			}
2572 2572
 		}
2573 2573
 
2574
-		if ( $this->is_feed ) {
2574
+		if ($this->is_feed) {
2575 2575
 			// This overrides posts_per_page.
2576
-			if ( ! empty( $q['posts_per_rss'] ) ) {
2576
+			if ( ! empty($q['posts_per_rss'])) {
2577 2577
 				$q['posts_per_page'] = $q['posts_per_rss'];
2578 2578
 			} else {
2579
-				$q['posts_per_page'] = get_option( 'posts_per_rss' );
2579
+				$q['posts_per_page'] = get_option('posts_per_rss');
2580 2580
 			}
2581 2581
 			$q['nopaging'] = false;
2582 2582
 		}
2583 2583
 		$q['posts_per_page'] = (int) $q['posts_per_page'];
2584
-		if ( $q['posts_per_page'] < -1 )
2584
+		if ($q['posts_per_page'] < -1)
2585 2585
 			$q['posts_per_page'] = abs($q['posts_per_page']);
2586
-		elseif ( $q['posts_per_page'] == 0 )
2586
+		elseif ($q['posts_per_page'] == 0)
2587 2587
 			$q['posts_per_page'] = 1;
2588 2588
 
2589
-		if ( !isset($q['comments_per_page']) || $q['comments_per_page'] == 0 )
2589
+		if ( ! isset($q['comments_per_page']) || $q['comments_per_page'] == 0)
2590 2590
 			$q['comments_per_page'] = get_option('comments_per_page');
2591 2591
 
2592
-		if ( $this->is_home && (empty($this->query) || $q['preview'] == 'true') && ( 'page' == get_option('show_on_front') ) && get_option('page_on_front') ) {
2592
+		if ($this->is_home && (empty($this->query) || $q['preview'] == 'true') && ('page' == get_option('show_on_front')) && get_option('page_on_front')) {
2593 2593
 			$this->is_page = true;
2594 2594
 			$this->is_home = false;
2595 2595
 			$q['page_id'] = get_option('page_on_front');
2596 2596
 		}
2597 2597
 
2598
-		if ( isset($q['page']) ) {
2598
+		if (isset($q['page'])) {
2599 2599
 			$q['page'] = trim($q['page'], '/');
2600 2600
 			$q['page'] = absint($q['page']);
2601 2601
 		}
2602 2602
 
2603 2603
 		// If true, forcibly turns off SQL_CALC_FOUND_ROWS even when limits are present.
2604
-		if ( isset($q['no_found_rows']) )
2604
+		if (isset($q['no_found_rows']))
2605 2605
 			$q['no_found_rows'] = (bool) $q['no_found_rows'];
2606 2606
 		else
2607 2607
 			$q['no_found_rows'] = false;
2608 2608
 
2609
-		switch ( $q['fields'] ) {
2609
+		switch ($q['fields']) {
2610 2610
 			case 'ids':
2611 2611
 				$fields = "$wpdb->posts.ID";
2612 2612
 				break;
@@ -2617,74 +2617,74 @@  discard block
 block discarded – undo
2617 2617
 				$fields = "$wpdb->posts.*";
2618 2618
 		}
2619 2619
 
2620
-		if ( '' !== $q['menu_order'] )
2621
-			$where .= " AND $wpdb->posts.menu_order = " . $q['menu_order'];
2620
+		if ('' !== $q['menu_order'])
2621
+			$where .= " AND $wpdb->posts.menu_order = ".$q['menu_order'];
2622 2622
 
2623 2623
 		// The "m" parameter is meant for months but accepts datetimes of varying specificity
2624
-		if ( $q['m'] ) {
2625
-			$where .= " AND YEAR($wpdb->posts.post_date)=" . substr($q['m'], 0, 4);
2626
-			if ( strlen($q['m']) > 5 )
2627
-				$where .= " AND MONTH($wpdb->posts.post_date)=" . substr($q['m'], 4, 2);
2628
-			if ( strlen($q['m']) > 7 )
2629
-				$where .= " AND DAYOFMONTH($wpdb->posts.post_date)=" . substr($q['m'], 6, 2);
2630
-			if ( strlen($q['m']) > 9 )
2631
-				$where .= " AND HOUR($wpdb->posts.post_date)=" . substr($q['m'], 8, 2);
2632
-			if ( strlen($q['m']) > 11 )
2633
-				$where .= " AND MINUTE($wpdb->posts.post_date)=" . substr($q['m'], 10, 2);
2634
-			if ( strlen($q['m']) > 13 )
2635
-				$where .= " AND SECOND($wpdb->posts.post_date)=" . substr($q['m'], 12, 2);
2624
+		if ($q['m']) {
2625
+			$where .= " AND YEAR($wpdb->posts.post_date)=".substr($q['m'], 0, 4);
2626
+			if (strlen($q['m']) > 5)
2627
+				$where .= " AND MONTH($wpdb->posts.post_date)=".substr($q['m'], 4, 2);
2628
+			if (strlen($q['m']) > 7)
2629
+				$where .= " AND DAYOFMONTH($wpdb->posts.post_date)=".substr($q['m'], 6, 2);
2630
+			if (strlen($q['m']) > 9)
2631
+				$where .= " AND HOUR($wpdb->posts.post_date)=".substr($q['m'], 8, 2);
2632
+			if (strlen($q['m']) > 11)
2633
+				$where .= " AND MINUTE($wpdb->posts.post_date)=".substr($q['m'], 10, 2);
2634
+			if (strlen($q['m']) > 13)
2635
+				$where .= " AND SECOND($wpdb->posts.post_date)=".substr($q['m'], 12, 2);
2636 2636
 		}
2637 2637
 
2638 2638
 		// Handle the other individual date parameters
2639 2639
 		$date_parameters = array();
2640 2640
 
2641
-		if ( '' !== $q['hour'] )
2641
+		if ('' !== $q['hour'])
2642 2642
 			$date_parameters['hour'] = $q['hour'];
2643 2643
 
2644
-		if ( '' !== $q['minute'] )
2644
+		if ('' !== $q['minute'])
2645 2645
 			$date_parameters['minute'] = $q['minute'];
2646 2646
 
2647
-		if ( '' !== $q['second'] )
2647
+		if ('' !== $q['second'])
2648 2648
 			$date_parameters['second'] = $q['second'];
2649 2649
 
2650
-		if ( $q['year'] )
2650
+		if ($q['year'])
2651 2651
 			$date_parameters['year'] = $q['year'];
2652 2652
 
2653
-		if ( $q['monthnum'] )
2653
+		if ($q['monthnum'])
2654 2654
 			$date_parameters['monthnum'] = $q['monthnum'];
2655 2655
 
2656
-		if ( $q['w'] )
2656
+		if ($q['w'])
2657 2657
 			$date_parameters['week'] = $q['w'];
2658 2658
 
2659
-		if ( $q['day'] )
2659
+		if ($q['day'])
2660 2660
 			$date_parameters['day'] = $q['day'];
2661 2661
 
2662
-		if ( $date_parameters ) {
2663
-			$date_query = new WP_Date_Query( array( $date_parameters ) );
2662
+		if ($date_parameters) {
2663
+			$date_query = new WP_Date_Query(array($date_parameters));
2664 2664
 			$where .= $date_query->get_sql();
2665 2665
 		}
2666
-		unset( $date_parameters, $date_query );
2666
+		unset($date_parameters, $date_query);
2667 2667
 
2668 2668
 		// Handle complex date queries
2669
-		if ( ! empty( $q['date_query'] ) ) {
2670
-			$this->date_query = new WP_Date_Query( $q['date_query'] );
2669
+		if ( ! empty($q['date_query'])) {
2670
+			$this->date_query = new WP_Date_Query($q['date_query']);
2671 2671
 			$where .= $this->date_query->get_sql();
2672 2672
 		}
2673 2673
 
2674 2674
 
2675 2675
 		// If we've got a post_type AND it's not "any" post_type.
2676
-		if ( !empty($q['post_type']) && 'any' != $q['post_type'] ) {
2677
-			foreach ( (array)$q['post_type'] as $_post_type ) {
2676
+		if ( ! empty($q['post_type']) && 'any' != $q['post_type']) {
2677
+			foreach ((array) $q['post_type'] as $_post_type) {
2678 2678
 				$ptype_obj = get_post_type_object($_post_type);
2679
-				if ( !$ptype_obj || !$ptype_obj->query_var || empty($q[ $ptype_obj->query_var ]) )
2679
+				if ( ! $ptype_obj || ! $ptype_obj->query_var || empty($q[$ptype_obj->query_var]))
2680 2680
 					continue;
2681 2681
 
2682
-				if ( ! $ptype_obj->hierarchical ) {
2682
+				if ( ! $ptype_obj->hierarchical) {
2683 2683
 					// Non-hierarchical post types can directly use 'name'.
2684
-					$q['name'] = $q[ $ptype_obj->query_var ];
2684
+					$q['name'] = $q[$ptype_obj->query_var];
2685 2685
 				} else {
2686 2686
 					// Hierarchical post types will operate through 'pagename'.
2687
-					$q['pagename'] = $q[ $ptype_obj->query_var ];
2687
+					$q['pagename'] = $q[$ptype_obj->query_var];
2688 2688
 					$q['name'] = '';
2689 2689
 				}
2690 2690
 
@@ -2694,98 +2694,98 @@  discard block
 block discarded – undo
2694 2694
 			unset($ptype_obj);
2695 2695
 		}
2696 2696
 
2697
-		if ( '' !== $q['title'] ) {
2698
-			$where .= $wpdb->prepare( " AND $wpdb->posts.post_title = %s", stripslashes( $q['title'] ) );
2697
+		if ('' !== $q['title']) {
2698
+			$where .= $wpdb->prepare(" AND $wpdb->posts.post_title = %s", stripslashes($q['title']));
2699 2699
 		}
2700 2700
 
2701 2701
 		// Parameters related to 'post_name'.
2702
-		if ( '' != $q['name'] ) {
2703
-			$q['name'] = sanitize_title_for_query( $q['name'] );
2704
-			$where .= " AND $wpdb->posts.post_name = '" . $q['name'] . "'";
2705
-		} elseif ( '' != $q['pagename'] ) {
2706
-			if ( isset($this->queried_object_id) ) {
2702
+		if ('' != $q['name']) {
2703
+			$q['name'] = sanitize_title_for_query($q['name']);
2704
+			$where .= " AND $wpdb->posts.post_name = '".$q['name']."'";
2705
+		} elseif ('' != $q['pagename']) {
2706
+			if (isset($this->queried_object_id)) {
2707 2707
 				$reqpage = $this->queried_object_id;
2708 2708
 			} else {
2709
-				if ( 'page' != $q['post_type'] ) {
2710
-					foreach ( (array)$q['post_type'] as $_post_type ) {
2709
+				if ('page' != $q['post_type']) {
2710
+					foreach ((array) $q['post_type'] as $_post_type) {
2711 2711
 						$ptype_obj = get_post_type_object($_post_type);
2712
-						if ( !$ptype_obj || !$ptype_obj->hierarchical )
2712
+						if ( ! $ptype_obj || ! $ptype_obj->hierarchical)
2713 2713
 							continue;
2714 2714
 
2715 2715
 						$reqpage = get_page_by_path($q['pagename'], OBJECT, $_post_type);
2716
-						if ( $reqpage )
2716
+						if ($reqpage)
2717 2717
 							break;
2718 2718
 					}
2719 2719
 					unset($ptype_obj);
2720 2720
 				} else {
2721 2721
 					$reqpage = get_page_by_path($q['pagename']);
2722 2722
 				}
2723
-				if ( !empty($reqpage) )
2723
+				if ( ! empty($reqpage))
2724 2724
 					$reqpage = $reqpage->ID;
2725 2725
 				else
2726 2726
 					$reqpage = 0;
2727 2727
 			}
2728 2728
 
2729 2729
 			$page_for_posts = get_option('page_for_posts');
2730
-			if  ( ('page' != get_option('show_on_front') ) || empty($page_for_posts) || ( $reqpage != $page_for_posts ) ) {
2731
-				$q['pagename'] = sanitize_title_for_query( wp_basename( $q['pagename'] ) );
2730
+			if (('page' != get_option('show_on_front')) || empty($page_for_posts) || ($reqpage != $page_for_posts)) {
2731
+				$q['pagename'] = sanitize_title_for_query(wp_basename($q['pagename']));
2732 2732
 				$q['name'] = $q['pagename'];
2733 2733
 				$where .= " AND ($wpdb->posts.ID = '$reqpage')";
2734
-				$reqpage_obj = get_post( $reqpage );
2735
-				if ( is_object($reqpage_obj) && 'attachment' == $reqpage_obj->post_type ) {
2734
+				$reqpage_obj = get_post($reqpage);
2735
+				if (is_object($reqpage_obj) && 'attachment' == $reqpage_obj->post_type) {
2736 2736
 					$this->is_attachment = true;
2737 2737
 					$post_type = $q['post_type'] = 'attachment';
2738 2738
 					$this->is_page = true;
2739 2739
 					$q['attachment_id'] = $reqpage;
2740 2740
 				}
2741 2741
 			}
2742
-		} elseif ( '' != $q['attachment'] ) {
2743
-			$q['attachment'] = sanitize_title_for_query( wp_basename( $q['attachment'] ) );
2742
+		} elseif ('' != $q['attachment']) {
2743
+			$q['attachment'] = sanitize_title_for_query(wp_basename($q['attachment']));
2744 2744
 			$q['name'] = $q['attachment'];
2745
-			$where .= " AND $wpdb->posts.post_name = '" . $q['attachment'] . "'";
2746
-		} elseif ( is_array( $q['post_name__in'] ) && ! empty( $q['post_name__in'] ) ) {
2747
-			$q['post_name__in'] = array_map( 'sanitize_title_for_query', $q['post_name__in'] );
2748
-			$where .= " AND $wpdb->posts.post_name IN ('" . implode( "' ,'", $q['post_name__in'] ) . "')";
2745
+			$where .= " AND $wpdb->posts.post_name = '".$q['attachment']."'";
2746
+		} elseif (is_array($q['post_name__in']) && ! empty($q['post_name__in'])) {
2747
+			$q['post_name__in'] = array_map('sanitize_title_for_query', $q['post_name__in']);
2748
+			$where .= " AND $wpdb->posts.post_name IN ('".implode("' ,'", $q['post_name__in'])."')";
2749 2749
 		}
2750 2750
 
2751 2751
 		// If an attachment is requested by number, let it supersede any post number.
2752
-		if ( $q['attachment_id'] )
2752
+		if ($q['attachment_id'])
2753 2753
 			$q['p'] = absint($q['attachment_id']);
2754 2754
 
2755 2755
 		// If a post number is specified, load that post
2756
-		if ( $q['p'] ) {
2757
-			$where .= " AND {$wpdb->posts}.ID = " . $q['p'];
2758
-		} elseif ( $q['post__in'] ) {
2759
-			$post__in = implode(',', array_map( 'absint', $q['post__in'] ));
2756
+		if ($q['p']) {
2757
+			$where .= " AND {$wpdb->posts}.ID = ".$q['p'];
2758
+		} elseif ($q['post__in']) {
2759
+			$post__in = implode(',', array_map('absint', $q['post__in']));
2760 2760
 			$where .= " AND {$wpdb->posts}.ID IN ($post__in)";
2761
-		} elseif ( $q['post__not_in'] ) {
2762
-			$post__not_in = implode(',',  array_map( 'absint', $q['post__not_in'] ));
2761
+		} elseif ($q['post__not_in']) {
2762
+			$post__not_in = implode(',', array_map('absint', $q['post__not_in']));
2763 2763
 			$where .= " AND {$wpdb->posts}.ID NOT IN ($post__not_in)";
2764 2764
 		}
2765 2765
 
2766
-		if ( is_numeric( $q['post_parent'] ) ) {
2767
-			$where .= $wpdb->prepare( " AND $wpdb->posts.post_parent = %d ", $q['post_parent'] );
2768
-		} elseif ( $q['post_parent__in'] ) {
2769
-			$post_parent__in = implode( ',', array_map( 'absint', $q['post_parent__in'] ) );
2766
+		if (is_numeric($q['post_parent'])) {
2767
+			$where .= $wpdb->prepare(" AND $wpdb->posts.post_parent = %d ", $q['post_parent']);
2768
+		} elseif ($q['post_parent__in']) {
2769
+			$post_parent__in = implode(',', array_map('absint', $q['post_parent__in']));
2770 2770
 			$where .= " AND {$wpdb->posts}.post_parent IN ($post_parent__in)";
2771
-		} elseif ( $q['post_parent__not_in'] ) {
2772
-			$post_parent__not_in = implode( ',',  array_map( 'absint', $q['post_parent__not_in'] ) );
2771
+		} elseif ($q['post_parent__not_in']) {
2772
+			$post_parent__not_in = implode(',', array_map('absint', $q['post_parent__not_in']));
2773 2773
 			$where .= " AND {$wpdb->posts}.post_parent NOT IN ($post_parent__not_in)";
2774 2774
 		}
2775 2775
 
2776
-		if ( $q['page_id'] ) {
2777
-			if  ( ('page' != get_option('show_on_front') ) || ( $q['page_id'] != get_option('page_for_posts') ) ) {
2776
+		if ($q['page_id']) {
2777
+			if (('page' != get_option('show_on_front')) || ($q['page_id'] != get_option('page_for_posts'))) {
2778 2778
 				$q['p'] = $q['page_id'];
2779
-				$where = " AND {$wpdb->posts}.ID = " . $q['page_id'];
2779
+				$where = " AND {$wpdb->posts}.ID = ".$q['page_id'];
2780 2780
 			}
2781 2781
 		}
2782 2782
 
2783 2783
 		// If a search pattern is specified, load the posts that match.
2784
-		if ( strlen( $q['s'] ) ) {
2785
-			$search = $this->parse_search( $q );
2784
+		if (strlen($q['s'])) {
2785
+			$search = $this->parse_search($q);
2786 2786
 		}
2787 2787
 
2788
-		if ( ! $q['suppress_filters'] ) {
2788
+		if ( ! $q['suppress_filters']) {
2789 2789
 			/**
2790 2790
 			 * Filter the search SQL that is used in the WHERE clause of WP_Query.
2791 2791
 			 *
@@ -2794,36 +2794,36 @@  discard block
 block discarded – undo
2794 2794
 			 * @param string   $search Search SQL for WHERE clause.
2795 2795
 			 * @param WP_Query $this   The current WP_Query object.
2796 2796
 			 */
2797
-			$search = apply_filters_ref_array( 'posts_search', array( $search, &$this ) );
2797
+			$search = apply_filters_ref_array('posts_search', array($search, &$this));
2798 2798
 		}
2799 2799
 
2800 2800
 		// Taxonomies
2801
-		if ( !$this->is_singular ) {
2802
-			$this->parse_tax_query( $q );
2801
+		if ( ! $this->is_singular) {
2802
+			$this->parse_tax_query($q);
2803 2803
 
2804
-			$clauses = $this->tax_query->get_sql( $wpdb->posts, 'ID' );
2804
+			$clauses = $this->tax_query->get_sql($wpdb->posts, 'ID');
2805 2805
 
2806 2806
 			$join .= $clauses['join'];
2807 2807
 			$where .= $clauses['where'];
2808 2808
 		}
2809 2809
 
2810
-		if ( $this->is_tax ) {
2811
-			if ( empty($post_type) ) {
2810
+		if ($this->is_tax) {
2811
+			if (empty($post_type)) {
2812 2812
 				// Do a fully inclusive search for currently registered post types of queried taxonomies
2813 2813
 				$post_type = array();
2814
-				$taxonomies = array_keys( $this->tax_query->queried_terms );
2815
-				foreach ( get_post_types( array( 'exclude_from_search' => false ) ) as $pt ) {
2816
-					$object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies( $pt );
2817
-					if ( array_intersect( $taxonomies, $object_taxonomies ) )
2814
+				$taxonomies = array_keys($this->tax_query->queried_terms);
2815
+				foreach (get_post_types(array('exclude_from_search' => false)) as $pt) {
2816
+					$object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt);
2817
+					if (array_intersect($taxonomies, $object_taxonomies))
2818 2818
 						$post_type[] = $pt;
2819 2819
 				}
2820
-				if ( ! $post_type )
2820
+				if ( ! $post_type)
2821 2821
 					$post_type = 'any';
2822
-				elseif ( count( $post_type ) == 1 )
2822
+				elseif (count($post_type) == 1)
2823 2823
 					$post_type = $post_type[0];
2824 2824
 
2825 2825
 				$post_status_join = true;
2826
-			} elseif ( in_array('attachment', (array) $post_type) ) {
2826
+			} elseif (in_array('attachment', (array) $post_type)) {
2827 2827
 				$post_status_join = true;
2828 2828
 			}
2829 2829
 		}
@@ -2832,22 +2832,22 @@  discard block
 block discarded – undo
2832 2832
 		 * Ensure that 'taxonomy', 'term', 'term_id', 'cat', and
2833 2833
 		 * 'category_name' vars are set for backward compatibility.
2834 2834
 		 */
2835
-		if ( ! empty( $this->tax_query->queried_terms ) ) {
2835
+		if ( ! empty($this->tax_query->queried_terms)) {
2836 2836
 
2837 2837
 			/*
2838 2838
 			 * Set 'taxonomy', 'term', and 'term_id' to the
2839 2839
 			 * first taxonomy other than 'post_tag' or 'category'.
2840 2840
 			 */
2841
-			if ( ! isset( $q['taxonomy'] ) ) {
2842
-				foreach ( $this->tax_query->queried_terms as $queried_taxonomy => $queried_items ) {
2843
-					if ( empty( $queried_items['terms'][0] ) ) {
2841
+			if ( ! isset($q['taxonomy'])) {
2842
+				foreach ($this->tax_query->queried_terms as $queried_taxonomy => $queried_items) {
2843
+					if (empty($queried_items['terms'][0])) {
2844 2844
 						continue;
2845 2845
 					}
2846 2846
 
2847
-					if ( ! in_array( $queried_taxonomy, array( 'category', 'post_tag' ) ) ) {
2847
+					if ( ! in_array($queried_taxonomy, array('category', 'post_tag'))) {
2848 2848
 						$q['taxonomy'] = $queried_taxonomy;
2849 2849
 
2850
-						if ( 'slug' === $queried_items['field'] ) {
2850
+						if ('slug' === $queried_items['field']) {
2851 2851
 							$q['term'] = $queried_items['terms'][0];
2852 2852
 						} else {
2853 2853
 							$q['term_id'] = $queried_items['terms'][0];
@@ -2860,154 +2860,154 @@  discard block
 block discarded – undo
2860 2860
 			}
2861 2861
 
2862 2862
 			// 'cat', 'category_name', 'tag_id'
2863
-			foreach ( $this->tax_query->queried_terms as $queried_taxonomy => $queried_items ) {
2864
-				if ( empty( $queried_items['terms'][0] ) ) {
2863
+			foreach ($this->tax_query->queried_terms as $queried_taxonomy => $queried_items) {
2864
+				if (empty($queried_items['terms'][0])) {
2865 2865
 					continue;
2866 2866
 				}
2867 2867
 
2868
-				if ( 'category' === $queried_taxonomy ) {
2869
-					$the_cat = get_term_by( $queried_items['field'], $queried_items['terms'][0], 'category' );
2870
-					if ( $the_cat ) {
2871
-						$this->set( 'cat', $the_cat->term_id );
2872
-						$this->set( 'category_name', $the_cat->slug );
2868
+				if ('category' === $queried_taxonomy) {
2869
+					$the_cat = get_term_by($queried_items['field'], $queried_items['terms'][0], 'category');
2870
+					if ($the_cat) {
2871
+						$this->set('cat', $the_cat->term_id);
2872
+						$this->set('category_name', $the_cat->slug);
2873 2873
 					}
2874
-					unset( $the_cat );
2874
+					unset($the_cat);
2875 2875
 				}
2876 2876
 
2877
-				if ( 'post_tag' === $queried_taxonomy ) {
2878
-					$the_tag = get_term_by( $queried_items['field'], $queried_items['terms'][0], 'post_tag' );
2879
-					if ( $the_tag ) {
2880
-						$this->set( 'tag_id', $the_tag->term_id );
2877
+				if ('post_tag' === $queried_taxonomy) {
2878
+					$the_tag = get_term_by($queried_items['field'], $queried_items['terms'][0], 'post_tag');
2879
+					if ($the_tag) {
2880
+						$this->set('tag_id', $the_tag->term_id);
2881 2881
 					}
2882
-					unset( $the_tag );
2882
+					unset($the_tag);
2883 2883
 				}
2884 2884
 			}
2885 2885
 		}
2886 2886
 
2887
-		if ( !empty( $this->tax_query->queries ) || !empty( $this->meta_query->queries ) ) {
2887
+		if ( ! empty($this->tax_query->queries) || ! empty($this->meta_query->queries)) {
2888 2888
 			$groupby = "{$wpdb->posts}.ID";
2889 2889
 		}
2890 2890
 
2891 2891
 		// Author/user stuff
2892 2892
 
2893
-		if ( ! empty( $q['author'] ) && $q['author'] != '0' ) {
2894
-			$q['author'] = addslashes_gpc( '' . urldecode( $q['author'] ) );
2895
-			$authors = array_unique( array_map( 'intval', preg_split( '/[,\s]+/', $q['author'] ) ) );
2896
-			foreach ( $authors as $author ) {
2893
+		if ( ! empty($q['author']) && $q['author'] != '0') {
2894
+			$q['author'] = addslashes_gpc(''.urldecode($q['author']));
2895
+			$authors = array_unique(array_map('intval', preg_split('/[,\s]+/', $q['author'])));
2896
+			foreach ($authors as $author) {
2897 2897
 				$key = $author > 0 ? 'author__in' : 'author__not_in';
2898
-				$q[$key][] = abs( $author );
2898
+				$q[$key][] = abs($author);
2899 2899
 			}
2900
-			$q['author'] = implode( ',', $authors );
2900
+			$q['author'] = implode(',', $authors);
2901 2901
 		}
2902 2902
 
2903
-		if ( ! empty( $q['author__not_in'] ) ) {
2904
-			$author__not_in = implode( ',', array_map( 'absint', array_unique( (array) $q['author__not_in'] ) ) );
2903
+		if ( ! empty($q['author__not_in'])) {
2904
+			$author__not_in = implode(',', array_map('absint', array_unique((array) $q['author__not_in'])));
2905 2905
 			$where .= " AND {$wpdb->posts}.post_author NOT IN ($author__not_in) ";
2906
-		} elseif ( ! empty( $q['author__in'] ) ) {
2907
-			$author__in = implode( ',', array_map( 'absint', array_unique( (array) $q['author__in'] ) ) );
2906
+		} elseif ( ! empty($q['author__in'])) {
2907
+			$author__in = implode(',', array_map('absint', array_unique((array) $q['author__in'])));
2908 2908
 			$where .= " AND {$wpdb->posts}.post_author IN ($author__in) ";
2909 2909
 		}
2910 2910
 
2911 2911
 		// Author stuff for nice URLs
2912 2912
 
2913
-		if ( '' != $q['author_name'] ) {
2914
-			if ( strpos($q['author_name'], '/') !== false ) {
2913
+		if ('' != $q['author_name']) {
2914
+			if (strpos($q['author_name'], '/') !== false) {
2915 2915
 				$q['author_name'] = explode('/', $q['author_name']);
2916
-				if ( $q['author_name'][ count($q['author_name'])-1 ] ) {
2917
-					$q['author_name'] = $q['author_name'][count($q['author_name'])-1]; // no trailing slash
2916
+				if ($q['author_name'][count($q['author_name']) - 1]) {
2917
+					$q['author_name'] = $q['author_name'][count($q['author_name']) - 1]; // no trailing slash
2918 2918
 				} else {
2919
-					$q['author_name'] = $q['author_name'][count($q['author_name'])-2]; // there was a trailing slash
2919
+					$q['author_name'] = $q['author_name'][count($q['author_name']) - 2]; // there was a trailing slash
2920 2920
 				}
2921 2921
 			}
2922
-			$q['author_name'] = sanitize_title_for_query( $q['author_name'] );
2922
+			$q['author_name'] = sanitize_title_for_query($q['author_name']);
2923 2923
 			$q['author'] = get_user_by('slug', $q['author_name']);
2924
-			if ( $q['author'] )
2924
+			if ($q['author'])
2925 2925
 				$q['author'] = $q['author']->ID;
2926
-			$whichauthor .= " AND ($wpdb->posts.post_author = " . absint($q['author']) . ')';
2926
+			$whichauthor .= " AND ($wpdb->posts.post_author = ".absint($q['author']).')';
2927 2927
 		}
2928 2928
 
2929 2929
 		// MIME-Type stuff for attachment browsing
2930 2930
 
2931
-		if ( isset( $q['post_mime_type'] ) && '' != $q['post_mime_type'] )
2932
-			$whichmimetype = wp_post_mime_type_where( $q['post_mime_type'], $wpdb->posts );
2931
+		if (isset($q['post_mime_type']) && '' != $q['post_mime_type'])
2932
+			$whichmimetype = wp_post_mime_type_where($q['post_mime_type'], $wpdb->posts);
2933 2933
 
2934
-		$where .= $search . $whichauthor . $whichmimetype;
2934
+		$where .= $search.$whichauthor.$whichmimetype;
2935 2935
 
2936
-		if ( ! empty( $this->meta_query->queries ) ) {
2937
-			$clauses = $this->meta_query->get_sql( 'post', $wpdb->posts, 'ID', $this );
2936
+		if ( ! empty($this->meta_query->queries)) {
2937
+			$clauses = $this->meta_query->get_sql('post', $wpdb->posts, 'ID', $this);
2938 2938
 			$join   .= $clauses['join'];
2939 2939
 			$where  .= $clauses['where'];
2940 2940
 		}
2941 2941
 
2942
-		$rand = ( isset( $q['orderby'] ) && 'rand' === $q['orderby'] );
2943
-		if ( ! isset( $q['order'] ) ) {
2942
+		$rand = (isset($q['orderby']) && 'rand' === $q['orderby']);
2943
+		if ( ! isset($q['order'])) {
2944 2944
 			$q['order'] = $rand ? '' : 'DESC';
2945 2945
 		} else {
2946
-			$q['order'] = $rand ? '' : $this->parse_order( $q['order'] );
2946
+			$q['order'] = $rand ? '' : $this->parse_order($q['order']);
2947 2947
 		}
2948 2948
 
2949 2949
 		// Order by.
2950
-		if ( empty( $q['orderby'] ) ) {
2950
+		if (empty($q['orderby'])) {
2951 2951
 			/*
2952 2952
 			 * Boolean false or empty array blanks out ORDER BY,
2953 2953
 			 * while leaving the value unset or otherwise empty sets the default.
2954 2954
 			 */
2955
-			if ( isset( $q['orderby'] ) && ( is_array( $q['orderby'] ) || false === $q['orderby'] ) ) {
2955
+			if (isset($q['orderby']) && (is_array($q['orderby']) || false === $q['orderby'])) {
2956 2956
 				$orderby = '';
2957 2957
 			} else {
2958
-				$orderby = "$wpdb->posts.post_date " . $q['order'];
2958
+				$orderby = "$wpdb->posts.post_date ".$q['order'];
2959 2959
 			}
2960
-		} elseif ( 'none' == $q['orderby'] ) {
2960
+		} elseif ('none' == $q['orderby']) {
2961 2961
 			$orderby = '';
2962
-		} elseif ( $q['orderby'] == 'post__in' && ! empty( $post__in ) ) {
2962
+		} elseif ($q['orderby'] == 'post__in' && ! empty($post__in)) {
2963 2963
 			$orderby = "FIELD( {$wpdb->posts}.ID, $post__in )";
2964
-		} elseif ( $q['orderby'] == 'post_parent__in' && ! empty( $post_parent__in ) ) {
2964
+		} elseif ($q['orderby'] == 'post_parent__in' && ! empty($post_parent__in)) {
2965 2965
 			$orderby = "FIELD( {$wpdb->posts}.post_parent, $post_parent__in )";
2966 2966
 		} else {
2967 2967
 			$orderby_array = array();
2968
-			if ( is_array( $q['orderby'] ) ) {
2969
-				foreach ( $q['orderby'] as $_orderby => $order ) {
2970
-					$orderby = addslashes_gpc( urldecode( $_orderby ) );
2971
-					$parsed  = $this->parse_orderby( $orderby );
2968
+			if (is_array($q['orderby'])) {
2969
+				foreach ($q['orderby'] as $_orderby => $order) {
2970
+					$orderby = addslashes_gpc(urldecode($_orderby));
2971
+					$parsed  = $this->parse_orderby($orderby);
2972 2972
 
2973
-					if ( ! $parsed ) {
2973
+					if ( ! $parsed) {
2974 2974
 						continue;
2975 2975
 					}
2976 2976
 
2977
-					$orderby_array[] = $parsed . ' ' . $this->parse_order( $order );
2977
+					$orderby_array[] = $parsed.' '.$this->parse_order($order);
2978 2978
 				}
2979
-				$orderby = implode( ', ', $orderby_array );
2979
+				$orderby = implode(', ', $orderby_array);
2980 2980
 
2981 2981
 			} else {
2982
-				$q['orderby'] = urldecode( $q['orderby'] );
2983
-				$q['orderby'] = addslashes_gpc( $q['orderby'] );
2982
+				$q['orderby'] = urldecode($q['orderby']);
2983
+				$q['orderby'] = addslashes_gpc($q['orderby']);
2984 2984
 
2985
-				foreach ( explode( ' ', $q['orderby'] ) as $i => $orderby ) {
2986
-					$parsed = $this->parse_orderby( $orderby );
2985
+				foreach (explode(' ', $q['orderby']) as $i => $orderby) {
2986
+					$parsed = $this->parse_orderby($orderby);
2987 2987
 					// Only allow certain values for safety.
2988
-					if ( ! $parsed ) {
2988
+					if ( ! $parsed) {
2989 2989
 						continue;
2990 2990
 					}
2991 2991
 
2992 2992
 					$orderby_array[] = $parsed;
2993 2993
 				}
2994
-				$orderby = implode( ' ' . $q['order'] . ', ', $orderby_array );
2994
+				$orderby = implode(' '.$q['order'].', ', $orderby_array);
2995 2995
 
2996
-				if ( empty( $orderby ) ) {
2997
-					$orderby = "$wpdb->posts.post_date " . $q['order'];
2998
-				} elseif ( ! empty( $q['order'] ) ) {
2996
+				if (empty($orderby)) {
2997
+					$orderby = "$wpdb->posts.post_date ".$q['order'];
2998
+				} elseif ( ! empty($q['order'])) {
2999 2999
 					$orderby .= " {$q['order']}";
3000 3000
 				}
3001 3001
 			}
3002 3002
 		}
3003 3003
 
3004 3004
 		// Order search results by relevance only when another "orderby" is not specified in the query.
3005
-		if ( ! empty( $q['s'] ) ) {
3005
+		if ( ! empty($q['s'])) {
3006 3006
 			$search_orderby = '';
3007
-			if ( ! empty( $q['search_orderby_title'] ) && ( empty( $q['orderby'] ) && ! $this->is_feed ) || ( isset( $q['orderby'] ) && 'relevance' === $q['orderby'] ) )
3008
-				$search_orderby = $this->parse_search_order( $q );
3007
+			if ( ! empty($q['search_orderby_title']) && (empty($q['orderby']) && ! $this->is_feed) || (isset($q['orderby']) && 'relevance' === $q['orderby']))
3008
+				$search_orderby = $this->parse_search_order($q);
3009 3009
 
3010
-			if ( ! $q['suppress_filters'] ) {
3010
+			if ( ! $q['suppress_filters']) {
3011 3011
 				/**
3012 3012
 				 * Filter the ORDER BY used when ordering search results.
3013 3013
 				 *
@@ -3016,94 +3016,94 @@  discard block
 block discarded – undo
3016 3016
 				 * @param string   $search_orderby The ORDER BY clause.
3017 3017
 				 * @param WP_Query $this           The current WP_Query instance.
3018 3018
 				 */
3019
-				$search_orderby = apply_filters( 'posts_search_orderby', $search_orderby, $this );
3019
+				$search_orderby = apply_filters('posts_search_orderby', $search_orderby, $this);
3020 3020
 			}
3021 3021
 
3022
-			if ( $search_orderby )
3023
-				$orderby = $orderby ? $search_orderby . ', ' . $orderby : $search_orderby;
3022
+			if ($search_orderby)
3023
+				$orderby = $orderby ? $search_orderby.', '.$orderby : $search_orderby;
3024 3024
 		}
3025 3025
 
3026
-		if ( is_array( $post_type ) && count( $post_type ) > 1 ) {
3026
+		if (is_array($post_type) && count($post_type) > 1) {
3027 3027
 			$post_type_cap = 'multiple_post_type';
3028 3028
 		} else {
3029
-			if ( is_array( $post_type ) )
3030
-				$post_type = reset( $post_type );
3031
-			$post_type_object = get_post_type_object( $post_type );
3032
-			if ( empty( $post_type_object ) )
3029
+			if (is_array($post_type))
3030
+				$post_type = reset($post_type);
3031
+			$post_type_object = get_post_type_object($post_type);
3032
+			if (empty($post_type_object))
3033 3033
 				$post_type_cap = $post_type;
3034 3034
 		}
3035 3035
 
3036
-		if ( isset( $q['post_password'] ) ) {
3037
-			$where .= $wpdb->prepare( " AND $wpdb->posts.post_password = %s", $q['post_password'] );
3038
-			if ( empty( $q['perm'] ) ) {
3036
+		if (isset($q['post_password'])) {
3037
+			$where .= $wpdb->prepare(" AND $wpdb->posts.post_password = %s", $q['post_password']);
3038
+			if (empty($q['perm'])) {
3039 3039
 				$q['perm'] = 'readable';
3040 3040
 			}
3041
-		} elseif ( isset( $q['has_password'] ) ) {
3042
-			$where .= sprintf( " AND $wpdb->posts.post_password %s ''", $q['has_password'] ? '!=' : '=' );
3041
+		} elseif (isset($q['has_password'])) {
3042
+			$where .= sprintf(" AND $wpdb->posts.post_password %s ''", $q['has_password'] ? '!=' : '=');
3043 3043
 		}
3044 3044
 
3045
-		if ( ! empty( $q['comment_status'] ) ) {
3046
-			$where .= $wpdb->prepare( " AND $wpdb->posts.comment_status = %s ", $q['comment_status'] );
3045
+		if ( ! empty($q['comment_status'])) {
3046
+			$where .= $wpdb->prepare(" AND $wpdb->posts.comment_status = %s ", $q['comment_status']);
3047 3047
 		}
3048 3048
 
3049
-		if ( ! empty( $q['ping_status'] ) )  {
3050
-			$where .= $wpdb->prepare( " AND $wpdb->posts.ping_status = %s ", $q['ping_status'] );
3049
+		if ( ! empty($q['ping_status'])) {
3050
+			$where .= $wpdb->prepare(" AND $wpdb->posts.ping_status = %s ", $q['ping_status']);
3051 3051
 		}
3052 3052
 
3053
-		if ( 'any' == $post_type ) {
3054
-			$in_search_post_types = get_post_types( array('exclude_from_search' => false) );
3055
-			if ( empty( $in_search_post_types ) )
3053
+		if ('any' == $post_type) {
3054
+			$in_search_post_types = get_post_types(array('exclude_from_search' => false));
3055
+			if (empty($in_search_post_types))
3056 3056
 				$where .= ' AND 1=0 ';
3057 3057
 			else
3058
-				$where .= " AND $wpdb->posts.post_type IN ('" . join("', '", $in_search_post_types ) . "')";
3059
-		} elseif ( !empty( $post_type ) && is_array( $post_type ) ) {
3060
-			$where .= " AND $wpdb->posts.post_type IN ('" . join("', '", $post_type) . "')";
3061
-		} elseif ( ! empty( $post_type ) ) {
3058
+				$where .= " AND $wpdb->posts.post_type IN ('".join("', '", $in_search_post_types)."')";
3059
+		} elseif ( ! empty($post_type) && is_array($post_type)) {
3060
+			$where .= " AND $wpdb->posts.post_type IN ('".join("', '", $post_type)."')";
3061
+		} elseif ( ! empty($post_type)) {
3062 3062
 			$where .= " AND $wpdb->posts.post_type = '$post_type'";
3063
-			$post_type_object = get_post_type_object ( $post_type );
3064
-		} elseif ( $this->is_attachment ) {
3063
+			$post_type_object = get_post_type_object($post_type);
3064
+		} elseif ($this->is_attachment) {
3065 3065
 			$where .= " AND $wpdb->posts.post_type = 'attachment'";
3066
-			$post_type_object = get_post_type_object ( 'attachment' );
3067
-		} elseif ( $this->is_page ) {
3066
+			$post_type_object = get_post_type_object('attachment');
3067
+		} elseif ($this->is_page) {
3068 3068
 			$where .= " AND $wpdb->posts.post_type = 'page'";
3069
-			$post_type_object = get_post_type_object ( 'page' );
3069
+			$post_type_object = get_post_type_object('page');
3070 3070
 		} else {
3071 3071
 			$where .= " AND $wpdb->posts.post_type = 'post'";
3072
-			$post_type_object = get_post_type_object ( 'post' );
3072
+			$post_type_object = get_post_type_object('post');
3073 3073
 		}
3074 3074
 
3075 3075
 		$edit_cap = 'edit_post';
3076 3076
 		$read_cap = 'read_post';
3077 3077
 
3078
-		if ( ! empty( $post_type_object ) ) {
3078
+		if ( ! empty($post_type_object)) {
3079 3079
 			$edit_others_cap = $post_type_object->cap->edit_others_posts;
3080 3080
 			$read_private_cap = $post_type_object->cap->read_private_posts;
3081 3081
 		} else {
3082
-			$edit_others_cap = 'edit_others_' . $post_type_cap . 's';
3083
-			$read_private_cap = 'read_private_' . $post_type_cap . 's';
3082
+			$edit_others_cap = 'edit_others_'.$post_type_cap.'s';
3083
+			$read_private_cap = 'read_private_'.$post_type_cap.'s';
3084 3084
 		}
3085 3085
 
3086 3086
 		$user_id = get_current_user_id();
3087 3087
 
3088 3088
 		$q_status = array();
3089
-		if ( ! empty( $q['post_status'] ) ) {
3089
+		if ( ! empty($q['post_status'])) {
3090 3090
 			$statuswheres = array();
3091 3091
 			$q_status = $q['post_status'];
3092
-			if ( ! is_array( $q_status ) )
3092
+			if ( ! is_array($q_status))
3093 3093
 				$q_status = explode(',', $q_status);
3094 3094
 			$r_status = array();
3095 3095
 			$p_status = array();
3096 3096
 			$e_status = array();
3097
-			if ( in_array( 'any', $q_status ) ) {
3098
-				foreach ( get_post_stati( array( 'exclude_from_search' => true ) ) as $status ) {
3099
-					if ( ! in_array( $status, $q_status ) ) {
3097
+			if (in_array('any', $q_status)) {
3098
+				foreach (get_post_stati(array('exclude_from_search' => true)) as $status) {
3099
+					if ( ! in_array($status, $q_status)) {
3100 3100
 						$e_status[] = "$wpdb->posts.post_status <> '$status'";
3101 3101
 					}
3102 3102
 				}
3103 3103
 			} else {
3104
-				foreach ( get_post_stati() as $status ) {
3105
-					if ( in_array( $status, $q_status ) ) {
3106
-						if ( 'private' == $status )
3104
+				foreach (get_post_stati() as $status) {
3105
+					if (in_array($status, $q_status)) {
3106
+						if ('private' == $status)
3107 3107
 							$p_status[] = "$wpdb->posts.post_status = '$status'";
3108 3108
 						else
3109 3109
 							$r_status[] = "$wpdb->posts.post_status = '$status'";
@@ -3111,58 +3111,58 @@  discard block
 block discarded – undo
3111 3111
 				}
3112 3112
 			}
3113 3113
 
3114
-			if ( empty($q['perm'] ) || 'readable' != $q['perm'] ) {
3114
+			if (empty($q['perm']) || 'readable' != $q['perm']) {
3115 3115
 				$r_status = array_merge($r_status, $p_status);
3116 3116
 				unset($p_status);
3117 3117
 			}
3118 3118
 
3119
-			if ( !empty($e_status) ) {
3120
-				$statuswheres[] = "(" . join( ' AND ', $e_status ) . ")";
3119
+			if ( ! empty($e_status)) {
3120
+				$statuswheres[] = "(".join(' AND ', $e_status).")";
3121 3121
 			}
3122
-			if ( !empty($r_status) ) {
3123
-				if ( !empty($q['perm'] ) && 'editable' == $q['perm'] && !current_user_can($edit_others_cap) )
3124
-					$statuswheres[] = "($wpdb->posts.post_author = $user_id " . "AND (" . join( ' OR ', $r_status ) . "))";
3122
+			if ( ! empty($r_status)) {
3123
+				if ( ! empty($q['perm']) && 'editable' == $q['perm'] && ! current_user_can($edit_others_cap))
3124
+					$statuswheres[] = "($wpdb->posts.post_author = $user_id "."AND (".join(' OR ', $r_status)."))";
3125 3125
 				else
3126
-					$statuswheres[] = "(" . join( ' OR ', $r_status ) . ")";
3126
+					$statuswheres[] = "(".join(' OR ', $r_status).")";
3127 3127
 			}
3128
-			if ( !empty($p_status) ) {
3129
-				if ( !empty($q['perm'] ) && 'readable' == $q['perm'] && !current_user_can($read_private_cap) )
3130
-					$statuswheres[] = "($wpdb->posts.post_author = $user_id " . "AND (" . join( ' OR ', $p_status ) . "))";
3128
+			if ( ! empty($p_status)) {
3129
+				if ( ! empty($q['perm']) && 'readable' == $q['perm'] && ! current_user_can($read_private_cap))
3130
+					$statuswheres[] = "($wpdb->posts.post_author = $user_id "."AND (".join(' OR ', $p_status)."))";
3131 3131
 				else
3132
-					$statuswheres[] = "(" . join( ' OR ', $p_status ) . ")";
3132
+					$statuswheres[] = "(".join(' OR ', $p_status).")";
3133 3133
 			}
3134
-			if ( $post_status_join ) {
3134
+			if ($post_status_join) {
3135 3135
 				$join .= " LEFT JOIN $wpdb->posts AS p2 ON ($wpdb->posts.post_parent = p2.ID) ";
3136
-				foreach ( $statuswheres as $index => $statuswhere )
3137
-					$statuswheres[$index] = "($statuswhere OR ($wpdb->posts.post_status = 'inherit' AND " . str_replace($wpdb->posts, 'p2', $statuswhere) . "))";
3136
+				foreach ($statuswheres as $index => $statuswhere)
3137
+					$statuswheres[$index] = "($statuswhere OR ($wpdb->posts.post_status = 'inherit' AND ".str_replace($wpdb->posts, 'p2', $statuswhere)."))";
3138 3138
 			}
3139
-			$where_status = implode( ' OR ', $statuswheres );
3140
-			if ( ! empty( $where_status ) ) {
3139
+			$where_status = implode(' OR ', $statuswheres);
3140
+			if ( ! empty($where_status)) {
3141 3141
 				$where .= " AND ($where_status)";
3142 3142
 			}
3143
-		} elseif ( !$this->is_singular ) {
3143
+		} elseif ( ! $this->is_singular) {
3144 3144
 			$where .= " AND ($wpdb->posts.post_status = 'publish'";
3145 3145
 
3146 3146
 			// Add public states.
3147
-			$public_states = get_post_stati( array('public' => true) );
3148
-			foreach ( (array) $public_states as $state ) {
3149
-				if ( 'publish' == $state ) // Publish is hard-coded above.
3147
+			$public_states = get_post_stati(array('public' => true));
3148
+			foreach ((array) $public_states as $state) {
3149
+				if ('publish' == $state) // Publish is hard-coded above.
3150 3150
 					continue;
3151 3151
 				$where .= " OR $wpdb->posts.post_status = '$state'";
3152 3152
 			}
3153 3153
 
3154
-			if ( $this->is_admin ) {
3154
+			if ($this->is_admin) {
3155 3155
 				// Add protected states that should show in the admin all list.
3156
-				$admin_all_states = get_post_stati( array('protected' => true, 'show_in_admin_all_list' => true) );
3157
-				foreach ( (array) $admin_all_states as $state )
3156
+				$admin_all_states = get_post_stati(array('protected' => true, 'show_in_admin_all_list' => true));
3157
+				foreach ((array) $admin_all_states as $state)
3158 3158
 					$where .= " OR $wpdb->posts.post_status = '$state'";
3159 3159
 			}
3160 3160
 
3161
-			if ( is_user_logged_in() ) {
3161
+			if (is_user_logged_in()) {
3162 3162
 				// Add private states that are limited to viewing by the author of a post or someone who has caps to read private states.
3163
-				$private_states = get_post_stati( array('private' => true) );
3164
-				foreach ( (array) $private_states as $state )
3165
-					$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'";
3163
+				$private_states = get_post_stati(array('private' => true));
3164
+				foreach ((array) $private_states as $state)
3165
+					$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'";
3166 3166
 			}
3167 3167
 
3168 3168
 			$where .= ')';
@@ -3172,7 +3172,7 @@  discard block
 block discarded – undo
3172 3172
 		 * Apply filters on where and join prior to paging so that any
3173 3173
 		 * manipulations to them are reflected in the paging by day queries.
3174 3174
 		 */
3175
-		if ( !$q['suppress_filters'] ) {
3175
+		if ( ! $q['suppress_filters']) {
3176 3176
 			/**
3177 3177
 			 * Filter the WHERE clause of the query.
3178 3178
 			 *
@@ -3181,7 +3181,7 @@  discard block
 block discarded – undo
3181 3181
 			 * @param string   $where The WHERE clause of the query.
3182 3182
 			 * @param WP_Query &$this The WP_Query instance (passed by reference).
3183 3183
 			 */
3184
-			$where = apply_filters_ref_array( 'posts_where', array( $where, &$this ) );
3184
+			$where = apply_filters_ref_array('posts_where', array($where, &$this));
3185 3185
 
3186 3186
 			/**
3187 3187
 			 * Filter the JOIN clause of the query.
@@ -3191,28 +3191,28 @@  discard block
 block discarded – undo
3191 3191
 			 * @param string   $where The JOIN clause of the query.
3192 3192
 			 * @param WP_Query &$this The WP_Query instance (passed by reference).
3193 3193
 			 */
3194
-			$join = apply_filters_ref_array( 'posts_join', array( $join, &$this ) );
3194
+			$join = apply_filters_ref_array('posts_join', array($join, &$this));
3195 3195
 		}
3196 3196
 
3197 3197
 		// Paging
3198
-		if ( empty($q['nopaging']) && !$this->is_singular ) {
3198
+		if (empty($q['nopaging']) && ! $this->is_singular) {
3199 3199
 			$page = absint($q['paged']);
3200
-			if ( !$page )
3200
+			if ( ! $page)
3201 3201
 				$page = 1;
3202 3202
 
3203 3203
 			// If 'offset' is provided, it takes precedence over 'paged'.
3204
-			if ( isset( $q['offset'] ) && is_numeric( $q['offset'] ) ) {
3205
-				$q['offset'] = absint( $q['offset'] );
3206
-				$pgstrt = $q['offset'] . ', ';
3204
+			if (isset($q['offset']) && is_numeric($q['offset'])) {
3205
+				$q['offset'] = absint($q['offset']);
3206
+				$pgstrt = $q['offset'].', ';
3207 3207
 			} else {
3208
-				$pgstrt = absint( ( $page - 1 ) * $q['posts_per_page'] ) . ', ';
3208
+				$pgstrt = absint(($page - 1) * $q['posts_per_page']).', ';
3209 3209
 			}
3210
-			$limits = 'LIMIT ' . $pgstrt . $q['posts_per_page'];
3210
+			$limits = 'LIMIT '.$pgstrt.$q['posts_per_page'];
3211 3211
 		}
3212 3212
 
3213 3213
 		// Comments feeds
3214
-		if ( $this->is_comment_feed && ! $this->is_singular ) {
3215
-			if ( $this->is_archive || $this->is_search ) {
3214
+		if ($this->is_comment_feed && ! $this->is_singular) {
3215
+			if ($this->is_archive || $this->is_search) {
3216 3216
 				$cjoin = "JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID = $wpdb->posts.ID) $join ";
3217 3217
 				$cwhere = "WHERE comment_approved = '1' $where";
3218 3218
 				$cgroupby = "$wpdb->comments.comment_id";
@@ -3222,7 +3222,7 @@  discard block
 block discarded – undo
3222 3222
 				$cgroupby = '';
3223 3223
 			}
3224 3224
 
3225
-			if ( !$q['suppress_filters'] ) {
3225
+			if ( ! $q['suppress_filters']) {
3226 3226
 				/**
3227 3227
 				 * Filter the JOIN clause of the comments feed query before sending.
3228 3228
 				 *
@@ -3231,7 +3231,7 @@  discard block
 block discarded – undo
3231 3231
 				 * @param string   $cjoin The JOIN clause of the query.
3232 3232
 				 * @param WP_Query &$this The WP_Query instance (passed by reference).
3233 3233
 				 */
3234
-				$cjoin = apply_filters_ref_array( 'comment_feed_join', array( $cjoin, &$this ) );
3234
+				$cjoin = apply_filters_ref_array('comment_feed_join', array($cjoin, &$this));
3235 3235
 
3236 3236
 				/**
3237 3237
 				 * Filter the WHERE clause of the comments feed query before sending.
@@ -3241,7 +3241,7 @@  discard block
 block discarded – undo
3241 3241
 				 * @param string   $cwhere The WHERE clause of the query.
3242 3242
 				 * @param WP_Query &$this  The WP_Query instance (passed by reference).
3243 3243
 				 */
3244
-				$cwhere = apply_filters_ref_array( 'comment_feed_where', array( $cwhere, &$this ) );
3244
+				$cwhere = apply_filters_ref_array('comment_feed_where', array($cwhere, &$this));
3245 3245
 
3246 3246
 				/**
3247 3247
 				 * Filter the GROUP BY clause of the comments feed query before sending.
@@ -3251,7 +3251,7 @@  discard block
 block discarded – undo
3251 3251
 				 * @param string   $cgroupby The GROUP BY clause of the query.
3252 3252
 				 * @param WP_Query &$this    The WP_Query instance (passed by reference).
3253 3253
 				 */
3254
-				$cgroupby = apply_filters_ref_array( 'comment_feed_groupby', array( $cgroupby, &$this ) );
3254
+				$cgroupby = apply_filters_ref_array('comment_feed_groupby', array($cgroupby, &$this));
3255 3255
 
3256 3256
 				/**
3257 3257
 				 * Filter the ORDER BY clause of the comments feed query before sending.
@@ -3261,7 +3261,7 @@  discard block
 block discarded – undo
3261 3261
 				 * @param string   $corderby The ORDER BY clause of the query.
3262 3262
 				 * @param WP_Query &$this    The WP_Query instance (passed by reference).
3263 3263
 				 */
3264
-				$corderby = apply_filters_ref_array( 'comment_feed_orderby', array( 'comment_date_gmt DESC', &$this ) );
3264
+				$corderby = apply_filters_ref_array('comment_feed_orderby', array('comment_date_gmt DESC', &$this));
3265 3265
 
3266 3266
 				/**
3267 3267
 				 * Filter the LIMIT clause of the comments feed query before sending.
@@ -3271,36 +3271,36 @@  discard block
 block discarded – undo
3271 3271
 				 * @param string   $climits The JOIN clause of the query.
3272 3272
 				 * @param WP_Query &$this   The WP_Query instance (passed by reference).
3273 3273
 				 */
3274
-				$climits = apply_filters_ref_array( 'comment_feed_limits', array( 'LIMIT ' . get_option('posts_per_rss'), &$this ) );
3274
+				$climits = apply_filters_ref_array('comment_feed_limits', array('LIMIT '.get_option('posts_per_rss'), &$this));
3275 3275
 			}
3276
-			$cgroupby = ( ! empty( $cgroupby ) ) ? 'GROUP BY ' . $cgroupby : '';
3277
-			$corderby = ( ! empty( $corderby ) ) ? 'ORDER BY ' . $corderby : '';
3276
+			$cgroupby = ( ! empty($cgroupby)) ? 'GROUP BY '.$cgroupby : '';
3277
+			$corderby = ( ! empty($corderby)) ? 'ORDER BY '.$corderby : '';
3278 3278
 
3279 3279
 			$comments = (array) $wpdb->get_results("SELECT $distinct $wpdb->comments.* FROM $wpdb->comments $cjoin $cwhere $cgroupby $corderby $climits");
3280 3280
 			// Convert to WP_Comment
3281
-			$this->comments = array_map( 'get_comment', $comments );
3281
+			$this->comments = array_map('get_comment', $comments);
3282 3282
 			$this->comment_count = count($this->comments);
3283 3283
 
3284 3284
 			$post_ids = array();
3285 3285
 
3286
-			foreach ( $this->comments as $comment )
3286
+			foreach ($this->comments as $comment)
3287 3287
 				$post_ids[] = (int) $comment->comment_post_ID;
3288 3288
 
3289 3289
 			$post_ids = join(',', $post_ids);
3290 3290
 			$join = '';
3291
-			if ( $post_ids )
3291
+			if ($post_ids)
3292 3292
 				$where = "AND $wpdb->posts.ID IN ($post_ids) ";
3293 3293
 			else
3294 3294
 				$where = "AND 0";
3295 3295
 		}
3296 3296
 
3297
-		$pieces = array( 'where', 'groupby', 'join', 'orderby', 'distinct', 'fields', 'limits' );
3297
+		$pieces = array('where', 'groupby', 'join', 'orderby', 'distinct', 'fields', 'limits');
3298 3298
 
3299 3299
 		/*
3300 3300
 		 * Apply post-paging filters on where and join. Only plugins that
3301 3301
 		 * manipulate paging queries should use these hooks.
3302 3302
 		 */
3303
-		if ( !$q['suppress_filters'] ) {
3303
+		if ( ! $q['suppress_filters']) {
3304 3304
 			/**
3305 3305
 			 * Filter the WHERE clause of the query.
3306 3306
 			 *
@@ -3311,7 +3311,7 @@  discard block
 block discarded – undo
3311 3311
 			 * @param string   $where The WHERE clause of the query.
3312 3312
 			 * @param WP_Query &$this The WP_Query instance (passed by reference).
3313 3313
 			 */
3314
-			$where = apply_filters_ref_array( 'posts_where_paged', array( $where, &$this ) );
3314
+			$where = apply_filters_ref_array('posts_where_paged', array($where, &$this));
3315 3315
 
3316 3316
 			/**
3317 3317
 			 * Filter the GROUP BY clause of the query.
@@ -3321,7 +3321,7 @@  discard block
 block discarded – undo
3321 3321
 			 * @param string   $groupby The GROUP BY clause of the query.
3322 3322
 			 * @param WP_Query &$this   The WP_Query instance (passed by reference).
3323 3323
 			 */
3324
-			$groupby = apply_filters_ref_array( 'posts_groupby', array( $groupby, &$this ) );
3324
+			$groupby = apply_filters_ref_array('posts_groupby', array($groupby, &$this));
3325 3325
 
3326 3326
 			/**
3327 3327
 			 * Filter the JOIN clause of the query.
@@ -3333,7 +3333,7 @@  discard block
 block discarded – undo
3333 3333
 			 * @param string   $join  The JOIN clause of the query.
3334 3334
 			 * @param WP_Query &$this The WP_Query instance (passed by reference).
3335 3335
 			 */
3336
-			$join = apply_filters_ref_array( 'posts_join_paged', array( $join, &$this ) );
3336
+			$join = apply_filters_ref_array('posts_join_paged', array($join, &$this));
3337 3337
 
3338 3338
 			/**
3339 3339
 			 * Filter the ORDER BY clause of the query.
@@ -3343,7 +3343,7 @@  discard block
 block discarded – undo
3343 3343
 			 * @param string   $orderby The ORDER BY clause of the query.
3344 3344
 			 * @param WP_Query &$this   The WP_Query instance (passed by reference).
3345 3345
 			 */
3346
-			$orderby = apply_filters_ref_array( 'posts_orderby', array( $orderby, &$this ) );
3346
+			$orderby = apply_filters_ref_array('posts_orderby', array($orderby, &$this));
3347 3347
 
3348 3348
 			/**
3349 3349
 			 * Filter the DISTINCT clause of the query.
@@ -3353,7 +3353,7 @@  discard block
 block discarded – undo
3353 3353
 			 * @param string   $distinct The DISTINCT clause of the query.
3354 3354
 			 * @param WP_Query &$this    The WP_Query instance (passed by reference).
3355 3355
 			 */
3356
-			$distinct = apply_filters_ref_array( 'posts_distinct', array( $distinct, &$this ) );
3356
+			$distinct = apply_filters_ref_array('posts_distinct', array($distinct, &$this));
3357 3357
 
3358 3358
 			/**
3359 3359
 			 * Filter the LIMIT clause of the query.
@@ -3363,7 +3363,7 @@  discard block
 block discarded – undo
3363 3363
 			 * @param string   $limits The LIMIT clause of the query.
3364 3364
 			 * @param WP_Query &$this  The WP_Query instance (passed by reference).
3365 3365
 			 */
3366
-			$limits = apply_filters_ref_array( 'post_limits', array( $limits, &$this ) );
3366
+			$limits = apply_filters_ref_array('post_limits', array($limits, &$this));
3367 3367
 
3368 3368
 			/**
3369 3369
 			 * Filter the SELECT clause of the query.
@@ -3373,7 +3373,7 @@  discard block
 block discarded – undo
3373 3373
 			 * @param string   $fields The SELECT clause of the query.
3374 3374
 			 * @param WP_Query &$this  The WP_Query instance (passed by reference).
3375 3375
 			 */
3376
-			$fields = apply_filters_ref_array( 'posts_fields', array( $fields, &$this ) );
3376
+			$fields = apply_filters_ref_array('posts_fields', array($fields, &$this));
3377 3377
 
3378 3378
 			/**
3379 3379
 			 * Filter all query clauses at once, for convenience.
@@ -3386,15 +3386,15 @@  discard block
 block discarded – undo
3386 3386
 			 * @param array    $clauses The list of clauses for the query.
3387 3387
 			 * @param WP_Query &$this   The WP_Query instance (passed by reference).
3388 3388
 			 */
3389
-			$clauses = (array) apply_filters_ref_array( 'posts_clauses', array( compact( $pieces ), &$this ) );
3390
-
3391
-			$where = isset( $clauses[ 'where' ] ) ? $clauses[ 'where' ] : '';
3392
-			$groupby = isset( $clauses[ 'groupby' ] ) ? $clauses[ 'groupby' ] : '';
3393
-			$join = isset( $clauses[ 'join' ] ) ? $clauses[ 'join' ] : '';
3394
-			$orderby = isset( $clauses[ 'orderby' ] ) ? $clauses[ 'orderby' ] : '';
3395
-			$distinct = isset( $clauses[ 'distinct' ] ) ? $clauses[ 'distinct' ] : '';
3396
-			$fields = isset( $clauses[ 'fields' ] ) ? $clauses[ 'fields' ] : '';
3397
-			$limits = isset( $clauses[ 'limits' ] ) ? $clauses[ 'limits' ] : '';
3389
+			$clauses = (array) apply_filters_ref_array('posts_clauses', array(compact($pieces), &$this));
3390
+
3391
+			$where = isset($clauses['where']) ? $clauses['where'] : '';
3392
+			$groupby = isset($clauses['groupby']) ? $clauses['groupby'] : '';
3393
+			$join = isset($clauses['join']) ? $clauses['join'] : '';
3394
+			$orderby = isset($clauses['orderby']) ? $clauses['orderby'] : '';
3395
+			$distinct = isset($clauses['distinct']) ? $clauses['distinct'] : '';
3396
+			$fields = isset($clauses['fields']) ? $clauses['fields'] : '';
3397
+			$limits = isset($clauses['limits']) ? $clauses['limits'] : '';
3398 3398
 		}
3399 3399
 
3400 3400
 		/**
@@ -3406,13 +3406,13 @@  discard block
 block discarded – undo
3406 3406
 		 *
3407 3407
 		 * @param string $selection The assembled selection query.
3408 3408
 		 */
3409
-		do_action( 'posts_selection', $where . $groupby . $orderby . $limits . $join );
3409
+		do_action('posts_selection', $where.$groupby.$orderby.$limits.$join);
3410 3410
 
3411 3411
 		/*
3412 3412
 		 * Filter again for the benefit of caching plugins.
3413 3413
 		 * Regular plugins should use the hooks above.
3414 3414
 		 */
3415
-		if ( !$q['suppress_filters'] ) {
3415
+		if ( ! $q['suppress_filters']) {
3416 3416
 			/**
3417 3417
 			 * Filter the WHERE clause of the query.
3418 3418
 			 *
@@ -3423,7 +3423,7 @@  discard block
 block discarded – undo
3423 3423
 			 * @param string   $where The WHERE clause of the query.
3424 3424
 			 * @param WP_Query &$this The WP_Query instance (passed by reference).
3425 3425
 			 */
3426
-			$where = apply_filters_ref_array( 'posts_where_request', array( $where, &$this ) );
3426
+			$where = apply_filters_ref_array('posts_where_request', array($where, &$this));
3427 3427
 
3428 3428
 			/**
3429 3429
 			 * Filter the GROUP BY clause of the query.
@@ -3435,7 +3435,7 @@  discard block
 block discarded – undo
3435 3435
 			 * @param string   $groupby The GROUP BY clause of the query.
3436 3436
 			 * @param WP_Query &$this   The WP_Query instance (passed by reference).
3437 3437
 			 */
3438
-			$groupby = apply_filters_ref_array( 'posts_groupby_request', array( $groupby, &$this ) );
3438
+			$groupby = apply_filters_ref_array('posts_groupby_request', array($groupby, &$this));
3439 3439
 
3440 3440
 			/**
3441 3441
 			 * Filter the JOIN clause of the query.
@@ -3447,7 +3447,7 @@  discard block
 block discarded – undo
3447 3447
 			 * @param string   $join  The JOIN clause of the query.
3448 3448
 			 * @param WP_Query &$this The WP_Query instance (passed by reference).
3449 3449
 			 */
3450
-			$join = apply_filters_ref_array( 'posts_join_request', array( $join, &$this ) );
3450
+			$join = apply_filters_ref_array('posts_join_request', array($join, &$this));
3451 3451
 
3452 3452
 			/**
3453 3453
 			 * Filter the ORDER BY clause of the query.
@@ -3459,7 +3459,7 @@  discard block
 block discarded – undo
3459 3459
 			 * @param string   $orderby The ORDER BY clause of the query.
3460 3460
 			 * @param WP_Query &$this   The WP_Query instance (passed by reference).
3461 3461
 			 */
3462
-			$orderby = apply_filters_ref_array( 'posts_orderby_request', array( $orderby, &$this ) );
3462
+			$orderby = apply_filters_ref_array('posts_orderby_request', array($orderby, &$this));
3463 3463
 
3464 3464
 			/**
3465 3465
 			 * Filter the DISTINCT clause of the query.
@@ -3471,7 +3471,7 @@  discard block
 block discarded – undo
3471 3471
 			 * @param string   $distinct The DISTINCT clause of the query.
3472 3472
 			 * @param WP_Query &$this    The WP_Query instance (passed by reference).
3473 3473
 			 */
3474
-			$distinct = apply_filters_ref_array( 'posts_distinct_request', array( $distinct, &$this ) );
3474
+			$distinct = apply_filters_ref_array('posts_distinct_request', array($distinct, &$this));
3475 3475
 
3476 3476
 			/**
3477 3477
 			 * Filter the SELECT clause of the query.
@@ -3483,7 +3483,7 @@  discard block
 block discarded – undo
3483 3483
 			 * @param string   $fields The SELECT clause of the query.
3484 3484
 			 * @param WP_Query &$this  The WP_Query instance (passed by reference).
3485 3485
 			 */
3486
-			$fields = apply_filters_ref_array( 'posts_fields_request', array( $fields, &$this ) );
3486
+			$fields = apply_filters_ref_array('posts_fields_request', array($fields, &$this));
3487 3487
 
3488 3488
 			/**
3489 3489
 			 * Filter the LIMIT clause of the query.
@@ -3495,7 +3495,7 @@  discard block
 block discarded – undo
3495 3495
 			 * @param string   $limits The LIMIT clause of the query.
3496 3496
 			 * @param WP_Query &$this  The WP_Query instance (passed by reference).
3497 3497
 			 */
3498
-			$limits = apply_filters_ref_array( 'post_limits_request', array( $limits, &$this ) );
3498
+			$limits = apply_filters_ref_array('post_limits_request', array($limits, &$this));
3499 3499
 
3500 3500
 			/**
3501 3501
 			 * Filter all query clauses at once, for convenience.
@@ -3510,29 +3510,29 @@  discard block
 block discarded – undo
3510 3510
 			 * @param array    $pieces The pieces of the query.
3511 3511
 			 * @param WP_Query &$this  The WP_Query instance (passed by reference).
3512 3512
 			 */
3513
-			$clauses = (array) apply_filters_ref_array( 'posts_clauses_request', array( compact( $pieces ), &$this ) );
3514
-
3515
-			$where = isset( $clauses[ 'where' ] ) ? $clauses[ 'where' ] : '';
3516
-			$groupby = isset( $clauses[ 'groupby' ] ) ? $clauses[ 'groupby' ] : '';
3517
-			$join = isset( $clauses[ 'join' ] ) ? $clauses[ 'join' ] : '';
3518
-			$orderby = isset( $clauses[ 'orderby' ] ) ? $clauses[ 'orderby' ] : '';
3519
-			$distinct = isset( $clauses[ 'distinct' ] ) ? $clauses[ 'distinct' ] : '';
3520
-			$fields = isset( $clauses[ 'fields' ] ) ? $clauses[ 'fields' ] : '';
3521
-			$limits = isset( $clauses[ 'limits' ] ) ? $clauses[ 'limits' ] : '';
3513
+			$clauses = (array) apply_filters_ref_array('posts_clauses_request', array(compact($pieces), &$this));
3514
+
3515
+			$where = isset($clauses['where']) ? $clauses['where'] : '';
3516
+			$groupby = isset($clauses['groupby']) ? $clauses['groupby'] : '';
3517
+			$join = isset($clauses['join']) ? $clauses['join'] : '';
3518
+			$orderby = isset($clauses['orderby']) ? $clauses['orderby'] : '';
3519
+			$distinct = isset($clauses['distinct']) ? $clauses['distinct'] : '';
3520
+			$fields = isset($clauses['fields']) ? $clauses['fields'] : '';
3521
+			$limits = isset($clauses['limits']) ? $clauses['limits'] : '';
3522 3522
 		}
3523 3523
 
3524
-		if ( ! empty($groupby) )
3525
-			$groupby = 'GROUP BY ' . $groupby;
3526
-		if ( !empty( $orderby ) )
3527
-			$orderby = 'ORDER BY ' . $orderby;
3524
+		if ( ! empty($groupby))
3525
+			$groupby = 'GROUP BY '.$groupby;
3526
+		if ( ! empty($orderby))
3527
+			$orderby = 'ORDER BY '.$orderby;
3528 3528
 
3529 3529
 		$found_rows = '';
3530
-		if ( !$q['no_found_rows'] && !empty($limits) )
3530
+		if ( ! $q['no_found_rows'] && ! empty($limits))
3531 3531
 			$found_rows = 'SQL_CALC_FOUND_ROWS';
3532 3532
 
3533 3533
 		$this->request = $old_request = "SELECT $found_rows $distinct $fields FROM $wpdb->posts $join WHERE 1=1 $where $groupby $orderby $limits";
3534 3534
 
3535
-		if ( !$q['suppress_filters'] ) {
3535
+		if ( ! $q['suppress_filters']) {
3536 3536
 			/**
3537 3537
 			 * Filter the completed SQL query before sending.
3538 3538
 			 *
@@ -3541,35 +3541,35 @@  discard block
 block discarded – undo
3541 3541
 			 * @param array    $request The complete SQL query.
3542 3542
 			 * @param WP_Query &$this   The WP_Query instance (passed by reference).
3543 3543
 			 */
3544
-			$this->request = apply_filters_ref_array( 'posts_request', array( $this->request, &$this ) );
3544
+			$this->request = apply_filters_ref_array('posts_request', array($this->request, &$this));
3545 3545
 		}
3546 3546
 
3547
-		if ( 'ids' == $q['fields'] ) {
3548
-			$this->posts = $wpdb->get_col( $this->request );
3549
-			$this->posts = array_map( 'intval', $this->posts );
3550
-			$this->post_count = count( $this->posts );
3551
-			$this->set_found_posts( $q, $limits );
3547
+		if ('ids' == $q['fields']) {
3548
+			$this->posts = $wpdb->get_col($this->request);
3549
+			$this->posts = array_map('intval', $this->posts);
3550
+			$this->post_count = count($this->posts);
3551
+			$this->set_found_posts($q, $limits);
3552 3552
 
3553 3553
 			return $this->posts;
3554 3554
 		}
3555 3555
 
3556
-		if ( 'id=>parent' == $q['fields'] ) {
3557
-			$this->posts = $wpdb->get_results( $this->request );
3558
-			$this->post_count = count( $this->posts );
3559
-			$this->set_found_posts( $q, $limits );
3556
+		if ('id=>parent' == $q['fields']) {
3557
+			$this->posts = $wpdb->get_results($this->request);
3558
+			$this->post_count = count($this->posts);
3559
+			$this->set_found_posts($q, $limits);
3560 3560
 
3561 3561
 			$r = array();
3562
-			foreach ( $this->posts as $key => $post ) {
3563
-				$this->posts[ $key ]->ID = (int) $post->ID;
3564
-				$this->posts[ $key ]->post_parent = (int) $post->post_parent;
3562
+			foreach ($this->posts as $key => $post) {
3563
+				$this->posts[$key]->ID = (int) $post->ID;
3564
+				$this->posts[$key]->post_parent = (int) $post->post_parent;
3565 3565
 
3566
-				$r[ (int) $post->ID ] = (int) $post->post_parent;
3566
+				$r[(int) $post->ID] = (int) $post->post_parent;
3567 3567
 			}
3568 3568
 
3569 3569
 			return $r;
3570 3570
 		}
3571 3571
 
3572
-		$split_the_query = ( $old_request == $this->request && "$wpdb->posts.*" == $fields && !empty( $limits ) && $q['posts_per_page'] < 500 );
3572
+		$split_the_query = ($old_request == $this->request && "$wpdb->posts.*" == $fields && ! empty($limits) && $q['posts_per_page'] < 500);
3573 3573
 
3574 3574
 		/**
3575 3575
 		 * Filter whether to split the query.
@@ -3583,9 +3583,9 @@  discard block
 block discarded – undo
3583 3583
 		 * @param bool     $split_the_query Whether or not to split the query.
3584 3584
 		 * @param WP_Query $this            The WP_Query instance.
3585 3585
 		 */
3586
-		$split_the_query = apply_filters( 'split_the_query', $split_the_query, $this );
3586
+		$split_the_query = apply_filters('split_the_query', $split_the_query, $this);
3587 3587
 
3588
-		if ( $split_the_query ) {
3588
+		if ($split_the_query) {
3589 3589
 			// First get the IDs and then fill in the objects
3590 3590
 
3591 3591
 			$this->request = "SELECT $found_rows $distinct $wpdb->posts.ID FROM $wpdb->posts $join WHERE 1=1 $where $groupby $orderby $limits";
@@ -3598,27 +3598,27 @@  discard block
 block discarded – undo
3598 3598
 			 * @param string   $request The post ID request.
3599 3599
 			 * @param WP_Query $this    The WP_Query instance.
3600 3600
 			 */
3601
-			$this->request = apply_filters( 'posts_request_ids', $this->request, $this );
3601
+			$this->request = apply_filters('posts_request_ids', $this->request, $this);
3602 3602
 
3603
-			$ids = $wpdb->get_col( $this->request );
3603
+			$ids = $wpdb->get_col($this->request);
3604 3604
 
3605
-			if ( $ids ) {
3605
+			if ($ids) {
3606 3606
 				$this->posts = $ids;
3607
-				$this->set_found_posts( $q, $limits );
3608
-				_prime_post_caches( $ids, $q['update_post_term_cache'], $q['update_post_meta_cache'] );
3607
+				$this->set_found_posts($q, $limits);
3608
+				_prime_post_caches($ids, $q['update_post_term_cache'], $q['update_post_meta_cache']);
3609 3609
 			} else {
3610 3610
 				$this->posts = array();
3611 3611
 			}
3612 3612
 		} else {
3613
-			$this->posts = $wpdb->get_results( $this->request );
3614
-			$this->set_found_posts( $q, $limits );
3613
+			$this->posts = $wpdb->get_results($this->request);
3614
+			$this->set_found_posts($q, $limits);
3615 3615
 		}
3616 3616
 
3617 3617
 		// Convert to WP_Post objects
3618
-		if ( $this->posts )
3619
-			$this->posts = array_map( 'get_post', $this->posts );
3618
+		if ($this->posts)
3619
+			$this->posts = array_map('get_post', $this->posts);
3620 3620
 
3621
-		if ( ! $q['suppress_filters'] ) {
3621
+		if ( ! $q['suppress_filters']) {
3622 3622
 			/**
3623 3623
 			 * Filter the raw post results array, prior to status checks.
3624 3624
 			 *
@@ -3627,38 +3627,38 @@  discard block
 block discarded – undo
3627 3627
 			 * @param array    $posts The post results array.
3628 3628
 			 * @param WP_Query &$this The WP_Query instance (passed by reference).
3629 3629
 			 */
3630
-			$this->posts = apply_filters_ref_array( 'posts_results', array( $this->posts, &$this ) );
3630
+			$this->posts = apply_filters_ref_array('posts_results', array($this->posts, &$this));
3631 3631
 		}
3632 3632
 
3633
-		if ( !empty($this->posts) && $this->is_comment_feed && $this->is_singular ) {
3633
+		if ( ! empty($this->posts) && $this->is_comment_feed && $this->is_singular) {
3634 3634
 			/** This filter is documented in wp-includes/query.php */
3635
-			$cjoin = apply_filters_ref_array( 'comment_feed_join', array( '', &$this ) );
3635
+			$cjoin = apply_filters_ref_array('comment_feed_join', array('', &$this));
3636 3636
 
3637 3637
 			/** This filter is documented in wp-includes/query.php */
3638
-			$cwhere = apply_filters_ref_array( 'comment_feed_where', array( "WHERE comment_post_ID = '{$this->posts[0]->ID}' AND comment_approved = '1'", &$this ) );
3638
+			$cwhere = apply_filters_ref_array('comment_feed_where', array("WHERE comment_post_ID = '{$this->posts[0]->ID}' AND comment_approved = '1'", &$this));
3639 3639
 
3640 3640
 			/** This filter is documented in wp-includes/query.php */
3641
-			$cgroupby = apply_filters_ref_array( 'comment_feed_groupby', array( '', &$this ) );
3642
-			$cgroupby = ( ! empty( $cgroupby ) ) ? 'GROUP BY ' . $cgroupby : '';
3641
+			$cgroupby = apply_filters_ref_array('comment_feed_groupby', array('', &$this));
3642
+			$cgroupby = ( ! empty($cgroupby)) ? 'GROUP BY '.$cgroupby : '';
3643 3643
 
3644 3644
 			/** This filter is documented in wp-includes/query.php */
3645
-			$corderby = apply_filters_ref_array( 'comment_feed_orderby', array( 'comment_date_gmt DESC', &$this ) );
3646
-			$corderby = ( ! empty( $corderby ) ) ? 'ORDER BY ' . $corderby : '';
3645
+			$corderby = apply_filters_ref_array('comment_feed_orderby', array('comment_date_gmt DESC', &$this));
3646
+			$corderby = ( ! empty($corderby)) ? 'ORDER BY '.$corderby : '';
3647 3647
 
3648 3648
 			/** This filter is documented in wp-includes/query.php */
3649
-			$climits = apply_filters_ref_array( 'comment_feed_limits', array( 'LIMIT ' . get_option('posts_per_rss'), &$this ) );
3649
+			$climits = apply_filters_ref_array('comment_feed_limits', array('LIMIT '.get_option('posts_per_rss'), &$this));
3650 3650
 
3651 3651
 			$comments_request = "SELECT $wpdb->comments.* FROM $wpdb->comments $cjoin $cwhere $cgroupby $corderby $climits";
3652 3652
 			$comments = $wpdb->get_results($comments_request);
3653 3653
 			// Convert to WP_Comment
3654
-			$this->comments = array_map( 'get_comment', $comments );
3654
+			$this->comments = array_map('get_comment', $comments);
3655 3655
 			$this->comment_count = count($this->comments);
3656 3656
 		}
3657 3657
 
3658 3658
 		// Check post status to determine if post should be displayed.
3659
-		if ( !empty($this->posts) && ($this->is_single || $this->is_page) ) {
3659
+		if ( ! empty($this->posts) && ($this->is_single || $this->is_page)) {
3660 3660
 			$status = get_post_status($this->posts[0]);
3661
-			if ( 'attachment' === $this->posts[0]->post_type && 0 === (int) $this->posts[0]->post_parent ) {
3661
+			if ('attachment' === $this->posts[0]->post_type && 0 === (int) $this->posts[0]->post_parent) {
3662 3662
 				$this->is_page = false;
3663 3663
 				$this->is_single = true;
3664 3664
 				$this->is_attachment = true;
@@ -3666,23 +3666,23 @@  discard block
 block discarded – undo
3666 3666
 			$post_status_obj = get_post_status_object($status);
3667 3667
 
3668 3668
 			// If the post_status was specifically requested, let it pass through.
3669
-			if ( !$post_status_obj->public && ! in_array( $status, $q_status ) ) {
3669
+			if ( ! $post_status_obj->public && ! in_array($status, $q_status)) {
3670 3670
 
3671
-				if ( ! is_user_logged_in() ) {
3671
+				if ( ! is_user_logged_in()) {
3672 3672
 					// User must be logged in to view unpublished posts.
3673 3673
 					$this->posts = array();
3674 3674
 				} else {
3675
-					if  ( $post_status_obj->protected ) {
3675
+					if ($post_status_obj->protected) {
3676 3676
 						// User must have edit permissions on the draft to preview.
3677
-						if ( ! current_user_can($edit_cap, $this->posts[0]->ID) ) {
3677
+						if ( ! current_user_can($edit_cap, $this->posts[0]->ID)) {
3678 3678
 							$this->posts = array();
3679 3679
 						} else {
3680 3680
 							$this->is_preview = true;
3681
-							if ( 'future' != $status )
3681
+							if ('future' != $status)
3682 3682
 								$this->posts[0]->post_date = current_time('mysql');
3683 3683
 						}
3684
-					} elseif ( $post_status_obj->private ) {
3685
-						if ( ! current_user_can($read_cap, $this->posts[0]->ID) )
3684
+					} elseif ($post_status_obj->private) {
3685
+						if ( ! current_user_can($read_cap, $this->posts[0]->ID))
3686 3686
 							$this->posts = array();
3687 3687
 					} else {
3688 3688
 						$this->posts = array();
@@ -3690,7 +3690,7 @@  discard block
 block discarded – undo
3690 3690
 				}
3691 3691
 			}
3692 3692
 
3693
-			if ( $this->is_preview && $this->posts && current_user_can( $edit_cap, $this->posts[0]->ID ) ) {
3693
+			if ($this->is_preview && $this->posts && current_user_can($edit_cap, $this->posts[0]->ID)) {
3694 3694
 				/**
3695 3695
 				 * Filter the single post for preview mode.
3696 3696
 				 *
@@ -3699,18 +3699,18 @@  discard block
 block discarded – undo
3699 3699
 				 * @param WP_Post  $post_preview  The Post object.
3700 3700
 				 * @param WP_Query &$this         The WP_Query instance (passed by reference).
3701 3701
 				 */
3702
-				$this->posts[0] = get_post( apply_filters_ref_array( 'the_preview', array( $this->posts[0], &$this ) ) );
3702
+				$this->posts[0] = get_post(apply_filters_ref_array('the_preview', array($this->posts[0], &$this)));
3703 3703
 			}
3704 3704
 		}
3705 3705
 
3706 3706
 		// Put sticky posts at the top of the posts array
3707 3707
 		$sticky_posts = get_option('sticky_posts');
3708
-		if ( $this->is_home && $page <= 1 && is_array($sticky_posts) && !empty($sticky_posts) && !$q['ignore_sticky_posts'] ) {
3708
+		if ($this->is_home && $page <= 1 && is_array($sticky_posts) && ! empty($sticky_posts) && ! $q['ignore_sticky_posts']) {
3709 3709
 			$num_posts = count($this->posts);
3710 3710
 			$sticky_offset = 0;
3711 3711
 			// Loop over posts and relocate stickies to the front.
3712
-			for ( $i = 0; $i < $num_posts; $i++ ) {
3713
-				if ( in_array($this->posts[$i]->ID, $sticky_posts) ) {
3712
+			for ($i = 0; $i < $num_posts; $i++) {
3713
+				if (in_array($this->posts[$i]->ID, $sticky_posts)) {
3714 3714
 					$sticky_post = $this->posts[$i];
3715 3715
 					// Remove sticky from current position
3716 3716
 					array_splice($this->posts, $i, 1);
@@ -3720,36 +3720,36 @@  discard block
 block discarded – undo
3720 3720
 					$sticky_offset++;
3721 3721
 					// Remove post from sticky posts array
3722 3722
 					$offset = array_search($sticky_post->ID, $sticky_posts);
3723
-					unset( $sticky_posts[$offset] );
3723
+					unset($sticky_posts[$offset]);
3724 3724
 				}
3725 3725
 			}
3726 3726
 
3727 3727
 			// If any posts have been excluded specifically, Ignore those that are sticky.
3728
-			if ( !empty($sticky_posts) && !empty($q['post__not_in']) )
3728
+			if ( ! empty($sticky_posts) && ! empty($q['post__not_in']))
3729 3729
 				$sticky_posts = array_diff($sticky_posts, $q['post__not_in']);
3730 3730
 
3731 3731
 			// Fetch sticky posts that weren't in the query results
3732
-			if ( !empty($sticky_posts) ) {
3733
-				$stickies = get_posts( array(
3732
+			if ( ! empty($sticky_posts)) {
3733
+				$stickies = get_posts(array(
3734 3734
 					'post__in' => $sticky_posts,
3735 3735
 					'post_type' => $post_type,
3736 3736
 					'post_status' => 'publish',
3737 3737
 					'nopaging' => true
3738
-				) );
3738
+				));
3739 3739
 
3740
-				foreach ( $stickies as $sticky_post ) {
3741
-					array_splice( $this->posts, $sticky_offset, 0, array( $sticky_post ) );
3740
+				foreach ($stickies as $sticky_post) {
3741
+					array_splice($this->posts, $sticky_offset, 0, array($sticky_post));
3742 3742
 					$sticky_offset++;
3743 3743
 				}
3744 3744
 			}
3745 3745
 		}
3746 3746
 
3747 3747
 		// If comments have been fetched as part of the query, make sure comment meta lazy-loading is set up.
3748
-		if ( ! empty( $this->comments ) ) {
3749
-			wp_queue_comments_for_comment_meta_lazyload( $this->comments );
3748
+		if ( ! empty($this->comments)) {
3749
+			wp_queue_comments_for_comment_meta_lazyload($this->comments);
3750 3750
 		}
3751 3751
 
3752
-		if ( ! $q['suppress_filters'] ) {
3752
+		if ( ! $q['suppress_filters']) {
3753 3753
 			/**
3754 3754
 			 * Filter the array of retrieved posts after they've been fetched and
3755 3755
 			 * internally processed.
@@ -3759,27 +3759,27 @@  discard block
 block discarded – undo
3759 3759
 			 * @param array    $posts The array of retrieved posts.
3760 3760
 			 * @param WP_Query &$this The WP_Query instance (passed by reference).
3761 3761
 			 */
3762
-			$this->posts = apply_filters_ref_array( 'the_posts', array( $this->posts, &$this ) );
3762
+			$this->posts = apply_filters_ref_array('the_posts', array($this->posts, &$this));
3763 3763
 		}
3764 3764
 
3765 3765
 		// Ensure that any posts added/modified via one of the filters above are
3766 3766
 		// of the type WP_Post and are filtered.
3767
-		if ( $this->posts ) {
3768
-			$this->post_count = count( $this->posts );
3767
+		if ($this->posts) {
3768
+			$this->post_count = count($this->posts);
3769 3769
 
3770
-			$this->posts = array_map( 'get_post', $this->posts );
3770
+			$this->posts = array_map('get_post', $this->posts);
3771 3771
 
3772
-			if ( $q['cache_results'] )
3772
+			if ($q['cache_results'])
3773 3773
 				update_post_caches($this->posts, $post_type, $q['update_post_term_cache'], $q['update_post_meta_cache']);
3774 3774
 
3775
-			$this->post = reset( $this->posts );
3775
+			$this->post = reset($this->posts);
3776 3776
 		} else {
3777 3777
 			$this->post_count = 0;
3778 3778
 			$this->posts = array();
3779 3779
 		}
3780 3780
 
3781
-		if ( $q['update_post_term_cache'] ) {
3782
-			wp_queue_posts_for_term_meta_lazyload( $this->posts );
3781
+		if ($q['update_post_term_cache']) {
3782
+			wp_queue_posts_for_term_meta_lazyload($this->posts);
3783 3783
 		}
3784 3784
 
3785 3785
 		return $this->posts;
@@ -3797,15 +3797,15 @@  discard block
 block discarded – undo
3797 3797
 	 * @param array  $q      Query variables.
3798 3798
 	 * @param string $limits LIMIT clauses of the query.
3799 3799
 	 */
3800
-	private function set_found_posts( $q, $limits ) {
3800
+	private function set_found_posts($q, $limits) {
3801 3801
 		global $wpdb;
3802 3802
 
3803 3803
 		// Bail if posts is an empty array. Continue if posts is an empty string,
3804 3804
 		// null, or false to accommodate caching plugins that fill posts later.
3805
-		if ( $q['no_found_rows'] || ( is_array( $this->posts ) && ! $this->posts ) )
3805
+		if ($q['no_found_rows'] || (is_array($this->posts) && ! $this->posts))
3806 3806
 			return;
3807 3807
 
3808
-		if ( ! empty( $limits ) ) {
3808
+		if ( ! empty($limits)) {
3809 3809
 			/**
3810 3810
 			 * Filter the query to run for retrieving the found posts.
3811 3811
 			 *
@@ -3814,9 +3814,9 @@  discard block
 block discarded – undo
3814 3814
 			 * @param string   $found_posts The query to run to find the found posts.
3815 3815
 			 * @param WP_Query &$this       The WP_Query instance (passed by reference).
3816 3816
 			 */
3817
-			$this->found_posts = $wpdb->get_var( apply_filters_ref_array( 'found_posts_query', array( 'SELECT FOUND_ROWS()', &$this ) ) );
3817
+			$this->found_posts = $wpdb->get_var(apply_filters_ref_array('found_posts_query', array('SELECT FOUND_ROWS()', &$this)));
3818 3818
 		} else {
3819
-			$this->found_posts = count( $this->posts );
3819
+			$this->found_posts = count($this->posts);
3820 3820
 		}
3821 3821
 
3822 3822
 		/**
@@ -3827,10 +3827,10 @@  discard block
 block discarded – undo
3827 3827
 		 * @param int      $found_posts The number of posts found.
3828 3828
 		 * @param WP_Query &$this       The WP_Query instance (passed by reference).
3829 3829
 		 */
3830
-		$this->found_posts = apply_filters_ref_array( 'found_posts', array( $this->found_posts, &$this ) );
3830
+		$this->found_posts = apply_filters_ref_array('found_posts', array($this->found_posts, &$this));
3831 3831
 
3832
-		if ( ! empty( $limits ) )
3833
-			$this->max_num_pages = ceil( $this->found_posts / $q['posts_per_page'] );
3832
+		if ( ! empty($limits))
3833
+			$this->max_num_pages = ceil($this->found_posts / $q['posts_per_page']);
3834 3834
 	}
3835 3835
 
3836 3836
 	/**
@@ -3864,7 +3864,7 @@  discard block
 block discarded – undo
3864 3864
 		global $post;
3865 3865
 		$this->in_the_loop = true;
3866 3866
 
3867
-		if ( $this->current_post == -1 ) // loop has just started
3867
+		if ($this->current_post == -1) // loop has just started
3868 3868
 			/**
3869 3869
 			 * Fires once the loop is started.
3870 3870
 			 *
@@ -3872,10 +3872,10 @@  discard block
 block discarded – undo
3872 3872
 			 *
3873 3873
 			 * @param WP_Query &$this The WP_Query instance (passed by reference).
3874 3874
 			 */
3875
-			do_action_ref_array( 'loop_start', array( &$this ) );
3875
+			do_action_ref_array('loop_start', array(&$this));
3876 3876
 
3877 3877
 		$post = $this->next_post();
3878
-		$this->setup_postdata( $post );
3878
+		$this->setup_postdata($post);
3879 3879
 	}
3880 3880
 
3881 3881
 	/**
@@ -3889,9 +3889,9 @@  discard block
 block discarded – undo
3889 3889
 	 * @return bool True if posts are available, false if end of loop.
3890 3890
 	 */
3891 3891
 	public function have_posts() {
3892
-		if ( $this->current_post + 1 < $this->post_count ) {
3892
+		if ($this->current_post + 1 < $this->post_count) {
3893 3893
 			return true;
3894
-		} elseif ( $this->current_post + 1 == $this->post_count && $this->post_count > 0 ) {
3894
+		} elseif ($this->current_post + 1 == $this->post_count && $this->post_count > 0) {
3895 3895
 			/**
3896 3896
 			 * Fires once the loop has ended.
3897 3897
 			 *
@@ -3899,7 +3899,7 @@  discard block
 block discarded – undo
3899 3899
 			 *
3900 3900
 			 * @param WP_Query &$this The WP_Query instance (passed by reference).
3901 3901
 			 */
3902
-			do_action_ref_array( 'loop_end', array( &$this ) );
3902
+			do_action_ref_array('loop_end', array(&$this));
3903 3903
 			// Do some cleaning up after the loop
3904 3904
 			$this->rewind_posts();
3905 3905
 		}
@@ -3916,7 +3916,7 @@  discard block
 block discarded – undo
3916 3916
 	 */
3917 3917
 	public function rewind_posts() {
3918 3918
 		$this->current_post = -1;
3919
-		if ( $this->post_count > 0 ) {
3919
+		if ($this->post_count > 0) {
3920 3920
 			$this->post = $this->posts[0];
3921 3921
 		}
3922 3922
 	}
@@ -3948,13 +3948,13 @@  discard block
 block discarded – undo
3948 3948
 
3949 3949
 		$comment = $this->next_comment();
3950 3950
 
3951
-		if ( $this->current_comment == 0 ) {
3951
+		if ($this->current_comment == 0) {
3952 3952
 			/**
3953 3953
 			 * Fires once the comment loop is started.
3954 3954
 			 *
3955 3955
 			 * @since 2.2.0
3956 3956
 			 */
3957
-			do_action( 'comment_loop_start' );
3957
+			do_action('comment_loop_start');
3958 3958
 		}
3959 3959
 	}
3960 3960
 
@@ -3969,9 +3969,9 @@  discard block
 block discarded – undo
3969 3969
 	 * @return bool True, if more comments. False, if no more posts.
3970 3970
 	 */
3971 3971
 	public function have_comments() {
3972
-		if ( $this->current_comment + 1 < $this->comment_count ) {
3972
+		if ($this->current_comment + 1 < $this->comment_count) {
3973 3973
 			return true;
3974
-		} elseif ( $this->current_comment + 1 == $this->comment_count ) {
3974
+		} elseif ($this->current_comment + 1 == $this->comment_count) {
3975 3975
 			$this->rewind_comments();
3976 3976
 		}
3977 3977
 
@@ -3986,7 +3986,7 @@  discard block
 block discarded – undo
3986 3986
 	 */
3987 3987
 	public function rewind_comments() {
3988 3988
 		$this->current_comment = -1;
3989
-		if ( $this->comment_count > 0 ) {
3989
+		if ($this->comment_count > 0) {
3990 3990
 			$this->comment = $this->comments[0];
3991 3991
 		}
3992 3992
 	}
@@ -4000,9 +4000,9 @@  discard block
 block discarded – undo
4000 4000
 	 * @param string $query URL query string.
4001 4001
 	 * @return array List of posts.
4002 4002
 	 */
4003
-	public function query( $query ) {
4003
+	public function query($query) {
4004 4004
 		$this->init();
4005
-		$this->query = $this->query_vars = wp_parse_args( $query );
4005
+		$this->query = $this->query_vars = wp_parse_args($query);
4006 4006
 		return $this->get_posts();
4007 4007
 	}
4008 4008
 
@@ -4019,66 +4019,66 @@  discard block
 block discarded – undo
4019 4019
 	 * @return object
4020 4020
 	 */
4021 4021
 	public function get_queried_object() {
4022
-		if ( isset($this->queried_object) )
4022
+		if (isset($this->queried_object))
4023 4023
 			return $this->queried_object;
4024 4024
 
4025 4025
 		$this->queried_object = null;
4026 4026
 		$this->queried_object_id = null;
4027 4027
 
4028
-		if ( $this->is_category || $this->is_tag || $this->is_tax ) {
4029
-			if ( $this->is_category ) {
4030
-				if ( $this->get( 'cat' ) ) {
4031
-					$term = get_term( $this->get( 'cat' ), 'category' );
4032
-				} elseif ( $this->get( 'category_name' ) ) {
4033
-					$term = get_term_by( 'slug', $this->get( 'category_name' ), 'category' );
4028
+		if ($this->is_category || $this->is_tag || $this->is_tax) {
4029
+			if ($this->is_category) {
4030
+				if ($this->get('cat')) {
4031
+					$term = get_term($this->get('cat'), 'category');
4032
+				} elseif ($this->get('category_name')) {
4033
+					$term = get_term_by('slug', $this->get('category_name'), 'category');
4034 4034
 				}
4035
-			} elseif ( $this->is_tag ) {
4036
-				if ( $this->get( 'tag_id' ) ) {
4037
-					$term = get_term( $this->get( 'tag_id' ), 'post_tag' );
4038
-				} elseif ( $this->get( 'tag' ) ) {
4039
-					$term = get_term_by( 'slug', $this->get( 'tag' ), 'post_tag' );
4035
+			} elseif ($this->is_tag) {
4036
+				if ($this->get('tag_id')) {
4037
+					$term = get_term($this->get('tag_id'), 'post_tag');
4038
+				} elseif ($this->get('tag')) {
4039
+					$term = get_term_by('slug', $this->get('tag'), 'post_tag');
4040 4040
 				}
4041 4041
 			} else {
4042 4042
 				// For other tax queries, grab the first term from the first clause.
4043
-				$tax_query_in_and = wp_list_filter( $this->tax_query->queried_terms, array( 'operator' => 'NOT IN' ), 'NOT' );
4043
+				$tax_query_in_and = wp_list_filter($this->tax_query->queried_terms, array('operator' => 'NOT IN'), 'NOT');
4044 4044
 
4045
-				if ( ! empty( $tax_query_in_and ) ) {
4046
-					$queried_taxonomies = array_keys( $tax_query_in_and );
4047
-					$matched_taxonomy = reset( $queried_taxonomies );
4048
-					$query = $tax_query_in_and[ $matched_taxonomy ];
4045
+				if ( ! empty($tax_query_in_and)) {
4046
+					$queried_taxonomies = array_keys($tax_query_in_and);
4047
+					$matched_taxonomy = reset($queried_taxonomies);
4048
+					$query = $tax_query_in_and[$matched_taxonomy];
4049 4049
 
4050
-					if ( $query['terms'] ) {
4051
-						if ( 'term_id' == $query['field'] ) {
4052
-							$term = get_term( reset( $query['terms'] ), $matched_taxonomy );
4050
+					if ($query['terms']) {
4051
+						if ('term_id' == $query['field']) {
4052
+							$term = get_term(reset($query['terms']), $matched_taxonomy);
4053 4053
 						} else {
4054
-							$term = get_term_by( $query['field'], reset( $query['terms'] ), $matched_taxonomy );
4054
+							$term = get_term_by($query['field'], reset($query['terms']), $matched_taxonomy);
4055 4055
 						}
4056 4056
 					}
4057 4057
 				}
4058 4058
 			}
4059 4059
 
4060
-			if ( ! empty( $term ) && ! is_wp_error( $term ) )  {
4060
+			if ( ! empty($term) && ! is_wp_error($term)) {
4061 4061
 				$this->queried_object = $term;
4062 4062
 				$this->queried_object_id = (int) $term->term_id;
4063 4063
 
4064
-				if ( $this->is_category && 'category' === $this->queried_object->taxonomy )
4065
-					_make_cat_compat( $this->queried_object );
4064
+				if ($this->is_category && 'category' === $this->queried_object->taxonomy)
4065
+					_make_cat_compat($this->queried_object);
4066 4066
 			}
4067
-		} elseif ( $this->is_post_type_archive ) {
4068
-			$post_type = $this->get( 'post_type' );
4069
-			if ( is_array( $post_type ) )
4070
-				$post_type = reset( $post_type );
4071
-			$this->queried_object = get_post_type_object( $post_type );
4072
-		} elseif ( $this->is_posts_page ) {
4067
+		} elseif ($this->is_post_type_archive) {
4068
+			$post_type = $this->get('post_type');
4069
+			if (is_array($post_type))
4070
+				$post_type = reset($post_type);
4071
+			$this->queried_object = get_post_type_object($post_type);
4072
+		} elseif ($this->is_posts_page) {
4073 4073
 			$page_for_posts = get_option('page_for_posts');
4074
-			$this->queried_object = get_post( $page_for_posts );
4074
+			$this->queried_object = get_post($page_for_posts);
4075 4075
 			$this->queried_object_id = (int) $this->queried_object->ID;
4076
-		} elseif ( $this->is_singular && ! empty( $this->post ) ) {
4076
+		} elseif ($this->is_singular && ! empty($this->post)) {
4077 4077
 			$this->queried_object = $this->post;
4078 4078
 			$this->queried_object_id = (int) $this->post->ID;
4079
-		} elseif ( $this->is_author ) {
4079
+		} elseif ($this->is_author) {
4080 4080
 			$this->queried_object_id = (int) $this->get('author');
4081
-			$this->queried_object = get_userdata( $this->queried_object_id );
4081
+			$this->queried_object = get_userdata($this->queried_object_id);
4082 4082
 		}
4083 4083
 
4084 4084
 		return $this->queried_object;
@@ -4095,7 +4095,7 @@  discard block
 block discarded – undo
4095 4095
 	public function get_queried_object_id() {
4096 4096
 		$this->get_queried_object();
4097 4097
 
4098
-		if ( isset($this->queried_object_id) ) {
4098
+		if (isset($this->queried_object_id)) {
4099 4099
 			return $this->queried_object_id;
4100 4100
 		}
4101 4101
 
@@ -4113,7 +4113,7 @@  discard block
 block discarded – undo
4113 4113
 	 * @param string|array $query URL query string or array of vars.
4114 4114
 	 */
4115 4115
 	public function __construct($query = '') {
4116
-		if ( ! empty($query) ) {
4116
+		if ( ! empty($query)) {
4117 4117
 			$this->query($query);
4118 4118
 		}
4119 4119
 	}
@@ -4127,8 +4127,8 @@  discard block
 block discarded – undo
4127 4127
 	 * @param string $name Property to get.
4128 4128
 	 * @return mixed Property.
4129 4129
 	 */
4130
-	public function __get( $name ) {
4131
-		if ( in_array( $name, $this->compat_fields ) ) {
4130
+	public function __get($name) {
4131
+		if (in_array($name, $this->compat_fields)) {
4132 4132
 			return $this->$name;
4133 4133
 		}
4134 4134
 	}
@@ -4142,9 +4142,9 @@  discard block
 block discarded – undo
4142 4142
 	 * @param string $name Property to check if set.
4143 4143
 	 * @return bool Whether the property is set.
4144 4144
 	 */
4145
-	public function __isset( $name ) {
4146
-		if ( in_array( $name, $this->compat_fields ) ) {
4147
-			return isset( $this->$name );
4145
+	public function __isset($name) {
4146
+		if (in_array($name, $this->compat_fields)) {
4147
+			return isset($this->$name);
4148 4148
 		}
4149 4149
 	}
4150 4150
 
@@ -4158,9 +4158,9 @@  discard block
 block discarded – undo
4158 4158
 	 * @param array    $arguments Arguments to pass when calling.
4159 4159
 	 * @return mixed|false Return value of the callback, false otherwise.
4160 4160
 	 */
4161
-	public function __call( $name, $arguments ) {
4162
-		if ( in_array( $name, $this->compat_methods ) ) {
4163
-			return call_user_func_array( array( $this, $name ), $arguments );
4161
+	public function __call($name, $arguments) {
4162
+		if (in_array($name, $this->compat_methods)) {
4163
+			return call_user_func_array(array($this, $name), $arguments);
4164 4164
 		}
4165 4165
 		return false;
4166 4166
 	}
@@ -4186,16 +4186,16 @@  discard block
 block discarded – undo
4186 4186
 	 * @param mixed $post_types Optional. Post type or array of posts types to check against.
4187 4187
 	 * @return bool
4188 4188
 	 */
4189
-	public function is_post_type_archive( $post_types = '' ) {
4190
-		if ( empty( $post_types ) || ! $this->is_post_type_archive )
4189
+	public function is_post_type_archive($post_types = '') {
4190
+		if (empty($post_types) || ! $this->is_post_type_archive)
4191 4191
 			return (bool) $this->is_post_type_archive;
4192 4192
 
4193
-		$post_type = $this->get( 'post_type' );
4194
-		if ( is_array( $post_type ) )
4195
-			$post_type = reset( $post_type );
4196
-		$post_type_object = get_post_type_object( $post_type );
4193
+		$post_type = $this->get('post_type');
4194
+		if (is_array($post_type))
4195
+			$post_type = reset($post_type);
4196
+		$post_type_object = get_post_type_object($post_type);
4197 4197
 
4198
-		return in_array( $post_type_object->name, (array) $post_types );
4198
+		return in_array($post_type_object->name, (array) $post_types);
4199 4199
 	}
4200 4200
 
4201 4201
 	/**
@@ -4206,24 +4206,24 @@  discard block
 block discarded – undo
4206 4206
 	 * @param mixed $attachment Attachment ID, title, slug, or array of such.
4207 4207
 	 * @return bool
4208 4208
 	 */
4209
-	public function is_attachment( $attachment = '' ) {
4210
-		if ( ! $this->is_attachment ) {
4209
+	public function is_attachment($attachment = '') {
4210
+		if ( ! $this->is_attachment) {
4211 4211
 			return false;
4212 4212
 		}
4213 4213
 
4214
-		if ( empty( $attachment ) ) {
4214
+		if (empty($attachment)) {
4215 4215
 			return true;
4216 4216
 		}
4217 4217
 
4218
-		$attachment = array_map( 'strval', (array) $attachment );
4218
+		$attachment = array_map('strval', (array) $attachment);
4219 4219
 
4220 4220
 		$post_obj = $this->get_queried_object();
4221 4221
 
4222
-		if ( in_array( (string) $post_obj->ID, $attachment ) ) {
4222
+		if (in_array((string) $post_obj->ID, $attachment)) {
4223 4223
 			return true;
4224
-		} elseif ( in_array( $post_obj->post_title, $attachment ) ) {
4224
+		} elseif (in_array($post_obj->post_title, $attachment)) {
4225 4225
 			return true;
4226
-		} elseif ( in_array( $post_obj->post_name, $attachment ) ) {
4226
+		} elseif (in_array($post_obj->post_name, $attachment)) {
4227 4227
 			return true;
4228 4228
 		}
4229 4229
 		return false;
@@ -4240,22 +4240,22 @@  discard block
 block discarded – undo
4240 4240
 	 * @param mixed $author Optional. User ID, nickname, nicename, or array of User IDs, nicknames, and nicenames
4241 4241
 	 * @return bool
4242 4242
 	 */
4243
-	public function is_author( $author = '' ) {
4244
-		if ( !$this->is_author )
4243
+	public function is_author($author = '') {
4244
+		if ( ! $this->is_author)
4245 4245
 			return false;
4246 4246
 
4247
-		if ( empty($author) )
4247
+		if (empty($author))
4248 4248
 			return true;
4249 4249
 
4250 4250
 		$author_obj = $this->get_queried_object();
4251 4251
 
4252
-		$author = array_map( 'strval', (array) $author );
4252
+		$author = array_map('strval', (array) $author);
4253 4253
 
4254
-		if ( in_array( (string) $author_obj->ID, $author ) )
4254
+		if (in_array((string) $author_obj->ID, $author))
4255 4255
 			return true;
4256
-		elseif ( in_array( $author_obj->nickname, $author ) )
4256
+		elseif (in_array($author_obj->nickname, $author))
4257 4257
 			return true;
4258
-		elseif ( in_array( $author_obj->user_nicename, $author ) )
4258
+		elseif (in_array($author_obj->user_nicename, $author))
4259 4259
 			return true;
4260 4260
 
4261 4261
 		return false;
@@ -4272,22 +4272,22 @@  discard block
 block discarded – undo
4272 4272
 	 * @param mixed $category Optional. Category ID, name, slug, or array of Category IDs, names, and slugs.
4273 4273
 	 * @return bool
4274 4274
 	 */
4275
-	public function is_category( $category = '' ) {
4276
-		if ( !$this->is_category )
4275
+	public function is_category($category = '') {
4276
+		if ( ! $this->is_category)
4277 4277
 			return false;
4278 4278
 
4279
-		if ( empty($category) )
4279
+		if (empty($category))
4280 4280
 			return true;
4281 4281
 
4282 4282
 		$cat_obj = $this->get_queried_object();
4283 4283
 
4284
-		$category = array_map( 'strval', (array) $category );
4284
+		$category = array_map('strval', (array) $category);
4285 4285
 
4286
-		if ( in_array( (string) $cat_obj->term_id, $category ) )
4286
+		if (in_array((string) $cat_obj->term_id, $category))
4287 4287
 			return true;
4288
-		elseif ( in_array( $cat_obj->name, $category ) )
4288
+		elseif (in_array($cat_obj->name, $category))
4289 4289
 			return true;
4290
-		elseif ( in_array( $cat_obj->slug, $category ) )
4290
+		elseif (in_array($cat_obj->slug, $category))
4291 4291
 			return true;
4292 4292
 
4293 4293
 		return false;
@@ -4304,22 +4304,22 @@  discard block
 block discarded – undo
4304 4304
 	 * @param mixed $tag Optional. Tag ID, name, slug, or array of Tag IDs, names, and slugs.
4305 4305
 	 * @return bool
4306 4306
 	 */
4307
-	public function is_tag( $tag = '' ) {
4308
-		if ( ! $this->is_tag )
4307
+	public function is_tag($tag = '') {
4308
+		if ( ! $this->is_tag)
4309 4309
 			return false;
4310 4310
 
4311
-		if ( empty( $tag ) )
4311
+		if (empty($tag))
4312 4312
 			return true;
4313 4313
 
4314 4314
 		$tag_obj = $this->get_queried_object();
4315 4315
 
4316
-		$tag = array_map( 'strval', (array) $tag );
4316
+		$tag = array_map('strval', (array) $tag);
4317 4317
 
4318
-		if ( in_array( (string) $tag_obj->term_id, $tag ) )
4318
+		if (in_array((string) $tag_obj->term_id, $tag))
4319 4319
 			return true;
4320
-		elseif ( in_array( $tag_obj->name, $tag ) )
4320
+		elseif (in_array($tag_obj->name, $tag))
4321 4321
 			return true;
4322
-		elseif ( in_array( $tag_obj->slug, $tag ) )
4322
+		elseif (in_array($tag_obj->slug, $tag))
4323 4323
 			return true;
4324 4324
 
4325 4325
 		return false;
@@ -4343,32 +4343,32 @@  discard block
 block discarded – undo
4343 4343
 	 * @param mixed $term     Optional. Term ID, name, slug or array of Term IDs, names, and slugs.
4344 4344
 	 * @return bool
4345 4345
 	 */
4346
-	public function is_tax( $taxonomy = '', $term = '' ) {
4346
+	public function is_tax($taxonomy = '', $term = '') {
4347 4347
 		global $wp_taxonomies;
4348 4348
 
4349
-		if ( !$this->is_tax )
4349
+		if ( ! $this->is_tax)
4350 4350
 			return false;
4351 4351
 
4352
-		if ( empty( $taxonomy ) )
4352
+		if (empty($taxonomy))
4353 4353
 			return true;
4354 4354
 
4355 4355
 		$queried_object = $this->get_queried_object();
4356
-		$tax_array = array_intersect( array_keys( $wp_taxonomies ), (array) $taxonomy );
4356
+		$tax_array = array_intersect(array_keys($wp_taxonomies), (array) $taxonomy);
4357 4357
 		$term_array = (array) $term;
4358 4358
 
4359 4359
 		// Check that the taxonomy matches.
4360
-		if ( ! ( isset( $queried_object->taxonomy ) && count( $tax_array ) && in_array( $queried_object->taxonomy, $tax_array ) ) )
4360
+		if ( ! (isset($queried_object->taxonomy) && count($tax_array) && in_array($queried_object->taxonomy, $tax_array)))
4361 4361
 			return false;
4362 4362
 
4363 4363
 		// Only a Taxonomy provided.
4364
-		if ( empty( $term ) )
4364
+		if (empty($term))
4365 4365
 			return true;
4366 4366
 
4367
-		return isset( $queried_object->term_id ) &&
4368
-			count( array_intersect(
4369
-				array( $queried_object->term_id, $queried_object->name, $queried_object->slug ),
4367
+		return isset($queried_object->term_id) &&
4368
+			count(array_intersect(
4369
+				array($queried_object->term_id, $queried_object->name, $queried_object->slug),
4370 4370
 				$term_array
4371
-			) );
4371
+			));
4372 4372
 	}
4373 4373
 
4374 4374
 	/**
@@ -4380,7 +4380,7 @@  discard block
 block discarded – undo
4380 4380
 	 * @return bool
4381 4381
 	 */
4382 4382
 	public function is_comments_popup() {
4383
-		_deprecated_function( __FUNCTION__, '4.5' );
4383
+		_deprecated_function(__FUNCTION__, '4.5');
4384 4384
 
4385 4385
 		return false;
4386 4386
 	}
@@ -4415,13 +4415,13 @@  discard block
 block discarded – undo
4415 4415
 	 * @param string|array $feeds Optional feed types to check.
4416 4416
 	 * @return bool
4417 4417
 	 */
4418
-	public function is_feed( $feeds = '' ) {
4419
-		if ( empty( $feeds ) || ! $this->is_feed )
4418
+	public function is_feed($feeds = '') {
4419
+		if (empty($feeds) || ! $this->is_feed)
4420 4420
 			return (bool) $this->is_feed;
4421
-		$qv = $this->get( 'feed' );
4422
-		if ( 'feed' == $qv )
4421
+		$qv = $this->get('feed');
4422
+		if ('feed' == $qv)
4423 4423
 			$qv = get_default_feed();
4424
-		return in_array( $qv, (array) $feeds );
4424
+		return in_array($qv, (array) $feeds);
4425 4425
 	}
4426 4426
 
4427 4427
 	/**
@@ -4453,9 +4453,9 @@  discard block
 block discarded – undo
4453 4453
 	 */
4454 4454
 	public function is_front_page() {
4455 4455
 		// most likely case
4456
-		if ( 'posts' == get_option( 'show_on_front') && $this->is_home() )
4456
+		if ('posts' == get_option('show_on_front') && $this->is_home())
4457 4457
 			return true;
4458
-		elseif ( 'page' == get_option( 'show_on_front') && get_option( 'page_on_front' ) && $this->is_page( get_option( 'page_on_front' ) ) )
4458
+		elseif ('page' == get_option('show_on_front') && get_option('page_on_front') && $this->is_page(get_option('page_on_front')))
4459 4459
 			return true;
4460 4460
 		else
4461 4461
 			return false;
@@ -4506,31 +4506,31 @@  discard block
 block discarded – undo
4506 4506
 	 * @param int|string|array $page Optional. Page ID, title, slug, path, or array of such. Default empty.
4507 4507
 	 * @return bool Whether the query is for an existing single page.
4508 4508
 	 */
4509
-	public function is_page( $page = '' ) {
4510
-		if ( !$this->is_page )
4509
+	public function is_page($page = '') {
4510
+		if ( ! $this->is_page)
4511 4511
 			return false;
4512 4512
 
4513
-		if ( empty( $page ) )
4513
+		if (empty($page))
4514 4514
 			return true;
4515 4515
 
4516 4516
 		$page_obj = $this->get_queried_object();
4517 4517
 
4518
-		$page = array_map( 'strval', (array) $page );
4518
+		$page = array_map('strval', (array) $page);
4519 4519
 
4520
-		if ( in_array( (string) $page_obj->ID, $page ) ) {
4520
+		if (in_array((string) $page_obj->ID, $page)) {
4521 4521
 			return true;
4522
-		} elseif ( in_array( $page_obj->post_title, $page ) ) {
4522
+		} elseif (in_array($page_obj->post_title, $page)) {
4523 4523
 			return true;
4524
-		} elseif ( in_array( $page_obj->post_name, $page ) ) {
4524
+		} elseif (in_array($page_obj->post_name, $page)) {
4525 4525
 			return true;
4526 4526
 		} else {
4527
-			foreach ( $page as $pagepath ) {
4528
-				if ( ! strpos( $pagepath, '/' ) ) {
4527
+			foreach ($page as $pagepath) {
4528
+				if ( ! strpos($pagepath, '/')) {
4529 4529
 					continue;
4530 4530
 				}
4531
-				$pagepath_obj = get_page_by_path( $pagepath );
4531
+				$pagepath_obj = get_page_by_path($pagepath);
4532 4532
 
4533
-				if ( $pagepath_obj && ( $pagepath_obj->ID == $page_obj->ID ) ) {
4533
+				if ($pagepath_obj && ($pagepath_obj->ID == $page_obj->ID)) {
4534 4534
 					return true;
4535 4535
 				}
4536 4536
 			}
@@ -4599,31 +4599,31 @@  discard block
 block discarded – undo
4599 4599
 	 * @param int|string|array $post Optional. Post ID, title, slug, path, or array of such. Default empty.
4600 4600
 	 * @return bool Whether the query is for an existing single post.
4601 4601
 	 */
4602
-	public function is_single( $post = '' ) {
4603
-		if ( !$this->is_single )
4602
+	public function is_single($post = '') {
4603
+		if ( ! $this->is_single)
4604 4604
 			return false;
4605 4605
 
4606
-		if ( empty($post) )
4606
+		if (empty($post))
4607 4607
 			return true;
4608 4608
 
4609 4609
 		$post_obj = $this->get_queried_object();
4610 4610
 
4611
-		$post = array_map( 'strval', (array) $post );
4611
+		$post = array_map('strval', (array) $post);
4612 4612
 
4613
-		if ( in_array( (string) $post_obj->ID, $post ) ) {
4613
+		if (in_array((string) $post_obj->ID, $post)) {
4614 4614
 			return true;
4615
-		} elseif ( in_array( $post_obj->post_title, $post ) ) {
4615
+		} elseif (in_array($post_obj->post_title, $post)) {
4616 4616
 			return true;
4617
-		} elseif ( in_array( $post_obj->post_name, $post ) ) {
4617
+		} elseif (in_array($post_obj->post_name, $post)) {
4618 4618
 			return true;
4619 4619
 		} else {
4620
-			foreach ( $post as $postpath ) {
4621
-				if ( ! strpos( $postpath, '/' ) ) {
4620
+			foreach ($post as $postpath) {
4621
+				if ( ! strpos($postpath, '/')) {
4622 4622
 					continue;
4623 4623
 				}
4624
-				$postpath_obj = get_page_by_path( $postpath, OBJECT, $post_obj->post_type );
4624
+				$postpath_obj = get_page_by_path($postpath, OBJECT, $post_obj->post_type);
4625 4625
 
4626
-				if ( $postpath_obj && ( $postpath_obj->ID == $post_obj->ID ) ) {
4626
+				if ($postpath_obj && ($postpath_obj->ID == $post_obj->ID)) {
4627 4627
 					return true;
4628 4628
 				}
4629 4629
 			}
@@ -4645,13 +4645,13 @@  discard block
 block discarded – undo
4645 4645
 	 * @param string|array $post_types Optional. Post type or array of post types. Default empty.
4646 4646
 	 * @return bool Whether the query is for an existing single post of any of the given post types.
4647 4647
 	 */
4648
-	public function is_singular( $post_types = '' ) {
4649
-		if ( empty( $post_types ) || !$this->is_singular )
4648
+	public function is_singular($post_types = '') {
4649
+		if (empty($post_types) || ! $this->is_singular)
4650 4650
 			return (bool) $this->is_singular;
4651 4651
 
4652 4652
 		$post_obj = $this->get_queried_object();
4653 4653
 
4654
-		return in_array( $post_obj->post_type, (array) $post_types );
4654
+		return in_array($post_obj->post_type, (array) $post_types);
4655 4655
 	}
4656 4656
 
4657 4657
 	/**
@@ -4742,14 +4742,14 @@  discard block
 block discarded – undo
4742 4742
 	 * @param WP_Post|object|int $post WP_Post instance or Post ID/object.
4743 4743
 	 * @return true True when finished.
4744 4744
 	 */
4745
-	public function setup_postdata( $post ) {
4745
+	public function setup_postdata($post) {
4746 4746
 		global $id, $authordata, $currentday, $currentmonth, $page, $pages, $multipage, $more, $numpages;
4747 4747
 
4748
-		if ( ! ( $post instanceof WP_Post ) ) {
4749
-			$post = get_post( $post );
4748
+		if ( ! ($post instanceof WP_Post)) {
4749
+			$post = get_post($post);
4750 4750
 		}
4751 4751
 
4752
-		if ( ! $post ) {
4752
+		if ( ! $post) {
4753 4753
 			return;
4754 4754
 		}
4755 4755
 
@@ -4761,35 +4761,35 @@  discard block
 block discarded – undo
4761 4761
 		$currentmonth = mysql2date('m', $post->post_date, false);
4762 4762
 		$numpages = 1;
4763 4763
 		$multipage = 0;
4764
-		$page = $this->get( 'page' );
4765
-		if ( ! $page )
4764
+		$page = $this->get('page');
4765
+		if ( ! $page)
4766 4766
 			$page = 1;
4767 4767
 
4768 4768
 		/*
4769 4769
 		 * Force full post content when viewing the permalink for the $post,
4770 4770
 		 * or when on an RSS feed. Otherwise respect the 'more' tag.
4771 4771
 		 */
4772
-		if ( $post->ID === get_queried_object_id() && ( $this->is_page() || $this->is_single() ) ) {
4772
+		if ($post->ID === get_queried_object_id() && ($this->is_page() || $this->is_single())) {
4773 4773
 			$more = 1;
4774
-		} elseif ( $this->is_feed() ) {
4774
+		} elseif ($this->is_feed()) {
4775 4775
 			$more = 1;
4776 4776
 		} else {
4777 4777
 			$more = 0;
4778 4778
 		}
4779 4779
 
4780 4780
 		$content = $post->post_content;
4781
-		if ( false !== strpos( $content, '<!--nextpage-->' ) ) {
4782
-			$content = str_replace( "\n<!--nextpage-->\n", '<!--nextpage-->', $content );
4783
-			$content = str_replace( "\n<!--nextpage-->", '<!--nextpage-->', $content );
4784
-			$content = str_replace( "<!--nextpage-->\n", '<!--nextpage-->', $content );
4781
+		if (false !== strpos($content, '<!--nextpage-->')) {
4782
+			$content = str_replace("\n<!--nextpage-->\n", '<!--nextpage-->', $content);
4783
+			$content = str_replace("\n<!--nextpage-->", '<!--nextpage-->', $content);
4784
+			$content = str_replace("<!--nextpage-->\n", '<!--nextpage-->', $content);
4785 4785
 
4786 4786
 			// Ignore nextpage at the beginning of the content.
4787
-			if ( 0 === strpos( $content, '<!--nextpage-->' ) )
4788
-				$content = substr( $content, 15 );
4787
+			if (0 === strpos($content, '<!--nextpage-->'))
4788
+				$content = substr($content, 15);
4789 4789
 
4790 4790
 			$pages = explode('<!--nextpage-->', $content);
4791 4791
 		} else {
4792
-			$pages = array( $post->post_content );
4792
+			$pages = array($post->post_content);
4793 4793
 		}
4794 4794
 
4795 4795
 		/**
@@ -4804,12 +4804,12 @@  discard block
 block discarded – undo
4804 4804
 		 *                       of `<!-- nextpage -->` tags..
4805 4805
 		 * @param WP_Post $post  Current post object.
4806 4806
 		 */
4807
-		$pages = apply_filters( 'content_pagination', $pages, $post );
4807
+		$pages = apply_filters('content_pagination', $pages, $post);
4808 4808
 
4809
-		$numpages = count( $pages );
4809
+		$numpages = count($pages);
4810 4810
 
4811
-		if ( $numpages > 1 ) {
4812
-			if ( $page > 1 ) {
4811
+		if ($numpages > 1) {
4812
+			if ($page > 1) {
4813 4813
 				$more = 1;
4814 4814
 			}
4815 4815
 			$multipage = 1;
@@ -4826,7 +4826,7 @@  discard block
 block discarded – undo
4826 4826
 		 * @param WP_Post  &$post The Post object (passed by reference).
4827 4827
 		 * @param WP_Query &$this The current Query object (passed by reference).
4828 4828
 		 */
4829
-		do_action_ref_array( 'the_post', array( &$post, &$this ) );
4829
+		do_action_ref_array('the_post', array(&$post, &$this));
4830 4830
 
4831 4831
 		return true;
4832 4832
 	}
@@ -4839,9 +4839,9 @@  discard block
 block discarded – undo
4839 4839
 	 * @global WP_Post $post
4840 4840
 	 */
4841 4841
 	public function reset_postdata() {
4842
-		if ( ! empty( $this->post ) ) {
4842
+		if ( ! empty($this->post)) {
4843 4843
 			$GLOBALS['post'] = $this->post;
4844
-			$this->setup_postdata( $this->post );
4844
+			$this->setup_postdata($this->post);
4845 4845
 		}
4846 4846
 	}
4847 4847
 
@@ -4855,8 +4855,8 @@  discard block
 block discarded – undo
4855 4855
 	 * @param int   $term_id
4856 4856
 	 * @return mixed
4857 4857
 	 */
4858
-	public function lazyload_term_meta( $check, $term_id ) {
4859
-		_deprecated_function( __METHOD__, '4.5.0' );
4858
+	public function lazyload_term_meta($check, $term_id) {
4859
+		_deprecated_function(__METHOD__, '4.5.0');
4860 4860
 		return $check;
4861 4861
 	}
4862 4862
 
@@ -4870,8 +4870,8 @@  discard block
 block discarded – undo
4870 4870
 	 * @param int   $comment_id
4871 4871
 	 * @return mixed
4872 4872
 	 */
4873
-	public function lazyload_comment_meta( $check, $comment_id ) {
4874
-		_deprecated_function( __METHOD__, '4.5.0' );
4873
+	public function lazyload_comment_meta($check, $comment_id) {
4874
+		_deprecated_function(__METHOD__, '4.5.0');
4875 4875
 		return $check;
4876 4876
 	}
4877 4877
 }
@@ -4890,63 +4890,63 @@  discard block
 block discarded – undo
4890 4890
 function wp_old_slug_redirect() {
4891 4891
 	global $wp_query, $wp_rewrite;
4892 4892
 
4893
-	if ( get_queried_object() ) {
4893
+	if (get_queried_object()) {
4894 4894
 		return;
4895 4895
 	}
4896 4896
 
4897
-	if ( '' !== $wp_query->query_vars['name'] ) :
4897
+	if ('' !== $wp_query->query_vars['name']) :
4898 4898
 		global $wpdb;
4899 4899
 
4900 4900
 		// Guess the current post_type based on the query vars.
4901
-		if ( get_query_var( 'post_type' ) ) {
4902
-			$post_type = get_query_var( 'post_type' );
4903
-		} elseif ( get_query_var( 'attachment' ) ) {
4901
+		if (get_query_var('post_type')) {
4902
+			$post_type = get_query_var('post_type');
4903
+		} elseif (get_query_var('attachment')) {
4904 4904
 			$post_type = 'attachment';
4905
-		} elseif ( ! empty( $wp_query->query_vars['pagename'] ) ) {
4905
+		} elseif ( ! empty($wp_query->query_vars['pagename'])) {
4906 4906
 			$post_type = 'page';
4907 4907
 		} else {
4908 4908
 			$post_type = 'post';
4909 4909
 		}
4910 4910
 
4911
-		if ( is_array( $post_type ) ) {
4912
-			if ( count( $post_type ) > 1 )
4911
+		if (is_array($post_type)) {
4912
+			if (count($post_type) > 1)
4913 4913
 				return;
4914
-			$post_type = reset( $post_type );
4914
+			$post_type = reset($post_type);
4915 4915
 		}
4916 4916
 
4917 4917
 		// Do not attempt redirect for hierarchical post types
4918
-		if ( is_post_type_hierarchical( $post_type ) )
4918
+		if (is_post_type_hierarchical($post_type))
4919 4919
 			return;
4920 4920
 
4921 4921
 		$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']);
4922 4922
 
4923 4923
 		// if year, monthnum, or day have been specified, make our query more precise
4924 4924
 		// just in case there are multiple identical _wp_old_slug values
4925
-		if ( '' != $wp_query->query_vars['year'] )
4925
+		if ('' != $wp_query->query_vars['year'])
4926 4926
 			$query .= $wpdb->prepare(" AND YEAR(post_date) = %d", $wp_query->query_vars['year']);
4927
-		if ( '' != $wp_query->query_vars['monthnum'] )
4927
+		if ('' != $wp_query->query_vars['monthnum'])
4928 4928
 			$query .= $wpdb->prepare(" AND MONTH(post_date) = %d", $wp_query->query_vars['monthnum']);
4929
-		if ( '' != $wp_query->query_vars['day'] )
4929
+		if ('' != $wp_query->query_vars['day'])
4930 4930
 			$query .= $wpdb->prepare(" AND DAYOFMONTH(post_date) = %d", $wp_query->query_vars['day']);
4931 4931
 
4932 4932
 		$id = (int) $wpdb->get_var($query);
4933 4933
 
4934
-		if ( ! $id )
4934
+		if ( ! $id)
4935 4935
 			return;
4936 4936
 
4937
-		$link = get_permalink( $id );
4937
+		$link = get_permalink($id);
4938 4938
 
4939
-		if ( is_feed() ) {
4940
-			$link = user_trailingslashit( trailingslashit( $link ) . 'feed' );
4941
-		} elseif ( isset( $GLOBALS['wp_query']->query_vars['paged'] ) && $GLOBALS['wp_query']->query_vars['paged'] > 1 ) {
4942
-			$link = user_trailingslashit( trailingslashit( $link ) . 'page/' . $GLOBALS['wp_query']->query_vars['paged'] );
4943
-		} elseif( is_embed() ) {
4944
-			$link = user_trailingslashit( trailingslashit( $link ) . 'embed' );
4945
-		} elseif ( is_404() ) {
4939
+		if (is_feed()) {
4940
+			$link = user_trailingslashit(trailingslashit($link).'feed');
4941
+		} elseif (isset($GLOBALS['wp_query']->query_vars['paged']) && $GLOBALS['wp_query']->query_vars['paged'] > 1) {
4942
+			$link = user_trailingslashit(trailingslashit($link).'page/'.$GLOBALS['wp_query']->query_vars['paged']);
4943
+		} elseif (is_embed()) {
4944
+			$link = user_trailingslashit(trailingslashit($link).'embed');
4945
+		} elseif (is_404()) {
4946 4946
 			// Add rewrite endpoints if necessary.
4947
-			foreach ( $wp_rewrite->endpoints as $endpoint ) {
4948
-				if ( $endpoint[2] && false !== get_query_var( $endpoint[2], false ) ) {
4949
-					$link = user_trailingslashit( trailingslashit( $link ) . $endpoint[1] );
4947
+			foreach ($wp_rewrite->endpoints as $endpoint) {
4948
+				if ($endpoint[2] && false !== get_query_var($endpoint[2], false)) {
4949
+					$link = user_trailingslashit(trailingslashit($link).$endpoint[1]);
4950 4950
 				}
4951 4951
 			}
4952 4952
 		}
@@ -4958,13 +4958,13 @@  discard block
 block discarded – undo
4958 4958
 		 *
4959 4959
 		 * @param string $link The redirect URL.
4960 4960
 		 */
4961
-		$link = apply_filters( 'old_slug_redirect_url', $link );
4961
+		$link = apply_filters('old_slug_redirect_url', $link);
4962 4962
 
4963
-		if ( ! $link ) {
4963
+		if ( ! $link) {
4964 4964
 			return;
4965 4965
 		}
4966 4966
 
4967
-		wp_redirect( $link, 301 ); // Permanent redirect
4967
+		wp_redirect($link, 301); // Permanent redirect
4968 4968
 		exit;
4969 4969
 	endif;
4970 4970
 }
@@ -4980,11 +4980,11 @@  discard block
 block discarded – undo
4980 4980
  * @param WP_Post|object|int $post WP_Post instance or Post ID/object.
4981 4981
  * @return bool True when finished.
4982 4982
  */
4983
-function setup_postdata( $post ) {
4983
+function setup_postdata($post) {
4984 4984
 	global $wp_query;
4985 4985
 
4986
-	if ( ! empty( $wp_query ) && $wp_query instanceof WP_Query ) {
4987
-		return $wp_query->setup_postdata( $post );
4986
+	if ( ! empty($wp_query) && $wp_query instanceof WP_Query) {
4987
+		return $wp_query->setup_postdata($post);
4988 4988
 	}
4989 4989
 
4990 4990
 	return false;
Please login to merge, or discard this patch.
Braces   +437 added lines, -300 removed lines patch added patch discarded remove patch
@@ -1442,8 +1442,9 @@  discard block
 block discarded – undo
1442 1442
 		);
1443 1443
 
1444 1444
 		foreach ( $keys as $key ) {
1445
-			if ( !isset($array[$key]) )
1446
-				$array[$key] = '';
1445
+			if ( !isset($array[$key]) ) {
1446
+							$array[$key] = '';
1447
+			}
1447 1448
 		}
1448 1449
 
1449 1450
 		$array_keys = array( 'category__in', 'category__not_in', 'category__and', 'post__in', 'post__not_in', 'post_name__in',
@@ -1451,8 +1452,9 @@  discard block
 block discarded – undo
1451 1452
 			'author__in', 'author__not_in' );
1452 1453
 
1453 1454
 		foreach ( $array_keys as $key ) {
1454
-			if ( !isset($array[$key]) )
1455
-				$array[$key] = array();
1455
+			if ( !isset($array[$key]) ) {
1456
+							$array[$key] = array();
1457
+			}
1456 1458
 		}
1457 1459
 		return $array;
1458 1460
 	}
@@ -1582,8 +1584,9 @@  discard block
 block discarded – undo
1582 1584
 		$qv = &$this->query_vars;
1583 1585
 		$this->query_vars_changed = true;
1584 1586
 
1585
-		if ( ! empty($qv['robots']) )
1586
-			$this->is_robots = true;
1587
+		if ( ! empty($qv['robots']) ) {
1588
+					$this->is_robots = true;
1589
+		}
1587 1590
 
1588 1591
 		$qv['p'] =  absint($qv['p']);
1589 1592
 		$qv['page_id'] =  absint($qv['page_id']);
@@ -1598,10 +1601,18 @@  discard block
 block discarded – undo
1598 1601
 		$qv['pagename'] = trim( $qv['pagename'] );
1599 1602
 		$qv['name'] = trim( $qv['name'] );
1600 1603
 		$qv['title'] = trim( $qv['title'] );
1601
-		if ( '' !== $qv['hour'] ) $qv['hour'] = absint($qv['hour']);
1602
-		if ( '' !== $qv['minute'] ) $qv['minute'] = absint($qv['minute']);
1603
-		if ( '' !== $qv['second'] ) $qv['second'] = absint($qv['second']);
1604
-		if ( '' !== $qv['menu_order'] ) $qv['menu_order'] = absint($qv['menu_order']);
1604
+		if ( '' !== $qv['hour'] ) {
1605
+			$qv['hour'] = absint($qv['hour']);
1606
+		}
1607
+		if ( '' !== $qv['minute'] ) {
1608
+			$qv['minute'] = absint($qv['minute']);
1609
+		}
1610
+		if ( '' !== $qv['second'] ) {
1611
+			$qv['second'] = absint($qv['second']);
1612
+		}
1613
+		if ( '' !== $qv['menu_order'] ) {
1614
+			$qv['menu_order'] = absint($qv['menu_order']);
1615
+		}
1605 1616
 
1606 1617
 		// Fairly insane upper bound for search string lengths.
1607 1618
 		if ( ! is_scalar( $qv['s'] ) || ( ! empty( $qv['s'] ) && strlen( $qv['s'] ) > 1600 ) ) {
@@ -1609,10 +1620,12 @@  discard block
 block discarded – undo
1609 1620
 		}
1610 1621
 
1611 1622
 		// Compat. Map subpost to attachment.
1612
-		if ( '' != $qv['subpost'] )
1613
-			$qv['attachment'] = $qv['subpost'];
1614
-		if ( '' != $qv['subpost_id'] )
1615
-			$qv['attachment_id'] = $qv['subpost_id'];
1623
+		if ( '' != $qv['subpost'] ) {
1624
+					$qv['attachment'] = $qv['subpost'];
1625
+		}
1626
+		if ( '' != $qv['subpost_id'] ) {
1627
+					$qv['attachment_id'] = $qv['subpost_id'];
1628
+		}
1616 1629
 
1617 1630
 		$qv['attachment_id'] = absint($qv['attachment_id']);
1618 1631
 
@@ -1728,38 +1741,46 @@  discard block
 block discarded – undo
1728 1741
 				$this->is_author = true;
1729 1742
 			}
1730 1743
 
1731
-			if ( '' != $qv['author_name'] )
1732
-				$this->is_author = true;
1744
+			if ( '' != $qv['author_name'] ) {
1745
+							$this->is_author = true;
1746
+			}
1733 1747
 
1734 1748
 			if ( !empty( $qv['post_type'] ) && ! is_array( $qv['post_type'] ) ) {
1735 1749
 				$post_type_obj = get_post_type_object( $qv['post_type'] );
1736
-				if ( ! empty( $post_type_obj->has_archive ) )
1737
-					$this->is_post_type_archive = true;
1750
+				if ( ! empty( $post_type_obj->has_archive ) ) {
1751
+									$this->is_post_type_archive = true;
1752
+				}
1738 1753
 			}
1739 1754
 
1740
-			if ( $this->is_post_type_archive || $this->is_date || $this->is_author || $this->is_category || $this->is_tag || $this->is_tax )
1741
-				$this->is_archive = true;
1755
+			if ( $this->is_post_type_archive || $this->is_date || $this->is_author || $this->is_category || $this->is_tag || $this->is_tax ) {
1756
+							$this->is_archive = true;
1757
+			}
1742 1758
 		}
1743 1759
 
1744
-		if ( '' != $qv['feed'] )
1745
-			$this->is_feed = true;
1760
+		if ( '' != $qv['feed'] ) {
1761
+					$this->is_feed = true;
1762
+		}
1746 1763
 
1747 1764
 		if ( '' != $qv['embed'] ) {
1748 1765
 			$this->is_embed = true;
1749 1766
 		}
1750 1767
 
1751
-		if ( '' != $qv['tb'] )
1752
-			$this->is_trackback = true;
1768
+		if ( '' != $qv['tb'] ) {
1769
+					$this->is_trackback = true;
1770
+		}
1753 1771
 
1754
-		if ( '' != $qv['paged'] && ( intval($qv['paged']) > 1 ) )
1755
-			$this->is_paged = true;
1772
+		if ( '' != $qv['paged'] && ( intval($qv['paged']) > 1 ) ) {
1773
+					$this->is_paged = true;
1774
+		}
1756 1775
 
1757 1776
 		// if we're previewing inside the write screen
1758
-		if ( '' != $qv['preview'] )
1759
-			$this->is_preview = true;
1777
+		if ( '' != $qv['preview'] ) {
1778
+					$this->is_preview = true;
1779
+		}
1760 1780
 
1761
-		if ( is_admin() )
1762
-			$this->is_admin = true;
1781
+		if ( is_admin() ) {
1782
+					$this->is_admin = true;
1783
+		}
1763 1784
 
1764 1785
 		if ( false !== strpos($qv['feed'], 'comments-') ) {
1765 1786
 			$qv['feed'] = str_replace('comments-', '', $qv['feed']);
@@ -1768,18 +1789,21 @@  discard block
 block discarded – undo
1768 1789
 
1769 1790
 		$this->is_singular = $this->is_single || $this->is_page || $this->is_attachment;
1770 1791
 
1771
-		if ( $this->is_feed && ( !empty($qv['withcomments']) || ( empty($qv['withoutcomments']) && $this->is_singular ) ) )
1772
-			$this->is_comment_feed = true;
1792
+		if ( $this->is_feed && ( !empty($qv['withcomments']) || ( empty($qv['withoutcomments']) && $this->is_singular ) ) ) {
1793
+					$this->is_comment_feed = true;
1794
+		}
1773 1795
 
1774
-		if ( !( $this->is_singular || $this->is_archive || $this->is_search || $this->is_feed || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) || $this->is_trackback || $this->is_404 || $this->is_admin || $this->is_robots ) )
1775
-			$this->is_home = true;
1796
+		if ( !( $this->is_singular || $this->is_archive || $this->is_search || $this->is_feed || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) || $this->is_trackback || $this->is_404 || $this->is_admin || $this->is_robots ) ) {
1797
+					$this->is_home = true;
1798
+		}
1776 1799
 
1777 1800
 		// Correct is_* for page_on_front and page_for_posts
1778 1801
 		if ( $this->is_home && 'page' == get_option('show_on_front') && get_option('page_on_front') ) {
1779 1802
 			$_query = wp_parse_args($this->query);
1780 1803
 			// pagename can be set and empty depending on matched rewrite rules. Ignore an empty pagename.
1781
-			if ( isset($_query['pagename']) && '' == $_query['pagename'] )
1782
-				unset($_query['pagename']);
1804
+			if ( isset($_query['pagename']) && '' == $_query['pagename'] ) {
1805
+							unset($_query['pagename']);
1806
+			}
1783 1807
 
1784 1808
 			unset( $_query['embed'] );
1785 1809
 
@@ -1832,27 +1856,31 @@  discard block
 block discarded – undo
1832 1856
 		}
1833 1857
 
1834 1858
 		if ( !empty($qv['post_type']) ) {
1835
-			if ( is_array($qv['post_type']) )
1836
-				$qv['post_type'] = array_map('sanitize_key', $qv['post_type']);
1837
-			else
1838
-				$qv['post_type'] = sanitize_key($qv['post_type']);
1859
+			if ( is_array($qv['post_type']) ) {
1860
+							$qv['post_type'] = array_map('sanitize_key', $qv['post_type']);
1861
+			} else {
1862
+							$qv['post_type'] = sanitize_key($qv['post_type']);
1863
+			}
1839 1864
 		}
1840 1865
 
1841 1866
 		if ( ! empty( $qv['post_status'] ) ) {
1842
-			if ( is_array( $qv['post_status'] ) )
1843
-				$qv['post_status'] = array_map('sanitize_key', $qv['post_status']);
1844
-			else
1845
-				$qv['post_status'] = preg_replace('|[^a-z0-9_,-]|', '', $qv['post_status']);
1867
+			if ( is_array( $qv['post_status'] ) ) {
1868
+							$qv['post_status'] = array_map('sanitize_key', $qv['post_status']);
1869
+			} else {
1870
+							$qv['post_status'] = preg_replace('|[^a-z0-9_,-]|', '', $qv['post_status']);
1871
+			}
1846 1872
 		}
1847 1873
 
1848
-		if ( $this->is_posts_page && ( ! isset($qv['withcomments']) || ! $qv['withcomments'] ) )
1849
-			$this->is_comment_feed = false;
1874
+		if ( $this->is_posts_page && ( ! isset($qv['withcomments']) || ! $qv['withcomments'] ) ) {
1875
+					$this->is_comment_feed = false;
1876
+		}
1850 1877
 
1851 1878
 		$this->is_singular = $this->is_single || $this->is_page || $this->is_attachment;
1852 1879
 		// Done correcting is_* for page_on_front and page_for_posts
1853 1880
 
1854
-		if ( '404' == $qv['error'] )
1855
-			$this->set_404();
1881
+		if ( '404' == $qv['error'] ) {
1882
+					$this->set_404();
1883
+		}
1856 1884
 
1857 1885
 		$this->is_embed = $this->is_embed && ( $this->is_singular || $this->is_404 );
1858 1886
 
@@ -1895,8 +1923,10 @@  discard block
 block discarded – undo
1895 1923
 		}
1896 1924
 
1897 1925
 		foreach ( get_taxonomies( array() , 'objects' ) as $taxonomy => $t ) {
1898
-			if ( 'post_tag' == $taxonomy )
1899
-				continue;	// Handled further down in the $q['tag'] block
1926
+			if ( 'post_tag' == $taxonomy ) {
1927
+							continue;
1928
+			}
1929
+			// Handled further down in the $q['tag'] block
1900 1930
 
1901 1931
 			if ( $t->query_var && !empty( $q[$t->query_var] ) ) {
1902 1932
 				$tax_query_defaults = array(
@@ -1943,10 +1973,11 @@  discard block
 block discarded – undo
1943 1973
 			$q['cat'] = implode( ',', $cat_array );
1944 1974
 
1945 1975
 			foreach ( $cat_array as $cat ) {
1946
-				if ( $cat > 0 )
1947
-					$cat_in[] = $cat;
1948
-				elseif ( $cat < 0 )
1949
-					$cat_not_in[] = abs( $cat );
1976
+				if ( $cat > 0 ) {
1977
+									$cat_in[] = $cat;
1978
+				} elseif ( $cat < 0 ) {
1979
+									$cat_not_in[] = abs( $cat );
1980
+				}
1950 1981
 			}
1951 1982
 
1952 1983
 			if ( ! empty( $cat_in ) ) {
@@ -1972,8 +2003,9 @@  discard block
 block discarded – undo
1972 2003
 
1973 2004
 		if ( ! empty( $q['category__and'] ) && 1 === count( (array) $q['category__and'] ) ) {
1974 2005
 			$q['category__and'] = (array) $q['category__and'];
1975
-			if ( ! isset( $q['category__in'] ) )
1976
-				$q['category__in'] = array();
2006
+			if ( ! isset( $q['category__in'] ) ) {
2007
+							$q['category__in'] = array();
2008
+			}
1977 2009
 			$q['category__in'][] = absint( reset( $q['category__and'] ) );
1978 2010
 			unset( $q['category__and'] );
1979 2011
 		}
@@ -2116,8 +2148,9 @@  discard block
 block discarded – undo
2116 2148
 
2117 2149
 		// added slashes screw with quote grouping when done early, so done later
2118 2150
 		$q['s'] = stripslashes( $q['s'] );
2119
-		if ( empty( $_GET['s'] ) && $this->is_main_query() )
2120
-			$q['s'] = urldecode( $q['s'] );
2151
+		if ( empty( $_GET['s'] ) && $this->is_main_query() ) {
2152
+					$q['s'] = urldecode( $q['s'] );
2153
+		}
2121 2154
 		// there are no line breaks in <input /> fields
2122 2155
 		$q['s'] = str_replace( array( "\r", "\n" ), '', $q['s'] );
2123 2156
 		$q['search_terms_count'] = 1;
@@ -2128,8 +2161,9 @@  discard block
 block discarded – undo
2128 2161
 				$q['search_terms_count'] = count( $matches[0] );
2129 2162
 				$q['search_terms'] = $this->parse_search_terms( $matches[0] );
2130 2163
 				// if the search string has only short terms or stopwords, or is 10+ terms long, match it as sentence
2131
-				if ( empty( $q['search_terms'] ) || count( $q['search_terms'] ) > 9 )
2132
-					$q['search_terms'] = array( $q['s'] );
2164
+				if ( empty( $q['search_terms'] ) || count( $q['search_terms'] ) > 9 ) {
2165
+									$q['search_terms'] = array( $q['s'] );
2166
+				}
2133 2167
 			} else {
2134 2168
 				$q['search_terms'] = array( $q['s'] );
2135 2169
 			}
@@ -2162,8 +2196,9 @@  discard block
 block discarded – undo
2162 2196
 
2163 2197
 		if ( ! empty( $search ) ) {
2164 2198
 			$search = " AND ({$search}) ";
2165
-			if ( ! is_user_logged_in() )
2166
-				$search .= " AND ($wpdb->posts.post_password = '') ";
2199
+			if ( ! is_user_logged_in() ) {
2200
+							$search .= " AND ($wpdb->posts.post_password = '') ";
2201
+			}
2167 2202
 		}
2168 2203
 
2169 2204
 		return $search;
@@ -2189,17 +2224,20 @@  discard block
 block discarded – undo
2189 2224
 
2190 2225
 		foreach ( $terms as $term ) {
2191 2226
 			// keep before/after spaces when term is for exact match
2192
-			if ( preg_match( '/^".+"$/', $term ) )
2193
-				$term = trim( $term, "\"'" );
2194
-			else
2195
-				$term = trim( $term, "\"' " );
2227
+			if ( preg_match( '/^".+"$/', $term ) ) {
2228
+							$term = trim( $term, "\"'" );
2229
+			} else {
2230
+							$term = trim( $term, "\"' " );
2231
+			}
2196 2232
 
2197 2233
 			// Avoid single A-Z and single dashes.
2198
-			if ( ! $term || ( 1 === strlen( $term ) && preg_match( '/^[a-z\-]$/i', $term ) ) )
2199
-				continue;
2234
+			if ( ! $term || ( 1 === strlen( $term ) && preg_match( '/^[a-z\-]$/i', $term ) ) ) {
2235
+							continue;
2236
+			}
2200 2237
 
2201
-			if ( in_array( call_user_func( $strtolower, $term ), $stopwords, true ) )
2202
-				continue;
2238
+			if ( in_array( call_user_func( $strtolower, $term ), $stopwords, true ) ) {
2239
+							continue;
2240
+			}
2203 2241
 
2204 2242
 			$checked[] = $term;
2205 2243
 		}
@@ -2215,8 +2253,9 @@  discard block
 block discarded – undo
2215 2253
 	 * @return array Stopwords.
2216 2254
 	 */
2217 2255
 	protected function get_search_stopwords() {
2218
-		if ( isset( $this->stopwords ) )
2219
-			return $this->stopwords;
2256
+		if ( isset( $this->stopwords ) ) {
2257
+					return $this->stopwords;
2258
+		}
2220 2259
 
2221 2260
 		/* translators: This is a comma-separated list of very common words that should be excluded from a search,
2222 2261
 		 * like a, an, and the. These are usually called "stopwords". You should not simply translate these individual
@@ -2228,8 +2267,9 @@  discard block
 block discarded – undo
2228 2267
 		$stopwords = array();
2229 2268
 		foreach ( $words as $word ) {
2230 2269
 			$word = trim( $word, "\r\n\t " );
2231
-			if ( $word )
2232
-				$stopwords[] = $word;
2270
+			if ( $word ) {
2271
+							$stopwords[] = $word;
2272
+			}
2233 2273
 		}
2234 2274
 
2235 2275
 		/**
@@ -2276,8 +2316,9 @@  discard block
 block discarded – undo
2276 2316
 				// all words in title
2277 2317
 				$search_orderby .= 'WHEN ' . implode( ' AND ', $q['search_orderby_title'] ) . ' THEN 2 ';
2278 2318
 				// any word in title, not needed when $num_terms == 1
2279
-				if ( $num_terms > 1 )
2280
-					$search_orderby .= 'WHEN ' . implode( ' OR ', $q['search_orderby_title'] ) . ' THEN 3 ';
2319
+				if ( $num_terms > 1 ) {
2320
+									$search_orderby .= 'WHEN ' . implode( ' OR ', $q['search_orderby_title'] ) . ' THEN 3 ';
2321
+				}
2281 2322
 			}
2282 2323
 
2283 2324
 			// Sentence match in 'post_content' and 'post_excerpt'.
@@ -2524,34 +2565,41 @@  discard block
 block discarded – undo
2524 2565
 
2525 2566
 		if ( isset( $q['caller_get_posts'] ) ) {
2526 2567
 			_deprecated_argument( 'WP_Query', '3.1', __( '"caller_get_posts" is deprecated. Use "ignore_sticky_posts" instead.' ) );
2527
-			if ( !isset( $q['ignore_sticky_posts'] ) )
2528
-				$q['ignore_sticky_posts'] = $q['caller_get_posts'];
2568
+			if ( !isset( $q['ignore_sticky_posts'] ) ) {
2569
+							$q['ignore_sticky_posts'] = $q['caller_get_posts'];
2570
+			}
2529 2571
 		}
2530 2572
 
2531
-		if ( !isset( $q['ignore_sticky_posts'] ) )
2532
-			$q['ignore_sticky_posts'] = false;
2573
+		if ( !isset( $q['ignore_sticky_posts'] ) ) {
2574
+					$q['ignore_sticky_posts'] = false;
2575
+		}
2533 2576
 
2534
-		if ( !isset($q['suppress_filters']) )
2535
-			$q['suppress_filters'] = false;
2577
+		if ( !isset($q['suppress_filters']) ) {
2578
+					$q['suppress_filters'] = false;
2579
+		}
2536 2580
 
2537 2581
 		if ( !isset($q['cache_results']) ) {
2538
-			if ( wp_using_ext_object_cache() )
2539
-				$q['cache_results'] = false;
2540
-			else
2541
-				$q['cache_results'] = true;
2582
+			if ( wp_using_ext_object_cache() ) {
2583
+							$q['cache_results'] = false;
2584
+			} else {
2585
+							$q['cache_results'] = true;
2586
+			}
2542 2587
 		}
2543 2588
 
2544
-		if ( !isset($q['update_post_term_cache']) )
2545
-			$q['update_post_term_cache'] = true;
2589
+		if ( !isset($q['update_post_term_cache']) ) {
2590
+					$q['update_post_term_cache'] = true;
2591
+		}
2546 2592
 
2547
-		if ( !isset($q['update_post_meta_cache']) )
2548
-			$q['update_post_meta_cache'] = true;
2593
+		if ( !isset($q['update_post_meta_cache']) ) {
2594
+					$q['update_post_meta_cache'] = true;
2595
+		}
2549 2596
 
2550 2597
 		if ( !isset($q['post_type']) ) {
2551
-			if ( $this->is_search )
2552
-				$q['post_type'] = 'any';
2553
-			else
2554
-				$q['post_type'] = '';
2598
+			if ( $this->is_search ) {
2599
+							$q['post_type'] = 'any';
2600
+			} else {
2601
+							$q['post_type'] = '';
2602
+			}
2555 2603
 		}
2556 2604
 		$post_type = $q['post_type'];
2557 2605
 		if ( empty( $q['posts_per_page'] ) ) {
@@ -2561,8 +2609,9 @@  discard block
 block discarded – undo
2561 2609
 			$q['showposts'] = (int) $q['showposts'];
2562 2610
 			$q['posts_per_page'] = $q['showposts'];
2563 2611
 		}
2564
-		if ( (isset($q['posts_per_archive_page']) && $q['posts_per_archive_page'] != 0) && ($this->is_archive || $this->is_search) )
2565
-			$q['posts_per_page'] = $q['posts_per_archive_page'];
2612
+		if ( (isset($q['posts_per_archive_page']) && $q['posts_per_archive_page'] != 0) && ($this->is_archive || $this->is_search) ) {
2613
+					$q['posts_per_page'] = $q['posts_per_archive_page'];
2614
+		}
2566 2615
 		if ( !isset($q['nopaging']) ) {
2567 2616
 			if ( $q['posts_per_page'] == -1 ) {
2568 2617
 				$q['nopaging'] = true;
@@ -2581,13 +2630,15 @@  discard block
 block discarded – undo
2581 2630
 			$q['nopaging'] = false;
2582 2631
 		}
2583 2632
 		$q['posts_per_page'] = (int) $q['posts_per_page'];
2584
-		if ( $q['posts_per_page'] < -1 )
2585
-			$q['posts_per_page'] = abs($q['posts_per_page']);
2586
-		elseif ( $q['posts_per_page'] == 0 )
2587
-			$q['posts_per_page'] = 1;
2633
+		if ( $q['posts_per_page'] < -1 ) {
2634
+					$q['posts_per_page'] = abs($q['posts_per_page']);
2635
+		} elseif ( $q['posts_per_page'] == 0 ) {
2636
+					$q['posts_per_page'] = 1;
2637
+		}
2588 2638
 
2589
-		if ( !isset($q['comments_per_page']) || $q['comments_per_page'] == 0 )
2590
-			$q['comments_per_page'] = get_option('comments_per_page');
2639
+		if ( !isset($q['comments_per_page']) || $q['comments_per_page'] == 0 ) {
2640
+					$q['comments_per_page'] = get_option('comments_per_page');
2641
+		}
2591 2642
 
2592 2643
 		if ( $this->is_home && (empty($this->query) || $q['preview'] == 'true') && ( 'page' == get_option('show_on_front') ) && get_option('page_on_front') ) {
2593 2644
 			$this->is_page = true;
@@ -2601,10 +2652,11 @@  discard block
 block discarded – undo
2601 2652
 		}
2602 2653
 
2603 2654
 		// If true, forcibly turns off SQL_CALC_FOUND_ROWS even when limits are present.
2604
-		if ( isset($q['no_found_rows']) )
2605
-			$q['no_found_rows'] = (bool) $q['no_found_rows'];
2606
-		else
2607
-			$q['no_found_rows'] = false;
2655
+		if ( isset($q['no_found_rows']) ) {
2656
+					$q['no_found_rows'] = (bool) $q['no_found_rows'];
2657
+		} else {
2658
+					$q['no_found_rows'] = false;
2659
+		}
2608 2660
 
2609 2661
 		switch ( $q['fields'] ) {
2610 2662
 			case 'ids':
@@ -2617,47 +2669,60 @@  discard block
 block discarded – undo
2617 2669
 				$fields = "$wpdb->posts.*";
2618 2670
 		}
2619 2671
 
2620
-		if ( '' !== $q['menu_order'] )
2621
-			$where .= " AND $wpdb->posts.menu_order = " . $q['menu_order'];
2672
+		if ( '' !== $q['menu_order'] ) {
2673
+					$where .= " AND $wpdb->posts.menu_order = " . $q['menu_order'];
2674
+		}
2622 2675
 
2623 2676
 		// The "m" parameter is meant for months but accepts datetimes of varying specificity
2624 2677
 		if ( $q['m'] ) {
2625 2678
 			$where .= " AND YEAR($wpdb->posts.post_date)=" . substr($q['m'], 0, 4);
2626
-			if ( strlen($q['m']) > 5 )
2627
-				$where .= " AND MONTH($wpdb->posts.post_date)=" . substr($q['m'], 4, 2);
2628
-			if ( strlen($q['m']) > 7 )
2629
-				$where .= " AND DAYOFMONTH($wpdb->posts.post_date)=" . substr($q['m'], 6, 2);
2630
-			if ( strlen($q['m']) > 9 )
2631
-				$where .= " AND HOUR($wpdb->posts.post_date)=" . substr($q['m'], 8, 2);
2632
-			if ( strlen($q['m']) > 11 )
2633
-				$where .= " AND MINUTE($wpdb->posts.post_date)=" . substr($q['m'], 10, 2);
2634
-			if ( strlen($q['m']) > 13 )
2635
-				$where .= " AND SECOND($wpdb->posts.post_date)=" . substr($q['m'], 12, 2);
2679
+			if ( strlen($q['m']) > 5 ) {
2680
+							$where .= " AND MONTH($wpdb->posts.post_date)=" . substr($q['m'], 4, 2);
2681
+			}
2682
+			if ( strlen($q['m']) > 7 ) {
2683
+							$where .= " AND DAYOFMONTH($wpdb->posts.post_date)=" . substr($q['m'], 6, 2);
2684
+			}
2685
+			if ( strlen($q['m']) > 9 ) {
2686
+							$where .= " AND HOUR($wpdb->posts.post_date)=" . substr($q['m'], 8, 2);
2687
+			}
2688
+			if ( strlen($q['m']) > 11 ) {
2689
+							$where .= " AND MINUTE($wpdb->posts.post_date)=" . substr($q['m'], 10, 2);
2690
+			}
2691
+			if ( strlen($q['m']) > 13 ) {
2692
+							$where .= " AND SECOND($wpdb->posts.post_date)=" . substr($q['m'], 12, 2);
2693
+			}
2636 2694
 		}
2637 2695
 
2638 2696
 		// Handle the other individual date parameters
2639 2697
 		$date_parameters = array();
2640 2698
 
2641
-		if ( '' !== $q['hour'] )
2642
-			$date_parameters['hour'] = $q['hour'];
2699
+		if ( '' !== $q['hour'] ) {
2700
+					$date_parameters['hour'] = $q['hour'];
2701
+		}
2643 2702
 
2644
-		if ( '' !== $q['minute'] )
2645
-			$date_parameters['minute'] = $q['minute'];
2703
+		if ( '' !== $q['minute'] ) {
2704
+					$date_parameters['minute'] = $q['minute'];
2705
+		}
2646 2706
 
2647
-		if ( '' !== $q['second'] )
2648
-			$date_parameters['second'] = $q['second'];
2707
+		if ( '' !== $q['second'] ) {
2708
+					$date_parameters['second'] = $q['second'];
2709
+		}
2649 2710
 
2650
-		if ( $q['year'] )
2651
-			$date_parameters['year'] = $q['year'];
2711
+		if ( $q['year'] ) {
2712
+					$date_parameters['year'] = $q['year'];
2713
+		}
2652 2714
 
2653
-		if ( $q['monthnum'] )
2654
-			$date_parameters['monthnum'] = $q['monthnum'];
2715
+		if ( $q['monthnum'] ) {
2716
+					$date_parameters['monthnum'] = $q['monthnum'];
2717
+		}
2655 2718
 
2656
-		if ( $q['w'] )
2657
-			$date_parameters['week'] = $q['w'];
2719
+		if ( $q['w'] ) {
2720
+					$date_parameters['week'] = $q['w'];
2721
+		}
2658 2722
 
2659
-		if ( $q['day'] )
2660
-			$date_parameters['day'] = $q['day'];
2723
+		if ( $q['day'] ) {
2724
+					$date_parameters['day'] = $q['day'];
2725
+		}
2661 2726
 
2662 2727
 		if ( $date_parameters ) {
2663 2728
 			$date_query = new WP_Date_Query( array( $date_parameters ) );
@@ -2676,8 +2741,9 @@  discard block
 block discarded – undo
2676 2741
 		if ( !empty($q['post_type']) && 'any' != $q['post_type'] ) {
2677 2742
 			foreach ( (array)$q['post_type'] as $_post_type ) {
2678 2743
 				$ptype_obj = get_post_type_object($_post_type);
2679
-				if ( !$ptype_obj || !$ptype_obj->query_var || empty($q[ $ptype_obj->query_var ]) )
2680
-					continue;
2744
+				if ( !$ptype_obj || !$ptype_obj->query_var || empty($q[ $ptype_obj->query_var ]) ) {
2745
+									continue;
2746
+				}
2681 2747
 
2682 2748
 				if ( ! $ptype_obj->hierarchical ) {
2683 2749
 					// Non-hierarchical post types can directly use 'name'.
@@ -2709,21 +2775,24 @@  discard block
 block discarded – undo
2709 2775
 				if ( 'page' != $q['post_type'] ) {
2710 2776
 					foreach ( (array)$q['post_type'] as $_post_type ) {
2711 2777
 						$ptype_obj = get_post_type_object($_post_type);
2712
-						if ( !$ptype_obj || !$ptype_obj->hierarchical )
2713
-							continue;
2778
+						if ( !$ptype_obj || !$ptype_obj->hierarchical ) {
2779
+													continue;
2780
+						}
2714 2781
 
2715 2782
 						$reqpage = get_page_by_path($q['pagename'], OBJECT, $_post_type);
2716
-						if ( $reqpage )
2717
-							break;
2783
+						if ( $reqpage ) {
2784
+													break;
2785
+						}
2718 2786
 					}
2719 2787
 					unset($ptype_obj);
2720 2788
 				} else {
2721 2789
 					$reqpage = get_page_by_path($q['pagename']);
2722 2790
 				}
2723
-				if ( !empty($reqpage) )
2724
-					$reqpage = $reqpage->ID;
2725
-				else
2726
-					$reqpage = 0;
2791
+				if ( !empty($reqpage) ) {
2792
+									$reqpage = $reqpage->ID;
2793
+				} else {
2794
+									$reqpage = 0;
2795
+				}
2727 2796
 			}
2728 2797
 
2729 2798
 			$page_for_posts = get_option('page_for_posts');
@@ -2749,8 +2818,9 @@  discard block
 block discarded – undo
2749 2818
 		}
2750 2819
 
2751 2820
 		// If an attachment is requested by number, let it supersede any post number.
2752
-		if ( $q['attachment_id'] )
2753
-			$q['p'] = absint($q['attachment_id']);
2821
+		if ( $q['attachment_id'] ) {
2822
+					$q['p'] = absint($q['attachment_id']);
2823
+		}
2754 2824
 
2755 2825
 		// If a post number is specified, load that post
2756 2826
 		if ( $q['p'] ) {
@@ -2814,13 +2884,15 @@  discard block
 block discarded – undo
2814 2884
 				$taxonomies = array_keys( $this->tax_query->queried_terms );
2815 2885
 				foreach ( get_post_types( array( 'exclude_from_search' => false ) ) as $pt ) {
2816 2886
 					$object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies( $pt );
2817
-					if ( array_intersect( $taxonomies, $object_taxonomies ) )
2818
-						$post_type[] = $pt;
2887
+					if ( array_intersect( $taxonomies, $object_taxonomies ) ) {
2888
+											$post_type[] = $pt;
2889
+					}
2890
+				}
2891
+				if ( ! $post_type ) {
2892
+									$post_type = 'any';
2893
+				} elseif ( count( $post_type ) == 1 ) {
2894
+									$post_type = $post_type[0];
2819 2895
 				}
2820
-				if ( ! $post_type )
2821
-					$post_type = 'any';
2822
-				elseif ( count( $post_type ) == 1 )
2823
-					$post_type = $post_type[0];
2824 2896
 
2825 2897
 				$post_status_join = true;
2826 2898
 			} elseif ( in_array('attachment', (array) $post_type) ) {
@@ -2921,15 +2993,17 @@  discard block
 block discarded – undo
2921 2993
 			}
2922 2994
 			$q['author_name'] = sanitize_title_for_query( $q['author_name'] );
2923 2995
 			$q['author'] = get_user_by('slug', $q['author_name']);
2924
-			if ( $q['author'] )
2925
-				$q['author'] = $q['author']->ID;
2996
+			if ( $q['author'] ) {
2997
+							$q['author'] = $q['author']->ID;
2998
+			}
2926 2999
 			$whichauthor .= " AND ($wpdb->posts.post_author = " . absint($q['author']) . ')';
2927 3000
 		}
2928 3001
 
2929 3002
 		// MIME-Type stuff for attachment browsing
2930 3003
 
2931
-		if ( isset( $q['post_mime_type'] ) && '' != $q['post_mime_type'] )
2932
-			$whichmimetype = wp_post_mime_type_where( $q['post_mime_type'], $wpdb->posts );
3004
+		if ( isset( $q['post_mime_type'] ) && '' != $q['post_mime_type'] ) {
3005
+					$whichmimetype = wp_post_mime_type_where( $q['post_mime_type'], $wpdb->posts );
3006
+		}
2933 3007
 
2934 3008
 		$where .= $search . $whichauthor . $whichmimetype;
2935 3009
 
@@ -3004,8 +3078,9 @@  discard block
 block discarded – undo
3004 3078
 		// Order search results by relevance only when another "orderby" is not specified in the query.
3005 3079
 		if ( ! empty( $q['s'] ) ) {
3006 3080
 			$search_orderby = '';
3007
-			if ( ! empty( $q['search_orderby_title'] ) && ( empty( $q['orderby'] ) && ! $this->is_feed ) || ( isset( $q['orderby'] ) && 'relevance' === $q['orderby'] ) )
3008
-				$search_orderby = $this->parse_search_order( $q );
3081
+			if ( ! empty( $q['search_orderby_title'] ) && ( empty( $q['orderby'] ) && ! $this->is_feed ) || ( isset( $q['orderby'] ) && 'relevance' === $q['orderby'] ) ) {
3082
+							$search_orderby = $this->parse_search_order( $q );
3083
+			}
3009 3084
 
3010 3085
 			if ( ! $q['suppress_filters'] ) {
3011 3086
 				/**
@@ -3019,18 +3094,21 @@  discard block
 block discarded – undo
3019 3094
 				$search_orderby = apply_filters( 'posts_search_orderby', $search_orderby, $this );
3020 3095
 			}
3021 3096
 
3022
-			if ( $search_orderby )
3023
-				$orderby = $orderby ? $search_orderby . ', ' . $orderby : $search_orderby;
3097
+			if ( $search_orderby ) {
3098
+							$orderby = $orderby ? $search_orderby . ', ' . $orderby : $search_orderby;
3099
+			}
3024 3100
 		}
3025 3101
 
3026 3102
 		if ( is_array( $post_type ) && count( $post_type ) > 1 ) {
3027 3103
 			$post_type_cap = 'multiple_post_type';
3028 3104
 		} else {
3029
-			if ( is_array( $post_type ) )
3030
-				$post_type = reset( $post_type );
3105
+			if ( is_array( $post_type ) ) {
3106
+							$post_type = reset( $post_type );
3107
+			}
3031 3108
 			$post_type_object = get_post_type_object( $post_type );
3032
-			if ( empty( $post_type_object ) )
3033
-				$post_type_cap = $post_type;
3109
+			if ( empty( $post_type_object ) ) {
3110
+							$post_type_cap = $post_type;
3111
+			}
3034 3112
 		}
3035 3113
 
3036 3114
 		if ( isset( $q['post_password'] ) ) {
@@ -3052,10 +3130,11 @@  discard block
 block discarded – undo
3052 3130
 
3053 3131
 		if ( 'any' == $post_type ) {
3054 3132
 			$in_search_post_types = get_post_types( array('exclude_from_search' => false) );
3055
-			if ( empty( $in_search_post_types ) )
3056
-				$where .= ' AND 1=0 ';
3057
-			else
3058
-				$where .= " AND $wpdb->posts.post_type IN ('" . join("', '", $in_search_post_types ) . "')";
3133
+			if ( empty( $in_search_post_types ) ) {
3134
+							$where .= ' AND 1=0 ';
3135
+			} else {
3136
+							$where .= " AND $wpdb->posts.post_type IN ('" . join("', '", $in_search_post_types ) . "')";
3137
+			}
3059 3138
 		} elseif ( !empty( $post_type ) && is_array( $post_type ) ) {
3060 3139
 			$where .= " AND $wpdb->posts.post_type IN ('" . join("', '", $post_type) . "')";
3061 3140
 		} elseif ( ! empty( $post_type ) ) {
@@ -3089,8 +3168,9 @@  discard block
 block discarded – undo
3089 3168
 		if ( ! empty( $q['post_status'] ) ) {
3090 3169
 			$statuswheres = array();
3091 3170
 			$q_status = $q['post_status'];
3092
-			if ( ! is_array( $q_status ) )
3093
-				$q_status = explode(',', $q_status);
3171
+			if ( ! is_array( $q_status ) ) {
3172
+							$q_status = explode(',', $q_status);
3173
+			}
3094 3174
 			$r_status = array();
3095 3175
 			$p_status = array();
3096 3176
 			$e_status = array();
@@ -3103,10 +3183,11 @@  discard block
 block discarded – undo
3103 3183
 			} else {
3104 3184
 				foreach ( get_post_stati() as $status ) {
3105 3185
 					if ( in_array( $status, $q_status ) ) {
3106
-						if ( 'private' == $status )
3107
-							$p_status[] = "$wpdb->posts.post_status = '$status'";
3108
-						else
3109
-							$r_status[] = "$wpdb->posts.post_status = '$status'";
3186
+						if ( 'private' == $status ) {
3187
+													$p_status[] = "$wpdb->posts.post_status = '$status'";
3188
+						} else {
3189
+													$r_status[] = "$wpdb->posts.post_status = '$status'";
3190
+						}
3110 3191
 					}
3111 3192
 				}
3112 3193
 			}
@@ -3120,21 +3201,24 @@  discard block
 block discarded – undo
3120 3201
 				$statuswheres[] = "(" . join( ' AND ', $e_status ) . ")";
3121 3202
 			}
3122 3203
 			if ( !empty($r_status) ) {
3123
-				if ( !empty($q['perm'] ) && 'editable' == $q['perm'] && !current_user_can($edit_others_cap) )
3124
-					$statuswheres[] = "($wpdb->posts.post_author = $user_id " . "AND (" . join( ' OR ', $r_status ) . "))";
3125
-				else
3126
-					$statuswheres[] = "(" . join( ' OR ', $r_status ) . ")";
3204
+				if ( !empty($q['perm'] ) && 'editable' == $q['perm'] && !current_user_can($edit_others_cap) ) {
3205
+									$statuswheres[] = "($wpdb->posts.post_author = $user_id " . "AND (" . join( ' OR ', $r_status ) . "))";
3206
+				} else {
3207
+									$statuswheres[] = "(" . join( ' OR ', $r_status ) . ")";
3208
+				}
3127 3209
 			}
3128 3210
 			if ( !empty($p_status) ) {
3129
-				if ( !empty($q['perm'] ) && 'readable' == $q['perm'] && !current_user_can($read_private_cap) )
3130
-					$statuswheres[] = "($wpdb->posts.post_author = $user_id " . "AND (" . join( ' OR ', $p_status ) . "))";
3131
-				else
3132
-					$statuswheres[] = "(" . join( ' OR ', $p_status ) . ")";
3211
+				if ( !empty($q['perm'] ) && 'readable' == $q['perm'] && !current_user_can($read_private_cap) ) {
3212
+									$statuswheres[] = "($wpdb->posts.post_author = $user_id " . "AND (" . join( ' OR ', $p_status ) . "))";
3213
+				} else {
3214
+									$statuswheres[] = "(" . join( ' OR ', $p_status ) . ")";
3215
+				}
3133 3216
 			}
3134 3217
 			if ( $post_status_join ) {
3135 3218
 				$join .= " LEFT JOIN $wpdb->posts AS p2 ON ($wpdb->posts.post_parent = p2.ID) ";
3136
-				foreach ( $statuswheres as $index => $statuswhere )
3137
-					$statuswheres[$index] = "($statuswhere OR ($wpdb->posts.post_status = 'inherit' AND " . str_replace($wpdb->posts, 'p2', $statuswhere) . "))";
3219
+				foreach ( $statuswheres as $index => $statuswhere ) {
3220
+									$statuswheres[$index] = "($statuswhere OR ($wpdb->posts.post_status = 'inherit' AND " . str_replace($wpdb->posts, 'p2', $statuswhere) . "))";
3221
+				}
3138 3222
 			}
3139 3223
 			$where_status = implode( ' OR ', $statuswheres );
3140 3224
 			if ( ! empty( $where_status ) ) {
@@ -3146,23 +3230,27 @@  discard block
 block discarded – undo
3146 3230
 			// Add public states.
3147 3231
 			$public_states = get_post_stati( array('public' => true) );
3148 3232
 			foreach ( (array) $public_states as $state ) {
3149
-				if ( 'publish' == $state ) // Publish is hard-coded above.
3233
+				if ( 'publish' == $state ) {
3234
+					// Publish is hard-coded above.
3150 3235
 					continue;
3236
+				}
3151 3237
 				$where .= " OR $wpdb->posts.post_status = '$state'";
3152 3238
 			}
3153 3239
 
3154 3240
 			if ( $this->is_admin ) {
3155 3241
 				// Add protected states that should show in the admin all list.
3156 3242
 				$admin_all_states = get_post_stati( array('protected' => true, 'show_in_admin_all_list' => true) );
3157
-				foreach ( (array) $admin_all_states as $state )
3158
-					$where .= " OR $wpdb->posts.post_status = '$state'";
3243
+				foreach ( (array) $admin_all_states as $state ) {
3244
+									$where .= " OR $wpdb->posts.post_status = '$state'";
3245
+				}
3159 3246
 			}
3160 3247
 
3161 3248
 			if ( is_user_logged_in() ) {
3162 3249
 				// Add private states that are limited to viewing by the author of a post or someone who has caps to read private states.
3163 3250
 				$private_states = get_post_stati( array('private' => true) );
3164
-				foreach ( (array) $private_states as $state )
3165
-					$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'";
3251
+				foreach ( (array) $private_states as $state ) {
3252
+									$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'";
3253
+				}
3166 3254
 			}
3167 3255
 
3168 3256
 			$where .= ')';
@@ -3197,8 +3285,9 @@  discard block
 block discarded – undo
3197 3285
 		// Paging
3198 3286
 		if ( empty($q['nopaging']) && !$this->is_singular ) {
3199 3287
 			$page = absint($q['paged']);
3200
-			if ( !$page )
3201
-				$page = 1;
3288
+			if ( !$page ) {
3289
+							$page = 1;
3290
+			}
3202 3291
 
3203 3292
 			// If 'offset' is provided, it takes precedence over 'paged'.
3204 3293
 			if ( isset( $q['offset'] ) && is_numeric( $q['offset'] ) ) {
@@ -3283,15 +3372,17 @@  discard block
 block discarded – undo
3283 3372
 
3284 3373
 			$post_ids = array();
3285 3374
 
3286
-			foreach ( $this->comments as $comment )
3287
-				$post_ids[] = (int) $comment->comment_post_ID;
3375
+			foreach ( $this->comments as $comment ) {
3376
+							$post_ids[] = (int) $comment->comment_post_ID;
3377
+			}
3288 3378
 
3289 3379
 			$post_ids = join(',', $post_ids);
3290 3380
 			$join = '';
3291
-			if ( $post_ids )
3292
-				$where = "AND $wpdb->posts.ID IN ($post_ids) ";
3293
-			else
3294
-				$where = "AND 0";
3381
+			if ( $post_ids ) {
3382
+							$where = "AND $wpdb->posts.ID IN ($post_ids) ";
3383
+			} else {
3384
+							$where = "AND 0";
3385
+			}
3295 3386
 		}
3296 3387
 
3297 3388
 		$pieces = array( 'where', 'groupby', 'join', 'orderby', 'distinct', 'fields', 'limits' );
@@ -3521,14 +3612,17 @@  discard block
 block discarded – undo
3521 3612
 			$limits = isset( $clauses[ 'limits' ] ) ? $clauses[ 'limits' ] : '';
3522 3613
 		}
3523 3614
 
3524
-		if ( ! empty($groupby) )
3525
-			$groupby = 'GROUP BY ' . $groupby;
3526
-		if ( !empty( $orderby ) )
3527
-			$orderby = 'ORDER BY ' . $orderby;
3615
+		if ( ! empty($groupby) ) {
3616
+					$groupby = 'GROUP BY ' . $groupby;
3617
+		}
3618
+		if ( !empty( $orderby ) ) {
3619
+					$orderby = 'ORDER BY ' . $orderby;
3620
+		}
3528 3621
 
3529 3622
 		$found_rows = '';
3530
-		if ( !$q['no_found_rows'] && !empty($limits) )
3531
-			$found_rows = 'SQL_CALC_FOUND_ROWS';
3623
+		if ( !$q['no_found_rows'] && !empty($limits) ) {
3624
+					$found_rows = 'SQL_CALC_FOUND_ROWS';
3625
+		}
3532 3626
 
3533 3627
 		$this->request = $old_request = "SELECT $found_rows $distinct $fields FROM $wpdb->posts $join WHERE 1=1 $where $groupby $orderby $limits";
3534 3628
 
@@ -3615,8 +3709,9 @@  discard block
 block discarded – undo
3615 3709
 		}
3616 3710
 
3617 3711
 		// Convert to WP_Post objects
3618
-		if ( $this->posts )
3619
-			$this->posts = array_map( 'get_post', $this->posts );
3712
+		if ( $this->posts ) {
3713
+					$this->posts = array_map( 'get_post', $this->posts );
3714
+		}
3620 3715
 
3621 3716
 		if ( ! $q['suppress_filters'] ) {
3622 3717
 			/**
@@ -3678,12 +3773,14 @@  discard block
 block discarded – undo
3678 3773
 							$this->posts = array();
3679 3774
 						} else {
3680 3775
 							$this->is_preview = true;
3681
-							if ( 'future' != $status )
3682
-								$this->posts[0]->post_date = current_time('mysql');
3776
+							if ( 'future' != $status ) {
3777
+															$this->posts[0]->post_date = current_time('mysql');
3778
+							}
3683 3779
 						}
3684 3780
 					} elseif ( $post_status_obj->private ) {
3685
-						if ( ! current_user_can($read_cap, $this->posts[0]->ID) )
3686
-							$this->posts = array();
3781
+						if ( ! current_user_can($read_cap, $this->posts[0]->ID) ) {
3782
+													$this->posts = array();
3783
+						}
3687 3784
 					} else {
3688 3785
 						$this->posts = array();
3689 3786
 					}
@@ -3725,8 +3822,9 @@  discard block
 block discarded – undo
3725 3822
 			}
3726 3823
 
3727 3824
 			// If any posts have been excluded specifically, Ignore those that are sticky.
3728
-			if ( !empty($sticky_posts) && !empty($q['post__not_in']) )
3729
-				$sticky_posts = array_diff($sticky_posts, $q['post__not_in']);
3825
+			if ( !empty($sticky_posts) && !empty($q['post__not_in']) ) {
3826
+							$sticky_posts = array_diff($sticky_posts, $q['post__not_in']);
3827
+			}
3730 3828
 
3731 3829
 			// Fetch sticky posts that weren't in the query results
3732 3830
 			if ( !empty($sticky_posts) ) {
@@ -3769,8 +3867,9 @@  discard block
 block discarded – undo
3769 3867
 
3770 3868
 			$this->posts = array_map( 'get_post', $this->posts );
3771 3869
 
3772
-			if ( $q['cache_results'] )
3773
-				update_post_caches($this->posts, $post_type, $q['update_post_term_cache'], $q['update_post_meta_cache']);
3870
+			if ( $q['cache_results'] ) {
3871
+							update_post_caches($this->posts, $post_type, $q['update_post_term_cache'], $q['update_post_meta_cache']);
3872
+			}
3774 3873
 
3775 3874
 			$this->post = reset( $this->posts );
3776 3875
 		} else {
@@ -3802,8 +3901,9 @@  discard block
 block discarded – undo
3802 3901
 
3803 3902
 		// Bail if posts is an empty array. Continue if posts is an empty string,
3804 3903
 		// null, or false to accommodate caching plugins that fill posts later.
3805
-		if ( $q['no_found_rows'] || ( is_array( $this->posts ) && ! $this->posts ) )
3806
-			return;
3904
+		if ( $q['no_found_rows'] || ( is_array( $this->posts ) && ! $this->posts ) ) {
3905
+					return;
3906
+		}
3807 3907
 
3808 3908
 		if ( ! empty( $limits ) ) {
3809 3909
 			/**
@@ -3829,8 +3929,9 @@  discard block
 block discarded – undo
3829 3929
 		 */
3830 3930
 		$this->found_posts = apply_filters_ref_array( 'found_posts', array( $this->found_posts, &$this ) );
3831 3931
 
3832
-		if ( ! empty( $limits ) )
3833
-			$this->max_num_pages = ceil( $this->found_posts / $q['posts_per_page'] );
3932
+		if ( ! empty( $limits ) ) {
3933
+					$this->max_num_pages = ceil( $this->found_posts / $q['posts_per_page'] );
3934
+		}
3834 3935
 	}
3835 3936
 
3836 3937
 	/**
@@ -3864,7 +3965,8 @@  discard block
 block discarded – undo
3864 3965
 		global $post;
3865 3966
 		$this->in_the_loop = true;
3866 3967
 
3867
-		if ( $this->current_post == -1 ) // loop has just started
3968
+		if ( $this->current_post == -1 ) {
3969
+			// loop has just started
3868 3970
 			/**
3869 3971
 			 * Fires once the loop is started.
3870 3972
 			 *
@@ -3873,6 +3975,7 @@  discard block
 block discarded – undo
3873 3975
 			 * @param WP_Query &$this The WP_Query instance (passed by reference).
3874 3976
 			 */
3875 3977
 			do_action_ref_array( 'loop_start', array( &$this ) );
3978
+		}
3876 3979
 
3877 3980
 		$post = $this->next_post();
3878 3981
 		$this->setup_postdata( $post );
@@ -4019,8 +4122,9 @@  discard block
 block discarded – undo
4019 4122
 	 * @return object
4020 4123
 	 */
4021 4124
 	public function get_queried_object() {
4022
-		if ( isset($this->queried_object) )
4023
-			return $this->queried_object;
4125
+		if ( isset($this->queried_object) ) {
4126
+					return $this->queried_object;
4127
+		}
4024 4128
 
4025 4129
 		$this->queried_object = null;
4026 4130
 		$this->queried_object_id = null;
@@ -4061,13 +4165,15 @@  discard block
 block discarded – undo
4061 4165
 				$this->queried_object = $term;
4062 4166
 				$this->queried_object_id = (int) $term->term_id;
4063 4167
 
4064
-				if ( $this->is_category && 'category' === $this->queried_object->taxonomy )
4065
-					_make_cat_compat( $this->queried_object );
4168
+				if ( $this->is_category && 'category' === $this->queried_object->taxonomy ) {
4169
+									_make_cat_compat( $this->queried_object );
4170
+				}
4066 4171
 			}
4067 4172
 		} elseif ( $this->is_post_type_archive ) {
4068 4173
 			$post_type = $this->get( 'post_type' );
4069
-			if ( is_array( $post_type ) )
4070
-				$post_type = reset( $post_type );
4174
+			if ( is_array( $post_type ) ) {
4175
+							$post_type = reset( $post_type );
4176
+			}
4071 4177
 			$this->queried_object = get_post_type_object( $post_type );
4072 4178
 		} elseif ( $this->is_posts_page ) {
4073 4179
 			$page_for_posts = get_option('page_for_posts');
@@ -4187,12 +4293,14 @@  discard block
 block discarded – undo
4187 4293
 	 * @return bool
4188 4294
 	 */
4189 4295
 	public function is_post_type_archive( $post_types = '' ) {
4190
-		if ( empty( $post_types ) || ! $this->is_post_type_archive )
4191
-			return (bool) $this->is_post_type_archive;
4296
+		if ( empty( $post_types ) || ! $this->is_post_type_archive ) {
4297
+					return (bool) $this->is_post_type_archive;
4298
+		}
4192 4299
 
4193 4300
 		$post_type = $this->get( 'post_type' );
4194
-		if ( is_array( $post_type ) )
4195
-			$post_type = reset( $post_type );
4301
+		if ( is_array( $post_type ) ) {
4302
+					$post_type = reset( $post_type );
4303
+		}
4196 4304
 		$post_type_object = get_post_type_object( $post_type );
4197 4305
 
4198 4306
 		return in_array( $post_type_object->name, (array) $post_types );
@@ -4241,22 +4349,25 @@  discard block
 block discarded – undo
4241 4349
 	 * @return bool
4242 4350
 	 */
4243 4351
 	public function is_author( $author = '' ) {
4244
-		if ( !$this->is_author )
4245
-			return false;
4352
+		if ( !$this->is_author ) {
4353
+					return false;
4354
+		}
4246 4355
 
4247
-		if ( empty($author) )
4248
-			return true;
4356
+		if ( empty($author) ) {
4357
+					return true;
4358
+		}
4249 4359
 
4250 4360
 		$author_obj = $this->get_queried_object();
4251 4361
 
4252 4362
 		$author = array_map( 'strval', (array) $author );
4253 4363
 
4254
-		if ( in_array( (string) $author_obj->ID, $author ) )
4255
-			return true;
4256
-		elseif ( in_array( $author_obj->nickname, $author ) )
4257
-			return true;
4258
-		elseif ( in_array( $author_obj->user_nicename, $author ) )
4259
-			return true;
4364
+		if ( in_array( (string) $author_obj->ID, $author ) ) {
4365
+					return true;
4366
+		} elseif ( in_array( $author_obj->nickname, $author ) ) {
4367
+					return true;
4368
+		} elseif ( in_array( $author_obj->user_nicename, $author ) ) {
4369
+					return true;
4370
+		}
4260 4371
 
4261 4372
 		return false;
4262 4373
 	}
@@ -4273,22 +4384,25 @@  discard block
 block discarded – undo
4273 4384
 	 * @return bool
4274 4385
 	 */
4275 4386
 	public function is_category( $category = '' ) {
4276
-		if ( !$this->is_category )
4277
-			return false;
4387
+		if ( !$this->is_category ) {
4388
+					return false;
4389
+		}
4278 4390
 
4279
-		if ( empty($category) )
4280
-			return true;
4391
+		if ( empty($category) ) {
4392
+					return true;
4393
+		}
4281 4394
 
4282 4395
 		$cat_obj = $this->get_queried_object();
4283 4396
 
4284 4397
 		$category = array_map( 'strval', (array) $category );
4285 4398
 
4286
-		if ( in_array( (string) $cat_obj->term_id, $category ) )
4287
-			return true;
4288
-		elseif ( in_array( $cat_obj->name, $category ) )
4289
-			return true;
4290
-		elseif ( in_array( $cat_obj->slug, $category ) )
4291
-			return true;
4399
+		if ( in_array( (string) $cat_obj->term_id, $category ) ) {
4400
+					return true;
4401
+		} elseif ( in_array( $cat_obj->name, $category ) ) {
4402
+					return true;
4403
+		} elseif ( in_array( $cat_obj->slug, $category ) ) {
4404
+					return true;
4405
+		}
4292 4406
 
4293 4407
 		return false;
4294 4408
 	}
@@ -4305,22 +4419,25 @@  discard block
 block discarded – undo
4305 4419
 	 * @return bool
4306 4420
 	 */
4307 4421
 	public function is_tag( $tag = '' ) {
4308
-		if ( ! $this->is_tag )
4309
-			return false;
4422
+		if ( ! $this->is_tag ) {
4423
+					return false;
4424
+		}
4310 4425
 
4311
-		if ( empty( $tag ) )
4312
-			return true;
4426
+		if ( empty( $tag ) ) {
4427
+					return true;
4428
+		}
4313 4429
 
4314 4430
 		$tag_obj = $this->get_queried_object();
4315 4431
 
4316 4432
 		$tag = array_map( 'strval', (array) $tag );
4317 4433
 
4318
-		if ( in_array( (string) $tag_obj->term_id, $tag ) )
4319
-			return true;
4320
-		elseif ( in_array( $tag_obj->name, $tag ) )
4321
-			return true;
4322
-		elseif ( in_array( $tag_obj->slug, $tag ) )
4323
-			return true;
4434
+		if ( in_array( (string) $tag_obj->term_id, $tag ) ) {
4435
+					return true;
4436
+		} elseif ( in_array( $tag_obj->name, $tag ) ) {
4437
+					return true;
4438
+		} elseif ( in_array( $tag_obj->slug, $tag ) ) {
4439
+					return true;
4440
+		}
4324 4441
 
4325 4442
 		return false;
4326 4443
 	}
@@ -4346,23 +4463,27 @@  discard block
 block discarded – undo
4346 4463
 	public function is_tax( $taxonomy = '', $term = '' ) {
4347 4464
 		global $wp_taxonomies;
4348 4465
 
4349
-		if ( !$this->is_tax )
4350
-			return false;
4466
+		if ( !$this->is_tax ) {
4467
+					return false;
4468
+		}
4351 4469
 
4352
-		if ( empty( $taxonomy ) )
4353
-			return true;
4470
+		if ( empty( $taxonomy ) ) {
4471
+					return true;
4472
+		}
4354 4473
 
4355 4474
 		$queried_object = $this->get_queried_object();
4356 4475
 		$tax_array = array_intersect( array_keys( $wp_taxonomies ), (array) $taxonomy );
4357 4476
 		$term_array = (array) $term;
4358 4477
 
4359 4478
 		// Check that the taxonomy matches.
4360
-		if ( ! ( isset( $queried_object->taxonomy ) && count( $tax_array ) && in_array( $queried_object->taxonomy, $tax_array ) ) )
4361
-			return false;
4479
+		if ( ! ( isset( $queried_object->taxonomy ) && count( $tax_array ) && in_array( $queried_object->taxonomy, $tax_array ) ) ) {
4480
+					return false;
4481
+		}
4362 4482
 
4363 4483
 		// Only a Taxonomy provided.
4364
-		if ( empty( $term ) )
4365
-			return true;
4484
+		if ( empty( $term ) ) {
4485
+					return true;
4486
+		}
4366 4487
 
4367 4488
 		return isset( $queried_object->term_id ) &&
4368 4489
 			count( array_intersect(
@@ -4416,11 +4537,13 @@  discard block
 block discarded – undo
4416 4537
 	 * @return bool
4417 4538
 	 */
4418 4539
 	public function is_feed( $feeds = '' ) {
4419
-		if ( empty( $feeds ) || ! $this->is_feed )
4420
-			return (bool) $this->is_feed;
4540
+		if ( empty( $feeds ) || ! $this->is_feed ) {
4541
+					return (bool) $this->is_feed;
4542
+		}
4421 4543
 		$qv = $this->get( 'feed' );
4422
-		if ( 'feed' == $qv )
4423
-			$qv = get_default_feed();
4544
+		if ( 'feed' == $qv ) {
4545
+					$qv = get_default_feed();
4546
+		}
4424 4547
 		return in_array( $qv, (array) $feeds );
4425 4548
 	}
4426 4549
 
@@ -4453,12 +4576,13 @@  discard block
 block discarded – undo
4453 4576
 	 */
4454 4577
 	public function is_front_page() {
4455 4578
 		// most likely case
4456
-		if ( 'posts' == get_option( 'show_on_front') && $this->is_home() )
4457
-			return true;
4458
-		elseif ( 'page' == get_option( 'show_on_front') && get_option( 'page_on_front' ) && $this->is_page( get_option( 'page_on_front' ) ) )
4459
-			return true;
4460
-		else
4461
-			return false;
4579
+		if ( 'posts' == get_option( 'show_on_front') && $this->is_home() ) {
4580
+					return true;
4581
+		} elseif ( 'page' == get_option( 'show_on_front') && get_option( 'page_on_front' ) && $this->is_page( get_option( 'page_on_front' ) ) ) {
4582
+					return true;
4583
+		} else {
4584
+					return false;
4585
+		}
4462 4586
 	}
4463 4587
 
4464 4588
 	/**
@@ -4507,11 +4631,13 @@  discard block
 block discarded – undo
4507 4631
 	 * @return bool Whether the query is for an existing single page.
4508 4632
 	 */
4509 4633
 	public function is_page( $page = '' ) {
4510
-		if ( !$this->is_page )
4511
-			return false;
4634
+		if ( !$this->is_page ) {
4635
+					return false;
4636
+		}
4512 4637
 
4513
-		if ( empty( $page ) )
4514
-			return true;
4638
+		if ( empty( $page ) ) {
4639
+					return true;
4640
+		}
4515 4641
 
4516 4642
 		$page_obj = $this->get_queried_object();
4517 4643
 
@@ -4600,11 +4726,13 @@  discard block
 block discarded – undo
4600 4726
 	 * @return bool Whether the query is for an existing single post.
4601 4727
 	 */
4602 4728
 	public function is_single( $post = '' ) {
4603
-		if ( !$this->is_single )
4604
-			return false;
4729
+		if ( !$this->is_single ) {
4730
+					return false;
4731
+		}
4605 4732
 
4606
-		if ( empty($post) )
4607
-			return true;
4733
+		if ( empty($post) ) {
4734
+					return true;
4735
+		}
4608 4736
 
4609 4737
 		$post_obj = $this->get_queried_object();
4610 4738
 
@@ -4646,8 +4774,9 @@  discard block
 block discarded – undo
4646 4774
 	 * @return bool Whether the query is for an existing single post of any of the given post types.
4647 4775
 	 */
4648 4776
 	public function is_singular( $post_types = '' ) {
4649
-		if ( empty( $post_types ) || !$this->is_singular )
4650
-			return (bool) $this->is_singular;
4777
+		if ( empty( $post_types ) || !$this->is_singular ) {
4778
+					return (bool) $this->is_singular;
4779
+		}
4651 4780
 
4652 4781
 		$post_obj = $this->get_queried_object();
4653 4782
 
@@ -4762,8 +4891,9 @@  discard block
 block discarded – undo
4762 4891
 		$numpages = 1;
4763 4892
 		$multipage = 0;
4764 4893
 		$page = $this->get( 'page' );
4765
-		if ( ! $page )
4766
-			$page = 1;
4894
+		if ( ! $page ) {
4895
+					$page = 1;
4896
+		}
4767 4897
 
4768 4898
 		/*
4769 4899
 		 * Force full post content when viewing the permalink for the $post,
@@ -4784,8 +4914,9 @@  discard block
 block discarded – undo
4784 4914
 			$content = str_replace( "<!--nextpage-->\n", '<!--nextpage-->', $content );
4785 4915
 
4786 4916
 			// Ignore nextpage at the beginning of the content.
4787
-			if ( 0 === strpos( $content, '<!--nextpage-->' ) )
4788
-				$content = substr( $content, 15 );
4917
+			if ( 0 === strpos( $content, '<!--nextpage-->' ) ) {
4918
+							$content = substr( $content, 15 );
4919
+			}
4789 4920
 
4790 4921
 			$pages = explode('<!--nextpage-->', $content);
4791 4922
 		} else {
@@ -4909,30 +5040,36 @@  discard block
 block discarded – undo
4909 5040
 		}
4910 5041
 
4911 5042
 		if ( is_array( $post_type ) ) {
4912
-			if ( count( $post_type ) > 1 )
4913
-				return;
5043
+			if ( count( $post_type ) > 1 ) {
5044
+							return;
5045
+			}
4914 5046
 			$post_type = reset( $post_type );
4915 5047
 		}
4916 5048
 
4917 5049
 		// Do not attempt redirect for hierarchical post types
4918
-		if ( is_post_type_hierarchical( $post_type ) )
4919
-			return;
5050
+		if ( is_post_type_hierarchical( $post_type ) ) {
5051
+					return;
5052
+		}
4920 5053
 
4921 5054
 		$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']);
4922 5055
 
4923 5056
 		// if year, monthnum, or day have been specified, make our query more precise
4924 5057
 		// just in case there are multiple identical _wp_old_slug values
4925
-		if ( '' != $wp_query->query_vars['year'] )
4926
-			$query .= $wpdb->prepare(" AND YEAR(post_date) = %d", $wp_query->query_vars['year']);
4927
-		if ( '' != $wp_query->query_vars['monthnum'] )
4928
-			$query .= $wpdb->prepare(" AND MONTH(post_date) = %d", $wp_query->query_vars['monthnum']);
4929
-		if ( '' != $wp_query->query_vars['day'] )
4930
-			$query .= $wpdb->prepare(" AND DAYOFMONTH(post_date) = %d", $wp_query->query_vars['day']);
5058
+		if ( '' != $wp_query->query_vars['year'] ) {
5059
+					$query .= $wpdb->prepare(" AND YEAR(post_date) = %d", $wp_query->query_vars['year']);
5060
+		}
5061
+		if ( '' != $wp_query->query_vars['monthnum'] ) {
5062
+					$query .= $wpdb->prepare(" AND MONTH(post_date) = %d", $wp_query->query_vars['monthnum']);
5063
+		}
5064
+		if ( '' != $wp_query->query_vars['day'] ) {
5065
+					$query .= $wpdb->prepare(" AND DAYOFMONTH(post_date) = %d", $wp_query->query_vars['day']);
5066
+		}
4931 5067
 
4932 5068
 		$id = (int) $wpdb->get_var($query);
4933 5069
 
4934
-		if ( ! $id )
4935
-			return;
5070
+		if ( ! $id ) {
5071
+					return;
5072
+		}
4936 5073
 
4937 5074
 		$link = get_permalink( $id );
4938 5075
 
Please login to merge, or discard this patch.