Completed
Push — master ( a7cd2a...eabd6c )
by Stephen
38:42
created
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.php 4 patches
Doc Comments   +7 added lines, -10 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
  *
56 56
  * @param string   $type Type of time to retrieve. Accepts 'mysql', 'timestamp', or PHP date
57 57
  *                       format string (e.g. 'Y-m-d').
58
- * @param int|bool $gmt  Optional. Whether to use GMT timezone. Default false.
58
+ * @param integer $gmt  Optional. Whether to use GMT timezone. Default false.
59 59
  * @return int|string Integer if $type is 'timestamp', string otherwise.
60 60
  */
61 61
 function current_time( $type, $gmt = 0 ) {
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
  * @since 2.0.5
428 428
  *
429 429
  * @param string|array|object $data Data that might be serialized.
430
- * @return mixed A scalar data
430
+ * @return string A scalar data
431 431
  */
432 432
 function maybe_serialize( $data ) {
433 433
 	if ( is_array( $data ) || is_object( $data ) )
@@ -762,9 +762,6 @@  discard block
 block discarded – undo
762 762
  *
763 763
  * @since 1.5.0
764 764
  *
765
- * @param string|array $key   Either a query variable key, or an associative array of query variables.
766
- * @param string       $value Optional. Either a query variable value, or a URL to act upon.
767
- * @param string       $url   Optional. A URL to act upon.
768 765
  * @return string New URL query string (unescaped).
769 766
  */
770 767
 function add_query_arg() {
@@ -1419,7 +1416,7 @@  discard block
 block discarded – undo
1419 1416
  * @since 2.0.4
1420 1417
  *
1421 1418
  * @param string     $actionurl URL to add nonce action.
1422
- * @param int|string $action    Optional. Nonce action name. Default -1.
1419
+ * @param integer $action    Optional. Nonce action name. Default -1.
1423 1420
  * @param string     $name      Optional. Nonce name. Default '_wpnonce'.
1424 1421
  * @return string Escaped URL with nonce action added.
1425 1422
  */
@@ -1448,7 +1445,7 @@  discard block
 block discarded – undo
1448 1445
  *
1449 1446
  * @since 2.0.4
1450 1447
  *
1451
- * @param int|string $action  Optional. Action name. Default -1.
1448
+ * @param integer $action  Optional. Action name. Default -1.
1452 1449
  * @param string     $name    Optional. Nonce name. Default '_wpnonce'.
1453 1450
  * @param bool       $referer Optional. Whether to set the referer field for validation. Default true.
1454 1451
  * @param bool       $echo    Optional. Whether to display or return hidden form field. Default true.
@@ -1540,7 +1537,7 @@  discard block
 block discarded – undo
1540 1537
  *
1541 1538
  * @since 4.5.0
1542 1539
  *
1543
- * @return string|false Referer URL on success, false on failure.
1540
+ * @return string Referer URL on success, false on failure.
1544 1541
  */
1545 1542
 function wp_get_raw_referer() {
1546 1543
 	if ( ! empty( $_REQUEST['_wp_http_referer'] ) ) {
@@ -4616,7 +4613,7 @@  discard block
 block discarded – undo
4616 4613
  *
4617 4614
  * @see __return_false()
4618 4615
  *
4619
- * @return true True.
4616
+ * @return boolean True.
4620 4617
  */
4621 4618
 function __return_true() {
4622 4619
 	return true;
@@ -4738,7 +4735,7 @@  discard block
 block discarded – undo
4738 4735
  * @param int      $start         The ID to start the loop check at.
4739 4736
  * @param int      $start_parent  The parent_ID of $start to use instead of calling $callback( $start ).
4740 4737
  *                                Use null to always use $callback
4741
- * @param array    $callback_args Optional. Additional arguments to send to $callback.
4738
+ * @param string[]    $callback_args Optional. Additional arguments to send to $callback.
4742 4739
  * @return array IDs of all members of loop.
4743 4740
  */
4744 4741
 function wp_find_hierarchy_loop( $callback, $start, $start_parent, $callback_args = array() ) {
Please login to merge, or discard this patch.
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Main WordPress API
4
- *
5
- * @package WordPress
6
- */
3
+	 * Main WordPress API
4
+	 *
5
+	 * @package WordPress
6
+	 */
7 7
 
8 8
 require( ABSPATH . WPINC . '/option.php' );
9 9
 
@@ -2452,14 +2452,14 @@  discard block
 block discarded – undo
2452 2452
 	) );
2453 2453
 }
2454 2454
 /**
2455
- * Retrieve list of allowed mime types and file extensions.
2456
- *
2457
- * @since 2.8.6
2458
- *
2459
- * @param int|WP_User $user Optional. User to check. Defaults to current user.
2460
- * @return array Array of mime types keyed by the file extension regex corresponding
2461
- *               to those types.
2462
- */
2455
+	 * Retrieve list of allowed mime types and file extensions.
2456
+	 *
2457
+	 * @since 2.8.6
2458
+	 *
2459
+	 * @param int|WP_User $user Optional. User to check. Defaults to current user.
2460
+	 * @return array Array of mime types keyed by the file extension regex corresponding
2461
+	 *               to those types.
2462
+	 */
2463 2463
 function get_allowed_mime_types( $user = null ) {
2464 2464
 	$t = wp_get_mime_types();
2465 2465
 
@@ -3208,7 +3208,7 @@  discard block
 block discarded – undo
3208 3208
 		  ':arrow:' => "\xe2\x9e\xa1",
3209 3209
 		  ':shock:' => "\xf0\x9f\x98\xaf",
3210 3210
 		  ':smile:' => "\xf0\x9f\x99\x82",
3211
-		    ':???:' => "\xf0\x9f\x98\x95",
3211
+			':???:' => "\xf0\x9f\x98\x95",
3212 3212
 		   ':cool:' => "\xf0\x9f\x98\x8e",
3213 3213
 		   ':evil:' => "\xf0\x9f\x91\xbf",
3214 3214
 		   ':grin:' => "\xf0\x9f\x98\x80",
@@ -3217,36 +3217,36 @@  discard block
 block discarded – undo
3217 3217
 		   ':razz:' => "\xf0\x9f\x98\x9b",
3218 3218
 		   ':roll:' => 'rolleyes.png',
3219 3219
 		   ':wink:' => "\xf0\x9f\x98\x89",
3220
-		    ':cry:' => "\xf0\x9f\x98\xa5",
3221
-		    ':eek:' => "\xf0\x9f\x98\xae",
3222
-		    ':lol:' => "\xf0\x9f\x98\x86",
3223
-		    ':mad:' => "\xf0\x9f\x98\xa1",
3224
-		    ':sad:' => "\xf0\x9f\x99\x81",
3225
-		      '8-)' => "\xf0\x9f\x98\x8e",
3226
-		      '8-O' => "\xf0\x9f\x98\xaf",
3227
-		      ':-(' => "\xf0\x9f\x99\x81",
3228
-		      ':-)' => "\xf0\x9f\x99\x82",
3229
-		      ':-?' => "\xf0\x9f\x98\x95",
3230
-		      ':-D' => "\xf0\x9f\x98\x80",
3231
-		      ':-P' => "\xf0\x9f\x98\x9b",
3232
-		      ':-o' => "\xf0\x9f\x98\xae",
3233
-		      ':-x' => "\xf0\x9f\x98\xa1",
3234
-		      ':-|' => "\xf0\x9f\x98\x90",
3235
-		      ';-)' => "\xf0\x9f\x98\x89",
3220
+			':cry:' => "\xf0\x9f\x98\xa5",
3221
+			':eek:' => "\xf0\x9f\x98\xae",
3222
+			':lol:' => "\xf0\x9f\x98\x86",
3223
+			':mad:' => "\xf0\x9f\x98\xa1",
3224
+			':sad:' => "\xf0\x9f\x99\x81",
3225
+			  '8-)' => "\xf0\x9f\x98\x8e",
3226
+			  '8-O' => "\xf0\x9f\x98\xaf",
3227
+			  ':-(' => "\xf0\x9f\x99\x81",
3228
+			  ':-)' => "\xf0\x9f\x99\x82",
3229
+			  ':-?' => "\xf0\x9f\x98\x95",
3230
+			  ':-D' => "\xf0\x9f\x98\x80",
3231
+			  ':-P' => "\xf0\x9f\x98\x9b",
3232
+			  ':-o' => "\xf0\x9f\x98\xae",
3233
+			  ':-x' => "\xf0\x9f\x98\xa1",
3234
+			  ':-|' => "\xf0\x9f\x98\x90",
3235
+			  ';-)' => "\xf0\x9f\x98\x89",
3236 3236
 		// This one transformation breaks regular text with frequency.
3237 3237
 		//     '8)' => "\xf0\x9f\x98\x8e",
3238
-		       '8O' => "\xf0\x9f\x98\xaf",
3239
-		       ':(' => "\xf0\x9f\x99\x81",
3240
-		       ':)' => "\xf0\x9f\x99\x82",
3241
-		       ':?' => "\xf0\x9f\x98\x95",
3242
-		       ':D' => "\xf0\x9f\x98\x80",
3243
-		       ':P' => "\xf0\x9f\x98\x9b",
3244
-		       ':o' => "\xf0\x9f\x98\xae",
3245
-		       ':x' => "\xf0\x9f\x98\xa1",
3246
-		       ':|' => "\xf0\x9f\x98\x90",
3247
-		       ';)' => "\xf0\x9f\x98\x89",
3248
-		      ':!:' => "\xe2\x9d\x97",
3249
-		      ':?:' => "\xe2\x9d\x93",
3238
+			   '8O' => "\xf0\x9f\x98\xaf",
3239
+			   ':(' => "\xf0\x9f\x99\x81",
3240
+			   ':)' => "\xf0\x9f\x99\x82",
3241
+			   ':?' => "\xf0\x9f\x98\x95",
3242
+			   ':D' => "\xf0\x9f\x98\x80",
3243
+			   ':P' => "\xf0\x9f\x98\x9b",
3244
+			   ':o' => "\xf0\x9f\x98\xae",
3245
+			   ':x' => "\xf0\x9f\x98\xa1",
3246
+			   ':|' => "\xf0\x9f\x98\x90",
3247
+			   ';)' => "\xf0\x9f\x98\x89",
3248
+			  ':!:' => "\xe2\x9d\x97",
3249
+			  ':?:' => "\xe2\x9d\x93",
3250 3250
 		);
3251 3251
 	}
3252 3252
 
@@ -3795,31 +3795,31 @@  discard block
 block discarded – undo
3795 3795
 	}
3796 3796
 }
3797 3797
 /**
3798
- * Mark a function argument as deprecated and inform when it has been used.
3799
- *
3800
- * This function is to be used whenever a deprecated function argument is used.
3801
- * Before this function is called, the argument must be checked for whether it was
3802
- * used by comparing it to its default value or evaluating whether it is empty.
3803
- * For example:
3804
- *
3805
- *     if ( ! empty( $deprecated ) ) {
3806
- *         _deprecated_argument( __FUNCTION__, '3.0' );
3807
- *     }
3808
- *
3809
- *
3810
- * There is a hook deprecated_argument_run that will be called that can be used
3811
- * to get the backtrace up to what file and function used the deprecated
3812
- * argument.
3813
- *
3814
- * The current behavior is to trigger a user error if WP_DEBUG is true.
3815
- *
3816
- * @since 3.0.0
3817
- * @access private
3818
- *
3819
- * @param string $function The function that was called.
3820
- * @param string $version  The version of WordPress that deprecated the argument used.
3821
- * @param string $message  Optional. A message regarding the change. Default null.
3822
- */
3798
+	 * Mark a function argument as deprecated and inform when it has been used.
3799
+	 *
3800
+	 * This function is to be used whenever a deprecated function argument is used.
3801
+	 * Before this function is called, the argument must be checked for whether it was
3802
+	 * used by comparing it to its default value or evaluating whether it is empty.
3803
+	 * For example:
3804
+	 *
3805
+	 *     if ( ! empty( $deprecated ) ) {
3806
+	 *         _deprecated_argument( __FUNCTION__, '3.0' );
3807
+	 *     }
3808
+	 *
3809
+	 *
3810
+	 * There is a hook deprecated_argument_run that will be called that can be used
3811
+	 * to get the backtrace up to what file and function used the deprecated
3812
+	 * argument.
3813
+	 *
3814
+	 * The current behavior is to trigger a user error if WP_DEBUG is true.
3815
+	 *
3816
+	 * @since 3.0.0
3817
+	 * @access private
3818
+	 *
3819
+	 * @param string $function The function that was called.
3820
+	 * @param string $version  The version of WordPress that deprecated the argument used.
3821
+	 * @param string $message  Optional. A message regarding the change. Default null.
3822
+	 */
3823 3823
 function _deprecated_argument( $function, $version, $message = null ) {
3824 3824
 
3825 3825
 	/**
Please login to merge, or discard this patch.
Spacing   +1005 added lines, -1005 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
  * @package WordPress
6 6
  */
7 7
 
8
-require( ABSPATH . WPINC . '/option.php' );
8
+require(ABSPATH.WPINC.'/option.php');
9 9
 
10 10
 /**
11 11
  * Convert given date string into a different format.
@@ -23,22 +23,22 @@  discard block
 block discarded – undo
23 23
  * @param bool   $translate Whether the return date should be translated. Default true.
24 24
  * @return string|int|bool Formatted date string or Unix timestamp. False if $date is empty.
25 25
  */
26
-function mysql2date( $format, $date, $translate = true ) {
27
-	if ( empty( $date ) )
26
+function mysql2date($format, $date, $translate = true) {
27
+	if (empty($date))
28 28
 		return false;
29 29
 
30
-	if ( 'G' == $format )
31
-		return strtotime( $date . ' +0000' );
30
+	if ('G' == $format)
31
+		return strtotime($date.' +0000');
32 32
 
33
-	$i = strtotime( $date );
33
+	$i = strtotime($date);
34 34
 
35
-	if ( 'U' == $format )
35
+	if ('U' == $format)
36 36
 		return $i;
37 37
 
38
-	if ( $translate )
39
-		return date_i18n( $format, $i );
38
+	if ($translate)
39
+		return date_i18n($format, $i);
40 40
 	else
41
-		return date( $format, $i );
41
+		return date($format, $i);
42 42
 }
43 43
 
44 44
 /**
@@ -58,14 +58,14 @@  discard block
 block discarded – undo
58 58
  * @param int|bool $gmt  Optional. Whether to use GMT timezone. Default false.
59 59
  * @return int|string Integer if $type is 'timestamp', string otherwise.
60 60
  */
61
-function current_time( $type, $gmt = 0 ) {
62
-	switch ( $type ) {
61
+function current_time($type, $gmt = 0) {
62
+	switch ($type) {
63 63
 		case 'mysql':
64
-			return ( $gmt ) ? gmdate( 'Y-m-d H:i:s' ) : gmdate( 'Y-m-d H:i:s', ( time() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) );
64
+			return ($gmt) ? gmdate('Y-m-d H:i:s') : gmdate('Y-m-d H:i:s', (time() + (get_option('gmt_offset') * HOUR_IN_SECONDS)));
65 65
 		case 'timestamp':
66
-			return ( $gmt ) ? time() : time() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS );
66
+			return ($gmt) ? time() : time() + (get_option('gmt_offset') * HOUR_IN_SECONDS);
67 67
 		default:
68
-			return ( $gmt ) ? date( $type ) : date( $type, time() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) );
68
+			return ($gmt) ? date($type) : date($type, time() + (get_option('gmt_offset') * HOUR_IN_SECONDS));
69 69
 	}
70 70
 }
71 71
 
@@ -86,13 +86,13 @@  discard block
 block discarded – undo
86 86
  *
87 87
  * @return string The date, translated if locale specifies it.
88 88
  */
89
-function date_i18n( $dateformatstring, $unixtimestamp = false, $gmt = false ) {
89
+function date_i18n($dateformatstring, $unixtimestamp = false, $gmt = false) {
90 90
 	global $wp_locale;
91 91
 	$i = $unixtimestamp;
92 92
 
93
-	if ( false === $i ) {
94
-		if ( ! $gmt )
95
-			$i = current_time( 'timestamp' );
93
+	if (false === $i) {
94
+		if ( ! $gmt)
95
+			$i = current_time('timestamp');
96 96
 		else
97 97
 			$i = time();
98 98
 		// we should not let date() interfere with our
@@ -106,43 +106,43 @@  discard block
 block discarded – undo
106 106
 	 */
107 107
 	$req_format = $dateformatstring;
108 108
 
109
-	$datefunc = $gmt? 'gmdate' : 'date';
109
+	$datefunc = $gmt ? 'gmdate' : 'date';
110 110
 
111
-	if ( ( !empty( $wp_locale->month ) ) && ( !empty( $wp_locale->weekday ) ) ) {
112
-		$datemonth = $wp_locale->get_month( $datefunc( 'm', $i ) );
113
-		$datemonth_abbrev = $wp_locale->get_month_abbrev( $datemonth );
114
-		$dateweekday = $wp_locale->get_weekday( $datefunc( 'w', $i ) );
115
-		$dateweekday_abbrev = $wp_locale->get_weekday_abbrev( $dateweekday );
116
-		$datemeridiem = $wp_locale->get_meridiem( $datefunc( 'a', $i ) );
117
-		$datemeridiem_capital = $wp_locale->get_meridiem( $datefunc( 'A', $i ) );
111
+	if (( ! empty($wp_locale->month)) && ( ! empty($wp_locale->weekday))) {
112
+		$datemonth = $wp_locale->get_month($datefunc('m', $i));
113
+		$datemonth_abbrev = $wp_locale->get_month_abbrev($datemonth);
114
+		$dateweekday = $wp_locale->get_weekday($datefunc('w', $i));
115
+		$dateweekday_abbrev = $wp_locale->get_weekday_abbrev($dateweekday);
116
+		$datemeridiem = $wp_locale->get_meridiem($datefunc('a', $i));
117
+		$datemeridiem_capital = $wp_locale->get_meridiem($datefunc('A', $i));
118 118
 		$dateformatstring = ' '.$dateformatstring;
119
-		$dateformatstring = preg_replace( "/([^\\\])D/", "\\1" . backslashit( $dateweekday_abbrev ), $dateformatstring );
120
-		$dateformatstring = preg_replace( "/([^\\\])F/", "\\1" . backslashit( $datemonth ), $dateformatstring );
121
-		$dateformatstring = preg_replace( "/([^\\\])l/", "\\1" . backslashit( $dateweekday ), $dateformatstring );
122
-		$dateformatstring = preg_replace( "/([^\\\])M/", "\\1" . backslashit( $datemonth_abbrev ), $dateformatstring );
123
-		$dateformatstring = preg_replace( "/([^\\\])a/", "\\1" . backslashit( $datemeridiem ), $dateformatstring );
124
-		$dateformatstring = preg_replace( "/([^\\\])A/", "\\1" . backslashit( $datemeridiem_capital ), $dateformatstring );
125
-
126
-		$dateformatstring = substr( $dateformatstring, 1, strlen( $dateformatstring ) -1 );
127
-	}
128
-	$timezone_formats = array( 'P', 'I', 'O', 'T', 'Z', 'e' );
129
-	$timezone_formats_re = implode( '|', $timezone_formats );
130
-	if ( preg_match( "/$timezone_formats_re/", $dateformatstring ) ) {
131
-		$timezone_string = get_option( 'timezone_string' );
132
-		if ( $timezone_string ) {
133
-			$timezone_object = timezone_open( $timezone_string );
134
-			$date_object = date_create( null, $timezone_object );
135
-			foreach ( $timezone_formats as $timezone_format ) {
136
-				if ( false !== strpos( $dateformatstring, $timezone_format ) ) {
137
-					$formatted = date_format( $date_object, $timezone_format );
119
+		$dateformatstring = preg_replace("/([^\\\])D/", "\\1".backslashit($dateweekday_abbrev), $dateformatstring);
120
+		$dateformatstring = preg_replace("/([^\\\])F/", "\\1".backslashit($datemonth), $dateformatstring);
121
+		$dateformatstring = preg_replace("/([^\\\])l/", "\\1".backslashit($dateweekday), $dateformatstring);
122
+		$dateformatstring = preg_replace("/([^\\\])M/", "\\1".backslashit($datemonth_abbrev), $dateformatstring);
123
+		$dateformatstring = preg_replace("/([^\\\])a/", "\\1".backslashit($datemeridiem), $dateformatstring);
124
+		$dateformatstring = preg_replace("/([^\\\])A/", "\\1".backslashit($datemeridiem_capital), $dateformatstring);
125
+
126
+		$dateformatstring = substr($dateformatstring, 1, strlen($dateformatstring) - 1);
127
+	}
128
+	$timezone_formats = array('P', 'I', 'O', 'T', 'Z', 'e');
129
+	$timezone_formats_re = implode('|', $timezone_formats);
130
+	if (preg_match("/$timezone_formats_re/", $dateformatstring)) {
131
+		$timezone_string = get_option('timezone_string');
132
+		if ($timezone_string) {
133
+			$timezone_object = timezone_open($timezone_string);
134
+			$date_object = date_create(null, $timezone_object);
135
+			foreach ($timezone_formats as $timezone_format) {
136
+				if (false !== strpos($dateformatstring, $timezone_format)) {
137
+					$formatted = date_format($date_object, $timezone_format);
138 138
 					$dateformatstring = ' '.$dateformatstring;
139
-					$dateformatstring = preg_replace( "/([^\\\])$timezone_format/", "\\1" . backslashit( $formatted ), $dateformatstring );
140
-					$dateformatstring = substr( $dateformatstring, 1, strlen( $dateformatstring ) -1 );
139
+					$dateformatstring = preg_replace("/([^\\\])$timezone_format/", "\\1".backslashit($formatted), $dateformatstring);
140
+					$dateformatstring = substr($dateformatstring, 1, strlen($dateformatstring) - 1);
141 141
 				}
142 142
 			}
143 143
 		}
144 144
 	}
145
-	$j = @$datefunc( $dateformatstring, $i );
145
+	$j = @$datefunc($dateformatstring, $i);
146 146
 
147 147
 	/**
148 148
 	 * Filter the date formatted based on the locale.
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	 * @param int    $i          Unix timestamp.
155 155
 	 * @param bool   $gmt        Whether to convert to GMT for time. Default false.
156 156
 	 */
157
-	$j = apply_filters( 'date_i18n', $j, $req_format, $i, $gmt );
157
+	$j = apply_filters('date_i18n', $j, $req_format, $i, $gmt);
158 158
 	return $j;
159 159
 }
160 160
 
@@ -169,36 +169,36 @@  discard block
 block discarded – undo
169 169
  * @param string $date Formatted date string.
170 170
  * @return string The date, declined if locale specifies it.
171 171
  */
172
-function wp_maybe_decline_date( $date ) {
172
+function wp_maybe_decline_date($date) {
173 173
 	global $wp_locale;
174 174
 
175 175
 	// i18n functions are not available in SHORTINIT mode
176
-	if ( ! function_exists( '_x' ) ) {
176
+	if ( ! function_exists('_x')) {
177 177
 		return $date;
178 178
 	}
179 179
 
180 180
 	/* translators: If months in your language require a genitive case,
181 181
 	 * translate this to 'on'. Do not translate into your own language.
182 182
 	 */
183
-	if ( 'on' === _x( 'off', 'decline months names: on or off' ) ) {
183
+	if ('on' === _x('off', 'decline months names: on or off')) {
184 184
 		// Match a format like 'j F Y' or 'j. F'
185
-		if ( @preg_match( '#^\d{1,2}\.? \w+#u', $date ) ) {
185
+		if (@preg_match('#^\d{1,2}\.? \w+#u', $date)) {
186 186
 			$months = $wp_locale->month;
187 187
 
188
-			foreach ( $months as $key => $month ) {
189
-				$months[ $key ] = '#' . $month . '#';
188
+			foreach ($months as $key => $month) {
189
+				$months[$key] = '#'.$month.'#';
190 190
 			}
191 191
 
192
-			$date = preg_replace( $months, $wp_locale->month_genitive, $date );
192
+			$date = preg_replace($months, $wp_locale->month_genitive, $date);
193 193
 		}
194 194
 	}
195 195
 
196 196
 	// Used for locale-specific rules
197 197
 	$locale = get_locale();
198 198
 
199
-	if ( 'ca' === $locale ) {
199
+	if ('ca' === $locale) {
200 200
 		// " de abril| de agost| de octubre..." -> " d'abril| d'agost| d'octubre..."
201
-		$date = preg_replace( '# de ([ao])#i', " d'\\1", $date );
201
+		$date = preg_replace('# de ([ao])#i', " d'\\1", $date);
202 202
 	}
203 203
 
204 204
 	return $date;
@@ -215,13 +215,13 @@  discard block
 block discarded – undo
215 215
  * @param int   $decimals Optional. Precision of the number of decimal places. Default 0.
216 216
  * @return string Converted number in string format.
217 217
  */
218
-function number_format_i18n( $number, $decimals = 0 ) {
218
+function number_format_i18n($number, $decimals = 0) {
219 219
 	global $wp_locale;
220 220
 
221
-	if ( isset( $wp_locale ) ) {
222
-		$formatted = number_format( $number, absint( $decimals ), $wp_locale->number_format['decimal_point'], $wp_locale->number_format['thousands_sep'] );
221
+	if (isset($wp_locale)) {
222
+		$formatted = number_format($number, absint($decimals), $wp_locale->number_format['decimal_point'], $wp_locale->number_format['thousands_sep']);
223 223
 	} else {
224
-		$formatted = number_format( $number, absint( $decimals ) );
224
+		$formatted = number_format($number, absint($decimals));
225 225
 	}
226 226
 
227 227
 	/**
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 	 *
232 232
 	 * @param string $formatted Converted number in string format.
233 233
 	 */
234
-	return apply_filters( 'number_format_i18n', $formatted );
234
+	return apply_filters('number_format_i18n', $formatted);
235 235
 }
236 236
 
237 237
 /**
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
  * @param int        $decimals Optional. Precision of number of decimal places. Default 0.
255 255
  * @return string|false False on failure. Number string on success.
256 256
  */
257
-function size_format( $bytes, $decimals = 0 ) {
257
+function size_format($bytes, $decimals = 0) {
258 258
 	$quant = array(
259 259
 		'TB' => TB_IN_BYTES,
260 260
 		'GB' => GB_IN_BYTES,
@@ -263,9 +263,9 @@  discard block
 block discarded – undo
263 263
 		'B'  => 1,
264 264
 	);
265 265
 
266
-	foreach ( $quant as $unit => $mag ) {
267
-		if ( doubleval( $bytes ) >= $mag ) {
268
-			return number_format_i18n( $bytes / $mag, $decimals ) . ' ' . $unit;
266
+	foreach ($quant as $unit => $mag) {
267
+		if (doubleval($bytes) >= $mag) {
268
+			return number_format_i18n($bytes / $mag, $decimals).' '.$unit;
269 269
 		}
270 270
 	}
271 271
 
@@ -281,34 +281,34 @@  discard block
 block discarded – undo
281 281
  * @param int|string $start_of_week Optional. Start of the week as an integer. Default empty string.
282 282
  * @return array Keys are 'start' and 'end'.
283 283
  */
284
-function get_weekstartend( $mysqlstring, $start_of_week = '' ) {
284
+function get_weekstartend($mysqlstring, $start_of_week = '') {
285 285
 	// MySQL string year.
286
-	$my = substr( $mysqlstring, 0, 4 );
286
+	$my = substr($mysqlstring, 0, 4);
287 287
 
288 288
 	// MySQL string month.
289
-	$mm = substr( $mysqlstring, 8, 2 );
289
+	$mm = substr($mysqlstring, 8, 2);
290 290
 
291 291
 	// MySQL string day.
292
-	$md = substr( $mysqlstring, 5, 2 );
292
+	$md = substr($mysqlstring, 5, 2);
293 293
 
294 294
 	// The timestamp for MySQL string day.
295
-	$day = mktime( 0, 0, 0, $md, $mm, $my );
295
+	$day = mktime(0, 0, 0, $md, $mm, $my);
296 296
 
297 297
 	// The day of the week from the timestamp.
298
-	$weekday = date( 'w', $day );
298
+	$weekday = date('w', $day);
299 299
 
300
-	if ( !is_numeric($start_of_week) )
301
-		$start_of_week = get_option( 'start_of_week' );
300
+	if ( ! is_numeric($start_of_week))
301
+		$start_of_week = get_option('start_of_week');
302 302
 
303
-	if ( $weekday < $start_of_week )
303
+	if ($weekday < $start_of_week)
304 304
 		$weekday += 7;
305 305
 
306 306
 	// The most recent week start day on or before $day.
307
-	$start = $day - DAY_IN_SECONDS * ( $weekday - $start_of_week );
307
+	$start = $day - DAY_IN_SECONDS * ($weekday - $start_of_week);
308 308
 
309 309
 	// $start + 1 week - 1 second.
310 310
 	$end = $start + WEEK_IN_SECONDS - 1;
311
-	return compact( 'start', 'end' );
311
+	return compact('start', 'end');
312 312
 }
313 313
 
314 314
 /**
@@ -319,9 +319,9 @@  discard block
 block discarded – undo
319 319
  * @param string $original Maybe unserialized original, if is needed.
320 320
  * @return mixed Unserialized data can be any type.
321 321
  */
322
-function maybe_unserialize( $original ) {
323
-	if ( is_serialized( $original ) ) // don't attempt to unserialize data that wasn't serialized going in
324
-		return @unserialize( $original );
322
+function maybe_unserialize($original) {
323
+	if (is_serialized($original)) // don't attempt to unserialize data that wasn't serialized going in
324
+		return @unserialize($original);
325 325
 	return $original;
326 326
 }
327 327
 
@@ -337,57 +337,57 @@  discard block
 block discarded – undo
337 337
  * @param bool   $strict Optional. Whether to be strict about the end of the string. Default true.
338 338
  * @return bool False if not serialized and true if it was.
339 339
  */
340
-function is_serialized( $data, $strict = true ) {
340
+function is_serialized($data, $strict = true) {
341 341
 	// if it isn't a string, it isn't serialized.
342
-	if ( ! is_string( $data ) ) {
342
+	if ( ! is_string($data)) {
343 343
 		return false;
344 344
 	}
345
-	$data = trim( $data );
346
- 	if ( 'N;' == $data ) {
345
+	$data = trim($data);
346
+ 	if ('N;' == $data) {
347 347
 		return true;
348 348
 	}
349
-	if ( strlen( $data ) < 4 ) {
349
+	if (strlen($data) < 4) {
350 350
 		return false;
351 351
 	}
352
-	if ( ':' !== $data[1] ) {
352
+	if (':' !== $data[1]) {
353 353
 		return false;
354 354
 	}
355
-	if ( $strict ) {
356
-		$lastc = substr( $data, -1 );
357
-		if ( ';' !== $lastc && '}' !== $lastc ) {
355
+	if ($strict) {
356
+		$lastc = substr($data, -1);
357
+		if (';' !== $lastc && '}' !== $lastc) {
358 358
 			return false;
359 359
 		}
360 360
 	} else {
361
-		$semicolon = strpos( $data, ';' );
362
-		$brace     = strpos( $data, '}' );
361
+		$semicolon = strpos($data, ';');
362
+		$brace     = strpos($data, '}');
363 363
 		// Either ; or } must exist.
364
-		if ( false === $semicolon && false === $brace )
364
+		if (false === $semicolon && false === $brace)
365 365
 			return false;
366 366
 		// But neither must be in the first X characters.
367
-		if ( false !== $semicolon && $semicolon < 3 )
367
+		if (false !== $semicolon && $semicolon < 3)
368 368
 			return false;
369
-		if ( false !== $brace && $brace < 4 )
369
+		if (false !== $brace && $brace < 4)
370 370
 			return false;
371 371
 	}
372 372
 	$token = $data[0];
373
-	switch ( $token ) {
373
+	switch ($token) {
374 374
 		case 's' :
375
-			if ( $strict ) {
376
-				if ( '"' !== substr( $data, -2, 1 ) ) {
375
+			if ($strict) {
376
+				if ('"' !== substr($data, -2, 1)) {
377 377
 					return false;
378 378
 				}
379
-			} elseif ( false === strpos( $data, '"' ) ) {
379
+			} elseif (false === strpos($data, '"')) {
380 380
 				return false;
381 381
 			}
382 382
 			// or else fall through
383 383
 		case 'a' :
384 384
 		case 'O' :
385
-			return (bool) preg_match( "/^{$token}:[0-9]+:/s", $data );
385
+			return (bool) preg_match("/^{$token}:[0-9]+:/s", $data);
386 386
 		case 'b' :
387 387
 		case 'i' :
388 388
 		case 'd' :
389 389
 			$end = $strict ? '$' : '';
390
-			return (bool) preg_match( "/^{$token}:[0-9.E-]+;$end/", $data );
390
+			return (bool) preg_match("/^{$token}:[0-9.E-]+;$end/", $data);
391 391
 	}
392 392
 	return false;
393 393
 }
@@ -400,21 +400,21 @@  discard block
 block discarded – undo
400 400
  * @param string $data Serialized data.
401 401
  * @return bool False if not a serialized string, true if it is.
402 402
  */
403
-function is_serialized_string( $data ) {
403
+function is_serialized_string($data) {
404 404
 	// if it isn't a string, it isn't a serialized string.
405
-	if ( ! is_string( $data ) ) {
405
+	if ( ! is_string($data)) {
406 406
 		return false;
407 407
 	}
408
-	$data = trim( $data );
409
-	if ( strlen( $data ) < 4 ) {
408
+	$data = trim($data);
409
+	if (strlen($data) < 4) {
410 410
 		return false;
411
-	} elseif ( ':' !== $data[1] ) {
411
+	} elseif (':' !== $data[1]) {
412 412
 		return false;
413
-	} elseif ( ';' !== substr( $data, -1 ) ) {
413
+	} elseif (';' !== substr($data, -1)) {
414 414
 		return false;
415
-	} elseif ( $data[0] !== 's' ) {
415
+	} elseif ($data[0] !== 's') {
416 416
 		return false;
417
-	} elseif ( '"' !== substr( $data, -2, 1 ) ) {
417
+	} elseif ('"' !== substr($data, -2, 1)) {
418 418
 		return false;
419 419
 	} else {
420 420
 		return true;
@@ -429,15 +429,15 @@  discard block
 block discarded – undo
429 429
  * @param string|array|object $data Data that might be serialized.
430 430
  * @return mixed A scalar data
431 431
  */
432
-function maybe_serialize( $data ) {
433
-	if ( is_array( $data ) || is_object( $data ) )
434
-		return serialize( $data );
432
+function maybe_serialize($data) {
433
+	if (is_array($data) || is_object($data))
434
+		return serialize($data);
435 435
 
436 436
 	// Double serialization is required for backward compatibility.
437 437
 	// See https://core.trac.wordpress.org/ticket/12930
438 438
 	// Also the world will end. See WP 3.6.1.
439
-	if ( is_serialized( $data, false ) )
440
-		return serialize( $data );
439
+	if (is_serialized($data, false))
440
+		return serialize($data);
441 441
 
442 442
 	return $data;
443 443
 }
@@ -455,9 +455,9 @@  discard block
 block discarded – undo
455 455
  * @param string $content XMLRPC XML Request content
456 456
  * @return string Post title
457 457
  */
458
-function xmlrpc_getposttitle( $content ) {
458
+function xmlrpc_getposttitle($content) {
459 459
 	global $post_default_title;
460
-	if ( preg_match( '/<title>(.+?)<\/title>/is', $content, $matchtitle ) ) {
460
+	if (preg_match('/<title>(.+?)<\/title>/is', $content, $matchtitle)) {
461 461
 		$post_title = $matchtitle[1];
462 462
 	} else {
463 463
 		$post_title = $post_default_title;
@@ -479,11 +479,11 @@  discard block
 block discarded – undo
479 479
  * @param string $content XMLRPC XML Request content
480 480
  * @return string|array List of categories or category name.
481 481
  */
482
-function xmlrpc_getpostcategory( $content ) {
482
+function xmlrpc_getpostcategory($content) {
483 483
 	global $post_default_category;
484
-	if ( preg_match( '/<category>(.+?)<\/category>/is', $content, $matchcat ) ) {
485
-		$post_category = trim( $matchcat[1], ',' );
486
-		$post_category = explode( ',', $post_category );
484
+	if (preg_match('/<category>(.+?)<\/category>/is', $content, $matchcat)) {
485
+		$post_category = trim($matchcat[1], ',');
486
+		$post_category = explode(',', $post_category);
487 487
 	} else {
488 488
 		$post_category = $post_default_category;
489 489
 	}
@@ -498,10 +498,10 @@  discard block
 block discarded – undo
498 498
  * @param string $content XML-RPC XML Request content.
499 499
  * @return string XMLRPC XML Request content without title and category elements.
500 500
  */
501
-function xmlrpc_removepostdata( $content ) {
502
-	$content = preg_replace( '/<title>(.+?)<\/title>/si', '', $content );
503
-	$content = preg_replace( '/<category>(.+?)<\/category>/si', '', $content );
504
-	$content = trim( $content );
501
+function xmlrpc_removepostdata($content) {
502
+	$content = preg_replace('/<title>(.+?)<\/title>/si', '', $content);
503
+	$content = preg_replace('/<category>(.+?)<\/category>/si', '', $content);
504
+	$content = trim($content);
505 505
 	return $content;
506 506
 }
507 507
 
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
  * @param string $content Content to extract URLs from.
514 514
  * @return array URLs found in passed string.
515 515
  */
516
-function wp_extract_urls( $content ) {
516
+function wp_extract_urls($content) {
517 517
 	preg_match_all(
518 518
 		"#([\"']?)("
519 519
 			. "(?:([\w-]+:)?//?)"
@@ -531,9 +531,9 @@  discard block
 block discarded – undo
531 531
 		$post_links
532 532
 	);
533 533
 
534
-	$post_links = array_unique( array_map( 'html_entity_decode', $post_links[2] ) );
534
+	$post_links = array_unique(array_map('html_entity_decode', $post_links[2]));
535 535
 
536
-	return array_values( $post_links );
536
+	return array_values($post_links);
537 537
 }
538 538
 
539 539
 /**
@@ -550,34 +550,34 @@  discard block
 block discarded – undo
550 550
  * @param string $content Post Content.
551 551
  * @param int    $post_ID Post ID.
552 552
  */
553
-function do_enclose( $content, $post_ID ) {
553
+function do_enclose($content, $post_ID) {
554 554
 	global $wpdb;
555 555
 
556 556
 	//TODO: Tidy this ghetto code up and make the debug code optional
557
-	include_once( ABSPATH . WPINC . '/class-IXR.php' );
557
+	include_once(ABSPATH.WPINC.'/class-IXR.php');
558 558
 
559 559
 	$post_links = array();
560 560
 
561
-	$pung = get_enclosed( $post_ID );
561
+	$pung = get_enclosed($post_ID);
562 562
 
563
-	$post_links_temp = wp_extract_urls( $content );
563
+	$post_links_temp = wp_extract_urls($content);
564 564
 
565
-	foreach ( $pung as $link_test ) {
566
-		if ( ! in_array( $link_test, $post_links_temp ) ) { // link no longer in post
567
-			$mids = $wpdb->get_col( $wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE %s", $post_ID, $wpdb->esc_like( $link_test ) . '%') );
568
-			foreach ( $mids as $mid )
569
-				delete_metadata_by_mid( 'post', $mid );
565
+	foreach ($pung as $link_test) {
566
+		if ( ! in_array($link_test, $post_links_temp)) { // link no longer in post
567
+			$mids = $wpdb->get_col($wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE %s", $post_ID, $wpdb->esc_like($link_test).'%'));
568
+			foreach ($mids as $mid)
569
+				delete_metadata_by_mid('post', $mid);
570 570
 		}
571 571
 	}
572 572
 
573
-	foreach ( (array) $post_links_temp as $link_test ) {
574
-		if ( !in_array( $link_test, $pung ) ) { // If we haven't pung it already
575
-			$test = @parse_url( $link_test );
576
-			if ( false === $test )
573
+	foreach ((array) $post_links_temp as $link_test) {
574
+		if ( ! in_array($link_test, $pung)) { // If we haven't pung it already
575
+			$test = @parse_url($link_test);
576
+			if (false === $test)
577 577
 				continue;
578
-			if ( isset( $test['query'] ) )
578
+			if (isset($test['query']))
579 579
 				$post_links[] = $link_test;
580
-			elseif ( isset($test['path']) && ( $test['path'] != '/' ) &&  ($test['path'] != '' ) )
580
+			elseif (isset($test['path']) && ($test['path'] != '/') && ($test['path'] != ''))
581 581
 				$post_links[] = $link_test;
582 582
 		}
583 583
 	}
@@ -593,24 +593,24 @@  discard block
 block discarded – undo
593 593
 	 * @param array $post_links An array of enclosure links.
594 594
 	 * @param int   $post_ID    Post ID.
595 595
 	 */
596
-	$post_links = apply_filters( 'enclosure_links', $post_links, $post_ID );
596
+	$post_links = apply_filters('enclosure_links', $post_links, $post_ID);
597 597
 
598
-	foreach ( (array) $post_links as $url ) {
599
-		if ( $url != '' && !$wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE %s", $post_ID, $wpdb->esc_like( $url ) . '%' ) ) ) {
598
+	foreach ((array) $post_links as $url) {
599
+		if ($url != '' && ! $wpdb->get_var($wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE %s", $post_ID, $wpdb->esc_like($url).'%'))) {
600 600
 
601
-			if ( $headers = wp_get_http_headers( $url) ) {
602
-				$len = isset( $headers['content-length'] ) ? (int) $headers['content-length'] : 0;
603
-				$type = isset( $headers['content-type'] ) ? $headers['content-type'] : '';
604
-				$allowed_types = array( 'video', 'audio' );
601
+			if ($headers = wp_get_http_headers($url)) {
602
+				$len = isset($headers['content-length']) ? (int) $headers['content-length'] : 0;
603
+				$type = isset($headers['content-type']) ? $headers['content-type'] : '';
604
+				$allowed_types = array('video', 'audio');
605 605
 
606 606
 				// Check to see if we can figure out the mime type from
607 607
 				// the extension
608
-				$url_parts = @parse_url( $url );
609
-				if ( false !== $url_parts ) {
610
-					$extension = pathinfo( $url_parts['path'], PATHINFO_EXTENSION );
611
-					if ( !empty( $extension ) ) {
612
-						foreach ( wp_get_mime_types() as $exts => $mime ) {
613
-							if ( preg_match( '!^(' . $exts . ')$!i', $extension ) ) {
608
+				$url_parts = @parse_url($url);
609
+				if (false !== $url_parts) {
610
+					$extension = pathinfo($url_parts['path'], PATHINFO_EXTENSION);
611
+					if ( ! empty($extension)) {
612
+						foreach (wp_get_mime_types() as $exts => $mime) {
613
+							if (preg_match('!^('.$exts.')$!i', $extension)) {
614 614
 								$type = $mime;
615 615
 								break;
616 616
 							}
@@ -618,8 +618,8 @@  discard block
 block discarded – undo
618 618
 					}
619 619
 				}
620 620
 
621
-				if ( in_array( substr( $type, 0, strpos( $type, "/" ) ), $allowed_types ) ) {
622
-					add_post_meta( $post_ID, 'enclosure', "$url\n$len\n$mime\n" );
621
+				if (in_array(substr($type, 0, strpos($type, "/")), $allowed_types)) {
622
+					add_post_meta($post_ID, 'enclosure', "$url\n$len\n$mime\n");
623 623
 				}
624 624
 			}
625 625
 		}
@@ -635,16 +635,16 @@  discard block
 block discarded – undo
635 635
  * @param bool   $deprecated Not Used.
636 636
  * @return bool|string False on failure, headers on success.
637 637
  */
638
-function wp_get_http_headers( $url, $deprecated = false ) {
639
-	if ( !empty( $deprecated ) )
640
-		_deprecated_argument( __FUNCTION__, '2.7' );
638
+function wp_get_http_headers($url, $deprecated = false) {
639
+	if ( ! empty($deprecated))
640
+		_deprecated_argument(__FUNCTION__, '2.7');
641 641
 
642
-	$response = wp_safe_remote_head( $url );
642
+	$response = wp_safe_remote_head($url);
643 643
 
644
-	if ( is_wp_error( $response ) )
644
+	if (is_wp_error($response))
645 645
 		return false;
646 646
 
647
-	return wp_remote_retrieve_headers( $response );
647
+	return wp_remote_retrieve_headers($response);
648 648
 }
649 649
 
650 650
 /**
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
  */
661 661
 function is_new_day() {
662 662
 	global $currentday, $previousday;
663
-	if ( $currentday != $previousday )
663
+	if ($currentday != $previousday)
664 664
 		return 1;
665 665
 	else
666 666
 		return 0;
@@ -681,8 +681,8 @@  discard block
 block discarded – undo
681 681
  * @param array $data URL-encode key/value pairs.
682 682
  * @return string URL-encoded string.
683 683
  */
684
-function build_query( $data ) {
685
-	return _http_build_query( $data, null, '&', '', false );
684
+function build_query($data) {
685
+	return _http_build_query($data, null, '&', '', false);
686 686
 }
687 687
 
688 688
 /**
@@ -703,30 +703,30 @@  discard block
 block discarded – undo
703 703
  *
704 704
  * @return string The query string.
705 705
  */
706
-function _http_build_query( $data, $prefix = null, $sep = null, $key = '', $urlencode = true ) {
706
+function _http_build_query($data, $prefix = null, $sep = null, $key = '', $urlencode = true) {
707 707
 	$ret = array();
708 708
 
709
-	foreach ( (array) $data as $k => $v ) {
710
-		if ( $urlencode)
709
+	foreach ((array) $data as $k => $v) {
710
+		if ($urlencode)
711 711
 			$k = urlencode($k);
712
-		if ( is_int($k) && $prefix != null )
712
+		if (is_int($k) && $prefix != null)
713 713
 			$k = $prefix.$k;
714
-		if ( !empty($key) )
715
-			$k = $key . '%5B' . $k . '%5D';
716
-		if ( $v === null )
714
+		if ( ! empty($key))
715
+			$k = $key.'%5B'.$k.'%5D';
716
+		if ($v === null)
717 717
 			continue;
718
-		elseif ( $v === false )
718
+		elseif ($v === false)
719 719
 			$v = '0';
720 720
 
721
-		if ( is_array($v) || is_object($v) )
722
-			array_push($ret,_http_build_query($v, '', $sep, $k, $urlencode));
723
-		elseif ( $urlencode )
721
+		if (is_array($v) || is_object($v))
722
+			array_push($ret, _http_build_query($v, '', $sep, $k, $urlencode));
723
+		elseif ($urlencode)
724 724
 			array_push($ret, $k.'='.urlencode($v));
725 725
 		else
726 726
 			array_push($ret, $k.'='.$v);
727 727
 	}
728 728
 
729
-	if ( null === $sep )
729
+	if (null === $sep)
730 730
 		$sep = ini_get('arg_separator.output');
731 731
 
732 732
 	return implode($sep, $ret);
@@ -769,64 +769,64 @@  discard block
 block discarded – undo
769 769
  */
770 770
 function add_query_arg() {
771 771
 	$args = func_get_args();
772
-	if ( is_array( $args[0] ) ) {
773
-		if ( count( $args ) < 2 || false === $args[1] )
772
+	if (is_array($args[0])) {
773
+		if (count($args) < 2 || false === $args[1])
774 774
 			$uri = $_SERVER['REQUEST_URI'];
775 775
 		else
776 776
 			$uri = $args[1];
777 777
 	} else {
778
-		if ( count( $args ) < 3 || false === $args[2] )
778
+		if (count($args) < 3 || false === $args[2])
779 779
 			$uri = $_SERVER['REQUEST_URI'];
780 780
 		else
781 781
 			$uri = $args[2];
782 782
 	}
783 783
 
784
-	if ( $frag = strstr( $uri, '#' ) )
785
-		$uri = substr( $uri, 0, -strlen( $frag ) );
784
+	if ($frag = strstr($uri, '#'))
785
+		$uri = substr($uri, 0, -strlen($frag));
786 786
 	else
787 787
 		$frag = '';
788 788
 
789
-	if ( 0 === stripos( $uri, 'http://' ) ) {
789
+	if (0 === stripos($uri, 'http://')) {
790 790
 		$protocol = 'http://';
791
-		$uri = substr( $uri, 7 );
792
-	} elseif ( 0 === stripos( $uri, 'https://' ) ) {
791
+		$uri = substr($uri, 7);
792
+	} elseif (0 === stripos($uri, 'https://')) {
793 793
 		$protocol = 'https://';
794
-		$uri = substr( $uri, 8 );
794
+		$uri = substr($uri, 8);
795 795
 	} else {
796 796
 		$protocol = '';
797 797
 	}
798 798
 
799
-	if ( strpos( $uri, '?' ) !== false ) {
800
-		list( $base, $query ) = explode( '?', $uri, 2 );
799
+	if (strpos($uri, '?') !== false) {
800
+		list($base, $query) = explode('?', $uri, 2);
801 801
 		$base .= '?';
802
-	} elseif ( $protocol || strpos( $uri, '=' ) === false ) {
803
-		$base = $uri . '?';
802
+	} elseif ($protocol || strpos($uri, '=') === false) {
803
+		$base = $uri.'?';
804 804
 		$query = '';
805 805
 	} else {
806 806
 		$base = '';
807 807
 		$query = $uri;
808 808
 	}
809 809
 
810
-	wp_parse_str( $query, $qs );
811
-	$qs = urlencode_deep( $qs ); // this re-URL-encodes things that were already in the query string
812
-	if ( is_array( $args[0] ) ) {
813
-		foreach ( $args[0] as $k => $v ) {
814
-			$qs[ $k ] = $v;
810
+	wp_parse_str($query, $qs);
811
+	$qs = urlencode_deep($qs); // this re-URL-encodes things that were already in the query string
812
+	if (is_array($args[0])) {
813
+		foreach ($args[0] as $k => $v) {
814
+			$qs[$k] = $v;
815 815
 		}
816 816
 	} else {
817
-		$qs[ $args[0] ] = $args[1];
817
+		$qs[$args[0]] = $args[1];
818 818
 	}
819 819
 
820
-	foreach ( $qs as $k => $v ) {
821
-		if ( $v === false )
822
-			unset( $qs[$k] );
820
+	foreach ($qs as $k => $v) {
821
+		if ($v === false)
822
+			unset($qs[$k]);
823 823
 	}
824 824
 
825
-	$ret = build_query( $qs );
826
-	$ret = trim( $ret, '?' );
827
-	$ret = preg_replace( '#=(&|$)#', '$1', $ret );
828
-	$ret = $protocol . $base . $ret . $frag;
829
-	$ret = rtrim( $ret, '?' );
825
+	$ret = build_query($qs);
826
+	$ret = trim($ret, '?');
827
+	$ret = preg_replace('#=(&|$)#', '$1', $ret);
828
+	$ret = $protocol.$base.$ret.$frag;
829
+	$ret = rtrim($ret, '?');
830 830
 	return $ret;
831 831
 }
832 832
 
@@ -839,13 +839,13 @@  discard block
 block discarded – undo
839 839
  * @param bool|string  $query Optional. When false uses the current URL. Default false.
840 840
  * @return string New URL query string.
841 841
  */
842
-function remove_query_arg( $key, $query = false ) {
843
-	if ( is_array( $key ) ) { // removing multiple keys
844
-		foreach ( $key as $k )
845
-			$query = add_query_arg( $k, false, $query );
842
+function remove_query_arg($key, $query = false) {
843
+	if (is_array($key)) { // removing multiple keys
844
+		foreach ($key as $k)
845
+			$query = add_query_arg($k, false, $query);
846 846
 		return $query;
847 847
 	}
848
-	return add_query_arg( $key, false, $query );
848
+	return add_query_arg($key, false, $query);
849 849
 }
850 850
 
851 851
 /**
@@ -887,7 +887,7 @@  discard block
 block discarded – undo
887 887
 	 *
888 888
 	 * @param array $removable_query_args An array of query variables to remove from a URL.
889 889
 	 */
890
-	return apply_filters( 'removable_query_args', $removable_query_args );
890
+	return apply_filters('removable_query_args', $removable_query_args);
891 891
 }
892 892
 
893 893
 /**
@@ -898,12 +898,12 @@  discard block
 block discarded – undo
898 898
  * @param array $array Array to walk while sanitizing contents.
899 899
  * @return array Sanitized $array.
900 900
  */
901
-function add_magic_quotes( $array ) {
902
-	foreach ( (array) $array as $k => $v ) {
903
-		if ( is_array( $v ) ) {
904
-			$array[$k] = add_magic_quotes( $v );
901
+function add_magic_quotes($array) {
902
+	foreach ((array) $array as $k => $v) {
903
+		if (is_array($v)) {
904
+			$array[$k] = add_magic_quotes($v);
905 905
 		} else {
906
-			$array[$k] = addslashes( $v );
906
+			$array[$k] = addslashes($v);
907 907
 		}
908 908
 	}
909 909
 	return $array;
@@ -919,21 +919,21 @@  discard block
 block discarded – undo
919 919
  * @param string $uri URI/URL of web page to retrieve.
920 920
  * @return false|string HTTP content. False on failure.
921 921
  */
922
-function wp_remote_fopen( $uri ) {
923
-	$parsed_url = @parse_url( $uri );
922
+function wp_remote_fopen($uri) {
923
+	$parsed_url = @parse_url($uri);
924 924
 
925
-	if ( !$parsed_url || !is_array( $parsed_url ) )
925
+	if ( ! $parsed_url || ! is_array($parsed_url))
926 926
 		return false;
927 927
 
928 928
 	$options = array();
929 929
 	$options['timeout'] = 10;
930 930
 
931
-	$response = wp_safe_remote_get( $uri, $options );
931
+	$response = wp_safe_remote_get($uri, $options);
932 932
 
933
-	if ( is_wp_error( $response ) )
933
+	if (is_wp_error($response))
934 934
 		return false;
935 935
 
936
-	return wp_remote_retrieve_body( $response );
936
+	return wp_remote_retrieve_body($response);
937 937
 }
938 938
 
939 939
 /**
@@ -947,11 +947,11 @@  discard block
 block discarded – undo
947 947
  *
948 948
  * @param string|array $query_vars Default WP_Query arguments.
949 949
  */
950
-function wp( $query_vars = '' ) {
950
+function wp($query_vars = '') {
951 951
 	global $wp, $wp_query, $wp_the_query;
952
-	$wp->main( $query_vars );
952
+	$wp->main($query_vars);
953 953
 
954
-	if ( !isset($wp_the_query) )
954
+	if ( ! isset($wp_the_query))
955 955
 		$wp_the_query = $wp_query;
956 956
 }
957 957
 
@@ -965,12 +965,12 @@  discard block
 block discarded – undo
965 965
  * @param int $code HTTP status code.
966 966
  * @return string Empty string if not found, or description if found.
967 967
  */
968
-function get_status_header_desc( $code ) {
968
+function get_status_header_desc($code) {
969 969
 	global $wp_header_to_desc;
970 970
 
971
-	$code = absint( $code );
971
+	$code = absint($code);
972 972
 
973
-	if ( !isset( $wp_header_to_desc ) ) {
973
+	if ( ! isset($wp_header_to_desc)) {
974 974
 		$wp_header_to_desc = array(
975 975
 			100 => 'Continue',
976 976
 			101 => 'Switching Protocols',
@@ -1038,7 +1038,7 @@  discard block
 block discarded – undo
1038 1038
 		);
1039 1039
 	}
1040 1040
 
1041
-	if ( isset( $wp_header_to_desc[$code] ) )
1041
+	if (isset($wp_header_to_desc[$code]))
1042 1042
 		return $wp_header_to_desc[$code];
1043 1043
 	else
1044 1044
 		return '';
@@ -1055,18 +1055,18 @@  discard block
 block discarded – undo
1055 1055
  * @param int    $code        HTTP status code.
1056 1056
  * @param string $description Optional. A custom description for the HTTP status.
1057 1057
  */
1058
-function status_header( $code, $description = '' ) {
1059
-	if ( ! $description ) {
1060
-		$description = get_status_header_desc( $code );
1058
+function status_header($code, $description = '') {
1059
+	if ( ! $description) {
1060
+		$description = get_status_header_desc($code);
1061 1061
 	}
1062 1062
 
1063
-	if ( empty( $description ) ) {
1063
+	if (empty($description)) {
1064 1064
 		return;
1065 1065
 	}
1066 1066
 
1067 1067
 	$protocol = wp_get_server_protocol();
1068 1068
 	$status_header = "$protocol $code $description";
1069
-	if ( function_exists( 'apply_filters' ) )
1069
+	if (function_exists('apply_filters'))
1070 1070
 
1071 1071
 		/**
1072 1072
 		 * Filter an HTTP status header.
@@ -1078,9 +1078,9 @@  discard block
 block discarded – undo
1078 1078
 		 * @param string $description   Description for the status code.
1079 1079
 		 * @param string $protocol      Server protocol.
1080 1080
 		 */
1081
-		$status_header = apply_filters( 'status_header', $status_header, $code, $description, $protocol );
1081
+		$status_header = apply_filters('status_header', $status_header, $code, $description, $protocol);
1082 1082
 
1083
-	@header( $status_header, true, $code );
1083
+	@header($status_header, true, $code);
1084 1084
 }
1085 1085
 
1086 1086
 /**
@@ -1100,7 +1100,7 @@  discard block
 block discarded – undo
1100 1100
 		'Pragma' => 'no-cache',
1101 1101
 	);
1102 1102
 
1103
-	if ( function_exists('apply_filters') ) {
1103
+	if (function_exists('apply_filters')) {
1104 1104
 		/**
1105 1105
 		 * Filter the cache-controlling headers.
1106 1106
 		 *
@@ -1116,7 +1116,7 @@  discard block
 block discarded – undo
1116 1116
 		 *     @type string $Pragma        Pragma header.
1117 1117
 		 * }
1118 1118
 		 */
1119
-		$headers = (array) apply_filters( 'nocache_headers', $headers );
1119
+		$headers = (array) apply_filters('nocache_headers', $headers);
1120 1120
 	}
1121 1121
 	$headers['Last-Modified'] = false;
1122 1122
 	return $headers;
@@ -1136,23 +1136,23 @@  discard block
 block discarded – undo
1136 1136
 function nocache_headers() {
1137 1137
 	$headers = wp_get_nocache_headers();
1138 1138
 
1139
-	unset( $headers['Last-Modified'] );
1139
+	unset($headers['Last-Modified']);
1140 1140
 
1141 1141
 	// In PHP 5.3+, make sure we are not sending a Last-Modified header.
1142
-	if ( function_exists( 'header_remove' ) ) {
1143
-		@header_remove( 'Last-Modified' );
1142
+	if (function_exists('header_remove')) {
1143
+		@header_remove('Last-Modified');
1144 1144
 	} else {
1145 1145
 		// In PHP 5.2, send an empty Last-Modified header, but only as a
1146 1146
 		// last resort to override a header already sent. #WP23021
1147
-		foreach ( headers_list() as $header ) {
1148
-			if ( 0 === stripos( $header, 'Last-Modified' ) ) {
1147
+		foreach (headers_list() as $header) {
1148
+			if (0 === stripos($header, 'Last-Modified')) {
1149 1149
 				$headers['Last-Modified'] = '';
1150 1150
 				break;
1151 1151
 			}
1152 1152
 		}
1153 1153
 	}
1154 1154
 
1155
-	foreach ( $headers as $name => $field_value )
1155
+	foreach ($headers as $name => $field_value)
1156 1156
 		@header("{$name}: {$field_value}");
1157 1157
 }
1158 1158
 
@@ -1164,9 +1164,9 @@  discard block
 block discarded – undo
1164 1164
 function cache_javascript_headers() {
1165 1165
 	$expiresOffset = 10 * DAY_IN_SECONDS;
1166 1166
 
1167
-	header( "Content-Type: text/javascript; charset=" . get_bloginfo( 'charset' ) );
1168
-	header( "Vary: Accept-Encoding" ); // Handle proxies
1169
-	header( "Expires: " . gmdate( "D, d M Y H:i:s", time() + $expiresOffset ) . " GMT" );
1167
+	header("Content-Type: text/javascript; charset=".get_bloginfo('charset'));
1168
+	header("Vary: Accept-Encoding"); // Handle proxies
1169
+	header("Expires: ".gmdate("D, d M Y H:i:s", time() + $expiresOffset)." GMT");
1170 1170
 }
1171 1171
 
1172 1172
 /**
@@ -1193,8 +1193,8 @@  discard block
 block discarded – undo
1193 1193
  * @param string $yn Character string containing either 'y' (yes) or 'n' (no).
1194 1194
  * @return bool True if yes, false on anything else.
1195 1195
  */
1196
-function bool_from_yn( $yn ) {
1197
-	return ( strtolower( $yn ) == 'y' );
1196
+function bool_from_yn($yn) {
1197
+	return (strtolower($yn) == 'y');
1198 1198
 }
1199 1199
 
1200 1200
 /**
@@ -1212,16 +1212,16 @@  discard block
 block discarded – undo
1212 1212
 function do_feed() {
1213 1213
 	global $wp_query;
1214 1214
 
1215
-	$feed = get_query_var( 'feed' );
1215
+	$feed = get_query_var('feed');
1216 1216
 
1217 1217
 	// Remove the pad, if present.
1218
-	$feed = preg_replace( '/^_+/', '', $feed );
1218
+	$feed = preg_replace('/^_+/', '', $feed);
1219 1219
 
1220
-	if ( $feed == '' || $feed == 'feed' )
1220
+	if ($feed == '' || $feed == 'feed')
1221 1221
 		$feed = get_default_feed();
1222 1222
 
1223
-	if ( ! has_action( "do_feed_{$feed}" ) ) {
1224
-		wp_die( __( 'ERROR: This is not a valid feed template.' ), '', array( 'response' => 404 ) );
1223
+	if ( ! has_action("do_feed_{$feed}")) {
1224
+		wp_die(__('ERROR: This is not a valid feed template.'), '', array('response' => 404));
1225 1225
 	}
1226 1226
 
1227 1227
 	/**
@@ -1236,7 +1236,7 @@  discard block
 block discarded – undo
1236 1236
 	 * @param bool   $is_comment_feed Whether the feed is a comment feed.
1237 1237
 	 * @param string $feed            The feed name.
1238 1238
 	 */
1239
-	do_action( "do_feed_{$feed}", $wp_query->is_comment_feed, $feed );
1239
+	do_action("do_feed_{$feed}", $wp_query->is_comment_feed, $feed);
1240 1240
 }
1241 1241
 
1242 1242
 /**
@@ -1247,7 +1247,7 @@  discard block
 block discarded – undo
1247 1247
  * @see load_template()
1248 1248
  */
1249 1249
 function do_feed_rdf() {
1250
-	load_template( ABSPATH . WPINC . '/feed-rdf.php' );
1250
+	load_template(ABSPATH.WPINC.'/feed-rdf.php');
1251 1251
 }
1252 1252
 
1253 1253
 /**
@@ -1258,7 +1258,7 @@  discard block
 block discarded – undo
1258 1258
  * @see load_template()
1259 1259
  */
1260 1260
 function do_feed_rss() {
1261
-	load_template( ABSPATH . WPINC . '/feed-rss.php' );
1261
+	load_template(ABSPATH.WPINC.'/feed-rss.php');
1262 1262
 }
1263 1263
 
1264 1264
 /**
@@ -1270,11 +1270,11 @@  discard block
 block discarded – undo
1270 1270
  *
1271 1271
  * @param bool $for_comments True for the comment feed, false for normal feed.
1272 1272
  */
1273
-function do_feed_rss2( $for_comments ) {
1274
-	if ( $for_comments )
1275
-		load_template( ABSPATH . WPINC . '/feed-rss2-comments.php' );
1273
+function do_feed_rss2($for_comments) {
1274
+	if ($for_comments)
1275
+		load_template(ABSPATH.WPINC.'/feed-rss2-comments.php');
1276 1276
 	else
1277
-		load_template( ABSPATH . WPINC . '/feed-rss2.php' );
1277
+		load_template(ABSPATH.WPINC.'/feed-rss2.php');
1278 1278
 }
1279 1279
 
1280 1280
 /**
@@ -1286,11 +1286,11 @@  discard block
 block discarded – undo
1286 1286
  *
1287 1287
  * @param bool $for_comments True for the comment feed, false for normal feed.
1288 1288
  */
1289
-function do_feed_atom( $for_comments ) {
1289
+function do_feed_atom($for_comments) {
1290 1290
 	if ($for_comments)
1291
-		load_template( ABSPATH . WPINC . '/feed-atom-comments.php');
1291
+		load_template(ABSPATH.WPINC.'/feed-atom-comments.php');
1292 1292
 	else
1293
-		load_template( ABSPATH . WPINC . '/feed-atom.php' );
1293
+		load_template(ABSPATH.WPINC.'/feed-atom.php');
1294 1294
 }
1295 1295
 
1296 1296
 /**
@@ -1302,22 +1302,22 @@  discard block
 block discarded – undo
1302 1302
  * @since 2.1.0
1303 1303
  */
1304 1304
 function do_robots() {
1305
-	header( 'Content-Type: text/plain; charset=utf-8' );
1305
+	header('Content-Type: text/plain; charset=utf-8');
1306 1306
 
1307 1307
 	/**
1308 1308
 	 * Fires when displaying the robots.txt file.
1309 1309
 	 *
1310 1310
 	 * @since 2.1.0
1311 1311
 	 */
1312
-	do_action( 'do_robotstxt' );
1312
+	do_action('do_robotstxt');
1313 1313
 
1314 1314
 	$output = "User-agent: *\n";
1315
-	$public = get_option( 'blog_public' );
1316
-	if ( '0' == $public ) {
1315
+	$public = get_option('blog_public');
1316
+	if ('0' == $public) {
1317 1317
 		$output .= "Disallow: /\n";
1318 1318
 	} else {
1319
-		$site_url = parse_url( site_url() );
1320
-		$path = ( !empty( $site_url['path'] ) ) ? $site_url['path'] : '';
1319
+		$site_url = parse_url(site_url());
1320
+		$path = ( ! empty($site_url['path'])) ? $site_url['path'] : '';
1321 1321
 		$output .= "Disallow: $path/wp-admin/\n";
1322 1322
 		$output .= "Allow: $path/wp-admin/admin-ajax.php\n";
1323 1323
 	}
@@ -1330,7 +1330,7 @@  discard block
 block discarded – undo
1330 1330
 	 * @param string $output Robots.txt output.
1331 1331
 	 * @param bool   $public Whether the site is considered "public".
1332 1332
 	 */
1333
-	echo apply_filters( 'robots_txt', $output, $public );
1333
+	echo apply_filters('robots_txt', $output, $public);
1334 1334
 }
1335 1335
 
1336 1336
 /**
@@ -1355,28 +1355,28 @@  discard block
 block discarded – undo
1355 1355
 	 * Check cache first. If options table goes away and we have true
1356 1356
 	 * cached, oh well.
1357 1357
 	 */
1358
-	if ( wp_cache_get( 'is_blog_installed' ) )
1358
+	if (wp_cache_get('is_blog_installed'))
1359 1359
 		return true;
1360 1360
 
1361 1361
 	$suppress = $wpdb->suppress_errors();
1362
-	if ( ! wp_installing() ) {
1362
+	if ( ! wp_installing()) {
1363 1363
 		$alloptions = wp_load_alloptions();
1364 1364
 	}
1365 1365
 	// If siteurl is not set to autoload, check it specifically
1366
-	if ( !isset( $alloptions['siteurl'] ) )
1367
-		$installed = $wpdb->get_var( "SELECT option_value FROM $wpdb->options WHERE option_name = 'siteurl'" );
1366
+	if ( ! isset($alloptions['siteurl']))
1367
+		$installed = $wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = 'siteurl'");
1368 1368
 	else
1369 1369
 		$installed = $alloptions['siteurl'];
1370
-	$wpdb->suppress_errors( $suppress );
1370
+	$wpdb->suppress_errors($suppress);
1371 1371
 
1372
-	$installed = !empty( $installed );
1373
-	wp_cache_set( 'is_blog_installed', $installed );
1372
+	$installed = ! empty($installed);
1373
+	wp_cache_set('is_blog_installed', $installed);
1374 1374
 
1375
-	if ( $installed )
1375
+	if ($installed)
1376 1376
 		return true;
1377 1377
 
1378 1378
 	// If visiting repair.php, return true and let it take over.
1379
-	if ( defined( 'WP_REPAIRING' ) )
1379
+	if (defined('WP_REPAIRING'))
1380 1380
 		return true;
1381 1381
 
1382 1382
 	$suppress = $wpdb->suppress_errors();
@@ -1387,14 +1387,14 @@  discard block
 block discarded – undo
1387 1387
 	 * options table could not be accessed.
1388 1388
 	 */
1389 1389
 	$wp_tables = $wpdb->tables();
1390
-	foreach ( $wp_tables as $table ) {
1390
+	foreach ($wp_tables as $table) {
1391 1391
 		// The existence of custom user tables shouldn't suggest an insane state or prevent a clean install.
1392
-		if ( defined( 'CUSTOM_USER_TABLE' ) && CUSTOM_USER_TABLE == $table )
1392
+		if (defined('CUSTOM_USER_TABLE') && CUSTOM_USER_TABLE == $table)
1393 1393
 			continue;
1394
-		if ( defined( 'CUSTOM_USER_META_TABLE' ) && CUSTOM_USER_META_TABLE == $table )
1394
+		if (defined('CUSTOM_USER_META_TABLE') && CUSTOM_USER_META_TABLE == $table)
1395 1395
 			continue;
1396 1396
 
1397
-		if ( ! $wpdb->get_results( "DESCRIBE $table;" ) )
1397
+		if ( ! $wpdb->get_results("DESCRIBE $table;"))
1398 1398
 			continue;
1399 1399
 
1400 1400
 		// One or more tables exist. We are insane.
@@ -1402,13 +1402,13 @@  discard block
 block discarded – undo
1402 1402
 		wp_load_translations_early();
1403 1403
 
1404 1404
 		// Die with a DB error.
1405
-		$wpdb->error = sprintf( __( 'One or more database tables are unavailable. The database may need to be <a href="%s">repaired</a>.' ), 'maint/repair.php?referrer=is_blog_installed' );
1405
+		$wpdb->error = sprintf(__('One or more database tables are unavailable. The database may need to be <a href="%s">repaired</a>.'), 'maint/repair.php?referrer=is_blog_installed');
1406 1406
 		dead_db();
1407 1407
 	}
1408 1408
 
1409
-	$wpdb->suppress_errors( $suppress );
1409
+	$wpdb->suppress_errors($suppress);
1410 1410
 
1411
-	wp_cache_set( 'is_blog_installed', false );
1411
+	wp_cache_set('is_blog_installed', false);
1412 1412
 
1413 1413
 	return false;
1414 1414
 }
@@ -1423,9 +1423,9 @@  discard block
 block discarded – undo
1423 1423
  * @param string     $name      Optional. Nonce name. Default '_wpnonce'.
1424 1424
  * @return string Escaped URL with nonce action added.
1425 1425
  */
1426
-function wp_nonce_url( $actionurl, $action = -1, $name = '_wpnonce' ) {
1427
-	$actionurl = str_replace( '&amp;', '&', $actionurl );
1428
-	return esc_html( add_query_arg( $name, wp_create_nonce( $action ), $actionurl ) );
1426
+function wp_nonce_url($actionurl, $action = -1, $name = '_wpnonce') {
1427
+	$actionurl = str_replace('&amp;', '&', $actionurl);
1428
+	return esc_html(add_query_arg($name, wp_create_nonce($action), $actionurl));
1429 1429
 }
1430 1430
 
1431 1431
 /**
@@ -1454,14 +1454,14 @@  discard block
 block discarded – undo
1454 1454
  * @param bool       $echo    Optional. Whether to display or return hidden form field. Default true.
1455 1455
  * @return string Nonce field HTML markup.
1456 1456
  */
1457
-function wp_nonce_field( $action = -1, $name = "_wpnonce", $referer = true , $echo = true ) {
1458
-	$name = esc_attr( $name );
1459
-	$nonce_field = '<input type="hidden" id="' . $name . '" name="' . $name . '" value="' . wp_create_nonce( $action ) . '" />';
1457
+function wp_nonce_field($action = -1, $name = "_wpnonce", $referer = true, $echo = true) {
1458
+	$name = esc_attr($name);
1459
+	$nonce_field = '<input type="hidden" id="'.$name.'" name="'.$name.'" value="'.wp_create_nonce($action).'" />';
1460 1460
 
1461
-	if ( $referer )
1462
-		$nonce_field .= wp_referer_field( false );
1461
+	if ($referer)
1462
+		$nonce_field .= wp_referer_field(false);
1463 1463
 
1464
-	if ( $echo )
1464
+	if ($echo)
1465 1465
 		echo $nonce_field;
1466 1466
 
1467 1467
 	return $nonce_field;
@@ -1478,10 +1478,10 @@  discard block
 block discarded – undo
1478 1478
  * @param bool $echo Optional. Whether to echo or return the referer field. Default true.
1479 1479
  * @return string Referer field HTML markup.
1480 1480
  */
1481
-function wp_referer_field( $echo = true ) {
1482
-	$referer_field = '<input type="hidden" name="_wp_http_referer" value="'. esc_attr( wp_unslash( $_SERVER['REQUEST_URI'] ) ) . '" />';
1481
+function wp_referer_field($echo = true) {
1482
+	$referer_field = '<input type="hidden" name="_wp_http_referer" value="'.esc_attr(wp_unslash($_SERVER['REQUEST_URI'])).'" />';
1483 1483
 
1484
-	if ( $echo )
1484
+	if ($echo)
1485 1485
 		echo $referer_field;
1486 1486
 	return $referer_field;
1487 1487
 }
@@ -1500,12 +1500,12 @@  discard block
 block discarded – undo
1500 1500
  *                             Default 'current'.
1501 1501
  * @return string Original referer field.
1502 1502
  */
1503
-function wp_original_referer_field( $echo = true, $jump_back_to = 'current' ) {
1504
-	if ( ! $ref = wp_get_original_referer() ) {
1505
-		$ref = 'previous' == $jump_back_to ? wp_get_referer() : wp_unslash( $_SERVER['REQUEST_URI'] );
1503
+function wp_original_referer_field($echo = true, $jump_back_to = 'current') {
1504
+	if ( ! $ref = wp_get_original_referer()) {
1505
+		$ref = 'previous' == $jump_back_to ? wp_get_referer() : wp_unslash($_SERVER['REQUEST_URI']);
1506 1506
 	}
1507
-	$orig_referer_field = '<input type="hidden" name="_wp_original_http_referer" value="' . esc_attr( $ref ) . '" />';
1508
-	if ( $echo )
1507
+	$orig_referer_field = '<input type="hidden" name="_wp_original_http_referer" value="'.esc_attr($ref).'" />';
1508
+	if ($echo)
1509 1509
 		echo $orig_referer_field;
1510 1510
 	return $orig_referer_field;
1511 1511
 }
@@ -1520,14 +1520,14 @@  discard block
 block discarded – undo
1520 1520
  * @return false|string False on failure. Referer URL on success.
1521 1521
  */
1522 1522
 function wp_get_referer() {
1523
-	if ( ! function_exists( 'wp_validate_redirect' ) ) {
1523
+	if ( ! function_exists('wp_validate_redirect')) {
1524 1524
 		return false;
1525 1525
 	}
1526 1526
 
1527 1527
 	$ref = wp_get_raw_referer();
1528 1528
 
1529
-	if ( $ref && $ref !== wp_unslash( $_SERVER['REQUEST_URI'] ) && $ref !== home_url() . wp_unslash( $_SERVER['REQUEST_URI'] ) ) {
1530
-		return wp_validate_redirect( $ref, false );
1529
+	if ($ref && $ref !== wp_unslash($_SERVER['REQUEST_URI']) && $ref !== home_url().wp_unslash($_SERVER['REQUEST_URI'])) {
1530
+		return wp_validate_redirect($ref, false);
1531 1531
 	}
1532 1532
 
1533 1533
 	return false;
@@ -1543,10 +1543,10 @@  discard block
 block discarded – undo
1543 1543
  * @return string|false Referer URL on success, false on failure.
1544 1544
  */
1545 1545
 function wp_get_raw_referer() {
1546
-	if ( ! empty( $_REQUEST['_wp_http_referer'] ) ) {
1547
-		return wp_unslash( $_REQUEST['_wp_http_referer'] );
1548
-	} else if ( ! empty( $_SERVER['HTTP_REFERER'] ) ) {
1549
-		return wp_unslash( $_SERVER['HTTP_REFERER'] );
1546
+	if ( ! empty($_REQUEST['_wp_http_referer'])) {
1547
+		return wp_unslash($_REQUEST['_wp_http_referer']);
1548
+	} else if ( ! empty($_SERVER['HTTP_REFERER'])) {
1549
+		return wp_unslash($_SERVER['HTTP_REFERER']);
1550 1550
 	}
1551 1551
 
1552 1552
 	return false;
@@ -1560,8 +1560,8 @@  discard block
 block discarded – undo
1560 1560
  * @return string|false False if no original referer or original referer if set.
1561 1561
  */
1562 1562
 function wp_get_original_referer() {
1563
-	if ( ! empty( $_REQUEST['_wp_original_http_referer'] ) && function_exists( 'wp_validate_redirect' ) )
1564
-		return wp_validate_redirect( wp_unslash( $_REQUEST['_wp_original_http_referer'] ), false );
1563
+	if ( ! empty($_REQUEST['_wp_original_http_referer']) && function_exists('wp_validate_redirect'))
1564
+		return wp_validate_redirect(wp_unslash($_REQUEST['_wp_original_http_referer']), false);
1565 1565
 	return false;
1566 1566
 }
1567 1567
 
@@ -1575,20 +1575,20 @@  discard block
 block discarded – undo
1575 1575
  * @param string $target Full path to attempt to create.
1576 1576
  * @return bool Whether the path was created. True if path already exists.
1577 1577
  */
1578
-function wp_mkdir_p( $target ) {
1578
+function wp_mkdir_p($target) {
1579 1579
 	$wrapper = null;
1580 1580
 
1581 1581
 	// Strip the protocol.
1582
-	if ( wp_is_stream( $target ) ) {
1583
-		list( $wrapper, $target ) = explode( '://', $target, 2 );
1582
+	if (wp_is_stream($target)) {
1583
+		list($wrapper, $target) = explode('://', $target, 2);
1584 1584
 	}
1585 1585
 
1586 1586
 	// From php.net/mkdir user contributed notes.
1587
-	$target = str_replace( '//', '/', $target );
1587
+	$target = str_replace('//', '/', $target);
1588 1588
 
1589 1589
 	// Put the wrapper back on the target.
1590
-	if ( $wrapper !== null ) {
1591
-		$target = $wrapper . '://' . $target;
1590
+	if ($wrapper !== null) {
1591
+		$target = $wrapper.'://'.$target;
1592 1592
 	}
1593 1593
 
1594 1594
 	/*
@@ -1596,35 +1596,35 @@  discard block
 block discarded – undo
1596 1596
 	 * Use rtrim() instead of untrailingslashit to avoid formatting.php dependency.
1597 1597
 	 */
1598 1598
 	$target = rtrim($target, '/');
1599
-	if ( empty($target) )
1599
+	if (empty($target))
1600 1600
 		$target = '/';
1601 1601
 
1602
-	if ( file_exists( $target ) )
1603
-		return @is_dir( $target );
1602
+	if (file_exists($target))
1603
+		return @is_dir($target);
1604 1604
 
1605 1605
 	// We need to find the permissions of the parent folder that exists and inherit that.
1606
-	$target_parent = dirname( $target );
1607
-	while ( '.' != $target_parent && ! is_dir( $target_parent ) ) {
1608
-		$target_parent = dirname( $target_parent );
1606
+	$target_parent = dirname($target);
1607
+	while ('.' != $target_parent && ! is_dir($target_parent)) {
1608
+		$target_parent = dirname($target_parent);
1609 1609
 	}
1610 1610
 
1611 1611
 	// Get the permission bits.
1612
-	if ( $stat = @stat( $target_parent ) ) {
1612
+	if ($stat = @stat($target_parent)) {
1613 1613
 		$dir_perms = $stat['mode'] & 0007777;
1614 1614
 	} else {
1615 1615
 		$dir_perms = 0777;
1616 1616
 	}
1617 1617
 
1618
-	if ( @mkdir( $target, $dir_perms, true ) ) {
1618
+	if (@mkdir($target, $dir_perms, true)) {
1619 1619
 
1620 1620
 		/*
1621 1621
 		 * If a umask is set that modifies $dir_perms, we'll have to re-set
1622 1622
 		 * the $dir_perms correctly with chmod()
1623 1623
 		 */
1624
-		if ( $dir_perms != ( $dir_perms & ~umask() ) ) {
1625
-			$folder_parts = explode( '/', substr( $target, strlen( $target_parent ) + 1 ) );
1626
-			for ( $i = 1, $c = count( $folder_parts ); $i <= $c; $i++ ) {
1627
-				@chmod( $target_parent . '/' . implode( '/', array_slice( $folder_parts, 0, $i ) ), $dir_perms );
1624
+		if ($dir_perms != ($dir_perms & ~umask())) {
1625
+			$folder_parts = explode('/', substr($target, strlen($target_parent) + 1));
1626
+			for ($i = 1, $c = count($folder_parts); $i <= $c; $i++) {
1627
+				@chmod($target_parent.'/'.implode('/', array_slice($folder_parts, 0, $i)), $dir_perms);
1628 1628
 			}
1629 1629
 		}
1630 1630
 
@@ -1644,23 +1644,23 @@  discard block
 block discarded – undo
1644 1644
  * @param string $path File path.
1645 1645
  * @return bool True if path is absolute, false is not absolute.
1646 1646
  */
1647
-function path_is_absolute( $path ) {
1647
+function path_is_absolute($path) {
1648 1648
 	/*
1649 1649
 	 * This is definitive if true but fails if $path does not exist or contains
1650 1650
 	 * a symbolic link.
1651 1651
 	 */
1652
-	if ( realpath($path) == $path )
1652
+	if (realpath($path) == $path)
1653 1653
 		return true;
1654 1654
 
1655
-	if ( strlen($path) == 0 || $path[0] == '.' )
1655
+	if (strlen($path) == 0 || $path[0] == '.')
1656 1656
 		return false;
1657 1657
 
1658 1658
 	// Windows allows absolute paths like this.
1659
-	if ( preg_match('#^[a-zA-Z]:\\\\#', $path) )
1659
+	if (preg_match('#^[a-zA-Z]:\\\\#', $path))
1660 1660
 		return true;
1661 1661
 
1662 1662
 	// A path starting with / or \ is absolute; anything else is relative.
1663
-	return ( $path[0] == '/' || $path[0] == '\\' );
1663
+	return ($path[0] == '/' || $path[0] == '\\');
1664 1664
 }
1665 1665
 
1666 1666
 /**
@@ -1675,11 +1675,11 @@  discard block
 block discarded – undo
1675 1675
  * @param string $path Path relative to $base.
1676 1676
  * @return string The path with the base or absolute path.
1677 1677
  */
1678
-function path_join( $base, $path ) {
1679
-	if ( path_is_absolute($path) )
1678
+function path_join($base, $path) {
1679
+	if (path_is_absolute($path))
1680 1680
 		return $path;
1681 1681
 
1682
-	return rtrim($base, '/') . '/' . ltrim($path, '/');
1682
+	return rtrim($base, '/').'/'.ltrim($path, '/');
1683 1683
 }
1684 1684
 
1685 1685
 /**
@@ -1697,11 +1697,11 @@  discard block
 block discarded – undo
1697 1697
  * @param string $path Path to normalize.
1698 1698
  * @return string Normalized path.
1699 1699
  */
1700
-function wp_normalize_path( $path ) {
1701
-	$path = str_replace( '\\', '/', $path );
1702
-	$path = preg_replace( '|(?<=.)/+|', '/', $path );
1703
-	if ( ':' === substr( $path, 1, 1 ) ) {
1704
-		$path = ucfirst( $path );
1700
+function wp_normalize_path($path) {
1701
+	$path = str_replace('\\', '/', $path);
1702
+	$path = preg_replace('|(?<=.)/+|', '/', $path);
1703
+	if (':' === substr($path, 1, 1)) {
1704
+		$path = ucfirst($path);
1705 1705
 	}
1706 1706
 	return $path;
1707 1707
 }
@@ -1724,24 +1724,24 @@  discard block
 block discarded – undo
1724 1724
  */
1725 1725
 function get_temp_dir() {
1726 1726
 	static $temp = '';
1727
-	if ( defined('WP_TEMP_DIR') )
1727
+	if (defined('WP_TEMP_DIR'))
1728 1728
 		return trailingslashit(WP_TEMP_DIR);
1729 1729
 
1730
-	if ( $temp )
1731
-		return trailingslashit( $temp );
1730
+	if ($temp)
1731
+		return trailingslashit($temp);
1732 1732
 
1733
-	if ( function_exists('sys_get_temp_dir') ) {
1733
+	if (function_exists('sys_get_temp_dir')) {
1734 1734
 		$temp = sys_get_temp_dir();
1735
-		if ( @is_dir( $temp ) && wp_is_writable( $temp ) )
1736
-			return trailingslashit( $temp );
1735
+		if (@is_dir($temp) && wp_is_writable($temp))
1736
+			return trailingslashit($temp);
1737 1737
 	}
1738 1738
 
1739 1739
 	$temp = ini_get('upload_tmp_dir');
1740
-	if ( @is_dir( $temp ) && wp_is_writable( $temp ) )
1741
-		return trailingslashit( $temp );
1740
+	if (@is_dir($temp) && wp_is_writable($temp))
1741
+		return trailingslashit($temp);
1742 1742
 
1743
-	$temp = WP_CONTENT_DIR . '/';
1744
-	if ( is_dir( $temp ) && wp_is_writable( $temp ) )
1743
+	$temp = WP_CONTENT_DIR.'/';
1744
+	if (is_dir($temp) && wp_is_writable($temp))
1745 1745
 		return $temp;
1746 1746
 
1747 1747
 	return '/tmp/';
@@ -1760,11 +1760,11 @@  discard block
 block discarded – undo
1760 1760
  * @param string $path Path to check for write-ability.
1761 1761
  * @return bool Whether the path is writable.
1762 1762
  */
1763
-function wp_is_writable( $path ) {
1764
-	if ( 'WIN' === strtoupper( substr( PHP_OS, 0, 3 ) ) )
1765
-		return win_is_writable( $path );
1763
+function wp_is_writable($path) {
1764
+	if ('WIN' === strtoupper(substr(PHP_OS, 0, 3)))
1765
+		return win_is_writable($path);
1766 1766
 	else
1767
-		return @is_writable( $path );
1767
+		return @is_writable($path);
1768 1768
 }
1769 1769
 
1770 1770
 /**
@@ -1783,21 +1783,21 @@  discard block
 block discarded – undo
1783 1783
  * @param string $path Windows path to check for write-ability.
1784 1784
  * @return bool Whether the path is writable.
1785 1785
  */
1786
-function win_is_writable( $path ) {
1786
+function win_is_writable($path) {
1787 1787
 
1788
-	if ( $path[strlen( $path ) - 1] == '/' ) { // if it looks like a directory, check a random file within the directory
1789
-		return win_is_writable( $path . uniqid( mt_rand() ) . '.tmp');
1790
-	} elseif ( is_dir( $path ) ) { // If it's a directory (and not a file) check a random file within the directory
1791
-		return win_is_writable( $path . '/' . uniqid( mt_rand() ) . '.tmp' );
1788
+	if ($path[strlen($path) - 1] == '/') { // if it looks like a directory, check a random file within the directory
1789
+		return win_is_writable($path.uniqid(mt_rand()).'.tmp');
1790
+	} elseif (is_dir($path)) { // If it's a directory (and not a file) check a random file within the directory
1791
+		return win_is_writable($path.'/'.uniqid(mt_rand()).'.tmp');
1792 1792
 	}
1793 1793
 	// check tmp file for read/write capabilities
1794
-	$should_delete_tmp_file = !file_exists( $path );
1795
-	$f = @fopen( $path, 'a' );
1796
-	if ( $f === false )
1794
+	$should_delete_tmp_file = ! file_exists($path);
1795
+	$f = @fopen($path, 'a');
1796
+	if ($f === false)
1797 1797
 		return false;
1798
-	fclose( $f );
1799
-	if ( $should_delete_tmp_file )
1800
-		unlink( $path );
1798
+	fclose($f);
1799
+	if ($should_delete_tmp_file)
1800
+		unlink($path);
1801 1801
 	return true;
1802 1802
 }
1803 1803
 
@@ -1815,7 +1815,7 @@  discard block
 block discarded – undo
1815 1815
  * @return array See wp_upload_dir() for description.
1816 1816
  */
1817 1817
 function wp_get_upload_dir() {
1818
-	return wp_upload_dir( null, false );
1818
+	return wp_upload_dir(null, false);
1819 1819
 }
1820 1820
 
1821 1821
 /**
@@ -1853,13 +1853,13 @@  discard block
 block discarded – undo
1853 1853
  * @param bool   $refresh_cache Optional. Whether to refresh the cache. Default false.
1854 1854
  * @return array See above for description.
1855 1855
  */
1856
-function wp_upload_dir( $time = null, $create_dir = true, $refresh_cache = false ) {
1856
+function wp_upload_dir($time = null, $create_dir = true, $refresh_cache = false) {
1857 1857
 	static $cache = array();
1858 1858
 
1859
-	$key = sprintf( '%d-%s', get_current_blog_id(), (string) $time );
1859
+	$key = sprintf('%d-%s', get_current_blog_id(), (string) $time);
1860 1860
 
1861
-	if ( $refresh_cache || empty( $cache[ $key ] ) ) {
1862
-		$cache[ $key ] = _wp_upload_dir( $time );
1861
+	if ($refresh_cache || empty($cache[$key])) {
1862
+		$cache[$key] = _wp_upload_dir($time);
1863 1863
 	}
1864 1864
 
1865 1865
 	/**
@@ -1870,28 +1870,28 @@  discard block
 block discarded – undo
1870 1870
 	 * @param array $uploads Array of upload directory data with keys of 'path',
1871 1871
 	 *                       'url', 'subdir, 'basedir', and 'error'.
1872 1872
 	 */
1873
-	$uploads = apply_filters( 'upload_dir', $cache[ $key ] );
1873
+	$uploads = apply_filters('upload_dir', $cache[$key]);
1874 1874
 
1875
-	if ( $create_dir ) {
1875
+	if ($create_dir) {
1876 1876
 		$path = $uploads['path'];
1877
-		$tested_paths = wp_cache_get( 'upload_dir_tested_paths' );
1877
+		$tested_paths = wp_cache_get('upload_dir_tested_paths');
1878 1878
 
1879
-		if ( ! is_array( $tested_paths ) ) {
1879
+		if ( ! is_array($tested_paths)) {
1880 1880
 			$tested_paths = array();
1881 1881
 		}
1882 1882
 
1883
-		if ( ! in_array( $path, $tested_paths, true ) ) {
1884
-			if ( ! wp_mkdir_p( $path ) ) {
1885
-				if ( 0 === strpos( $uploads['basedir'], ABSPATH ) ) {
1886
-					$error_path = str_replace( ABSPATH, '', $uploads['basedir'] ) . $uploads['subdir'];
1883
+		if ( ! in_array($path, $tested_paths, true)) {
1884
+			if ( ! wp_mkdir_p($path)) {
1885
+				if (0 === strpos($uploads['basedir'], ABSPATH)) {
1886
+					$error_path = str_replace(ABSPATH, '', $uploads['basedir']).$uploads['subdir'];
1887 1887
 				} else {
1888
-					$error_path = basename( $uploads['basedir'] ) . $uploads['subdir'];
1888
+					$error_path = basename($uploads['basedir']).$uploads['subdir'];
1889 1889
 				}
1890 1890
 
1891
-				$uploads['error'] = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), esc_html( $error_path ) );
1891
+				$uploads['error'] = sprintf(__('Unable to create directory %s. Is its parent directory writable by the server?'), esc_html($error_path));
1892 1892
 			} else {
1893 1893
 				$tested_paths[] = $path;
1894
-				wp_cache_set( 'upload_dir_tested_paths', $tested_paths );
1894
+				wp_cache_set('upload_dir_tested_paths', $tested_paths);
1895 1895
 			}
1896 1896
 		}
1897 1897
 	}
@@ -1907,39 +1907,39 @@  discard block
 block discarded – undo
1907 1907
  * @param string $time Optional. Time formatted in 'yyyy/mm'. Default null.
1908 1908
  * @return array See wp_upload_dir()
1909 1909
  */
1910
-function _wp_upload_dir( $time = null ) {
1911
-	$siteurl = get_option( 'siteurl' );
1912
-	$upload_path = trim( get_option( 'upload_path' ) );
1910
+function _wp_upload_dir($time = null) {
1911
+	$siteurl = get_option('siteurl');
1912
+	$upload_path = trim(get_option('upload_path'));
1913 1913
 
1914
-	if ( empty( $upload_path ) || 'wp-content/uploads' == $upload_path ) {
1915
-		$dir = WP_CONTENT_DIR . '/uploads';
1916
-	} elseif ( 0 !== strpos( $upload_path, ABSPATH ) ) {
1914
+	if (empty($upload_path) || 'wp-content/uploads' == $upload_path) {
1915
+		$dir = WP_CONTENT_DIR.'/uploads';
1916
+	} elseif (0 !== strpos($upload_path, ABSPATH)) {
1917 1917
 		// $dir is absolute, $upload_path is (maybe) relative to ABSPATH
1918
-		$dir = path_join( ABSPATH, $upload_path );
1918
+		$dir = path_join(ABSPATH, $upload_path);
1919 1919
 	} else {
1920 1920
 		$dir = $upload_path;
1921 1921
 	}
1922 1922
 
1923
-	if ( !$url = get_option( 'upload_url_path' ) ) {
1924
-		if ( empty($upload_path) || ( 'wp-content/uploads' == $upload_path ) || ( $upload_path == $dir ) )
1925
-			$url = WP_CONTENT_URL . '/uploads';
1923
+	if ( ! $url = get_option('upload_url_path')) {
1924
+		if (empty($upload_path) || ('wp-content/uploads' == $upload_path) || ($upload_path == $dir))
1925
+			$url = WP_CONTENT_URL.'/uploads';
1926 1926
 		else
1927
-			$url = trailingslashit( $siteurl ) . $upload_path;
1927
+			$url = trailingslashit($siteurl).$upload_path;
1928 1928
 	}
1929 1929
 
1930 1930
 	/*
1931 1931
 	 * Honor the value of UPLOADS. This happens as long as ms-files rewriting is disabled.
1932 1932
 	 * We also sometimes obey UPLOADS when rewriting is enabled -- see the next block.
1933 1933
 	 */
1934
-	if ( defined( 'UPLOADS' ) && ! ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) ) {
1935
-		$dir = ABSPATH . UPLOADS;
1936
-		$url = trailingslashit( $siteurl ) . UPLOADS;
1934
+	if (defined('UPLOADS') && ! (is_multisite() && get_site_option('ms_files_rewriting'))) {
1935
+		$dir = ABSPATH.UPLOADS;
1936
+		$url = trailingslashit($siteurl).UPLOADS;
1937 1937
 	}
1938 1938
 
1939 1939
 	// If multisite (and if not the main site in a post-MU network)
1940
-	if ( is_multisite() && ! ( is_main_network() && is_main_site() && defined( 'MULTISITE' ) ) ) {
1940
+	if (is_multisite() && ! (is_main_network() && is_main_site() && defined('MULTISITE'))) {
1941 1941
 
1942
-		if ( ! get_site_option( 'ms_files_rewriting' ) ) {
1942
+		if ( ! get_site_option('ms_files_rewriting')) {
1943 1943
 			/*
1944 1944
 			 * If ms-files rewriting is disabled (networks created post-3.5), it is fairly
1945 1945
 			 * straightforward: Append sites/%d if we're not on the main site (for post-MU
@@ -1949,15 +1949,15 @@  discard block
 block discarded – undo
1949 1949
 			 * had wp-content/uploads for the main site.)
1950 1950
 			 */
1951 1951
 
1952
-			if ( defined( 'MULTISITE' ) )
1953
-				$ms_dir = '/sites/' . get_current_blog_id();
1952
+			if (defined('MULTISITE'))
1953
+				$ms_dir = '/sites/'.get_current_blog_id();
1954 1954
 			else
1955
-				$ms_dir = '/' . get_current_blog_id();
1955
+				$ms_dir = '/'.get_current_blog_id();
1956 1956
 
1957 1957
 			$dir .= $ms_dir;
1958 1958
 			$url .= $ms_dir;
1959 1959
 
1960
-		} elseif ( defined( 'UPLOADS' ) && ! ms_is_switched() ) {
1960
+		} elseif (defined('UPLOADS') && ! ms_is_switched()) {
1961 1961
 			/*
1962 1962
 			 * Handle the old-form ms-files.php rewriting if the network still has that enabled.
1963 1963
 			 * When ms-files rewriting is enabled, then we only listen to UPLOADS when:
@@ -1972,11 +1972,11 @@  discard block
 block discarded – undo
1972 1972
 			 * rewriting in multisite, the resulting URL is /files. (#WP22702 for background.)
1973 1973
 			 */
1974 1974
 
1975
-			if ( defined( 'BLOGUPLOADDIR' ) )
1976
-				$dir = untrailingslashit( BLOGUPLOADDIR );
1975
+			if (defined('BLOGUPLOADDIR'))
1976
+				$dir = untrailingslashit(BLOGUPLOADDIR);
1977 1977
 			else
1978
-				$dir = ABSPATH . UPLOADS;
1979
-			$url = trailingslashit( $siteurl ) . 'files';
1978
+				$dir = ABSPATH.UPLOADS;
1979
+			$url = trailingslashit($siteurl).'files';
1980 1980
 		}
1981 1981
 	}
1982 1982
 
@@ -1984,12 +1984,12 @@  discard block
 block discarded – undo
1984 1984
 	$baseurl = $url;
1985 1985
 
1986 1986
 	$subdir = '';
1987
-	if ( get_option( 'uploads_use_yearmonth_folders' ) ) {
1987
+	if (get_option('uploads_use_yearmonth_folders')) {
1988 1988
 		// Generate the yearly and monthly dirs
1989
-		if ( !$time )
1990
-			$time = current_time( 'mysql' );
1991
-		$y = substr( $time, 0, 4 );
1992
-		$m = substr( $time, 5, 2 );
1989
+		if ( ! $time)
1990
+			$time = current_time('mysql');
1991
+		$y = substr($time, 0, 4);
1992
+		$m = substr($time, 5, 2);
1993 1993
 		$subdir = "/$y/$m";
1994 1994
 	}
1995 1995
 
@@ -2023,38 +2023,38 @@  discard block
 block discarded – undo
2023 2023
  * @param callable $unique_filename_callback Callback. Default null.
2024 2024
  * @return string New filename, if given wasn't unique.
2025 2025
  */
2026
-function wp_unique_filename( $dir, $filename, $unique_filename_callback = null ) {
2026
+function wp_unique_filename($dir, $filename, $unique_filename_callback = null) {
2027 2027
 	// Sanitize the file name before we begin processing.
2028 2028
 	$filename = sanitize_file_name($filename);
2029 2029
 
2030 2030
 	// Separate the filename into a name and extension.
2031 2031
 	$info = pathinfo($filename);
2032
-	$ext = !empty($info['extension']) ? '.' . $info['extension'] : '';
2032
+	$ext = ! empty($info['extension']) ? '.'.$info['extension'] : '';
2033 2033
 	$name = basename($filename, $ext);
2034 2034
 
2035 2035
 	// Edge case: if file is named '.ext', treat as an empty name.
2036
-	if ( $name === $ext )
2036
+	if ($name === $ext)
2037 2037
 		$name = '';
2038 2038
 
2039 2039
 	/*
2040 2040
 	 * Increment the file number until we have a unique file to save in $dir.
2041 2041
 	 * Use callback if supplied.
2042 2042
 	 */
2043
-	if ( $unique_filename_callback && is_callable( $unique_filename_callback ) ) {
2044
-		$filename = call_user_func( $unique_filename_callback, $dir, $name, $ext );
2043
+	if ($unique_filename_callback && is_callable($unique_filename_callback)) {
2044
+		$filename = call_user_func($unique_filename_callback, $dir, $name, $ext);
2045 2045
 	} else {
2046 2046
 		$number = '';
2047 2047
 
2048 2048
 		// Change '.ext' to lower case.
2049
-		if ( $ext && strtolower($ext) != $ext ) {
2049
+		if ($ext && strtolower($ext) != $ext) {
2050 2050
 			$ext2 = strtolower($ext);
2051
-			$filename2 = preg_replace( '|' . preg_quote($ext) . '$|', $ext2, $filename );
2051
+			$filename2 = preg_replace('|'.preg_quote($ext).'$|', $ext2, $filename);
2052 2052
 
2053 2053
 			// Check for both lower and upper case extension or image sub-sizes may be overwritten.
2054
-			while ( file_exists($dir . "/$filename") || file_exists($dir . "/$filename2") ) {
2054
+			while (file_exists($dir."/$filename") || file_exists($dir."/$filename2")) {
2055 2055
 				$new_number = $number + 1;
2056
-				$filename = str_replace( array( "-$number$ext", "$number$ext" ), "-$new_number$ext", $filename );
2057
-				$filename2 = str_replace( array( "-$number$ext2", "$number$ext2" ), "-$new_number$ext2", $filename2 );
2056
+				$filename = str_replace(array("-$number$ext", "$number$ext"), "-$new_number$ext", $filename);
2057
+				$filename2 = str_replace(array("-$number$ext2", "$number$ext2"), "-$new_number$ext2", $filename2);
2058 2058
 				$number = $new_number;
2059 2059
 			}
2060 2060
 
@@ -2068,20 +2068,20 @@  discard block
 block discarded – undo
2068 2068
 			 * @param string        $dir                      Directory path.
2069 2069
 			 * @param callable|null $unique_filename_callback Callback function that generates the unique file name.
2070 2070
 			 */
2071
-			return apply_filters( 'wp_unique_filename', $filename2, $ext, $dir, $unique_filename_callback );
2071
+			return apply_filters('wp_unique_filename', $filename2, $ext, $dir, $unique_filename_callback);
2072 2072
 		}
2073 2073
 
2074
-		while ( file_exists( $dir . "/$filename" ) ) {
2075
-			if ( '' == "$number$ext" ) {
2076
-				$filename = "$filename-" . ++$number;
2074
+		while (file_exists($dir."/$filename")) {
2075
+			if ('' == "$number$ext") {
2076
+				$filename = "$filename-".++$number;
2077 2077
 			} else {
2078
-				$filename = str_replace( array( "-$number$ext", "$number$ext" ), "-" . ++$number . $ext, $filename );
2078
+				$filename = str_replace(array("-$number$ext", "$number$ext"), "-".++$number.$ext, $filename);
2079 2079
 			}
2080 2080
 		}
2081 2081
 	}
2082 2082
 
2083 2083
 	/** This filter is documented in wp-includes/functions.php */
2084
-	return apply_filters( 'wp_unique_filename', $filename, $ext, $dir, $unique_filename_callback );
2084
+	return apply_filters('wp_unique_filename', $filename, $ext, $dir, $unique_filename_callback);
2085 2085
 }
2086 2086
 
2087 2087
 /**
@@ -2107,20 +2107,20 @@  discard block
 block discarded – undo
2107 2107
  * @param string       $time       Optional. Time formatted in 'yyyy/mm'. Default null.
2108 2108
  * @return array
2109 2109
  */
2110
-function wp_upload_bits( $name, $deprecated, $bits, $time = null ) {
2111
-	if ( !empty( $deprecated ) )
2112
-		_deprecated_argument( __FUNCTION__, '2.0' );
2110
+function wp_upload_bits($name, $deprecated, $bits, $time = null) {
2111
+	if ( ! empty($deprecated))
2112
+		_deprecated_argument(__FUNCTION__, '2.0');
2113 2113
 
2114
-	if ( empty( $name ) )
2115
-		return array( 'error' => __( 'Empty filename' ) );
2114
+	if (empty($name))
2115
+		return array('error' => __('Empty filename'));
2116 2116
 
2117
-	$wp_filetype = wp_check_filetype( $name );
2118
-	if ( ! $wp_filetype['ext'] && ! current_user_can( 'unfiltered_upload' ) )
2119
-		return array( 'error' => __( 'Invalid file type' ) );
2117
+	$wp_filetype = wp_check_filetype($name);
2118
+	if ( ! $wp_filetype['ext'] && ! current_user_can('unfiltered_upload'))
2119
+		return array('error' => __('Invalid file type'));
2120 2120
 
2121
-	$upload = wp_upload_dir( $time );
2121
+	$upload = wp_upload_dir($time);
2122 2122
 
2123
-	if ( $upload['error'] !== false )
2123
+	if ($upload['error'] !== false)
2124 2124
 		return $upload;
2125 2125
 
2126 2126
 	/**
@@ -2133,45 +2133,45 @@  discard block
 block discarded – undo
2133 2133
 	 *
2134 2134
 	 * @param mixed $upload_bits_error An array of upload bits data, or a non-array error to return.
2135 2135
 	 */
2136
-	$upload_bits_error = apply_filters( 'wp_upload_bits', array( 'name' => $name, 'bits' => $bits, 'time' => $time ) );
2137
-	if ( !is_array( $upload_bits_error ) ) {
2138
-		$upload[ 'error' ] = $upload_bits_error;
2136
+	$upload_bits_error = apply_filters('wp_upload_bits', array('name' => $name, 'bits' => $bits, 'time' => $time));
2137
+	if ( ! is_array($upload_bits_error)) {
2138
+		$upload['error'] = $upload_bits_error;
2139 2139
 		return $upload;
2140 2140
 	}
2141 2141
 
2142
-	$filename = wp_unique_filename( $upload['path'], $name );
2142
+	$filename = wp_unique_filename($upload['path'], $name);
2143 2143
 
2144
-	$new_file = $upload['path'] . "/$filename";
2145
-	if ( ! wp_mkdir_p( dirname( $new_file ) ) ) {
2146
-		if ( 0 === strpos( $upload['basedir'], ABSPATH ) )
2147
-			$error_path = str_replace( ABSPATH, '', $upload['basedir'] ) . $upload['subdir'];
2144
+	$new_file = $upload['path']."/$filename";
2145
+	if ( ! wp_mkdir_p(dirname($new_file))) {
2146
+		if (0 === strpos($upload['basedir'], ABSPATH))
2147
+			$error_path = str_replace(ABSPATH, '', $upload['basedir']).$upload['subdir'];
2148 2148
 		else
2149
-			$error_path = basename( $upload['basedir'] ) . $upload['subdir'];
2149
+			$error_path = basename($upload['basedir']).$upload['subdir'];
2150 2150
 
2151
-		$message = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), $error_path );
2152
-		return array( 'error' => $message );
2151
+		$message = sprintf(__('Unable to create directory %s. Is its parent directory writable by the server?'), $error_path);
2152
+		return array('error' => $message);
2153 2153
 	}
2154 2154
 
2155
-	$ifp = @ fopen( $new_file, 'wb' );
2156
-	if ( ! $ifp )
2157
-		return array( 'error' => sprintf( __( 'Could not write file %s' ), $new_file ) );
2155
+	$ifp = @ fopen($new_file, 'wb');
2156
+	if ( ! $ifp)
2157
+		return array('error' => sprintf(__('Could not write file %s'), $new_file));
2158 2158
 
2159
-	@fwrite( $ifp, $bits );
2160
-	fclose( $ifp );
2159
+	@fwrite($ifp, $bits);
2160
+	fclose($ifp);
2161 2161
 	clearstatcache();
2162 2162
 
2163 2163
 	// Set correct file permissions
2164
-	$stat = @ stat( dirname( $new_file ) );
2164
+	$stat = @ stat(dirname($new_file));
2165 2165
 	$perms = $stat['mode'] & 0007777;
2166 2166
 	$perms = $perms & 0000666;
2167
-	@ chmod( $new_file, $perms );
2167
+	@ chmod($new_file, $perms);
2168 2168
 	clearstatcache();
2169 2169
 
2170 2170
 	// Compute the URL
2171
-	$url = $upload['url'] . "/$filename";
2171
+	$url = $upload['url']."/$filename";
2172 2172
 
2173 2173
 	/** This filter is documented in wp-admin/includes/file.php */
2174
-	return apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $wp_filetype['type'], 'error' => false ), 'sideload' );
2174
+	return apply_filters('wp_handle_upload', array('file' => $new_file, 'url' => $url, 'type' => $wp_filetype['type'], 'error' => false), 'sideload');
2175 2175
 }
2176 2176
 
2177 2177
 /**
@@ -2182,8 +2182,8 @@  discard block
 block discarded – undo
2182 2182
  * @param string $ext The extension to search.
2183 2183
  * @return string|void The file type, example: audio, video, document, spreadsheet, etc.
2184 2184
  */
2185
-function wp_ext2type( $ext ) {
2186
-	$ext = strtolower( $ext );
2185
+function wp_ext2type($ext) {
2186
+	$ext = strtolower($ext);
2187 2187
 
2188 2188
 	/**
2189 2189
 	 * Filter file type based on the extension name.
@@ -2195,20 +2195,20 @@  discard block
 block discarded – undo
2195 2195
 	 * @param array $ext2type Multi-dimensional array with extensions for a default set
2196 2196
 	 *                        of file types.
2197 2197
 	 */
2198
-	$ext2type = apply_filters( 'ext2type', array(
2199
-		'image'       => array( 'jpg', 'jpeg', 'jpe',  'gif',  'png',  'bmp',   'tif',  'tiff', 'ico' ),
2200
-		'audio'       => array( 'aac', 'ac3',  'aif',  'aiff', 'm3a',  'm4a',   'm4b',  'mka',  'mp1',  'mp2',  'mp3', 'ogg', 'oga', 'ram', 'wav', 'wma' ),
2201
-		'video'       => array( '3g2',  '3gp', '3gpp', 'asf', 'avi',  'divx', 'dv',   'flv',  'm4v',   'mkv',  'mov',  'mp4',  'mpeg', 'mpg', 'mpv', 'ogm', 'ogv', 'qt',  'rm', 'vob', 'wmv' ),
2202
-		'document'    => array( 'doc', 'docx', 'docm', 'dotm', 'odt',  'pages', 'pdf',  'xps',  'oxps', 'rtf',  'wp', 'wpd', 'psd', 'xcf' ),
2203
-		'spreadsheet' => array( 'numbers',     'ods',  'xls',  'xlsx', 'xlsm',  'xlsb' ),
2204
-		'interactive' => array( 'swf', 'key',  'ppt',  'pptx', 'pptm', 'pps',   'ppsx', 'ppsm', 'sldx', 'sldm', 'odp' ),
2205
-		'text'        => array( 'asc', 'csv',  'tsv',  'txt' ),
2206
-		'archive'     => array( 'bz2', 'cab',  'dmg',  'gz',   'rar',  'sea',   'sit',  'sqx',  'tar',  'tgz',  'zip', '7z' ),
2207
-		'code'        => array( 'css', 'htm',  'html', 'php',  'js' ),
2208
-	) );
2209
-
2210
-	foreach ( $ext2type as $type => $exts )
2211
-		if ( in_array( $ext, $exts ) )
2198
+	$ext2type = apply_filters('ext2type', array(
2199
+		'image'       => array('jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico'),
2200
+		'audio'       => array('aac', 'ac3', 'aif', 'aiff', 'm3a', 'm4a', 'm4b', 'mka', 'mp1', 'mp2', 'mp3', 'ogg', 'oga', 'ram', 'wav', 'wma'),
2201
+		'video'       => array('3g2', '3gp', '3gpp', 'asf', 'avi', 'divx', 'dv', 'flv', 'm4v', 'mkv', 'mov', 'mp4', 'mpeg', 'mpg', 'mpv', 'ogm', 'ogv', 'qt', 'rm', 'vob', 'wmv'),
2202
+		'document'    => array('doc', 'docx', 'docm', 'dotm', 'odt', 'pages', 'pdf', 'xps', 'oxps', 'rtf', 'wp', 'wpd', 'psd', 'xcf'),
2203
+		'spreadsheet' => array('numbers', 'ods', 'xls', 'xlsx', 'xlsm', 'xlsb'),
2204
+		'interactive' => array('swf', 'key', 'ppt', 'pptx', 'pptm', 'pps', 'ppsx', 'ppsm', 'sldx', 'sldm', 'odp'),
2205
+		'text'        => array('asc', 'csv', 'tsv', 'txt'),
2206
+		'archive'     => array('bz2', 'cab', 'dmg', 'gz', 'rar', 'sea', 'sit', 'sqx', 'tar', 'tgz', 'zip', '7z'),
2207
+		'code'        => array('css', 'htm', 'html', 'php', 'js'),
2208
+	));
2209
+
2210
+	foreach ($ext2type as $type => $exts)
2211
+		if (in_array($ext, $exts))
2212 2212
 			return $type;
2213 2213
 }
2214 2214
 
@@ -2223,22 +2223,22 @@  discard block
 block discarded – undo
2223 2223
  * @param array  $mimes    Optional. Key is the file extension with value as the mime type.
2224 2224
  * @return array Values with extension first and mime type.
2225 2225
  */
2226
-function wp_check_filetype( $filename, $mimes = null ) {
2227
-	if ( empty($mimes) )
2226
+function wp_check_filetype($filename, $mimes = null) {
2227
+	if (empty($mimes))
2228 2228
 		$mimes = get_allowed_mime_types();
2229 2229
 	$type = false;
2230 2230
 	$ext = false;
2231 2231
 
2232
-	foreach ( $mimes as $ext_preg => $mime_match ) {
2233
-		$ext_preg = '!\.(' . $ext_preg . ')$!i';
2234
-		if ( preg_match( $ext_preg, $filename, $ext_matches ) ) {
2232
+	foreach ($mimes as $ext_preg => $mime_match) {
2233
+		$ext_preg = '!\.('.$ext_preg.')$!i';
2234
+		if (preg_match($ext_preg, $filename, $ext_matches)) {
2235 2235
 			$type = $mime_match;
2236 2236
 			$ext = $ext_matches[1];
2237 2237
 			break;
2238 2238
 		}
2239 2239
 	}
2240 2240
 
2241
-	return compact( 'ext', 'type' );
2241
+	return compact('ext', 'type');
2242 2242
 }
2243 2243
 
2244 2244
 /**
@@ -2260,27 +2260,27 @@  discard block
 block discarded – undo
2260 2260
  * @return array Values for the extension, MIME, and either a corrected filename or false
2261 2261
  *               if original $filename is valid.
2262 2262
  */
2263
-function wp_check_filetype_and_ext( $file, $filename, $mimes = null ) {
2263
+function wp_check_filetype_and_ext($file, $filename, $mimes = null) {
2264 2264
 	$proper_filename = false;
2265 2265
 
2266 2266
 	// Do basic extension validation and MIME mapping
2267
-	$wp_filetype = wp_check_filetype( $filename, $mimes );
2267
+	$wp_filetype = wp_check_filetype($filename, $mimes);
2268 2268
 	$ext = $wp_filetype['ext'];
2269 2269
 	$type = $wp_filetype['type'];
2270 2270
 
2271 2271
 	// We can't do any further validation without a file to work with
2272
-	if ( ! file_exists( $file ) ) {
2273
-		return compact( 'ext', 'type', 'proper_filename' );
2272
+	if ( ! file_exists($file)) {
2273
+		return compact('ext', 'type', 'proper_filename');
2274 2274
 	}
2275 2275
 
2276 2276
 	// We're able to validate images using GD
2277
-	if ( $type && 0 === strpos( $type, 'image/' ) && function_exists('getimagesize') ) {
2277
+	if ($type && 0 === strpos($type, 'image/') && function_exists('getimagesize')) {
2278 2278
 
2279 2279
 		// Attempt to figure out what type of image it actually is
2280
-		$imgstats = @getimagesize( $file );
2280
+		$imgstats = @getimagesize($file);
2281 2281
 
2282 2282
 		// If getimagesize() knows what kind of image it really is and if the real MIME doesn't match the claimed MIME
2283
-		if ( !empty($imgstats['mime']) && $imgstats['mime'] != $type ) {
2283
+		if ( ! empty($imgstats['mime']) && $imgstats['mime'] != $type) {
2284 2284
 			/**
2285 2285
 			 * Filter the list mapping image mime types to their respective extensions.
2286 2286
 			 *
@@ -2288,26 +2288,26 @@  discard block
 block discarded – undo
2288 2288
 			 *
2289 2289
 			 * @param  array $mime_to_ext Array of image mime types and their matching extensions.
2290 2290
 			 */
2291
-			$mime_to_ext = apply_filters( 'getimagesize_mimes_to_exts', array(
2291
+			$mime_to_ext = apply_filters('getimagesize_mimes_to_exts', array(
2292 2292
 				'image/jpeg' => 'jpg',
2293 2293
 				'image/png'  => 'png',
2294 2294
 				'image/gif'  => 'gif',
2295 2295
 				'image/bmp'  => 'bmp',
2296 2296
 				'image/tiff' => 'tif',
2297
-			) );
2297
+			));
2298 2298
 
2299 2299
 			// Replace whatever is after the last period in the filename with the correct extension
2300
-			if ( ! empty( $mime_to_ext[ $imgstats['mime'] ] ) ) {
2301
-				$filename_parts = explode( '.', $filename );
2302
-				array_pop( $filename_parts );
2303
-				$filename_parts[] = $mime_to_ext[ $imgstats['mime'] ];
2304
-				$new_filename = implode( '.', $filename_parts );
2300
+			if ( ! empty($mime_to_ext[$imgstats['mime']])) {
2301
+				$filename_parts = explode('.', $filename);
2302
+				array_pop($filename_parts);
2303
+				$filename_parts[] = $mime_to_ext[$imgstats['mime']];
2304
+				$new_filename = implode('.', $filename_parts);
2305 2305
 
2306
-				if ( $new_filename != $filename ) {
2306
+				if ($new_filename != $filename) {
2307 2307
 					$proper_filename = $new_filename; // Mark that it changed
2308 2308
 				}
2309 2309
 				// Redefine the extension / MIME
2310
-				$wp_filetype = wp_check_filetype( $new_filename, $mimes );
2310
+				$wp_filetype = wp_check_filetype($new_filename, $mimes);
2311 2311
 				$ext = $wp_filetype['ext'];
2312 2312
 				$type = $wp_filetype['type'];
2313 2313
 			}
@@ -2326,7 +2326,7 @@  discard block
 block discarded – undo
2326 2326
 	 *                                          $file being in a tmp directory).
2327 2327
 	 * @param array  $mimes                     Key is the file extension with value as the mime type.
2328 2328
 	 */
2329
-	return apply_filters( 'wp_check_filetype_and_ext', compact( 'ext', 'type', 'proper_filename' ), $file, $filename, $mimes );
2329
+	return apply_filters('wp_check_filetype_and_ext', compact('ext', 'type', 'proper_filename'), $file, $filename, $mimes);
2330 2330
 }
2331 2331
 
2332 2332
 /**
@@ -2349,7 +2349,7 @@  discard block
 block discarded – undo
2349 2349
 	 * @param array $wp_get_mime_types Mime types keyed by the file extension regex
2350 2350
 	 *                                 corresponding to those types.
2351 2351
 	 */
2352
-	return apply_filters( 'mime_types', array(
2352
+	return apply_filters('mime_types', array(
2353 2353
 	// Image formats.
2354 2354
 	'jpg|jpeg|jpe' => 'image/jpeg',
2355 2355
 	'gif' => 'image/gif',
@@ -2449,7 +2449,7 @@  discard block
 block discarded – undo
2449 2449
 	'key' => 'application/vnd.apple.keynote',
2450 2450
 	'numbers' => 'application/vnd.apple.numbers',
2451 2451
 	'pages' => 'application/vnd.apple.pages',
2452
-	) );
2452
+	));
2453 2453
 }
2454 2454
 /**
2455 2455
  * Retrieve list of allowed mime types and file extensions.
@@ -2460,15 +2460,15 @@  discard block
 block discarded – undo
2460 2460
  * @return array Array of mime types keyed by the file extension regex corresponding
2461 2461
  *               to those types.
2462 2462
  */
2463
-function get_allowed_mime_types( $user = null ) {
2463
+function get_allowed_mime_types($user = null) {
2464 2464
 	$t = wp_get_mime_types();
2465 2465
 
2466
-	unset( $t['swf'], $t['exe'] );
2467
-	if ( function_exists( 'current_user_can' ) )
2468
-		$unfiltered = $user ? user_can( $user, 'unfiltered_html' ) : current_user_can( 'unfiltered_html' );
2466
+	unset($t['swf'], $t['exe']);
2467
+	if (function_exists('current_user_can'))
2468
+		$unfiltered = $user ? user_can($user, 'unfiltered_html') : current_user_can('unfiltered_html');
2469 2469
 
2470
-	if ( empty( $unfiltered ) )
2471
-		unset( $t['htm|html'] );
2470
+	if (empty($unfiltered))
2471
+		unset($t['htm|html']);
2472 2472
 
2473 2473
 	/**
2474 2474
 	 * Filter list of allowed mime types and file extensions.
@@ -2480,7 +2480,7 @@  discard block
 block discarded – undo
2480 2480
 	 *                               removed depending on '$user' capabilities.
2481 2481
 	 * @param int|WP_User|null $user User ID, User object or null if not provided (indicates current user).
2482 2482
 	 */
2483
-	return apply_filters( 'upload_mimes', $t, $user );
2483
+	return apply_filters('upload_mimes', $t, $user);
2484 2484
 }
2485 2485
 
2486 2486
 /**
@@ -2493,18 +2493,18 @@  discard block
 block discarded – undo
2493 2493
  *
2494 2494
  * @param string $action The nonce action.
2495 2495
  */
2496
-function wp_nonce_ays( $action ) {
2497
-	if ( 'log-out' == $action ) {
2498
-		$html = sprintf( __( 'You are attempting to log out of %s' ), get_bloginfo( 'name' ) ) . '</p><p>';
2499
-		$redirect_to = isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '';
2500
-		$html .= sprintf( __( "Do you really want to <a href='%s'>log out</a>?"), wp_logout_url( $redirect_to ) );
2496
+function wp_nonce_ays($action) {
2497
+	if ('log-out' == $action) {
2498
+		$html = sprintf(__('You are attempting to log out of %s'), get_bloginfo('name')).'</p><p>';
2499
+		$redirect_to = isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : '';
2500
+		$html .= sprintf(__("Do you really want to <a href='%s'>log out</a>?"), wp_logout_url($redirect_to));
2501 2501
 	} else {
2502
-		$html = __( 'Are you sure you want to do this?' );
2503
-		if ( wp_get_referer() )
2504
-			$html .= "</p><p><a href='" . esc_url( remove_query_arg( 'updated', wp_get_referer() ) ) . "'>" . __( 'Please try again.' ) . "</a>";
2502
+		$html = __('Are you sure you want to do this?');
2503
+		if (wp_get_referer())
2504
+			$html .= "</p><p><a href='".esc_url(remove_query_arg('updated', wp_get_referer()))."'>".__('Please try again.')."</a>";
2505 2505
 	}
2506 2506
 
2507
-	wp_die( $html, __( 'WordPress Failure Notice' ), 403 );
2507
+	wp_die($html, __('WordPress Failure Notice'), 403);
2508 2508
 }
2509 2509
 
2510 2510
 /**
@@ -2540,16 +2540,16 @@  discard block
 block discarded – undo
2540 2540
  *                                  Default is the value of {@see is_rtl()}.
2541 2541
  * }
2542 2542
  */
2543
-function wp_die( $message = '', $title = '', $args = array() ) {
2543
+function wp_die($message = '', $title = '', $args = array()) {
2544 2544
 
2545
-	if ( is_int( $args ) ) {
2546
-		$args = array( 'response' => $args );
2547
-	} elseif ( is_int( $title ) ) {
2548
-		$args  = array( 'response' => $title );
2545
+	if (is_int($args)) {
2546
+		$args = array('response' => $args);
2547
+	} elseif (is_int($title)) {
2548
+		$args  = array('response' => $title);
2549 2549
 		$title = '';
2550 2550
 	}
2551 2551
 
2552
-	if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
2552
+	if (defined('DOING_AJAX') && DOING_AJAX) {
2553 2553
 		/**
2554 2554
 		 * Filter callback for killing WordPress execution for AJAX requests.
2555 2555
 		 *
@@ -2557,8 +2557,8 @@  discard block
 block discarded – undo
2557 2557
 		 *
2558 2558
 		 * @param callable $function Callback function name.
2559 2559
 		 */
2560
-		$function = apply_filters( 'wp_die_ajax_handler', '_ajax_wp_die_handler' );
2561
-	} elseif ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) {
2560
+		$function = apply_filters('wp_die_ajax_handler', '_ajax_wp_die_handler');
2561
+	} elseif (defined('XMLRPC_REQUEST') && XMLRPC_REQUEST) {
2562 2562
 		/**
2563 2563
 		 * Filter callback for killing WordPress execution for XML-RPC requests.
2564 2564
 		 *
@@ -2566,7 +2566,7 @@  discard block
 block discarded – undo
2566 2566
 		 *
2567 2567
 		 * @param callable $function Callback function name.
2568 2568
 		 */
2569
-		$function = apply_filters( 'wp_die_xmlrpc_handler', '_xmlrpc_wp_die_handler' );
2569
+		$function = apply_filters('wp_die_xmlrpc_handler', '_xmlrpc_wp_die_handler');
2570 2570
 	} else {
2571 2571
 		/**
2572 2572
 		 * Filter callback for killing WordPress execution for all non-AJAX, non-XML-RPC requests.
@@ -2575,10 +2575,10 @@  discard block
 block discarded – undo
2575 2575
 		 *
2576 2576
 		 * @param callable $function Callback function name.
2577 2577
 		 */
2578
-		$function = apply_filters( 'wp_die_handler', '_default_wp_die_handler' );
2578
+		$function = apply_filters('wp_die_handler', '_default_wp_die_handler');
2579 2579
 	}
2580 2580
 
2581
-	call_user_func( $function, $message, $title, $args );
2581
+	call_user_func($function, $message, $title, $args);
2582 2582
 }
2583 2583
 
2584 2584
 /**
@@ -2594,20 +2594,20 @@  discard block
 block discarded – undo
2594 2594
  * @param string       $title   Optional. Error title. Default empty.
2595 2595
  * @param string|array $args    Optional. Arguments to control behavior. Default empty array.
2596 2596
  */
2597
-function _default_wp_die_handler( $message, $title = '', $args = array() ) {
2598
-	$defaults = array( 'response' => 500 );
2597
+function _default_wp_die_handler($message, $title = '', $args = array()) {
2598
+	$defaults = array('response' => 500);
2599 2599
 	$r = wp_parse_args($args, $defaults);
2600 2600
 
2601 2601
 	$have_gettext = function_exists('__');
2602 2602
 
2603
-	if ( function_exists( 'is_wp_error' ) && is_wp_error( $message ) ) {
2604
-		if ( empty( $title ) ) {
2603
+	if (function_exists('is_wp_error') && is_wp_error($message)) {
2604
+		if (empty($title)) {
2605 2605
 			$error_data = $message->get_error_data();
2606
-			if ( is_array( $error_data ) && isset( $error_data['title'] ) )
2606
+			if (is_array($error_data) && isset($error_data['title']))
2607 2607
 				$title = $error_data['title'];
2608 2608
 		}
2609 2609
 		$errors = $message->get_error_messages();
2610
-		switch ( count( $errors ) ) {
2610
+		switch (count($errors)) {
2611 2611
 		case 0 :
2612 2612
 			$message = '';
2613 2613
 			break;
@@ -2615,38 +2615,38 @@  discard block
 block discarded – undo
2615 2615
 			$message = "<p>{$errors[0]}</p>";
2616 2616
 			break;
2617 2617
 		default :
2618
-			$message = "<ul>\n\t\t<li>" . join( "</li>\n\t\t<li>", $errors ) . "</li>\n\t</ul>";
2618
+			$message = "<ul>\n\t\t<li>".join("</li>\n\t\t<li>", $errors)."</li>\n\t</ul>";
2619 2619
 			break;
2620 2620
 		}
2621
-	} elseif ( is_string( $message ) ) {
2621
+	} elseif (is_string($message)) {
2622 2622
 		$message = "<p>$message</p>";
2623 2623
 	}
2624 2624
 
2625
-	if ( isset( $r['back_link'] ) && $r['back_link'] ) {
2626
-		$back_text = $have_gettext? __('&laquo; Back') : '&laquo; Back';
2625
+	if (isset($r['back_link']) && $r['back_link']) {
2626
+		$back_text = $have_gettext ? __('&laquo; Back') : '&laquo; Back';
2627 2627
 		$message .= "\n<p><a href='javascript:history.back()'>$back_text</a></p>";
2628 2628
 	}
2629 2629
 
2630
-	if ( ! did_action( 'admin_head' ) ) :
2631
-		if ( !headers_sent() ) {
2632
-			status_header( $r['response'] );
2630
+	if ( ! did_action('admin_head')) :
2631
+		if ( ! headers_sent()) {
2632
+			status_header($r['response']);
2633 2633
 			nocache_headers();
2634
-			header( 'Content-Type: text/html; charset=utf-8' );
2634
+			header('Content-Type: text/html; charset=utf-8');
2635 2635
 		}
2636 2636
 
2637
-		if ( empty($title) )
2637
+		if (empty($title))
2638 2638
 			$title = $have_gettext ? __('WordPress &rsaquo; Error') : 'WordPress &rsaquo; Error';
2639 2639
 
2640 2640
 		$text_direction = 'ltr';
2641
-		if ( isset($r['text_direction']) && 'rtl' == $r['text_direction'] )
2641
+		if (isset($r['text_direction']) && 'rtl' == $r['text_direction'])
2642 2642
 			$text_direction = 'rtl';
2643
-		elseif ( function_exists( 'is_rtl' ) && is_rtl() )
2643
+		elseif (function_exists('is_rtl') && is_rtl())
2644 2644
 			$text_direction = 'rtl';
2645 2645
 ?>
2646 2646
 <!DOCTYPE html>
2647 2647
 <!-- Ticket #11289, IE bug fix: always pad the error page with enough characters such that it is greater than 512 bytes, even after gzip compression abcdefghijklmnopqrstuvwxyz1234567890aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz11223344556677889900abacbcbdcdcededfefegfgfhghgihihjijikjkjlklkmlmlnmnmononpopoqpqprqrqsrsrtstsubcbcdcdedefefgfabcadefbghicjkldmnoepqrfstugvwxhyz1i234j567k890laabmbccnddeoeffpgghqhiirjjksklltmmnunoovppqwqrrxsstytuuzvvw0wxx1yyz2z113223434455666777889890091abc2def3ghi4jkl5mno6pqr7stu8vwx9yz11aab2bcc3dd4ee5ff6gg7hh8ii9j0jk1kl2lmm3nnoo4p5pq6qrr7ss8tt9uuvv0wwx1x2yyzz13aba4cbcb5dcdc6dedfef8egf9gfh0ghg1ihi2hji3jik4jkj5lkl6kml7mln8mnm9ono
2648 2648
 -->
2649
-<html xmlns="http://www.w3.org/1999/xhtml" <?php if ( function_exists( 'language_attributes' ) && function_exists( 'is_rtl' ) ) language_attributes(); else echo "dir='$text_direction'"; ?>>
2649
+<html xmlns="http://www.w3.org/1999/xhtml" <?php if (function_exists('language_attributes') && function_exists('is_rtl')) language_attributes(); else echo "dir='$text_direction'"; ?>>
2650 2650
 <head>
2651 2651
 	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
2652 2652
 	<meta name="viewport" content="width=device-width">
@@ -2762,7 +2762,7 @@  discard block
 block discarded – undo
2762 2762
 		}
2763 2763
 
2764 2764
 		<?php
2765
-		if ( 'rtl' == $text_direction ) {
2765
+		if ('rtl' == $text_direction) {
2766 2766
 			echo 'body { font-family: Tahoma, Arial; }';
2767 2767
 		}
2768 2768
 		?>
@@ -2791,15 +2791,15 @@  discard block
 block discarded – undo
2791 2791
  * @param string       $title   Optional. Error title. Default empty.
2792 2792
  * @param string|array $args    Optional. Arguments to control behavior. Default empty array.
2793 2793
  */
2794
-function _xmlrpc_wp_die_handler( $message, $title = '', $args = array() ) {
2794
+function _xmlrpc_wp_die_handler($message, $title = '', $args = array()) {
2795 2795
 	global $wp_xmlrpc_server;
2796
-	$defaults = array( 'response' => 500 );
2796
+	$defaults = array('response' => 500);
2797 2797
 
2798 2798
 	$r = wp_parse_args($args, $defaults);
2799 2799
 
2800
-	if ( $wp_xmlrpc_server ) {
2801
-		$error = new IXR_Error( $r['response'] , $message);
2802
-		$wp_xmlrpc_server->output( $error->getXml() );
2800
+	if ($wp_xmlrpc_server) {
2801
+		$error = new IXR_Error($r['response'], $message);
2802
+		$wp_xmlrpc_server->output($error->getXml());
2803 2803
 	}
2804 2804
 	die();
2805 2805
 }
@@ -2814,10 +2814,10 @@  discard block
 block discarded – undo
2814 2814
  *
2815 2815
  * @param string $message Optional. Response to print. Default empty.
2816 2816
  */
2817
-function _ajax_wp_die_handler( $message = '' ) {
2818
-	if ( is_scalar( $message ) )
2819
-		die( (string) $message );
2820
-	die( '0' );
2817
+function _ajax_wp_die_handler($message = '') {
2818
+	if (is_scalar($message))
2819
+		die((string) $message);
2820
+	die('0');
2821 2821
 }
2822 2822
 
2823 2823
 /**
@@ -2830,9 +2830,9 @@  discard block
 block discarded – undo
2830 2830
  *
2831 2831
  * @param string $message Optional. Response to print. Default empty.
2832 2832
  */
2833
-function _scalar_wp_die_handler( $message = '' ) {
2834
-	if ( is_scalar( $message ) )
2835
-		die( (string) $message );
2833
+function _scalar_wp_die_handler($message = '') {
2834
+	if (is_scalar($message))
2835
+		die((string) $message);
2836 2836
 	die();
2837 2837
 }
2838 2838
 
@@ -2847,39 +2847,39 @@  discard block
 block discarded – undo
2847 2847
  *                       greater than 0. Default 512.
2848 2848
  * @return string|false The JSON encoded string, or false if it cannot be encoded.
2849 2849
  */
2850
-function wp_json_encode( $data, $options = 0, $depth = 512 ) {
2850
+function wp_json_encode($data, $options = 0, $depth = 512) {
2851 2851
 	/*
2852 2852
 	 * json_encode() has had extra params added over the years.
2853 2853
 	 * $options was added in 5.3, and $depth in 5.5.
2854 2854
 	 * We need to make sure we call it with the correct arguments.
2855 2855
 	 */
2856
-	if ( version_compare( PHP_VERSION, '5.5', '>=' ) ) {
2857
-		$args = array( $data, $options, $depth );
2858
-	} elseif ( version_compare( PHP_VERSION, '5.3', '>=' ) ) {
2859
-		$args = array( $data, $options );
2856
+	if (version_compare(PHP_VERSION, '5.5', '>=')) {
2857
+		$args = array($data, $options, $depth);
2858
+	} elseif (version_compare(PHP_VERSION, '5.3', '>=')) {
2859
+		$args = array($data, $options);
2860 2860
 	} else {
2861
-		$args = array( $data );
2861
+		$args = array($data);
2862 2862
 	}
2863 2863
 
2864 2864
 	// Prepare the data for JSON serialization.
2865
-	$data = _wp_json_prepare_data( $data );
2865
+	$data = _wp_json_prepare_data($data);
2866 2866
 
2867
-	$json = @call_user_func_array( 'json_encode', $args );
2867
+	$json = @call_user_func_array('json_encode', $args);
2868 2868
 
2869 2869
 	// If json_encode() was successful, no need to do more sanity checking.
2870 2870
 	// ... unless we're in an old version of PHP, and json_encode() returned
2871 2871
 	// a string containing 'null'. Then we need to do more sanity checking.
2872
-	if ( false !== $json && ( version_compare( PHP_VERSION, '5.5', '>=' ) || false === strpos( $json, 'null' ) ) )  {
2872
+	if (false !== $json && (version_compare(PHP_VERSION, '5.5', '>=') || false === strpos($json, 'null'))) {
2873 2873
 		return $json;
2874 2874
 	}
2875 2875
 
2876 2876
 	try {
2877
-		$args[0] = _wp_json_sanity_check( $data, $depth );
2878
-	} catch ( Exception $e ) {
2877
+		$args[0] = _wp_json_sanity_check($data, $depth);
2878
+	} catch (Exception $e) {
2879 2879
 		return false;
2880 2880
 	}
2881 2881
 
2882
-	return call_user_func_array( 'json_encode', $args );
2882
+	return call_user_func_array('json_encode', $args);
2883 2883
 }
2884 2884
 
2885 2885
 /**
@@ -2895,49 +2895,49 @@  discard block
 block discarded – undo
2895 2895
  * @param int   $depth Maximum depth to walk through $data. Must be greater than 0.
2896 2896
  * @return mixed The sanitized data that shall be encoded to JSON.
2897 2897
  */
2898
-function _wp_json_sanity_check( $data, $depth ) {
2899
-	if ( $depth < 0 ) {
2900
-		throw new Exception( 'Reached depth limit' );
2898
+function _wp_json_sanity_check($data, $depth) {
2899
+	if ($depth < 0) {
2900
+		throw new Exception('Reached depth limit');
2901 2901
 	}
2902 2902
 
2903
-	if ( is_array( $data ) ) {
2903
+	if (is_array($data)) {
2904 2904
 		$output = array();
2905
-		foreach ( $data as $id => $el ) {
2905
+		foreach ($data as $id => $el) {
2906 2906
 			// Don't forget to sanitize the ID!
2907
-			if ( is_string( $id ) ) {
2908
-				$clean_id = _wp_json_convert_string( $id );
2907
+			if (is_string($id)) {
2908
+				$clean_id = _wp_json_convert_string($id);
2909 2909
 			} else {
2910 2910
 				$clean_id = $id;
2911 2911
 			}
2912 2912
 
2913 2913
 			// Check the element type, so that we're only recursing if we really have to.
2914
-			if ( is_array( $el ) || is_object( $el ) ) {
2915
-				$output[ $clean_id ] = _wp_json_sanity_check( $el, $depth - 1 );
2916
-			} elseif ( is_string( $el ) ) {
2917
-				$output[ $clean_id ] = _wp_json_convert_string( $el );
2914
+			if (is_array($el) || is_object($el)) {
2915
+				$output[$clean_id] = _wp_json_sanity_check($el, $depth - 1);
2916
+			} elseif (is_string($el)) {
2917
+				$output[$clean_id] = _wp_json_convert_string($el);
2918 2918
 			} else {
2919
-				$output[ $clean_id ] = $el;
2919
+				$output[$clean_id] = $el;
2920 2920
 			}
2921 2921
 		}
2922
-	} elseif ( is_object( $data ) ) {
2922
+	} elseif (is_object($data)) {
2923 2923
 		$output = new stdClass;
2924
-		foreach ( $data as $id => $el ) {
2925
-			if ( is_string( $id ) ) {
2926
-				$clean_id = _wp_json_convert_string( $id );
2924
+		foreach ($data as $id => $el) {
2925
+			if (is_string($id)) {
2926
+				$clean_id = _wp_json_convert_string($id);
2927 2927
 			} else {
2928 2928
 				$clean_id = $id;
2929 2929
 			}
2930 2930
 
2931
-			if ( is_array( $el ) || is_object( $el ) ) {
2932
-				$output->$clean_id = _wp_json_sanity_check( $el, $depth - 1 );
2933
-			} elseif ( is_string( $el ) ) {
2934
-				$output->$clean_id = _wp_json_convert_string( $el );
2931
+			if (is_array($el) || is_object($el)) {
2932
+				$output->$clean_id = _wp_json_sanity_check($el, $depth - 1);
2933
+			} elseif (is_string($el)) {
2934
+				$output->$clean_id = _wp_json_convert_string($el);
2935 2935
 			} else {
2936 2936
 				$output->$clean_id = $el;
2937 2937
 			}
2938 2938
 		}
2939
-	} elseif ( is_string( $data ) ) {
2940
-		return _wp_json_convert_string( $data );
2939
+	} elseif (is_string($data)) {
2940
+		return _wp_json_convert_string($data);
2941 2941
 	} else {
2942 2942
 		return $data;
2943 2943
 	}
@@ -2959,21 +2959,21 @@  discard block
 block discarded – undo
2959 2959
  * @param string $string The string which is to be converted.
2960 2960
  * @return string The checked string.
2961 2961
  */
2962
-function _wp_json_convert_string( $string ) {
2962
+function _wp_json_convert_string($string) {
2963 2963
 	static $use_mb = null;
2964
-	if ( is_null( $use_mb ) ) {
2965
-		$use_mb = function_exists( 'mb_convert_encoding' );
2964
+	if (is_null($use_mb)) {
2965
+		$use_mb = function_exists('mb_convert_encoding');
2966 2966
 	}
2967 2967
 
2968
-	if ( $use_mb ) {
2969
-		$encoding = mb_detect_encoding( $string, mb_detect_order(), true );
2970
-		if ( $encoding ) {
2971
-			return mb_convert_encoding( $string, 'UTF-8', $encoding );
2968
+	if ($use_mb) {
2969
+		$encoding = mb_detect_encoding($string, mb_detect_order(), true);
2970
+		if ($encoding) {
2971
+			return mb_convert_encoding($string, 'UTF-8', $encoding);
2972 2972
 		} else {
2973
-			return mb_convert_encoding( $string, 'UTF-8', 'UTF-8' );
2973
+			return mb_convert_encoding($string, 'UTF-8', 'UTF-8');
2974 2974
 		}
2975 2975
 	} else {
2976
-		return wp_check_invalid_utf8( $string, true );
2976
+		return wp_check_invalid_utf8($string, true);
2977 2977
 	}
2978 2978
 }
2979 2979
 
@@ -2989,12 +2989,12 @@  discard block
 block discarded – undo
2989 2989
  * @param mixed $data Native representation.
2990 2990
  * @return bool|int|float|null|string|array Data ready for `json_encode()`.
2991 2991
  */
2992
-function _wp_json_prepare_data( $data ) {
2993
-	if ( ! defined( 'WP_JSON_SERIALIZE_COMPATIBLE' ) || WP_JSON_SERIALIZE_COMPATIBLE === false ) {
2992
+function _wp_json_prepare_data($data) {
2993
+	if ( ! defined('WP_JSON_SERIALIZE_COMPATIBLE') || WP_JSON_SERIALIZE_COMPATIBLE === false) {
2994 2994
 		return $data;
2995 2995
 	}
2996 2996
 
2997
-	switch ( gettype( $data ) ) {
2997
+	switch (gettype($data)) {
2998 2998
 		case 'boolean':
2999 2999
 		case 'integer':
3000 3000
 		case 'double':
@@ -3005,22 +3005,22 @@  discard block
 block discarded – undo
3005 3005
 
3006 3006
 		case 'array':
3007 3007
 			// Arrays must be mapped in case they also return objects.
3008
-			return array_map( '_wp_json_prepare_data', $data );
3008
+			return array_map('_wp_json_prepare_data', $data);
3009 3009
 
3010 3010
 		case 'object':
3011 3011
 			// If this is an incomplete object (__PHP_Incomplete_Class), bail.
3012
-			if ( ! is_object( $data ) ) {
3012
+			if ( ! is_object($data)) {
3013 3013
 				return null;
3014 3014
 			}
3015 3015
 
3016
-			if ( $data instanceof JsonSerializable ) {
3016
+			if ($data instanceof JsonSerializable) {
3017 3017
 				$data = $data->jsonSerialize();
3018 3018
 			} else {
3019
-				$data = get_object_vars( $data );
3019
+				$data = get_object_vars($data);
3020 3020
 			}
3021 3021
 
3022 3022
 			// Now, pass the array (or whatever was returned from jsonSerialize through).
3023
-			return _wp_json_prepare_data( $data );
3023
+			return _wp_json_prepare_data($data);
3024 3024
 
3025 3025
 		default:
3026 3026
 			return null;
@@ -3035,10 +3035,10 @@  discard block
 block discarded – undo
3035 3035
  * @param mixed $response Variable (usually an array or object) to encode as JSON,
3036 3036
  *                        then print and die.
3037 3037
  */
3038
-function wp_send_json( $response ) {
3039
-	@header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
3040
-	echo wp_json_encode( $response );
3041
-	if ( defined( 'DOING_AJAX' ) && DOING_AJAX )
3038
+function wp_send_json($response) {
3039
+	@header('Content-Type: application/json; charset='.get_option('blog_charset'));
3040
+	echo wp_json_encode($response);
3041
+	if (defined('DOING_AJAX') && DOING_AJAX)
3042 3042
 		wp_die();
3043 3043
 	else
3044 3044
 		die;
@@ -3051,13 +3051,13 @@  discard block
 block discarded – undo
3051 3051
  *
3052 3052
  * @param mixed $data Data to encode as JSON, then print and die.
3053 3053
  */
3054
-function wp_send_json_success( $data = null ) {
3055
-	$response = array( 'success' => true );
3054
+function wp_send_json_success($data = null) {
3055
+	$response = array('success' => true);
3056 3056
 
3057
-	if ( isset( $data ) )
3057
+	if (isset($data))
3058 3058
 		$response['data'] = $data;
3059 3059
 
3060
-	wp_send_json( $response );
3060
+	wp_send_json($response);
3061 3061
 }
3062 3062
 
3063 3063
 /**
@@ -3074,15 +3074,15 @@  discard block
 block discarded – undo
3074 3074
  *
3075 3075
  * @param mixed $data Data to encode as JSON, then print and die.
3076 3076
  */
3077
-function wp_send_json_error( $data = null ) {
3078
-	$response = array( 'success' => false );
3077
+function wp_send_json_error($data = null) {
3078
+	$response = array('success' => false);
3079 3079
 
3080
-	if ( isset( $data ) ) {
3081
-		if ( is_wp_error( $data ) ) {
3080
+	if (isset($data)) {
3081
+		if (is_wp_error($data)) {
3082 3082
 			$result = array();
3083
-			foreach ( $data->errors as $code => $messages ) {
3084
-				foreach ( $messages as $message ) {
3085
-					$result[] = array( 'code' => $code, 'message' => $message );
3083
+			foreach ($data->errors as $code => $messages) {
3084
+				foreach ($messages as $message) {
3085
+					$result[] = array('code' => $code, 'message' => $message);
3086 3086
 				}
3087 3087
 			}
3088 3088
 
@@ -3092,7 +3092,7 @@  discard block
 block discarded – undo
3092 3092
 		}
3093 3093
 	}
3094 3094
 
3095
-	wp_send_json( $response );
3095
+	wp_send_json($response);
3096 3096
 }
3097 3097
 
3098 3098
 /**
@@ -3110,9 +3110,9 @@  discard block
 block discarded – undo
3110 3110
  * @param string $url URL for the home location.
3111 3111
  * @return string Homepage location.
3112 3112
  */
3113
-function _config_wp_home( $url = '' ) {
3114
-	if ( defined( 'WP_HOME' ) )
3115
-		return untrailingslashit( WP_HOME );
3113
+function _config_wp_home($url = '') {
3114
+	if (defined('WP_HOME'))
3115
+		return untrailingslashit(WP_HOME);
3116 3116
 	return $url;
3117 3117
 }
3118 3118
 
@@ -3131,9 +3131,9 @@  discard block
 block discarded – undo
3131 3131
  * @param string $url URL to set the WordPress site location.
3132 3132
  * @return string The WordPress Site URL.
3133 3133
  */
3134
-function _config_wp_siteurl( $url = '' ) {
3135
-	if ( defined( 'WP_SITEURL' ) )
3136
-		return untrailingslashit( WP_SITEURL );
3134
+function _config_wp_siteurl($url = '') {
3135
+	if (defined('WP_SITEURL'))
3136
+		return untrailingslashit(WP_SITEURL);
3137 3137
 	return $url;
3138 3138
 }
3139 3139
 
@@ -3154,15 +3154,15 @@  discard block
 block discarded – undo
3154 3154
  * @param array $input MCE settings array.
3155 3155
  * @return array Direction set for 'rtl', if needed by locale.
3156 3156
  */
3157
-function _mce_set_direction( $input ) {
3158
-	if ( is_rtl() ) {
3157
+function _mce_set_direction($input) {
3158
+	if (is_rtl()) {
3159 3159
 		$input['directionality'] = 'rtl';
3160 3160
 
3161
-		if ( ! empty( $input['plugins'] ) && strpos( $input['plugins'], 'directionality' ) === false ) {
3161
+		if ( ! empty($input['plugins']) && strpos($input['plugins'], 'directionality') === false) {
3162 3162
 			$input['plugins'] .= ',directionality';
3163 3163
 		}
3164 3164
 
3165
-		if ( ! empty( $input['toolbar1'] ) && ! preg_match( '/\bltr\b/', $input['toolbar1'] ) ) {
3165
+		if ( ! empty($input['toolbar1']) && ! preg_match('/\bltr\b/', $input['toolbar1'])) {
3166 3166
 			$input['toolbar1'] .= ',ltr';
3167 3167
 		}
3168 3168
 	}
@@ -3197,10 +3197,10 @@  discard block
 block discarded – undo
3197 3197
 	global $wpsmiliestrans, $wp_smiliessearch;
3198 3198
 
3199 3199
 	// don't bother setting up smilies if they are disabled
3200
-	if ( !get_option( 'use_smilies' ) )
3200
+	if ( ! get_option('use_smilies'))
3201 3201
 		return;
3202 3202
 
3203
-	if ( !isset( $wpsmiliestrans ) ) {
3203
+	if ( ! isset($wpsmiliestrans)) {
3204 3204
 		$wpsmiliestrans = array(
3205 3205
 		':mrgreen:' => 'mrgreen.png',
3206 3206
 		':neutral:' => "\xf0\x9f\x98\x90",
@@ -3264,28 +3264,28 @@  discard block
 block discarded – undo
3264 3264
 	$spaces = wp_spaces_regexp();
3265 3265
 
3266 3266
 	// Begin first "subpattern"
3267
-	$wp_smiliessearch = '/(?<=' . $spaces . '|^)';
3267
+	$wp_smiliessearch = '/(?<='.$spaces.'|^)';
3268 3268
 
3269 3269
 	$subchar = '';
3270
-	foreach ( (array) $wpsmiliestrans as $smiley => $img ) {
3270
+	foreach ((array) $wpsmiliestrans as $smiley => $img) {
3271 3271
 		$firstchar = substr($smiley, 0, 1);
3272 3272
 		$rest = substr($smiley, 1);
3273 3273
 
3274 3274
 		// new subpattern?
3275 3275
 		if ($firstchar != $subchar) {
3276 3276
 			if ($subchar != '') {
3277
-				$wp_smiliessearch .= ')(?=' . $spaces . '|$)';  // End previous "subpattern"
3278
-				$wp_smiliessearch .= '|(?<=' . $spaces . '|^)'; // Begin another "subpattern"
3277
+				$wp_smiliessearch .= ')(?='.$spaces.'|$)'; // End previous "subpattern"
3278
+				$wp_smiliessearch .= '|(?<='.$spaces.'|^)'; // Begin another "subpattern"
3279 3279
 			}
3280 3280
 			$subchar = $firstchar;
3281
-			$wp_smiliessearch .= preg_quote($firstchar, '/') . '(?:';
3281
+			$wp_smiliessearch .= preg_quote($firstchar, '/').'(?:';
3282 3282
 		} else {
3283 3283
 			$wp_smiliessearch .= '|';
3284 3284
 		}
3285 3285
 		$wp_smiliessearch .= preg_quote($rest, '/');
3286 3286
 	}
3287 3287
 
3288
-	$wp_smiliessearch .= ')(?=' . $spaces . '|$)/m';
3288
+	$wp_smiliessearch .= ')(?='.$spaces.'|$)/m';
3289 3289
 
3290 3290
 }
3291 3291
 
@@ -3301,16 +3301,16 @@  discard block
 block discarded – undo
3301 3301
  * @param array        $defaults Optional. Array that serves as the defaults. Default empty.
3302 3302
  * @return array Merged user defined values with defaults.
3303 3303
  */
3304
-function wp_parse_args( $args, $defaults = '' ) {
3305
-	if ( is_object( $args ) )
3306
-		$r = get_object_vars( $args );
3307
-	elseif ( is_array( $args ) )
3308
-		$r =& $args;
3304
+function wp_parse_args($args, $defaults = '') {
3305
+	if (is_object($args))
3306
+		$r = get_object_vars($args);
3307
+	elseif (is_array($args))
3308
+		$r = & $args;
3309 3309
 	else
3310
-		wp_parse_str( $args, $r );
3310
+		wp_parse_str($args, $r);
3311 3311
 
3312
-	if ( is_array( $defaults ) )
3313
-		return array_merge( $defaults, $r );
3312
+	if (is_array($defaults))
3313
+		return array_merge($defaults, $r);
3314 3314
 	return $r;
3315 3315
 }
3316 3316
 
@@ -3322,8 +3322,8 @@  discard block
 block discarded – undo
3322 3322
  * @param array|string $list List of ids.
3323 3323
  * @return array Sanitized array of IDs.
3324 3324
  */
3325
-function wp_parse_id_list( $list ) {
3326
-	if ( !is_array($list) )
3325
+function wp_parse_id_list($list) {
3326
+	if ( ! is_array($list))
3327 3327
 		$list = preg_split('/[\s,]+/', $list);
3328 3328
 
3329 3329
 	return array_unique(array_map('absint', $list));
@@ -3338,11 +3338,11 @@  discard block
 block discarded – undo
3338 3338
  * @param array $keys  The list of keys.
3339 3339
  * @return array The array slice.
3340 3340
  */
3341
-function wp_array_slice_assoc( $array, $keys ) {
3341
+function wp_array_slice_assoc($array, $keys) {
3342 3342
 	$slice = array();
3343
-	foreach ( $keys as $key )
3344
-		if ( isset( $array[ $key ] ) )
3345
-			$slice[ $key ] = $array[ $key ];
3343
+	foreach ($keys as $key)
3344
+		if (isset($array[$key]))
3345
+			$slice[$key] = $array[$key];
3346 3346
 
3347 3347
 	return $slice;
3348 3348
 }
@@ -3355,14 +3355,14 @@  discard block
 block discarded – undo
3355 3355
  * @param mixed $data Variable to check.
3356 3356
  * @return bool Whether the variable is a list.
3357 3357
  */
3358
-function wp_is_numeric_array( $data ) {
3359
-	if ( ! is_array( $data ) ) {
3358
+function wp_is_numeric_array($data) {
3359
+	if ( ! is_array($data)) {
3360 3360
 		return false;
3361 3361
 	}
3362 3362
 
3363
-	$keys = array_keys( $data );
3364
-	$string_keys = array_filter( $keys, 'is_string' );
3365
-	return count( $string_keys ) === 0;
3363
+	$keys = array_keys($data);
3364
+	$string_keys = array_filter($keys, 'is_string');
3365
+	return count($string_keys) === 0;
3366 3366
 }
3367 3367
 
3368 3368
 /**
@@ -3381,14 +3381,14 @@  discard block
 block discarded – undo
3381 3381
  *                              Default false.
3382 3382
  * @return array A list of objects or object fields.
3383 3383
  */
3384
-function wp_filter_object_list( $list, $args = array(), $operator = 'and', $field = false ) {
3385
-	if ( ! is_array( $list ) )
3384
+function wp_filter_object_list($list, $args = array(), $operator = 'and', $field = false) {
3385
+	if ( ! is_array($list))
3386 3386
 		return array();
3387 3387
 
3388
-	$list = wp_list_filter( $list, $args, $operator );
3388
+	$list = wp_list_filter($list, $args, $operator);
3389 3389
 
3390
-	if ( $field )
3391
-		$list = wp_list_pluck( $list, $field );
3390
+	if ($field)
3391
+		$list = wp_list_pluck($list, $field);
3392 3392
 
3393 3393
 	return $list;
3394 3394
 }
@@ -3407,29 +3407,29 @@  discard block
 block discarded – undo
3407 3407
  *                         match. Default 'AND'.
3408 3408
  * @return array Array of found values.
3409 3409
  */
3410
-function wp_list_filter( $list, $args = array(), $operator = 'AND' ) {
3411
-	if ( ! is_array( $list ) )
3410
+function wp_list_filter($list, $args = array(), $operator = 'AND') {
3411
+	if ( ! is_array($list))
3412 3412
 		return array();
3413 3413
 
3414
-	if ( empty( $args ) )
3414
+	if (empty($args))
3415 3415
 		return $list;
3416 3416
 
3417
-	$operator = strtoupper( $operator );
3418
-	$count = count( $args );
3417
+	$operator = strtoupper($operator);
3418
+	$count = count($args);
3419 3419
 	$filtered = array();
3420 3420
 
3421
-	foreach ( $list as $key => $obj ) {
3421
+	foreach ($list as $key => $obj) {
3422 3422
 		$to_match = (array) $obj;
3423 3423
 
3424 3424
 		$matched = 0;
3425
-		foreach ( $args as $m_key => $m_value ) {
3426
-			if ( array_key_exists( $m_key, $to_match ) && $m_value == $to_match[ $m_key ] )
3425
+		foreach ($args as $m_key => $m_value) {
3426
+			if (array_key_exists($m_key, $to_match) && $m_value == $to_match[$m_key])
3427 3427
 				$matched++;
3428 3428
 		}
3429 3429
 
3430
-		if ( ( 'AND' == $operator && $matched == $count )
3431
-		  || ( 'OR' == $operator && $matched > 0 )
3432
-		  || ( 'NOT' == $operator && 0 == $matched ) ) {
3430
+		if (('AND' == $operator && $matched == $count)
3431
+		  || ('OR' == $operator && $matched > 0)
3432
+		  || ('NOT' == $operator && 0 == $matched)) {
3433 3433
 			$filtered[$key] = $obj;
3434 3434
 		}
3435 3435
 	}
@@ -3454,17 +3454,17 @@  discard block
 block discarded – undo
3454 3454
  *               corresponding to `$index_key`. If `$index_key` is null, array keys from the original
3455 3455
  *               `$list` will be preserved in the results.
3456 3456
  */
3457
-function wp_list_pluck( $list, $field, $index_key = null ) {
3458
-	if ( ! $index_key ) {
3457
+function wp_list_pluck($list, $field, $index_key = null) {
3458
+	if ( ! $index_key) {
3459 3459
 		/*
3460 3460
 		 * This is simple. Could at some point wrap array_column()
3461 3461
 		 * if we knew we had an array of arrays.
3462 3462
 		 */
3463
-		foreach ( $list as $key => $value ) {
3464
-			if ( is_object( $value ) ) {
3465
-				$list[ $key ] = $value->$field;
3463
+		foreach ($list as $key => $value) {
3464
+			if (is_object($value)) {
3465
+				$list[$key] = $value->$field;
3466 3466
 			} else {
3467
-				$list[ $key ] = $value[ $field ];
3467
+				$list[$key] = $value[$field];
3468 3468
 			}
3469 3469
 		}
3470 3470
 		return $list;
@@ -3475,18 +3475,18 @@  discard block
 block discarded – undo
3475 3475
 	 * to the end of the stack. This is how array_column() behaves.
3476 3476
 	 */
3477 3477
 	$newlist = array();
3478
-	foreach ( $list as $value ) {
3479
-		if ( is_object( $value ) ) {
3480
-			if ( isset( $value->$index_key ) ) {
3481
-				$newlist[ $value->$index_key ] = $value->$field;
3478
+	foreach ($list as $value) {
3479
+		if (is_object($value)) {
3480
+			if (isset($value->$index_key)) {
3481
+				$newlist[$value->$index_key] = $value->$field;
3482 3482
 			} else {
3483 3483
 				$newlist[] = $value->$field;
3484 3484
 			}
3485 3485
 		} else {
3486
-			if ( isset( $value[ $index_key ] ) ) {
3487
-				$newlist[ $value[ $index_key ] ] = $value[ $field ];
3486
+			if (isset($value[$index_key])) {
3487
+				$newlist[$value[$index_key]] = $value[$field];
3488 3488
 			} else {
3489
-				$newlist[] = $value[ $field ];
3489
+				$newlist[] = $value[$field];
3490 3490
 			}
3491 3491
 		}
3492 3492
 	}
@@ -3514,13 +3514,13 @@  discard block
 block discarded – undo
3514 3514
 	 * @param bool $wp_maybe_load_widgets Whether to load the Widgets library.
3515 3515
 	 *                                    Default true.
3516 3516
 	 */
3517
-	if ( ! apply_filters( 'load_default_widgets', true ) ) {
3517
+	if ( ! apply_filters('load_default_widgets', true)) {
3518 3518
 		return;
3519 3519
 	}
3520 3520
 
3521
-	require_once( ABSPATH . WPINC . '/default-widgets.php' );
3521
+	require_once(ABSPATH.WPINC.'/default-widgets.php');
3522 3522
 
3523
-	add_action( '_admin_menu', 'wp_widgets_add_menu' );
3523
+	add_action('_admin_menu', 'wp_widgets_add_menu');
3524 3524
 }
3525 3525
 
3526 3526
 /**
@@ -3533,11 +3533,11 @@  discard block
 block discarded – undo
3533 3533
 function wp_widgets_add_menu() {
3534 3534
 	global $submenu;
3535 3535
 
3536
-	if ( ! current_theme_supports( 'widgets' ) )
3536
+	if ( ! current_theme_supports('widgets'))
3537 3537
 		return;
3538 3538
 
3539
-	$submenu['themes.php'][7] = array( __( 'Widgets' ), 'edit_theme_options', 'widgets.php' );
3540
-	ksort( $submenu['themes.php'], SORT_NUMERIC );
3539
+	$submenu['themes.php'][7] = array(__('Widgets'), 'edit_theme_options', 'widgets.php');
3540
+	ksort($submenu['themes.php'], SORT_NUMERIC);
3541 3541
 }
3542 3542
 
3543 3543
 /**
@@ -3549,7 +3549,7 @@  discard block
 block discarded – undo
3549 3549
  */
3550 3550
 function wp_ob_end_flush_all() {
3551 3551
 	$levels = ob_get_level();
3552
-	for ($i=0; $i<$levels; $i++)
3552
+	for ($i = 0; $i < $levels; $i++)
3553 3553
 		ob_end_flush();
3554 3554
 }
3555 3555
 
@@ -3577,29 +3577,29 @@  discard block
 block discarded – undo
3577 3577
 	wp_load_translations_early();
3578 3578
 
3579 3579
 	// Load custom DB error template, if present.
3580
-	if ( file_exists( WP_CONTENT_DIR . '/db-error.php' ) ) {
3581
-		require_once( WP_CONTENT_DIR . '/db-error.php' );
3580
+	if (file_exists(WP_CONTENT_DIR.'/db-error.php')) {
3581
+		require_once(WP_CONTENT_DIR.'/db-error.php');
3582 3582
 		die();
3583 3583
 	}
3584 3584
 
3585 3585
 	// If installing or in the admin, provide the verbose message.
3586
-	if ( wp_installing() || defined( 'WP_ADMIN' ) )
3586
+	if (wp_installing() || defined('WP_ADMIN'))
3587 3587
 		wp_die($wpdb->error);
3588 3588
 
3589 3589
 	// Otherwise, be terse.
3590
-	status_header( 500 );
3590
+	status_header(500);
3591 3591
 	nocache_headers();
3592
-	header( 'Content-Type: text/html; charset=utf-8' );
3592
+	header('Content-Type: text/html; charset=utf-8');
3593 3593
 ?>
3594 3594
 <!DOCTYPE html>
3595
-<html xmlns="http://www.w3.org/1999/xhtml"<?php if ( is_rtl() ) echo ' dir="rtl"'; ?>>
3595
+<html xmlns="http://www.w3.org/1999/xhtml"<?php if (is_rtl()) echo ' dir="rtl"'; ?>>
3596 3596
 <head>
3597 3597
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
3598
-	<title><?php _e( 'Database Error' ); ?></title>
3598
+	<title><?php _e('Database Error'); ?></title>
3599 3599
 
3600 3600
 </head>
3601 3601
 <body>
3602
-	<h1><?php _e( 'Error establishing a database connection' ); ?></h1>
3602
+	<h1><?php _e('Error establishing a database connection'); ?></h1>
3603 3603
 </body>
3604 3604
 </html>
3605 3605
 <?php
@@ -3614,8 +3614,8 @@  discard block
 block discarded – undo
3614 3614
  * @param mixed $maybeint Data you wish to have converted to a non-negative integer.
3615 3615
  * @return int A non-negative integer.
3616 3616
  */
3617
-function absint( $maybeint ) {
3618
-	return abs( intval( $maybeint ) );
3617
+function absint($maybeint) {
3618
+	return abs(intval($maybeint));
3619 3619
 }
3620 3620
 
3621 3621
 /**
@@ -3636,7 +3636,7 @@  discard block
 block discarded – undo
3636 3636
  * @param string $version     The version of WordPress that deprecated the function.
3637 3637
  * @param string $replacement Optional. The function that should have been called. Default null.
3638 3638
  */
3639
-function _deprecated_function( $function, $version, $replacement = null ) {
3639
+function _deprecated_function($function, $version, $replacement = null) {
3640 3640
 
3641 3641
 	/**
3642 3642
 	 * Fires when a deprecated function is called.
@@ -3647,7 +3647,7 @@  discard block
 block discarded – undo
3647 3647
 	 * @param string $replacement The function that should have been called.
3648 3648
 	 * @param string $version     The version of WordPress that deprecated the function.
3649 3649
 	 */
3650
-	do_action( 'deprecated_function_run', $function, $replacement, $version );
3650
+	do_action('deprecated_function_run', $function, $replacement, $version);
3651 3651
 
3652 3652
 	/**
3653 3653
 	 * Filter whether to trigger an error for deprecated functions.
@@ -3656,17 +3656,17 @@  discard block
 block discarded – undo
3656 3656
 	 *
3657 3657
 	 * @param bool $trigger Whether to trigger the error for deprecated functions. Default true.
3658 3658
 	 */
3659
-	if ( WP_DEBUG && apply_filters( 'deprecated_function_trigger_error', true ) ) {
3660
-		if ( function_exists( '__' ) ) {
3661
-			if ( ! is_null( $replacement ) )
3662
-				trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $function, $version, $replacement ) );
3659
+	if (WP_DEBUG && apply_filters('deprecated_function_trigger_error', true)) {
3660
+		if (function_exists('__')) {
3661
+			if ( ! is_null($replacement))
3662
+				trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $function, $version, $replacement));
3663 3663
 			else
3664
-				trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version ) );
3664
+				trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version));
3665 3665
 		} else {
3666
-			if ( ! is_null( $replacement ) )
3667
-				trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $function, $version, $replacement ) );
3666
+			if ( ! is_null($replacement))
3667
+				trigger_error(sprintf('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $function, $version, $replacement));
3668 3668
 			else
3669
-				trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', $function, $version ) );
3669
+				trigger_error(sprintf('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', $function, $version));
3670 3670
 		}
3671 3671
 	}
3672 3672
 }
@@ -3691,7 +3691,7 @@  discard block
 block discarded – undo
3691 3691
  * @param string $parent_class Optional. The parent class calling the deprecated constructor.
3692 3692
  *                             Default empty string.
3693 3693
  */
3694
-function _deprecated_constructor( $class, $version, $parent_class = '' ) {
3694
+function _deprecated_constructor($class, $version, $parent_class = '') {
3695 3695
 
3696 3696
 	/**
3697 3697
 	 * Fires when a deprecated constructor is called.
@@ -3703,7 +3703,7 @@  discard block
 block discarded – undo
3703 3703
 	 * @param string $version      The version of WordPress that deprecated the function.
3704 3704
 	 * @param string $parent_class The parent class calling the deprecated constructor.
3705 3705
 	 */
3706
-	do_action( 'deprecated_constructor_run', $class, $version, $parent_class );
3706
+	do_action('deprecated_constructor_run', $class, $version, $parent_class);
3707 3707
 
3708 3708
 	/**
3709 3709
 	 * Filter whether to trigger an error for deprecated functions.
@@ -3714,24 +3714,24 @@  discard block
 block discarded – undo
3714 3714
 	 *
3715 3715
 	 * @param bool $trigger Whether to trigger the error for deprecated functions. Default true.
3716 3716
 	 */
3717
-	if ( WP_DEBUG && apply_filters( 'deprecated_constructor_trigger_error', true ) ) {
3718
-		if ( function_exists( '__' ) ) {
3719
-			if ( ! empty( $parent_class ) ) {
3717
+	if (WP_DEBUG && apply_filters('deprecated_constructor_trigger_error', true)) {
3718
+		if (function_exists('__')) {
3719
+			if ( ! empty($parent_class)) {
3720 3720
 				/* translators: 1: PHP class name, 2: PHP parent class name, 3: version number, 4: __construct() method */
3721
-				trigger_error( sprintf( __( 'The called constructor method for %1$s in %2$s is <strong>deprecated</strong> since version %3$s! Use %4$s instead.' ),
3722
-					$class, $parent_class, $version, '<pre>__construct()</pre>' ) );
3721
+				trigger_error(sprintf(__('The called constructor method for %1$s in %2$s is <strong>deprecated</strong> since version %3$s! Use %4$s instead.'),
3722
+					$class, $parent_class, $version, '<pre>__construct()</pre>'));
3723 3723
 			} else {
3724 3724
 				/* translators: 1: PHP class name, 2: version number, 3: __construct() method */
3725
-				trigger_error( sprintf( __( 'The called constructor method for %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.' ),
3726
-					$class, $version, '<pre>__construct()</pre>' ) );
3725
+				trigger_error(sprintf(__('The called constructor method for %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'),
3726
+					$class, $version, '<pre>__construct()</pre>'));
3727 3727
 			}
3728 3728
 		} else {
3729
-			if ( ! empty( $parent_class ) ) {
3730
-				trigger_error( sprintf( 'The called constructor method for %1$s in %2$s is <strong>deprecated</strong> since version %3$s! Use %4$s instead.',
3731
-					$class, $parent_class, $version, '<pre>__construct()</pre>' ) );
3729
+			if ( ! empty($parent_class)) {
3730
+				trigger_error(sprintf('The called constructor method for %1$s in %2$s is <strong>deprecated</strong> since version %3$s! Use %4$s instead.',
3731
+					$class, $parent_class, $version, '<pre>__construct()</pre>'));
3732 3732
 			} else {
3733
-				trigger_error( sprintf( 'The called constructor method for %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.',
3734
-					$class, $version, '<pre>__construct()</pre>' ) );
3733
+				trigger_error(sprintf('The called constructor method for %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.',
3734
+					$class, $version, '<pre>__construct()</pre>'));
3735 3735
 			}
3736 3736
 		}
3737 3737
 	}
@@ -3758,7 +3758,7 @@  discard block
 block discarded – undo
3758 3758
  *                            Default null.
3759 3759
  * @param string $message     Optional. A message regarding the change. Default empty.
3760 3760
  */
3761
-function _deprecated_file( $file, $version, $replacement = null, $message = '' ) {
3761
+function _deprecated_file($file, $version, $replacement = null, $message = '') {
3762 3762
 
3763 3763
 	/**
3764 3764
 	 * Fires when a deprecated file is called.
@@ -3770,7 +3770,7 @@  discard block
 block discarded – undo
3770 3770
 	 * @param string $version     The version of WordPress that deprecated the file.
3771 3771
 	 * @param string $message     A message regarding the change.
3772 3772
 	 */
3773
-	do_action( 'deprecated_file_included', $file, $replacement, $version, $message );
3773
+	do_action('deprecated_file_included', $file, $replacement, $version, $message);
3774 3774
 
3775 3775
 	/**
3776 3776
 	 * Filter whether to trigger an error for deprecated files.
@@ -3779,18 +3779,18 @@  discard block
 block discarded – undo
3779 3779
 	 *
3780 3780
 	 * @param bool $trigger Whether to trigger the error for deprecated files. Default true.
3781 3781
 	 */
3782
-	if ( WP_DEBUG && apply_filters( 'deprecated_file_trigger_error', true ) ) {
3783
-		$message = empty( $message ) ? '' : ' ' . $message;
3784
-		if ( function_exists( '__' ) ) {
3785
-			if ( ! is_null( $replacement ) )
3786
-				trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $file, $version, $replacement ) . $message );
3782
+	if (WP_DEBUG && apply_filters('deprecated_file_trigger_error', true)) {
3783
+		$message = empty($message) ? '' : ' '.$message;
3784
+		if (function_exists('__')) {
3785
+			if ( ! is_null($replacement))
3786
+				trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $file, $version, $replacement).$message);
3787 3787
 			else
3788
-				trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $file, $version ) . $message );
3788
+				trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $file, $version).$message);
3789 3789
 		} else {
3790
-			if ( ! is_null( $replacement ) )
3791
-				trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $file, $version, $replacement ) . $message );
3790
+			if ( ! is_null($replacement))
3791
+				trigger_error(sprintf('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $file, $version, $replacement).$message);
3792 3792
 			else
3793
-				trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', $file, $version ) . $message );
3793
+				trigger_error(sprintf('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', $file, $version).$message);
3794 3794
 		}
3795 3795
 	}
3796 3796
 }
@@ -3820,7 +3820,7 @@  discard block
 block discarded – undo
3820 3820
  * @param string $version  The version of WordPress that deprecated the argument used.
3821 3821
  * @param string $message  Optional. A message regarding the change. Default null.
3822 3822
  */
3823
-function _deprecated_argument( $function, $version, $message = null ) {
3823
+function _deprecated_argument($function, $version, $message = null) {
3824 3824
 
3825 3825
 	/**
3826 3826
 	 * Fires when a deprecated argument is called.
@@ -3831,7 +3831,7 @@  discard block
 block discarded – undo
3831 3831
 	 * @param string $message  A message regarding the change.
3832 3832
 	 * @param string $version  The version of WordPress that deprecated the argument used.
3833 3833
 	 */
3834
-	do_action( 'deprecated_argument_run', $function, $message, $version );
3834
+	do_action('deprecated_argument_run', $function, $message, $version);
3835 3835
 
3836 3836
 	/**
3837 3837
 	 * Filter whether to trigger an error for deprecated arguments.
@@ -3840,17 +3840,17 @@  discard block
 block discarded – undo
3840 3840
 	 *
3841 3841
 	 * @param bool $trigger Whether to trigger the error for deprecated arguments. Default true.
3842 3842
 	 */
3843
-	if ( WP_DEBUG && apply_filters( 'deprecated_argument_trigger_error', true ) ) {
3844
-		if ( function_exists( '__' ) ) {
3845
-			if ( ! is_null( $message ) )
3846
-				trigger_error( sprintf( __('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s'), $function, $version, $message ) );
3843
+	if (WP_DEBUG && apply_filters('deprecated_argument_trigger_error', true)) {
3844
+		if (function_exists('__')) {
3845
+			if ( ! is_null($message))
3846
+				trigger_error(sprintf(__('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s'), $function, $version, $message));
3847 3847
 			else
3848
-				trigger_error( sprintf( __('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version ) );
3848
+				trigger_error(sprintf(__('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version));
3849 3849
 		} else {
3850
-			if ( ! is_null( $message ) )
3851
-				trigger_error( sprintf( '%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s', $function, $version, $message ) );
3850
+			if ( ! is_null($message))
3851
+				trigger_error(sprintf('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s', $function, $version, $message));
3852 3852
 			else
3853
-				trigger_error( sprintf( '%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.', $function, $version ) );
3853
+				trigger_error(sprintf('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.', $function, $version));
3854 3854
 		}
3855 3855
 	}
3856 3856
 }
@@ -3871,7 +3871,7 @@  discard block
 block discarded – undo
3871 3871
  * @param string $message  A message explaining what has been done incorrectly.
3872 3872
  * @param string $version  The version of WordPress where the message was added.
3873 3873
  */
3874
-function _doing_it_wrong( $function, $message, $version ) {
3874
+function _doing_it_wrong($function, $message, $version) {
3875 3875
 
3876 3876
 	/**
3877 3877
 	 * Fires when the given function is being used incorrectly.
@@ -3882,7 +3882,7 @@  discard block
 block discarded – undo
3882 3882
 	 * @param string $message  A message explaining what has been done incorrectly.
3883 3883
 	 * @param string $version  The version of WordPress where the message was added.
3884 3884
 	 */
3885
-	do_action( 'doing_it_wrong_run', $function, $message, $version );
3885
+	do_action('doing_it_wrong_run', $function, $message, $version);
3886 3886
 
3887 3887
 	/**
3888 3888
 	 * Filter whether to trigger an error for _doing_it_wrong() calls.
@@ -3891,20 +3891,20 @@  discard block
 block discarded – undo
3891 3891
 	 *
3892 3892
 	 * @param bool $trigger Whether to trigger the error for _doing_it_wrong() calls. Default true.
3893 3893
 	 */
3894
-	if ( WP_DEBUG && apply_filters( 'doing_it_wrong_trigger_error', true ) ) {
3895
-		if ( function_exists( '__' ) ) {
3896
-			$version = is_null( $version ) ? '' : sprintf( __( '(This message was added in version %s.)' ), $version );
3894
+	if (WP_DEBUG && apply_filters('doing_it_wrong_trigger_error', true)) {
3895
+		if (function_exists('__')) {
3896
+			$version = is_null($version) ? '' : sprintf(__('(This message was added in version %s.)'), $version);
3897 3897
 			/* translators: %s: Codex URL */
3898
-			$message .= ' ' . sprintf( __( 'Please see <a href="%s">Debugging in WordPress</a> for more information.' ),
3899
-				__( 'https://codex.wordpress.org/Debugging_in_WordPress' )
3898
+			$message .= ' '.sprintf(__('Please see <a href="%s">Debugging in WordPress</a> for more information.'),
3899
+				__('https://codex.wordpress.org/Debugging_in_WordPress')
3900 3900
 			);
3901
-			trigger_error( sprintf( __( '%1$s was called <strong>incorrectly</strong>. %2$s %3$s' ), $function, $message, $version ) );
3901
+			trigger_error(sprintf(__('%1$s was called <strong>incorrectly</strong>. %2$s %3$s'), $function, $message, $version));
3902 3902
 		} else {
3903
-			$version = is_null( $version ) ? '' : sprintf( '(This message was added in version %s.)', $version );
3904
-			$message .= sprintf( ' Please see <a href="%s">Debugging in WordPress</a> for more information.',
3903
+			$version = is_null($version) ? '' : sprintf('(This message was added in version %s.)', $version);
3904
+			$message .= sprintf(' Please see <a href="%s">Debugging in WordPress</a> for more information.',
3905 3905
 				'https://codex.wordpress.org/Debugging_in_WordPress'
3906 3906
 			);
3907
-			trigger_error( sprintf( '%1$s was called <strong>incorrectly</strong>. %2$s %3$s', $function, $message, $version ) );
3907
+			trigger_error(sprintf('%1$s was called <strong>incorrectly</strong>. %2$s %3$s', $function, $message, $version));
3908 3908
 		}
3909 3909
 	}
3910 3910
 }
@@ -3917,9 +3917,9 @@  discard block
 block discarded – undo
3917 3917
  * @return bool Whether the server is running lighttpd < 1.5.0.
3918 3918
  */
3919 3919
 function is_lighttpd_before_150() {
3920
-	$server_parts = explode( '/', isset( $_SERVER['SERVER_SOFTWARE'] )? $_SERVER['SERVER_SOFTWARE'] : '' );
3921
-	$server_parts[1] = isset( $server_parts[1] )? $server_parts[1] : '';
3922
-	return  'lighttpd' == $server_parts[0] && -1 == version_compare( $server_parts[1], '1.5.0' );
3920
+	$server_parts = explode('/', isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : '');
3921
+	$server_parts[1] = isset($server_parts[1]) ? $server_parts[1] : '';
3922
+	return  'lighttpd' == $server_parts[0] && -1 == version_compare($server_parts[1], '1.5.0');
3923 3923
 }
3924 3924
 
3925 3925
 /**
@@ -3936,18 +3936,18 @@  discard block
 block discarded – undo
3936 3936
 function apache_mod_loaded($mod, $default = false) {
3937 3937
 	global $is_apache;
3938 3938
 
3939
-	if ( !$is_apache )
3939
+	if ( ! $is_apache)
3940 3940
 		return false;
3941 3941
 
3942
-	if ( function_exists( 'apache_get_modules' ) ) {
3942
+	if (function_exists('apache_get_modules')) {
3943 3943
 		$mods = apache_get_modules();
3944
-		if ( in_array($mod, $mods) )
3944
+		if (in_array($mod, $mods))
3945 3945
 			return true;
3946
-	} elseif ( function_exists( 'phpinfo' ) && false === strpos( ini_get( 'disable_functions' ), 'phpinfo' ) ) {
3946
+	} elseif (function_exists('phpinfo') && false === strpos(ini_get('disable_functions'), 'phpinfo')) {
3947 3947
 			ob_start();
3948 3948
 			phpinfo(8);
3949 3949
 			$phpinfo = ob_get_clean();
3950
-			if ( false !== strpos($phpinfo, $mod) )
3950
+			if (false !== strpos($phpinfo, $mod))
3951 3951
 				return true;
3952 3952
 	}
3953 3953
 	return $default;
@@ -3966,7 +3966,7 @@  discard block
 block discarded – undo
3966 3966
 	global $is_iis7;
3967 3967
 
3968 3968
 	$supports_permalinks = false;
3969
-	if ( $is_iis7 ) {
3969
+	if ($is_iis7) {
3970 3970
 		/* First we check if the DOMDocument class exists. If it does not exist, then we cannot
3971 3971
 		 * easily update the xml configuration file, hence we just bail out and tell user that
3972 3972
 		 * pretty permalinks cannot be used.
@@ -3976,7 +3976,7 @@  discard block
 block discarded – undo
3976 3976
 		 * Lastly we make sure that PHP is running via FastCGI. This is important because if it runs
3977 3977
 		 * via ISAPI then pretty permalinks will not work.
3978 3978
 		 */
3979
-		$supports_permalinks = class_exists( 'DOMDocument', false ) && isset($_SERVER['IIS_UrlRewriteModule']) && ( PHP_SAPI == 'cgi-fcgi' );
3979
+		$supports_permalinks = class_exists('DOMDocument', false) && isset($_SERVER['IIS_UrlRewriteModule']) && (PHP_SAPI == 'cgi-fcgi');
3980 3980
 	}
3981 3981
 
3982 3982
 	/**
@@ -3986,7 +3986,7 @@  discard block
 block discarded – undo
3986 3986
 	 *
3987 3987
 	 * @param bool $supports_permalinks Whether IIS7 supports permalinks. Default false.
3988 3988
 	 */
3989
-	return apply_filters( 'iis7_supports_permalinks', $supports_permalinks );
3989
+	return apply_filters('iis7_supports_permalinks', $supports_permalinks);
3990 3990
 }
3991 3991
 
3992 3992
 /**
@@ -4003,17 +4003,17 @@  discard block
 block discarded – undo
4003 4003
  * @param array  $allowed_files List of allowed files.
4004 4004
  * @return int 0 means nothing is wrong, greater than 0 means something was wrong.
4005 4005
  */
4006
-function validate_file( $file, $allowed_files = '' ) {
4007
-	if ( false !== strpos( $file, '..' ) )
4006
+function validate_file($file, $allowed_files = '') {
4007
+	if (false !== strpos($file, '..'))
4008 4008
 		return 1;
4009 4009
 
4010
-	if ( false !== strpos( $file, './' ) )
4010
+	if (false !== strpos($file, './'))
4011 4011
 		return 1;
4012 4012
 
4013
-	if ( ! empty( $allowed_files ) && ! in_array( $file, $allowed_files ) )
4013
+	if ( ! empty($allowed_files) && ! in_array($file, $allowed_files))
4014 4014
 		return 3;
4015 4015
 
4016
-	if (':' == substr( $file, 1, 1 ) )
4016
+	if (':' == substr($file, 1, 1))
4017 4017
 		return 2;
4018 4018
 
4019 4019
 	return 0;
@@ -4027,12 +4027,12 @@  discard block
 block discarded – undo
4027 4027
  * @return bool True if SSL, false if not used.
4028 4028
  */
4029 4029
 function is_ssl() {
4030
-	if ( isset($_SERVER['HTTPS']) ) {
4031
-		if ( 'on' == strtolower($_SERVER['HTTPS']) )
4030
+	if (isset($_SERVER['HTTPS'])) {
4031
+		if ('on' == strtolower($_SERVER['HTTPS']))
4032 4032
 			return true;
4033
-		if ( '1' == $_SERVER['HTTPS'] )
4033
+		if ('1' == $_SERVER['HTTPS'])
4034 4034
 			return true;
4035
-	} elseif ( isset($_SERVER['SERVER_PORT']) && ( '443' == $_SERVER['SERVER_PORT'] ) ) {
4035
+	} elseif (isset($_SERVER['SERVER_PORT']) && ('443' == $_SERVER['SERVER_PORT'])) {
4036 4036
 		return true;
4037 4037
 	}
4038 4038
 	return false;
@@ -4048,10 +4048,10 @@  discard block
 block discarded – undo
4048 4048
  * @param string|bool $force Optional. Whether to force SSL in admin screens. Default null.
4049 4049
  * @return bool True if forced, false if not forced.
4050 4050
  */
4051
-function force_ssl_admin( $force = null ) {
4051
+function force_ssl_admin($force = null) {
4052 4052
 	static $forced = false;
4053 4053
 
4054
-	if ( !is_null( $force ) ) {
4054
+	if ( ! is_null($force)) {
4055 4055
 		$old_forced = $forced;
4056 4056
 		$forced = $force;
4057 4057
 		return $old_forced;
@@ -4071,39 +4071,39 @@  discard block
 block discarded – undo
4071 4071
  * @return string The guessed URL.
4072 4072
  */
4073 4073
 function wp_guess_url() {
4074
-	if ( defined('WP_SITEURL') && '' != WP_SITEURL ) {
4074
+	if (defined('WP_SITEURL') && '' != WP_SITEURL) {
4075 4075
 		$url = WP_SITEURL;
4076 4076
 	} else {
4077
-		$abspath_fix = str_replace( '\\', '/', ABSPATH );
4078
-		$script_filename_dir = dirname( $_SERVER['SCRIPT_FILENAME'] );
4077
+		$abspath_fix = str_replace('\\', '/', ABSPATH);
4078
+		$script_filename_dir = dirname($_SERVER['SCRIPT_FILENAME']);
4079 4079
 
4080 4080
 		// The request is for the admin
4081
-		if ( strpos( $_SERVER['REQUEST_URI'], 'wp-admin' ) !== false || strpos( $_SERVER['REQUEST_URI'], 'wp-login.php' ) !== false ) {
4082
-			$path = preg_replace( '#/(wp-admin/.*|wp-login.php)#i', '', $_SERVER['REQUEST_URI'] );
4081
+		if (strpos($_SERVER['REQUEST_URI'], 'wp-admin') !== false || strpos($_SERVER['REQUEST_URI'], 'wp-login.php') !== false) {
4082
+			$path = preg_replace('#/(wp-admin/.*|wp-login.php)#i', '', $_SERVER['REQUEST_URI']);
4083 4083
 
4084 4084
 		// The request is for a file in ABSPATH
4085
-		} elseif ( $script_filename_dir . '/' == $abspath_fix ) {
4085
+		} elseif ($script_filename_dir.'/' == $abspath_fix) {
4086 4086
 			// Strip off any file/query params in the path
4087
-			$path = preg_replace( '#/[^/]*$#i', '', $_SERVER['PHP_SELF'] );
4087
+			$path = preg_replace('#/[^/]*$#i', '', $_SERVER['PHP_SELF']);
4088 4088
 
4089 4089
 		} else {
4090
-			if ( false !== strpos( $_SERVER['SCRIPT_FILENAME'], $abspath_fix ) ) {
4090
+			if (false !== strpos($_SERVER['SCRIPT_FILENAME'], $abspath_fix)) {
4091 4091
 				// Request is hitting a file inside ABSPATH
4092
-				$directory = str_replace( ABSPATH, '', $script_filename_dir );
4092
+				$directory = str_replace(ABSPATH, '', $script_filename_dir);
4093 4093
 				// Strip off the sub directory, and any file/query params
4094
-				$path = preg_replace( '#/' . preg_quote( $directory, '#' ) . '/[^/]*$#i', '' , $_SERVER['REQUEST_URI'] );
4095
-			} elseif ( false !== strpos( $abspath_fix, $script_filename_dir ) ) {
4094
+				$path = preg_replace('#/'.preg_quote($directory, '#').'/[^/]*$#i', '', $_SERVER['REQUEST_URI']);
4095
+			} elseif (false !== strpos($abspath_fix, $script_filename_dir)) {
4096 4096
 				// Request is hitting a file above ABSPATH
4097
-				$subdirectory = substr( $abspath_fix, strpos( $abspath_fix, $script_filename_dir ) + strlen( $script_filename_dir ) );
4097
+				$subdirectory = substr($abspath_fix, strpos($abspath_fix, $script_filename_dir) + strlen($script_filename_dir));
4098 4098
 				// Strip off any file/query params from the path, appending the sub directory to the install
4099
-				$path = preg_replace( '#/[^/]*$#i', '' , $_SERVER['REQUEST_URI'] ) . $subdirectory;
4099
+				$path = preg_replace('#/[^/]*$#i', '', $_SERVER['REQUEST_URI']).$subdirectory;
4100 4100
 			} else {
4101 4101
 				$path = $_SERVER['REQUEST_URI'];
4102 4102
 			}
4103 4103
 		}
4104 4104
 
4105 4105
 		$schema = is_ssl() ? 'https://' : 'http://'; // set_url_scheme() is not defined yet
4106
-		$url = $schema . $_SERVER['HTTP_HOST'] . $path;
4106
+		$url = $schema.$_SERVER['HTTP_HOST'].$path;
4107 4107
 	}
4108 4108
 
4109 4109
 	return rtrim($url, '/');
@@ -4126,10 +4126,10 @@  discard block
 block discarded – undo
4126 4126
  * @param bool $suspend Optional. Suspends additions if true, re-enables them if false.
4127 4127
  * @return bool The current suspend setting
4128 4128
  */
4129
-function wp_suspend_cache_addition( $suspend = null ) {
4129
+function wp_suspend_cache_addition($suspend = null) {
4130 4130
 	static $_suspend = false;
4131 4131
 
4132
-	if ( is_bool( $suspend ) )
4132
+	if (is_bool($suspend))
4133 4133
 		$_suspend = $suspend;
4134 4134
 
4135 4135
 	return $_suspend;
@@ -4149,7 +4149,7 @@  discard block
 block discarded – undo
4149 4149
  * @param bool $suspend Optional. Whether to suspend or enable cache invalidation. Default true.
4150 4150
  * @return bool The current suspend setting.
4151 4151
  */
4152
-function wp_suspend_cache_invalidation( $suspend = true ) {
4152
+function wp_suspend_cache_invalidation($suspend = true) {
4153 4153
 	global $_wp_suspend_cache_invalidation;
4154 4154
 
4155 4155
 	$current_suspend = $_wp_suspend_cache_invalidation;
@@ -4169,14 +4169,14 @@  discard block
 block discarded – undo
4169 4169
  * @return bool True if $site_id is the main site of the network, or if not
4170 4170
  *              running Multisite.
4171 4171
  */
4172
-function is_main_site( $site_id = null ) {
4172
+function is_main_site($site_id = null) {
4173 4173
 	// This is the current network's information; 'site' is old terminology.
4174 4174
 	global $current_site;
4175 4175
 
4176
-	if ( ! is_multisite() )
4176
+	if ( ! is_multisite())
4177 4177
 		return true;
4178 4178
 
4179
-	if ( ! $site_id )
4179
+	if ( ! $site_id)
4180 4180
 		$site_id = get_current_blog_id();
4181 4181
 
4182 4182
 	return (int) $site_id === (int) $current_site->blog_id;
@@ -4190,20 +4190,20 @@  discard block
 block discarded – undo
4190 4190
  * @param int $network_id Optional. Network ID to test. Defaults to current network.
4191 4191
  * @return bool True if $network_id is the main network, or if not running Multisite.
4192 4192
  */
4193
-function is_main_network( $network_id = null ) {
4194
-	if ( ! is_multisite() ) {
4193
+function is_main_network($network_id = null) {
4194
+	if ( ! is_multisite()) {
4195 4195
 		return true;
4196 4196
 	}
4197 4197
 
4198 4198
 	$current_network_id = (int) get_current_site()->id;
4199 4199
 
4200
-	if ( null === $network_id ) {
4200
+	if (null === $network_id) {
4201 4201
 		$network_id = $current_network_id;
4202 4202
 	}
4203 4203
 
4204 4204
 	$network_id = (int) $network_id;
4205 4205
 
4206
-	return ( $network_id === get_main_network_id() );
4206
+	return ($network_id === get_main_network_id());
4207 4207
 }
4208 4208
 
4209 4209
 /**
@@ -4218,21 +4218,21 @@  discard block
 block discarded – undo
4218 4218
 function get_main_network_id() {
4219 4219
 	global $wpdb;
4220 4220
 
4221
-	if ( ! is_multisite() ) {
4221
+	if ( ! is_multisite()) {
4222 4222
 		return 1;
4223 4223
 	}
4224 4224
 
4225
-	if ( defined( 'PRIMARY_NETWORK_ID' ) ) {
4225
+	if (defined('PRIMARY_NETWORK_ID')) {
4226 4226
 		$main_network_id = PRIMARY_NETWORK_ID;
4227
-	} elseif ( 1 === (int) get_current_site()->id ) {
4227
+	} elseif (1 === (int) get_current_site()->id) {
4228 4228
 		// If the current network has an ID of 1, assume it is the main network.
4229 4229
 		$main_network_id = 1;
4230 4230
 	} else {
4231
-		$main_network_id = wp_cache_get( 'primary_network_id', 'site-options' );
4231
+		$main_network_id = wp_cache_get('primary_network_id', 'site-options');
4232 4232
 
4233
-		if ( false === $main_network_id ) {
4234
-			$main_network_id = (int) $wpdb->get_var( "SELECT id FROM {$wpdb->site} ORDER BY id LIMIT 1" );
4235
-			wp_cache_add( 'primary_network_id', $main_network_id, 'site-options' );
4233
+		if (false === $main_network_id) {
4234
+			$main_network_id = (int) $wpdb->get_var("SELECT id FROM {$wpdb->site} ORDER BY id LIMIT 1");
4235
+			wp_cache_add('primary_network_id', $main_network_id, 'site-options');
4236 4236
 		}
4237 4237
 	}
4238 4238
 
@@ -4243,7 +4243,7 @@  discard block
 block discarded – undo
4243 4243
 	 *
4244 4244
 	 * @param int $main_network_id The ID of the main network.
4245 4245
 	 */
4246
-	return (int) apply_filters( 'get_main_network_id', $main_network_id );
4246
+	return (int) apply_filters('get_main_network_id', $main_network_id);
4247 4247
 }
4248 4248
 
4249 4249
 /**
@@ -4256,11 +4256,11 @@  discard block
 block discarded – undo
4256 4256
  * @return bool True if multisite and global terms enabled.
4257 4257
  */
4258 4258
 function global_terms_enabled() {
4259
-	if ( ! is_multisite() )
4259
+	if ( ! is_multisite())
4260 4260
 		return false;
4261 4261
 
4262 4262
 	static $global_terms = null;
4263
-	if ( is_null( $global_terms ) ) {
4263
+	if (is_null($global_terms)) {
4264 4264
 
4265 4265
 		/**
4266 4266
 		 * Filter whether global terms are enabled.
@@ -4272,11 +4272,11 @@  discard block
 block discarded – undo
4272 4272
 		 *
4273 4273
 		 * @param null $enabled Whether global terms are enabled.
4274 4274
 		 */
4275
-		$filter = apply_filters( 'global_terms_enabled', null );
4276
-		if ( ! is_null( $filter ) )
4275
+		$filter = apply_filters('global_terms_enabled', null);
4276
+		if ( ! is_null($filter))
4277 4277
 			$global_terms = (bool) $filter;
4278 4278
 		else
4279
-			$global_terms = (bool) get_site_option( 'global_terms_enabled', false );
4279
+			$global_terms = (bool) get_site_option('global_terms_enabled', false);
4280 4280
 	}
4281 4281
 	return $global_terms;
4282 4282
 }
@@ -4291,16 +4291,16 @@  discard block
 block discarded – undo
4291 4291
  * @return float|false Timezone GMT offset, false otherwise.
4292 4292
  */
4293 4293
 function wp_timezone_override_offset() {
4294
-	if ( !$timezone_string = get_option( 'timezone_string' ) ) {
4294
+	if ( ! $timezone_string = get_option('timezone_string')) {
4295 4295
 		return false;
4296 4296
 	}
4297 4297
 
4298
-	$timezone_object = timezone_open( $timezone_string );
4298
+	$timezone_object = timezone_open($timezone_string);
4299 4299
 	$datetime_object = date_create();
4300
-	if ( false === $timezone_object || false === $datetime_object ) {
4300
+	if (false === $timezone_object || false === $datetime_object) {
4301 4301
 		return false;
4302 4302
 	}
4303
-	return round( timezone_offset_get( $timezone_object, $datetime_object ) / HOUR_IN_SECONDS, 2 );
4303
+	return round(timezone_offset_get($timezone_object, $datetime_object) / HOUR_IN_SECONDS, 2);
4304 4304
 }
4305 4305
 
4306 4306
 /**
@@ -4313,41 +4313,41 @@  discard block
 block discarded – undo
4313 4313
  * @param array $b
4314 4314
  * @return int
4315 4315
  */
4316
-function _wp_timezone_choice_usort_callback( $a, $b ) {
4316
+function _wp_timezone_choice_usort_callback($a, $b) {
4317 4317
 	// Don't use translated versions of Etc
4318
-	if ( 'Etc' === $a['continent'] && 'Etc' === $b['continent'] ) {
4318
+	if ('Etc' === $a['continent'] && 'Etc' === $b['continent']) {
4319 4319
 		// Make the order of these more like the old dropdown
4320
-		if ( 'GMT+' === substr( $a['city'], 0, 4 ) && 'GMT+' === substr( $b['city'], 0, 4 ) ) {
4321
-			return -1 * ( strnatcasecmp( $a['city'], $b['city'] ) );
4320
+		if ('GMT+' === substr($a['city'], 0, 4) && 'GMT+' === substr($b['city'], 0, 4)) {
4321
+			return -1 * (strnatcasecmp($a['city'], $b['city']));
4322 4322
 		}
4323
-		if ( 'UTC' === $a['city'] ) {
4324
-			if ( 'GMT+' === substr( $b['city'], 0, 4 ) ) {
4323
+		if ('UTC' === $a['city']) {
4324
+			if ('GMT+' === substr($b['city'], 0, 4)) {
4325 4325
 				return 1;
4326 4326
 			}
4327 4327
 			return -1;
4328 4328
 		}
4329
-		if ( 'UTC' === $b['city'] ) {
4330
-			if ( 'GMT+' === substr( $a['city'], 0, 4 ) ) {
4329
+		if ('UTC' === $b['city']) {
4330
+			if ('GMT+' === substr($a['city'], 0, 4)) {
4331 4331
 				return -1;
4332 4332
 			}
4333 4333
 			return 1;
4334 4334
 		}
4335
-		return strnatcasecmp( $a['city'], $b['city'] );
4335
+		return strnatcasecmp($a['city'], $b['city']);
4336 4336
 	}
4337
-	if ( $a['t_continent'] == $b['t_continent'] ) {
4338
-		if ( $a['t_city'] == $b['t_city'] ) {
4339
-			return strnatcasecmp( $a['t_subcity'], $b['t_subcity'] );
4337
+	if ($a['t_continent'] == $b['t_continent']) {
4338
+		if ($a['t_city'] == $b['t_city']) {
4339
+			return strnatcasecmp($a['t_subcity'], $b['t_subcity']);
4340 4340
 		}
4341
-		return strnatcasecmp( $a['t_city'], $b['t_city'] );
4341
+		return strnatcasecmp($a['t_city'], $b['t_city']);
4342 4342
 	} else {
4343 4343
 		// Force Etc to the bottom of the list
4344
-		if ( 'Etc' === $a['continent'] ) {
4344
+		if ('Etc' === $a['continent']) {
4345 4345
 			return 1;
4346 4346
 		}
4347
-		if ( 'Etc' === $b['continent'] ) {
4347
+		if ('Etc' === $b['continent']) {
4348 4348
 			return -1;
4349 4349
 		}
4350
-		return strnatcasecmp( $a['t_continent'], $b['t_continent'] );
4350
+		return strnatcasecmp($a['t_continent'], $b['t_continent']);
4351 4351
 	}
4352 4352
 }
4353 4353
 
@@ -4361,125 +4361,125 @@  discard block
 block discarded – undo
4361 4361
  * @param string $selected_zone Selected timezone.
4362 4362
  * @return string
4363 4363
  */
4364
-function wp_timezone_choice( $selected_zone ) {
4364
+function wp_timezone_choice($selected_zone) {
4365 4365
 	static $mo_loaded = false;
4366 4366
 
4367
-	$continents = array( 'Africa', 'America', 'Antarctica', 'Arctic', 'Asia', 'Atlantic', 'Australia', 'Europe', 'Indian', 'Pacific');
4367
+	$continents = array('Africa', 'America', 'Antarctica', 'Arctic', 'Asia', 'Atlantic', 'Australia', 'Europe', 'Indian', 'Pacific');
4368 4368
 
4369 4369
 	// Load translations for continents and cities
4370
-	if ( !$mo_loaded ) {
4370
+	if ( ! $mo_loaded) {
4371 4371
 		$locale = get_locale();
4372
-		$mofile = WP_LANG_DIR . '/continents-cities-' . $locale . '.mo';
4373
-		load_textdomain( 'continents-cities', $mofile );
4372
+		$mofile = WP_LANG_DIR.'/continents-cities-'.$locale.'.mo';
4373
+		load_textdomain('continents-cities', $mofile);
4374 4374
 		$mo_loaded = true;
4375 4375
 	}
4376 4376
 
4377 4377
 	$zonen = array();
4378
-	foreach ( timezone_identifiers_list() as $zone ) {
4379
-		$zone = explode( '/', $zone );
4380
-		if ( !in_array( $zone[0], $continents ) ) {
4378
+	foreach (timezone_identifiers_list() as $zone) {
4379
+		$zone = explode('/', $zone);
4380
+		if ( ! in_array($zone[0], $continents)) {
4381 4381
 			continue;
4382 4382
 		}
4383 4383
 
4384 4384
 		// This determines what gets set and translated - we don't translate Etc/* strings here, they are done later
4385 4385
 		$exists = array(
4386
-			0 => ( isset( $zone[0] ) && $zone[0] ),
4387
-			1 => ( isset( $zone[1] ) && $zone[1] ),
4388
-			2 => ( isset( $zone[2] ) && $zone[2] ),
4386
+			0 => (isset($zone[0]) && $zone[0]),
4387
+			1 => (isset($zone[1]) && $zone[1]),
4388
+			2 => (isset($zone[2]) && $zone[2]),
4389 4389
 		);
4390
-		$exists[3] = ( $exists[0] && 'Etc' !== $zone[0] );
4391
-		$exists[4] = ( $exists[1] && $exists[3] );
4392
-		$exists[5] = ( $exists[2] && $exists[3] );
4390
+		$exists[3] = ($exists[0] && 'Etc' !== $zone[0]);
4391
+		$exists[4] = ($exists[1] && $exists[3]);
4392
+		$exists[5] = ($exists[2] && $exists[3]);
4393 4393
 
4394 4394
 		$zonen[] = array(
4395
-			'continent'   => ( $exists[0] ? $zone[0] : '' ),
4396
-			'city'        => ( $exists[1] ? $zone[1] : '' ),
4397
-			'subcity'     => ( $exists[2] ? $zone[2] : '' ),
4398
-			't_continent' => ( $exists[3] ? translate( str_replace( '_', ' ', $zone[0] ), 'continents-cities' ) : '' ),
4399
-			't_city'      => ( $exists[4] ? translate( str_replace( '_', ' ', $zone[1] ), 'continents-cities' ) : '' ),
4400
-			't_subcity'   => ( $exists[5] ? translate( str_replace( '_', ' ', $zone[2] ), 'continents-cities' ) : '' )
4395
+			'continent'   => ($exists[0] ? $zone[0] : ''),
4396
+			'city'        => ($exists[1] ? $zone[1] : ''),
4397
+			'subcity'     => ($exists[2] ? $zone[2] : ''),
4398
+			't_continent' => ($exists[3] ? translate(str_replace('_', ' ', $zone[0]), 'continents-cities') : ''),
4399
+			't_city'      => ($exists[4] ? translate(str_replace('_', ' ', $zone[1]), 'continents-cities') : ''),
4400
+			't_subcity'   => ($exists[5] ? translate(str_replace('_', ' ', $zone[2]), 'continents-cities') : '')
4401 4401
 		);
4402 4402
 	}
4403
-	usort( $zonen, '_wp_timezone_choice_usort_callback' );
4403
+	usort($zonen, '_wp_timezone_choice_usort_callback');
4404 4404
 
4405 4405
 	$structure = array();
4406 4406
 
4407
-	if ( empty( $selected_zone ) ) {
4408
-		$structure[] = '<option selected="selected" value="">' . __( 'Select a city' ) . '</option>';
4407
+	if (empty($selected_zone)) {
4408
+		$structure[] = '<option selected="selected" value="">'.__('Select a city').'</option>';
4409 4409
 	}
4410 4410
 
4411
-	foreach ( $zonen as $key => $zone ) {
4411
+	foreach ($zonen as $key => $zone) {
4412 4412
 		// Build value in an array to join later
4413
-		$value = array( $zone['continent'] );
4413
+		$value = array($zone['continent']);
4414 4414
 
4415
-		if ( empty( $zone['city'] ) ) {
4415
+		if (empty($zone['city'])) {
4416 4416
 			// It's at the continent level (generally won't happen)
4417 4417
 			$display = $zone['t_continent'];
4418 4418
 		} else {
4419 4419
 			// It's inside a continent group
4420 4420
 
4421 4421
 			// Continent optgroup
4422
-			if ( !isset( $zonen[$key - 1] ) || $zonen[$key - 1]['continent'] !== $zone['continent'] ) {
4422
+			if ( ! isset($zonen[$key - 1]) || $zonen[$key - 1]['continent'] !== $zone['continent']) {
4423 4423
 				$label = $zone['t_continent'];
4424
-				$structure[] = '<optgroup label="'. esc_attr( $label ) .'">';
4424
+				$structure[] = '<optgroup label="'.esc_attr($label).'">';
4425 4425
 			}
4426 4426
 
4427 4427
 			// Add the city to the value
4428 4428
 			$value[] = $zone['city'];
4429 4429
 
4430 4430
 			$display = $zone['t_city'];
4431
-			if ( !empty( $zone['subcity'] ) ) {
4431
+			if ( ! empty($zone['subcity'])) {
4432 4432
 				// Add the subcity to the value
4433 4433
 				$value[] = $zone['subcity'];
4434
-				$display .= ' - ' . $zone['t_subcity'];
4434
+				$display .= ' - '.$zone['t_subcity'];
4435 4435
 			}
4436 4436
 		}
4437 4437
 
4438 4438
 		// Build the value
4439
-		$value = join( '/', $value );
4439
+		$value = join('/', $value);
4440 4440
 		$selected = '';
4441
-		if ( $value === $selected_zone ) {
4441
+		if ($value === $selected_zone) {
4442 4442
 			$selected = 'selected="selected" ';
4443 4443
 		}
4444
-		$structure[] = '<option ' . $selected . 'value="' . esc_attr( $value ) . '">' . esc_html( $display ) . "</option>";
4444
+		$structure[] = '<option '.$selected.'value="'.esc_attr($value).'">'.esc_html($display)."</option>";
4445 4445
 
4446 4446
 		// Close continent optgroup
4447
-		if ( !empty( $zone['city'] ) && ( !isset($zonen[$key + 1]) || (isset( $zonen[$key + 1] ) && $zonen[$key + 1]['continent'] !== $zone['continent']) ) ) {
4447
+		if ( ! empty($zone['city']) && ( ! isset($zonen[$key + 1]) || (isset($zonen[$key + 1]) && $zonen[$key + 1]['continent'] !== $zone['continent']))) {
4448 4448
 			$structure[] = '</optgroup>';
4449 4449
 		}
4450 4450
 	}
4451 4451
 
4452 4452
 	// Do UTC
4453
-	$structure[] = '<optgroup label="'. esc_attr__( 'UTC' ) .'">';
4453
+	$structure[] = '<optgroup label="'.esc_attr__('UTC').'">';
4454 4454
 	$selected = '';
4455
-	if ( 'UTC' === $selected_zone )
4455
+	if ('UTC' === $selected_zone)
4456 4456
 		$selected = 'selected="selected" ';
4457
-	$structure[] = '<option ' . $selected . 'value="' . esc_attr( 'UTC' ) . '">' . __('UTC') . '</option>';
4457
+	$structure[] = '<option '.$selected.'value="'.esc_attr('UTC').'">'.__('UTC').'</option>';
4458 4458
 	$structure[] = '</optgroup>';
4459 4459
 
4460 4460
 	// Do manual UTC offsets
4461
-	$structure[] = '<optgroup label="'. esc_attr__( 'Manual Offsets' ) .'">';
4462
-	$offset_range = array (-12, -11.5, -11, -10.5, -10, -9.5, -9, -8.5, -8, -7.5, -7, -6.5, -6, -5.5, -5, -4.5, -4, -3.5, -3, -2.5, -2, -1.5, -1, -0.5,
4461
+	$structure[] = '<optgroup label="'.esc_attr__('Manual Offsets').'">';
4462
+	$offset_range = array(-12, -11.5, -11, -10.5, -10, -9.5, -9, -8.5, -8, -7.5, -7, -6.5, -6, -5.5, -5, -4.5, -4, -3.5, -3, -2.5, -2, -1.5, -1, -0.5,
4463 4463
 		0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 5.75, 6, 6.5, 7, 7.5, 8, 8.5, 8.75, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.75, 13, 13.75, 14);
4464
-	foreach ( $offset_range as $offset ) {
4465
-		if ( 0 <= $offset )
4466
-			$offset_name = '+' . $offset;
4464
+	foreach ($offset_range as $offset) {
4465
+		if (0 <= $offset)
4466
+			$offset_name = '+'.$offset;
4467 4467
 		else
4468 4468
 			$offset_name = (string) $offset;
4469 4469
 
4470 4470
 		$offset_value = $offset_name;
4471
-		$offset_name = str_replace(array('.25','.5','.75'), array(':15',':30',':45'), $offset_name);
4472
-		$offset_name = 'UTC' . $offset_name;
4473
-		$offset_value = 'UTC' . $offset_value;
4471
+		$offset_name = str_replace(array('.25', '.5', '.75'), array(':15', ':30', ':45'), $offset_name);
4472
+		$offset_name = 'UTC'.$offset_name;
4473
+		$offset_value = 'UTC'.$offset_value;
4474 4474
 		$selected = '';
4475
-		if ( $offset_value === $selected_zone )
4475
+		if ($offset_value === $selected_zone)
4476 4476
 			$selected = 'selected="selected" ';
4477
-		$structure[] = '<option ' . $selected . 'value="' . esc_attr( $offset_value ) . '">' . esc_html( $offset_name ) . "</option>";
4477
+		$structure[] = '<option '.$selected.'value="'.esc_attr($offset_value).'">'.esc_html($offset_name)."</option>";
4478 4478
 
4479 4479
 	}
4480 4480
 	$structure[] = '</optgroup>';
4481 4481
 
4482
-	return join( "\n", $structure );
4482
+	return join("\n", $structure);
4483 4483
 }
4484 4484
 
4485 4485
 /**
@@ -4493,7 +4493,7 @@  discard block
 block discarded – undo
4493 4493
  * @param string $str Header comment to clean up.
4494 4494
  * @return string
4495 4495
  */
4496
-function _cleanup_header_comment( $str ) {
4496
+function _cleanup_header_comment($str) {
4497 4497
 	return trim(preg_replace("/\s*(?:\*\/|\?>).*/", '', $str));
4498 4498
 }
4499 4499
 
@@ -4510,18 +4510,18 @@  discard block
 block discarded – undo
4510 4510
 function wp_scheduled_delete() {
4511 4511
 	global $wpdb;
4512 4512
 
4513
-	$delete_timestamp = time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS );
4513
+	$delete_timestamp = time() - (DAY_IN_SECONDS * EMPTY_TRASH_DAYS);
4514 4514
 
4515 4515
 	$posts_to_delete = $wpdb->get_results($wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_wp_trash_meta_time' AND meta_value < '%d'", $delete_timestamp), ARRAY_A);
4516 4516
 
4517
-	foreach ( (array) $posts_to_delete as $post ) {
4517
+	foreach ((array) $posts_to_delete as $post) {
4518 4518
 		$post_id = (int) $post['post_id'];
4519
-		if ( !$post_id )
4519
+		if ( ! $post_id)
4520 4520
 			continue;
4521 4521
 
4522 4522
 		$del_post = get_post($post_id);
4523 4523
 
4524
-		if ( !$del_post || 'trash' != $del_post->post_status ) {
4524
+		if ( ! $del_post || 'trash' != $del_post->post_status) {
4525 4525
 			delete_post_meta($post_id, '_wp_trash_meta_status');
4526 4526
 			delete_post_meta($post_id, '_wp_trash_meta_time');
4527 4527
 		} else {
@@ -4531,18 +4531,18 @@  discard block
 block discarded – undo
4531 4531
 
4532 4532
 	$comments_to_delete = $wpdb->get_results($wpdb->prepare("SELECT comment_id FROM $wpdb->commentmeta WHERE meta_key = '_wp_trash_meta_time' AND meta_value < '%d'", $delete_timestamp), ARRAY_A);
4533 4533
 
4534
-	foreach ( (array) $comments_to_delete as $comment ) {
4534
+	foreach ((array) $comments_to_delete as $comment) {
4535 4535
 		$comment_id = (int) $comment['comment_id'];
4536
-		if ( !$comment_id )
4536
+		if ( ! $comment_id)
4537 4537
 			continue;
4538 4538
 
4539 4539
 		$del_comment = get_comment($comment_id);
4540 4540
 
4541
-		if ( !$del_comment || 'trash' != $del_comment->comment_approved ) {
4541
+		if ( ! $del_comment || 'trash' != $del_comment->comment_approved) {
4542 4542
 			delete_comment_meta($comment_id, '_wp_trash_meta_time');
4543 4543
 			delete_comment_meta($comment_id, '_wp_trash_meta_status');
4544 4544
 		} else {
4545
-			wp_delete_comment( $del_comment );
4545
+			wp_delete_comment($del_comment);
4546 4546
 		}
4547 4547
 	}
4548 4548
 }
@@ -4567,18 +4567,18 @@  discard block
 block discarded – undo
4567 4567
  *                                Default empty.
4568 4568
  * @return array Array of file headers in `HeaderKey => Header Value` format.
4569 4569
  */
4570
-function get_file_data( $file, $default_headers, $context = '' ) {
4570
+function get_file_data($file, $default_headers, $context = '') {
4571 4571
 	// We don't need to write to the file, so just open for reading.
4572
-	$fp = fopen( $file, 'r' );
4572
+	$fp = fopen($file, 'r');
4573 4573
 
4574 4574
 	// Pull only the first 8kiB of the file in.
4575
-	$file_data = fread( $fp, 8192 );
4575
+	$file_data = fread($fp, 8192);
4576 4576
 
4577 4577
 	// PHP will close file handle, but we are good citizens.
4578
-	fclose( $fp );
4578
+	fclose($fp);
4579 4579
 
4580 4580
 	// Make sure we catch CR-only line endings.
4581
-	$file_data = str_replace( "\r", "\n", $file_data );
4581
+	$file_data = str_replace("\r", "\n", $file_data);
4582 4582
 
4583 4583
 	/**
4584 4584
 	 * Filter extra file headers by context.
@@ -4590,18 +4590,18 @@  discard block
 block discarded – undo
4590 4590
 	 *
4591 4591
 	 * @param array $extra_context_headers Empty array by default.
4592 4592
 	 */
4593
-	if ( $context && $extra_headers = apply_filters( "extra_{$context}_headers", array() ) ) {
4594
-		$extra_headers = array_combine( $extra_headers, $extra_headers ); // keys equal values
4595
-		$all_headers = array_merge( $extra_headers, (array) $default_headers );
4593
+	if ($context && $extra_headers = apply_filters("extra_{$context}_headers", array())) {
4594
+		$extra_headers = array_combine($extra_headers, $extra_headers); // keys equal values
4595
+		$all_headers = array_merge($extra_headers, (array) $default_headers);
4596 4596
 	} else {
4597 4597
 		$all_headers = $default_headers;
4598 4598
 	}
4599 4599
 
4600
-	foreach ( $all_headers as $field => $regex ) {
4601
-		if ( preg_match( '/^[ \t\/*#@]*' . preg_quote( $regex, '/' ) . ':(.*)$/mi', $file_data, $match ) && $match[1] )
4602
-			$all_headers[ $field ] = _cleanup_header_comment( $match[1] );
4600
+	foreach ($all_headers as $field => $regex) {
4601
+		if (preg_match('/^[ \t\/*#@]*'.preg_quote($regex, '/').':(.*)$/mi', $file_data, $match) && $match[1])
4602
+			$all_headers[$field] = _cleanup_header_comment($match[1]);
4603 4603
 		else
4604
-			$all_headers[ $field ] = '';
4604
+			$all_headers[$field] = '';
4605 4605
 	}
4606 4606
 
4607 4607
 	return $all_headers;
@@ -4700,7 +4700,7 @@  discard block
 block discarded – undo
4700 4700
  * @see http://src.chromium.org/viewvc/chrome?view=rev&revision=6985
4701 4701
  */
4702 4702
 function send_nosniff_header() {
4703
-	@header( 'X-Content-Type-Options: nosniff' );
4703
+	@header('X-Content-Type-Options: nosniff');
4704 4704
 }
4705 4705
 
4706 4706
 /**
@@ -4712,8 +4712,8 @@  discard block
 block discarded – undo
4712 4712
  * @param string $column Database column.
4713 4713
  * @return string SQL clause.
4714 4714
  */
4715
-function _wp_mysql_week( $column ) {
4716
-	switch ( $start_of_week = (int) get_option( 'start_of_week' ) ) {
4715
+function _wp_mysql_week($column) {
4716
+	switch ($start_of_week = (int) get_option('start_of_week')) {
4717 4717
 	case 1 :
4718 4718
 		return "WEEK( $column, 1 )";
4719 4719
 	case 2 :
@@ -4741,13 +4741,13 @@  discard block
 block discarded – undo
4741 4741
  * @param array    $callback_args Optional. Additional arguments to send to $callback.
4742 4742
  * @return array IDs of all members of loop.
4743 4743
  */
4744
-function wp_find_hierarchy_loop( $callback, $start, $start_parent, $callback_args = array() ) {
4745
-	$override = is_null( $start_parent ) ? array() : array( $start => $start_parent );
4744
+function wp_find_hierarchy_loop($callback, $start, $start_parent, $callback_args = array()) {
4745
+	$override = is_null($start_parent) ? array() : array($start => $start_parent);
4746 4746
 
4747
-	if ( !$arbitrary_loop_member = wp_find_hierarchy_loop_tortoise_hare( $callback, $start, $override, $callback_args ) )
4747
+	if ( ! $arbitrary_loop_member = wp_find_hierarchy_loop_tortoise_hare($callback, $start, $override, $callback_args))
4748 4748
 		return array();
4749 4749
 
4750
-	return wp_find_hierarchy_loop_tortoise_hare( $callback, $arbitrary_loop_member, $override, $callback_args, true );
4750
+	return wp_find_hierarchy_loop_tortoise_hare($callback, $arbitrary_loop_member, $override, $callback_args, true);
4751 4751
 }
4752 4752
 
4753 4753
 /**
@@ -4770,7 +4770,7 @@  discard block
 block discarded – undo
4770 4770
  * @return mixed Scalar ID of some arbitrary member of the loop, or array of IDs of all members of loop if
4771 4771
  *               $_return_loop
4772 4772
  */
4773
-function wp_find_hierarchy_loop_tortoise_hare( $callback, $start, $override = array(), $callback_args = array(), $_return_loop = false ) {
4773
+function wp_find_hierarchy_loop_tortoise_hare($callback, $start, $override = array(), $callback_args = array(), $_return_loop = false) {
4774 4774
 	$tortoise = $hare = $evanescent_hare = $start;
4775 4775
 	$return = array();
4776 4776
 
@@ -4779,19 +4779,19 @@  discard block
 block discarded – undo
4779 4779
 	while (
4780 4780
 		$tortoise
4781 4781
 	&&
4782
-		( $evanescent_hare = isset( $override[$hare] ) ? $override[$hare] : call_user_func_array( $callback, array_merge( array( $hare ), $callback_args ) ) )
4782
+		($evanescent_hare = isset($override[$hare]) ? $override[$hare] : call_user_func_array($callback, array_merge(array($hare), $callback_args)))
4783 4783
 	&&
4784
-		( $hare = isset( $override[$evanescent_hare] ) ? $override[$evanescent_hare] : call_user_func_array( $callback, array_merge( array( $evanescent_hare ), $callback_args ) ) )
4784
+		($hare = isset($override[$evanescent_hare]) ? $override[$evanescent_hare] : call_user_func_array($callback, array_merge(array($evanescent_hare), $callback_args)))
4785 4785
 	) {
4786
-		if ( $_return_loop )
4786
+		if ($_return_loop)
4787 4787
 			$return[$tortoise] = $return[$evanescent_hare] = $return[$hare] = true;
4788 4788
 
4789 4789
 		// tortoise got lapped - must be a loop
4790
-		if ( $tortoise == $evanescent_hare || $tortoise == $hare )
4790
+		if ($tortoise == $evanescent_hare || $tortoise == $hare)
4791 4791
 			return $_return_loop ? $return : $tortoise;
4792 4792
 
4793 4793
 		// Increment tortoise by one step
4794
-		$tortoise = isset( $override[$tortoise] ) ? $override[$tortoise] : call_user_func_array( $callback, array_merge( array( $tortoise ), $callback_args ) );
4794
+		$tortoise = isset($override[$tortoise]) ? $override[$tortoise] : call_user_func_array($callback, array_merge(array($tortoise), $callback_args));
4795 4795
 	}
4796 4796
 
4797 4797
 	return false;
@@ -4805,7 +4805,7 @@  discard block
 block discarded – undo
4805 4805
  * @see https://developer.mozilla.org/en/the_x-frame-options_response_header
4806 4806
  */
4807 4807
 function send_frame_options_header() {
4808
-	@header( 'X-Frame-Options: SAMEORIGIN' );
4808
+	@header('X-Frame-Options: SAMEORIGIN');
4809 4809
 }
4810 4810
 
4811 4811
 /**
@@ -4826,8 +4826,8 @@  discard block
 block discarded – undo
4826 4826
 function wp_allowed_protocols() {
4827 4827
 	static $protocols = array();
4828 4828
 
4829
-	if ( empty( $protocols ) ) {
4830
-		$protocols = array( 'http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet', 'mms', 'rtsp', 'svn', 'tel', 'fax', 'xmpp', 'webcal' );
4829
+	if (empty($protocols)) {
4830
+		$protocols = array('http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet', 'mms', 'rtsp', 'svn', 'tel', 'fax', 'xmpp', 'webcal');
4831 4831
 
4832 4832
 		/**
4833 4833
 		 * Filter the list of protocols allowed in HTML attributes.
@@ -4836,7 +4836,7 @@  discard block
 block discarded – undo
4836 4836
 		 *
4837 4837
 		 * @param array $protocols Array of allowed protocols e.g. 'http', 'ftp', 'tel', and more.
4838 4838
 		 */
4839
-		$protocols = apply_filters( 'kses_allowed_protocols', $protocols );
4839
+		$protocols = apply_filters('kses_allowed_protocols', $protocols);
4840 4840
 	}
4841 4841
 
4842 4842
 	return $protocols;
@@ -4859,36 +4859,36 @@  discard block
 block discarded – undo
4859 4859
  * @return string|array Either a string containing a reversed comma separated trace or an array
4860 4860
  *                      of individual calls.
4861 4861
  */
4862
-function wp_debug_backtrace_summary( $ignore_class = null, $skip_frames = 0, $pretty = true ) {
4863
-	if ( version_compare( PHP_VERSION, '5.2.5', '>=' ) )
4864
-		$trace = debug_backtrace( false );
4862
+function wp_debug_backtrace_summary($ignore_class = null, $skip_frames = 0, $pretty = true) {
4863
+	if (version_compare(PHP_VERSION, '5.2.5', '>='))
4864
+		$trace = debug_backtrace(false);
4865 4865
 	else
4866 4866
 		$trace = debug_backtrace();
4867 4867
 
4868 4868
 	$caller = array();
4869
-	$check_class = ! is_null( $ignore_class );
4869
+	$check_class = ! is_null($ignore_class);
4870 4870
 	$skip_frames++; // skip this function
4871 4871
 
4872
-	foreach ( $trace as $call ) {
4873
-		if ( $skip_frames > 0 ) {
4872
+	foreach ($trace as $call) {
4873
+		if ($skip_frames > 0) {
4874 4874
 			$skip_frames--;
4875
-		} elseif ( isset( $call['class'] ) ) {
4876
-			if ( $check_class && $ignore_class == $call['class'] )
4875
+		} elseif (isset($call['class'])) {
4876
+			if ($check_class && $ignore_class == $call['class'])
4877 4877
 				continue; // Filter out calls
4878 4878
 
4879 4879
 			$caller[] = "{$call['class']}{$call['type']}{$call['function']}";
4880 4880
 		} else {
4881
-			if ( in_array( $call['function'], array( 'do_action', 'apply_filters' ) ) ) {
4881
+			if (in_array($call['function'], array('do_action', 'apply_filters'))) {
4882 4882
 				$caller[] = "{$call['function']}('{$call['args'][0]}')";
4883
-			} elseif ( in_array( $call['function'], array( 'include', 'include_once', 'require', 'require_once' ) ) ) {
4884
-				$caller[] = $call['function'] . "('" . str_replace( array( WP_CONTENT_DIR, ABSPATH ) , '', $call['args'][0] ) . "')";
4883
+			} elseif (in_array($call['function'], array('include', 'include_once', 'require', 'require_once'))) {
4884
+				$caller[] = $call['function']."('".str_replace(array(WP_CONTENT_DIR, ABSPATH), '', $call['args'][0])."')";
4885 4885
 			} else {
4886 4886
 				$caller[] = $call['function'];
4887 4887
 			}
4888 4888
 		}
4889 4889
 	}
4890
-	if ( $pretty )
4891
-		return join( ', ', array_reverse( $caller ) );
4890
+	if ($pretty)
4891
+		return join(', ', array_reverse($caller));
4892 4892
 	else
4893 4893
 		return $caller;
4894 4894
 }
@@ -4904,11 +4904,11 @@  discard block
 block discarded – undo
4904 4904
  *
4905 4905
  * @return array List of ids not present in the cache.
4906 4906
  */
4907
-function _get_non_cached_ids( $object_ids, $cache_key ) {
4907
+function _get_non_cached_ids($object_ids, $cache_key) {
4908 4908
 	$clean = array();
4909
-	foreach ( $object_ids as $id ) {
4909
+	foreach ($object_ids as $id) {
4910 4910
 		$id = (int) $id;
4911
-		if ( !wp_cache_get( $id, $cache_key ) ) {
4911
+		if ( ! wp_cache_get($id, $cache_key)) {
4912 4912
 			$clean[] = $id;
4913 4913
 		}
4914 4914
 	}
@@ -4925,15 +4925,15 @@  discard block
 block discarded – undo
4925 4925
  * @return bool Whether the device is able to upload files.
4926 4926
  */
4927 4927
 function _device_can_upload() {
4928
-	if ( ! wp_is_mobile() )
4928
+	if ( ! wp_is_mobile())
4929 4929
 		return true;
4930 4930
 
4931 4931
 	$ua = $_SERVER['HTTP_USER_AGENT'];
4932 4932
 
4933
-	if ( strpos($ua, 'iPhone') !== false
4933
+	if (strpos($ua, 'iPhone') !== false
4934 4934
 		|| strpos($ua, 'iPad') !== false
4935
-		|| strpos($ua, 'iPod') !== false ) {
4936
-			return preg_match( '#OS ([\d_]+) like Mac OS X#', $ua, $version ) && version_compare( $version[1], '6', '>=' );
4935
+		|| strpos($ua, 'iPod') !== false) {
4936
+			return preg_match('#OS ([\d_]+) like Mac OS X#', $ua, $version) && version_compare($version[1], '6', '>=');
4937 4937
 	}
4938 4938
 
4939 4939
 	return true;
@@ -4945,11 +4945,11 @@  discard block
 block discarded – undo
4945 4945
  * @param string $path The resource path or URL.
4946 4946
  * @return bool True if the path is a stream URL.
4947 4947
  */
4948
-function wp_is_stream( $path ) {
4948
+function wp_is_stream($path) {
4949 4949
 	$wrappers = stream_get_wrappers();
4950
-	$wrappers_re = '(' . join('|', $wrappers) . ')';
4950
+	$wrappers_re = '('.join('|', $wrappers).')';
4951 4951
 
4952
-	return preg_match( "!^$wrappers_re://!", $path ) === 1;
4952
+	return preg_match("!^$wrappers_re://!", $path) === 1;
4953 4953
 }
4954 4954
 
4955 4955
 /**
@@ -4965,7 +4965,7 @@  discard block
 block discarded – undo
4965 4965
  * @param  string $source_date The date to filter.
4966 4966
  * @return bool True if valid date, false if not valid date.
4967 4967
  */
4968
-function wp_checkdate( $month, $day, $year, $source_date ) {
4968
+function wp_checkdate($month, $day, $year, $source_date) {
4969 4969
 	/**
4970 4970
 	 * Filter whether the given date is valid for the Gregorian calendar.
4971 4971
 	 *
@@ -4974,7 +4974,7 @@  discard block
 block discarded – undo
4974 4974
 	 * @param bool   $checkdate   Whether the given date is valid.
4975 4975
 	 * @param string $source_date Date to check.
4976 4976
 	 */
4977
-	return apply_filters( 'wp_checkdate', checkdate( $month, $day, $year ), $source_date );
4977
+	return apply_filters('wp_checkdate', checkdate($month, $day, $year), $source_date);
4978 4978
 }
4979 4979
 
4980 4980
 /**
@@ -4989,15 +4989,15 @@  discard block
 block discarded – undo
4989 4989
  * @since 3.6.0
4990 4990
  */
4991 4991
 function wp_auth_check_load() {
4992
-	if ( ! is_admin() && ! is_user_logged_in() )
4992
+	if ( ! is_admin() && ! is_user_logged_in())
4993 4993
 		return;
4994 4994
 
4995
-	if ( defined( 'IFRAME_REQUEST' ) )
4995
+	if (defined('IFRAME_REQUEST'))
4996 4996
 		return;
4997 4997
 
4998 4998
 	$screen = get_current_screen();
4999
-	$hidden = array( 'update', 'update-network', 'update-core', 'update-core-network', 'upgrade', 'upgrade-network', 'network' );
5000
-	$show = ! in_array( $screen->id, $hidden );
4999
+	$hidden = array('update', 'update-network', 'update-core', 'update-core-network', 'upgrade', 'upgrade-network', 'network');
5000
+	$show = ! in_array($screen->id, $hidden);
5001 5001
 
5002 5002
 	/**
5003 5003
 	 * Filter whether to load the authentication check.
@@ -5010,12 +5010,12 @@  discard block
 block discarded – undo
5010 5010
 	 * @param bool      $show   Whether to load the authentication check.
5011 5011
 	 * @param WP_Screen $screen The current screen object.
5012 5012
 	 */
5013
-	if ( apply_filters( 'wp_auth_check_load', $show, $screen ) ) {
5014
-		wp_enqueue_style( 'wp-auth-check' );
5015
-		wp_enqueue_script( 'wp-auth-check' );
5013
+	if (apply_filters('wp_auth_check_load', $show, $screen)) {
5014
+		wp_enqueue_style('wp-auth-check');
5015
+		wp_enqueue_script('wp-auth-check');
5016 5016
 
5017
-		add_action( 'admin_print_footer_scripts', 'wp_auth_check_html', 5 );
5018
-		add_action( 'wp_print_footer_scripts', 'wp_auth_check_html', 5 );
5017
+		add_action('admin_print_footer_scripts', 'wp_auth_check_html', 5);
5018
+		add_action('wp_print_footer_scripts', 'wp_auth_check_html', 5);
5019 5019
 	}
5020 5020
 }
5021 5021
 
@@ -5026,8 +5026,8 @@  discard block
 block discarded – undo
5026 5026
  */
5027 5027
 function wp_auth_check_html() {
5028 5028
 	$login_url = wp_login_url();
5029
-	$current_domain = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'];
5030
-	$same_domain = ( strpos( $login_url, $current_domain ) === 0 );
5029
+	$current_domain = (is_ssl() ? 'https://' : 'http://').$_SERVER['HTTP_HOST'];
5030
+	$same_domain = (strpos($login_url, $current_domain) === 0);
5031 5031
 
5032 5032
 	/**
5033 5033
 	 * Filter whether the authentication check originated at the same domain.
@@ -5036,26 +5036,26 @@  discard block
 block discarded – undo
5036 5036
 	 *
5037 5037
 	 * @param bool $same_domain Whether the authentication check originated at the same domain.
5038 5038
 	 */
5039
-	$same_domain = apply_filters( 'wp_auth_check_same_domain', $same_domain );
5039
+	$same_domain = apply_filters('wp_auth_check_same_domain', $same_domain);
5040 5040
 	$wrap_class = $same_domain ? 'hidden' : 'hidden fallback';
5041 5041
 
5042 5042
 	?>
5043 5043
 	<div id="wp-auth-check-wrap" class="<?php echo $wrap_class; ?>">
5044 5044
 	<div id="wp-auth-check-bg"></div>
5045 5045
 	<div id="wp-auth-check">
5046
-	<button type="button" class="wp-auth-check-close button-link"><span class="screen-reader-text"><?php _e( 'Close dialog' ); ?></span></button>
5046
+	<button type="button" class="wp-auth-check-close button-link"><span class="screen-reader-text"><?php _e('Close dialog'); ?></span></button>
5047 5047
 	<?php
5048 5048
 
5049
-	if ( $same_domain ) {
5049
+	if ($same_domain) {
5050 5050
 		?>
5051
-		<div id="wp-auth-check-form" class="loading" data-src="<?php echo esc_url( add_query_arg( array( 'interim-login' => 1 ), $login_url ) ); ?>"></div>
5051
+		<div id="wp-auth-check-form" class="loading" data-src="<?php echo esc_url(add_query_arg(array('interim-login' => 1), $login_url)); ?>"></div>
5052 5052
 		<?php
5053 5053
 	}
5054 5054
 
5055 5055
 	?>
5056 5056
 	<div class="wp-auth-fallback">
5057 5057
 		<p><b class="wp-auth-fallback-expired" tabindex="0"><?php _e('Session expired'); ?></b></p>
5058
-		<p><a href="<?php echo esc_url( $login_url ); ?>" target="_blank"><?php _e('Please log in again.'); ?></a>
5058
+		<p><a href="<?php echo esc_url($login_url); ?>" target="_blank"><?php _e('Please log in again.'); ?></a>
5059 5059
 		<?php _e('The login page will open in a new window. After logging in you can close it and return to this page.'); ?></p>
5060 5060
 	</div>
5061 5061
 	</div>
@@ -5076,8 +5076,8 @@  discard block
 block discarded – undo
5076 5076
  * @param array $response  The Heartbeat response.
5077 5077
  * @return array $response The Heartbeat response with 'wp-auth-check' value set.
5078 5078
  */
5079
-function wp_auth_check( $response ) {
5080
-	$response['wp-auth-check'] = is_user_logged_in() && empty( $GLOBALS['login_grace_period'] );
5079
+function wp_auth_check($response) {
5080
+	$response['wp-auth-check'] = is_user_logged_in() && empty($GLOBALS['login_grace_period']);
5081 5081
 	return $response;
5082 5082
 }
5083 5083
 
@@ -5097,10 +5097,10 @@  discard block
 block discarded – undo
5097 5097
  * @param string $tag An HTML tag name. Example: 'video'.
5098 5098
  * @return string Tag RegEx.
5099 5099
  */
5100
-function get_tag_regex( $tag ) {
5101
-	if ( empty( $tag ) )
5100
+function get_tag_regex($tag) {
5101
+	if (empty($tag))
5102 5102
 		return;
5103
-	return sprintf( '<%1$s[^<]*(?:>[\s\S]*<\/%1$s>|\s*\/>)', tag_escape( $tag ) );
5103
+	return sprintf('<%1$s[^<]*(?:>[\s\S]*<\/%1$s>|\s*\/>)', tag_escape($tag));
5104 5104
 }
5105 5105
 
5106 5106
 /**
@@ -5115,13 +5115,13 @@  discard block
 block discarded – undo
5115 5115
  * @param string $charset A charset name.
5116 5116
  * @return string The canonical form of the charset.
5117 5117
  */
5118
-function _canonical_charset( $charset ) {
5119
-	if ( 'UTF-8' === $charset || 'utf-8' === $charset || 'utf8' === $charset ||
5120
-		'UTF8' === $charset )
5118
+function _canonical_charset($charset) {
5119
+	if ('UTF-8' === $charset || 'utf-8' === $charset || 'utf8' === $charset ||
5120
+		'UTF8' === $charset)
5121 5121
 		return 'UTF-8';
5122 5122
 
5123
-	if ( 'ISO-8859-1' === $charset || 'iso-8859-1' === $charset ||
5124
-		'iso8859-1' === $charset || 'ISO8859-1' === $charset )
5123
+	if ('ISO-8859-1' === $charset || 'iso-8859-1' === $charset ||
5124
+		'iso8859-1' === $charset || 'ISO8859-1' === $charset)
5125 5125
 		return 'ISO-8859-1';
5126 5126
 
5127 5127
 	return $charset;
@@ -5153,25 +5153,25 @@  discard block
 block discarded – undo
5153 5153
  * @param bool $reset Optional. Whether to reset the encoding back to a previously-set encoding.
5154 5154
  *                    Default false.
5155 5155
  */
5156
-function mbstring_binary_safe_encoding( $reset = false ) {
5156
+function mbstring_binary_safe_encoding($reset = false) {
5157 5157
 	static $encodings = array();
5158 5158
 	static $overloaded = null;
5159 5159
 
5160
-	if ( is_null( $overloaded ) )
5161
-		$overloaded = function_exists( 'mb_internal_encoding' ) && ( ini_get( 'mbstring.func_overload' ) & 2 );
5160
+	if (is_null($overloaded))
5161
+		$overloaded = function_exists('mb_internal_encoding') && (ini_get('mbstring.func_overload') & 2);
5162 5162
 
5163
-	if ( false === $overloaded )
5163
+	if (false === $overloaded)
5164 5164
 		return;
5165 5165
 
5166
-	if ( ! $reset ) {
5166
+	if ( ! $reset) {
5167 5167
 		$encoding = mb_internal_encoding();
5168
-		array_push( $encodings, $encoding );
5169
-		mb_internal_encoding( 'ISO-8859-1' );
5168
+		array_push($encodings, $encoding);
5169
+		mb_internal_encoding('ISO-8859-1');
5170 5170
 	}
5171 5171
 
5172
-	if ( $reset && $encodings ) {
5173
-		$encoding = array_pop( $encodings );
5174
-		mb_internal_encoding( $encoding );
5172
+	if ($reset && $encodings) {
5173
+		$encoding = array_pop($encodings);
5174
+		mb_internal_encoding($encoding);
5175 5175
 	}
5176 5176
 }
5177 5177
 
@@ -5183,7 +5183,7 @@  discard block
 block discarded – undo
5183 5183
  * @since 3.7.0
5184 5184
  */
5185 5185
 function reset_mbstring_encoding() {
5186
-	mbstring_binary_safe_encoding( true );
5186
+	mbstring_binary_safe_encoding(true);
5187 5187
 }
5188 5188
 
5189 5189
 /**
@@ -5196,12 +5196,12 @@  discard block
 block discarded – undo
5196 5196
  * @param mixed $var Boolean value to validate.
5197 5197
  * @return bool Whether the value is validated.
5198 5198
  */
5199
-function wp_validate_boolean( $var ) {
5200
-	if ( is_bool( $var ) ) {
5199
+function wp_validate_boolean($var) {
5200
+	if (is_bool($var)) {
5201 5201
 		return $var;
5202 5202
 	}
5203 5203
 
5204
-	if ( is_string( $var ) && 'false' === strtolower( $var ) ) {
5204
+	if (is_string($var) && 'false' === strtolower($var)) {
5205 5205
 		return false;
5206 5206
 	}
5207 5207
 
@@ -5215,7 +5215,7 @@  discard block
 block discarded – undo
5215 5215
  *
5216 5216
  * @param string $file The path to the file to delete.
5217 5217
  */
5218
-function wp_delete_file( $file ) {
5218
+function wp_delete_file($file) {
5219 5219
 	/**
5220 5220
 	 * Filter the path of the file to delete.
5221 5221
 	 *
@@ -5223,9 +5223,9 @@  discard block
 block discarded – undo
5223 5223
 	 *
5224 5224
 	 * @param string $medium Path to the file to delete.
5225 5225
 	 */
5226
-	$delete = apply_filters( 'wp_delete_file', $file );
5227
-	if ( ! empty( $delete ) ) {
5228
-		@unlink( $delete );
5226
+	$delete = apply_filters('wp_delete_file', $file);
5227
+	if ( ! empty($delete)) {
5228
+		@unlink($delete);
5229 5229
 	}
5230 5230
 }
5231 5231
 
@@ -5239,12 +5239,12 @@  discard block
 block discarded – undo
5239 5239
 function wp_post_preview_js() {
5240 5240
 	global $post;
5241 5241
 
5242
-	if ( ! is_preview() || empty( $post ) ) {
5242
+	if ( ! is_preview() || empty($post)) {
5243 5243
 		return;
5244 5244
 	}
5245 5245
 
5246 5246
 	// Has to match the window name used in post_submit_meta_box()
5247
-	$name = 'wp-preview-' . (int) $post->ID;
5247
+	$name = 'wp-preview-'.(int) $post->ID;
5248 5248
 
5249 5249
 	?>
5250 5250
 	<script>
@@ -5274,9 +5274,9 @@  discard block
 block discarded – undo
5274 5274
  * @param string $date_string Date string to parse and format.
5275 5275
  * @return string Date formatted for ISO8601/RFC3339.
5276 5276
  */
5277
-function mysql_to_rfc3339( $date_string ) {
5278
-	$formatted = mysql2date( 'c', $date_string, false );
5277
+function mysql_to_rfc3339($date_string) {
5278
+	$formatted = mysql2date('c', $date_string, false);
5279 5279
 
5280 5280
 	// Strip timezone information
5281
-	return preg_replace( '/(?:Z|[+-]\d{2}(?::\d{2})?)$/', '', $formatted );
5281
+	return preg_replace('/(?:Z|[+-]\d{2}(?::\d{2})?)$/', '', $formatted);
5282 5282
 }
Please login to merge, or discard this patch.
Braces   +522 added lines, -369 removed lines patch added patch discarded remove patch
@@ -24,22 +24,26 @@  discard block
 block discarded – undo
24 24
  * @return string|int|bool Formatted date string or Unix timestamp. False if $date is empty.
25 25
  */
26 26
 function mysql2date( $format, $date, $translate = true ) {
27
-	if ( empty( $date ) )
28
-		return false;
27
+	if ( empty( $date ) ) {
28
+			return false;
29
+	}
29 30
 
30
-	if ( 'G' == $format )
31
-		return strtotime( $date . ' +0000' );
31
+	if ( 'G' == $format ) {
32
+			return strtotime( $date . ' +0000' );
33
+	}
32 34
 
33 35
 	$i = strtotime( $date );
34 36
 
35
-	if ( 'U' == $format )
36
-		return $i;
37
+	if ( 'U' == $format ) {
38
+			return $i;
39
+	}
37 40
 
38
-	if ( $translate )
39
-		return date_i18n( $format, $i );
40
-	else
41
-		return date( $format, $i );
42
-}
41
+	if ( $translate ) {
42
+			return date_i18n( $format, $i );
43
+	} else {
44
+			return date( $format, $i );
45
+	}
46
+	}
43 47
 
44 48
 /**
45 49
  * Retrieve the current time based on specified type.
@@ -91,10 +95,11 @@  discard block
 block discarded – undo
91 95
 	$i = $unixtimestamp;
92 96
 
93 97
 	if ( false === $i ) {
94
-		if ( ! $gmt )
95
-			$i = current_time( 'timestamp' );
96
-		else
97
-			$i = time();
98
+		if ( ! $gmt ) {
99
+					$i = current_time( 'timestamp' );
100
+		} else {
101
+					$i = time();
102
+		}
98 103
 		// we should not let date() interfere with our
99 104
 		// specially computed timestamp
100 105
 		$gmt = true;
@@ -297,11 +302,13 @@  discard block
 block discarded – undo
297 302
 	// The day of the week from the timestamp.
298 303
 	$weekday = date( 'w', $day );
299 304
 
300
-	if ( !is_numeric($start_of_week) )
301
-		$start_of_week = get_option( 'start_of_week' );
305
+	if ( !is_numeric($start_of_week) ) {
306
+			$start_of_week = get_option( 'start_of_week' );
307
+	}
302 308
 
303
-	if ( $weekday < $start_of_week )
304
-		$weekday += 7;
309
+	if ( $weekday < $start_of_week ) {
310
+			$weekday += 7;
311
+	}
305 312
 
306 313
 	// The most recent week start day on or before $day.
307 314
 	$start = $day - DAY_IN_SECONDS * ( $weekday - $start_of_week );
@@ -320,8 +327,10 @@  discard block
 block discarded – undo
320 327
  * @return mixed Unserialized data can be any type.
321 328
  */
322 329
 function maybe_unserialize( $original ) {
323
-	if ( is_serialized( $original ) ) // don't attempt to unserialize data that wasn't serialized going in
330
+	if ( is_serialized( $original ) ) {
331
+		// don't attempt to unserialize data that wasn't serialized going in
324 332
 		return @unserialize( $original );
333
+	}
325 334
 	return $original;
326 335
 }
327 336
 
@@ -361,13 +370,16 @@  discard block
 block discarded – undo
361 370
 		$semicolon = strpos( $data, ';' );
362 371
 		$brace     = strpos( $data, '}' );
363 372
 		// Either ; or } must exist.
364
-		if ( false === $semicolon && false === $brace )
365
-			return false;
373
+		if ( false === $semicolon && false === $brace ) {
374
+					return false;
375
+		}
366 376
 		// But neither must be in the first X characters.
367
-		if ( false !== $semicolon && $semicolon < 3 )
368
-			return false;
369
-		if ( false !== $brace && $brace < 4 )
370
-			return false;
377
+		if ( false !== $semicolon && $semicolon < 3 ) {
378
+					return false;
379
+		}
380
+		if ( false !== $brace && $brace < 4 ) {
381
+					return false;
382
+		}
371 383
 	}
372 384
 	$token = $data[0];
373 385
 	switch ( $token ) {
@@ -430,14 +442,16 @@  discard block
 block discarded – undo
430 442
  * @return mixed A scalar data
431 443
  */
432 444
 function maybe_serialize( $data ) {
433
-	if ( is_array( $data ) || is_object( $data ) )
434
-		return serialize( $data );
445
+	if ( is_array( $data ) || is_object( $data ) ) {
446
+			return serialize( $data );
447
+	}
435 448
 
436 449
 	// Double serialization is required for backward compatibility.
437 450
 	// See https://core.trac.wordpress.org/ticket/12930
438 451
 	// Also the world will end. See WP 3.6.1.
439
-	if ( is_serialized( $data, false ) )
440
-		return serialize( $data );
452
+	if ( is_serialized( $data, false ) ) {
453
+			return serialize( $data );
454
+	}
441 455
 
442 456
 	return $data;
443 457
 }
@@ -565,20 +579,23 @@  discard block
 block discarded – undo
565 579
 	foreach ( $pung as $link_test ) {
566 580
 		if ( ! in_array( $link_test, $post_links_temp ) ) { // link no longer in post
567 581
 			$mids = $wpdb->get_col( $wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE %s", $post_ID, $wpdb->esc_like( $link_test ) . '%') );
568
-			foreach ( $mids as $mid )
569
-				delete_metadata_by_mid( 'post', $mid );
582
+			foreach ( $mids as $mid ) {
583
+							delete_metadata_by_mid( 'post', $mid );
584
+			}
570 585
 		}
571 586
 	}
572 587
 
573 588
 	foreach ( (array) $post_links_temp as $link_test ) {
574 589
 		if ( !in_array( $link_test, $pung ) ) { // If we haven't pung it already
575 590
 			$test = @parse_url( $link_test );
576
-			if ( false === $test )
577
-				continue;
578
-			if ( isset( $test['query'] ) )
579
-				$post_links[] = $link_test;
580
-			elseif ( isset($test['path']) && ( $test['path'] != '/' ) &&  ($test['path'] != '' ) )
581
-				$post_links[] = $link_test;
591
+			if ( false === $test ) {
592
+							continue;
593
+			}
594
+			if ( isset( $test['query'] ) ) {
595
+							$post_links[] = $link_test;
596
+			} elseif ( isset($test['path']) && ( $test['path'] != '/' ) &&  ($test['path'] != '' ) ) {
597
+							$post_links[] = $link_test;
598
+			}
582 599
 		}
583 600
 	}
584 601
 
@@ -636,13 +653,15 @@  discard block
 block discarded – undo
636 653
  * @return bool|string False on failure, headers on success.
637 654
  */
638 655
 function wp_get_http_headers( $url, $deprecated = false ) {
639
-	if ( !empty( $deprecated ) )
640
-		_deprecated_argument( __FUNCTION__, '2.7' );
656
+	if ( !empty( $deprecated ) ) {
657
+			_deprecated_argument( __FUNCTION__, '2.7' );
658
+	}
641 659
 
642 660
 	$response = wp_safe_remote_head( $url );
643 661
 
644
-	if ( is_wp_error( $response ) )
645
-		return false;
662
+	if ( is_wp_error( $response ) ) {
663
+			return false;
664
+	}
646 665
 
647 666
 	return wp_remote_retrieve_headers( $response );
648 667
 }
@@ -660,11 +679,12 @@  discard block
 block discarded – undo
660 679
  */
661 680
 function is_new_day() {
662 681
 	global $currentday, $previousday;
663
-	if ( $currentday != $previousday )
664
-		return 1;
665
-	else
666
-		return 0;
667
-}
682
+	if ( $currentday != $previousday ) {
683
+			return 1;
684
+	} else {
685
+			return 0;
686
+	}
687
+	}
668 688
 
669 689
 /**
670 690
  * Build URL query based on an associative and, or indexed array.
@@ -707,27 +727,33 @@  discard block
 block discarded – undo
707 727
 	$ret = array();
708 728
 
709 729
 	foreach ( (array) $data as $k => $v ) {
710
-		if ( $urlencode)
711
-			$k = urlencode($k);
712
-		if ( is_int($k) && $prefix != null )
713
-			$k = $prefix.$k;
714
-		if ( !empty($key) )
715
-			$k = $key . '%5B' . $k . '%5D';
716
-		if ( $v === null )
717
-			continue;
718
-		elseif ( $v === false )
719
-			$v = '0';
730
+		if ( $urlencode) {
731
+					$k = urlencode($k);
732
+		}
733
+		if ( is_int($k) && $prefix != null ) {
734
+					$k = $prefix.$k;
735
+		}
736
+		if ( !empty($key) ) {
737
+					$k = $key . '%5B' . $k . '%5D';
738
+		}
739
+		if ( $v === null ) {
740
+					continue;
741
+		} elseif ( $v === false ) {
742
+					$v = '0';
743
+		}
720 744
 
721
-		if ( is_array($v) || is_object($v) )
722
-			array_push($ret,_http_build_query($v, '', $sep, $k, $urlencode));
723
-		elseif ( $urlencode )
724
-			array_push($ret, $k.'='.urlencode($v));
725
-		else
726
-			array_push($ret, $k.'='.$v);
745
+		if ( is_array($v) || is_object($v) ) {
746
+					array_push($ret,_http_build_query($v, '', $sep, $k, $urlencode));
747
+		} elseif ( $urlencode ) {
748
+					array_push($ret, $k.'='.urlencode($v));
749
+		} else {
750
+					array_push($ret, $k.'='.$v);
751
+		}
727 752
 	}
728 753
 
729
-	if ( null === $sep )
730
-		$sep = ini_get('arg_separator.output');
754
+	if ( null === $sep ) {
755
+			$sep = ini_get('arg_separator.output');
756
+	}
731 757
 
732 758
 	return implode($sep, $ret);
733 759
 }
@@ -770,21 +796,24 @@  discard block
 block discarded – undo
770 796
 function add_query_arg() {
771 797
 	$args = func_get_args();
772 798
 	if ( is_array( $args[0] ) ) {
773
-		if ( count( $args ) < 2 || false === $args[1] )
774
-			$uri = $_SERVER['REQUEST_URI'];
775
-		else
776
-			$uri = $args[1];
799
+		if ( count( $args ) < 2 || false === $args[1] ) {
800
+					$uri = $_SERVER['REQUEST_URI'];
801
+		} else {
802
+					$uri = $args[1];
803
+		}
777 804
 	} else {
778
-		if ( count( $args ) < 3 || false === $args[2] )
779
-			$uri = $_SERVER['REQUEST_URI'];
780
-		else
781
-			$uri = $args[2];
805
+		if ( count( $args ) < 3 || false === $args[2] ) {
806
+					$uri = $_SERVER['REQUEST_URI'];
807
+		} else {
808
+					$uri = $args[2];
809
+		}
782 810
 	}
783 811
 
784
-	if ( $frag = strstr( $uri, '#' ) )
785
-		$uri = substr( $uri, 0, -strlen( $frag ) );
786
-	else
787
-		$frag = '';
812
+	if ( $frag = strstr( $uri, '#' ) ) {
813
+			$uri = substr( $uri, 0, -strlen( $frag ) );
814
+	} else {
815
+			$frag = '';
816
+	}
788 817
 
789 818
 	if ( 0 === stripos( $uri, 'http://' ) ) {
790 819
 		$protocol = 'http://';
@@ -818,8 +847,9 @@  discard block
 block discarded – undo
818 847
 	}
819 848
 
820 849
 	foreach ( $qs as $k => $v ) {
821
-		if ( $v === false )
822
-			unset( $qs[$k] );
850
+		if ( $v === false ) {
851
+					unset( $qs[$k] );
852
+		}
823 853
 	}
824 854
 
825 855
 	$ret = build_query( $qs );
@@ -841,8 +871,9 @@  discard block
 block discarded – undo
841 871
  */
842 872
 function remove_query_arg( $key, $query = false ) {
843 873
 	if ( is_array( $key ) ) { // removing multiple keys
844
-		foreach ( $key as $k )
845
-			$query = add_query_arg( $k, false, $query );
874
+		foreach ( $key as $k ) {
875
+					$query = add_query_arg( $k, false, $query );
876
+		}
846 877
 		return $query;
847 878
 	}
848 879
 	return add_query_arg( $key, false, $query );
@@ -922,16 +953,18 @@  discard block
 block discarded – undo
922 953
 function wp_remote_fopen( $uri ) {
923 954
 	$parsed_url = @parse_url( $uri );
924 955
 
925
-	if ( !$parsed_url || !is_array( $parsed_url ) )
926
-		return false;
956
+	if ( !$parsed_url || !is_array( $parsed_url ) ) {
957
+			return false;
958
+	}
927 959
 
928 960
 	$options = array();
929 961
 	$options['timeout'] = 10;
930 962
 
931 963
 	$response = wp_safe_remote_get( $uri, $options );
932 964
 
933
-	if ( is_wp_error( $response ) )
934
-		return false;
965
+	if ( is_wp_error( $response ) ) {
966
+			return false;
967
+	}
935 968
 
936 969
 	return wp_remote_retrieve_body( $response );
937 970
 }
@@ -951,9 +984,10 @@  discard block
 block discarded – undo
951 984
 	global $wp, $wp_query, $wp_the_query;
952 985
 	$wp->main( $query_vars );
953 986
 
954
-	if ( !isset($wp_the_query) )
955
-		$wp_the_query = $wp_query;
956
-}
987
+	if ( !isset($wp_the_query) ) {
988
+			$wp_the_query = $wp_query;
989
+	}
990
+	}
957 991
 
958 992
 /**
959 993
  * Retrieve the description for the HTTP status.
@@ -1038,11 +1072,12 @@  discard block
 block discarded – undo
1038 1072
 		);
1039 1073
 	}
1040 1074
 
1041
-	if ( isset( $wp_header_to_desc[$code] ) )
1042
-		return $wp_header_to_desc[$code];
1043
-	else
1044
-		return '';
1045
-}
1075
+	if ( isset( $wp_header_to_desc[$code] ) ) {
1076
+			return $wp_header_to_desc[$code];
1077
+	} else {
1078
+			return '';
1079
+	}
1080
+	}
1046 1081
 
1047 1082
 /**
1048 1083
  * Set HTTP status header.
@@ -1066,8 +1101,8 @@  discard block
 block discarded – undo
1066 1101
 
1067 1102
 	$protocol = wp_get_server_protocol();
1068 1103
 	$status_header = "$protocol $code $description";
1069
-	if ( function_exists( 'apply_filters' ) )
1070
-
1104
+	if ( function_exists( 'apply_filters' ) ) {
1105
+	
1071 1106
 		/**
1072 1107
 		 * Filter an HTTP status header.
1073 1108
 		 *
@@ -1079,6 +1114,7 @@  discard block
 block discarded – undo
1079 1114
 		 * @param string $protocol      Server protocol.
1080 1115
 		 */
1081 1116
 		$status_header = apply_filters( 'status_header', $status_header, $code, $description, $protocol );
1117
+	}
1082 1118
 
1083 1119
 	@header( $status_header, true, $code );
1084 1120
 }
@@ -1152,9 +1188,10 @@  discard block
 block discarded – undo
1152 1188
 		}
1153 1189
 	}
1154 1190
 
1155
-	foreach ( $headers as $name => $field_value )
1156
-		@header("{$name}: {$field_value}");
1157
-}
1191
+	foreach ( $headers as $name => $field_value ) {
1192
+			@header("{$name}: {$field_value}");
1193
+	}
1194
+	}
1158 1195
 
1159 1196
 /**
1160 1197
  * Set the headers for caching for 10 days with JavaScript content type.
@@ -1217,8 +1254,9 @@  discard block
 block discarded – undo
1217 1254
 	// Remove the pad, if present.
1218 1255
 	$feed = preg_replace( '/^_+/', '', $feed );
1219 1256
 
1220
-	if ( $feed == '' || $feed == 'feed' )
1221
-		$feed = get_default_feed();
1257
+	if ( $feed == '' || $feed == 'feed' ) {
1258
+			$feed = get_default_feed();
1259
+	}
1222 1260
 
1223 1261
 	if ( ! has_action( "do_feed_{$feed}" ) ) {
1224 1262
 		wp_die( __( 'ERROR: This is not a valid feed template.' ), '', array( 'response' => 404 ) );
@@ -1271,11 +1309,12 @@  discard block
 block discarded – undo
1271 1309
  * @param bool $for_comments True for the comment feed, false for normal feed.
1272 1310
  */
1273 1311
 function do_feed_rss2( $for_comments ) {
1274
-	if ( $for_comments )
1275
-		load_template( ABSPATH . WPINC . '/feed-rss2-comments.php' );
1276
-	else
1277
-		load_template( ABSPATH . WPINC . '/feed-rss2.php' );
1278
-}
1312
+	if ( $for_comments ) {
1313
+			load_template( ABSPATH . WPINC . '/feed-rss2-comments.php' );
1314
+	} else {
1315
+			load_template( ABSPATH . WPINC . '/feed-rss2.php' );
1316
+	}
1317
+	}
1279 1318
 
1280 1319
 /**
1281 1320
  * Load either Atom comment feed or Atom posts feed.
@@ -1287,11 +1326,12 @@  discard block
 block discarded – undo
1287 1326
  * @param bool $for_comments True for the comment feed, false for normal feed.
1288 1327
  */
1289 1328
 function do_feed_atom( $for_comments ) {
1290
-	if ($for_comments)
1291
-		load_template( ABSPATH . WPINC . '/feed-atom-comments.php');
1292
-	else
1293
-		load_template( ABSPATH . WPINC . '/feed-atom.php' );
1294
-}
1329
+	if ($for_comments) {
1330
+			load_template( ABSPATH . WPINC . '/feed-atom-comments.php');
1331
+	} else {
1332
+			load_template( ABSPATH . WPINC . '/feed-atom.php' );
1333
+	}
1334
+	}
1295 1335
 
1296 1336
 /**
1297 1337
  * Display the robots.txt file content.
@@ -1355,29 +1395,33 @@  discard block
 block discarded – undo
1355 1395
 	 * Check cache first. If options table goes away and we have true
1356 1396
 	 * cached, oh well.
1357 1397
 	 */
1358
-	if ( wp_cache_get( 'is_blog_installed' ) )
1359
-		return true;
1398
+	if ( wp_cache_get( 'is_blog_installed' ) ) {
1399
+			return true;
1400
+	}
1360 1401
 
1361 1402
 	$suppress = $wpdb->suppress_errors();
1362 1403
 	if ( ! wp_installing() ) {
1363 1404
 		$alloptions = wp_load_alloptions();
1364 1405
 	}
1365 1406
 	// If siteurl is not set to autoload, check it specifically
1366
-	if ( !isset( $alloptions['siteurl'] ) )
1367
-		$installed = $wpdb->get_var( "SELECT option_value FROM $wpdb->options WHERE option_name = 'siteurl'" );
1368
-	else
1369
-		$installed = $alloptions['siteurl'];
1407
+	if ( !isset( $alloptions['siteurl'] ) ) {
1408
+			$installed = $wpdb->get_var( "SELECT option_value FROM $wpdb->options WHERE option_name = 'siteurl'" );
1409
+	} else {
1410
+			$installed = $alloptions['siteurl'];
1411
+	}
1370 1412
 	$wpdb->suppress_errors( $suppress );
1371 1413
 
1372 1414
 	$installed = !empty( $installed );
1373 1415
 	wp_cache_set( 'is_blog_installed', $installed );
1374 1416
 
1375
-	if ( $installed )
1376
-		return true;
1417
+	if ( $installed ) {
1418
+			return true;
1419
+	}
1377 1420
 
1378 1421
 	// If visiting repair.php, return true and let it take over.
1379
-	if ( defined( 'WP_REPAIRING' ) )
1380
-		return true;
1422
+	if ( defined( 'WP_REPAIRING' ) ) {
1423
+			return true;
1424
+	}
1381 1425
 
1382 1426
 	$suppress = $wpdb->suppress_errors();
1383 1427
 
@@ -1389,13 +1433,16 @@  discard block
 block discarded – undo
1389 1433
 	$wp_tables = $wpdb->tables();
1390 1434
 	foreach ( $wp_tables as $table ) {
1391 1435
 		// The existence of custom user tables shouldn't suggest an insane state or prevent a clean install.
1392
-		if ( defined( 'CUSTOM_USER_TABLE' ) && CUSTOM_USER_TABLE == $table )
1393
-			continue;
1394
-		if ( defined( 'CUSTOM_USER_META_TABLE' ) && CUSTOM_USER_META_TABLE == $table )
1395
-			continue;
1436
+		if ( defined( 'CUSTOM_USER_TABLE' ) && CUSTOM_USER_TABLE == $table ) {
1437
+					continue;
1438
+		}
1439
+		if ( defined( 'CUSTOM_USER_META_TABLE' ) && CUSTOM_USER_META_TABLE == $table ) {
1440
+					continue;
1441
+		}
1396 1442
 
1397
-		if ( ! $wpdb->get_results( "DESCRIBE $table;" ) )
1398
-			continue;
1443
+		if ( ! $wpdb->get_results( "DESCRIBE $table;" ) ) {
1444
+					continue;
1445
+		}
1399 1446
 
1400 1447
 		// One or more tables exist. We are insane.
1401 1448
 
@@ -1458,11 +1505,13 @@  discard block
 block discarded – undo
1458 1505
 	$name = esc_attr( $name );
1459 1506
 	$nonce_field = '<input type="hidden" id="' . $name . '" name="' . $name . '" value="' . wp_create_nonce( $action ) . '" />';
1460 1507
 
1461
-	if ( $referer )
1462
-		$nonce_field .= wp_referer_field( false );
1508
+	if ( $referer ) {
1509
+			$nonce_field .= wp_referer_field( false );
1510
+	}
1463 1511
 
1464
-	if ( $echo )
1465
-		echo $nonce_field;
1512
+	if ( $echo ) {
1513
+			echo $nonce_field;
1514
+	}
1466 1515
 
1467 1516
 	return $nonce_field;
1468 1517
 }
@@ -1481,8 +1530,9 @@  discard block
 block discarded – undo
1481 1530
 function wp_referer_field( $echo = true ) {
1482 1531
 	$referer_field = '<input type="hidden" name="_wp_http_referer" value="'. esc_attr( wp_unslash( $_SERVER['REQUEST_URI'] ) ) . '" />';
1483 1532
 
1484
-	if ( $echo )
1485
-		echo $referer_field;
1533
+	if ( $echo ) {
1534
+			echo $referer_field;
1535
+	}
1486 1536
 	return $referer_field;
1487 1537
 }
1488 1538
 
@@ -1505,8 +1555,9 @@  discard block
 block discarded – undo
1505 1555
 		$ref = 'previous' == $jump_back_to ? wp_get_referer() : wp_unslash( $_SERVER['REQUEST_URI'] );
1506 1556
 	}
1507 1557
 	$orig_referer_field = '<input type="hidden" name="_wp_original_http_referer" value="' . esc_attr( $ref ) . '" />';
1508
-	if ( $echo )
1509
-		echo $orig_referer_field;
1558
+	if ( $echo ) {
1559
+			echo $orig_referer_field;
1560
+	}
1510 1561
 	return $orig_referer_field;
1511 1562
 }
1512 1563
 
@@ -1560,8 +1611,9 @@  discard block
 block discarded – undo
1560 1611
  * @return string|false False if no original referer or original referer if set.
1561 1612
  */
1562 1613
 function wp_get_original_referer() {
1563
-	if ( ! empty( $_REQUEST['_wp_original_http_referer'] ) && function_exists( 'wp_validate_redirect' ) )
1564
-		return wp_validate_redirect( wp_unslash( $_REQUEST['_wp_original_http_referer'] ), false );
1614
+	if ( ! empty( $_REQUEST['_wp_original_http_referer'] ) && function_exists( 'wp_validate_redirect' ) ) {
1615
+			return wp_validate_redirect( wp_unslash( $_REQUEST['_wp_original_http_referer'] ), false );
1616
+	}
1565 1617
 	return false;
1566 1618
 }
1567 1619
 
@@ -1596,11 +1648,13 @@  discard block
 block discarded – undo
1596 1648
 	 * Use rtrim() instead of untrailingslashit to avoid formatting.php dependency.
1597 1649
 	 */
1598 1650
 	$target = rtrim($target, '/');
1599
-	if ( empty($target) )
1600
-		$target = '/';
1651
+	if ( empty($target) ) {
1652
+			$target = '/';
1653
+	}
1601 1654
 
1602
-	if ( file_exists( $target ) )
1603
-		return @is_dir( $target );
1655
+	if ( file_exists( $target ) ) {
1656
+			return @is_dir( $target );
1657
+	}
1604 1658
 
1605 1659
 	// We need to find the permissions of the parent folder that exists and inherit that.
1606 1660
 	$target_parent = dirname( $target );
@@ -1649,15 +1703,18 @@  discard block
 block discarded – undo
1649 1703
 	 * This is definitive if true but fails if $path does not exist or contains
1650 1704
 	 * a symbolic link.
1651 1705
 	 */
1652
-	if ( realpath($path) == $path )
1653
-		return true;
1706
+	if ( realpath($path) == $path ) {
1707
+			return true;
1708
+	}
1654 1709
 
1655
-	if ( strlen($path) == 0 || $path[0] == '.' )
1656
-		return false;
1710
+	if ( strlen($path) == 0 || $path[0] == '.' ) {
1711
+			return false;
1712
+	}
1657 1713
 
1658 1714
 	// Windows allows absolute paths like this.
1659
-	if ( preg_match('#^[a-zA-Z]:\\\\#', $path) )
1660
-		return true;
1715
+	if ( preg_match('#^[a-zA-Z]:\\\\#', $path) ) {
1716
+			return true;
1717
+	}
1661 1718
 
1662 1719
 	// A path starting with / or \ is absolute; anything else is relative.
1663 1720
 	return ( $path[0] == '/' || $path[0] == '\\' );
@@ -1676,8 +1733,9 @@  discard block
 block discarded – undo
1676 1733
  * @return string The path with the base or absolute path.
1677 1734
  */
1678 1735
 function path_join( $base, $path ) {
1679
-	if ( path_is_absolute($path) )
1680
-		return $path;
1736
+	if ( path_is_absolute($path) ) {
1737
+			return $path;
1738
+	}
1681 1739
 
1682 1740
 	return rtrim($base, '/') . '/' . ltrim($path, '/');
1683 1741
 }
@@ -1724,25 +1782,30 @@  discard block
 block discarded – undo
1724 1782
  */
1725 1783
 function get_temp_dir() {
1726 1784
 	static $temp = '';
1727
-	if ( defined('WP_TEMP_DIR') )
1728
-		return trailingslashit(WP_TEMP_DIR);
1785
+	if ( defined('WP_TEMP_DIR') ) {
1786
+			return trailingslashit(WP_TEMP_DIR);
1787
+	}
1729 1788
 
1730
-	if ( $temp )
1731
-		return trailingslashit( $temp );
1789
+	if ( $temp ) {
1790
+			return trailingslashit( $temp );
1791
+	}
1732 1792
 
1733 1793
 	if ( function_exists('sys_get_temp_dir') ) {
1734 1794
 		$temp = sys_get_temp_dir();
1735
-		if ( @is_dir( $temp ) && wp_is_writable( $temp ) )
1736
-			return trailingslashit( $temp );
1795
+		if ( @is_dir( $temp ) && wp_is_writable( $temp ) ) {
1796
+					return trailingslashit( $temp );
1797
+		}
1737 1798
 	}
1738 1799
 
1739 1800
 	$temp = ini_get('upload_tmp_dir');
1740
-	if ( @is_dir( $temp ) && wp_is_writable( $temp ) )
1741
-		return trailingslashit( $temp );
1801
+	if ( @is_dir( $temp ) && wp_is_writable( $temp ) ) {
1802
+			return trailingslashit( $temp );
1803
+	}
1742 1804
 
1743 1805
 	$temp = WP_CONTENT_DIR . '/';
1744
-	if ( is_dir( $temp ) && wp_is_writable( $temp ) )
1745
-		return $temp;
1806
+	if ( is_dir( $temp ) && wp_is_writable( $temp ) ) {
1807
+			return $temp;
1808
+	}
1746 1809
 
1747 1810
 	return '/tmp/';
1748 1811
 }
@@ -1761,11 +1824,12 @@  discard block
 block discarded – undo
1761 1824
  * @return bool Whether the path is writable.
1762 1825
  */
1763 1826
 function wp_is_writable( $path ) {
1764
-	if ( 'WIN' === strtoupper( substr( PHP_OS, 0, 3 ) ) )
1765
-		return win_is_writable( $path );
1766
-	else
1767
-		return @is_writable( $path );
1768
-}
1827
+	if ( 'WIN' === strtoupper( substr( PHP_OS, 0, 3 ) ) ) {
1828
+			return win_is_writable( $path );
1829
+	} else {
1830
+			return @is_writable( $path );
1831
+	}
1832
+	}
1769 1833
 
1770 1834
 /**
1771 1835
  * Workaround for Windows bug in is_writable() function
@@ -1793,11 +1857,13 @@  discard block
 block discarded – undo
1793 1857
 	// check tmp file for read/write capabilities
1794 1858
 	$should_delete_tmp_file = !file_exists( $path );
1795 1859
 	$f = @fopen( $path, 'a' );
1796
-	if ( $f === false )
1797
-		return false;
1860
+	if ( $f === false ) {
1861
+			return false;
1862
+	}
1798 1863
 	fclose( $f );
1799
-	if ( $should_delete_tmp_file )
1800
-		unlink( $path );
1864
+	if ( $should_delete_tmp_file ) {
1865
+			unlink( $path );
1866
+	}
1801 1867
 	return true;
1802 1868
 }
1803 1869
 
@@ -1921,10 +1987,11 @@  discard block
 block discarded – undo
1921 1987
 	}
1922 1988
 
1923 1989
 	if ( !$url = get_option( 'upload_url_path' ) ) {
1924
-		if ( empty($upload_path) || ( 'wp-content/uploads' == $upload_path ) || ( $upload_path == $dir ) )
1925
-			$url = WP_CONTENT_URL . '/uploads';
1926
-		else
1927
-			$url = trailingslashit( $siteurl ) . $upload_path;
1990
+		if ( empty($upload_path) || ( 'wp-content/uploads' == $upload_path ) || ( $upload_path == $dir ) ) {
1991
+					$url = WP_CONTENT_URL . '/uploads';
1992
+		} else {
1993
+					$url = trailingslashit( $siteurl ) . $upload_path;
1994
+		}
1928 1995
 	}
1929 1996
 
1930 1997
 	/*
@@ -1949,10 +2016,11 @@  discard block
 block discarded – undo
1949 2016
 			 * had wp-content/uploads for the main site.)
1950 2017
 			 */
1951 2018
 
1952
-			if ( defined( 'MULTISITE' ) )
1953
-				$ms_dir = '/sites/' . get_current_blog_id();
1954
-			else
1955
-				$ms_dir = '/' . get_current_blog_id();
2019
+			if ( defined( 'MULTISITE' ) ) {
2020
+							$ms_dir = '/sites/' . get_current_blog_id();
2021
+			} else {
2022
+							$ms_dir = '/' . get_current_blog_id();
2023
+			}
1956 2024
 
1957 2025
 			$dir .= $ms_dir;
1958 2026
 			$url .= $ms_dir;
@@ -1972,10 +2040,11 @@  discard block
 block discarded – undo
1972 2040
 			 * rewriting in multisite, the resulting URL is /files. (#WP22702 for background.)
1973 2041
 			 */
1974 2042
 
1975
-			if ( defined( 'BLOGUPLOADDIR' ) )
1976
-				$dir = untrailingslashit( BLOGUPLOADDIR );
1977
-			else
1978
-				$dir = ABSPATH . UPLOADS;
2043
+			if ( defined( 'BLOGUPLOADDIR' ) ) {
2044
+							$dir = untrailingslashit( BLOGUPLOADDIR );
2045
+			} else {
2046
+							$dir = ABSPATH . UPLOADS;
2047
+			}
1979 2048
 			$url = trailingslashit( $siteurl ) . 'files';
1980 2049
 		}
1981 2050
 	}
@@ -1986,8 +2055,9 @@  discard block
 block discarded – undo
1986 2055
 	$subdir = '';
1987 2056
 	if ( get_option( 'uploads_use_yearmonth_folders' ) ) {
1988 2057
 		// Generate the yearly and monthly dirs
1989
-		if ( !$time )
1990
-			$time = current_time( 'mysql' );
2058
+		if ( !$time ) {
2059
+					$time = current_time( 'mysql' );
2060
+		}
1991 2061
 		$y = substr( $time, 0, 4 );
1992 2062
 		$m = substr( $time, 5, 2 );
1993 2063
 		$subdir = "/$y/$m";
@@ -2033,8 +2103,9 @@  discard block
 block discarded – undo
2033 2103
 	$name = basename($filename, $ext);
2034 2104
 
2035 2105
 	// Edge case: if file is named '.ext', treat as an empty name.
2036
-	if ( $name === $ext )
2037
-		$name = '';
2106
+	if ( $name === $ext ) {
2107
+			$name = '';
2108
+	}
2038 2109
 
2039 2110
 	/*
2040 2111
 	 * Increment the file number until we have a unique file to save in $dir.
@@ -2108,20 +2179,24 @@  discard block
 block discarded – undo
2108 2179
  * @return array
2109 2180
  */
2110 2181
 function wp_upload_bits( $name, $deprecated, $bits, $time = null ) {
2111
-	if ( !empty( $deprecated ) )
2112
-		_deprecated_argument( __FUNCTION__, '2.0' );
2182
+	if ( !empty( $deprecated ) ) {
2183
+			_deprecated_argument( __FUNCTION__, '2.0' );
2184
+	}
2113 2185
 
2114
-	if ( empty( $name ) )
2115
-		return array( 'error' => __( 'Empty filename' ) );
2186
+	if ( empty( $name ) ) {
2187
+			return array( 'error' => __( 'Empty filename' ) );
2188
+	}
2116 2189
 
2117 2190
 	$wp_filetype = wp_check_filetype( $name );
2118
-	if ( ! $wp_filetype['ext'] && ! current_user_can( 'unfiltered_upload' ) )
2119
-		return array( 'error' => __( 'Invalid file type' ) );
2191
+	if ( ! $wp_filetype['ext'] && ! current_user_can( 'unfiltered_upload' ) ) {
2192
+			return array( 'error' => __( 'Invalid file type' ) );
2193
+	}
2120 2194
 
2121 2195
 	$upload = wp_upload_dir( $time );
2122 2196
 
2123
-	if ( $upload['error'] !== false )
2124
-		return $upload;
2197
+	if ( $upload['error'] !== false ) {
2198
+			return $upload;
2199
+	}
2125 2200
 
2126 2201
 	/**
2127 2202
 	 * Filter whether to treat the upload bits as an error.
@@ -2143,18 +2218,20 @@  discard block
 block discarded – undo
2143 2218
 
2144 2219
 	$new_file = $upload['path'] . "/$filename";
2145 2220
 	if ( ! wp_mkdir_p( dirname( $new_file ) ) ) {
2146
-		if ( 0 === strpos( $upload['basedir'], ABSPATH ) )
2147
-			$error_path = str_replace( ABSPATH, '', $upload['basedir'] ) . $upload['subdir'];
2148
-		else
2149
-			$error_path = basename( $upload['basedir'] ) . $upload['subdir'];
2221
+		if ( 0 === strpos( $upload['basedir'], ABSPATH ) ) {
2222
+					$error_path = str_replace( ABSPATH, '', $upload['basedir'] ) . $upload['subdir'];
2223
+		} else {
2224
+					$error_path = basename( $upload['basedir'] ) . $upload['subdir'];
2225
+		}
2150 2226
 
2151 2227
 		$message = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), $error_path );
2152 2228
 		return array( 'error' => $message );
2153 2229
 	}
2154 2230
 
2155 2231
 	$ifp = @ fopen( $new_file, 'wb' );
2156
-	if ( ! $ifp )
2157
-		return array( 'error' => sprintf( __( 'Could not write file %s' ), $new_file ) );
2232
+	if ( ! $ifp ) {
2233
+			return array( 'error' => sprintf( __( 'Could not write file %s' ), $new_file ) );
2234
+	}
2158 2235
 
2159 2236
 	@fwrite( $ifp, $bits );
2160 2237
 	fclose( $ifp );
@@ -2207,10 +2284,11 @@  discard block
 block discarded – undo
2207 2284
 		'code'        => array( 'css', 'htm',  'html', 'php',  'js' ),
2208 2285
 	) );
2209 2286
 
2210
-	foreach ( $ext2type as $type => $exts )
2211
-		if ( in_array( $ext, $exts ) )
2287
+	foreach ( $ext2type as $type => $exts ) {
2288
+			if ( in_array( $ext, $exts ) )
2212 2289
 			return $type;
2213
-}
2290
+	}
2291
+	}
2214 2292
 
2215 2293
 /**
2216 2294
  * Retrieve the file type from the file name.
@@ -2224,8 +2302,9 @@  discard block
 block discarded – undo
2224 2302
  * @return array Values with extension first and mime type.
2225 2303
  */
2226 2304
 function wp_check_filetype( $filename, $mimes = null ) {
2227
-	if ( empty($mimes) )
2228
-		$mimes = get_allowed_mime_types();
2305
+	if ( empty($mimes) ) {
2306
+			$mimes = get_allowed_mime_types();
2307
+	}
2229 2308
 	$type = false;
2230 2309
 	$ext = false;
2231 2310
 
@@ -2464,11 +2543,13 @@  discard block
 block discarded – undo
2464 2543
 	$t = wp_get_mime_types();
2465 2544
 
2466 2545
 	unset( $t['swf'], $t['exe'] );
2467
-	if ( function_exists( 'current_user_can' ) )
2468
-		$unfiltered = $user ? user_can( $user, 'unfiltered_html' ) : current_user_can( 'unfiltered_html' );
2546
+	if ( function_exists( 'current_user_can' ) ) {
2547
+			$unfiltered = $user ? user_can( $user, 'unfiltered_html' ) : current_user_can( 'unfiltered_html' );
2548
+	}
2469 2549
 
2470
-	if ( empty( $unfiltered ) )
2471
-		unset( $t['htm|html'] );
2550
+	if ( empty( $unfiltered ) ) {
2551
+			unset( $t['htm|html'] );
2552
+	}
2472 2553
 
2473 2554
 	/**
2474 2555
 	 * Filter list of allowed mime types and file extensions.
@@ -2500,8 +2581,9 @@  discard block
 block discarded – undo
2500 2581
 		$html .= sprintf( __( "Do you really want to <a href='%s'>log out</a>?"), wp_logout_url( $redirect_to ) );
2501 2582
 	} else {
2502 2583
 		$html = __( 'Are you sure you want to do this?' );
2503
-		if ( wp_get_referer() )
2504
-			$html .= "</p><p><a href='" . esc_url( remove_query_arg( 'updated', wp_get_referer() ) ) . "'>" . __( 'Please try again.' ) . "</a>";
2584
+		if ( wp_get_referer() ) {
2585
+					$html .= "</p><p><a href='" . esc_url( remove_query_arg( 'updated', wp_get_referer() ) ) . "'>" . __( 'Please try again.' ) . "</a>";
2586
+		}
2505 2587
 	}
2506 2588
 
2507 2589
 	wp_die( $html, __( 'WordPress Failure Notice' ), 403 );
@@ -2603,8 +2685,9 @@  discard block
 block discarded – undo
2603 2685
 	if ( function_exists( 'is_wp_error' ) && is_wp_error( $message ) ) {
2604 2686
 		if ( empty( $title ) ) {
2605 2687
 			$error_data = $message->get_error_data();
2606
-			if ( is_array( $error_data ) && isset( $error_data['title'] ) )
2607
-				$title = $error_data['title'];
2688
+			if ( is_array( $error_data ) && isset( $error_data['title'] ) ) {
2689
+							$title = $error_data['title'];
2690
+			}
2608 2691
 		}
2609 2692
 		$errors = $message->get_error_messages();
2610 2693
 		switch ( count( $errors ) ) {
@@ -2634,19 +2717,26 @@  discard block
 block discarded – undo
2634 2717
 			header( 'Content-Type: text/html; charset=utf-8' );
2635 2718
 		}
2636 2719
 
2637
-		if ( empty($title) )
2638
-			$title = $have_gettext ? __('WordPress &rsaquo; Error') : 'WordPress &rsaquo; Error';
2720
+		if ( empty($title) ) {
2721
+					$title = $have_gettext ? __('WordPress &rsaquo; Error') : 'WordPress &rsaquo; Error';
2722
+		}
2639 2723
 
2640 2724
 		$text_direction = 'ltr';
2641
-		if ( isset($r['text_direction']) && 'rtl' == $r['text_direction'] )
2642
-			$text_direction = 'rtl';
2643
-		elseif ( function_exists( 'is_rtl' ) && is_rtl() )
2644
-			$text_direction = 'rtl';
2645
-?>
2725
+		if ( isset($r['text_direction']) && 'rtl' == $r['text_direction'] ) {
2726
+					$text_direction = 'rtl';
2727
+		} elseif ( function_exists( 'is_rtl' ) && is_rtl() ) {
2728
+					$text_direction = 'rtl';
2729
+		}
2730
+		?>
2646 2731
 <!DOCTYPE html>
2647 2732
 <!-- Ticket #11289, IE bug fix: always pad the error page with enough characters such that it is greater than 512 bytes, even after gzip compression abcdefghijklmnopqrstuvwxyz1234567890aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz11223344556677889900abacbcbdcdcededfefegfgfhghgihihjijikjkjlklkmlmlnmnmononpopoqpqprqrqsrsrtstsubcbcdcdedefefgfabcadefbghicjkldmnoepqrfstugvwxhyz1i234j567k890laabmbccnddeoeffpgghqhiirjjksklltmmnunoovppqwqrrxsstytuuzvvw0wxx1yyz2z113223434455666777889890091abc2def3ghi4jkl5mno6pqr7stu8vwx9yz11aab2bcc3dd4ee5ff6gg7hh8ii9j0jk1kl2lmm3nnoo4p5pq6qrr7ss8tt9uuvv0wwx1x2yyzz13aba4cbcb5dcdc6dedfef8egf9gfh0ghg1ihi2hji3jik4jkj5lkl6kml7mln8mnm9ono
2648 2733
 -->
2649
-<html xmlns="http://www.w3.org/1999/xhtml" <?php if ( function_exists( 'language_attributes' ) && function_exists( 'is_rtl' ) ) language_attributes(); else echo "dir='$text_direction'"; ?>>
2734
+<html xmlns="http://www.w3.org/1999/xhtml" <?php if ( function_exists( 'language_attributes' ) && function_exists( 'is_rtl' ) ) {
2735
+	language_attributes();
2736
+} else {
2737
+	echo "dir='$text_direction'";
2738
+}
2739
+?>>
2650 2740
 <head>
2651 2741
 	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
2652 2742
 	<meta name="viewport" content="width=device-width">
@@ -2815,8 +2905,9 @@  discard block
 block discarded – undo
2815 2905
  * @param string $message Optional. Response to print. Default empty.
2816 2906
  */
2817 2907
 function _ajax_wp_die_handler( $message = '' ) {
2818
-	if ( is_scalar( $message ) )
2819
-		die( (string) $message );
2908
+	if ( is_scalar( $message ) ) {
2909
+			die( (string) $message );
2910
+	}
2820 2911
 	die( '0' );
2821 2912
 }
2822 2913
 
@@ -2831,8 +2922,9 @@  discard block
 block discarded – undo
2831 2922
  * @param string $message Optional. Response to print. Default empty.
2832 2923
  */
2833 2924
 function _scalar_wp_die_handler( $message = '' ) {
2834
-	if ( is_scalar( $message ) )
2835
-		die( (string) $message );
2925
+	if ( is_scalar( $message ) ) {
2926
+			die( (string) $message );
2927
+	}
2836 2928
 	die();
2837 2929
 }
2838 2930
 
@@ -3038,11 +3130,12 @@  discard block
 block discarded – undo
3038 3130
 function wp_send_json( $response ) {
3039 3131
 	@header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
3040 3132
 	echo wp_json_encode( $response );
3041
-	if ( defined( 'DOING_AJAX' ) && DOING_AJAX )
3042
-		wp_die();
3043
-	else
3044
-		die;
3045
-}
3133
+	if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
3134
+			wp_die();
3135
+	} else {
3136
+			die;
3137
+	}
3138
+	}
3046 3139
 
3047 3140
 /**
3048 3141
  * Send a JSON response back to an Ajax request, indicating success.
@@ -3054,8 +3147,9 @@  discard block
 block discarded – undo
3054 3147
 function wp_send_json_success( $data = null ) {
3055 3148
 	$response = array( 'success' => true );
3056 3149
 
3057
-	if ( isset( $data ) )
3058
-		$response['data'] = $data;
3150
+	if ( isset( $data ) ) {
3151
+			$response['data'] = $data;
3152
+	}
3059 3153
 
3060 3154
 	wp_send_json( $response );
3061 3155
 }
@@ -3111,8 +3205,9 @@  discard block
 block discarded – undo
3111 3205
  * @return string Homepage location.
3112 3206
  */
3113 3207
 function _config_wp_home( $url = '' ) {
3114
-	if ( defined( 'WP_HOME' ) )
3115
-		return untrailingslashit( WP_HOME );
3208
+	if ( defined( 'WP_HOME' ) ) {
3209
+			return untrailingslashit( WP_HOME );
3210
+	}
3116 3211
 	return $url;
3117 3212
 }
3118 3213
 
@@ -3132,8 +3227,9 @@  discard block
 block discarded – undo
3132 3227
  * @return string The WordPress Site URL.
3133 3228
  */
3134 3229
 function _config_wp_siteurl( $url = '' ) {
3135
-	if ( defined( 'WP_SITEURL' ) )
3136
-		return untrailingslashit( WP_SITEURL );
3230
+	if ( defined( 'WP_SITEURL' ) ) {
3231
+			return untrailingslashit( WP_SITEURL );
3232
+	}
3137 3233
 	return $url;
3138 3234
 }
3139 3235
 
@@ -3197,8 +3293,9 @@  discard block
 block discarded – undo
3197 3293
 	global $wpsmiliestrans, $wp_smiliessearch;
3198 3294
 
3199 3295
 	// don't bother setting up smilies if they are disabled
3200
-	if ( !get_option( 'use_smilies' ) )
3201
-		return;
3296
+	if ( !get_option( 'use_smilies' ) ) {
3297
+			return;
3298
+	}
3202 3299
 
3203 3300
 	if ( !isset( $wpsmiliestrans ) ) {
3204 3301
 		$wpsmiliestrans = array(
@@ -3302,15 +3399,17 @@  discard block
 block discarded – undo
3302 3399
  * @return array Merged user defined values with defaults.
3303 3400
  */
3304 3401
 function wp_parse_args( $args, $defaults = '' ) {
3305
-	if ( is_object( $args ) )
3306
-		$r = get_object_vars( $args );
3307
-	elseif ( is_array( $args ) )
3308
-		$r =& $args;
3309
-	else
3310
-		wp_parse_str( $args, $r );
3311
-
3312
-	if ( is_array( $defaults ) )
3313
-		return array_merge( $defaults, $r );
3402
+	if ( is_object( $args ) ) {
3403
+			$r = get_object_vars( $args );
3404
+	} elseif ( is_array( $args ) ) {
3405
+			$r =& $args;
3406
+	} else {
3407
+			wp_parse_str( $args, $r );
3408
+	}
3409
+
3410
+	if ( is_array( $defaults ) ) {
3411
+			return array_merge( $defaults, $r );
3412
+	}
3314 3413
 	return $r;
3315 3414
 }
3316 3415
 
@@ -3323,8 +3422,9 @@  discard block
 block discarded – undo
3323 3422
  * @return array Sanitized array of IDs.
3324 3423
  */
3325 3424
 function wp_parse_id_list( $list ) {
3326
-	if ( !is_array($list) )
3327
-		$list = preg_split('/[\s,]+/', $list);
3425
+	if ( !is_array($list) ) {
3426
+			$list = preg_split('/[\s,]+/', $list);
3427
+	}
3328 3428
 
3329 3429
 	return array_unique(array_map('absint', $list));
3330 3430
 }
@@ -3340,9 +3440,10 @@  discard block
 block discarded – undo
3340 3440
  */
3341 3441
 function wp_array_slice_assoc( $array, $keys ) {
3342 3442
 	$slice = array();
3343
-	foreach ( $keys as $key )
3344
-		if ( isset( $array[ $key ] ) )
3443
+	foreach ( $keys as $key ) {
3444
+			if ( isset( $array[ $key ] ) )
3345 3445
 			$slice[ $key ] = $array[ $key ];
3446
+	}
3346 3447
 
3347 3448
 	return $slice;
3348 3449
 }
@@ -3382,13 +3483,15 @@  discard block
 block discarded – undo
3382 3483
  * @return array A list of objects or object fields.
3383 3484
  */
3384 3485
 function wp_filter_object_list( $list, $args = array(), $operator = 'and', $field = false ) {
3385
-	if ( ! is_array( $list ) )
3386
-		return array();
3486
+	if ( ! is_array( $list ) ) {
3487
+			return array();
3488
+	}
3387 3489
 
3388 3490
 	$list = wp_list_filter( $list, $args, $operator );
3389 3491
 
3390
-	if ( $field )
3391
-		$list = wp_list_pluck( $list, $field );
3492
+	if ( $field ) {
3493
+			$list = wp_list_pluck( $list, $field );
3494
+	}
3392 3495
 
3393 3496
 	return $list;
3394 3497
 }
@@ -3408,11 +3511,13 @@  discard block
 block discarded – undo
3408 3511
  * @return array Array of found values.
3409 3512
  */
3410 3513
 function wp_list_filter( $list, $args = array(), $operator = 'AND' ) {
3411
-	if ( ! is_array( $list ) )
3412
-		return array();
3514
+	if ( ! is_array( $list ) ) {
3515
+			return array();
3516
+	}
3413 3517
 
3414
-	if ( empty( $args ) )
3415
-		return $list;
3518
+	if ( empty( $args ) ) {
3519
+			return $list;
3520
+	}
3416 3521
 
3417 3522
 	$operator = strtoupper( $operator );
3418 3523
 	$count = count( $args );
@@ -3423,8 +3528,9 @@  discard block
 block discarded – undo
3423 3528
 
3424 3529
 		$matched = 0;
3425 3530
 		foreach ( $args as $m_key => $m_value ) {
3426
-			if ( array_key_exists( $m_key, $to_match ) && $m_value == $to_match[ $m_key ] )
3427
-				$matched++;
3531
+			if ( array_key_exists( $m_key, $to_match ) && $m_value == $to_match[ $m_key ] ) {
3532
+							$matched++;
3533
+			}
3428 3534
 		}
3429 3535
 
3430 3536
 		if ( ( 'AND' == $operator && $matched == $count )
@@ -3533,8 +3639,9 @@  discard block
 block discarded – undo
3533 3639
 function wp_widgets_add_menu() {
3534 3640
 	global $submenu;
3535 3641
 
3536
-	if ( ! current_theme_supports( 'widgets' ) )
3537
-		return;
3642
+	if ( ! current_theme_supports( 'widgets' ) ) {
3643
+			return;
3644
+	}
3538 3645
 
3539 3646
 	$submenu['themes.php'][7] = array( __( 'Widgets' ), 'edit_theme_options', 'widgets.php' );
3540 3647
 	ksort( $submenu['themes.php'], SORT_NUMERIC );
@@ -3549,9 +3656,10 @@  discard block
 block discarded – undo
3549 3656
  */
3550 3657
 function wp_ob_end_flush_all() {
3551 3658
 	$levels = ob_get_level();
3552
-	for ($i=0; $i<$levels; $i++)
3553
-		ob_end_flush();
3554
-}
3659
+	for ($i=0; $i<$levels; $i++) {
3660
+			ob_end_flush();
3661
+	}
3662
+	}
3555 3663
 
3556 3664
 /**
3557 3665
  * Load custom DB error or display WordPress DB error.
@@ -3583,8 +3691,9 @@  discard block
 block discarded – undo
3583 3691
 	}
3584 3692
 
3585 3693
 	// If installing or in the admin, provide the verbose message.
3586
-	if ( wp_installing() || defined( 'WP_ADMIN' ) )
3587
-		wp_die($wpdb->error);
3694
+	if ( wp_installing() || defined( 'WP_ADMIN' ) ) {
3695
+			wp_die($wpdb->error);
3696
+	}
3588 3697
 
3589 3698
 	// Otherwise, be terse.
3590 3699
 	status_header( 500 );
@@ -3592,7 +3701,10 @@  discard block
 block discarded – undo
3592 3701
 	header( 'Content-Type: text/html; charset=utf-8' );
3593 3702
 ?>
3594 3703
 <!DOCTYPE html>
3595
-<html xmlns="http://www.w3.org/1999/xhtml"<?php if ( is_rtl() ) echo ' dir="rtl"'; ?>>
3704
+<html xmlns="http://www.w3.org/1999/xhtml"<?php if ( is_rtl() ) {
3705
+	echo ' dir="rtl"';
3706
+}
3707
+?>>
3596 3708
 <head>
3597 3709
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
3598 3710
 	<title><?php _e( 'Database Error' ); ?></title>
@@ -3658,15 +3770,17 @@  discard block
 block discarded – undo
3658 3770
 	 */
3659 3771
 	if ( WP_DEBUG && apply_filters( 'deprecated_function_trigger_error', true ) ) {
3660 3772
 		if ( function_exists( '__' ) ) {
3661
-			if ( ! is_null( $replacement ) )
3662
-				trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $function, $version, $replacement ) );
3663
-			else
3664
-				trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version ) );
3773
+			if ( ! is_null( $replacement ) ) {
3774
+							trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $function, $version, $replacement ) );
3775
+			} else {
3776
+							trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version ) );
3777
+			}
3665 3778
 		} else {
3666
-			if ( ! is_null( $replacement ) )
3667
-				trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $function, $version, $replacement ) );
3668
-			else
3669
-				trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', $function, $version ) );
3779
+			if ( ! is_null( $replacement ) ) {
3780
+							trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $function, $version, $replacement ) );
3781
+			} else {
3782
+							trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', $function, $version ) );
3783
+			}
3670 3784
 		}
3671 3785
 	}
3672 3786
 }
@@ -3782,15 +3896,17 @@  discard block
 block discarded – undo
3782 3896
 	if ( WP_DEBUG && apply_filters( 'deprecated_file_trigger_error', true ) ) {
3783 3897
 		$message = empty( $message ) ? '' : ' ' . $message;
3784 3898
 		if ( function_exists( '__' ) ) {
3785
-			if ( ! is_null( $replacement ) )
3786
-				trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $file, $version, $replacement ) . $message );
3787
-			else
3788
-				trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $file, $version ) . $message );
3899
+			if ( ! is_null( $replacement ) ) {
3900
+							trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $file, $version, $replacement ) . $message );
3901
+			} else {
3902
+							trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $file, $version ) . $message );
3903
+			}
3789 3904
 		} else {
3790
-			if ( ! is_null( $replacement ) )
3791
-				trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $file, $version, $replacement ) . $message );
3792
-			else
3793
-				trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', $file, $version ) . $message );
3905
+			if ( ! is_null( $replacement ) ) {
3906
+							trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $file, $version, $replacement ) . $message );
3907
+			} else {
3908
+							trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', $file, $version ) . $message );
3909
+			}
3794 3910
 		}
3795 3911
 	}
3796 3912
 }
@@ -3842,15 +3958,17 @@  discard block
 block discarded – undo
3842 3958
 	 */
3843 3959
 	if ( WP_DEBUG && apply_filters( 'deprecated_argument_trigger_error', true ) ) {
3844 3960
 		if ( function_exists( '__' ) ) {
3845
-			if ( ! is_null( $message ) )
3846
-				trigger_error( sprintf( __('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s'), $function, $version, $message ) );
3847
-			else
3848
-				trigger_error( sprintf( __('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version ) );
3961
+			if ( ! is_null( $message ) ) {
3962
+							trigger_error( sprintf( __('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s'), $function, $version, $message ) );
3963
+			} else {
3964
+							trigger_error( sprintf( __('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version ) );
3965
+			}
3849 3966
 		} else {
3850
-			if ( ! is_null( $message ) )
3851
-				trigger_error( sprintf( '%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s', $function, $version, $message ) );
3852
-			else
3853
-				trigger_error( sprintf( '%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.', $function, $version ) );
3967
+			if ( ! is_null( $message ) ) {
3968
+							trigger_error( sprintf( '%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s', $function, $version, $message ) );
3969
+			} else {
3970
+							trigger_error( sprintf( '%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.', $function, $version ) );
3971
+			}
3854 3972
 		}
3855 3973
 	}
3856 3974
 }
@@ -3936,19 +4054,22 @@  discard block
 block discarded – undo
3936 4054
 function apache_mod_loaded($mod, $default = false) {
3937 4055
 	global $is_apache;
3938 4056
 
3939
-	if ( !$is_apache )
3940
-		return false;
4057
+	if ( !$is_apache ) {
4058
+			return false;
4059
+	}
3941 4060
 
3942 4061
 	if ( function_exists( 'apache_get_modules' ) ) {
3943 4062
 		$mods = apache_get_modules();
3944
-		if ( in_array($mod, $mods) )
3945
-			return true;
4063
+		if ( in_array($mod, $mods) ) {
4064
+					return true;
4065
+		}
3946 4066
 	} elseif ( function_exists( 'phpinfo' ) && false === strpos( ini_get( 'disable_functions' ), 'phpinfo' ) ) {
3947 4067
 			ob_start();
3948 4068
 			phpinfo(8);
3949 4069
 			$phpinfo = ob_get_clean();
3950
-			if ( false !== strpos($phpinfo, $mod) )
3951
-				return true;
4070
+			if ( false !== strpos($phpinfo, $mod) ) {
4071
+							return true;
4072
+			}
3952 4073
 	}
3953 4074
 	return $default;
3954 4075
 }
@@ -4004,17 +4125,21 @@  discard block
 block discarded – undo
4004 4125
  * @return int 0 means nothing is wrong, greater than 0 means something was wrong.
4005 4126
  */
4006 4127
 function validate_file( $file, $allowed_files = '' ) {
4007
-	if ( false !== strpos( $file, '..' ) )
4008
-		return 1;
4128
+	if ( false !== strpos( $file, '..' ) ) {
4129
+			return 1;
4130
+	}
4009 4131
 
4010
-	if ( false !== strpos( $file, './' ) )
4011
-		return 1;
4132
+	if ( false !== strpos( $file, './' ) ) {
4133
+			return 1;
4134
+	}
4012 4135
 
4013
-	if ( ! empty( $allowed_files ) && ! in_array( $file, $allowed_files ) )
4014
-		return 3;
4136
+	if ( ! empty( $allowed_files ) && ! in_array( $file, $allowed_files ) ) {
4137
+			return 3;
4138
+	}
4015 4139
 
4016
-	if (':' == substr( $file, 1, 1 ) )
4017
-		return 2;
4140
+	if (':' == substr( $file, 1, 1 ) ) {
4141
+			return 2;
4142
+	}
4018 4143
 
4019 4144
 	return 0;
4020 4145
 }
@@ -4028,10 +4153,12 @@  discard block
 block discarded – undo
4028 4153
  */
4029 4154
 function is_ssl() {
4030 4155
 	if ( isset($_SERVER['HTTPS']) ) {
4031
-		if ( 'on' == strtolower($_SERVER['HTTPS']) )
4032
-			return true;
4033
-		if ( '1' == $_SERVER['HTTPS'] )
4034
-			return true;
4156
+		if ( 'on' == strtolower($_SERVER['HTTPS']) ) {
4157
+					return true;
4158
+		}
4159
+		if ( '1' == $_SERVER['HTTPS'] ) {
4160
+					return true;
4161
+		}
4035 4162
 	} elseif ( isset($_SERVER['SERVER_PORT']) && ( '443' == $_SERVER['SERVER_PORT'] ) ) {
4036 4163
 		return true;
4037 4164
 	}
@@ -4129,8 +4256,9 @@  discard block
 block discarded – undo
4129 4256
 function wp_suspend_cache_addition( $suspend = null ) {
4130 4257
 	static $_suspend = false;
4131 4258
 
4132
-	if ( is_bool( $suspend ) )
4133
-		$_suspend = $suspend;
4259
+	if ( is_bool( $suspend ) ) {
4260
+			$_suspend = $suspend;
4261
+	}
4134 4262
 
4135 4263
 	return $_suspend;
4136 4264
 }
@@ -4173,11 +4301,13 @@  discard block
 block discarded – undo
4173 4301
 	// This is the current network's information; 'site' is old terminology.
4174 4302
 	global $current_site;
4175 4303
 
4176
-	if ( ! is_multisite() )
4177
-		return true;
4304
+	if ( ! is_multisite() ) {
4305
+			return true;
4306
+	}
4178 4307
 
4179
-	if ( ! $site_id )
4180
-		$site_id = get_current_blog_id();
4308
+	if ( ! $site_id ) {
4309
+			$site_id = get_current_blog_id();
4310
+	}
4181 4311
 
4182 4312
 	return (int) $site_id === (int) $current_site->blog_id;
4183 4313
 }
@@ -4256,8 +4386,9 @@  discard block
 block discarded – undo
4256 4386
  * @return bool True if multisite and global terms enabled.
4257 4387
  */
4258 4388
 function global_terms_enabled() {
4259
-	if ( ! is_multisite() )
4260
-		return false;
4389
+	if ( ! is_multisite() ) {
4390
+			return false;
4391
+	}
4261 4392
 
4262 4393
 	static $global_terms = null;
4263 4394
 	if ( is_null( $global_terms ) ) {
@@ -4273,10 +4404,11 @@  discard block
 block discarded – undo
4273 4404
 		 * @param null $enabled Whether global terms are enabled.
4274 4405
 		 */
4275 4406
 		$filter = apply_filters( 'global_terms_enabled', null );
4276
-		if ( ! is_null( $filter ) )
4277
-			$global_terms = (bool) $filter;
4278
-		else
4279
-			$global_terms = (bool) get_site_option( 'global_terms_enabled', false );
4407
+		if ( ! is_null( $filter ) ) {
4408
+					$global_terms = (bool) $filter;
4409
+		} else {
4410
+					$global_terms = (bool) get_site_option( 'global_terms_enabled', false );
4411
+		}
4280 4412
 	}
4281 4413
 	return $global_terms;
4282 4414
 }
@@ -4452,8 +4584,9 @@  discard block
 block discarded – undo
4452 4584
 	// Do UTC
4453 4585
 	$structure[] = '<optgroup label="'. esc_attr__( 'UTC' ) .'">';
4454 4586
 	$selected = '';
4455
-	if ( 'UTC' === $selected_zone )
4456
-		$selected = 'selected="selected" ';
4587
+	if ( 'UTC' === $selected_zone ) {
4588
+			$selected = 'selected="selected" ';
4589
+	}
4457 4590
 	$structure[] = '<option ' . $selected . 'value="' . esc_attr( 'UTC' ) . '">' . __('UTC') . '</option>';
4458 4591
 	$structure[] = '</optgroup>';
4459 4592
 
@@ -4462,18 +4595,20 @@  discard block
 block discarded – undo
4462 4595
 	$offset_range = array (-12, -11.5, -11, -10.5, -10, -9.5, -9, -8.5, -8, -7.5, -7, -6.5, -6, -5.5, -5, -4.5, -4, -3.5, -3, -2.5, -2, -1.5, -1, -0.5,
4463 4596
 		0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 5.75, 6, 6.5, 7, 7.5, 8, 8.5, 8.75, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.75, 13, 13.75, 14);
4464 4597
 	foreach ( $offset_range as $offset ) {
4465
-		if ( 0 <= $offset )
4466
-			$offset_name = '+' . $offset;
4467
-		else
4468
-			$offset_name = (string) $offset;
4598
+		if ( 0 <= $offset ) {
4599
+					$offset_name = '+' . $offset;
4600
+		} else {
4601
+					$offset_name = (string) $offset;
4602
+		}
4469 4603
 
4470 4604
 		$offset_value = $offset_name;
4471 4605
 		$offset_name = str_replace(array('.25','.5','.75'), array(':15',':30',':45'), $offset_name);
4472 4606
 		$offset_name = 'UTC' . $offset_name;
4473 4607
 		$offset_value = 'UTC' . $offset_value;
4474 4608
 		$selected = '';
4475
-		if ( $offset_value === $selected_zone )
4476
-			$selected = 'selected="selected" ';
4609
+		if ( $offset_value === $selected_zone ) {
4610
+					$selected = 'selected="selected" ';
4611
+		}
4477 4612
 		$structure[] = '<option ' . $selected . 'value="' . esc_attr( $offset_value ) . '">' . esc_html( $offset_name ) . "</option>";
4478 4613
 
4479 4614
 	}
@@ -4516,8 +4651,9 @@  discard block
 block discarded – undo
4516 4651
 
4517 4652
 	foreach ( (array) $posts_to_delete as $post ) {
4518 4653
 		$post_id = (int) $post['post_id'];
4519
-		if ( !$post_id )
4520
-			continue;
4654
+		if ( !$post_id ) {
4655
+					continue;
4656
+		}
4521 4657
 
4522 4658
 		$del_post = get_post($post_id);
4523 4659
 
@@ -4533,8 +4669,9 @@  discard block
 block discarded – undo
4533 4669
 
4534 4670
 	foreach ( (array) $comments_to_delete as $comment ) {
4535 4671
 		$comment_id = (int) $comment['comment_id'];
4536
-		if ( !$comment_id )
4537
-			continue;
4672
+		if ( !$comment_id ) {
4673
+					continue;
4674
+		}
4538 4675
 
4539 4676
 		$del_comment = get_comment($comment_id);
4540 4677
 
@@ -4598,10 +4735,11 @@  discard block
 block discarded – undo
4598 4735
 	}
4599 4736
 
4600 4737
 	foreach ( $all_headers as $field => $regex ) {
4601
-		if ( preg_match( '/^[ \t\/*#@]*' . preg_quote( $regex, '/' ) . ':(.*)$/mi', $file_data, $match ) && $match[1] )
4602
-			$all_headers[ $field ] = _cleanup_header_comment( $match[1] );
4603
-		else
4604
-			$all_headers[ $field ] = '';
4738
+		if ( preg_match( '/^[ \t\/*#@]*' . preg_quote( $regex, '/' ) . ':(.*)$/mi', $file_data, $match ) && $match[1] ) {
4739
+					$all_headers[ $field ] = _cleanup_header_comment( $match[1] );
4740
+		} else {
4741
+					$all_headers[ $field ] = '';
4742
+		}
4605 4743
 	}
4606 4744
 
4607 4745
 	return $all_headers;
@@ -4744,8 +4882,9 @@  discard block
 block discarded – undo
4744 4882
 function wp_find_hierarchy_loop( $callback, $start, $start_parent, $callback_args = array() ) {
4745 4883
 	$override = is_null( $start_parent ) ? array() : array( $start => $start_parent );
4746 4884
 
4747
-	if ( !$arbitrary_loop_member = wp_find_hierarchy_loop_tortoise_hare( $callback, $start, $override, $callback_args ) )
4748
-		return array();
4885
+	if ( !$arbitrary_loop_member = wp_find_hierarchy_loop_tortoise_hare( $callback, $start, $override, $callback_args ) ) {
4886
+			return array();
4887
+	}
4749 4888
 
4750 4889
 	return wp_find_hierarchy_loop_tortoise_hare( $callback, $arbitrary_loop_member, $override, $callback_args, true );
4751 4890
 }
@@ -4783,12 +4922,14 @@  discard block
 block discarded – undo
4783 4922
 	&&
4784 4923
 		( $hare = isset( $override[$evanescent_hare] ) ? $override[$evanescent_hare] : call_user_func_array( $callback, array_merge( array( $evanescent_hare ), $callback_args ) ) )
4785 4924
 	) {
4786
-		if ( $_return_loop )
4787
-			$return[$tortoise] = $return[$evanescent_hare] = $return[$hare] = true;
4925
+		if ( $_return_loop ) {
4926
+					$return[$tortoise] = $return[$evanescent_hare] = $return[$hare] = true;
4927
+		}
4788 4928
 
4789 4929
 		// tortoise got lapped - must be a loop
4790
-		if ( $tortoise == $evanescent_hare || $tortoise == $hare )
4791
-			return $_return_loop ? $return : $tortoise;
4930
+		if ( $tortoise == $evanescent_hare || $tortoise == $hare ) {
4931
+					return $_return_loop ? $return : $tortoise;
4932
+		}
4792 4933
 
4793 4934
 		// Increment tortoise by one step
4794 4935
 		$tortoise = isset( $override[$tortoise] ) ? $override[$tortoise] : call_user_func_array( $callback, array_merge( array( $tortoise ), $callback_args ) );
@@ -4860,10 +5001,11 @@  discard block
 block discarded – undo
4860 5001
  *                      of individual calls.
4861 5002
  */
4862 5003
 function wp_debug_backtrace_summary( $ignore_class = null, $skip_frames = 0, $pretty = true ) {
4863
-	if ( version_compare( PHP_VERSION, '5.2.5', '>=' ) )
4864
-		$trace = debug_backtrace( false );
4865
-	else
4866
-		$trace = debug_backtrace();
5004
+	if ( version_compare( PHP_VERSION, '5.2.5', '>=' ) ) {
5005
+			$trace = debug_backtrace( false );
5006
+	} else {
5007
+			$trace = debug_backtrace();
5008
+	}
4867 5009
 
4868 5010
 	$caller = array();
4869 5011
 	$check_class = ! is_null( $ignore_class );
@@ -4873,8 +5015,10 @@  discard block
 block discarded – undo
4873 5015
 		if ( $skip_frames > 0 ) {
4874 5016
 			$skip_frames--;
4875 5017
 		} elseif ( isset( $call['class'] ) ) {
4876
-			if ( $check_class && $ignore_class == $call['class'] )
4877
-				continue; // Filter out calls
5018
+			if ( $check_class && $ignore_class == $call['class'] ) {
5019
+							continue;
5020
+			}
5021
+			// Filter out calls
4878 5022
 
4879 5023
 			$caller[] = "{$call['class']}{$call['type']}{$call['function']}";
4880 5024
 		} else {
@@ -4887,11 +5031,12 @@  discard block
 block discarded – undo
4887 5031
 			}
4888 5032
 		}
4889 5033
 	}
4890
-	if ( $pretty )
4891
-		return join( ', ', array_reverse( $caller ) );
4892
-	else
4893
-		return $caller;
4894
-}
5034
+	if ( $pretty ) {
5035
+			return join( ', ', array_reverse( $caller ) );
5036
+	} else {
5037
+			return $caller;
5038
+	}
5039
+	}
4895 5040
 
4896 5041
 /**
4897 5042
  * Retrieve ids that are not already present in the cache.
@@ -4925,8 +5070,9 @@  discard block
 block discarded – undo
4925 5070
  * @return bool Whether the device is able to upload files.
4926 5071
  */
4927 5072
 function _device_can_upload() {
4928
-	if ( ! wp_is_mobile() )
4929
-		return true;
5073
+	if ( ! wp_is_mobile() ) {
5074
+			return true;
5075
+	}
4930 5076
 
4931 5077
 	$ua = $_SERVER['HTTP_USER_AGENT'];
4932 5078
 
@@ -4989,11 +5135,13 @@  discard block
 block discarded – undo
4989 5135
  * @since 3.6.0
4990 5136
  */
4991 5137
 function wp_auth_check_load() {
4992
-	if ( ! is_admin() && ! is_user_logged_in() )
4993
-		return;
5138
+	if ( ! is_admin() && ! is_user_logged_in() ) {
5139
+			return;
5140
+	}
4994 5141
 
4995
-	if ( defined( 'IFRAME_REQUEST' ) )
4996
-		return;
5142
+	if ( defined( 'IFRAME_REQUEST' ) ) {
5143
+			return;
5144
+	}
4997 5145
 
4998 5146
 	$screen = get_current_screen();
4999 5147
 	$hidden = array( 'update', 'update-network', 'update-core', 'update-core-network', 'upgrade', 'upgrade-network', 'network' );
@@ -5098,8 +5246,9 @@  discard block
 block discarded – undo
5098 5246
  * @return string Tag RegEx.
5099 5247
  */
5100 5248
 function get_tag_regex( $tag ) {
5101
-	if ( empty( $tag ) )
5102
-		return;
5249
+	if ( empty( $tag ) ) {
5250
+			return;
5251
+	}
5103 5252
 	return sprintf( '<%1$s[^<]*(?:>[\s\S]*<\/%1$s>|\s*\/>)', tag_escape( $tag ) );
5104 5253
 }
5105 5254
 
@@ -5117,12 +5266,14 @@  discard block
 block discarded – undo
5117 5266
  */
5118 5267
 function _canonical_charset( $charset ) {
5119 5268
 	if ( 'UTF-8' === $charset || 'utf-8' === $charset || 'utf8' === $charset ||
5120
-		'UTF8' === $charset )
5121
-		return 'UTF-8';
5269
+		'UTF8' === $charset ) {
5270
+			return 'UTF-8';
5271
+	}
5122 5272
 
5123 5273
 	if ( 'ISO-8859-1' === $charset || 'iso-8859-1' === $charset ||
5124
-		'iso8859-1' === $charset || 'ISO8859-1' === $charset )
5125
-		return 'ISO-8859-1';
5274
+		'iso8859-1' === $charset || 'ISO8859-1' === $charset ) {
5275
+			return 'ISO-8859-1';
5276
+	}
5126 5277
 
5127 5278
 	return $charset;
5128 5279
 }
@@ -5157,11 +5308,13 @@  discard block
 block discarded – undo
5157 5308
 	static $encodings = array();
5158 5309
 	static $overloaded = null;
5159 5310
 
5160
-	if ( is_null( $overloaded ) )
5161
-		$overloaded = function_exists( 'mb_internal_encoding' ) && ( ini_get( 'mbstring.func_overload' ) & 2 );
5311
+	if ( is_null( $overloaded ) ) {
5312
+			$overloaded = function_exists( 'mb_internal_encoding' ) && ( ini_get( 'mbstring.func_overload' ) & 2 );
5313
+	}
5162 5314
 
5163
-	if ( false === $overloaded )
5164
-		return;
5315
+	if ( false === $overloaded ) {
5316
+			return;
5317
+	}
5165 5318
 
5166 5319
 	if ( ! $reset ) {
5167 5320
 		$encoding = mb_internal_encoding();
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/functions.wp-styles.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
  *
37 37
  * @since 2.6.0
38 38
  *
39
- * @param string|bool|array $handles Styles to be printed. Default 'false'.
39
+ * @param string $handles Styles to be printed. Default 'false'.
40 40
  * @return array On success, a processed array of WP_Dependencies items; otherwise, an empty array.
41 41
  */
42 42
 function wp_print_styles( $handles = false ) {
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
  * @param string           $handle Name of the stylesheet. Should be unique.
148 148
  * @param string           $src    Full URL of the stylesheet, or path of the stylesheet relative to the WordPress root directory.
149 149
  * @param array            $deps   Optional. An array of registered stylesheet handles this stylesheet depends on. Default empty array.
150
- * @param string|bool|null $ver    Optional. String specifying stylesheet version number, if it has one, which is added to the URL
150
+ * @param string|null $ver    Optional. String specifying stylesheet version number, if it has one, which is added to the URL
151 151
  *                                 as a query string for cache busting purposes. If version is set to false, a version
152 152
  *                                 number is automatically added equal to current installed WordPress version.
153 153
  *                                 If set to null, no version is added.
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
  * @param string $handle Name of the stylesheet.
218 218
  * @param string $key    Name of data point for which we're storing a value.
219 219
  *                       Accepts 'conditional', 'rtl' and 'suffix', 'alt' and 'title'.
220
- * @param mixed  $value  String containing the CSS data to be added.
220
+ * @param string  $value  String containing the CSS data to be added.
221 221
  * @return bool True on success, false on failure.
222 222
  */
223 223
 function wp_style_add_data( $handle, $key, $value ) {
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: Styles functions
4
- *
5
- * @since 2.6.0
6
- *
7
- * @package WordPress
8
- * @subpackage Dependencies
9
- */
3
+	 * Dependencies API: Styles functions
4
+	 *
5
+	 * @since 2.6.0
6
+	 *
7
+	 * @package WordPress
8
+	 * @subpackage Dependencies
9
+	 */
10 10
 
11 11
 /**
12 12
  * Initialize $wp_styles if it has not been set.
Please login to merge, or discard this patch.
src/wp-includes/general-template.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1847,7 +1847,7 @@  discard block
 block discarded – undo
1847 1847
  * @since 1.5.0
1848 1848
  *
1849 1849
  * @param int $num Number of day.
1850
- * @return int Days since the start of the week.
1850
+ * @return double Days since the start of the week.
1851 1851
  */
1852 1852
 function calendar_week_mod($num) {
1853 1853
 	$base = 7;
@@ -3029,7 +3029,7 @@  discard block
 block discarded – undo
3029 3029
  *     @type string $before_page_number A string to appear before the page number. Default empty.
3030 3030
  *     @type string $after_page_number  A string to append after the page number. Default empty.
3031 3031
  * }
3032
- * @return array|string|void String of page links or array of page links.
3032
+ * @return string String of page links or array of page links.
3033 3033
  */
3034 3034
 function paginate_links( $args = '' ) {
3035 3035
 	global $wp_query, $wp_rewrite;
@@ -3190,7 +3190,7 @@  discard block
 block discarded – undo
3190 3190
  * @param string $key    The unique key for this theme.
3191 3191
  * @param string $name   The name of the theme.
3192 3192
  * @param string $url    The URL of the CSS file containing the color scheme.
3193
- * @param array  $colors Optional. An array of CSS color definition strings which are used
3193
+ * @param string[]  $colors Optional. An array of CSS color definition strings which are used
3194 3194
  *                       to give the user a feel for the theme.
3195 3195
  * @param array  $icons {
3196 3196
  *     Optional. CSS color definitions used to color any SVG icons.
Please login to merge, or discard this patch.
Spacing   +730 added lines, -730 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
  *
20 20
  * @param string $name The name of the specialised header.
21 21
  */
22
-function get_header( $name = null ) {
22
+function get_header($name = null) {
23 23
 	/**
24 24
 	 * Fires before the header template file is loaded.
25 25
 	 *
@@ -32,17 +32,17 @@  discard block
 block discarded – undo
32 32
 	 *
33 33
 	 * @param string $name Name of the specific header file to use.
34 34
 	 */
35
-	do_action( 'get_header', $name );
35
+	do_action('get_header', $name);
36 36
 
37 37
 	$templates = array();
38 38
 	$name = (string) $name;
39
-	if ( '' !== $name ) {
39
+	if ('' !== $name) {
40 40
 		$templates[] = "header-{$name}.php";
41 41
 	}
42 42
 
43 43
 	$templates[] = 'header.php';
44 44
 
45
-	locate_template( $templates, true );
45
+	locate_template($templates, true);
46 46
 }
47 47
 
48 48
 /**
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
  *
59 59
  * @param string $name The name of the specialised footer.
60 60
  */
61
-function get_footer( $name = null ) {
61
+function get_footer($name = null) {
62 62
 	/**
63 63
 	 * Fires before the footer template file is loaded.
64 64
 	 *
@@ -71,17 +71,17 @@  discard block
 block discarded – undo
71 71
 	 *
72 72
 	 * @param string $name Name of the specific footer file to use.
73 73
 	 */
74
-	do_action( 'get_footer', $name );
74
+	do_action('get_footer', $name);
75 75
 
76 76
 	$templates = array();
77 77
 	$name = (string) $name;
78
-	if ( '' !== $name ) {
78
+	if ('' !== $name) {
79 79
 		$templates[] = "footer-{$name}.php";
80 80
 	}
81 81
 
82
-	$templates[]    = 'footer.php';
82
+	$templates[] = 'footer.php';
83 83
 
84
-	locate_template( $templates, true );
84
+	locate_template($templates, true);
85 85
 }
86 86
 
87 87
 /**
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
  *
98 98
  * @param string $name The name of the specialised sidebar.
99 99
  */
100
-function get_sidebar( $name = null ) {
100
+function get_sidebar($name = null) {
101 101
 	/**
102 102
 	 * Fires before the sidebar template file is loaded.
103 103
 	 *
@@ -110,16 +110,16 @@  discard block
 block discarded – undo
110 110
 	 *
111 111
 	 * @param string $name Name of the specific sidebar file to use.
112 112
 	 */
113
-	do_action( 'get_sidebar', $name );
113
+	do_action('get_sidebar', $name);
114 114
 
115 115
 	$templates = array();
116 116
 	$name = (string) $name;
117
-	if ( '' !== $name )
117
+	if ('' !== $name)
118 118
 		$templates[] = "sidebar-{$name}.php";
119 119
 
120 120
 	$templates[] = 'sidebar.php';
121 121
 
122
-	locate_template( $templates, true );
122
+	locate_template($templates, true);
123 123
 }
124 124
 
125 125
 /**
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
  * @param string $slug The slug name for the generic template.
144 144
  * @param string $name The name of the specialised template.
145 145
  */
146
-function get_template_part( $slug, $name = null ) {
146
+function get_template_part($slug, $name = null) {
147 147
 	/**
148 148
 	 * Fires before the specified template part file is loaded.
149 149
 	 *
@@ -155,11 +155,11 @@  discard block
 block discarded – undo
155 155
 	 * @param string $slug The slug name for the generic template.
156 156
 	 * @param string $name The name of the specialized template.
157 157
 	 */
158
-	do_action( "get_template_part_{$slug}", $slug, $name );
158
+	do_action("get_template_part_{$slug}", $slug, $name);
159 159
 
160 160
 	$templates = array();
161 161
 	$name = (string) $name;
162
-	if ( '' !== $name )
162
+	if ('' !== $name)
163 163
 		$templates[] = "{$slug}-{$name}.php";
164 164
 
165 165
 	$templates[] = "{$slug}.php";
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
  * @param bool $echo Default to echo and not return the form.
190 190
  * @return string|void String when $echo is false.
191 191
  */
192
-function get_search_form( $echo = true ) {
192
+function get_search_form($echo = true) {
193 193
 	/**
194 194
 	 * Fires before the search form is retrieved, at the start of get_search_form().
195 195
 	 *
@@ -198,9 +198,9 @@  discard block
 block discarded – undo
198 198
 	 *
199 199
 	 * @link https://core.trac.wordpress.org/ticket/19321
200 200
 	 */
201
-	do_action( 'pre_get_search_form' );
201
+	do_action('pre_get_search_form');
202 202
 
203
-	$format = current_theme_supports( 'html5', 'search-form' ) ? 'html5' : 'xhtml';
203
+	$format = current_theme_supports('html5', 'search-form') ? 'html5' : 'xhtml';
204 204
 
205 205
 	/**
206 206
 	 * Filter the HTML format of the search form.
@@ -210,28 +210,28 @@  discard block
 block discarded – undo
210 210
 	 * @param string $format The type of markup to use in the search form.
211 211
 	 *                       Accepts 'html5', 'xhtml'.
212 212
 	 */
213
-	$format = apply_filters( 'search_form_format', $format );
213
+	$format = apply_filters('search_form_format', $format);
214 214
 
215
-	$search_form_template = locate_template( 'searchform.php' );
216
-	if ( '' != $search_form_template ) {
215
+	$search_form_template = locate_template('searchform.php');
216
+	if ('' != $search_form_template) {
217 217
 		ob_start();
218
-		require( $search_form_template );
218
+		require($search_form_template);
219 219
 		$form = ob_get_clean();
220 220
 	} else {
221
-		if ( 'html5' == $format ) {
222
-			$form = '<form role="search" method="get" class="search-form" action="' . esc_url( home_url( '/' ) ) . '">
221
+		if ('html5' == $format) {
222
+			$form = '<form role="search" method="get" class="search-form" action="'.esc_url(home_url('/')).'">
223 223
 				<label>
224
-					<span class="screen-reader-text">' . _x( 'Search for:', 'label' ) . '</span>
225
-					<input type="search" class="search-field" placeholder="' . esc_attr_x( 'Search &hellip;', 'placeholder' ) . '" value="' . get_search_query() . '" name="s" />
224
+					<span class="screen-reader-text">' . _x('Search for:', 'label').'</span>
225
+					<input type="search" class="search-field" placeholder="' . esc_attr_x('Search &hellip;', 'placeholder').'" value="'.get_search_query().'" name="s" />
226 226
 				</label>
227
-				<input type="submit" class="search-submit" value="'. esc_attr_x( 'Search', 'submit button' ) .'" />
227
+				<input type="submit" class="search-submit" value="'. esc_attr_x('Search', 'submit button').'" />
228 228
 			</form>';
229 229
 		} else {
230
-			$form = '<form role="search" method="get" id="searchform" class="searchform" action="' . esc_url( home_url( '/' ) ) . '">
230
+			$form = '<form role="search" method="get" id="searchform" class="searchform" action="'.esc_url(home_url('/')).'">
231 231
 				<div>
232
-					<label class="screen-reader-text" for="s">' . _x( 'Search for:', 'label' ) . '</label>
233
-					<input type="text" value="' . get_search_query() . '" name="s" id="s" />
234
-					<input type="submit" id="searchsubmit" value="'. esc_attr_x( 'Search', 'submit button' ) .'" />
232
+					<label class="screen-reader-text" for="s">' . _x('Search for:', 'label').'</label>
233
+					<input type="text" value="' . get_search_query().'" name="s" id="s" />
234
+					<input type="submit" id="searchsubmit" value="'. esc_attr_x('Search', 'submit button').'" />
235 235
 				</div>
236 236
 			</form>';
237 237
 		}
@@ -244,12 +244,12 @@  discard block
 block discarded – undo
244 244
 	 *
245 245
 	 * @param string $form The search form HTML output.
246 246
 	 */
247
-	$result = apply_filters( 'get_search_form', $form );
247
+	$result = apply_filters('get_search_form', $form);
248 248
 
249
-	if ( null === $result )
249
+	if (null === $result)
250 250
 		$result = $form;
251 251
 
252
-	if ( $echo )
252
+	if ($echo)
253 253
 		echo $result;
254 254
 	else
255 255
 		return $result;
@@ -268,12 +268,12 @@  discard block
 block discarded – undo
268 268
  * @return string|void String when retrieving.
269 269
  */
270 270
 function wp_loginout($redirect = '', $echo = true) {
271
-	if ( ! is_user_logged_in() )
272
-		$link = '<a href="' . esc_url( wp_login_url($redirect) ) . '">' . __('Log in') . '</a>';
271
+	if ( ! is_user_logged_in())
272
+		$link = '<a href="'.esc_url(wp_login_url($redirect)).'">'.__('Log in').'</a>';
273 273
 	else
274
-		$link = '<a href="' . esc_url( wp_logout_url($redirect) ) . '">' . __('Log out') . '</a>';
274
+		$link = '<a href="'.esc_url(wp_logout_url($redirect)).'">'.__('Log out').'</a>';
275 275
 
276
-	if ( $echo ) {
276
+	if ($echo) {
277 277
 		/**
278 278
 		 * Filter the HTML output for the Log In/Log Out link.
279 279
 		 *
@@ -281,10 +281,10 @@  discard block
 block discarded – undo
281 281
 		 *
282 282
 		 * @param string $link The HTML link content.
283 283
 		 */
284
-		echo apply_filters( 'loginout', $link );
284
+		echo apply_filters('loginout', $link);
285 285
 	} else {
286 286
 		/** This filter is documented in wp-includes/general-template.php */
287
-		return apply_filters( 'loginout', $link );
287
+		return apply_filters('loginout', $link);
288 288
 	}
289 289
 }
290 290
 
@@ -299,13 +299,13 @@  discard block
 block discarded – undo
299 299
  * @return string A log out URL.
300 300
  */
301 301
 function wp_logout_url($redirect = '') {
302
-	$args = array( 'action' => 'logout' );
303
-	if ( !empty($redirect) ) {
304
-		$args['redirect_to'] = urlencode( $redirect );
302
+	$args = array('action' => 'logout');
303
+	if ( ! empty($redirect)) {
304
+		$args['redirect_to'] = urlencode($redirect);
305 305
 	}
306 306
 
307 307
 	$logout_url = add_query_arg($args, site_url('wp-login.php', 'login'));
308
-	$logout_url = wp_nonce_url( $logout_url, 'log-out' );
308
+	$logout_url = wp_nonce_url($logout_url, 'log-out');
309 309
 
310 310
 	/**
311 311
 	 * Filter the logout URL.
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 	 * @param string $logout_url The Log Out URL.
316 316
 	 * @param string $redirect   Path to redirect to on logout.
317 317
 	 */
318
-	return apply_filters( 'logout_url', $logout_url, $redirect );
318
+	return apply_filters('logout_url', $logout_url, $redirect);
319 319
 }
320 320
 
321 321
 /**
@@ -330,10 +330,10 @@  discard block
 block discarded – undo
330 330
 function wp_login_url($redirect = '', $force_reauth = false) {
331 331
 	$login_url = site_url('wp-login.php', 'login');
332 332
 
333
-	if ( !empty($redirect) )
333
+	if ( ! empty($redirect))
334 334
 		$login_url = add_query_arg('redirect_to', urlencode($redirect), $login_url);
335 335
 
336
-	if ( $force_reauth )
336
+	if ($force_reauth)
337 337
 		$login_url = add_query_arg('reauth', '1', $login_url);
338 338
 
339 339
 	/**
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 	 * @param string $redirect     The path to redirect to on login, if supplied.
347 347
 	 * @param bool   $force_reauth Whether to force reauthorization, even if a cookie is present.
348 348
 	 */
349
-	return apply_filters( 'login_url', $login_url, $redirect, $force_reauth );
349
+	return apply_filters('login_url', $login_url, $redirect, $force_reauth);
350 350
 }
351 351
 
352 352
 /**
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 	 *
365 365
 	 * @param string $register The user registration URL.
366 366
 	 */
367
-	return apply_filters( 'register_url', site_url( 'wp-login.php?action=register', 'login' ) );
367
+	return apply_filters('register_url', site_url('wp-login.php?action=register', 'login'));
368 368
 }
369 369
 
370 370
 /**
@@ -398,16 +398,16 @@  discard block
 block discarded – undo
398 398
  * }
399 399
  * @return string|void String when retrieving.
400 400
  */
401
-function wp_login_form( $args = array() ) {
401
+function wp_login_form($args = array()) {
402 402
 	$defaults = array(
403 403
 		'echo' => true,
404 404
 		// Default 'redirect' value takes the user back to the request URI.
405
-		'redirect' => ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'],
405
+		'redirect' => (is_ssl() ? 'https://' : 'http://').$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'],
406 406
 		'form_id' => 'loginform',
407
-		'label_username' => __( 'Username or Email' ),
408
-		'label_password' => __( 'Password' ),
409
-		'label_remember' => __( 'Remember Me' ),
410
-		'label_log_in' => __( 'Log In' ),
407
+		'label_username' => __('Username or Email'),
408
+		'label_password' => __('Password'),
409
+		'label_remember' => __('Remember Me'),
410
+		'label_log_in' => __('Log In'),
411 411
 		'id_username' => 'user_login',
412 412
 		'id_password' => 'user_pass',
413 413
 		'id_remember' => 'rememberme',
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 	 *
428 428
 	 * @param array $defaults An array of default login form arguments.
429 429
 	 */
430
-	$args = wp_parse_args( $args, apply_filters( 'login_form_defaults', $defaults ) );
430
+	$args = wp_parse_args($args, apply_filters('login_form_defaults', $defaults));
431 431
 
432 432
 	/**
433 433
 	 * Filter content to display at the top of the login form.
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 	 * @param string $content Content to display. Default empty.
440 440
 	 * @param array  $args    Array of login form arguments.
441 441
 	 */
442
-	$login_form_top = apply_filters( 'login_form_top', '', $args );
442
+	$login_form_top = apply_filters('login_form_top', '', $args);
443 443
 
444 444
 	/**
445 445
 	 * Filter content to display in the middle of the login form.
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 	 * @param string $content Content to display. Default empty.
453 453
 	 * @param array  $args    Array of login form arguments.
454 454
 	 */
455
-	$login_form_middle = apply_filters( 'login_form_middle', '', $args );
455
+	$login_form_middle = apply_filters('login_form_middle', '', $args);
456 456
 
457 457
 	/**
458 458
 	 * Filter content to display at the bottom of the login form.
@@ -464,29 +464,29 @@  discard block
 block discarded – undo
464 464
 	 * @param string $content Content to display. Default empty.
465 465
 	 * @param array  $args    Array of login form arguments.
466 466
 	 */
467
-	$login_form_bottom = apply_filters( 'login_form_bottom', '', $args );
467
+	$login_form_bottom = apply_filters('login_form_bottom', '', $args);
468 468
 
469 469
 	$form = '
470
-		<form name="' . $args['form_id'] . '" id="' . $args['form_id'] . '" action="' . esc_url( site_url( 'wp-login.php', 'login_post' ) ) . '" method="post">
471
-			' . $login_form_top . '
470
+		<form name="' . $args['form_id'].'" id="'.$args['form_id'].'" action="'.esc_url(site_url('wp-login.php', 'login_post')).'" method="post">
471
+			' . $login_form_top.'
472 472
 			<p class="login-username">
473
-				<label for="' . esc_attr( $args['id_username'] ) . '">' . esc_html( $args['label_username'] ) . '</label>
474
-				<input type="text" name="log" id="' . esc_attr( $args['id_username'] ) . '" class="input" value="' . esc_attr( $args['value_username'] ) . '" size="20" />
473
+				<label for="' . esc_attr($args['id_username']).'">'.esc_html($args['label_username']).'</label>
474
+				<input type="text" name="log" id="' . esc_attr($args['id_username']).'" class="input" value="'.esc_attr($args['value_username']).'" size="20" />
475 475
 			</p>
476 476
 			<p class="login-password">
477
-				<label for="' . esc_attr( $args['id_password'] ) . '">' . esc_html( $args['label_password'] ) . '</label>
478
-				<input type="password" name="pwd" id="' . esc_attr( $args['id_password'] ) . '" class="input" value="" size="20" />
477
+				<label for="' . esc_attr($args['id_password']).'">'.esc_html($args['label_password']).'</label>
478
+				<input type="password" name="pwd" id="' . esc_attr($args['id_password']).'" class="input" value="" size="20" />
479 479
 			</p>
480
-			' . $login_form_middle . '
481
-			' . ( $args['remember'] ? '<p class="login-remember"><label><input name="rememberme" type="checkbox" id="' . esc_attr( $args['id_remember'] ) . '" value="forever"' . ( $args['value_remember'] ? ' checked="checked"' : '' ) . ' /> ' . esc_html( $args['label_remember'] ) . '</label></p>' : '' ) . '
480
+			' . $login_form_middle.'
481
+			' . ($args['remember'] ? '<p class="login-remember"><label><input name="rememberme" type="checkbox" id="'.esc_attr($args['id_remember']).'" value="forever"'.($args['value_remember'] ? ' checked="checked"' : '').' /> '.esc_html($args['label_remember']).'</label></p>' : '').'
482 482
 			<p class="login-submit">
483
-				<input type="submit" name="wp-submit" id="' . esc_attr( $args['id_submit'] ) . '" class="button-primary" value="' . esc_attr( $args['label_log_in'] ) . '" />
484
-				<input type="hidden" name="redirect_to" value="' . esc_url( $args['redirect'] ) . '" />
483
+				<input type="submit" name="wp-submit" id="' . esc_attr($args['id_submit']).'" class="button-primary" value="'.esc_attr($args['label_log_in']).'" />
484
+				<input type="hidden" name="redirect_to" value="' . esc_url($args['redirect']).'" />
485 485
 			</p>
486
-			' . $login_form_bottom . '
486
+			' . $login_form_bottom.'
487 487
 		</form>';
488 488
 
489
-	if ( $args['echo'] )
489
+	if ($args['echo'])
490 490
 		echo $form;
491 491
 	else
492 492
 		return $form;
@@ -500,13 +500,13 @@  discard block
 block discarded – undo
500 500
  * @param string $redirect Path to redirect to on login.
501 501
  * @return string Lost password URL.
502 502
  */
503
-function wp_lostpassword_url( $redirect = '' ) {
504
-	$args = array( 'action' => 'lostpassword' );
505
-	if ( !empty($redirect) ) {
503
+function wp_lostpassword_url($redirect = '') {
504
+	$args = array('action' => 'lostpassword');
505
+	if ( ! empty($redirect)) {
506 506
 		$args['redirect_to'] = $redirect;
507 507
 	}
508 508
 
509
-	$lostpassword_url = add_query_arg( $args, network_site_url('wp-login.php', 'login') );
509
+	$lostpassword_url = add_query_arg($args, network_site_url('wp-login.php', 'login'));
510 510
 
511 511
 	/**
512 512
 	 * Filter the Lost Password URL.
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
 	 * @param string $lostpassword_url The lost password page URL.
517 517
 	 * @param string $redirect         The path to redirect to on login.
518 518
 	 */
519
-	return apply_filters( 'lostpassword_url', $lostpassword_url, $redirect );
519
+	return apply_filters('lostpassword_url', $lostpassword_url, $redirect);
520 520
 }
521 521
 
522 522
 /**
@@ -532,14 +532,14 @@  discard block
 block discarded – undo
532 532
  * @param bool   $echo   Default to echo and not return the link.
533 533
  * @return string|void String when retrieving.
534 534
  */
535
-function wp_register( $before = '<li>', $after = '</li>', $echo = true ) {
536
-	if ( ! is_user_logged_in() ) {
537
-		if ( get_option('users_can_register') )
538
-			$link = $before . '<a href="' . esc_url( wp_registration_url() ) . '">' . __('Register') . '</a>' . $after;
535
+function wp_register($before = '<li>', $after = '</li>', $echo = true) {
536
+	if ( ! is_user_logged_in()) {
537
+		if (get_option('users_can_register'))
538
+			$link = $before.'<a href="'.esc_url(wp_registration_url()).'">'.__('Register').'</a>'.$after;
539 539
 		else
540 540
 			$link = '';
541
-	} elseif ( current_user_can( 'read' ) ) {
542
-		$link = $before . '<a href="' . admin_url() . '">' . __('Site Admin') . '</a>' . $after;
541
+	} elseif (current_user_can('read')) {
542
+		$link = $before.'<a href="'.admin_url().'">'.__('Site Admin').'</a>'.$after;
543 543
 	} else {
544 544
 		$link = '';
545 545
 	}
@@ -554,9 +554,9 @@  discard block
 block discarded – undo
554 554
 	 *
555 555
 	 * @param string $link The HTML code for the link to the Registration or Admin page.
556 556
 	 */
557
-	$link = apply_filters( 'register', $link );
557
+	$link = apply_filters('register', $link);
558 558
 
559
-	if ( $echo ) {
559
+	if ($echo) {
560 560
 		echo $link;
561 561
 	} else {
562 562
 		return $link;
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
 	 *
580 580
 	 * @since 1.5.0
581 581
 	 */
582
-	do_action( 'wp_meta' );
582
+	do_action('wp_meta');
583 583
 }
584 584
 
585 585
 /**
@@ -591,8 +591,8 @@  discard block
 block discarded – undo
591 591
  *
592 592
  * @param string $show Optional. Site information to display. Default empty.
593 593
  */
594
-function bloginfo( $show = '' ) {
595
-	echo get_bloginfo( $show, 'display' );
594
+function bloginfo($show = '') {
595
+	echo get_bloginfo($show, 'display');
596 596
 }
597 597
 
598 598
 /**
@@ -642,17 +642,17 @@  discard block
 block discarded – undo
642 642
  * @param string $filter Optional. How to filter what is retrieved. Default 'raw'.
643 643
  * @return string Mostly string values, might be empty.
644 644
  */
645
-function get_bloginfo( $show = '', $filter = 'raw' ) {
646
-	switch( $show ) {
645
+function get_bloginfo($show = '', $filter = 'raw') {
646
+	switch ($show) {
647 647
 		case 'home' : // DEPRECATED
648 648
 		case 'siteurl' : // DEPRECATED
649
-			_deprecated_argument( __FUNCTION__, '2.2', sprintf(
649
+			_deprecated_argument(__FUNCTION__, '2.2', sprintf(
650 650
 				/* translators: 1: 'siteurl'/'home' argument, 2: bloginfo() function name, 3: 'url' argument */
651
-				__( 'The %1$s option is deprecated for the family of %2$s functions. Use the %3$s option instead.' ),
652
-				'<code>' . $show . '</code>',
651
+				__('The %1$s option is deprecated for the family of %2$s functions. Use the %3$s option instead.'),
652
+				'<code>'.$show.'</code>',
653 653
 				'<code>bloginfo()</code>',
654 654
 				'<code>url</code>'
655
-			) );
655
+			));
656 656
 		case 'url' :
657 657
 			$output = home_url();
658 658
 			break;
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
 			$output = get_feed_link('comments_rss2');
682 682
 			break;
683 683
 		case 'pingback_url':
684
-			$output = site_url( 'xmlrpc.php' );
684
+			$output = site_url('xmlrpc.php');
685 685
 			break;
686 686
 		case 'stylesheet_url':
687 687
 			$output = get_stylesheet_uri();
@@ -712,21 +712,21 @@  discard block
 block discarded – undo
712 712
 			 * see https://www.w3.org/International/articles/language-tags/ for reference.
713 713
 			 * Do not translate into your own language.
714 714
 			 */
715
-			$output = __( 'html_lang_attribute' );
716
-			if ( 'html_lang_attribute' === $output || preg_match( '/[^a-zA-Z0-9-]/', $output ) ) {
715
+			$output = __('html_lang_attribute');
716
+			if ('html_lang_attribute' === $output || preg_match('/[^a-zA-Z0-9-]/', $output)) {
717 717
 				$output = get_locale();
718
-				$output = str_replace( '_', '-', $output );
718
+				$output = str_replace('_', '-', $output);
719 719
 			}
720 720
 			break;
721 721
 		case 'text_direction':
722
-			_deprecated_argument( __FUNCTION__, '2.2', sprintf(
722
+			_deprecated_argument(__FUNCTION__, '2.2', sprintf(
723 723
 				/* translators: 1: 'text_direction' argument, 2: bloginfo() function name, 3: is_rtl() function name */
724
-				__( 'The %1$s option is deprecated for the family of %2$s functions. Use the %3$s function instead.' ),
725
-				'<code>' . $show . '</code>',
724
+				__('The %1$s option is deprecated for the family of %2$s functions. Use the %3$s function instead.'),
725
+				'<code>'.$show.'</code>',
726 726
 				'<code>bloginfo()</code>',
727 727
 				'<code>is_rtl()</code>'
728
-			) );
729
-			if ( function_exists( 'is_rtl' ) ) {
728
+			));
729
+			if (function_exists('is_rtl')) {
730 730
 				$output = is_rtl() ? 'rtl' : 'ltr';
731 731
 			} else {
732 732
 				$output = 'ltr';
@@ -744,8 +744,8 @@  discard block
 block discarded – undo
744 744
 		strpos($show, 'home') === false)
745 745
 		$url = false;
746 746
 
747
-	if ( 'display' == $filter ) {
748
-		if ( $url ) {
747
+	if ('display' == $filter) {
748
+		if ($url) {
749 749
 			/**
750 750
 			 * Filter the URL returned by get_bloginfo().
751 751
 			 *
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
 			 * @param mixed $output The URL returned by bloginfo().
755 755
 			 * @param mixed $show   Type of information requested.
756 756
 			 */
757
-			$output = apply_filters( 'bloginfo_url', $output, $show );
757
+			$output = apply_filters('bloginfo_url', $output, $show);
758 758
 		} else {
759 759
 			/**
760 760
 			 * Filter the site information returned by get_bloginfo().
@@ -764,7 +764,7 @@  discard block
 block discarded – undo
764 764
 			 * @param mixed $output The requested non-URL site information.
765 765
 			 * @param mixed $show   Type of information requested.
766 766
 			 */
767
-			$output = apply_filters( 'bloginfo', $output, $show );
767
+			$output = apply_filters('bloginfo', $output, $show);
768 768
 		}
769 769
 	}
770 770
 
@@ -781,23 +781,23 @@  discard block
 block discarded – undo
781 781
  * @param int    $blog_id Optional. ID of the blog to get the site icon for. Default current blog.
782 782
  * @return string Site Icon URL.
783 783
  */
784
-function get_site_icon_url( $size = 512, $url = '', $blog_id = 0 ) {
785
-	if ( is_multisite() && (int) $blog_id !== get_current_blog_id() ) {
786
-		switch_to_blog( $blog_id );
784
+function get_site_icon_url($size = 512, $url = '', $blog_id = 0) {
785
+	if (is_multisite() && (int) $blog_id !== get_current_blog_id()) {
786
+		switch_to_blog($blog_id);
787 787
 	}
788 788
 
789
-	$site_icon_id = get_option( 'site_icon' );
789
+	$site_icon_id = get_option('site_icon');
790 790
 
791
-	if ( $site_icon_id ) {
792
-		if ( $size >= 512 ) {
791
+	if ($site_icon_id) {
792
+		if ($size >= 512) {
793 793
 			$size_data = 'full';
794 794
 		} else {
795
-			$size_data = array( $size, $size );
795
+			$size_data = array($size, $size);
796 796
 		}
797
-		$url = wp_get_attachment_image_url( $site_icon_id, $size_data );
797
+		$url = wp_get_attachment_image_url($site_icon_id, $size_data);
798 798
 	}
799 799
 
800
-	if ( is_multisite() && ms_is_switched() ) {
800
+	if (is_multisite() && ms_is_switched()) {
801 801
 		restore_current_blog();
802 802
 	}
803 803
 
@@ -810,7 +810,7 @@  discard block
 block discarded – undo
810 810
 	 * @param int    $size    Size of the site icon.
811 811
 	 * @param int    $blog_id ID of the blog to get the site icon for.
812 812
 	 */
813
-	return apply_filters( 'get_site_icon_url', $url, $size, $blog_id );
813
+	return apply_filters('get_site_icon_url', $url, $size, $blog_id);
814 814
 }
815 815
 
816 816
 /**
@@ -822,8 +822,8 @@  discard block
 block discarded – undo
822 822
  * @param string $url     Optional. Fallback url if no site icon is found. Default empty.
823 823
  * @param int    $blog_id Optional. ID of the blog to get the site icon for. Default current blog.
824 824
  */
825
-function site_icon_url( $size = 512, $url = '', $blog_id = 0 ) {
826
-	echo esc_url( get_site_icon_url( $size, $url, $blog_id ) );
825
+function site_icon_url($size = 512, $url = '', $blog_id = 0) {
826
+	echo esc_url(get_site_icon_url($size, $url, $blog_id));
827 827
 }
828 828
 
829 829
 /**
@@ -834,8 +834,8 @@  discard block
 block discarded – undo
834 834
  * @param int $blog_id Optional. ID of the blog in question. Default current blog.
835 835
  * @return bool Whether the site has a site icon or not.
836 836
  */
837
-function has_site_icon( $blog_id = 0 ) {
838
-	return (bool) get_site_icon_url( 512, '', $blog_id );
837
+function has_site_icon($blog_id = 0) {
838
+	return (bool) get_site_icon_url(512, '', $blog_id);
839 839
 }
840 840
 
841 841
 /**
@@ -846,14 +846,14 @@  discard block
 block discarded – undo
846 846
  * @param int $blog_id Optional. ID of the blog in question. Default is the ID of the current blog.
847 847
  * @return bool Whether the site has a custom logo or not.
848 848
  */
849
-function has_custom_logo( $blog_id = 0 ) {
850
-	if ( is_multisite() && (int) $blog_id !== get_current_blog_id() ) {
851
-		switch_to_blog( $blog_id );
849
+function has_custom_logo($blog_id = 0) {
850
+	if (is_multisite() && (int) $blog_id !== get_current_blog_id()) {
851
+		switch_to_blog($blog_id);
852 852
 	}
853 853
 
854
-	$custom_logo_id = get_theme_mod( 'custom_logo' );
854
+	$custom_logo_id = get_theme_mod('custom_logo');
855 855
 
856
-	if ( is_multisite() && ms_is_switched() ) {
856
+	if (is_multisite() && ms_is_switched()) {
857 857
 		restore_current_blog();
858 858
 	}
859 859
 
@@ -868,41 +868,41 @@  discard block
 block discarded – undo
868 868
  * @param int $blog_id Optional. ID of the blog in question. Default is the ID of the current blog.
869 869
  * @return string Custom logo markup.
870 870
  */
871
-function get_custom_logo( $blog_id = 0 ) {
871
+function get_custom_logo($blog_id = 0) {
872 872
 	$html = '';
873 873
 
874
-	if ( is_multisite() && (int) $blog_id !== get_current_blog_id() ) {
875
-		switch_to_blog( $blog_id );
874
+	if (is_multisite() && (int) $blog_id !== get_current_blog_id()) {
875
+		switch_to_blog($blog_id);
876 876
 	}
877 877
 
878
-	$custom_logo_id = get_theme_mod( 'custom_logo' );
879
-	$size           = get_theme_support( 'custom-logo', 'size' );
878
+	$custom_logo_id = get_theme_mod('custom_logo');
879
+	$size           = get_theme_support('custom-logo', 'size');
880 880
 
881
-	if ( ! $size ) {
881
+	if ( ! $size) {
882 882
 		$size = 'full';
883 883
 	}
884 884
 
885 885
 	// We have a logo. Logo is go.
886
-	if ( $custom_logo_id ) {
887
-		$html = sprintf( '<a href="%1$s" class="custom-logo-link" rel="home" itemprop="url">%2$s</a>',
888
-			esc_url( home_url( '/' ) ),
889
-			wp_get_attachment_image( $custom_logo_id, $size, false, array(
886
+	if ($custom_logo_id) {
887
+		$html = sprintf('<a href="%1$s" class="custom-logo-link" rel="home" itemprop="url">%2$s</a>',
888
+			esc_url(home_url('/')),
889
+			wp_get_attachment_image($custom_logo_id, $size, false, array(
890 890
 				'class'     => "custom-logo attachment-$size",
891 891
 				'data-size' => $size,
892 892
 				'itemprop'  => 'logo',
893
-			) )
893
+			))
894 894
 		);
895 895
 	}
896 896
 
897 897
 	// If no logo is set but we're in the Customizer, leave a placeholder (needed for the live preview).
898
-	elseif ( is_customize_preview() ) {
899
-		$html = sprintf( '<a href="%1$s" class="custom-logo-link" style="display:none;"><img class="custom-logo" data-size="%2$s" /></a>',
900
-			esc_url( home_url( '/' ) ),
901
-			esc_attr( $size )
898
+	elseif (is_customize_preview()) {
899
+		$html = sprintf('<a href="%1$s" class="custom-logo-link" style="display:none;"><img class="custom-logo" data-size="%2$s" /></a>',
900
+			esc_url(home_url('/')),
901
+			esc_attr($size)
902 902
 		);
903 903
 	}
904 904
 
905
-	if ( is_multisite() && ms_is_switched() ) {
905
+	if (is_multisite() && ms_is_switched()) {
906 906
 		restore_current_blog();
907 907
 	}
908 908
 
@@ -914,7 +914,7 @@  discard block
 block discarded – undo
914 914
 	 * @param string $html Custom logo HTML output.
915 915
 	 * @param string $size Size specified in add_theme_support declaration, or 'full' default.
916 916
 	 */
917
-	return apply_filters( 'get_custom_logo', $html, $size );
917
+	return apply_filters('get_custom_logo', $html, $size);
918 918
 }
919 919
 
920 920
 /**
@@ -924,8 +924,8 @@  discard block
 block discarded – undo
924 924
  *
925 925
  * @param int $blog_id Optional. ID of the blog in question. Default is the ID of the current blog.
926 926
  */
927
-function the_custom_logo( $blog_id = 0 ) {
928
-	echo get_custom_logo( $blog_id );
927
+function the_custom_logo($blog_id = 0) {
928
+	echo get_custom_logo($blog_id);
929 929
 }
930 930
 
931 931
 /**
@@ -950,8 +950,8 @@  discard block
 block discarded – undo
950 950
 	 *
951 951
 	 * @param string $title The document title. Default empty string.
952 952
 	 */
953
-	$title = apply_filters( 'pre_get_document_title', '' );
954
-	if ( ! empty( $title ) ) {
953
+	$title = apply_filters('pre_get_document_title', '');
954
+	if ( ! empty($title)) {
955 955
 		return $title;
956 956
 	}
957 957
 
@@ -962,62 +962,62 @@  discard block
 block discarded – undo
962 962
 	);
963 963
 
964 964
 	// If it's a 404 page, use a "Page not found" title.
965
-	if ( is_404() ) {
966
-		$title['title'] = __( 'Page not found' );
965
+	if (is_404()) {
966
+		$title['title'] = __('Page not found');
967 967
 
968 968
 	// If it's a search, use a dynamic search results title.
969
-	} elseif ( is_search() ) {
969
+	} elseif (is_search()) {
970 970
 		/* translators: %s: search phrase */
971
-		$title['title'] = sprintf( __( 'Search Results for &#8220;%s&#8221;' ), get_search_query() );
971
+		$title['title'] = sprintf(__('Search Results for &#8220;%s&#8221;'), get_search_query());
972 972
 
973 973
 	// If on the front page, use the site title.
974
-	} elseif ( is_front_page() ) {
975
-		$title['title'] = get_bloginfo( 'name', 'display' );
974
+	} elseif (is_front_page()) {
975
+		$title['title'] = get_bloginfo('name', 'display');
976 976
 
977 977
 	// If on a post type archive, use the post type archive title.
978
-	} elseif ( is_post_type_archive() ) {
979
-		$title['title'] = post_type_archive_title( '', false );
978
+	} elseif (is_post_type_archive()) {
979
+		$title['title'] = post_type_archive_title('', false);
980 980
 
981 981
 	// If on a taxonomy archive, use the term title.
982
-	} elseif ( is_tax() ) {
983
-		$title['title'] = single_term_title( '', false );
982
+	} elseif (is_tax()) {
983
+		$title['title'] = single_term_title('', false);
984 984
 
985 985
 	/*
986 986
 	 * If we're on the blog page that is not the homepage or
987 987
 	 * a single post of any post type, use the post title.
988 988
 	 */
989
-	} elseif ( is_home() || is_singular() ) {
990
-		$title['title'] = single_post_title( '', false );
989
+	} elseif (is_home() || is_singular()) {
990
+		$title['title'] = single_post_title('', false);
991 991
 
992 992
 	// If on a category or tag archive, use the term title.
993
-	} elseif ( is_category() || is_tag() ) {
994
-		$title['title'] = single_term_title( '', false );
993
+	} elseif (is_category() || is_tag()) {
994
+		$title['title'] = single_term_title('', false);
995 995
 
996 996
 	// If on an author archive, use the author's display name.
997
-	} elseif ( is_author() && $author = get_queried_object() ) {
997
+	} elseif (is_author() && $author = get_queried_object()) {
998 998
 		$title['title'] = $author->display_name;
999 999
 
1000 1000
 	// If it's a date archive, use the date as the title.
1001
-	} elseif ( is_year() ) {
1002
-		$title['title'] = get_the_date( _x( 'Y', 'yearly archives date format' ) );
1001
+	} elseif (is_year()) {
1002
+		$title['title'] = get_the_date(_x('Y', 'yearly archives date format'));
1003 1003
 
1004
-	} elseif ( is_month() ) {
1005
-		$title['title'] = get_the_date( _x( 'F Y', 'monthly archives date format' ) );
1004
+	} elseif (is_month()) {
1005
+		$title['title'] = get_the_date(_x('F Y', 'monthly archives date format'));
1006 1006
 
1007
-	} elseif ( is_day() ) {
1007
+	} elseif (is_day()) {
1008 1008
 		$title['title'] = get_the_date();
1009 1009
 	}
1010 1010
 
1011 1011
 	// Add a page number if necessary.
1012
-	if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) {
1013
-		$title['page'] = sprintf( __( 'Page %s' ), max( $paged, $page ) );
1012
+	if (($paged >= 2 || $page >= 2) && ! is_404()) {
1013
+		$title['page'] = sprintf(__('Page %s'), max($paged, $page));
1014 1014
 	}
1015 1015
 
1016 1016
 	// Append the description or site title to give context.
1017
-	if ( is_front_page() ) {
1018
-		$title['tagline'] = get_bloginfo( 'description', 'display' );
1017
+	if (is_front_page()) {
1018
+		$title['tagline'] = get_bloginfo('description', 'display');
1019 1019
 	} else {
1020
-		$title['site'] = get_bloginfo( 'name', 'display' );
1020
+		$title['site'] = get_bloginfo('name', 'display');
1021 1021
 	}
1022 1022
 
1023 1023
 	/**
@@ -1027,7 +1027,7 @@  discard block
 block discarded – undo
1027 1027
 	 *
1028 1028
 	 * @param string $sep Document title separator. Default '-'.
1029 1029
 	 */
1030
-	$sep = apply_filters( 'document_title_separator', '-' );
1030
+	$sep = apply_filters('document_title_separator', '-');
1031 1031
 
1032 1032
 	/**
1033 1033
 	 * Filter the parts of the document title.
@@ -1043,13 +1043,13 @@  discard block
 block discarded – undo
1043 1043
 	 *     @type string $site    Optional. Site title when not on home page.
1044 1044
 	 * }
1045 1045
 	 */
1046
-	$title = apply_filters( 'document_title_parts', $title );
1046
+	$title = apply_filters('document_title_parts', $title);
1047 1047
 
1048
-	$title = implode( " $sep ", array_filter( $title ) );
1049
-	$title = wptexturize( $title );
1050
-	$title = convert_chars( $title );
1051
-	$title = esc_html( $title );
1052
-	$title = capital_P_dangit( $title );
1048
+	$title = implode(" $sep ", array_filter($title));
1049
+	$title = wptexturize($title);
1050
+	$title = convert_chars($title);
1051
+	$title = esc_html($title);
1052
+	$title = capital_P_dangit($title);
1053 1053
 
1054 1054
 	return $title;
1055 1055
 }
@@ -1063,11 +1063,11 @@  discard block
 block discarded – undo
1063 1063
  * @access private
1064 1064
  */
1065 1065
 function _wp_render_title_tag() {
1066
-	if ( ! current_theme_supports( 'title-tag' ) ) {
1066
+	if ( ! current_theme_supports('title-tag')) {
1067 1067
 		return;
1068 1068
 	}
1069 1069
 
1070
-	echo '<title>' . wp_get_document_title() . '</title>' . "\n";
1070
+	echo '<title>'.wp_get_document_title().'</title>'."\n";
1071 1071
 }
1072 1072
 
1073 1073
 /**
@@ -1095,94 +1095,94 @@  discard block
 block discarded – undo
1095 1095
  * @param string $seplocation Optional. Direction to display title, 'right'.
1096 1096
  * @return string|null String on retrieve, null when displaying.
1097 1097
  */
1098
-function wp_title( $sep = '&raquo;', $display = true, $seplocation = '' ) {
1098
+function wp_title($sep = '&raquo;', $display = true, $seplocation = '') {
1099 1099
 	global $wp_locale;
1100 1100
 
1101
-	$m        = get_query_var( 'm' );
1102
-	$year     = get_query_var( 'year' );
1103
-	$monthnum = get_query_var( 'monthnum' );
1104
-	$day      = get_query_var( 'day' );
1105
-	$search   = get_query_var( 's' );
1101
+	$m        = get_query_var('m');
1102
+	$year     = get_query_var('year');
1103
+	$monthnum = get_query_var('monthnum');
1104
+	$day      = get_query_var('day');
1105
+	$search   = get_query_var('s');
1106 1106
 	$title    = '';
1107 1107
 
1108 1108
 	$t_sep = '%WP_TITLE_SEP%'; // Temporary separator, for accurate flipping, if necessary
1109 1109
 
1110 1110
 	// If there is a post
1111
-	if ( is_single() || ( is_home() && ! is_front_page() ) || ( is_page() && ! is_front_page() ) ) {
1112
-		$title = single_post_title( '', false );
1111
+	if (is_single() || (is_home() && ! is_front_page()) || (is_page() && ! is_front_page())) {
1112
+		$title = single_post_title('', false);
1113 1113
 	}
1114 1114
 
1115 1115
 	// If there's a post type archive
1116
-	if ( is_post_type_archive() ) {
1117
-		$post_type = get_query_var( 'post_type' );
1118
-		if ( is_array( $post_type ) ) {
1119
-			$post_type = reset( $post_type );
1116
+	if (is_post_type_archive()) {
1117
+		$post_type = get_query_var('post_type');
1118
+		if (is_array($post_type)) {
1119
+			$post_type = reset($post_type);
1120 1120
 		}
1121
-		$post_type_object = get_post_type_object( $post_type );
1122
-		if ( ! $post_type_object->has_archive ) {
1123
-			$title = post_type_archive_title( '', false );
1121
+		$post_type_object = get_post_type_object($post_type);
1122
+		if ( ! $post_type_object->has_archive) {
1123
+			$title = post_type_archive_title('', false);
1124 1124
 		}
1125 1125
 	}
1126 1126
 
1127 1127
 	// If there's a category or tag
1128
-	if ( is_category() || is_tag() ) {
1129
-		$title = single_term_title( '', false );
1128
+	if (is_category() || is_tag()) {
1129
+		$title = single_term_title('', false);
1130 1130
 	}
1131 1131
 
1132 1132
 	// If there's a taxonomy
1133
-	if ( is_tax() ) {
1133
+	if (is_tax()) {
1134 1134
 		$term = get_queried_object();
1135
-		if ( $term ) {
1136
-			$tax   = get_taxonomy( $term->taxonomy );
1137
-			$title = single_term_title( $tax->labels->name . $t_sep, false );
1135
+		if ($term) {
1136
+			$tax   = get_taxonomy($term->taxonomy);
1137
+			$title = single_term_title($tax->labels->name.$t_sep, false);
1138 1138
 		}
1139 1139
 	}
1140 1140
 
1141 1141
 	// If there's an author
1142
-	if ( is_author() && ! is_post_type_archive() ) {
1142
+	if (is_author() && ! is_post_type_archive()) {
1143 1143
 		$author = get_queried_object();
1144
-		if ( $author ) {
1144
+		if ($author) {
1145 1145
 			$title = $author->display_name;
1146 1146
 		}
1147 1147
 	}
1148 1148
 
1149 1149
 	// Post type archives with has_archive should override terms.
1150
-	if ( is_post_type_archive() && $post_type_object->has_archive ) {
1151
-		$title = post_type_archive_title( '', false );
1150
+	if (is_post_type_archive() && $post_type_object->has_archive) {
1151
+		$title = post_type_archive_title('', false);
1152 1152
 	}
1153 1153
 
1154 1154
 	// If there's a month
1155
-	if ( is_archive() && ! empty( $m ) ) {
1156
-		$my_year  = substr( $m, 0, 4 );
1157
-		$my_month = $wp_locale->get_month( substr( $m, 4, 2 ) );
1158
-		$my_day   = intval( substr( $m, 6, 2 ) );
1159
-		$title    = $my_year . ( $my_month ? $t_sep . $my_month : '' ) . ( $my_day ? $t_sep . $my_day : '' );
1155
+	if (is_archive() && ! empty($m)) {
1156
+		$my_year  = substr($m, 0, 4);
1157
+		$my_month = $wp_locale->get_month(substr($m, 4, 2));
1158
+		$my_day   = intval(substr($m, 6, 2));
1159
+		$title    = $my_year.($my_month ? $t_sep.$my_month : '').($my_day ? $t_sep.$my_day : '');
1160 1160
 	}
1161 1161
 
1162 1162
 	// If there's a year
1163
-	if ( is_archive() && ! empty( $year ) ) {
1163
+	if (is_archive() && ! empty($year)) {
1164 1164
 		$title = $year;
1165
-		if ( ! empty( $monthnum ) ) {
1166
-			$title .= $t_sep . $wp_locale->get_month( $monthnum );
1165
+		if ( ! empty($monthnum)) {
1166
+			$title .= $t_sep.$wp_locale->get_month($monthnum);
1167 1167
 		}
1168
-		if ( ! empty( $day ) ) {
1169
-			$title .= $t_sep . zeroise( $day, 2 );
1168
+		if ( ! empty($day)) {
1169
+			$title .= $t_sep.zeroise($day, 2);
1170 1170
 		}
1171 1171
 	}
1172 1172
 
1173 1173
 	// If it's a search
1174
-	if ( is_search() ) {
1174
+	if (is_search()) {
1175 1175
 		/* translators: 1: separator, 2: search phrase */
1176
-		$title = sprintf( __( 'Search Results %1$s %2$s' ), $t_sep, strip_tags( $search ) );
1176
+		$title = sprintf(__('Search Results %1$s %2$s'), $t_sep, strip_tags($search));
1177 1177
 	}
1178 1178
 
1179 1179
 	// If it's a 404 page
1180
-	if ( is_404() ) {
1181
-		$title = __( 'Page not found' );
1180
+	if (is_404()) {
1181
+		$title = __('Page not found');
1182 1182
 	}
1183 1183
 
1184 1184
 	$prefix = '';
1185
-	if ( ! empty( $title ) ) {
1185
+	if ( ! empty($title)) {
1186 1186
 		$prefix = " $sep ";
1187 1187
 	}
1188 1188
 
@@ -1193,14 +1193,14 @@  discard block
 block discarded – undo
1193 1193
 	 *
1194 1194
 	 * @param array $title_array Parts of the page title.
1195 1195
 	 */
1196
-	$title_array = apply_filters( 'wp_title_parts', explode( $t_sep, $title ) );
1196
+	$title_array = apply_filters('wp_title_parts', explode($t_sep, $title));
1197 1197
 
1198 1198
 	// Determines position of the separator and direction of the breadcrumb
1199
-	if ( 'right' == $seplocation ) { // sep on right, so reverse the order
1200
-		$title_array = array_reverse( $title_array );
1201
-		$title       = implode( " $sep ", $title_array ) . $prefix;
1199
+	if ('right' == $seplocation) { // sep on right, so reverse the order
1200
+		$title_array = array_reverse($title_array);
1201
+		$title       = implode(" $sep ", $title_array).$prefix;
1202 1202
 	} else {
1203
-		$title = $prefix . implode( " $sep ", $title_array );
1203
+		$title = $prefix.implode(" $sep ", $title_array);
1204 1204
 	}
1205 1205
 
1206 1206
 	/**
@@ -1212,10 +1212,10 @@  discard block
 block discarded – undo
1212 1212
 	 * @param string $sep Title separator.
1213 1213
 	 * @param string $seplocation Location of the separator (left or right).
1214 1214
 	 */
1215
-	$title = apply_filters( 'wp_title', $title, $sep, $seplocation );
1215
+	$title = apply_filters('wp_title', $title, $sep, $seplocation);
1216 1216
 
1217 1217
 	// Send it out
1218
-	if ( $display ) {
1218
+	if ($display) {
1219 1219
 		echo $title;
1220 1220
 	} else {
1221 1221
 		return $title;
@@ -1238,10 +1238,10 @@  discard block
 block discarded – undo
1238 1238
  * @param bool   $display Optional, default is true. Whether to display or retrieve title.
1239 1239
  * @return string|void Title when retrieving.
1240 1240
  */
1241
-function single_post_title( $prefix = '', $display = true ) {
1241
+function single_post_title($prefix = '', $display = true) {
1242 1242
 	$_post = get_queried_object();
1243 1243
 
1244
-	if ( !isset($_post->post_title) )
1244
+	if ( ! isset($_post->post_title))
1245 1245
 		return;
1246 1246
 
1247 1247
 	/**
@@ -1252,11 +1252,11 @@  discard block
 block discarded – undo
1252 1252
 	 * @param string $_post_title The single post page title.
1253 1253
 	 * @param object $_post       The current queried object as returned by get_queried_object().
1254 1254
 	 */
1255
-	$title = apply_filters( 'single_post_title', $_post->post_title, $_post );
1256
-	if ( $display )
1257
-		echo $prefix . $title;
1255
+	$title = apply_filters('single_post_title', $_post->post_title, $_post);
1256
+	if ($display)
1257
+		echo $prefix.$title;
1258 1258
 	else
1259
-		return $prefix . $title;
1259
+		return $prefix.$title;
1260 1260
 }
1261 1261
 
1262 1262
 /**
@@ -1271,15 +1271,15 @@  discard block
 block discarded – undo
1271 1271
  * @param bool   $display Optional, default is true. Whether to display or retrieve title.
1272 1272
  * @return string|void Title when retrieving, null when displaying or failure.
1273 1273
  */
1274
-function post_type_archive_title( $prefix = '', $display = true ) {
1275
-	if ( ! is_post_type_archive() )
1274
+function post_type_archive_title($prefix = '', $display = true) {
1275
+	if ( ! is_post_type_archive())
1276 1276
 		return;
1277 1277
 
1278
-	$post_type = get_query_var( 'post_type' );
1279
-	if ( is_array( $post_type ) )
1280
-		$post_type = reset( $post_type );
1278
+	$post_type = get_query_var('post_type');
1279
+	if (is_array($post_type))
1280
+		$post_type = reset($post_type);
1281 1281
 
1282
-	$post_type_obj = get_post_type_object( $post_type );
1282
+	$post_type_obj = get_post_type_object($post_type);
1283 1283
 
1284 1284
 	/**
1285 1285
 	 * Filter the post type archive title.
@@ -1289,12 +1289,12 @@  discard block
 block discarded – undo
1289 1289
 	 * @param string $post_type_name Post type 'name' label.
1290 1290
 	 * @param string $post_type      Post type.
1291 1291
 	 */
1292
-	$title = apply_filters( 'post_type_archive_title', $post_type_obj->labels->name, $post_type );
1292
+	$title = apply_filters('post_type_archive_title', $post_type_obj->labels->name, $post_type);
1293 1293
 
1294
-	if ( $display )
1295
-		echo $prefix . $title;
1294
+	if ($display)
1295
+		echo $prefix.$title;
1296 1296
 	else
1297
-		return $prefix . $title;
1297
+		return $prefix.$title;
1298 1298
 }
1299 1299
 
1300 1300
 /**
@@ -1310,8 +1310,8 @@  discard block
 block discarded – undo
1310 1310
  * @param bool   $display Optional, default is true. Whether to display or retrieve title.
1311 1311
  * @return string|void Title when retrieving.
1312 1312
  */
1313
-function single_cat_title( $prefix = '', $display = true ) {
1314
-	return single_term_title( $prefix, $display );
1313
+function single_cat_title($prefix = '', $display = true) {
1314
+	return single_term_title($prefix, $display);
1315 1315
 }
1316 1316
 
1317 1317
 /**
@@ -1327,8 +1327,8 @@  discard block
 block discarded – undo
1327 1327
  * @param bool   $display Optional, default is true. Whether to display or retrieve title.
1328 1328
  * @return string|void Title when retrieving.
1329 1329
  */
1330
-function single_tag_title( $prefix = '', $display = true ) {
1331
-	return single_term_title( $prefix, $display );
1330
+function single_tag_title($prefix = '', $display = true) {
1331
+	return single_term_title($prefix, $display);
1332 1332
 }
1333 1333
 
1334 1334
 /**
@@ -1344,13 +1344,13 @@  discard block
 block discarded – undo
1344 1344
  * @param bool   $display Optional, default is true. Whether to display or retrieve title.
1345 1345
  * @return string|void Title when retrieving.
1346 1346
  */
1347
-function single_term_title( $prefix = '', $display = true ) {
1347
+function single_term_title($prefix = '', $display = true) {
1348 1348
 	$term = get_queried_object();
1349 1349
 
1350
-	if ( !$term )
1350
+	if ( ! $term)
1351 1351
 		return;
1352 1352
 
1353
-	if ( is_category() ) {
1353
+	if (is_category()) {
1354 1354
 		/**
1355 1355
 		 * Filter the category archive page title.
1356 1356
 		 *
@@ -1358,8 +1358,8 @@  discard block
 block discarded – undo
1358 1358
 		 *
1359 1359
 		 * @param string $term_name Category name for archive being displayed.
1360 1360
 		 */
1361
-		$term_name = apply_filters( 'single_cat_title', $term->name );
1362
-	} elseif ( is_tag() ) {
1361
+		$term_name = apply_filters('single_cat_title', $term->name);
1362
+	} elseif (is_tag()) {
1363 1363
 		/**
1364 1364
 		 * Filter the tag archive page title.
1365 1365
 		 *
@@ -1367,8 +1367,8 @@  discard block
 block discarded – undo
1367 1367
 		 *
1368 1368
 		 * @param string $term_name Tag name for archive being displayed.
1369 1369
 		 */
1370
-		$term_name = apply_filters( 'single_tag_title', $term->name );
1371
-	} elseif ( is_tax() ) {
1370
+		$term_name = apply_filters('single_tag_title', $term->name);
1371
+	} elseif (is_tax()) {
1372 1372
 		/**
1373 1373
 		 * Filter the custom taxonomy archive page title.
1374 1374
 		 *
@@ -1376,18 +1376,18 @@  discard block
 block discarded – undo
1376 1376
 		 *
1377 1377
 		 * @param string $term_name Term name for archive being displayed.
1378 1378
 		 */
1379
-		$term_name = apply_filters( 'single_term_title', $term->name );
1379
+		$term_name = apply_filters('single_term_title', $term->name);
1380 1380
 	} else {
1381 1381
 		return;
1382 1382
 	}
1383 1383
 
1384
-	if ( empty( $term_name ) )
1384
+	if (empty($term_name))
1385 1385
 		return;
1386 1386
 
1387
-	if ( $display )
1388
-		echo $prefix . $term_name;
1387
+	if ($display)
1388
+		echo $prefix.$term_name;
1389 1389
 	else
1390
-		return $prefix . $term_name;
1390
+		return $prefix.$term_name;
1391 1391
 }
1392 1392
 
1393 1393
 /**
@@ -1406,27 +1406,27 @@  discard block
 block discarded – undo
1406 1406
  * @param bool   $display Optional, default is true. Whether to display or retrieve title.
1407 1407
  * @return string|void Title when retrieving.
1408 1408
  */
1409
-function single_month_title($prefix = '', $display = true ) {
1409
+function single_month_title($prefix = '', $display = true) {
1410 1410
 	global $wp_locale;
1411 1411
 
1412 1412
 	$m = get_query_var('m');
1413 1413
 	$year = get_query_var('year');
1414 1414
 	$monthnum = get_query_var('monthnum');
1415 1415
 
1416
-	if ( !empty($monthnum) && !empty($year) ) {
1416
+	if ( ! empty($monthnum) && ! empty($year)) {
1417 1417
 		$my_year = $year;
1418 1418
 		$my_month = $wp_locale->get_month($monthnum);
1419
-	} elseif ( !empty($m) ) {
1419
+	} elseif ( ! empty($m)) {
1420 1420
 		$my_year = substr($m, 0, 4);
1421 1421
 		$my_month = $wp_locale->get_month(substr($m, 4, 2));
1422 1422
 	}
1423 1423
 
1424
-	if ( empty($my_month) )
1424
+	if (empty($my_month))
1425 1425
 		return false;
1426 1426
 
1427
-	$result = $prefix . $my_month . $prefix . $my_year;
1427
+	$result = $prefix.$my_month.$prefix.$my_year;
1428 1428
 
1429
-	if ( !$display )
1429
+	if ( ! $display)
1430 1430
 		return $result;
1431 1431
 	echo $result;
1432 1432
 }
@@ -1441,11 +1441,11 @@  discard block
 block discarded – undo
1441 1441
  * @param string $before Optional. Content to prepend to the title. Default empty.
1442 1442
  * @param string $after  Optional. Content to append to the title. Default empty.
1443 1443
  */
1444
-function the_archive_title( $before = '', $after = '' ) {
1444
+function the_archive_title($before = '', $after = '') {
1445 1445
 	$title = get_the_archive_title();
1446 1446
 
1447
-	if ( ! empty( $title ) ) {
1448
-		echo $before . $title . $after;
1447
+	if ( ! empty($title)) {
1448
+		echo $before.$title.$after;
1449 1449
 	}
1450 1450
 }
1451 1451
 
@@ -1457,46 +1457,46 @@  discard block
 block discarded – undo
1457 1457
  * @return string Archive title.
1458 1458
  */
1459 1459
 function get_the_archive_title() {
1460
-	if ( is_category() ) {
1461
-		$title = sprintf( __( 'Category: %s' ), single_cat_title( '', false ) );
1462
-	} elseif ( is_tag() ) {
1463
-		$title = sprintf( __( 'Tag: %s' ), single_tag_title( '', false ) );
1464
-	} elseif ( is_author() ) {
1465
-		$title = sprintf( __( 'Author: %s' ), '<span class="vcard">' . get_the_author() . '</span>' );
1466
-	} elseif ( is_year() ) {
1467
-		$title = sprintf( __( 'Year: %s' ), get_the_date( _x( 'Y', 'yearly archives date format' ) ) );
1468
-	} elseif ( is_month() ) {
1469
-		$title = sprintf( __( 'Month: %s' ), get_the_date( _x( 'F Y', 'monthly archives date format' ) ) );
1470
-	} elseif ( is_day() ) {
1471
-		$title = sprintf( __( 'Day: %s' ), get_the_date( _x( 'F j, Y', 'daily archives date format' ) ) );
1472
-	} elseif ( is_tax( 'post_format' ) ) {
1473
-		if ( is_tax( 'post_format', 'post-format-aside' ) ) {
1474
-			$title = _x( 'Asides', 'post format archive title' );
1475
-		} elseif ( is_tax( 'post_format', 'post-format-gallery' ) ) {
1476
-			$title = _x( 'Galleries', 'post format archive title' );
1477
-		} elseif ( is_tax( 'post_format', 'post-format-image' ) ) {
1478
-			$title = _x( 'Images', 'post format archive title' );
1479
-		} elseif ( is_tax( 'post_format', 'post-format-video' ) ) {
1480
-			$title = _x( 'Videos', 'post format archive title' );
1481
-		} elseif ( is_tax( 'post_format', 'post-format-quote' ) ) {
1482
-			$title = _x( 'Quotes', 'post format archive title' );
1483
-		} elseif ( is_tax( 'post_format', 'post-format-link' ) ) {
1484
-			$title = _x( 'Links', 'post format archive title' );
1485
-		} elseif ( is_tax( 'post_format', 'post-format-status' ) ) {
1486
-			$title = _x( 'Statuses', 'post format archive title' );
1487
-		} elseif ( is_tax( 'post_format', 'post-format-audio' ) ) {
1488
-			$title = _x( 'Audio', 'post format archive title' );
1489
-		} elseif ( is_tax( 'post_format', 'post-format-chat' ) ) {
1490
-			$title = _x( 'Chats', 'post format archive title' );
1460
+	if (is_category()) {
1461
+		$title = sprintf(__('Category: %s'), single_cat_title('', false));
1462
+	} elseif (is_tag()) {
1463
+		$title = sprintf(__('Tag: %s'), single_tag_title('', false));
1464
+	} elseif (is_author()) {
1465
+		$title = sprintf(__('Author: %s'), '<span class="vcard">'.get_the_author().'</span>');
1466
+	} elseif (is_year()) {
1467
+		$title = sprintf(__('Year: %s'), get_the_date(_x('Y', 'yearly archives date format')));
1468
+	} elseif (is_month()) {
1469
+		$title = sprintf(__('Month: %s'), get_the_date(_x('F Y', 'monthly archives date format')));
1470
+	} elseif (is_day()) {
1471
+		$title = sprintf(__('Day: %s'), get_the_date(_x('F j, Y', 'daily archives date format')));
1472
+	} elseif (is_tax('post_format')) {
1473
+		if (is_tax('post_format', 'post-format-aside')) {
1474
+			$title = _x('Asides', 'post format archive title');
1475
+		} elseif (is_tax('post_format', 'post-format-gallery')) {
1476
+			$title = _x('Galleries', 'post format archive title');
1477
+		} elseif (is_tax('post_format', 'post-format-image')) {
1478
+			$title = _x('Images', 'post format archive title');
1479
+		} elseif (is_tax('post_format', 'post-format-video')) {
1480
+			$title = _x('Videos', 'post format archive title');
1481
+		} elseif (is_tax('post_format', 'post-format-quote')) {
1482
+			$title = _x('Quotes', 'post format archive title');
1483
+		} elseif (is_tax('post_format', 'post-format-link')) {
1484
+			$title = _x('Links', 'post format archive title');
1485
+		} elseif (is_tax('post_format', 'post-format-status')) {
1486
+			$title = _x('Statuses', 'post format archive title');
1487
+		} elseif (is_tax('post_format', 'post-format-audio')) {
1488
+			$title = _x('Audio', 'post format archive title');
1489
+		} elseif (is_tax('post_format', 'post-format-chat')) {
1490
+			$title = _x('Chats', 'post format archive title');
1491 1491
 		}
1492
-	} elseif ( is_post_type_archive() ) {
1493
-		$title = sprintf( __( 'Archives: %s' ), post_type_archive_title( '', false ) );
1494
-	} elseif ( is_tax() ) {
1495
-		$tax = get_taxonomy( get_queried_object()->taxonomy );
1492
+	} elseif (is_post_type_archive()) {
1493
+		$title = sprintf(__('Archives: %s'), post_type_archive_title('', false));
1494
+	} elseif (is_tax()) {
1495
+		$tax = get_taxonomy(get_queried_object()->taxonomy);
1496 1496
 		/* translators: 1: Taxonomy singular name, 2: Current taxonomy term */
1497
-		$title = sprintf( __( '%1$s: %2$s' ), $tax->labels->singular_name, single_term_title( '', false ) );
1497
+		$title = sprintf(__('%1$s: %2$s'), $tax->labels->singular_name, single_term_title('', false));
1498 1498
 	} else {
1499
-		$title = __( 'Archives' );
1499
+		$title = __('Archives');
1500 1500
 	}
1501 1501
 
1502 1502
 	/**
@@ -1506,7 +1506,7 @@  discard block
 block discarded – undo
1506 1506
 	 *
1507 1507
 	 * @param string $title Archive title to be displayed.
1508 1508
 	 */
1509
-	return apply_filters( 'get_the_archive_title', $title );
1509
+	return apply_filters('get_the_archive_title', $title);
1510 1510
 }
1511 1511
 
1512 1512
 /**
@@ -1519,10 +1519,10 @@  discard block
 block discarded – undo
1519 1519
  * @param string $before Optional. Content to prepend to the description. Default empty.
1520 1520
  * @param string $after  Optional. Content to append to the description. Default empty.
1521 1521
  */
1522
-function the_archive_description( $before = '', $after = '' ) {
1522
+function the_archive_description($before = '', $after = '') {
1523 1523
 	$description = get_the_archive_description();
1524
-	if ( $description ) {
1525
-		echo $before . $description . $after;
1524
+	if ($description) {
1525
+		echo $before.$description.$after;
1526 1526
 	}
1527 1527
 }
1528 1528
 
@@ -1543,7 +1543,7 @@  discard block
 block discarded – undo
1543 1543
 	 *
1544 1544
 	 * @param string $description Archive description to be displayed.
1545 1545
 	 */
1546
-	return apply_filters( 'get_the_archive_description', term_description() );
1546
+	return apply_filters('get_the_archive_description', term_description());
1547 1547
 }
1548 1548
 
1549 1549
 /**
@@ -1584,7 +1584,7 @@  discard block
 block discarded – undo
1584 1584
 	$url = esc_url($url);
1585 1585
 
1586 1586
 	if ('link' == $format)
1587
-		$link_html = "\t<link rel='archives' title='" . esc_attr( $text ) . "' href='$url' />\n";
1587
+		$link_html = "\t<link rel='archives' title='".esc_attr($text)."' href='$url' />\n";
1588 1588
 	elseif ('option' == $format)
1589 1589
 		$link_html = "\t<option value='$url'>$before $text $after</option>\n";
1590 1590
 	elseif ('html' == $format)
@@ -1605,7 +1605,7 @@  discard block
 block discarded – undo
1605 1605
 	 * @param string $before    Content to prepend to the description.
1606 1606
 	 * @param string $after     Content to append to the description.
1607 1607
 	 */
1608
-	return apply_filters( 'get_archives_link', $link_html, $url, $text, $format, $before, $after );
1608
+	return apply_filters('get_archives_link', $link_html, $url, $text, $format, $before, $after);
1609 1609
 }
1610 1610
 
1611 1611
 /**
@@ -1643,7 +1643,7 @@  discard block
 block discarded – undo
1643 1643
  * }
1644 1644
  * @return string|void String when retrieving.
1645 1645
  */
1646
-function wp_get_archives( $args = '' ) {
1646
+function wp_get_archives($args = '') {
1647 1647
 	global $wpdb, $wp_locale;
1648 1648
 
1649 1649
 	$defaults = array(
@@ -1654,32 +1654,32 @@  discard block
 block discarded – undo
1654 1654
 		'post_type' => 'post'
1655 1655
 	);
1656 1656
 
1657
-	$r = wp_parse_args( $args, $defaults );
1657
+	$r = wp_parse_args($args, $defaults);
1658 1658
 
1659
-	$post_type_object = get_post_type_object( $r['post_type'] );
1660
-	if ( ! is_post_type_viewable( $post_type_object ) ) {
1659
+	$post_type_object = get_post_type_object($r['post_type']);
1660
+	if ( ! is_post_type_viewable($post_type_object)) {
1661 1661
 		return;
1662 1662
 	}
1663 1663
 	$r['post_type'] = $post_type_object->name;
1664 1664
 
1665
-	if ( '' == $r['type'] ) {
1665
+	if ('' == $r['type']) {
1666 1666
 		$r['type'] = 'monthly';
1667 1667
 	}
1668 1668
 
1669
-	if ( ! empty( $r['limit'] ) ) {
1670
-		$r['limit'] = absint( $r['limit'] );
1671
-		$r['limit'] = ' LIMIT ' . $r['limit'];
1669
+	if ( ! empty($r['limit'])) {
1670
+		$r['limit'] = absint($r['limit']);
1671
+		$r['limit'] = ' LIMIT '.$r['limit'];
1672 1672
 	}
1673 1673
 
1674
-	$order = strtoupper( $r['order'] );
1675
-	if ( $order !== 'ASC' ) {
1674
+	$order = strtoupper($r['order']);
1675
+	if ($order !== 'ASC') {
1676 1676
 		$order = 'DESC';
1677 1677
 	}
1678 1678
 
1679 1679
 	// this is what will separate dates on weekly archive links
1680 1680
 	$archive_week_separator = '&#8211;';
1681 1681
 
1682
-	$sql_where = $wpdb->prepare( "WHERE post_type = %s AND post_status = 'publish'", $r['post_type'] );
1682
+	$sql_where = $wpdb->prepare("WHERE post_type = %s AND post_status = 'publish'", $r['post_type']);
1683 1683
 
1684 1684
 	/**
1685 1685
 	 * Filter the SQL WHERE clause for retrieving archives.
@@ -1689,7 +1689,7 @@  discard block
 block discarded – undo
1689 1689
 	 * @param string $sql_where Portion of SQL query containing the WHERE clause.
1690 1690
 	 * @param array  $r         An array of default arguments.
1691 1691
 	 */
1692
-	$where = apply_filters( 'getarchives_where', $sql_where, $r );
1692
+	$where = apply_filters('getarchives_where', $sql_where, $r);
1693 1693
 
1694 1694
 	/**
1695 1695
 	 * Filter the SQL JOIN clause for retrieving archives.
@@ -1699,142 +1699,142 @@  discard block
 block discarded – undo
1699 1699
 	 * @param string $sql_join Portion of SQL query containing JOIN clause.
1700 1700
 	 * @param array  $r        An array of default arguments.
1701 1701
 	 */
1702
-	$join = apply_filters( 'getarchives_join', '', $r );
1702
+	$join = apply_filters('getarchives_join', '', $r);
1703 1703
 
1704 1704
 	$output = '';
1705 1705
 
1706
-	$last_changed = wp_cache_get( 'last_changed', 'posts' );
1707
-	if ( ! $last_changed ) {
1706
+	$last_changed = wp_cache_get('last_changed', 'posts');
1707
+	if ( ! $last_changed) {
1708 1708
 		$last_changed = microtime();
1709
-		wp_cache_set( 'last_changed', $last_changed, 'posts' );
1709
+		wp_cache_set('last_changed', $last_changed, 'posts');
1710 1710
 	}
1711 1711
 
1712 1712
 	$limit = $r['limit'];
1713 1713
 
1714
-	if ( 'monthly' == $r['type'] ) {
1714
+	if ('monthly' == $r['type']) {
1715 1715
 		$query = "SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date $order $limit";
1716
-		$key = md5( $query );
1716
+		$key = md5($query);
1717 1717
 		$key = "wp_get_archives:$key:$last_changed";
1718
-		if ( ! $results = wp_cache_get( $key, 'posts' ) ) {
1719
-			$results = $wpdb->get_results( $query );
1720
-			wp_cache_set( $key, $results, 'posts' );
1718
+		if ( ! $results = wp_cache_get($key, 'posts')) {
1719
+			$results = $wpdb->get_results($query);
1720
+			wp_cache_set($key, $results, 'posts');
1721 1721
 		}
1722
-		if ( $results ) {
1722
+		if ($results) {
1723 1723
 			$after = $r['after'];
1724
-			foreach ( (array) $results as $result ) {
1725
-				$url = get_month_link( $result->year, $result->month );
1726
-				if ( 'post' !== $r['post_type'] ) {
1727
-					$url = add_query_arg( 'post_type', $r['post_type'], $url );
1724
+			foreach ((array) $results as $result) {
1725
+				$url = get_month_link($result->year, $result->month);
1726
+				if ('post' !== $r['post_type']) {
1727
+					$url = add_query_arg('post_type', $r['post_type'], $url);
1728 1728
 				}
1729 1729
 				/* translators: 1: month name, 2: 4-digit year */
1730
-				$text = sprintf( __( '%1$s %2$d' ), $wp_locale->get_month( $result->month ), $result->year );
1731
-				if ( $r['show_post_count'] ) {
1732
-					$r['after'] = '&nbsp;(' . $result->posts . ')' . $after;
1730
+				$text = sprintf(__('%1$s %2$d'), $wp_locale->get_month($result->month), $result->year);
1731
+				if ($r['show_post_count']) {
1732
+					$r['after'] = '&nbsp;('.$result->posts.')'.$after;
1733 1733
 				}
1734
-				$output .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'] );
1734
+				$output .= get_archives_link($url, $text, $r['format'], $r['before'], $r['after']);
1735 1735
 			}
1736 1736
 		}
1737
-	} elseif ( 'yearly' == $r['type'] ) {
1737
+	} elseif ('yearly' == $r['type']) {
1738 1738
 		$query = "SELECT YEAR(post_date) AS `year`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date) ORDER BY post_date $order $limit";
1739
-		$key = md5( $query );
1739
+		$key = md5($query);
1740 1740
 		$key = "wp_get_archives:$key:$last_changed";
1741
-		if ( ! $results = wp_cache_get( $key, 'posts' ) ) {
1742
-			$results = $wpdb->get_results( $query );
1743
-			wp_cache_set( $key, $results, 'posts' );
1741
+		if ( ! $results = wp_cache_get($key, 'posts')) {
1742
+			$results = $wpdb->get_results($query);
1743
+			wp_cache_set($key, $results, 'posts');
1744 1744
 		}
1745
-		if ( $results ) {
1745
+		if ($results) {
1746 1746
 			$after = $r['after'];
1747
-			foreach ( (array) $results as $result) {
1748
-				$url = get_year_link( $result->year );
1749
-				if ( 'post' !== $r['post_type'] ) {
1750
-					$url = add_query_arg( 'post_type', $r['post_type'], $url );
1747
+			foreach ((array) $results as $result) {
1748
+				$url = get_year_link($result->year);
1749
+				if ('post' !== $r['post_type']) {
1750
+					$url = add_query_arg('post_type', $r['post_type'], $url);
1751 1751
 				}
1752
-				$text = sprintf( '%d', $result->year );
1753
-				if ( $r['show_post_count'] ) {
1754
-					$r['after'] = '&nbsp;(' . $result->posts . ')' . $after;
1752
+				$text = sprintf('%d', $result->year);
1753
+				if ($r['show_post_count']) {
1754
+					$r['after'] = '&nbsp;('.$result->posts.')'.$after;
1755 1755
 				}
1756
-				$output .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'] );
1756
+				$output .= get_archives_link($url, $text, $r['format'], $r['before'], $r['after']);
1757 1757
 			}
1758 1758
 		}
1759
-	} elseif ( 'daily' == $r['type'] ) {
1759
+	} elseif ('daily' == $r['type']) {
1760 1760
 		$query = "SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date), DAYOFMONTH(post_date) ORDER BY post_date $order $limit";
1761
-		$key = md5( $query );
1761
+		$key = md5($query);
1762 1762
 		$key = "wp_get_archives:$key:$last_changed";
1763
-		if ( ! $results = wp_cache_get( $key, 'posts' ) ) {
1764
-			$results = $wpdb->get_results( $query );
1765
-			wp_cache_set( $key, $results, 'posts' );
1763
+		if ( ! $results = wp_cache_get($key, 'posts')) {
1764
+			$results = $wpdb->get_results($query);
1765
+			wp_cache_set($key, $results, 'posts');
1766 1766
 		}
1767
-		if ( $results ) {
1767
+		if ($results) {
1768 1768
 			$after = $r['after'];
1769
-			foreach ( (array) $results as $result ) {
1770
-				$url  = get_day_link( $result->year, $result->month, $result->dayofmonth );
1771
-				if ( 'post' !== $r['post_type'] ) {
1772
-					$url = add_query_arg( 'post_type', $r['post_type'], $url );
1769
+			foreach ((array) $results as $result) {
1770
+				$url  = get_day_link($result->year, $result->month, $result->dayofmonth);
1771
+				if ('post' !== $r['post_type']) {
1772
+					$url = add_query_arg('post_type', $r['post_type'], $url);
1773 1773
 				}
1774
-				$date = sprintf( '%1$d-%2$02d-%3$02d 00:00:00', $result->year, $result->month, $result->dayofmonth );
1775
-				$text = mysql2date( get_option( 'date_format' ), $date );
1776
-				if ( $r['show_post_count'] ) {
1777
-					$r['after'] = '&nbsp;(' . $result->posts . ')' . $after;
1774
+				$date = sprintf('%1$d-%2$02d-%3$02d 00:00:00', $result->year, $result->month, $result->dayofmonth);
1775
+				$text = mysql2date(get_option('date_format'), $date);
1776
+				if ($r['show_post_count']) {
1777
+					$r['after'] = '&nbsp;('.$result->posts.')'.$after;
1778 1778
 				}
1779
-				$output .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'] );
1779
+				$output .= get_archives_link($url, $text, $r['format'], $r['before'], $r['after']);
1780 1780
 			}
1781 1781
 		}
1782
-	} elseif ( 'weekly' == $r['type'] ) {
1783
-		$week = _wp_mysql_week( '`post_date`' );
1782
+	} elseif ('weekly' == $r['type']) {
1783
+		$week = _wp_mysql_week('`post_date`');
1784 1784
 		$query = "SELECT DISTINCT $week AS `week`, YEAR( `post_date` ) AS `yr`, DATE_FORMAT( `post_date`, '%Y-%m-%d' ) AS `yyyymmdd`, count( `ID` ) AS `posts` FROM `$wpdb->posts` $join $where GROUP BY $week, YEAR( `post_date` ) ORDER BY `post_date` $order $limit";
1785
-		$key = md5( $query );
1785
+		$key = md5($query);
1786 1786
 		$key = "wp_get_archives:$key:$last_changed";
1787
-		if ( ! $results = wp_cache_get( $key, 'posts' ) ) {
1788
-			$results = $wpdb->get_results( $query );
1789
-			wp_cache_set( $key, $results, 'posts' );
1787
+		if ( ! $results = wp_cache_get($key, 'posts')) {
1788
+			$results = $wpdb->get_results($query);
1789
+			wp_cache_set($key, $results, 'posts');
1790 1790
 		}
1791 1791
 		$arc_w_last = '';
1792
-		if ( $results ) {
1792
+		if ($results) {
1793 1793
 			$after = $r['after'];
1794
-			foreach ( (array) $results as $result ) {
1795
-				if ( $result->week != $arc_w_last ) {
1794
+			foreach ((array) $results as $result) {
1795
+				if ($result->week != $arc_w_last) {
1796 1796
 					$arc_year       = $result->yr;
1797 1797
 					$arc_w_last     = $result->week;
1798
-					$arc_week       = get_weekstartend( $result->yyyymmdd, get_option( 'start_of_week' ) );
1799
-					$arc_week_start = date_i18n( get_option( 'date_format' ), $arc_week['start'] );
1800
-					$arc_week_end   = date_i18n( get_option( 'date_format' ), $arc_week['end'] );
1801
-					$url            = sprintf( '%1$s/%2$s%3$sm%4$s%5$s%6$sw%7$s%8$d', home_url(), '', '?', '=', $arc_year, '&amp;', '=', $result->week );
1802
-					if ( 'post' !== $r['post_type'] ) {
1803
-						$url = add_query_arg( 'post_type', $r['post_type'], $url );
1798
+					$arc_week       = get_weekstartend($result->yyyymmdd, get_option('start_of_week'));
1799
+					$arc_week_start = date_i18n(get_option('date_format'), $arc_week['start']);
1800
+					$arc_week_end   = date_i18n(get_option('date_format'), $arc_week['end']);
1801
+					$url            = sprintf('%1$s/%2$s%3$sm%4$s%5$s%6$sw%7$s%8$d', home_url(), '', '?', '=', $arc_year, '&amp;', '=', $result->week);
1802
+					if ('post' !== $r['post_type']) {
1803
+						$url = add_query_arg('post_type', $r['post_type'], $url);
1804 1804
 					}
1805
-					$text           = $arc_week_start . $archive_week_separator . $arc_week_end;
1806
-					if ( $r['show_post_count'] ) {
1807
-						$r['after'] = '&nbsp;(' . $result->posts . ')' . $after;
1805
+					$text = $arc_week_start.$archive_week_separator.$arc_week_end;
1806
+					if ($r['show_post_count']) {
1807
+						$r['after'] = '&nbsp;('.$result->posts.')'.$after;
1808 1808
 					}
1809
-					$output .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'] );
1809
+					$output .= get_archives_link($url, $text, $r['format'], $r['before'], $r['after']);
1810 1810
 				}
1811 1811
 			}
1812 1812
 		}
1813
-	} elseif ( ( 'postbypost' == $r['type'] ) || ('alpha' == $r['type'] ) ) {
1814
-		$orderby = ( 'alpha' == $r['type'] ) ? 'post_title ASC ' : 'post_date DESC, ID DESC ';
1813
+	} elseif (('postbypost' == $r['type']) || ('alpha' == $r['type'])) {
1814
+		$orderby = ('alpha' == $r['type']) ? 'post_title ASC ' : 'post_date DESC, ID DESC ';
1815 1815
 		$query = "SELECT * FROM $wpdb->posts $join $where ORDER BY $orderby $limit";
1816
-		$key = md5( $query );
1816
+		$key = md5($query);
1817 1817
 		$key = "wp_get_archives:$key:$last_changed";
1818
-		if ( ! $results = wp_cache_get( $key, 'posts' ) ) {
1819
-			$results = $wpdb->get_results( $query );
1820
-			wp_cache_set( $key, $results, 'posts' );
1818
+		if ( ! $results = wp_cache_get($key, 'posts')) {
1819
+			$results = $wpdb->get_results($query);
1820
+			wp_cache_set($key, $results, 'posts');
1821 1821
 		}
1822
-		if ( $results ) {
1823
-			foreach ( (array) $results as $result ) {
1824
-				if ( $result->post_date != '0000-00-00 00:00:00' ) {
1825
-					$url = get_permalink( $result );
1826
-					if ( $result->post_title ) {
1822
+		if ($results) {
1823
+			foreach ((array) $results as $result) {
1824
+				if ($result->post_date != '0000-00-00 00:00:00') {
1825
+					$url = get_permalink($result);
1826
+					if ($result->post_title) {
1827 1827
 						/** This filter is documented in wp-includes/post-template.php */
1828
-						$text = strip_tags( apply_filters( 'the_title', $result->post_title, $result->ID ) );
1828
+						$text = strip_tags(apply_filters('the_title', $result->post_title, $result->ID));
1829 1829
 					} else {
1830 1830
 						$text = $result->ID;
1831 1831
 					}
1832
-					$output .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'] );
1832
+					$output .= get_archives_link($url, $text, $r['format'], $r['before'], $r['after']);
1833 1833
 				}
1834 1834
 			}
1835 1835
 		}
1836 1836
 	}
1837
-	if ( $r['echo'] ) {
1837
+	if ($r['echo']) {
1838 1838
 		echo $output;
1839 1839
 	} else {
1840 1840
 		return $output;
@@ -1851,7 +1851,7 @@  discard block
 block discarded – undo
1851 1851
  */
1852 1852
 function calendar_week_mod($num) {
1853 1853
 	$base = 7;
1854
-	return ($num - $base*floor($num/$base));
1854
+	return ($num - $base * floor($num / $base));
1855 1855
 }
1856 1856
 
1857 1857
 /**
@@ -1873,17 +1873,17 @@  discard block
 block discarded – undo
1873 1873
  * @param bool $echo    Optional, default is true. Set to false for return.
1874 1874
  * @return string|void String when retrieving.
1875 1875
  */
1876
-function get_calendar( $initial = true, $echo = true ) {
1876
+function get_calendar($initial = true, $echo = true) {
1877 1877
 	global $wpdb, $m, $monthnum, $year, $wp_locale, $posts;
1878 1878
 
1879
-	$key = md5( $m . $monthnum . $year );
1880
-	$cache = wp_cache_get( 'get_calendar', 'calendar' );
1879
+	$key = md5($m.$monthnum.$year);
1880
+	$cache = wp_cache_get('get_calendar', 'calendar');
1881 1881
 
1882
-	if ( $cache && is_array( $cache ) && isset( $cache[ $key ] ) ) {
1882
+	if ($cache && is_array($cache) && isset($cache[$key])) {
1883 1883
 		/** This filter is documented in wp-includes/general-template.php */
1884
-		$output = apply_filters( 'get_calendar', $cache[ $key ] );
1884
+		$output = apply_filters('get_calendar', $cache[$key]);
1885 1885
 
1886
-		if ( $echo ) {
1886
+		if ($echo) {
1887 1887
 			echo $output;
1888 1888
 			return;
1889 1889
 		}
@@ -1891,51 +1891,51 @@  discard block
 block discarded – undo
1891 1891
 		return $output;
1892 1892
 	}
1893 1893
 
1894
-	if ( ! is_array( $cache ) ) {
1894
+	if ( ! is_array($cache)) {
1895 1895
 		$cache = array();
1896 1896
 	}
1897 1897
 
1898 1898
 	// Quick check. If we have no posts at all, abort!
1899
-	if ( ! $posts ) {
1899
+	if ( ! $posts) {
1900 1900
 		$gotsome = $wpdb->get_var("SELECT 1 as test FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' LIMIT 1");
1901
-		if ( ! $gotsome ) {
1902
-			$cache[ $key ] = '';
1903
-			wp_cache_set( 'get_calendar', $cache, 'calendar' );
1901
+		if ( ! $gotsome) {
1902
+			$cache[$key] = '';
1903
+			wp_cache_set('get_calendar', $cache, 'calendar');
1904 1904
 			return;
1905 1905
 		}
1906 1906
 	}
1907 1907
 
1908
-	if ( isset( $_GET['w'] ) ) {
1908
+	if (isset($_GET['w'])) {
1909 1909
 		$w = (int) $_GET['w'];
1910 1910
 	}
1911 1911
 	// week_begins = 0 stands for Sunday
1912
-	$week_begins = (int) get_option( 'start_of_week' );
1913
-	$ts = current_time( 'timestamp' );
1912
+	$week_begins = (int) get_option('start_of_week');
1913
+	$ts = current_time('timestamp');
1914 1914
 
1915 1915
 	// Let's figure out when we are
1916
-	if ( ! empty( $monthnum ) && ! empty( $year ) ) {
1917
-		$thismonth = zeroise( intval( $monthnum ), 2 );
1916
+	if ( ! empty($monthnum) && ! empty($year)) {
1917
+		$thismonth = zeroise(intval($monthnum), 2);
1918 1918
 		$thisyear = (int) $year;
1919
-	} elseif ( ! empty( $w ) ) {
1919
+	} elseif ( ! empty($w)) {
1920 1920
 		// We need to get the month from MySQL
1921
-		$thisyear = (int) substr( $m, 0, 4 );
1921
+		$thisyear = (int) substr($m, 0, 4);
1922 1922
 		//it seems MySQL's weeks disagree with PHP's
1923
-		$d = ( ( $w - 1 ) * 7 ) + 6;
1923
+		$d = (($w - 1) * 7) + 6;
1924 1924
 		$thismonth = $wpdb->get_var("SELECT DATE_FORMAT((DATE_ADD('{$thisyear}0101', INTERVAL $d DAY) ), '%m')");
1925
-	} elseif ( ! empty( $m ) ) {
1926
-		$thisyear = (int) substr( $m, 0, 4 );
1927
-		if ( strlen( $m ) < 6 ) {
1925
+	} elseif ( ! empty($m)) {
1926
+		$thisyear = (int) substr($m, 0, 4);
1927
+		if (strlen($m) < 6) {
1928 1928
 			$thismonth = '01';
1929 1929
 		} else {
1930
-			$thismonth = zeroise( (int) substr( $m, 4, 2 ), 2 );
1930
+			$thismonth = zeroise((int) substr($m, 4, 2), 2);
1931 1931
 		}
1932 1932
 	} else {
1933
-		$thisyear = gmdate( 'Y', $ts );
1934
-		$thismonth = gmdate( 'm', $ts );
1933
+		$thisyear = gmdate('Y', $ts);
1934
+		$thismonth = gmdate('m', $ts);
1935 1935
 	}
1936 1936
 
1937
-	$unixmonth = mktime( 0, 0 , 0, $thismonth, 1, $thisyear );
1938
-	$last_day = date( 't', $unixmonth );
1937
+	$unixmonth = mktime(0, 0, 0, $thismonth, 1, $thisyear);
1938
+	$last_day = date('t', $unixmonth);
1939 1939
 
1940 1940
 	// Get the next and previous month and year with at least one post
1941 1941
 	$previous = $wpdb->get_row("SELECT MONTH(post_date) AS month, YEAR(post_date) AS year
@@ -1956,21 +1956,21 @@  discard block
 block discarded – undo
1956 1956
 	$calendar_output = '<table id="wp-calendar">
1957 1957
 	<caption>' . sprintf(
1958 1958
 		$calendar_caption,
1959
-		$wp_locale->get_month( $thismonth ),
1960
-		date( 'Y', $unixmonth )
1961
-	) . '</caption>
1959
+		$wp_locale->get_month($thismonth),
1960
+		date('Y', $unixmonth)
1961
+	).'</caption>
1962 1962
 	<thead>
1963 1963
 	<tr>';
1964 1964
 
1965 1965
 	$myweek = array();
1966 1966
 
1967
-	for ( $wdcount = 0; $wdcount <= 6; $wdcount++ ) {
1968
-		$myweek[] = $wp_locale->get_weekday( ( $wdcount + $week_begins ) % 7 );
1967
+	for ($wdcount = 0; $wdcount <= 6; $wdcount++) {
1968
+		$myweek[] = $wp_locale->get_weekday(($wdcount + $week_begins) % 7);
1969 1969
 	}
1970 1970
 
1971
-	foreach ( $myweek as $wd ) {
1972
-		$day_name = $initial ? $wp_locale->get_weekday_initial( $wd ) : $wp_locale->get_weekday_abbrev( $wd );
1973
-		$wd = esc_attr( $wd );
1971
+	foreach ($myweek as $wd) {
1972
+		$day_name = $initial ? $wp_locale->get_weekday_initial($wd) : $wp_locale->get_weekday_abbrev($wd);
1973
+		$wd = esc_attr($wd);
1974 1974
 		$calendar_output .= "\n\t\t<th scope=\"col\" title=\"$wd\">$day_name</th>";
1975 1975
 	}
1976 1976
 
@@ -1981,9 +1981,9 @@  discard block
 block discarded – undo
1981 1981
 	<tfoot>
1982 1982
 	<tr>';
1983 1983
 
1984
-	if ( $previous ) {
1985
-		$calendar_output .= "\n\t\t".'<td colspan="3" id="prev"><a href="' . get_month_link( $previous->year, $previous->month ) . '">&laquo; ' .
1986
-			$wp_locale->get_month_abbrev( $wp_locale->get_month( $previous->month ) ) .
1984
+	if ($previous) {
1985
+		$calendar_output .= "\n\t\t".'<td colspan="3" id="prev"><a href="'.get_month_link($previous->year, $previous->month).'">&laquo; '.
1986
+			$wp_locale->get_month_abbrev($wp_locale->get_month($previous->month)).
1987 1987
 		'</a></td>';
1988 1988
 	} else {
1989 1989
 		$calendar_output .= "\n\t\t".'<td colspan="3" id="prev" class="pad">&nbsp;</td>';
@@ -1991,9 +1991,9 @@  discard block
 block discarded – undo
1991 1991
 
1992 1992
 	$calendar_output .= "\n\t\t".'<td class="pad">&nbsp;</td>';
1993 1993
 
1994
-	if ( $next ) {
1995
-		$calendar_output .= "\n\t\t".'<td colspan="3" id="next"><a href="' . get_month_link( $next->year, $next->month ) . '">' .
1996
-			$wp_locale->get_month_abbrev( $wp_locale->get_month( $next->month ) ) .
1994
+	if ($next) {
1995
+		$calendar_output .= "\n\t\t".'<td colspan="3" id="next"><a href="'.get_month_link($next->year, $next->month).'">'.
1996
+			$wp_locale->get_month_abbrev($wp_locale->get_month($next->month)).
1997 1997
 		' &raquo;</a></td>';
1998 1998
 	} else {
1999 1999
 		$calendar_output .= "\n\t\t".'<td colspan="3" id="next" class="pad">&nbsp;</td>';
@@ -2013,43 +2013,43 @@  discard block
 block discarded – undo
2013 2013
 		FROM $wpdb->posts WHERE post_date >= '{$thisyear}-{$thismonth}-01 00:00:00'
2014 2014
 		AND post_type = 'post' AND post_status = 'publish'
2015 2015
 		AND post_date <= '{$thisyear}-{$thismonth}-{$last_day} 23:59:59'", ARRAY_N);
2016
-	if ( $dayswithposts ) {
2017
-		foreach ( (array) $dayswithposts as $daywith ) {
2016
+	if ($dayswithposts) {
2017
+		foreach ((array) $dayswithposts as $daywith) {
2018 2018
 			$daywithpost[] = $daywith[0];
2019 2019
 		}
2020 2020
 	}
2021 2021
 
2022 2022
 	// See how much we should pad in the beginning
2023
-	$pad = calendar_week_mod( date( 'w', $unixmonth ) - $week_begins );
2024
-	if ( 0 != $pad ) {
2025
-		$calendar_output .= "\n\t\t".'<td colspan="'. esc_attr( $pad ) .'" class="pad">&nbsp;</td>';
2023
+	$pad = calendar_week_mod(date('w', $unixmonth) - $week_begins);
2024
+	if (0 != $pad) {
2025
+		$calendar_output .= "\n\t\t".'<td colspan="'.esc_attr($pad).'" class="pad">&nbsp;</td>';
2026 2026
 	}
2027 2027
 
2028 2028
 	$newrow = false;
2029
-	$daysinmonth = (int) date( 't', $unixmonth );
2029
+	$daysinmonth = (int) date('t', $unixmonth);
2030 2030
 
2031
-	for ( $day = 1; $day <= $daysinmonth; ++$day ) {
2032
-		if ( isset($newrow) && $newrow ) {
2031
+	for ($day = 1; $day <= $daysinmonth; ++$day) {
2032
+		if (isset($newrow) && $newrow) {
2033 2033
 			$calendar_output .= "\n\t</tr>\n\t<tr>\n\t\t";
2034 2034
 		}
2035 2035
 		$newrow = false;
2036 2036
 
2037
-		if ( $day == gmdate( 'j', $ts ) &&
2038
-			$thismonth == gmdate( 'm', $ts ) &&
2039
-			$thisyear == gmdate( 'Y', $ts ) ) {
2037
+		if ($day == gmdate('j', $ts) &&
2038
+			$thismonth == gmdate('m', $ts) &&
2039
+			$thisyear == gmdate('Y', $ts)) {
2040 2040
 			$calendar_output .= '<td id="today">';
2041 2041
 		} else {
2042 2042
 			$calendar_output .= '<td>';
2043 2043
 		}
2044 2044
 
2045
-		if ( in_array( $day, $daywithpost ) ) {
2045
+		if (in_array($day, $daywithpost)) {
2046 2046
 			// any posts today?
2047
-			$date_format = date( _x( 'F j, Y', 'daily archives date format' ), strtotime( "{$thisyear}-{$thismonth}-{$day}" ) );
2048
-			$label = sprintf( __( 'Posts published on %s' ), $date_format );
2047
+			$date_format = date(_x('F j, Y', 'daily archives date format'), strtotime("{$thisyear}-{$thismonth}-{$day}"));
2048
+			$label = sprintf(__('Posts published on %s'), $date_format);
2049 2049
 			$calendar_output .= sprintf(
2050 2050
 				'<a href="%s" aria-label="%s">%s</a>',
2051
-				get_day_link( $thisyear, $thismonth, $day ),
2052
-				esc_attr( $label ),
2051
+				get_day_link($thisyear, $thismonth, $day),
2052
+				esc_attr($label),
2053 2053
 				$day
2054 2054
 			);
2055 2055
 		} else {
@@ -2057,21 +2057,21 @@  discard block
 block discarded – undo
2057 2057
 		}
2058 2058
 		$calendar_output .= '</td>';
2059 2059
 
2060
-		if ( 6 == calendar_week_mod( date( 'w', mktime(0, 0 , 0, $thismonth, $day, $thisyear ) ) - $week_begins ) ) {
2060
+		if (6 == calendar_week_mod(date('w', mktime(0, 0, 0, $thismonth, $day, $thisyear)) - $week_begins)) {
2061 2061
 			$newrow = true;
2062 2062
 		}
2063 2063
 	}
2064 2064
 
2065
-	$pad = 7 - calendar_week_mod( date( 'w', mktime( 0, 0 , 0, $thismonth, $day, $thisyear ) ) - $week_begins );
2066
-	if ( $pad != 0 && $pad != 7 ) {
2067
-		$calendar_output .= "\n\t\t".'<td class="pad" colspan="'. esc_attr( $pad ) .'">&nbsp;</td>';
2065
+	$pad = 7 - calendar_week_mod(date('w', mktime(0, 0, 0, $thismonth, $day, $thisyear)) - $week_begins);
2066
+	if ($pad != 0 && $pad != 7) {
2067
+		$calendar_output .= "\n\t\t".'<td class="pad" colspan="'.esc_attr($pad).'">&nbsp;</td>';
2068 2068
 	}
2069 2069
 	$calendar_output .= "\n\t</tr>\n\t</tbody>\n\t</table>";
2070 2070
 
2071
-	$cache[ $key ] = $calendar_output;
2072
-	wp_cache_set( 'get_calendar', $cache, 'calendar' );
2071
+	$cache[$key] = $calendar_output;
2072
+	wp_cache_set('get_calendar', $cache, 'calendar');
2073 2073
 
2074
-	if ( $echo ) {
2074
+	if ($echo) {
2075 2075
 		/**
2076 2076
 		 * Filter the HTML calendar output.
2077 2077
 		 *
@@ -2079,11 +2079,11 @@  discard block
 block discarded – undo
2079 2079
 		 *
2080 2080
 		 * @param string $calendar_output HTML output of the calendar.
2081 2081
 		 */
2082
-		echo apply_filters( 'get_calendar', $calendar_output );
2082
+		echo apply_filters('get_calendar', $calendar_output);
2083 2083
 		return;
2084 2084
 	}
2085 2085
 	/** This filter is documented in wp-includes/general-template.php */
2086
-	return apply_filters( 'get_calendar', $calendar_output );
2086
+	return apply_filters('get_calendar', $calendar_output);
2087 2087
 }
2088 2088
 
2089 2089
 /**
@@ -2093,7 +2093,7 @@  discard block
 block discarded – undo
2093 2093
  * @since 2.1.0
2094 2094
  */
2095 2095
 function delete_get_calendar_cache() {
2096
-	wp_cache_delete( 'get_calendar', 'calendar' );
2096
+	wp_cache_delete('get_calendar', 'calendar');
2097 2097
 }
2098 2098
 
2099 2099
 /**
@@ -2111,16 +2111,16 @@  discard block
 block discarded – undo
2111 2111
 function allowed_tags() {
2112 2112
 	global $allowedtags;
2113 2113
 	$allowed = '';
2114
-	foreach ( (array) $allowedtags as $tag => $attributes ) {
2114
+	foreach ((array) $allowedtags as $tag => $attributes) {
2115 2115
 		$allowed .= '<'.$tag;
2116
-		if ( 0 < count($attributes) ) {
2117
-			foreach ( $attributes as $attribute => $limits ) {
2116
+		if (0 < count($attributes)) {
2117
+			foreach ($attributes as $attribute => $limits) {
2118 2118
 				$allowed .= ' '.$attribute.'=""';
2119 2119
 			}
2120 2120
 		}
2121 2121
 		$allowed .= '> ';
2122 2122
 	}
2123
-	return htmlentities( $allowed );
2123
+	return htmlentities($allowed);
2124 2124
 }
2125 2125
 
2126 2126
 /***** Date/Time tags *****/
@@ -2131,7 +2131,7 @@  discard block
 block discarded – undo
2131 2131
  * @since 1.0.0
2132 2132
  */
2133 2133
 function the_date_xml() {
2134
-	echo mysql2date( 'Y-m-d', get_post()->post_date, false );
2134
+	echo mysql2date('Y-m-d', get_post()->post_date, false);
2135 2135
 }
2136 2136
 
2137 2137
 /**
@@ -2157,11 +2157,11 @@  discard block
 block discarded – undo
2157 2157
  * @param bool   $echo   Optional, default is display. Whether to echo the date or return it.
2158 2158
  * @return string|void String if retrieving.
2159 2159
  */
2160
-function the_date( $d = '', $before = '', $after = '', $echo = true ) {
2160
+function the_date($d = '', $before = '', $after = '', $echo = true) {
2161 2161
 	global $currentday, $previousday;
2162 2162
 
2163
-	if ( is_new_day() ) {
2164
-		$the_date = $before . get_the_date( $d ) . $after;
2163
+	if (is_new_day()) {
2164
+		$the_date = $before.get_the_date($d).$after;
2165 2165
 		$previousday = $currentday;
2166 2166
 
2167 2167
 		/**
@@ -2175,9 +2175,9 @@  discard block
 block discarded – undo
2175 2175
 		 * @param string $before   HTML output before the date.
2176 2176
 		 * @param string $after    HTML output after the date.
2177 2177
 		 */
2178
-		$the_date = apply_filters( 'the_date', $the_date, $d, $before, $after );
2178
+		$the_date = apply_filters('the_date', $the_date, $d, $before, $after);
2179 2179
 
2180
-		if ( $echo )
2180
+		if ($echo)
2181 2181
 			echo $the_date;
2182 2182
 		else
2183 2183
 			return $the_date;
@@ -2196,17 +2196,17 @@  discard block
 block discarded – undo
2196 2196
  * @param  int|WP_Post $post Optional. Post ID or WP_Post object. Default current post.
2197 2197
  * @return false|string Date the current post was written. False on failure.
2198 2198
  */
2199
-function get_the_date( $d = '', $post = null ) {
2200
-	$post = get_post( $post );
2199
+function get_the_date($d = '', $post = null) {
2200
+	$post = get_post($post);
2201 2201
 
2202
-	if ( ! $post ) {
2202
+	if ( ! $post) {
2203 2203
 		return false;
2204 2204
 	}
2205 2205
 
2206
-	if ( '' == $d ) {
2207
-		$the_date = mysql2date( get_option( 'date_format' ), $post->post_date );
2206
+	if ('' == $d) {
2207
+		$the_date = mysql2date(get_option('date_format'), $post->post_date);
2208 2208
 	} else {
2209
-		$the_date = mysql2date( $d, $post->post_date );
2209
+		$the_date = mysql2date($d, $post->post_date);
2210 2210
 	}
2211 2211
 
2212 2212
 	/**
@@ -2219,7 +2219,7 @@  discard block
 block discarded – undo
2219 2219
 	 *                              if not specified.
2220 2220
 	 * @param int|WP_Post $post     The post object or ID.
2221 2221
 	 */
2222
-	return apply_filters( 'get_the_date', $the_date, $d, $post );
2222
+	return apply_filters('get_the_date', $the_date, $d, $post);
2223 2223
 }
2224 2224
 
2225 2225
 /**
@@ -2233,8 +2233,8 @@  discard block
 block discarded – undo
2233 2233
  * @param bool   $echo   Optional, default is display. Whether to echo the date or return it.
2234 2234
  * @return string|void String if retrieving.
2235 2235
  */
2236
-function the_modified_date( $d = '', $before = '', $after = '', $echo = true ) {
2237
-	$the_modified_date = $before . get_the_modified_date($d) . $after;
2236
+function the_modified_date($d = '', $before = '', $after = '', $echo = true) {
2237
+	$the_modified_date = $before.get_the_modified_date($d).$after;
2238 2238
 
2239 2239
 	/**
2240 2240
 	 * Filter the date a post was last modified for display.
@@ -2247,9 +2247,9 @@  discard block
 block discarded – undo
2247 2247
 	 * @param string $before            HTML output before the date.
2248 2248
 	 * @param string $after             HTML output after the date.
2249 2249
 	 */
2250
-	$the_modified_date = apply_filters( 'the_modified_date', $the_modified_date, $d, $before, $after );
2250
+	$the_modified_date = apply_filters('the_modified_date', $the_modified_date, $d, $before, $after);
2251 2251
 
2252
-	if ( $echo )
2252
+	if ($echo)
2253 2253
 		echo $the_modified_date;
2254 2254
 	else
2255 2255
 		return $the_modified_date;
@@ -2265,7 +2265,7 @@  discard block
 block discarded – undo
2265 2265
  * @return string
2266 2266
  */
2267 2267
 function get_the_modified_date($d = '') {
2268
-	if ( '' == $d )
2268
+	if ('' == $d)
2269 2269
 		$the_time = get_post_modified_time(get_option('date_format'), null, null, true);
2270 2270
 	else
2271 2271
 		$the_time = get_post_modified_time($d, null, null, true);
@@ -2279,7 +2279,7 @@  discard block
 block discarded – undo
2279 2279
 	 * @param string $d        PHP date format. Defaults to value specified in
2280 2280
 	 *                         'date_format' option.
2281 2281
 	 */
2282
-	return apply_filters( 'get_the_modified_date', $the_time, $d );
2282
+	return apply_filters('get_the_modified_date', $the_time, $d);
2283 2283
 }
2284 2284
 
2285 2285
 /**
@@ -2289,7 +2289,7 @@  discard block
 block discarded – undo
2289 2289
  *
2290 2290
  * @param string $d Either 'G', 'U', or php date format.
2291 2291
  */
2292
-function the_time( $d = '' ) {
2292
+function the_time($d = '') {
2293 2293
 	/**
2294 2294
 	 * Filter the time a post was written for display.
2295 2295
 	 *
@@ -2299,7 +2299,7 @@  discard block
 block discarded – undo
2299 2299
 	 * @param string $d            The time format. Accepts 'G', 'U',
2300 2300
 	 *                             or php date format.
2301 2301
 	 */
2302
-	echo apply_filters( 'the_time', get_the_time( $d ), $d );
2302
+	echo apply_filters('the_time', get_the_time($d), $d);
2303 2303
 }
2304 2304
 
2305 2305
 /**
@@ -2313,14 +2313,14 @@  discard block
 block discarded – undo
2313 2313
  * @param int|WP_Post $post WP_Post object or ID. Default is global $post object.
2314 2314
  * @return false|string Formatted date string or Unix timestamp. False on failure.
2315 2315
  */
2316
-function get_the_time( $d = '', $post = null ) {
2316
+function get_the_time($d = '', $post = null) {
2317 2317
 	$post = get_post($post);
2318 2318
 
2319
-	if ( ! $post ) {
2319
+	if ( ! $post) {
2320 2320
 		return false;
2321 2321
 	}
2322 2322
 
2323
-	if ( '' == $d )
2323
+	if ('' == $d)
2324 2324
 		$the_time = get_post_time(get_option('time_format'), false, $post, true);
2325 2325
 	else
2326 2326
 		$the_time = get_post_time($d, false, $post, true);
@@ -2336,7 +2336,7 @@  discard block
 block discarded – undo
2336 2336
 	 *                              in 'time_format' option. Default empty.
2337 2337
 	 * @param int|WP_Post $post     WP_Post object or ID.
2338 2338
 	 */
2339
-	return apply_filters( 'get_the_time', $the_time, $d, $post );
2339
+	return apply_filters('get_the_time', $the_time, $d, $post);
2340 2340
 }
2341 2341
 
2342 2342
 /**
@@ -2351,14 +2351,14 @@  discard block
 block discarded – undo
2351 2351
  * @param bool        $translate Whether to translate the time string. Default false.
2352 2352
  * @return false|string|int Formatted date string or Unix timestamp. False on failure.
2353 2353
  */
2354
-function get_post_time( $d = 'U', $gmt = false, $post = null, $translate = false ) {
2354
+function get_post_time($d = 'U', $gmt = false, $post = null, $translate = false) {
2355 2355
 	$post = get_post($post);
2356 2356
 
2357
-	if ( ! $post ) {
2357
+	if ( ! $post) {
2358 2358
 		return false;
2359 2359
 	}
2360 2360
 
2361
-	if ( $gmt )
2361
+	if ($gmt)
2362 2362
 		$time = $post->post_date_gmt;
2363 2363
 	else
2364 2364
 		$time = $post->post_date;
@@ -2375,7 +2375,7 @@  discard block
 block discarded – undo
2375 2375
 	 *                     Accepts 'G', 'U', or php date format. Default 'U'.
2376 2376
 	 * @param bool   $gmt  Whether to retrieve the GMT time. Default false.
2377 2377
 	 */
2378
-	return apply_filters( 'get_post_time', $time, $d, $gmt );
2378
+	return apply_filters('get_post_time', $time, $d, $gmt);
2379 2379
 }
2380 2380
 
2381 2381
 /**
@@ -2396,7 +2396,7 @@  discard block
 block discarded – undo
2396 2396
 	 *                                      or php date format. Defaults to value
2397 2397
 	 *                                      specified in 'time_format' option.
2398 2398
 	 */
2399
-	echo apply_filters( 'the_modified_time', get_the_modified_time($d), $d );
2399
+	echo apply_filters('the_modified_time', get_the_modified_time($d), $d);
2400 2400
 }
2401 2401
 
2402 2402
 /**
@@ -2408,7 +2408,7 @@  discard block
 block discarded – undo
2408 2408
  * @return string
2409 2409
  */
2410 2410
 function get_the_modified_time($d = '') {
2411
-	if ( '' == $d )
2411
+	if ('' == $d)
2412 2412
 		$the_time = get_post_modified_time(get_option('time_format'), null, null, true);
2413 2413
 	else
2414 2414
 		$the_time = get_post_modified_time($d, null, null, true);
@@ -2423,7 +2423,7 @@  discard block
 block discarded – undo
2423 2423
 	 *                         written. Accepts 'G', 'U', or php date format. Defaults
2424 2424
 	 *                         to value specified in 'time_format' option.
2425 2425
 	 */
2426
-	return apply_filters( 'get_the_modified_time', $the_time, $d );
2426
+	return apply_filters('get_the_modified_time', $the_time, $d);
2427 2427
 }
2428 2428
 
2429 2429
 /**
@@ -2438,14 +2438,14 @@  discard block
 block discarded – undo
2438 2438
  * @param bool        $translate Whether to translate the time string. Default false.
2439 2439
  * @return false|string Formatted date string or Unix timestamp. False on failure.
2440 2440
  */
2441
-function get_post_modified_time( $d = 'U', $gmt = false, $post = null, $translate = false ) {
2441
+function get_post_modified_time($d = 'U', $gmt = false, $post = null, $translate = false) {
2442 2442
 	$post = get_post($post);
2443 2443
 
2444
-	if ( ! $post ) {
2444
+	if ( ! $post) {
2445 2445
 		return false;
2446 2446
 	}
2447 2447
 
2448
-	if ( $gmt )
2448
+	if ($gmt)
2449 2449
 		$time = $post->post_modified_gmt;
2450 2450
 	else
2451 2451
 		$time = $post->post_modified;
@@ -2460,7 +2460,7 @@  discard block
 block discarded – undo
2460 2460
 	 * @param string $d    The date format. Accepts 'G', 'U', or php date format. Default 'U'.
2461 2461
 	 * @param bool   $gmt  Whether to return the GMT time. Default false.
2462 2462
 	 */
2463
-	return apply_filters( 'get_post_modified_time', $time, $d, $gmt );
2463
+	return apply_filters('get_post_modified_time', $time, $d, $gmt);
2464 2464
 }
2465 2465
 
2466 2466
 /**
@@ -2472,7 +2472,7 @@  discard block
 block discarded – undo
2472 2472
  */
2473 2473
 function the_weekday() {
2474 2474
 	global $wp_locale;
2475
-	$the_weekday = $wp_locale->get_weekday( mysql2date( 'w', get_post()->post_date, false ) );
2475
+	$the_weekday = $wp_locale->get_weekday(mysql2date('w', get_post()->post_date, false));
2476 2476
 
2477 2477
 	/**
2478 2478
 	 * Filter the weekday on which the post was written, for display.
@@ -2481,7 +2481,7 @@  discard block
 block discarded – undo
2481 2481
 	 *
2482 2482
 	 * @param string $the_weekday
2483 2483
 	 */
2484
-	echo apply_filters( 'the_weekday', $the_weekday );
2484
+	echo apply_filters('the_weekday', $the_weekday);
2485 2485
 }
2486 2486
 
2487 2487
 /**
@@ -2499,12 +2499,12 @@  discard block
 block discarded – undo
2499 2499
  * @param string $before Optional Output before the date.
2500 2500
  * @param string $after Optional Output after the date.
2501 2501
  */
2502
-function the_weekday_date($before='',$after='') {
2502
+function the_weekday_date($before = '', $after = '') {
2503 2503
 	global $wp_locale, $currentday, $previousweekday;
2504 2504
 	$the_weekday_date = '';
2505
-	if ( $currentday != $previousweekday ) {
2505
+	if ($currentday != $previousweekday) {
2506 2506
 		$the_weekday_date .= $before;
2507
-		$the_weekday_date .= $wp_locale->get_weekday( mysql2date( 'w', get_post()->post_date, false ) );
2507
+		$the_weekday_date .= $wp_locale->get_weekday(mysql2date('w', get_post()->post_date, false));
2508 2508
 		$the_weekday_date .= $after;
2509 2509
 		$previousweekday = $currentday;
2510 2510
 	}
@@ -2518,7 +2518,7 @@  discard block
 block discarded – undo
2518 2518
 	 * @param string $before           The HTML to output before the date.
2519 2519
 	 * @param string $after            The HTML to output after the date.
2520 2520
 	 */
2521
-	$the_weekday_date = apply_filters( 'the_weekday_date', $the_weekday_date, $before, $after );
2521
+	$the_weekday_date = apply_filters('the_weekday_date', $the_weekday_date, $before, $after);
2522 2522
 	echo $the_weekday_date;
2523 2523
 }
2524 2524
 
@@ -2533,7 +2533,7 @@  discard block
 block discarded – undo
2533 2533
 	 *
2534 2534
 	 * @since 1.5.0
2535 2535
 	 */
2536
-	do_action( 'wp_head' );
2536
+	do_action('wp_head');
2537 2537
 }
2538 2538
 
2539 2539
 /**
@@ -2547,7 +2547,7 @@  discard block
 block discarded – undo
2547 2547
 	 *
2548 2548
 	 * @since 1.5.1
2549 2549
 	 */
2550
-	do_action( 'wp_footer' );
2550
+	do_action('wp_footer');
2551 2551
 }
2552 2552
 
2553 2553
 /**
@@ -2557,8 +2557,8 @@  discard block
 block discarded – undo
2557 2557
  *
2558 2558
  * @param array $args Optional arguments.
2559 2559
  */
2560
-function feed_links( $args = array() ) {
2561
-	if ( !current_theme_supports('automatic-feed-links') )
2560
+function feed_links($args = array()) {
2561
+	if ( ! current_theme_supports('automatic-feed-links'))
2562 2562
 		return;
2563 2563
 
2564 2564
 	$defaults = array(
@@ -2570,7 +2570,7 @@  discard block
 block discarded – undo
2570 2570
 		'comstitle'	=> __('%1$s %2$s Comments Feed'),
2571 2571
 	);
2572 2572
 
2573
-	$args = wp_parse_args( $args, $defaults );
2573
+	$args = wp_parse_args($args, $defaults);
2574 2574
 
2575 2575
 	/**
2576 2576
 	 * Filter whether to display the posts feed link.
@@ -2579,8 +2579,8 @@  discard block
 block discarded – undo
2579 2579
 	 *
2580 2580
 	 * @param bool $show Whether to display the posts feed link. Default true.
2581 2581
 	 */
2582
-	if ( apply_filters( 'feed_links_show_posts_feed', true ) ) {
2583
-		echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr( sprintf( $args['feedtitle'], get_bloginfo( 'name' ), $args['separator'] ) ) . '" href="' . esc_url( get_feed_link() ) . "\" />\n";
2582
+	if (apply_filters('feed_links_show_posts_feed', true)) {
2583
+		echo '<link rel="alternate" type="'.feed_content_type().'" title="'.esc_attr(sprintf($args['feedtitle'], get_bloginfo('name'), $args['separator'])).'" href="'.esc_url(get_feed_link())."\" />\n";
2584 2584
 	}
2585 2585
 
2586 2586
 	/**
@@ -2590,8 +2590,8 @@  discard block
 block discarded – undo
2590 2590
 	 *
2591 2591
 	 * @param bool $show Whether to display the comments feed link. Default true.
2592 2592
 	 */
2593
-	if ( apply_filters( 'feed_links_show_comments_feed', true ) ) {
2594
-		echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr( sprintf( $args['comstitle'], get_bloginfo( 'name' ), $args['separator'] ) ) . '" href="' . esc_url( get_feed_link( 'comments_' . get_default_feed() ) ) . "\" />\n";
2593
+	if (apply_filters('feed_links_show_comments_feed', true)) {
2594
+		echo '<link rel="alternate" type="'.feed_content_type().'" title="'.esc_attr(sprintf($args['comstitle'], get_bloginfo('name'), $args['separator'])).'" href="'.esc_url(get_feed_link('comments_'.get_default_feed()))."\" />\n";
2595 2595
 	}
2596 2596
 }
2597 2597
 
@@ -2602,7 +2602,7 @@  discard block
 block discarded – undo
2602 2602
  *
2603 2603
  * @param array $args Optional arguments.
2604 2604
  */
2605
-function feed_links_extra( $args = array() ) {
2605
+function feed_links_extra($args = array()) {
2606 2606
 	$defaults = array(
2607 2607
 		/* translators: Separator between blog name and feed type in feed links */
2608 2608
 		'separator'   => _x('&raquo;', 'feed link'),
@@ -2622,60 +2622,60 @@  discard block
 block discarded – undo
2622 2622
 		'posttypetitle' => __('%1$s %2$s %3$s Feed'),
2623 2623
 	);
2624 2624
 
2625
-	$args = wp_parse_args( $args, $defaults );
2625
+	$args = wp_parse_args($args, $defaults);
2626 2626
 
2627
-	if ( is_singular() ) {
2627
+	if (is_singular()) {
2628 2628
 		$id = 0;
2629
-		$post = get_post( $id );
2629
+		$post = get_post($id);
2630 2630
 
2631
-		if ( comments_open() || pings_open() || $post->comment_count > 0 ) {
2632
-			$title = sprintf( $args['singletitle'], get_bloginfo('name'), $args['separator'], the_title_attribute( array( 'echo' => false ) ) );
2633
-			$href = get_post_comments_feed_link( $post->ID );
2631
+		if (comments_open() || pings_open() || $post->comment_count > 0) {
2632
+			$title = sprintf($args['singletitle'], get_bloginfo('name'), $args['separator'], the_title_attribute(array('echo' => false)));
2633
+			$href = get_post_comments_feed_link($post->ID);
2634 2634
 		}
2635
-	} elseif ( is_post_type_archive() ) {
2636
-		$post_type = get_query_var( 'post_type' );
2637
-		if ( is_array( $post_type ) )
2638
-			$post_type = reset( $post_type );
2639
-
2640
-		$post_type_obj = get_post_type_object( $post_type );
2641
-		$title = sprintf( $args['posttypetitle'], get_bloginfo( 'name' ), $args['separator'], $post_type_obj->labels->name );
2642
-		$href = get_post_type_archive_feed_link( $post_type_obj->name );
2643
-	} elseif ( is_category() ) {
2635
+	} elseif (is_post_type_archive()) {
2636
+		$post_type = get_query_var('post_type');
2637
+		if (is_array($post_type))
2638
+			$post_type = reset($post_type);
2639
+
2640
+		$post_type_obj = get_post_type_object($post_type);
2641
+		$title = sprintf($args['posttypetitle'], get_bloginfo('name'), $args['separator'], $post_type_obj->labels->name);
2642
+		$href = get_post_type_archive_feed_link($post_type_obj->name);
2643
+	} elseif (is_category()) {
2644 2644
 		$term = get_queried_object();
2645 2645
 
2646
-		if ( $term ) {
2647
-			$title = sprintf( $args['cattitle'], get_bloginfo('name'), $args['separator'], $term->name );
2648
-			$href = get_category_feed_link( $term->term_id );
2646
+		if ($term) {
2647
+			$title = sprintf($args['cattitle'], get_bloginfo('name'), $args['separator'], $term->name);
2648
+			$href = get_category_feed_link($term->term_id);
2649 2649
 		}
2650
-	} elseif ( is_tag() ) {
2650
+	} elseif (is_tag()) {
2651 2651
 		$term = get_queried_object();
2652 2652
 
2653
-		if ( $term ) {
2654
-			$title = sprintf( $args['tagtitle'], get_bloginfo('name'), $args['separator'], $term->name );
2655
-			$href = get_tag_feed_link( $term->term_id );
2653
+		if ($term) {
2654
+			$title = sprintf($args['tagtitle'], get_bloginfo('name'), $args['separator'], $term->name);
2655
+			$href = get_tag_feed_link($term->term_id);
2656 2656
 		}
2657
-	} elseif ( is_tax() ) {
2657
+	} elseif (is_tax()) {
2658 2658
  		$term = get_queried_object();
2659
- 		$tax = get_taxonomy( $term->taxonomy );
2660
- 		$title = sprintf( $args['taxtitle'], get_bloginfo('name'), $args['separator'], $term->name, $tax->labels->singular_name );
2661
- 		$href = get_term_feed_link( $term->term_id, $term->taxonomy );
2662
-	} elseif ( is_author() ) {
2663
-		$author_id = intval( get_query_var('author') );
2664
-
2665
-		$title = sprintf( $args['authortitle'], get_bloginfo('name'), $args['separator'], get_the_author_meta( 'display_name', $author_id ) );
2666
-		$href = get_author_feed_link( $author_id );
2667
-	} elseif ( is_search() ) {
2668
-		$title = sprintf( $args['searchtitle'], get_bloginfo('name'), $args['separator'], get_search_query( false ) );
2659
+ 		$tax = get_taxonomy($term->taxonomy);
2660
+ 		$title = sprintf($args['taxtitle'], get_bloginfo('name'), $args['separator'], $term->name, $tax->labels->singular_name);
2661
+ 		$href = get_term_feed_link($term->term_id, $term->taxonomy);
2662
+	} elseif (is_author()) {
2663
+		$author_id = intval(get_query_var('author'));
2664
+
2665
+		$title = sprintf($args['authortitle'], get_bloginfo('name'), $args['separator'], get_the_author_meta('display_name', $author_id));
2666
+		$href = get_author_feed_link($author_id);
2667
+	} elseif (is_search()) {
2668
+		$title = sprintf($args['searchtitle'], get_bloginfo('name'), $args['separator'], get_search_query(false));
2669 2669
 		$href = get_search_feed_link();
2670
-	} elseif ( is_post_type_archive() ) {
2671
-		$title = sprintf( $args['posttypetitle'], get_bloginfo('name'), $args['separator'], post_type_archive_title( '', false ) );
2670
+	} elseif (is_post_type_archive()) {
2671
+		$title = sprintf($args['posttypetitle'], get_bloginfo('name'), $args['separator'], post_type_archive_title('', false));
2672 2672
 		$post_type_obj = get_queried_object();
2673
-		if ( $post_type_obj )
2674
-			$href = get_post_type_archive_feed_link( $post_type_obj->name );
2673
+		if ($post_type_obj)
2674
+			$href = get_post_type_archive_feed_link($post_type_obj->name);
2675 2675
 	}
2676 2676
 
2677
-	if ( isset($title) && isset($href) )
2678
-		echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr( $title ) . '" href="' . esc_url( $href ) . '" />' . "\n";
2677
+	if (isset($title) && isset($href))
2678
+		echo '<link rel="alternate" type="'.feed_content_type().'" title="'.esc_attr($title).'" href="'.esc_url($href).'" />'."\n";
2679 2679
 }
2680 2680
 
2681 2681
 /**
@@ -2685,7 +2685,7 @@  discard block
 block discarded – undo
2685 2685
  * @since 2.0.0
2686 2686
  */
2687 2687
 function rsd_link() {
2688
-	echo '<link rel="EditURI" type="application/rsd+xml" title="RSD" href="' . esc_url( site_url( 'xmlrpc.php?rsd', 'rpc' ) ) . '" />' . "\n";
2688
+	echo '<link rel="EditURI" type="application/rsd+xml" title="RSD" href="'.esc_url(site_url('xmlrpc.php?rsd', 'rpc')).'" />'."\n";
2689 2689
 }
2690 2690
 
2691 2691
 /**
@@ -2696,7 +2696,7 @@  discard block
 block discarded – undo
2696 2696
  */
2697 2697
 function wlwmanifest_link() {
2698 2698
 	echo '<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="',
2699
-		includes_url( 'wlwmanifest.xml' ), '" /> ', "\n";
2699
+		includes_url('wlwmanifest.xml'), '" /> ', "\n";
2700 2700
 }
2701 2701
 
2702 2702
 /**
@@ -2712,7 +2712,7 @@  discard block
 block discarded – undo
2712 2712
  */
2713 2713
 function noindex() {
2714 2714
 	// If the blog is not public, tell robots to go away.
2715
-	if ( '0' == get_option('blog_public') )
2715
+	if ('0' == get_option('blog_public'))
2716 2716
 		wp_no_robots();
2717 2717
 }
2718 2718
 
@@ -2736,15 +2736,15 @@  discard block
 block discarded – undo
2736 2736
  * @link http://www.whatwg.org/specs/web-apps/current-work/multipage/links.html#rel-icon HTML5 specification link icon.
2737 2737
  */
2738 2738
 function wp_site_icon() {
2739
-	if ( ! has_site_icon() && ! is_customize_preview() ) {
2739
+	if ( ! has_site_icon() && ! is_customize_preview()) {
2740 2740
 		return;
2741 2741
 	}
2742 2742
 
2743 2743
 	$meta_tags = array(
2744
-		sprintf( '<link rel="icon" href="%s" sizes="32x32" />', esc_url( get_site_icon_url( 32 ) ) ),
2745
-		sprintf( '<link rel="icon" href="%s" sizes="192x192" />', esc_url( get_site_icon_url( 192 ) ) ),
2746
-		sprintf( '<link rel="apple-touch-icon-precomposed" href="%s" />', esc_url( get_site_icon_url( 180 ) ) ),
2747
-		sprintf( '<meta name="msapplication-TileImage" content="%s" />', esc_url( get_site_icon_url( 270 ) ) ),
2744
+		sprintf('<link rel="icon" href="%s" sizes="32x32" />', esc_url(get_site_icon_url(32))),
2745
+		sprintf('<link rel="icon" href="%s" sizes="192x192" />', esc_url(get_site_icon_url(192))),
2746
+		sprintf('<link rel="apple-touch-icon-precomposed" href="%s" />', esc_url(get_site_icon_url(180))),
2747
+		sprintf('<meta name="msapplication-TileImage" content="%s" />', esc_url(get_site_icon_url(270))),
2748 2748
 	);
2749 2749
 
2750 2750
 	/**
@@ -2754,10 +2754,10 @@  discard block
 block discarded – undo
2754 2754
 	 *
2755 2755
 	 * @param array $meta_tags Site Icon meta elements.
2756 2756
 	 */
2757
-	$meta_tags = apply_filters( 'site_icon_meta_tags', $meta_tags );
2758
-	$meta_tags = array_filter( $meta_tags );
2757
+	$meta_tags = apply_filters('site_icon_meta_tags', $meta_tags);
2758
+	$meta_tags = array_filter($meta_tags);
2759 2759
 
2760
-	foreach ( $meta_tags as $meta_tag ) {
2760
+	foreach ($meta_tags as $meta_tag) {
2761 2761
 		echo "$meta_tag\n";
2762 2762
 	}
2763 2763
 }
@@ -2782,13 +2782,13 @@  discard block
 block discarded – undo
2782 2782
 function user_can_richedit() {
2783 2783
 	global $wp_rich_edit, $is_gecko, $is_opera, $is_safari, $is_chrome, $is_IE, $is_edge;
2784 2784
 
2785
-	if ( !isset($wp_rich_edit) ) {
2785
+	if ( ! isset($wp_rich_edit)) {
2786 2786
 		$wp_rich_edit = false;
2787 2787
 
2788
-		if ( get_user_option( 'rich_editing' ) == 'true' || ! is_user_logged_in() ) { // default to 'true' for logged out users
2789
-			if ( $is_safari ) {
2790
-				$wp_rich_edit = ! wp_is_mobile() || ( preg_match( '!AppleWebKit/(\d+)!', $_SERVER['HTTP_USER_AGENT'], $match ) && intval( $match[1] ) >= 534 );
2791
-			} elseif ( $is_gecko || $is_chrome || $is_IE || $is_edge || ( $is_opera && !wp_is_mobile() ) ) {
2788
+		if (get_user_option('rich_editing') == 'true' || ! is_user_logged_in()) { // default to 'true' for logged out users
2789
+			if ($is_safari) {
2790
+				$wp_rich_edit = ! wp_is_mobile() || (preg_match('!AppleWebKit/(\d+)!', $_SERVER['HTTP_USER_AGENT'], $match) && intval($match[1]) >= 534);
2791
+			} elseif ($is_gecko || $is_chrome || $is_IE || $is_edge || ($is_opera && ! wp_is_mobile())) {
2792 2792
 				$wp_rich_edit = true;
2793 2793
 			}
2794 2794
 		}
@@ -2801,7 +2801,7 @@  discard block
 block discarded – undo
2801 2801
 	 *
2802 2802
 	 * @param bool $wp_rich_edit Whether the user can access to the rich (Visual) editor.
2803 2803
 	 */
2804
-	return apply_filters( 'user_can_richedit', $wp_rich_edit );
2804
+	return apply_filters('user_can_richedit', $wp_rich_edit);
2805 2805
 }
2806 2806
 
2807 2807
 /**
@@ -2816,9 +2816,9 @@  discard block
 block discarded – undo
2816 2816
  */
2817 2817
 function wp_default_editor() {
2818 2818
 	$r = user_can_richedit() ? 'tinymce' : 'html'; // defaults
2819
-	if ( wp_get_current_user() ) { // look for cookie
2819
+	if (wp_get_current_user()) { // look for cookie
2820 2820
 		$ed = get_user_setting('editor', 'tinymce');
2821
-		$r = ( in_array($ed, array('tinymce', 'html', 'test') ) ) ? $ed : $r;
2821
+		$r = (in_array($ed, array('tinymce', 'html', 'test'))) ? $ed : $r;
2822 2822
 	}
2823 2823
 
2824 2824
 	/**
@@ -2828,7 +2828,7 @@  discard block
 block discarded – undo
2828 2828
 	 *
2829 2829
 	 * @param array $r An array of editors. Accepts 'tinymce', 'html', 'test'.
2830 2830
 	 */
2831
-	return apply_filters( 'wp_default_editor', $r );
2831
+	return apply_filters('wp_default_editor', $r);
2832 2832
 }
2833 2833
 
2834 2834
 /**
@@ -2850,9 +2850,9 @@  discard block
 block discarded – undo
2850 2850
  * @param string $editor_id HTML ID attribute value for the textarea and TinyMCE. Can only be /[a-z]+/.
2851 2851
  * @param array  $settings  See _WP_Editors::editor().
2852 2852
  */
2853
-function wp_editor( $content, $editor_id, $settings = array() ) {
2854
-	if ( ! class_exists( '_WP_Editors', false ) )
2855
-		require( ABSPATH . WPINC . '/class-wp-editor.php' );
2853
+function wp_editor($content, $editor_id, $settings = array()) {
2854
+	if ( ! class_exists('_WP_Editors', false))
2855
+		require(ABSPATH.WPINC.'/class-wp-editor.php');
2856 2856
 
2857 2857
 	_WP_Editors::editor($content, $editor_id, $settings);
2858 2858
 }
@@ -2869,7 +2869,7 @@  discard block
 block discarded – undo
2869 2869
  * 	                    Only use when you are later escaping it. Do not use unescaped.
2870 2870
  * @return string
2871 2871
  */
2872
-function get_search_query( $escaped = true ) {
2872
+function get_search_query($escaped = true) {
2873 2873
 	/**
2874 2874
 	 * Filter the contents of the search query variable.
2875 2875
 	 *
@@ -2877,10 +2877,10 @@  discard block
 block discarded – undo
2877 2877
 	 *
2878 2878
 	 * @param mixed $search Contents of the search query variable.
2879 2879
 	 */
2880
-	$query = apply_filters( 'get_search_query', get_query_var( 's' ) );
2880
+	$query = apply_filters('get_search_query', get_query_var('s'));
2881 2881
 
2882
-	if ( $escaped )
2883
-		$query = esc_attr( $query );
2882
+	if ($escaped)
2883
+		$query = esc_attr($query);
2884 2884
 	return $query;
2885 2885
 }
2886 2886
 
@@ -2900,7 +2900,7 @@  discard block
 block discarded – undo
2900 2900
 	 *
2901 2901
 	 * @param mixed $search Contents of the search query variable.
2902 2902
 	 */
2903
-	echo esc_attr( apply_filters( 'the_search_query', get_search_query( false ) ) );
2903
+	echo esc_attr(apply_filters('the_search_query', get_search_query(false)));
2904 2904
 }
2905 2905
 
2906 2906
 /**
@@ -2913,17 +2913,17 @@  discard block
 block discarded – undo
2913 2913
  *
2914 2914
  * @param string $doctype Optional. The type of html document. Accepts 'xhtml' or 'html'. Default 'html'.
2915 2915
  */
2916
-function get_language_attributes( $doctype = 'html' ) {
2916
+function get_language_attributes($doctype = 'html') {
2917 2917
 	$attributes = array();
2918 2918
 
2919
-	if ( function_exists( 'is_rtl' ) && is_rtl() )
2919
+	if (function_exists('is_rtl') && is_rtl())
2920 2920
 		$attributes[] = 'dir="rtl"';
2921 2921
 
2922
-	if ( $lang = get_bloginfo('language') ) {
2923
-		if ( get_option('html_type') == 'text/html' || $doctype == 'html' )
2922
+	if ($lang = get_bloginfo('language')) {
2923
+		if (get_option('html_type') == 'text/html' || $doctype == 'html')
2924 2924
 			$attributes[] = "lang=\"$lang\"";
2925 2925
 
2926
-		if ( get_option('html_type') != 'text/html' || $doctype == 'xhtml' )
2926
+		if (get_option('html_type') != 'text/html' || $doctype == 'xhtml')
2927 2927
 			$attributes[] = "xml:lang=\"$lang\"";
2928 2928
 	}
2929 2929
 
@@ -2938,7 +2938,7 @@  discard block
 block discarded – undo
2938 2938
 	 * @param string $output A space-separated list of language attributes.
2939 2939
 	 * @param string $doctype The type of html document (xhtml|html).
2940 2940
 	 */
2941
-	return apply_filters( 'language_attributes', $output, $doctype );
2941
+	return apply_filters('language_attributes', $output, $doctype);
2942 2942
 }
2943 2943
 
2944 2944
 /**
@@ -2952,8 +2952,8 @@  discard block
 block discarded – undo
2952 2952
  *
2953 2953
  * @param string $doctype Optional. The type of html document. Accepts 'xhtml' or 'html'. Default 'html'.
2954 2954
  */
2955
-function language_attributes( $doctype = 'html' ) {
2956
-	echo get_language_attributes( $doctype );
2955
+function language_attributes($doctype = 'html') {
2956
+	echo get_language_attributes($doctype);
2957 2957
 }
2958 2958
 
2959 2959
 /**
@@ -3031,23 +3031,23 @@  discard block
 block discarded – undo
3031 3031
  * }
3032 3032
  * @return array|string|void String of page links or array of page links.
3033 3033
  */
3034
-function paginate_links( $args = '' ) {
3034
+function paginate_links($args = '') {
3035 3035
 	global $wp_query, $wp_rewrite;
3036 3036
 
3037 3037
 	// Setting up default values based on the current URL.
3038
-	$pagenum_link = html_entity_decode( get_pagenum_link() );
3039
-	$url_parts    = explode( '?', $pagenum_link );
3038
+	$pagenum_link = html_entity_decode(get_pagenum_link());
3039
+	$url_parts    = explode('?', $pagenum_link);
3040 3040
 
3041 3041
 	// Get max pages and current page out of the current query, if available.
3042
-	$total   = isset( $wp_query->max_num_pages ) ? $wp_query->max_num_pages : 1;
3043
-	$current = get_query_var( 'paged' ) ? intval( get_query_var( 'paged' ) ) : 1;
3042
+	$total   = isset($wp_query->max_num_pages) ? $wp_query->max_num_pages : 1;
3043
+	$current = get_query_var('paged') ? intval(get_query_var('paged')) : 1;
3044 3044
 
3045 3045
 	// Append the format placeholder to the base URL.
3046
-	$pagenum_link = trailingslashit( $url_parts[0] ) . '%_%';
3046
+	$pagenum_link = trailingslashit($url_parts[0]).'%_%';
3047 3047
 
3048 3048
 	// URL base depends on permalink settings.
3049
-	$format  = $wp_rewrite->using_index_permalinks() && ! strpos( $pagenum_link, 'index.php' ) ? 'index.php/' : '';
3050
-	$format .= $wp_rewrite->using_permalinks() ? user_trailingslashit( $wp_rewrite->pagination_base . '/%#%', 'paged' ) : '?paged=%#%';
3049
+	$format  = $wp_rewrite->using_index_permalinks() && ! strpos($pagenum_link, 'index.php') ? 'index.php/' : '';
3050
+	$format .= $wp_rewrite->using_permalinks() ? user_trailingslashit($wp_rewrite->pagination_base.'/%#%', 'paged') : '?paged=%#%';
3051 3051
 
3052 3052
 	$defaults = array(
3053 3053
 		'base' => $pagenum_link, // http://example.com/all_posts.php%_% : %_% is replaced by format (below)
@@ -3067,42 +3067,42 @@  discard block
 block discarded – undo
3067 3067
 		'after_page_number' => ''
3068 3068
 	);
3069 3069
 
3070
-	$args = wp_parse_args( $args, $defaults );
3070
+	$args = wp_parse_args($args, $defaults);
3071 3071
 
3072
-	if ( ! is_array( $args['add_args'] ) ) {
3072
+	if ( ! is_array($args['add_args'])) {
3073 3073
 		$args['add_args'] = array();
3074 3074
 	}
3075 3075
 
3076 3076
 	// Merge additional query vars found in the original URL into 'add_args' array.
3077
-	if ( isset( $url_parts[1] ) ) {
3077
+	if (isset($url_parts[1])) {
3078 3078
 		// Find the format argument.
3079
-		$format = explode( '?', str_replace( '%_%', $args['format'], $args['base'] ) );
3080
-		$format_query = isset( $format[1] ) ? $format[1] : '';
3081
-		wp_parse_str( $format_query, $format_args );
3079
+		$format = explode('?', str_replace('%_%', $args['format'], $args['base']));
3080
+		$format_query = isset($format[1]) ? $format[1] : '';
3081
+		wp_parse_str($format_query, $format_args);
3082 3082
 
3083 3083
 		// Find the query args of the requested URL.
3084
-		wp_parse_str( $url_parts[1], $url_query_args );
3084
+		wp_parse_str($url_parts[1], $url_query_args);
3085 3085
 
3086 3086
 		// Remove the format argument from the array of query arguments, to avoid overwriting custom format.
3087
-		foreach ( $format_args as $format_arg => $format_arg_value ) {
3088
-			unset( $url_query_args[ $format_arg ] );
3087
+		foreach ($format_args as $format_arg => $format_arg_value) {
3088
+			unset($url_query_args[$format_arg]);
3089 3089
 		}
3090 3090
 
3091
-		$args['add_args'] = array_merge( $args['add_args'], urlencode_deep( $url_query_args ) );
3091
+		$args['add_args'] = array_merge($args['add_args'], urlencode_deep($url_query_args));
3092 3092
 	}
3093 3093
 
3094 3094
 	// Who knows what else people pass in $args
3095 3095
 	$total = (int) $args['total'];
3096
-	if ( $total < 2 ) {
3096
+	if ($total < 2) {
3097 3097
 		return;
3098 3098
 	}
3099 3099
 	$current  = (int) $args['current'];
3100 3100
 	$end_size = (int) $args['end_size']; // Out of bounds?  Make it the default.
3101
-	if ( $end_size < 1 ) {
3101
+	if ($end_size < 1) {
3102 3102
 		$end_size = 1;
3103 3103
 	}
3104 3104
 	$mid_size = (int) $args['mid_size'];
3105
-	if ( $mid_size < 0 ) {
3105
+	if ($mid_size < 0) {
3106 3106
 		$mid_size = 2;
3107 3107
 	}
3108 3108
 	$add_args = $args['add_args'];
@@ -3110,11 +3110,11 @@  discard block
 block discarded – undo
3110 3110
 	$page_links = array();
3111 3111
 	$dots = false;
3112 3112
 
3113
-	if ( $args['prev_next'] && $current && 1 < $current ) :
3114
-		$link = str_replace( '%_%', 2 == $current ? '' : $args['format'], $args['base'] );
3115
-		$link = str_replace( '%#%', $current - 1, $link );
3116
-		if ( $add_args )
3117
-			$link = add_query_arg( $add_args, $link );
3113
+	if ($args['prev_next'] && $current && 1 < $current) :
3114
+		$link = str_replace('%_%', 2 == $current ? '' : $args['format'], $args['base']);
3115
+		$link = str_replace('%#%', $current - 1, $link);
3116
+		if ($add_args)
3117
+			$link = add_query_arg($add_args, $link);
3118 3118
 		$link .= $args['add_fragment'];
3119 3119
 
3120 3120
 		/**
@@ -3124,40 +3124,40 @@  discard block
 block discarded – undo
3124 3124
 		 *
3125 3125
 		 * @param string $link The paginated link URL.
3126 3126
 		 */
3127
-		$page_links[] = '<a class="prev page-numbers" href="' . esc_url( apply_filters( 'paginate_links', $link ) ) . '">' . $args['prev_text'] . '</a>';
3127
+		$page_links[] = '<a class="prev page-numbers" href="'.esc_url(apply_filters('paginate_links', $link)).'">'.$args['prev_text'].'</a>';
3128 3128
 	endif;
3129
-	for ( $n = 1; $n <= $total; $n++ ) :
3130
-		if ( $n == $current ) :
3131
-			$page_links[] = "<span class='page-numbers current'>" . $args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number'] . "</span>";
3129
+	for ($n = 1; $n <= $total; $n++) :
3130
+		if ($n == $current) :
3131
+			$page_links[] = "<span class='page-numbers current'>".$args['before_page_number'].number_format_i18n($n).$args['after_page_number']."</span>";
3132 3132
 			$dots = true;
3133 3133
 		else :
3134
-			if ( $args['show_all'] || ( $n <= $end_size || ( $current && $n >= $current - $mid_size && $n <= $current + $mid_size ) || $n > $total - $end_size ) ) :
3135
-				$link = str_replace( '%_%', 1 == $n ? '' : $args['format'], $args['base'] );
3136
-				$link = str_replace( '%#%', $n, $link );
3137
-				if ( $add_args )
3138
-					$link = add_query_arg( $add_args, $link );
3134
+			if ($args['show_all'] || ($n <= $end_size || ($current && $n >= $current - $mid_size && $n <= $current + $mid_size) || $n > $total - $end_size)) :
3135
+				$link = str_replace('%_%', 1 == $n ? '' : $args['format'], $args['base']);
3136
+				$link = str_replace('%#%', $n, $link);
3137
+				if ($add_args)
3138
+					$link = add_query_arg($add_args, $link);
3139 3139
 				$link .= $args['add_fragment'];
3140 3140
 
3141 3141
 				/** This filter is documented in wp-includes/general-template.php */
3142
-				$page_links[] = "<a class='page-numbers' href='" . esc_url( apply_filters( 'paginate_links', $link ) ) . "'>" . $args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number'] . "</a>";
3142
+				$page_links[] = "<a class='page-numbers' href='".esc_url(apply_filters('paginate_links', $link))."'>".$args['before_page_number'].number_format_i18n($n).$args['after_page_number']."</a>";
3143 3143
 				$dots = true;
3144
-			elseif ( $dots && ! $args['show_all'] ) :
3145
-				$page_links[] = '<span class="page-numbers dots">' . __( '&hellip;' ) . '</span>';
3144
+			elseif ($dots && ! $args['show_all']) :
3145
+				$page_links[] = '<span class="page-numbers dots">'.__('&hellip;').'</span>';
3146 3146
 				$dots = false;
3147 3147
 			endif;
3148 3148
 		endif;
3149 3149
 	endfor;
3150
-	if ( $args['prev_next'] && $current && ( $current < $total || -1 == $total ) ) :
3151
-		$link = str_replace( '%_%', $args['format'], $args['base'] );
3152
-		$link = str_replace( '%#%', $current + 1, $link );
3153
-		if ( $add_args )
3154
-			$link = add_query_arg( $add_args, $link );
3150
+	if ($args['prev_next'] && $current && ($current < $total || -1 == $total)) :
3151
+		$link = str_replace('%_%', $args['format'], $args['base']);
3152
+		$link = str_replace('%#%', $current + 1, $link);
3153
+		if ($add_args)
3154
+			$link = add_query_arg($add_args, $link);
3155 3155
 		$link .= $args['add_fragment'];
3156 3156
 
3157 3157
 		/** This filter is documented in wp-includes/general-template.php */
3158
-		$page_links[] = '<a class="next page-numbers" href="' . esc_url( apply_filters( 'paginate_links', $link ) ) . '">' . $args['next_text'] . '</a>';
3158
+		$page_links[] = '<a class="next page-numbers" href="'.esc_url(apply_filters('paginate_links', $link)).'">'.$args['next_text'].'</a>';
3159 3159
 	endif;
3160
-	switch ( $args['type'] ) {
3160
+	switch ($args['type']) {
3161 3161
 		case 'array' :
3162 3162
 			return $page_links;
3163 3163
 
@@ -3200,10 +3200,10 @@  discard block
 block discarded – undo
3200 3200
  *     @type string $current SVG icon color of current admin menu link.
3201 3201
  * }
3202 3202
  */
3203
-function wp_admin_css_color( $key, $name, $url, $colors = array(), $icons = array() ) {
3203
+function wp_admin_css_color($key, $name, $url, $colors = array(), $icons = array()) {
3204 3204
 	global $_wp_admin_css_colors;
3205 3205
 
3206
-	if ( !isset($_wp_admin_css_colors) )
3206
+	if ( ! isset($_wp_admin_css_colors))
3207 3207
 		$_wp_admin_css_colors = array();
3208 3208
 
3209 3209
 	$_wp_admin_css_colors[$key] = (object) array(
@@ -3225,56 +3225,56 @@  discard block
 block discarded – undo
3225 3225
 	$suffix = is_rtl() ? '-rtl' : '';
3226 3226
 	$suffix .= SCRIPT_DEBUG ? '' : '.min';
3227 3227
 
3228
-	wp_admin_css_color( 'fresh', _x( 'Default', 'admin color scheme' ),
3228
+	wp_admin_css_color('fresh', _x('Default', 'admin color scheme'),
3229 3229
 		false,
3230
-		array( '#222', '#333', '#0073aa', '#00a0d2' ),
3231
-		array( 'base' => '#82878c', 'focus' => '#00a0d2', 'current' => '#fff' )
3230
+		array('#222', '#333', '#0073aa', '#00a0d2'),
3231
+		array('base' => '#82878c', 'focus' => '#00a0d2', 'current' => '#fff')
3232 3232
 	);
3233 3233
 
3234 3234
 	// Other color schemes are not available when running out of src
3235
-	if ( false !== strpos( $GLOBALS['wp_version'], '-src' ) )
3235
+	if (false !== strpos($GLOBALS['wp_version'], '-src'))
3236 3236
 		return;
3237 3237
 
3238
-	wp_admin_css_color( 'light', _x( 'Light', 'admin color scheme' ),
3239
-		admin_url( "css/colors/light/colors$suffix.css" ),
3240
-		array( '#e5e5e5', '#999', '#d64e07', '#04a4cc' ),
3241
-		array( 'base' => '#999', 'focus' => '#ccc', 'current' => '#ccc' )
3238
+	wp_admin_css_color('light', _x('Light', 'admin color scheme'),
3239
+		admin_url("css/colors/light/colors$suffix.css"),
3240
+		array('#e5e5e5', '#999', '#d64e07', '#04a4cc'),
3241
+		array('base' => '#999', 'focus' => '#ccc', 'current' => '#ccc')
3242 3242
 	);
3243 3243
 
3244
-	wp_admin_css_color( 'blue', _x( 'Blue', 'admin color scheme' ),
3245
-		admin_url( "css/colors/blue/colors$suffix.css" ),
3246
-		array( '#096484', '#4796b3', '#52accc', '#74B6CE' ),
3247
-		array( 'base' => '#e5f8ff', 'focus' => '#fff', 'current' => '#fff' )
3244
+	wp_admin_css_color('blue', _x('Blue', 'admin color scheme'),
3245
+		admin_url("css/colors/blue/colors$suffix.css"),
3246
+		array('#096484', '#4796b3', '#52accc', '#74B6CE'),
3247
+		array('base' => '#e5f8ff', 'focus' => '#fff', 'current' => '#fff')
3248 3248
 	);
3249 3249
 
3250
-	wp_admin_css_color( 'midnight', _x( 'Midnight', 'admin color scheme' ),
3251
-		admin_url( "css/colors/midnight/colors$suffix.css" ),
3252
-		array( '#25282b', '#363b3f', '#69a8bb', '#e14d43' ),
3253
-		array( 'base' => '#f1f2f3', 'focus' => '#fff', 'current' => '#fff' )
3250
+	wp_admin_css_color('midnight', _x('Midnight', 'admin color scheme'),
3251
+		admin_url("css/colors/midnight/colors$suffix.css"),
3252
+		array('#25282b', '#363b3f', '#69a8bb', '#e14d43'),
3253
+		array('base' => '#f1f2f3', 'focus' => '#fff', 'current' => '#fff')
3254 3254
 	);
3255 3255
 
3256
-	wp_admin_css_color( 'sunrise', _x( 'Sunrise', 'admin color scheme' ),
3257
-		admin_url( "css/colors/sunrise/colors$suffix.css" ),
3258
-		array( '#b43c38', '#cf4944', '#dd823b', '#ccaf0b' ),
3259
-		array( 'base' => '#f3f1f1', 'focus' => '#fff', 'current' => '#fff' )
3256
+	wp_admin_css_color('sunrise', _x('Sunrise', 'admin color scheme'),
3257
+		admin_url("css/colors/sunrise/colors$suffix.css"),
3258
+		array('#b43c38', '#cf4944', '#dd823b', '#ccaf0b'),
3259
+		array('base' => '#f3f1f1', 'focus' => '#fff', 'current' => '#fff')
3260 3260
 	);
3261 3261
 
3262
-	wp_admin_css_color( 'ectoplasm', _x( 'Ectoplasm', 'admin color scheme' ),
3263
-		admin_url( "css/colors/ectoplasm/colors$suffix.css" ),
3264
-		array( '#413256', '#523f6d', '#a3b745', '#d46f15' ),
3265
-		array( 'base' => '#ece6f6', 'focus' => '#fff', 'current' => '#fff' )
3262
+	wp_admin_css_color('ectoplasm', _x('Ectoplasm', 'admin color scheme'),
3263
+		admin_url("css/colors/ectoplasm/colors$suffix.css"),
3264
+		array('#413256', '#523f6d', '#a3b745', '#d46f15'),
3265
+		array('base' => '#ece6f6', 'focus' => '#fff', 'current' => '#fff')
3266 3266
 	);
3267 3267
 
3268
-	wp_admin_css_color( 'ocean', _x( 'Ocean', 'admin color scheme' ),
3269
-		admin_url( "css/colors/ocean/colors$suffix.css" ),
3270
-		array( '#627c83', '#738e96', '#9ebaa0', '#aa9d88' ),
3271
-		array( 'base' => '#f2fcff', 'focus' => '#fff', 'current' => '#fff' )
3268
+	wp_admin_css_color('ocean', _x('Ocean', 'admin color scheme'),
3269
+		admin_url("css/colors/ocean/colors$suffix.css"),
3270
+		array('#627c83', '#738e96', '#9ebaa0', '#aa9d88'),
3271
+		array('base' => '#f2fcff', 'focus' => '#fff', 'current' => '#fff')
3272 3272
 	);
3273 3273
 
3274
-	wp_admin_css_color( 'coffee', _x( 'Coffee', 'admin color scheme' ),
3275
-		admin_url( "css/colors/coffee/colors$suffix.css" ),
3276
-		array( '#46403c', '#59524c', '#c7a589', '#9ea476' ),
3277
-		array( 'base' => '#f3f2f1', 'focus' => '#fff', 'current' => '#fff' )
3274
+	wp_admin_css_color('coffee', _x('Coffee', 'admin color scheme'),
3275
+		admin_url("css/colors/coffee/colors$suffix.css"),
3276
+		array('#46403c', '#59524c', '#c7a589', '#9ea476'),
3277
+		array('base' => '#f3f2f1', 'focus' => '#fff', 'current' => '#fff')
3278 3278
 	);
3279 3279
 
3280 3280
 }
@@ -3289,13 +3289,13 @@  discard block
 block discarded – undo
3289 3289
  * @param string $file file relative to wp-admin/ without its ".css" extension.
3290 3290
  * @return string
3291 3291
  */
3292
-function wp_admin_css_uri( $file = 'wp-admin' ) {
3293
-	if ( defined('WP_INSTALLING') ) {
3292
+function wp_admin_css_uri($file = 'wp-admin') {
3293
+	if (defined('WP_INSTALLING')) {
3294 3294
 		$_file = "./$file.css";
3295 3295
 	} else {
3296 3296
 		$_file = admin_url("$file.css");
3297 3297
 	}
3298
-	$_file = add_query_arg( 'version', get_bloginfo( 'version' ),  $_file );
3298
+	$_file = add_query_arg('version', get_bloginfo('version'), $_file);
3299 3299
 
3300 3300
 	/**
3301 3301
 	 * Filter the URI of a WordPress admin CSS file.
@@ -3305,7 +3305,7 @@  discard block
 block discarded – undo
3305 3305
 	 * @param string $_file Relative path to the file with query arguments attached.
3306 3306
 	 * @param string $file  Relative path to the file, minus its ".css" extension.
3307 3307
 	 */
3308
-	return apply_filters( 'wp_admin_css_uri', $_file, $file );
3308
+	return apply_filters('wp_admin_css_uri', $_file, $file);
3309 3309
 }
3310 3310
 
3311 3311
 /**
@@ -3328,15 +3328,15 @@  discard block
 block discarded – undo
3328 3328
  * 	                         to wp-admin/. Defaults to 'wp-admin'.
3329 3329
  * @param bool   $force_echo Optional. Force the stylesheet link to be printed rather than enqueued.
3330 3330
  */
3331
-function wp_admin_css( $file = 'wp-admin', $force_echo = false ) {
3331
+function wp_admin_css($file = 'wp-admin', $force_echo = false) {
3332 3332
 	// For backward compatibility
3333
-	$handle = 0 === strpos( $file, 'css/' ) ? substr( $file, 4 ) : $file;
3333
+	$handle = 0 === strpos($file, 'css/') ? substr($file, 4) : $file;
3334 3334
 
3335
-	if ( wp_styles()->query( $handle ) ) {
3336
-		if ( $force_echo || did_action( 'wp_print_styles' ) ) // we already printed the style queue. Print this one immediately
3337
-			wp_print_styles( $handle );
3335
+	if (wp_styles()->query($handle)) {
3336
+		if ($force_echo || did_action('wp_print_styles')) // we already printed the style queue. Print this one immediately
3337
+			wp_print_styles($handle);
3338 3338
 		else // Add to style queue
3339
-			wp_enqueue_style( $handle );
3339
+			wp_enqueue_style($handle);
3340 3340
 		return;
3341 3341
 	}
3342 3342
 
@@ -3351,11 +3351,11 @@  discard block
 block discarded – undo
3351 3351
 	 * @param string $file Style handle name or filename (without ".css" extension)
3352 3352
 	 *                     relative to wp-admin/. Defaults to 'wp-admin'.
3353 3353
 	 */
3354
-	echo apply_filters( 'wp_admin_css', "<link rel='stylesheet' href='" . esc_url( wp_admin_css_uri( $file ) ) . "' type='text/css' />\n", $file );
3354
+	echo apply_filters('wp_admin_css', "<link rel='stylesheet' href='".esc_url(wp_admin_css_uri($file))."' type='text/css' />\n", $file);
3355 3355
 
3356
-	if ( function_exists( 'is_rtl' ) && is_rtl() ) {
3356
+	if (function_exists('is_rtl') && is_rtl()) {
3357 3357
 		/** This filter is documented in wp-includes/general-template.php */
3358
-		echo apply_filters( 'wp_admin_css', "<link rel='stylesheet' href='" . esc_url( wp_admin_css_uri( "$file-rtl" ) ) . "' type='text/css' />\n", "$file-rtl" );
3358
+		echo apply_filters('wp_admin_css', "<link rel='stylesheet' href='".esc_url(wp_admin_css_uri("$file-rtl"))."' type='text/css' />\n", "$file-rtl");
3359 3359
 	}
3360 3360
 }
3361 3361
 
@@ -3369,11 +3369,11 @@  discard block
 block discarded – undo
3369 3369
  * @since 2.5.0
3370 3370
  */
3371 3371
 function add_thickbox() {
3372
-	wp_enqueue_script( 'thickbox' );
3373
-	wp_enqueue_style( 'thickbox' );
3372
+	wp_enqueue_script('thickbox');
3373
+	wp_enqueue_style('thickbox');
3374 3374
 
3375
-	if ( is_network_admin() )
3376
-		add_action( 'admin_head', '_thickbox_path_admin_subfolder' );
3375
+	if (is_network_admin())
3376
+		add_action('admin_head', '_thickbox_path_admin_subfolder');
3377 3377
 }
3378 3378
 
3379 3379
 /**
@@ -3389,7 +3389,7 @@  discard block
 block discarded – undo
3389 3389
 	 *
3390 3390
 	 * @param string $generator_type The XHTML generator.
3391 3391
 	 */
3392
-	the_generator( apply_filters( 'wp_generator_type', 'xhtml' ) );
3392
+	the_generator(apply_filters('wp_generator_type', 'xhtml'));
3393 3393
 }
3394 3394
 
3395 3395
 /**
@@ -3402,7 +3402,7 @@  discard block
 block discarded – undo
3402 3402
  *
3403 3403
  * @param string $type The type of generator to output - (html|xhtml|atom|rss2|rdf|comment|export).
3404 3404
  */
3405
-function the_generator( $type ) {
3405
+function the_generator($type) {
3406 3406
 	/**
3407 3407
 	 * Filter the output of the XHTML generator tag for display.
3408 3408
 	 *
@@ -3412,7 +3412,7 @@  discard block
 block discarded – undo
3412 3412
 	 * @param string $type           The type of generator to output. Accepts 'html',
3413 3413
 	 *                               'xhtml', 'atom', 'rss2', 'rdf', 'comment', 'export'.
3414 3414
 	 */
3415
-	echo apply_filters( 'the_generator', get_the_generator($type), $type ) . "\n";
3415
+	echo apply_filters('the_generator', get_the_generator($type), $type)."\n";
3416 3416
 }
3417 3417
 
3418 3418
 /**
@@ -3427,14 +3427,14 @@  discard block
 block discarded – undo
3427 3427
  * @param string $type The type of generator to return - (html|xhtml|atom|rss2|rdf|comment|export).
3428 3428
  * @return string|void The HTML content for the generator.
3429 3429
  */
3430
-function get_the_generator( $type = '' ) {
3431
-	if ( empty( $type ) ) {
3430
+function get_the_generator($type = '') {
3431
+	if (empty($type)) {
3432 3432
 
3433 3433
 		$current_filter = current_filter();
3434
-		if ( empty( $current_filter ) )
3434
+		if (empty($current_filter))
3435 3435
 			return;
3436 3436
 
3437
-		switch ( $current_filter ) {
3437
+		switch ($current_filter) {
3438 3438
 			case 'rss2_head' :
3439 3439
 			case 'commentsrss2_head' :
3440 3440
 				$type = 'rss2';
@@ -3454,27 +3454,27 @@  discard block
 block discarded – undo
3454 3454
 		}
3455 3455
 	}
3456 3456
 
3457
-	switch ( $type ) {
3457
+	switch ($type) {
3458 3458
 		case 'html':
3459
-			$gen = '<meta name="generator" content="WordPress ' . get_bloginfo( 'version' ) . '">';
3459
+			$gen = '<meta name="generator" content="WordPress '.get_bloginfo('version').'">';
3460 3460
 			break;
3461 3461
 		case 'xhtml':
3462
-			$gen = '<meta name="generator" content="WordPress ' . get_bloginfo( 'version' ) . '" />';
3462
+			$gen = '<meta name="generator" content="WordPress '.get_bloginfo('version').'" />';
3463 3463
 			break;
3464 3464
 		case 'atom':
3465
-			$gen = '<generator uri="https://wordpress.org/" version="' . get_bloginfo_rss( 'version' ) . '">WordPress</generator>';
3465
+			$gen = '<generator uri="https://wordpress.org/" version="'.get_bloginfo_rss('version').'">WordPress</generator>';
3466 3466
 			break;
3467 3467
 		case 'rss2':
3468
-			$gen = '<generator>https://wordpress.org/?v=' . get_bloginfo_rss( 'version' ) . '</generator>';
3468
+			$gen = '<generator>https://wordpress.org/?v='.get_bloginfo_rss('version').'</generator>';
3469 3469
 			break;
3470 3470
 		case 'rdf':
3471
-			$gen = '<admin:generatorAgent rdf:resource="https://wordpress.org/?v=' . get_bloginfo_rss( 'version' ) . '" />';
3471
+			$gen = '<admin:generatorAgent rdf:resource="https://wordpress.org/?v='.get_bloginfo_rss('version').'" />';
3472 3472
 			break;
3473 3473
 		case 'comment':
3474
-			$gen = '<!-- generator="WordPress/' . get_bloginfo( 'version' ) . '" -->';
3474
+			$gen = '<!-- generator="WordPress/'.get_bloginfo('version').'" -->';
3475 3475
 			break;
3476 3476
 		case 'export':
3477
-			$gen = '<!-- generator="WordPress/' . get_bloginfo_rss('version') . '" created="'. date('Y-m-d H:i') . '" -->';
3477
+			$gen = '<!-- generator="WordPress/'.get_bloginfo_rss('version').'" created="'.date('Y-m-d H:i').'" -->';
3478 3478
 			break;
3479 3479
 	}
3480 3480
 
@@ -3489,7 +3489,7 @@  discard block
 block discarded – undo
3489 3489
 	 * @param string $type The type of generator. Accepts 'html', 'xhtml', 'atom',
3490 3490
 	 *                     'rss2', 'rdf', 'comment', 'export'.
3491 3491
 	 */
3492
-	return apply_filters( "get_the_generator_{$type}", $gen, $type );
3492
+	return apply_filters("get_the_generator_{$type}", $gen, $type);
3493 3493
 }
3494 3494
 
3495 3495
 /**
@@ -3504,8 +3504,8 @@  discard block
 block discarded – undo
3504 3504
  * @param bool  $echo    Whether to echo or just return the string
3505 3505
  * @return string html attribute or empty string
3506 3506
  */
3507
-function checked( $checked, $current = true, $echo = true ) {
3508
-	return __checked_selected_helper( $checked, $current, $echo, 'checked' );
3507
+function checked($checked, $current = true, $echo = true) {
3508
+	return __checked_selected_helper($checked, $current, $echo, 'checked');
3509 3509
 }
3510 3510
 
3511 3511
 /**
@@ -3520,8 +3520,8 @@  discard block
 block discarded – undo
3520 3520
  * @param bool  $echo     Whether to echo or just return the string
3521 3521
  * @return string html attribute or empty string
3522 3522
  */
3523
-function selected( $selected, $current = true, $echo = true ) {
3524
-	return __checked_selected_helper( $selected, $current, $echo, 'selected' );
3523
+function selected($selected, $current = true, $echo = true) {
3524
+	return __checked_selected_helper($selected, $current, $echo, 'selected');
3525 3525
 }
3526 3526
 
3527 3527
 /**
@@ -3536,8 +3536,8 @@  discard block
 block discarded – undo
3536 3536
  * @param bool  $echo     Whether to echo or just return the string
3537 3537
  * @return string html attribute or empty string
3538 3538
  */
3539
-function disabled( $disabled, $current = true, $echo = true ) {
3540
-	return __checked_selected_helper( $disabled, $current, $echo, 'disabled' );
3539
+function disabled($disabled, $current = true, $echo = true) {
3540
+	return __checked_selected_helper($disabled, $current, $echo, 'disabled');
3541 3541
 }
3542 3542
 
3543 3543
 /**
@@ -3554,13 +3554,13 @@  discard block
 block discarded – undo
3554 3554
  * @param string $type    The type of checked|selected|disabled we are doing
3555 3555
  * @return string html attribute or empty string
3556 3556
  */
3557
-function __checked_selected_helper( $helper, $current, $echo, $type ) {
3558
-	if ( (string) $helper === (string) $current )
3557
+function __checked_selected_helper($helper, $current, $echo, $type) {
3558
+	if ((string) $helper === (string) $current)
3559 3559
 		$result = " $type='$type'";
3560 3560
 	else
3561 3561
 		$result = '';
3562 3562
 
3563
-	if ( $echo )
3563
+	if ($echo)
3564 3564
 		echo $result;
3565 3565
 
3566 3566
 	return $result;
@@ -3576,12 +3576,12 @@  discard block
 block discarded – undo
3576 3576
  * @param array $settings
3577 3577
  * @return array $settings
3578 3578
  */
3579
-function wp_heartbeat_settings( $settings ) {
3580
-	if ( ! is_admin() )
3581
-		$settings['ajaxurl'] = admin_url( 'admin-ajax.php', 'relative' );
3579
+function wp_heartbeat_settings($settings) {
3580
+	if ( ! is_admin())
3581
+		$settings['ajaxurl'] = admin_url('admin-ajax.php', 'relative');
3582 3582
 
3583
-	if ( is_user_logged_in() )
3584
-		$settings['nonce'] = wp_create_nonce( 'heartbeat-nonce' );
3583
+	if (is_user_logged_in())
3584
+		$settings['nonce'] = wp_create_nonce('heartbeat-nonce');
3585 3585
 
3586 3586
 	return $settings;
3587 3587
 }
Please login to merge, or discard this patch.
Braces   +202 added lines, -145 removed lines patch added patch discarded remove patch
@@ -114,8 +114,9 @@  discard block
 block discarded – undo
114 114
 
115 115
 	$templates = array();
116 116
 	$name = (string) $name;
117
-	if ( '' !== $name )
118
-		$templates[] = "sidebar-{$name}.php";
117
+	if ( '' !== $name ) {
118
+			$templates[] = "sidebar-{$name}.php";
119
+	}
119 120
 
120 121
 	$templates[] = 'sidebar.php';
121 122
 
@@ -159,8 +160,9 @@  discard block
 block discarded – undo
159 160
 
160 161
 	$templates = array();
161 162
 	$name = (string) $name;
162
-	if ( '' !== $name )
163
-		$templates[] = "{$slug}-{$name}.php";
163
+	if ( '' !== $name ) {
164
+			$templates[] = "{$slug}-{$name}.php";
165
+	}
164 166
 
165 167
 	$templates[] = "{$slug}.php";
166 168
 
@@ -246,14 +248,16 @@  discard block
 block discarded – undo
246 248
 	 */
247 249
 	$result = apply_filters( 'get_search_form', $form );
248 250
 
249
-	if ( null === $result )
250
-		$result = $form;
251
+	if ( null === $result ) {
252
+			$result = $form;
253
+	}
251 254
 
252
-	if ( $echo )
253
-		echo $result;
254
-	else
255
-		return $result;
256
-}
255
+	if ( $echo ) {
256
+			echo $result;
257
+	} else {
258
+			return $result;
259
+	}
260
+	}
257 261
 
258 262
 /**
259 263
  * Display the Log In/Out link.
@@ -268,10 +272,11 @@  discard block
 block discarded – undo
268 272
  * @return string|void String when retrieving.
269 273
  */
270 274
 function wp_loginout($redirect = '', $echo = true) {
271
-	if ( ! is_user_logged_in() )
272
-		$link = '<a href="' . esc_url( wp_login_url($redirect) ) . '">' . __('Log in') . '</a>';
273
-	else
274
-		$link = '<a href="' . esc_url( wp_logout_url($redirect) ) . '">' . __('Log out') . '</a>';
275
+	if ( ! is_user_logged_in() ) {
276
+			$link = '<a href="' . esc_url( wp_login_url($redirect) ) . '">' . __('Log in') . '</a>';
277
+	} else {
278
+			$link = '<a href="' . esc_url( wp_logout_url($redirect) ) . '">' . __('Log out') . '</a>';
279
+	}
275 280
 
276 281
 	if ( $echo ) {
277 282
 		/**
@@ -330,11 +335,13 @@  discard block
 block discarded – undo
330 335
 function wp_login_url($redirect = '', $force_reauth = false) {
331 336
 	$login_url = site_url('wp-login.php', 'login');
332 337
 
333
-	if ( !empty($redirect) )
334
-		$login_url = add_query_arg('redirect_to', urlencode($redirect), $login_url);
338
+	if ( !empty($redirect) ) {
339
+			$login_url = add_query_arg('redirect_to', urlencode($redirect), $login_url);
340
+	}
335 341
 
336
-	if ( $force_reauth )
337
-		$login_url = add_query_arg('reauth', '1', $login_url);
342
+	if ( $force_reauth ) {
343
+			$login_url = add_query_arg('reauth', '1', $login_url);
344
+	}
338 345
 
339 346
 	/**
340 347
 	 * Filter the login URL.
@@ -486,11 +493,12 @@  discard block
 block discarded – undo
486 493
 			' . $login_form_bottom . '
487 494
 		</form>';
488 495
 
489
-	if ( $args['echo'] )
490
-		echo $form;
491
-	else
492
-		return $form;
493
-}
496
+	if ( $args['echo'] ) {
497
+			echo $form;
498
+	} else {
499
+			return $form;
500
+	}
501
+	}
494 502
 
495 503
 /**
496 504
  * Returns the URL that allows the user to retrieve the lost password
@@ -534,10 +542,11 @@  discard block
 block discarded – undo
534 542
  */
535 543
 function wp_register( $before = '<li>', $after = '</li>', $echo = true ) {
536 544
 	if ( ! is_user_logged_in() ) {
537
-		if ( get_option('users_can_register') )
538
-			$link = $before . '<a href="' . esc_url( wp_registration_url() ) . '">' . __('Register') . '</a>' . $after;
539
-		else
540
-			$link = '';
545
+		if ( get_option('users_can_register') ) {
546
+					$link = $before . '<a href="' . esc_url( wp_registration_url() ) . '">' . __('Register') . '</a>' . $after;
547
+		} else {
548
+					$link = '';
549
+		}
541 550
 	} elseif ( current_user_can( 'read' ) ) {
542 551
 		$link = $before . '<a href="' . admin_url() . '">' . __('Site Admin') . '</a>' . $after;
543 552
 	} else {
@@ -698,7 +707,9 @@  discard block
 block discarded – undo
698 707
 			break;
699 708
 		case 'charset':
700 709
 			$output = get_option('blog_charset');
701
-			if ('' == $output) $output = 'UTF-8';
710
+			if ('' == $output) {
711
+				$output = 'UTF-8';
712
+			}
702 713
 			break;
703 714
 		case 'html_type' :
704 715
 			$output = get_option('html_type');
@@ -741,8 +752,9 @@  discard block
 block discarded – undo
741 752
 	$url = true;
742 753
 	if (strpos($show, 'url') === false &&
743 754
 		strpos($show, 'directory') === false &&
744
-		strpos($show, 'home') === false)
745
-		$url = false;
755
+		strpos($show, 'home') === false) {
756
+			$url = false;
757
+	}
746 758
 
747 759
 	if ( 'display' == $filter ) {
748 760
 		if ( $url ) {
@@ -1241,8 +1253,9 @@  discard block
 block discarded – undo
1241 1253
 function single_post_title( $prefix = '', $display = true ) {
1242 1254
 	$_post = get_queried_object();
1243 1255
 
1244
-	if ( !isset($_post->post_title) )
1245
-		return;
1256
+	if ( !isset($_post->post_title) ) {
1257
+			return;
1258
+	}
1246 1259
 
1247 1260
 	/**
1248 1261
 	 * Filter the page title for a single post.
@@ -1253,11 +1266,12 @@  discard block
 block discarded – undo
1253 1266
 	 * @param object $_post       The current queried object as returned by get_queried_object().
1254 1267
 	 */
1255 1268
 	$title = apply_filters( 'single_post_title', $_post->post_title, $_post );
1256
-	if ( $display )
1257
-		echo $prefix . $title;
1258
-	else
1259
-		return $prefix . $title;
1260
-}
1269
+	if ( $display ) {
1270
+			echo $prefix . $title;
1271
+	} else {
1272
+			return $prefix . $title;
1273
+	}
1274
+	}
1261 1275
 
1262 1276
 /**
1263 1277
  * Display or retrieve title for a post type archive.
@@ -1272,12 +1286,14 @@  discard block
 block discarded – undo
1272 1286
  * @return string|void Title when retrieving, null when displaying or failure.
1273 1287
  */
1274 1288
 function post_type_archive_title( $prefix = '', $display = true ) {
1275
-	if ( ! is_post_type_archive() )
1276
-		return;
1289
+	if ( ! is_post_type_archive() ) {
1290
+			return;
1291
+	}
1277 1292
 
1278 1293
 	$post_type = get_query_var( 'post_type' );
1279
-	if ( is_array( $post_type ) )
1280
-		$post_type = reset( $post_type );
1294
+	if ( is_array( $post_type ) ) {
1295
+			$post_type = reset( $post_type );
1296
+	}
1281 1297
 
1282 1298
 	$post_type_obj = get_post_type_object( $post_type );
1283 1299
 
@@ -1291,11 +1307,12 @@  discard block
 block discarded – undo
1291 1307
 	 */
1292 1308
 	$title = apply_filters( 'post_type_archive_title', $post_type_obj->labels->name, $post_type );
1293 1309
 
1294
-	if ( $display )
1295
-		echo $prefix . $title;
1296
-	else
1297
-		return $prefix . $title;
1298
-}
1310
+	if ( $display ) {
1311
+			echo $prefix . $title;
1312
+	} else {
1313
+			return $prefix . $title;
1314
+	}
1315
+	}
1299 1316
 
1300 1317
 /**
1301 1318
  * Display or retrieve page title for category archive.
@@ -1347,8 +1364,9 @@  discard block
 block discarded – undo
1347 1364
 function single_term_title( $prefix = '', $display = true ) {
1348 1365
 	$term = get_queried_object();
1349 1366
 
1350
-	if ( !$term )
1351
-		return;
1367
+	if ( !$term ) {
1368
+			return;
1369
+	}
1352 1370
 
1353 1371
 	if ( is_category() ) {
1354 1372
 		/**
@@ -1381,14 +1399,16 @@  discard block
 block discarded – undo
1381 1399
 		return;
1382 1400
 	}
1383 1401
 
1384
-	if ( empty( $term_name ) )
1385
-		return;
1402
+	if ( empty( $term_name ) ) {
1403
+			return;
1404
+	}
1386 1405
 
1387
-	if ( $display )
1388
-		echo $prefix . $term_name;
1389
-	else
1390
-		return $prefix . $term_name;
1391
-}
1406
+	if ( $display ) {
1407
+			echo $prefix . $term_name;
1408
+	} else {
1409
+			return $prefix . $term_name;
1410
+	}
1411
+	}
1392 1412
 
1393 1413
 /**
1394 1414
  * Display or retrieve page title for post archive based on date.
@@ -1421,13 +1441,15 @@  discard block
 block discarded – undo
1421 1441
 		$my_month = $wp_locale->get_month(substr($m, 4, 2));
1422 1442
 	}
1423 1443
 
1424
-	if ( empty($my_month) )
1425
-		return false;
1444
+	if ( empty($my_month) ) {
1445
+			return false;
1446
+	}
1426 1447
 
1427 1448
 	$result = $prefix . $my_month . $prefix . $my_year;
1428 1449
 
1429
-	if ( !$display )
1430
-		return $result;
1450
+	if ( !$display ) {
1451
+			return $result;
1452
+	}
1431 1453
 	echo $result;
1432 1454
 }
1433 1455
 
@@ -1583,14 +1605,16 @@  discard block
 block discarded – undo
1583 1605
 	$text = wptexturize($text);
1584 1606
 	$url = esc_url($url);
1585 1607
 
1586
-	if ('link' == $format)
1587
-		$link_html = "\t<link rel='archives' title='" . esc_attr( $text ) . "' href='$url' />\n";
1588
-	elseif ('option' == $format)
1589
-		$link_html = "\t<option value='$url'>$before $text $after</option>\n";
1590
-	elseif ('html' == $format)
1591
-		$link_html = "\t<li>$before<a href='$url'>$text</a>$after</li>\n";
1592
-	else // custom
1608
+	if ('link' == $format) {
1609
+			$link_html = "\t<link rel='archives' title='" . esc_attr( $text ) . "' href='$url' />\n";
1610
+	} elseif ('option' == $format) {
1611
+			$link_html = "\t<option value='$url'>$before $text $after</option>\n";
1612
+	} elseif ('html' == $format) {
1613
+			$link_html = "\t<li>$before<a href='$url'>$text</a>$after</li>\n";
1614
+	} else {
1615
+		// custom
1593 1616
 		$link_html = "\t$before<a href='$url'>$text</a>$after\n";
1617
+	}
1594 1618
 
1595 1619
 	/**
1596 1620
 	 * Filter the archive link content.
@@ -2177,10 +2201,11 @@  discard block
 block discarded – undo
2177 2201
 		 */
2178 2202
 		$the_date = apply_filters( 'the_date', $the_date, $d, $before, $after );
2179 2203
 
2180
-		if ( $echo )
2181
-			echo $the_date;
2182
-		else
2183
-			return $the_date;
2204
+		if ( $echo ) {
2205
+					echo $the_date;
2206
+		} else {
2207
+					return $the_date;
2208
+		}
2184 2209
 	}
2185 2210
 }
2186 2211
 
@@ -2249,10 +2274,11 @@  discard block
 block discarded – undo
2249 2274
 	 */
2250 2275
 	$the_modified_date = apply_filters( 'the_modified_date', $the_modified_date, $d, $before, $after );
2251 2276
 
2252
-	if ( $echo )
2253
-		echo $the_modified_date;
2254
-	else
2255
-		return $the_modified_date;
2277
+	if ( $echo ) {
2278
+			echo $the_modified_date;
2279
+	} else {
2280
+			return $the_modified_date;
2281
+	}
2256 2282
 
2257 2283
 }
2258 2284
 
@@ -2265,10 +2291,11 @@  discard block
 block discarded – undo
2265 2291
  * @return string
2266 2292
  */
2267 2293
 function get_the_modified_date($d = '') {
2268
-	if ( '' == $d )
2269
-		$the_time = get_post_modified_time(get_option('date_format'), null, null, true);
2270
-	else
2271
-		$the_time = get_post_modified_time($d, null, null, true);
2294
+	if ( '' == $d ) {
2295
+			$the_time = get_post_modified_time(get_option('date_format'), null, null, true);
2296
+	} else {
2297
+			$the_time = get_post_modified_time($d, null, null, true);
2298
+	}
2272 2299
 
2273 2300
 	/**
2274 2301
 	 * Filter the date a post was last modified.
@@ -2320,10 +2347,11 @@  discard block
 block discarded – undo
2320 2347
 		return false;
2321 2348
 	}
2322 2349
 
2323
-	if ( '' == $d )
2324
-		$the_time = get_post_time(get_option('time_format'), false, $post, true);
2325
-	else
2326
-		$the_time = get_post_time($d, false, $post, true);
2350
+	if ( '' == $d ) {
2351
+			$the_time = get_post_time(get_option('time_format'), false, $post, true);
2352
+	} else {
2353
+			$the_time = get_post_time($d, false, $post, true);
2354
+	}
2327 2355
 
2328 2356
 	/**
2329 2357
 	 * Filter the time a post was written.
@@ -2358,10 +2386,11 @@  discard block
 block discarded – undo
2358 2386
 		return false;
2359 2387
 	}
2360 2388
 
2361
-	if ( $gmt )
2362
-		$time = $post->post_date_gmt;
2363
-	else
2364
-		$time = $post->post_date;
2389
+	if ( $gmt ) {
2390
+			$time = $post->post_date_gmt;
2391
+	} else {
2392
+			$time = $post->post_date;
2393
+	}
2365 2394
 
2366 2395
 	$time = mysql2date($d, $time, $translate);
2367 2396
 
@@ -2408,10 +2437,11 @@  discard block
 block discarded – undo
2408 2437
  * @return string
2409 2438
  */
2410 2439
 function get_the_modified_time($d = '') {
2411
-	if ( '' == $d )
2412
-		$the_time = get_post_modified_time(get_option('time_format'), null, null, true);
2413
-	else
2414
-		$the_time = get_post_modified_time($d, null, null, true);
2440
+	if ( '' == $d ) {
2441
+			$the_time = get_post_modified_time(get_option('time_format'), null, null, true);
2442
+	} else {
2443
+			$the_time = get_post_modified_time($d, null, null, true);
2444
+	}
2415 2445
 
2416 2446
 	/**
2417 2447
 	 * Filter the localized time a post was last modified.
@@ -2445,10 +2475,11 @@  discard block
 block discarded – undo
2445 2475
 		return false;
2446 2476
 	}
2447 2477
 
2448
-	if ( $gmt )
2449
-		$time = $post->post_modified_gmt;
2450
-	else
2451
-		$time = $post->post_modified;
2478
+	if ( $gmt ) {
2479
+			$time = $post->post_modified_gmt;
2480
+	} else {
2481
+			$time = $post->post_modified;
2482
+	}
2452 2483
 	$time = mysql2date($d, $time, $translate);
2453 2484
 
2454 2485
 	/**
@@ -2558,8 +2589,9 @@  discard block
 block discarded – undo
2558 2589
  * @param array $args Optional arguments.
2559 2590
  */
2560 2591
 function feed_links( $args = array() ) {
2561
-	if ( !current_theme_supports('automatic-feed-links') )
2562
-		return;
2592
+	if ( !current_theme_supports('automatic-feed-links') ) {
2593
+			return;
2594
+	}
2563 2595
 
2564 2596
 	$defaults = array(
2565 2597
 		/* translators: Separator between blog name and feed type in feed links */
@@ -2634,8 +2666,9 @@  discard block
 block discarded – undo
2634 2666
 		}
2635 2667
 	} elseif ( is_post_type_archive() ) {
2636 2668
 		$post_type = get_query_var( 'post_type' );
2637
-		if ( is_array( $post_type ) )
2638
-			$post_type = reset( $post_type );
2669
+		if ( is_array( $post_type ) ) {
2670
+					$post_type = reset( $post_type );
2671
+		}
2639 2672
 
2640 2673
 		$post_type_obj = get_post_type_object( $post_type );
2641 2674
 		$title = sprintf( $args['posttypetitle'], get_bloginfo( 'name' ), $args['separator'], $post_type_obj->labels->name );
@@ -2670,13 +2703,15 @@  discard block
 block discarded – undo
2670 2703
 	} elseif ( is_post_type_archive() ) {
2671 2704
 		$title = sprintf( $args['posttypetitle'], get_bloginfo('name'), $args['separator'], post_type_archive_title( '', false ) );
2672 2705
 		$post_type_obj = get_queried_object();
2673
-		if ( $post_type_obj )
2674
-			$href = get_post_type_archive_feed_link( $post_type_obj->name );
2706
+		if ( $post_type_obj ) {
2707
+					$href = get_post_type_archive_feed_link( $post_type_obj->name );
2708
+		}
2675 2709
 	}
2676 2710
 
2677
-	if ( isset($title) && isset($href) )
2678
-		echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr( $title ) . '" href="' . esc_url( $href ) . '" />' . "\n";
2679
-}
2711
+	if ( isset($title) && isset($href) ) {
2712
+			echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr( $title ) . '" href="' . esc_url( $href ) . '" />' . "\n";
2713
+	}
2714
+	}
2680 2715
 
2681 2716
 /**
2682 2717
  * Display the link to the Really Simple Discovery service endpoint.
@@ -2712,9 +2747,10 @@  discard block
 block discarded – undo
2712 2747
  */
2713 2748
 function noindex() {
2714 2749
 	// If the blog is not public, tell robots to go away.
2715
-	if ( '0' == get_option('blog_public') )
2716
-		wp_no_robots();
2717
-}
2750
+	if ( '0' == get_option('blog_public') ) {
2751
+			wp_no_robots();
2752
+	}
2753
+	}
2718 2754
 
2719 2755
 /**
2720 2756
  * Display a noindex meta tag.
@@ -2851,8 +2887,9 @@  discard block
 block discarded – undo
2851 2887
  * @param array  $settings  See _WP_Editors::editor().
2852 2888
  */
2853 2889
 function wp_editor( $content, $editor_id, $settings = array() ) {
2854
-	if ( ! class_exists( '_WP_Editors', false ) )
2855
-		require( ABSPATH . WPINC . '/class-wp-editor.php' );
2890
+	if ( ! class_exists( '_WP_Editors', false ) ) {
2891
+			require( ABSPATH . WPINC . '/class-wp-editor.php' );
2892
+	}
2856 2893
 
2857 2894
 	_WP_Editors::editor($content, $editor_id, $settings);
2858 2895
 }
@@ -2879,8 +2916,9 @@  discard block
 block discarded – undo
2879 2916
 	 */
2880 2917
 	$query = apply_filters( 'get_search_query', get_query_var( 's' ) );
2881 2918
 
2882
-	if ( $escaped )
2883
-		$query = esc_attr( $query );
2919
+	if ( $escaped ) {
2920
+			$query = esc_attr( $query );
2921
+	}
2884 2922
 	return $query;
2885 2923
 }
2886 2924
 
@@ -2916,15 +2954,18 @@  discard block
 block discarded – undo
2916 2954
 function get_language_attributes( $doctype = 'html' ) {
2917 2955
 	$attributes = array();
2918 2956
 
2919
-	if ( function_exists( 'is_rtl' ) && is_rtl() )
2920
-		$attributes[] = 'dir="rtl"';
2957
+	if ( function_exists( 'is_rtl' ) && is_rtl() ) {
2958
+			$attributes[] = 'dir="rtl"';
2959
+	}
2921 2960
 
2922 2961
 	if ( $lang = get_bloginfo('language') ) {
2923
-		if ( get_option('html_type') == 'text/html' || $doctype == 'html' )
2924
-			$attributes[] = "lang=\"$lang\"";
2962
+		if ( get_option('html_type') == 'text/html' || $doctype == 'html' ) {
2963
+					$attributes[] = "lang=\"$lang\"";
2964
+		}
2925 2965
 
2926
-		if ( get_option('html_type') != 'text/html' || $doctype == 'xhtml' )
2927
-			$attributes[] = "xml:lang=\"$lang\"";
2966
+		if ( get_option('html_type') != 'text/html' || $doctype == 'xhtml' ) {
2967
+					$attributes[] = "xml:lang=\"$lang\"";
2968
+		}
2928 2969
 	}
2929 2970
 
2930 2971
 	$output = implode(' ', $attributes);
@@ -3113,8 +3154,9 @@  discard block
 block discarded – undo
3113 3154
 	if ( $args['prev_next'] && $current && 1 < $current ) :
3114 3155
 		$link = str_replace( '%_%', 2 == $current ? '' : $args['format'], $args['base'] );
3115 3156
 		$link = str_replace( '%#%', $current - 1, $link );
3116
-		if ( $add_args )
3117
-			$link = add_query_arg( $add_args, $link );
3157
+		if ( $add_args ) {
3158
+					$link = add_query_arg( $add_args, $link );
3159
+		}
3118 3160
 		$link .= $args['add_fragment'];
3119 3161
 
3120 3162
 		/**
@@ -3130,12 +3172,15 @@  discard block
 block discarded – undo
3130 3172
 		if ( $n == $current ) :
3131 3173
 			$page_links[] = "<span class='page-numbers current'>" . $args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number'] . "</span>";
3132 3174
 			$dots = true;
3133
-		else :
3175
+		else {
3176
+			:
3134 3177
 			if ( $args['show_all'] || ( $n <= $end_size || ( $current && $n >= $current - $mid_size && $n <= $current + $mid_size ) || $n > $total - $end_size ) ) :
3135 3178
 				$link = str_replace( '%_%', 1 == $n ? '' : $args['format'], $args['base'] );
3179
+		}
3136 3180
 				$link = str_replace( '%#%', $n, $link );
3137
-				if ( $add_args )
3138
-					$link = add_query_arg( $add_args, $link );
3181
+				if ( $add_args ) {
3182
+									$link = add_query_arg( $add_args, $link );
3183
+				}
3139 3184
 				$link .= $args['add_fragment'];
3140 3185
 
3141 3186
 				/** This filter is documented in wp-includes/general-template.php */
@@ -3150,8 +3195,9 @@  discard block
 block discarded – undo
3150 3195
 	if ( $args['prev_next'] && $current && ( $current < $total || -1 == $total ) ) :
3151 3196
 		$link = str_replace( '%_%', $args['format'], $args['base'] );
3152 3197
 		$link = str_replace( '%#%', $current + 1, $link );
3153
-		if ( $add_args )
3154
-			$link = add_query_arg( $add_args, $link );
3198
+		if ( $add_args ) {
3199
+					$link = add_query_arg( $add_args, $link );
3200
+		}
3155 3201
 		$link .= $args['add_fragment'];
3156 3202
 
3157 3203
 		/** This filter is documented in wp-includes/general-template.php */
@@ -3203,8 +3249,9 @@  discard block
 block discarded – undo
3203 3249
 function wp_admin_css_color( $key, $name, $url, $colors = array(), $icons = array() ) {
3204 3250
 	global $_wp_admin_css_colors;
3205 3251
 
3206
-	if ( !isset($_wp_admin_css_colors) )
3207
-		$_wp_admin_css_colors = array();
3252
+	if ( !isset($_wp_admin_css_colors) ) {
3253
+			$_wp_admin_css_colors = array();
3254
+	}
3208 3255
 
3209 3256
 	$_wp_admin_css_colors[$key] = (object) array(
3210 3257
 		'name' => $name,
@@ -3232,8 +3279,9 @@  discard block
 block discarded – undo
3232 3279
 	);
3233 3280
 
3234 3281
 	// Other color schemes are not available when running out of src
3235
-	if ( false !== strpos( $GLOBALS['wp_version'], '-src' ) )
3236
-		return;
3282
+	if ( false !== strpos( $GLOBALS['wp_version'], '-src' ) ) {
3283
+			return;
3284
+	}
3237 3285
 
3238 3286
 	wp_admin_css_color( 'light', _x( 'Light', 'admin color scheme' ),
3239 3287
 		admin_url( "css/colors/light/colors$suffix.css" ),
@@ -3333,10 +3381,13 @@  discard block
 block discarded – undo
3333 3381
 	$handle = 0 === strpos( $file, 'css/' ) ? substr( $file, 4 ) : $file;
3334 3382
 
3335 3383
 	if ( wp_styles()->query( $handle ) ) {
3336
-		if ( $force_echo || did_action( 'wp_print_styles' ) ) // we already printed the style queue. Print this one immediately
3384
+		if ( $force_echo || did_action( 'wp_print_styles' ) ) {
3385
+			// we already printed the style queue. Print this one immediately
3337 3386
 			wp_print_styles( $handle );
3338
-		else // Add to style queue
3387
+		} else {
3388
+			// Add to style queue
3339 3389
 			wp_enqueue_style( $handle );
3390
+		}
3340 3391
 		return;
3341 3392
 	}
3342 3393
 
@@ -3372,9 +3423,10 @@  discard block
 block discarded – undo
3372 3423
 	wp_enqueue_script( 'thickbox' );
3373 3424
 	wp_enqueue_style( 'thickbox' );
3374 3425
 
3375
-	if ( is_network_admin() )
3376
-		add_action( 'admin_head', '_thickbox_path_admin_subfolder' );
3377
-}
3426
+	if ( is_network_admin() ) {
3427
+			add_action( 'admin_head', '_thickbox_path_admin_subfolder' );
3428
+	}
3429
+	}
3378 3430
 
3379 3431
 /**
3380 3432
  * Display the XHTML generator that is generated on the wp_head hook.
@@ -3431,8 +3483,9 @@  discard block
 block discarded – undo
3431 3483
 	if ( empty( $type ) ) {
3432 3484
 
3433 3485
 		$current_filter = current_filter();
3434
-		if ( empty( $current_filter ) )
3435
-			return;
3486
+		if ( empty( $current_filter ) ) {
3487
+					return;
3488
+		}
3436 3489
 
3437 3490
 		switch ( $current_filter ) {
3438 3491
 			case 'rss2_head' :
@@ -3555,13 +3608,15 @@  discard block
 block discarded – undo
3555 3608
  * @return string html attribute or empty string
3556 3609
  */
3557 3610
 function __checked_selected_helper( $helper, $current, $echo, $type ) {
3558
-	if ( (string) $helper === (string) $current )
3559
-		$result = " $type='$type'";
3560
-	else
3561
-		$result = '';
3611
+	if ( (string) $helper === (string) $current ) {
3612
+			$result = " $type='$type'";
3613
+	} else {
3614
+			$result = '';
3615
+	}
3562 3616
 
3563
-	if ( $echo )
3564
-		echo $result;
3617
+	if ( $echo ) {
3618
+			echo $result;
3619
+	}
3565 3620
 
3566 3621
 	return $result;
3567 3622
 }
@@ -3577,11 +3632,13 @@  discard block
 block discarded – undo
3577 3632
  * @return array $settings
3578 3633
  */
3579 3634
 function wp_heartbeat_settings( $settings ) {
3580
-	if ( ! is_admin() )
3581
-		$settings['ajaxurl'] = admin_url( 'admin-ajax.php', 'relative' );
3635
+	if ( ! is_admin() ) {
3636
+			$settings['ajaxurl'] = admin_url( 'admin-ajax.php', 'relative' );
3637
+	}
3582 3638
 
3583
-	if ( is_user_logged_in() )
3584
-		$settings['nonce'] = wp_create_nonce( 'heartbeat-nonce' );
3639
+	if ( is_user_logged_in() ) {
3640
+			$settings['nonce'] = wp_create_nonce( 'heartbeat-nonce' );
3641
+	}
3585 3642
 
3586 3643
 	return $settings;
3587 3644
 }
Please login to merge, or discard this patch.
src/wp-includes/link-template.php 3 patches
Doc Comments   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  * @since 1.2.0
13 13
  * @since 4.4.0 Added the `$post` parameter.
14 14
  *
15
- * @param int|WP_Post $post Optional. Post ID or post object. Default is the global `$post`.
15
+ * @param integer $post Optional. Post ID or post object. Default is the global `$post`.
16 16
  */
17 17
 function the_permalink( $post = 0 ) {
18 18
 	/**
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
  *
97 97
  * @see get_permalink()
98 98
  *
99
- * @param int|WP_Post $post      Optional. Post ID or post object. Default is the global `$post`.
99
+ * @param integer $post      Optional. Post ID or post object. Default is the global `$post`.
100 100
  * @param bool        $leavename Optional. Whether to keep post name or page name. Default false.
101 101
  *
102 102
  * @return string|false The permalink URL or false if post does not exist.
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
  *
111 111
  * @since 1.0.0
112 112
  *
113
- * @param int|WP_Post $post      Optional. Post ID or post object. Default is the global `$post`.
113
+ * @param integer $post      Optional. Post ID or post object. Default is the global `$post`.
114 114
  * @param bool        $leavename Optional. Whether to keep post name or page name. Default false.
115 115
  * @return string|false The permalink URL or false if post does not exist.
116 116
  */
@@ -1377,7 +1377,7 @@  discard block
 block discarded – undo
1377 1377
  *
1378 1378
  * @since 2.3.0
1379 1379
  *
1380
- * @param int|WP_Comment $comment_id Optional. Comment ID or WP_Comment object.
1380
+ * @param integer $comment_id Optional. Comment ID or WP_Comment object.
1381 1381
  * @return string|void The edit comment link URL for the given comment.
1382 1382
  */
1383 1383
 function get_edit_comment_link( $comment_id = 0 ) {
@@ -1437,7 +1437,7 @@  discard block
 block discarded – undo
1437 1437
  *
1438 1438
  * @since 2.7.0
1439 1439
  *
1440
- * @param int|stdClass $link Optional. Bookmark ID.
1440
+ * @param integer $link Optional. Bookmark ID.
1441 1441
  * @return string|void The edit bookmark link URL.
1442 1442
  */
1443 1443
 function get_edit_bookmark_link( $link = 0 ) {
@@ -1535,7 +1535,7 @@  discard block
 block discarded – undo
1535 1535
  * @since 1.5.0
1536 1536
  *
1537 1537
  * @param bool         $in_same_term   Optional. Whether post should be in a same taxonomy term.
1538
- * @param array|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
1538
+ * @param string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
1539 1539
  * @param string       $taxonomy       Optional. Taxonomy, if $in_same_term is true. Default 'category'.
1540 1540
  * @return null|string|WP_Post Post object if successful. Null if global $post is not set. Empty string if no corresponding post exists.
1541 1541
  */
@@ -1549,7 +1549,7 @@  discard block
 block discarded – undo
1549 1549
  * @since 1.5.0
1550 1550
  *
1551 1551
  * @param bool         $in_same_term   Optional. Whether post should be in a same taxonomy term.
1552
- * @param array|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
1552
+ * @param string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
1553 1553
  * @param string       $taxonomy       Optional. Taxonomy, if $in_same_term is true. Default 'category'.
1554 1554
  * @return null|string|WP_Post Post object if successful. Null if global $post is not set. Empty string if no corresponding post exists.
1555 1555
  */
@@ -1570,7 +1570,7 @@  discard block
 block discarded – undo
1570 1570
  * @param array|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
1571 1571
  * @param bool         $previous       Optional. Whether to retrieve previous post.
1572 1572
  * @param string       $taxonomy       Optional. Taxonomy, if $in_same_term is true. Default 'category'.
1573
- * @return null|string|WP_Post Post object if successful. Null if global $post is not set. Empty string if no corresponding post exists.
1573
+ * @return integer Post object if successful. Null if global $post is not set. Empty string if no corresponding post exists.
1574 1574
  */
1575 1575
 function get_adjacent_post( $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category' ) {
1576 1576
 	global $wpdb;
@@ -1852,7 +1852,7 @@  discard block
 block discarded – undo
1852 1852
  * @since 2.8.0
1853 1853
  *
1854 1854
  * @param bool         $in_same_term   Optional. Whether returned post should be in a same taxonomy term.
1855
- * @param array|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
1855
+ * @param string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
1856 1856
  * @param bool         $start          Optional. Whether to retrieve first or last post.
1857 1857
  * @param string       $taxonomy       Optional. Taxonomy, if $in_same_term is true. Default 'category'.
1858 1858
  * @return null|array Array containing the boundary post object if successful, null otherwise.
@@ -2732,7 +2732,7 @@  discard block
 block discarded – undo
2732 2732
  * @global WP_Rewrite $wp_rewrite
2733 2733
  *
2734 2734
  * @param string|array $args Optional args. See paginate_links().
2735
- * @return string|void Markup for pagination links.
2735
+ * @return string Markup for pagination links.
2736 2736
  */
2737 2737
 function paginate_comments_links($args = array()) {
2738 2738
 	global $wp_rewrite;
Please login to merge, or discard this patch.
Spacing   +785 added lines, -785 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
  *
15 15
  * @param int|WP_Post $post Optional. Post ID or post object. Default is the global `$post`.
16 16
  */
17
-function the_permalink( $post = 0 ) {
17
+function the_permalink($post = 0) {
18 18
 	/**
19 19
 	 * Filter the display of the permalink for the current post.
20 20
 	 *
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	 * @param string      $permalink The permalink for the current post.
25 25
 	 * @param int|WP_Post $post      Post ID, WP_Post object, or 0. Default 0.
26 26
 	 */
27
-	echo esc_url( apply_filters( 'the_permalink', get_permalink( $post ), $post ) );
27
+	echo esc_url(apply_filters('the_permalink', get_permalink($post), $post));
28 28
 }
29 29
 
30 30
 /**
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
  */
45 45
 function user_trailingslashit($string, $type_of_url = '') {
46 46
 	global $wp_rewrite;
47
-	if ( $wp_rewrite->use_trailing_slashes )
47
+	if ($wp_rewrite->use_trailing_slashes)
48 48
 		$string = trailingslashit($string);
49 49
 	else
50 50
 		$string = untrailingslashit($string);
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	 *                            'single_feed', 'single_paged', 'feed', 'category', 'page', 'year',
61 61
 	 *                            'month', 'day', 'paged', 'post_type_archive'.
62 62
 	 */
63
-	return apply_filters( 'user_trailingslashit', $string, $type_of_url );
63
+	return apply_filters('user_trailingslashit', $string, $type_of_url);
64 64
 }
65 65
 
66 66
 /**
@@ -73,16 +73,16 @@  discard block
 block discarded – undo
73 73
  *
74 74
  * @param string $mode Permalink mode can be either 'title', 'id', or default, which is 'id'.
75 75
  */
76
-function permalink_anchor( $mode = 'id' ) {
76
+function permalink_anchor($mode = 'id') {
77 77
 	$post = get_post();
78
-	switch ( strtolower( $mode ) ) {
78
+	switch (strtolower($mode)) {
79 79
 		case 'title':
80
-			$title = sanitize_title( $post->post_title ) . '-' . $post->ID;
80
+			$title = sanitize_title($post->post_title).'-'.$post->ID;
81 81
 			echo '<a id="'.$title.'"></a>';
82 82
 			break;
83 83
 		case 'id':
84 84
 		default:
85
-			echo '<a id="post-' . $post->ID . '"></a>';
85
+			echo '<a id="post-'.$post->ID.'"></a>';
86 86
 			break;
87 87
 	}
88 88
 }
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
  *
102 102
  * @return string|false The permalink URL or false if post does not exist.
103 103
  */
104
-function get_the_permalink( $post = 0, $leavename = false ) {
105
-	return get_permalink( $post, $leavename );
104
+function get_the_permalink($post = 0, $leavename = false) {
105
+	return get_permalink($post, $leavename);
106 106
 }
107 107
 
108 108
 /**
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
  * @param bool        $leavename Optional. Whether to keep post name or page name. Default false.
115 115
  * @return string|false The permalink URL or false if post does not exist.
116 116
  */
117
-function get_permalink( $post = 0, $leavename = false ) {
117
+function get_permalink($post = 0, $leavename = false) {
118 118
 	$rewritecode = array(
119 119
 		'%year%',
120 120
 		'%monthnum%',
@@ -122,28 +122,28 @@  discard block
 block discarded – undo
122 122
 		'%hour%',
123 123
 		'%minute%',
124 124
 		'%second%',
125
-		$leavename? '' : '%postname%',
125
+		$leavename ? '' : '%postname%',
126 126
 		'%post_id%',
127 127
 		'%category%',
128 128
 		'%author%',
129
-		$leavename? '' : '%pagename%',
129
+		$leavename ? '' : '%pagename%',
130 130
 	);
131 131
 
132
-	if ( is_object( $post ) && isset( $post->filter ) && 'sample' == $post->filter ) {
132
+	if (is_object($post) && isset($post->filter) && 'sample' == $post->filter) {
133 133
 		$sample = true;
134 134
 	} else {
135
-		$post = get_post( $post );
135
+		$post = get_post($post);
136 136
 		$sample = false;
137 137
 	}
138 138
 
139
-	if ( empty($post->ID) )
139
+	if (empty($post->ID))
140 140
 		return false;
141 141
 
142
-	if ( $post->post_type == 'page' )
142
+	if ($post->post_type == 'page')
143 143
 		return get_page_link($post, $leavename, $sample);
144
-	elseif ( $post->post_type == 'attachment' )
145
-		return get_attachment_link( $post, $leavename );
146
-	elseif ( in_array($post->post_type, get_post_types( array('_builtin' => false) ) ) )
144
+	elseif ($post->post_type == 'attachment')
145
+		return get_attachment_link($post, $leavename);
146
+	elseif (in_array($post->post_type, get_post_types(array('_builtin' => false))))
147 147
 		return get_post_permalink($post, $leavename, $sample);
148 148
 
149 149
 	$permalink = get_option('permalink_structure');
@@ -159,15 +159,15 @@  discard block
 block discarded – undo
159 159
 	 * @param WP_Post $post      The post in question.
160 160
 	 * @param bool    $leavename Whether to keep the post name.
161 161
 	 */
162
-	$permalink = apply_filters( 'pre_post_link', $permalink, $post, $leavename );
162
+	$permalink = apply_filters('pre_post_link', $permalink, $post, $leavename);
163 163
 
164
-	if ( '' != $permalink && !in_array( $post->post_status, array( 'draft', 'pending', 'auto-draft', 'future' ) ) ) {
164
+	if ('' != $permalink && ! in_array($post->post_status, array('draft', 'pending', 'auto-draft', 'future'))) {
165 165
 		$unixtime = strtotime($post->post_date);
166 166
 
167 167
 		$category = '';
168
-		if ( strpos($permalink, '%category%') !== false ) {
168
+		if (strpos($permalink, '%category%') !== false) {
169 169
 			$cats = get_the_category($post->ID);
170
-			if ( $cats ) {
170
+			if ($cats) {
171 171
 				usort($cats, '_usort_terms_by_ID'); // order by ID
172 172
 
173 173
 				/**
@@ -179,28 +179,28 @@  discard block
 block discarded – undo
179 179
 				 * @param array    $cats Array of all categories associated with the post.
180 180
 				 * @param WP_Post  $post The post in question.
181 181
 				 */
182
-				$category_object = apply_filters( 'post_link_category', $cats[0], $cats, $post );
182
+				$category_object = apply_filters('post_link_category', $cats[0], $cats, $post);
183 183
 
184
-				$category_object = get_term( $category_object, 'category' );
184
+				$category_object = get_term($category_object, 'category');
185 185
 				$category = $category_object->slug;
186
-				if ( $parent = $category_object->parent )
187
-					$category = get_category_parents($parent, false, '/', true) . $category;
186
+				if ($parent = $category_object->parent)
187
+					$category = get_category_parents($parent, false, '/', true).$category;
188 188
 			}
189 189
 			// show default category in permalinks, without
190 190
 			// having to assign it explicitly
191
-			if ( empty($category) ) {
192
-				$default_category = get_term( get_option( 'default_category' ), 'category' );
193
-				$category = is_wp_error( $default_category ) ? '' : $default_category->slug;
191
+			if (empty($category)) {
192
+				$default_category = get_term(get_option('default_category'), 'category');
193
+				$category = is_wp_error($default_category) ? '' : $default_category->slug;
194 194
 			}
195 195
 		}
196 196
 
197 197
 		$author = '';
198
-		if ( strpos($permalink, '%author%') !== false ) {
198
+		if (strpos($permalink, '%author%') !== false) {
199 199
 			$authordata = get_userdata($post->post_author);
200 200
 			$author = $authordata->user_nicename;
201 201
 		}
202 202
 
203
-		$date = explode(" ",date('Y m d H i s', $unixtime));
203
+		$date = explode(" ", date('Y m d H i s', $unixtime));
204 204
 		$rewritereplace =
205 205
 		array(
206 206
 			$date[0],
@@ -215,10 +215,10 @@  discard block
 block discarded – undo
215 215
 			$author,
216 216
 			$post->post_name,
217 217
 		);
218
-		$permalink = home_url( str_replace($rewritecode, $rewritereplace, $permalink) );
218
+		$permalink = home_url(str_replace($rewritecode, $rewritereplace, $permalink));
219 219
 		$permalink = user_trailingslashit($permalink, 'single');
220 220
 	} else { // if they're not using the fancy permalink option
221
-		$permalink = home_url('?p=' . $post->ID);
221
+		$permalink = home_url('?p='.$post->ID);
222 222
 	}
223 223
 
224 224
 	/**
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 	 * @param WP_Post $post      The post in question.
233 233
 	 * @param bool    $leavename Whether to keep the post name.
234 234
 	 */
235
-	return apply_filters( 'post_link', $permalink, $post, $leavename );
235
+	return apply_filters('post_link', $permalink, $post, $leavename);
236 236
 }
237 237
 
238 238
 /**
@@ -247,33 +247,33 @@  discard block
 block discarded – undo
247 247
  * @param bool $sample    Optional, defaults to false. Is it a sample permalink.
248 248
  * @return string|WP_Error The post permalink.
249 249
  */
250
-function get_post_permalink( $id = 0, $leavename = false, $sample = false ) {
250
+function get_post_permalink($id = 0, $leavename = false, $sample = false) {
251 251
 	global $wp_rewrite;
252 252
 
253 253
 	$post = get_post($id);
254 254
 
255
-	if ( is_wp_error( $post ) )
255
+	if (is_wp_error($post))
256 256
 		return $post;
257 257
 
258 258
 	$post_link = $wp_rewrite->get_extra_permastruct($post->post_type);
259 259
 
260 260
 	$slug = $post->post_name;
261 261
 
262
-	$draft_or_pending = get_post_status( $id ) && in_array( get_post_status( $id ), array( 'draft', 'pending', 'auto-draft', 'future' ) );
262
+	$draft_or_pending = get_post_status($id) && in_array(get_post_status($id), array('draft', 'pending', 'auto-draft', 'future'));
263 263
 
264 264
 	$post_type = get_post_type_object($post->post_type);
265 265
 
266
-	if ( $post_type->hierarchical ) {
267
-		$slug = get_page_uri( $id );
266
+	if ($post_type->hierarchical) {
267
+		$slug = get_page_uri($id);
268 268
 	}
269 269
 
270
-	if ( !empty($post_link) && ( !$draft_or_pending || $sample ) ) {
271
-		if ( ! $leavename ) {
270
+	if ( ! empty($post_link) && ( ! $draft_or_pending || $sample)) {
271
+		if ( ! $leavename) {
272 272
 			$post_link = str_replace("%$post->post_type%", $slug, $post_link);
273 273
 		}
274
-		$post_link = home_url( user_trailingslashit($post_link) );
274
+		$post_link = home_url(user_trailingslashit($post_link));
275 275
 	} else {
276
-		if ( $post_type->query_var && ( isset($post->post_status) && !$draft_or_pending ) )
276
+		if ($post_type->query_var && (isset($post->post_status) && ! $draft_or_pending))
277 277
 			$post_link = add_query_arg($post_type->query_var, $slug, '');
278 278
 		else
279 279
 			$post_link = add_query_arg(array('post_type' => $post->post_type, 'p' => $post->ID), '');
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 	 * @param bool    $leavename Whether to keep the post name.
291 291
 	 * @param bool    $sample    Is it a sample permalink.
292 292
 	 */
293
-	return apply_filters( 'post_type_link', $post_link, $post, $leavename, $sample );
293
+	return apply_filters('post_type_link', $post_link, $post, $leavename, $sample);
294 294
 }
295 295
 
296 296
 /**
@@ -305,13 +305,13 @@  discard block
 block discarded – undo
305 305
  * @param bool       $sample    Optional, defaults to false. Is it a sample permalink.
306 306
  * @return string The page permalink.
307 307
  */
308
-function get_page_link( $post = false, $leavename = false, $sample = false ) {
309
-	$post = get_post( $post );
308
+function get_page_link($post = false, $leavename = false, $sample = false) {
309
+	$post = get_post($post);
310 310
 
311
-	if ( 'page' == get_option( 'show_on_front' ) && $post->ID == get_option( 'page_on_front' ) )
311
+	if ('page' == get_option('show_on_front') && $post->ID == get_option('page_on_front'))
312 312
 		$link = home_url('/');
313 313
 	else
314
-		$link = _get_page_link( $post, $leavename, $sample );
314
+		$link = _get_page_link($post, $leavename, $sample);
315 315
 
316 316
 	/**
317 317
 	 * Filter the permalink for a page.
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 	 * @param int    $post_id The ID of the page.
323 323
 	 * @param bool   $sample  Is it a sample permalink.
324 324
 	 */
325
-	return apply_filters( 'page_link', $link, $post->ID, $sample );
325
+	return apply_filters('page_link', $link, $post->ID, $sample);
326 326
 }
327 327
 
328 328
 /**
@@ -340,24 +340,24 @@  discard block
 block discarded – undo
340 340
  * @param bool       $sample    Optional. Sample permalink.
341 341
  * @return string The page permalink.
342 342
  */
343
-function _get_page_link( $post = false, $leavename = false, $sample = false ) {
343
+function _get_page_link($post = false, $leavename = false, $sample = false) {
344 344
 	global $wp_rewrite;
345 345
 
346
-	$post = get_post( $post );
346
+	$post = get_post($post);
347 347
 
348
-	$draft_or_pending = in_array( $post->post_status, array( 'draft', 'pending', 'auto-draft' ) );
348
+	$draft_or_pending = in_array($post->post_status, array('draft', 'pending', 'auto-draft'));
349 349
 
350 350
 	$link = $wp_rewrite->get_page_permastruct();
351 351
 
352
-	if ( !empty($link) && ( ( isset($post->post_status) && !$draft_or_pending ) || $sample ) ) {
353
-		if ( ! $leavename ) {
354
-			$link = str_replace('%pagename%', get_page_uri( $post ), $link);
352
+	if ( ! empty($link) && ((isset($post->post_status) && ! $draft_or_pending) || $sample)) {
353
+		if ( ! $leavename) {
354
+			$link = str_replace('%pagename%', get_page_uri($post), $link);
355 355
 		}
356 356
 
357 357
 		$link = home_url($link);
358 358
 		$link = user_trailingslashit($link, 'page');
359 359
 	} else {
360
-		$link = home_url( '?page_id=' . $post->ID );
360
+		$link = home_url('?page_id='.$post->ID);
361 361
 	}
362 362
 
363 363
 	/**
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 	 * @param string $link    The page's permalink.
369 369
 	 * @param int    $post_id The ID of the page.
370 370
 	 */
371
-	return apply_filters( '_get_page_link', $link, $post->ID );
371
+	return apply_filters('_get_page_link', $link, $post->ID);
372 372
 }
373 373
 
374 374
 /**
@@ -384,39 +384,39 @@  discard block
 block discarded – undo
384 384
  * @param bool       $leavename Optional. Leave name.
385 385
  * @return string The attachment permalink.
386 386
  */
387
-function get_attachment_link( $post = null, $leavename = false ) {
387
+function get_attachment_link($post = null, $leavename = false) {
388 388
 	global $wp_rewrite;
389 389
 
390 390
 	$link = false;
391 391
 
392
-	$post = get_post( $post );
393
-	$parent = ( $post->post_parent > 0 && $post->post_parent != $post->ID ) ? get_post( $post->post_parent ) : false;
394
-	if ( $parent && ! in_array( $parent->post_type, get_post_types() ) ) {
392
+	$post = get_post($post);
393
+	$parent = ($post->post_parent > 0 && $post->post_parent != $post->ID) ? get_post($post->post_parent) : false;
394
+	if ($parent && ! in_array($parent->post_type, get_post_types())) {
395 395
 		$parent = false;
396 396
 	}
397 397
 
398
-	if ( $wp_rewrite->using_permalinks() && $parent ) {
399
-		if ( 'page' == $parent->post_type )
400
-			$parentlink = _get_page_link( $post->post_parent ); // Ignores page_on_front
398
+	if ($wp_rewrite->using_permalinks() && $parent) {
399
+		if ('page' == $parent->post_type)
400
+			$parentlink = _get_page_link($post->post_parent); // Ignores page_on_front
401 401
 		else
402
-			$parentlink = get_permalink( $post->post_parent );
402
+			$parentlink = get_permalink($post->post_parent);
403 403
 
404
-		if ( is_numeric($post->post_name) || false !== strpos(get_option('permalink_structure'), '%category%') )
405
-			$name = 'attachment/' . $post->post_name; // <permalink>/<int>/ is paged so we use the explicit attachment marker
404
+		if (is_numeric($post->post_name) || false !== strpos(get_option('permalink_structure'), '%category%'))
405
+			$name = 'attachment/'.$post->post_name; // <permalink>/<int>/ is paged so we use the explicit attachment marker
406 406
 		else
407 407
 			$name = $post->post_name;
408 408
 
409
-		if ( strpos($parentlink, '?') === false )
410
-			$link = user_trailingslashit( trailingslashit($parentlink) . '%postname%' );
409
+		if (strpos($parentlink, '?') === false)
410
+			$link = user_trailingslashit(trailingslashit($parentlink).'%postname%');
411 411
 
412
-		if ( ! $leavename )
413
-			$link = str_replace( '%postname%', $name, $link );
414
-	} elseif ( $wp_rewrite->using_permalinks() && ! $leavename ) {
415
-		$link = home_url( user_trailingslashit( $post->post_name ) );
412
+		if ( ! $leavename)
413
+			$link = str_replace('%postname%', $name, $link);
414
+	} elseif ($wp_rewrite->using_permalinks() && ! $leavename) {
415
+		$link = home_url(user_trailingslashit($post->post_name));
416 416
 	}
417 417
 
418
-	if ( ! $link )
419
-		$link = home_url( '/?attachment_id=' . $post->ID );
418
+	if ( ! $link)
419
+		$link = home_url('/?attachment_id='.$post->ID);
420 420
 
421 421
 	/**
422 422
 	 * Filter the permalink for an attachment.
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
 	 * @param string $link    The attachment's permalink.
427 427
 	 * @param int    $post_id Attachment ID.
428 428
 	 */
429
-	return apply_filters( 'attachment_link', $link, $post->ID );
429
+	return apply_filters('attachment_link', $link, $post->ID);
430 430
 }
431 431
 
432 432
 /**
@@ -441,14 +441,14 @@  discard block
 block discarded – undo
441 441
  */
442 442
 function get_year_link($year) {
443 443
 	global $wp_rewrite;
444
-	if ( !$year )
444
+	if ( ! $year)
445 445
 		$year = gmdate('Y', current_time('timestamp'));
446 446
 	$yearlink = $wp_rewrite->get_year_permastruct();
447
-	if ( !empty($yearlink) ) {
447
+	if ( ! empty($yearlink)) {
448 448
 		$yearlink = str_replace('%year%', $year, $yearlink);
449
-		$yearlink = home_url( user_trailingslashit( $yearlink, 'year' ) );
449
+		$yearlink = home_url(user_trailingslashit($yearlink, 'year'));
450 450
 	} else {
451
-		$yearlink = home_url( '?m=' . $year );
451
+		$yearlink = home_url('?m='.$year);
452 452
 	}
453 453
 
454 454
 	/**
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
 	 * @param string $yearlink Permalink for the year archive.
460 460
 	 * @param int    $year     Year for the archive.
461 461
 	 */
462
-	return apply_filters( 'year_link', $yearlink, $year );
462
+	return apply_filters('year_link', $yearlink, $year);
463 463
 }
464 464
 
465 465
 /**
@@ -475,17 +475,17 @@  discard block
 block discarded – undo
475 475
  */
476 476
 function get_month_link($year, $month) {
477 477
 	global $wp_rewrite;
478
-	if ( !$year )
478
+	if ( ! $year)
479 479
 		$year = gmdate('Y', current_time('timestamp'));
480
-	if ( !$month )
480
+	if ( ! $month)
481 481
 		$month = gmdate('m', current_time('timestamp'));
482 482
 	$monthlink = $wp_rewrite->get_month_permastruct();
483
-	if ( !empty($monthlink) ) {
483
+	if ( ! empty($monthlink)) {
484 484
 		$monthlink = str_replace('%year%', $year, $monthlink);
485 485
 		$monthlink = str_replace('%monthnum%', zeroise(intval($month), 2), $monthlink);
486
-		$monthlink = home_url( user_trailingslashit( $monthlink, 'month' ) );
486
+		$monthlink = home_url(user_trailingslashit($monthlink, 'month'));
487 487
 	} else {
488
-		$monthlink = home_url( '?m=' . $year . zeroise( $month, 2 ) );
488
+		$monthlink = home_url('?m='.$year.zeroise($month, 2));
489 489
 	}
490 490
 
491 491
 	/**
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
 	 * @param int    $year      Year for the archive.
498 498
 	 * @param int    $month     The month for the archive.
499 499
 	 */
500
-	return apply_filters( 'month_link', $monthlink, $year, $month );
500
+	return apply_filters('month_link', $monthlink, $year, $month);
501 501
 }
502 502
 
503 503
 /**
@@ -514,21 +514,21 @@  discard block
 block discarded – undo
514 514
  */
515 515
 function get_day_link($year, $month, $day) {
516 516
 	global $wp_rewrite;
517
-	if ( !$year )
517
+	if ( ! $year)
518 518
 		$year = gmdate('Y', current_time('timestamp'));
519
-	if ( !$month )
519
+	if ( ! $month)
520 520
 		$month = gmdate('m', current_time('timestamp'));
521
-	if ( !$day )
521
+	if ( ! $day)
522 522
 		$day = gmdate('j', current_time('timestamp'));
523 523
 
524 524
 	$daylink = $wp_rewrite->get_day_permastruct();
525
-	if ( !empty($daylink) ) {
525
+	if ( ! empty($daylink)) {
526 526
 		$daylink = str_replace('%year%', $year, $daylink);
527 527
 		$daylink = str_replace('%monthnum%', zeroise(intval($month), 2), $daylink);
528 528
 		$daylink = str_replace('%day%', zeroise(intval($day), 2), $daylink);
529
-		$daylink = home_url( user_trailingslashit( $daylink, 'day' ) );
529
+		$daylink = home_url(user_trailingslashit($daylink, 'day'));
530 530
 	} else {
531
-		$daylink = home_url( '?m=' . $year . zeroise( $month, 2 ) . zeroise( $day, 2 ) );
531
+		$daylink = home_url('?m='.$year.zeroise($month, 2).zeroise($day, 2));
532 532
 	}
533 533
 
534 534
 	/**
@@ -541,7 +541,7 @@  discard block
 block discarded – undo
541 541
 	 * @param int    $month   Month for the archive.
542 542
 	 * @param int    $day     The day for the archive.
543 543
 	 */
544
-	return apply_filters( 'day_link', $daylink, $year, $month, $day );
544
+	return apply_filters('day_link', $daylink, $year, $month, $day);
545 545
 }
546 546
 
547 547
 /**
@@ -552,8 +552,8 @@  discard block
 block discarded – undo
552 552
  * @param string $anchor The link's anchor text.
553 553
  * @param string $feed   Optional, defaults to default feed. Feed type.
554 554
  */
555
-function the_feed_link( $anchor, $feed = '' ) {
556
-	$link = '<a href="' . esc_url( get_feed_link( $feed ) ) . '">' . $anchor . '</a>';
555
+function the_feed_link($anchor, $feed = '') {
556
+	$link = '<a href="'.esc_url(get_feed_link($feed)).'">'.$anchor.'</a>';
557 557
 
558 558
 	/**
559 559
 	 * Filter the feed link anchor tag.
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
 	 * @param string $feed The feed type, or an empty string for the
565 565
 	 *                     default feed type.
566 566
 	 */
567
-	echo apply_filters( 'the_feed_link', $link, $feed );
567
+	echo apply_filters('the_feed_link', $link, $feed);
568 568
 }
569 569
 
570 570
 /**
@@ -581,23 +581,23 @@  discard block
 block discarded – undo
581 581
 	global $wp_rewrite;
582 582
 
583 583
 	$permalink = $wp_rewrite->get_feed_permastruct();
584
-	if ( '' != $permalink ) {
585
-		if ( false !== strpos($feed, 'comments_') ) {
584
+	if ('' != $permalink) {
585
+		if (false !== strpos($feed, 'comments_')) {
586 586
 			$feed = str_replace('comments_', '', $feed);
587 587
 			$permalink = $wp_rewrite->get_comment_feed_permastruct();
588 588
 		}
589 589
 
590
-		if ( get_default_feed() == $feed )
590
+		if (get_default_feed() == $feed)
591 591
 			$feed = '';
592 592
 
593 593
 		$permalink = str_replace('%feed%', $feed, $permalink);
594 594
 		$permalink = preg_replace('#/+#', '/', "/$permalink");
595
-		$output =  home_url( user_trailingslashit($permalink, 'feed') );
595
+		$output = home_url(user_trailingslashit($permalink, 'feed'));
596 596
 	} else {
597
-		if ( empty($feed) )
597
+		if (empty($feed))
598 598
 			$feed = get_default_feed();
599 599
 
600
-		if ( false !== strpos($feed, 'comments_') )
600
+		if (false !== strpos($feed, 'comments_'))
601 601
 			$feed = str_replace('comments_', 'comments-', $feed);
602 602
 
603 603
 		$output = home_url("?feed={$feed}");
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
 	 * @param string $output The feed permalink.
612 612
 	 * @param string $feed   Feed type.
613 613
 	 */
614
-	return apply_filters( 'feed_link', $output, $feed );
614
+	return apply_filters('feed_link', $output, $feed);
615 615
 }
616 616
 
617 617
 /**
@@ -624,42 +624,42 @@  discard block
 block discarded – undo
624 624
  * @return string The permalink for the comments feed for the given post.
625 625
  */
626 626
 function get_post_comments_feed_link($post_id = 0, $feed = '') {
627
-	$post_id = absint( $post_id );
627
+	$post_id = absint($post_id);
628 628
 
629
-	if ( ! $post_id )
629
+	if ( ! $post_id)
630 630
 		$post_id = get_the_ID();
631 631
 
632
-	if ( empty( $feed ) )
632
+	if (empty($feed))
633 633
 		$feed = get_default_feed();
634 634
 
635
-	$post = get_post( $post_id );
635
+	$post = get_post($post_id);
636 636
 	$unattached = 'attachment' === $post->post_type && 0 === (int) $post->post_parent;
637 637
 
638
-	if ( '' != get_option('permalink_structure') ) {
639
-		if ( 'page' == get_option('show_on_front') && $post_id == get_option('page_on_front') )
640
-			$url = _get_page_link( $post_id );
638
+	if ('' != get_option('permalink_structure')) {
639
+		if ('page' == get_option('show_on_front') && $post_id == get_option('page_on_front'))
640
+			$url = _get_page_link($post_id);
641 641
 		else
642 642
 			$url = get_permalink($post_id);
643 643
 
644
-		if ( $unattached ) {
645
-			$url =  home_url( '/feed/' );
646
-			if ( $feed !== get_default_feed() ) {
644
+		if ($unattached) {
645
+			$url = home_url('/feed/');
646
+			if ($feed !== get_default_feed()) {
647 647
 				$url .= "$feed/";
648 648
 			}
649
-			$url = add_query_arg( 'attachment_id', $post_id, $url );
649
+			$url = add_query_arg('attachment_id', $post_id, $url);
650 650
 		} else {
651
-			$url = trailingslashit($url) . 'feed';
652
-			if ( $feed != get_default_feed() )
651
+			$url = trailingslashit($url).'feed';
652
+			if ($feed != get_default_feed())
653 653
 				$url .= "/$feed";
654 654
 			$url = user_trailingslashit($url, 'single_feed');
655 655
 		}
656 656
 	} else {
657
-		if ( $unattached ) {
658
-			$url = add_query_arg( array( 'feed' => $feed, 'attachment_id' => $post_id ), home_url( '/' ) );
659
-		} elseif ( 'page' == $post->post_type ) {
660
-			$url = add_query_arg( array( 'feed' => $feed, 'page_id' => $post_id ), home_url( '/' ) );
657
+		if ($unattached) {
658
+			$url = add_query_arg(array('feed' => $feed, 'attachment_id' => $post_id), home_url('/'));
659
+		} elseif ('page' == $post->post_type) {
660
+			$url = add_query_arg(array('feed' => $feed, 'page_id' => $post_id), home_url('/'));
661 661
 		} else {
662
-			$url = add_query_arg( array( 'feed' => $feed, 'p' => $post_id ), home_url( '/' ) );
662
+			$url = add_query_arg(array('feed' => $feed, 'p' => $post_id), home_url('/'));
663 663
 		}
664 664
 	}
665 665
 
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
 	 *
671 671
 	 * @param string $url Post comments feed permalink.
672 672
 	 */
673
-	return apply_filters( 'post_comments_feed_link', $url );
673
+	return apply_filters('post_comments_feed_link', $url);
674 674
 }
675 675
 
676 676
 /**
@@ -686,13 +686,13 @@  discard block
 block discarded – undo
686 686
  * @param int    $post_id   Optional post ID. Default to current post.
687 687
  * @param string $feed      Optional. Feed format.
688 688
  */
689
-function post_comments_feed_link( $link_text = '', $post_id = '', $feed = '' ) {
690
-	$url = get_post_comments_feed_link( $post_id, $feed );
691
-	if ( empty( $link_text ) ) {
689
+function post_comments_feed_link($link_text = '', $post_id = '', $feed = '') {
690
+	$url = get_post_comments_feed_link($post_id, $feed);
691
+	if (empty($link_text)) {
692 692
 		$link_text = __('Comments Feed');
693 693
 	}
694 694
 
695
-	$link = '<a href="' . esc_url( $url ) . '">' . $link_text . '</a>';
695
+	$link = '<a href="'.esc_url($url).'">'.$link_text.'</a>';
696 696
 	/**
697 697
 	 * Filter the post comment feed link anchor tag.
698 698
 	 *
@@ -702,7 +702,7 @@  discard block
 block discarded – undo
702 702
 	 * @param int    $post_id Post ID.
703 703
 	 * @param string $feed    The feed type, or an empty string for the default feed type.
704 704
 	 */
705
-	echo apply_filters( 'post_comments_feed_link_html', $link, $post_id, $feed );
705
+	echo apply_filters('post_comments_feed_link_html', $link, $post_id, $feed);
706 706
 }
707 707
 
708 708
 /**
@@ -717,23 +717,23 @@  discard block
 block discarded – undo
717 717
  * @param string $feed      Optional. Feed type.
718 718
  * @return string Link to the feed for the author specified by $author_id.
719 719
  */
720
-function get_author_feed_link( $author_id, $feed = '' ) {
720
+function get_author_feed_link($author_id, $feed = '') {
721 721
 	$author_id = (int) $author_id;
722 722
 	$permalink_structure = get_option('permalink_structure');
723 723
 
724
-	if ( empty($feed) )
724
+	if (empty($feed))
725 725
 		$feed = get_default_feed();
726 726
 
727
-	if ( '' == $permalink_structure ) {
728
-		$link = home_url("?feed=$feed&amp;author=" . $author_id);
727
+	if ('' == $permalink_structure) {
728
+		$link = home_url("?feed=$feed&amp;author=".$author_id);
729 729
 	} else {
730 730
 		$link = get_author_posts_url($author_id);
731
-		if ( $feed == get_default_feed() )
731
+		if ($feed == get_default_feed())
732 732
 			$feed_link = 'feed';
733 733
 		else
734 734
 			$feed_link = "feed/$feed";
735 735
 
736
-		$link = trailingslashit($link) . user_trailingslashit($feed_link, 'feed');
736
+		$link = trailingslashit($link).user_trailingslashit($feed_link, 'feed');
737 737
 	}
738 738
 
739 739
 	/**
@@ -744,7 +744,7 @@  discard block
 block discarded – undo
744 744
 	 * @param string $link The author feed link.
745 745
 	 * @param string $feed Feed type.
746 746
 	 */
747
-	$link = apply_filters( 'author_feed_link', $link, $feed );
747
+	$link = apply_filters('author_feed_link', $link, $feed);
748 748
 
749 749
 	return $link;
750 750
 }
@@ -761,8 +761,8 @@  discard block
 block discarded – undo
761 761
  * @param string $feed   Optional. Feed type.
762 762
  * @return string Link to the feed for the category specified by $cat_id.
763 763
  */
764
-function get_category_feed_link( $cat_id, $feed = '' ) {
765
-	return get_term_feed_link( $cat_id, 'category', $feed );
764
+function get_category_feed_link($cat_id, $feed = '') {
765
+	return get_term_feed_link($cat_id, 'category', $feed);
766 766
 }
767 767
 
768 768
 /**
@@ -778,40 +778,40 @@  discard block
 block discarded – undo
778 778
  * @param string $feed     Optional. Feed type.
779 779
  * @return string|false Link to the feed for the term specified by $term_id and $taxonomy.
780 780
  */
781
-function get_term_feed_link( $term_id, $taxonomy = 'category', $feed = '' ) {
782
-	$term_id = ( int ) $term_id;
781
+function get_term_feed_link($term_id, $taxonomy = 'category', $feed = '') {
782
+	$term_id = (int) $term_id;
783 783
 
784
-	$term = get_term( $term_id, $taxonomy  );
784
+	$term = get_term($term_id, $taxonomy);
785 785
 
786
-	if ( empty( $term ) || is_wp_error( $term ) )
786
+	if (empty($term) || is_wp_error($term))
787 787
 		return false;
788 788
 
789
-	if ( empty( $feed ) )
789
+	if (empty($feed))
790 790
 		$feed = get_default_feed();
791 791
 
792
-	$permalink_structure = get_option( 'permalink_structure' );
792
+	$permalink_structure = get_option('permalink_structure');
793 793
 
794
-	if ( '' == $permalink_structure ) {
795
-		if ( 'category' == $taxonomy ) {
794
+	if ('' == $permalink_structure) {
795
+		if ('category' == $taxonomy) {
796 796
 			$link = home_url("?feed=$feed&amp;cat=$term_id");
797 797
 		}
798
-		elseif ( 'post_tag' == $taxonomy ) {
798
+		elseif ('post_tag' == $taxonomy) {
799 799
 			$link = home_url("?feed=$feed&amp;tag=$term->slug");
800 800
 		} else {
801
-			$t = get_taxonomy( $taxonomy );
801
+			$t = get_taxonomy($taxonomy);
802 802
 			$link = home_url("?feed=$feed&amp;$t->query_var=$term->slug");
803 803
 		}
804 804
 	} else {
805
-		$link = get_term_link( $term_id, $term->taxonomy );
806
-		if ( $feed == get_default_feed() )
805
+		$link = get_term_link($term_id, $term->taxonomy);
806
+		if ($feed == get_default_feed())
807 807
 			$feed_link = 'feed';
808 808
 		else
809 809
 			$feed_link = "feed/$feed";
810 810
 
811
-		$link = trailingslashit( $link ) . user_trailingslashit( $feed_link, 'feed' );
811
+		$link = trailingslashit($link).user_trailingslashit($feed_link, 'feed');
812 812
 	}
813 813
 
814
-	if ( 'category' == $taxonomy ) {
814
+	if ('category' == $taxonomy) {
815 815
 		/**
816 816
 		 * Filter the category feed link.
817 817
 		 *
@@ -820,8 +820,8 @@  discard block
 block discarded – undo
820 820
 		 * @param string $link The category feed link.
821 821
 		 * @param string $feed Feed type.
822 822
 		 */
823
-		$link = apply_filters( 'category_feed_link', $link, $feed );
824
-	} elseif ( 'post_tag' == $taxonomy ) {
823
+		$link = apply_filters('category_feed_link', $link, $feed);
824
+	} elseif ('post_tag' == $taxonomy) {
825 825
 		/**
826 826
 		 * Filter the post tag feed link.
827 827
 		 *
@@ -830,7 +830,7 @@  discard block
 block discarded – undo
830 830
 		 * @param string $link The tag feed link.
831 831
 		 * @param string $feed Feed type.
832 832
 		 */
833
-		$link = apply_filters( 'tag_feed_link', $link, $feed );
833
+		$link = apply_filters('tag_feed_link', $link, $feed);
834 834
 	} else {
835 835
 		/**
836 836
 		 * Filter the feed link for a taxonomy other than 'category' or 'post_tag'.
@@ -841,7 +841,7 @@  discard block
 block discarded – undo
841 841
 		 * @param string $feed Feed type.
842 842
 		 * @param string $feed The taxonomy name.
843 843
 		 */
844
-		$link = apply_filters( 'taxonomy_feed_link', $link, $feed, $taxonomy );
844
+		$link = apply_filters('taxonomy_feed_link', $link, $feed, $taxonomy);
845 845
 	}
846 846
 
847 847
 	return $link;
@@ -856,8 +856,8 @@  discard block
 block discarded – undo
856 856
  * @param string $feed   Optional. Feed type.
857 857
  * @return string The feed permalink for the given tag.
858 858
  */
859
-function get_tag_feed_link( $tag_id, $feed = '' ) {
860
-	return get_term_feed_link( $tag_id, 'post_tag', $feed );
859
+function get_tag_feed_link($tag_id, $feed = '') {
860
+	return get_term_feed_link($tag_id, 'post_tag', $feed);
861 861
 }
862 862
 
863 863
 /**
@@ -869,7 +869,7 @@  discard block
 block discarded – undo
869 869
  * @param string $taxonomy Taxonomy
870 870
  * @return string The edit tag link URL for the given tag.
871 871
  */
872
-function get_edit_tag_link( $tag_id, $taxonomy = 'post_tag' ) {
872
+function get_edit_tag_link($tag_id, $taxonomy = 'post_tag') {
873 873
 	/**
874 874
 	 * Filter the edit link for a tag (or term in another taxonomy).
875 875
 	 *
@@ -877,7 +877,7 @@  discard block
 block discarded – undo
877 877
 	 *
878 878
 	 * @param string $link The term edit link.
879 879
 	 */
880
-	return apply_filters( 'get_edit_tag_link', get_edit_term_link( $tag_id, $taxonomy ) );
880
+	return apply_filters('get_edit_tag_link', get_edit_term_link($tag_id, $taxonomy));
881 881
 }
882 882
 
883 883
 /**
@@ -890,8 +890,8 @@  discard block
 block discarded – undo
890 890
  * @param string $after  Optional. Display after edit link.
891 891
  * @param object $tag    Tag object.
892 892
  */
893
-function edit_tag_link( $link = '', $before = '', $after = '', $tag = null ) {
894
-	$link = edit_term_link( $link, '', '', $tag, false );
893
+function edit_tag_link($link = '', $before = '', $after = '', $tag = null) {
894
+	$link = edit_term_link($link, '', '', $tag, false);
895 895
 
896 896
 	/**
897 897
 	 * Filter the anchor tag for the edit link for a tag (or term in another taxonomy).
@@ -900,7 +900,7 @@  discard block
 block discarded – undo
900 900
 	 *
901 901
 	 * @param string $link The anchor tag for the edit link.
902 902
 	 */
903
-	echo $before . apply_filters( 'edit_tag_link', $link ) . $after;
903
+	echo $before.apply_filters('edit_tag_link', $link).$after;
904 904
 }
905 905
 
906 906
 /**
@@ -915,14 +915,14 @@  discard block
 block discarded – undo
915 915
  *                            Defaults to the first object_type associated with the taxonomy.
916 916
  * @return string|null The edit term link URL for the given term, or null on failure.
917 917
  */
918
-function get_edit_term_link( $term_id, $taxonomy = '', $object_type = '' ) {
919
-	$term = get_term( $term_id, $taxonomy );
920
-	if ( ! $term || is_wp_error( $term ) ) {
918
+function get_edit_term_link($term_id, $taxonomy = '', $object_type = '') {
919
+	$term = get_term($term_id, $taxonomy);
920
+	if ( ! $term || is_wp_error($term)) {
921 921
 		return;
922 922
 	}
923 923
 
924
-	$tax = get_taxonomy( $term->taxonomy );
925
-	if ( ! $tax || ! current_user_can( $tax->cap->edit_terms ) ) {
924
+	$tax = get_taxonomy($term->taxonomy);
925
+	if ( ! $tax || ! current_user_can($tax->cap->edit_terms)) {
926 926
 		return;
927 927
 	}
928 928
 
@@ -931,14 +931,14 @@  discard block
 block discarded – undo
931 931
 		'tag_ID'   => $term->term_id,
932 932
 	);
933 933
 
934
-	if ( $object_type ) {
934
+	if ($object_type) {
935 935
 		$args['post_type'] = $object_type;
936
-	} elseif ( ! empty( $tax->object_type ) ) {
937
-		$args['post_type'] = reset( $tax->object_type );
936
+	} elseif ( ! empty($tax->object_type)) {
937
+		$args['post_type'] = reset($tax->object_type);
938 938
 	}
939 939
 
940
-	if ( $tax->show_ui ) {
941
-		$location = add_query_arg( $args, admin_url( 'term.php' ) );
940
+	if ($tax->show_ui) {
941
+		$location = add_query_arg($args, admin_url('term.php'));
942 942
 	} else {
943 943
 		$location = '';
944 944
 	}
@@ -953,7 +953,7 @@  discard block
 block discarded – undo
953 953
 	 * @param string $taxonomy    Taxonomy name.
954 954
 	 * @param string $object_type The object type (eg. the post type).
955 955
 	 */
956
-	return apply_filters( 'get_edit_term_link', $location, $term_id, $taxonomy, $object_type );
956
+	return apply_filters('get_edit_term_link', $location, $term_id, $taxonomy, $object_type);
957 957
 }
958 958
 
959 959
 /**
@@ -968,21 +968,21 @@  discard block
 block discarded – undo
968 968
  * @param bool   $echo   Optional. Whether or not to echo the return. Default true.
969 969
  * @return string|void HTML content.
970 970
  */
971
-function edit_term_link( $link = '', $before = '', $after = '', $term = null, $echo = true ) {
972
-	if ( is_null( $term ) )
971
+function edit_term_link($link = '', $before = '', $after = '', $term = null, $echo = true) {
972
+	if (is_null($term))
973 973
 		$term = get_queried_object();
974 974
 
975
-	if ( ! $term )
975
+	if ( ! $term)
976 976
 		return;
977 977
 
978
-	$tax = get_taxonomy( $term->taxonomy );
979
-	if ( ! current_user_can( $tax->cap->edit_terms ) )
978
+	$tax = get_taxonomy($term->taxonomy);
979
+	if ( ! current_user_can($tax->cap->edit_terms))
980 980
 		return;
981 981
 
982
-	if ( empty( $link ) )
982
+	if (empty($link))
983 983
 		$link = __('Edit This');
984 984
 
985
-	$link = '<a href="' . get_edit_term_link( $term->term_id, $term->taxonomy ) . '">' . $link . '</a>';
985
+	$link = '<a href="'.get_edit_term_link($term->term_id, $term->taxonomy).'">'.$link.'</a>';
986 986
 
987 987
 	/**
988 988
 	 * Filter the anchor tag for the edit link of a term.
@@ -992,9 +992,9 @@  discard block
 block discarded – undo
992 992
 	 * @param string $link    The anchor tag for the edit link.
993 993
 	 * @param int    $term_id Term ID.
994 994
 	 */
995
-	$link = $before . apply_filters( 'edit_term_link', $link, $term->term_id ) . $after;
995
+	$link = $before.apply_filters('edit_term_link', $link, $term->term_id).$after;
996 996
 
997
-	if ( $echo )
997
+	if ($echo)
998 998
 		echo $link;
999 999
 	else
1000 1000
 		return $link;
@@ -1010,23 +1010,23 @@  discard block
 block discarded – undo
1010 1010
  * @param string $query Optional. The query string to use. If empty the current query is used.
1011 1011
  * @return string The search permalink.
1012 1012
  */
1013
-function get_search_link( $query = '' ) {
1013
+function get_search_link($query = '') {
1014 1014
 	global $wp_rewrite;
1015 1015
 
1016
-	if ( empty($query) )
1017
-		$search = get_search_query( false );
1016
+	if (empty($query))
1017
+		$search = get_search_query(false);
1018 1018
 	else
1019 1019
 		$search = stripslashes($query);
1020 1020
 
1021 1021
 	$permastruct = $wp_rewrite->get_search_permastruct();
1022 1022
 
1023
-	if ( empty( $permastruct ) ) {
1024
-		$link = home_url('?s=' . urlencode($search) );
1023
+	if (empty($permastruct)) {
1024
+		$link = home_url('?s='.urlencode($search));
1025 1025
 	} else {
1026 1026
 		$search = urlencode($search);
1027 1027
 		$search = str_replace('%2F', '/', $search); // %2F(/) is not valid within a URL, send it un-encoded.
1028
-		$link = str_replace( '%search%', $search, $permastruct );
1029
-		$link = home_url( user_trailingslashit( $link, 'search' ) );
1028
+		$link = str_replace('%search%', $search, $permastruct);
1029
+		$link = home_url(user_trailingslashit($link, 'search'));
1030 1030
 	}
1031 1031
 
1032 1032
 	/**
@@ -1037,7 +1037,7 @@  discard block
 block discarded – undo
1037 1037
 	 * @param string $link   Search permalink.
1038 1038
 	 * @param string $search The URL-encoded search term.
1039 1039
 	 */
1040
-	return apply_filters( 'search_link', $link, $search );
1040
+	return apply_filters('search_link', $link, $search);
1041 1041
 }
1042 1042
 
1043 1043
 /**
@@ -1055,12 +1055,12 @@  discard block
 block discarded – undo
1055 1055
 	global $wp_rewrite;
1056 1056
 	$link = get_search_link($search_query);
1057 1057
 
1058
-	if ( empty($feed) )
1058
+	if (empty($feed))
1059 1059
 		$feed = get_default_feed();
1060 1060
 
1061 1061
 	$permastruct = $wp_rewrite->get_search_permastruct();
1062 1062
 
1063
-	if ( empty($permastruct) ) {
1063
+	if (empty($permastruct)) {
1064 1064
 		$link = add_query_arg('feed', $feed, $link);
1065 1065
 	} else {
1066 1066
 		$link = trailingslashit($link);
@@ -1076,7 +1076,7 @@  discard block
 block discarded – undo
1076 1076
 	 * @param string $feed Feed type.
1077 1077
 	 * @param string $type The search type. One of 'posts' or 'comments'.
1078 1078
 	 */
1079
-	return apply_filters( 'search_feed_link', $link, $feed, 'posts' );
1079
+	return apply_filters('search_feed_link', $link, $feed, 'posts');
1080 1080
 }
1081 1081
 
1082 1082
 /**
@@ -1093,20 +1093,20 @@  discard block
 block discarded – undo
1093 1093
 function get_search_comments_feed_link($search_query = '', $feed = '') {
1094 1094
 	global $wp_rewrite;
1095 1095
 
1096
-	if ( empty($feed) )
1096
+	if (empty($feed))
1097 1097
 		$feed = get_default_feed();
1098 1098
 
1099 1099
 	$link = get_search_feed_link($search_query, $feed);
1100 1100
 
1101 1101
 	$permastruct = $wp_rewrite->get_search_permastruct();
1102 1102
 
1103
-	if ( empty($permastruct) )
1104
-		$link = add_query_arg('feed', 'comments-' . $feed, $link);
1103
+	if (empty($permastruct))
1104
+		$link = add_query_arg('feed', 'comments-'.$feed, $link);
1105 1105
 	else
1106 1106
 		$link = add_query_arg('withcomments', 1, $link);
1107 1107
 
1108 1108
 	/** This filter is documented in wp-includes/link-template.php */
1109
-	return apply_filters( 'search_feed_link', $link, $feed, 'comments' );
1109
+	return apply_filters('search_feed_link', $link, $feed, 'comments');
1110 1110
 }
1111 1111
 
1112 1112
 /**
@@ -1120,36 +1120,36 @@  discard block
 block discarded – undo
1120 1120
  * @param string $post_type Post type.
1121 1121
  * @return string|false The post type archive permalink.
1122 1122
  */
1123
-function get_post_type_archive_link( $post_type ) {
1123
+function get_post_type_archive_link($post_type) {
1124 1124
 	global $wp_rewrite;
1125
-	if ( ! $post_type_obj = get_post_type_object( $post_type ) )
1125
+	if ( ! $post_type_obj = get_post_type_object($post_type))
1126 1126
 		return false;
1127 1127
 
1128
-	if ( 'post' === $post_type ) {
1129
-		$show_on_front = get_option( 'show_on_front' );
1130
-		$page_for_posts  = get_option( 'page_for_posts' );
1128
+	if ('post' === $post_type) {
1129
+		$show_on_front = get_option('show_on_front');
1130
+		$page_for_posts = get_option('page_for_posts');
1131 1131
 
1132
-		if ( 'page' == $show_on_front && $page_for_posts ) {
1133
-			$link = get_permalink( $page_for_posts );
1132
+		if ('page' == $show_on_front && $page_for_posts) {
1133
+			$link = get_permalink($page_for_posts);
1134 1134
 		} else {
1135 1135
 			$link = get_home_url();
1136 1136
 		}
1137 1137
 		/** This filter is documented in wp-includes/link-template.php */
1138
-		return apply_filters( 'post_type_archive_link', $link, $post_type );
1138
+		return apply_filters('post_type_archive_link', $link, $post_type);
1139 1139
 	}
1140 1140
 
1141
-	if ( ! $post_type_obj->has_archive )
1141
+	if ( ! $post_type_obj->has_archive)
1142 1142
 		return false;
1143 1143
 
1144
-	if ( get_option( 'permalink_structure' ) && is_array( $post_type_obj->rewrite ) ) {
1145
-		$struct = ( true === $post_type_obj->has_archive ) ? $post_type_obj->rewrite['slug'] : $post_type_obj->has_archive;
1146
-		if ( $post_type_obj->rewrite['with_front'] )
1147
-			$struct = $wp_rewrite->front . $struct;
1144
+	if (get_option('permalink_structure') && is_array($post_type_obj->rewrite)) {
1145
+		$struct = (true === $post_type_obj->has_archive) ? $post_type_obj->rewrite['slug'] : $post_type_obj->has_archive;
1146
+		if ($post_type_obj->rewrite['with_front'])
1147
+			$struct = $wp_rewrite->front.$struct;
1148 1148
 		else
1149
-			$struct = $wp_rewrite->root . $struct;
1150
-		$link = home_url( user_trailingslashit( $struct, 'post_type_archive' ) );
1149
+			$struct = $wp_rewrite->root.$struct;
1150
+		$link = home_url(user_trailingslashit($struct, 'post_type_archive'));
1151 1151
 	} else {
1152
-		$link = home_url( '?post_type=' . $post_type );
1152
+		$link = home_url('?post_type='.$post_type);
1153 1153
 	}
1154 1154
 
1155 1155
 	/**
@@ -1160,7 +1160,7 @@  discard block
 block discarded – undo
1160 1160
 	 * @param string $link      The post type archive permalink.
1161 1161
 	 * @param string $post_type Post type name.
1162 1162
 	 */
1163
-	return apply_filters( 'post_type_archive_link', $link, $post_type );
1163
+	return apply_filters('post_type_archive_link', $link, $post_type);
1164 1164
 }
1165 1165
 
1166 1166
 /**
@@ -1172,22 +1172,22 @@  discard block
 block discarded – undo
1172 1172
  * @param string $feed      Optional. Feed type
1173 1173
  * @return string|false The post type feed permalink.
1174 1174
  */
1175
-function get_post_type_archive_feed_link( $post_type, $feed = '' ) {
1175
+function get_post_type_archive_feed_link($post_type, $feed = '') {
1176 1176
 	$default_feed = get_default_feed();
1177
-	if ( empty( $feed ) )
1177
+	if (empty($feed))
1178 1178
 		$feed = $default_feed;
1179 1179
 
1180
-	if ( ! $link = get_post_type_archive_link( $post_type ) )
1180
+	if ( ! $link = get_post_type_archive_link($post_type))
1181 1181
 		return false;
1182 1182
 
1183
-	$post_type_obj = get_post_type_object( $post_type );
1184
-	if ( get_option( 'permalink_structure' ) && is_array( $post_type_obj->rewrite ) && $post_type_obj->rewrite['feeds'] ) {
1185
-		$link = trailingslashit( $link );
1183
+	$post_type_obj = get_post_type_object($post_type);
1184
+	if (get_option('permalink_structure') && is_array($post_type_obj->rewrite) && $post_type_obj->rewrite['feeds']) {
1185
+		$link = trailingslashit($link);
1186 1186
 		$link .= 'feed/';
1187
-		if ( $feed != $default_feed )
1187
+		if ($feed != $default_feed)
1188 1188
 			$link .= "$feed/";
1189 1189
 	} else {
1190
-		$link = add_query_arg( 'feed', $feed, $link );
1190
+		$link = add_query_arg('feed', $feed, $link);
1191 1191
 	}
1192 1192
 
1193 1193
 	/**
@@ -1198,7 +1198,7 @@  discard block
 block discarded – undo
1198 1198
 	 * @param string $link The post type archive feed link.
1199 1199
 	 * @param string $feed Feed type.
1200 1200
 	 */
1201
-	return apply_filters( 'post_type_archive_feed_link', $link, $feed );
1201
+	return apply_filters('post_type_archive_feed_link', $link, $feed);
1202 1202
 }
1203 1203
 
1204 1204
 /**
@@ -1213,20 +1213,20 @@  discard block
 block discarded – undo
1213 1213
  * @param string      $preview_link Optional. Base preview link to be used if it should differ from the post permalink.
1214 1214
  * @return string URL used for the post preview.
1215 1215
  */
1216
-function get_preview_post_link( $post = null, $query_args = array(), $preview_link = '' ) {
1217
-	$post = get_post( $post );
1218
-	if ( ! $post ) {
1216
+function get_preview_post_link($post = null, $query_args = array(), $preview_link = '') {
1217
+	$post = get_post($post);
1218
+	if ( ! $post) {
1219 1219
 		return;
1220 1220
 	}
1221 1221
 
1222
-	$post_type_object = get_post_type_object( $post->post_type );
1223
-	if ( is_post_type_viewable( $post_type_object ) ) {
1224
-		if ( ! $preview_link ) {
1225
-			$preview_link = set_url_scheme( get_permalink( $post ) );
1222
+	$post_type_object = get_post_type_object($post->post_type);
1223
+	if (is_post_type_viewable($post_type_object)) {
1224
+		if ( ! $preview_link) {
1225
+			$preview_link = set_url_scheme(get_permalink($post));
1226 1226
 		}
1227 1227
 
1228 1228
 		$query_args['preview'] = 'true';
1229
-		$preview_link = add_query_arg( $query_args, $preview_link );
1229
+		$preview_link = add_query_arg($query_args, $preview_link);
1230 1230
 	}
1231 1231
 
1232 1232
 	/**
@@ -1238,7 +1238,7 @@  discard block
 block discarded – undo
1238 1238
 	 * @param string  $preview_link URL used for the post preview.
1239 1239
 	 * @param WP_Post $post         Post object.
1240 1240
 	 */
1241
-	return apply_filters( 'preview_post_link', $preview_link, $post );
1241
+	return apply_filters('preview_post_link', $preview_link, $post);
1242 1242
 }
1243 1243
 
1244 1244
 /**
@@ -1254,26 +1254,26 @@  discard block
 block discarded – undo
1254 1254
  * @return string|null The edit post link for the given post. null if the post type is invalid or does
1255 1255
  *                     not allow an editing UI.
1256 1256
  */
1257
-function get_edit_post_link( $id = 0, $context = 'display' ) {
1258
-	if ( ! $post = get_post( $id ) )
1257
+function get_edit_post_link($id = 0, $context = 'display') {
1258
+	if ( ! $post = get_post($id))
1259 1259
 		return;
1260 1260
 
1261
-	if ( 'revision' === $post->post_type )
1261
+	if ('revision' === $post->post_type)
1262 1262
 		$action = '';
1263
-	elseif ( 'display' == $context )
1263
+	elseif ('display' == $context)
1264 1264
 		$action = '&amp;action=edit';
1265 1265
 	else
1266 1266
 		$action = '&action=edit';
1267 1267
 
1268
-	$post_type_object = get_post_type_object( $post->post_type );
1269
-	if ( !$post_type_object )
1268
+	$post_type_object = get_post_type_object($post->post_type);
1269
+	if ( ! $post_type_object)
1270 1270
 		return;
1271 1271
 
1272
-	if ( !current_user_can( 'edit_post', $post->ID ) )
1272
+	if ( ! current_user_can('edit_post', $post->ID))
1273 1273
 		return;
1274 1274
 
1275
-	if ( $post_type_object->_edit_link ) {
1276
-		$link = admin_url( sprintf( $post_type_object->_edit_link . $action, $post->ID ) );
1275
+	if ($post_type_object->_edit_link) {
1276
+		$link = admin_url(sprintf($post_type_object->_edit_link.$action, $post->ID));
1277 1277
 	} else {
1278 1278
 		$link = '';
1279 1279
 	}
@@ -1288,7 +1288,7 @@  discard block
 block discarded – undo
1288 1288
 	 * @param string $context The link context. If set to 'display' then ampersands
1289 1289
 	 *                        are encoded.
1290 1290
 	 */
1291
-	return apply_filters( 'get_edit_post_link', $link, $post->ID, $context );
1291
+	return apply_filters('get_edit_post_link', $link, $post->ID, $context);
1292 1292
 }
1293 1293
 
1294 1294
 /**
@@ -1303,20 +1303,20 @@  discard block
 block discarded – undo
1303 1303
  * @param int    $id     Optional. Post ID.
1304 1304
  * @param string $class  Optional. Add custom class to link.
1305 1305
  */
1306
-function edit_post_link( $text = null, $before = '', $after = '', $id = 0, $class = 'post-edit-link' ) {
1307
-	if ( ! $post = get_post( $id ) ) {
1306
+function edit_post_link($text = null, $before = '', $after = '', $id = 0, $class = 'post-edit-link') {
1307
+	if ( ! $post = get_post($id)) {
1308 1308
 		return;
1309 1309
 	}
1310 1310
 
1311
-	if ( ! $url = get_edit_post_link( $post->ID ) ) {
1311
+	if ( ! $url = get_edit_post_link($post->ID)) {
1312 1312
 		return;
1313 1313
 	}
1314 1314
 
1315
-	if ( null === $text ) {
1316
-		$text = __( 'Edit This' );
1315
+	if (null === $text) {
1316
+		$text = __('Edit This');
1317 1317
 	}
1318 1318
 
1319
-	$link = '<a class="' . esc_attr( $class ) . '" href="' . esc_url( $url ) . '">' . $text . '</a>';
1319
+	$link = '<a class="'.esc_attr($class).'" href="'.esc_url($url).'">'.$text.'</a>';
1320 1320
 
1321 1321
 	/**
1322 1322
 	 * Filter the post edit link anchor tag.
@@ -1327,7 +1327,7 @@  discard block
 block discarded – undo
1327 1327
 	 * @param int    $post_id Post ID.
1328 1328
 	 * @param string $text    Anchor text.
1329 1329
 	 */
1330
-	echo $before . apply_filters( 'edit_post_link', $link, $post->ID, $text ) . $after;
1330
+	echo $before.apply_filters('edit_post_link', $link, $post->ID, $text).$after;
1331 1331
 }
1332 1332
 
1333 1333
 /**
@@ -1342,23 +1342,23 @@  discard block
 block discarded – undo
1342 1342
  * @param bool   $force_delete Whether to bypass trash and force deletion. Default is false.
1343 1343
  * @return string|void The delete post link URL for the given post.
1344 1344
  */
1345
-function get_delete_post_link( $id = 0, $deprecated = '', $force_delete = false ) {
1346
-	if ( ! empty( $deprecated ) )
1347
-		_deprecated_argument( __FUNCTION__, '3.0' );
1345
+function get_delete_post_link($id = 0, $deprecated = '', $force_delete = false) {
1346
+	if ( ! empty($deprecated))
1347
+		_deprecated_argument(__FUNCTION__, '3.0');
1348 1348
 
1349
-	if ( !$post = get_post( $id ) )
1349
+	if ( ! $post = get_post($id))
1350 1350
 		return;
1351 1351
 
1352
-	$post_type_object = get_post_type_object( $post->post_type );
1353
-	if ( !$post_type_object )
1352
+	$post_type_object = get_post_type_object($post->post_type);
1353
+	if ( ! $post_type_object)
1354 1354
 		return;
1355 1355
 
1356
-	if ( !current_user_can( 'delete_post', $post->ID ) )
1356
+	if ( ! current_user_can('delete_post', $post->ID))
1357 1357
 		return;
1358 1358
 
1359
-	$action = ( $force_delete || !EMPTY_TRASH_DAYS ) ? 'delete' : 'trash';
1359
+	$action = ($force_delete || ! EMPTY_TRASH_DAYS) ? 'delete' : 'trash';
1360 1360
 
1361
-	$delete_link = add_query_arg( 'action', $action, admin_url( sprintf( $post_type_object->_edit_link, $post->ID ) ) );
1361
+	$delete_link = add_query_arg('action', $action, admin_url(sprintf($post_type_object->_edit_link, $post->ID)));
1362 1362
 
1363 1363
 	/**
1364 1364
 	 * Filter the post delete link.
@@ -1369,7 +1369,7 @@  discard block
 block discarded – undo
1369 1369
 	 * @param int    $post_id      Post ID.
1370 1370
 	 * @param bool   $force_delete Whether to bypass the trash and force deletion. Default false.
1371 1371
 	 */
1372
-	return apply_filters( 'get_delete_post_link', wp_nonce_url( $delete_link, "$action-post_{$post->ID}" ), $post->ID, $force_delete );
1372
+	return apply_filters('get_delete_post_link', wp_nonce_url($delete_link, "$action-post_{$post->ID}"), $post->ID, $force_delete);
1373 1373
 }
1374 1374
 
1375 1375
 /**
@@ -1380,13 +1380,13 @@  discard block
 block discarded – undo
1380 1380
  * @param int|WP_Comment $comment_id Optional. Comment ID or WP_Comment object.
1381 1381
  * @return string|void The edit comment link URL for the given comment.
1382 1382
  */
1383
-function get_edit_comment_link( $comment_id = 0 ) {
1384
-	$comment = get_comment( $comment_id );
1383
+function get_edit_comment_link($comment_id = 0) {
1384
+	$comment = get_comment($comment_id);
1385 1385
 
1386
-	if ( !current_user_can( 'edit_comment', $comment->comment_ID ) )
1386
+	if ( ! current_user_can('edit_comment', $comment->comment_ID))
1387 1387
 		return;
1388 1388
 
1389
-	$location = admin_url('comment.php?action=editcomment&amp;c=') . $comment->comment_ID;
1389
+	$location = admin_url('comment.php?action=editcomment&amp;c=').$comment->comment_ID;
1390 1390
 
1391 1391
 	/**
1392 1392
 	 * Filter the comment edit link.
@@ -1395,7 +1395,7 @@  discard block
 block discarded – undo
1395 1395
 	 *
1396 1396
 	 * @param string $location The edit link.
1397 1397
 	 */
1398
-	return apply_filters( 'get_edit_comment_link', $location );
1398
+	return apply_filters('get_edit_comment_link', $location);
1399 1399
 }
1400 1400
 
1401 1401
 /**
@@ -1407,18 +1407,18 @@  discard block
 block discarded – undo
1407 1407
  * @param string $before Optional. Display before edit link.
1408 1408
  * @param string $after  Optional. Display after edit link.
1409 1409
  */
1410
-function edit_comment_link( $text = null, $before = '', $after = '' ) {
1410
+function edit_comment_link($text = null, $before = '', $after = '') {
1411 1411
 	$comment = get_comment();
1412 1412
 
1413
-	if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) ) {
1413
+	if ( ! current_user_can('edit_comment', $comment->comment_ID)) {
1414 1414
 		return;
1415 1415
 	}
1416 1416
 
1417
-	if ( null === $text ) {
1418
-		$text = __( 'Edit This' );
1417
+	if (null === $text) {
1418
+		$text = __('Edit This');
1419 1419
 	}
1420 1420
 
1421
-	$link = '<a class="comment-edit-link" href="' . esc_url( get_edit_comment_link( $comment ) ) . '">' . $text . '</a>';
1421
+	$link = '<a class="comment-edit-link" href="'.esc_url(get_edit_comment_link($comment)).'">'.$text.'</a>';
1422 1422
 
1423 1423
 	/**
1424 1424
 	 * Filter the comment edit link anchor tag.
@@ -1429,7 +1429,7 @@  discard block
 block discarded – undo
1429 1429
 	 * @param int    $comment_id Comment ID.
1430 1430
 	 * @param string $text       Anchor text.
1431 1431
 	 */
1432
-	echo $before . apply_filters( 'edit_comment_link', $link, $comment->comment_ID, $text ) . $after;
1432
+	echo $before.apply_filters('edit_comment_link', $link, $comment->comment_ID, $text).$after;
1433 1433
 }
1434 1434
 
1435 1435
 /**
@@ -1440,13 +1440,13 @@  discard block
 block discarded – undo
1440 1440
  * @param int|stdClass $link Optional. Bookmark ID.
1441 1441
  * @return string|void The edit bookmark link URL.
1442 1442
  */
1443
-function get_edit_bookmark_link( $link = 0 ) {
1444
-	$link = get_bookmark( $link );
1443
+function get_edit_bookmark_link($link = 0) {
1444
+	$link = get_bookmark($link);
1445 1445
 
1446
-	if ( !current_user_can('manage_links') )
1446
+	if ( ! current_user_can('manage_links'))
1447 1447
 		return;
1448 1448
 
1449
-	$location = admin_url('link.php?action=edit&amp;link_id=') . $link->link_id;
1449
+	$location = admin_url('link.php?action=edit&amp;link_id=').$link->link_id;
1450 1450
 
1451 1451
 	/**
1452 1452
 	 * Filter the bookmark edit link.
@@ -1456,7 +1456,7 @@  discard block
 block discarded – undo
1456 1456
 	 * @param string $location The edit link.
1457 1457
 	 * @param int    $link_id  Bookmark ID.
1458 1458
 	 */
1459
-	return apply_filters( 'get_edit_bookmark_link', $location, $link->link_id );
1459
+	return apply_filters('get_edit_bookmark_link', $location, $link->link_id);
1460 1460
 }
1461 1461
 
1462 1462
 /**
@@ -1469,16 +1469,16 @@  discard block
 block discarded – undo
1469 1469
  * @param string $after    Optional. Display after edit link.
1470 1470
  * @param int    $bookmark Optional. Bookmark ID.
1471 1471
  */
1472
-function edit_bookmark_link( $link = '', $before = '', $after = '', $bookmark = null ) {
1472
+function edit_bookmark_link($link = '', $before = '', $after = '', $bookmark = null) {
1473 1473
 	$bookmark = get_bookmark($bookmark);
1474 1474
 
1475
-	if ( !current_user_can('manage_links') )
1475
+	if ( ! current_user_can('manage_links'))
1476 1476
 		return;
1477 1477
 
1478
-	if ( empty($link) )
1478
+	if (empty($link))
1479 1479
 		$link = __('Edit This');
1480 1480
 
1481
-	$link = '<a href="' . esc_url( get_edit_bookmark_link( $bookmark ) ) . '">' . $link . '</a>';
1481
+	$link = '<a href="'.esc_url(get_edit_bookmark_link($bookmark)).'">'.$link.'</a>';
1482 1482
 
1483 1483
 	/**
1484 1484
 	 * Filter the bookmark edit link anchor tag.
@@ -1488,7 +1488,7 @@  discard block
 block discarded – undo
1488 1488
 	 * @param string $link    Anchor tag for the edit link.
1489 1489
 	 * @param int    $link_id Bookmark ID.
1490 1490
 	 */
1491
-	echo $before . apply_filters( 'edit_bookmark_link', $link, $bookmark->link_id ) . $after;
1491
+	echo $before.apply_filters('edit_bookmark_link', $link, $bookmark->link_id).$after;
1492 1492
 }
1493 1493
 
1494 1494
 /**
@@ -1499,22 +1499,22 @@  discard block
 block discarded – undo
1499 1499
  * @param int $user_id Optional. User ID. Defaults to the current user.
1500 1500
  * @return string URL to edit user page or empty string.
1501 1501
  */
1502
-function get_edit_user_link( $user_id = null ) {
1503
-	if ( ! $user_id )
1502
+function get_edit_user_link($user_id = null) {
1503
+	if ( ! $user_id)
1504 1504
 		$user_id = get_current_user_id();
1505 1505
 
1506
-	if ( empty( $user_id ) || ! current_user_can( 'edit_user', $user_id ) )
1506
+	if (empty($user_id) || ! current_user_can('edit_user', $user_id))
1507 1507
 		return '';
1508 1508
 
1509
-	$user = get_userdata( $user_id );
1509
+	$user = get_userdata($user_id);
1510 1510
 
1511
-	if ( ! $user )
1511
+	if ( ! $user)
1512 1512
 		return '';
1513 1513
 
1514
-	if ( get_current_user_id() == $user->ID )
1515
-		$link = get_edit_profile_url( $user->ID );
1514
+	if (get_current_user_id() == $user->ID)
1515
+		$link = get_edit_profile_url($user->ID);
1516 1516
 	else
1517
-		$link = add_query_arg( 'user_id', $user->ID, self_admin_url( 'user-edit.php' ) );
1517
+		$link = add_query_arg('user_id', $user->ID, self_admin_url('user-edit.php'));
1518 1518
 
1519 1519
 	/**
1520 1520
 	 * Filter the user edit link.
@@ -1524,7 +1524,7 @@  discard block
 block discarded – undo
1524 1524
 	 * @param string $link    The edit link.
1525 1525
 	 * @param int    $user_id User ID.
1526 1526
 	 */
1527
-	return apply_filters( 'get_edit_user_link', $link, $user->ID );
1527
+	return apply_filters('get_edit_user_link', $link, $user->ID);
1528 1528
 }
1529 1529
 
1530 1530
 // Navigation links
@@ -1539,8 +1539,8 @@  discard block
 block discarded – undo
1539 1539
  * @param string       $taxonomy       Optional. Taxonomy, if $in_same_term is true. Default 'category'.
1540 1540
  * @return null|string|WP_Post Post object if successful. Null if global $post is not set. Empty string if no corresponding post exists.
1541 1541
  */
1542
-function get_previous_post( $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
1543
-	return get_adjacent_post( $in_same_term, $excluded_terms, true, $taxonomy );
1542
+function get_previous_post($in_same_term = false, $excluded_terms = '', $taxonomy = 'category') {
1543
+	return get_adjacent_post($in_same_term, $excluded_terms, true, $taxonomy);
1544 1544
 }
1545 1545
 
1546 1546
 /**
@@ -1553,8 +1553,8 @@  discard block
 block discarded – undo
1553 1553
  * @param string       $taxonomy       Optional. Taxonomy, if $in_same_term is true. Default 'category'.
1554 1554
  * @return null|string|WP_Post Post object if successful. Null if global $post is not set. Empty string if no corresponding post exists.
1555 1555
  */
1556
-function get_next_post( $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
1557
-	return get_adjacent_post( $in_same_term, $excluded_terms, false, $taxonomy );
1556
+function get_next_post($in_same_term = false, $excluded_terms = '', $taxonomy = 'category') {
1557
+	return get_adjacent_post($in_same_term, $excluded_terms, false, $taxonomy);
1558 1558
 }
1559 1559
 
1560 1560
 /**
@@ -1572,10 +1572,10 @@  discard block
 block discarded – undo
1572 1572
  * @param string       $taxonomy       Optional. Taxonomy, if $in_same_term is true. Default 'category'.
1573 1573
  * @return null|string|WP_Post Post object if successful. Null if global $post is not set. Empty string if no corresponding post exists.
1574 1574
  */
1575
-function get_adjacent_post( $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category' ) {
1575
+function get_adjacent_post($in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category') {
1576 1576
 	global $wpdb;
1577 1577
 
1578
-	if ( ( ! $post = get_post() ) || ! taxonomy_exists( $taxonomy ) )
1578
+	if (( ! $post = get_post()) || ! taxonomy_exists($taxonomy))
1579 1579
 		return null;
1580 1580
 
1581 1581
 	$current_post_date = $post->post_date;
@@ -1584,35 +1584,35 @@  discard block
 block discarded – undo
1584 1584
 	$where = '';
1585 1585
 	$adjacent = $previous ? 'previous' : 'next';
1586 1586
 
1587
-	if ( $in_same_term || ! empty( $excluded_terms ) ) {
1588
-		if ( ! empty( $excluded_terms ) && ! is_array( $excluded_terms ) ) {
1587
+	if ($in_same_term || ! empty($excluded_terms)) {
1588
+		if ( ! empty($excluded_terms) && ! is_array($excluded_terms)) {
1589 1589
 			// back-compat, $excluded_terms used to be $excluded_terms with IDs separated by " and "
1590
-			if ( false !== strpos( $excluded_terms, ' and ' ) ) {
1591
-				_deprecated_argument( __FUNCTION__, '3.3', sprintf( __( 'Use commas instead of %s to separate excluded terms.' ), "'and'" ) );
1592
-				$excluded_terms = explode( ' and ', $excluded_terms );
1590
+			if (false !== strpos($excluded_terms, ' and ')) {
1591
+				_deprecated_argument(__FUNCTION__, '3.3', sprintf(__('Use commas instead of %s to separate excluded terms.'), "'and'"));
1592
+				$excluded_terms = explode(' and ', $excluded_terms);
1593 1593
 			} else {
1594
-				$excluded_terms = explode( ',', $excluded_terms );
1594
+				$excluded_terms = explode(',', $excluded_terms);
1595 1595
 			}
1596 1596
 
1597
-			$excluded_terms = array_map( 'intval', $excluded_terms );
1597
+			$excluded_terms = array_map('intval', $excluded_terms);
1598 1598
 		}
1599 1599
 
1600
-		if ( $in_same_term ) {
1600
+		if ($in_same_term) {
1601 1601
 			$join .= " INNER JOIN $wpdb->term_relationships AS tr ON p.ID = tr.object_id INNER JOIN $wpdb->term_taxonomy tt ON tr.term_taxonomy_id = tt.term_taxonomy_id";
1602
-			$where .= $wpdb->prepare( "AND tt.taxonomy = %s", $taxonomy );
1602
+			$where .= $wpdb->prepare("AND tt.taxonomy = %s", $taxonomy);
1603 1603
 
1604
-			if ( ! is_object_in_taxonomy( $post->post_type, $taxonomy ) )
1604
+			if ( ! is_object_in_taxonomy($post->post_type, $taxonomy))
1605 1605
 				return '';
1606
-			$term_array = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'ids' ) );
1606
+			$term_array = wp_get_object_terms($post->ID, $taxonomy, array('fields' => 'ids'));
1607 1607
 
1608 1608
 			// Remove any exclusions from the term array to include.
1609
-			$term_array = array_diff( $term_array, (array) $excluded_terms );
1610
-			$term_array = array_map( 'intval', $term_array );
1609
+			$term_array = array_diff($term_array, (array) $excluded_terms);
1610
+			$term_array = array_map('intval', $term_array);
1611 1611
 
1612
-			if ( ! $term_array || is_wp_error( $term_array ) )
1612
+			if ( ! $term_array || is_wp_error($term_array))
1613 1613
 				return '';
1614 1614
 
1615
-			$where .= " AND tt.term_id IN (" . implode( ',', $term_array ) . ")";
1615
+			$where .= " AND tt.term_id IN (".implode(',', $term_array).")";
1616 1616
 		}
1617 1617
 
1618 1618
 		/**
@@ -1625,21 +1625,21 @@  discard block
 block discarded – undo
1625 1625
 		 *
1626 1626
 		 * @param string $excluded_terms Array of excluded term IDs.
1627 1627
 		 */
1628
-		$excluded_terms = apply_filters( "get_{$adjacent}_post_excluded_terms", $excluded_terms );
1628
+		$excluded_terms = apply_filters("get_{$adjacent}_post_excluded_terms", $excluded_terms);
1629 1629
 
1630
-		if ( ! empty( $excluded_terms ) ) {
1631
-			$where .= " AND p.ID NOT IN ( SELECT tr.object_id FROM $wpdb->term_relationships tr LEFT JOIN $wpdb->term_taxonomy tt ON (tr.term_taxonomy_id = tt.term_taxonomy_id) WHERE tt.term_id IN (" . implode( ',', array_map( 'intval', $excluded_terms ) ) . ') )';
1630
+		if ( ! empty($excluded_terms)) {
1631
+			$where .= " AND p.ID NOT IN ( SELECT tr.object_id FROM $wpdb->term_relationships tr LEFT JOIN $wpdb->term_taxonomy tt ON (tr.term_taxonomy_id = tt.term_taxonomy_id) WHERE tt.term_id IN (".implode(',', array_map('intval', $excluded_terms)).') )';
1632 1632
 		}
1633 1633
 	}
1634 1634
 
1635 1635
 	// 'post_status' clause depends on the current user.
1636
-	if ( is_user_logged_in() ) {
1636
+	if (is_user_logged_in()) {
1637 1637
 		$user_id = get_current_user_id();
1638 1638
 
1639
-		$post_type_object = get_post_type_object( $post->post_type );
1640
-		if ( empty( $post_type_object ) ) {
1639
+		$post_type_object = get_post_type_object($post->post_type);
1640
+		if (empty($post_type_object)) {
1641 1641
 			$post_type_cap    = $post->post_type;
1642
-			$read_private_cap = 'read_private_' . $post_type_cap . 's';
1642
+			$read_private_cap = 'read_private_'.$post_type_cap.'s';
1643 1643
 		} else {
1644 1644
 			$read_private_cap = $post_type_object->cap->read_private_posts;
1645 1645
 		}
@@ -1648,13 +1648,13 @@  discard block
 block discarded – undo
1648 1648
 		 * Results should include private posts belonging to the current user, or private posts where the
1649 1649
 		 * current user has the 'read_private_posts' cap.
1650 1650
 		 */
1651
-		$private_states = get_post_stati( array( 'private' => true ) );
1651
+		$private_states = get_post_stati(array('private' => true));
1652 1652
 		$where .= " AND ( p.post_status = 'publish'";
1653
-		foreach ( (array) $private_states as $state ) {
1654
-			if ( current_user_can( $read_private_cap ) ) {
1655
-				$where .= $wpdb->prepare( " OR p.post_status = %s", $state );
1653
+		foreach ((array) $private_states as $state) {
1654
+			if (current_user_can($read_private_cap)) {
1655
+				$where .= $wpdb->prepare(" OR p.post_status = %s", $state);
1656 1656
 			} else {
1657
-				$where .= $wpdb->prepare( " OR (p.post_author = %d AND p.post_status = %s)", $user_id, $state );
1657
+				$where .= $wpdb->prepare(" OR (p.post_author = %d AND p.post_status = %s)", $user_id, $state);
1658 1658
 			}
1659 1659
 		}
1660 1660
 		$where .= " )";
@@ -1680,7 +1680,7 @@  discard block
 block discarded – undo
1680 1680
 	 * @param string  $taxonomy       Taxonomy. Used to identify the term used when `$in_same_term` is true.
1681 1681
 	 * @param WP_Post $post           WP_Post object.
1682 1682
 	 */
1683
-	$join = apply_filters( "get_{$adjacent}_post_join", $join, $in_same_term, $excluded_terms, $taxonomy, $post );
1683
+	$join = apply_filters("get_{$adjacent}_post_join", $join, $in_same_term, $excluded_terms, $taxonomy, $post);
1684 1684
 
1685 1685
 	/**
1686 1686
 	 * Filter the WHERE clause in the SQL for an adjacent post query.
@@ -1697,7 +1697,7 @@  discard block
 block discarded – undo
1697 1697
 	 * @param string $taxonomy       Taxonomy. Used to identify the term used when `$in_same_term` is true.
1698 1698
 	 * @param WP_Post $post           WP_Post object.
1699 1699
 	 */
1700
-	$where = apply_filters( "get_{$adjacent}_post_where", $wpdb->prepare( "WHERE p.post_date $op %s AND p.post_type = %s $where", $current_post_date, $post->post_type ), $in_same_term, $excluded_terms, $taxonomy, $post );
1700
+	$where = apply_filters("get_{$adjacent}_post_where", $wpdb->prepare("WHERE p.post_date $op %s AND p.post_type = %s $where", $current_post_date, $post->post_type), $in_same_term, $excluded_terms, $taxonomy, $post);
1701 1701
 
1702 1702
 	/**
1703 1703
 	 * Filter the ORDER BY clause in the SQL for an adjacent post query.
@@ -1711,25 +1711,25 @@  discard block
 block discarded – undo
1711 1711
 	 * @param string $order_by The `ORDER BY` clause in the SQL.
1712 1712
 	 * @param WP_Post $post    WP_Post object.
1713 1713
 	 */
1714
-	$sort  = apply_filters( "get_{$adjacent}_post_sort", "ORDER BY p.post_date $order LIMIT 1", $post );
1714
+	$sort  = apply_filters("get_{$adjacent}_post_sort", "ORDER BY p.post_date $order LIMIT 1", $post);
1715 1715
 
1716 1716
 	$query = "SELECT p.ID FROM $wpdb->posts AS p $join $where $sort";
1717
-	$query_key = 'adjacent_post_' . md5( $query );
1718
-	$result = wp_cache_get( $query_key, 'counts' );
1719
-	if ( false !== $result ) {
1720
-		if ( $result )
1721
-			$result = get_post( $result );
1717
+	$query_key = 'adjacent_post_'.md5($query);
1718
+	$result = wp_cache_get($query_key, 'counts');
1719
+	if (false !== $result) {
1720
+		if ($result)
1721
+			$result = get_post($result);
1722 1722
 		return $result;
1723 1723
 	}
1724 1724
 
1725
-	$result = $wpdb->get_var( $query );
1726
-	if ( null === $result )
1725
+	$result = $wpdb->get_var($query);
1726
+	if (null === $result)
1727 1727
 		$result = '';
1728 1728
 
1729
-	wp_cache_set( $query_key, $result, 'counts' );
1729
+	wp_cache_set($query_key, $result, 'counts');
1730 1730
 
1731
-	if ( $result )
1732
-		$result = get_post( $result );
1731
+	if ($result)
1732
+		$result = get_post($result);
1733 1733
 
1734 1734
 	return $result;
1735 1735
 }
@@ -1748,28 +1748,28 @@  discard block
 block discarded – undo
1748 1748
  * @param string       $taxonomy       Optional. Taxonomy, if $in_same_term is true. Default 'category'.
1749 1749
  * @return string|void The adjacent post relational link URL.
1750 1750
  */
1751
-function get_adjacent_post_rel_link( $title = '%title', $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category' ) {
1752
-	if ( $previous && is_attachment() && $post = get_post() )
1753
-		$post = get_post( $post->post_parent );
1751
+function get_adjacent_post_rel_link($title = '%title', $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category') {
1752
+	if ($previous && is_attachment() && $post = get_post())
1753
+		$post = get_post($post->post_parent);
1754 1754
 	else
1755
-		$post = get_adjacent_post( $in_same_term, $excluded_terms, $previous, $taxonomy );
1755
+		$post = get_adjacent_post($in_same_term, $excluded_terms, $previous, $taxonomy);
1756 1756
 
1757
-	if ( empty( $post ) )
1757
+	if (empty($post))
1758 1758
 		return;
1759 1759
 
1760
-	$post_title = the_title_attribute( array( 'echo' => false, 'post' => $post ) );
1760
+	$post_title = the_title_attribute(array('echo' => false, 'post' => $post));
1761 1761
 
1762
-	if ( empty( $post_title ) )
1763
-		$post_title = $previous ? __( 'Previous Post' ) : __( 'Next Post' );
1762
+	if (empty($post_title))
1763
+		$post_title = $previous ? __('Previous Post') : __('Next Post');
1764 1764
 
1765
-	$date = mysql2date( get_option( 'date_format' ), $post->post_date );
1765
+	$date = mysql2date(get_option('date_format'), $post->post_date);
1766 1766
 
1767
-	$title = str_replace( '%title', $post_title, $title );
1768
-	$title = str_replace( '%date', $date, $title );
1767
+	$title = str_replace('%title', $post_title, $title);
1768
+	$title = str_replace('%date', $date, $title);
1769 1769
 
1770 1770
 	$link = $previous ? "<link rel='prev' title='" : "<link rel='next' title='";
1771
-	$link .= esc_attr( $title );
1772
-	$link .= "' href='" . get_permalink( $post ) . "' />\n";
1771
+	$link .= esc_attr($title);
1772
+	$link .= "' href='".get_permalink($post)."' />\n";
1773 1773
 
1774 1774
 	$adjacent = $previous ? 'previous' : 'next';
1775 1775
 
@@ -1783,7 +1783,7 @@  discard block
 block discarded – undo
1783 1783
 	 *
1784 1784
 	 * @param string $link The relational link.
1785 1785
 	 */
1786
-	return apply_filters( "{$adjacent}_post_rel_link", $link );
1786
+	return apply_filters("{$adjacent}_post_rel_link", $link);
1787 1787
 }
1788 1788
 
1789 1789
 /**
@@ -1796,9 +1796,9 @@  discard block
 block discarded – undo
1796 1796
  * @param array|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
1797 1797
  * @param string       $taxonomy       Optional. Taxonomy, if $in_same_term is true. Default 'category'.
1798 1798
  */
1799
-function adjacent_posts_rel_link( $title = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
1800
-	echo get_adjacent_post_rel_link( $title, $in_same_term, $excluded_terms, true, $taxonomy );
1801
-	echo get_adjacent_post_rel_link( $title, $in_same_term, $excluded_terms, false, $taxonomy );
1799
+function adjacent_posts_rel_link($title = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category') {
1800
+	echo get_adjacent_post_rel_link($title, $in_same_term, $excluded_terms, true, $taxonomy);
1801
+	echo get_adjacent_post_rel_link($title, $in_same_term, $excluded_terms, false, $taxonomy);
1802 1802
 }
1803 1803
 
1804 1804
 /**
@@ -1809,7 +1809,7 @@  discard block
 block discarded – undo
1809 1809
  *
1810 1810
  */
1811 1811
 function adjacent_posts_rel_link_wp_head() {
1812
-	if ( ! is_single() || is_attachment() ) {
1812
+	if ( ! is_single() || is_attachment()) {
1813 1813
 		return;
1814 1814
 	}
1815 1815
 	adjacent_posts_rel_link();
@@ -1825,8 +1825,8 @@  discard block
 block discarded – undo
1825 1825
  * @param array|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
1826 1826
  * @param string       $taxonomy       Optional. Taxonomy, if $in_same_term is true. Default 'category'.
1827 1827
  */
1828
-function next_post_rel_link( $title = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
1829
-	echo get_adjacent_post_rel_link( $title, $in_same_term, $excluded_terms, false, $taxonomy );
1828
+function next_post_rel_link($title = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category') {
1829
+	echo get_adjacent_post_rel_link($title, $in_same_term, $excluded_terms, false, $taxonomy);
1830 1830
 }
1831 1831
 
1832 1832
 /**
@@ -1839,8 +1839,8 @@  discard block
 block discarded – undo
1839 1839
  * @param array|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs. Default true.
1840 1840
  * @param string       $taxonomy       Optional. Taxonomy, if $in_same_term is true. Default 'category'.
1841 1841
  */
1842
-function prev_post_rel_link( $title = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
1843
-	echo get_adjacent_post_rel_link( $title, $in_same_term, $excluded_terms, true, $taxonomy );
1842
+function prev_post_rel_link($title = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category') {
1843
+	echo get_adjacent_post_rel_link($title, $in_same_term, $excluded_terms, true, $taxonomy);
1844 1844
 }
1845 1845
 
1846 1846
 /**
@@ -1857,9 +1857,9 @@  discard block
 block discarded – undo
1857 1857
  * @param string       $taxonomy       Optional. Taxonomy, if $in_same_term is true. Default 'category'.
1858 1858
  * @return null|array Array containing the boundary post object if successful, null otherwise.
1859 1859
  */
1860
-function get_boundary_post( $in_same_term = false, $excluded_terms = '', $start = true, $taxonomy = 'category' ) {
1860
+function get_boundary_post($in_same_term = false, $excluded_terms = '', $start = true, $taxonomy = 'category') {
1861 1861
 	$post = get_post();
1862
-	if ( ! $post || ! is_single() || is_attachment() || ! taxonomy_exists( $taxonomy ) )
1862
+	if ( ! $post || ! is_single() || is_attachment() || ! taxonomy_exists($taxonomy))
1863 1863
 		return null;
1864 1864
 
1865 1865
 	$query_args = array(
@@ -1871,34 +1871,34 @@  discard block
 block discarded – undo
1871 1871
 
1872 1872
 	$term_array = array();
1873 1873
 
1874
-	if ( ! is_array( $excluded_terms ) ) {
1875
-		if ( ! empty( $excluded_terms ) )
1876
-			$excluded_terms = explode( ',', $excluded_terms );
1874
+	if ( ! is_array($excluded_terms)) {
1875
+		if ( ! empty($excluded_terms))
1876
+			$excluded_terms = explode(',', $excluded_terms);
1877 1877
 		else
1878 1878
 			$excluded_terms = array();
1879 1879
 	}
1880 1880
 
1881
-	if ( $in_same_term || ! empty( $excluded_terms ) ) {
1882
-		if ( $in_same_term )
1883
-			$term_array = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'ids' ) );
1881
+	if ($in_same_term || ! empty($excluded_terms)) {
1882
+		if ($in_same_term)
1883
+			$term_array = wp_get_object_terms($post->ID, $taxonomy, array('fields' => 'ids'));
1884 1884
 
1885
-		if ( ! empty( $excluded_terms ) ) {
1886
-			$excluded_terms = array_map( 'intval', $excluded_terms );
1887
-			$excluded_terms = array_diff( $excluded_terms, $term_array );
1885
+		if ( ! empty($excluded_terms)) {
1886
+			$excluded_terms = array_map('intval', $excluded_terms);
1887
+			$excluded_terms = array_diff($excluded_terms, $term_array);
1888 1888
 
1889 1889
 			$inverse_terms = array();
1890
-			foreach ( $excluded_terms as $excluded_term )
1890
+			foreach ($excluded_terms as $excluded_term)
1891 1891
 				$inverse_terms[] = $excluded_term * -1;
1892 1892
 			$excluded_terms = $inverse_terms;
1893 1893
 		}
1894 1894
 
1895
-		$query_args[ 'tax_query' ] = array( array(
1895
+		$query_args['tax_query'] = array(array(
1896 1896
 			'taxonomy' => $taxonomy,
1897
-			'terms' => array_merge( $term_array, $excluded_terms )
1898
-		) );
1897
+			'terms' => array_merge($term_array, $excluded_terms)
1898
+		));
1899 1899
 	}
1900 1900
 
1901
-	return get_posts( $query_args );
1901
+	return get_posts($query_args);
1902 1902
 }
1903 1903
 
1904 1904
 /**
@@ -1913,8 +1913,8 @@  discard block
 block discarded – undo
1913 1913
  * @param string       $taxonomy       Optional. Taxonomy, if $in_same_term is true. Default 'category'.
1914 1914
  * @return string The link URL of the previous post in relation to the current post.
1915 1915
  */
1916
-function get_previous_post_link( $format = '&laquo; %link', $link = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
1917
-	return get_adjacent_post_link( $format, $link, $in_same_term, $excluded_terms, true, $taxonomy );
1916
+function get_previous_post_link($format = '&laquo; %link', $link = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category') {
1917
+	return get_adjacent_post_link($format, $link, $in_same_term, $excluded_terms, true, $taxonomy);
1918 1918
 }
1919 1919
 
1920 1920
 /**
@@ -1929,8 +1929,8 @@  discard block
 block discarded – undo
1929 1929
  * @param array|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
1930 1930
  * @param string       $taxonomy       Optional. Taxonomy, if $in_same_term is true. Default 'category'.
1931 1931
  */
1932
-function previous_post_link( $format = '&laquo; %link', $link = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
1933
-	echo get_previous_post_link( $format, $link, $in_same_term, $excluded_terms, $taxonomy );
1932
+function previous_post_link($format = '&laquo; %link', $link = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category') {
1933
+	echo get_previous_post_link($format, $link, $in_same_term, $excluded_terms, $taxonomy);
1934 1934
 }
1935 1935
 
1936 1936
 /**
@@ -1945,8 +1945,8 @@  discard block
 block discarded – undo
1945 1945
  * @param string       $taxonomy       Optional. Taxonomy, if $in_same_term is true. Default 'category'.
1946 1946
  * @return string The link URL of the next post in relation to the current post.
1947 1947
  */
1948
-function get_next_post_link( $format = '%link &raquo;', $link = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
1949
-	return get_adjacent_post_link( $format, $link, $in_same_term, $excluded_terms, false, $taxonomy );
1948
+function get_next_post_link($format = '%link &raquo;', $link = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category') {
1949
+	return get_adjacent_post_link($format, $link, $in_same_term, $excluded_terms, false, $taxonomy);
1950 1950
 }
1951 1951
 
1952 1952
 /**
@@ -1961,8 +1961,8 @@  discard block
 block discarded – undo
1961 1961
  * @param array|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
1962 1962
  * @param string       $taxonomy       Optional. Taxonomy, if $in_same_term is true. Default 'category'.
1963 1963
  */
1964
-function next_post_link( $format = '%link &raquo;', $link = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
1965
-	 echo get_next_post_link( $format, $link, $in_same_term, $excluded_terms, $taxonomy );
1964
+function next_post_link($format = '%link &raquo;', $link = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category') {
1965
+	 echo get_next_post_link($format, $link, $in_same_term, $excluded_terms, $taxonomy);
1966 1966
 }
1967 1967
 
1968 1968
 /**
@@ -1980,32 +1980,32 @@  discard block
 block discarded – undo
1980 1980
  * @param string       $taxonomy       Optional. Taxonomy, if $in_same_term is true. Default 'category'.
1981 1981
  * @return string The link URL of the previous or next post in relation to the current post.
1982 1982
  */
1983
-function get_adjacent_post_link( $format, $link, $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category' ) {
1984
-	if ( $previous && is_attachment() )
1985
-		$post = get_post( get_post()->post_parent );
1983
+function get_adjacent_post_link($format, $link, $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category') {
1984
+	if ($previous && is_attachment())
1985
+		$post = get_post(get_post()->post_parent);
1986 1986
 	else
1987
-		$post = get_adjacent_post( $in_same_term, $excluded_terms, $previous, $taxonomy );
1987
+		$post = get_adjacent_post($in_same_term, $excluded_terms, $previous, $taxonomy);
1988 1988
 
1989
-	if ( ! $post ) {
1989
+	if ( ! $post) {
1990 1990
 		$output = '';
1991 1991
 	} else {
1992 1992
 		$title = $post->post_title;
1993 1993
 
1994
-		if ( empty( $post->post_title ) )
1995
-			$title = $previous ? __( 'Previous Post' ) : __( 'Next Post' );
1994
+		if (empty($post->post_title))
1995
+			$title = $previous ? __('Previous Post') : __('Next Post');
1996 1996
 
1997 1997
 		/** This filter is documented in wp-includes/post-template.php */
1998
-		$title = apply_filters( 'the_title', $title, $post->ID );
1998
+		$title = apply_filters('the_title', $title, $post->ID);
1999 1999
 
2000
-		$date = mysql2date( get_option( 'date_format' ), $post->post_date );
2000
+		$date = mysql2date(get_option('date_format'), $post->post_date);
2001 2001
 		$rel = $previous ? 'prev' : 'next';
2002 2002
 
2003
-		$string = '<a href="' . get_permalink( $post ) . '" rel="'.$rel.'">';
2004
-		$inlink = str_replace( '%title', $title, $link );
2005
-		$inlink = str_replace( '%date', $date, $inlink );
2006
-		$inlink = $string . $inlink . '</a>';
2003
+		$string = '<a href="'.get_permalink($post).'" rel="'.$rel.'">';
2004
+		$inlink = str_replace('%title', $title, $link);
2005
+		$inlink = str_replace('%date', $date, $inlink);
2006
+		$inlink = $string.$inlink.'</a>';
2007 2007
 
2008
-		$output = str_replace( '%link', $inlink, $format );
2008
+		$output = str_replace('%link', $inlink, $format);
2009 2009
 	}
2010 2010
 
2011 2011
 	$adjacent = $previous ? 'previous' : 'next';
@@ -2025,7 +2025,7 @@  discard block
 block discarded – undo
2025 2025
 	 * @param WP_Post $post     The adjacent post.
2026 2026
 	 * @param string  $adjacent Whether the post is previous or next.
2027 2027
 	 */
2028
-	return apply_filters( "{$adjacent}_post_link", $output, $format, $link, $post, $adjacent );
2028
+	return apply_filters("{$adjacent}_post_link", $output, $format, $link, $post, $adjacent);
2029 2029
 }
2030 2030
 
2031 2031
 /**
@@ -2042,8 +2042,8 @@  discard block
 block discarded – undo
2042 2042
  * @param bool         $previous       Optional. Whether to display link to previous or next post. Default true.
2043 2043
  * @param string       $taxonomy       Optional. Taxonomy, if $in_same_term is true. Default 'category'.
2044 2044
  */
2045
-function adjacent_post_link( $format, $link, $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category' ) {
2046
-	echo get_adjacent_post_link( $format, $link, $in_same_term, $excluded_terms, $previous, $taxonomy );
2045
+function adjacent_post_link($format, $link, $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category') {
2046
+	echo get_adjacent_post_link($format, $link, $in_same_term, $excluded_terms, $previous, $taxonomy);
2047 2047
 }
2048 2048
 
2049 2049
 /**
@@ -2058,53 +2058,53 @@  discard block
 block discarded – undo
2058 2058
  * 	                    Otherwise, prepares the URL with esc_url_raw().
2059 2059
  * @return string The link URL for the given page number.
2060 2060
  */
2061
-function get_pagenum_link($pagenum = 1, $escape = true ) {
2061
+function get_pagenum_link($pagenum = 1, $escape = true) {
2062 2062
 	global $wp_rewrite;
2063 2063
 
2064 2064
 	$pagenum = (int) $pagenum;
2065 2065
 
2066
-	$request = remove_query_arg( 'paged' );
2066
+	$request = remove_query_arg('paged');
2067 2067
 
2068 2068
 	$home_root = parse_url(home_url());
2069
-	$home_root = ( isset($home_root['path']) ) ? $home_root['path'] : '';
2070
-	$home_root = preg_quote( $home_root, '|' );
2069
+	$home_root = (isset($home_root['path'])) ? $home_root['path'] : '';
2070
+	$home_root = preg_quote($home_root, '|');
2071 2071
 
2072
-	$request = preg_replace('|^'. $home_root . '|i', '', $request);
2072
+	$request = preg_replace('|^'.$home_root.'|i', '', $request);
2073 2073
 	$request = preg_replace('|^/+|', '', $request);
2074 2074
 
2075
-	if ( !$wp_rewrite->using_permalinks() || is_admin() ) {
2076
-		$base = trailingslashit( get_bloginfo( 'url' ) );
2075
+	if ( ! $wp_rewrite->using_permalinks() || is_admin()) {
2076
+		$base = trailingslashit(get_bloginfo('url'));
2077 2077
 
2078
-		if ( $pagenum > 1 ) {
2079
-			$result = add_query_arg( 'paged', $pagenum, $base . $request );
2078
+		if ($pagenum > 1) {
2079
+			$result = add_query_arg('paged', $pagenum, $base.$request);
2080 2080
 		} else {
2081
-			$result = $base . $request;
2081
+			$result = $base.$request;
2082 2082
 		}
2083 2083
 	} else {
2084 2084
 		$qs_regex = '|\?.*?$|';
2085
-		preg_match( $qs_regex, $request, $qs_match );
2085
+		preg_match($qs_regex, $request, $qs_match);
2086 2086
 
2087
-		if ( !empty( $qs_match[0] ) ) {
2087
+		if ( ! empty($qs_match[0])) {
2088 2088
 			$query_string = $qs_match[0];
2089
-			$request = preg_replace( $qs_regex, '', $request );
2089
+			$request = preg_replace($qs_regex, '', $request);
2090 2090
 		} else {
2091 2091
 			$query_string = '';
2092 2092
 		}
2093 2093
 
2094
-		$request = preg_replace( "|$wp_rewrite->pagination_base/\d+/?$|", '', $request);
2095
-		$request = preg_replace( '|^' . preg_quote( $wp_rewrite->index, '|' ) . '|i', '', $request);
2094
+		$request = preg_replace("|$wp_rewrite->pagination_base/\d+/?$|", '', $request);
2095
+		$request = preg_replace('|^'.preg_quote($wp_rewrite->index, '|').'|i', '', $request);
2096 2096
 		$request = ltrim($request, '/');
2097 2097
 
2098
-		$base = trailingslashit( get_bloginfo( 'url' ) );
2098
+		$base = trailingslashit(get_bloginfo('url'));
2099 2099
 
2100
-		if ( $wp_rewrite->using_index_permalinks() && ( $pagenum > 1 || '' != $request ) )
2101
-			$base .= $wp_rewrite->index . '/';
2100
+		if ($wp_rewrite->using_index_permalinks() && ($pagenum > 1 || '' != $request))
2101
+			$base .= $wp_rewrite->index.'/';
2102 2102
 
2103
-		if ( $pagenum > 1 ) {
2104
-			$request = ( ( !empty( $request ) ) ? trailingslashit( $request ) : $request ) . user_trailingslashit( $wp_rewrite->pagination_base . "/" . $pagenum, 'paged' );
2103
+		if ($pagenum > 1) {
2104
+			$request = (( ! empty($request)) ? trailingslashit($request) : $request).user_trailingslashit($wp_rewrite->pagination_base."/".$pagenum, 'paged');
2105 2105
 		}
2106 2106
 
2107
-		$result = $base . $request . $query_string;
2107
+		$result = $base.$request.$query_string;
2108 2108
 	}
2109 2109
 
2110 2110
 	/**
@@ -2114,12 +2114,12 @@  discard block
 block discarded – undo
2114 2114
 	 *
2115 2115
 	 * @param string $result The page number link.
2116 2116
 	 */
2117
-	$result = apply_filters( 'get_pagenum_link', $result );
2117
+	$result = apply_filters('get_pagenum_link', $result);
2118 2118
 
2119
-	if ( $escape )
2120
-		return esc_url( $result );
2119
+	if ($escape)
2120
+		return esc_url($result);
2121 2121
 	else
2122
-		return esc_url_raw( $result );
2122
+		return esc_url_raw($result);
2123 2123
 }
2124 2124
 
2125 2125
 /**
@@ -2137,11 +2137,11 @@  discard block
 block discarded – undo
2137 2137
 function get_next_posts_page_link($max_page = 0) {
2138 2138
 	global $paged;
2139 2139
 
2140
-	if ( !is_single() ) {
2141
-		if ( !$paged )
2140
+	if ( ! is_single()) {
2141
+		if ( ! $paged)
2142 2142
 			$paged = 1;
2143 2143
 		$nextpage = intval($paged) + 1;
2144
-		if ( !$max_page || $max_page >= $nextpage )
2144
+		if ( ! $max_page || $max_page >= $nextpage)
2145 2145
 			return get_pagenum_link($nextpage);
2146 2146
 	}
2147 2147
 }
@@ -2155,10 +2155,10 @@  discard block
 block discarded – undo
2155 2155
  * @param bool  $echo     Optional. Echo or return;
2156 2156
  * @return string|void The link URL for next posts page if `$echo = false`.
2157 2157
  */
2158
-function next_posts( $max_page = 0, $echo = true ) {
2159
-	$output = esc_url( get_next_posts_page_link( $max_page ) );
2158
+function next_posts($max_page = 0, $echo = true) {
2159
+	$output = esc_url(get_next_posts_page_link($max_page));
2160 2160
 
2161
-	if ( $echo )
2161
+	if ($echo)
2162 2162
 		echo $output;
2163 2163
 	else
2164 2164
 		return $output;
@@ -2176,21 +2176,21 @@  discard block
 block discarded – undo
2176 2176
  * @param int    $max_page Optional. Max pages.
2177 2177
  * @return string|void HTML-formatted next posts page link.
2178 2178
  */
2179
-function get_next_posts_link( $label = null, $max_page = 0 ) {
2179
+function get_next_posts_link($label = null, $max_page = 0) {
2180 2180
 	global $paged, $wp_query;
2181 2181
 
2182
-	if ( !$max_page )
2182
+	if ( ! $max_page)
2183 2183
 		$max_page = $wp_query->max_num_pages;
2184 2184
 
2185
-	if ( !$paged )
2185
+	if ( ! $paged)
2186 2186
 		$paged = 1;
2187 2187
 
2188 2188
 	$nextpage = intval($paged) + 1;
2189 2189
 
2190
-	if ( null === $label )
2191
-		$label = __( 'Next Page &raquo;' );
2190
+	if (null === $label)
2191
+		$label = __('Next Page &raquo;');
2192 2192
 
2193
-	if ( !is_single() && ( $nextpage <= $max_page ) ) {
2193
+	if ( ! is_single() && ($nextpage <= $max_page)) {
2194 2194
 		/**
2195 2195
 		 * Filter the anchor tag attributes for the next posts page link.
2196 2196
 		 *
@@ -2198,9 +2198,9 @@  discard block
 block discarded – undo
2198 2198
 		 *
2199 2199
 		 * @param string $attributes Attributes for the anchor tag.
2200 2200
 		 */
2201
-		$attr = apply_filters( 'next_posts_link_attributes', '' );
2201
+		$attr = apply_filters('next_posts_link_attributes', '');
2202 2202
 
2203
-		return '<a href="' . next_posts( $max_page, false ) . "\" $attr>" . preg_replace('/&([^#])(?![a-z]{1,8};)/i', '&#038;$1', $label) . '</a>';
2203
+		return '<a href="'.next_posts($max_page, false)."\" $attr>".preg_replace('/&([^#])(?![a-z]{1,8};)/i', '&#038;$1', $label).'</a>';
2204 2204
 	}
2205 2205
 }
2206 2206
 
@@ -2212,8 +2212,8 @@  discard block
 block discarded – undo
2212 2212
  * @param string $label    Content for link text.
2213 2213
  * @param int    $max_page Optional. Max pages.
2214 2214
  */
2215
-function next_posts_link( $label = null, $max_page = 0 ) {
2216
-	echo get_next_posts_link( $label, $max_page );
2215
+function next_posts_link($label = null, $max_page = 0) {
2216
+	echo get_next_posts_link($label, $max_page);
2217 2217
 }
2218 2218
 
2219 2219
 /**
@@ -2232,9 +2232,9 @@  discard block
 block discarded – undo
2232 2232
 function get_previous_posts_page_link() {
2233 2233
 	global $paged;
2234 2234
 
2235
-	if ( !is_single() ) {
2235
+	if ( ! is_single()) {
2236 2236
 		$nextpage = intval($paged) - 1;
2237
-		if ( $nextpage < 1 )
2237
+		if ($nextpage < 1)
2238 2238
 			$nextpage = 1;
2239 2239
 		return get_pagenum_link($nextpage);
2240 2240
 	}
@@ -2248,10 +2248,10 @@  discard block
 block discarded – undo
2248 2248
  * @param bool $echo Optional. Echo or return;
2249 2249
  * @return string|void The previous posts page link if `$echo = false`.
2250 2250
  */
2251
-function previous_posts( $echo = true ) {
2252
-	$output = esc_url( get_previous_posts_page_link() );
2251
+function previous_posts($echo = true) {
2252
+	$output = esc_url(get_previous_posts_page_link());
2253 2253
 
2254
-	if ( $echo )
2254
+	if ($echo)
2255 2255
 		echo $output;
2256 2256
 	else
2257 2257
 		return $output;
@@ -2267,13 +2267,13 @@  discard block
 block discarded – undo
2267 2267
  * @param string $label Optional. Previous page link text.
2268 2268
  * @return string|void HTML-formatted previous page link.
2269 2269
  */
2270
-function get_previous_posts_link( $label = null ) {
2270
+function get_previous_posts_link($label = null) {
2271 2271
 	global $paged;
2272 2272
 
2273
-	if ( null === $label )
2274
-		$label = __( '&laquo; Previous Page' );
2273
+	if (null === $label)
2274
+		$label = __('&laquo; Previous Page');
2275 2275
 
2276
-	if ( !is_single() && $paged > 1 ) {
2276
+	if ( ! is_single() && $paged > 1) {
2277 2277
 		/**
2278 2278
 		 * Filter the anchor tag attributes for the previous posts page link.
2279 2279
 		 *
@@ -2281,8 +2281,8 @@  discard block
 block discarded – undo
2281 2281
 		 *
2282 2282
 		 * @param string $attributes Attributes for the anchor tag.
2283 2283
 		 */
2284
-		$attr = apply_filters( 'previous_posts_link_attributes', '' );
2285
-		return '<a href="' . previous_posts( false ) . "\" $attr>". preg_replace( '/&([^#])(?![a-z]{1,8};)/i', '&#038;$1', $label ) .'</a>';
2284
+		$attr = apply_filters('previous_posts_link_attributes', '');
2285
+		return '<a href="'.previous_posts(false)."\" $attr>".preg_replace('/&([^#])(?![a-z]{1,8};)/i', '&#038;$1', $label).'</a>';
2286 2286
 	}
2287 2287
 }
2288 2288
 
@@ -2293,8 +2293,8 @@  discard block
 block discarded – undo
2293 2293
  *
2294 2294
  * @param string $label Optional. Previous page link text.
2295 2295
  */
2296
-function previous_posts_link( $label = null ) {
2297
-	echo get_previous_posts_link( $label );
2296
+function previous_posts_link($label = null) {
2297
+	echo get_previous_posts_link($label);
2298 2298
 }
2299 2299
 
2300 2300
 /**
@@ -2307,18 +2307,18 @@  discard block
 block discarded – undo
2307 2307
  * @param string|array $args Optional args.
2308 2308
  * @return string The posts link navigation.
2309 2309
  */
2310
-function get_posts_nav_link( $args = array() ) {
2310
+function get_posts_nav_link($args = array()) {
2311 2311
 	global $wp_query;
2312 2312
 
2313 2313
 	$return = '';
2314 2314
 
2315
-	if ( !is_singular() ) {
2315
+	if ( ! is_singular()) {
2316 2316
 		$defaults = array(
2317 2317
 			'sep' => ' &#8212; ',
2318 2318
 			'prelabel' => __('&laquo; Previous Page'),
2319 2319
 			'nxtlabel' => __('Next Page &raquo;'),
2320 2320
 		);
2321
-		$args = wp_parse_args( $args, $defaults );
2321
+		$args = wp_parse_args($args, $defaults);
2322 2322
 
2323 2323
 		$max_num_pages = $wp_query->max_num_pages;
2324 2324
 		$paged = get_query_var('paged');
@@ -2328,7 +2328,7 @@  discard block
 block discarded – undo
2328 2328
 			$args['sep'] = '';
2329 2329
 		}
2330 2330
 
2331
-		if ( $max_num_pages > 1 ) {
2331
+		if ($max_num_pages > 1) {
2332 2332
 			$return = get_previous_posts_link($args['prelabel']);
2333 2333
 			$return .= preg_replace('/&([^#])(?![a-z]{1,8};)/i', '&#038;$1', $args['sep']);
2334 2334
 			$return .= get_next_posts_link($args['nxtlabel']);
@@ -2347,8 +2347,8 @@  discard block
 block discarded – undo
2347 2347
  * @param string $prelabel Optional. Label for previous pages.
2348 2348
  * @param string $nxtlabel Optional Label for next pages.
2349 2349
  */
2350
-function posts_nav_link( $sep = '', $prelabel = '', $nxtlabel = '' ) {
2351
-	$args = array_filter( compact('sep', 'prelabel', 'nxtlabel') );
2350
+function posts_nav_link($sep = '', $prelabel = '', $nxtlabel = '') {
2351
+	$args = array_filter(compact('sep', 'prelabel', 'nxtlabel'));
2352 2352
 	echo get_posts_nav_link($args);
2353 2353
 }
2354 2354
 
@@ -2370,15 +2370,15 @@  discard block
 block discarded – undo
2370 2370
  * }
2371 2371
  * @return string Markup for post links.
2372 2372
  */
2373
-function get_the_post_navigation( $args = array() ) {
2374
-	$args = wp_parse_args( $args, array(
2373
+function get_the_post_navigation($args = array()) {
2374
+	$args = wp_parse_args($args, array(
2375 2375
 		'prev_text'          => '%title',
2376 2376
 		'next_text'          => '%title',
2377 2377
 		'in_same_term'       => false,
2378 2378
 		'excluded_terms'     => '',
2379 2379
 		'taxonomy'           => 'category',
2380
-		'screen_reader_text' => __( 'Post navigation' ),
2381
-	) );
2380
+		'screen_reader_text' => __('Post navigation'),
2381
+	));
2382 2382
 
2383 2383
 	$navigation = '';
2384 2384
 
@@ -2399,8 +2399,8 @@  discard block
 block discarded – undo
2399 2399
 	);
2400 2400
 
2401 2401
 	// Only add markup if there's somewhere to navigate to.
2402
-	if ( $previous || $next ) {
2403
-		$navigation = _navigation_markup( $previous . $next, 'post-navigation', $args['screen_reader_text'] );
2402
+	if ($previous || $next) {
2403
+		$navigation = _navigation_markup($previous.$next, 'post-navigation', $args['screen_reader_text']);
2404 2404
 	}
2405 2405
 
2406 2406
 	return $navigation;
@@ -2414,8 +2414,8 @@  discard block
 block discarded – undo
2414 2414
  * @param array $args Optional. See {@see get_the_post_navigation()} for available
2415 2415
  *                    arguments. Default empty array.
2416 2416
  */
2417
-function the_post_navigation( $args = array() ) {
2418
-	echo get_the_post_navigation( $args );
2417
+function the_post_navigation($args = array()) {
2418
+	echo get_the_post_navigation($args);
2419 2419
 }
2420 2420
 
2421 2421
 /**
@@ -2437,29 +2437,29 @@  discard block
 block discarded – undo
2437 2437
  * }
2438 2438
  * @return string Markup for posts links.
2439 2439
  */
2440
-function get_the_posts_navigation( $args = array() ) {
2440
+function get_the_posts_navigation($args = array()) {
2441 2441
 	$navigation = '';
2442 2442
 
2443 2443
 	// Don't print empty markup if there's only one page.
2444
-	if ( $GLOBALS['wp_query']->max_num_pages > 1 ) {
2445
-		$args = wp_parse_args( $args, array(
2446
-			'prev_text'          => __( 'Older posts' ),
2447
-			'next_text'          => __( 'Newer posts' ),
2448
-			'screen_reader_text' => __( 'Posts navigation' ),
2449
-		) );
2450
-
2451
-		$next_link = get_previous_posts_link( $args['next_text'] );
2452
-		$prev_link = get_next_posts_link( $args['prev_text'] );
2453
-
2454
-		if ( $prev_link ) {
2455
-			$navigation .= '<div class="nav-previous">' . $prev_link . '</div>';
2444
+	if ($GLOBALS['wp_query']->max_num_pages > 1) {
2445
+		$args = wp_parse_args($args, array(
2446
+			'prev_text'          => __('Older posts'),
2447
+			'next_text'          => __('Newer posts'),
2448
+			'screen_reader_text' => __('Posts navigation'),
2449
+		));
2450
+
2451
+		$next_link = get_previous_posts_link($args['next_text']);
2452
+		$prev_link = get_next_posts_link($args['prev_text']);
2453
+
2454
+		if ($prev_link) {
2455
+			$navigation .= '<div class="nav-previous">'.$prev_link.'</div>';
2456 2456
 		}
2457 2457
 
2458
-		if ( $next_link ) {
2459
-			$navigation .= '<div class="nav-next">' . $next_link . '</div>';
2458
+		if ($next_link) {
2459
+			$navigation .= '<div class="nav-next">'.$next_link.'</div>';
2460 2460
 		}
2461 2461
 
2462
-		$navigation = _navigation_markup( $navigation, 'posts-navigation', $args['screen_reader_text'] );
2462
+		$navigation = _navigation_markup($navigation, 'posts-navigation', $args['screen_reader_text']);
2463 2463
 	}
2464 2464
 
2465 2465
 	return $navigation;
@@ -2473,8 +2473,8 @@  discard block
 block discarded – undo
2473 2473
  * @param array $args Optional. See {@see get_the_posts_navigation()} for available
2474 2474
  *                    arguments. Default empty array.
2475 2475
  */
2476
-function the_posts_navigation( $args = array() ) {
2477
-	echo get_the_posts_navigation( $args );
2476
+function the_posts_navigation($args = array()) {
2477
+	echo get_the_posts_navigation($args);
2478 2478
 }
2479 2479
 
2480 2480
 /**
@@ -2491,28 +2491,28 @@  discard block
 block discarded – undo
2491 2491
  * }
2492 2492
  * @return string Markup for pagination links.
2493 2493
  */
2494
-function get_the_posts_pagination( $args = array() ) {
2494
+function get_the_posts_pagination($args = array()) {
2495 2495
 	$navigation = '';
2496 2496
 
2497 2497
 	// Don't print empty markup if there's only one page.
2498
-	if ( $GLOBALS['wp_query']->max_num_pages > 1 ) {
2499
-		$args = wp_parse_args( $args, array(
2498
+	if ($GLOBALS['wp_query']->max_num_pages > 1) {
2499
+		$args = wp_parse_args($args, array(
2500 2500
 			'mid_size'           => 1,
2501
-			'prev_text'          => _x( 'Previous', 'previous post' ),
2502
-			'next_text'          => _x( 'Next', 'next post' ),
2503
-			'screen_reader_text' => __( 'Posts navigation' ),
2504
-		) );
2501
+			'prev_text'          => _x('Previous', 'previous post'),
2502
+			'next_text'          => _x('Next', 'next post'),
2503
+			'screen_reader_text' => __('Posts navigation'),
2504
+		));
2505 2505
 
2506 2506
 		// Make sure we get a string back. Plain is the next best thing.
2507
-		if ( isset( $args['type'] ) && 'array' == $args['type'] ) {
2507
+		if (isset($args['type']) && 'array' == $args['type']) {
2508 2508
 			$args['type'] = 'plain';
2509 2509
 		}
2510 2510
 
2511 2511
 		// Set up paginated links.
2512
-		$links = paginate_links( $args );
2512
+		$links = paginate_links($args);
2513 2513
 
2514
-		if ( $links ) {
2515
-			$navigation = _navigation_markup( $links, 'pagination', $args['screen_reader_text'] );
2514
+		if ($links) {
2515
+			$navigation = _navigation_markup($links, 'pagination', $args['screen_reader_text']);
2516 2516
 		}
2517 2517
 	}
2518 2518
 
@@ -2528,8 +2528,8 @@  discard block
 block discarded – undo
2528 2528
  * @param array $args Optional. See {@see get_the_posts_pagination()} for available arguments.
2529 2529
  *                    Default empty array.
2530 2530
  */
2531
-function the_posts_pagination( $args = array() ) {
2532
-	echo get_the_posts_pagination( $args );
2531
+function the_posts_pagination($args = array()) {
2532
+	echo get_the_posts_pagination($args);
2533 2533
 }
2534 2534
 
2535 2535
 /**
@@ -2543,9 +2543,9 @@  discard block
 block discarded – undo
2543 2543
  * @param string $screen_reader_text Optional. Screen reader text for nav element. Default: 'Posts navigation'.
2544 2544
  * @return string Navigation template tag.
2545 2545
  */
2546
-function _navigation_markup( $links, $class = 'posts-navigation', $screen_reader_text = '' ) {
2547
-	if ( empty( $screen_reader_text ) ) {
2548
-		$screen_reader_text = __( 'Posts navigation' );
2546
+function _navigation_markup($links, $class = 'posts-navigation', $screen_reader_text = '') {
2547
+	if (empty($screen_reader_text)) {
2548
+		$screen_reader_text = __('Posts navigation');
2549 2549
 	}
2550 2550
 
2551 2551
 	$template = '
@@ -2572,9 +2572,9 @@  discard block
 block discarded – undo
2572 2572
 	 * @param string $class    The class passed by the calling function.
2573 2573
 	 * @return string Navigation template.
2574 2574
 	 */
2575
-	$template = apply_filters( 'navigation_markup_template', $template, $class );
2575
+	$template = apply_filters('navigation_markup_template', $template, $class);
2576 2576
 
2577
-	return sprintf( $template, sanitize_html_class( $class ), esc_html( $screen_reader_text ), $links );
2577
+	return sprintf($template, sanitize_html_class($class), esc_html($screen_reader_text), $links);
2578 2578
 }
2579 2579
 
2580 2580
 /**
@@ -2588,25 +2588,25 @@  discard block
 block discarded – undo
2588 2588
  * @param int $max_page Optional. The maximum number of comment pages.
2589 2589
  * @return string The comments page number link URL.
2590 2590
  */
2591
-function get_comments_pagenum_link( $pagenum = 1, $max_page = 0 ) {
2591
+function get_comments_pagenum_link($pagenum = 1, $max_page = 0) {
2592 2592
 	global $wp_rewrite;
2593 2593
 
2594 2594
 	$pagenum = (int) $pagenum;
2595 2595
 
2596 2596
 	$result = get_permalink();
2597 2597
 
2598
-	if ( 'newest' == get_option('default_comments_page') ) {
2599
-		if ( $pagenum != $max_page ) {
2600
-			if ( $wp_rewrite->using_permalinks() )
2601
-				$result = user_trailingslashit( trailingslashit($result) . $wp_rewrite->comments_pagination_base . '-' . $pagenum, 'commentpaged');
2598
+	if ('newest' == get_option('default_comments_page')) {
2599
+		if ($pagenum != $max_page) {
2600
+			if ($wp_rewrite->using_permalinks())
2601
+				$result = user_trailingslashit(trailingslashit($result).$wp_rewrite->comments_pagination_base.'-'.$pagenum, 'commentpaged');
2602 2602
 			else
2603
-				$result = add_query_arg( 'cpage', $pagenum, $result );
2603
+				$result = add_query_arg('cpage', $pagenum, $result);
2604 2604
 		}
2605
-	} elseif ( $pagenum > 1 ) {
2606
-		if ( $wp_rewrite->using_permalinks() )
2607
-			$result = user_trailingslashit( trailingslashit($result) . $wp_rewrite->comments_pagination_base . '-' . $pagenum, 'commentpaged');
2605
+	} elseif ($pagenum > 1) {
2606
+		if ($wp_rewrite->using_permalinks())
2607
+			$result = user_trailingslashit(trailingslashit($result).$wp_rewrite->comments_pagination_base.'-'.$pagenum, 'commentpaged');
2608 2608
 		else
2609
-			$result = add_query_arg( 'cpage', $pagenum, $result );
2609
+			$result = add_query_arg('cpage', $pagenum, $result);
2610 2610
 	}
2611 2611
 
2612 2612
 	$result .= '#comments';
@@ -2618,7 +2618,7 @@  discard block
 block discarded – undo
2618 2618
 	 *
2619 2619
 	 * @param string $result The comments page number link.
2620 2620
 	 */
2621
-	return apply_filters( 'get_comments_pagenum_link', $result );
2621
+	return apply_filters('get_comments_pagenum_link', $result);
2622 2622
 }
2623 2623
 
2624 2624
 /**
@@ -2632,30 +2632,30 @@  discard block
 block discarded – undo
2632 2632
  * @param int    $max_page Optional. Max page.
2633 2633
  * @return string|void HTML-formatted link for the next page of comments.
2634 2634
  */
2635
-function get_next_comments_link( $label = '', $max_page = 0 ) {
2635
+function get_next_comments_link($label = '', $max_page = 0) {
2636 2636
 	global $wp_query;
2637 2637
 
2638
-	if ( ! is_singular() )
2638
+	if ( ! is_singular())
2639 2639
 		return;
2640 2640
 
2641 2641
 	$page = get_query_var('cpage');
2642 2642
 
2643
-	if ( ! $page ) {
2643
+	if ( ! $page) {
2644 2644
 		$page = 1;
2645 2645
 	}
2646 2646
 
2647 2647
 	$nextpage = intval($page) + 1;
2648 2648
 
2649
-	if ( empty($max_page) )
2649
+	if (empty($max_page))
2650 2650
 		$max_page = $wp_query->max_num_comment_pages;
2651 2651
 
2652
-	if ( empty($max_page) )
2652
+	if (empty($max_page))
2653 2653
 		$max_page = get_comment_pages_count();
2654 2654
 
2655
-	if ( $nextpage > $max_page )
2655
+	if ($nextpage > $max_page)
2656 2656
 		return;
2657 2657
 
2658
-	if ( empty($label) )
2658
+	if (empty($label))
2659 2659
 		$label = __('Newer Comments &raquo;');
2660 2660
 
2661 2661
 	/**
@@ -2665,7 +2665,7 @@  discard block
 block discarded – undo
2665 2665
 	 *
2666 2666
 	 * @param string $attributes Attributes for the anchor tag.
2667 2667
 	 */
2668
-	return '<a href="' . esc_url( get_comments_pagenum_link( $nextpage, $max_page ) ) . '" ' . apply_filters( 'next_comments_link_attributes', '' ) . '>'. preg_replace('/&([^#])(?![a-z]{1,8};)/i', '&#038;$1', $label) .'</a>';
2668
+	return '<a href="'.esc_url(get_comments_pagenum_link($nextpage, $max_page)).'" '.apply_filters('next_comments_link_attributes', '').'>'.preg_replace('/&([^#])(?![a-z]{1,8};)/i', '&#038;$1', $label).'</a>';
2669 2669
 }
2670 2670
 
2671 2671
 /**
@@ -2676,8 +2676,8 @@  discard block
 block discarded – undo
2676 2676
  * @param string $label    Optional. Label for link text.
2677 2677
  * @param int    $max_page Optional. Max page.
2678 2678
  */
2679
-function next_comments_link( $label = '', $max_page = 0 ) {
2680
-	echo get_next_comments_link( $label, $max_page );
2679
+function next_comments_link($label = '', $max_page = 0) {
2680
+	echo get_next_comments_link($label, $max_page);
2681 2681
 }
2682 2682
 
2683 2683
 /**
@@ -2688,18 +2688,18 @@  discard block
 block discarded – undo
2688 2688
  * @param string $label Optional. Label for comments link text.
2689 2689
  * @return string|void HTML-formatted link for the previous page of comments.
2690 2690
  */
2691
-function get_previous_comments_link( $label = '' ) {
2692
-	if ( ! is_singular() )
2691
+function get_previous_comments_link($label = '') {
2692
+	if ( ! is_singular())
2693 2693
 		return;
2694 2694
 
2695 2695
 	$page = get_query_var('cpage');
2696 2696
 
2697
-	if ( intval($page) <= 1 )
2697
+	if (intval($page) <= 1)
2698 2698
 		return;
2699 2699
 
2700 2700
 	$prevpage = intval($page) - 1;
2701 2701
 
2702
-	if ( empty($label) )
2702
+	if (empty($label))
2703 2703
 		$label = __('&laquo; Older Comments');
2704 2704
 
2705 2705
 	/**
@@ -2709,7 +2709,7 @@  discard block
 block discarded – undo
2709 2709
 	 *
2710 2710
 	 * @param string $attributes Attributes for the anchor tag.
2711 2711
 	 */
2712
-	return '<a href="' . esc_url( get_comments_pagenum_link( $prevpage ) ) . '" ' . apply_filters( 'previous_comments_link_attributes', '' ) . '>' . preg_replace('/&([^#])(?![a-z]{1,8};)/i', '&#038;$1', $label) .'</a>';
2712
+	return '<a href="'.esc_url(get_comments_pagenum_link($prevpage)).'" '.apply_filters('previous_comments_link_attributes', '').'>'.preg_replace('/&([^#])(?![a-z]{1,8};)/i', '&#038;$1', $label).'</a>';
2713 2713
 }
2714 2714
 
2715 2715
 /**
@@ -2719,8 +2719,8 @@  discard block
 block discarded – undo
2719 2719
  *
2720 2720
  * @param string $label Optional. Label for comments link text.
2721 2721
  */
2722
-function previous_comments_link( $label = '' ) {
2723
-	echo get_previous_comments_link( $label );
2722
+function previous_comments_link($label = '') {
2723
+	echo get_previous_comments_link($label);
2724 2724
 }
2725 2725
 
2726 2726
 /**
@@ -2737,28 +2737,28 @@  discard block
 block discarded – undo
2737 2737
 function paginate_comments_links($args = array()) {
2738 2738
 	global $wp_rewrite;
2739 2739
 
2740
-	if ( ! is_singular() )
2740
+	if ( ! is_singular())
2741 2741
 		return;
2742 2742
 
2743 2743
 	$page = get_query_var('cpage');
2744
-	if ( !$page )
2744
+	if ( ! $page)
2745 2745
 		$page = 1;
2746 2746
 	$max_page = get_comment_pages_count();
2747 2747
 	$defaults = array(
2748
-		'base' => add_query_arg( 'cpage', '%#%' ),
2748
+		'base' => add_query_arg('cpage', '%#%'),
2749 2749
 		'format' => '',
2750 2750
 		'total' => $max_page,
2751 2751
 		'current' => $page,
2752 2752
 		'echo' => true,
2753 2753
 		'add_fragment' => '#comments'
2754 2754
 	);
2755
-	if ( $wp_rewrite->using_permalinks() )
2756
-		$defaults['base'] = user_trailingslashit(trailingslashit(get_permalink()) . $wp_rewrite->comments_pagination_base . '-%#%', 'commentpaged');
2755
+	if ($wp_rewrite->using_permalinks())
2756
+		$defaults['base'] = user_trailingslashit(trailingslashit(get_permalink()).$wp_rewrite->comments_pagination_base.'-%#%', 'commentpaged');
2757 2757
 
2758
-	$args = wp_parse_args( $args, $defaults );
2759
-	$page_links = paginate_links( $args );
2758
+	$args = wp_parse_args($args, $defaults);
2759
+	$page_links = paginate_links($args);
2760 2760
 
2761
-	if ( $args['echo'] )
2761
+	if ($args['echo'])
2762 2762
 		echo $page_links;
2763 2763
 	else
2764 2764
 		return $page_links;
@@ -2778,29 +2778,29 @@  discard block
 block discarded – undo
2778 2778
  * }
2779 2779
  * @return string Markup for comments links.
2780 2780
  */
2781
-function get_the_comments_navigation( $args = array() ) {
2781
+function get_the_comments_navigation($args = array()) {
2782 2782
 	$navigation = '';
2783 2783
 
2784 2784
 	// Are there comments to navigate through?
2785
-	if ( get_comment_pages_count() > 1 ) {
2786
-		$args = wp_parse_args( $args, array(
2787
-			'prev_text'          => __( 'Older comments' ),
2788
-			'next_text'          => __( 'Newer comments' ),
2789
-			'screen_reader_text' => __( 'Comments navigation' ),
2790
-		) );
2791
-
2792
-		$prev_link = get_previous_comments_link( $args['prev_text'] );
2793
-		$next_link = get_next_comments_link( $args['next_text'] );
2794
-
2795
-		if ( $prev_link ) {
2796
-			$navigation .= '<div class="nav-previous">' . $prev_link . '</div>';
2785
+	if (get_comment_pages_count() > 1) {
2786
+		$args = wp_parse_args($args, array(
2787
+			'prev_text'          => __('Older comments'),
2788
+			'next_text'          => __('Newer comments'),
2789
+			'screen_reader_text' => __('Comments navigation'),
2790
+		));
2791
+
2792
+		$prev_link = get_previous_comments_link($args['prev_text']);
2793
+		$next_link = get_next_comments_link($args['next_text']);
2794
+
2795
+		if ($prev_link) {
2796
+			$navigation .= '<div class="nav-previous">'.$prev_link.'</div>';
2797 2797
 		}
2798 2798
 
2799
-		if ( $next_link ) {
2800
-			$navigation .= '<div class="nav-next">' . $next_link . '</div>';
2799
+		if ($next_link) {
2800
+			$navigation .= '<div class="nav-next">'.$next_link.'</div>';
2801 2801
 		}
2802 2802
 
2803
-		$navigation = _navigation_markup( $navigation, 'comment-navigation', $args['screen_reader_text'] );
2803
+		$navigation = _navigation_markup($navigation, 'comment-navigation', $args['screen_reader_text']);
2804 2804
 	}
2805 2805
 
2806 2806
 	return $navigation;
@@ -2813,8 +2813,8 @@  discard block
 block discarded – undo
2813 2813
  *
2814 2814
  * @param array $args See {@see get_the_comments_navigation()} for available arguments.
2815 2815
  */
2816
-function the_comments_navigation( $args = array() ) {
2817
-	echo get_the_comments_navigation( $args );
2816
+function the_comments_navigation($args = array()) {
2817
+	echo get_the_comments_navigation($args);
2818 2818
 }
2819 2819
 
2820 2820
 /**
@@ -2832,20 +2832,20 @@  discard block
 block discarded – undo
2832 2832
  * }
2833 2833
  * @return string Markup for pagination links.
2834 2834
  */
2835
-function get_the_comments_pagination( $args = array() ) {
2835
+function get_the_comments_pagination($args = array()) {
2836 2836
 	$navigation = '';
2837
-	$args       = wp_parse_args( $args, array(
2838
-		'screen_reader_text' => __( 'Comments navigation' ),
2839
-	) );
2837
+	$args       = wp_parse_args($args, array(
2838
+		'screen_reader_text' => __('Comments navigation'),
2839
+	));
2840 2840
 	$args['echo'] = false;
2841 2841
 
2842 2842
 	// Make sure we get plain links, so we get a string we can work with.
2843 2843
 	$args['type'] = 'plain';
2844 2844
 
2845
-	$links = paginate_comments_links( $args );
2845
+	$links = paginate_comments_links($args);
2846 2846
 
2847
-	if ( $links ) {
2848
-		$navigation = _navigation_markup( $links, 'comments-pagination', $args['screen_reader_text'] );
2847
+	if ($links) {
2848
+		$navigation = _navigation_markup($links, 'comments-pagination', $args['screen_reader_text']);
2849 2849
 	}
2850 2850
 
2851 2851
 	return $navigation;
@@ -2859,8 +2859,8 @@  discard block
 block discarded – undo
2859 2859
  *
2860 2860
  * @param array $args See {@see get_the_comments_pagination()} for available arguments.
2861 2861
  */
2862
-function the_comments_pagination( $args = array() ) {
2863
-	echo get_the_comments_pagination( $args );
2862
+function the_comments_pagination($args = array()) {
2863
+	echo get_the_comments_pagination($args);
2864 2864
 }
2865 2865
 
2866 2866
 /**
@@ -2879,11 +2879,11 @@  discard block
 block discarded – undo
2879 2879
 function get_shortcut_link() {
2880 2880
 	global $is_IE, $wp_version;
2881 2881
 
2882
-	include_once( ABSPATH . 'wp-admin/includes/class-wp-press-this.php' );
2882
+	include_once(ABSPATH.'wp-admin/includes/class-wp-press-this.php');
2883 2883
 	$bookmarklet_version = $GLOBALS['wp_press_this']->version;
2884 2884
 	$link = '';
2885 2885
 
2886
-	if ( $is_IE ) {
2886
+	if ($is_IE) {
2887 2887
 		/**
2888 2888
 		 * Return the old/shorter bookmarklet code for MSIE 8 and lower,
2889 2889
 		 * since they only support a max length of ~2000 characters for
@@ -2893,27 +2893,27 @@  discard block
 block discarded – undo
2893 2893
 		 */
2894 2894
 		$ua = $_SERVER['HTTP_USER_AGENT'];
2895 2895
 
2896
-		if ( ! empty( $ua ) && preg_match( '/\bMSIE (\d)/', $ua, $matches ) && (int) $matches[1] <= 8 ) {
2897
-			$url = wp_json_encode( admin_url( 'press-this.php' ) );
2896
+		if ( ! empty($ua) && preg_match('/\bMSIE (\d)/', $ua, $matches) && (int) $matches[1] <= 8) {
2897
+			$url = wp_json_encode(admin_url('press-this.php'));
2898 2898
 
2899
-			$link = 'javascript:var d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,' .
2900
-				's=(e?e():(k)?k():(x?x.createRange().text:0)),f=' . $url . ',l=d.location,e=encodeURIComponent,' .
2901
-				'u=f+"?u="+e(l.href)+"&t="+e(d.title)+"&s="+e(s)+"&v=' . $bookmarklet_version . '";' .
2902
-				'a=function(){if(!w.open(u,"t","toolbar=0,resizable=1,scrollbars=1,status=1,width=600,height=700"))l.href=u;};' .
2899
+			$link = 'javascript:var d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,'.
2900
+				's=(e?e():(k)?k():(x?x.createRange().text:0)),f='.$url.',l=d.location,e=encodeURIComponent,'.
2901
+				'u=f+"?u="+e(l.href)+"&t="+e(d.title)+"&s="+e(s)+"&v='.$bookmarklet_version.'";'.
2902
+				'a=function(){if(!w.open(u,"t","toolbar=0,resizable=1,scrollbars=1,status=1,width=600,height=700"))l.href=u;};'.
2903 2903
 				'if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else a();void(0)';
2904 2904
 		}
2905 2905
 	}
2906 2906
 
2907
-	if ( empty( $link ) ) {
2908
-		$src = @file_get_contents( ABSPATH . 'wp-admin/js/bookmarklet.min.js' );
2907
+	if (empty($link)) {
2908
+		$src = @file_get_contents(ABSPATH.'wp-admin/js/bookmarklet.min.js');
2909 2909
 
2910
-		if ( $src ) {
2911
-			$url = wp_json_encode( admin_url( 'press-this.php' ) . '?v=' . $bookmarklet_version );
2912
-			$link = 'javascript:' . str_replace( 'window.pt_url', $url, $src );
2910
+		if ($src) {
2911
+			$url = wp_json_encode(admin_url('press-this.php').'?v='.$bookmarklet_version);
2912
+			$link = 'javascript:'.str_replace('window.pt_url', $url, $src);
2913 2913
 		}
2914 2914
 	}
2915 2915
 
2916
-	$link = str_replace( array( "\r", "\n", "\t" ),  '', $link );
2916
+	$link = str_replace(array("\r", "\n", "\t"), '', $link);
2917 2917
 
2918 2918
 	/**
2919 2919
 	 * Filter the Press This bookmarklet link.
@@ -2922,7 +2922,7 @@  discard block
 block discarded – undo
2922 2922
 	 *
2923 2923
 	 * @param string $link The Press This bookmarklet link.
2924 2924
 	 */
2925
-	return apply_filters( 'shortcut_link', $link );
2925
+	return apply_filters('shortcut_link', $link);
2926 2926
 }
2927 2927
 
2928 2928
 /**
@@ -2939,8 +2939,8 @@  discard block
 block discarded – undo
2939 2939
  *                             'http', 'https', 'relative', 'rest', or null. Default null.
2940 2940
  * @return string Home url link with optional path appended.
2941 2941
  */
2942
-function home_url( $path = '', $scheme = null ) {
2943
-	return get_home_url( null, $path, $scheme );
2942
+function home_url($path = '', $scheme = null) {
2943
+	return get_home_url(null, $path, $scheme);
2944 2944
 }
2945 2945
 
2946 2946
 /**
@@ -2961,30 +2961,30 @@  discard block
 block discarded – undo
2961 2961
  *                              'http', 'https', 'relative', 'rest', or null. Default null.
2962 2962
  * @return string Home URL link with optional path appended.
2963 2963
  */
2964
-function get_home_url( $blog_id = null, $path = '', $scheme = null ) {
2964
+function get_home_url($blog_id = null, $path = '', $scheme = null) {
2965 2965
 	global $pagenow;
2966 2966
 
2967 2967
 	$orig_scheme = $scheme;
2968 2968
 
2969
-	if ( empty( $blog_id ) || !is_multisite() ) {
2970
-		$url = get_option( 'home' );
2969
+	if (empty($blog_id) || ! is_multisite()) {
2970
+		$url = get_option('home');
2971 2971
 	} else {
2972
-		switch_to_blog( $blog_id );
2973
-		$url = get_option( 'home' );
2972
+		switch_to_blog($blog_id);
2973
+		$url = get_option('home');
2974 2974
 		restore_current_blog();
2975 2975
 	}
2976 2976
 
2977
-	if ( ! in_array( $scheme, array( 'http', 'https', 'relative' ) ) ) {
2978
-		if ( is_ssl() && ! is_admin() && 'wp-login.php' !== $pagenow )
2977
+	if ( ! in_array($scheme, array('http', 'https', 'relative'))) {
2978
+		if (is_ssl() && ! is_admin() && 'wp-login.php' !== $pagenow)
2979 2979
 			$scheme = 'https';
2980 2980
 		else
2981
-			$scheme = parse_url( $url, PHP_URL_SCHEME );
2981
+			$scheme = parse_url($url, PHP_URL_SCHEME);
2982 2982
 	}
2983 2983
 
2984
-	$url = set_url_scheme( $url, $scheme );
2984
+	$url = set_url_scheme($url, $scheme);
2985 2985
 
2986
-	if ( $path && is_string( $path ) )
2987
-		$url .= '/' . ltrim( $path, '/' );
2986
+	if ($path && is_string($path))
2987
+		$url .= '/'.ltrim($path, '/');
2988 2988
 
2989 2989
 	/**
2990 2990
 	 * Filter the home URL.
@@ -2997,7 +2997,7 @@  discard block
 block discarded – undo
2997 2997
 	 *                                 'relative', 'rest', or null.
2998 2998
 	 * @param int|null    $blog_id     Site ID, or null for the current site.
2999 2999
 	 */
3000
-	return apply_filters( 'home_url', $url, $path, $orig_scheme, $blog_id );
3000
+	return apply_filters('home_url', $url, $path, $orig_scheme, $blog_id);
3001 3001
 }
3002 3002
 
3003 3003
 /**
@@ -3014,8 +3014,8 @@  discard block
 block discarded – undo
3014 3014
  * @param string $scheme Optional. Scheme to give the site url context. See set_url_scheme().
3015 3015
  * @return string Site url link with optional path appended.
3016 3016
  */
3017
-function site_url( $path = '', $scheme = null ) {
3018
-	return get_site_url( null, $path, $scheme );
3017
+function site_url($path = '', $scheme = null) {
3018
+	return get_site_url(null, $path, $scheme);
3019 3019
 }
3020 3020
 
3021 3021
 /**
@@ -3035,19 +3035,19 @@  discard block
 block discarded – undo
3035 3035
  *                        'relative'. Default null.
3036 3036
  * @return string Site url link with optional path appended.
3037 3037
  */
3038
-function get_site_url( $blog_id = null, $path = '', $scheme = null ) {
3039
-	if ( empty( $blog_id ) || !is_multisite() ) {
3040
-		$url = get_option( 'siteurl' );
3038
+function get_site_url($blog_id = null, $path = '', $scheme = null) {
3039
+	if (empty($blog_id) || ! is_multisite()) {
3040
+		$url = get_option('siteurl');
3041 3041
 	} else {
3042
-		switch_to_blog( $blog_id );
3043
-		$url = get_option( 'siteurl' );
3042
+		switch_to_blog($blog_id);
3043
+		$url = get_option('siteurl');
3044 3044
 		restore_current_blog();
3045 3045
 	}
3046 3046
 
3047
-	$url = set_url_scheme( $url, $scheme );
3047
+	$url = set_url_scheme($url, $scheme);
3048 3048
 
3049
-	if ( $path && is_string( $path ) )
3050
-		$url .= '/' . ltrim( $path, '/' );
3049
+	if ($path && is_string($path))
3050
+		$url .= '/'.ltrim($path, '/');
3051 3051
 
3052 3052
 	/**
3053 3053
 	 * Filter the site URL.
@@ -3060,7 +3060,7 @@  discard block
 block discarded – undo
3060 3060
 	 *                             'login_post', 'admin', 'relative' or null.
3061 3061
 	 * @param int|null    $blog_id Site ID, or null for the current site.
3062 3062
 	 */
3063
-	return apply_filters( 'site_url', $url, $path, $scheme, $blog_id );
3063
+	return apply_filters('site_url', $url, $path, $scheme, $blog_id);
3064 3064
 }
3065 3065
 
3066 3066
 /**
@@ -3072,8 +3072,8 @@  discard block
 block discarded – undo
3072 3072
  * @param string $scheme The scheme to use. Default is 'admin', which obeys force_ssl_admin() and is_ssl(). 'http' or 'https' can be passed to force those schemes.
3073 3073
  * @return string Admin url link with optional path appended.
3074 3074
  */
3075
-function admin_url( $path = '', $scheme = 'admin' ) {
3076
-	return get_admin_url( null, $path, $scheme );
3075
+function admin_url($path = '', $scheme = 'admin') {
3076
+	return get_admin_url(null, $path, $scheme);
3077 3077
 }
3078 3078
 
3079 3079
 /**
@@ -3088,11 +3088,11 @@  discard block
 block discarded – undo
3088 3088
  *                        {@see force_ssl_admin()} and {@see is_ssl()}.
3089 3089
  * @return string Admin url link with optional path appended.
3090 3090
  */
3091
-function get_admin_url( $blog_id = null, $path = '', $scheme = 'admin' ) {
3091
+function get_admin_url($blog_id = null, $path = '', $scheme = 'admin') {
3092 3092
 	$url = get_site_url($blog_id, 'wp-admin/', $scheme);
3093 3093
 
3094
-	if ( $path && is_string( $path ) )
3095
-		$url .= ltrim( $path, '/' );
3094
+	if ($path && is_string($path))
3095
+		$url .= ltrim($path, '/');
3096 3096
 
3097 3097
 	/**
3098 3098
 	 * Filter the admin area URL.
@@ -3103,7 +3103,7 @@  discard block
 block discarded – undo
3103 3103
 	 * @param string   $path    Path relative to the admin area URL. Blank string if no path is specified.
3104 3104
 	 * @param int|null $blog_id Site ID, or null for the current site.
3105 3105
 	 */
3106
-	return apply_filters( 'admin_url', $url, $path, $blog_id );
3106
+	return apply_filters('admin_url', $url, $path, $blog_id);
3107 3107
 }
3108 3108
 
3109 3109
 /**
@@ -3115,10 +3115,10 @@  discard block
 block discarded – undo
3115 3115
  * @param string $scheme Optional. Scheme to give the includes url context.
3116 3116
  * @return string Includes url link with optional path appended.
3117 3117
  */
3118
-function includes_url( $path = '', $scheme = null ) {
3119
-	$url = site_url( '/' . WPINC . '/', $scheme );
3118
+function includes_url($path = '', $scheme = null) {
3119
+	$url = site_url('/'.WPINC.'/', $scheme);
3120 3120
 
3121
-	if ( $path && is_string( $path ) )
3121
+	if ($path && is_string($path))
3122 3122
 		$url .= ltrim($path, '/');
3123 3123
 
3124 3124
 	/**
@@ -3130,7 +3130,7 @@  discard block
 block discarded – undo
3130 3130
 	 * @param string $path Path relative to the URL to the wp-includes directory. Blank string
3131 3131
 	 *                     if no path is specified.
3132 3132
 	 */
3133
-	return apply_filters( 'includes_url', $url, $path );
3133
+	return apply_filters('includes_url', $url, $path);
3134 3134
 }
3135 3135
 
3136 3136
 /**
@@ -3142,10 +3142,10 @@  discard block
 block discarded – undo
3142 3142
  * @return string Content url link with optional path appended.
3143 3143
  */
3144 3144
 function content_url($path = '') {
3145
-	$url = set_url_scheme( WP_CONTENT_URL );
3145
+	$url = set_url_scheme(WP_CONTENT_URL);
3146 3146
 
3147
-	if ( $path && is_string( $path ) )
3148
-		$url .= '/' . ltrim($path, '/');
3147
+	if ($path && is_string($path))
3148
+		$url .= '/'.ltrim($path, '/');
3149 3149
 
3150 3150
 	/**
3151 3151
 	 * Filter the URL to the content directory.
@@ -3156,7 +3156,7 @@  discard block
 block discarded – undo
3156 3156
 	 * @param string $path Path relative to the URL to the content directory. Blank string
3157 3157
 	 *                     if no path is specified.
3158 3158
 	 */
3159
-	return apply_filters( 'content_url', $url, $path);
3159
+	return apply_filters('content_url', $url, $path);
3160 3160
 }
3161 3161
 
3162 3162
 /**
@@ -3173,28 +3173,28 @@  discard block
 block discarded – undo
3173 3173
  *                        Typically this is done by passing `__FILE__` as the argument.
3174 3174
  * @return string Plugins URL link with optional paths appended.
3175 3175
  */
3176
-function plugins_url( $path = '', $plugin = '' ) {
3176
+function plugins_url($path = '', $plugin = '') {
3177 3177
 
3178
-	$path = wp_normalize_path( $path );
3179
-	$plugin = wp_normalize_path( $plugin );
3180
-	$mu_plugin_dir = wp_normalize_path( WPMU_PLUGIN_DIR );
3178
+	$path = wp_normalize_path($path);
3179
+	$plugin = wp_normalize_path($plugin);
3180
+	$mu_plugin_dir = wp_normalize_path(WPMU_PLUGIN_DIR);
3181 3181
 
3182
-	if ( !empty($plugin) && 0 === strpos($plugin, $mu_plugin_dir) )
3182
+	if ( ! empty($plugin) && 0 === strpos($plugin, $mu_plugin_dir))
3183 3183
 		$url = WPMU_PLUGIN_URL;
3184 3184
 	else
3185 3185
 		$url = WP_PLUGIN_URL;
3186 3186
 
3187 3187
 
3188
-	$url = set_url_scheme( $url );
3188
+	$url = set_url_scheme($url);
3189 3189
 
3190
-	if ( !empty($plugin) && is_string($plugin) ) {
3190
+	if ( ! empty($plugin) && is_string($plugin)) {
3191 3191
 		$folder = dirname(plugin_basename($plugin));
3192
-		if ( '.' != $folder )
3193
-			$url .= '/' . ltrim($folder, '/');
3192
+		if ('.' != $folder)
3193
+			$url .= '/'.ltrim($folder, '/');
3194 3194
 	}
3195 3195
 
3196
-	if ( $path && is_string( $path ) )
3197
-		$url .= '/' . ltrim($path, '/');
3196
+	if ($path && is_string($path))
3197
+		$url .= '/'.ltrim($path, '/');
3198 3198
 
3199 3199
 	/**
3200 3200
 	 * Filter the URL to the plugins directory.
@@ -3207,7 +3207,7 @@  discard block
 block discarded – undo
3207 3207
 	 * @param string $plugin The plugin file path to be relative to. Blank string if no plugin
3208 3208
 	 *                       is specified.
3209 3209
 	 */
3210
-	return apply_filters( 'plugins_url', $url, $path, $plugin );
3210
+	return apply_filters('plugins_url', $url, $path, $plugin);
3211 3211
 }
3212 3212
 
3213 3213
 /**
@@ -3223,19 +3223,19 @@  discard block
 block discarded – undo
3223 3223
  * @param string $scheme Optional. Scheme to give the site url context. See set_url_scheme().
3224 3224
  * @return string Site url link with optional path appended.
3225 3225
  */
3226
-function network_site_url( $path = '', $scheme = null ) {
3227
-	if ( ! is_multisite() )
3226
+function network_site_url($path = '', $scheme = null) {
3227
+	if ( ! is_multisite())
3228 3228
 		return site_url($path, $scheme);
3229 3229
 
3230 3230
 	$current_site = get_current_site();
3231 3231
 
3232
-	if ( 'relative' == $scheme )
3232
+	if ('relative' == $scheme)
3233 3233
 		$url = $current_site->path;
3234 3234
 	else
3235
-		$url = set_url_scheme( 'http://' . $current_site->domain . $current_site->path, $scheme );
3235
+		$url = set_url_scheme('http://'.$current_site->domain.$current_site->path, $scheme);
3236 3236
 
3237
-	if ( $path && is_string( $path ) )
3238
-		$url .= ltrim( $path, '/' );
3237
+	if ($path && is_string($path))
3238
+		$url .= ltrim($path, '/');
3239 3239
 
3240 3240
 	/**
3241 3241
 	 * Filter the network site URL.
@@ -3248,7 +3248,7 @@  discard block
 block discarded – undo
3248 3248
 	 * @param string|null $scheme Scheme to give the URL context. Accepts 'http', 'https',
3249 3249
 	 *                            'relative' or null.
3250 3250
 	 */
3251
-	return apply_filters( 'network_site_url', $url, $path, $scheme );
3251
+	return apply_filters('network_site_url', $url, $path, $scheme);
3252 3252
 }
3253 3253
 
3254 3254
 /**
@@ -3265,23 +3265,23 @@  discard block
 block discarded – undo
3265 3265
  *                        'http', 'https', or 'relative'. Default null.
3266 3266
  * @return string Home url link with optional path appended.
3267 3267
  */
3268
-function network_home_url( $path = '', $scheme = null ) {
3269
-	if ( ! is_multisite() )
3268
+function network_home_url($path = '', $scheme = null) {
3269
+	if ( ! is_multisite())
3270 3270
 		return home_url($path, $scheme);
3271 3271
 
3272 3272
 	$current_site = get_current_site();
3273 3273
 	$orig_scheme = $scheme;
3274 3274
 
3275
-	if ( ! in_array( $scheme, array( 'http', 'https', 'relative' ) ) )
3275
+	if ( ! in_array($scheme, array('http', 'https', 'relative')))
3276 3276
 		$scheme = is_ssl() && ! is_admin() ? 'https' : 'http';
3277 3277
 
3278
-	if ( 'relative' == $scheme )
3278
+	if ('relative' == $scheme)
3279 3279
 		$url = $current_site->path;
3280 3280
 	else
3281
-		$url = set_url_scheme( 'http://' . $current_site->domain . $current_site->path, $scheme );
3281
+		$url = set_url_scheme('http://'.$current_site->domain.$current_site->path, $scheme);
3282 3282
 
3283
-	if ( $path && is_string( $path ) )
3284
-		$url .= ltrim( $path, '/' );
3283
+	if ($path && is_string($path))
3284
+		$url .= ltrim($path, '/');
3285 3285
 
3286 3286
 	/**
3287 3287
 	 * Filter the network home URL.
@@ -3294,7 +3294,7 @@  discard block
 block discarded – undo
3294 3294
 	 * @param string|null $orig_scheme Scheme to give the URL context. Accepts 'http', 'https',
3295 3295
 	 *                                 'relative' or null.
3296 3296
 	 */
3297
-	return apply_filters( 'network_home_url', $url, $path, $orig_scheme);
3297
+	return apply_filters('network_home_url', $url, $path, $orig_scheme);
3298 3298
 }
3299 3299
 
3300 3300
 /**
@@ -3306,13 +3306,13 @@  discard block
 block discarded – undo
3306 3306
  * @param string $scheme The scheme to use. Default is 'admin', which obeys force_ssl_admin() and is_ssl(). 'http' or 'https' can be passed to force those schemes.
3307 3307
  * @return string Admin url link with optional path appended.
3308 3308
  */
3309
-function network_admin_url( $path = '', $scheme = 'admin' ) {
3310
-	if ( ! is_multisite() )
3311
-		return admin_url( $path, $scheme );
3309
+function network_admin_url($path = '', $scheme = 'admin') {
3310
+	if ( ! is_multisite())
3311
+		return admin_url($path, $scheme);
3312 3312
 
3313 3313
 	$url = network_site_url('wp-admin/network/', $scheme);
3314 3314
 
3315
-	if ( $path && is_string( $path ) )
3315
+	if ($path && is_string($path))
3316 3316
 		$url .= ltrim($path, '/');
3317 3317
 
3318 3318
 	/**
@@ -3324,7 +3324,7 @@  discard block
 block discarded – undo
3324 3324
 	 * @param string $path Path relative to the network admin URL. Blank string if
3325 3325
 	 *                     no path is specified.
3326 3326
 	 */
3327
-	return apply_filters( 'network_admin_url', $url, $path );
3327
+	return apply_filters('network_admin_url', $url, $path);
3328 3328
 }
3329 3329
 
3330 3330
 /**
@@ -3336,10 +3336,10 @@  discard block
 block discarded – undo
3336 3336
  * @param string $scheme The scheme to use. Default is 'admin', which obeys force_ssl_admin() and is_ssl(). 'http' or 'https' can be passed to force those schemes.
3337 3337
  * @return string Admin url link with optional path appended.
3338 3338
  */
3339
-function user_admin_url( $path = '', $scheme = 'admin' ) {
3339
+function user_admin_url($path = '', $scheme = 'admin') {
3340 3340
 	$url = network_site_url('wp-admin/user/', $scheme);
3341 3341
 
3342
-	if ( $path && is_string( $path ) )
3342
+	if ($path && is_string($path))
3343 3343
 		$url .= ltrim($path, '/');
3344 3344
 
3345 3345
 	/**
@@ -3351,7 +3351,7 @@  discard block
 block discarded – undo
3351 3351
 	 * @param string $path Path relative to the URL. Blank string if
3352 3352
 	 *                     no path is specified.
3353 3353
 	 */
3354
-	return apply_filters( 'user_admin_url', $url, $path );
3354
+	return apply_filters('user_admin_url', $url, $path);
3355 3355
 }
3356 3356
 
3357 3357
 /**
@@ -3364,9 +3364,9 @@  discard block
 block discarded – undo
3364 3364
  * @return string Admin url link with optional path appended.
3365 3365
  */
3366 3366
 function self_admin_url($path = '', $scheme = 'admin') {
3367
-	if ( is_network_admin() )
3367
+	if (is_network_admin())
3368 3368
 		return network_admin_url($path, $scheme);
3369
-	elseif ( is_user_admin() )
3369
+	elseif (is_user_admin())
3370 3370
 		return user_admin_url($path, $scheme);
3371 3371
 	else
3372 3372
 		return admin_url($path, $scheme);
@@ -3383,27 +3383,27 @@  discard block
 block discarded – undo
3383 3383
  *                            'login_post', 'admin', 'relative', 'rest', 'rpc', or null. Default null.
3384 3384
  * @return string $url URL with chosen scheme.
3385 3385
  */
3386
-function set_url_scheme( $url, $scheme = null ) {
3386
+function set_url_scheme($url, $scheme = null) {
3387 3387
 	$orig_scheme = $scheme;
3388 3388
 
3389
-	if ( ! $scheme ) {
3389
+	if ( ! $scheme) {
3390 3390
 		$scheme = is_ssl() ? 'https' : 'http';
3391
-	} elseif ( $scheme === 'admin' || $scheme === 'login' || $scheme === 'login_post' || $scheme === 'rpc' ) {
3391
+	} elseif ($scheme === 'admin' || $scheme === 'login' || $scheme === 'login_post' || $scheme === 'rpc') {
3392 3392
 		$scheme = is_ssl() || force_ssl_admin() ? 'https' : 'http';
3393
-	} elseif ( $scheme !== 'http' && $scheme !== 'https' && $scheme !== 'relative' ) {
3393
+	} elseif ($scheme !== 'http' && $scheme !== 'https' && $scheme !== 'relative') {
3394 3394
 		$scheme = is_ssl() ? 'https' : 'http';
3395 3395
 	}
3396 3396
 
3397
-	$url = trim( $url );
3398
-	if ( substr( $url, 0, 2 ) === '//' )
3399
-		$url = 'http:' . $url;
3397
+	$url = trim($url);
3398
+	if (substr($url, 0, 2) === '//')
3399
+		$url = 'http:'.$url;
3400 3400
 
3401
-	if ( 'relative' == $scheme ) {
3402
-		$url = ltrim( preg_replace( '#^\w+://[^/]*#', '', $url ) );
3403
-		if ( $url !== '' && $url[0] === '/' )
3404
-			$url = '/' . ltrim($url , "/ \t\n\r\0\x0B" );
3401
+	if ('relative' == $scheme) {
3402
+		$url = ltrim(preg_replace('#^\w+://[^/]*#', '', $url));
3403
+		if ($url !== '' && $url[0] === '/')
3404
+			$url = '/'.ltrim($url, "/ \t\n\r\0\x0B");
3405 3405
 	} else {
3406
-		$url = preg_replace( '#^\w+://#', $scheme . '://', $url );
3406
+		$url = preg_replace('#^\w+://#', $scheme.'://', $url);
3407 3407
 	}
3408 3408
 
3409 3409
 	/**
@@ -3416,7 +3416,7 @@  discard block
 block discarded – undo
3416 3416
 	 * @param string|null $orig_scheme Scheme requested for the URL. One of 'http', 'https', 'login',
3417 3417
 	 *                                 'login_post', 'admin', 'relative', 'rest', 'rpc', or null.
3418 3418
 	 */
3419
-	return apply_filters( 'set_url_scheme', $url, $scheme, $orig_scheme );
3419
+	return apply_filters('set_url_scheme', $url, $scheme, $orig_scheme);
3420 3420
 }
3421 3421
 
3422 3422
 /**
@@ -3433,24 +3433,24 @@  discard block
 block discarded – undo
3433 3433
  * @param string $scheme  The scheme to use. Default is 'admin', which obeys force_ssl_admin() and is_ssl(). 'http' or 'https' can be passed to force those schemes.
3434 3434
  * @return string Dashboard url link with optional path appended.
3435 3435
  */
3436
-function get_dashboard_url( $user_id = 0, $path = '', $scheme = 'admin' ) {
3436
+function get_dashboard_url($user_id = 0, $path = '', $scheme = 'admin') {
3437 3437
 	$user_id = $user_id ? (int) $user_id : get_current_user_id();
3438 3438
 
3439
-	$blogs = get_blogs_of_user( $user_id );
3440
-	if ( ! is_super_admin() && empty($blogs) ) {
3441
-		$url = user_admin_url( $path, $scheme );
3442
-	} elseif ( ! is_multisite() ) {
3443
-		$url = admin_url( $path, $scheme );
3439
+	$blogs = get_blogs_of_user($user_id);
3440
+	if ( ! is_super_admin() && empty($blogs)) {
3441
+		$url = user_admin_url($path, $scheme);
3442
+	} elseif ( ! is_multisite()) {
3443
+		$url = admin_url($path, $scheme);
3444 3444
 	} else {
3445 3445
 		$current_blog = get_current_blog_id();
3446
-		if ( $current_blog  && ( is_super_admin( $user_id ) || in_array( $current_blog, array_keys( $blogs ) ) ) ) {
3447
-			$url = admin_url( $path, $scheme );
3446
+		if ($current_blog && (is_super_admin($user_id) || in_array($current_blog, array_keys($blogs)))) {
3447
+			$url = admin_url($path, $scheme);
3448 3448
 		} else {
3449
-			$active = get_active_blog_for_user( $user_id );
3450
-			if ( $active )
3451
-				$url = get_admin_url( $active->blog_id, $path, $scheme );
3449
+			$active = get_active_blog_for_user($user_id);
3450
+			if ($active)
3451
+				$url = get_admin_url($active->blog_id, $path, $scheme);
3452 3452
 			else
3453
-				$url = user_admin_url( $path, $scheme );
3453
+				$url = user_admin_url($path, $scheme);
3454 3454
 		}
3455 3455
 	}
3456 3456
 
@@ -3465,7 +3465,7 @@  discard block
 block discarded – undo
3465 3465
 	 * @param string $scheme  Scheme to give the URL context. Accepts 'http', 'https', 'login',
3466 3466
 	 *                        'login_post', 'admin', 'relative' or null.
3467 3467
 	 */
3468
-	return apply_filters( 'user_dashboard_url', $url, $user_id, $path, $scheme);
3468
+	return apply_filters('user_dashboard_url', $url, $user_id, $path, $scheme);
3469 3469
 }
3470 3470
 
3471 3471
 /**
@@ -3478,15 +3478,15 @@  discard block
 block discarded – undo
3478 3478
  *                        'http' or 'https' can be passed to force those schemes.
3479 3479
  * @return string Dashboard url link with optional path appended.
3480 3480
  */
3481
-function get_edit_profile_url( $user_id = 0, $scheme = 'admin' ) {
3481
+function get_edit_profile_url($user_id = 0, $scheme = 'admin') {
3482 3482
 	$user_id = $user_id ? (int) $user_id : get_current_user_id();
3483 3483
 
3484
-	if ( is_user_admin() )
3485
-		$url = user_admin_url( 'profile.php', $scheme );
3486
-	elseif ( is_network_admin() )
3487
-		$url = network_admin_url( 'profile.php', $scheme );
3484
+	if (is_user_admin())
3485
+		$url = user_admin_url('profile.php', $scheme);
3486
+	elseif (is_network_admin())
3487
+		$url = network_admin_url('profile.php', $scheme);
3488 3488
 	else
3489
-		$url = get_dashboard_url( $user_id, 'profile.php', $scheme );
3489
+		$url = get_dashboard_url($user_id, 'profile.php', $scheme);
3490 3490
 
3491 3491
 	/**
3492 3492
 	 * Filter the URL for a user's profile editor.
@@ -3498,7 +3498,7 @@  discard block
 block discarded – undo
3498 3498
 	 * @param string $scheme  Scheme to give the URL context. Accepts 'http', 'https', 'login',
3499 3499
 	 *                        'login_post', 'admin', 'relative' or null.
3500 3500
 	 */
3501
-	return apply_filters( 'edit_profile_url', $url, $user_id, $scheme);
3501
+	return apply_filters('edit_profile_url', $url, $user_id, $scheme);
3502 3502
 }
3503 3503
 
3504 3504
 /**
@@ -3507,30 +3507,30 @@  discard block
 block discarded – undo
3507 3507
  * @since 2.9.0
3508 3508
  */
3509 3509
 function rel_canonical() {
3510
-	if ( ! is_singular() ) {
3510
+	if ( ! is_singular()) {
3511 3511
 		return;
3512 3512
 	}
3513 3513
 
3514
-	if ( ! $id = get_queried_object_id() ) {
3514
+	if ( ! $id = get_queried_object_id()) {
3515 3515
 		return;
3516 3516
 	}
3517 3517
 
3518
-	$url = get_permalink( $id );
3518
+	$url = get_permalink($id);
3519 3519
 
3520
-	$page = get_query_var( 'page' );
3521
-	if ( $page >= 2 ) {
3522
-		if ( '' == get_option( 'permalink_structure' ) ) {
3523
-			$url = add_query_arg( 'page', $page, $url );
3520
+	$page = get_query_var('page');
3521
+	if ($page >= 2) {
3522
+		if ('' == get_option('permalink_structure')) {
3523
+			$url = add_query_arg('page', $page, $url);
3524 3524
 		} else {
3525
-			$url = trailingslashit( $url ) . user_trailingslashit( $page, 'single_paged' );
3525
+			$url = trailingslashit($url).user_trailingslashit($page, 'single_paged');
3526 3526
 		}
3527 3527
 	}
3528 3528
 
3529
-	$cpage = get_query_var( 'cpage' );
3530
-	if ( $cpage ) {
3531
-		$url = get_comments_pagenum_link( $cpage );
3529
+	$cpage = get_query_var('cpage');
3530
+	if ($cpage) {
3531
+		$url = get_comments_pagenum_link($cpage);
3532 3532
 	}
3533
-	echo '<link rel="canonical" href="' . esc_url( $url ) . "\" />\n";
3533
+	echo '<link rel="canonical" href="'.esc_url($url)."\" />\n";
3534 3534
 }
3535 3535
 
3536 3536
 /**
@@ -3565,32 +3565,32 @@  discard block
 block discarded – undo
3565 3565
 	 * @param string      $context     The context for the link. One of 'post' or 'query',
3566 3566
 	 * @param bool        $allow_slugs Whether to allow post slugs in the shortlink.
3567 3567
 	 */
3568
-	$shortlink = apply_filters( 'pre_get_shortlink', false, $id, $context, $allow_slugs );
3568
+	$shortlink = apply_filters('pre_get_shortlink', false, $id, $context, $allow_slugs);
3569 3569
 
3570
-	if ( false !== $shortlink ) {
3570
+	if (false !== $shortlink) {
3571 3571
 		return $shortlink;
3572 3572
 	}
3573 3573
 
3574 3574
 	$post_id = 0;
3575
-	if ( 'query' == $context && is_singular() ) {
3575
+	if ('query' == $context && is_singular()) {
3576 3576
 		$post_id = get_queried_object_id();
3577
-		$post = get_post( $post_id );
3578
-	} elseif ( 'post' == $context ) {
3579
-		$post = get_post( $id );
3580
-		if ( ! empty( $post->ID ) )
3577
+		$post = get_post($post_id);
3578
+	} elseif ('post' == $context) {
3579
+		$post = get_post($id);
3580
+		if ( ! empty($post->ID))
3581 3581
 			$post_id = $post->ID;
3582 3582
 	}
3583 3583
 
3584 3584
 	$shortlink = '';
3585 3585
 
3586 3586
 	// Return p= link for all public post types.
3587
-	if ( ! empty( $post_id ) ) {
3588
-		$post_type = get_post_type_object( $post->post_type );
3587
+	if ( ! empty($post_id)) {
3588
+		$post_type = get_post_type_object($post->post_type);
3589 3589
 
3590
-		if ( 'page' === $post->post_type && $post->ID == get_option( 'page_on_front' ) && 'page' == get_option( 'show_on_front' ) ) {
3591
-			$shortlink = home_url( '/' );
3592
-		} elseif ( $post_type->public ) {
3593
-			$shortlink = home_url( '?p=' . $post_id );
3590
+		if ('page' === $post->post_type && $post->ID == get_option('page_on_front') && 'page' == get_option('show_on_front')) {
3591
+			$shortlink = home_url('/');
3592
+		} elseif ($post_type->public) {
3593
+			$shortlink = home_url('?p='.$post_id);
3594 3594
 		}
3595 3595
 	}
3596 3596
 
@@ -3604,7 +3604,7 @@  discard block
 block discarded – undo
3604 3604
 	 * @param string $context     The context for the link. One of 'post' or 'query',
3605 3605
 	 * @param bool   $allow_slugs Whether to allow post slugs in the shortlink. Not used by default.
3606 3606
 	 */
3607
-	return apply_filters( 'get_shortlink', $shortlink, $id, $context, $allow_slugs );
3607
+	return apply_filters('get_shortlink', $shortlink, $id, $context, $allow_slugs);
3608 3608
 }
3609 3609
 
3610 3610
 /**
@@ -3615,12 +3615,12 @@  discard block
 block discarded – undo
3615 3615
  * @since 3.0.0
3616 3616
  */
3617 3617
 function wp_shortlink_wp_head() {
3618
-	$shortlink = wp_get_shortlink( 0, 'query' );
3618
+	$shortlink = wp_get_shortlink(0, 'query');
3619 3619
 
3620
-	if ( empty( $shortlink ) )
3620
+	if (empty($shortlink))
3621 3621
 		return;
3622 3622
 
3623
-	echo "<link rel='shortlink' href='" . esc_url( $shortlink ) . "' />\n";
3623
+	echo "<link rel='shortlink' href='".esc_url($shortlink)."' />\n";
3624 3624
 }
3625 3625
 
3626 3626
 /**
@@ -3631,15 +3631,15 @@  discard block
 block discarded – undo
3631 3631
  * @since 3.0.0
3632 3632
  */
3633 3633
 function wp_shortlink_header() {
3634
-	if ( headers_sent() )
3634
+	if (headers_sent())
3635 3635
 		return;
3636 3636
 
3637 3637
 	$shortlink = wp_get_shortlink(0, 'query');
3638 3638
 
3639
-	if ( empty($shortlink) )
3639
+	if (empty($shortlink))
3640 3640
 		return;
3641 3641
 
3642
-	header('Link: <' . $shortlink . '>; rel=shortlink', false);
3642
+	header('Link: <'.$shortlink.'>; rel=shortlink', false);
3643 3643
 }
3644 3644
 
3645 3645
 /**
@@ -3656,19 +3656,19 @@  discard block
 block discarded – undo
3656 3656
  * @param string $before Optional HTML to display before the link.
3657 3657
  * @param string $after  Optional HTML to display after the link.
3658 3658
  */
3659
-function the_shortlink( $text = '', $title = '', $before = '', $after = '' ) {
3659
+function the_shortlink($text = '', $title = '', $before = '', $after = '') {
3660 3660
 	$post = get_post();
3661 3661
 
3662
-	if ( empty( $text ) )
3662
+	if (empty($text))
3663 3663
 		$text = __('This is the short link.');
3664 3664
 
3665
-	if ( empty( $title ) )
3666
-		$title = the_title_attribute( array( 'echo' => false ) );
3665
+	if (empty($title))
3666
+		$title = the_title_attribute(array('echo' => false));
3667 3667
 
3668
-	$shortlink = wp_get_shortlink( $post->ID );
3668
+	$shortlink = wp_get_shortlink($post->ID);
3669 3669
 
3670
-	if ( !empty( $shortlink ) ) {
3671
-		$link = '<a rel="shortlink" href="' . esc_url( $shortlink ) . '" title="' . $title . '">' . $text . '</a>';
3670
+	if ( ! empty($shortlink)) {
3671
+		$link = '<a rel="shortlink" href="'.esc_url($shortlink).'" title="'.$title.'">'.$text.'</a>';
3672 3672
 
3673 3673
 		/**
3674 3674
 		 * Filter the shortlink anchor tag for a post.
@@ -3680,7 +3680,7 @@  discard block
 block discarded – undo
3680 3680
 		 * @param string $text      Shortlink's text.
3681 3681
 		 * @param string $title     Shortlink's title attribute.
3682 3682
 		 */
3683
-		$link = apply_filters( 'the_shortlink', $link, $shortlink, $text, $title );
3683
+		$link = apply_filters('the_shortlink', $link, $shortlink, $text, $title);
3684 3684
 		echo $before, $link, $after;
3685 3685
 	}
3686 3686
 }
@@ -3713,8 +3713,8 @@  discard block
 block discarded – undo
3713 3713
  * }
3714 3714
  * @return false|string The URL of the avatar we found, or false if we couldn't find an avatar.
3715 3715
  */
3716
-function get_avatar_url( $id_or_email, $args = null ) {
3717
-	$args = get_avatar_data( $id_or_email, $args );
3716
+function get_avatar_url($id_or_email, $args = null) {
3717
+	$args = get_avatar_data($id_or_email, $args);
3718 3718
 	return $args['url'];
3719 3719
 }
3720 3720
 
@@ -3754,51 +3754,51 @@  discard block
 block discarded – undo
3754 3754
  *     @type string $url          The URL of the avatar we found.
3755 3755
  * }
3756 3756
  */
3757
-function get_avatar_data( $id_or_email, $args = null ) {
3758
-	$args = wp_parse_args( $args, array(
3757
+function get_avatar_data($id_or_email, $args = null) {
3758
+	$args = wp_parse_args($args, array(
3759 3759
 		'size'           => 96,
3760 3760
 		'height'         => null,
3761 3761
 		'width'          => null,
3762
-		'default'        => get_option( 'avatar_default', 'mystery' ),
3762
+		'default'        => get_option('avatar_default', 'mystery'),
3763 3763
 		'force_default'  => false,
3764
-		'rating'         => get_option( 'avatar_rating' ),
3764
+		'rating'         => get_option('avatar_rating'),
3765 3765
 		'scheme'         => null,
3766 3766
 		'processed_args' => null, // if used, should be a reference
3767 3767
 		'extra_attr'     => '',
3768
-	) );
3768
+	));
3769 3769
 
3770
-	if ( is_numeric( $args['size'] ) ) {
3771
-		$args['size'] = absint( $args['size'] );
3772
-		if ( ! $args['size'] ) {
3770
+	if (is_numeric($args['size'])) {
3771
+		$args['size'] = absint($args['size']);
3772
+		if ( ! $args['size']) {
3773 3773
 			$args['size'] = 96;
3774 3774
 		}
3775 3775
 	} else {
3776 3776
 		$args['size'] = 96;
3777 3777
 	}
3778 3778
 
3779
-	if ( is_numeric( $args['height'] ) ) {
3780
-		$args['height'] = absint( $args['height'] );
3781
-		if ( ! $args['height'] ) {
3779
+	if (is_numeric($args['height'])) {
3780
+		$args['height'] = absint($args['height']);
3781
+		if ( ! $args['height']) {
3782 3782
 			$args['height'] = $args['size'];
3783 3783
 		}
3784 3784
 	} else {
3785 3785
 		$args['height'] = $args['size'];
3786 3786
 	}
3787 3787
 
3788
-	if ( is_numeric( $args['width'] ) ) {
3789
-		$args['width'] = absint( $args['width'] );
3790
-		if ( ! $args['width'] ) {
3788
+	if (is_numeric($args['width'])) {
3789
+		$args['width'] = absint($args['width']);
3790
+		if ( ! $args['width']) {
3791 3791
 			$args['width'] = $args['size'];
3792 3792
 		}
3793 3793
 	} else {
3794 3794
 		$args['width'] = $args['size'];
3795 3795
 	}
3796 3796
 
3797
-	if ( empty( $args['default'] ) ) {
3798
-		$args['default'] = get_option( 'avatar_default', 'mystery' );
3797
+	if (empty($args['default'])) {
3798
+		$args['default'] = get_option('avatar_default', 'mystery');
3799 3799
 	}
3800 3800
 
3801
-	switch ( $args['default'] ) {
3801
+	switch ($args['default']) {
3802 3802
 		case 'mm' :
3803 3803
 		case 'mystery' :
3804 3804
 		case 'mysteryman' :
@@ -3811,7 +3811,7 @@  discard block
 block discarded – undo
3811 3811
 
3812 3812
 	$args['force_default'] = (bool) $args['force_default'];
3813 3813
 
3814
-	$args['rating'] = strtolower( $args['rating'] );
3814
+	$args['rating'] = strtolower($args['rating']);
3815 3815
 
3816 3816
 	$args['found_avatar'] = false;
3817 3817
 
@@ -3828,38 +3828,38 @@  discard block
 block discarded – undo
3828 3828
 	 * @param mixed  $id_or_email The Gravatar to retrieve. Accepts a user_id, gravatar md5 hash,
3829 3829
 	 *                            user email, WP_User object, WP_Post object, or WP_Comment object.
3830 3830
 	 */
3831
-	$args = apply_filters( 'pre_get_avatar_data', $args, $id_or_email );
3831
+	$args = apply_filters('pre_get_avatar_data', $args, $id_or_email);
3832 3832
 
3833
-	if ( isset( $args['url'] ) && ! is_null( $args['url'] ) ) {
3833
+	if (isset($args['url']) && ! is_null($args['url'])) {
3834 3834
 		/** This filter is documented in wp-includes/link-template.php */
3835
-		return apply_filters( 'get_avatar_data', $args, $id_or_email );
3835
+		return apply_filters('get_avatar_data', $args, $id_or_email);
3836 3836
 	}
3837 3837
 
3838 3838
 	$email_hash = '';
3839 3839
 	$user = $email = false;
3840 3840
 
3841
-	if ( is_object( $id_or_email ) && isset( $id_or_email->comment_ID ) ) {
3842
-		$id_or_email = get_comment( $id_or_email );
3841
+	if (is_object($id_or_email) && isset($id_or_email->comment_ID)) {
3842
+		$id_or_email = get_comment($id_or_email);
3843 3843
 	}
3844 3844
 
3845 3845
 	// Process the user identifier.
3846
-	if ( is_numeric( $id_or_email ) ) {
3847
-		$user = get_user_by( 'id', absint( $id_or_email ) );
3848
-	} elseif ( is_string( $id_or_email ) ) {
3849
-		if ( strpos( $id_or_email, '@md5.gravatar.com' ) ) {
3846
+	if (is_numeric($id_or_email)) {
3847
+		$user = get_user_by('id', absint($id_or_email));
3848
+	} elseif (is_string($id_or_email)) {
3849
+		if (strpos($id_or_email, '@md5.gravatar.com')) {
3850 3850
 			// md5 hash
3851
-			list( $email_hash ) = explode( '@', $id_or_email );
3851
+			list($email_hash) = explode('@', $id_or_email);
3852 3852
 		} else {
3853 3853
 			// email address
3854 3854
 			$email = $id_or_email;
3855 3855
 		}
3856
-	} elseif ( $id_or_email instanceof WP_User ) {
3856
+	} elseif ($id_or_email instanceof WP_User) {
3857 3857
 		// User Object
3858 3858
 		$user = $id_or_email;
3859
-	} elseif ( $id_or_email instanceof WP_Post ) {
3859
+	} elseif ($id_or_email instanceof WP_Post) {
3860 3860
 		// Post Object
3861
-		$user = get_user_by( 'id', (int) $id_or_email->post_author );
3862
-	} elseif ( $id_or_email instanceof WP_Comment ) {
3861
+		$user = get_user_by('id', (int) $id_or_email->post_author);
3862
+	} elseif ($id_or_email instanceof WP_Comment) {
3863 3863
 		/**
3864 3864
 		 * Filter the list of allowed comment types for retrieving avatars.
3865 3865
 		 *
@@ -3867,36 +3867,36 @@  discard block
 block discarded – undo
3867 3867
 		 *
3868 3868
 		 * @param array $types An array of content types. Default only contains 'comment'.
3869 3869
 		 */
3870
-		$allowed_comment_types = apply_filters( 'get_avatar_comment_types', array( 'comment' ) );
3871
-		if ( ! empty( $id_or_email->comment_type ) && ! in_array( $id_or_email->comment_type, (array) $allowed_comment_types ) ) {
3870
+		$allowed_comment_types = apply_filters('get_avatar_comment_types', array('comment'));
3871
+		if ( ! empty($id_or_email->comment_type) && ! in_array($id_or_email->comment_type, (array) $allowed_comment_types)) {
3872 3872
 			$args['url'] = false;
3873 3873
 			/** This filter is documented in wp-includes/link-template.php */
3874
-			return apply_filters( 'get_avatar_data', $args, $id_or_email );
3874
+			return apply_filters('get_avatar_data', $args, $id_or_email);
3875 3875
 		}
3876 3876
 
3877
-		if ( ! empty( $id_or_email->user_id ) ) {
3878
-			$user = get_user_by( 'id', (int) $id_or_email->user_id );
3877
+		if ( ! empty($id_or_email->user_id)) {
3878
+			$user = get_user_by('id', (int) $id_or_email->user_id);
3879 3879
 		}
3880
-		if ( ( ! $user || is_wp_error( $user ) ) && ! empty( $id_or_email->comment_author_email ) ) {
3880
+		if (( ! $user || is_wp_error($user)) && ! empty($id_or_email->comment_author_email)) {
3881 3881
 			$email = $id_or_email->comment_author_email;
3882 3882
 		}
3883 3883
 	}
3884 3884
 
3885
-	if ( ! $email_hash ) {
3886
-		if ( $user ) {
3885
+	if ( ! $email_hash) {
3886
+		if ($user) {
3887 3887
 			$email = $user->user_email;
3888 3888
 		}
3889 3889
 
3890
-		if ( $email ) {
3891
-			$email_hash = md5( strtolower( trim( $email ) ) );
3890
+		if ($email) {
3891
+			$email_hash = md5(strtolower(trim($email)));
3892 3892
 		}
3893 3893
 	}
3894 3894
 
3895
-	if ( $email_hash ) {
3895
+	if ($email_hash) {
3896 3896
 		$args['found_avatar'] = true;
3897
-		$gravatar_server = hexdec( $email_hash[0] ) % 3;
3897
+		$gravatar_server = hexdec($email_hash[0]) % 3;
3898 3898
 	} else {
3899
-		$gravatar_server = rand( 0, 2 );
3899
+		$gravatar_server = rand(0, 2);
3900 3900
 	}
3901 3901
 
3902 3902
 	$url_args = array(
@@ -3906,15 +3906,15 @@  discard block
 block discarded – undo
3906 3906
 		'r' => $args['rating'],
3907 3907
 	);
3908 3908
 
3909
-	if ( is_ssl() ) {
3910
-		$url = 'https://secure.gravatar.com/avatar/' . $email_hash;
3909
+	if (is_ssl()) {
3910
+		$url = 'https://secure.gravatar.com/avatar/'.$email_hash;
3911 3911
 	} else {
3912
-		$url = sprintf( 'http://%d.gravatar.com/avatar/%s', $gravatar_server, $email_hash );
3912
+		$url = sprintf('http://%d.gravatar.com/avatar/%s', $gravatar_server, $email_hash);
3913 3913
 	}
3914 3914
 
3915 3915
 	$url = add_query_arg(
3916
-		rawurlencode_deep( array_filter( $url_args ) ),
3917
-		set_url_scheme( $url, $args['scheme'] )
3916
+		rawurlencode_deep(array_filter($url_args)),
3917
+		set_url_scheme($url, $args['scheme'])
3918 3918
 	);
3919 3919
 
3920 3920
 	/**
@@ -3927,7 +3927,7 @@  discard block
 block discarded – undo
3927 3927
 	 *                            user email, WP_User object, WP_Post object, or WP_Comment object.
3928 3928
 	 * @param array  $args        Arguments passed to get_avatar_data(), after processing.
3929 3929
 	 */
3930
-	$args['url'] = apply_filters( 'get_avatar_url', $url, $id_or_email, $args );
3930
+	$args['url'] = apply_filters('get_avatar_url', $url, $id_or_email, $args);
3931 3931
 
3932 3932
 	/**
3933 3933
 	 * Filter the avatar data.
@@ -3938,5 +3938,5 @@  discard block
 block discarded – undo
3938 3938
 	 * @param mixed  $id_or_email The Gravatar to retrieve. Accepts a user_id, gravatar md5 hash,
3939 3939
 	 *                            user email, WP_User object, WP_Post object, or WP_Comment object.
3940 3940
 	 */
3941
-	return apply_filters( 'get_avatar_data', $args, $id_or_email );
3941
+	return apply_filters('get_avatar_data', $args, $id_or_email);
3942 3942
 }
Please login to merge, or discard this patch.
Braces   +474 added lines, -340 removed lines patch added patch discarded remove patch
@@ -44,10 +44,11 @@  discard block
 block discarded – undo
44 44
  */
45 45
 function user_trailingslashit($string, $type_of_url = '') {
46 46
 	global $wp_rewrite;
47
-	if ( $wp_rewrite->use_trailing_slashes )
48
-		$string = trailingslashit($string);
49
-	else
50
-		$string = untrailingslashit($string);
47
+	if ( $wp_rewrite->use_trailing_slashes ) {
48
+			$string = trailingslashit($string);
49
+	} else {
50
+			$string = untrailingslashit($string);
51
+	}
51 52
 
52 53
 	/**
53 54
 	 * Filter the trailing slashed string, depending on whether the site is set
@@ -136,15 +137,17 @@  discard block
 block discarded – undo
136 137
 		$sample = false;
137 138
 	}
138 139
 
139
-	if ( empty($post->ID) )
140
-		return false;
140
+	if ( empty($post->ID) ) {
141
+			return false;
142
+	}
141 143
 
142
-	if ( $post->post_type == 'page' )
143
-		return get_page_link($post, $leavename, $sample);
144
-	elseif ( $post->post_type == 'attachment' )
145
-		return get_attachment_link( $post, $leavename );
146
-	elseif ( in_array($post->post_type, get_post_types( array('_builtin' => false) ) ) )
147
-		return get_post_permalink($post, $leavename, $sample);
144
+	if ( $post->post_type == 'page' ) {
145
+			return get_page_link($post, $leavename, $sample);
146
+	} elseif ( $post->post_type == 'attachment' ) {
147
+			return get_attachment_link( $post, $leavename );
148
+	} elseif ( in_array($post->post_type, get_post_types( array('_builtin' => false) ) ) ) {
149
+			return get_post_permalink($post, $leavename, $sample);
150
+	}
148 151
 
149 152
 	$permalink = get_option('permalink_structure');
150 153
 
@@ -183,8 +186,9 @@  discard block
 block discarded – undo
183 186
 
184 187
 				$category_object = get_term( $category_object, 'category' );
185 188
 				$category = $category_object->slug;
186
-				if ( $parent = $category_object->parent )
187
-					$category = get_category_parents($parent, false, '/', true) . $category;
189
+				if ( $parent = $category_object->parent ) {
190
+									$category = get_category_parents($parent, false, '/', true) . $category;
191
+				}
188 192
 			}
189 193
 			// show default category in permalinks, without
190 194
 			// having to assign it explicitly
@@ -252,8 +256,9 @@  discard block
 block discarded – undo
252 256
 
253 257
 	$post = get_post($id);
254 258
 
255
-	if ( is_wp_error( $post ) )
256
-		return $post;
259
+	if ( is_wp_error( $post ) ) {
260
+			return $post;
261
+	}
257 262
 
258 263
 	$post_link = $wp_rewrite->get_extra_permastruct($post->post_type);
259 264
 
@@ -273,10 +278,11 @@  discard block
 block discarded – undo
273 278
 		}
274 279
 		$post_link = home_url( user_trailingslashit($post_link) );
275 280
 	} else {
276
-		if ( $post_type->query_var && ( isset($post->post_status) && !$draft_or_pending ) )
277
-			$post_link = add_query_arg($post_type->query_var, $slug, '');
278
-		else
279
-			$post_link = add_query_arg(array('post_type' => $post->post_type, 'p' => $post->ID), '');
281
+		if ( $post_type->query_var && ( isset($post->post_status) && !$draft_or_pending ) ) {
282
+					$post_link = add_query_arg($post_type->query_var, $slug, '');
283
+		} else {
284
+					$post_link = add_query_arg(array('post_type' => $post->post_type, 'p' => $post->ID), '');
285
+		}
280 286
 		$post_link = home_url($post_link);
281 287
 	}
282 288
 
@@ -308,10 +314,11 @@  discard block
 block discarded – undo
308 314
 function get_page_link( $post = false, $leavename = false, $sample = false ) {
309 315
 	$post = get_post( $post );
310 316
 
311
-	if ( 'page' == get_option( 'show_on_front' ) && $post->ID == get_option( 'page_on_front' ) )
312
-		$link = home_url('/');
313
-	else
314
-		$link = _get_page_link( $post, $leavename, $sample );
317
+	if ( 'page' == get_option( 'show_on_front' ) && $post->ID == get_option( 'page_on_front' ) ) {
318
+			$link = home_url('/');
319
+	} else {
320
+			$link = _get_page_link( $post, $leavename, $sample );
321
+	}
315 322
 
316 323
 	/**
317 324
 	 * Filter the permalink for a page.
@@ -396,27 +403,36 @@  discard block
 block discarded – undo
396 403
 	}
397 404
 
398 405
 	if ( $wp_rewrite->using_permalinks() && $parent ) {
399
-		if ( 'page' == $parent->post_type )
400
-			$parentlink = _get_page_link( $post->post_parent ); // Ignores page_on_front
401
-		else
402
-			$parentlink = get_permalink( $post->post_parent );
406
+		if ( 'page' == $parent->post_type ) {
407
+					$parentlink = _get_page_link( $post->post_parent );
408
+		}
409
+		// Ignores page_on_front
410
+		else {
411
+					$parentlink = get_permalink( $post->post_parent );
412
+		}
403 413
 
404
-		if ( is_numeric($post->post_name) || false !== strpos(get_option('permalink_structure'), '%category%') )
405
-			$name = 'attachment/' . $post->post_name; // <permalink>/<int>/ is paged so we use the explicit attachment marker
406
-		else
407
-			$name = $post->post_name;
414
+		if ( is_numeric($post->post_name) || false !== strpos(get_option('permalink_structure'), '%category%') ) {
415
+					$name = 'attachment/' . $post->post_name;
416
+		}
417
+		// <permalink>/<int>/ is paged so we use the explicit attachment marker
418
+		else {
419
+					$name = $post->post_name;
420
+		}
408 421
 
409
-		if ( strpos($parentlink, '?') === false )
410
-			$link = user_trailingslashit( trailingslashit($parentlink) . '%postname%' );
422
+		if ( strpos($parentlink, '?') === false ) {
423
+					$link = user_trailingslashit( trailingslashit($parentlink) . '%postname%' );
424
+		}
411 425
 
412
-		if ( ! $leavename )
413
-			$link = str_replace( '%postname%', $name, $link );
426
+		if ( ! $leavename ) {
427
+					$link = str_replace( '%postname%', $name, $link );
428
+		}
414 429
 	} elseif ( $wp_rewrite->using_permalinks() && ! $leavename ) {
415 430
 		$link = home_url( user_trailingslashit( $post->post_name ) );
416 431
 	}
417 432
 
418
-	if ( ! $link )
419
-		$link = home_url( '/?attachment_id=' . $post->ID );
433
+	if ( ! $link ) {
434
+			$link = home_url( '/?attachment_id=' . $post->ID );
435
+	}
420 436
 
421 437
 	/**
422 438
 	 * Filter the permalink for an attachment.
@@ -441,8 +457,9 @@  discard block
 block discarded – undo
441 457
  */
442 458
 function get_year_link($year) {
443 459
 	global $wp_rewrite;
444
-	if ( !$year )
445
-		$year = gmdate('Y', current_time('timestamp'));
460
+	if ( !$year ) {
461
+			$year = gmdate('Y', current_time('timestamp'));
462
+	}
446 463
 	$yearlink = $wp_rewrite->get_year_permastruct();
447 464
 	if ( !empty($yearlink) ) {
448 465
 		$yearlink = str_replace('%year%', $year, $yearlink);
@@ -475,10 +492,12 @@  discard block
 block discarded – undo
475 492
  */
476 493
 function get_month_link($year, $month) {
477 494
 	global $wp_rewrite;
478
-	if ( !$year )
479
-		$year = gmdate('Y', current_time('timestamp'));
480
-	if ( !$month )
481
-		$month = gmdate('m', current_time('timestamp'));
495
+	if ( !$year ) {
496
+			$year = gmdate('Y', current_time('timestamp'));
497
+	}
498
+	if ( !$month ) {
499
+			$month = gmdate('m', current_time('timestamp'));
500
+	}
482 501
 	$monthlink = $wp_rewrite->get_month_permastruct();
483 502
 	if ( !empty($monthlink) ) {
484 503
 		$monthlink = str_replace('%year%', $year, $monthlink);
@@ -514,12 +533,15 @@  discard block
 block discarded – undo
514 533
  */
515 534
 function get_day_link($year, $month, $day) {
516 535
 	global $wp_rewrite;
517
-	if ( !$year )
518
-		$year = gmdate('Y', current_time('timestamp'));
519
-	if ( !$month )
520
-		$month = gmdate('m', current_time('timestamp'));
521
-	if ( !$day )
522
-		$day = gmdate('j', current_time('timestamp'));
536
+	if ( !$year ) {
537
+			$year = gmdate('Y', current_time('timestamp'));
538
+	}
539
+	if ( !$month ) {
540
+			$month = gmdate('m', current_time('timestamp'));
541
+	}
542
+	if ( !$day ) {
543
+			$day = gmdate('j', current_time('timestamp'));
544
+	}
523 545
 
524 546
 	$daylink = $wp_rewrite->get_day_permastruct();
525 547
 	if ( !empty($daylink) ) {
@@ -587,18 +609,21 @@  discard block
 block discarded – undo
587 609
 			$permalink = $wp_rewrite->get_comment_feed_permastruct();
588 610
 		}
589 611
 
590
-		if ( get_default_feed() == $feed )
591
-			$feed = '';
612
+		if ( get_default_feed() == $feed ) {
613
+					$feed = '';
614
+		}
592 615
 
593 616
 		$permalink = str_replace('%feed%', $feed, $permalink);
594 617
 		$permalink = preg_replace('#/+#', '/', "/$permalink");
595 618
 		$output =  home_url( user_trailingslashit($permalink, 'feed') );
596 619
 	} else {
597
-		if ( empty($feed) )
598
-			$feed = get_default_feed();
620
+		if ( empty($feed) ) {
621
+					$feed = get_default_feed();
622
+		}
599 623
 
600
-		if ( false !== strpos($feed, 'comments_') )
601
-			$feed = str_replace('comments_', 'comments-', $feed);
624
+		if ( false !== strpos($feed, 'comments_') ) {
625
+					$feed = str_replace('comments_', 'comments-', $feed);
626
+		}
602 627
 
603 628
 		$output = home_url("?feed={$feed}");
604 629
 	}
@@ -626,20 +651,23 @@  discard block
 block discarded – undo
626 651
 function get_post_comments_feed_link($post_id = 0, $feed = '') {
627 652
 	$post_id = absint( $post_id );
628 653
 
629
-	if ( ! $post_id )
630
-		$post_id = get_the_ID();
654
+	if ( ! $post_id ) {
655
+			$post_id = get_the_ID();
656
+	}
631 657
 
632
-	if ( empty( $feed ) )
633
-		$feed = get_default_feed();
658
+	if ( empty( $feed ) ) {
659
+			$feed = get_default_feed();
660
+	}
634 661
 
635 662
 	$post = get_post( $post_id );
636 663
 	$unattached = 'attachment' === $post->post_type && 0 === (int) $post->post_parent;
637 664
 
638 665
 	if ( '' != get_option('permalink_structure') ) {
639
-		if ( 'page' == get_option('show_on_front') && $post_id == get_option('page_on_front') )
640
-			$url = _get_page_link( $post_id );
641
-		else
642
-			$url = get_permalink($post_id);
666
+		if ( 'page' == get_option('show_on_front') && $post_id == get_option('page_on_front') ) {
667
+					$url = _get_page_link( $post_id );
668
+		} else {
669
+					$url = get_permalink($post_id);
670
+		}
643 671
 
644 672
 		if ( $unattached ) {
645 673
 			$url =  home_url( '/feed/' );
@@ -649,8 +677,9 @@  discard block
 block discarded – undo
649 677
 			$url = add_query_arg( 'attachment_id', $post_id, $url );
650 678
 		} else {
651 679
 			$url = trailingslashit($url) . 'feed';
652
-			if ( $feed != get_default_feed() )
653
-				$url .= "/$feed";
680
+			if ( $feed != get_default_feed() ) {
681
+							$url .= "/$feed";
682
+			}
654 683
 			$url = user_trailingslashit($url, 'single_feed');
655 684
 		}
656 685
 	} else {
@@ -721,17 +750,19 @@  discard block
 block discarded – undo
721 750
 	$author_id = (int) $author_id;
722 751
 	$permalink_structure = get_option('permalink_structure');
723 752
 
724
-	if ( empty($feed) )
725
-		$feed = get_default_feed();
753
+	if ( empty($feed) ) {
754
+			$feed = get_default_feed();
755
+	}
726 756
 
727 757
 	if ( '' == $permalink_structure ) {
728 758
 		$link = home_url("?feed=$feed&amp;author=" . $author_id);
729 759
 	} else {
730 760
 		$link = get_author_posts_url($author_id);
731
-		if ( $feed == get_default_feed() )
732
-			$feed_link = 'feed';
733
-		else
734
-			$feed_link = "feed/$feed";
761
+		if ( $feed == get_default_feed() ) {
762
+					$feed_link = 'feed';
763
+		} else {
764
+					$feed_link = "feed/$feed";
765
+		}
735 766
 
736 767
 		$link = trailingslashit($link) . user_trailingslashit($feed_link, 'feed');
737 768
 	}
@@ -783,19 +814,20 @@  discard block
 block discarded – undo
783 814
 
784 815
 	$term = get_term( $term_id, $taxonomy  );
785 816
 
786
-	if ( empty( $term ) || is_wp_error( $term ) )
787
-		return false;
817
+	if ( empty( $term ) || is_wp_error( $term ) ) {
818
+			return false;
819
+	}
788 820
 
789
-	if ( empty( $feed ) )
790
-		$feed = get_default_feed();
821
+	if ( empty( $feed ) ) {
822
+			$feed = get_default_feed();
823
+	}
791 824
 
792 825
 	$permalink_structure = get_option( 'permalink_structure' );
793 826
 
794 827
 	if ( '' == $permalink_structure ) {
795 828
 		if ( 'category' == $taxonomy ) {
796 829
 			$link = home_url("?feed=$feed&amp;cat=$term_id");
797
-		}
798
-		elseif ( 'post_tag' == $taxonomy ) {
830
+		} elseif ( 'post_tag' == $taxonomy ) {
799 831
 			$link = home_url("?feed=$feed&amp;tag=$term->slug");
800 832
 		} else {
801 833
 			$t = get_taxonomy( $taxonomy );
@@ -803,10 +835,11 @@  discard block
 block discarded – undo
803 835
 		}
804 836
 	} else {
805 837
 		$link = get_term_link( $term_id, $term->taxonomy );
806
-		if ( $feed == get_default_feed() )
807
-			$feed_link = 'feed';
808
-		else
809
-			$feed_link = "feed/$feed";
838
+		if ( $feed == get_default_feed() ) {
839
+					$feed_link = 'feed';
840
+		} else {
841
+					$feed_link = "feed/$feed";
842
+		}
810 843
 
811 844
 		$link = trailingslashit( $link ) . user_trailingslashit( $feed_link, 'feed' );
812 845
 	}
@@ -969,18 +1002,22 @@  discard block
 block discarded – undo
969 1002
  * @return string|void HTML content.
970 1003
  */
971 1004
 function edit_term_link( $link = '', $before = '', $after = '', $term = null, $echo = true ) {
972
-	if ( is_null( $term ) )
973
-		$term = get_queried_object();
1005
+	if ( is_null( $term ) ) {
1006
+			$term = get_queried_object();
1007
+	}
974 1008
 
975
-	if ( ! $term )
976
-		return;
1009
+	if ( ! $term ) {
1010
+			return;
1011
+	}
977 1012
 
978 1013
 	$tax = get_taxonomy( $term->taxonomy );
979
-	if ( ! current_user_can( $tax->cap->edit_terms ) )
980
-		return;
1014
+	if ( ! current_user_can( $tax->cap->edit_terms ) ) {
1015
+			return;
1016
+	}
981 1017
 
982
-	if ( empty( $link ) )
983
-		$link = __('Edit This');
1018
+	if ( empty( $link ) ) {
1019
+			$link = __('Edit This');
1020
+	}
984 1021
 
985 1022
 	$link = '<a href="' . get_edit_term_link( $term->term_id, $term->taxonomy ) . '">' . $link . '</a>';
986 1023
 
@@ -994,11 +1031,12 @@  discard block
 block discarded – undo
994 1031
 	 */
995 1032
 	$link = $before . apply_filters( 'edit_term_link', $link, $term->term_id ) . $after;
996 1033
 
997
-	if ( $echo )
998
-		echo $link;
999
-	else
1000
-		return $link;
1001
-}
1034
+	if ( $echo ) {
1035
+			echo $link;
1036
+	} else {
1037
+			return $link;
1038
+	}
1039
+	}
1002 1040
 
1003 1041
 /**
1004 1042
  * Retrieve permalink for search.
@@ -1013,10 +1051,11 @@  discard block
 block discarded – undo
1013 1051
 function get_search_link( $query = '' ) {
1014 1052
 	global $wp_rewrite;
1015 1053
 
1016
-	if ( empty($query) )
1017
-		$search = get_search_query( false );
1018
-	else
1019
-		$search = stripslashes($query);
1054
+	if ( empty($query) ) {
1055
+			$search = get_search_query( false );
1056
+	} else {
1057
+			$search = stripslashes($query);
1058
+	}
1020 1059
 
1021 1060
 	$permastruct = $wp_rewrite->get_search_permastruct();
1022 1061
 
@@ -1055,8 +1094,9 @@  discard block
 block discarded – undo
1055 1094
 	global $wp_rewrite;
1056 1095
 	$link = get_search_link($search_query);
1057 1096
 
1058
-	if ( empty($feed) )
1059
-		$feed = get_default_feed();
1097
+	if ( empty($feed) ) {
1098
+			$feed = get_default_feed();
1099
+	}
1060 1100
 
1061 1101
 	$permastruct = $wp_rewrite->get_search_permastruct();
1062 1102
 
@@ -1093,17 +1133,19 @@  discard block
 block discarded – undo
1093 1133
 function get_search_comments_feed_link($search_query = '', $feed = '') {
1094 1134
 	global $wp_rewrite;
1095 1135
 
1096
-	if ( empty($feed) )
1097
-		$feed = get_default_feed();
1136
+	if ( empty($feed) ) {
1137
+			$feed = get_default_feed();
1138
+	}
1098 1139
 
1099 1140
 	$link = get_search_feed_link($search_query, $feed);
1100 1141
 
1101 1142
 	$permastruct = $wp_rewrite->get_search_permastruct();
1102 1143
 
1103
-	if ( empty($permastruct) )
1104
-		$link = add_query_arg('feed', 'comments-' . $feed, $link);
1105
-	else
1106
-		$link = add_query_arg('withcomments', 1, $link);
1144
+	if ( empty($permastruct) ) {
1145
+			$link = add_query_arg('feed', 'comments-' . $feed, $link);
1146
+	} else {
1147
+			$link = add_query_arg('withcomments', 1, $link);
1148
+	}
1107 1149
 
1108 1150
 	/** This filter is documented in wp-includes/link-template.php */
1109 1151
 	return apply_filters( 'search_feed_link', $link, $feed, 'comments' );
@@ -1122,8 +1164,9 @@  discard block
 block discarded – undo
1122 1164
  */
1123 1165
 function get_post_type_archive_link( $post_type ) {
1124 1166
 	global $wp_rewrite;
1125
-	if ( ! $post_type_obj = get_post_type_object( $post_type ) )
1126
-		return false;
1167
+	if ( ! $post_type_obj = get_post_type_object( $post_type ) ) {
1168
+			return false;
1169
+	}
1127 1170
 
1128 1171
 	if ( 'post' === $post_type ) {
1129 1172
 		$show_on_front = get_option( 'show_on_front' );
@@ -1138,15 +1181,17 @@  discard block
 block discarded – undo
1138 1181
 		return apply_filters( 'post_type_archive_link', $link, $post_type );
1139 1182
 	}
1140 1183
 
1141
-	if ( ! $post_type_obj->has_archive )
1142
-		return false;
1184
+	if ( ! $post_type_obj->has_archive ) {
1185
+			return false;
1186
+	}
1143 1187
 
1144 1188
 	if ( get_option( 'permalink_structure' ) && is_array( $post_type_obj->rewrite ) ) {
1145 1189
 		$struct = ( true === $post_type_obj->has_archive ) ? $post_type_obj->rewrite['slug'] : $post_type_obj->has_archive;
1146
-		if ( $post_type_obj->rewrite['with_front'] )
1147
-			$struct = $wp_rewrite->front . $struct;
1148
-		else
1149
-			$struct = $wp_rewrite->root . $struct;
1190
+		if ( $post_type_obj->rewrite['with_front'] ) {
1191
+					$struct = $wp_rewrite->front . $struct;
1192
+		} else {
1193
+					$struct = $wp_rewrite->root . $struct;
1194
+		}
1150 1195
 		$link = home_url( user_trailingslashit( $struct, 'post_type_archive' ) );
1151 1196
 	} else {
1152 1197
 		$link = home_url( '?post_type=' . $post_type );
@@ -1174,18 +1219,21 @@  discard block
 block discarded – undo
1174 1219
  */
1175 1220
 function get_post_type_archive_feed_link( $post_type, $feed = '' ) {
1176 1221
 	$default_feed = get_default_feed();
1177
-	if ( empty( $feed ) )
1178
-		$feed = $default_feed;
1222
+	if ( empty( $feed ) ) {
1223
+			$feed = $default_feed;
1224
+	}
1179 1225
 
1180
-	if ( ! $link = get_post_type_archive_link( $post_type ) )
1181
-		return false;
1226
+	if ( ! $link = get_post_type_archive_link( $post_type ) ) {
1227
+			return false;
1228
+	}
1182 1229
 
1183 1230
 	$post_type_obj = get_post_type_object( $post_type );
1184 1231
 	if ( get_option( 'permalink_structure' ) && is_array( $post_type_obj->rewrite ) && $post_type_obj->rewrite['feeds'] ) {
1185 1232
 		$link = trailingslashit( $link );
1186 1233
 		$link .= 'feed/';
1187
-		if ( $feed != $default_feed )
1188
-			$link .= "$feed/";
1234
+		if ( $feed != $default_feed ) {
1235
+					$link .= "$feed/";
1236
+		}
1189 1237
 	} else {
1190 1238
 		$link = add_query_arg( 'feed', $feed, $link );
1191 1239
 	}
@@ -1255,22 +1303,26 @@  discard block
 block discarded – undo
1255 1303
  *                     not allow an editing UI.
1256 1304
  */
1257 1305
 function get_edit_post_link( $id = 0, $context = 'display' ) {
1258
-	if ( ! $post = get_post( $id ) )
1259
-		return;
1306
+	if ( ! $post = get_post( $id ) ) {
1307
+			return;
1308
+	}
1260 1309
 
1261
-	if ( 'revision' === $post->post_type )
1262
-		$action = '';
1263
-	elseif ( 'display' == $context )
1264
-		$action = '&amp;action=edit';
1265
-	else
1266
-		$action = '&action=edit';
1310
+	if ( 'revision' === $post->post_type ) {
1311
+			$action = '';
1312
+	} elseif ( 'display' == $context ) {
1313
+			$action = '&amp;action=edit';
1314
+	} else {
1315
+			$action = '&action=edit';
1316
+	}
1267 1317
 
1268 1318
 	$post_type_object = get_post_type_object( $post->post_type );
1269
-	if ( !$post_type_object )
1270
-		return;
1319
+	if ( !$post_type_object ) {
1320
+			return;
1321
+	}
1271 1322
 
1272
-	if ( !current_user_can( 'edit_post', $post->ID ) )
1273
-		return;
1323
+	if ( !current_user_can( 'edit_post', $post->ID ) ) {
1324
+			return;
1325
+	}
1274 1326
 
1275 1327
 	if ( $post_type_object->_edit_link ) {
1276 1328
 		$link = admin_url( sprintf( $post_type_object->_edit_link . $action, $post->ID ) );
@@ -1343,18 +1395,22 @@  discard block
 block discarded – undo
1343 1395
  * @return string|void The delete post link URL for the given post.
1344 1396
  */
1345 1397
 function get_delete_post_link( $id = 0, $deprecated = '', $force_delete = false ) {
1346
-	if ( ! empty( $deprecated ) )
1347
-		_deprecated_argument( __FUNCTION__, '3.0' );
1398
+	if ( ! empty( $deprecated ) ) {
1399
+			_deprecated_argument( __FUNCTION__, '3.0' );
1400
+	}
1348 1401
 
1349
-	if ( !$post = get_post( $id ) )
1350
-		return;
1402
+	if ( !$post = get_post( $id ) ) {
1403
+			return;
1404
+	}
1351 1405
 
1352 1406
 	$post_type_object = get_post_type_object( $post->post_type );
1353
-	if ( !$post_type_object )
1354
-		return;
1407
+	if ( !$post_type_object ) {
1408
+			return;
1409
+	}
1355 1410
 
1356
-	if ( !current_user_can( 'delete_post', $post->ID ) )
1357
-		return;
1411
+	if ( !current_user_can( 'delete_post', $post->ID ) ) {
1412
+			return;
1413
+	}
1358 1414
 
1359 1415
 	$action = ( $force_delete || !EMPTY_TRASH_DAYS ) ? 'delete' : 'trash';
1360 1416
 
@@ -1383,8 +1439,9 @@  discard block
 block discarded – undo
1383 1439
 function get_edit_comment_link( $comment_id = 0 ) {
1384 1440
 	$comment = get_comment( $comment_id );
1385 1441
 
1386
-	if ( !current_user_can( 'edit_comment', $comment->comment_ID ) )
1387
-		return;
1442
+	if ( !current_user_can( 'edit_comment', $comment->comment_ID ) ) {
1443
+			return;
1444
+	}
1388 1445
 
1389 1446
 	$location = admin_url('comment.php?action=editcomment&amp;c=') . $comment->comment_ID;
1390 1447
 
@@ -1443,8 +1500,9 @@  discard block
 block discarded – undo
1443 1500
 function get_edit_bookmark_link( $link = 0 ) {
1444 1501
 	$link = get_bookmark( $link );
1445 1502
 
1446
-	if ( !current_user_can('manage_links') )
1447
-		return;
1503
+	if ( !current_user_can('manage_links') ) {
1504
+			return;
1505
+	}
1448 1506
 
1449 1507
 	$location = admin_url('link.php?action=edit&amp;link_id=') . $link->link_id;
1450 1508
 
@@ -1472,11 +1530,13 @@  discard block
 block discarded – undo
1472 1530
 function edit_bookmark_link( $link = '', $before = '', $after = '', $bookmark = null ) {
1473 1531
 	$bookmark = get_bookmark($bookmark);
1474 1532
 
1475
-	if ( !current_user_can('manage_links') )
1476
-		return;
1533
+	if ( !current_user_can('manage_links') ) {
1534
+			return;
1535
+	}
1477 1536
 
1478
-	if ( empty($link) )
1479
-		$link = __('Edit This');
1537
+	if ( empty($link) ) {
1538
+			$link = __('Edit This');
1539
+	}
1480 1540
 
1481 1541
 	$link = '<a href="' . esc_url( get_edit_bookmark_link( $bookmark ) ) . '">' . $link . '</a>';
1482 1542
 
@@ -1500,21 +1560,25 @@  discard block
 block discarded – undo
1500 1560
  * @return string URL to edit user page or empty string.
1501 1561
  */
1502 1562
 function get_edit_user_link( $user_id = null ) {
1503
-	if ( ! $user_id )
1504
-		$user_id = get_current_user_id();
1563
+	if ( ! $user_id ) {
1564
+			$user_id = get_current_user_id();
1565
+	}
1505 1566
 
1506
-	if ( empty( $user_id ) || ! current_user_can( 'edit_user', $user_id ) )
1507
-		return '';
1567
+	if ( empty( $user_id ) || ! current_user_can( 'edit_user', $user_id ) ) {
1568
+			return '';
1569
+	}
1508 1570
 
1509 1571
 	$user = get_userdata( $user_id );
1510 1572
 
1511
-	if ( ! $user )
1512
-		return '';
1573
+	if ( ! $user ) {
1574
+			return '';
1575
+	}
1513 1576
 
1514
-	if ( get_current_user_id() == $user->ID )
1515
-		$link = get_edit_profile_url( $user->ID );
1516
-	else
1517
-		$link = add_query_arg( 'user_id', $user->ID, self_admin_url( 'user-edit.php' ) );
1577
+	if ( get_current_user_id() == $user->ID ) {
1578
+			$link = get_edit_profile_url( $user->ID );
1579
+	} else {
1580
+			$link = add_query_arg( 'user_id', $user->ID, self_admin_url( 'user-edit.php' ) );
1581
+	}
1518 1582
 
1519 1583
 	/**
1520 1584
 	 * Filter the user edit link.
@@ -1575,8 +1639,9 @@  discard block
 block discarded – undo
1575 1639
 function get_adjacent_post( $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category' ) {
1576 1640
 	global $wpdb;
1577 1641
 
1578
-	if ( ( ! $post = get_post() ) || ! taxonomy_exists( $taxonomy ) )
1579
-		return null;
1642
+	if ( ( ! $post = get_post() ) || ! taxonomy_exists( $taxonomy ) ) {
1643
+			return null;
1644
+	}
1580 1645
 
1581 1646
 	$current_post_date = $post->post_date;
1582 1647
 
@@ -1601,16 +1666,18 @@  discard block
 block discarded – undo
1601 1666
 			$join .= " INNER JOIN $wpdb->term_relationships AS tr ON p.ID = tr.object_id INNER JOIN $wpdb->term_taxonomy tt ON tr.term_taxonomy_id = tt.term_taxonomy_id";
1602 1667
 			$where .= $wpdb->prepare( "AND tt.taxonomy = %s", $taxonomy );
1603 1668
 
1604
-			if ( ! is_object_in_taxonomy( $post->post_type, $taxonomy ) )
1605
-				return '';
1669
+			if ( ! is_object_in_taxonomy( $post->post_type, $taxonomy ) ) {
1670
+							return '';
1671
+			}
1606 1672
 			$term_array = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'ids' ) );
1607 1673
 
1608 1674
 			// Remove any exclusions from the term array to include.
1609 1675
 			$term_array = array_diff( $term_array, (array) $excluded_terms );
1610 1676
 			$term_array = array_map( 'intval', $term_array );
1611 1677
 
1612
-			if ( ! $term_array || is_wp_error( $term_array ) )
1613
-				return '';
1678
+			if ( ! $term_array || is_wp_error( $term_array ) ) {
1679
+							return '';
1680
+			}
1614 1681
 
1615 1682
 			$where .= " AND tt.term_id IN (" . implode( ',', $term_array ) . ")";
1616 1683
 		}
@@ -1717,19 +1784,22 @@  discard block
 block discarded – undo
1717 1784
 	$query_key = 'adjacent_post_' . md5( $query );
1718 1785
 	$result = wp_cache_get( $query_key, 'counts' );
1719 1786
 	if ( false !== $result ) {
1720
-		if ( $result )
1721
-			$result = get_post( $result );
1787
+		if ( $result ) {
1788
+					$result = get_post( $result );
1789
+		}
1722 1790
 		return $result;
1723 1791
 	}
1724 1792
 
1725 1793
 	$result = $wpdb->get_var( $query );
1726
-	if ( null === $result )
1727
-		$result = '';
1794
+	if ( null === $result ) {
1795
+			$result = '';
1796
+	}
1728 1797
 
1729 1798
 	wp_cache_set( $query_key, $result, 'counts' );
1730 1799
 
1731
-	if ( $result )
1732
-		$result = get_post( $result );
1800
+	if ( $result ) {
1801
+			$result = get_post( $result );
1802
+	}
1733 1803
 
1734 1804
 	return $result;
1735 1805
 }
@@ -1749,18 +1819,21 @@  discard block
 block discarded – undo
1749 1819
  * @return string|void The adjacent post relational link URL.
1750 1820
  */
1751 1821
 function get_adjacent_post_rel_link( $title = '%title', $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category' ) {
1752
-	if ( $previous && is_attachment() && $post = get_post() )
1753
-		$post = get_post( $post->post_parent );
1754
-	else
1755
-		$post = get_adjacent_post( $in_same_term, $excluded_terms, $previous, $taxonomy );
1822
+	if ( $previous && is_attachment() && $post = get_post() ) {
1823
+			$post = get_post( $post->post_parent );
1824
+	} else {
1825
+			$post = get_adjacent_post( $in_same_term, $excluded_terms, $previous, $taxonomy );
1826
+	}
1756 1827
 
1757
-	if ( empty( $post ) )
1758
-		return;
1828
+	if ( empty( $post ) ) {
1829
+			return;
1830
+	}
1759 1831
 
1760 1832
 	$post_title = the_title_attribute( array( 'echo' => false, 'post' => $post ) );
1761 1833
 
1762
-	if ( empty( $post_title ) )
1763
-		$post_title = $previous ? __( 'Previous Post' ) : __( 'Next Post' );
1834
+	if ( empty( $post_title ) ) {
1835
+			$post_title = $previous ? __( 'Previous Post' ) : __( 'Next Post' );
1836
+	}
1764 1837
 
1765 1838
 	$date = mysql2date( get_option( 'date_format' ), $post->post_date );
1766 1839
 
@@ -1859,8 +1932,9 @@  discard block
 block discarded – undo
1859 1932
  */
1860 1933
 function get_boundary_post( $in_same_term = false, $excluded_terms = '', $start = true, $taxonomy = 'category' ) {
1861 1934
 	$post = get_post();
1862
-	if ( ! $post || ! is_single() || is_attachment() || ! taxonomy_exists( $taxonomy ) )
1863
-		return null;
1935
+	if ( ! $post || ! is_single() || is_attachment() || ! taxonomy_exists( $taxonomy ) ) {
1936
+			return null;
1937
+	}
1864 1938
 
1865 1939
 	$query_args = array(
1866 1940
 		'posts_per_page' => 1,
@@ -1872,23 +1946,26 @@  discard block
 block discarded – undo
1872 1946
 	$term_array = array();
1873 1947
 
1874 1948
 	if ( ! is_array( $excluded_terms ) ) {
1875
-		if ( ! empty( $excluded_terms ) )
1876
-			$excluded_terms = explode( ',', $excluded_terms );
1877
-		else
1878
-			$excluded_terms = array();
1949
+		if ( ! empty( $excluded_terms ) ) {
1950
+					$excluded_terms = explode( ',', $excluded_terms );
1951
+		} else {
1952
+					$excluded_terms = array();
1953
+		}
1879 1954
 	}
1880 1955
 
1881 1956
 	if ( $in_same_term || ! empty( $excluded_terms ) ) {
1882
-		if ( $in_same_term )
1883
-			$term_array = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'ids' ) );
1957
+		if ( $in_same_term ) {
1958
+					$term_array = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'ids' ) );
1959
+		}
1884 1960
 
1885 1961
 		if ( ! empty( $excluded_terms ) ) {
1886 1962
 			$excluded_terms = array_map( 'intval', $excluded_terms );
1887 1963
 			$excluded_terms = array_diff( $excluded_terms, $term_array );
1888 1964
 
1889 1965
 			$inverse_terms = array();
1890
-			foreach ( $excluded_terms as $excluded_term )
1891
-				$inverse_terms[] = $excluded_term * -1;
1966
+			foreach ( $excluded_terms as $excluded_term ) {
1967
+							$inverse_terms[] = $excluded_term * -1;
1968
+			}
1892 1969
 			$excluded_terms = $inverse_terms;
1893 1970
 		}
1894 1971
 
@@ -1981,18 +2058,20 @@  discard block
 block discarded – undo
1981 2058
  * @return string The link URL of the previous or next post in relation to the current post.
1982 2059
  */
1983 2060
 function get_adjacent_post_link( $format, $link, $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category' ) {
1984
-	if ( $previous && is_attachment() )
1985
-		$post = get_post( get_post()->post_parent );
1986
-	else
1987
-		$post = get_adjacent_post( $in_same_term, $excluded_terms, $previous, $taxonomy );
2061
+	if ( $previous && is_attachment() ) {
2062
+			$post = get_post( get_post()->post_parent );
2063
+	} else {
2064
+			$post = get_adjacent_post( $in_same_term, $excluded_terms, $previous, $taxonomy );
2065
+	}
1988 2066
 
1989 2067
 	if ( ! $post ) {
1990 2068
 		$output = '';
1991 2069
 	} else {
1992 2070
 		$title = $post->post_title;
1993 2071
 
1994
-		if ( empty( $post->post_title ) )
1995
-			$title = $previous ? __( 'Previous Post' ) : __( 'Next Post' );
2072
+		if ( empty( $post->post_title ) ) {
2073
+					$title = $previous ? __( 'Previous Post' ) : __( 'Next Post' );
2074
+		}
1996 2075
 
1997 2076
 		/** This filter is documented in wp-includes/post-template.php */
1998 2077
 		$title = apply_filters( 'the_title', $title, $post->ID );
@@ -2097,8 +2176,9 @@  discard block
 block discarded – undo
2097 2176
 
2098 2177
 		$base = trailingslashit( get_bloginfo( 'url' ) );
2099 2178
 
2100
-		if ( $wp_rewrite->using_index_permalinks() && ( $pagenum > 1 || '' != $request ) )
2101
-			$base .= $wp_rewrite->index . '/';
2179
+		if ( $wp_rewrite->using_index_permalinks() && ( $pagenum > 1 || '' != $request ) ) {
2180
+					$base .= $wp_rewrite->index . '/';
2181
+		}
2102 2182
 
2103 2183
 		if ( $pagenum > 1 ) {
2104 2184
 			$request = ( ( !empty( $request ) ) ? trailingslashit( $request ) : $request ) . user_trailingslashit( $wp_rewrite->pagination_base . "/" . $pagenum, 'paged' );
@@ -2116,11 +2196,12 @@  discard block
 block discarded – undo
2116 2196
 	 */
2117 2197
 	$result = apply_filters( 'get_pagenum_link', $result );
2118 2198
 
2119
-	if ( $escape )
2120
-		return esc_url( $result );
2121
-	else
2122
-		return esc_url_raw( $result );
2123
-}
2199
+	if ( $escape ) {
2200
+			return esc_url( $result );
2201
+	} else {
2202
+			return esc_url_raw( $result );
2203
+	}
2204
+	}
2124 2205
 
2125 2206
 /**
2126 2207
  * Retrieve next posts page link.
@@ -2138,11 +2219,13 @@  discard block
 block discarded – undo
2138 2219
 	global $paged;
2139 2220
 
2140 2221
 	if ( !is_single() ) {
2141
-		if ( !$paged )
2142
-			$paged = 1;
2222
+		if ( !$paged ) {
2223
+					$paged = 1;
2224
+		}
2143 2225
 		$nextpage = intval($paged) + 1;
2144
-		if ( !$max_page || $max_page >= $nextpage )
2145
-			return get_pagenum_link($nextpage);
2226
+		if ( !$max_page || $max_page >= $nextpage ) {
2227
+					return get_pagenum_link($nextpage);
2228
+		}
2146 2229
 	}
2147 2230
 }
2148 2231
 
@@ -2158,11 +2241,12 @@  discard block
 block discarded – undo
2158 2241
 function next_posts( $max_page = 0, $echo = true ) {
2159 2242
 	$output = esc_url( get_next_posts_page_link( $max_page ) );
2160 2243
 
2161
-	if ( $echo )
2162
-		echo $output;
2163
-	else
2164
-		return $output;
2165
-}
2244
+	if ( $echo ) {
2245
+			echo $output;
2246
+	} else {
2247
+			return $output;
2248
+	}
2249
+	}
2166 2250
 
2167 2251
 /**
2168 2252
  * Return the next posts page link.
@@ -2179,16 +2263,19 @@  discard block
 block discarded – undo
2179 2263
 function get_next_posts_link( $label = null, $max_page = 0 ) {
2180 2264
 	global $paged, $wp_query;
2181 2265
 
2182
-	if ( !$max_page )
2183
-		$max_page = $wp_query->max_num_pages;
2266
+	if ( !$max_page ) {
2267
+			$max_page = $wp_query->max_num_pages;
2268
+	}
2184 2269
 
2185
-	if ( !$paged )
2186
-		$paged = 1;
2270
+	if ( !$paged ) {
2271
+			$paged = 1;
2272
+	}
2187 2273
 
2188 2274
 	$nextpage = intval($paged) + 1;
2189 2275
 
2190
-	if ( null === $label )
2191
-		$label = __( 'Next Page &raquo;' );
2276
+	if ( null === $label ) {
2277
+			$label = __( 'Next Page &raquo;' );
2278
+	}
2192 2279
 
2193 2280
 	if ( !is_single() && ( $nextpage <= $max_page ) ) {
2194 2281
 		/**
@@ -2234,8 +2321,9 @@  discard block
 block discarded – undo
2234 2321
 
2235 2322
 	if ( !is_single() ) {
2236 2323
 		$nextpage = intval($paged) - 1;
2237
-		if ( $nextpage < 1 )
2238
-			$nextpage = 1;
2324
+		if ( $nextpage < 1 ) {
2325
+					$nextpage = 1;
2326
+		}
2239 2327
 		return get_pagenum_link($nextpage);
2240 2328
 	}
2241 2329
 }
@@ -2251,11 +2339,12 @@  discard block
 block discarded – undo
2251 2339
 function previous_posts( $echo = true ) {
2252 2340
 	$output = esc_url( get_previous_posts_page_link() );
2253 2341
 
2254
-	if ( $echo )
2255
-		echo $output;
2256
-	else
2257
-		return $output;
2258
-}
2342
+	if ( $echo ) {
2343
+			echo $output;
2344
+	} else {
2345
+			return $output;
2346
+	}
2347
+	}
2259 2348
 
2260 2349
 /**
2261 2350
  * Return the previous posts page link.
@@ -2270,8 +2359,9 @@  discard block
 block discarded – undo
2270 2359
 function get_previous_posts_link( $label = null ) {
2271 2360
 	global $paged;
2272 2361
 
2273
-	if ( null === $label )
2274
-		$label = __( '&laquo; Previous Page' );
2362
+	if ( null === $label ) {
2363
+			$label = __( '&laquo; Previous Page' );
2364
+	}
2275 2365
 
2276 2366
 	if ( !is_single() && $paged > 1 ) {
2277 2367
 		/**
@@ -2597,16 +2687,18 @@  discard block
 block discarded – undo
2597 2687
 
2598 2688
 	if ( 'newest' == get_option('default_comments_page') ) {
2599 2689
 		if ( $pagenum != $max_page ) {
2600
-			if ( $wp_rewrite->using_permalinks() )
2601
-				$result = user_trailingslashit( trailingslashit($result) . $wp_rewrite->comments_pagination_base . '-' . $pagenum, 'commentpaged');
2602
-			else
2603
-				$result = add_query_arg( 'cpage', $pagenum, $result );
2690
+			if ( $wp_rewrite->using_permalinks() ) {
2691
+							$result = user_trailingslashit( trailingslashit($result) . $wp_rewrite->comments_pagination_base . '-' . $pagenum, 'commentpaged');
2692
+			} else {
2693
+							$result = add_query_arg( 'cpage', $pagenum, $result );
2694
+			}
2604 2695
 		}
2605 2696
 	} elseif ( $pagenum > 1 ) {
2606
-		if ( $wp_rewrite->using_permalinks() )
2607
-			$result = user_trailingslashit( trailingslashit($result) . $wp_rewrite->comments_pagination_base . '-' . $pagenum, 'commentpaged');
2608
-		else
2609
-			$result = add_query_arg( 'cpage', $pagenum, $result );
2697
+		if ( $wp_rewrite->using_permalinks() ) {
2698
+					$result = user_trailingslashit( trailingslashit($result) . $wp_rewrite->comments_pagination_base . '-' . $pagenum, 'commentpaged');
2699
+		} else {
2700
+					$result = add_query_arg( 'cpage', $pagenum, $result );
2701
+		}
2610 2702
 	}
2611 2703
 
2612 2704
 	$result .= '#comments';
@@ -2635,8 +2727,9 @@  discard block
 block discarded – undo
2635 2727
 function get_next_comments_link( $label = '', $max_page = 0 ) {
2636 2728
 	global $wp_query;
2637 2729
 
2638
-	if ( ! is_singular() )
2639
-		return;
2730
+	if ( ! is_singular() ) {
2731
+			return;
2732
+	}
2640 2733
 
2641 2734
 	$page = get_query_var('cpage');
2642 2735
 
@@ -2646,17 +2739,21 @@  discard block
 block discarded – undo
2646 2739
 
2647 2740
 	$nextpage = intval($page) + 1;
2648 2741
 
2649
-	if ( empty($max_page) )
2650
-		$max_page = $wp_query->max_num_comment_pages;
2742
+	if ( empty($max_page) ) {
2743
+			$max_page = $wp_query->max_num_comment_pages;
2744
+	}
2651 2745
 
2652
-	if ( empty($max_page) )
2653
-		$max_page = get_comment_pages_count();
2746
+	if ( empty($max_page) ) {
2747
+			$max_page = get_comment_pages_count();
2748
+	}
2654 2749
 
2655
-	if ( $nextpage > $max_page )
2656
-		return;
2750
+	if ( $nextpage > $max_page ) {
2751
+			return;
2752
+	}
2657 2753
 
2658
-	if ( empty($label) )
2659
-		$label = __('Newer Comments &raquo;');
2754
+	if ( empty($label) ) {
2755
+			$label = __('Newer Comments &raquo;');
2756
+	}
2660 2757
 
2661 2758
 	/**
2662 2759
 	 * Filter the anchor tag attributes for the next comments page link.
@@ -2689,18 +2786,21 @@  discard block
 block discarded – undo
2689 2786
  * @return string|void HTML-formatted link for the previous page of comments.
2690 2787
  */
2691 2788
 function get_previous_comments_link( $label = '' ) {
2692
-	if ( ! is_singular() )
2693
-		return;
2789
+	if ( ! is_singular() ) {
2790
+			return;
2791
+	}
2694 2792
 
2695 2793
 	$page = get_query_var('cpage');
2696 2794
 
2697
-	if ( intval($page) <= 1 )
2698
-		return;
2795
+	if ( intval($page) <= 1 ) {
2796
+			return;
2797
+	}
2699 2798
 
2700 2799
 	$prevpage = intval($page) - 1;
2701 2800
 
2702
-	if ( empty($label) )
2703
-		$label = __('&laquo; Older Comments');
2801
+	if ( empty($label) ) {
2802
+			$label = __('&laquo; Older Comments');
2803
+	}
2704 2804
 
2705 2805
 	/**
2706 2806
 	 * Filter the anchor tag attributes for the previous comments page link.
@@ -2737,12 +2837,14 @@  discard block
 block discarded – undo
2737 2837
 function paginate_comments_links($args = array()) {
2738 2838
 	global $wp_rewrite;
2739 2839
 
2740
-	if ( ! is_singular() )
2741
-		return;
2840
+	if ( ! is_singular() ) {
2841
+			return;
2842
+	}
2742 2843
 
2743 2844
 	$page = get_query_var('cpage');
2744
-	if ( !$page )
2745
-		$page = 1;
2845
+	if ( !$page ) {
2846
+			$page = 1;
2847
+	}
2746 2848
 	$max_page = get_comment_pages_count();
2747 2849
 	$defaults = array(
2748 2850
 		'base' => add_query_arg( 'cpage', '%#%' ),
@@ -2752,17 +2854,19 @@  discard block
 block discarded – undo
2752 2854
 		'echo' => true,
2753 2855
 		'add_fragment' => '#comments'
2754 2856
 	);
2755
-	if ( $wp_rewrite->using_permalinks() )
2756
-		$defaults['base'] = user_trailingslashit(trailingslashit(get_permalink()) . $wp_rewrite->comments_pagination_base . '-%#%', 'commentpaged');
2857
+	if ( $wp_rewrite->using_permalinks() ) {
2858
+			$defaults['base'] = user_trailingslashit(trailingslashit(get_permalink()) . $wp_rewrite->comments_pagination_base . '-%#%', 'commentpaged');
2859
+	}
2757 2860
 
2758 2861
 	$args = wp_parse_args( $args, $defaults );
2759 2862
 	$page_links = paginate_links( $args );
2760 2863
 
2761
-	if ( $args['echo'] )
2762
-		echo $page_links;
2763
-	else
2764
-		return $page_links;
2765
-}
2864
+	if ( $args['echo'] ) {
2865
+			echo $page_links;
2866
+	} else {
2867
+			return $page_links;
2868
+	}
2869
+	}
2766 2870
 
2767 2871
 /**
2768 2872
  * Returns navigation to next/previous set of comments when applicable.
@@ -2975,16 +3079,18 @@  discard block
 block discarded – undo
2975 3079
 	}
2976 3080
 
2977 3081
 	if ( ! in_array( $scheme, array( 'http', 'https', 'relative' ) ) ) {
2978
-		if ( is_ssl() && ! is_admin() && 'wp-login.php' !== $pagenow )
2979
-			$scheme = 'https';
2980
-		else
2981
-			$scheme = parse_url( $url, PHP_URL_SCHEME );
3082
+		if ( is_ssl() && ! is_admin() && 'wp-login.php' !== $pagenow ) {
3083
+					$scheme = 'https';
3084
+		} else {
3085
+					$scheme = parse_url( $url, PHP_URL_SCHEME );
3086
+		}
2982 3087
 	}
2983 3088
 
2984 3089
 	$url = set_url_scheme( $url, $scheme );
2985 3090
 
2986
-	if ( $path && is_string( $path ) )
2987
-		$url .= '/' . ltrim( $path, '/' );
3091
+	if ( $path && is_string( $path ) ) {
3092
+			$url .= '/' . ltrim( $path, '/' );
3093
+	}
2988 3094
 
2989 3095
 	/**
2990 3096
 	 * Filter the home URL.
@@ -3046,8 +3152,9 @@  discard block
 block discarded – undo
3046 3152
 
3047 3153
 	$url = set_url_scheme( $url, $scheme );
3048 3154
 
3049
-	if ( $path && is_string( $path ) )
3050
-		$url .= '/' . ltrim( $path, '/' );
3155
+	if ( $path && is_string( $path ) ) {
3156
+			$url .= '/' . ltrim( $path, '/' );
3157
+	}
3051 3158
 
3052 3159
 	/**
3053 3160
 	 * Filter the site URL.
@@ -3091,8 +3198,9 @@  discard block
 block discarded – undo
3091 3198
 function get_admin_url( $blog_id = null, $path = '', $scheme = 'admin' ) {
3092 3199
 	$url = get_site_url($blog_id, 'wp-admin/', $scheme);
3093 3200
 
3094
-	if ( $path && is_string( $path ) )
3095
-		$url .= ltrim( $path, '/' );
3201
+	if ( $path && is_string( $path ) ) {
3202
+			$url .= ltrim( $path, '/' );
3203
+	}
3096 3204
 
3097 3205
 	/**
3098 3206
 	 * Filter the admin area URL.
@@ -3118,8 +3226,9 @@  discard block
 block discarded – undo
3118 3226
 function includes_url( $path = '', $scheme = null ) {
3119 3227
 	$url = site_url( '/' . WPINC . '/', $scheme );
3120 3228
 
3121
-	if ( $path && is_string( $path ) )
3122
-		$url .= ltrim($path, '/');
3229
+	if ( $path && is_string( $path ) ) {
3230
+			$url .= ltrim($path, '/');
3231
+	}
3123 3232
 
3124 3233
 	/**
3125 3234
 	 * Filter the URL to the includes directory.
@@ -3144,8 +3253,9 @@  discard block
 block discarded – undo
3144 3253
 function content_url($path = '') {
3145 3254
 	$url = set_url_scheme( WP_CONTENT_URL );
3146 3255
 
3147
-	if ( $path && is_string( $path ) )
3148
-		$url .= '/' . ltrim($path, '/');
3256
+	if ( $path && is_string( $path ) ) {
3257
+			$url .= '/' . ltrim($path, '/');
3258
+	}
3149 3259
 
3150 3260
 	/**
3151 3261
 	 * Filter the URL to the content directory.
@@ -3179,22 +3289,25 @@  discard block
 block discarded – undo
3179 3289
 	$plugin = wp_normalize_path( $plugin );
3180 3290
 	$mu_plugin_dir = wp_normalize_path( WPMU_PLUGIN_DIR );
3181 3291
 
3182
-	if ( !empty($plugin) && 0 === strpos($plugin, $mu_plugin_dir) )
3183
-		$url = WPMU_PLUGIN_URL;
3184
-	else
3185
-		$url = WP_PLUGIN_URL;
3292
+	if ( !empty($plugin) && 0 === strpos($plugin, $mu_plugin_dir) ) {
3293
+			$url = WPMU_PLUGIN_URL;
3294
+	} else {
3295
+			$url = WP_PLUGIN_URL;
3296
+	}
3186 3297
 
3187 3298
 
3188 3299
 	$url = set_url_scheme( $url );
3189 3300
 
3190 3301
 	if ( !empty($plugin) && is_string($plugin) ) {
3191 3302
 		$folder = dirname(plugin_basename($plugin));
3192
-		if ( '.' != $folder )
3193
-			$url .= '/' . ltrim($folder, '/');
3303
+		if ( '.' != $folder ) {
3304
+					$url .= '/' . ltrim($folder, '/');
3305
+		}
3194 3306
 	}
3195 3307
 
3196
-	if ( $path && is_string( $path ) )
3197
-		$url .= '/' . ltrim($path, '/');
3308
+	if ( $path && is_string( $path ) ) {
3309
+			$url .= '/' . ltrim($path, '/');
3310
+	}
3198 3311
 
3199 3312
 	/**
3200 3313
 	 * Filter the URL to the plugins directory.
@@ -3224,18 +3337,21 @@  discard block
 block discarded – undo
3224 3337
  * @return string Site url link with optional path appended.
3225 3338
  */
3226 3339
 function network_site_url( $path = '', $scheme = null ) {
3227
-	if ( ! is_multisite() )
3228
-		return site_url($path, $scheme);
3340
+	if ( ! is_multisite() ) {
3341
+			return site_url($path, $scheme);
3342
+	}
3229 3343
 
3230 3344
 	$current_site = get_current_site();
3231 3345
 
3232
-	if ( 'relative' == $scheme )
3233
-		$url = $current_site->path;
3234
-	else
3235
-		$url = set_url_scheme( 'http://' . $current_site->domain . $current_site->path, $scheme );
3346
+	if ( 'relative' == $scheme ) {
3347
+			$url = $current_site->path;
3348
+	} else {
3349
+			$url = set_url_scheme( 'http://' . $current_site->domain . $current_site->path, $scheme );
3350
+	}
3236 3351
 
3237
-	if ( $path && is_string( $path ) )
3238
-		$url .= ltrim( $path, '/' );
3352
+	if ( $path && is_string( $path ) ) {
3353
+			$url .= ltrim( $path, '/' );
3354
+	}
3239 3355
 
3240 3356
 	/**
3241 3357
 	 * Filter the network site URL.
@@ -3266,22 +3382,26 @@  discard block
 block discarded – undo
3266 3382
  * @return string Home url link with optional path appended.
3267 3383
  */
3268 3384
 function network_home_url( $path = '', $scheme = null ) {
3269
-	if ( ! is_multisite() )
3270
-		return home_url($path, $scheme);
3385
+	if ( ! is_multisite() ) {
3386
+			return home_url($path, $scheme);
3387
+	}
3271 3388
 
3272 3389
 	$current_site = get_current_site();
3273 3390
 	$orig_scheme = $scheme;
3274 3391
 
3275
-	if ( ! in_array( $scheme, array( 'http', 'https', 'relative' ) ) )
3276
-		$scheme = is_ssl() && ! is_admin() ? 'https' : 'http';
3392
+	if ( ! in_array( $scheme, array( 'http', 'https', 'relative' ) ) ) {
3393
+			$scheme = is_ssl() && ! is_admin() ? 'https' : 'http';
3394
+	}
3277 3395
 
3278
-	if ( 'relative' == $scheme )
3279
-		$url = $current_site->path;
3280
-	else
3281
-		$url = set_url_scheme( 'http://' . $current_site->domain . $current_site->path, $scheme );
3396
+	if ( 'relative' == $scheme ) {
3397
+			$url = $current_site->path;
3398
+	} else {
3399
+			$url = set_url_scheme( 'http://' . $current_site->domain . $current_site->path, $scheme );
3400
+	}
3282 3401
 
3283
-	if ( $path && is_string( $path ) )
3284
-		$url .= ltrim( $path, '/' );
3402
+	if ( $path && is_string( $path ) ) {
3403
+			$url .= ltrim( $path, '/' );
3404
+	}
3285 3405
 
3286 3406
 	/**
3287 3407
 	 * Filter the network home URL.
@@ -3307,13 +3427,15 @@  discard block
 block discarded – undo
3307 3427
  * @return string Admin url link with optional path appended.
3308 3428
  */
3309 3429
 function network_admin_url( $path = '', $scheme = 'admin' ) {
3310
-	if ( ! is_multisite() )
3311
-		return admin_url( $path, $scheme );
3430
+	if ( ! is_multisite() ) {
3431
+			return admin_url( $path, $scheme );
3432
+	}
3312 3433
 
3313 3434
 	$url = network_site_url('wp-admin/network/', $scheme);
3314 3435
 
3315
-	if ( $path && is_string( $path ) )
3316
-		$url .= ltrim($path, '/');
3436
+	if ( $path && is_string( $path ) ) {
3437
+			$url .= ltrim($path, '/');
3438
+	}
3317 3439
 
3318 3440
 	/**
3319 3441
 	 * Filter the network admin URL.
@@ -3339,8 +3461,9 @@  discard block
 block discarded – undo
3339 3461
 function user_admin_url( $path = '', $scheme = 'admin' ) {
3340 3462
 	$url = network_site_url('wp-admin/user/', $scheme);
3341 3463
 
3342
-	if ( $path && is_string( $path ) )
3343
-		$url .= ltrim($path, '/');
3464
+	if ( $path && is_string( $path ) ) {
3465
+			$url .= ltrim($path, '/');
3466
+	}
3344 3467
 
3345 3468
 	/**
3346 3469
 	 * Filter the user admin URL for the current user.
@@ -3364,13 +3487,14 @@  discard block
 block discarded – undo
3364 3487
  * @return string Admin url link with optional path appended.
3365 3488
  */
3366 3489
 function self_admin_url($path = '', $scheme = 'admin') {
3367
-	if ( is_network_admin() )
3368
-		return network_admin_url($path, $scheme);
3369
-	elseif ( is_user_admin() )
3370
-		return user_admin_url($path, $scheme);
3371
-	else
3372
-		return admin_url($path, $scheme);
3373
-}
3490
+	if ( is_network_admin() ) {
3491
+			return network_admin_url($path, $scheme);
3492
+	} elseif ( is_user_admin() ) {
3493
+			return user_admin_url($path, $scheme);
3494
+	} else {
3495
+			return admin_url($path, $scheme);
3496
+	}
3497
+	}
3374 3498
 
3375 3499
 /**
3376 3500
  * Sets the scheme for a URL.
@@ -3395,13 +3519,15 @@  discard block
 block discarded – undo
3395 3519
 	}
3396 3520
 
3397 3521
 	$url = trim( $url );
3398
-	if ( substr( $url, 0, 2 ) === '//' )
3399
-		$url = 'http:' . $url;
3522
+	if ( substr( $url, 0, 2 ) === '//' ) {
3523
+			$url = 'http:' . $url;
3524
+	}
3400 3525
 
3401 3526
 	if ( 'relative' == $scheme ) {
3402 3527
 		$url = ltrim( preg_replace( '#^\w+://[^/]*#', '', $url ) );
3403
-		if ( $url !== '' && $url[0] === '/' )
3404
-			$url = '/' . ltrim($url , "/ \t\n\r\0\x0B" );
3528
+		if ( $url !== '' && $url[0] === '/' ) {
3529
+					$url = '/' . ltrim($url , "/ \t\n\r\0\x0B" );
3530
+		}
3405 3531
 	} else {
3406 3532
 		$url = preg_replace( '#^\w+://#', $scheme . '://', $url );
3407 3533
 	}
@@ -3447,10 +3573,11 @@  discard block
 block discarded – undo
3447 3573
 			$url = admin_url( $path, $scheme );
3448 3574
 		} else {
3449 3575
 			$active = get_active_blog_for_user( $user_id );
3450
-			if ( $active )
3451
-				$url = get_admin_url( $active->blog_id, $path, $scheme );
3452
-			else
3453
-				$url = user_admin_url( $path, $scheme );
3576
+			if ( $active ) {
3577
+							$url = get_admin_url( $active->blog_id, $path, $scheme );
3578
+			} else {
3579
+							$url = user_admin_url( $path, $scheme );
3580
+			}
3454 3581
 		}
3455 3582
 	}
3456 3583
 
@@ -3481,12 +3608,13 @@  discard block
 block discarded – undo
3481 3608
 function get_edit_profile_url( $user_id = 0, $scheme = 'admin' ) {
3482 3609
 	$user_id = $user_id ? (int) $user_id : get_current_user_id();
3483 3610
 
3484
-	if ( is_user_admin() )
3485
-		$url = user_admin_url( 'profile.php', $scheme );
3486
-	elseif ( is_network_admin() )
3487
-		$url = network_admin_url( 'profile.php', $scheme );
3488
-	else
3489
-		$url = get_dashboard_url( $user_id, 'profile.php', $scheme );
3611
+	if ( is_user_admin() ) {
3612
+			$url = user_admin_url( 'profile.php', $scheme );
3613
+	} elseif ( is_network_admin() ) {
3614
+			$url = network_admin_url( 'profile.php', $scheme );
3615
+	} else {
3616
+			$url = get_dashboard_url( $user_id, 'profile.php', $scheme );
3617
+	}
3490 3618
 
3491 3619
 	/**
3492 3620
 	 * Filter the URL for a user's profile editor.
@@ -3577,8 +3705,9 @@  discard block
 block discarded – undo
3577 3705
 		$post = get_post( $post_id );
3578 3706
 	} elseif ( 'post' == $context ) {
3579 3707
 		$post = get_post( $id );
3580
-		if ( ! empty( $post->ID ) )
3581
-			$post_id = $post->ID;
3708
+		if ( ! empty( $post->ID ) ) {
3709
+					$post_id = $post->ID;
3710
+		}
3582 3711
 	}
3583 3712
 
3584 3713
 	$shortlink = '';
@@ -3617,8 +3746,9 @@  discard block
 block discarded – undo
3617 3746
 function wp_shortlink_wp_head() {
3618 3747
 	$shortlink = wp_get_shortlink( 0, 'query' );
3619 3748
 
3620
-	if ( empty( $shortlink ) )
3621
-		return;
3749
+	if ( empty( $shortlink ) ) {
3750
+			return;
3751
+	}
3622 3752
 
3623 3753
 	echo "<link rel='shortlink' href='" . esc_url( $shortlink ) . "' />\n";
3624 3754
 }
@@ -3631,13 +3761,15 @@  discard block
 block discarded – undo
3631 3761
  * @since 3.0.0
3632 3762
  */
3633 3763
 function wp_shortlink_header() {
3634
-	if ( headers_sent() )
3635
-		return;
3764
+	if ( headers_sent() ) {
3765
+			return;
3766
+	}
3636 3767
 
3637 3768
 	$shortlink = wp_get_shortlink(0, 'query');
3638 3769
 
3639
-	if ( empty($shortlink) )
3640
-		return;
3770
+	if ( empty($shortlink) ) {
3771
+			return;
3772
+	}
3641 3773
 
3642 3774
 	header('Link: <' . $shortlink . '>; rel=shortlink', false);
3643 3775
 }
@@ -3659,11 +3791,13 @@  discard block
 block discarded – undo
3659 3791
 function the_shortlink( $text = '', $title = '', $before = '', $after = '' ) {
3660 3792
 	$post = get_post();
3661 3793
 
3662
-	if ( empty( $text ) )
3663
-		$text = __('This is the short link.');
3794
+	if ( empty( $text ) ) {
3795
+			$text = __('This is the short link.');
3796
+	}
3664 3797
 
3665
-	if ( empty( $title ) )
3666
-		$title = the_title_attribute( array( 'echo' => false ) );
3798
+	if ( empty( $title ) ) {
3799
+			$title = the_title_attribute( array( 'echo' => false ) );
3800
+	}
3667 3801
 
3668 3802
 	$shortlink = wp_get_shortlink( $post->ID );
3669 3803
 
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/ms-functions.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1861,7 +1861,7 @@  discard block
 block discarded – undo
1861 1861
  * @since MU
1862 1862
  *
1863 1863
  * @param array|string $deprecated Not used.
1864
- * @return array The current site's domain
1864
+ * @return string[] The current site's domain
1865 1865
  */
1866 1866
 function redirect_this_site( $deprecated = '' ) {
1867 1867
 	return array( get_current_site()->domain );
@@ -2139,7 +2139,7 @@  discard block
 block discarded – undo
2139 2139
  *
2140 2140
  * @staticvar bool $forced_content
2141 2141
  *
2142
- * @param bool $force
2142
+ * @param string|boolean $force
2143 2143
  * @return bool True if forced, false if not forced.
2144 2144
  */
2145 2145
 function force_ssl_content( $force = '' ) {
Please login to merge, or discard this patch.
Spacing   +511 added lines, -511 removed lines patch added patch discarded remove patch
@@ -39,45 +39,45 @@  discard block
 block discarded – undo
39 39
  * @param int $user_id The unique ID of the user
40 40
  * @return WP_Site|void The blog object
41 41
  */
42
-function get_active_blog_for_user( $user_id ) {
42
+function get_active_blog_for_user($user_id) {
43 43
 	global $wpdb;
44
-	$blogs = get_blogs_of_user( $user_id );
45
-	if ( empty( $blogs ) )
44
+	$blogs = get_blogs_of_user($user_id);
45
+	if (empty($blogs))
46 46
 		return;
47 47
 
48
-	if ( !is_multisite() )
48
+	if ( ! is_multisite())
49 49
 		return $blogs[$wpdb->blogid];
50 50
 
51
-	$primary_blog = get_user_meta( $user_id, 'primary_blog', true );
51
+	$primary_blog = get_user_meta($user_id, 'primary_blog', true);
52 52
 	$first_blog = current($blogs);
53
-	if ( false !== $primary_blog ) {
54
-		if ( ! isset( $blogs[ $primary_blog ] ) ) {
55
-			update_user_meta( $user_id, 'primary_blog', $first_blog->userblog_id );
56
-			$primary = get_blog_details( $first_blog->userblog_id );
53
+	if (false !== $primary_blog) {
54
+		if ( ! isset($blogs[$primary_blog])) {
55
+			update_user_meta($user_id, 'primary_blog', $first_blog->userblog_id);
56
+			$primary = get_blog_details($first_blog->userblog_id);
57 57
 		} else {
58
-			$primary = get_blog_details( $primary_blog );
58
+			$primary = get_blog_details($primary_blog);
59 59
 		}
60 60
 	} else {
61 61
 		//TODO Review this call to add_user_to_blog too - to get here the user must have a role on this blog?
62
-		add_user_to_blog( $first_blog->userblog_id, $user_id, 'subscriber' );
63
-		update_user_meta( $user_id, 'primary_blog', $first_blog->userblog_id );
62
+		add_user_to_blog($first_blog->userblog_id, $user_id, 'subscriber');
63
+		update_user_meta($user_id, 'primary_blog', $first_blog->userblog_id);
64 64
 		$primary = $first_blog;
65 65
 	}
66 66
 
67
-	if ( ( ! is_object( $primary ) ) || ( $primary->archived == 1 || $primary->spam == 1 || $primary->deleted == 1 ) ) {
68
-		$blogs = get_blogs_of_user( $user_id, true ); // if a user's primary blog is shut down, check their other blogs.
67
+	if (( ! is_object($primary)) || ($primary->archived == 1 || $primary->spam == 1 || $primary->deleted == 1)) {
68
+		$blogs = get_blogs_of_user($user_id, true); // if a user's primary blog is shut down, check their other blogs.
69 69
 		$ret = false;
70
-		if ( is_array( $blogs ) && count( $blogs ) > 0 ) {
71
-			foreach ( (array) $blogs as $blog_id => $blog ) {
72
-				if ( $blog->site_id != $wpdb->siteid )
70
+		if (is_array($blogs) && count($blogs) > 0) {
71
+			foreach ((array) $blogs as $blog_id => $blog) {
72
+				if ($blog->site_id != $wpdb->siteid)
73 73
 					continue;
74
-				$details = get_blog_details( $blog_id );
75
-				if ( is_object( $details ) && $details->archived == 0 && $details->spam == 0 && $details->deleted == 0 ) {
74
+				$details = get_blog_details($blog_id);
75
+				if (is_object($details) && $details->archived == 0 && $details->spam == 0 && $details->deleted == 0) {
76 76
 					$ret = $blog;
77
-					if ( get_user_meta( $user_id , 'primary_blog', true ) != $blog_id )
78
-						update_user_meta( $user_id, 'primary_blog', $blog_id );
79
-					if ( !get_user_meta($user_id , 'source_domain', true) )
80
-						update_user_meta( $user_id, 'source_domain', $blog->domain );
77
+					if (get_user_meta($user_id, 'primary_blog', true) != $blog_id)
78
+						update_user_meta($user_id, 'primary_blog', $blog_id);
79
+					if ( ! get_user_meta($user_id, 'source_domain', true))
80
+						update_user_meta($user_id, 'source_domain', $blog->domain);
81 81
 					break;
82 82
 				}
83 83
 			}
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
  * @return int
101 101
  */
102 102
 function get_user_count() {
103
-	return get_site_option( 'user_count' );
103
+	return get_site_option('user_count');
104 104
 }
105 105
 
106 106
 /**
@@ -113,11 +113,11 @@  discard block
 block discarded – undo
113 113
  * @param int $network_id Deprecated, not supported.
114 114
  * @return int
115 115
  */
116
-function get_blog_count( $network_id = 0 ) {
117
-	if ( func_num_args() )
118
-		_deprecated_argument( __FUNCTION__, '3.1' );
116
+function get_blog_count($network_id = 0) {
117
+	if (func_num_args())
118
+		_deprecated_argument(__FUNCTION__, '3.1');
119 119
 
120
-	return get_site_option( 'blog_count' );
120
+	return get_site_option('blog_count');
121 121
 }
122 122
 
123 123
 /**
@@ -129,9 +129,9 @@  discard block
 block discarded – undo
129 129
  * @param int $post_id ID of the post you're looking for.
130 130
  * @return WP_Post|null WP_Post on success or null on failure
131 131
  */
132
-function get_blog_post( $blog_id, $post_id ) {
133
-	switch_to_blog( $blog_id );
134
-	$post = get_post( $post_id );
132
+function get_blog_post($blog_id, $post_id) {
133
+	switch_to_blog($blog_id);
134
+	$post = get_post($post_id);
135 135
 	restore_current_blog();
136 136
 
137 137
 	return $post;
@@ -150,17 +150,17 @@  discard block
 block discarded – undo
150 150
  * @param string $role    The role you want the user to have
151 151
  * @return true|WP_Error
152 152
  */
153
-function add_user_to_blog( $blog_id, $user_id, $role ) {
153
+function add_user_to_blog($blog_id, $user_id, $role) {
154 154
 	switch_to_blog($blog_id);
155 155
 
156
-	$user = get_userdata( $user_id );
156
+	$user = get_userdata($user_id);
157 157
 
158
-	if ( ! $user ) {
158
+	if ( ! $user) {
159 159
 		restore_current_blog();
160
-		return new WP_Error( 'user_does_not_exist', __( 'The requested user does not exist.' ) );
160
+		return new WP_Error('user_does_not_exist', __('The requested user does not exist.'));
161 161
 	}
162 162
 
163
-	if ( !get_user_meta($user_id, 'primary_blog', true) ) {
163
+	if ( ! get_user_meta($user_id, 'primary_blog', true)) {
164 164
 		update_user_meta($user_id, 'primary_blog', $blog_id);
165 165
 		$details = get_blog_details($blog_id);
166 166
 		update_user_meta($user_id, 'source_domain', $details->domain);
@@ -177,9 +177,9 @@  discard block
 block discarded – undo
177 177
 	 * @param string $role    User role.
178 178
 	 * @param int    $blog_id Blog ID.
179 179
 	 */
180
-	do_action( 'add_user_to_blog', $user_id, $role, $blog_id );
181
-	wp_cache_delete( $user_id, 'users' );
182
-	wp_cache_delete( $blog_id . '_user_count', 'blog-details' );
180
+	do_action('add_user_to_blog', $user_id, $role, $blog_id);
181
+	wp_cache_delete($user_id, 'users');
182
+	wp_cache_delete($blog_id.'_user_count', 'blog-details');
183 183
 	restore_current_blog();
184 184
 	return true;
185 185
 }
@@ -214,17 +214,17 @@  discard block
 block discarded – undo
214 214
 	 * @param int $user_id User ID.
215 215
 	 * @param int $blog_id Blog ID.
216 216
 	 */
217
-	do_action( 'remove_user_from_blog', $user_id, $blog_id );
217
+	do_action('remove_user_from_blog', $user_id, $blog_id);
218 218
 
219 219
 	// If being removed from the primary blog, set a new primary if the user is assigned
220 220
 	// to multiple blogs.
221 221
 	$primary_blog = get_user_meta($user_id, 'primary_blog', true);
222
-	if ( $primary_blog == $blog_id ) {
222
+	if ($primary_blog == $blog_id) {
223 223
 		$new_id = '';
224 224
 		$new_domain = '';
225 225
 		$blogs = get_blogs_of_user($user_id);
226
-		foreach ( (array) $blogs as $blog ) {
227
-			if ( $blog->userblog_id == $blog_id )
226
+		foreach ((array) $blogs as $blog) {
227
+			if ($blog->userblog_id == $blog_id)
228 228
 				continue;
229 229
 			$new_id = $blog->userblog_id;
230 230
 			$new_domain = $blog->domain;
@@ -236,8 +236,8 @@  discard block
 block discarded – undo
236 236
 	}
237 237
 
238 238
 	// wp_revoke_user($user_id);
239
-	$user = get_userdata( $user_id );
240
-	if ( ! $user ) {
239
+	$user = get_userdata($user_id);
240
+	if ( ! $user) {
241 241
 		restore_current_blog();
242 242
 		return new WP_Error('user_does_not_exist', __('That user does not exist.'));
243 243
 	}
@@ -245,24 +245,24 @@  discard block
 block discarded – undo
245 245
 	$user->remove_all_caps();
246 246
 
247 247
 	$blogs = get_blogs_of_user($user_id);
248
-	if ( count($blogs) == 0 ) {
248
+	if (count($blogs) == 0) {
249 249
 		update_user_meta($user_id, 'primary_blog', '');
250 250
 		update_user_meta($user_id, 'source_domain', '');
251 251
 	}
252 252
 
253
-	if ( $reassign != '' ) {
253
+	if ($reassign != '') {
254 254
 		$reassign = (int) $reassign;
255
-		$post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_author = %d", $user_id ) );
256
-		$link_ids = $wpdb->get_col( $wpdb->prepare( "SELECT link_id FROM $wpdb->links WHERE link_owner = %d", $user_id ) );
255
+		$post_ids = $wpdb->get_col($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_author = %d", $user_id));
256
+		$link_ids = $wpdb->get_col($wpdb->prepare("SELECT link_id FROM $wpdb->links WHERE link_owner = %d", $user_id));
257 257
 
258
-		if ( ! empty( $post_ids ) ) {
259
-			$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_author = %d WHERE post_author = %d", $reassign, $user_id ) );
260
-			array_walk( $post_ids, 'clean_post_cache' );
258
+		if ( ! empty($post_ids)) {
259
+			$wpdb->query($wpdb->prepare("UPDATE $wpdb->posts SET post_author = %d WHERE post_author = %d", $reassign, $user_id));
260
+			array_walk($post_ids, 'clean_post_cache');
261 261
 		}
262 262
 
263
-		if ( ! empty( $link_ids ) ) {
264
-			$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->links SET link_owner = %d WHERE link_owner = %d", $reassign, $user_id ) );
265
-			array_walk( $link_ids, 'clean_bookmark_cache' );
263
+		if ( ! empty($link_ids)) {
264
+			$wpdb->query($wpdb->prepare("UPDATE $wpdb->links SET link_owner = %d WHERE link_owner = %d", $reassign, $user_id));
265
+			array_walk($link_ids, 'clean_bookmark_cache');
266 266
 		}
267 267
 	}
268 268
 
@@ -280,9 +280,9 @@  discard block
 block discarded – undo
280 280
  * @param int $post_id ID of the desired post.
281 281
  * @return string The post's permalink
282 282
  */
283
-function get_blog_permalink( $blog_id, $post_id ) {
284
-	switch_to_blog( $blog_id );
285
-	$link = get_permalink( $post_id );
283
+function get_blog_permalink($blog_id, $post_id) {
284
+	switch_to_blog($blog_id);
285
+	$link = get_permalink($post_id);
286 286
 	restore_current_blog();
287 287
 
288 288
 	return $link;
@@ -304,26 +304,26 @@  discard block
 block discarded – undo
304 304
  * @param string $path   Optional. Not required for subdomain installations.
305 305
  * @return int 0 if no blog found, otherwise the ID of the matching blog
306 306
  */
307
-function get_blog_id_from_url( $domain, $path = '/' ) {
307
+function get_blog_id_from_url($domain, $path = '/') {
308 308
 	global $wpdb;
309 309
 
310
-	$domain = strtolower( $domain );
311
-	$path = strtolower( $path );
312
-	$id = wp_cache_get( md5( $domain . $path ), 'blog-id-cache' );
310
+	$domain = strtolower($domain);
311
+	$path = strtolower($path);
312
+	$id = wp_cache_get(md5($domain.$path), 'blog-id-cache');
313 313
 
314
-	if ( $id == -1 ) // blog does not exist
314
+	if ($id == -1) // blog does not exist
315 315
 		return 0;
316
-	elseif ( $id )
316
+	elseif ($id)
317 317
 		return (int) $id;
318 318
 
319
-	$id = $wpdb->get_var( $wpdb->prepare( "SELECT blog_id FROM $wpdb->blogs WHERE domain = %s and path = %s /* get_blog_id_from_url */", $domain, $path ) );
319
+	$id = $wpdb->get_var($wpdb->prepare("SELECT blog_id FROM $wpdb->blogs WHERE domain = %s and path = %s /* get_blog_id_from_url */", $domain, $path));
320 320
 
321
-	if ( ! $id ) {
322
-		wp_cache_set( md5( $domain . $path ), -1, 'blog-id-cache' );
321
+	if ( ! $id) {
322
+		wp_cache_set(md5($domain.$path), -1, 'blog-id-cache');
323 323
 		return 0;
324 324
 	}
325 325
 
326
-	wp_cache_set( md5( $domain . $path ), $id, 'blog-id-cache' );
326
+	wp_cache_set(md5($domain.$path), $id, 'blog-id-cache');
327 327
 
328 328
 	return $id;
329 329
 }
@@ -343,30 +343,30 @@  discard block
 block discarded – undo
343 343
  * @param string $user_email The email provided by the user at registration.
344 344
  * @return bool Returns true when the email address is banned.
345 345
  */
346
-function is_email_address_unsafe( $user_email ) {
347
-	$banned_names = get_site_option( 'banned_email_domains' );
348
-	if ( $banned_names && ! is_array( $banned_names ) )
349
-		$banned_names = explode( "\n", $banned_names );
346
+function is_email_address_unsafe($user_email) {
347
+	$banned_names = get_site_option('banned_email_domains');
348
+	if ($banned_names && ! is_array($banned_names))
349
+		$banned_names = explode("\n", $banned_names);
350 350
 
351 351
 	$is_email_address_unsafe = false;
352 352
 
353
-	if ( $banned_names && is_array( $banned_names ) ) {
354
-		$banned_names = array_map( 'strtolower', $banned_names );
355
-		$normalized_email = strtolower( $user_email );
353
+	if ($banned_names && is_array($banned_names)) {
354
+		$banned_names = array_map('strtolower', $banned_names);
355
+		$normalized_email = strtolower($user_email);
356 356
 
357
-		list( $email_local_part, $email_domain ) = explode( '@', $normalized_email );
357
+		list($email_local_part, $email_domain) = explode('@', $normalized_email);
358 358
 
359
-		foreach ( $banned_names as $banned_domain ) {
360
-			if ( ! $banned_domain )
359
+		foreach ($banned_names as $banned_domain) {
360
+			if ( ! $banned_domain)
361 361
 				continue;
362 362
 
363
-			if ( $email_domain == $banned_domain ) {
363
+			if ($email_domain == $banned_domain) {
364 364
 				$is_email_address_unsafe = true;
365 365
 				break;
366 366
 			}
367 367
 
368 368
 			$dotted_domain = ".$banned_domain";
369
-			if ( $dotted_domain === substr( $normalized_email, -strlen( $dotted_domain ) ) ) {
369
+			if ($dotted_domain === substr($normalized_email, -strlen($dotted_domain))) {
370 370
 				$is_email_address_unsafe = true;
371 371
 				break;
372 372
 			}
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
 	 * @param bool   $is_email_address_unsafe Whether the email address is "unsafe". Default false.
382 382
 	 * @param string $user_email              User email address.
383 383
 	 */
384
-	return apply_filters( 'is_email_address_unsafe', $is_email_address_unsafe, $user_email );
384
+	return apply_filters('is_email_address_unsafe', $is_email_address_unsafe, $user_email);
385 385
 }
386 386
 
387 387
 /**
@@ -410,86 +410,86 @@  discard block
 block discarded – undo
410 410
 	$errors = new WP_Error();
411 411
 
412 412
 	$orig_username = $user_name;
413
-	$user_name = preg_replace( '/\s+/', '', sanitize_user( $user_name, true ) );
413
+	$user_name = preg_replace('/\s+/', '', sanitize_user($user_name, true));
414 414
 
415
-	if ( $user_name != $orig_username || preg_match( '/[^a-z0-9]/', $user_name ) ) {
416
-		$errors->add( 'user_name', __( 'Usernames can only contain lowercase letters (a-z) and numbers.' ) );
415
+	if ($user_name != $orig_username || preg_match('/[^a-z0-9]/', $user_name)) {
416
+		$errors->add('user_name', __('Usernames can only contain lowercase letters (a-z) and numbers.'));
417 417
 		$user_name = $orig_username;
418 418
 	}
419 419
 
420
-	$user_email = sanitize_email( $user_email );
420
+	$user_email = sanitize_email($user_email);
421 421
 
422
-	if ( empty( $user_name ) )
423
-	   	$errors->add('user_name', __( 'Please enter a username.' ) );
422
+	if (empty($user_name))
423
+	   	$errors->add('user_name', __('Please enter a username.'));
424 424
 
425
-	$illegal_names = get_site_option( 'illegal_names' );
426
-	if ( ! is_array( $illegal_names ) ) {
427
-		$illegal_names = array(  'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator' );
428
-		add_site_option( 'illegal_names', $illegal_names );
425
+	$illegal_names = get_site_option('illegal_names');
426
+	if ( ! is_array($illegal_names)) {
427
+		$illegal_names = array('www', 'web', 'root', 'admin', 'main', 'invite', 'administrator');
428
+		add_site_option('illegal_names', $illegal_names);
429 429
 	}
430
-	if ( in_array( $user_name, $illegal_names ) ) {
431
-		$errors->add( 'user_name',  __( 'Sorry, that username is not allowed.' ) );
430
+	if (in_array($user_name, $illegal_names)) {
431
+		$errors->add('user_name', __('Sorry, that username is not allowed.'));
432 432
 	}
433 433
 
434 434
 	/** This filter is documented in wp-includes/user.php */
435
-	$illegal_logins = (array) apply_filters( 'illegal_user_logins', array() );
435
+	$illegal_logins = (array) apply_filters('illegal_user_logins', array());
436 436
 
437
-	if ( in_array( strtolower( $user_name ), array_map( 'strtolower', $illegal_logins ) ) ) {
438
-		$errors->add( 'user_name',  __( 'Sorry, that username is not allowed.' ) );
437
+	if (in_array(strtolower($user_name), array_map('strtolower', $illegal_logins))) {
438
+		$errors->add('user_name', __('Sorry, that username is not allowed.'));
439 439
 	}
440 440
 
441
-	if ( is_email_address_unsafe( $user_email ) )
442
-		$errors->add('user_email',  __('You cannot use that email address to signup. We are having problems with them blocking some of our email. Please use another email provider.'));
441
+	if (is_email_address_unsafe($user_email))
442
+		$errors->add('user_email', __('You cannot use that email address to signup. We are having problems with them blocking some of our email. Please use another email provider.'));
443 443
 
444
-	if ( strlen( $user_name ) < 4 )
445
-		$errors->add('user_name',  __( 'Username must be at least 4 characters.' ) );
444
+	if (strlen($user_name) < 4)
445
+		$errors->add('user_name', __('Username must be at least 4 characters.'));
446 446
 
447
-	if ( strlen( $user_name ) > 60 ) {
448
-		$errors->add( 'user_name', __( 'Username may not be longer than 60 characters.' ) );
447
+	if (strlen($user_name) > 60) {
448
+		$errors->add('user_name', __('Username may not be longer than 60 characters.'));
449 449
 	}
450 450
 
451 451
 	// all numeric?
452
-	if ( preg_match( '/^[0-9]*$/', $user_name ) )
452
+	if (preg_match('/^[0-9]*$/', $user_name))
453 453
 		$errors->add('user_name', __('Sorry, usernames must have letters too!'));
454 454
 
455
-	if ( !is_email( $user_email ) )
456
-		$errors->add('user_email', __( 'Please enter a valid email address.' ) );
455
+	if ( ! is_email($user_email))
456
+		$errors->add('user_email', __('Please enter a valid email address.'));
457 457
 
458
-	$limited_email_domains = get_site_option( 'limited_email_domains' );
459
-	if ( is_array( $limited_email_domains ) && ! empty( $limited_email_domains ) ) {
460
-		$emaildomain = substr( $user_email, 1 + strpos( $user_email, '@' ) );
461
-		if ( ! in_array( $emaildomain, $limited_email_domains ) ) {
458
+	$limited_email_domains = get_site_option('limited_email_domains');
459
+	if (is_array($limited_email_domains) && ! empty($limited_email_domains)) {
460
+		$emaildomain = substr($user_email, 1 + strpos($user_email, '@'));
461
+		if ( ! in_array($emaildomain, $limited_email_domains)) {
462 462
 			$errors->add('user_email', __('Sorry, that email address is not allowed!'));
463 463
 		}
464 464
 	}
465 465
 
466 466
 	// Check if the username has been used already.
467
-	if ( username_exists($user_name) )
468
-		$errors->add( 'user_name', __( 'Sorry, that username already exists!' ) );
467
+	if (username_exists($user_name))
468
+		$errors->add('user_name', __('Sorry, that username already exists!'));
469 469
 
470 470
 	// Check if the email address has been used already.
471
-	if ( email_exists($user_email) )
472
-		$errors->add( 'user_email', __( 'Sorry, that email address is already used!' ) );
471
+	if (email_exists($user_email))
472
+		$errors->add('user_email', __('Sorry, that email address is already used!'));
473 473
 
474 474
 	// Has someone already signed up for this username?
475
-	$signup = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->signups WHERE user_login = %s", $user_name) );
476
-	if ( $signup != null ) {
477
-		$registered_at =  mysql2date('U', $signup->registered);
478
-		$now = current_time( 'timestamp', true );
475
+	$signup = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->signups WHERE user_login = %s", $user_name));
476
+	if ($signup != null) {
477
+		$registered_at = mysql2date('U', $signup->registered);
478
+		$now = current_time('timestamp', true);
479 479
 		$diff = $now - $registered_at;
480 480
 		// If registered more than two days ago, cancel registration and let this signup go through.
481
-		if ( $diff > 2 * DAY_IN_SECONDS )
482
-			$wpdb->delete( $wpdb->signups, array( 'user_login' => $user_name ) );
481
+		if ($diff > 2 * DAY_IN_SECONDS)
482
+			$wpdb->delete($wpdb->signups, array('user_login' => $user_name));
483 483
 		else
484 484
 			$errors->add('user_name', __('That username is currently reserved but may be available in a couple of days.'));
485 485
 	}
486 486
 
487
-	$signup = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->signups WHERE user_email = %s", $user_email) );
488
-	if ( $signup != null ) {
489
-		$diff = current_time( 'timestamp', true ) - mysql2date('U', $signup->registered);
487
+	$signup = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->signups WHERE user_email = %s", $user_email));
488
+	if ($signup != null) {
489
+		$diff = current_time('timestamp', true) - mysql2date('U', $signup->registered);
490 490
 		// If registered more than two days ago, cancel registration and let this signup go through.
491
-		if ( $diff > 2 * DAY_IN_SECONDS )
492
-			$wpdb->delete( $wpdb->signups, array( 'user_email' => $user_email ) );
491
+		if ($diff > 2 * DAY_IN_SECONDS)
492
+			$wpdb->delete($wpdb->signups, array('user_email' => $user_email));
493 493
 		else
494 494
 			$errors->add('user_email', __('That email address has already been used. Please check your inbox for an activation email. It will become available in a couple of days if you do nothing.'));
495 495
 	}
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
 	 *     @type WP_Error $errors        WP_Error object containing any errors found.
514 514
 	 * }
515 515
 	 */
516
-	return apply_filters( 'wpmu_validate_user_signup', $result );
516
+	return apply_filters('wpmu_validate_user_signup', $result);
517 517
 }
518 518
 
519 519
 /**
@@ -540,48 +540,48 @@  discard block
 block discarded – undo
540 540
  * @param WP_User|string $user       Optional. The user object to check against the new site name.
541 541
  * @return array Contains the new site data and error messages.
542 542
  */
543
-function wpmu_validate_blog_signup( $blogname, $blog_title, $user = '' ) {
543
+function wpmu_validate_blog_signup($blogname, $blog_title, $user = '') {
544 544
 	global $wpdb, $domain;
545 545
 
546 546
 	$current_site = get_current_site();
547 547
 	$base = $current_site->path;
548 548
 
549
-	$blog_title = strip_tags( $blog_title );
549
+	$blog_title = strip_tags($blog_title);
550 550
 
551 551
 	$errors = new WP_Error();
552
-	$illegal_names = get_site_option( 'illegal_names' );
553
-	if ( $illegal_names == false ) {
554
-		$illegal_names = array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator' );
555
-		add_site_option( 'illegal_names', $illegal_names );
552
+	$illegal_names = get_site_option('illegal_names');
553
+	if ($illegal_names == false) {
554
+		$illegal_names = array('www', 'web', 'root', 'admin', 'main', 'invite', 'administrator');
555
+		add_site_option('illegal_names', $illegal_names);
556 556
 	}
557 557
 
558 558
 	/*
559 559
 	 * On sub dir installs, some names are so illegal, only a filter can
560 560
 	 * spring them from jail.
561 561
 	 */
562
-	if ( ! is_subdomain_install() ) {
563
-		$illegal_names = array_merge( $illegal_names, get_subdirectory_reserved_names() );
562
+	if ( ! is_subdomain_install()) {
563
+		$illegal_names = array_merge($illegal_names, get_subdirectory_reserved_names());
564 564
 	}
565 565
 
566
-	if ( empty( $blogname ) )
567
-		$errors->add('blogname', __( 'Please enter a site name.' ) );
566
+	if (empty($blogname))
567
+		$errors->add('blogname', __('Please enter a site name.'));
568 568
 
569
-	if ( preg_match( '/[^a-z0-9]+/', $blogname ) ) {
570
-		$errors->add( 'blogname', __( 'Site names can only contain lowercase letters (a-z) and numbers.' ) );
569
+	if (preg_match('/[^a-z0-9]+/', $blogname)) {
570
+		$errors->add('blogname', __('Site names can only contain lowercase letters (a-z) and numbers.'));
571 571
 	}
572 572
 
573
-	if ( in_array( $blogname, $illegal_names ) )
574
-		$errors->add('blogname',  __( 'That name is not allowed.' ) );
573
+	if (in_array($blogname, $illegal_names))
574
+		$errors->add('blogname', __('That name is not allowed.'));
575 575
 
576
-	if ( strlen( $blogname ) < 4 && !is_super_admin() )
577
-		$errors->add('blogname',  __( 'Site name must be at least 4 characters.' ) );
576
+	if (strlen($blogname) < 4 && ! is_super_admin())
577
+		$errors->add('blogname', __('Site name must be at least 4 characters.'));
578 578
 
579 579
 	// do not allow users to create a blog that conflicts with a page on the main blog.
580
-	if ( !is_subdomain_install() && $wpdb->get_var( $wpdb->prepare( "SELECT post_name FROM " . $wpdb->get_blog_prefix( $current_site->blog_id ) . "posts WHERE post_type = 'page' AND post_name = %s", $blogname ) ) )
581
-		$errors->add( 'blogname', __( 'Sorry, you may not use that site name.' ) );
580
+	if ( ! is_subdomain_install() && $wpdb->get_var($wpdb->prepare("SELECT post_name FROM ".$wpdb->get_blog_prefix($current_site->blog_id)."posts WHERE post_type = 'page' AND post_name = %s", $blogname)))
581
+		$errors->add('blogname', __('Sorry, you may not use that site name.'));
582 582
 
583 583
 	// all numeric?
584
-	if ( preg_match( '/^[0-9]*$/', $blogname ) )
584
+	if (preg_match('/^[0-9]*$/', $blogname))
585 585
 		$errors->add('blogname', __('Sorry, site names must have letters too!'));
586 586
 
587 587
 	/**
@@ -594,36 +594,36 @@  discard block
 block discarded – undo
594 594
 	 *
595 595
 	 * @param string $blogname Site name.
596 596
 	 */
597
-	$blogname = apply_filters( 'newblogname', $blogname );
597
+	$blogname = apply_filters('newblogname', $blogname);
598 598
 
599
-	$blog_title = wp_unslash(  $blog_title );
599
+	$blog_title = wp_unslash($blog_title);
600 600
 
601
-	if ( empty( $blog_title ) )
602
-		$errors->add('blog_title', __( 'Please enter a site title.' ) );
601
+	if (empty($blog_title))
602
+		$errors->add('blog_title', __('Please enter a site title.'));
603 603
 
604 604
 	// Check if the domain/path has been used already.
605
-	if ( is_subdomain_install() ) {
606
-		$mydomain = $blogname . '.' . preg_replace( '|^www\.|', '', $domain );
605
+	if (is_subdomain_install()) {
606
+		$mydomain = $blogname.'.'.preg_replace('|^www\.|', '', $domain);
607 607
 		$path = $base;
608 608
 	} else {
609 609
 		$mydomain = "$domain";
610 610
 		$path = $base.$blogname.'/';
611 611
 	}
612
-	if ( domain_exists($mydomain, $path, $current_site->id) )
613
-		$errors->add( 'blogname', __( 'Sorry, that site already exists!' ) );
612
+	if (domain_exists($mydomain, $path, $current_site->id))
613
+		$errors->add('blogname', __('Sorry, that site already exists!'));
614 614
 
615
-	if ( username_exists( $blogname ) ) {
616
-		if ( ! is_object( $user ) || ( is_object($user) && ( $user->user_login != $blogname ) ) )
617
-			$errors->add( 'blogname', __( 'Sorry, that site is reserved!' ) );
615
+	if (username_exists($blogname)) {
616
+		if ( ! is_object($user) || (is_object($user) && ($user->user_login != $blogname)))
617
+			$errors->add('blogname', __('Sorry, that site is reserved!'));
618 618
 	}
619 619
 
620 620
 	// Has someone already signed up for this domain?
621
-	$signup = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->signups WHERE domain = %s AND path = %s", $mydomain, $path) ); // TODO: Check email too?
622
-	if ( ! empty($signup) ) {
623
-		$diff = current_time( 'timestamp', true ) - mysql2date('U', $signup->registered);
621
+	$signup = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->signups WHERE domain = %s AND path = %s", $mydomain, $path)); // TODO: Check email too?
622
+	if ( ! empty($signup)) {
623
+		$diff = current_time('timestamp', true) - mysql2date('U', $signup->registered);
624 624
 		// If registered more than two days ago, cancel registration and let this signup go through.
625
-		if ( $diff > 2 * DAY_IN_SECONDS )
626
-			$wpdb->delete( $wpdb->signups, array( 'domain' => $mydomain , 'path' => $path ) );
625
+		if ($diff > 2 * DAY_IN_SECONDS)
626
+			$wpdb->delete($wpdb->signups, array('domain' => $mydomain, 'path' => $path));
627 627
 		else
628 628
 			$errors->add('blogname', __('That site is currently reserved but may be available in a couple days.'));
629 629
 	}
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
 	 *     @type WP_Error       $errors     WP_Error containing any errors found.
647 647
 	 * }
648 648
 	 */
649
-	return apply_filters( 'wpmu_validate_blog_signup', $result );
649
+	return apply_filters('wpmu_validate_blog_signup', $result);
650 650
 }
651 651
 
652 652
 /**
@@ -663,13 +663,13 @@  discard block
 block discarded – undo
663 663
  * @param string $user_email The user's email address.
664 664
  * @param array  $meta       By default, contains the requested privacy setting and lang_id.
665 665
  */
666
-function wpmu_signup_blog( $domain, $path, $title, $user, $user_email, $meta = array() )  {
666
+function wpmu_signup_blog($domain, $path, $title, $user, $user_email, $meta = array()) {
667 667
 	global $wpdb;
668 668
 
669
-	$key = substr( md5( time() . rand() . $domain ), 0, 16 );
669
+	$key = substr(md5(time().rand().$domain), 0, 16);
670 670
 	$meta = serialize($meta);
671 671
 
672
-	$wpdb->insert( $wpdb->signups, array(
672
+	$wpdb->insert($wpdb->signups, array(
673 673
 		'domain' => $domain,
674 674
 		'path' => $path,
675 675
 		'title' => $title,
@@ -678,7 +678,7 @@  discard block
 block discarded – undo
678 678
 		'registered' => current_time('mysql', true),
679 679
 		'activation_key' => $key,
680 680
 		'meta' => $meta
681
-	) );
681
+	));
682 682
 
683 683
 	/**
684 684
 	 * Fires after site signup information has been written to the database.
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
 	 * @param string $key        The user's activation key
694 694
 	 * @param array  $meta       By default, contains the requested privacy setting and lang_id.
695 695
 	 */
696
-	do_action( 'after_signup_site', $domain, $path, $title, $user, $user_email, $key, $meta );
696
+	do_action('after_signup_site', $domain, $path, $title, $user, $user_email, $key, $meta);
697 697
 }
698 698
 
699 699
 /**
@@ -710,16 +710,16 @@  discard block
 block discarded – undo
710 710
  * @param string $user_email The user's email address.
711 711
  * @param array  $meta       By default, this is an empty array.
712 712
  */
713
-function wpmu_signup_user( $user, $user_email, $meta = array() ) {
713
+function wpmu_signup_user($user, $user_email, $meta = array()) {
714 714
 	global $wpdb;
715 715
 
716 716
 	// Format data
717
-	$user = preg_replace( '/\s+/', '', sanitize_user( $user, true ) );
718
-	$user_email = sanitize_email( $user_email );
719
-	$key = substr( md5( time() . rand() . $user_email ), 0, 16 );
717
+	$user = preg_replace('/\s+/', '', sanitize_user($user, true));
718
+	$user_email = sanitize_email($user_email);
719
+	$key = substr(md5(time().rand().$user_email), 0, 16);
720 720
 	$meta = serialize($meta);
721 721
 
722
-	$wpdb->insert( $wpdb->signups, array(
722
+	$wpdb->insert($wpdb->signups, array(
723 723
 		'domain' => '',
724 724
 		'path' => '',
725 725
 		'title' => '',
@@ -728,7 +728,7 @@  discard block
 block discarded – undo
728 728
 		'registered' => current_time('mysql', true),
729 729
 		'activation_key' => $key,
730 730
 		'meta' => $meta
731
-	) );
731
+	));
732 732
 
733 733
 	/**
734 734
 	 * Fires after a user's signup information has been written to the database.
@@ -740,7 +740,7 @@  discard block
 block discarded – undo
740 740
 	 * @param string $key        The user's activation key
741 741
 	 * @param array  $meta       Additional signup meta. By default, this is an empty array.
742 742
 	 */
743
-	do_action( 'after_signup_user', $user, $user_email, $key, $meta );
743
+	do_action('after_signup_user', $user, $user_email, $key, $meta);
744 744
 }
745 745
 
746 746
 /**
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
  * @param array  $meta       By default, contains the requested privacy setting and lang_id.
768 768
  * @return bool
769 769
  */
770
-function wpmu_signup_blog_notification( $domain, $path, $title, $user, $user_email, $key, $meta = array() ) {
770
+function wpmu_signup_blog_notification($domain, $path, $title, $user, $user_email, $key, $meta = array()) {
771 771
 	/**
772 772
 	 * Filter whether to bypass the new site email notification.
773 773
 	 *
@@ -781,22 +781,22 @@  discard block
 block discarded – undo
781 781
 	 * @param string      $key        Activation key created in wpmu_signup_blog().
782 782
 	 * @param array       $meta       By default, contains the requested privacy setting and lang_id.
783 783
 	 */
784
-	if ( ! apply_filters( 'wpmu_signup_blog_notification', $domain, $path, $title, $user, $user_email, $key, $meta ) ) {
784
+	if ( ! apply_filters('wpmu_signup_blog_notification', $domain, $path, $title, $user, $user_email, $key, $meta)) {
785 785
 		return false;
786 786
 	}
787 787
 
788 788
 	// Send email with activation link.
789
-	if ( !is_subdomain_install() || get_current_site()->id != 1 )
789
+	if ( ! is_subdomain_install() || get_current_site()->id != 1)
790 790
 		$activate_url = network_site_url("wp-activate.php?key=$key");
791 791
 	else
792 792
 		$activate_url = "http://{$domain}{$path}wp-activate.php?key=$key"; // @todo use *_url() API
793 793
 
794 794
 	$activate_url = esc_url($activate_url);
795
-	$admin_email = get_site_option( 'admin_email' );
796
-	if ( $admin_email == '' )
797
-		$admin_email = 'support@' . $_SERVER['SERVER_NAME'];
798
-	$from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
799
-	$message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
795
+	$admin_email = get_site_option('admin_email');
796
+	if ($admin_email == '')
797
+		$admin_email = 'support@'.$_SERVER['SERVER_NAME'];
798
+	$from_name = get_site_option('site_name') == '' ? 'WordPress' : esc_html(get_site_option('site_name'));
799
+	$message_headers = "From: \"{$from_name}\" <{$admin_email}>\n"."Content-Type: text/plain; charset=\"".get_option('blog_charset')."\"\n";
800 800
 	$message = sprintf(
801 801
 		/**
802 802
 		 * Filter the message content of the new blog notification email.
@@ -814,12 +814,12 @@  discard block
 block discarded – undo
814 814
 		 * @param string $key        Activation key created in wpmu_signup_blog().
815 815
 		 * @param array  $meta       By default, contains the requested privacy setting and lang_id.
816 816
 		 */
817
-		apply_filters( 'wpmu_signup_blog_notification_email',
818
-			__( "To activate your blog, please click the following link:\n\n%s\n\nAfter you activate, you will receive *another email* with your login.\n\nAfter you activate, you can visit your site here:\n\n%s" ),
817
+		apply_filters('wpmu_signup_blog_notification_email',
818
+			__("To activate your blog, please click the following link:\n\n%s\n\nAfter you activate, you will receive *another email* with your login.\n\nAfter you activate, you can visit your site here:\n\n%s"),
819 819
 			$domain, $path, $title, $user, $user_email, $key, $meta
820 820
 		),
821 821
 		$activate_url,
822
-		esc_url( "http://{$domain}{$path}" ),
822
+		esc_url("http://{$domain}{$path}"),
823 823
 		$key
824 824
 	);
825 825
 	// TODO: Don't hard code activation link.
@@ -838,14 +838,14 @@  discard block
 block discarded – undo
838 838
 		 * @param string $key        Activation key created in wpmu_signup_blog().
839 839
 		 * @param array  $meta       By default, contains the requested privacy setting and lang_id.
840 840
 		 */
841
-		apply_filters( 'wpmu_signup_blog_notification_subject',
842
-			__( '[%1$s] Activate %2$s' ),
841
+		apply_filters('wpmu_signup_blog_notification_subject',
842
+			__('[%1$s] Activate %2$s'),
843 843
 			$domain, $path, $title, $user, $user_email, $key, $meta
844 844
 		),
845 845
 		$from_name,
846
-		esc_url( 'http://' . $domain . $path )
846
+		esc_url('http://'.$domain.$path)
847 847
 	);
848
-	wp_mail( $user_email, wp_specialchars_decode( $subject ), $message, $message_headers );
848
+	wp_mail($user_email, wp_specialchars_decode($subject), $message, $message_headers);
849 849
 	return true;
850 850
 }
851 851
 
@@ -870,7 +870,7 @@  discard block
 block discarded – undo
870 870
  * @param array  $meta       By default, an empty array.
871 871
  * @return bool
872 872
  */
873
-function wpmu_signup_user_notification( $user, $user_email, $key, $meta = array() ) {
873
+function wpmu_signup_user_notification($user, $user_email, $key, $meta = array()) {
874 874
 	/**
875 875
 	 * Filter whether to bypass the email notification for new user sign-up.
876 876
 	 *
@@ -881,15 +881,15 @@  discard block
 block discarded – undo
881 881
 	 * @param string $key        Activation key created in wpmu_signup_user().
882 882
 	 * @param array  $meta       Signup meta data.
883 883
 	 */
884
-	if ( ! apply_filters( 'wpmu_signup_user_notification', $user, $user_email, $key, $meta ) )
884
+	if ( ! apply_filters('wpmu_signup_user_notification', $user, $user_email, $key, $meta))
885 885
 		return false;
886 886
 
887 887
 	// Send email with activation link.
888
-	$admin_email = get_site_option( 'admin_email' );
889
-	if ( $admin_email == '' )
890
-		$admin_email = 'support@' . $_SERVER['SERVER_NAME'];
891
-	$from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
892
-	$message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
888
+	$admin_email = get_site_option('admin_email');
889
+	if ($admin_email == '')
890
+		$admin_email = 'support@'.$_SERVER['SERVER_NAME'];
891
+	$from_name = get_site_option('site_name') == '' ? 'WordPress' : esc_html(get_site_option('site_name'));
892
+	$message_headers = "From: \"{$from_name}\" <{$admin_email}>\n"."Content-Type: text/plain; charset=\"".get_option('blog_charset')."\"\n";
893 893
 	$message = sprintf(
894 894
 		/**
895 895
 		 * Filter the content of the notification email for new user sign-up.
@@ -904,11 +904,11 @@  discard block
 block discarded – undo
904 904
 		 * @param string $key        Activation key created in wpmu_signup_user().
905 905
 		 * @param array  $meta       Signup meta data.
906 906
 		 */
907
-		apply_filters( 'wpmu_signup_user_notification_email',
908
-			__( "To activate your user, please click the following link:\n\n%s\n\nAfter you activate, you will receive *another email* with your login." ),
907
+		apply_filters('wpmu_signup_user_notification_email',
908
+			__("To activate your user, please click the following link:\n\n%s\n\nAfter you activate, you will receive *another email* with your login."),
909 909
 			$user, $user_email, $key, $meta
910 910
 		),
911
-		site_url( "wp-activate.php?key=$key" )
911
+		site_url("wp-activate.php?key=$key")
912 912
 	);
913 913
 	// TODO: Don't hard code activation link.
914 914
 	$subject = sprintf(
@@ -923,14 +923,14 @@  discard block
 block discarded – undo
923 923
 		 * @param string $key        Activation key created in wpmu_signup_user().
924 924
 		 * @param array  $meta       Signup meta data.
925 925
 		 */
926
-		apply_filters( 'wpmu_signup_user_notification_subject',
927
-			__( '[%1$s] Activate %2$s' ),
926
+		apply_filters('wpmu_signup_user_notification_subject',
927
+			__('[%1$s] Activate %2$s'),
928 928
 			$user, $user_email, $key, $meta
929 929
 		),
930 930
 		$from_name,
931 931
 		$user
932 932
 	);
933
-	wp_mail( $user_email, wp_specialchars_decode( $subject ), $message, $message_headers );
933
+	wp_mail($user_email, wp_specialchars_decode($subject), $message, $message_headers);
934 934
 	return true;
935 935
 }
936 936
 
@@ -952,38 +952,38 @@  discard block
 block discarded – undo
952 952
 function wpmu_activate_signup($key) {
953 953
 	global $wpdb;
954 954
 
955
-	$signup = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->signups WHERE activation_key = %s", $key) );
955
+	$signup = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->signups WHERE activation_key = %s", $key));
956 956
 
957
-	if ( empty( $signup ) )
958
-		return new WP_Error( 'invalid_key', __( 'Invalid activation key.' ) );
957
+	if (empty($signup))
958
+		return new WP_Error('invalid_key', __('Invalid activation key.'));
959 959
 
960
-	if ( $signup->active ) {
961
-		if ( empty( $signup->domain ) )
962
-			return new WP_Error( 'already_active', __( 'The user is already active.' ), $signup );
960
+	if ($signup->active) {
961
+		if (empty($signup->domain))
962
+			return new WP_Error('already_active', __('The user is already active.'), $signup);
963 963
 		else
964
-			return new WP_Error( 'already_active', __( 'The site is already active.' ), $signup );
964
+			return new WP_Error('already_active', __('The site is already active.'), $signup);
965 965
 	}
966 966
 
967 967
 	$meta = maybe_unserialize($signup->meta);
968
-	$password = wp_generate_password( 12, false );
968
+	$password = wp_generate_password(12, false);
969 969
 
970 970
 	$user_id = username_exists($signup->user_login);
971 971
 
972
-	if ( ! $user_id )
972
+	if ( ! $user_id)
973 973
 		$user_id = wpmu_create_user($signup->user_login, $password, $signup->user_email);
974 974
 	else
975 975
 		$user_already_exists = true;
976 976
 
977
-	if ( ! $user_id )
977
+	if ( ! $user_id)
978 978
 		return new WP_Error('create_user', __('Could not create user'), $signup);
979 979
 
980 980
 	$now = current_time('mysql', true);
981 981
 
982
-	if ( empty($signup->domain) ) {
983
-		$wpdb->update( $wpdb->signups, array('active' => 1, 'activated' => $now), array('activation_key' => $key) );
982
+	if (empty($signup->domain)) {
983
+		$wpdb->update($wpdb->signups, array('active' => 1, 'activated' => $now), array('activation_key' => $key));
984 984
 
985
-		if ( isset( $user_already_exists ) )
986
-			return new WP_Error( 'user_already_exists', __( 'That username is already activated.' ), $signup);
985
+		if (isset($user_already_exists))
986
+			return new WP_Error('user_already_exists', __('That username is already activated.'), $signup);
987 987
 
988 988
 		/**
989 989
 		 * Fires immediately after a new user is activated.
@@ -994,24 +994,24 @@  discard block
 block discarded – undo
994 994
 		 * @param int   $password User password.
995 995
 		 * @param array $meta     Signup meta data.
996 996
 		 */
997
-		do_action( 'wpmu_activate_user', $user_id, $password, $meta );
998
-		return array( 'user_id' => $user_id, 'password' => $password, 'meta' => $meta );
997
+		do_action('wpmu_activate_user', $user_id, $password, $meta);
998
+		return array('user_id' => $user_id, 'password' => $password, 'meta' => $meta);
999 999
 	}
1000 1000
 
1001
-	$blog_id = wpmu_create_blog( $signup->domain, $signup->path, $signup->title, $user_id, $meta, $wpdb->siteid );
1001
+	$blog_id = wpmu_create_blog($signup->domain, $signup->path, $signup->title, $user_id, $meta, $wpdb->siteid);
1002 1002
 
1003 1003
 	// TODO: What to do if we create a user but cannot create a blog?
1004
-	if ( is_wp_error($blog_id) ) {
1004
+	if (is_wp_error($blog_id)) {
1005 1005
 		// If blog is taken, that means a previous attempt to activate this blog failed in between creating the blog and
1006 1006
 		// setting the activation flag. Let's just set the active flag and instruct the user to reset their password.
1007
-		if ( 'blog_taken' == $blog_id->get_error_code() ) {
1008
-			$blog_id->add_data( $signup );
1009
-			$wpdb->update( $wpdb->signups, array( 'active' => 1, 'activated' => $now ), array( 'activation_key' => $key ) );
1007
+		if ('blog_taken' == $blog_id->get_error_code()) {
1008
+			$blog_id->add_data($signup);
1009
+			$wpdb->update($wpdb->signups, array('active' => 1, 'activated' => $now), array('activation_key' => $key));
1010 1010
 		}
1011 1011
 		return $blog_id;
1012 1012
 	}
1013 1013
 
1014
-	$wpdb->update( $wpdb->signups, array('active' => 1, 'activated' => $now), array('activation_key' => $key) );
1014
+	$wpdb->update($wpdb->signups, array('active' => 1, 'activated' => $now), array('activation_key' => $key));
1015 1015
 	/**
1016 1016
 	 * Fires immediately after a site is activated.
1017 1017
 	 *
@@ -1023,7 +1023,7 @@  discard block
 block discarded – undo
1023 1023
 	 * @param string $signup_title  Site title.
1024 1024
 	 * @param array  $meta          Signup meta data.
1025 1025
 	 */
1026
-	do_action( 'wpmu_activate_blog', $blog_id, $user_id, $password, $signup->title, $meta );
1026
+	do_action('wpmu_activate_blog', $blog_id, $user_id, $password, $signup->title, $meta);
1027 1027
 
1028 1028
 	return array('blog_id' => $blog_id, 'user_id' => $user_id, 'password' => $password, 'title' => $signup->title, 'meta' => $meta);
1029 1029
 }
@@ -1043,16 +1043,16 @@  discard block
 block discarded – undo
1043 1043
  * @param string $email     The new user's email address.
1044 1044
  * @return int|false Returns false on failure, or int $user_id on success
1045 1045
  */
1046
-function wpmu_create_user( $user_name, $password, $email ) {
1047
-	$user_name = preg_replace( '/\s+/', '', sanitize_user( $user_name, true ) );
1046
+function wpmu_create_user($user_name, $password, $email) {
1047
+	$user_name = preg_replace('/\s+/', '', sanitize_user($user_name, true));
1048 1048
 
1049
-	$user_id = wp_create_user( $user_name, $password, $email );
1050
-	if ( is_wp_error( $user_id ) )
1049
+	$user_id = wp_create_user($user_name, $password, $email);
1050
+	if (is_wp_error($user_id))
1051 1051
 		return false;
1052 1052
 
1053 1053
 	// Newly created users have no roles or caps until they are added to a blog.
1054
-	delete_user_option( $user_id, 'capabilities' );
1055
-	delete_user_option( $user_id, 'user_level' );
1054
+	delete_user_option($user_id, 'capabilities');
1055
+	delete_user_option($user_id, 'user_level');
1056 1056
 
1057 1057
 	/**
1058 1058
 	 * Fires immediately after a new user is created.
@@ -1061,7 +1061,7 @@  discard block
 block discarded – undo
1061 1061
 	 *
1062 1062
 	 * @param int $user_id User ID.
1063 1063
 	 */
1064
-	do_action( 'wpmu_new_user', $user_id );
1064
+	do_action('wpmu_new_user', $user_id);
1065 1065
 
1066 1066
 	return $user_id;
1067 1067
 }
@@ -1088,30 +1088,30 @@  discard block
 block discarded – undo
1088 1088
  * @param int    $site_id Optional. Only relevant on multi-network installs.
1089 1089
  * @return int|WP_Error Returns WP_Error object on failure, int $blog_id on success
1090 1090
  */
1091
-function wpmu_create_blog( $domain, $path, $title, $user_id, $meta = array(), $site_id = 1 ) {
1092
-	$defaults = array( 'public' => 0 );
1093
-	$meta = wp_parse_args( $meta, $defaults );
1091
+function wpmu_create_blog($domain, $path, $title, $user_id, $meta = array(), $site_id = 1) {
1092
+	$defaults = array('public' => 0);
1093
+	$meta = wp_parse_args($meta, $defaults);
1094 1094
 
1095
-	$domain = preg_replace( '/\s+/', '', sanitize_user( $domain, true ) );
1095
+	$domain = preg_replace('/\s+/', '', sanitize_user($domain, true));
1096 1096
 
1097
-	if ( is_subdomain_install() )
1098
-		$domain = str_replace( '@', '', $domain );
1097
+	if (is_subdomain_install())
1098
+		$domain = str_replace('@', '', $domain);
1099 1099
 
1100
-	$title = strip_tags( $title );
1100
+	$title = strip_tags($title);
1101 1101
 	$user_id = (int) $user_id;
1102 1102
 
1103
-	if ( empty($path) )
1103
+	if (empty($path))
1104 1104
 		$path = '/';
1105 1105
 
1106 1106
 	// Check if the domain has been used already. We should return an error message.
1107
-	if ( domain_exists($domain, $path, $site_id) )
1108
-		return new WP_Error( 'blog_taken', __( 'Sorry, that site already exists!' ) );
1107
+	if (domain_exists($domain, $path, $site_id))
1108
+		return new WP_Error('blog_taken', __('Sorry, that site already exists!'));
1109 1109
 
1110
-	if ( ! wp_installing() ) {
1111
-		wp_installing( true );
1110
+	if ( ! wp_installing()) {
1111
+		wp_installing(true);
1112 1112
 	}
1113 1113
 
1114
-	if ( ! $blog_id = insert_blog($domain, $path, $site_id) )
1114
+	if ( ! $blog_id = insert_blog($domain, $path, $site_id))
1115 1115
 		return new WP_Error('insert_blog', __('Could not create site.'));
1116 1116
 
1117 1117
 	switch_to_blog($blog_id);
@@ -1120,18 +1120,18 @@  discard block
 block discarded – undo
1120 1120
 
1121 1121
 	add_user_to_blog($blog_id, $user_id, 'administrator');
1122 1122
 
1123
-	foreach ( $meta as $key => $value ) {
1124
-		if ( in_array( $key, array( 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id' ) ) )
1125
-			update_blog_status( $blog_id, $key, $value );
1123
+	foreach ($meta as $key => $value) {
1124
+		if (in_array($key, array('public', 'archived', 'mature', 'spam', 'deleted', 'lang_id')))
1125
+			update_blog_status($blog_id, $key, $value);
1126 1126
 		else
1127
-			update_option( $key, $value );
1127
+			update_option($key, $value);
1128 1128
 	}
1129 1129
 
1130
-	add_option( 'WPLANG', get_site_option( 'WPLANG' ) );
1131
-	update_option( 'blog_public', (int) $meta['public'] );
1130
+	add_option('WPLANG', get_site_option('WPLANG'));
1131
+	update_option('blog_public', (int) $meta['public']);
1132 1132
 
1133
-	if ( ! is_super_admin( $user_id ) && ! get_user_meta( $user_id, 'primary_blog', true ) )
1134
-		update_user_meta( $user_id, 'primary_blog', $blog_id );
1133
+	if ( ! is_super_admin($user_id) && ! get_user_meta($user_id, 'primary_blog', true))
1134
+		update_user_meta($user_id, 'primary_blog', $blog_id);
1135 1135
 
1136 1136
 	restore_current_blog();
1137 1137
 	/**
@@ -1146,7 +1146,7 @@  discard block
 block discarded – undo
1146 1146
 	 * @param int    $site_id Site ID. Only relevant on multi-network installs.
1147 1147
 	 * @param array  $meta    Meta data. Used to set initial site options.
1148 1148
 	 */
1149
-	do_action( 'wpmu_new_blog', $blog_id, $user_id, $domain, $path, $site_id, $meta );
1149
+	do_action('wpmu_new_blog', $blog_id, $user_id, $domain, $path, $site_id, $meta);
1150 1150
 
1151 1151
 	return $blog_id;
1152 1152
 }
@@ -1163,26 +1163,26 @@  discard block
 block discarded – undo
1163 1163
  * @param string $deprecated Not used.
1164 1164
  * @return bool
1165 1165
  */
1166
-function newblog_notify_siteadmin( $blog_id, $deprecated = '' ) {
1167
-	if ( get_site_option( 'registrationnotification' ) != 'yes' )
1166
+function newblog_notify_siteadmin($blog_id, $deprecated = '') {
1167
+	if (get_site_option('registrationnotification') != 'yes')
1168 1168
 		return false;
1169 1169
 
1170
-	$email = get_site_option( 'admin_email' );
1171
-	if ( is_email($email) == false )
1170
+	$email = get_site_option('admin_email');
1171
+	if (is_email($email) == false)
1172 1172
 		return false;
1173 1173
 
1174 1174
 	$options_site_url = esc_url(network_admin_url('settings.php'));
1175 1175
 
1176
-	switch_to_blog( $blog_id );
1177
-	$blogname = get_option( 'blogname' );
1176
+	switch_to_blog($blog_id);
1177
+	$blogname = get_option('blogname');
1178 1178
 	$siteurl = site_url();
1179 1179
 	restore_current_blog();
1180 1180
 
1181
-	$msg = sprintf( __( 'New Site: %1$s
1181
+	$msg = sprintf(__('New Site: %1$s
1182 1182
 URL: %2$s
1183 1183
 Remote IP: %3$s
1184 1184
 
1185
-Disable these notifications: %4$s' ), $blogname, $siteurl, wp_unslash( $_SERVER['REMOTE_ADDR'] ), $options_site_url);
1185
+Disable these notifications: %4$s' ), $blogname, $siteurl, wp_unslash($_SERVER['REMOTE_ADDR']), $options_site_url);
1186 1186
 	/**
1187 1187
 	 * Filter the message body of the new site activation email sent
1188 1188
 	 * to the network administrator.
@@ -1191,9 +1191,9 @@  discard block
 block discarded – undo
1191 1191
 	 *
1192 1192
 	 * @param string $msg Email body.
1193 1193
 	 */
1194
-	$msg = apply_filters( 'newblog_notify_siteadmin', $msg );
1194
+	$msg = apply_filters('newblog_notify_siteadmin', $msg);
1195 1195
 
1196
-	wp_mail( $email, sprintf( __( 'New Site Registration: %s' ), $siteurl ), $msg );
1196
+	wp_mail($email, sprintf(__('New Site Registration: %s'), $siteurl), $msg);
1197 1197
 	return true;
1198 1198
 }
1199 1199
 
@@ -1208,22 +1208,22 @@  discard block
 block discarded – undo
1208 1208
  * @param int $user_id The new user's ID.
1209 1209
  * @return bool
1210 1210
  */
1211
-function newuser_notify_siteadmin( $user_id ) {
1212
-	if ( get_site_option( 'registrationnotification' ) != 'yes' )
1211
+function newuser_notify_siteadmin($user_id) {
1212
+	if (get_site_option('registrationnotification') != 'yes')
1213 1213
 		return false;
1214 1214
 
1215
-	$email = get_site_option( 'admin_email' );
1215
+	$email = get_site_option('admin_email');
1216 1216
 
1217
-	if ( is_email($email) == false )
1217
+	if (is_email($email) == false)
1218 1218
 		return false;
1219 1219
 
1220
-	$user = get_userdata( $user_id );
1220
+	$user = get_userdata($user_id);
1221 1221
 
1222 1222
 	$options_site_url = esc_url(network_admin_url('settings.php'));
1223 1223
 	$msg = sprintf(__('New User: %1$s
1224 1224
 Remote IP: %2$s
1225 1225
 
1226
-Disable these notifications: %3$s'), $user->user_login, wp_unslash( $_SERVER['REMOTE_ADDR'] ), $options_site_url);
1226
+Disable these notifications: %3$s'), $user->user_login, wp_unslash($_SERVER['REMOTE_ADDR']), $options_site_url);
1227 1227
 
1228 1228
 	/**
1229 1229
 	 * Filter the message body of the new user activation email sent
@@ -1234,8 +1234,8 @@  discard block
 block discarded – undo
1234 1234
 	 * @param string  $msg  Email body.
1235 1235
 	 * @param WP_User $user WP_User instance of the new user.
1236 1236
 	 */
1237
-	$msg = apply_filters( 'newuser_notify_siteadmin', $msg, $user );
1238
-	wp_mail( $email, sprintf(__('New User Registration: %s'), $user->user_login), $msg );
1237
+	$msg = apply_filters('newuser_notify_siteadmin', $msg, $user);
1238
+	wp_mail($email, sprintf(__('New User Registration: %s'), $user->user_login), $msg);
1239 1239
 	return true;
1240 1240
 }
1241 1241
 
@@ -1256,8 +1256,8 @@  discard block
 block discarded – undo
1256 1256
  */
1257 1257
 function domain_exists($domain, $path, $site_id = 1) {
1258 1258
 	global $wpdb;
1259
-	$path = trailingslashit( $path );
1260
-	$result = $wpdb->get_var( $wpdb->prepare("SELECT blog_id FROM $wpdb->blogs WHERE domain = %s AND path = %s AND site_id = %d", $domain, $path, $site_id) );
1259
+	$path = trailingslashit($path);
1260
+	$result = $wpdb->get_var($wpdb->prepare("SELECT blog_id FROM $wpdb->blogs WHERE domain = %s AND path = %s AND site_id = %d", $domain, $path, $site_id));
1261 1261
 
1262 1262
 	/**
1263 1263
 	 * Filter whether a blogname is taken.
@@ -1269,7 +1269,7 @@  discard block
 block discarded – undo
1269 1269
 	 * @param string   $path    Path to be checked.
1270 1270
 	 * @param int      $site_id Site ID. Relevant only on multi-network installs.
1271 1271
 	 */
1272
-	return apply_filters( 'domain_exists', $result, $domain, $path, $site_id );
1272
+	return apply_filters('domain_exists', $result, $domain, $path, $site_id);
1273 1273
 }
1274 1274
 
1275 1275
 /**
@@ -1293,12 +1293,12 @@  discard block
 block discarded – undo
1293 1293
 	$path = trailingslashit($path);
1294 1294
 	$site_id = (int) $site_id;
1295 1295
 
1296
-	$result = $wpdb->insert( $wpdb->blogs, array('site_id' => $site_id, 'domain' => $domain, 'path' => $path, 'registered' => current_time('mysql')) );
1297
-	if ( ! $result )
1296
+	$result = $wpdb->insert($wpdb->blogs, array('site_id' => $site_id, 'domain' => $domain, 'path' => $path, 'registered' => current_time('mysql')));
1297
+	if ( ! $result)
1298 1298
 		return false;
1299 1299
 
1300 1300
 	$blog_id = $wpdb->insert_id;
1301
-	refresh_blog_details( $blog_id );
1301
+	refresh_blog_details($blog_id);
1302 1302
 
1303 1303
 	wp_maybe_update_network_site_counts();
1304 1304
 
@@ -1320,57 +1320,57 @@  discard block
 block discarded – undo
1320 1320
  * @param int    $blog_id    The value returned by insert_blog().
1321 1321
  * @param string $blog_title The title of the new site.
1322 1322
  */
1323
-function install_blog( $blog_id, $blog_title = '' ) {
1323
+function install_blog($blog_id, $blog_title = '') {
1324 1324
 	global $wpdb, $wp_roles, $current_site;
1325 1325
 
1326 1326
 	// Cast for security
1327 1327
 	$blog_id = (int) $blog_id;
1328 1328
 
1329
-	require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
1329
+	require_once(ABSPATH.'wp-admin/includes/upgrade.php');
1330 1330
 
1331 1331
 	$suppress = $wpdb->suppress_errors();
1332
-	if ( $wpdb->get_results( "DESCRIBE {$wpdb->posts}" ) )
1333
-		die( '<h1>' . __( 'Already Installed' ) . '</h1><p>' . __( 'You appear to have already installed WordPress. To reinstall please clear your old database tables first.' ) . '</p></body></html>' );
1334
-	$wpdb->suppress_errors( $suppress );
1332
+	if ($wpdb->get_results("DESCRIBE {$wpdb->posts}"))
1333
+		die('<h1>'.__('Already Installed').'</h1><p>'.__('You appear to have already installed WordPress. To reinstall please clear your old database tables first.').'</p></body></html>');
1334
+	$wpdb->suppress_errors($suppress);
1335 1335
 
1336
-	$url = get_blogaddress_by_id( $blog_id );
1336
+	$url = get_blogaddress_by_id($blog_id);
1337 1337
 
1338 1338
 	// Set everything up
1339
-	make_db_current_silent( 'blog' );
1339
+	make_db_current_silent('blog');
1340 1340
 	populate_options();
1341 1341
 	populate_roles();
1342 1342
 
1343 1343
 	// populate_roles() clears previous role definitions so we start over.
1344 1344
 	$wp_roles = new WP_Roles();
1345 1345
 
1346
-	$siteurl = $home = untrailingslashit( $url );
1346
+	$siteurl = $home = untrailingslashit($url);
1347 1347
 
1348
-	if ( ! is_subdomain_install() ) {
1348
+	if ( ! is_subdomain_install()) {
1349 1349
 
1350
- 		if ( 'https' === parse_url( get_site_option( 'siteurl' ), PHP_URL_SCHEME ) ) {
1351
- 			$siteurl = set_url_scheme( $siteurl, 'https' );
1350
+ 		if ('https' === parse_url(get_site_option('siteurl'), PHP_URL_SCHEME)) {
1351
+ 			$siteurl = set_url_scheme($siteurl, 'https');
1352 1352
  		}
1353
- 		if ( 'https' === parse_url( get_home_url( $current_site->blog_id ), PHP_URL_SCHEME ) ) {
1354
- 			$home = set_url_scheme( $home, 'https' );
1353
+ 		if ('https' === parse_url(get_home_url($current_site->blog_id), PHP_URL_SCHEME)) {
1354
+ 			$home = set_url_scheme($home, 'https');
1355 1355
  		}
1356 1356
 
1357 1357
 	}
1358 1358
 
1359
-	update_option( 'siteurl', $siteurl );
1360
-	update_option( 'home', $home );
1359
+	update_option('siteurl', $siteurl);
1360
+	update_option('home', $home);
1361 1361
 
1362
-	if ( get_site_option( 'ms_files_rewriting' ) )
1363
-		update_option( 'upload_path', UPLOADBLOGSDIR . "/$blog_id/files" );
1362
+	if (get_site_option('ms_files_rewriting'))
1363
+		update_option('upload_path', UPLOADBLOGSDIR."/$blog_id/files");
1364 1364
 	else
1365
-		update_option( 'upload_path', get_blog_option( get_current_site()->blog_id, 'upload_path' ) );
1365
+		update_option('upload_path', get_blog_option(get_current_site()->blog_id, 'upload_path'));
1366 1366
 
1367
-	update_option( 'blogname', wp_unslash( $blog_title ) );
1368
-	update_option( 'admin_email', '' );
1367
+	update_option('blogname', wp_unslash($blog_title));
1368
+	update_option('admin_email', '');
1369 1369
 
1370 1370
 	// remove all perms
1371 1371
 	$table_prefix = $wpdb->get_blog_prefix();
1372
-	delete_metadata( 'user', 0, $table_prefix . 'user_level',   null, true ); // delete all
1373
-	delete_metadata( 'user', 0, $table_prefix . 'capabilities', null, true ); // delete all
1372
+	delete_metadata('user', 0, $table_prefix.'user_level', null, true); // delete all
1373
+	delete_metadata('user', 0, $table_prefix.'capabilities', null, true); // delete all
1374 1374
 }
1375 1375
 
1376 1376
 /**
@@ -1390,13 +1390,13 @@  discard block
 block discarded – undo
1390 1390
 function install_blog_defaults($blog_id, $user_id) {
1391 1391
 	global $wpdb;
1392 1392
 
1393
-	require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
1393
+	require_once(ABSPATH.'wp-admin/includes/upgrade.php');
1394 1394
 
1395 1395
 	$suppress = $wpdb->suppress_errors();
1396 1396
 
1397 1397
 	wp_install_defaults($user_id);
1398 1398
 
1399
-	$wpdb->suppress_errors( $suppress );
1399
+	$wpdb->suppress_errors($suppress);
1400 1400
 }
1401 1401
 
1402 1402
 /**
@@ -1416,7 +1416,7 @@  discard block
 block discarded – undo
1416 1416
  * @param array  $meta     Optional. Not used in the default function, but is passed along to hooks for customization.
1417 1417
  * @return bool
1418 1418
  */
1419
-function wpmu_welcome_notification( $blog_id, $user_id, $password, $title, $meta = array() ) {
1419
+function wpmu_welcome_notification($blog_id, $user_id, $password, $title, $meta = array()) {
1420 1420
 	$current_site = get_current_site();
1421 1421
 
1422 1422
 	/**
@@ -1432,13 +1432,13 @@  discard block
 block discarded – undo
1432 1432
 	 * @param string   $title    Site title.
1433 1433
 	 * @param array    $meta     Signup meta data.
1434 1434
 	 */
1435
-	if ( ! apply_filters( 'wpmu_welcome_notification', $blog_id, $user_id, $password, $title, $meta ) )
1435
+	if ( ! apply_filters('wpmu_welcome_notification', $blog_id, $user_id, $password, $title, $meta))
1436 1436
 		return false;
1437 1437
 
1438
-	$welcome_email = get_site_option( 'welcome_email' );
1439
-	if ( $welcome_email == false ) {
1438
+	$welcome_email = get_site_option('welcome_email');
1439
+	if ($welcome_email == false) {
1440 1440
 		/* translators: Do not translate USERNAME, SITE_NAME, BLOG_URL, PASSWORD: those are placeholders. */
1441
-		$welcome_email = __( 'Howdy USERNAME,
1441
+		$welcome_email = __('Howdy USERNAME,
1442 1442
 
1443 1443
 Your new SITE_NAME site has been successfully set up at:
1444 1444
 BLOG_URL
@@ -1455,13 +1455,13 @@  discard block
 block discarded – undo
1455 1455
 	}
1456 1456
 
1457 1457
 	$url = get_blogaddress_by_id($blog_id);
1458
-	$user = get_userdata( $user_id );
1458
+	$user = get_userdata($user_id);
1459 1459
 
1460
-	$welcome_email = str_replace( 'SITE_NAME', $current_site->site_name, $welcome_email );
1461
-	$welcome_email = str_replace( 'BLOG_TITLE', $title, $welcome_email );
1462
-	$welcome_email = str_replace( 'BLOG_URL', $url, $welcome_email );
1463
-	$welcome_email = str_replace( 'USERNAME', $user->user_login, $welcome_email );
1464
-	$welcome_email = str_replace( 'PASSWORD', $password, $welcome_email );
1460
+	$welcome_email = str_replace('SITE_NAME', $current_site->site_name, $welcome_email);
1461
+	$welcome_email = str_replace('BLOG_TITLE', $title, $welcome_email);
1462
+	$welcome_email = str_replace('BLOG_URL', $url, $welcome_email);
1463
+	$welcome_email = str_replace('USERNAME', $user->user_login, $welcome_email);
1464
+	$welcome_email = str_replace('PASSWORD', $password, $welcome_email);
1465 1465
 
1466 1466
 	/**
1467 1467
 	 * Filter the content of the welcome email after site activation.
@@ -1477,17 +1477,17 @@  discard block
 block discarded – undo
1477 1477
 	 * @param string $title         Site title.
1478 1478
 	 * @param array  $meta          Signup meta data.
1479 1479
 	 */
1480
-	$welcome_email = apply_filters( 'update_welcome_email', $welcome_email, $blog_id, $user_id, $password, $title, $meta );
1481
-	$admin_email = get_site_option( 'admin_email' );
1480
+	$welcome_email = apply_filters('update_welcome_email', $welcome_email, $blog_id, $user_id, $password, $title, $meta);
1481
+	$admin_email = get_site_option('admin_email');
1482 1482
 
1483
-	if ( $admin_email == '' )
1484
-		$admin_email = 'support@' . $_SERVER['SERVER_NAME'];
1483
+	if ($admin_email == '')
1484
+		$admin_email = 'support@'.$_SERVER['SERVER_NAME'];
1485 1485
 
1486
-	$from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
1487
-	$message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
1486
+	$from_name = get_site_option('site_name') == '' ? 'WordPress' : esc_html(get_site_option('site_name'));
1487
+	$message_headers = "From: \"{$from_name}\" <{$admin_email}>\n"."Content-Type: text/plain; charset=\"".get_option('blog_charset')."\"\n";
1488 1488
 	$message = $welcome_email;
1489 1489
 
1490
-	if ( empty( $current_site->site_name ) )
1490
+	if (empty($current_site->site_name))
1491 1491
 		$current_site->site_name = 'WordPress';
1492 1492
 
1493 1493
 	/**
@@ -1497,8 +1497,8 @@  discard block
 block discarded – undo
1497 1497
 	 *
1498 1498
 	 * @param string $subject Subject of the email.
1499 1499
 	 */
1500
-	$subject = apply_filters( 'update_welcome_subject', sprintf( __( 'New %1$s Site: %2$s' ), $current_site->site_name, wp_unslash( $title ) ) );
1501
-	wp_mail( $user->user_email, wp_specialchars_decode( $subject ), $message, $message_headers );
1500
+	$subject = apply_filters('update_welcome_subject', sprintf(__('New %1$s Site: %2$s'), $current_site->site_name, wp_unslash($title)));
1501
+	wp_mail($user->user_email, wp_specialchars_decode($subject), $message, $message_headers);
1502 1502
 	return true;
1503 1503
 }
1504 1504
 
@@ -1517,7 +1517,7 @@  discard block
 block discarded – undo
1517 1517
  * @param array  $meta     Optional. Not used in the default function, but is passed along to hooks for customization.
1518 1518
  * @return bool
1519 1519
  */
1520
-function wpmu_welcome_user_notification( $user_id, $password, $meta = array() ) {
1520
+function wpmu_welcome_user_notification($user_id, $password, $meta = array()) {
1521 1521
 	$current_site = get_current_site();
1522 1522
 
1523 1523
 	/**
@@ -1531,12 +1531,12 @@  discard block
 block discarded – undo
1531 1531
 	 * @param string $password User password.
1532 1532
 	 * @param array  $meta     Signup meta data.
1533 1533
 	 */
1534
-	if ( ! apply_filters( 'wpmu_welcome_user_notification', $user_id, $password, $meta ) )
1534
+	if ( ! apply_filters('wpmu_welcome_user_notification', $user_id, $password, $meta))
1535 1535
 		return false;
1536 1536
 
1537
-	$welcome_email = get_site_option( 'welcome_user_email' );
1537
+	$welcome_email = get_site_option('welcome_user_email');
1538 1538
 
1539
-	$user = get_userdata( $user_id );
1539
+	$user = get_userdata($user_id);
1540 1540
 
1541 1541
 	/**
1542 1542
 	 * Filters the content of the welcome email after user activation.
@@ -1550,22 +1550,22 @@  discard block
 block discarded – undo
1550 1550
 	 * @param string $password      User password.
1551 1551
 	 * @param array  $meta          Signup meta data.
1552 1552
 	 */
1553
-	$welcome_email = apply_filters( 'update_welcome_user_email', $welcome_email, $user_id, $password, $meta );
1554
-	$welcome_email = str_replace( 'SITE_NAME', $current_site->site_name, $welcome_email );
1555
-	$welcome_email = str_replace( 'USERNAME', $user->user_login, $welcome_email );
1556
-	$welcome_email = str_replace( 'PASSWORD', $password, $welcome_email );
1557
-	$welcome_email = str_replace( 'LOGINLINK', wp_login_url(), $welcome_email );
1553
+	$welcome_email = apply_filters('update_welcome_user_email', $welcome_email, $user_id, $password, $meta);
1554
+	$welcome_email = str_replace('SITE_NAME', $current_site->site_name, $welcome_email);
1555
+	$welcome_email = str_replace('USERNAME', $user->user_login, $welcome_email);
1556
+	$welcome_email = str_replace('PASSWORD', $password, $welcome_email);
1557
+	$welcome_email = str_replace('LOGINLINK', wp_login_url(), $welcome_email);
1558 1558
 
1559
-	$admin_email = get_site_option( 'admin_email' );
1559
+	$admin_email = get_site_option('admin_email');
1560 1560
 
1561
-	if ( $admin_email == '' )
1562
-		$admin_email = 'support@' . $_SERVER['SERVER_NAME'];
1561
+	if ($admin_email == '')
1562
+		$admin_email = 'support@'.$_SERVER['SERVER_NAME'];
1563 1563
 
1564
-	$from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
1565
-	$message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
1564
+	$from_name = get_site_option('site_name') == '' ? 'WordPress' : esc_html(get_site_option('site_name'));
1565
+	$message_headers = "From: \"{$from_name}\" <{$admin_email}>\n"."Content-Type: text/plain; charset=\"".get_option('blog_charset')."\"\n";
1566 1566
 	$message = $welcome_email;
1567 1567
 
1568
-	if ( empty( $current_site->site_name ) )
1568
+	if (empty($current_site->site_name))
1569 1569
 		$current_site->site_name = 'WordPress';
1570 1570
 
1571 1571
 	/**
@@ -1575,8 +1575,8 @@  discard block
 block discarded – undo
1575 1575
 	 *
1576 1576
 	 * @param string $subject Subject of the email.
1577 1577
 	 */
1578
-	$subject = apply_filters( 'update_welcome_user_subject', sprintf( __( 'New %1$s User: %2$s' ), $current_site->site_name, $user->user_login) );
1579
-	wp_mail( $user->user_email, wp_specialchars_decode( $subject ), $message, $message_headers );
1578
+	$subject = apply_filters('update_welcome_user_subject', sprintf(__('New %1$s User: %2$s'), $current_site->site_name, $user->user_login));
1579
+	wp_mail($user->user_email, wp_specialchars_decode($subject), $message, $message_headers);
1580 1580
 	return true;
1581 1581
 }
1582 1582
 
@@ -1612,26 +1612,26 @@  discard block
 block discarded – undo
1612 1612
  * @param int $user_id
1613 1613
  * @return array Contains the blog_id, post_id, post_date_gmt, and post_gmt_ts
1614 1614
  */
1615
-function get_most_recent_post_of_user( $user_id ) {
1615
+function get_most_recent_post_of_user($user_id) {
1616 1616
 	global $wpdb;
1617 1617
 
1618
-	$user_blogs = get_blogs_of_user( (int) $user_id );
1618
+	$user_blogs = get_blogs_of_user((int) $user_id);
1619 1619
 	$most_recent_post = array();
1620 1620
 
1621 1621
 	// Walk through each blog and get the most recent post
1622 1622
 	// published by $user_id
1623
-	foreach ( (array) $user_blogs as $blog ) {
1624
-		$prefix = $wpdb->get_blog_prefix( $blog->userblog_id );
1625
-		$recent_post = $wpdb->get_row( $wpdb->prepare("SELECT ID, post_date_gmt FROM {$prefix}posts WHERE post_author = %d AND post_type = 'post' AND post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1", $user_id ), ARRAY_A);
1623
+	foreach ((array) $user_blogs as $blog) {
1624
+		$prefix = $wpdb->get_blog_prefix($blog->userblog_id);
1625
+		$recent_post = $wpdb->get_row($wpdb->prepare("SELECT ID, post_date_gmt FROM {$prefix}posts WHERE post_author = %d AND post_type = 'post' AND post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1", $user_id), ARRAY_A);
1626 1626
 
1627 1627
 		// Make sure we found a post
1628
-		if ( isset($recent_post['ID']) ) {
1628
+		if (isset($recent_post['ID'])) {
1629 1629
 			$post_gmt_ts = strtotime($recent_post['post_date_gmt']);
1630 1630
 
1631 1631
 			// If this is the first post checked or if this post is
1632 1632
 			// newer than the current recent post, make it the new
1633 1633
 			// most recent post.
1634
-			if ( !isset($most_recent_post['post_gmt_ts']) || ( $post_gmt_ts > $most_recent_post['post_gmt_ts'] ) ) {
1634
+			if ( ! isset($most_recent_post['post_gmt_ts']) || ($post_gmt_ts > $most_recent_post['post_gmt_ts'])) {
1635 1635
 				$most_recent_post = array(
1636 1636
 					'blog_id'		=> $blog->userblog_id,
1637 1637
 					'post_id'		=> $recent_post['ID'],
@@ -1658,24 +1658,24 @@  discard block
 block discarded – undo
1658 1658
  * @param string $directory Full path of a directory.
1659 1659
  * @return int Size of the directory in MB.
1660 1660
  */
1661
-function get_dirsize( $directory ) {
1662
-	$dirsize = get_transient( 'dirsize_cache' );
1663
-	if ( is_array( $dirsize ) && isset( $dirsize[ $directory ][ 'size' ] ) )
1664
-		return $dirsize[ $directory ][ 'size' ];
1661
+function get_dirsize($directory) {
1662
+	$dirsize = get_transient('dirsize_cache');
1663
+	if (is_array($dirsize) && isset($dirsize[$directory]['size']))
1664
+		return $dirsize[$directory]['size'];
1665 1665
 
1666
-	if ( ! is_array( $dirsize ) )
1666
+	if ( ! is_array($dirsize))
1667 1667
 		$dirsize = array();
1668 1668
 
1669 1669
 	// Exclude individual site directories from the total when checking the main site,
1670 1670
 	// as they are subdirectories and should not be counted.
1671
-	if ( is_main_site() ) {
1672
-		$dirsize[ $directory ][ 'size' ] = recurse_dirsize( $directory, $directory . '/sites' );
1671
+	if (is_main_site()) {
1672
+		$dirsize[$directory]['size'] = recurse_dirsize($directory, $directory.'/sites');
1673 1673
 	} else {
1674
-		$dirsize[ $directory ][ 'size' ] = recurse_dirsize( $directory );
1674
+		$dirsize[$directory]['size'] = recurse_dirsize($directory);
1675 1675
 	}
1676 1676
 
1677
-	set_transient( 'dirsize_cache', $dirsize, HOUR_IN_SECONDS );
1678
-	return $dirsize[ $directory ][ 'size' ];
1677
+	set_transient('dirsize_cache', $dirsize, HOUR_IN_SECONDS);
1678
+	return $dirsize[$directory]['size'];
1679 1679
 }
1680 1680
 
1681 1681
 /**
@@ -1691,23 +1691,23 @@  discard block
 block discarded – undo
1691 1691
  * @param string $exclude   Optional. Full path of a subdirectory to exclude from the total.
1692 1692
  * @return int|false Size in MB if a valid directory. False if not.
1693 1693
  */
1694
-function recurse_dirsize( $directory, $exclude = null ) {
1694
+function recurse_dirsize($directory, $exclude = null) {
1695 1695
 	$size = 0;
1696 1696
 
1697
-	$directory = untrailingslashit( $directory );
1697
+	$directory = untrailingslashit($directory);
1698 1698
 
1699
-	if ( ! file_exists( $directory ) || ! is_dir( $directory ) || ! is_readable( $directory ) || $directory === $exclude ) {
1699
+	if ( ! file_exists($directory) || ! is_dir($directory) || ! is_readable($directory) || $directory === $exclude) {
1700 1700
 		return false;
1701 1701
 	}
1702 1702
 
1703 1703
 	if ($handle = opendir($directory)) {
1704
-		while(($file = readdir($handle)) !== false) {
1704
+		while (($file = readdir($handle)) !== false) {
1705 1705
 			$path = $directory.'/'.$file;
1706 1706
 			if ($file != '.' && $file != '..') {
1707 1707
 				if (is_file($path)) {
1708 1708
 					$size += filesize($path);
1709 1709
 				} elseif (is_dir($path)) {
1710
-					$handlesize = recurse_dirsize( $path, $exclude );
1710
+					$handlesize = recurse_dirsize($path, $exclude);
1711 1711
 					if ($handlesize > 0)
1712 1712
 						$size += $handlesize;
1713 1713
 				}
@@ -1732,12 +1732,12 @@  discard block
 block discarded – undo
1732 1732
  * @param array $mimes
1733 1733
  * @return array
1734 1734
  */
1735
-function check_upload_mimes( $mimes ) {
1736
-	$site_exts = explode( ' ', get_site_option( 'upload_filetypes', 'jpg jpeg png gif' ) );
1735
+function check_upload_mimes($mimes) {
1736
+	$site_exts = explode(' ', get_site_option('upload_filetypes', 'jpg jpeg png gif'));
1737 1737
 	$site_mimes = array();
1738
-	foreach ( $site_exts as $ext ) {
1739
-		foreach ( $mimes as $ext_pattern => $mime ) {
1740
-			if ( $ext != '' && strpos( $ext_pattern, $ext ) !== false )
1738
+	foreach ($site_exts as $ext) {
1739
+		foreach ($mimes as $ext_pattern => $mime) {
1740
+			if ($ext != '' && strpos($ext_pattern, $ext) !== false)
1741 1741
 				$site_mimes[$ext_pattern] = $mime;
1742 1742
 		}
1743 1743
 	}
@@ -1758,9 +1758,9 @@  discard block
 block discarded – undo
1758 1758
  *
1759 1759
  * @param string $deprecated Not used.
1760 1760
  */
1761
-function update_posts_count( $deprecated = '' ) {
1761
+function update_posts_count($deprecated = '') {
1762 1762
 	global $wpdb;
1763
-	update_option( 'post_count', (int) $wpdb->get_var( "SELECT COUNT(ID) FROM {$wpdb->posts} WHERE post_status = 'publish' and post_type = 'post'" ) );
1763
+	update_option('post_count', (int) $wpdb->get_var("SELECT COUNT(ID) FROM {$wpdb->posts} WHERE post_status = 'publish' and post_type = 'post'"));
1764 1764
 }
1765 1765
 
1766 1766
 /**
@@ -1773,11 +1773,11 @@  discard block
 block discarded – undo
1773 1773
  * @param int $blog_id
1774 1774
  * @param int $user_id
1775 1775
  */
1776
-function wpmu_log_new_registrations( $blog_id, $user_id ) {
1776
+function wpmu_log_new_registrations($blog_id, $user_id) {
1777 1777
 	global $wpdb;
1778
-	$user = get_userdata( (int) $user_id );
1779
-	if ( $user )
1780
-		$wpdb->insert( $wpdb->registration_log, array('email' => $user->user_email, 'IP' => preg_replace( '/[^0-9., ]/', '', wp_unslash( $_SERVER['REMOTE_ADDR'] ) ), 'blog_id' => $blog_id, 'date_registered' => current_time('mysql')) );
1778
+	$user = get_userdata((int) $user_id);
1779
+	if ($user)
1780
+		$wpdb->insert($wpdb->registration_log, array('email' => $user->user_email, 'IP' => preg_replace('/[^0-9., ]/', '', wp_unslash($_SERVER['REMOTE_ADDR'])), 'blog_id' => $blog_id, 'date_registered' => current_time('mysql')));
1781 1781
 }
1782 1782
 
1783 1783
 /**
@@ -1794,61 +1794,61 @@  discard block
 block discarded – undo
1794 1794
  * @param string $deprecated Not used.
1795 1795
  * @return int An ID from the global terms table mapped from $term_id.
1796 1796
  */
1797
-function global_terms( $term_id, $deprecated = '' ) {
1797
+function global_terms($term_id, $deprecated = '') {
1798 1798
 	global $wpdb;
1799 1799
 	static $global_terms_recurse = null;
1800 1800
 
1801
-	if ( !global_terms_enabled() )
1801
+	if ( ! global_terms_enabled())
1802 1802
 		return $term_id;
1803 1803
 
1804 1804
 	// prevent a race condition
1805 1805
 	$recurse_start = false;
1806
-	if ( $global_terms_recurse === null ) {
1806
+	if ($global_terms_recurse === null) {
1807 1807
 		$recurse_start = true;
1808 1808
 		$global_terms_recurse = 1;
1809
-	} elseif ( 10 < $global_terms_recurse++ ) {
1809
+	} elseif (10 < $global_terms_recurse++) {
1810 1810
 		return $term_id;
1811 1811
 	}
1812 1812
 
1813
-	$term_id = intval( $term_id );
1814
-	$c = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->terms WHERE term_id = %d", $term_id ) );
1813
+	$term_id = intval($term_id);
1814
+	$c = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->terms WHERE term_id = %d", $term_id));
1815 1815
 
1816
-	$global_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM $wpdb->sitecategories WHERE category_nicename = %s", $c->slug ) );
1817
-	if ( $global_id == null ) {
1818
-		$used_global_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM $wpdb->sitecategories WHERE cat_ID = %d", $c->term_id ) );
1819
-		if ( null == $used_global_id ) {
1820
-			$wpdb->insert( $wpdb->sitecategories, array( 'cat_ID' => $term_id, 'cat_name' => $c->name, 'category_nicename' => $c->slug ) );
1816
+	$global_id = $wpdb->get_var($wpdb->prepare("SELECT cat_ID FROM $wpdb->sitecategories WHERE category_nicename = %s", $c->slug));
1817
+	if ($global_id == null) {
1818
+		$used_global_id = $wpdb->get_var($wpdb->prepare("SELECT cat_ID FROM $wpdb->sitecategories WHERE cat_ID = %d", $c->term_id));
1819
+		if (null == $used_global_id) {
1820
+			$wpdb->insert($wpdb->sitecategories, array('cat_ID' => $term_id, 'cat_name' => $c->name, 'category_nicename' => $c->slug));
1821 1821
 			$global_id = $wpdb->insert_id;
1822
-			if ( empty( $global_id ) )
1822
+			if (empty($global_id))
1823 1823
 				return $term_id;
1824 1824
 		} else {
1825
-			$max_global_id = $wpdb->get_var( "SELECT MAX(cat_ID) FROM $wpdb->sitecategories" );
1826
-			$max_local_id = $wpdb->get_var( "SELECT MAX(term_id) FROM $wpdb->terms" );
1827
-			$new_global_id = max( $max_global_id, $max_local_id ) + mt_rand( 100, 400 );
1828
-			$wpdb->insert( $wpdb->sitecategories, array( 'cat_ID' => $new_global_id, 'cat_name' => $c->name, 'category_nicename' => $c->slug ) );
1825
+			$max_global_id = $wpdb->get_var("SELECT MAX(cat_ID) FROM $wpdb->sitecategories");
1826
+			$max_local_id = $wpdb->get_var("SELECT MAX(term_id) FROM $wpdb->terms");
1827
+			$new_global_id = max($max_global_id, $max_local_id) + mt_rand(100, 400);
1828
+			$wpdb->insert($wpdb->sitecategories, array('cat_ID' => $new_global_id, 'cat_name' => $c->name, 'category_nicename' => $c->slug));
1829 1829
 			$global_id = $wpdb->insert_id;
1830 1830
 		}
1831
-	} elseif ( $global_id != $term_id ) {
1832
-		$local_id = $wpdb->get_var( $wpdb->prepare( "SELECT term_id FROM $wpdb->terms WHERE term_id = %d", $global_id ) );
1833
-		if ( null != $local_id ) {
1834
-			global_terms( $local_id );
1835
-			if ( 10 < $global_terms_recurse ) {
1831
+	} elseif ($global_id != $term_id) {
1832
+		$local_id = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms WHERE term_id = %d", $global_id));
1833
+		if (null != $local_id) {
1834
+			global_terms($local_id);
1835
+			if (10 < $global_terms_recurse) {
1836 1836
 				$global_id = $term_id;
1837 1837
 			}
1838 1838
 		}
1839 1839
 	}
1840 1840
 
1841
-	if ( $global_id != $term_id ) {
1842
-		if ( get_option( 'default_category' ) == $term_id )
1843
-			update_option( 'default_category', $global_id );
1841
+	if ($global_id != $term_id) {
1842
+		if (get_option('default_category') == $term_id)
1843
+			update_option('default_category', $global_id);
1844 1844
 
1845
-		$wpdb->update( $wpdb->terms, array('term_id' => $global_id), array('term_id' => $term_id) );
1846
-		$wpdb->update( $wpdb->term_taxonomy, array('term_id' => $global_id), array('term_id' => $term_id) );
1847
-		$wpdb->update( $wpdb->term_taxonomy, array('parent' => $global_id), array('parent' => $term_id) );
1845
+		$wpdb->update($wpdb->terms, array('term_id' => $global_id), array('term_id' => $term_id));
1846
+		$wpdb->update($wpdb->term_taxonomy, array('term_id' => $global_id), array('term_id' => $term_id));
1847
+		$wpdb->update($wpdb->term_taxonomy, array('parent' => $global_id), array('parent' => $term_id));
1848 1848
 
1849 1849
 		clean_term_cache($term_id);
1850 1850
 	}
1851
-	if ( $recurse_start )
1851
+	if ($recurse_start)
1852 1852
 		$global_terms_recurse = null;
1853 1853
 
1854 1854
 	return $global_id;
@@ -1863,8 +1863,8 @@  discard block
 block discarded – undo
1863 1863
  * @param array|string $deprecated Not used.
1864 1864
  * @return array The current site's domain
1865 1865
  */
1866
-function redirect_this_site( $deprecated = '' ) {
1867
-	return array( get_current_site()->domain );
1866
+function redirect_this_site($deprecated = '') {
1867
+	return array(get_current_site()->domain);
1868 1868
 }
1869 1869
 
1870 1870
 /**
@@ -1877,12 +1877,12 @@  discard block
 block discarded – undo
1877 1877
  * @param array $upload
1878 1878
  * @return string|array If the upload is under the size limit, $upload is returned. Otherwise returns an error message.
1879 1879
  */
1880
-function upload_is_file_too_big( $upload ) {
1881
-	if ( ! is_array( $upload ) || defined( 'WP_IMPORTING' ) || get_site_option( 'upload_space_check_disabled' ) )
1880
+function upload_is_file_too_big($upload) {
1881
+	if ( ! is_array($upload) || defined('WP_IMPORTING') || get_site_option('upload_space_check_disabled'))
1882 1882
 		return $upload;
1883 1883
 
1884
-	if ( strlen( $upload['bits'] )  > ( KB_IN_BYTES * get_site_option( 'fileupload_maxk', 1500 ) ) ) {
1885
-		return sprintf( __( 'This file is too big. Files must be less than %d KB in size.' ) . '<br />', get_site_option( 'fileupload_maxk', 1500 ) );
1884
+	if (strlen($upload['bits']) > (KB_IN_BYTES * get_site_option('fileupload_maxk', 1500))) {
1885
+		return sprintf(__('This file is too big. Files must be less than %d KB in size.').'<br />', get_site_option('fileupload_maxk', 1500));
1886 1886
 	}
1887 1887
 
1888 1888
 	return $upload;
@@ -1896,7 +1896,7 @@  discard block
 block discarded – undo
1896 1896
 function signup_nonce_fields() {
1897 1897
 	$id = mt_rand();
1898 1898
 	echo "<input type='hidden' name='signup_form_id' value='{$id}' />";
1899
-	wp_nonce_field('signup_form_' . $id, '_signup_form', false);
1899
+	wp_nonce_field('signup_form_'.$id, '_signup_form', false);
1900 1900
 }
1901 1901
 
1902 1902
 /**
@@ -1907,12 +1907,12 @@  discard block
 block discarded – undo
1907 1907
  * @param array $result
1908 1908
  * @return array
1909 1909
  */
1910
-function signup_nonce_check( $result ) {
1911
-	if ( !strpos( $_SERVER[ 'PHP_SELF' ], 'wp-signup.php' ) )
1910
+function signup_nonce_check($result) {
1911
+	if ( ! strpos($_SERVER['PHP_SELF'], 'wp-signup.php'))
1912 1912
 		return $result;
1913 1913
 
1914
-	if ( wp_create_nonce('signup_form_' . $_POST[ 'signup_form_id' ]) != $_POST['_signup_form'] )
1915
-		wp_die( __( 'Please try again.' ) );
1914
+	if (wp_create_nonce('signup_form_'.$_POST['signup_form_id']) != $_POST['_signup_form'])
1915
+		wp_die(__('Please try again.'));
1916 1916
 
1917 1917
 	return $result;
1918 1918
 }
@@ -1932,10 +1932,10 @@  discard block
 block discarded – undo
1932 1932
 	 *
1933 1933
 	 * @param string $no_blog_redirect The redirect URL defined in NOBLOGREDIRECT.
1934 1934
 	 */
1935
-	if ( is_main_site() && is_404() && defined( 'NOBLOGREDIRECT' ) && ( $destination = apply_filters( 'blog_redirect_404', NOBLOGREDIRECT ) ) ) {
1936
-		if ( $destination == '%siteurl%' )
1935
+	if (is_main_site() && is_404() && defined('NOBLOGREDIRECT') && ($destination = apply_filters('blog_redirect_404', NOBLOGREDIRECT))) {
1936
+		if ($destination == '%siteurl%')
1937 1937
 			$destination = network_home_url();
1938
-		wp_redirect( $destination );
1938
+		wp_redirect($destination);
1939 1939
 		exit();
1940 1940
 	}
1941 1941
 }
@@ -1950,23 +1950,23 @@  discard block
 block discarded – undo
1950 1950
  * @since MU
1951 1951
  */
1952 1952
 function maybe_add_existing_user_to_blog() {
1953
-	if ( false === strpos( $_SERVER[ 'REQUEST_URI' ], '/newbloguser/' ) )
1953
+	if (false === strpos($_SERVER['REQUEST_URI'], '/newbloguser/'))
1954 1954
 		return;
1955 1955
 
1956
-	$parts = explode( '/', $_SERVER[ 'REQUEST_URI' ] );
1957
-	$key = array_pop( $parts );
1956
+	$parts = explode('/', $_SERVER['REQUEST_URI']);
1957
+	$key = array_pop($parts);
1958 1958
 
1959
-	if ( $key == '' )
1960
-		$key = array_pop( $parts );
1959
+	if ($key == '')
1960
+		$key = array_pop($parts);
1961 1961
 
1962
-	$details = get_option( 'new_user_' . $key );
1963
-	if ( !empty( $details ) )
1964
-		delete_option( 'new_user_' . $key );
1962
+	$details = get_option('new_user_'.$key);
1963
+	if ( ! empty($details))
1964
+		delete_option('new_user_'.$key);
1965 1965
 
1966
-	if ( empty( $details ) || is_wp_error( add_existing_user_to_blog( $details ) ) )
1967
-		wp_die( sprintf(__('An error occurred adding you to this site. Back to the <a href="%s">homepage</a>.'), home_url() ) );
1966
+	if (empty($details) || is_wp_error(add_existing_user_to_blog($details)))
1967
+		wp_die(sprintf(__('An error occurred adding you to this site. Back to the <a href="%s">homepage</a>.'), home_url()));
1968 1968
 
1969
-	wp_die( sprintf( __( 'You have been added to this site. Please visit the <a href="%s">homepage</a> or <a href="%s">log in</a> using your username and password.' ), home_url(), admin_url() ), __( 'WordPress &rsaquo; Success' ), array( 'response' => 200 ) );
1969
+	wp_die(sprintf(__('You have been added to this site. Please visit the <a href="%s">homepage</a> or <a href="%s">log in</a> using your username and password.'), home_url(), admin_url()), __('WordPress &rsaquo; Success'), array('response' => 200));
1970 1970
 }
1971 1971
 
1972 1972
 /**
@@ -1979,11 +1979,11 @@  discard block
 block discarded – undo
1979 1979
  * @param array $details
1980 1980
  * @return true|WP_Error|void
1981 1981
  */
1982
-function add_existing_user_to_blog( $details = false ) {
1982
+function add_existing_user_to_blog($details = false) {
1983 1983
 	global $blog_id;
1984 1984
 
1985
-	if ( is_array( $details ) ) {
1986
-		$result = add_user_to_blog( $blog_id, $details[ 'user_id' ], $details[ 'role' ] );
1985
+	if (is_array($details)) {
1986
+		$result = add_user_to_blog($blog_id, $details['user_id'], $details['role']);
1987 1987
 		/**
1988 1988
 		 * Fires immediately after an existing user is added to a site.
1989 1989
 		 *
@@ -1992,7 +1992,7 @@  discard block
 block discarded – undo
1992 1992
 		 * @param int   $user_id User ID.
1993 1993
 		 * @param mixed $result  True on success or a WP_Error object if the user doesn't exist.
1994 1994
 		 */
1995
-		do_action( 'added_existing_user', $details['user_id'], $result );
1995
+		do_action('added_existing_user', $details['user_id'], $result);
1996 1996
 		return $result;
1997 1997
 	}
1998 1998
 }
@@ -2010,13 +2010,13 @@  discard block
 block discarded – undo
2010 2010
  * @param mixed $password Ignored.
2011 2011
  * @param array $meta
2012 2012
  */
2013
-function add_new_user_to_blog( $user_id, $password, $meta ) {
2014
-	if ( !empty( $meta[ 'add_to_blog' ] ) ) {
2015
-		$blog_id = $meta[ 'add_to_blog' ];
2016
-		$role = $meta[ 'new_role' ];
2013
+function add_new_user_to_blog($user_id, $password, $meta) {
2014
+	if ( ! empty($meta['add_to_blog'])) {
2015
+		$blog_id = $meta['add_to_blog'];
2016
+		$role = $meta['new_role'];
2017 2017
 		remove_user_from_blog($user_id, get_current_site()->blog_id); // remove user from main blog.
2018
-		add_user_to_blog( $blog_id, $user_id, $role );
2019
-		update_user_meta( $user_id, 'primary_blog', $blog_id );
2018
+		add_user_to_blog($blog_id, $user_id, $role);
2019
+		update_user_meta($user_id, 'primary_blog', $blog_id);
2020 2020
 	}
2021 2021
 }
2022 2022
 
@@ -2027,7 +2027,7 @@  discard block
 block discarded – undo
2027 2027
  *
2028 2028
  * @param PHPMailer $phpmailer The PHPMailer instance, passed by reference.
2029 2029
  */
2030
-function fix_phpmailer_messageid( $phpmailer ) {
2030
+function fix_phpmailer_messageid($phpmailer) {
2031 2031
 	$phpmailer->Hostname = get_current_site()->domain;
2032 2032
 }
2033 2033
 
@@ -2040,16 +2040,16 @@  discard block
 block discarded – undo
2040 2040
  * 	                           or user login name as a string.
2041 2041
  * @return bool
2042 2042
  */
2043
-function is_user_spammy( $user = null ) {
2044
-    if ( ! ( $user instanceof WP_User ) ) {
2045
-		if ( $user ) {
2046
-			$user = get_user_by( 'login', $user );
2043
+function is_user_spammy($user = null) {
2044
+    if ( ! ($user instanceof WP_User)) {
2045
+		if ($user) {
2046
+			$user = get_user_by('login', $user);
2047 2047
 		} else {
2048 2048
 			$user = wp_get_current_user();
2049 2049
 		}
2050 2050
 	}
2051 2051
 
2052
-	return $user && isset( $user->spam ) && 1 == $user->spam;
2052
+	return $user && isset($user->spam) && 1 == $user->spam;
2053 2053
 }
2054 2054
 
2055 2055
 /**
@@ -2062,8 +2062,8 @@  discard block
 block discarded – undo
2062 2062
  * @param int $old_value
2063 2063
  * @param int $value     The new public value
2064 2064
  */
2065
-function update_blog_public( $old_value, $value ) {
2066
-	update_blog_status( get_current_blog_id(), 'public', (int) $value );
2065
+function update_blog_public($old_value, $value) {
2066
+	update_blog_status(get_current_blog_id(), 'public', (int) $value);
2067 2067
 }
2068 2068
 
2069 2069
 /**
@@ -2078,16 +2078,16 @@  discard block
 block discarded – undo
2078 2078
  * @param int    $blog_id Optional. Defaults to current blog.
2079 2079
  * @return bool
2080 2080
  */
2081
-function is_user_option_local( $key, $user_id = 0, $blog_id = 0 ) {
2081
+function is_user_option_local($key, $user_id = 0, $blog_id = 0) {
2082 2082
 	global $wpdb;
2083 2083
 
2084 2084
 	$current_user = wp_get_current_user();
2085
-	if ( $blog_id == 0 ) {
2085
+	if ($blog_id == 0) {
2086 2086
 		$blog_id = $wpdb->blogid;
2087 2087
 	}
2088
-	$local_key = $wpdb->get_blog_prefix( $blog_id ) . $key;
2088
+	$local_key = $wpdb->get_blog_prefix($blog_id).$key;
2089 2089
 
2090
-	return isset( $current_user->$local_key );
2090
+	return isset($current_user->$local_key);
2091 2091
 }
2092 2092
 
2093 2093
 /**
@@ -2099,7 +2099,7 @@  discard block
 block discarded – undo
2099 2099
  */
2100 2100
 function users_can_register_signup_filter() {
2101 2101
 	$registration = get_site_option('registration');
2102
-	return ( $registration == 'all' || $registration == 'user' );
2102
+	return ($registration == 'all' || $registration == 'user');
2103 2103
 }
2104 2104
 
2105 2105
 /**
@@ -2110,12 +2110,12 @@  discard block
 block discarded – undo
2110 2110
  * @param string $text
2111 2111
  * @return string
2112 2112
  */
2113
-function welcome_user_msg_filter( $text ) {
2114
-	if ( !$text ) {
2115
-		remove_filter( 'site_option_welcome_user_email', 'welcome_user_msg_filter' );
2113
+function welcome_user_msg_filter($text) {
2114
+	if ( ! $text) {
2115
+		remove_filter('site_option_welcome_user_email', 'welcome_user_msg_filter');
2116 2116
 
2117 2117
 		/* translators: Do not translate USERNAME, PASSWORD, LOGINLINK, SITE_NAME: those are placeholders. */
2118
-		$text = __( 'Howdy USERNAME,
2118
+		$text = __('Howdy USERNAME,
2119 2119
 
2120 2120
 Your new account is set up.
2121 2121
 
@@ -2127,7 +2127,7 @@  discard block
 block discarded – undo
2127 2127
 Thanks!
2128 2128
 
2129 2129
 --The Team @ SITE_NAME' );
2130
-		update_site_option( 'welcome_user_email', $text );
2130
+		update_site_option('welcome_user_email', $text);
2131 2131
 	}
2132 2132
 	return $text;
2133 2133
 }
@@ -2142,10 +2142,10 @@  discard block
 block discarded – undo
2142 2142
  * @param bool $force
2143 2143
  * @return bool True if forced, false if not forced.
2144 2144
  */
2145
-function force_ssl_content( $force = '' ) {
2145
+function force_ssl_content($force = '') {
2146 2146
 	static $forced_content = false;
2147 2147
 
2148
-	if ( '' != $force ) {
2148
+	if ('' != $force) {
2149 2149
 		$old_forced = $forced_content;
2150 2150
 		$forced_content = $force;
2151 2151
 		return $old_forced;
@@ -2164,12 +2164,12 @@  discard block
 block discarded – undo
2164 2164
  * @param string $url URL
2165 2165
  * @return string URL with https as the scheme
2166 2166
  */
2167
-function filter_SSL( $url ) {
2168
-	if ( ! is_string( $url ) )
2169
-		return get_bloginfo( 'url' ); // Return home blog url with proper scheme
2167
+function filter_SSL($url) {
2168
+	if ( ! is_string($url))
2169
+		return get_bloginfo('url'); // Return home blog url with proper scheme
2170 2170
 
2171
-	if ( force_ssl_content() && is_ssl() )
2172
-		$url = set_url_scheme( $url, 'https' );
2171
+	if (force_ssl_content() && is_ssl())
2172
+		$url = set_url_scheme($url, 'https');
2173 2173
 
2174 2174
 	return $url;
2175 2175
 }
@@ -2180,10 +2180,10 @@  discard block
 block discarded – undo
2180 2180
  * @since 3.1.0
2181 2181
  */
2182 2182
 function wp_schedule_update_network_counts() {
2183
-	if ( !is_main_site() )
2183
+	if ( ! is_main_site())
2184 2184
 		return;
2185 2185
 
2186
-	if ( ! wp_next_scheduled('update_network_counts') && ! wp_installing() )
2186
+	if ( ! wp_next_scheduled('update_network_counts') && ! wp_installing())
2187 2187
 		wp_schedule_event(time(), 'twicedaily', 'update_network_counts');
2188 2188
 }
2189 2189
 
@@ -2206,7 +2206,7 @@  discard block
 block discarded – undo
2206 2206
  * @since 3.7.0
2207 2207
  */
2208 2208
 function wp_maybe_update_network_site_counts() {
2209
-	$is_small_network = ! wp_is_large_network( 'sites' );
2209
+	$is_small_network = ! wp_is_large_network('sites');
2210 2210
 
2211 2211
 	/**
2212 2212
 	 * Filter whether to update network site or user counts when a new site is created.
@@ -2218,7 +2218,7 @@  discard block
 block discarded – undo
2218 2218
 	 * @param bool   $small_network Whether the network is considered small.
2219 2219
 	 * @param string $context       Context. Either 'users' or 'sites'.
2220 2220
 	 */
2221
-	if ( ! apply_filters( 'enable_live_network_counts', $is_small_network, 'sites' ) )
2221
+	if ( ! apply_filters('enable_live_network_counts', $is_small_network, 'sites'))
2222 2222
 		return;
2223 2223
 
2224 2224
 	wp_update_network_site_counts();
@@ -2233,10 +2233,10 @@  discard block
 block discarded – undo
2233 2233
  * @since 3.7.0
2234 2234
  */
2235 2235
 function wp_maybe_update_network_user_counts() {
2236
-	$is_small_network = ! wp_is_large_network( 'users' );
2236
+	$is_small_network = ! wp_is_large_network('users');
2237 2237
 
2238 2238
 	/** This filter is documented in wp-includes/ms-functions.php */
2239
-	if ( ! apply_filters( 'enable_live_network_counts', $is_small_network, 'users' ) )
2239
+	if ( ! apply_filters('enable_live_network_counts', $is_small_network, 'users'))
2240 2240
 		return;
2241 2241
 
2242 2242
 	wp_update_network_user_counts();
@@ -2252,8 +2252,8 @@  discard block
 block discarded – undo
2252 2252
 function wp_update_network_site_counts() {
2253 2253
 	global $wpdb;
2254 2254
 
2255
-	$count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(blog_id) as c FROM $wpdb->blogs WHERE site_id = %d AND spam = '0' AND deleted = '0' and archived = '0'", $wpdb->siteid) );
2256
-	update_site_option( 'blog_count', $count );
2255
+	$count = $wpdb->get_var($wpdb->prepare("SELECT COUNT(blog_id) as c FROM $wpdb->blogs WHERE site_id = %d AND spam = '0' AND deleted = '0' and archived = '0'", $wpdb->siteid));
2256
+	update_site_option('blog_count', $count);
2257 2257
 }
2258 2258
 
2259 2259
 /**
@@ -2266,8 +2266,8 @@  discard block
 block discarded – undo
2266 2266
 function wp_update_network_user_counts() {
2267 2267
 	global $wpdb;
2268 2268
 
2269
-	$count = $wpdb->get_var( "SELECT COUNT(ID) as c FROM $wpdb->users WHERE spam = '0' AND deleted = '0'" );
2270
-	update_site_option( 'user_count', $count );
2269
+	$count = $wpdb->get_var("SELECT COUNT(ID) as c FROM $wpdb->users WHERE spam = '0' AND deleted = '0'");
2270
+	update_site_option('user_count', $count);
2271 2271
 }
2272 2272
 
2273 2273
 /**
@@ -2285,10 +2285,10 @@  discard block
 block discarded – undo
2285 2285
 	 *
2286 2286
 	 * @param int|bool $space_used The amount of used space, in megabytes. Default false.
2287 2287
 	 */
2288
-	$space_used = apply_filters( 'pre_get_space_used', false );
2289
-	if ( false === $space_used ) {
2288
+	$space_used = apply_filters('pre_get_space_used', false);
2289
+	if (false === $space_used) {
2290 2290
 		$upload_dir = wp_upload_dir();
2291
-		$space_used = get_dirsize( $upload_dir['basedir'] ) / MB_IN_BYTES;
2291
+		$space_used = get_dirsize($upload_dir['basedir']) / MB_IN_BYTES;
2292 2292
 	}
2293 2293
 
2294 2294
 	return $space_used;
@@ -2302,12 +2302,12 @@  discard block
 block discarded – undo
2302 2302
  * @return int Quota in megabytes
2303 2303
  */
2304 2304
 function get_space_allowed() {
2305
-	$space_allowed = get_option( 'blog_upload_space' );
2305
+	$space_allowed = get_option('blog_upload_space');
2306 2306
 
2307
-	if ( ! is_numeric( $space_allowed ) )
2308
-		$space_allowed = get_site_option( 'blog_upload_space' );
2307
+	if ( ! is_numeric($space_allowed))
2308
+		$space_allowed = get_site_option('blog_upload_space');
2309 2309
 
2310
-	if ( ! is_numeric( $space_allowed ) )
2310
+	if ( ! is_numeric($space_allowed))
2311 2311
 		$space_allowed = 100;
2312 2312
 
2313 2313
 	/**
@@ -2317,7 +2317,7 @@  discard block
 block discarded – undo
2317 2317
 	 *
2318 2318
 	 * @param int $space_allowed Upload quota in megabytes for the current blog.
2319 2319
 	 */
2320
-	return apply_filters( 'get_space_allowed', $space_allowed );
2320
+	return apply_filters('get_space_allowed', $space_allowed);
2321 2321
 }
2322 2322
 
2323 2323
 /**
@@ -2329,16 +2329,16 @@  discard block
 block discarded – undo
2329 2329
  */
2330 2330
 function get_upload_space_available() {
2331 2331
 	$allowed = get_space_allowed();
2332
-	if ( $allowed < 0 ) {
2332
+	if ($allowed < 0) {
2333 2333
 		$allowed = 0;
2334 2334
 	}
2335 2335
 	$space_allowed = $allowed * MB_IN_BYTES;
2336
-	if ( get_site_option( 'upload_space_check_disabled' ) )
2336
+	if (get_site_option('upload_space_check_disabled'))
2337 2337
 		return $space_allowed;
2338 2338
 
2339 2339
 	$space_used = get_space_used() * MB_IN_BYTES;
2340 2340
 
2341
-	if ( ( $space_allowed - $space_used ) <= 0 )
2341
+	if (($space_allowed - $space_used) <= 0)
2342 2342
 		return 0;
2343 2343
 
2344 2344
 	return $space_allowed - $space_used;
@@ -2351,7 +2351,7 @@  discard block
 block discarded – undo
2351 2351
  * @return bool True if space is available, false otherwise.
2352 2352
  */
2353 2353
 function is_upload_space_available() {
2354
-	if ( get_site_option( 'upload_space_check_disabled' ) )
2354
+	if (get_site_option('upload_space_check_disabled'))
2355 2355
 		return true;
2356 2356
 
2357 2357
 	return (bool) get_upload_space_available();
@@ -2365,12 +2365,12 @@  discard block
 block discarded – undo
2365 2365
  * @param  int $size Upload size limit in bytes.
2366 2366
  * @return int       Upload size limit in bytes.
2367 2367
  */
2368
-function upload_size_limit_filter( $size ) {
2369
-	$fileupload_maxk = KB_IN_BYTES * get_site_option( 'fileupload_maxk', 1500 );
2370
-	if ( get_site_option( 'upload_space_check_disabled' ) )
2371
-		return min( $size, $fileupload_maxk );
2368
+function upload_size_limit_filter($size) {
2369
+	$fileupload_maxk = KB_IN_BYTES * get_site_option('fileupload_maxk', 1500);
2370
+	if (get_site_option('upload_space_check_disabled'))
2371
+		return min($size, $fileupload_maxk);
2372 2372
 
2373
-	return min( $size, $fileupload_maxk, get_upload_space_available() );
2373
+	return min($size, $fileupload_maxk, get_upload_space_available());
2374 2374
 }
2375 2375
 
2376 2376
 /**
@@ -2383,8 +2383,8 @@  discard block
 block discarded – undo
2383 2383
  * @param string $using 'sites or 'users'. Default is 'sites'.
2384 2384
  * @return bool True if the network meets the criteria for large. False otherwise.
2385 2385
  */
2386
-function wp_is_large_network( $using = 'sites' ) {
2387
-	if ( 'users' == $using ) {
2386
+function wp_is_large_network($using = 'sites') {
2387
+	if ('users' == $using) {
2388 2388
 		$count = get_user_count();
2389 2389
 		/**
2390 2390
 		 * Filter whether the network is considered large.
@@ -2395,12 +2395,12 @@  discard block
 block discarded – undo
2395 2395
 		 * @param string $component        The component to count. Accepts 'users', or 'sites'.
2396 2396
 		 * @param int    $count            The count of items for the component.
2397 2397
 		 */
2398
-		return apply_filters( 'wp_is_large_network', $count > 10000, 'users', $count );
2398
+		return apply_filters('wp_is_large_network', $count > 10000, 'users', $count);
2399 2399
 	}
2400 2400
 
2401 2401
 	$count = get_blog_count();
2402 2402
 	/** This filter is documented in wp-includes/ms-functions.php */
2403
-	return apply_filters( 'wp_is_large_network', $count > 10000, 'sites', $count );
2403
+	return apply_filters('wp_is_large_network', $count > 10000, 'sites', $count);
2404 2404
 }
2405 2405
 
2406 2406
 
@@ -2429,10 +2429,10 @@  discard block
 block discarded – undo
2429 2429
  *               site domain and path, dates registered and modified, and the language ID. Also, boolean
2430 2430
  *               values for whether the site is public, archived, mature, spam, and/or deleted.
2431 2431
  */
2432
-function wp_get_sites( $args = array() ) {
2432
+function wp_get_sites($args = array()) {
2433 2433
 	global $wpdb;
2434 2434
 
2435
-	if ( wp_is_large_network() )
2435
+	if (wp_is_large_network())
2436 2436
 		return array();
2437 2437
 
2438 2438
 	$defaults = array(
@@ -2446,38 +2446,38 @@  discard block
 block discarded – undo
2446 2446
 		'offset'     => 0,
2447 2447
 	);
2448 2448
 
2449
-	$args = wp_parse_args( $args, $defaults );
2449
+	$args = wp_parse_args($args, $defaults);
2450 2450
 
2451 2451
 	$query = "SELECT * FROM $wpdb->blogs WHERE 1=1 ";
2452 2452
 
2453
-	if ( isset( $args['network_id'] ) && ( is_array( $args['network_id'] ) || is_numeric( $args['network_id'] ) ) ) {
2454
-		$network_ids = implode( ',', wp_parse_id_list( $args['network_id'] ) );
2453
+	if (isset($args['network_id']) && (is_array($args['network_id']) || is_numeric($args['network_id']))) {
2454
+		$network_ids = implode(',', wp_parse_id_list($args['network_id']));
2455 2455
 		$query .= "AND site_id IN ($network_ids) ";
2456 2456
 	}
2457 2457
 
2458
-	if ( isset( $args['public'] ) )
2459
-		$query .= $wpdb->prepare( "AND public = %d ", $args['public'] );
2458
+	if (isset($args['public']))
2459
+		$query .= $wpdb->prepare("AND public = %d ", $args['public']);
2460 2460
 
2461
-	if ( isset( $args['archived'] ) )
2462
-		$query .= $wpdb->prepare( "AND archived = %d ", $args['archived'] );
2461
+	if (isset($args['archived']))
2462
+		$query .= $wpdb->prepare("AND archived = %d ", $args['archived']);
2463 2463
 
2464
-	if ( isset( $args['mature'] ) )
2465
-		$query .= $wpdb->prepare( "AND mature = %d ", $args['mature'] );
2464
+	if (isset($args['mature']))
2465
+		$query .= $wpdb->prepare("AND mature = %d ", $args['mature']);
2466 2466
 
2467
-	if ( isset( $args['spam'] ) )
2468
-		$query .= $wpdb->prepare( "AND spam = %d ", $args['spam'] );
2467
+	if (isset($args['spam']))
2468
+		$query .= $wpdb->prepare("AND spam = %d ", $args['spam']);
2469 2469
 
2470
-	if ( isset( $args['deleted'] ) )
2471
-		$query .= $wpdb->prepare( "AND deleted = %d ", $args['deleted'] );
2470
+	if (isset($args['deleted']))
2471
+		$query .= $wpdb->prepare("AND deleted = %d ", $args['deleted']);
2472 2472
 
2473
-	if ( isset( $args['limit'] ) && $args['limit'] ) {
2474
-		if ( isset( $args['offset'] ) && $args['offset'] )
2475
-			$query .= $wpdb->prepare( "LIMIT %d , %d ", $args['offset'], $args['limit'] );
2473
+	if (isset($args['limit']) && $args['limit']) {
2474
+		if (isset($args['offset']) && $args['offset'])
2475
+			$query .= $wpdb->prepare("LIMIT %d , %d ", $args['offset'], $args['limit']);
2476 2476
 		else
2477
-			$query .= $wpdb->prepare( "LIMIT %d ", $args['limit'] );
2477
+			$query .= $wpdb->prepare("LIMIT %d ", $args['limit']);
2478 2478
 	}
2479 2479
 
2480
-	$site_results = $wpdb->get_results( $query, ARRAY_A );
2480
+	$site_results = $wpdb->get_results($query, ARRAY_A);
2481 2481
 
2482 2482
 	return $site_results;
2483 2483
 }
@@ -2504,5 +2504,5 @@  discard block
 block discarded – undo
2504 2504
 	 *
2505 2505
 	 * @param array $subdirectory_reserved_names Array of reserved names.
2506 2506
 	 */
2507
-	return apply_filters( 'subdirectory_reserved_names', $names );
2507
+	return apply_filters('subdirectory_reserved_names', $names);
2508 2508
 }
Please login to merge, or discard this patch.
Braces   +303 added lines, -207 removed lines patch added patch discarded remove patch
@@ -42,11 +42,13 @@  discard block
 block discarded – undo
42 42
 function get_active_blog_for_user( $user_id ) {
43 43
 	global $wpdb;
44 44
 	$blogs = get_blogs_of_user( $user_id );
45
-	if ( empty( $blogs ) )
46
-		return;
45
+	if ( empty( $blogs ) ) {
46
+			return;
47
+	}
47 48
 
48
-	if ( !is_multisite() )
49
-		return $blogs[$wpdb->blogid];
49
+	if ( !is_multisite() ) {
50
+			return $blogs[$wpdb->blogid];
51
+	}
50 52
 
51 53
 	$primary_blog = get_user_meta( $user_id, 'primary_blog', true );
52 54
 	$first_blog = current($blogs);
@@ -69,15 +71,18 @@  discard block
 block discarded – undo
69 71
 		$ret = false;
70 72
 		if ( is_array( $blogs ) && count( $blogs ) > 0 ) {
71 73
 			foreach ( (array) $blogs as $blog_id => $blog ) {
72
-				if ( $blog->site_id != $wpdb->siteid )
73
-					continue;
74
+				if ( $blog->site_id != $wpdb->siteid ) {
75
+									continue;
76
+				}
74 77
 				$details = get_blog_details( $blog_id );
75 78
 				if ( is_object( $details ) && $details->archived == 0 && $details->spam == 0 && $details->deleted == 0 ) {
76 79
 					$ret = $blog;
77
-					if ( get_user_meta( $user_id , 'primary_blog', true ) != $blog_id )
78
-						update_user_meta( $user_id, 'primary_blog', $blog_id );
79
-					if ( !get_user_meta($user_id , 'source_domain', true) )
80
-						update_user_meta( $user_id, 'source_domain', $blog->domain );
80
+					if ( get_user_meta( $user_id , 'primary_blog', true ) != $blog_id ) {
81
+											update_user_meta( $user_id, 'primary_blog', $blog_id );
82
+					}
83
+					if ( !get_user_meta($user_id , 'source_domain', true) ) {
84
+											update_user_meta( $user_id, 'source_domain', $blog->domain );
85
+					}
81 86
 					break;
82 87
 				}
83 88
 			}
@@ -114,8 +119,9 @@  discard block
 block discarded – undo
114 119
  * @return int
115 120
  */
116 121
 function get_blog_count( $network_id = 0 ) {
117
-	if ( func_num_args() )
118
-		_deprecated_argument( __FUNCTION__, '3.1' );
122
+	if ( func_num_args() ) {
123
+			_deprecated_argument( __FUNCTION__, '3.1' );
124
+	}
119 125
 
120 126
 	return get_site_option( 'blog_count' );
121 127
 }
@@ -224,8 +230,9 @@  discard block
 block discarded – undo
224 230
 		$new_domain = '';
225 231
 		$blogs = get_blogs_of_user($user_id);
226 232
 		foreach ( (array) $blogs as $blog ) {
227
-			if ( $blog->userblog_id == $blog_id )
228
-				continue;
233
+			if ( $blog->userblog_id == $blog_id ) {
234
+							continue;
235
+			}
229 236
 			$new_id = $blog->userblog_id;
230 237
 			$new_domain = $blog->domain;
231 238
 			break;
@@ -311,10 +318,12 @@  discard block
 block discarded – undo
311 318
 	$path = strtolower( $path );
312 319
 	$id = wp_cache_get( md5( $domain . $path ), 'blog-id-cache' );
313 320
 
314
-	if ( $id == -1 ) // blog does not exist
321
+	if ( $id == -1 ) {
322
+		// blog does not exist
315 323
 		return 0;
316
-	elseif ( $id )
317
-		return (int) $id;
324
+	} elseif ( $id ) {
325
+			return (int) $id;
326
+	}
318 327
 
319 328
 	$id = $wpdb->get_var( $wpdb->prepare( "SELECT blog_id FROM $wpdb->blogs WHERE domain = %s and path = %s /* get_blog_id_from_url */", $domain, $path ) );
320 329
 
@@ -345,8 +354,9 @@  discard block
 block discarded – undo
345 354
  */
346 355
 function is_email_address_unsafe( $user_email ) {
347 356
 	$banned_names = get_site_option( 'banned_email_domains' );
348
-	if ( $banned_names && ! is_array( $banned_names ) )
349
-		$banned_names = explode( "\n", $banned_names );
357
+	if ( $banned_names && ! is_array( $banned_names ) ) {
358
+			$banned_names = explode( "\n", $banned_names );
359
+	}
350 360
 
351 361
 	$is_email_address_unsafe = false;
352 362
 
@@ -357,8 +367,9 @@  discard block
 block discarded – undo
357 367
 		list( $email_local_part, $email_domain ) = explode( '@', $normalized_email );
358 368
 
359 369
 		foreach ( $banned_names as $banned_domain ) {
360
-			if ( ! $banned_domain )
361
-				continue;
370
+			if ( ! $banned_domain ) {
371
+							continue;
372
+			}
362 373
 
363 374
 			if ( $email_domain == $banned_domain ) {
364 375
 				$is_email_address_unsafe = true;
@@ -419,8 +430,9 @@  discard block
 block discarded – undo
419 430
 
420 431
 	$user_email = sanitize_email( $user_email );
421 432
 
422
-	if ( empty( $user_name ) )
423
-	   	$errors->add('user_name', __( 'Please enter a username.' ) );
433
+	if ( empty( $user_name ) ) {
434
+		   	$errors->add('user_name', __( 'Please enter a username.' ) );
435
+	}
424 436
 
425 437
 	$illegal_names = get_site_option( 'illegal_names' );
426 438
 	if ( ! is_array( $illegal_names ) ) {
@@ -438,22 +450,26 @@  discard block
 block discarded – undo
438 450
 		$errors->add( 'user_name',  __( 'Sorry, that username is not allowed.' ) );
439 451
 	}
440 452
 
441
-	if ( is_email_address_unsafe( $user_email ) )
442
-		$errors->add('user_email',  __('You cannot use that email address to signup. We are having problems with them blocking some of our email. Please use another email provider.'));
453
+	if ( is_email_address_unsafe( $user_email ) ) {
454
+			$errors->add('user_email',  __('You cannot use that email address to signup. We are having problems with them blocking some of our email. Please use another email provider.'));
455
+	}
443 456
 
444
-	if ( strlen( $user_name ) < 4 )
445
-		$errors->add('user_name',  __( 'Username must be at least 4 characters.' ) );
457
+	if ( strlen( $user_name ) < 4 ) {
458
+			$errors->add('user_name',  __( 'Username must be at least 4 characters.' ) );
459
+	}
446 460
 
447 461
 	if ( strlen( $user_name ) > 60 ) {
448 462
 		$errors->add( 'user_name', __( 'Username may not be longer than 60 characters.' ) );
449 463
 	}
450 464
 
451 465
 	// all numeric?
452
-	if ( preg_match( '/^[0-9]*$/', $user_name ) )
453
-		$errors->add('user_name', __('Sorry, usernames must have letters too!'));
466
+	if ( preg_match( '/^[0-9]*$/', $user_name ) ) {
467
+			$errors->add('user_name', __('Sorry, usernames must have letters too!'));
468
+	}
454 469
 
455
-	if ( !is_email( $user_email ) )
456
-		$errors->add('user_email', __( 'Please enter a valid email address.' ) );
470
+	if ( !is_email( $user_email ) ) {
471
+			$errors->add('user_email', __( 'Please enter a valid email address.' ) );
472
+	}
457 473
 
458 474
 	$limited_email_domains = get_site_option( 'limited_email_domains' );
459 475
 	if ( is_array( $limited_email_domains ) && ! empty( $limited_email_domains ) ) {
@@ -464,12 +480,14 @@  discard block
 block discarded – undo
464 480
 	}
465 481
 
466 482
 	// Check if the username has been used already.
467
-	if ( username_exists($user_name) )
468
-		$errors->add( 'user_name', __( 'Sorry, that username already exists!' ) );
483
+	if ( username_exists($user_name) ) {
484
+			$errors->add( 'user_name', __( 'Sorry, that username already exists!' ) );
485
+	}
469 486
 
470 487
 	// Check if the email address has been used already.
471
-	if ( email_exists($user_email) )
472
-		$errors->add( 'user_email', __( 'Sorry, that email address is already used!' ) );
488
+	if ( email_exists($user_email) ) {
489
+			$errors->add( 'user_email', __( 'Sorry, that email address is already used!' ) );
490
+	}
473 491
 
474 492
 	// Has someone already signed up for this username?
475 493
 	$signup = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->signups WHERE user_login = %s", $user_name) );
@@ -478,20 +496,22 @@  discard block
 block discarded – undo
478 496
 		$now = current_time( 'timestamp', true );
479 497
 		$diff = $now - $registered_at;
480 498
 		// If registered more than two days ago, cancel registration and let this signup go through.
481
-		if ( $diff > 2 * DAY_IN_SECONDS )
482
-			$wpdb->delete( $wpdb->signups, array( 'user_login' => $user_name ) );
483
-		else
484
-			$errors->add('user_name', __('That username is currently reserved but may be available in a couple of days.'));
499
+		if ( $diff > 2 * DAY_IN_SECONDS ) {
500
+					$wpdb->delete( $wpdb->signups, array( 'user_login' => $user_name ) );
501
+		} else {
502
+					$errors->add('user_name', __('That username is currently reserved but may be available in a couple of days.'));
503
+		}
485 504
 	}
486 505
 
487 506
 	$signup = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->signups WHERE user_email = %s", $user_email) );
488 507
 	if ( $signup != null ) {
489 508
 		$diff = current_time( 'timestamp', true ) - mysql2date('U', $signup->registered);
490 509
 		// If registered more than two days ago, cancel registration and let this signup go through.
491
-		if ( $diff > 2 * DAY_IN_SECONDS )
492
-			$wpdb->delete( $wpdb->signups, array( 'user_email' => $user_email ) );
493
-		else
494
-			$errors->add('user_email', __('That email address has already been used. Please check your inbox for an activation email. It will become available in a couple of days if you do nothing.'));
510
+		if ( $diff > 2 * DAY_IN_SECONDS ) {
511
+					$wpdb->delete( $wpdb->signups, array( 'user_email' => $user_email ) );
512
+		} else {
513
+					$errors->add('user_email', __('That email address has already been used. Please check your inbox for an activation email. It will become available in a couple of days if you do nothing.'));
514
+		}
495 515
 	}
496 516
 
497 517
 	$result = array('user_name' => $user_name, 'orig_username' => $orig_username, 'user_email' => $user_email, 'errors' => $errors);
@@ -563,26 +583,31 @@  discard block
 block discarded – undo
563 583
 		$illegal_names = array_merge( $illegal_names, get_subdirectory_reserved_names() );
564 584
 	}
565 585
 
566
-	if ( empty( $blogname ) )
567
-		$errors->add('blogname', __( 'Please enter a site name.' ) );
586
+	if ( empty( $blogname ) ) {
587
+			$errors->add('blogname', __( 'Please enter a site name.' ) );
588
+	}
568 589
 
569 590
 	if ( preg_match( '/[^a-z0-9]+/', $blogname ) ) {
570 591
 		$errors->add( 'blogname', __( 'Site names can only contain lowercase letters (a-z) and numbers.' ) );
571 592
 	}
572 593
 
573
-	if ( in_array( $blogname, $illegal_names ) )
574
-		$errors->add('blogname',  __( 'That name is not allowed.' ) );
594
+	if ( in_array( $blogname, $illegal_names ) ) {
595
+			$errors->add('blogname',  __( 'That name is not allowed.' ) );
596
+	}
575 597
 
576
-	if ( strlen( $blogname ) < 4 && !is_super_admin() )
577
-		$errors->add('blogname',  __( 'Site name must be at least 4 characters.' ) );
598
+	if ( strlen( $blogname ) < 4 && !is_super_admin() ) {
599
+			$errors->add('blogname',  __( 'Site name must be at least 4 characters.' ) );
600
+	}
578 601
 
579 602
 	// do not allow users to create a blog that conflicts with a page on the main blog.
580
-	if ( !is_subdomain_install() && $wpdb->get_var( $wpdb->prepare( "SELECT post_name FROM " . $wpdb->get_blog_prefix( $current_site->blog_id ) . "posts WHERE post_type = 'page' AND post_name = %s", $blogname ) ) )
581
-		$errors->add( 'blogname', __( 'Sorry, you may not use that site name.' ) );
603
+	if ( !is_subdomain_install() && $wpdb->get_var( $wpdb->prepare( "SELECT post_name FROM " . $wpdb->get_blog_prefix( $current_site->blog_id ) . "posts WHERE post_type = 'page' AND post_name = %s", $blogname ) ) ) {
604
+			$errors->add( 'blogname', __( 'Sorry, you may not use that site name.' ) );
605
+	}
582 606
 
583 607
 	// all numeric?
584
-	if ( preg_match( '/^[0-9]*$/', $blogname ) )
585
-		$errors->add('blogname', __('Sorry, site names must have letters too!'));
608
+	if ( preg_match( '/^[0-9]*$/', $blogname ) ) {
609
+			$errors->add('blogname', __('Sorry, site names must have letters too!'));
610
+	}
586 611
 
587 612
 	/**
588 613
 	 * Filter the new site name during registration.
@@ -598,8 +623,9 @@  discard block
 block discarded – undo
598 623
 
599 624
 	$blog_title = wp_unslash(  $blog_title );
600 625
 
601
-	if ( empty( $blog_title ) )
602
-		$errors->add('blog_title', __( 'Please enter a site title.' ) );
626
+	if ( empty( $blog_title ) ) {
627
+			$errors->add('blog_title', __( 'Please enter a site title.' ) );
628
+	}
603 629
 
604 630
 	// Check if the domain/path has been used already.
605 631
 	if ( is_subdomain_install() ) {
@@ -609,12 +635,14 @@  discard block
 block discarded – undo
609 635
 		$mydomain = "$domain";
610 636
 		$path = $base.$blogname.'/';
611 637
 	}
612
-	if ( domain_exists($mydomain, $path, $current_site->id) )
613
-		$errors->add( 'blogname', __( 'Sorry, that site already exists!' ) );
638
+	if ( domain_exists($mydomain, $path, $current_site->id) ) {
639
+			$errors->add( 'blogname', __( 'Sorry, that site already exists!' ) );
640
+	}
614 641
 
615 642
 	if ( username_exists( $blogname ) ) {
616
-		if ( ! is_object( $user ) || ( is_object($user) && ( $user->user_login != $blogname ) ) )
617
-			$errors->add( 'blogname', __( 'Sorry, that site is reserved!' ) );
643
+		if ( ! is_object( $user ) || ( is_object($user) && ( $user->user_login != $blogname ) ) ) {
644
+					$errors->add( 'blogname', __( 'Sorry, that site is reserved!' ) );
645
+		}
618 646
 	}
619 647
 
620 648
 	// Has someone already signed up for this domain?
@@ -622,10 +650,11 @@  discard block
 block discarded – undo
622 650
 	if ( ! empty($signup) ) {
623 651
 		$diff = current_time( 'timestamp', true ) - mysql2date('U', $signup->registered);
624 652
 		// If registered more than two days ago, cancel registration and let this signup go through.
625
-		if ( $diff > 2 * DAY_IN_SECONDS )
626
-			$wpdb->delete( $wpdb->signups, array( 'domain' => $mydomain , 'path' => $path ) );
627
-		else
628
-			$errors->add('blogname', __('That site is currently reserved but may be available in a couple days.'));
653
+		if ( $diff > 2 * DAY_IN_SECONDS ) {
654
+					$wpdb->delete( $wpdb->signups, array( 'domain' => $mydomain , 'path' => $path ) );
655
+		} else {
656
+					$errors->add('blogname', __('That site is currently reserved but may be available in a couple days.'));
657
+		}
629 658
 	}
630 659
 
631 660
 	$result = array('domain' => $mydomain, 'path' => $path, 'blogname' => $blogname, 'blog_title' => $blog_title, 'user' => $user, 'errors' => $errors);
@@ -786,15 +815,18 @@  discard block
 block discarded – undo
786 815
 	}
787 816
 
788 817
 	// Send email with activation link.
789
-	if ( !is_subdomain_install() || get_current_site()->id != 1 )
790
-		$activate_url = network_site_url("wp-activate.php?key=$key");
791
-	else
792
-		$activate_url = "http://{$domain}{$path}wp-activate.php?key=$key"; // @todo use *_url() API
818
+	if ( !is_subdomain_install() || get_current_site()->id != 1 ) {
819
+			$activate_url = network_site_url("wp-activate.php?key=$key");
820
+	} else {
821
+			$activate_url = "http://{$domain}{$path}wp-activate.php?key=$key";
822
+	}
823
+	// @todo use *_url() API
793 824
 
794 825
 	$activate_url = esc_url($activate_url);
795 826
 	$admin_email = get_site_option( 'admin_email' );
796
-	if ( $admin_email == '' )
797
-		$admin_email = 'support@' . $_SERVER['SERVER_NAME'];
827
+	if ( $admin_email == '' ) {
828
+			$admin_email = 'support@' . $_SERVER['SERVER_NAME'];
829
+	}
798 830
 	$from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
799 831
 	$message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
800 832
 	$message = sprintf(
@@ -881,13 +913,15 @@  discard block
 block discarded – undo
881 913
 	 * @param string $key        Activation key created in wpmu_signup_user().
882 914
 	 * @param array  $meta       Signup meta data.
883 915
 	 */
884
-	if ( ! apply_filters( 'wpmu_signup_user_notification', $user, $user_email, $key, $meta ) )
885
-		return false;
916
+	if ( ! apply_filters( 'wpmu_signup_user_notification', $user, $user_email, $key, $meta ) ) {
917
+			return false;
918
+	}
886 919
 
887 920
 	// Send email with activation link.
888 921
 	$admin_email = get_site_option( 'admin_email' );
889
-	if ( $admin_email == '' )
890
-		$admin_email = 'support@' . $_SERVER['SERVER_NAME'];
922
+	if ( $admin_email == '' ) {
923
+			$admin_email = 'support@' . $_SERVER['SERVER_NAME'];
924
+	}
891 925
 	$from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
892 926
 	$message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
893 927
 	$message = sprintf(
@@ -954,14 +988,16 @@  discard block
 block discarded – undo
954 988
 
955 989
 	$signup = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->signups WHERE activation_key = %s", $key) );
956 990
 
957
-	if ( empty( $signup ) )
958
-		return new WP_Error( 'invalid_key', __( 'Invalid activation key.' ) );
991
+	if ( empty( $signup ) ) {
992
+			return new WP_Error( 'invalid_key', __( 'Invalid activation key.' ) );
993
+	}
959 994
 
960 995
 	if ( $signup->active ) {
961
-		if ( empty( $signup->domain ) )
962
-			return new WP_Error( 'already_active', __( 'The user is already active.' ), $signup );
963
-		else
964
-			return new WP_Error( 'already_active', __( 'The site is already active.' ), $signup );
996
+		if ( empty( $signup->domain ) ) {
997
+					return new WP_Error( 'already_active', __( 'The user is already active.' ), $signup );
998
+		} else {
999
+					return new WP_Error( 'already_active', __( 'The site is already active.' ), $signup );
1000
+		}
965 1001
 	}
966 1002
 
967 1003
 	$meta = maybe_unserialize($signup->meta);
@@ -969,21 +1005,24 @@  discard block
 block discarded – undo
969 1005
 
970 1006
 	$user_id = username_exists($signup->user_login);
971 1007
 
972
-	if ( ! $user_id )
973
-		$user_id = wpmu_create_user($signup->user_login, $password, $signup->user_email);
974
-	else
975
-		$user_already_exists = true;
1008
+	if ( ! $user_id ) {
1009
+			$user_id = wpmu_create_user($signup->user_login, $password, $signup->user_email);
1010
+	} else {
1011
+			$user_already_exists = true;
1012
+	}
976 1013
 
977
-	if ( ! $user_id )
978
-		return new WP_Error('create_user', __('Could not create user'), $signup);
1014
+	if ( ! $user_id ) {
1015
+			return new WP_Error('create_user', __('Could not create user'), $signup);
1016
+	}
979 1017
 
980 1018
 	$now = current_time('mysql', true);
981 1019
 
982 1020
 	if ( empty($signup->domain) ) {
983 1021
 		$wpdb->update( $wpdb->signups, array('active' => 1, 'activated' => $now), array('activation_key' => $key) );
984 1022
 
985
-		if ( isset( $user_already_exists ) )
986
-			return new WP_Error( 'user_already_exists', __( 'That username is already activated.' ), $signup);
1023
+		if ( isset( $user_already_exists ) ) {
1024
+					return new WP_Error( 'user_already_exists', __( 'That username is already activated.' ), $signup);
1025
+		}
987 1026
 
988 1027
 		/**
989 1028
 		 * Fires immediately after a new user is activated.
@@ -1047,8 +1086,9 @@  discard block
 block discarded – undo
1047 1086
 	$user_name = preg_replace( '/\s+/', '', sanitize_user( $user_name, true ) );
1048 1087
 
1049 1088
 	$user_id = wp_create_user( $user_name, $password, $email );
1050
-	if ( is_wp_error( $user_id ) )
1051
-		return false;
1089
+	if ( is_wp_error( $user_id ) ) {
1090
+			return false;
1091
+	}
1052 1092
 
1053 1093
 	// Newly created users have no roles or caps until they are added to a blog.
1054 1094
 	delete_user_option( $user_id, 'capabilities' );
@@ -1094,25 +1134,29 @@  discard block
 block discarded – undo
1094 1134
 
1095 1135
 	$domain = preg_replace( '/\s+/', '', sanitize_user( $domain, true ) );
1096 1136
 
1097
-	if ( is_subdomain_install() )
1098
-		$domain = str_replace( '@', '', $domain );
1137
+	if ( is_subdomain_install() ) {
1138
+			$domain = str_replace( '@', '', $domain );
1139
+	}
1099 1140
 
1100 1141
 	$title = strip_tags( $title );
1101 1142
 	$user_id = (int) $user_id;
1102 1143
 
1103
-	if ( empty($path) )
1104
-		$path = '/';
1144
+	if ( empty($path) ) {
1145
+			$path = '/';
1146
+	}
1105 1147
 
1106 1148
 	// Check if the domain has been used already. We should return an error message.
1107
-	if ( domain_exists($domain, $path, $site_id) )
1108
-		return new WP_Error( 'blog_taken', __( 'Sorry, that site already exists!' ) );
1149
+	if ( domain_exists($domain, $path, $site_id) ) {
1150
+			return new WP_Error( 'blog_taken', __( 'Sorry, that site already exists!' ) );
1151
+	}
1109 1152
 
1110 1153
 	if ( ! wp_installing() ) {
1111 1154
 		wp_installing( true );
1112 1155
 	}
1113 1156
 
1114
-	if ( ! $blog_id = insert_blog($domain, $path, $site_id) )
1115
-		return new WP_Error('insert_blog', __('Could not create site.'));
1157
+	if ( ! $blog_id = insert_blog($domain, $path, $site_id) ) {
1158
+			return new WP_Error('insert_blog', __('Could not create site.'));
1159
+	}
1116 1160
 
1117 1161
 	switch_to_blog($blog_id);
1118 1162
 	install_blog($blog_id, $title);
@@ -1121,17 +1165,19 @@  discard block
 block discarded – undo
1121 1165
 	add_user_to_blog($blog_id, $user_id, 'administrator');
1122 1166
 
1123 1167
 	foreach ( $meta as $key => $value ) {
1124
-		if ( in_array( $key, array( 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id' ) ) )
1125
-			update_blog_status( $blog_id, $key, $value );
1126
-		else
1127
-			update_option( $key, $value );
1168
+		if ( in_array( $key, array( 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id' ) ) ) {
1169
+					update_blog_status( $blog_id, $key, $value );
1170
+		} else {
1171
+					update_option( $key, $value );
1172
+		}
1128 1173
 	}
1129 1174
 
1130 1175
 	add_option( 'WPLANG', get_site_option( 'WPLANG' ) );
1131 1176
 	update_option( 'blog_public', (int) $meta['public'] );
1132 1177
 
1133
-	if ( ! is_super_admin( $user_id ) && ! get_user_meta( $user_id, 'primary_blog', true ) )
1134
-		update_user_meta( $user_id, 'primary_blog', $blog_id );
1178
+	if ( ! is_super_admin( $user_id ) && ! get_user_meta( $user_id, 'primary_blog', true ) ) {
1179
+			update_user_meta( $user_id, 'primary_blog', $blog_id );
1180
+	}
1135 1181
 
1136 1182
 	restore_current_blog();
1137 1183
 	/**
@@ -1164,12 +1210,14 @@  discard block
 block discarded – undo
1164 1210
  * @return bool
1165 1211
  */
1166 1212
 function newblog_notify_siteadmin( $blog_id, $deprecated = '' ) {
1167
-	if ( get_site_option( 'registrationnotification' ) != 'yes' )
1168
-		return false;
1213
+	if ( get_site_option( 'registrationnotification' ) != 'yes' ) {
1214
+			return false;
1215
+	}
1169 1216
 
1170 1217
 	$email = get_site_option( 'admin_email' );
1171
-	if ( is_email($email) == false )
1172
-		return false;
1218
+	if ( is_email($email) == false ) {
1219
+			return false;
1220
+	}
1173 1221
 
1174 1222
 	$options_site_url = esc_url(network_admin_url('settings.php'));
1175 1223
 
@@ -1209,13 +1257,15 @@  discard block
 block discarded – undo
1209 1257
  * @return bool
1210 1258
  */
1211 1259
 function newuser_notify_siteadmin( $user_id ) {
1212
-	if ( get_site_option( 'registrationnotification' ) != 'yes' )
1213
-		return false;
1260
+	if ( get_site_option( 'registrationnotification' ) != 'yes' ) {
1261
+			return false;
1262
+	}
1214 1263
 
1215 1264
 	$email = get_site_option( 'admin_email' );
1216 1265
 
1217
-	if ( is_email($email) == false )
1218
-		return false;
1266
+	if ( is_email($email) == false ) {
1267
+			return false;
1268
+	}
1219 1269
 
1220 1270
 	$user = get_userdata( $user_id );
1221 1271
 
@@ -1294,8 +1344,9 @@  discard block
 block discarded – undo
1294 1344
 	$site_id = (int) $site_id;
1295 1345
 
1296 1346
 	$result = $wpdb->insert( $wpdb->blogs, array('site_id' => $site_id, 'domain' => $domain, 'path' => $path, 'registered' => current_time('mysql')) );
1297
-	if ( ! $result )
1298
-		return false;
1347
+	if ( ! $result ) {
1348
+			return false;
1349
+	}
1299 1350
 
1300 1351
 	$blog_id = $wpdb->insert_id;
1301 1352
 	refresh_blog_details( $blog_id );
@@ -1329,8 +1380,9 @@  discard block
 block discarded – undo
1329 1380
 	require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
1330 1381
 
1331 1382
 	$suppress = $wpdb->suppress_errors();
1332
-	if ( $wpdb->get_results( "DESCRIBE {$wpdb->posts}" ) )
1333
-		die( '<h1>' . __( 'Already Installed' ) . '</h1><p>' . __( 'You appear to have already installed WordPress. To reinstall please clear your old database tables first.' ) . '</p></body></html>' );
1383
+	if ( $wpdb->get_results( "DESCRIBE {$wpdb->posts}" ) ) {
1384
+			die( '<h1>' . __( 'Already Installed' ) . '</h1><p>' . __( 'You appear to have already installed WordPress. To reinstall please clear your old database tables first.' ) . '</p></body></html>' );
1385
+	}
1334 1386
 	$wpdb->suppress_errors( $suppress );
1335 1387
 
1336 1388
 	$url = get_blogaddress_by_id( $blog_id );
@@ -1359,10 +1411,11 @@  discard block
 block discarded – undo
1359 1411
 	update_option( 'siteurl', $siteurl );
1360 1412
 	update_option( 'home', $home );
1361 1413
 
1362
-	if ( get_site_option( 'ms_files_rewriting' ) )
1363
-		update_option( 'upload_path', UPLOADBLOGSDIR . "/$blog_id/files" );
1364
-	else
1365
-		update_option( 'upload_path', get_blog_option( get_current_site()->blog_id, 'upload_path' ) );
1414
+	if ( get_site_option( 'ms_files_rewriting' ) ) {
1415
+			update_option( 'upload_path', UPLOADBLOGSDIR . "/$blog_id/files" );
1416
+	} else {
1417
+			update_option( 'upload_path', get_blog_option( get_current_site()->blog_id, 'upload_path' ) );
1418
+	}
1366 1419
 
1367 1420
 	update_option( 'blogname', wp_unslash( $blog_title ) );
1368 1421
 	update_option( 'admin_email', '' );
@@ -1432,8 +1485,9 @@  discard block
 block discarded – undo
1432 1485
 	 * @param string   $title    Site title.
1433 1486
 	 * @param array    $meta     Signup meta data.
1434 1487
 	 */
1435
-	if ( ! apply_filters( 'wpmu_welcome_notification', $blog_id, $user_id, $password, $title, $meta ) )
1436
-		return false;
1488
+	if ( ! apply_filters( 'wpmu_welcome_notification', $blog_id, $user_id, $password, $title, $meta ) ) {
1489
+			return false;
1490
+	}
1437 1491
 
1438 1492
 	$welcome_email = get_site_option( 'welcome_email' );
1439 1493
 	if ( $welcome_email == false ) {
@@ -1480,15 +1534,17 @@  discard block
 block discarded – undo
1480 1534
 	$welcome_email = apply_filters( 'update_welcome_email', $welcome_email, $blog_id, $user_id, $password, $title, $meta );
1481 1535
 	$admin_email = get_site_option( 'admin_email' );
1482 1536
 
1483
-	if ( $admin_email == '' )
1484
-		$admin_email = 'support@' . $_SERVER['SERVER_NAME'];
1537
+	if ( $admin_email == '' ) {
1538
+			$admin_email = 'support@' . $_SERVER['SERVER_NAME'];
1539
+	}
1485 1540
 
1486 1541
 	$from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
1487 1542
 	$message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
1488 1543
 	$message = $welcome_email;
1489 1544
 
1490
-	if ( empty( $current_site->site_name ) )
1491
-		$current_site->site_name = 'WordPress';
1545
+	if ( empty( $current_site->site_name ) ) {
1546
+			$current_site->site_name = 'WordPress';
1547
+	}
1492 1548
 
1493 1549
 	/**
1494 1550
 	 * Filter the subject of the welcome email after site activation.
@@ -1531,8 +1587,9 @@  discard block
 block discarded – undo
1531 1587
 	 * @param string $password User password.
1532 1588
 	 * @param array  $meta     Signup meta data.
1533 1589
 	 */
1534
-	if ( ! apply_filters( 'wpmu_welcome_user_notification', $user_id, $password, $meta ) )
1535
-		return false;
1590
+	if ( ! apply_filters( 'wpmu_welcome_user_notification', $user_id, $password, $meta ) ) {
1591
+			return false;
1592
+	}
1536 1593
 
1537 1594
 	$welcome_email = get_site_option( 'welcome_user_email' );
1538 1595
 
@@ -1558,15 +1615,17 @@  discard block
 block discarded – undo
1558 1615
 
1559 1616
 	$admin_email = get_site_option( 'admin_email' );
1560 1617
 
1561
-	if ( $admin_email == '' )
1562
-		$admin_email = 'support@' . $_SERVER['SERVER_NAME'];
1618
+	if ( $admin_email == '' ) {
1619
+			$admin_email = 'support@' . $_SERVER['SERVER_NAME'];
1620
+	}
1563 1621
 
1564 1622
 	$from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
1565 1623
 	$message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
1566 1624
 	$message = $welcome_email;
1567 1625
 
1568
-	if ( empty( $current_site->site_name ) )
1569
-		$current_site->site_name = 'WordPress';
1626
+	if ( empty( $current_site->site_name ) ) {
1627
+			$current_site->site_name = 'WordPress';
1628
+	}
1570 1629
 
1571 1630
 	/**
1572 1631
 	 * Filter the subject of the welcome email after user activation.
@@ -1660,11 +1719,13 @@  discard block
 block discarded – undo
1660 1719
  */
1661 1720
 function get_dirsize( $directory ) {
1662 1721
 	$dirsize = get_transient( 'dirsize_cache' );
1663
-	if ( is_array( $dirsize ) && isset( $dirsize[ $directory ][ 'size' ] ) )
1664
-		return $dirsize[ $directory ][ 'size' ];
1722
+	if ( is_array( $dirsize ) && isset( $dirsize[ $directory ][ 'size' ] ) ) {
1723
+			return $dirsize[ $directory ][ 'size' ];
1724
+	}
1665 1725
 
1666
-	if ( ! is_array( $dirsize ) )
1667
-		$dirsize = array();
1726
+	if ( ! is_array( $dirsize ) ) {
1727
+			$dirsize = array();
1728
+	}
1668 1729
 
1669 1730
 	// Exclude individual site directories from the total when checking the main site,
1670 1731
 	// as they are subdirectories and should not be counted.
@@ -1708,8 +1769,9 @@  discard block
 block discarded – undo
1708 1769
 					$size += filesize($path);
1709 1770
 				} elseif (is_dir($path)) {
1710 1771
 					$handlesize = recurse_dirsize( $path, $exclude );
1711
-					if ($handlesize > 0)
1712
-						$size += $handlesize;
1772
+					if ($handlesize > 0) {
1773
+											$size += $handlesize;
1774
+					}
1713 1775
 				}
1714 1776
 			}
1715 1777
 		}
@@ -1737,8 +1799,9 @@  discard block
 block discarded – undo
1737 1799
 	$site_mimes = array();
1738 1800
 	foreach ( $site_exts as $ext ) {
1739 1801
 		foreach ( $mimes as $ext_pattern => $mime ) {
1740
-			if ( $ext != '' && strpos( $ext_pattern, $ext ) !== false )
1741
-				$site_mimes[$ext_pattern] = $mime;
1802
+			if ( $ext != '' && strpos( $ext_pattern, $ext ) !== false ) {
1803
+							$site_mimes[$ext_pattern] = $mime;
1804
+			}
1742 1805
 		}
1743 1806
 	}
1744 1807
 	return $site_mimes;
@@ -1776,9 +1839,10 @@  discard block
 block discarded – undo
1776 1839
 function wpmu_log_new_registrations( $blog_id, $user_id ) {
1777 1840
 	global $wpdb;
1778 1841
 	$user = get_userdata( (int) $user_id );
1779
-	if ( $user )
1780
-		$wpdb->insert( $wpdb->registration_log, array('email' => $user->user_email, 'IP' => preg_replace( '/[^0-9., ]/', '', wp_unslash( $_SERVER['REMOTE_ADDR'] ) ), 'blog_id' => $blog_id, 'date_registered' => current_time('mysql')) );
1781
-}
1842
+	if ( $user ) {
1843
+			$wpdb->insert( $wpdb->registration_log, array('email' => $user->user_email, 'IP' => preg_replace( '/[^0-9., ]/', '', wp_unslash( $_SERVER['REMOTE_ADDR'] ) ), 'blog_id' => $blog_id, 'date_registered' => current_time('mysql')) );
1844
+	}
1845
+	}
1782 1846
 
1783 1847
 /**
1784 1848
  * Maintains a canonical list of terms by syncing terms created for each blog with the global terms table.
@@ -1798,8 +1862,9 @@  discard block
 block discarded – undo
1798 1862
 	global $wpdb;
1799 1863
 	static $global_terms_recurse = null;
1800 1864
 
1801
-	if ( !global_terms_enabled() )
1802
-		return $term_id;
1865
+	if ( !global_terms_enabled() ) {
1866
+			return $term_id;
1867
+	}
1803 1868
 
1804 1869
 	// prevent a race condition
1805 1870
 	$recurse_start = false;
@@ -1819,8 +1884,9 @@  discard block
 block discarded – undo
1819 1884
 		if ( null == $used_global_id ) {
1820 1885
 			$wpdb->insert( $wpdb->sitecategories, array( 'cat_ID' => $term_id, 'cat_name' => $c->name, 'category_nicename' => $c->slug ) );
1821 1886
 			$global_id = $wpdb->insert_id;
1822
-			if ( empty( $global_id ) )
1823
-				return $term_id;
1887
+			if ( empty( $global_id ) ) {
1888
+							return $term_id;
1889
+			}
1824 1890
 		} else {
1825 1891
 			$max_global_id = $wpdb->get_var( "SELECT MAX(cat_ID) FROM $wpdb->sitecategories" );
1826 1892
 			$max_local_id = $wpdb->get_var( "SELECT MAX(term_id) FROM $wpdb->terms" );
@@ -1839,8 +1905,9 @@  discard block
 block discarded – undo
1839 1905
 	}
1840 1906
 
1841 1907
 	if ( $global_id != $term_id ) {
1842
-		if ( get_option( 'default_category' ) == $term_id )
1843
-			update_option( 'default_category', $global_id );
1908
+		if ( get_option( 'default_category' ) == $term_id ) {
1909
+					update_option( 'default_category', $global_id );
1910
+		}
1844 1911
 
1845 1912
 		$wpdb->update( $wpdb->terms, array('term_id' => $global_id), array('term_id' => $term_id) );
1846 1913
 		$wpdb->update( $wpdb->term_taxonomy, array('term_id' => $global_id), array('term_id' => $term_id) );
@@ -1848,8 +1915,9 @@  discard block
 block discarded – undo
1848 1915
 
1849 1916
 		clean_term_cache($term_id);
1850 1917
 	}
1851
-	if ( $recurse_start )
1852
-		$global_terms_recurse = null;
1918
+	if ( $recurse_start ) {
1919
+			$global_terms_recurse = null;
1920
+	}
1853 1921
 
1854 1922
 	return $global_id;
1855 1923
 }
@@ -1878,8 +1946,9 @@  discard block
 block discarded – undo
1878 1946
  * @return string|array If the upload is under the size limit, $upload is returned. Otherwise returns an error message.
1879 1947
  */
1880 1948
 function upload_is_file_too_big( $upload ) {
1881
-	if ( ! is_array( $upload ) || defined( 'WP_IMPORTING' ) || get_site_option( 'upload_space_check_disabled' ) )
1882
-		return $upload;
1949
+	if ( ! is_array( $upload ) || defined( 'WP_IMPORTING' ) || get_site_option( 'upload_space_check_disabled' ) ) {
1950
+			return $upload;
1951
+	}
1883 1952
 
1884 1953
 	if ( strlen( $upload['bits'] )  > ( KB_IN_BYTES * get_site_option( 'fileupload_maxk', 1500 ) ) ) {
1885 1954
 		return sprintf( __( 'This file is too big. Files must be less than %d KB in size.' ) . '<br />', get_site_option( 'fileupload_maxk', 1500 ) );
@@ -1908,11 +1977,13 @@  discard block
 block discarded – undo
1908 1977
  * @return array
1909 1978
  */
1910 1979
 function signup_nonce_check( $result ) {
1911
-	if ( !strpos( $_SERVER[ 'PHP_SELF' ], 'wp-signup.php' ) )
1912
-		return $result;
1980
+	if ( !strpos( $_SERVER[ 'PHP_SELF' ], 'wp-signup.php' ) ) {
1981
+			return $result;
1982
+	}
1913 1983
 
1914
-	if ( wp_create_nonce('signup_form_' . $_POST[ 'signup_form_id' ]) != $_POST['_signup_form'] )
1915
-		wp_die( __( 'Please try again.' ) );
1984
+	if ( wp_create_nonce('signup_form_' . $_POST[ 'signup_form_id' ]) != $_POST['_signup_form'] ) {
1985
+			wp_die( __( 'Please try again.' ) );
1986
+	}
1916 1987
 
1917 1988
 	return $result;
1918 1989
 }
@@ -1933,8 +2004,9 @@  discard block
 block discarded – undo
1933 2004
 	 * @param string $no_blog_redirect The redirect URL defined in NOBLOGREDIRECT.
1934 2005
 	 */
1935 2006
 	if ( is_main_site() && is_404() && defined( 'NOBLOGREDIRECT' ) && ( $destination = apply_filters( 'blog_redirect_404', NOBLOGREDIRECT ) ) ) {
1936
-		if ( $destination == '%siteurl%' )
1937
-			$destination = network_home_url();
2007
+		if ( $destination == '%siteurl%' ) {
2008
+					$destination = network_home_url();
2009
+		}
1938 2010
 		wp_redirect( $destination );
1939 2011
 		exit();
1940 2012
 	}
@@ -1950,21 +2022,25 @@  discard block
 block discarded – undo
1950 2022
  * @since MU
1951 2023
  */
1952 2024
 function maybe_add_existing_user_to_blog() {
1953
-	if ( false === strpos( $_SERVER[ 'REQUEST_URI' ], '/newbloguser/' ) )
1954
-		return;
2025
+	if ( false === strpos( $_SERVER[ 'REQUEST_URI' ], '/newbloguser/' ) ) {
2026
+			return;
2027
+	}
1955 2028
 
1956 2029
 	$parts = explode( '/', $_SERVER[ 'REQUEST_URI' ] );
1957 2030
 	$key = array_pop( $parts );
1958 2031
 
1959
-	if ( $key == '' )
1960
-		$key = array_pop( $parts );
2032
+	if ( $key == '' ) {
2033
+			$key = array_pop( $parts );
2034
+	}
1961 2035
 
1962 2036
 	$details = get_option( 'new_user_' . $key );
1963
-	if ( !empty( $details ) )
1964
-		delete_option( 'new_user_' . $key );
2037
+	if ( !empty( $details ) ) {
2038
+			delete_option( 'new_user_' . $key );
2039
+	}
1965 2040
 
1966
-	if ( empty( $details ) || is_wp_error( add_existing_user_to_blog( $details ) ) )
1967
-		wp_die( sprintf(__('An error occurred adding you to this site. Back to the <a href="%s">homepage</a>.'), home_url() ) );
2041
+	if ( empty( $details ) || is_wp_error( add_existing_user_to_blog( $details ) ) ) {
2042
+			wp_die( sprintf(__('An error occurred adding you to this site. Back to the <a href="%s">homepage</a>.'), home_url() ) );
2043
+	}
1968 2044
 
1969 2045
 	wp_die( sprintf( __( 'You have been added to this site. Please visit the <a href="%s">homepage</a> or <a href="%s">log in</a> using your username and password.' ), home_url(), admin_url() ), __( 'WordPress &rsaquo; Success' ), array( 'response' => 200 ) );
1970 2046
 }
@@ -2165,11 +2241,14 @@  discard block
 block discarded – undo
2165 2241
  * @return string URL with https as the scheme
2166 2242
  */
2167 2243
 function filter_SSL( $url ) {
2168
-	if ( ! is_string( $url ) )
2169
-		return get_bloginfo( 'url' ); // Return home blog url with proper scheme
2244
+	if ( ! is_string( $url ) ) {
2245
+			return get_bloginfo( 'url' );
2246
+	}
2247
+	// Return home blog url with proper scheme
2170 2248
 
2171
-	if ( force_ssl_content() && is_ssl() )
2172
-		$url = set_url_scheme( $url, 'https' );
2249
+	if ( force_ssl_content() && is_ssl() ) {
2250
+			$url = set_url_scheme( $url, 'https' );
2251
+	}
2173 2252
 
2174 2253
 	return $url;
2175 2254
 }
@@ -2180,12 +2259,14 @@  discard block
 block discarded – undo
2180 2259
  * @since 3.1.0
2181 2260
  */
2182 2261
 function wp_schedule_update_network_counts() {
2183
-	if ( !is_main_site() )
2184
-		return;
2262
+	if ( !is_main_site() ) {
2263
+			return;
2264
+	}
2185 2265
 
2186
-	if ( ! wp_next_scheduled('update_network_counts') && ! wp_installing() )
2187
-		wp_schedule_event(time(), 'twicedaily', 'update_network_counts');
2188
-}
2266
+	if ( ! wp_next_scheduled('update_network_counts') && ! wp_installing() ) {
2267
+			wp_schedule_event(time(), 'twicedaily', 'update_network_counts');
2268
+	}
2269
+	}
2189 2270
 
2190 2271
 /**
2191 2272
  *  Update the network-wide counts for the current network.
@@ -2218,8 +2299,9 @@  discard block
 block discarded – undo
2218 2299
 	 * @param bool   $small_network Whether the network is considered small.
2219 2300
 	 * @param string $context       Context. Either 'users' or 'sites'.
2220 2301
 	 */
2221
-	if ( ! apply_filters( 'enable_live_network_counts', $is_small_network, 'sites' ) )
2222
-		return;
2302
+	if ( ! apply_filters( 'enable_live_network_counts', $is_small_network, 'sites' ) ) {
2303
+			return;
2304
+	}
2223 2305
 
2224 2306
 	wp_update_network_site_counts();
2225 2307
 }
@@ -2236,8 +2318,9 @@  discard block
 block discarded – undo
2236 2318
 	$is_small_network = ! wp_is_large_network( 'users' );
2237 2319
 
2238 2320
 	/** This filter is documented in wp-includes/ms-functions.php */
2239
-	if ( ! apply_filters( 'enable_live_network_counts', $is_small_network, 'users' ) )
2240
-		return;
2321
+	if ( ! apply_filters( 'enable_live_network_counts', $is_small_network, 'users' ) ) {
2322
+			return;
2323
+	}
2241 2324
 
2242 2325
 	wp_update_network_user_counts();
2243 2326
 }
@@ -2304,11 +2387,13 @@  discard block
 block discarded – undo
2304 2387
 function get_space_allowed() {
2305 2388
 	$space_allowed = get_option( 'blog_upload_space' );
2306 2389
 
2307
-	if ( ! is_numeric( $space_allowed ) )
2308
-		$space_allowed = get_site_option( 'blog_upload_space' );
2390
+	if ( ! is_numeric( $space_allowed ) ) {
2391
+			$space_allowed = get_site_option( 'blog_upload_space' );
2392
+	}
2309 2393
 
2310
-	if ( ! is_numeric( $space_allowed ) )
2311
-		$space_allowed = 100;
2394
+	if ( ! is_numeric( $space_allowed ) ) {
2395
+			$space_allowed = 100;
2396
+	}
2312 2397
 
2313 2398
 	/**
2314 2399
 	 * Filter the upload quota for the current site.
@@ -2333,13 +2418,15 @@  discard block
 block discarded – undo
2333 2418
 		$allowed = 0;
2334 2419
 	}
2335 2420
 	$space_allowed = $allowed * MB_IN_BYTES;
2336
-	if ( get_site_option( 'upload_space_check_disabled' ) )
2337
-		return $space_allowed;
2421
+	if ( get_site_option( 'upload_space_check_disabled' ) ) {
2422
+			return $space_allowed;
2423
+	}
2338 2424
 
2339 2425
 	$space_used = get_space_used() * MB_IN_BYTES;
2340 2426
 
2341
-	if ( ( $space_allowed - $space_used ) <= 0 )
2342
-		return 0;
2427
+	if ( ( $space_allowed - $space_used ) <= 0 ) {
2428
+			return 0;
2429
+	}
2343 2430
 
2344 2431
 	return $space_allowed - $space_used;
2345 2432
 }
@@ -2351,8 +2438,9 @@  discard block
 block discarded – undo
2351 2438
  * @return bool True if space is available, false otherwise.
2352 2439
  */
2353 2440
 function is_upload_space_available() {
2354
-	if ( get_site_option( 'upload_space_check_disabled' ) )
2355
-		return true;
2441
+	if ( get_site_option( 'upload_space_check_disabled' ) ) {
2442
+			return true;
2443
+	}
2356 2444
 
2357 2445
 	return (bool) get_upload_space_available();
2358 2446
 }
@@ -2367,8 +2455,9 @@  discard block
 block discarded – undo
2367 2455
  */
2368 2456
 function upload_size_limit_filter( $size ) {
2369 2457
 	$fileupload_maxk = KB_IN_BYTES * get_site_option( 'fileupload_maxk', 1500 );
2370
-	if ( get_site_option( 'upload_space_check_disabled' ) )
2371
-		return min( $size, $fileupload_maxk );
2458
+	if ( get_site_option( 'upload_space_check_disabled' ) ) {
2459
+			return min( $size, $fileupload_maxk );
2460
+	}
2372 2461
 
2373 2462
 	return min( $size, $fileupload_maxk, get_upload_space_available() );
2374 2463
 }
@@ -2432,8 +2521,9 @@  discard block
 block discarded – undo
2432 2521
 function wp_get_sites( $args = array() ) {
2433 2522
 	global $wpdb;
2434 2523
 
2435
-	if ( wp_is_large_network() )
2436
-		return array();
2524
+	if ( wp_is_large_network() ) {
2525
+			return array();
2526
+	}
2437 2527
 
2438 2528
 	$defaults = array(
2439 2529
 		'network_id' => $wpdb->siteid,
@@ -2455,26 +2545,32 @@  discard block
 block discarded – undo
2455 2545
 		$query .= "AND site_id IN ($network_ids) ";
2456 2546
 	}
2457 2547
 
2458
-	if ( isset( $args['public'] ) )
2459
-		$query .= $wpdb->prepare( "AND public = %d ", $args['public'] );
2548
+	if ( isset( $args['public'] ) ) {
2549
+			$query .= $wpdb->prepare( "AND public = %d ", $args['public'] );
2550
+	}
2460 2551
 
2461
-	if ( isset( $args['archived'] ) )
2462
-		$query .= $wpdb->prepare( "AND archived = %d ", $args['archived'] );
2552
+	if ( isset( $args['archived'] ) ) {
2553
+			$query .= $wpdb->prepare( "AND archived = %d ", $args['archived'] );
2554
+	}
2463 2555
 
2464
-	if ( isset( $args['mature'] ) )
2465
-		$query .= $wpdb->prepare( "AND mature = %d ", $args['mature'] );
2556
+	if ( isset( $args['mature'] ) ) {
2557
+			$query .= $wpdb->prepare( "AND mature = %d ", $args['mature'] );
2558
+	}
2466 2559
 
2467
-	if ( isset( $args['spam'] ) )
2468
-		$query .= $wpdb->prepare( "AND spam = %d ", $args['spam'] );
2560
+	if ( isset( $args['spam'] ) ) {
2561
+			$query .= $wpdb->prepare( "AND spam = %d ", $args['spam'] );
2562
+	}
2469 2563
 
2470
-	if ( isset( $args['deleted'] ) )
2471
-		$query .= $wpdb->prepare( "AND deleted = %d ", $args['deleted'] );
2564
+	if ( isset( $args['deleted'] ) ) {
2565
+			$query .= $wpdb->prepare( "AND deleted = %d ", $args['deleted'] );
2566
+	}
2472 2567
 
2473 2568
 	if ( isset( $args['limit'] ) && $args['limit'] ) {
2474
-		if ( isset( $args['offset'] ) && $args['offset'] )
2475
-			$query .= $wpdb->prepare( "LIMIT %d , %d ", $args['offset'], $args['limit'] );
2476
-		else
2477
-			$query .= $wpdb->prepare( "LIMIT %d ", $args['limit'] );
2569
+		if ( isset( $args['offset'] ) && $args['offset'] ) {
2570
+					$query .= $wpdb->prepare( "LIMIT %d , %d ", $args['offset'], $args['limit'] );
2571
+		} else {
2572
+					$query .= $wpdb->prepare( "LIMIT %d ", $args['limit'] );
2573
+		}
2478 2574
 	}
2479 2575
 
2480 2576
 	$site_results = $wpdb->get_results( $query, ARRAY_A );
Please login to merge, or discard this patch.
src/wp-includes/pluggable.php 3 patches
Doc Comments   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
  *
743 743
  * @param string $cookie
744 744
  * @param string $scheme Optional. The cookie scheme to use: auth, secure_auth, or logged_in
745
- * @return array|false Authentication cookie components
745
+ * @return string Authentication cookie components
746 746
  */
747 747
 function wp_parse_auth_cookie($cookie = '', $scheme = '') {
748 748
 	if ( empty($cookie) ) {
@@ -1041,7 +1041,7 @@  discard block
 block discarded – undo
1041 1041
  *
1042 1042
  * @since 1.2.0
1043 1043
  *
1044
- * @param int|string $action    Action nonce.
1044
+ * @param integer $action    Action nonce.
1045 1045
  * @param string     $query_arg Optional. Key to check for nonce in `$_REQUEST` (since 2.5).
1046 1046
  *                              Default '_wpnonce'.
1047 1047
  * @return false|int False if the nonce is invalid, 1 if the nonce is valid and generated between
@@ -1081,7 +1081,7 @@  discard block
 block discarded – undo
1081 1081
  *
1082 1082
  * @since 2.0.3
1083 1083
  *
1084
- * @param int|string   $action    Action nonce.
1084
+ * @param integer   $action    Action nonce.
1085 1085
  * @param false|string $query_arg Optional. Key to check for the nonce in `$_REQUEST` (since 2.5). If false,
1086 1086
  *                                `$_REQUEST` values will be evaluated for '_ajax_nonce', and '_wpnonce'
1087 1087
  *                                (in that order). Default false.
@@ -1531,7 +1531,7 @@  discard block
 block discarded – undo
1531 1531
  * should be notified, overriding the site setting.
1532 1532
  *
1533 1533
  * @param int $comment_id Comment ID.
1534
- * @return true Always returns true.
1534
+ * @return boolean Always returns true.
1535 1535
  */
1536 1536
 function wp_notify_moderator($comment_id) {
1537 1537
 	global $wpdb;
@@ -1782,8 +1782,8 @@  discard block
 block discarded – undo
1782 1782
  * @since 2.0.3
1783 1783
  *
1784 1784
  * @param string     $nonce  Nonce that was used in the form to verify
1785
- * @param string|int $action Should give context to what is taking place and be the same when nonce was created.
1786
- * @return false|int False if the nonce is invalid, 1 if the nonce is valid and generated between
1785
+ * @param integer $action Should give context to what is taking place and be the same when nonce was created.
1786
+ * @return string False if the nonce is invalid, 1 if the nonce is valid and generated between
1787 1787
  *                   0-12 hours ago, 2 if the nonce is valid and generated between 12-24 hours ago.
1788 1788
  */
1789 1789
 function wp_verify_nonce( $nonce, $action = -1 ) {
@@ -1846,7 +1846,7 @@  discard block
 block discarded – undo
1846 1846
  * @since 2.0.3
1847 1847
  * @since 4.0.0 Session tokens were integrated with nonce creation
1848 1848
  *
1849
- * @param string|int $action Scalar value to add context to the nonce.
1849
+ * @param integer $action Scalar value to add context to the nonce.
1850 1850
  * @return string The token.
1851 1851
  */
1852 1852
 function wp_create_nonce($action = -1) {
Please login to merge, or discard this patch.
Spacing   +520 added lines, -520 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @package WordPress
7 7
  */
8 8
 
9
-if ( !function_exists('wp_set_current_user') ) :
9
+if ( ! function_exists('wp_set_current_user')) :
10 10
 /**
11 11
  * Changes the current user by ID or name.
12 12
  *
@@ -27,30 +27,30 @@  discard block
 block discarded – undo
27 27
 	global $current_user;
28 28
 
29 29
 	// If `$id` matches the user who's already current, there's nothing to do.
30
-	if ( isset( $current_user )
31
-		&& ( $current_user instanceof WP_User )
32
-		&& ( $id == $current_user->ID )
33
-		&& ( null !== $id )
30
+	if (isset($current_user)
31
+		&& ($current_user instanceof WP_User)
32
+		&& ($id == $current_user->ID)
33
+		&& (null !== $id)
34 34
 	) {
35 35
 		return $current_user;
36 36
 	}
37 37
 
38
-	$current_user = new WP_User( $id, $name );
38
+	$current_user = new WP_User($id, $name);
39 39
 
40
-	setup_userdata( $current_user->ID );
40
+	setup_userdata($current_user->ID);
41 41
 
42 42
 	/**
43 43
 	 * Fires after the current user is set.
44 44
 	 *
45 45
 	 * @since 2.0.1
46 46
 	 */
47
-	do_action( 'set_current_user' );
47
+	do_action('set_current_user');
48 48
 
49 49
 	return $current_user;
50 50
 }
51 51
 endif;
52 52
 
53
-if ( !function_exists('wp_get_current_user') ) :
53
+if ( ! function_exists('wp_get_current_user')) :
54 54
 /**
55 55
  * Retrieve the current user object.
56 56
  *
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 }
71 71
 endif;
72 72
 
73
-if ( !function_exists('get_userdata') ) :
73
+if ( ! function_exists('get_userdata')) :
74 74
 /**
75 75
  * Retrieve user info by user ID.
76 76
  *
@@ -79,12 +79,12 @@  discard block
 block discarded – undo
79 79
  * @param int $user_id User ID
80 80
  * @return WP_User|false WP_User object on success, false on failure.
81 81
  */
82
-function get_userdata( $user_id ) {
83
-	return get_user_by( 'id', $user_id );
82
+function get_userdata($user_id) {
83
+	return get_user_by('id', $user_id);
84 84
 }
85 85
 endif;
86 86
 
87
-if ( !function_exists('get_user_by') ) :
87
+if ( ! function_exists('get_user_by')) :
88 88
 /**
89 89
  * Retrieve user info by a given field
90 90
  *
@@ -95,20 +95,20 @@  discard block
 block discarded – undo
95 95
  * @param int|string $value A value for $field. A user ID, slug, email address, or login name.
96 96
  * @return WP_User|false WP_User object on success, false on failure.
97 97
  */
98
-function get_user_by( $field, $value ) {
99
-	$userdata = WP_User::get_data_by( $field, $value );
98
+function get_user_by($field, $value) {
99
+	$userdata = WP_User::get_data_by($field, $value);
100 100
 
101
-	if ( !$userdata )
101
+	if ( ! $userdata)
102 102
 		return false;
103 103
 
104 104
 	$user = new WP_User;
105
-	$user->init( $userdata );
105
+	$user->init($userdata);
106 106
 
107 107
 	return $user;
108 108
 }
109 109
 endif;
110 110
 
111
-if ( !function_exists('cache_users') ) :
111
+if ( ! function_exists('cache_users')) :
112 112
 /**
113 113
  * Retrieve info for user lists to prevent multiple queries by get_userdata()
114 114
  *
@@ -118,28 +118,28 @@  discard block
 block discarded – undo
118 118
  *
119 119
  * @param array $user_ids User ID numbers list
120 120
  */
121
-function cache_users( $user_ids ) {
121
+function cache_users($user_ids) {
122 122
 	global $wpdb;
123 123
 
124
-	$clean = _get_non_cached_ids( $user_ids, 'users' );
124
+	$clean = _get_non_cached_ids($user_ids, 'users');
125 125
 
126
-	if ( empty( $clean ) )
126
+	if (empty($clean))
127 127
 		return;
128 128
 
129
-	$list = implode( ',', $clean );
129
+	$list = implode(',', $clean);
130 130
 
131
-	$users = $wpdb->get_results( "SELECT * FROM $wpdb->users WHERE ID IN ($list)" );
131
+	$users = $wpdb->get_results("SELECT * FROM $wpdb->users WHERE ID IN ($list)");
132 132
 
133 133
 	$ids = array();
134
-	foreach ( $users as $user ) {
135
-		update_user_caches( $user );
134
+	foreach ($users as $user) {
135
+		update_user_caches($user);
136 136
 		$ids[] = $user->ID;
137 137
 	}
138
-	update_meta_cache( 'user', $ids );
138
+	update_meta_cache('user', $ids);
139 139
 }
140 140
 endif;
141 141
 
142
-if ( !function_exists( 'wp_mail' ) ) :
142
+if ( ! function_exists('wp_mail')) :
143 143
 /**
144 144
  * Send mail, similar to PHP's mail
145 145
  *
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
  * @param string|array $attachments Optional. Files to attach.
171 171
  * @return bool Whether the email contents were sent successfully.
172 172
  */
173
-function wp_mail( $to, $subject, $message, $headers = '', $attachments = array() ) {
173
+function wp_mail($to, $subject, $message, $headers = '', $attachments = array()) {
174 174
 	// Compact the input, apply the filters, and extract them back out
175 175
 
176 176
 	/**
@@ -181,48 +181,48 @@  discard block
 block discarded – undo
181 181
 	 * @param array $args A compacted array of wp_mail() arguments, including the "to" email,
182 182
 	 *                    subject, message, headers, and attachments values.
183 183
 	 */
184
-	$atts = apply_filters( 'wp_mail', compact( 'to', 'subject', 'message', 'headers', 'attachments' ) );
184
+	$atts = apply_filters('wp_mail', compact('to', 'subject', 'message', 'headers', 'attachments'));
185 185
 
186
-	if ( isset( $atts['to'] ) ) {
186
+	if (isset($atts['to'])) {
187 187
 		$to = $atts['to'];
188 188
 	}
189 189
 
190
-	if ( isset( $atts['subject'] ) ) {
190
+	if (isset($atts['subject'])) {
191 191
 		$subject = $atts['subject'];
192 192
 	}
193 193
 
194
-	if ( isset( $atts['message'] ) ) {
194
+	if (isset($atts['message'])) {
195 195
 		$message = $atts['message'];
196 196
 	}
197 197
 
198
-	if ( isset( $atts['headers'] ) ) {
198
+	if (isset($atts['headers'])) {
199 199
 		$headers = $atts['headers'];
200 200
 	}
201 201
 
202
-	if ( isset( $atts['attachments'] ) ) {
202
+	if (isset($atts['attachments'])) {
203 203
 		$attachments = $atts['attachments'];
204 204
 	}
205 205
 
206
-	if ( ! is_array( $attachments ) ) {
207
-		$attachments = explode( "\n", str_replace( "\r\n", "\n", $attachments ) );
206
+	if ( ! is_array($attachments)) {
207
+		$attachments = explode("\n", str_replace("\r\n", "\n", $attachments));
208 208
 	}
209 209
 	global $phpmailer;
210 210
 
211 211
 	// (Re)create it, if it's gone missing
212
-	if ( ! ( $phpmailer instanceof PHPMailer ) ) {
213
-		require_once ABSPATH . WPINC . '/class-phpmailer.php';
214
-		require_once ABSPATH . WPINC . '/class-smtp.php';
215
-		$phpmailer = new PHPMailer( true );
212
+	if ( ! ($phpmailer instanceof PHPMailer)) {
213
+		require_once ABSPATH.WPINC.'/class-phpmailer.php';
214
+		require_once ABSPATH.WPINC.'/class-smtp.php';
215
+		$phpmailer = new PHPMailer(true);
216 216
 	}
217 217
 
218 218
 	// Headers
219
-	if ( empty( $headers ) ) {
219
+	if (empty($headers)) {
220 220
 		$headers = array();
221 221
 	} else {
222
-		if ( !is_array( $headers ) ) {
222
+		if ( ! is_array($headers)) {
223 223
 			// Explode the headers out, so this function can take both
224 224
 			// string headers and an array of headers.
225
-			$tempheaders = explode( "\n", str_replace( "\r\n", "\n", $headers ) );
225
+			$tempheaders = explode("\n", str_replace("\r\n", "\n", $headers));
226 226
 		} else {
227 227
 			$tempheaders = $headers;
228 228
 		}
@@ -231,69 +231,69 @@  discard block
 block discarded – undo
231 231
 		$bcc = array();
232 232
 
233 233
 		// If it's actually got contents
234
-		if ( !empty( $tempheaders ) ) {
234
+		if ( ! empty($tempheaders)) {
235 235
 			// Iterate through the raw headers
236
-			foreach ( (array) $tempheaders as $header ) {
237
-				if ( strpos($header, ':') === false ) {
238
-					if ( false !== stripos( $header, 'boundary=' ) ) {
239
-						$parts = preg_split('/boundary=/i', trim( $header ) );
240
-						$boundary = trim( str_replace( array( "'", '"' ), '', $parts[1] ) );
236
+			foreach ((array) $tempheaders as $header) {
237
+				if (strpos($header, ':') === false) {
238
+					if (false !== stripos($header, 'boundary=')) {
239
+						$parts = preg_split('/boundary=/i', trim($header));
240
+						$boundary = trim(str_replace(array("'", '"'), '', $parts[1]));
241 241
 					}
242 242
 					continue;
243 243
 				}
244 244
 				// Explode them out
245
-				list( $name, $content ) = explode( ':', trim( $header ), 2 );
245
+				list($name, $content) = explode(':', trim($header), 2);
246 246
 
247 247
 				// Cleanup crew
248
-				$name    = trim( $name    );
249
-				$content = trim( $content );
248
+				$name    = trim($name);
249
+				$content = trim($content);
250 250
 
251
-				switch ( strtolower( $name ) ) {
251
+				switch (strtolower($name)) {
252 252
 					// Mainly for legacy -- process a From: header if it's there
253 253
 					case 'from':
254
-						$bracket_pos = strpos( $content, '<' );
255
-						if ( $bracket_pos !== false ) {
254
+						$bracket_pos = strpos($content, '<');
255
+						if ($bracket_pos !== false) {
256 256
 							// Text before the bracketed email is the "From" name.
257
-							if ( $bracket_pos > 0 ) {
258
-								$from_name = substr( $content, 0, $bracket_pos - 1 );
259
-								$from_name = str_replace( '"', '', $from_name );
260
-								$from_name = trim( $from_name );
257
+							if ($bracket_pos > 0) {
258
+								$from_name = substr($content, 0, $bracket_pos - 1);
259
+								$from_name = str_replace('"', '', $from_name);
260
+								$from_name = trim($from_name);
261 261
 							}
262 262
 
263
-							$from_email = substr( $content, $bracket_pos + 1 );
264
-							$from_email = str_replace( '>', '', $from_email );
265
-							$from_email = trim( $from_email );
263
+							$from_email = substr($content, $bracket_pos + 1);
264
+							$from_email = str_replace('>', '', $from_email);
265
+							$from_email = trim($from_email);
266 266
 
267 267
 						// Avoid setting an empty $from_email.
268
-						} elseif ( '' !== trim( $content ) ) {
269
-							$from_email = trim( $content );
268
+						} elseif ('' !== trim($content)) {
269
+							$from_email = trim($content);
270 270
 						}
271 271
 						break;
272 272
 					case 'content-type':
273
-						if ( strpos( $content, ';' ) !== false ) {
274
-							list( $type, $charset_content ) = explode( ';', $content );
275
-							$content_type = trim( $type );
276
-							if ( false !== stripos( $charset_content, 'charset=' ) ) {
277
-								$charset = trim( str_replace( array( 'charset=', '"' ), '', $charset_content ) );
278
-							} elseif ( false !== stripos( $charset_content, 'boundary=' ) ) {
279
-								$boundary = trim( str_replace( array( 'BOUNDARY=', 'boundary=', '"' ), '', $charset_content ) );
273
+						if (strpos($content, ';') !== false) {
274
+							list($type, $charset_content) = explode(';', $content);
275
+							$content_type = trim($type);
276
+							if (false !== stripos($charset_content, 'charset=')) {
277
+								$charset = trim(str_replace(array('charset=', '"'), '', $charset_content));
278
+							} elseif (false !== stripos($charset_content, 'boundary=')) {
279
+								$boundary = trim(str_replace(array('BOUNDARY=', 'boundary=', '"'), '', $charset_content));
280 280
 								$charset = '';
281 281
 							}
282 282
 
283 283
 						// Avoid setting an empty $content_type.
284
-						} elseif ( '' !== trim( $content ) ) {
285
-							$content_type = trim( $content );
284
+						} elseif ('' !== trim($content)) {
285
+							$content_type = trim($content);
286 286
 						}
287 287
 						break;
288 288
 					case 'cc':
289
-						$cc = array_merge( (array) $cc, explode( ',', $content ) );
289
+						$cc = array_merge((array) $cc, explode(',', $content));
290 290
 						break;
291 291
 					case 'bcc':
292
-						$bcc = array_merge( (array) $bcc, explode( ',', $content ) );
292
+						$bcc = array_merge((array) $bcc, explode(',', $content));
293 293
 						break;
294 294
 					default:
295 295
 						// Add it to our grand headers array
296
-						$headers[trim( $name )] = trim( $content );
296
+						$headers[trim($name)] = trim($content);
297 297
 						break;
298 298
 				}
299 299
 			}
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 
309 309
 	// From email and name
310 310
 	// If we don't have a name from the input headers
311
-	if ( !isset( $from_name ) )
311
+	if ( ! isset($from_name))
312 312
 		$from_name = 'WordPress';
313 313
 
314 314
 	/* If we don't have an email from the input headers default to wordpress@$sitename
@@ -318,14 +318,14 @@  discard block
 block discarded – undo
318 318
 	 * https://core.trac.wordpress.org/ticket/5007.
319 319
 	 */
320 320
 
321
-	if ( !isset( $from_email ) ) {
321
+	if ( ! isset($from_email)) {
322 322
 		// Get the site domain and get rid of www.
323
-		$sitename = strtolower( $_SERVER['SERVER_NAME'] );
324
-		if ( substr( $sitename, 0, 4 ) == 'www.' ) {
325
-			$sitename = substr( $sitename, 4 );
323
+		$sitename = strtolower($_SERVER['SERVER_NAME']);
324
+		if (substr($sitename, 0, 4) == 'www.') {
325
+			$sitename = substr($sitename, 4);
326 326
 		}
327 327
 
328
-		$from_email = 'wordpress@' . $sitename;
328
+		$from_email = 'wordpress@'.$sitename;
329 329
 	}
330 330
 
331 331
 	/**
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
 	 *
336 336
 	 * @param string $from_email Email address to send from.
337 337
 	 */
338
-	$phpmailer->From = apply_filters( 'wp_mail_from', $from_email );
338
+	$phpmailer->From = apply_filters('wp_mail_from', $from_email);
339 339
 
340 340
 	/**
341 341
 	 * Filter the name to associate with the "from" email address.
@@ -344,24 +344,24 @@  discard block
 block discarded – undo
344 344
 	 *
345 345
 	 * @param string $from_name Name associated with the "from" email address.
346 346
 	 */
347
-	$phpmailer->FromName = apply_filters( 'wp_mail_from_name', $from_name );
347
+	$phpmailer->FromName = apply_filters('wp_mail_from_name', $from_name);
348 348
 
349 349
 	// Set destination addresses
350
-	if ( !is_array( $to ) )
351
-		$to = explode( ',', $to );
350
+	if ( ! is_array($to))
351
+		$to = explode(',', $to);
352 352
 
353
-	foreach ( (array) $to as $recipient ) {
353
+	foreach ((array) $to as $recipient) {
354 354
 		try {
355 355
 			// Break $recipient into name and address parts if in the format "Foo <[email protected]>"
356 356
 			$recipient_name = '';
357
-			if ( preg_match( '/(.*)<(.+)>/', $recipient, $matches ) ) {
358
-				if ( count( $matches ) == 3 ) {
357
+			if (preg_match('/(.*)<(.+)>/', $recipient, $matches)) {
358
+				if (count($matches) == 3) {
359 359
 					$recipient_name = $matches[1];
360 360
 					$recipient = $matches[2];
361 361
 				}
362 362
 			}
363
-			$phpmailer->AddAddress( $recipient, $recipient_name);
364
-		} catch ( phpmailerException $e ) {
363
+			$phpmailer->AddAddress($recipient, $recipient_name);
364
+		} catch (phpmailerException $e) {
365 365
 			continue;
366 366
 		}
367 367
 	}
@@ -371,37 +371,37 @@  discard block
 block discarded – undo
371 371
 	$phpmailer->Body    = $message;
372 372
 
373 373
 	// Add any CC and BCC recipients
374
-	if ( !empty( $cc ) ) {
375
-		foreach ( (array) $cc as $recipient ) {
374
+	if ( ! empty($cc)) {
375
+		foreach ((array) $cc as $recipient) {
376 376
 			try {
377 377
 				// Break $recipient into name and address parts if in the format "Foo <[email protected]>"
378 378
 				$recipient_name = '';
379
-				if ( preg_match( '/(.*)<(.+)>/', $recipient, $matches ) ) {
380
-					if ( count( $matches ) == 3 ) {
379
+				if (preg_match('/(.*)<(.+)>/', $recipient, $matches)) {
380
+					if (count($matches) == 3) {
381 381
 						$recipient_name = $matches[1];
382 382
 						$recipient = $matches[2];
383 383
 					}
384 384
 				}
385
-				$phpmailer->AddCc( $recipient, $recipient_name );
386
-			} catch ( phpmailerException $e ) {
385
+				$phpmailer->AddCc($recipient, $recipient_name);
386
+			} catch (phpmailerException $e) {
387 387
 				continue;
388 388
 			}
389 389
 		}
390 390
 	}
391 391
 
392
-	if ( !empty( $bcc ) ) {
393
-		foreach ( (array) $bcc as $recipient) {
392
+	if ( ! empty($bcc)) {
393
+		foreach ((array) $bcc as $recipient) {
394 394
 			try {
395 395
 				// Break $recipient into name and address parts if in the format "Foo <[email protected]>"
396 396
 				$recipient_name = '';
397
-				if ( preg_match( '/(.*)<(.+)>/', $recipient, $matches ) ) {
398
-					if ( count( $matches ) == 3 ) {
397
+				if (preg_match('/(.*)<(.+)>/', $recipient, $matches)) {
398
+					if (count($matches) == 3) {
399 399
 						$recipient_name = $matches[1];
400 400
 						$recipient = $matches[2];
401 401
 					}
402 402
 				}
403
-				$phpmailer->AddBcc( $recipient, $recipient_name );
404
-			} catch ( phpmailerException $e ) {
403
+				$phpmailer->AddBcc($recipient, $recipient_name);
404
+			} catch (phpmailerException $e) {
405 405
 				continue;
406 406
 			}
407 407
 		}
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
 
413 413
 	// Set Content-Type and charset
414 414
 	// If we don't have a content-type from the input headers
415
-	if ( !isset( $content_type ) )
415
+	if ( ! isset($content_type))
416 416
 		$content_type = 'text/plain';
417 417
 
418 418
 	/**
@@ -422,17 +422,17 @@  discard block
 block discarded – undo
422 422
 	 *
423 423
 	 * @param string $content_type Default wp_mail() content type.
424 424
 	 */
425
-	$content_type = apply_filters( 'wp_mail_content_type', $content_type );
425
+	$content_type = apply_filters('wp_mail_content_type', $content_type);
426 426
 
427 427
 	$phpmailer->ContentType = $content_type;
428 428
 
429 429
 	// Set whether it's plaintext, depending on $content_type
430
-	if ( 'text/html' == $content_type )
431
-		$phpmailer->IsHTML( true );
430
+	if ('text/html' == $content_type)
431
+		$phpmailer->IsHTML(true);
432 432
 
433 433
 	// If we don't have a charset from the input headers
434
-	if ( !isset( $charset ) )
435
-		$charset = get_bloginfo( 'charset' );
434
+	if ( ! isset($charset))
435
+		$charset = get_bloginfo('charset');
436 436
 
437 437
 	// Set the content-type and charset
438 438
 
@@ -443,23 +443,23 @@  discard block
 block discarded – undo
443 443
 	 *
444 444
 	 * @param string $charset Default email charset.
445 445
 	 */
446
-	$phpmailer->CharSet = apply_filters( 'wp_mail_charset', $charset );
446
+	$phpmailer->CharSet = apply_filters('wp_mail_charset', $charset);
447 447
 
448 448
 	// Set custom headers
449
-	if ( !empty( $headers ) ) {
450
-		foreach ( (array) $headers as $name => $content ) {
451
-			$phpmailer->AddCustomHeader( sprintf( '%1$s: %2$s', $name, $content ) );
449
+	if ( ! empty($headers)) {
450
+		foreach ((array) $headers as $name => $content) {
451
+			$phpmailer->AddCustomHeader(sprintf('%1$s: %2$s', $name, $content));
452 452
 		}
453 453
 
454
-		if ( false !== stripos( $content_type, 'multipart' ) && ! empty($boundary) )
455
-			$phpmailer->AddCustomHeader( sprintf( "Content-Type: %s;\n\t boundary=\"%s\"", $content_type, $boundary ) );
454
+		if (false !== stripos($content_type, 'multipart') && ! empty($boundary))
455
+			$phpmailer->AddCustomHeader(sprintf("Content-Type: %s;\n\t boundary=\"%s\"", $content_type, $boundary));
456 456
 	}
457 457
 
458
-	if ( !empty( $attachments ) ) {
459
-		foreach ( $attachments as $attachment ) {
458
+	if ( ! empty($attachments)) {
459
+		foreach ($attachments as $attachment) {
460 460
 			try {
461 461
 				$phpmailer->AddAttachment($attachment);
462
-			} catch ( phpmailerException $e ) {
462
+			} catch (phpmailerException $e) {
463 463
 				continue;
464 464
 			}
465 465
 		}
@@ -472,14 +472,14 @@  discard block
 block discarded – undo
472 472
 	 *
473 473
 	 * @param PHPMailer &$phpmailer The PHPMailer instance, passed by reference.
474 474
 	 */
475
-	do_action_ref_array( 'phpmailer_init', array( &$phpmailer ) );
475
+	do_action_ref_array('phpmailer_init', array(&$phpmailer));
476 476
 
477 477
 	// Send!
478 478
 	try {
479 479
 		return $phpmailer->Send();
480
-	} catch ( phpmailerException $e ) {
480
+	} catch (phpmailerException $e) {
481 481
 
482
-		$mail_error_data = compact( 'to', 'subject', 'message', 'headers', 'attachments' );
482
+		$mail_error_data = compact('to', 'subject', 'message', 'headers', 'attachments');
483 483
 
484 484
 		/**
485 485
 		 * Fires after a phpmailerException is caught.
@@ -489,14 +489,14 @@  discard block
 block discarded – undo
489 489
 		 * @param WP_Error $error A WP_Error object with the phpmailerException code, message, and an array
490 490
 		 *                        containing the mail recipient, subject, message, headers, and attachments.
491 491
 		 */
492
- 		do_action( 'wp_mail_failed', new WP_Error( $e->getCode(), $e->getMessage(), $mail_error_data ) );
492
+ 		do_action('wp_mail_failed', new WP_Error($e->getCode(), $e->getMessage(), $mail_error_data));
493 493
 
494 494
 		return false;
495 495
 	}
496 496
 }
497 497
 endif;
498 498
 
499
-if ( !function_exists('wp_authenticate') ) :
499
+if ( ! function_exists('wp_authenticate')) :
500 500
 /**
501 501
  * Authenticate a user, confirming the login credentials are valid.
502 502
  *
@@ -526,17 +526,17 @@  discard block
 block discarded – undo
526 526
 	 * @param string                $username Username or email address.
527 527
 	 * @param string                $password User password
528 528
 	 */
529
-	$user = apply_filters( 'authenticate', null, $username, $password );
529
+	$user = apply_filters('authenticate', null, $username, $password);
530 530
 
531
-	if ( $user == null ) {
531
+	if ($user == null) {
532 532
 		// TODO what should the error message be? (Or would these even happen?)
533 533
 		// Only needed if all authentication handlers fail to return anything.
534
-		$user = new WP_Error( 'authentication_failed', __( '<strong>ERROR</strong>: Invalid username, email address or incorrect password.' ) );
534
+		$user = new WP_Error('authentication_failed', __('<strong>ERROR</strong>: Invalid username, email address or incorrect password.'));
535 535
 	}
536 536
 
537 537
 	$ignore_codes = array('empty_username', 'empty_password');
538 538
 
539
-	if (is_wp_error($user) && !in_array($user->get_error_code(), $ignore_codes) ) {
539
+	if (is_wp_error($user) && ! in_array($user->get_error_code(), $ignore_codes)) {
540 540
 		/**
541 541
 		 * Fires after a user login has failed.
542 542
 		 *
@@ -545,14 +545,14 @@  discard block
 block discarded – undo
545 545
 		 *
546 546
 		 * @param string $username Username or email address.
547 547
 		 */
548
-		do_action( 'wp_login_failed', $username );
548
+		do_action('wp_login_failed', $username);
549 549
 	}
550 550
 
551 551
 	return $user;
552 552
 }
553 553
 endif;
554 554
 
555
-if ( !function_exists('wp_logout') ) :
555
+if ( ! function_exists('wp_logout')) :
556 556
 /**
557 557
  * Log the current user out.
558 558
  *
@@ -567,11 +567,11 @@  discard block
 block discarded – undo
567 567
 	 *
568 568
 	 * @since 1.5.0
569 569
 	 */
570
-	do_action( 'wp_logout' );
570
+	do_action('wp_logout');
571 571
 }
572 572
 endif;
573 573
 
574
-if ( !function_exists('wp_validate_auth_cookie') ) :
574
+if ( ! function_exists('wp_validate_auth_cookie')) :
575 575
 /**
576 576
  * Validates authentication cookie.
577 577
  *
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
  * @return false|int False if invalid cookie, User ID if valid.
591 591
  */
592 592
 function wp_validate_auth_cookie($cookie = '', $scheme = '') {
593
-	if ( ! $cookie_elements = wp_parse_auth_cookie($cookie, $scheme) ) {
593
+	if ( ! $cookie_elements = wp_parse_auth_cookie($cookie, $scheme)) {
594 594
 		/**
595 595
 		 * Fires if an authentication cookie is malformed.
596 596
 		 *
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
 		 * @param string $scheme Authentication scheme. Values include 'auth', 'secure_auth',
601 601
 		 *                       or 'logged_in'.
602 602
 		 */
603
-		do_action( 'auth_cookie_malformed', $cookie, $scheme );
603
+		do_action('auth_cookie_malformed', $cookie, $scheme);
604 604
 		return false;
605 605
 	}
606 606
 
@@ -611,12 +611,12 @@  discard block
 block discarded – undo
611 611
 	$expired = $expiration = $cookie_elements['expiration'];
612 612
 
613 613
 	// Allow a grace period for POST and AJAX requests
614
-	if ( defined('DOING_AJAX') || 'POST' == $_SERVER['REQUEST_METHOD'] ) {
614
+	if (defined('DOING_AJAX') || 'POST' == $_SERVER['REQUEST_METHOD']) {
615 615
 		$expired += HOUR_IN_SECONDS;
616 616
 	}
617 617
 
618 618
 	// Quick check to see if an honest cookie has expired
619
-	if ( $expired < time() ) {
619
+	if ($expired < time()) {
620 620
 		/**
621 621
 		 * Fires once an authentication cookie has expired.
622 622
 		 *
@@ -624,12 +624,12 @@  discard block
 block discarded – undo
624 624
 		 *
625 625
 		 * @param array $cookie_elements An array of data for the authentication cookie.
626 626
 		 */
627
-		do_action( 'auth_cookie_expired', $cookie_elements );
627
+		do_action('auth_cookie_expired', $cookie_elements);
628 628
 		return false;
629 629
 	}
630 630
 
631 631
 	$user = get_user_by('login', $username);
632
-	if ( ! $user ) {
632
+	if ( ! $user) {
633 633
 		/**
634 634
 		 * Fires if a bad username is entered in the user authentication process.
635 635
 		 *
@@ -637,19 +637,19 @@  discard block
 block discarded – undo
637 637
 		 *
638 638
 		 * @param array $cookie_elements An array of data for the authentication cookie.
639 639
 		 */
640
-		do_action( 'auth_cookie_bad_username', $cookie_elements );
640
+		do_action('auth_cookie_bad_username', $cookie_elements);
641 641
 		return false;
642 642
 	}
643 643
 
644 644
 	$pass_frag = substr($user->user_pass, 8, 4);
645 645
 
646
-	$key = wp_hash( $username . '|' . $pass_frag . '|' . $expiration . '|' . $token, $scheme );
646
+	$key = wp_hash($username.'|'.$pass_frag.'|'.$expiration.'|'.$token, $scheme);
647 647
 
648 648
 	// If ext/hash is not present, compat.php's hash_hmac() does not support sha256.
649
-	$algo = function_exists( 'hash' ) ? 'sha256' : 'sha1';
650
-	$hash = hash_hmac( $algo, $username . '|' . $expiration . '|' . $token, $key );
649
+	$algo = function_exists('hash') ? 'sha256' : 'sha1';
650
+	$hash = hash_hmac($algo, $username.'|'.$expiration.'|'.$token, $key);
651 651
 
652
-	if ( ! hash_equals( $hash, $hmac ) ) {
652
+	if ( ! hash_equals($hash, $hmac)) {
653 653
 		/**
654 654
 		 * Fires if a bad authentication cookie hash is encountered.
655 655
 		 *
@@ -657,18 +657,18 @@  discard block
 block discarded – undo
657 657
 		 *
658 658
 		 * @param array $cookie_elements An array of data for the authentication cookie.
659 659
 		 */
660
-		do_action( 'auth_cookie_bad_hash', $cookie_elements );
660
+		do_action('auth_cookie_bad_hash', $cookie_elements);
661 661
 		return false;
662 662
 	}
663 663
 
664
-	$manager = WP_Session_Tokens::get_instance( $user->ID );
665
-	if ( ! $manager->verify( $token ) ) {
666
-		do_action( 'auth_cookie_bad_session_token', $cookie_elements );
664
+	$manager = WP_Session_Tokens::get_instance($user->ID);
665
+	if ( ! $manager->verify($token)) {
666
+		do_action('auth_cookie_bad_session_token', $cookie_elements);
667 667
 		return false;
668 668
 	}
669 669
 
670 670
 	// AJAX/POST grace period set above
671
-	if ( $expiration < time() ) {
671
+	if ($expiration < time()) {
672 672
 		$GLOBALS['login_grace_period'] = 1;
673 673
 	}
674 674
 
@@ -680,13 +680,13 @@  discard block
 block discarded – undo
680 680
 	 * @param array   $cookie_elements An array of data for the authentication cookie.
681 681
 	 * @param WP_User $user            User object.
682 682
 	 */
683
-	do_action( 'auth_cookie_valid', $cookie_elements, $user );
683
+	do_action('auth_cookie_valid', $cookie_elements, $user);
684 684
 
685 685
 	return $user->ID;
686 686
 }
687 687
 endif;
688 688
 
689
-if ( !function_exists('wp_generate_auth_cookie') ) :
689
+if ( ! function_exists('wp_generate_auth_cookie')) :
690 690
 /**
691 691
  * Generate authentication cookie contents.
692 692
  *
@@ -698,26 +698,26 @@  discard block
 block discarded – undo
698 698
  * @param string $token      User's session token to use for this cookie
699 699
  * @return string Authentication cookie contents. Empty string if user does not exist.
700 700
  */
701
-function wp_generate_auth_cookie( $user_id, $expiration, $scheme = 'auth', $token = '' ) {
701
+function wp_generate_auth_cookie($user_id, $expiration, $scheme = 'auth', $token = '') {
702 702
 	$user = get_userdata($user_id);
703
-	if ( ! $user ) {
703
+	if ( ! $user) {
704 704
 		return '';
705 705
 	}
706 706
 
707
-	if ( ! $token ) {
708
-		$manager = WP_Session_Tokens::get_instance( $user_id );
709
-		$token = $manager->create( $expiration );
707
+	if ( ! $token) {
708
+		$manager = WP_Session_Tokens::get_instance($user_id);
709
+		$token = $manager->create($expiration);
710 710
 	}
711 711
 
712 712
 	$pass_frag = substr($user->user_pass, 8, 4);
713 713
 
714
-	$key = wp_hash( $user->user_login . '|' . $pass_frag . '|' . $expiration . '|' . $token, $scheme );
714
+	$key = wp_hash($user->user_login.'|'.$pass_frag.'|'.$expiration.'|'.$token, $scheme);
715 715
 
716 716
 	// If ext/hash is not present, compat.php's hash_hmac() does not support sha256.
717
-	$algo = function_exists( 'hash' ) ? 'sha256' : 'sha1';
718
-	$hash = hash_hmac( $algo, $user->user_login . '|' . $expiration . '|' . $token, $key );
717
+	$algo = function_exists('hash') ? 'sha256' : 'sha1';
718
+	$hash = hash_hmac($algo, $user->user_login.'|'.$expiration.'|'.$token, $key);
719 719
 
720
-	$cookie = $user->user_login . '|' . $expiration . '|' . $token . '|' . $hash;
720
+	$cookie = $user->user_login.'|'.$expiration.'|'.$token.'|'.$hash;
721 721
 
722 722
 	/**
723 723
 	 * Filter the authentication cookie.
@@ -730,11 +730,11 @@  discard block
 block discarded – undo
730 730
 	 * @param string $scheme     Cookie scheme used. Accepts 'auth', 'secure_auth', or 'logged_in'.
731 731
 	 * @param string $token      User's session token used.
732 732
 	 */
733
-	return apply_filters( 'auth_cookie', $cookie, $user_id, $expiration, $scheme, $token );
733
+	return apply_filters('auth_cookie', $cookie, $user_id, $expiration, $scheme, $token);
734 734
 }
735 735
 endif;
736 736
 
737
-if ( !function_exists('wp_parse_auth_cookie') ) :
737
+if ( ! function_exists('wp_parse_auth_cookie')) :
738 738
 /**
739 739
  * Parse a cookie into its components
740 740
  *
@@ -745,8 +745,8 @@  discard block
 block discarded – undo
745 745
  * @return array|false Authentication cookie components
746 746
  */
747 747
 function wp_parse_auth_cookie($cookie = '', $scheme = '') {
748
-	if ( empty($cookie) ) {
749
-		switch ($scheme){
748
+	if (empty($cookie)) {
749
+		switch ($scheme) {
750 750
 			case 'auth':
751 751
 				$cookie_name = AUTH_COOKIE;
752 752
 				break;
@@ -757,7 +757,7 @@  discard block
 block discarded – undo
757 757
 				$cookie_name = LOGGED_IN_COOKIE;
758 758
 				break;
759 759
 			default:
760
-				if ( is_ssl() ) {
760
+				if (is_ssl()) {
761 761
 					$cookie_name = SECURE_AUTH_COOKIE;
762 762
 					$scheme = 'secure_auth';
763 763
 				} else {
@@ -766,23 +766,23 @@  discard block
 block discarded – undo
766 766
 				}
767 767
 	    }
768 768
 
769
-		if ( empty($_COOKIE[$cookie_name]) )
769
+		if (empty($_COOKIE[$cookie_name]))
770 770
 			return false;
771 771
 		$cookie = $_COOKIE[$cookie_name];
772 772
 	}
773 773
 
774 774
 	$cookie_elements = explode('|', $cookie);
775
-	if ( count( $cookie_elements ) !== 4 ) {
775
+	if (count($cookie_elements) !== 4) {
776 776
 		return false;
777 777
 	}
778 778
 
779
-	list( $username, $expiration, $token, $hmac ) = $cookie_elements;
779
+	list($username, $expiration, $token, $hmac) = $cookie_elements;
780 780
 
781
-	return compact( 'username', 'expiration', 'token', 'hmac', 'scheme' );
781
+	return compact('username', 'expiration', 'token', 'hmac', 'scheme');
782 782
 }
783 783
 endif;
784 784
 
785
-if ( !function_exists('wp_set_auth_cookie') ) :
785
+if ( ! function_exists('wp_set_auth_cookie')) :
786 786
 /**
787 787
  * Log in a user by setting authentication cookies.
788 788
  *
@@ -799,8 +799,8 @@  discard block
 block discarded – undo
799 799
  *                         Default is_ssl().
800 800
  * @param string $token    Optional. User's session token to use for this cookie.
801 801
  */
802
-function wp_set_auth_cookie( $user_id, $remember = false, $secure = '', $token = '' ) {
803
-	if ( $remember ) {
802
+function wp_set_auth_cookie($user_id, $remember = false, $secure = '', $token = '') {
803
+	if ($remember) {
804 804
 		/**
805 805
 		 * Filter the duration of the authentication cookie expiration period.
806 806
 		 *
@@ -810,25 +810,25 @@  discard block
 block discarded – undo
810 810
 		 * @param int  $user_id  User ID.
811 811
 		 * @param bool $remember Whether to remember the user login. Default false.
812 812
 		 */
813
-		$expiration = time() + apply_filters( 'auth_cookie_expiration', 14 * DAY_IN_SECONDS, $user_id, $remember );
813
+		$expiration = time() + apply_filters('auth_cookie_expiration', 14 * DAY_IN_SECONDS, $user_id, $remember);
814 814
 
815 815
 		/*
816 816
 		 * Ensure the browser will continue to send the cookie after the expiration time is reached.
817 817
 		 * Needed for the login grace period in wp_validate_auth_cookie().
818 818
 		 */
819
-		$expire = $expiration + ( 12 * HOUR_IN_SECONDS );
819
+		$expire = $expiration + (12 * HOUR_IN_SECONDS);
820 820
 	} else {
821 821
 		/** This filter is documented in wp-includes/pluggable.php */
822
-		$expiration = time() + apply_filters( 'auth_cookie_expiration', 2 * DAY_IN_SECONDS, $user_id, $remember );
822
+		$expiration = time() + apply_filters('auth_cookie_expiration', 2 * DAY_IN_SECONDS, $user_id, $remember);
823 823
 		$expire = 0;
824 824
 	}
825 825
 
826
-	if ( '' === $secure ) {
826
+	if ('' === $secure) {
827 827
 		$secure = is_ssl();
828 828
 	}
829 829
 
830 830
 	// Front-end cookie is secure when the auth cookie is secure and the site's home URL is forced HTTPS.
831
-	$secure_logged_in_cookie = $secure && 'https' === parse_url( get_option( 'home' ), PHP_URL_SCHEME );
831
+	$secure_logged_in_cookie = $secure && 'https' === parse_url(get_option('home'), PHP_URL_SCHEME);
832 832
 
833 833
 	/**
834 834
 	 * Filter whether the connection is secure.
@@ -838,7 +838,7 @@  discard block
 block discarded – undo
838 838
 	 * @param bool $secure  Whether the connection is secure.
839 839
 	 * @param int  $user_id User ID.
840 840
 	 */
841
-	$secure = apply_filters( 'secure_auth_cookie', $secure, $user_id );
841
+	$secure = apply_filters('secure_auth_cookie', $secure, $user_id);
842 842
 
843 843
 	/**
844 844
 	 * Filter whether to use a secure cookie when logged-in.
@@ -849,9 +849,9 @@  discard block
 block discarded – undo
849 849
 	 * @param int  $user_id                 User ID.
850 850
 	 * @param bool $secure                  Whether the connection is secure.
851 851
 	 */
852
-	$secure_logged_in_cookie = apply_filters( 'secure_logged_in_cookie', $secure_logged_in_cookie, $user_id, $secure );
852
+	$secure_logged_in_cookie = apply_filters('secure_logged_in_cookie', $secure_logged_in_cookie, $user_id, $secure);
853 853
 
854
-	if ( $secure ) {
854
+	if ($secure) {
855 855
 		$auth_cookie_name = SECURE_AUTH_COOKIE;
856 856
 		$scheme = 'secure_auth';
857 857
 	} else {
@@ -859,13 +859,13 @@  discard block
 block discarded – undo
859 859
 		$scheme = 'auth';
860 860
 	}
861 861
 
862
-	if ( '' === $token ) {
863
-		$manager = WP_Session_Tokens::get_instance( $user_id );
864
-		$token   = $manager->create( $expiration );
862
+	if ('' === $token) {
863
+		$manager = WP_Session_Tokens::get_instance($user_id);
864
+		$token   = $manager->create($expiration);
865 865
 	}
866 866
 
867
-	$auth_cookie = wp_generate_auth_cookie( $user_id, $expiration, $scheme, $token );
868
-	$logged_in_cookie = wp_generate_auth_cookie( $user_id, $expiration, 'logged_in', $token );
867
+	$auth_cookie = wp_generate_auth_cookie($user_id, $expiration, $scheme, $token);
868
+	$logged_in_cookie = wp_generate_auth_cookie($user_id, $expiration, 'logged_in', $token);
869 869
 
870 870
 	/**
871 871
 	 * Fires immediately before the authentication cookie is set.
@@ -879,7 +879,7 @@  discard block
 block discarded – undo
879 879
 	 * @param int    $user_id     User ID.
880 880
 	 * @param string $scheme      Authentication scheme. Values include 'auth', 'secure_auth', or 'logged_in'.
881 881
 	 */
882
-	do_action( 'set_auth_cookie', $auth_cookie, $expire, $expiration, $user_id, $scheme );
882
+	do_action('set_auth_cookie', $auth_cookie, $expire, $expiration, $user_id, $scheme);
883 883
 
884 884
 	/**
885 885
 	 * Fires immediately before the secure authentication cookie is set.
@@ -893,17 +893,17 @@  discard block
 block discarded – undo
893 893
 	 * @param int    $user_id          User ID.
894 894
 	 * @param string $scheme           Authentication scheme. Default 'logged_in'.
895 895
 	 */
896
-	do_action( 'set_logged_in_cookie', $logged_in_cookie, $expire, $expiration, $user_id, 'logged_in' );
896
+	do_action('set_logged_in_cookie', $logged_in_cookie, $expire, $expiration, $user_id, 'logged_in');
897 897
 
898 898
 	setcookie($auth_cookie_name, $auth_cookie, $expire, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN, $secure, true);
899 899
 	setcookie($auth_cookie_name, $auth_cookie, $expire, ADMIN_COOKIE_PATH, COOKIE_DOMAIN, $secure, true);
900 900
 	setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, COOKIEPATH, COOKIE_DOMAIN, $secure_logged_in_cookie, true);
901
-	if ( COOKIEPATH != SITECOOKIEPATH )
901
+	if (COOKIEPATH != SITECOOKIEPATH)
902 902
 		setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, SITECOOKIEPATH, COOKIE_DOMAIN, $secure_logged_in_cookie, true);
903 903
 }
904 904
 endif;
905 905
 
906
-if ( !function_exists('wp_clear_auth_cookie') ) :
906
+if ( ! function_exists('wp_clear_auth_cookie')) :
907 907
 /**
908 908
  * Removes all of the cookies associated with authentication.
909 909
  *
@@ -915,30 +915,30 @@  discard block
 block discarded – undo
915 915
 	 *
916 916
 	 * @since 2.7.0
917 917
 	 */
918
-	do_action( 'clear_auth_cookie' );
918
+	do_action('clear_auth_cookie');
919 919
 
920
-	setcookie( AUTH_COOKIE,        ' ', time() - YEAR_IN_SECONDS, ADMIN_COOKIE_PATH,   COOKIE_DOMAIN );
921
-	setcookie( SECURE_AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, ADMIN_COOKIE_PATH,   COOKIE_DOMAIN );
922
-	setcookie( AUTH_COOKIE,        ' ', time() - YEAR_IN_SECONDS, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN );
923
-	setcookie( SECURE_AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN );
924
-	setcookie( LOGGED_IN_COOKIE,   ' ', time() - YEAR_IN_SECONDS, COOKIEPATH,          COOKIE_DOMAIN );
925
-	setcookie( LOGGED_IN_COOKIE,   ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH,      COOKIE_DOMAIN );
920
+	setcookie(AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, ADMIN_COOKIE_PATH, COOKIE_DOMAIN);
921
+	setcookie(SECURE_AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, ADMIN_COOKIE_PATH, COOKIE_DOMAIN);
922
+	setcookie(AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN);
923
+	setcookie(SECURE_AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN);
924
+	setcookie(LOGGED_IN_COOKIE, ' ', time() - YEAR_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN);
925
+	setcookie(LOGGED_IN_COOKIE, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN);
926 926
 
927 927
 	// Old cookies
928
-	setcookie( AUTH_COOKIE,        ' ', time() - YEAR_IN_SECONDS, COOKIEPATH,     COOKIE_DOMAIN );
929
-	setcookie( AUTH_COOKIE,        ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN );
930
-	setcookie( SECURE_AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, COOKIEPATH,     COOKIE_DOMAIN );
931
-	setcookie( SECURE_AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN );
928
+	setcookie(AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN);
929
+	setcookie(AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN);
930
+	setcookie(SECURE_AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN);
931
+	setcookie(SECURE_AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN);
932 932
 
933 933
 	// Even older cookies
934
-	setcookie( USER_COOKIE, ' ', time() - YEAR_IN_SECONDS, COOKIEPATH,     COOKIE_DOMAIN );
935
-	setcookie( PASS_COOKIE, ' ', time() - YEAR_IN_SECONDS, COOKIEPATH,     COOKIE_DOMAIN );
936
-	setcookie( USER_COOKIE, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN );
937
-	setcookie( PASS_COOKIE, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN );
934
+	setcookie(USER_COOKIE, ' ', time() - YEAR_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN);
935
+	setcookie(PASS_COOKIE, ' ', time() - YEAR_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN);
936
+	setcookie(USER_COOKIE, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN);
937
+	setcookie(PASS_COOKIE, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN);
938 938
 }
939 939
 endif;
940 940
 
941
-if ( !function_exists('is_user_logged_in') ) :
941
+if ( ! function_exists('is_user_logged_in')) :
942 942
 /**
943 943
  * Checks if the current visitor is a logged in user.
944 944
  *
@@ -953,7 +953,7 @@  discard block
 block discarded – undo
953 953
 }
954 954
 endif;
955 955
 
956
-if ( !function_exists('auth_redirect') ) :
956
+if ( ! function_exists('auth_redirect')) :
957 957
 /**
958 958
  * Checks if a user is logged in, if not it redirects them to the login page.
959 959
  *
@@ -962,7 +962,7 @@  discard block
 block discarded – undo
962 962
 function auth_redirect() {
963 963
 	// Checks if a user is logged in, if not redirects them to the login page
964 964
 
965
-	$secure = ( is_ssl() || force_ssl_admin() );
965
+	$secure = (is_ssl() || force_ssl_admin());
966 966
 
967 967
 	/**
968 968
 	 * Filter whether to use a secure authentication redirect.
@@ -971,20 +971,20 @@  discard block
 block discarded – undo
971 971
 	 *
972 972
 	 * @param bool $secure Whether to use a secure authentication redirect. Default false.
973 973
 	 */
974
-	$secure = apply_filters( 'secure_auth_redirect', $secure );
974
+	$secure = apply_filters('secure_auth_redirect', $secure);
975 975
 
976 976
 	// If https is required and request is http, redirect
977
-	if ( $secure && !is_ssl() && false !== strpos($_SERVER['REQUEST_URI'], 'wp-admin') ) {
978
-		if ( 0 === strpos( $_SERVER['REQUEST_URI'], 'http' ) ) {
979
-			wp_redirect( set_url_scheme( $_SERVER['REQUEST_URI'], 'https' ) );
977
+	if ($secure && ! is_ssl() && false !== strpos($_SERVER['REQUEST_URI'], 'wp-admin')) {
978
+		if (0 === strpos($_SERVER['REQUEST_URI'], 'http')) {
979
+			wp_redirect(set_url_scheme($_SERVER['REQUEST_URI'], 'https'));
980 980
 			exit();
981 981
 		} else {
982
-			wp_redirect( 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
982
+			wp_redirect('https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
983 983
 			exit();
984 984
 		}
985 985
 	}
986 986
 
987
-	if ( is_user_admin() ) {
987
+	if (is_user_admin()) {
988 988
 		$scheme = 'logged_in';
989 989
 	} else {
990 990
 		/**
@@ -994,10 +994,10 @@  discard block
 block discarded – undo
994 994
 		 *
995 995
 		 * @param string $scheme Authentication redirect scheme. Default empty.
996 996
 		 */
997
-		$scheme = apply_filters( 'auth_redirect_scheme', '' );
997
+		$scheme = apply_filters('auth_redirect_scheme', '');
998 998
 	}
999 999
 
1000
-	if ( $user_id = wp_validate_auth_cookie( '',  $scheme) ) {
1000
+	if ($user_id = wp_validate_auth_cookie('', $scheme)) {
1001 1001
 		/**
1002 1002
 		 * Fires before the authentication redirect.
1003 1003
 		 *
@@ -1005,26 +1005,26 @@  discard block
 block discarded – undo
1005 1005
 		 *
1006 1006
 		 * @param int $user_id User ID.
1007 1007
 		 */
1008
-		do_action( 'auth_redirect', $user_id );
1008
+		do_action('auth_redirect', $user_id);
1009 1009
 
1010 1010
 		// If the user wants ssl but the session is not ssl, redirect.
1011
-		if ( !$secure && get_user_option('use_ssl', $user_id) && false !== strpos($_SERVER['REQUEST_URI'], 'wp-admin') ) {
1012
-			if ( 0 === strpos( $_SERVER['REQUEST_URI'], 'http' ) ) {
1013
-				wp_redirect( set_url_scheme( $_SERVER['REQUEST_URI'], 'https' ) );
1011
+		if ( ! $secure && get_user_option('use_ssl', $user_id) && false !== strpos($_SERVER['REQUEST_URI'], 'wp-admin')) {
1012
+			if (0 === strpos($_SERVER['REQUEST_URI'], 'http')) {
1013
+				wp_redirect(set_url_scheme($_SERVER['REQUEST_URI'], 'https'));
1014 1014
 				exit();
1015 1015
 			} else {
1016
-				wp_redirect( 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
1016
+				wp_redirect('https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
1017 1017
 				exit();
1018 1018
 			}
1019 1019
 		}
1020 1020
 
1021
-		return;  // The cookie is good so we're done
1021
+		return; // The cookie is good so we're done
1022 1022
 	}
1023 1023
 
1024 1024
 	// The cookie is no good so force login
1025 1025
 	nocache_headers();
1026 1026
 
1027
-	$redirect = ( strpos( $_SERVER['REQUEST_URI'], '/options.php' ) && wp_get_referer() ) ? wp_get_referer() : set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
1027
+	$redirect = (strpos($_SERVER['REQUEST_URI'], '/options.php') && wp_get_referer()) ? wp_get_referer() : set_url_scheme('http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
1028 1028
 
1029 1029
 	$login_url = wp_login_url($redirect, true);
1030 1030
 
@@ -1033,7 +1033,7 @@  discard block
 block discarded – undo
1033 1033
 }
1034 1034
 endif;
1035 1035
 
1036
-if ( !function_exists('check_admin_referer') ) :
1036
+if ( ! function_exists('check_admin_referer')) :
1037 1037
 /**
1038 1038
  * Makes sure that a user was referred from another admin page.
1039 1039
  *
@@ -1047,9 +1047,9 @@  discard block
 block discarded – undo
1047 1047
  * @return false|int False if the nonce is invalid, 1 if the nonce is valid and generated between
1048 1048
  *                   0-12 hours ago, 2 if the nonce is valid and generated between 12-24 hours ago.
1049 1049
  */
1050
-function check_admin_referer( $action = -1, $query_arg = '_wpnonce' ) {
1050
+function check_admin_referer($action = -1, $query_arg = '_wpnonce') {
1051 1051
 	if ( -1 == $action )
1052
-		_doing_it_wrong( __FUNCTION__, __( 'You should specify a nonce action to be verified by using the first parameter.' ), '3.2' );
1052
+		_doing_it_wrong(__FUNCTION__, __('You should specify a nonce action to be verified by using the first parameter.'), '3.2');
1053 1053
 
1054 1054
 	$adminurl = strtolower(admin_url());
1055 1055
 	$referer = strtolower(wp_get_referer());
@@ -1064,10 +1064,10 @@  discard block
 block discarded – undo
1064 1064
 	 * @param false|int $result False if the nonce is invalid, 1 if the nonce is valid and generated between
1065 1065
 	 *                          0-12 hours ago, 2 if the nonce is valid and generated between 12-24 hours ago.
1066 1066
 	 */
1067
-	do_action( 'check_admin_referer', $action, $result );
1067
+	do_action('check_admin_referer', $action, $result);
1068 1068
 
1069
-	if ( ! $result && ! ( -1 == $action && strpos( $referer, $adminurl ) === 0 ) ) {
1070
-		wp_nonce_ays( $action );
1069
+	if ( ! $result && ! ( -1 == $action && strpos($referer, $adminurl) === 0 )) {
1070
+		wp_nonce_ays($action);
1071 1071
 		die();
1072 1072
 	}
1073 1073
 
@@ -1075,7 +1075,7 @@  discard block
 block discarded – undo
1075 1075
 }
1076 1076
 endif;
1077 1077
 
1078
-if ( !function_exists('check_ajax_referer') ) :
1078
+if ( ! function_exists('check_ajax_referer')) :
1079 1079
 /**
1080 1080
  * Verifies the AJAX request to prevent processing requests external of the blog.
1081 1081
  *
@@ -1090,17 +1090,17 @@  discard block
 block discarded – undo
1090 1090
  * @return false|int False if the nonce is invalid, 1 if the nonce is valid and generated between
1091 1091
  *                   0-12 hours ago, 2 if the nonce is valid and generated between 12-24 hours ago.
1092 1092
  */
1093
-function check_ajax_referer( $action = -1, $query_arg = false, $die = true ) {
1093
+function check_ajax_referer($action = -1, $query_arg = false, $die = true) {
1094 1094
 	$nonce = '';
1095 1095
 
1096
-	if ( $query_arg && isset( $_REQUEST[ $query_arg ] ) )
1097
-		$nonce = $_REQUEST[ $query_arg ];
1098
-	elseif ( isset( $_REQUEST['_ajax_nonce'] ) )
1096
+	if ($query_arg && isset($_REQUEST[$query_arg]))
1097
+		$nonce = $_REQUEST[$query_arg];
1098
+	elseif (isset($_REQUEST['_ajax_nonce']))
1099 1099
 		$nonce = $_REQUEST['_ajax_nonce'];
1100
-	elseif ( isset( $_REQUEST['_wpnonce'] ) )
1100
+	elseif (isset($_REQUEST['_wpnonce']))
1101 1101
 		$nonce = $_REQUEST['_wpnonce'];
1102 1102
 
1103
-	$result = wp_verify_nonce( $nonce, $action );
1103
+	$result = wp_verify_nonce($nonce, $action);
1104 1104
 
1105 1105
 	/**
1106 1106
 	 * Fires once the AJAX request has been validated or not.
@@ -1111,13 +1111,13 @@  discard block
 block discarded – undo
1111 1111
 	 * @param false|int $result False if the nonce is invalid, 1 if the nonce is valid and generated between
1112 1112
 	 *                          0-12 hours ago, 2 if the nonce is valid and generated between 12-24 hours ago.
1113 1113
 	 */
1114
-	do_action( 'check_ajax_referer', $action, $result );
1114
+	do_action('check_ajax_referer', $action, $result);
1115 1115
 
1116
-	if ( $die && false === $result ) {
1117
-		if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
1116
+	if ($die && false === $result) {
1117
+		if (defined('DOING_AJAX') && DOING_AJAX) {
1118 1118
 			wp_die( -1 );
1119 1119
 		} else {
1120
-			die( '-1' );
1120
+			die('-1');
1121 1121
 		}
1122 1122
 	}
1123 1123
 
@@ -1125,7 +1125,7 @@  discard block
 block discarded – undo
1125 1125
 }
1126 1126
 endif;
1127 1127
 
1128
-if ( !function_exists('wp_redirect') ) :
1128
+if ( ! function_exists('wp_redirect')) :
1129 1129
 /**
1130 1130
  * Redirects to another page.
1131 1131
  *
@@ -1148,7 +1148,7 @@  discard block
 block discarded – undo
1148 1148
 	 * @param string $location The path to redirect to.
1149 1149
 	 * @param int    $status   Status code to use.
1150 1150
 	 */
1151
-	$location = apply_filters( 'wp_redirect', $location, $status );
1151
+	$location = apply_filters('wp_redirect', $location, $status);
1152 1152
 
1153 1153
 	/**
1154 1154
 	 * Filter the redirect status code.
@@ -1158,14 +1158,14 @@  discard block
 block discarded – undo
1158 1158
 	 * @param int    $status   Status code to use.
1159 1159
 	 * @param string $location The path to redirect to.
1160 1160
 	 */
1161
-	$status = apply_filters( 'wp_redirect_status', $status, $location );
1161
+	$status = apply_filters('wp_redirect_status', $status, $location);
1162 1162
 
1163
-	if ( ! $location )
1163
+	if ( ! $location)
1164 1164
 		return false;
1165 1165
 
1166 1166
 	$location = wp_sanitize_redirect($location);
1167 1167
 
1168
-	if ( !$is_IIS && PHP_SAPI != 'cgi-fcgi' )
1168
+	if ( ! $is_IIS && PHP_SAPI != 'cgi-fcgi')
1169 1169
 		status_header($status); // This causes problems on IIS and some FastCGI setups
1170 1170
 
1171 1171
 	header("Location: $location", true, $status);
@@ -1174,7 +1174,7 @@  discard block
 block discarded – undo
1174 1174
 }
1175 1175
 endif;
1176 1176
 
1177
-if ( !function_exists('wp_sanitize_redirect') ) :
1177
+if ( ! function_exists('wp_sanitize_redirect')) :
1178 1178
 /**
1179 1179
  * Sanitizes a URL for use in a redirect.
1180 1180
  *
@@ -1196,13 +1196,13 @@  discard block
 block discarded – undo
1196 1196
 			|   \xF4[\x80-\x8F][\x80-\xBF]{2}
1197 1197
 		){1,40}                              # ...one or more times
1198 1198
 		)/x';
1199
-	$location = preg_replace_callback( $regex, '_wp_sanitize_utf8_in_redirect', $location );
1199
+	$location = preg_replace_callback($regex, '_wp_sanitize_utf8_in_redirect', $location);
1200 1200
 	$location = preg_replace('|[^a-z0-9-~+_.?#=&;,/:%!*\[\]()@]|i', '', $location);
1201 1201
 	$location = wp_kses_no_null($location);
1202 1202
 
1203 1203
 	// remove %0d and %0a from location
1204 1204
 	$strip = array('%0d', '%0a', '%0D', '%0A');
1205
-	return _deep_replace( $strip, $location );
1205
+	return _deep_replace($strip, $location);
1206 1206
 }
1207 1207
 
1208 1208
 /**
@@ -1217,12 +1217,12 @@  discard block
 block discarded – undo
1217 1217
  * @param array $matches RegEx matches against the redirect location.
1218 1218
  * @return string URL-encoded version of the first RegEx match.
1219 1219
  */
1220
-function _wp_sanitize_utf8_in_redirect( $matches ) {
1221
-	return urlencode( $matches[0] );
1220
+function _wp_sanitize_utf8_in_redirect($matches) {
1221
+	return urlencode($matches[0]);
1222 1222
 }
1223 1223
 endif;
1224 1224
 
1225
-if ( !function_exists('wp_safe_redirect') ) :
1225
+if ( ! function_exists('wp_safe_redirect')) :
1226 1226
 /**
1227 1227
  * Performs a safe (local) redirect, using wp_redirect().
1228 1228
  *
@@ -1252,13 +1252,13 @@  discard block
 block discarded – undo
1252 1252
 	 * @param string $fallback_url The fallback URL to use by default.
1253 1253
 	 * @param int    $status       The redirect status.
1254 1254
 	 */
1255
-	$location = wp_validate_redirect( $location, apply_filters( 'wp_safe_redirect_fallback', admin_url(), $status ) );
1255
+	$location = wp_validate_redirect($location, apply_filters('wp_safe_redirect_fallback', admin_url(), $status));
1256 1256
 
1257 1257
 	wp_redirect($location, $status);
1258 1258
 }
1259 1259
 endif;
1260 1260
 
1261
-if ( !function_exists('wp_validate_redirect') ) :
1261
+if ( ! function_exists('wp_validate_redirect')) :
1262 1262
 /**
1263 1263
  * Validates a URL for use in a redirect.
1264 1264
  *
@@ -1275,33 +1275,33 @@  discard block
 block discarded – undo
1275 1275
  * @return string redirect-sanitized URL
1276 1276
  **/
1277 1277
 function wp_validate_redirect($location, $default = '') {
1278
-	$location = trim( $location );
1278
+	$location = trim($location);
1279 1279
 	// browsers will assume 'http' is your protocol, and will obey a redirect to a URL starting with '//'
1280
-	if ( substr($location, 0, 2) == '//' )
1281
-		$location = 'http:' . $location;
1280
+	if (substr($location, 0, 2) == '//')
1281
+		$location = 'http:'.$location;
1282 1282
 
1283 1283
 	// In php 5 parse_url may fail if the URL query part contains http://, bug #38143
1284
-	$test = ( $cut = strpos($location, '?') ) ? substr( $location, 0, $cut ) : $location;
1284
+	$test = ($cut = strpos($location, '?')) ? substr($location, 0, $cut) : $location;
1285 1285
 
1286 1286
 	// @-operator is used to prevent possible warnings in PHP < 5.3.3.
1287 1287
 	$lp = @parse_url($test);
1288 1288
 
1289 1289
 	// Give up if malformed URL
1290
-	if ( false === $lp )
1290
+	if (false === $lp)
1291 1291
 		return $default;
1292 1292
 
1293 1293
 	// Allow only http and https schemes. No data:, etc.
1294
-	if ( isset($lp['scheme']) && !('http' == $lp['scheme'] || 'https' == $lp['scheme']) )
1294
+	if (isset($lp['scheme']) && ! ('http' == $lp['scheme'] || 'https' == $lp['scheme']))
1295 1295
 		return $default;
1296 1296
 
1297 1297
 	// Reject if certain components are set but host is not. This catches urls like https:host.com for which parse_url does not set the host field.
1298
-	if ( ! isset( $lp['host'] ) && ( isset( $lp['scheme'] ) || isset( $lp['user'] ) || isset( $lp['pass'] ) || isset( $lp['port'] ) ) ) {
1298
+	if ( ! isset($lp['host']) && (isset($lp['scheme']) || isset($lp['user']) || isset($lp['pass']) || isset($lp['port']))) {
1299 1299
 		return $default;
1300 1300
 	}
1301 1301
 
1302 1302
 	// Reject malformed components parse_url() can return on odd inputs.
1303
-	foreach ( array( 'user', 'pass', 'host' ) as $component ) {
1304
-		if ( isset( $lp[ $component ] ) && strpbrk( $lp[ $component ], ':/?#@' ) ) {
1303
+	foreach (array('user', 'pass', 'host') as $component) {
1304
+		if (isset($lp[$component]) && strpbrk($lp[$component], ':/?#@')) {
1305 1305
 			return $default;
1306 1306
 		}
1307 1307
 	}
@@ -1316,16 +1316,16 @@  discard block
 block discarded – undo
1316 1316
 	 * @param array       $hosts An array of allowed hosts.
1317 1317
 	 * @param bool|string $host  The parsed host; empty if not isset.
1318 1318
 	 */
1319
-	$allowed_hosts = (array) apply_filters( 'allowed_redirect_hosts', array($wpp['host']), isset($lp['host']) ? $lp['host'] : '' );
1319
+	$allowed_hosts = (array) apply_filters('allowed_redirect_hosts', array($wpp['host']), isset($lp['host']) ? $lp['host'] : '');
1320 1320
 
1321
-	if ( isset($lp['host']) && ( !in_array($lp['host'], $allowed_hosts) && $lp['host'] != strtolower($wpp['host'])) )
1321
+	if (isset($lp['host']) && ( ! in_array($lp['host'], $allowed_hosts) && $lp['host'] != strtolower($wpp['host'])))
1322 1322
 		$location = $default;
1323 1323
 
1324 1324
 	return $location;
1325 1325
 }
1326 1326
 endif;
1327 1327
 
1328
-if ( ! function_exists('wp_notify_postauthor') ) :
1328
+if ( ! function_exists('wp_notify_postauthor')) :
1329 1329
 /**
1330 1330
  * Notify an author (and/or others) of a comment/trackback/pingback on a post.
1331 1331
  *
@@ -1335,21 +1335,21 @@  discard block
 block discarded – undo
1335 1335
  * @param string          $deprecated Not used
1336 1336
  * @return bool True on completion. False if no email addresses were specified.
1337 1337
  */
1338
-function wp_notify_postauthor( $comment_id, $deprecated = null ) {
1339
-	if ( null !== $deprecated ) {
1340
-		_deprecated_argument( __FUNCTION__, '3.8' );
1338
+function wp_notify_postauthor($comment_id, $deprecated = null) {
1339
+	if (null !== $deprecated) {
1340
+		_deprecated_argument(__FUNCTION__, '3.8');
1341 1341
 	}
1342 1342
 
1343
-	$comment = get_comment( $comment_id );
1344
-	if ( empty( $comment ) || empty( $comment->comment_post_ID ) )
1343
+	$comment = get_comment($comment_id);
1344
+	if (empty($comment) || empty($comment->comment_post_ID))
1345 1345
 		return false;
1346 1346
 
1347
-	$post    = get_post( $comment->comment_post_ID );
1348
-	$author  = get_userdata( $post->post_author );
1347
+	$post    = get_post($comment->comment_post_ID);
1348
+	$author  = get_userdata($post->post_author);
1349 1349
 
1350 1350
 	// Who to notify? By default, just the post author, but others can be added.
1351 1351
 	$emails = array();
1352
-	if ( $author ) {
1352
+	if ($author) {
1353 1353
 		$emails[] = $author->user_email;
1354 1354
 	}
1355 1355
 
@@ -1364,16 +1364,16 @@  discard block
 block discarded – undo
1364 1364
 	 * @param array $emails     An array of email addresses to receive a comment notification.
1365 1365
 	 * @param int   $comment_id The comment ID.
1366 1366
 	 */
1367
-	$emails = apply_filters( 'comment_notification_recipients', $emails, $comment->comment_ID );
1368
-	$emails = array_filter( $emails );
1367
+	$emails = apply_filters('comment_notification_recipients', $emails, $comment->comment_ID);
1368
+	$emails = array_filter($emails);
1369 1369
 
1370 1370
 	// If there are no addresses to send the comment to, bail.
1371
-	if ( ! count( $emails ) ) {
1371
+	if ( ! count($emails)) {
1372 1372
 		return false;
1373 1373
 	}
1374 1374
 
1375 1375
 	// Facilitate unsetting below without knowing the keys.
1376
-	$emails = array_flip( $emails );
1376
+	$emails = array_flip($emails);
1377 1377
 
1378 1378
 	/**
1379 1379
 	 * Filter whether to notify comment authors of their comments on their own posts.
@@ -1387,28 +1387,28 @@  discard block
 block discarded – undo
1387 1387
 	 *                         Default false.
1388 1388
 	 * @param int  $comment_id The comment ID.
1389 1389
 	 */
1390
-	$notify_author = apply_filters( 'comment_notification_notify_author', false, $comment->comment_ID );
1390
+	$notify_author = apply_filters('comment_notification_notify_author', false, $comment->comment_ID);
1391 1391
 
1392 1392
 	// The comment was left by the author
1393
-	if ( $author && ! $notify_author && $comment->user_id == $post->post_author ) {
1394
-		unset( $emails[ $author->user_email ] );
1393
+	if ($author && ! $notify_author && $comment->user_id == $post->post_author) {
1394
+		unset($emails[$author->user_email]);
1395 1395
 	}
1396 1396
 
1397 1397
 	// The author moderated a comment on their own post
1398
-	if ( $author && ! $notify_author && $post->post_author == get_current_user_id() ) {
1399
-		unset( $emails[ $author->user_email ] );
1398
+	if ($author && ! $notify_author && $post->post_author == get_current_user_id()) {
1399
+		unset($emails[$author->user_email]);
1400 1400
 	}
1401 1401
 
1402 1402
 	// The post author is no longer a member of the blog
1403
-	if ( $author && ! $notify_author && ! user_can( $post->post_author, 'read_post', $post->ID ) ) {
1404
-		unset( $emails[ $author->user_email ] );
1403
+	if ($author && ! $notify_author && ! user_can($post->post_author, 'read_post', $post->ID)) {
1404
+		unset($emails[$author->user_email]);
1405 1405
 	}
1406 1406
 
1407 1407
 	// If there's no email to send the comment to, bail, otherwise flip array back around for use below
1408
-	if ( ! count( $emails ) ) {
1408
+	if ( ! count($emails)) {
1409 1409
 		return false;
1410 1410
 	} else {
1411
-		$emails = array_flip( $emails );
1411
+		$emails = array_flip($emails);
1412 1412
 	}
1413 1413
 
1414 1414
 	$comment_author_domain = @gethostbyaddr($comment->comment_author_IP);
@@ -1416,70 +1416,70 @@  discard block
 block discarded – undo
1416 1416
 	// The blogname option is escaped with esc_html on the way into the database in sanitize_option
1417 1417
 	// we want to reverse this for the plain text arena of emails.
1418 1418
 	$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
1419
-	$comment_content = wp_specialchars_decode( $comment->comment_content );
1419
+	$comment_content = wp_specialchars_decode($comment->comment_content);
1420 1420
 
1421
-	switch ( $comment->comment_type ) {
1421
+	switch ($comment->comment_type) {
1422 1422
 		case 'trackback':
1423
-			$notify_message  = sprintf( __( 'New trackback on your post "%s"' ), $post->post_title ) . "\r\n";
1423
+			$notify_message  = sprintf(__('New trackback on your post "%s"'), $post->post_title)."\r\n";
1424 1424
 			/* translators: 1: website name, 2: website IP, 3: website hostname */
1425
-			$notify_message .= sprintf( __('Website: %1$s (IP: %2$s, %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
1426
-			$notify_message .= sprintf( __( 'URL: %s' ), $comment->comment_author_url ) . "\r\n";
1427
-			$notify_message .= sprintf( __( 'Comment: %s' ), "\r\n" . $comment_content ) . "\r\n\r\n";
1428
-			$notify_message .= __( 'You can see all trackbacks on this post here:' ) . "\r\n";
1425
+			$notify_message .= sprintf(__('Website: %1$s (IP: %2$s, %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain)."\r\n";
1426
+			$notify_message .= sprintf(__('URL: %s'), $comment->comment_author_url)."\r\n";
1427
+			$notify_message .= sprintf(__('Comment: %s'), "\r\n".$comment_content)."\r\n\r\n";
1428
+			$notify_message .= __('You can see all trackbacks on this post here:')."\r\n";
1429 1429
 			/* translators: 1: blog name, 2: post title */
1430
-			$subject = sprintf( __('[%1$s] Trackback: "%2$s"'), $blogname, $post->post_title );
1430
+			$subject = sprintf(__('[%1$s] Trackback: "%2$s"'), $blogname, $post->post_title);
1431 1431
 			break;
1432 1432
 		case 'pingback':
1433
-			$notify_message  = sprintf( __( 'New pingback on your post "%s"' ), $post->post_title ) . "\r\n";
1433
+			$notify_message  = sprintf(__('New pingback on your post "%s"'), $post->post_title)."\r\n";
1434 1434
 			/* translators: 1: website name, 2: website IP, 3: website hostname */
1435
-			$notify_message .= sprintf( __('Website: %1$s (IP: %2$s, %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
1436
-			$notify_message .= sprintf( __( 'URL: %s' ), $comment->comment_author_url ) . "\r\n";
1437
-			$notify_message .= sprintf( __( 'Comment: %s' ), "\r\n" . $comment_content ) . "\r\n\r\n";
1438
-			$notify_message .= __( 'You can see all pingbacks on this post here:' ) . "\r\n";
1435
+			$notify_message .= sprintf(__('Website: %1$s (IP: %2$s, %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain)."\r\n";
1436
+			$notify_message .= sprintf(__('URL: %s'), $comment->comment_author_url)."\r\n";
1437
+			$notify_message .= sprintf(__('Comment: %s'), "\r\n".$comment_content)."\r\n\r\n";
1438
+			$notify_message .= __('You can see all pingbacks on this post here:')."\r\n";
1439 1439
 			/* translators: 1: blog name, 2: post title */
1440
-			$subject = sprintf( __('[%1$s] Pingback: "%2$s"'), $blogname, $post->post_title );
1440
+			$subject = sprintf(__('[%1$s] Pingback: "%2$s"'), $blogname, $post->post_title);
1441 1441
 			break;
1442 1442
 		default: // Comments
1443
-			$notify_message  = sprintf( __( 'New comment on your post "%s"' ), $post->post_title ) . "\r\n";
1443
+			$notify_message  = sprintf(__('New comment on your post "%s"'), $post->post_title)."\r\n";
1444 1444
 			/* translators: 1: comment author, 2: author IP, 3: author domain */
1445
-			$notify_message .= sprintf( __( 'Author: %1$s (IP: %2$s, %3$s)' ), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
1446
-			$notify_message .= sprintf( __( 'Email: %s' ), $comment->comment_author_email ) . "\r\n";
1447
-			$notify_message .= sprintf( __( 'URL: %s' ), $comment->comment_author_url ) . "\r\n";
1448
-			$notify_message .= sprintf( __('Comment: %s' ), "\r\n" . $comment_content ) . "\r\n\r\n";
1449
-			$notify_message .= __( 'You can see all comments on this post here:' ) . "\r\n";
1445
+			$notify_message .= sprintf(__('Author: %1$s (IP: %2$s, %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain)."\r\n";
1446
+			$notify_message .= sprintf(__('Email: %s'), $comment->comment_author_email)."\r\n";
1447
+			$notify_message .= sprintf(__('URL: %s'), $comment->comment_author_url)."\r\n";
1448
+			$notify_message .= sprintf(__('Comment: %s'), "\r\n".$comment_content)."\r\n\r\n";
1449
+			$notify_message .= __('You can see all comments on this post here:')."\r\n";
1450 1450
 			/* translators: 1: blog name, 2: post title */
1451
-			$subject = sprintf( __('[%1$s] Comment: "%2$s"'), $blogname, $post->post_title );
1451
+			$subject = sprintf(__('[%1$s] Comment: "%2$s"'), $blogname, $post->post_title);
1452 1452
 			break;
1453 1453
 	}
1454
-	$notify_message .= get_permalink($comment->comment_post_ID) . "#comments\r\n\r\n";
1455
-	$notify_message .= sprintf( __('Permalink: %s'), get_comment_link( $comment ) ) . "\r\n";
1454
+	$notify_message .= get_permalink($comment->comment_post_ID)."#comments\r\n\r\n";
1455
+	$notify_message .= sprintf(__('Permalink: %s'), get_comment_link($comment))."\r\n";
1456 1456
 
1457
-	if ( user_can( $post->post_author, 'edit_comment', $comment->comment_ID ) ) {
1458
-		if ( EMPTY_TRASH_DAYS ) {
1459
-			$notify_message .= sprintf( __( 'Trash it: %s' ), admin_url( "comment.php?action=trash&c={$comment->comment_ID}#wpbody-content" ) ) . "\r\n";
1457
+	if (user_can($post->post_author, 'edit_comment', $comment->comment_ID)) {
1458
+		if (EMPTY_TRASH_DAYS) {
1459
+			$notify_message .= sprintf(__('Trash it: %s'), admin_url("comment.php?action=trash&c={$comment->comment_ID}#wpbody-content"))."\r\n";
1460 1460
 		} else {
1461
-			$notify_message .= sprintf( __( 'Delete it: %s' ), admin_url( "comment.php?action=delete&c={$comment->comment_ID}#wpbody-content" ) ) . "\r\n";
1461
+			$notify_message .= sprintf(__('Delete it: %s'), admin_url("comment.php?action=delete&c={$comment->comment_ID}#wpbody-content"))."\r\n";
1462 1462
 		}
1463
-		$notify_message .= sprintf( __( 'Spam it: %s' ), admin_url( "comment.php?action=spam&c={$comment->comment_ID}#wpbody-content" ) ) . "\r\n";
1463
+		$notify_message .= sprintf(__('Spam it: %s'), admin_url("comment.php?action=spam&c={$comment->comment_ID}#wpbody-content"))."\r\n";
1464 1464
 	}
1465 1465
 
1466
-	$wp_email = 'wordpress@' . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME']));
1466
+	$wp_email = 'wordpress@'.preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME']));
1467 1467
 
1468
-	if ( '' == $comment->comment_author ) {
1468
+	if ('' == $comment->comment_author) {
1469 1469
 		$from = "From: \"$blogname\" <$wp_email>";
1470
-		if ( '' != $comment->comment_author_email )
1470
+		if ('' != $comment->comment_author_email)
1471 1471
 			$reply_to = "Reply-To: $comment->comment_author_email";
1472 1472
 	} else {
1473 1473
 		$from = "From: \"$comment->comment_author\" <$wp_email>";
1474
-		if ( '' != $comment->comment_author_email )
1474
+		if ('' != $comment->comment_author_email)
1475 1475
 			$reply_to = "Reply-To: \"$comment->comment_author_email\" <$comment->comment_author_email>";
1476 1476
 	}
1477 1477
 
1478 1478
 	$message_headers = "$from\n"
1479
-		. "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
1479
+		. "Content-Type: text/plain; charset=\"".get_option('blog_charset')."\"\n";
1480 1480
 
1481
-	if ( isset($reply_to) )
1482
-		$message_headers .= $reply_to . "\n";
1481
+	if (isset($reply_to))
1482
+		$message_headers .= $reply_to."\n";
1483 1483
 
1484 1484
 	/**
1485 1485
 	 * Filter the comment notification email text.
@@ -1489,7 +1489,7 @@  discard block
 block discarded – undo
1489 1489
 	 * @param string $notify_message The comment notification email text.
1490 1490
 	 * @param int    $comment_id     Comment ID.
1491 1491
 	 */
1492
-	$notify_message = apply_filters( 'comment_notification_text', $notify_message, $comment->comment_ID );
1492
+	$notify_message = apply_filters('comment_notification_text', $notify_message, $comment->comment_ID);
1493 1493
 
1494 1494
 	/**
1495 1495
 	 * Filter the comment notification email subject.
@@ -1499,7 +1499,7 @@  discard block
 block discarded – undo
1499 1499
 	 * @param string $subject    The comment notification email subject.
1500 1500
 	 * @param int    $comment_id Comment ID.
1501 1501
 	 */
1502
-	$subject = apply_filters( 'comment_notification_subject', $subject, $comment->comment_ID );
1502
+	$subject = apply_filters('comment_notification_subject', $subject, $comment->comment_ID);
1503 1503
 
1504 1504
 	/**
1505 1505
 	 * Filter the comment notification email headers.
@@ -1509,17 +1509,17 @@  discard block
 block discarded – undo
1509 1509
 	 * @param string $message_headers Headers for the comment notification email.
1510 1510
 	 * @param int    $comment_id      Comment ID.
1511 1511
 	 */
1512
-	$message_headers = apply_filters( 'comment_notification_headers', $message_headers, $comment->comment_ID );
1512
+	$message_headers = apply_filters('comment_notification_headers', $message_headers, $comment->comment_ID);
1513 1513
 
1514
-	foreach ( $emails as $email ) {
1515
-		@wp_mail( $email, wp_specialchars_decode( $subject ), $notify_message, $message_headers );
1514
+	foreach ($emails as $email) {
1515
+		@wp_mail($email, wp_specialchars_decode($subject), $notify_message, $message_headers);
1516 1516
 	}
1517 1517
 
1518 1518
 	return true;
1519 1519
 }
1520 1520
 endif;
1521 1521
 
1522
-if ( !function_exists('wp_notify_moderator') ) :
1522
+if ( ! function_exists('wp_notify_moderator')) :
1523 1523
 /**
1524 1524
  * Notifies the moderator of the site about a new comment that is awaiting approval.
1525 1525
  *
@@ -1536,7 +1536,7 @@  discard block
 block discarded – undo
1536 1536
 function wp_notify_moderator($comment_id) {
1537 1537
 	global $wpdb;
1538 1538
 
1539
-	$maybe_notify = get_option( 'moderation_notify' );
1539
+	$maybe_notify = get_option('moderation_notify');
1540 1540
 
1541 1541
 	/**
1542 1542
 	 * Filter whether to send the site moderator email notifications, overriding the site setting.
@@ -1546,19 +1546,19 @@  discard block
 block discarded – undo
1546 1546
 	 * @param bool $maybe_notify Whether to notify blog moderator.
1547 1547
 	 * @param int  $comment_ID   The id of the comment for the notification.
1548 1548
 	 */
1549
-	$maybe_notify = apply_filters( 'notify_moderator', $maybe_notify, $comment_id );
1549
+	$maybe_notify = apply_filters('notify_moderator', $maybe_notify, $comment_id);
1550 1550
 
1551
-	if ( ! $maybe_notify ) {
1551
+	if ( ! $maybe_notify) {
1552 1552
 		return true;
1553 1553
 	}
1554 1554
 
1555 1555
 	$comment = get_comment($comment_id);
1556 1556
 	$post = get_post($comment->comment_post_ID);
1557
-	$user = get_userdata( $post->post_author );
1557
+	$user = get_userdata($post->post_author);
1558 1558
 	// Send to the administration and to the post author if the author can modify the comment.
1559
-	$emails = array( get_option( 'admin_email' ) );
1560
-	if ( $user && user_can( $user->ID, 'edit_comment', $comment_id ) && ! empty( $user->user_email ) ) {
1561
-		if ( 0 !== strcasecmp( $user->user_email, get_option( 'admin_email' ) ) )
1559
+	$emails = array(get_option('admin_email'));
1560
+	if ($user && user_can($user->ID, 'edit_comment', $comment_id) && ! empty($user->user_email)) {
1561
+		if (0 !== strcasecmp($user->user_email, get_option('admin_email')))
1562 1562
 			$emails[] = $user->user_email;
1563 1563
 	}
1564 1564
 
@@ -1568,49 +1568,49 @@  discard block
 block discarded – undo
1568 1568
 	// The blogname option is escaped with esc_html on the way into the database in sanitize_option
1569 1569
 	// we want to reverse this for the plain text arena of emails.
1570 1570
 	$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
1571
-	$comment_content = wp_specialchars_decode( $comment->comment_content );
1571
+	$comment_content = wp_specialchars_decode($comment->comment_content);
1572 1572
 
1573
-	switch ( $comment->comment_type ) {
1573
+	switch ($comment->comment_type) {
1574 1574
 		case 'trackback':
1575
-			$notify_message  = sprintf( __('A new trackback on the post "%s" is waiting for your approval'), $post->post_title ) . "\r\n";
1576
-			$notify_message .= get_permalink($comment->comment_post_ID) . "\r\n\r\n";
1575
+			$notify_message  = sprintf(__('A new trackback on the post "%s" is waiting for your approval'), $post->post_title)."\r\n";
1576
+			$notify_message .= get_permalink($comment->comment_post_ID)."\r\n\r\n";
1577 1577
 			/* translators: 1: website name, 2: website IP, 3: website hostname */
1578
-			$notify_message .= sprintf( __( 'Website: %1$s (IP: %2$s, %3$s)' ), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
1579
-			$notify_message .= sprintf( __( 'URL: %s' ), $comment->comment_author_url ) . "\r\n";
1580
-			$notify_message .= __('Trackback excerpt: ') . "\r\n" . $comment_content . "\r\n\r\n";
1578
+			$notify_message .= sprintf(__('Website: %1$s (IP: %2$s, %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain)."\r\n";
1579
+			$notify_message .= sprintf(__('URL: %s'), $comment->comment_author_url)."\r\n";
1580
+			$notify_message .= __('Trackback excerpt: ')."\r\n".$comment_content."\r\n\r\n";
1581 1581
 			break;
1582 1582
 		case 'pingback':
1583
-			$notify_message  = sprintf( __('A new pingback on the post "%s" is waiting for your approval'), $post->post_title ) . "\r\n";
1584
-			$notify_message .= get_permalink($comment->comment_post_ID) . "\r\n\r\n";
1583
+			$notify_message  = sprintf(__('A new pingback on the post "%s" is waiting for your approval'), $post->post_title)."\r\n";
1584
+			$notify_message .= get_permalink($comment->comment_post_ID)."\r\n\r\n";
1585 1585
 			/* translators: 1: website name, 2: website IP, 3: website hostname */
1586
-			$notify_message .= sprintf( __( 'Website: %1$s (IP: %2$s, %3$s)' ), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
1587
-			$notify_message .= sprintf( __( 'URL: %s' ), $comment->comment_author_url ) . "\r\n";
1588
-			$notify_message .= __('Pingback excerpt: ') . "\r\n" . $comment_content . "\r\n\r\n";
1586
+			$notify_message .= sprintf(__('Website: %1$s (IP: %2$s, %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain)."\r\n";
1587
+			$notify_message .= sprintf(__('URL: %s'), $comment->comment_author_url)."\r\n";
1588
+			$notify_message .= __('Pingback excerpt: ')."\r\n".$comment_content."\r\n\r\n";
1589 1589
 			break;
1590 1590
 		default: // Comments
1591
-			$notify_message  = sprintf( __('A new comment on the post "%s" is waiting for your approval'), $post->post_title ) . "\r\n";
1592
-			$notify_message .= get_permalink($comment->comment_post_ID) . "\r\n\r\n";
1593
-			$notify_message .= sprintf( __( 'Author: %1$s (IP: %2$s, %3$s)' ), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
1594
-			$notify_message .= sprintf( __( 'Email: %s' ), $comment->comment_author_email ) . "\r\n";
1595
-			$notify_message .= sprintf( __( 'URL: %s' ), $comment->comment_author_url ) . "\r\n";
1596
-			$notify_message .= sprintf( __( 'Comment: %s' ), "\r\n" . $comment_content ) . "\r\n\r\n";
1591
+			$notify_message  = sprintf(__('A new comment on the post "%s" is waiting for your approval'), $post->post_title)."\r\n";
1592
+			$notify_message .= get_permalink($comment->comment_post_ID)."\r\n\r\n";
1593
+			$notify_message .= sprintf(__('Author: %1$s (IP: %2$s, %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain)."\r\n";
1594
+			$notify_message .= sprintf(__('Email: %s'), $comment->comment_author_email)."\r\n";
1595
+			$notify_message .= sprintf(__('URL: %s'), $comment->comment_author_url)."\r\n";
1596
+			$notify_message .= sprintf(__('Comment: %s'), "\r\n".$comment_content)."\r\n\r\n";
1597 1597
 			break;
1598 1598
 	}
1599 1599
 
1600
-	$notify_message .= sprintf( __( 'Approve it: %s' ), admin_url( "comment.php?action=approve&c={$comment_id}#wpbody-content" ) ) . "\r\n";
1600
+	$notify_message .= sprintf(__('Approve it: %s'), admin_url("comment.php?action=approve&c={$comment_id}#wpbody-content"))."\r\n";
1601 1601
 
1602
-	if ( EMPTY_TRASH_DAYS )
1603
-		$notify_message .= sprintf( __( 'Trash it: %s' ), admin_url( "comment.php?action=trash&c={$comment_id}#wpbody-content" ) ) . "\r\n";
1602
+	if (EMPTY_TRASH_DAYS)
1603
+		$notify_message .= sprintf(__('Trash it: %s'), admin_url("comment.php?action=trash&c={$comment_id}#wpbody-content"))."\r\n";
1604 1604
 	else
1605
-		$notify_message .= sprintf( __( 'Delete it: %s' ), admin_url( "comment.php?action=delete&c={$comment_id}#wpbody-content" ) ) . "\r\n";
1605
+		$notify_message .= sprintf(__('Delete it: %s'), admin_url("comment.php?action=delete&c={$comment_id}#wpbody-content"))."\r\n";
1606 1606
 
1607
-	$notify_message .= sprintf( __( 'Spam it: %s' ), admin_url( "comment.php?action=spam&c={$comment_id}#wpbody-content" ) ) . "\r\n";
1607
+	$notify_message .= sprintf(__('Spam it: %s'), admin_url("comment.php?action=spam&c={$comment_id}#wpbody-content"))."\r\n";
1608 1608
 
1609
-	$notify_message .= sprintf( _n('Currently %s comment is waiting for approval. Please visit the moderation panel:',
1610
- 		'Currently %s comments are waiting for approval. Please visit the moderation panel:', $comments_waiting), number_format_i18n($comments_waiting) ) . "\r\n";
1611
-	$notify_message .= admin_url( "edit-comments.php?comment_status=moderated#wpbody-content" ) . "\r\n";
1609
+	$notify_message .= sprintf(_n('Currently %s comment is waiting for approval. Please visit the moderation panel:',
1610
+ 		'Currently %s comments are waiting for approval. Please visit the moderation panel:', $comments_waiting), number_format_i18n($comments_waiting))."\r\n";
1611
+	$notify_message .= admin_url("edit-comments.php?comment_status=moderated#wpbody-content")."\r\n";
1612 1612
 
1613
-	$subject = sprintf( __('[%1$s] Please moderate: "%2$s"'), $blogname, $post->post_title );
1613
+	$subject = sprintf(__('[%1$s] Please moderate: "%2$s"'), $blogname, $post->post_title);
1614 1614
 	$message_headers = '';
1615 1615
 
1616 1616
 	/**
@@ -1621,7 +1621,7 @@  discard block
 block discarded – undo
1621 1621
 	 * @param array $emails     List of email addresses to notify for comment moderation.
1622 1622
 	 * @param int   $comment_id Comment ID.
1623 1623
 	 */
1624
-	$emails = apply_filters( 'comment_moderation_recipients', $emails, $comment_id );
1624
+	$emails = apply_filters('comment_moderation_recipients', $emails, $comment_id);
1625 1625
 
1626 1626
 	/**
1627 1627
 	 * Filter the comment moderation email text.
@@ -1631,7 +1631,7 @@  discard block
 block discarded – undo
1631 1631
 	 * @param string $notify_message Text of the comment moderation email.
1632 1632
 	 * @param int    $comment_id     Comment ID.
1633 1633
 	 */
1634
-	$notify_message = apply_filters( 'comment_moderation_text', $notify_message, $comment_id );
1634
+	$notify_message = apply_filters('comment_moderation_text', $notify_message, $comment_id);
1635 1635
 
1636 1636
 	/**
1637 1637
 	 * Filter the comment moderation email subject.
@@ -1641,7 +1641,7 @@  discard block
 block discarded – undo
1641 1641
 	 * @param string $subject    Subject of the comment moderation email.
1642 1642
 	 * @param int    $comment_id Comment ID.
1643 1643
 	 */
1644
-	$subject = apply_filters( 'comment_moderation_subject', $subject, $comment_id );
1644
+	$subject = apply_filters('comment_moderation_subject', $subject, $comment_id);
1645 1645
 
1646 1646
 	/**
1647 1647
 	 * Filter the comment moderation email headers.
@@ -1651,17 +1651,17 @@  discard block
 block discarded – undo
1651 1651
 	 * @param string $message_headers Headers for the comment moderation email.
1652 1652
 	 * @param int    $comment_id      Comment ID.
1653 1653
 	 */
1654
-	$message_headers = apply_filters( 'comment_moderation_headers', $message_headers, $comment_id );
1654
+	$message_headers = apply_filters('comment_moderation_headers', $message_headers, $comment_id);
1655 1655
 
1656
-	foreach ( $emails as $email ) {
1657
-		@wp_mail( $email, wp_specialchars_decode( $subject ), $notify_message, $message_headers );
1656
+	foreach ($emails as $email) {
1657
+		@wp_mail($email, wp_specialchars_decode($subject), $notify_message, $message_headers);
1658 1658
 	}
1659 1659
 
1660 1660
 	return true;
1661 1661
 }
1662 1662
 endif;
1663 1663
 
1664
-if ( !function_exists('wp_password_change_notification') ) :
1664
+if ( ! function_exists('wp_password_change_notification')) :
1665 1665
 /**
1666 1666
  * Notify the blog admin of a user changing password, normally via email.
1667 1667
  *
@@ -1669,11 +1669,11 @@  discard block
 block discarded – undo
1669 1669
  *
1670 1670
  * @param WP_User $user User object.
1671 1671
  */
1672
-function wp_password_change_notification( $user ) {
1672
+function wp_password_change_notification($user) {
1673 1673
 	// send a copy of password change notification to the admin
1674 1674
 	// but check to see if it's the admin whose password we're changing, and skip this
1675
-	if ( 0 !== strcasecmp( $user->user_email, get_option( 'admin_email' ) ) ) {
1676
-		$message = sprintf(__('Password Lost and Changed for user: %s'), $user->user_login) . "\r\n";
1675
+	if (0 !== strcasecmp($user->user_email, get_option('admin_email'))) {
1676
+		$message = sprintf(__('Password Lost and Changed for user: %s'), $user->user_login)."\r\n";
1677 1677
 		// The blogname option is escaped with esc_html on the way into the database in sanitize_option
1678 1678
 		// we want to reverse this for the plain text arena of emails.
1679 1679
 		$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
@@ -1682,7 +1682,7 @@  discard block
 block discarded – undo
1682 1682
 }
1683 1683
 endif;
1684 1684
 
1685
-if ( !function_exists('wp_new_user_notification') ) :
1685
+if ( ! function_exists('wp_new_user_notification')) :
1686 1686
 /**
1687 1687
  * Email login credentials to a newly-registered user.
1688 1688
  *
@@ -1700,54 +1700,54 @@  discard block
 block discarded – undo
1700 1700
  * @param string $notify     Optional. Type of notification that should happen. Accepts 'admin' or an empty
1701 1701
  *                           string (admin only), or 'both' (admin and user). Default empty.
1702 1702
  */
1703
-function wp_new_user_notification( $user_id, $deprecated = null, $notify = '' ) {
1704
-	if ( $deprecated !== null ) {
1705
-		_deprecated_argument( __FUNCTION__, '4.3.1' );
1703
+function wp_new_user_notification($user_id, $deprecated = null, $notify = '') {
1704
+	if ($deprecated !== null) {
1705
+		_deprecated_argument(__FUNCTION__, '4.3.1');
1706 1706
 	}
1707 1707
 
1708 1708
 	global $wpdb, $wp_hasher;
1709
-	$user = get_userdata( $user_id );
1709
+	$user = get_userdata($user_id);
1710 1710
 
1711 1711
 	// The blogname option is escaped with esc_html on the way into the database in sanitize_option
1712 1712
 	// we want to reverse this for the plain text arena of emails.
1713 1713
 	$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
1714 1714
 
1715
-	$message  = sprintf(__('New user registration on your site %s:'), $blogname) . "\r\n\r\n";
1716
-	$message .= sprintf(__('Username: %s'), $user->user_login) . "\r\n\r\n";
1717
-	$message .= sprintf(__('Email: %s'), $user->user_email) . "\r\n";
1715
+	$message  = sprintf(__('New user registration on your site %s:'), $blogname)."\r\n\r\n";
1716
+	$message .= sprintf(__('Username: %s'), $user->user_login)."\r\n\r\n";
1717
+	$message .= sprintf(__('Email: %s'), $user->user_email)."\r\n";
1718 1718
 
1719 1719
 	@wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message);
1720 1720
 
1721 1721
 	// `$deprecated was pre-4.3 `$plaintext_pass`. An empty `$plaintext_pass` didn't sent a user notifcation.
1722
-	if ( 'admin' === $notify || ( empty( $deprecated ) && empty( $notify ) ) ) {
1722
+	if ('admin' === $notify || (empty($deprecated) && empty($notify))) {
1723 1723
 		return;
1724 1724
 	}
1725 1725
 
1726 1726
 	// Generate something random for a password reset key.
1727
-	$key = wp_generate_password( 20, false );
1727
+	$key = wp_generate_password(20, false);
1728 1728
 
1729 1729
 	/** This action is documented in wp-login.php */
1730
-	do_action( 'retrieve_password_key', $user->user_login, $key );
1730
+	do_action('retrieve_password_key', $user->user_login, $key);
1731 1731
 
1732 1732
 	// Now insert the key, hashed, into the DB.
1733
-	if ( empty( $wp_hasher ) ) {
1734
-		require_once ABSPATH . WPINC . '/class-phpass.php';
1735
-		$wp_hasher = new PasswordHash( 8, true );
1733
+	if (empty($wp_hasher)) {
1734
+		require_once ABSPATH.WPINC.'/class-phpass.php';
1735
+		$wp_hasher = new PasswordHash(8, true);
1736 1736
 	}
1737
-	$hashed = time() . ':' . $wp_hasher->HashPassword( $key );
1738
-	$wpdb->update( $wpdb->users, array( 'user_activation_key' => $hashed ), array( 'user_login' => $user->user_login ) );
1737
+	$hashed = time().':'.$wp_hasher->HashPassword($key);
1738
+	$wpdb->update($wpdb->users, array('user_activation_key' => $hashed), array('user_login' => $user->user_login));
1739 1739
 
1740
-	$message = sprintf(__('Username: %s'), $user->user_login) . "\r\n\r\n";
1741
-	$message .= __('To set your password, visit the following address:') . "\r\n\r\n";
1742
-	$message .= '<' . network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user->user_login), 'login') . ">\r\n\r\n";
1740
+	$message = sprintf(__('Username: %s'), $user->user_login)."\r\n\r\n";
1741
+	$message .= __('To set your password, visit the following address:')."\r\n\r\n";
1742
+	$message .= '<'.network_site_url("wp-login.php?action=rp&key=$key&login=".rawurlencode($user->user_login), 'login').">\r\n\r\n";
1743 1743
 
1744
-	$message .= wp_login_url() . "\r\n";
1744
+	$message .= wp_login_url()."\r\n";
1745 1745
 
1746 1746
 	wp_mail($user->user_email, sprintf(__('[%s] Your username and password info'), $blogname), $message);
1747 1747
 }
1748 1748
 endif;
1749 1749
 
1750
-if ( !function_exists('wp_nonce_tick') ) :
1750
+if ( ! function_exists('wp_nonce_tick')) :
1751 1751
 /**
1752 1752
  * Get the time-dependent variable for nonce creation.
1753 1753
  *
@@ -1766,13 +1766,13 @@  discard block
 block discarded – undo
1766 1766
 	 *
1767 1767
 	 * @param int $lifespan Lifespan of nonces in seconds. Default 86,400 seconds, or one day.
1768 1768
 	 */
1769
-	$nonce_life = apply_filters( 'nonce_life', DAY_IN_SECONDS );
1769
+	$nonce_life = apply_filters('nonce_life', DAY_IN_SECONDS);
1770 1770
 
1771
-	return ceil(time() / ( $nonce_life / 2 ));
1771
+	return ceil(time() / ($nonce_life / 2));
1772 1772
 }
1773 1773
 endif;
1774 1774
 
1775
-if ( !function_exists('wp_verify_nonce') ) :
1775
+if ( ! function_exists('wp_verify_nonce')) :
1776 1776
 /**
1777 1777
  * Verify that correct nonce was used with time limit.
1778 1778
  *
@@ -1786,11 +1786,11 @@  discard block
 block discarded – undo
1786 1786
  * @return false|int False if the nonce is invalid, 1 if the nonce is valid and generated between
1787 1787
  *                   0-12 hours ago, 2 if the nonce is valid and generated between 12-24 hours ago.
1788 1788
  */
1789
-function wp_verify_nonce( $nonce, $action = -1 ) {
1789
+function wp_verify_nonce($nonce, $action = -1) {
1790 1790
 	$nonce = (string) $nonce;
1791 1791
 	$user = wp_get_current_user();
1792 1792
 	$uid = (int) $user->ID;
1793
-	if ( ! $uid ) {
1793
+	if ( ! $uid) {
1794 1794
 		/**
1795 1795
 		 * Filter whether the user who generated the nonce is logged out.
1796 1796
 		 *
@@ -1799,10 +1799,10 @@  discard block
 block discarded – undo
1799 1799
 		 * @param int    $uid    ID of the nonce-owning user.
1800 1800
 		 * @param string $action The nonce action.
1801 1801
 		 */
1802
-		$uid = apply_filters( 'nonce_user_logged_out', $uid, $action );
1802
+		$uid = apply_filters('nonce_user_logged_out', $uid, $action);
1803 1803
 	}
1804 1804
 
1805
-	if ( empty( $nonce ) ) {
1805
+	if (empty($nonce)) {
1806 1806
 		return false;
1807 1807
 	}
1808 1808
 
@@ -1810,14 +1810,14 @@  discard block
 block discarded – undo
1810 1810
 	$i = wp_nonce_tick();
1811 1811
 
1812 1812
 	// Nonce generated 0-12 hours ago
1813
-	$expected = substr( wp_hash( $i . '|' . $action . '|' . $uid . '|' . $token, 'nonce'), -12, 10 );
1814
-	if ( hash_equals( $expected, $nonce ) ) {
1813
+	$expected = substr(wp_hash($i.'|'.$action.'|'.$uid.'|'.$token, 'nonce'), -12, 10);
1814
+	if (hash_equals($expected, $nonce)) {
1815 1815
 		return 1;
1816 1816
 	}
1817 1817
 
1818 1818
 	// Nonce generated 12-24 hours ago
1819
-	$expected = substr( wp_hash( ( $i - 1 ) . '|' . $action . '|' . $uid . '|' . $token, 'nonce' ), -12, 10 );
1820
-	if ( hash_equals( $expected, $nonce ) ) {
1819
+	$expected = substr(wp_hash(($i - 1).'|'.$action.'|'.$uid.'|'.$token, 'nonce'), -12, 10);
1820
+	if (hash_equals($expected, $nonce)) {
1821 1821
 		return 2;
1822 1822
 	}
1823 1823
 
@@ -1831,14 +1831,14 @@  discard block
 block discarded – undo
1831 1831
 	 * @param WP_User    $user   The current user object.
1832 1832
 	 * @param string     $token  The user's session token.
1833 1833
 	 */
1834
-	do_action( 'wp_verify_nonce_failed', $nonce, $action, $user, $token );
1834
+	do_action('wp_verify_nonce_failed', $nonce, $action, $user, $token);
1835 1835
 
1836 1836
 	// Invalid nonce
1837 1837
 	return false;
1838 1838
 }
1839 1839
 endif;
1840 1840
 
1841
-if ( !function_exists('wp_create_nonce') ) :
1841
+if ( ! function_exists('wp_create_nonce')) :
1842 1842
 /**
1843 1843
  * Creates a cryptographic token tied to a specific action, user, user session,
1844 1844
  * and window of time.
@@ -1852,19 +1852,19 @@  discard block
 block discarded – undo
1852 1852
 function wp_create_nonce($action = -1) {
1853 1853
 	$user = wp_get_current_user();
1854 1854
 	$uid = (int) $user->ID;
1855
-	if ( ! $uid ) {
1855
+	if ( ! $uid) {
1856 1856
 		/** This filter is documented in wp-includes/pluggable.php */
1857
-		$uid = apply_filters( 'nonce_user_logged_out', $uid, $action );
1857
+		$uid = apply_filters('nonce_user_logged_out', $uid, $action);
1858 1858
 	}
1859 1859
 
1860 1860
 	$token = wp_get_session_token();
1861 1861
 	$i = wp_nonce_tick();
1862 1862
 
1863
-	return substr( wp_hash( $i . '|' . $action . '|' . $uid . '|' . $token, 'nonce' ), -12, 10 );
1863
+	return substr(wp_hash($i.'|'.$action.'|'.$uid.'|'.$token, 'nonce'), -12, 10);
1864 1864
 }
1865 1865
 endif;
1866 1866
 
1867
-if ( !function_exists('wp_salt') ) :
1867
+if ( ! function_exists('wp_salt')) :
1868 1868
 /**
1869 1869
  * Get salt to add to hashes.
1870 1870
  *
@@ -1900,9 +1900,9 @@  discard block
 block discarded – undo
1900 1900
  * @param string $scheme Authentication scheme (auth, secure_auth, logged_in, nonce)
1901 1901
  * @return string Salt value
1902 1902
  */
1903
-function wp_salt( $scheme = 'auth' ) {
1903
+function wp_salt($scheme = 'auth') {
1904 1904
 	static $cached_salts = array();
1905
-	if ( isset( $cached_salts[ $scheme ] ) ) {
1905
+	if (isset($cached_salts[$scheme])) {
1906 1906
 		/**
1907 1907
 		 * Filter the WordPress salt.
1908 1908
 		 *
@@ -1912,19 +1912,19 @@  discard block
 block discarded – undo
1912 1912
 		 * @param string $scheme      Authentication scheme. Values include 'auth',
1913 1913
 		 *                            'secure_auth', 'logged_in', and 'nonce'.
1914 1914
 		 */
1915
-		return apply_filters( 'salt', $cached_salts[ $scheme ], $scheme );
1915
+		return apply_filters('salt', $cached_salts[$scheme], $scheme);
1916 1916
 	}
1917 1917
 
1918 1918
 	static $duplicated_keys;
1919
-	if ( null === $duplicated_keys ) {
1920
-		$duplicated_keys = array( 'put your unique phrase here' => true );
1921
-		foreach ( array( 'AUTH', 'SECURE_AUTH', 'LOGGED_IN', 'NONCE', 'SECRET' ) as $first ) {
1922
-			foreach ( array( 'KEY', 'SALT' ) as $second ) {
1923
-				if ( ! defined( "{$first}_{$second}" ) ) {
1919
+	if (null === $duplicated_keys) {
1920
+		$duplicated_keys = array('put your unique phrase here' => true);
1921
+		foreach (array('AUTH', 'SECURE_AUTH', 'LOGGED_IN', 'NONCE', 'SECRET') as $first) {
1922
+			foreach (array('KEY', 'SALT') as $second) {
1923
+				if ( ! defined("{$first}_{$second}")) {
1924 1924
 					continue;
1925 1925
 				}
1926
-				$value = constant( "{$first}_{$second}" );
1927
-				$duplicated_keys[ $value ] = isset( $duplicated_keys[ $value ] );
1926
+				$value = constant("{$first}_{$second}");
1927
+				$duplicated_keys[$value] = isset($duplicated_keys[$value]);
1928 1928
 			}
1929 1929
 		}
1930 1930
 	}
@@ -1933,45 +1933,45 @@  discard block
 block discarded – undo
1933 1933
 		'key' => '',
1934 1934
 		'salt' => ''
1935 1935
 	);
1936
-	if ( defined( 'SECRET_KEY' ) && SECRET_KEY && empty( $duplicated_keys[ SECRET_KEY ] ) ) {
1936
+	if (defined('SECRET_KEY') && SECRET_KEY && empty($duplicated_keys[SECRET_KEY])) {
1937 1937
 		$values['key'] = SECRET_KEY;
1938 1938
 	}
1939
-	if ( 'auth' == $scheme && defined( 'SECRET_SALT' ) && SECRET_SALT && empty( $duplicated_keys[ SECRET_SALT ] ) ) {
1939
+	if ('auth' == $scheme && defined('SECRET_SALT') && SECRET_SALT && empty($duplicated_keys[SECRET_SALT])) {
1940 1940
 		$values['salt'] = SECRET_SALT;
1941 1941
 	}
1942 1942
 
1943
-	if ( in_array( $scheme, array( 'auth', 'secure_auth', 'logged_in', 'nonce' ) ) ) {
1944
-		foreach ( array( 'key', 'salt' ) as $type ) {
1945
-			$const = strtoupper( "{$scheme}_{$type}" );
1946
-			if ( defined( $const ) && constant( $const ) && empty( $duplicated_keys[ constant( $const ) ] ) ) {
1947
-				$values[ $type ] = constant( $const );
1948
-			} elseif ( ! $values[ $type ] ) {
1949
-				$values[ $type ] = get_site_option( "{$scheme}_{$type}" );
1950
-				if ( ! $values[ $type ] ) {
1951
-					$values[ $type ] = wp_generate_password( 64, true, true );
1952
-					update_site_option( "{$scheme}_{$type}", $values[ $type ] );
1943
+	if (in_array($scheme, array('auth', 'secure_auth', 'logged_in', 'nonce'))) {
1944
+		foreach (array('key', 'salt') as $type) {
1945
+			$const = strtoupper("{$scheme}_{$type}");
1946
+			if (defined($const) && constant($const) && empty($duplicated_keys[constant($const)])) {
1947
+				$values[$type] = constant($const);
1948
+			} elseif ( ! $values[$type]) {
1949
+				$values[$type] = get_site_option("{$scheme}_{$type}");
1950
+				if ( ! $values[$type]) {
1951
+					$values[$type] = wp_generate_password(64, true, true);
1952
+					update_site_option("{$scheme}_{$type}", $values[$type]);
1953 1953
 				}
1954 1954
 			}
1955 1955
 		}
1956 1956
 	} else {
1957
-		if ( ! $values['key'] ) {
1958
-			$values['key'] = get_site_option( 'secret_key' );
1959
-			if ( ! $values['key'] ) {
1960
-				$values['key'] = wp_generate_password( 64, true, true );
1961
-				update_site_option( 'secret_key', $values['key'] );
1957
+		if ( ! $values['key']) {
1958
+			$values['key'] = get_site_option('secret_key');
1959
+			if ( ! $values['key']) {
1960
+				$values['key'] = wp_generate_password(64, true, true);
1961
+				update_site_option('secret_key', $values['key']);
1962 1962
 			}
1963 1963
 		}
1964
-		$values['salt'] = hash_hmac( 'md5', $scheme, $values['key'] );
1964
+		$values['salt'] = hash_hmac('md5', $scheme, $values['key']);
1965 1965
 	}
1966 1966
 
1967
-	$cached_salts[ $scheme ] = $values['key'] . $values['salt'];
1967
+	$cached_salts[$scheme] = $values['key'].$values['salt'];
1968 1968
 
1969 1969
 	/** This filter is documented in wp-includes/pluggable.php */
1970
-	return apply_filters( 'salt', $cached_salts[ $scheme ], $scheme );
1970
+	return apply_filters('salt', $cached_salts[$scheme], $scheme);
1971 1971
 }
1972 1972
 endif;
1973 1973
 
1974
-if ( !function_exists('wp_hash') ) :
1974
+if ( ! function_exists('wp_hash')) :
1975 1975
 /**
1976 1976
  * Get hash of given string.
1977 1977
  *
@@ -1988,7 +1988,7 @@  discard block
 block discarded – undo
1988 1988
 }
1989 1989
 endif;
1990 1990
 
1991
-if ( !function_exists('wp_hash_password') ) :
1991
+if ( ! function_exists('wp_hash_password')) :
1992 1992
 /**
1993 1993
  * Create a hash (encrypt) of a plain text password.
1994 1994
  *
@@ -2005,17 +2005,17 @@  discard block
 block discarded – undo
2005 2005
 function wp_hash_password($password) {
2006 2006
 	global $wp_hasher;
2007 2007
 
2008
-	if ( empty($wp_hasher) ) {
2009
-		require_once( ABSPATH . WPINC . '/class-phpass.php');
2008
+	if (empty($wp_hasher)) {
2009
+		require_once(ABSPATH.WPINC.'/class-phpass.php');
2010 2010
 		// By default, use the portable hash from phpass
2011 2011
 		$wp_hasher = new PasswordHash(8, true);
2012 2012
 	}
2013 2013
 
2014
-	return $wp_hasher->HashPassword( trim( $password ) );
2014
+	return $wp_hasher->HashPassword(trim($password));
2015 2015
 }
2016 2016
 endif;
2017 2017
 
2018
-if ( !function_exists('wp_check_password') ) :
2018
+if ( ! function_exists('wp_check_password')) :
2019 2019
 /**
2020 2020
  * Checks the plaintext password against the encrypted Password.
2021 2021
  *
@@ -2042,9 +2042,9 @@  discard block
 block discarded – undo
2042 2042
 	global $wp_hasher;
2043 2043
 
2044 2044
 	// If the hash is still md5...
2045
-	if ( strlen($hash) <= 32 ) {
2046
-		$check = hash_equals( $hash, md5( $password ) );
2047
-		if ( $check && $user_id ) {
2045
+	if (strlen($hash) <= 32) {
2046
+		$check = hash_equals($hash, md5($password));
2047
+		if ($check && $user_id) {
2048 2048
 			// Rehash using new hash.
2049 2049
 			wp_set_password($password, $user_id);
2050 2050
 			$hash = wp_hash_password($password);
@@ -2060,13 +2060,13 @@  discard block
 block discarded – undo
2060 2060
 		 * @param string     $hash     The hashed password.
2061 2061
 		 * @param string|int $user_id  User ID. Can be empty.
2062 2062
 		 */
2063
-		return apply_filters( 'check_password', $check, $password, $hash, $user_id );
2063
+		return apply_filters('check_password', $check, $password, $hash, $user_id);
2064 2064
 	}
2065 2065
 
2066 2066
 	// If the stored hash is longer than an MD5, presume the
2067 2067
 	// new style phpass portable hash.
2068
-	if ( empty($wp_hasher) ) {
2069
-		require_once( ABSPATH . WPINC . '/class-phpass.php');
2068
+	if (empty($wp_hasher)) {
2069
+		require_once(ABSPATH.WPINC.'/class-phpass.php');
2070 2070
 		// By default, use the portable hash from phpass
2071 2071
 		$wp_hasher = new PasswordHash(8, true);
2072 2072
 	}
@@ -2074,11 +2074,11 @@  discard block
 block discarded – undo
2074 2074
 	$check = $wp_hasher->CheckPassword($password, $hash);
2075 2075
 
2076 2076
 	/** This filter is documented in wp-includes/pluggable.php */
2077
-	return apply_filters( 'check_password', $check, $password, $hash, $user_id );
2077
+	return apply_filters('check_password', $check, $password, $hash, $user_id);
2078 2078
 }
2079 2079
 endif;
2080 2080
 
2081
-if ( !function_exists('wp_generate_password') ) :
2081
+if ( ! function_exists('wp_generate_password')) :
2082 2082
 /**
2083 2083
  * Generates a random password drawn from the defined set of characters.
2084 2084
  *
@@ -2091,15 +2091,15 @@  discard block
 block discarded – undo
2091 2091
  *                                  Used when generating secret keys and salts. Default false.
2092 2092
  * @return string The random password.
2093 2093
  */
2094
-function wp_generate_password( $length = 12, $special_chars = true, $extra_special_chars = false ) {
2094
+function wp_generate_password($length = 12, $special_chars = true, $extra_special_chars = false) {
2095 2095
 	$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
2096
-	if ( $special_chars )
2096
+	if ($special_chars)
2097 2097
 		$chars .= '!@#$%^&*()';
2098
-	if ( $extra_special_chars )
2098
+	if ($extra_special_chars)
2099 2099
 		$chars .= '-_ []{}<>~`+=,.;:/?|';
2100 2100
 
2101 2101
 	$password = '';
2102
-	for ( $i = 0; $i < $length; $i++ ) {
2102
+	for ($i = 0; $i < $length; $i++) {
2103 2103
 		$password .= substr($chars, wp_rand(0, strlen($chars) - 1), 1);
2104 2104
 	}
2105 2105
 
@@ -2110,11 +2110,11 @@  discard block
 block discarded – undo
2110 2110
 	 *
2111 2111
 	 * @param string $password The generated password.
2112 2112
 	 */
2113
-	return apply_filters( 'random_password', $password );
2113
+	return apply_filters('random_password', $password);
2114 2114
 }
2115 2115
 endif;
2116 2116
 
2117
-if ( !function_exists('wp_rand') ) :
2117
+if ( ! function_exists('wp_rand')) :
2118 2118
 /**
2119 2119
  * Generates a random number
2120 2120
  *
@@ -2129,7 +2129,7 @@  discard block
 block discarded – undo
2129 2129
  * @param int $max Upper limit for the generated number
2130 2130
  * @return int A random number between min and max
2131 2131
  */
2132
-function wp_rand( $min = 0, $max = 0 ) {
2132
+function wp_rand($min = 0, $max = 0) {
2133 2133
 	global $rnd_value;
2134 2134
 
2135 2135
 	// Some misconfigured 32bit environments (Entropy PHP, for example) truncate integers larger than PHP_INT_MAX to PHP_INT_MAX rather than overflowing them to floats.
@@ -2141,38 +2141,38 @@  discard block
 block discarded – undo
2141 2141
 
2142 2142
 	// Use PHP's CSPRNG, or a compatible method
2143 2143
 	static $use_random_int_functionality = true;
2144
-	if ( $use_random_int_functionality ) {
2144
+	if ($use_random_int_functionality) {
2145 2145
 		try {
2146
-			$_max = ( 0 != $max ) ? $max : $max_random_number;
2146
+			$_max = (0 != $max) ? $max : $max_random_number;
2147 2147
 			// wp_rand() can accept arguments in either order, PHP cannot.
2148
-			$_max = max( $min, $_max );
2149
-			$_min = min( $min, $_max );
2150
-			$val = random_int( $_min, $_max );
2151
-			if ( false !== $val ) {
2152
-				return absint( $val );
2148
+			$_max = max($min, $_max);
2149
+			$_min = min($min, $_max);
2150
+			$val = random_int($_min, $_max);
2151
+			if (false !== $val) {
2152
+				return absint($val);
2153 2153
 			} else {
2154 2154
 				$use_random_int_functionality = false;
2155 2155
 			}
2156
-		} catch ( Error $e ) {
2156
+		} catch (Error $e) {
2157 2157
 			$use_random_int_functionality = false;
2158
-		} catch ( Exception $e ) {
2158
+		} catch (Exception $e) {
2159 2159
 			$use_random_int_functionality = false;
2160 2160
 		}
2161 2161
 	}
2162 2162
 
2163 2163
 	// Reset $rnd_value after 14 uses
2164 2164
 	// 32(md5) + 40(sha1) + 40(sha1) / 8 = 14 random numbers from $rnd_value
2165
-	if ( strlen($rnd_value) < 8 ) {
2166
-		if ( defined( 'WP_SETUP_CONFIG' ) )
2165
+	if (strlen($rnd_value) < 8) {
2166
+		if (defined('WP_SETUP_CONFIG'))
2167 2167
 			static $seed = '';
2168 2168
 		else
2169 2169
 			$seed = get_transient('random_seed');
2170
-		$rnd_value = md5( uniqid(microtime() . mt_rand(), true ) . $seed );
2170
+		$rnd_value = md5(uniqid(microtime().mt_rand(), true).$seed);
2171 2171
 		$rnd_value .= sha1($rnd_value);
2172
-		$rnd_value .= sha1($rnd_value . $seed);
2173
-		$seed = md5($seed . $rnd_value);
2174
-		if ( ! defined( 'WP_SETUP_CONFIG' ) && ! defined( 'WP_INSTALLING' ) ) {
2175
-			set_transient( 'random_seed', $seed );
2172
+		$rnd_value .= sha1($rnd_value.$seed);
2173
+		$seed = md5($seed.$rnd_value);
2174
+		if ( ! defined('WP_SETUP_CONFIG') && ! defined('WP_INSTALLING')) {
2175
+			set_transient('random_seed', $seed);
2176 2176
 		}
2177 2177
 	}
2178 2178
 
@@ -2185,14 +2185,14 @@  discard block
 block discarded – undo
2185 2185
 	$value = abs(hexdec($value));
2186 2186
 
2187 2187
 	// Reduce the value to be within the min - max range
2188
-	if ( $max != 0 )
2189
-		$value = $min + ( $max - $min + 1 ) * $value / ( $max_random_number + 1 );
2188
+	if ($max != 0)
2189
+		$value = $min + ($max - $min + 1) * $value / ($max_random_number + 1);
2190 2190
 
2191 2191
 	return abs(intval($value));
2192 2192
 }
2193 2193
 endif;
2194 2194
 
2195
-if ( !function_exists('wp_set_password') ) :
2195
+if ( ! function_exists('wp_set_password')) :
2196 2196
 /**
2197 2197
  * Updates the user's password with a new encrypted one.
2198 2198
  *
@@ -2210,17 +2210,17 @@  discard block
 block discarded – undo
2210 2210
  * @param string $password The plaintext new user password
2211 2211
  * @param int    $user_id  User ID
2212 2212
  */
2213
-function wp_set_password( $password, $user_id ) {
2213
+function wp_set_password($password, $user_id) {
2214 2214
 	global $wpdb;
2215 2215
 
2216
-	$hash = wp_hash_password( $password );
2217
-	$wpdb->update($wpdb->users, array('user_pass' => $hash, 'user_activation_key' => ''), array('ID' => $user_id) );
2216
+	$hash = wp_hash_password($password);
2217
+	$wpdb->update($wpdb->users, array('user_pass' => $hash, 'user_activation_key' => ''), array('ID' => $user_id));
2218 2218
 
2219 2219
 	wp_cache_delete($user_id, 'users');
2220 2220
 }
2221 2221
 endif;
2222 2222
 
2223
-if ( !function_exists( 'get_avatar' ) ) :
2223
+if ( ! function_exists('get_avatar')) :
2224 2224
 /**
2225 2225
  * Retrieve the avatar `<img>` tag for a user, email address, MD5 hash, comment, or post.
2226 2226
  *
@@ -2255,15 +2255,15 @@  discard block
 block discarded – undo
2255 2255
  * }
2256 2256
  * @return false|string `<img>` tag for the user's avatar. False on failure.
2257 2257
  */
2258
-function get_avatar( $id_or_email, $size = 96, $default = '', $alt = '', $args = null ) {
2258
+function get_avatar($id_or_email, $size = 96, $default = '', $alt = '', $args = null) {
2259 2259
 	$defaults = array(
2260 2260
 		// get_avatar_data() args.
2261 2261
 		'size'          => 96,
2262 2262
 		'height'        => null,
2263 2263
 		'width'         => null,
2264
-		'default'       => get_option( 'avatar_default', 'mystery' ),
2264
+		'default'       => get_option('avatar_default', 'mystery'),
2265 2265
 		'force_default' => false,
2266
-		'rating'        => get_option( 'avatar_rating' ),
2266
+		'rating'        => get_option('avatar_rating'),
2267 2267
 		'scheme'        => null,
2268 2268
 		'alt'           => '',
2269 2269
 		'class'         => null,
@@ -2271,7 +2271,7 @@  discard block
 block discarded – undo
2271 2271
 		'extra_attr'    => '',
2272 2272
 	);
2273 2273
 
2274
-	if ( empty( $args ) ) {
2274
+	if (empty($args)) {
2275 2275
 		$args = array();
2276 2276
 	}
2277 2277
 
@@ -2279,17 +2279,17 @@  discard block
 block discarded – undo
2279 2279
 	$args['default'] = $default;
2280 2280
 	$args['alt']     = $alt;
2281 2281
 
2282
-	$args = wp_parse_args( $args, $defaults );
2282
+	$args = wp_parse_args($args, $defaults);
2283 2283
 
2284
-	if ( empty( $args['height'] ) ) {
2284
+	if (empty($args['height'])) {
2285 2285
 		$args['height'] = $args['size'];
2286 2286
 	}
2287
-	if ( empty( $args['width'] ) ) {
2287
+	if (empty($args['width'])) {
2288 2288
 		$args['width'] = $args['size'];
2289 2289
 	}
2290 2290
 
2291
-	if ( is_object( $id_or_email ) && isset( $id_or_email->comment_ID ) ) {
2292
-		$id_or_email = get_comment( $id_or_email );
2291
+	if (is_object($id_or_email) && isset($id_or_email->comment_ID)) {
2292
+		$id_or_email = get_comment($id_or_email);
2293 2293
 	}
2294 2294
 
2295 2295
 	/**
@@ -2305,36 +2305,36 @@  discard block
 block discarded – undo
2305 2305
 	 *                            user email, WP_User object, WP_Post object, or WP_Comment object.
2306 2306
 	 * @param array  $args        Arguments passed to get_avatar_url(), after processing.
2307 2307
 	 */
2308
-	$avatar = apply_filters( 'pre_get_avatar', null, $id_or_email, $args );
2308
+	$avatar = apply_filters('pre_get_avatar', null, $id_or_email, $args);
2309 2309
 
2310
-	if ( ! is_null( $avatar ) ) {
2310
+	if ( ! is_null($avatar)) {
2311 2311
 		/** This filter is documented in wp-includes/pluggable.php */
2312
-		return apply_filters( 'get_avatar', $avatar, $id_or_email, $args['size'], $args['default'], $args['alt'], $args );
2312
+		return apply_filters('get_avatar', $avatar, $id_or_email, $args['size'], $args['default'], $args['alt'], $args);
2313 2313
 	}
2314 2314
 
2315
-	if ( ! $args['force_display'] && ! get_option( 'show_avatars' ) ) {
2315
+	if ( ! $args['force_display'] && ! get_option('show_avatars')) {
2316 2316
 		return false;
2317 2317
 	}
2318 2318
 
2319
-	$url2x = get_avatar_url( $id_or_email, array_merge( $args, array( 'size' => $args['size'] * 2 ) ) );
2319
+	$url2x = get_avatar_url($id_or_email, array_merge($args, array('size' => $args['size'] * 2)));
2320 2320
 
2321
-	$args = get_avatar_data( $id_or_email, $args );
2321
+	$args = get_avatar_data($id_or_email, $args);
2322 2322
 
2323 2323
 	$url = $args['url'];
2324 2324
 
2325
-	if ( ! $url || is_wp_error( $url ) ) {
2325
+	if ( ! $url || is_wp_error($url)) {
2326 2326
 		return false;
2327 2327
 	}
2328 2328
 
2329
-	$class = array( 'avatar', 'avatar-' . (int) $args['size'], 'photo' );
2329
+	$class = array('avatar', 'avatar-'.(int) $args['size'], 'photo');
2330 2330
 
2331
-	if ( ! $args['found_avatar'] || $args['force_default'] ) {
2331
+	if ( ! $args['found_avatar'] || $args['force_default']) {
2332 2332
 		$class[] = 'avatar-default';
2333 2333
 	}
2334 2334
 
2335
-	if ( $args['class'] ) {
2336
-		if ( is_array( $args['class'] ) ) {
2337
-			$class = array_merge( $class, $args['class'] );
2335
+	if ($args['class']) {
2336
+		if (is_array($args['class'])) {
2337
+			$class = array_merge($class, $args['class']);
2338 2338
 		} else {
2339 2339
 			$class[] = $args['class'];
2340 2340
 		}
@@ -2342,10 +2342,10 @@  discard block
 block discarded – undo
2342 2342
 
2343 2343
 	$avatar = sprintf(
2344 2344
 		"<img alt='%s' src='%s' srcset='%s' class='%s' height='%d' width='%d' %s/>",
2345
-		esc_attr( $args['alt'] ),
2346
-		esc_url( $url ),
2347
-		esc_attr( "$url2x 2x" ),
2348
-		esc_attr( join( ' ', $class ) ),
2345
+		esc_attr($args['alt']),
2346
+		esc_url($url),
2347
+		esc_attr("$url2x 2x"),
2348
+		esc_attr(join(' ', $class)),
2349 2349
 		(int) $args['height'],
2350 2350
 		(int) $args['width'],
2351 2351
 		$args['extra_attr']
@@ -2365,11 +2365,11 @@  discard block
 block discarded – undo
2365 2365
 	 *                                       Default empty.
2366 2366
 	 * @param array  $args        Arguments passed to get_avatar_data(), after processing.
2367 2367
 	 */
2368
-	return apply_filters( 'get_avatar', $avatar, $id_or_email, $args['size'], $args['default'], $args['alt'], $args );
2368
+	return apply_filters('get_avatar', $avatar, $id_or_email, $args['size'], $args['default'], $args['alt'], $args);
2369 2369
 }
2370 2370
 endif;
2371 2371
 
2372
-if ( !function_exists( 'wp_text_diff' ) ) :
2372
+if ( ! function_exists('wp_text_diff')) :
2373 2373
 /**
2374 2374
  * Displays a human readable HTML representation of the difference between two strings.
2375 2375
  *
@@ -2397,12 +2397,12 @@  discard block
 block discarded – undo
2397 2397
  * @param string|array $args         Optional. Change 'title', 'title_left', and 'title_right' defaults.
2398 2398
  * @return string Empty string if strings are equivalent or HTML with differences.
2399 2399
  */
2400
-function wp_text_diff( $left_string, $right_string, $args = null ) {
2401
-	$defaults = array( 'title' => '', 'title_left' => '', 'title_right' => '' );
2402
-	$args = wp_parse_args( $args, $defaults );
2400
+function wp_text_diff($left_string, $right_string, $args = null) {
2401
+	$defaults = array('title' => '', 'title_left' => '', 'title_right' => '');
2402
+	$args = wp_parse_args($args, $defaults);
2403 2403
 
2404
-	if ( ! class_exists( 'WP_Text_Diff_Renderer_Table', false ) )
2405
-		require( ABSPATH . WPINC . '/wp-diff.php' );
2404
+	if ( ! class_exists('WP_Text_Diff_Renderer_Table', false))
2405
+		require(ABSPATH.WPINC.'/wp-diff.php');
2406 2406
 
2407 2407
 	$left_string  = normalize_whitespace($left_string);
2408 2408
 	$right_string = normalize_whitespace($right_string);
@@ -2410,31 +2410,31 @@  discard block
 block discarded – undo
2410 2410
 	$left_lines  = explode("\n", $left_string);
2411 2411
 	$right_lines = explode("\n", $right_string);
2412 2412
 	$text_diff = new Text_Diff($left_lines, $right_lines);
2413
-	$renderer  = new WP_Text_Diff_Renderer_Table( $args );
2413
+	$renderer  = new WP_Text_Diff_Renderer_Table($args);
2414 2414
 	$diff = $renderer->render($text_diff);
2415 2415
 
2416
-	if ( !$diff )
2416
+	if ( ! $diff)
2417 2417
 		return '';
2418 2418
 
2419
-	$r  = "<table class='diff'>\n";
2419
+	$r = "<table class='diff'>\n";
2420 2420
 
2421
-	if ( ! empty( $args[ 'show_split_view' ] ) ) {
2421
+	if ( ! empty($args['show_split_view'])) {
2422 2422
 		$r .= "<col class='content diffsplit left' /><col class='content diffsplit middle' /><col class='content diffsplit right' />";
2423 2423
 	} else {
2424 2424
 		$r .= "<col class='content' />";
2425 2425
 	}
2426 2426
 
2427
-	if ( $args['title'] || $args['title_left'] || $args['title_right'] )
2427
+	if ($args['title'] || $args['title_left'] || $args['title_right'])
2428 2428
 		$r .= "<thead>";
2429
-	if ( $args['title'] )
2429
+	if ($args['title'])
2430 2430
 		$r .= "<tr class='diff-title'><th colspan='4'>$args[title]</th></tr>\n";
2431
-	if ( $args['title_left'] || $args['title_right'] ) {
2431
+	if ($args['title_left'] || $args['title_right']) {
2432 2432
 		$r .= "<tr class='diff-sub-title'>\n";
2433 2433
 		$r .= "\t<td></td><th>$args[title_left]</th>\n";
2434 2434
 		$r .= "\t<td></td><th>$args[title_right]</th>\n";
2435 2435
 		$r .= "</tr>\n";
2436 2436
 	}
2437
-	if ( $args['title'] || $args['title_left'] || $args['title_right'] )
2437
+	if ($args['title'] || $args['title_left'] || $args['title_right'])
2438 2438
 		$r .= "</thead>\n";
2439 2439
 
2440 2440
 	$r .= "<tbody>\n$diff\n</tbody>\n";
Please login to merge, or discard this patch.
Braces   +109 added lines, -75 removed lines patch added patch discarded remove patch
@@ -98,8 +98,9 @@  discard block
 block discarded – undo
98 98
 function get_user_by( $field, $value ) {
99 99
 	$userdata = WP_User::get_data_by( $field, $value );
100 100
 
101
-	if ( !$userdata )
102
-		return false;
101
+	if ( !$userdata ) {
102
+			return false;
103
+	}
103 104
 
104 105
 	$user = new WP_User;
105 106
 	$user->init( $userdata );
@@ -123,8 +124,9 @@  discard block
 block discarded – undo
123 124
 
124 125
 	$clean = _get_non_cached_ids( $user_ids, 'users' );
125 126
 
126
-	if ( empty( $clean ) )
127
-		return;
127
+	if ( empty( $clean ) ) {
128
+			return;
129
+	}
128 130
 
129 131
 	$list = implode( ',', $clean );
130 132
 
@@ -308,8 +310,9 @@  discard block
 block discarded – undo
308 310
 
309 311
 	// From email and name
310 312
 	// If we don't have a name from the input headers
311
-	if ( !isset( $from_name ) )
312
-		$from_name = 'WordPress';
313
+	if ( !isset( $from_name ) ) {
314
+			$from_name = 'WordPress';
315
+	}
313 316
 
314 317
 	/* If we don't have an email from the input headers default to wordpress@$sitename
315 318
 	 * Some hosts will block outgoing mail from this address if it doesn't exist but
@@ -347,8 +350,9 @@  discard block
 block discarded – undo
347 350
 	$phpmailer->FromName = apply_filters( 'wp_mail_from_name', $from_name );
348 351
 
349 352
 	// Set destination addresses
350
-	if ( !is_array( $to ) )
351
-		$to = explode( ',', $to );
353
+	if ( !is_array( $to ) ) {
354
+			$to = explode( ',', $to );
355
+	}
352 356
 
353 357
 	foreach ( (array) $to as $recipient ) {
354 358
 		try {
@@ -412,8 +416,9 @@  discard block
 block discarded – undo
412 416
 
413 417
 	// Set Content-Type and charset
414 418
 	// If we don't have a content-type from the input headers
415
-	if ( !isset( $content_type ) )
416
-		$content_type = 'text/plain';
419
+	if ( !isset( $content_type ) ) {
420
+			$content_type = 'text/plain';
421
+	}
417 422
 
418 423
 	/**
419 424
 	 * Filter the wp_mail() content type.
@@ -427,12 +432,14 @@  discard block
 block discarded – undo
427 432
 	$phpmailer->ContentType = $content_type;
428 433
 
429 434
 	// Set whether it's plaintext, depending on $content_type
430
-	if ( 'text/html' == $content_type )
431
-		$phpmailer->IsHTML( true );
435
+	if ( 'text/html' == $content_type ) {
436
+			$phpmailer->IsHTML( true );
437
+	}
432 438
 
433 439
 	// If we don't have a charset from the input headers
434
-	if ( !isset( $charset ) )
435
-		$charset = get_bloginfo( 'charset' );
440
+	if ( !isset( $charset ) ) {
441
+			$charset = get_bloginfo( 'charset' );
442
+	}
436 443
 
437 444
 	// Set the content-type and charset
438 445
 
@@ -451,8 +458,9 @@  discard block
 block discarded – undo
451 458
 			$phpmailer->AddCustomHeader( sprintf( '%1$s: %2$s', $name, $content ) );
452 459
 		}
453 460
 
454
-		if ( false !== stripos( $content_type, 'multipart' ) && ! empty($boundary) )
455
-			$phpmailer->AddCustomHeader( sprintf( "Content-Type: %s;\n\t boundary=\"%s\"", $content_type, $boundary ) );
461
+		if ( false !== stripos( $content_type, 'multipart' ) && ! empty($boundary) ) {
462
+					$phpmailer->AddCustomHeader( sprintf( "Content-Type: %s;\n\t boundary=\"%s\"", $content_type, $boundary ) );
463
+		}
456 464
 	}
457 465
 
458 466
 	if ( !empty( $attachments ) ) {
@@ -766,8 +774,9 @@  discard block
 block discarded – undo
766 774
 				}
767 775
 	    }
768 776
 
769
-		if ( empty($_COOKIE[$cookie_name]) )
770
-			return false;
777
+		if ( empty($_COOKIE[$cookie_name]) ) {
778
+					return false;
779
+		}
771 780
 		$cookie = $_COOKIE[$cookie_name];
772 781
 	}
773 782
 
@@ -898,9 +907,10 @@  discard block
 block discarded – undo
898 907
 	setcookie($auth_cookie_name, $auth_cookie, $expire, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN, $secure, true);
899 908
 	setcookie($auth_cookie_name, $auth_cookie, $expire, ADMIN_COOKIE_PATH, COOKIE_DOMAIN, $secure, true);
900 909
 	setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, COOKIEPATH, COOKIE_DOMAIN, $secure_logged_in_cookie, true);
901
-	if ( COOKIEPATH != SITECOOKIEPATH )
902
-		setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, SITECOOKIEPATH, COOKIE_DOMAIN, $secure_logged_in_cookie, true);
903
-}
910
+	if ( COOKIEPATH != SITECOOKIEPATH ) {
911
+			setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, SITECOOKIEPATH, COOKIE_DOMAIN, $secure_logged_in_cookie, true);
912
+	}
913
+	}
904 914
 endif;
905 915
 
906 916
 if ( !function_exists('wp_clear_auth_cookie') ) :
@@ -1048,8 +1058,9 @@  discard block
 block discarded – undo
1048 1058
  *                   0-12 hours ago, 2 if the nonce is valid and generated between 12-24 hours ago.
1049 1059
  */
1050 1060
 function check_admin_referer( $action = -1, $query_arg = '_wpnonce' ) {
1051
-	if ( -1 == $action )
1052
-		_doing_it_wrong( __FUNCTION__, __( 'You should specify a nonce action to be verified by using the first parameter.' ), '3.2' );
1061
+	if ( -1 == $action ) {
1062
+			_doing_it_wrong( __FUNCTION__, __( 'You should specify a nonce action to be verified by using the first parameter.' ), '3.2' );
1063
+	}
1053 1064
 
1054 1065
 	$adminurl = strtolower(admin_url());
1055 1066
 	$referer = strtolower(wp_get_referer());
@@ -1093,12 +1104,13 @@  discard block
 block discarded – undo
1093 1104
 function check_ajax_referer( $action = -1, $query_arg = false, $die = true ) {
1094 1105
 	$nonce = '';
1095 1106
 
1096
-	if ( $query_arg && isset( $_REQUEST[ $query_arg ] ) )
1097
-		$nonce = $_REQUEST[ $query_arg ];
1098
-	elseif ( isset( $_REQUEST['_ajax_nonce'] ) )
1099
-		$nonce = $_REQUEST['_ajax_nonce'];
1100
-	elseif ( isset( $_REQUEST['_wpnonce'] ) )
1101
-		$nonce = $_REQUEST['_wpnonce'];
1107
+	if ( $query_arg && isset( $_REQUEST[ $query_arg ] ) ) {
1108
+			$nonce = $_REQUEST[ $query_arg ];
1109
+	} elseif ( isset( $_REQUEST['_ajax_nonce'] ) ) {
1110
+			$nonce = $_REQUEST['_ajax_nonce'];
1111
+	} elseif ( isset( $_REQUEST['_wpnonce'] ) ) {
1112
+			$nonce = $_REQUEST['_wpnonce'];
1113
+	}
1102 1114
 
1103 1115
 	$result = wp_verify_nonce( $nonce, $action );
1104 1116
 
@@ -1160,13 +1172,16 @@  discard block
 block discarded – undo
1160 1172
 	 */
1161 1173
 	$status = apply_filters( 'wp_redirect_status', $status, $location );
1162 1174
 
1163
-	if ( ! $location )
1164
-		return false;
1175
+	if ( ! $location ) {
1176
+			return false;
1177
+	}
1165 1178
 
1166 1179
 	$location = wp_sanitize_redirect($location);
1167 1180
 
1168
-	if ( !$is_IIS && PHP_SAPI != 'cgi-fcgi' )
1169
-		status_header($status); // This causes problems on IIS and some FastCGI setups
1181
+	if ( !$is_IIS && PHP_SAPI != 'cgi-fcgi' ) {
1182
+			status_header($status);
1183
+	}
1184
+	// This causes problems on IIS and some FastCGI setups
1170 1185
 
1171 1186
 	header("Location: $location", true, $status);
1172 1187
 
@@ -1277,8 +1292,9 @@  discard block
 block discarded – undo
1277 1292
 function wp_validate_redirect($location, $default = '') {
1278 1293
 	$location = trim( $location );
1279 1294
 	// browsers will assume 'http' is your protocol, and will obey a redirect to a URL starting with '//'
1280
-	if ( substr($location, 0, 2) == '//' )
1281
-		$location = 'http:' . $location;
1295
+	if ( substr($location, 0, 2) == '//' ) {
1296
+			$location = 'http:' . $location;
1297
+	}
1282 1298
 
1283 1299
 	// In php 5 parse_url may fail if the URL query part contains http://, bug #38143
1284 1300
 	$test = ( $cut = strpos($location, '?') ) ? substr( $location, 0, $cut ) : $location;
@@ -1287,12 +1303,14 @@  discard block
 block discarded – undo
1287 1303
 	$lp = @parse_url($test);
1288 1304
 
1289 1305
 	// Give up if malformed URL
1290
-	if ( false === $lp )
1291
-		return $default;
1306
+	if ( false === $lp ) {
1307
+			return $default;
1308
+	}
1292 1309
 
1293 1310
 	// Allow only http and https schemes. No data:, etc.
1294
-	if ( isset($lp['scheme']) && !('http' == $lp['scheme'] || 'https' == $lp['scheme']) )
1295
-		return $default;
1311
+	if ( isset($lp['scheme']) && !('http' == $lp['scheme'] || 'https' == $lp['scheme']) ) {
1312
+			return $default;
1313
+	}
1296 1314
 
1297 1315
 	// Reject if certain components are set but host is not. This catches urls like https:host.com for which parse_url does not set the host field.
1298 1316
 	if ( ! isset( $lp['host'] ) && ( isset( $lp['scheme'] ) || isset( $lp['user'] ) || isset( $lp['pass'] ) || isset( $lp['port'] ) ) ) {
@@ -1318,8 +1336,9 @@  discard block
 block discarded – undo
1318 1336
 	 */
1319 1337
 	$allowed_hosts = (array) apply_filters( 'allowed_redirect_hosts', array($wpp['host']), isset($lp['host']) ? $lp['host'] : '' );
1320 1338
 
1321
-	if ( isset($lp['host']) && ( !in_array($lp['host'], $allowed_hosts) && $lp['host'] != strtolower($wpp['host'])) )
1322
-		$location = $default;
1339
+	if ( isset($lp['host']) && ( !in_array($lp['host'], $allowed_hosts) && $lp['host'] != strtolower($wpp['host'])) ) {
1340
+			$location = $default;
1341
+	}
1323 1342
 
1324 1343
 	return $location;
1325 1344
 }
@@ -1341,8 +1360,9 @@  discard block
 block discarded – undo
1341 1360
 	}
1342 1361
 
1343 1362
 	$comment = get_comment( $comment_id );
1344
-	if ( empty( $comment ) || empty( $comment->comment_post_ID ) )
1345
-		return false;
1363
+	if ( empty( $comment ) || empty( $comment->comment_post_ID ) ) {
1364
+			return false;
1365
+	}
1346 1366
 
1347 1367
 	$post    = get_post( $comment->comment_post_ID );
1348 1368
 	$author  = get_userdata( $post->post_author );
@@ -1467,19 +1487,22 @@  discard block
 block discarded – undo
1467 1487
 
1468 1488
 	if ( '' == $comment->comment_author ) {
1469 1489
 		$from = "From: \"$blogname\" <$wp_email>";
1470
-		if ( '' != $comment->comment_author_email )
1471
-			$reply_to = "Reply-To: $comment->comment_author_email";
1490
+		if ( '' != $comment->comment_author_email ) {
1491
+					$reply_to = "Reply-To: $comment->comment_author_email";
1492
+		}
1472 1493
 	} else {
1473 1494
 		$from = "From: \"$comment->comment_author\" <$wp_email>";
1474
-		if ( '' != $comment->comment_author_email )
1475
-			$reply_to = "Reply-To: \"$comment->comment_author_email\" <$comment->comment_author_email>";
1495
+		if ( '' != $comment->comment_author_email ) {
1496
+					$reply_to = "Reply-To: \"$comment->comment_author_email\" <$comment->comment_author_email>";
1497
+		}
1476 1498
 	}
1477 1499
 
1478 1500
 	$message_headers = "$from\n"
1479 1501
 		. "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
1480 1502
 
1481
-	if ( isset($reply_to) )
1482
-		$message_headers .= $reply_to . "\n";
1503
+	if ( isset($reply_to) ) {
1504
+			$message_headers .= $reply_to . "\n";
1505
+	}
1483 1506
 
1484 1507
 	/**
1485 1508
 	 * Filter the comment notification email text.
@@ -1558,8 +1581,9 @@  discard block
 block discarded – undo
1558 1581
 	// Send to the administration and to the post author if the author can modify the comment.
1559 1582
 	$emails = array( get_option( 'admin_email' ) );
1560 1583
 	if ( $user && user_can( $user->ID, 'edit_comment', $comment_id ) && ! empty( $user->user_email ) ) {
1561
-		if ( 0 !== strcasecmp( $user->user_email, get_option( 'admin_email' ) ) )
1562
-			$emails[] = $user->user_email;
1584
+		if ( 0 !== strcasecmp( $user->user_email, get_option( 'admin_email' ) ) ) {
1585
+					$emails[] = $user->user_email;
1586
+		}
1563 1587
 	}
1564 1588
 
1565 1589
 	$comment_author_domain = @gethostbyaddr($comment->comment_author_IP);
@@ -1599,10 +1623,11 @@  discard block
 block discarded – undo
1599 1623
 
1600 1624
 	$notify_message .= sprintf( __( 'Approve it: %s' ), admin_url( "comment.php?action=approve&c={$comment_id}#wpbody-content" ) ) . "\r\n";
1601 1625
 
1602
-	if ( EMPTY_TRASH_DAYS )
1603
-		$notify_message .= sprintf( __( 'Trash it: %s' ), admin_url( "comment.php?action=trash&c={$comment_id}#wpbody-content" ) ) . "\r\n";
1604
-	else
1605
-		$notify_message .= sprintf( __( 'Delete it: %s' ), admin_url( "comment.php?action=delete&c={$comment_id}#wpbody-content" ) ) . "\r\n";
1626
+	if ( EMPTY_TRASH_DAYS ) {
1627
+			$notify_message .= sprintf( __( 'Trash it: %s' ), admin_url( "comment.php?action=trash&c={$comment_id}#wpbody-content" ) ) . "\r\n";
1628
+	} else {
1629
+			$notify_message .= sprintf( __( 'Delete it: %s' ), admin_url( "comment.php?action=delete&c={$comment_id}#wpbody-content" ) ) . "\r\n";
1630
+	}
1606 1631
 
1607 1632
 	$notify_message .= sprintf( __( 'Spam it: %s' ), admin_url( "comment.php?action=spam&c={$comment_id}#wpbody-content" ) ) . "\r\n";
1608 1633
 
@@ -2093,10 +2118,12 @@  discard block
 block discarded – undo
2093 2118
  */
2094 2119
 function wp_generate_password( $length = 12, $special_chars = true, $extra_special_chars = false ) {
2095 2120
 	$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
2096
-	if ( $special_chars )
2097
-		$chars .= '!@#$%^&*()';
2098
-	if ( $extra_special_chars )
2099
-		$chars .= '-_ []{}<>~`+=,.;:/?|';
2121
+	if ( $special_chars ) {
2122
+			$chars .= '!@#$%^&*()';
2123
+	}
2124
+	if ( $extra_special_chars ) {
2125
+			$chars .= '-_ []{}<>~`+=,.;:/?|';
2126
+	}
2100 2127
 
2101 2128
 	$password = '';
2102 2129
 	for ( $i = 0; $i < $length; $i++ ) {
@@ -2163,10 +2190,11 @@  discard block
 block discarded – undo
2163 2190
 	// Reset $rnd_value after 14 uses
2164 2191
 	// 32(md5) + 40(sha1) + 40(sha1) / 8 = 14 random numbers from $rnd_value
2165 2192
 	if ( strlen($rnd_value) < 8 ) {
2166
-		if ( defined( 'WP_SETUP_CONFIG' ) )
2167
-			static $seed = '';
2168
-		else
2169
-			$seed = get_transient('random_seed');
2193
+		if ( defined( 'WP_SETUP_CONFIG' ) ) {
2194
+					static $seed = '';
2195
+		} else {
2196
+					$seed = get_transient('random_seed');
2197
+		}
2170 2198
 		$rnd_value = md5( uniqid(microtime() . mt_rand(), true ) . $seed );
2171 2199
 		$rnd_value .= sha1($rnd_value);
2172 2200
 		$rnd_value .= sha1($rnd_value . $seed);
@@ -2185,8 +2213,9 @@  discard block
 block discarded – undo
2185 2213
 	$value = abs(hexdec($value));
2186 2214
 
2187 2215
 	// Reduce the value to be within the min - max range
2188
-	if ( $max != 0 )
2189
-		$value = $min + ( $max - $min + 1 ) * $value / ( $max_random_number + 1 );
2216
+	if ( $max != 0 ) {
2217
+			$value = $min + ( $max - $min + 1 ) * $value / ( $max_random_number + 1 );
2218
+	}
2190 2219
 
2191 2220
 	return abs(intval($value));
2192 2221
 }
@@ -2401,8 +2430,9 @@  discard block
 block discarded – undo
2401 2430
 	$defaults = array( 'title' => '', 'title_left' => '', 'title_right' => '' );
2402 2431
 	$args = wp_parse_args( $args, $defaults );
2403 2432
 
2404
-	if ( ! class_exists( 'WP_Text_Diff_Renderer_Table', false ) )
2405
-		require( ABSPATH . WPINC . '/wp-diff.php' );
2433
+	if ( ! class_exists( 'WP_Text_Diff_Renderer_Table', false ) ) {
2434
+			require( ABSPATH . WPINC . '/wp-diff.php' );
2435
+	}
2406 2436
 
2407 2437
 	$left_string  = normalize_whitespace($left_string);
2408 2438
 	$right_string = normalize_whitespace($right_string);
@@ -2413,8 +2443,9 @@  discard block
 block discarded – undo
2413 2443
 	$renderer  = new WP_Text_Diff_Renderer_Table( $args );
2414 2444
 	$diff = $renderer->render($text_diff);
2415 2445
 
2416
-	if ( !$diff )
2417
-		return '';
2446
+	if ( !$diff ) {
2447
+			return '';
2448
+	}
2418 2449
 
2419 2450
 	$r  = "<table class='diff'>\n";
2420 2451
 
@@ -2424,18 +2455,21 @@  discard block
 block discarded – undo
2424 2455
 		$r .= "<col class='content' />";
2425 2456
 	}
2426 2457
 
2427
-	if ( $args['title'] || $args['title_left'] || $args['title_right'] )
2428
-		$r .= "<thead>";
2429
-	if ( $args['title'] )
2430
-		$r .= "<tr class='diff-title'><th colspan='4'>$args[title]</th></tr>\n";
2458
+	if ( $args['title'] || $args['title_left'] || $args['title_right'] ) {
2459
+			$r .= "<thead>";
2460
+	}
2461
+	if ( $args['title'] ) {
2462
+			$r .= "<tr class='diff-title'><th colspan='4'>$args[title]</th></tr>\n";
2463
+	}
2431 2464
 	if ( $args['title_left'] || $args['title_right'] ) {
2432 2465
 		$r .= "<tr class='diff-sub-title'>\n";
2433 2466
 		$r .= "\t<td></td><th>$args[title_left]</th>\n";
2434 2467
 		$r .= "\t<td></td><th>$args[title_right]</th>\n";
2435 2468
 		$r .= "</tr>\n";
2436 2469
 	}
2437
-	if ( $args['title'] || $args['title_left'] || $args['title_right'] )
2438
-		$r .= "</thead>\n";
2470
+	if ( $args['title'] || $args['title_left'] || $args['title_right'] ) {
2471
+			$r .= "</thead>\n";
2472
+	}
2439 2473
 
2440 2474
 	$r .= "<tbody>\n$diff\n</tbody>\n";
2441 2475
 	$r .= "</table>";
Please login to merge, or discard this patch.