Completed
Push — master ( cde0c6...d99bf9 )
by Stephen
15:46
created
src/wp-admin/includes/template.php 3 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -675,10 +675,10 @@  discard block
 block discarded – undo
675 675
  *
676 676
  * @global WP_Locale  $wp_locale
677 677
  *
678
- * @param int|bool $edit      Accepts 1|true for editing the date, 0|false for adding the date.
679
- * @param int|bool $for_post  Accepts 1|true for applying the date to a post, 0|false for a comment.
678
+ * @param integer $edit      Accepts 1|true for editing the date, 0|false for adding the date.
679
+ * @param integer $for_post  Accepts 1|true for applying the date to a post, 0|false for a comment.
680 680
  * @param int      $tab_index The tabindex attribute to add. Default 0.
681
- * @param int|bool $multi     Optional. Whether the additional fields and buttons should be added.
681
+ * @param integer $multi     Optional. Whether the additional fields and buttons should be added.
682 682
  *                            Default 0|false.
683 683
  */
684 684
 function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) {
@@ -984,7 +984,7 @@  discard block
 block discarded – undo
984 984
  * @staticvar bool $already_sorted
985 985
  * @param string|WP_Screen $screen  Screen identifier
986 986
  * @param string           $context box context
987
- * @param mixed            $object  gets passed to the box callback function as first parameter
987
+ * @param string            $object  gets passed to the box callback function as first parameter
988 988
  * @return int number of meta_boxes
989 989
  */
990 990
 function do_meta_boxes( $screen, $context, $object ) {
@@ -1533,7 +1533,7 @@  discard block
 block discarded – undo
1533 1533
  *
1534 1534
  * @since 2.7.0
1535 1535
  *
1536
- * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
1536
+ * @param integer $post Optional. Post ID or WP_Post object. Default is global $post.
1537 1537
  * @return string The post title if set.
1538 1538
  */
1539 1539
 function _draft_or_post_title( $post = 0 ) {
Please login to merge, or discard this patch.
Spacing   +467 added lines, -467 removed lines patch added patch discarded remove patch
@@ -9,10 +9,10 @@  discard block
 block discarded – undo
9 9
  */
10 10
 
11 11
 /** Walker_Category_Checklist class */
12
-require_once( ABSPATH . 'wp-admin/includes/class-walker-category-checklist.php' );
12
+require_once(ABSPATH.'wp-admin/includes/class-walker-category-checklist.php');
13 13
 
14 14
 /** WP_Internal_Pointers class */
15
-require_once( ABSPATH . 'wp-admin/includes/class-wp-internal-pointers.php' );
15
+require_once(ABSPATH.'wp-admin/includes/class-wp-internal-pointers.php');
16 16
 
17 17
 //
18 18
 // Category Checklists
@@ -37,15 +37,15 @@  discard block
 block discarded – undo
37 37
  * @param bool   $checked_ontop        Optional. Whether to move checked items out of the hierarchy and to
38 38
  *                                     the top of the list. Default true.
39 39
  */
40
-function wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $selected_cats = false, $popular_cats = false, $walker = null, $checked_ontop = true ) {
41
-	wp_terms_checklist( $post_id, array(
40
+function wp_category_checklist($post_id = 0, $descendants_and_self = 0, $selected_cats = false, $popular_cats = false, $walker = null, $checked_ontop = true) {
41
+	wp_terms_checklist($post_id, array(
42 42
 		'taxonomy' => 'category',
43 43
 		'descendants_and_self' => $descendants_and_self,
44 44
 		'selected_cats' => $selected_cats,
45 45
 		'popular_cats' => $popular_cats,
46 46
 		'walker' => $walker,
47 47
 		'checked_ontop' => $checked_ontop
48
-	) );
48
+	));
49 49
 }
50 50
 
51 51
 /**
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
  *                                        of echoing it. Default true.
75 75
  * }
76 76
  */
77
-function wp_terms_checklist( $post_id = 0, $args = array() ) {
77
+function wp_terms_checklist($post_id = 0, $args = array()) {
78 78
  	$defaults = array(
79 79
 		'descendants_and_self' => 0,
80 80
 		'selected_cats' => false,
@@ -95,11 +95,11 @@  discard block
 block discarded – undo
95 95
 	 * @param array $args    An array of arguments.
96 96
 	 * @param int   $post_id The post ID.
97 97
 	 */
98
-	$params = apply_filters( 'wp_terms_checklist_args', $args, $post_id );
98
+	$params = apply_filters('wp_terms_checklist_args', $args, $post_id);
99 99
 
100
-	$r = wp_parse_args( $params, $defaults );
100
+	$r = wp_parse_args($params, $defaults);
101 101
 
102
-	if ( empty( $r['walker'] ) || ! ( $r['walker'] instanceof Walker ) ) {
102
+	if (empty($r['walker']) || ! ($r['walker'] instanceof Walker)) {
103 103
 		$walker = new Walker_Category_Checklist;
104 104
 	} else {
105 105
 		$walker = $r['walker'];
@@ -108,64 +108,64 @@  discard block
 block discarded – undo
108 108
 	$taxonomy = $r['taxonomy'];
109 109
 	$descendants_and_self = (int) $r['descendants_and_self'];
110 110
 
111
-	$args = array( 'taxonomy' => $taxonomy );
111
+	$args = array('taxonomy' => $taxonomy);
112 112
 
113
-	$tax = get_taxonomy( $taxonomy );
114
-	$args['disabled'] = ! current_user_can( $tax->cap->assign_terms );
113
+	$tax = get_taxonomy($taxonomy);
114
+	$args['disabled'] = ! current_user_can($tax->cap->assign_terms);
115 115
 
116
-	$args['list_only'] = ! empty( $r['list_only'] );
116
+	$args['list_only'] = ! empty($r['list_only']);
117 117
 
118
-	if ( is_array( $r['selected_cats'] ) ) {
118
+	if (is_array($r['selected_cats'])) {
119 119
 		$args['selected_cats'] = $r['selected_cats'];
120
-	} elseif ( $post_id ) {
121
-		$args['selected_cats'] = wp_get_object_terms( $post_id, $taxonomy, array_merge( $args, array( 'fields' => 'ids' ) ) );
120
+	} elseif ($post_id) {
121
+		$args['selected_cats'] = wp_get_object_terms($post_id, $taxonomy, array_merge($args, array('fields' => 'ids')));
122 122
 	} else {
123 123
 		$args['selected_cats'] = array();
124 124
 	}
125
-	if ( is_array( $r['popular_cats'] ) ) {
125
+	if (is_array($r['popular_cats'])) {
126 126
 		$args['popular_cats'] = $r['popular_cats'];
127 127
 	} else {
128
-		$args['popular_cats'] = get_terms( $taxonomy, array(
128
+		$args['popular_cats'] = get_terms($taxonomy, array(
129 129
 			'fields' => 'ids',
130 130
 			'orderby' => 'count',
131 131
 			'order' => 'DESC',
132 132
 			'number' => 10,
133 133
 			'hierarchical' => false
134
-		) );
134
+		));
135 135
 	}
136
-	if ( $descendants_and_self ) {
137
-		$categories = (array) get_terms( $taxonomy, array(
136
+	if ($descendants_and_self) {
137
+		$categories = (array) get_terms($taxonomy, array(
138 138
 			'child_of' => $descendants_and_self,
139 139
 			'hierarchical' => 0,
140 140
 			'hide_empty' => 0
141
-		) );
142
-		$self = get_term( $descendants_and_self, $taxonomy );
143
-		array_unshift( $categories, $self );
141
+		));
142
+		$self = get_term($descendants_and_self, $taxonomy);
143
+		array_unshift($categories, $self);
144 144
 	} else {
145
-		$categories = (array) get_terms( $taxonomy, array( 'get' => 'all' ) );
145
+		$categories = (array) get_terms($taxonomy, array('get' => 'all'));
146 146
 	}
147 147
 
148 148
 	$output = '';
149 149
 
150
-	if ( $r['checked_ontop'] ) {
150
+	if ($r['checked_ontop']) {
151 151
 		// Post process $categories rather than adding an exclude to the get_terms() query to keep the query the same across all posts (for any query cache)
152 152
 		$checked_categories = array();
153
-		$keys = array_keys( $categories );
153
+		$keys = array_keys($categories);
154 154
 
155
-		foreach ( $keys as $k ) {
156
-			if ( in_array( $categories[$k]->term_id, $args['selected_cats'] ) ) {
155
+		foreach ($keys as $k) {
156
+			if (in_array($categories[$k]->term_id, $args['selected_cats'])) {
157 157
 				$checked_categories[] = $categories[$k];
158
-				unset( $categories[$k] );
158
+				unset($categories[$k]);
159 159
 			}
160 160
 		}
161 161
 
162 162
 		// Put checked cats on top
163
-		$output .= call_user_func_array( array( $walker, 'walk' ), array( $checked_categories, 0, $args ) );
163
+		$output .= call_user_func_array(array($walker, 'walk'), array($checked_categories, 0, $args));
164 164
 	}
165 165
 	// Then the rest of them
166
-	$output .= call_user_func_array( array( $walker, 'walk' ), array( $categories, 0, $args ) );
166
+	$output .= call_user_func_array(array($walker, 'walk'), array($categories, 0, $args));
167 167
 
168
-	if ( $r['echo'] ) {
168
+	if ($r['echo']) {
169 169
 		echo $output;
170 170
 	}
171 171
 
@@ -188,33 +188,33 @@  discard block
 block discarded – undo
188 188
  * @param bool $echo Optionally output the list as well. Defaults to true.
189 189
  * @return array List of popular term IDs.
190 190
  */
191
-function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $echo = true ) {
191
+function wp_popular_terms_checklist($taxonomy, $default = 0, $number = 10, $echo = true) {
192 192
 	$post = get_post();
193 193
 
194
-	if ( $post && $post->ID )
194
+	if ($post && $post->ID)
195 195
 		$checked_terms = wp_get_object_terms($post->ID, $taxonomy, array('fields'=>'ids'));
196 196
 	else
197 197
 		$checked_terms = array();
198 198
 
199
-	$terms = get_terms( $taxonomy, array( 'orderby' => 'count', 'order' => 'DESC', 'number' => $number, 'hierarchical' => false ) );
199
+	$terms = get_terms($taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'number' => $number, 'hierarchical' => false));
200 200
 
201 201
 	$tax = get_taxonomy($taxonomy);
202 202
 
203 203
 	$popular_ids = array();
204
-	foreach ( (array) $terms as $term ) {
204
+	foreach ((array) $terms as $term) {
205 205
 		$popular_ids[] = $term->term_id;
206
-		if ( !$echo ) // Hack for Ajax use.
206
+		if ( ! $echo) // Hack for Ajax use.
207 207
 			continue;
208 208
 		$id = "popular-$taxonomy-$term->term_id";
209
-		$checked = in_array( $term->term_id, $checked_terms ) ? 'checked="checked"' : '';
209
+		$checked = in_array($term->term_id, $checked_terms) ? 'checked="checked"' : '';
210 210
 		?>
211 211
 
212 212
 		<li id="<?php echo $id; ?>" class="popular-category">
213 213
 			<label class="selectit">
214
-				<input id="in-<?php echo $id; ?>" type="checkbox" <?php echo $checked; ?> value="<?php echo (int) $term->term_id; ?>" <?php disabled( ! current_user_can( $tax->cap->assign_terms ) ); ?> />
214
+				<input id="in-<?php echo $id; ?>" type="checkbox" <?php echo $checked; ?> value="<?php echo (int) $term->term_id; ?>" <?php disabled( ! current_user_can($tax->cap->assign_terms)); ?> />
215 215
 				<?php
216 216
 				/** This filter is documented in wp-includes/category-template.php */
217
-				echo esc_html( apply_filters( 'the_category', $term->name ) );
217
+				echo esc_html(apply_filters('the_category', $term->name));
218 218
 				?>
219 219
 			</label>
220 220
 		</li>
@@ -231,32 +231,32 @@  discard block
 block discarded – undo
231 231
  *
232 232
  * @param int $link_id
233 233
  */
234
-function wp_link_category_checklist( $link_id = 0 ) {
234
+function wp_link_category_checklist($link_id = 0) {
235 235
 	$default = 1;
236 236
 
237 237
 	$checked_categories = array();
238 238
 
239
-	if ( $link_id ) {
240
-		$checked_categories = wp_get_link_cats( $link_id );
239
+	if ($link_id) {
240
+		$checked_categories = wp_get_link_cats($link_id);
241 241
 		// No selected categories, strange
242
-		if ( ! count( $checked_categories ) ) {
242
+		if ( ! count($checked_categories)) {
243 243
 			$checked_categories[] = $default;
244 244
 		}
245 245
 	} else {
246 246
 		$checked_categories[] = $default;
247 247
 	}
248 248
 
249
-	$categories = get_terms( 'link_category', array( 'orderby' => 'name', 'hide_empty' => 0 ) );
249
+	$categories = get_terms('link_category', array('orderby' => 'name', 'hide_empty' => 0));
250 250
 
251
-	if ( empty( $categories ) )
251
+	if (empty($categories))
252 252
 		return;
253 253
 
254
-	foreach ( $categories as $category ) {
254
+	foreach ($categories as $category) {
255 255
 		$cat_id = $category->term_id;
256 256
 
257 257
 		/** This filter is documented in wp-includes/category-template.php */
258
-		$name = esc_html( apply_filters( 'the_category', $category->name ) );
259
-		$checked = in_array( $cat_id, $checked_categories ) ? ' checked="checked"' : '';
258
+		$name = esc_html(apply_filters('the_category', $category->name));
259
+		$checked = in_array($cat_id, $checked_categories) ? ' checked="checked"' : '';
260 260
 		echo '<li id="link-category-', $cat_id, '"><label for="in-link-category-', $cat_id, '" class="selectit"><input value="', $cat_id, '" type="checkbox" name="link_category[]" id="in-link-category-', $cat_id, '"', $checked, '/> ', $name, "</label></li>";
261 261
 	}
262 262
 }
@@ -270,72 +270,72 @@  discard block
 block discarded – undo
270 270
  */
271 271
 function get_inline_data($post) {
272 272
 	$post_type_object = get_post_type_object($post->post_type);
273
-	if ( ! current_user_can( 'edit_post', $post->ID ) )
273
+	if ( ! current_user_can('edit_post', $post->ID))
274 274
 		return;
275 275
 
276
-	$title = esc_textarea( trim( $post->post_title ) );
276
+	$title = esc_textarea(trim($post->post_title));
277 277
 
278 278
 	/** This filter is documented in wp-admin/edit-tag-form.php */
279 279
 	echo '
280
-<div class="hidden" id="inline_' . $post->ID . '">
281
-	<div class="post_title">' . $title . '</div>' .
280
+<div class="hidden" id="inline_' . $post->ID.'">
281
+	<div class="post_title">' . $title.'</div>'.
282 282
 	/** This filter is documented in wp-admin/edit-tag-form.php */
283
-	'<div class="post_name">' . apply_filters( 'editable_slug', $post->post_name, $post ) . '</div>
284
-	<div class="post_author">' . $post->post_author . '</div>
285
-	<div class="comment_status">' . esc_html( $post->comment_status ) . '</div>
286
-	<div class="ping_status">' . esc_html( $post->ping_status ) . '</div>
287
-	<div class="_status">' . esc_html( $post->post_status ) . '</div>
288
-	<div class="jj">' . mysql2date( 'd', $post->post_date, false ) . '</div>
289
-	<div class="mm">' . mysql2date( 'm', $post->post_date, false ) . '</div>
290
-	<div class="aa">' . mysql2date( 'Y', $post->post_date, false ) . '</div>
291
-	<div class="hh">' . mysql2date( 'H', $post->post_date, false ) . '</div>
292
-	<div class="mn">' . mysql2date( 'i', $post->post_date, false ) . '</div>
293
-	<div class="ss">' . mysql2date( 's', $post->post_date, false ) . '</div>
294
-	<div class="post_password">' . esc_html( $post->post_password ) . '</div>';
295
-
296
-	if ( $post_type_object->hierarchical ) {
297
-		echo '<div class="post_parent">' . $post->post_parent . '</div>';
283
+	'<div class="post_name">'.apply_filters('editable_slug', $post->post_name, $post).'</div>
284
+	<div class="post_author">' . $post->post_author.'</div>
285
+	<div class="comment_status">' . esc_html($post->comment_status).'</div>
286
+	<div class="ping_status">' . esc_html($post->ping_status).'</div>
287
+	<div class="_status">' . esc_html($post->post_status).'</div>
288
+	<div class="jj">' . mysql2date('d', $post->post_date, false).'</div>
289
+	<div class="mm">' . mysql2date('m', $post->post_date, false).'</div>
290
+	<div class="aa">' . mysql2date('Y', $post->post_date, false).'</div>
291
+	<div class="hh">' . mysql2date('H', $post->post_date, false).'</div>
292
+	<div class="mn">' . mysql2date('i', $post->post_date, false).'</div>
293
+	<div class="ss">' . mysql2date('s', $post->post_date, false).'</div>
294
+	<div class="post_password">' . esc_html($post->post_password).'</div>';
295
+
296
+	if ($post_type_object->hierarchical) {
297
+		echo '<div class="post_parent">'.$post->post_parent.'</div>';
298 298
 	}
299 299
 
300
-	echo '<div class="page_template">' . ( $post->page_template ? esc_html( $post->page_template ) : 'default' ) . '</div>';
300
+	echo '<div class="page_template">'.($post->page_template ? esc_html($post->page_template) : 'default').'</div>';
301 301
 
302
-	if ( post_type_supports( $post->post_type, 'page-attributes' ) ) {
303
-		echo '<div class="menu_order">' . $post->menu_order . '</div>';
302
+	if (post_type_supports($post->post_type, 'page-attributes')) {
303
+		echo '<div class="menu_order">'.$post->menu_order.'</div>';
304 304
 	}
305 305
 
306
-	$taxonomy_names = get_object_taxonomies( $post->post_type );
307
-	foreach ( $taxonomy_names as $taxonomy_name) {
308
-		$taxonomy = get_taxonomy( $taxonomy_name );
306
+	$taxonomy_names = get_object_taxonomies($post->post_type);
307
+	foreach ($taxonomy_names as $taxonomy_name) {
308
+		$taxonomy = get_taxonomy($taxonomy_name);
309 309
 
310
-		if ( $taxonomy->hierarchical && $taxonomy->show_ui ) {
310
+		if ($taxonomy->hierarchical && $taxonomy->show_ui) {
311 311
 
312
-			$terms = get_object_term_cache( $post->ID, $taxonomy_name );
313
-			if ( false === $terms ) {
314
-				$terms = wp_get_object_terms( $post->ID, $taxonomy_name );
315
-				wp_cache_add( $post->ID, wp_list_pluck( $terms, 'term_id' ), $taxonomy_name . '_relationships' );
312
+			$terms = get_object_term_cache($post->ID, $taxonomy_name);
313
+			if (false === $terms) {
314
+				$terms = wp_get_object_terms($post->ID, $taxonomy_name);
315
+				wp_cache_add($post->ID, wp_list_pluck($terms, 'term_id'), $taxonomy_name.'_relationships');
316 316
 			}
317
-			$term_ids = empty( $terms ) ? array() : wp_list_pluck( $terms, 'term_id' );
317
+			$term_ids = empty($terms) ? array() : wp_list_pluck($terms, 'term_id');
318 318
 
319
-			echo '<div class="post_category" id="' . $taxonomy_name . '_' . $post->ID . '">' . implode( ',', $term_ids ) . '</div>';
319
+			echo '<div class="post_category" id="'.$taxonomy_name.'_'.$post->ID.'">'.implode(',', $term_ids).'</div>';
320 320
 
321
-		} elseif ( $taxonomy->show_ui ) {
321
+		} elseif ($taxonomy->show_ui) {
322 322
 
323
-			$terms_to_edit = get_terms_to_edit( $post->ID, $taxonomy_name );
324
-			if ( ! is_string( $terms_to_edit ) ) {
323
+			$terms_to_edit = get_terms_to_edit($post->ID, $taxonomy_name);
324
+			if ( ! is_string($terms_to_edit)) {
325 325
 				$terms_to_edit = '';
326 326
 			}
327 327
 
328 328
 			echo '<div class="tags_input" id="'.$taxonomy_name.'_'.$post->ID.'">'
329
-				. esc_html( str_replace( ',', ', ', $terms_to_edit ) ) . '</div>';
329
+				. esc_html(str_replace(',', ', ', $terms_to_edit)).'</div>';
330 330
 
331 331
 		}
332 332
 	}
333 333
 
334
-	if ( !$post_type_object->hierarchical )
335
-		echo '<div class="sticky">' . (is_sticky($post->ID) ? 'sticky' : '') . '</div>';
334
+	if ( ! $post_type_object->hierarchical)
335
+		echo '<div class="sticky">'.(is_sticky($post->ID) ? 'sticky' : '').'</div>';
336 336
 
337
-	if ( post_type_supports( $post->post_type, 'post-formats' ) )
338
-		echo '<div class="post_format">' . esc_html( get_post_format( $post->ID ) ) . '</div>';
337
+	if (post_type_supports($post->post_type, 'post-formats'))
338
+		echo '<div class="post_format">'.esc_html(get_post_format($post->ID)).'</div>';
339 339
 
340 340
 	echo '</div>';
341 341
 }
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
  * @param string $mode
353 353
  * @param bool   $table_row
354 354
  */
355
-function wp_comment_reply( $position = 1, $checkbox = false, $mode = 'single', $table_row = true ) {
355
+function wp_comment_reply($position = 1, $checkbox = false, $mode = 'single', $table_row = true) {
356 356
 	global $wp_list_table;
357 357
 	/**
358 358
 	 * Filters the in-line comment reply-to form output in the Comments
@@ -369,15 +369,15 @@  discard block
 block discarded – undo
369 369
 	 * @param string $content The reply-to form content.
370 370
 	 * @param array  $args    An array of default args.
371 371
 	 */
372
-	$content = apply_filters( 'wp_comment_reply', '', array( 'position' => $position, 'checkbox' => $checkbox, 'mode' => $mode ) );
372
+	$content = apply_filters('wp_comment_reply', '', array('position' => $position, 'checkbox' => $checkbox, 'mode' => $mode));
373 373
 
374
-	if ( ! empty($content) ) {
374
+	if ( ! empty($content)) {
375 375
 		echo $content;
376 376
 		return;
377 377
 	}
378 378
 
379
-	if ( ! $wp_list_table ) {
380
-		if ( $mode == 'single' ) {
379
+	if ( ! $wp_list_table) {
380
+		if ($mode == 'single') {
381 381
 			$wp_list_table = _get_list_table('WP_Post_Comments_List_Table');
382 382
 		} else {
383 383
 			$wp_list_table = _get_list_table('WP_Comments_List_Table');
@@ -386,29 +386,29 @@  discard block
 block discarded – undo
386 386
 
387 387
 ?>
388 388
 <form method="get">
389
-<?php if ( $table_row ) : ?>
389
+<?php if ($table_row) : ?>
390 390
 <table style="display:none;"><tbody id="com-reply"><tr id="replyrow" class="inline-edit-row" style="display:none;"><td colspan="<?php echo $wp_list_table->get_column_count(); ?>" class="colspanchange">
391 391
 <?php else : ?>
392 392
 <div id="com-reply" style="display:none;"><div id="replyrow" style="display:none;">
393 393
 <?php endif; ?>
394 394
 	<fieldset class="comment-reply">
395 395
 	<legend>
396
-		<span class="hidden" id="editlegend"><?php _e( 'Edit Comment' ); ?></span>
397
-		<span class="hidden" id="replyhead"><?php _e( 'Reply to Comment' ); ?></span>
398
-		<span class="hidden" id="addhead"><?php _e( 'Add new Comment' ); ?></span>
396
+		<span class="hidden" id="editlegend"><?php _e('Edit Comment'); ?></span>
397
+		<span class="hidden" id="replyhead"><?php _e('Reply to Comment'); ?></span>
398
+		<span class="hidden" id="addhead"><?php _e('Add new Comment'); ?></span>
399 399
 	</legend>
400 400
 
401 401
 	<div id="replycontainer">
402
-	<label for="replycontent" class="screen-reader-text"><?php _e( 'Comment' ); ?></label>
402
+	<label for="replycontent" class="screen-reader-text"><?php _e('Comment'); ?></label>
403 403
 	<?php
404
-	$quicktags_settings = array( 'buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,close' );
405
-	wp_editor( '', 'replycontent', array( 'media_buttons' => false, 'tinymce' => false, 'quicktags' => $quicktags_settings ) );
404
+	$quicktags_settings = array('buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,close');
405
+	wp_editor('', 'replycontent', array('media_buttons' => false, 'tinymce' => false, 'quicktags' => $quicktags_settings));
406 406
 	?>
407 407
 	</div>
408 408
 
409 409
 	<div id="edithead" style="display:none;">
410 410
 		<div class="inside">
411
-		<label for="author-name"><?php _e( 'Name' ) ?></label>
411
+		<label for="author-name"><?php _e('Name') ?></label>
412 412
 		<input type="text" name="newcomment_author" size="50" value="" id="author-name" />
413 413
 		</div>
414 414
 
@@ -441,12 +441,12 @@  discard block
 block discarded – undo
441 441
 	<input type="hidden" name="checkbox" id="checkbox" value="<?php echo $checkbox ? 1 : 0; ?>" />
442 442
 	<input type="hidden" name="mode" id="mode" value="<?php echo esc_attr($mode); ?>" />
443 443
 	<?php
444
-		wp_nonce_field( 'replyto-comment', '_ajax_nonce-replyto-comment', false );
445
-		if ( current_user_can( 'unfiltered_html' ) )
446
-			wp_nonce_field( 'unfiltered-html-comment', '_wp_unfiltered_html_comment', false );
444
+		wp_nonce_field('replyto-comment', '_ajax_nonce-replyto-comment', false);
445
+		if (current_user_can('unfiltered_html'))
446
+			wp_nonce_field('unfiltered-html-comment', '_wp_unfiltered_html_comment', false);
447 447
 	?>
448 448
 	</fieldset>
449
-<?php if ( $table_row ) : ?>
449
+<?php if ($table_row) : ?>
450 450
 </td></tr></tbody></table>
451 451
 <?php else : ?>
452 452
 </div></div>
@@ -478,15 +478,15 @@  discard block
 block discarded – undo
478 478
  *
479 479
  * @param array $meta
480 480
  */
481
-function list_meta( $meta ) {
481
+function list_meta($meta) {
482 482
 	// Exit if no meta
483
-	if ( ! $meta ) {
483
+	if ( ! $meta) {
484 484
 		echo '
485 485
 <table id="list-table" style="display: none;">
486 486
 	<thead>
487 487
 	<tr>
488
-		<th class="left">' . _x( 'Name', 'meta name' ) . '</th>
489
-		<th>' . __( 'Value' ) . '</th>
488
+		<th class="left">' . _x('Name', 'meta name').'</th>
489
+		<th>' . __('Value').'</th>
490 490
 	</tr>
491 491
 	</thead>
492 492
 	<tbody id="the-list" data-wp-lists="list:meta">
@@ -500,14 +500,14 @@  discard block
 block discarded – undo
500 500
 <table id="list-table">
501 501
 	<thead>
502 502
 	<tr>
503
-		<th class="left"><?php _ex( 'Name', 'meta name' ) ?></th>
504
-		<th><?php _e( 'Value' ) ?></th>
503
+		<th class="left"><?php _ex('Name', 'meta name') ?></th>
504
+		<th><?php _e('Value') ?></th>
505 505
 	</tr>
506 506
 	</thead>
507 507
 	<tbody id='the-list' data-wp-lists='list:meta'>
508 508
 <?php
509
-	foreach ( $meta as $entry )
510
-		echo _list_meta_row( $entry, $count );
509
+	foreach ($meta as $entry)
510
+		echo _list_meta_row($entry, $count);
511 511
 ?>
512 512
 	</tbody>
513 513
 </table>
@@ -525,22 +525,22 @@  discard block
 block discarded – undo
525 525
  * @param int   $count
526 526
  * @return string
527 527
  */
528
-function _list_meta_row( $entry, &$count ) {
528
+function _list_meta_row($entry, &$count) {
529 529
 	static $update_nonce = '';
530 530
 
531
-	if ( is_protected_meta( $entry['meta_key'], 'post' ) )
531
+	if (is_protected_meta($entry['meta_key'], 'post'))
532 532
 		return '';
533 533
 
534
-	if ( ! $update_nonce )
535
-		$update_nonce = wp_create_nonce( 'add-meta' );
534
+	if ( ! $update_nonce)
535
+		$update_nonce = wp_create_nonce('add-meta');
536 536
 
537 537
 	$r = '';
538
-	++ $count;
538
+	++$count;
539 539
 
540
-	if ( is_serialized( $entry['meta_value'] ) ) {
541
-		if ( is_serialized_string( $entry['meta_value'] ) ) {
540
+	if (is_serialized($entry['meta_value'])) {
541
+		if (is_serialized_string($entry['meta_value'])) {
542 542
 			// This is a serialized string, so we should display it.
543
-			$entry['meta_value'] = maybe_unserialize( $entry['meta_value'] );
543
+			$entry['meta_value'] = maybe_unserialize($entry['meta_value']);
544 544
 		} else {
545 545
 			// This is a serialized array/object so we should NOT display it.
546 546
 			--$count;
@@ -549,23 +549,23 @@  discard block
 block discarded – undo
549 549
 	}
550 550
 
551 551
 	$entry['meta_key'] = esc_attr($entry['meta_key']);
552
-	$entry['meta_value'] = esc_textarea( $entry['meta_value'] ); // using a <textarea />
552
+	$entry['meta_value'] = esc_textarea($entry['meta_value']); // using a <textarea />
553 553
 	$entry['meta_id'] = (int) $entry['meta_id'];
554 554
 
555
-	$delete_nonce = wp_create_nonce( 'delete-meta_' . $entry['meta_id'] );
555
+	$delete_nonce = wp_create_nonce('delete-meta_'.$entry['meta_id']);
556 556
 
557 557
 	$r .= "\n\t<tr id='meta-{$entry['meta_id']}'>";
558
-	$r .= "\n\t\t<td class='left'><label class='screen-reader-text' for='meta-{$entry['meta_id']}-key'>" . __( 'Key' ) . "</label><input name='meta[{$entry['meta_id']}][key]' id='meta-{$entry['meta_id']}-key' type='text' size='20' value='{$entry['meta_key']}' />";
558
+	$r .= "\n\t\t<td class='left'><label class='screen-reader-text' for='meta-{$entry['meta_id']}-key'>".__('Key')."</label><input name='meta[{$entry['meta_id']}][key]' id='meta-{$entry['meta_id']}-key' type='text' size='20' value='{$entry['meta_key']}' />";
559 559
 
560 560
 	$r .= "\n\t\t<div class='submit'>";
561
-	$r .= get_submit_button( __( 'Delete' ), 'deletemeta small', "deletemeta[{$entry['meta_id']}]", false, array( 'data-wp-lists' => "delete:the-list:meta-{$entry['meta_id']}::_ajax_nonce=$delete_nonce" ) );
561
+	$r .= get_submit_button(__('Delete'), 'deletemeta small', "deletemeta[{$entry['meta_id']}]", false, array('data-wp-lists' => "delete:the-list:meta-{$entry['meta_id']}::_ajax_nonce=$delete_nonce"));
562 562
 	$r .= "\n\t\t";
563
-	$r .= get_submit_button( __( 'Update' ), 'updatemeta small', "meta-{$entry['meta_id']}-submit", false, array( 'data-wp-lists' => "add:the-list:meta-{$entry['meta_id']}::_ajax_nonce-add-meta=$update_nonce" ) );
563
+	$r .= get_submit_button(__('Update'), 'updatemeta small', "meta-{$entry['meta_id']}-submit", false, array('data-wp-lists' => "add:the-list:meta-{$entry['meta_id']}::_ajax_nonce-add-meta=$update_nonce"));
564 564
 	$r .= "</div>";
565
-	$r .= wp_nonce_field( 'change-meta', '_ajax_nonce', false, false );
565
+	$r .= wp_nonce_field('change-meta', '_ajax_nonce', false, false);
566 566
 	$r .= "</td>";
567 567
 
568
-	$r .= "\n\t\t<td><label class='screen-reader-text' for='meta-{$entry['meta_id']}-value'>" . __( 'Value' ) . "</label><textarea name='meta[{$entry['meta_id']}][value]' id='meta-{$entry['meta_id']}-value' rows='2' cols='30'>{$entry['meta_value']}</textarea></td>\n\t</tr>";
568
+	$r .= "\n\t\t<td><label class='screen-reader-text' for='meta-{$entry['meta_id']}-value'>".__('Value')."</label><textarea name='meta[{$entry['meta_id']}][value]' id='meta-{$entry['meta_id']}-value' rows='2' cols='30'>{$entry['meta_value']}</textarea></td>\n\t</tr>";
569 569
 	return $r;
570 570
 }
571 571
 
@@ -578,9 +578,9 @@  discard block
 block discarded – undo
578 578
  *
579 579
  * @param WP_Post $post Optional. The post being edited.
580 580
  */
581
-function meta_form( $post = null ) {
581
+function meta_form($post = null) {
582 582
 	global $wpdb;
583
-	$post = get_post( $post );
583
+	$post = get_post($post);
584 584
 
585 585
 	/**
586 586
 	 * Filters values for the meta key dropdown in the Custom Fields meta box.
@@ -593,9 +593,9 @@  discard block
 block discarded – undo
593 593
 	 * @param array|null $keys Pre-defined meta keys to be used in place of a postmeta query. Default null.
594 594
 	 * @param WP_Post    $post The current post object.
595 595
 	 */
596
-	$keys = apply_filters( 'postmeta_form_keys', null, $post );
596
+	$keys = apply_filters('postmeta_form_keys', null, $post);
597 597
 
598
-	if ( null === $keys ) {
598
+	if (null === $keys) {
599 599
 		/**
600 600
 		 * Filters the number of custom fields to retrieve for the drop-down
601 601
 		 * in the Custom Fields meta box.
@@ -604,44 +604,44 @@  discard block
 block discarded – undo
604 604
 		 *
605 605
 		 * @param int $limit Number of custom fields to retrieve. Default 30.
606 606
 		 */
607
-		$limit = apply_filters( 'postmeta_form_limit', 30 );
607
+		$limit = apply_filters('postmeta_form_limit', 30);
608 608
 		$sql = "SELECT DISTINCT meta_key
609 609
 			FROM $wpdb->postmeta
610 610
 			WHERE meta_key NOT BETWEEN '_' AND '_z'
611 611
 			HAVING meta_key NOT LIKE %s
612 612
 			ORDER BY meta_key
613 613
 			LIMIT %d";
614
-		$keys = $wpdb->get_col( $wpdb->prepare( $sql, $wpdb->esc_like( '_' ) . '%', $limit ) );
614
+		$keys = $wpdb->get_col($wpdb->prepare($sql, $wpdb->esc_like('_').'%', $limit));
615 615
 	}
616 616
 
617
-	if ( $keys ) {
618
-		natcasesort( $keys );
617
+	if ($keys) {
618
+		natcasesort($keys);
619 619
 		$meta_key_input_id = 'metakeyselect';
620 620
 	} else {
621 621
 		$meta_key_input_id = 'metakeyinput';
622 622
 	}
623 623
 ?>
624
-<p><strong><?php _e( 'Add New Custom Field:' ) ?></strong></p>
624
+<p><strong><?php _e('Add New Custom Field:') ?></strong></p>
625 625
 <table id="newmeta">
626 626
 <thead>
627 627
 <tr>
628
-<th class="left"><label for="<?php echo $meta_key_input_id; ?>"><?php _ex( 'Name', 'meta name' ) ?></label></th>
629
-<th><label for="metavalue"><?php _e( 'Value' ) ?></label></th>
628
+<th class="left"><label for="<?php echo $meta_key_input_id; ?>"><?php _ex('Name', 'meta name') ?></label></th>
629
+<th><label for="metavalue"><?php _e('Value') ?></label></th>
630 630
 </tr>
631 631
 </thead>
632 632
 
633 633
 <tbody>
634 634
 <tr>
635 635
 <td id="newmetaleft" class="left">
636
-<?php if ( $keys ) { ?>
636
+<?php if ($keys) { ?>
637 637
 <select id="metakeyselect" name="metakeyselect">
638
-<option value="#NONE#"><?php _e( '&mdash; Select &mdash;' ); ?></option>
638
+<option value="#NONE#"><?php _e('&mdash; Select &mdash;'); ?></option>
639 639
 <?php
640 640
 
641
-	foreach ( $keys as $key ) {
642
-		if ( is_protected_meta( $key, 'post' ) || ! current_user_can( 'add_post_meta', $post->ID, $key ) )
641
+	foreach ($keys as $key) {
642
+		if (is_protected_meta($key, 'post') || ! current_user_can('add_post_meta', $post->ID, $key))
643 643
 			continue;
644
-		echo "\n<option value='" . esc_attr($key) . "'>" . esc_html($key) . "</option>";
644
+		echo "\n<option value='".esc_attr($key)."'>".esc_html($key)."</option>";
645 645
 	}
646 646
 ?>
647 647
 </select>
@@ -658,9 +658,9 @@  discard block
 block discarded – undo
658 658
 
659 659
 <tr><td colspan="2">
660 660
 <div class="submit">
661
-<?php submit_button( __( 'Add Custom Field' ), '', 'addmeta', false, array( 'id' => 'newmeta-submit', 'data-wp-lists' => 'add:the-list:newmeta' ) ); ?>
661
+<?php submit_button(__('Add Custom Field'), '', 'addmeta', false, array('id' => 'newmeta-submit', 'data-wp-lists' => 'add:the-list:newmeta')); ?>
662 662
 </div>
663
-<?php wp_nonce_field( 'add-meta', '_ajax_nonce-add-meta', false ); ?>
663
+<?php wp_nonce_field('add-meta', '_ajax_nonce-add-meta', false); ?>
664 664
 </td></tr>
665 665
 </tbody>
666 666
 </table>
@@ -682,15 +682,15 @@  discard block
 block discarded – undo
682 682
  * @param int|bool $multi     Optional. Whether the additional fields and buttons should be added.
683 683
  *                            Default 0|false.
684 684
  */
685
-function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) {
685
+function touch_time($edit = 1, $for_post = 1, $tab_index = 0, $multi = 0) {
686 686
 	global $wp_locale;
687 687
 	$post = get_post();
688 688
 
689
-	if ( $for_post )
690
-		$edit = ! ( in_array($post->post_status, array('draft', 'pending') ) && (!$post->post_date_gmt || '0000-00-00 00:00:00' == $post->post_date_gmt ) );
689
+	if ($for_post)
690
+		$edit = ! (in_array($post->post_status, array('draft', 'pending')) && ( ! $post->post_date_gmt || '0000-00-00 00:00:00' == $post->post_date_gmt));
691 691
 
692 692
 	$tab_index_attribute = '';
693
-	if ( (int) $tab_index > 0 )
693
+	if ((int) $tab_index > 0)
694 694
 		$tab_index_attribute = " tabindex=\"$tab_index\"";
695 695
 
696 696
 	// todo: Remove this?
@@ -698,56 +698,56 @@  discard block
 block discarded – undo
698 698
 
699 699
 	$time_adj = current_time('timestamp');
700 700
 	$post_date = ($for_post) ? $post->post_date : get_comment()->comment_date;
701
-	$jj = ($edit) ? mysql2date( 'd', $post_date, false ) : gmdate( 'd', $time_adj );
702
-	$mm = ($edit) ? mysql2date( 'm', $post_date, false ) : gmdate( 'm', $time_adj );
703
-	$aa = ($edit) ? mysql2date( 'Y', $post_date, false ) : gmdate( 'Y', $time_adj );
704
-	$hh = ($edit) ? mysql2date( 'H', $post_date, false ) : gmdate( 'H', $time_adj );
705
-	$mn = ($edit) ? mysql2date( 'i', $post_date, false ) : gmdate( 'i', $time_adj );
706
-	$ss = ($edit) ? mysql2date( 's', $post_date, false ) : gmdate( 's', $time_adj );
707
-
708
-	$cur_jj = gmdate( 'd', $time_adj );
709
-	$cur_mm = gmdate( 'm', $time_adj );
710
-	$cur_aa = gmdate( 'Y', $time_adj );
711
-	$cur_hh = gmdate( 'H', $time_adj );
712
-	$cur_mn = gmdate( 'i', $time_adj );
713
-
714
-	$month = '<label><span class="screen-reader-text">' . __( 'Month' ) . '</span><select ' . ( $multi ? '' : 'id="mm" ' ) . 'name="mm"' . $tab_index_attribute . ">\n";
715
-	for ( $i = 1; $i < 13; $i = $i +1 ) {
701
+	$jj = ($edit) ? mysql2date('d', $post_date, false) : gmdate('d', $time_adj);
702
+	$mm = ($edit) ? mysql2date('m', $post_date, false) : gmdate('m', $time_adj);
703
+	$aa = ($edit) ? mysql2date('Y', $post_date, false) : gmdate('Y', $time_adj);
704
+	$hh = ($edit) ? mysql2date('H', $post_date, false) : gmdate('H', $time_adj);
705
+	$mn = ($edit) ? mysql2date('i', $post_date, false) : gmdate('i', $time_adj);
706
+	$ss = ($edit) ? mysql2date('s', $post_date, false) : gmdate('s', $time_adj);
707
+
708
+	$cur_jj = gmdate('d', $time_adj);
709
+	$cur_mm = gmdate('m', $time_adj);
710
+	$cur_aa = gmdate('Y', $time_adj);
711
+	$cur_hh = gmdate('H', $time_adj);
712
+	$cur_mn = gmdate('i', $time_adj);
713
+
714
+	$month = '<label><span class="screen-reader-text">'.__('Month').'</span><select '.($multi ? '' : 'id="mm" ').'name="mm"'.$tab_index_attribute.">\n";
715
+	for ($i = 1; $i < 13; $i = $i + 1) {
716 716
 		$monthnum = zeroise($i, 2);
717
-		$monthtext = $wp_locale->get_month_abbrev( $wp_locale->get_month( $i ) );
718
-		$month .= "\t\t\t" . '<option value="' . $monthnum . '" data-text="' . $monthtext . '" ' . selected( $monthnum, $mm, false ) . '>';
717
+		$monthtext = $wp_locale->get_month_abbrev($wp_locale->get_month($i));
718
+		$month .= "\t\t\t".'<option value="'.$monthnum.'" data-text="'.$monthtext.'" '.selected($monthnum, $mm, false).'>';
719 719
 		/* translators: 1: month number (01, 02, etc.), 2: month abbreviation */
720
-		$month .= sprintf( __( '%1$s-%2$s' ), $monthnum, $monthtext ) . "</option>\n";
720
+		$month .= sprintf(__('%1$s-%2$s'), $monthnum, $monthtext)."</option>\n";
721 721
 	}
722 722
 	$month .= '</select></label>';
723 723
 
724
-	$day = '<label><span class="screen-reader-text">' . __( 'Day' ) . '</span><input type="text" ' . ( $multi ? '' : 'id="jj" ' ) . 'name="jj" value="' . $jj . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" /></label>';
725
-	$year = '<label><span class="screen-reader-text">' . __( 'Year' ) . '</span><input type="text" ' . ( $multi ? '' : 'id="aa" ' ) . 'name="aa" value="' . $aa . '" size="4" maxlength="4"' . $tab_index_attribute . ' autocomplete="off" /></label>';
726
-	$hour = '<label><span class="screen-reader-text">' . __( 'Hour' ) . '</span><input type="text" ' . ( $multi ? '' : 'id="hh" ' ) . 'name="hh" value="' . $hh . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" /></label>';
727
-	$minute = '<label><span class="screen-reader-text">' . __( 'Minute' ) . '</span><input type="text" ' . ( $multi ? '' : 'id="mn" ' ) . 'name="mn" value="' . $mn . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" /></label>';
724
+	$day = '<label><span class="screen-reader-text">'.__('Day').'</span><input type="text" '.($multi ? '' : 'id="jj" ').'name="jj" value="'.$jj.'" size="2" maxlength="2"'.$tab_index_attribute.' autocomplete="off" /></label>';
725
+	$year = '<label><span class="screen-reader-text">'.__('Year').'</span><input type="text" '.($multi ? '' : 'id="aa" ').'name="aa" value="'.$aa.'" size="4" maxlength="4"'.$tab_index_attribute.' autocomplete="off" /></label>';
726
+	$hour = '<label><span class="screen-reader-text">'.__('Hour').'</span><input type="text" '.($multi ? '' : 'id="hh" ').'name="hh" value="'.$hh.'" size="2" maxlength="2"'.$tab_index_attribute.' autocomplete="off" /></label>';
727
+	$minute = '<label><span class="screen-reader-text">'.__('Minute').'</span><input type="text" '.($multi ? '' : 'id="mn" ').'name="mn" value="'.$mn.'" size="2" maxlength="2"'.$tab_index_attribute.' autocomplete="off" /></label>';
728 728
 
729 729
 	echo '<div class="timestamp-wrap">';
730 730
 	/* translators: 1: month, 2: day, 3: year, 4: hour, 5: minute */
731
-	printf( __( '%1$s %2$s, %3$s @ %4$s:%5$s' ), $month, $day, $year, $hour, $minute );
731
+	printf(__('%1$s %2$s, %3$s @ %4$s:%5$s'), $month, $day, $year, $hour, $minute);
732 732
 
733
-	echo '</div><input type="hidden" id="ss" name="ss" value="' . $ss . '" />';
733
+	echo '</div><input type="hidden" id="ss" name="ss" value="'.$ss.'" />';
734 734
 
735
-	if ( $multi ) return;
735
+	if ($multi) return;
736 736
 
737 737
 	echo "\n\n";
738 738
 	$map = array(
739
-		'mm' => array( $mm, $cur_mm ),
740
-		'jj' => array( $jj, $cur_jj ),
741
-		'aa' => array( $aa, $cur_aa ),
742
-		'hh' => array( $hh, $cur_hh ),
743
-		'mn' => array( $mn, $cur_mn ),
739
+		'mm' => array($mm, $cur_mm),
740
+		'jj' => array($jj, $cur_jj),
741
+		'aa' => array($aa, $cur_aa),
742
+		'hh' => array($hh, $cur_hh),
743
+		'mn' => array($mn, $cur_mn),
744 744
 	);
745
-	foreach ( $map as $timeunit => $value ) {
746
-		list( $unit, $curr ) = $value;
745
+	foreach ($map as $timeunit => $value) {
746
+		list($unit, $curr) = $value;
747 747
 
748
-		echo '<input type="hidden" id="hidden_' . $timeunit . '" name="hidden_' . $timeunit . '" value="' . $unit . '" />' . "\n";
749
-		$cur_timeunit = 'cur_' . $timeunit;
750
-		echo '<input type="hidden" id="' . $cur_timeunit . '" name="' . $cur_timeunit . '" value="' . $curr . '" />' . "\n";
748
+		echo '<input type="hidden" id="hidden_'.$timeunit.'" name="hidden_'.$timeunit.'" value="'.$unit.'" />'."\n";
749
+		$cur_timeunit = 'cur_'.$timeunit;
750
+		echo '<input type="hidden" id="'.$cur_timeunit.'" name="'.$cur_timeunit.'" value="'.$curr.'" />'."\n";
751 751
 	}
752 752
 ?>
753 753
 
@@ -767,12 +767,12 @@  discard block
 block discarded – undo
767 767
  * @param string $default   Optional. The template file name. Default empty.
768 768
  * @param string $post_type Optional. Post type to get templates for. Default 'post'.
769 769
  */
770
-function page_template_dropdown( $default = '', $post_type = 'page' ) {
771
-	$templates = get_page_templates( null, $post_type );
772
-	ksort( $templates );
773
-	foreach ( array_keys( $templates ) as $template ) {
774
-		$selected = selected( $default, $templates[ $template ], false );
775
-		echo "\n\t<option value='" . $templates[ $template ] . "' $selected>$template</option>";
770
+function page_template_dropdown($default = '', $post_type = 'page') {
771
+	$templates = get_page_templates(null, $post_type);
772
+	ksort($templates);
773
+	foreach (array_keys($templates) as $template) {
774
+		$selected = selected($default, $templates[$template], false);
775
+		echo "\n\t<option value='".$templates[$template]."' $selected>$template</option>";
776 776
 	}
777 777
 }
778 778
 
@@ -791,22 +791,22 @@  discard block
 block discarded – undo
791 791
  *
792 792
  * @return null|false Boolean False if page has no children, otherwise print out html elements
793 793
  */
794
-function parent_dropdown( $default = 0, $parent = 0, $level = 0, $post = null ) {
794
+function parent_dropdown($default = 0, $parent = 0, $level = 0, $post = null) {
795 795
 	global $wpdb;
796
-	$post = get_post( $post );
797
-	$items = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' ORDER BY menu_order", $parent) );
796
+	$post = get_post($post);
797
+	$items = $wpdb->get_results($wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' ORDER BY menu_order", $parent));
798 798
 
799
-	if ( $items ) {
800
-		foreach ( $items as $item ) {
799
+	if ($items) {
800
+		foreach ($items as $item) {
801 801
 			// A page cannot be its own parent.
802
-			if ( $post && $post->ID && $item->ID == $post->ID )
802
+			if ($post && $post->ID && $item->ID == $post->ID)
803 803
 				continue;
804 804
 
805
-			$pad = str_repeat( '&nbsp;', $level * 3 );
806
-			$selected = selected( $default, $item->ID, false );
805
+			$pad = str_repeat('&nbsp;', $level * 3);
806
+			$selected = selected($default, $item->ID, false);
807 807
 
808
-			echo "\n\t<option class='level-$level' value='$item->ID' $selected>$pad " . esc_html($item->post_title) . "</option>";
809
-			parent_dropdown( $default, $item->ID, $level +1 );
808
+			echo "\n\t<option class='level-$level' value='$item->ID' $selected>$pad ".esc_html($item->post_title)."</option>";
809
+			parent_dropdown($default, $item->ID, $level + 1);
810 810
 		}
811 811
 	} else {
812 812
 		return false;
@@ -820,20 +820,20 @@  discard block
 block discarded – undo
820 820
  *
821 821
  * @param string $selected Slug for the role that should be already selected.
822 822
  */
823
-function wp_dropdown_roles( $selected = '' ) {
823
+function wp_dropdown_roles($selected = '') {
824 824
 	$p = '';
825 825
 	$r = '';
826 826
 
827
-	$editable_roles = array_reverse( get_editable_roles() );
827
+	$editable_roles = array_reverse(get_editable_roles());
828 828
 
829
-	foreach ( $editable_roles as $role => $details ) {
830
-		$name = translate_user_role($details['name'] );
831
-		if ( $selected == $role ) // preselect specified role
832
-			$p = "\n\t<option selected='selected' value='" . esc_attr($role) . "'>$name</option>";
829
+	foreach ($editable_roles as $role => $details) {
830
+		$name = translate_user_role($details['name']);
831
+		if ($selected == $role) // preselect specified role
832
+			$p = "\n\t<option selected='selected' value='".esc_attr($role)."'>$name</option>";
833 833
 		else
834
-			$r .= "\n\t<option value='" . esc_attr($role) . "'>$name</option>";
834
+			$r .= "\n\t<option value='".esc_attr($role)."'>$name</option>";
835 835
 	}
836
-	echo $p . $r;
836
+	echo $p.$r;
837 837
 }
838 838
 
839 839
 /**
@@ -843,7 +843,7 @@  discard block
 block discarded – undo
843 843
  *
844 844
  * @param string $action The action attribute for the form.
845 845
  */
846
-function wp_import_upload_form( $action ) {
846
+function wp_import_upload_form($action) {
847 847
 
848 848
 	/**
849 849
 	 * Filters the maximum allowed upload size for import files.
@@ -854,22 +854,22 @@  discard block
 block discarded – undo
854 854
 	 *
855 855
 	 * @param int $max_upload_size Allowed upload size. Default 1 MB.
856 856
 	 */
857
-	$bytes = apply_filters( 'import_upload_size_limit', wp_max_upload_size() );
858
-	$size = size_format( $bytes );
857
+	$bytes = apply_filters('import_upload_size_limit', wp_max_upload_size());
858
+	$size = size_format($bytes);
859 859
 	$upload_dir = wp_upload_dir();
860
-	if ( ! empty( $upload_dir['error'] ) ) :
860
+	if ( ! empty($upload_dir['error'])) :
861 861
 		?><div class="error"><p><?php _e('Before you can upload your import file, you will need to fix the following error:'); ?></p>
862 862
 		<p><strong><?php echo $upload_dir['error']; ?></strong></p></div><?php
863 863
 	else :
864 864
 ?>
865
-<form enctype="multipart/form-data" id="import-upload-form" method="post" class="wp-upload-form" action="<?php echo esc_url( wp_nonce_url( $action, 'import-upload' ) ); ?>">
865
+<form enctype="multipart/form-data" id="import-upload-form" method="post" class="wp-upload-form" action="<?php echo esc_url(wp_nonce_url($action, 'import-upload')); ?>">
866 866
 <p>
867
-<label for="upload"><?php _e( 'Choose a file from your computer:' ); ?></label> (<?php printf( __('Maximum size: %s' ), $size ); ?>)
867
+<label for="upload"><?php _e('Choose a file from your computer:'); ?></label> (<?php printf(__('Maximum size: %s'), $size); ?>)
868 868
 <input type="file" id="upload" name="import" size="25" />
869 869
 <input type="hidden" name="action" value="save" />
870 870
 <input type="hidden" name="max_file_size" value="<?php echo $bytes; ?>" />
871 871
 </p>
872
-<?php submit_button( __('Upload file and import'), 'primary' ); ?>
872
+<?php submit_button(__('Upload file and import'), 'primary'); ?>
873 873
 </form>
874 874
 <?php
875 875
 	endif;
@@ -903,75 +903,75 @@  discard block
 block discarded – undo
903 903
  *                                              of the box array (which is the second parameter passed
904 904
  *                                              to your callback). Default null.
905 905
  */
906
-function add_meta_box( $id, $title, $callback, $screen = null, $context = 'advanced', $priority = 'default', $callback_args = null ) {
906
+function add_meta_box($id, $title, $callback, $screen = null, $context = 'advanced', $priority = 'default', $callback_args = null) {
907 907
 	global $wp_meta_boxes;
908 908
 
909
-	if ( empty( $screen ) ) {
909
+	if (empty($screen)) {
910 910
 		$screen = get_current_screen();
911
-	} elseif ( is_string( $screen ) ) {
912
-		$screen = convert_to_screen( $screen );
913
-	} elseif ( is_array( $screen ) ) {
914
-		foreach ( $screen as $single_screen ) {
915
-			add_meta_box( $id, $title, $callback, $single_screen, $context, $priority, $callback_args );
911
+	} elseif (is_string($screen)) {
912
+		$screen = convert_to_screen($screen);
913
+	} elseif (is_array($screen)) {
914
+		foreach ($screen as $single_screen) {
915
+			add_meta_box($id, $title, $callback, $single_screen, $context, $priority, $callback_args);
916 916
 		}
917 917
 	}
918 918
 
919
-	if ( ! isset( $screen->id ) ) {
919
+	if ( ! isset($screen->id)) {
920 920
 		return;
921 921
 	}
922 922
 
923 923
 	$page = $screen->id;
924 924
 
925
-	if ( !isset($wp_meta_boxes) )
925
+	if ( ! isset($wp_meta_boxes))
926 926
 		$wp_meta_boxes = array();
927
-	if ( !isset($wp_meta_boxes[$page]) )
927
+	if ( ! isset($wp_meta_boxes[$page]))
928 928
 		$wp_meta_boxes[$page] = array();
929
-	if ( !isset($wp_meta_boxes[$page][$context]) )
929
+	if ( ! isset($wp_meta_boxes[$page][$context]))
930 930
 		$wp_meta_boxes[$page][$context] = array();
931 931
 
932
-	foreach ( array_keys($wp_meta_boxes[$page]) as $a_context ) {
933
-		foreach ( array('high', 'core', 'default', 'low') as $a_priority ) {
934
-			if ( !isset($wp_meta_boxes[$page][$a_context][$a_priority][$id]) )
932
+	foreach (array_keys($wp_meta_boxes[$page]) as $a_context) {
933
+		foreach (array('high', 'core', 'default', 'low') as $a_priority) {
934
+			if ( ! isset($wp_meta_boxes[$page][$a_context][$a_priority][$id]))
935 935
 				continue;
936 936
 
937 937
 			// If a core box was previously added or removed by a plugin, don't add.
938
-			if ( 'core' == $priority ) {
938
+			if ('core' == $priority) {
939 939
 				// If core box previously deleted, don't add
940
-				if ( false === $wp_meta_boxes[$page][$a_context][$a_priority][$id] )
940
+				if (false === $wp_meta_boxes[$page][$a_context][$a_priority][$id])
941 941
 					return;
942 942
 
943 943
 				/*
944 944
 				 * If box was added with default priority, give it core priority to
945 945
 				 * maintain sort order.
946 946
 				 */
947
-				if ( 'default' == $a_priority ) {
947
+				if ('default' == $a_priority) {
948 948
 					$wp_meta_boxes[$page][$a_context]['core'][$id] = $wp_meta_boxes[$page][$a_context]['default'][$id];
949 949
 					unset($wp_meta_boxes[$page][$a_context]['default'][$id]);
950 950
 				}
951 951
 				return;
952 952
 			}
953 953
 			// If no priority given and id already present, use existing priority.
954
-			if ( empty($priority) ) {
954
+			if (empty($priority)) {
955 955
 				$priority = $a_priority;
956 956
 			/*
957 957
 			 * Else, if we're adding to the sorted priority, we don't know the title
958 958
 			 * or callback. Grab them from the previously added context/priority.
959 959
 			 */
960
-			} elseif ( 'sorted' == $priority ) {
960
+			} elseif ('sorted' == $priority) {
961 961
 				$title = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['title'];
962 962
 				$callback = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['callback'];
963 963
 				$callback_args = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['args'];
964 964
 			}
965 965
 			// An id can be in only one priority and one context.
966
-			if ( $priority != $a_priority || $context != $a_context )
966
+			if ($priority != $a_priority || $context != $a_context)
967 967
 				unset($wp_meta_boxes[$page][$a_context][$a_priority][$id]);
968 968
 		}
969 969
 	}
970 970
 
971
-	if ( empty($priority) )
971
+	if (empty($priority))
972 972
 		$priority = 'low';
973 973
 
974
-	if ( !isset($wp_meta_boxes[$page][$context][$priority]) )
974
+	if ( ! isset($wp_meta_boxes[$page][$context][$priority]))
975 975
 		$wp_meta_boxes[$page][$context][$priority] = array();
976 976
 
977 977
 	$wp_meta_boxes[$page][$context][$priority][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback, 'args' => $callback_args);
@@ -990,27 +990,27 @@  discard block
 block discarded – undo
990 990
  * @param mixed            $object  gets passed to the box callback function as first parameter
991 991
  * @return int number of meta_boxes
992 992
  */
993
-function do_meta_boxes( $screen, $context, $object ) {
993
+function do_meta_boxes($screen, $context, $object) {
994 994
 	global $wp_meta_boxes;
995 995
 	static $already_sorted = false;
996 996
 
997
-	if ( empty( $screen ) )
997
+	if (empty($screen))
998 998
 		$screen = get_current_screen();
999
-	elseif ( is_string( $screen ) )
1000
-		$screen = convert_to_screen( $screen );
999
+	elseif (is_string($screen))
1000
+		$screen = convert_to_screen($screen);
1001 1001
 
1002 1002
 	$page = $screen->id;
1003 1003
 
1004
-	$hidden = get_hidden_meta_boxes( $screen );
1004
+	$hidden = get_hidden_meta_boxes($screen);
1005 1005
 
1006 1006
 	printf('<div id="%s-sortables" class="meta-box-sortables">', htmlspecialchars($context));
1007 1007
 
1008 1008
 	// Grab the ones the user has manually sorted. Pull them out of their previous context/priority and into the one the user chose
1009
-	if ( ! $already_sorted && $sorted = get_user_option( "meta-box-order_$page" ) ) {
1010
-		foreach ( $sorted as $box_context => $ids ) {
1011
-			foreach ( explode( ',', $ids ) as $id ) {
1012
-				if ( $id && 'dashboard_browser_nag' !== $id ) {
1013
-					add_meta_box( $id, null, null, $screen, $box_context, 'sorted' );
1009
+	if ( ! $already_sorted && $sorted = get_user_option("meta-box-order_$page")) {
1010
+		foreach ($sorted as $box_context => $ids) {
1011
+			foreach (explode(',', $ids) as $id) {
1012
+				if ($id && 'dashboard_browser_nag' !== $id) {
1013
+					add_meta_box($id, null, null, $screen, $box_context, 'sorted');
1014 1014
 				}
1015 1015
 			}
1016 1016
 		}
@@ -1020,31 +1020,31 @@  discard block
 block discarded – undo
1020 1020
 
1021 1021
 	$i = 0;
1022 1022
 
1023
-	if ( isset( $wp_meta_boxes[ $page ][ $context ] ) ) {
1024
-		foreach ( array( 'high', 'sorted', 'core', 'default', 'low' ) as $priority ) {
1025
-			if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ]) ) {
1026
-				foreach ( (array) $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) {
1027
-					if ( false == $box || ! $box['title'] )
1023
+	if (isset($wp_meta_boxes[$page][$context])) {
1024
+		foreach (array('high', 'sorted', 'core', 'default', 'low') as $priority) {
1025
+			if (isset($wp_meta_boxes[$page][$context][$priority])) {
1026
+				foreach ((array) $wp_meta_boxes[$page][$context][$priority] as $box) {
1027
+					if (false == $box || ! $box['title'])
1028 1028
 						continue;
1029 1029
 					$i++;
1030 1030
 					$hidden_class = in_array($box['id'], $hidden) ? ' hide-if-js' : '';
1031
-					echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . $hidden_class . '" ' . '>' . "\n";
1032
-					if ( 'dashboard_browser_nag' != $box['id'] ) {
1033
-						$widget_title = $box[ 'title' ];
1031
+					echo '<div id="'.$box['id'].'" class="postbox '.postbox_classes($box['id'], $page).$hidden_class.'" '.'>'."\n";
1032
+					if ('dashboard_browser_nag' != $box['id']) {
1033
+						$widget_title = $box['title'];
1034 1034
 
1035
-						if ( is_array( $box[ 'args' ] ) && isset( $box[ 'args' ][ '__widget_basename' ] ) ) {
1036
-							$widget_title = $box[ 'args' ][ '__widget_basename' ];
1035
+						if (is_array($box['args']) && isset($box['args']['__widget_basename'])) {
1036
+							$widget_title = $box['args']['__widget_basename'];
1037 1037
 							// Do not pass this parameter to the user callback function.
1038
-							unset( $box[ 'args' ][ '__widget_basename' ] );
1038
+							unset($box['args']['__widget_basename']);
1039 1039
 						}
1040 1040
 
1041 1041
 						echo '<button type="button" class="handlediv button-link" aria-expanded="true">';
1042
-						echo '<span class="screen-reader-text">' . sprintf( __( 'Toggle panel: %s' ), $widget_title ) . '</span>';
1042
+						echo '<span class="screen-reader-text">'.sprintf(__('Toggle panel: %s'), $widget_title).'</span>';
1043 1043
 						echo '<span class="toggle-indicator" aria-hidden="true"></span>';
1044 1044
 						echo '</button>';
1045 1045
 					}
1046 1046
 					echo "<h2 class='hndle'><span>{$box['title']}</span></h2>\n";
1047
-					echo '<div class="inside">' . "\n";
1047
+					echo '<div class="inside">'."\n";
1048 1048
 					call_user_func($box['callback'], $object, $box);
1049 1049
 					echo "</div>\n";
1050 1050
 					echo "</div>\n";
@@ -1077,33 +1077,33 @@  discard block
 block discarded – undo
1077 1077
  *                                        include 'normal' and 'side'. Menus meta boxes (accordion sections)
1078 1078
  *                                        all use the 'side' context.
1079 1079
  */
1080
-function remove_meta_box( $id, $screen, $context ) {
1080
+function remove_meta_box($id, $screen, $context) {
1081 1081
 	global $wp_meta_boxes;
1082 1082
 
1083
-	if ( empty( $screen ) ) {
1083
+	if (empty($screen)) {
1084 1084
 		$screen = get_current_screen();
1085
-	} elseif ( is_string( $screen ) ) {
1086
-		$screen = convert_to_screen( $screen );
1087
-	} elseif ( is_array( $screen ) ) {
1088
-		foreach ( $screen as $single_screen ) {
1089
-			remove_meta_box( $id, $single_screen, $context );
1085
+	} elseif (is_string($screen)) {
1086
+		$screen = convert_to_screen($screen);
1087
+	} elseif (is_array($screen)) {
1088
+		foreach ($screen as $single_screen) {
1089
+			remove_meta_box($id, $single_screen, $context);
1090 1090
 		}
1091 1091
 	}
1092 1092
 
1093
-	if ( ! isset( $screen->id ) ) {
1093
+	if ( ! isset($screen->id)) {
1094 1094
 		return;
1095 1095
 	}
1096 1096
 
1097 1097
 	$page = $screen->id;
1098 1098
 
1099
-	if ( !isset($wp_meta_boxes) )
1099
+	if ( ! isset($wp_meta_boxes))
1100 1100
 		$wp_meta_boxes = array();
1101
-	if ( !isset($wp_meta_boxes[$page]) )
1101
+	if ( ! isset($wp_meta_boxes[$page]))
1102 1102
 		$wp_meta_boxes[$page] = array();
1103
-	if ( !isset($wp_meta_boxes[$page][$context]) )
1103
+	if ( ! isset($wp_meta_boxes[$page][$context]))
1104 1104
 		$wp_meta_boxes[$page][$context] = array();
1105 1105
 
1106
-	foreach ( array('high', 'core', 'default', 'low') as $priority )
1106
+	foreach (array('high', 'core', 'default', 'low') as $priority)
1107 1107
 		$wp_meta_boxes[$page][$context][$priority][$id] = false;
1108 1108
 }
1109 1109
 
@@ -1123,19 +1123,19 @@  discard block
 block discarded – undo
1123 1123
  * @param mixed         $object  gets passed to the section callback function as first parameter.
1124 1124
  * @return int number of meta boxes as accordion sections.
1125 1125
  */
1126
-function do_accordion_sections( $screen, $context, $object ) {
1126
+function do_accordion_sections($screen, $context, $object) {
1127 1127
 	global $wp_meta_boxes;
1128 1128
 
1129
-	wp_enqueue_script( 'accordion' );
1129
+	wp_enqueue_script('accordion');
1130 1130
 
1131
-	if ( empty( $screen ) )
1131
+	if (empty($screen))
1132 1132
 		$screen = get_current_screen();
1133
-	elseif ( is_string( $screen ) )
1134
-		$screen = convert_to_screen( $screen );
1133
+	elseif (is_string($screen))
1134
+		$screen = convert_to_screen($screen);
1135 1135
 
1136 1136
 	$page = $screen->id;
1137 1137
 
1138
-	$hidden = get_hidden_meta_boxes( $screen );
1138
+	$hidden = get_hidden_meta_boxes($screen);
1139 1139
 	?>
1140 1140
 	<div id="side-sortables" class="accordion-container">
1141 1141
 		<ul class="outer-border">
@@ -1143,29 +1143,29 @@  discard block
 block discarded – undo
1143 1143
 	$i = 0;
1144 1144
 	$first_open = false;
1145 1145
 
1146
-	if ( isset( $wp_meta_boxes[ $page ][ $context ] ) ) {
1147
-		foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) {
1148
-			if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) {
1149
-				foreach ( $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) {
1150
-					if ( false == $box || ! $box['title'] )
1146
+	if (isset($wp_meta_boxes[$page][$context])) {
1147
+		foreach (array('high', 'core', 'default', 'low') as $priority) {
1148
+			if (isset($wp_meta_boxes[$page][$context][$priority])) {
1149
+				foreach ($wp_meta_boxes[$page][$context][$priority] as $box) {
1150
+					if (false == $box || ! $box['title'])
1151 1151
 						continue;
1152 1152
 					$i++;
1153
-					$hidden_class = in_array( $box['id'], $hidden ) ? 'hide-if-js' : '';
1153
+					$hidden_class = in_array($box['id'], $hidden) ? 'hide-if-js' : '';
1154 1154
 
1155 1155
 					$open_class = '';
1156
-					if ( ! $first_open && empty( $hidden_class ) ) {
1156
+					if ( ! $first_open && empty($hidden_class)) {
1157 1157
 						$first_open = true;
1158 1158
 						$open_class = 'open';
1159 1159
 					}
1160 1160
 					?>
1161
-					<li class="control-section accordion-section <?php echo $hidden_class; ?> <?php echo $open_class; ?> <?php echo esc_attr( $box['id'] ); ?>" id="<?php echo esc_attr( $box['id'] ); ?>">
1161
+					<li class="control-section accordion-section <?php echo $hidden_class; ?> <?php echo $open_class; ?> <?php echo esc_attr($box['id']); ?>" id="<?php echo esc_attr($box['id']); ?>">
1162 1162
 						<h3 class="accordion-section-title hndle" tabindex="0">
1163
-							<?php echo esc_html( $box['title'] ); ?>
1164
-							<span class="screen-reader-text"><?php _e( 'Press return or enter to open this section' ); ?></span>
1163
+							<?php echo esc_html($box['title']); ?>
1164
+							<span class="screen-reader-text"><?php _e('Press return or enter to open this section'); ?></span>
1165 1165
 						</h3>
1166
-						<div class="accordion-section-content <?php postbox_classes( $box['id'], $page ); ?>">
1166
+						<div class="accordion-section-content <?php postbox_classes($box['id'], $page); ?>">
1167 1167
 							<div class="inside">
1168
-								<?php call_user_func( $box['callback'], $object, $box ); ?>
1168
+								<?php call_user_func($box['callback'], $object, $box); ?>
1169 1169
 							</div><!-- .inside -->
1170 1170
 						</div><!-- .accordion-section-content -->
1171 1171
 					</li><!-- .accordion-section -->
@@ -1206,13 +1206,13 @@  discard block
 block discarded – undo
1206 1206
 function add_settings_section($id, $title, $callback, $page) {
1207 1207
 	global $wp_settings_sections;
1208 1208
 
1209
-	if ( 'misc' == $page ) {
1210
-		_deprecated_argument( __FUNCTION__, '3.0.0', sprintf( __( 'The "%s" options group has been removed. Use another settings group.' ), 'misc' ) );
1209
+	if ('misc' == $page) {
1210
+		_deprecated_argument(__FUNCTION__, '3.0.0', sprintf(__('The "%s" options group has been removed. Use another settings group.'), 'misc'));
1211 1211
 		$page = 'general';
1212 1212
 	}
1213 1213
 
1214
-	if ( 'privacy' == $page ) {
1215
-		_deprecated_argument( __FUNCTION__, '3.5.0', sprintf( __( 'The "%s" options group has been removed. Use another settings group.' ), 'privacy' ) );
1214
+	if ('privacy' == $page) {
1215
+		_deprecated_argument(__FUNCTION__, '3.5.0', sprintf(__('The "%s" options group has been removed. Use another settings group.'), 'privacy'));
1216 1216
 		$page = 'reading';
1217 1217
 	}
1218 1218
 
@@ -1257,13 +1257,13 @@  discard block
 block discarded – undo
1257 1257
 function add_settings_field($id, $title, $callback, $page, $section = 'default', $args = array()) {
1258 1258
 	global $wp_settings_fields;
1259 1259
 
1260
-	if ( 'misc' == $page ) {
1261
-		_deprecated_argument( __FUNCTION__, '3.0.0', __( 'The miscellaneous options group has been removed. Use another settings group.' ) );
1260
+	if ('misc' == $page) {
1261
+		_deprecated_argument(__FUNCTION__, '3.0.0', __('The miscellaneous options group has been removed. Use another settings group.'));
1262 1262
 		$page = 'general';
1263 1263
 	}
1264 1264
 
1265
-	if ( 'privacy' == $page ) {
1266
-		_deprecated_argument( __FUNCTION__, '3.5.0', __( 'The privacy options group has been removed. Use another settings group.' ) );
1265
+	if ('privacy' == $page) {
1266
+		_deprecated_argument(__FUNCTION__, '3.5.0', __('The privacy options group has been removed. Use another settings group.'));
1267 1267
 		$page = 'reading';
1268 1268
 	}
1269 1269
 
@@ -1283,23 +1283,23 @@  discard block
 block discarded – undo
1283 1283
  *
1284 1284
  * @param string $page The slug name of the page whose settings sections you want to output
1285 1285
  */
1286
-function do_settings_sections( $page ) {
1286
+function do_settings_sections($page) {
1287 1287
 	global $wp_settings_sections, $wp_settings_fields;
1288 1288
 
1289
-	if ( ! isset( $wp_settings_sections[$page] ) )
1289
+	if ( ! isset($wp_settings_sections[$page]))
1290 1290
 		return;
1291 1291
 
1292
-	foreach ( (array) $wp_settings_sections[$page] as $section ) {
1293
-		if ( $section['title'] )
1292
+	foreach ((array) $wp_settings_sections[$page] as $section) {
1293
+		if ($section['title'])
1294 1294
 			echo "<h2>{$section['title']}</h2>\n";
1295 1295
 
1296
-		if ( $section['callback'] )
1297
-			call_user_func( $section['callback'], $section );
1296
+		if ($section['callback'])
1297
+			call_user_func($section['callback'], $section);
1298 1298
 
1299
-		if ( ! isset( $wp_settings_fields ) || !isset( $wp_settings_fields[$page] ) || !isset( $wp_settings_fields[$page][$section['id']] ) )
1299
+		if ( ! isset($wp_settings_fields) || ! isset($wp_settings_fields[$page]) || ! isset($wp_settings_fields[$page][$section['id']]))
1300 1300
 			continue;
1301 1301
 		echo '<table class="form-table">';
1302
-		do_settings_fields( $page, $section['id'] );
1302
+		do_settings_fields($page, $section['id']);
1303 1303
 		echo '</table>';
1304 1304
 	}
1305 1305
 }
@@ -1321,22 +1321,22 @@  discard block
 block discarded – undo
1321 1321
 function do_settings_fields($page, $section) {
1322 1322
 	global $wp_settings_fields;
1323 1323
 
1324
-	if ( ! isset( $wp_settings_fields[$page][$section] ) )
1324
+	if ( ! isset($wp_settings_fields[$page][$section]))
1325 1325
 		return;
1326 1326
 
1327
-	foreach ( (array) $wp_settings_fields[$page][$section] as $field ) {
1327
+	foreach ((array) $wp_settings_fields[$page][$section] as $field) {
1328 1328
 		$class = '';
1329 1329
 
1330
-		if ( ! empty( $field['args']['class'] ) ) {
1331
-			$class = ' class="' . esc_attr( $field['args']['class'] ) . '"';
1330
+		if ( ! empty($field['args']['class'])) {
1331
+			$class = ' class="'.esc_attr($field['args']['class']).'"';
1332 1332
 		}
1333 1333
 
1334 1334
 		echo "<tr{$class}>";
1335 1335
 
1336
-		if ( ! empty( $field['args']['label_for'] ) ) {
1337
-			echo '<th scope="row"><label for="' . esc_attr( $field['args']['label_for'] ) . '">' . $field['title'] . '</label></th>';
1336
+		if ( ! empty($field['args']['label_for'])) {
1337
+			echo '<th scope="row"><label for="'.esc_attr($field['args']['label_for']).'">'.$field['title'].'</label></th>';
1338 1338
 		} else {
1339
-			echo '<th scope="row">' . $field['title'] . '</th>';
1339
+			echo '<th scope="row">'.$field['title'].'</th>';
1340 1340
 		}
1341 1341
 
1342 1342
 		echo '<td>';
@@ -1370,7 +1370,7 @@  discard block
 block discarded – undo
1370 1370
  * @param string $type    Optional. Message type, controls HTML class. Accepts 'error' or 'updated'.
1371 1371
  *                        Default 'error'.
1372 1372
  */
1373
-function add_settings_error( $setting, $code, $message, $type = 'error' ) {
1373
+function add_settings_error($setting, $code, $message, $type = 'error') {
1374 1374
 	global $wp_settings_errors;
1375 1375
 
1376 1376
 	$wp_settings_errors[] = array(
@@ -1404,7 +1404,7 @@  discard block
 block discarded – undo
1404 1404
  * @param boolean $sanitize Whether to re-sanitize the setting value before returning errors.
1405 1405
  * @return array Array of settings errors
1406 1406
  */
1407
-function get_settings_errors( $setting = '', $sanitize = false ) {
1407
+function get_settings_errors($setting = '', $sanitize = false) {
1408 1408
 	global $wp_settings_errors;
1409 1409
 
1410 1410
 	/*
@@ -1412,24 +1412,24 @@  discard block
 block discarded – undo
1412 1412
 	 * This allows the $sanitize_callback from register_setting() to run, adding
1413 1413
 	 * any settings errors you want to show by default.
1414 1414
 	 */
1415
-	if ( $sanitize )
1416
-		sanitize_option( $setting, get_option( $setting ) );
1415
+	if ($sanitize)
1416
+		sanitize_option($setting, get_option($setting));
1417 1417
 
1418 1418
 	// If settings were passed back from options.php then use them.
1419
-	if ( isset( $_GET['settings-updated'] ) && $_GET['settings-updated'] && get_transient( 'settings_errors' ) ) {
1420
-		$wp_settings_errors = array_merge( (array) $wp_settings_errors, get_transient( 'settings_errors' ) );
1421
-		delete_transient( 'settings_errors' );
1419
+	if (isset($_GET['settings-updated']) && $_GET['settings-updated'] && get_transient('settings_errors')) {
1420
+		$wp_settings_errors = array_merge((array) $wp_settings_errors, get_transient('settings_errors'));
1421
+		delete_transient('settings_errors');
1422 1422
 	}
1423 1423
 
1424 1424
 	// Check global in case errors have been added on this pageload.
1425
-	if ( ! count( $wp_settings_errors ) )
1425
+	if ( ! count($wp_settings_errors))
1426 1426
 		return array();
1427 1427
 
1428 1428
 	// Filter the results to those of a specific setting if one was set.
1429
-	if ( $setting ) {
1429
+	if ($setting) {
1430 1430
 		$setting_errors = array();
1431
-		foreach ( (array) $wp_settings_errors as $key => $details ) {
1432
-			if ( $setting == $details['setting'] )
1431
+		foreach ((array) $wp_settings_errors as $key => $details) {
1432
+			if ($setting == $details['setting'])
1433 1433
 				$setting_errors[] = $wp_settings_errors[$key];
1434 1434
 		}
1435 1435
 		return $setting_errors;
@@ -1465,20 +1465,20 @@  discard block
 block discarded – undo
1465 1465
  * @param bool   $hide_on_update If set to true errors will not be shown if the settings page has
1466 1466
  *                               already been submitted.
1467 1467
  */
1468
-function settings_errors( $setting = '', $sanitize = false, $hide_on_update = false ) {
1468
+function settings_errors($setting = '', $sanitize = false, $hide_on_update = false) {
1469 1469
 
1470
-	if ( $hide_on_update && ! empty( $_GET['settings-updated'] ) )
1470
+	if ($hide_on_update && ! empty($_GET['settings-updated']))
1471 1471
 		return;
1472 1472
 
1473
-	$settings_errors = get_settings_errors( $setting, $sanitize );
1473
+	$settings_errors = get_settings_errors($setting, $sanitize);
1474 1474
 
1475
-	if ( empty( $settings_errors ) )
1475
+	if (empty($settings_errors))
1476 1476
 		return;
1477 1477
 
1478 1478
 	$output = '';
1479
-	foreach ( $settings_errors as $key => $details ) {
1480
-		$css_id = 'setting-error-' . $details['code'];
1481
-		$css_class = $details['type'] . ' settings-error notice is-dismissible';
1479
+	foreach ($settings_errors as $key => $details) {
1480
+		$css_id = 'setting-error-'.$details['code'];
1481
+		$css_class = $details['type'].' settings-error notice is-dismissible';
1482 1482
 		$output .= "<div id='$css_id' class='$css_class'> \n";
1483 1483
 		$output .= "<p><strong>{$details['message']}</strong></p>";
1484 1484
 		$output .= "</div> \n";
@@ -1497,26 +1497,26 @@  discard block
 block discarded – undo
1497 1497
 ?>
1498 1498
 	<div id="find-posts" class="find-box" style="display: none;">
1499 1499
 		<div id="find-posts-head" class="find-box-head">
1500
-			<?php _e( 'Attach to existing content' ); ?>
1501
-			<button type="button" id="find-posts-close"><span class="screen-reader-text"><?php _e( 'Close media attachment panel' ); ?></button>
1500
+			<?php _e('Attach to existing content'); ?>
1501
+			<button type="button" id="find-posts-close"><span class="screen-reader-text"><?php _e('Close media attachment panel'); ?></button>
1502 1502
 		</div>
1503 1503
 		<div class="find-box-inside">
1504 1504
 			<div class="find-box-search">
1505
-				<?php if ( $found_action ) { ?>
1505
+				<?php if ($found_action) { ?>
1506 1506
 					<input type="hidden" name="found_action" value="<?php echo esc_attr($found_action); ?>" />
1507 1507
 				<?php } ?>
1508 1508
 				<input type="hidden" name="affected" id="affected" value="" />
1509
-				<?php wp_nonce_field( 'find-posts', '_ajax_nonce', false ); ?>
1510
-				<label class="screen-reader-text" for="find-posts-input"><?php _e( 'Search' ); ?></label>
1509
+				<?php wp_nonce_field('find-posts', '_ajax_nonce', false); ?>
1510
+				<label class="screen-reader-text" for="find-posts-input"><?php _e('Search'); ?></label>
1511 1511
 				<input type="text" id="find-posts-input" name="ps" value="" />
1512 1512
 				<span class="spinner"></span>
1513
-				<input type="button" id="find-posts-search" value="<?php esc_attr_e( 'Search' ); ?>" class="button" />
1513
+				<input type="button" id="find-posts-search" value="<?php esc_attr_e('Search'); ?>" class="button" />
1514 1514
 				<div class="clear"></div>
1515 1515
 			</div>
1516 1516
 			<div id="find-posts-response"></div>
1517 1517
 		</div>
1518 1518
 		<div class="find-box-buttons">
1519
-			<?php submit_button( __( 'Select' ), 'primary alignright', 'find-posts-submit', false ); ?>
1519
+			<?php submit_button(__('Select'), 'primary alignright', 'find-posts-submit', false); ?>
1520 1520
 			<div class="clear"></div>
1521 1521
 		</div>
1522 1522
 	</div>
@@ -1532,8 +1532,8 @@  discard block
 block discarded – undo
1532 1532
  */
1533 1533
 function the_post_password() {
1534 1534
 	$post = get_post();
1535
-	if ( isset( $post->post_password ) )
1536
-		echo esc_attr( $post->post_password );
1535
+	if (isset($post->post_password))
1536
+		echo esc_attr($post->post_password);
1537 1537
 }
1538 1538
 
1539 1539
 /**
@@ -1547,11 +1547,11 @@  discard block
 block discarded – undo
1547 1547
  * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
1548 1548
  * @return string The post title if set.
1549 1549
  */
1550
-function _draft_or_post_title( $post = 0 ) {
1551
-	$title = get_the_title( $post );
1552
-	if ( empty( $title ) )
1553
-		$title = __( '(no title)' );
1554
-	return esc_html( $title );
1550
+function _draft_or_post_title($post = 0) {
1551
+	$title = get_the_title($post);
1552
+	if (empty($title))
1553
+		$title = __('(no title)');
1554
+	return esc_html($title);
1555 1555
 }
1556 1556
 
1557 1557
 /**
@@ -1563,7 +1563,7 @@  discard block
 block discarded – undo
1563 1563
  * @since 2.7.0
1564 1564
  */
1565 1565
 function _admin_search_query() {
1566
-	echo isset($_REQUEST['s']) ? esc_attr( wp_unslash( $_REQUEST['s'] ) ) : '';
1566
+	echo isset($_REQUEST['s']) ? esc_attr(wp_unslash($_REQUEST['s'])) : '';
1567 1567
 }
1568 1568
 
1569 1569
 /**
@@ -1578,69 +1578,69 @@  discard block
 block discarded – undo
1578 1578
  * @param string $title      Optional. Title of the Iframe page. Default empty.
1579 1579
  * @param bool   $deprecated Not used.
1580 1580
  */
1581
-function iframe_header( $title = '', $deprecated = false ) {
1582
-	show_admin_bar( false );
1581
+function iframe_header($title = '', $deprecated = false) {
1582
+	show_admin_bar(false);
1583 1583
 	global $hook_suffix, $admin_body_class, $wp_locale;
1584 1584
 	$admin_body_class = preg_replace('/[^a-z0-9_-]+/i', '-', $hook_suffix);
1585 1585
 
1586 1586
 	$current_screen = get_current_screen();
1587 1587
 
1588
-	@header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) );
1588
+	@header('Content-Type: '.get_option('html_type').'; charset='.get_option('blog_charset'));
1589 1589
 	_wp_admin_html_begin();
1590 1590
 ?>
1591 1591
 <title><?php bloginfo('name') ?> &rsaquo; <?php echo $title ?> &#8212; <?php _e('WordPress'); ?></title>
1592 1592
 <?php
1593
-wp_enqueue_style( 'colors' );
1593
+wp_enqueue_style('colors');
1594 1594
 ?>
1595 1595
 <script type="text/javascript">
1596 1596
 addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
1597 1597
 function tb_close(){var win=window.dialogArguments||opener||parent||top;win.tb_remove();}
1598
-var ajaxurl = '<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>',
1598
+var ajaxurl = '<?php echo admin_url('admin-ajax.php', 'relative'); ?>',
1599 1599
 	pagenow = '<?php echo $current_screen->id; ?>',
1600 1600
 	typenow = '<?php echo $current_screen->post_type; ?>',
1601 1601
 	adminpage = '<?php echo $admin_body_class; ?>',
1602
-	thousandsSeparator = '<?php echo addslashes( $wp_locale->number_format['thousands_sep'] ); ?>',
1603
-	decimalPoint = '<?php echo addslashes( $wp_locale->number_format['decimal_point'] ); ?>',
1602
+	thousandsSeparator = '<?php echo addslashes($wp_locale->number_format['thousands_sep']); ?>',
1603
+	decimalPoint = '<?php echo addslashes($wp_locale->number_format['decimal_point']); ?>',
1604 1604
 	isRtl = <?php echo (int) is_rtl(); ?>;
1605 1605
 </script>
1606 1606
 <?php
1607 1607
 /** This action is documented in wp-admin/admin-header.php */
1608
-do_action( 'admin_enqueue_scripts', $hook_suffix );
1608
+do_action('admin_enqueue_scripts', $hook_suffix);
1609 1609
 
1610 1610
 /** This action is documented in wp-admin/admin-header.php */
1611
-do_action( "admin_print_styles-$hook_suffix" );
1611
+do_action("admin_print_styles-$hook_suffix");
1612 1612
 
1613 1613
 /** This action is documented in wp-admin/admin-header.php */
1614
-do_action( 'admin_print_styles' );
1614
+do_action('admin_print_styles');
1615 1615
 
1616 1616
 /** This action is documented in wp-admin/admin-header.php */
1617
-do_action( "admin_print_scripts-$hook_suffix" );
1617
+do_action("admin_print_scripts-$hook_suffix");
1618 1618
 
1619 1619
 /** This action is documented in wp-admin/admin-header.php */
1620
-do_action( 'admin_print_scripts' );
1620
+do_action('admin_print_scripts');
1621 1621
 
1622 1622
 /** This action is documented in wp-admin/admin-header.php */
1623
-do_action( "admin_head-$hook_suffix" );
1623
+do_action("admin_head-$hook_suffix");
1624 1624
 
1625 1625
 /** This action is documented in wp-admin/admin-header.php */
1626
-do_action( 'admin_head' );
1626
+do_action('admin_head');
1627 1627
 
1628
-$admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_user_locale() ) ) );
1628
+$admin_body_class .= ' locale-'.sanitize_html_class(strtolower(str_replace('_', '-', get_user_locale())));
1629 1629
 
1630
-if ( is_rtl() )
1630
+if (is_rtl())
1631 1631
 	$admin_body_class .= ' rtl';
1632 1632
 
1633 1633
 ?>
1634 1634
 </head>
1635 1635
 <?php
1636 1636
 /** This filter is documented in wp-admin/admin-header.php */
1637
-$admin_body_classes = apply_filters( 'admin_body_class', '' );
1637
+$admin_body_classes = apply_filters('admin_body_class', '');
1638 1638
 ?>
1639 1639
 <body<?php
1640 1640
 /**
1641 1641
  * @global string $body_id
1642 1642
  */
1643
-if ( isset($GLOBALS['body_id']) ) echo ' id="' . $GLOBALS['body_id'] . '"'; ?> class="wp-admin wp-core-ui no-js iframe <?php echo $admin_body_classes . ' ' . $admin_body_class; ?>">
1643
+if (isset($GLOBALS['body_id'])) echo ' id="'.$GLOBALS['body_id'].'"'; ?> class="wp-admin wp-core-ui no-js iframe <?php echo $admin_body_classes.' '.$admin_body_class; ?>">
1644 1644
 <script type="text/javascript">
1645 1645
 (function(){
1646 1646
 var c = document.body.className;
@@ -1671,13 +1671,13 @@  discard block
 block discarded – undo
1671 1671
 	<div class="hidden">
1672 1672
 <?php
1673 1673
 	/** This action is documented in wp-admin/admin-footer.php */
1674
-	do_action( 'admin_footer', $hook_suffix );
1674
+	do_action('admin_footer', $hook_suffix);
1675 1675
 
1676 1676
 	/** This action is documented in wp-admin/admin-footer.php */
1677
-	do_action( "admin_print_footer_scripts-$hook_suffix" );
1677
+	do_action("admin_print_footer_scripts-$hook_suffix");
1678 1678
 
1679 1679
 	/** This action is documented in wp-admin/admin-footer.php */
1680
-	do_action( 'admin_print_footer_scripts' );
1680
+	do_action('admin_print_footer_scripts');
1681 1681
 ?>
1682 1682
 	</div>
1683 1683
 <script type="text/javascript">if(typeof wpOnload=="function")wpOnload();</script>
@@ -1692,33 +1692,33 @@  discard block
 block discarded – undo
1692 1692
  */
1693 1693
 function _post_states($post) {
1694 1694
 	$post_states = array();
1695
-	if ( isset( $_REQUEST['post_status'] ) )
1695
+	if (isset($_REQUEST['post_status']))
1696 1696
 		$post_status = $_REQUEST['post_status'];
1697 1697
 	else
1698 1698
 		$post_status = '';
1699 1699
 
1700
-	if ( !empty($post->post_password) )
1700
+	if ( ! empty($post->post_password))
1701 1701
 		$post_states['protected'] = __('Password protected');
1702
-	if ( 'private' == $post->post_status && 'private' != $post_status )
1702
+	if ('private' == $post->post_status && 'private' != $post_status)
1703 1703
 		$post_states['private'] = __('Private');
1704
-	if ( 'draft' == $post->post_status && 'draft' != $post_status )
1704
+	if ('draft' == $post->post_status && 'draft' != $post_status)
1705 1705
 		$post_states['draft'] = __('Draft');
1706
-	if ( 'pending' == $post->post_status && 'pending' != $post_status )
1706
+	if ('pending' == $post->post_status && 'pending' != $post_status)
1707 1707
 		$post_states['pending'] = _x('Pending', 'post status');
1708
-	if ( is_sticky($post->ID) )
1708
+	if (is_sticky($post->ID))
1709 1709
 		$post_states['sticky'] = __('Sticky');
1710 1710
 
1711
-	if ( 'future' === $post->post_status ) {
1712
-		$post_states['scheduled'] = __( 'Scheduled' );
1711
+	if ('future' === $post->post_status) {
1712
+		$post_states['scheduled'] = __('Scheduled');
1713 1713
 	}
1714 1714
 
1715
-	if ( 'page' === get_option( 'show_on_front' ) ) {
1716
-		if ( intval( get_option( 'page_on_front' ) ) === $post->ID ) {
1717
-			$post_states['page_on_front'] = __( 'Front Page' );
1715
+	if ('page' === get_option('show_on_front')) {
1716
+		if (intval(get_option('page_on_front')) === $post->ID) {
1717
+			$post_states['page_on_front'] = __('Front Page');
1718 1718
 		}
1719 1719
 
1720
-		if ( intval( get_option( 'page_for_posts' ) ) === $post->ID ) {
1721
-			$post_states['page_for_posts'] = __( 'Posts Page' );
1720
+		if (intval(get_option('page_for_posts')) === $post->ID) {
1721
+			$post_states['page_for_posts'] = __('Posts Page');
1722 1722
 		}
1723 1723
 	}
1724 1724
 
@@ -1730,15 +1730,15 @@  discard block
 block discarded – undo
1730 1730
 	 * @param array   $post_states An array of post display states.
1731 1731
 	 * @param WP_Post $post        The current post object.
1732 1732
 	 */
1733
-	$post_states = apply_filters( 'display_post_states', $post_states, $post );
1733
+	$post_states = apply_filters('display_post_states', $post_states, $post);
1734 1734
 
1735
-	if ( ! empty($post_states) ) {
1735
+	if ( ! empty($post_states)) {
1736 1736
 		$state_count = count($post_states);
1737 1737
 		$i = 0;
1738 1738
 		echo ' &mdash; ';
1739
-		foreach ( $post_states as $state ) {
1739
+		foreach ($post_states as $state) {
1740 1740
 			++$i;
1741
-			( $i == $state_count ) ? $sep = '' : $sep = ', ';
1741
+			($i == $state_count) ? $sep = '' : $sep = ', ';
1742 1742
 			echo "<span class='post-state'>$state$sep</span>";
1743 1743
 		}
1744 1744
 	}
@@ -1749,53 +1749,53 @@  discard block
 block discarded – undo
1749 1749
  *
1750 1750
  * @param WP_Post $post
1751 1751
  */
1752
-function _media_states( $post ) {
1752
+function _media_states($post) {
1753 1753
 	$media_states = array();
1754 1754
 	$stylesheet = get_option('stylesheet');
1755 1755
 
1756
-	if ( current_theme_supports( 'custom-header') ) {
1757
-		$meta_header = get_post_meta($post->ID, '_wp_attachment_is_custom_header', true );
1756
+	if (current_theme_supports('custom-header')) {
1757
+		$meta_header = get_post_meta($post->ID, '_wp_attachment_is_custom_header', true);
1758 1758
 
1759
-		if ( is_random_header_image() ) {
1760
-			$header_images = wp_list_pluck( get_uploaded_header_images(), 'attachment_id' );
1759
+		if (is_random_header_image()) {
1760
+			$header_images = wp_list_pluck(get_uploaded_header_images(), 'attachment_id');
1761 1761
 
1762
-			if ( $meta_header == $stylesheet && in_array( $post->ID, $header_images ) ) {
1763
-				$media_states[] = __( 'Header Image' );
1762
+			if ($meta_header == $stylesheet && in_array($post->ID, $header_images)) {
1763
+				$media_states[] = __('Header Image');
1764 1764
 			}
1765 1765
 		} else {
1766 1766
 			$header_image = get_header_image();
1767 1767
 
1768 1768
 			// Display "Header Image" if the image was ever used as a header image
1769
-			if ( ! empty( $meta_header ) && $meta_header == $stylesheet && $header_image !== wp_get_attachment_url( $post->ID ) ) {
1770
-				$media_states[] = __( 'Header Image' );
1769
+			if ( ! empty($meta_header) && $meta_header == $stylesheet && $header_image !== wp_get_attachment_url($post->ID)) {
1770
+				$media_states[] = __('Header Image');
1771 1771
 			}
1772 1772
 
1773 1773
 			// Display "Current Header Image" if the image is currently the header image
1774
-			if ( $header_image && $header_image == wp_get_attachment_url( $post->ID ) ) {
1775
-				$media_states[] = __( 'Current Header Image' );
1774
+			if ($header_image && $header_image == wp_get_attachment_url($post->ID)) {
1775
+				$media_states[] = __('Current Header Image');
1776 1776
 			}
1777 1777
 		}
1778 1778
 	}
1779 1779
 
1780
-	if ( current_theme_supports( 'custom-background') ) {
1781
-		$meta_background = get_post_meta($post->ID, '_wp_attachment_is_custom_background', true );
1780
+	if (current_theme_supports('custom-background')) {
1781
+		$meta_background = get_post_meta($post->ID, '_wp_attachment_is_custom_background', true);
1782 1782
 
1783
-		if ( ! empty( $meta_background ) && $meta_background == $stylesheet ) {
1784
-			$media_states[] = __( 'Background Image' );
1783
+		if ( ! empty($meta_background) && $meta_background == $stylesheet) {
1784
+			$media_states[] = __('Background Image');
1785 1785
 
1786 1786
 			$background_image = get_background_image();
1787
-			if ( $background_image && $background_image == wp_get_attachment_url( $post->ID ) ) {
1788
-				$media_states[] = __( 'Current Background Image' );
1787
+			if ($background_image && $background_image == wp_get_attachment_url($post->ID)) {
1788
+				$media_states[] = __('Current Background Image');
1789 1789
 			}
1790 1790
 		}
1791 1791
 	}
1792 1792
 
1793
-	if ( $post->ID == get_option( 'site_icon' ) ) {
1794
-		$media_states[] = __( 'Site Icon' );
1793
+	if ($post->ID == get_option('site_icon')) {
1794
+		$media_states[] = __('Site Icon');
1795 1795
 	}
1796 1796
 
1797
-	if ( $post->ID == get_theme_mod( 'site_logo' ) ) {
1798
-		$media_states[] = __( 'Logo' );
1797
+	if ($post->ID == get_theme_mod('site_logo')) {
1798
+		$media_states[] = __('Logo');
1799 1799
 	}
1800 1800
 
1801 1801
 	/**
@@ -1806,15 +1806,15 @@  discard block
 block discarded – undo
1806 1806
 	 * @param array $media_states An array of media states. Default 'Header Image',
1807 1807
 	 *                            'Background Image', 'Site Icon', 'Logo'.
1808 1808
 	 */
1809
-	$media_states = apply_filters( 'display_media_states', $media_states );
1809
+	$media_states = apply_filters('display_media_states', $media_states);
1810 1810
 
1811
-	if ( ! empty( $media_states ) ) {
1812
-		$state_count = count( $media_states );
1811
+	if ( ! empty($media_states)) {
1812
+		$state_count = count($media_states);
1813 1813
 		$i = 0;
1814 1814
 		echo ' &mdash; ';
1815
-		foreach ( $media_states as $state ) {
1815
+		foreach ($media_states as $state) {
1816 1816
 			++$i;
1817
-			( $i == $state_count ) ? $sep = '' : $sep = ', ';
1817
+			($i == $state_count) ? $sep = '' : $sep = ', ';
1818 1818
 			echo "<span class='post-state'>$state$sep</span>";
1819 1819
 		}
1820 1820
 	}
@@ -1833,7 +1833,7 @@  discard block
 block discarded – undo
1833 1833
 function compression_test() {
1834 1834
 ?>
1835 1835
 	<script type="text/javascript">
1836
-	var compressionNonce = <?php echo wp_json_encode( wp_create_nonce( 'update_can_compress_scripts' ) ); ?>;
1836
+	var compressionNonce = <?php echo wp_json_encode(wp_create_nonce('update_can_compress_scripts')); ?>;
1837 1837
 	var testCompression = {
1838 1838
 		get : function(test) {
1839 1839
 			var x;
@@ -1906,8 +1906,8 @@  discard block
 block discarded – undo
1906 1906
  *                                       as a string such as 'tabindex="1"', though the array format is
1907 1907
  *                                       preferred. Default null.
1908 1908
  */
1909
-function submit_button( $text = null, $type = 'primary', $name = 'submit', $wrap = true, $other_attributes = null ) {
1910
-	echo get_submit_button( $text, $type, $name, $wrap, $other_attributes );
1909
+function submit_button($text = null, $type = 'primary', $name = 'submit', $wrap = true, $other_attributes = null) {
1910
+	echo get_submit_button($text, $type, $name, $wrap, $other_attributes);
1911 1911
 }
1912 1912
 
1913 1913
 /**
@@ -1931,47 +1931,47 @@  discard block
 block discarded – undo
1931 1931
  *                                       Default empty.
1932 1932
  * @return string Submit button HTML.
1933 1933
  */
1934
-function get_submit_button( $text = '', $type = 'primary large', $name = 'submit', $wrap = true, $other_attributes = '' ) {
1935
-	if ( ! is_array( $type ) )
1936
-		$type = explode( ' ', $type );
1937
-
1938
-	$button_shorthand = array( 'primary', 'small', 'large' );
1939
-	$classes = array( 'button' );
1940
-	foreach ( $type as $t ) {
1941
-		if ( 'secondary' === $t || 'button-secondary' === $t )
1934
+function get_submit_button($text = '', $type = 'primary large', $name = 'submit', $wrap = true, $other_attributes = '') {
1935
+	if ( ! is_array($type))
1936
+		$type = explode(' ', $type);
1937
+
1938
+	$button_shorthand = array('primary', 'small', 'large');
1939
+	$classes = array('button');
1940
+	foreach ($type as $t) {
1941
+		if ('secondary' === $t || 'button-secondary' === $t)
1942 1942
 			continue;
1943
-		$classes[] = in_array( $t, $button_shorthand ) ? 'button-' . $t : $t;
1943
+		$classes[] = in_array($t, $button_shorthand) ? 'button-'.$t : $t;
1944 1944
 	}
1945 1945
 	// Remove empty items, remove duplicate items, and finally build a string.
1946
-	$class = implode( ' ', array_unique( array_filter( $classes ) ) );
1946
+	$class = implode(' ', array_unique(array_filter($classes)));
1947 1947
 
1948
-	$text = $text ? $text : __( 'Save Changes' );
1948
+	$text = $text ? $text : __('Save Changes');
1949 1949
 
1950 1950
 	// Default the id attribute to $name unless an id was specifically provided in $other_attributes
1951 1951
 	$id = $name;
1952
-	if ( is_array( $other_attributes ) && isset( $other_attributes['id'] ) ) {
1952
+	if (is_array($other_attributes) && isset($other_attributes['id'])) {
1953 1953
 		$id = $other_attributes['id'];
1954
-		unset( $other_attributes['id'] );
1954
+		unset($other_attributes['id']);
1955 1955
 	}
1956 1956
 
1957 1957
 	$attributes = '';
1958
-	if ( is_array( $other_attributes ) ) {
1959
-		foreach ( $other_attributes as $attribute => $value ) {
1960
-			$attributes .= $attribute . '="' . esc_attr( $value ) . '" '; // Trailing space is important
1958
+	if (is_array($other_attributes)) {
1959
+		foreach ($other_attributes as $attribute => $value) {
1960
+			$attributes .= $attribute.'="'.esc_attr($value).'" '; // Trailing space is important
1961 1961
 		}
1962
-	} elseif ( ! empty( $other_attributes ) ) { // Attributes provided as a string
1962
+	} elseif ( ! empty($other_attributes)) { // Attributes provided as a string
1963 1963
 		$attributes = $other_attributes;
1964 1964
 	}
1965 1965
 
1966 1966
 	// Don't output empty name and id attributes.
1967
-	$name_attr = $name ? ' name="' . esc_attr( $name ) . '"' : '';
1968
-	$id_attr = $id ? ' id="' . esc_attr( $id ) . '"' : '';
1967
+	$name_attr = $name ? ' name="'.esc_attr($name).'"' : '';
1968
+	$id_attr = $id ? ' id="'.esc_attr($id).'"' : '';
1969 1969
 
1970
-	$button = '<input type="submit"' . $name_attr . $id_attr . ' class="' . esc_attr( $class );
1971
-	$button	.= '" value="' . esc_attr( $text ) . '" ' . $attributes . ' />';
1970
+	$button = '<input type="submit"'.$name_attr.$id_attr.' class="'.esc_attr($class);
1971
+	$button	.= '" value="'.esc_attr($text).'" '.$attributes.' />';
1972 1972
 
1973
-	if ( $wrap ) {
1974
-		$button = '<p class="submit">' . $button . '</p>';
1973
+	if ($wrap) {
1974
+		$button = '<p class="submit">'.$button.'</p>';
1975 1975
 	}
1976 1976
 
1977 1977
 	return $button;
@@ -1984,9 +1984,9 @@  discard block
 block discarded – undo
1984 1984
 function _wp_admin_html_begin() {
1985 1985
 	global $is_IE;
1986 1986
 
1987
-	$admin_html_class = ( is_admin_bar_showing() ) ? 'wp-toolbar' : '';
1987
+	$admin_html_class = (is_admin_bar_showing()) ? 'wp-toolbar' : '';
1988 1988
 
1989
-	if ( $is_IE )
1989
+	if ($is_IE)
1990 1990
 		@header('X-UA-Compatible: IE=edge');
1991 1991
 
1992 1992
 ?>
@@ -1998,13 +1998,13 @@  discard block
 block discarded – undo
1998 1998
 	 *
1999 1999
 	 * @since 2.2.0
2000 2000
 	 */
2001
-	do_action( 'admin_xml_ns' );
2001
+	do_action('admin_xml_ns');
2002 2002
 ?> <?php language_attributes(); ?>>
2003 2003
 <![endif]-->
2004 2004
 <!--[if !(IE 8) ]><!-->
2005 2005
 <html xmlns="http://www.w3.org/1999/xhtml" class="<?php echo $admin_html_class; ?>" <?php
2006 2006
 	/** This action is documented in wp-admin/includes/template.php */
2007
-	do_action( 'admin_xml_ns' );
2007
+	do_action('admin_xml_ns');
2008 2008
 ?> <?php language_attributes(); ?>>
2009 2009
 <!--<![endif]-->
2010 2010
 <head>
@@ -2020,13 +2020,13 @@  discard block
 block discarded – undo
2020 2020
  * @param string $hook_name The hook name (also known as the hook suffix) used to determine the screen.
2021 2021
  * @return WP_Screen Screen object.
2022 2022
  */
2023
-function convert_to_screen( $hook_name ) {
2024
-	if ( ! class_exists( 'WP_Screen' ) ) {
2025
-		_doing_it_wrong( 'convert_to_screen(), add_meta_box()', __( "Likely direct inclusion of wp-admin/includes/template.php in order to use add_meta_box(). This is very wrong. Hook the add_meta_box() call into the add_meta_boxes action instead." ), '3.3.0' );
2026
-		return (object) array( 'id' => '_invalid', 'base' => '_are_belong_to_us' );
2023
+function convert_to_screen($hook_name) {
2024
+	if ( ! class_exists('WP_Screen')) {
2025
+		_doing_it_wrong('convert_to_screen(), add_meta_box()', __("Likely direct inclusion of wp-admin/includes/template.php in order to use add_meta_box(). This is very wrong. Hook the add_meta_box() call into the add_meta_boxes action instead."), '3.3.0');
2026
+		return (object) array('id' => '_invalid', 'base' => '_are_belong_to_us');
2027 2027
 	}
2028 2028
 
2029
-	return WP_Screen::get( $hook_name );
2029
+	return WP_Screen::get($hook_name);
2030 2030
 }
2031 2031
 
2032 2032
 /**
@@ -2039,11 +2039,11 @@  discard block
 block discarded – undo
2039 2039
 	?>
2040 2040
 	<div id="local-storage-notice" class="hidden notice is-dismissible">
2041 2041
 	<p class="local-restore">
2042
-		<?php _e( 'The backup of this post in your browser is different from the version below.' ); ?>
2042
+		<?php _e('The backup of this post in your browser is different from the version below.'); ?>
2043 2043
 		<button type="button" class="button restore-backup"><?php _e('Restore the backup'); ?></button>
2044 2044
 	</p>
2045 2045
 	<p class="help">
2046
-		<?php _e( 'This will replace the current editor content with the last backup version. You can use undo and redo in the editor to get the old content back or to return to the restored version.' ); ?>
2046
+		<?php _e('This will replace the current editor content with the last backup version. You can use undo and redo in the editor to get the old content back or to return to the restored version.'); ?>
2047 2047
 	</p>
2048 2048
 	</div>
2049 2049
 	<?php
@@ -2071,45 +2071,45 @@  discard block
 block discarded – undo
2071 2071
  *                          of echoing it. Default true.
2072 2072
  * }
2073 2073
  */
2074
-function wp_star_rating( $args = array() ) {
2074
+function wp_star_rating($args = array()) {
2075 2075
 	$defaults = array(
2076 2076
 		'rating' => 0,
2077 2077
 		'type'   => 'rating',
2078 2078
 		'number' => 0,
2079 2079
 		'echo'   => true,
2080 2080
 	);
2081
-	$r = wp_parse_args( $args, $defaults );
2081
+	$r = wp_parse_args($args, $defaults);
2082 2082
 
2083 2083
 	// Non-english decimal places when the $rating is coming from a string
2084
-	$rating = str_replace( ',', '.', $r['rating'] );
2084
+	$rating = str_replace(',', '.', $r['rating']);
2085 2085
 
2086 2086
 	// Convert Percentage to star rating, 0..5 in .5 increments
2087
-	if ( 'percent' == $r['type'] ) {
2088
-		$rating = round( $rating / 10, 0 ) / 2;
2087
+	if ('percent' == $r['type']) {
2088
+		$rating = round($rating / 10, 0) / 2;
2089 2089
 	}
2090 2090
 
2091 2091
 	// Calculate the number of each type of star needed
2092
-	$full_stars = floor( $rating );
2093
-	$half_stars = ceil( $rating - $full_stars );
2092
+	$full_stars = floor($rating);
2093
+	$half_stars = ceil($rating - $full_stars);
2094 2094
 	$empty_stars = 5 - $full_stars - $half_stars;
2095 2095
 
2096
-	if ( $r['number'] ) {
2096
+	if ($r['number']) {
2097 2097
 		/* translators: 1: The rating, 2: The number of ratings */
2098
-		$format = _n( '%1$s rating based on %2$s rating', '%1$s rating based on %2$s ratings', $r['number'] );
2099
-		$title = sprintf( $format, number_format_i18n( $rating, 1 ), number_format_i18n( $r['number'] ) );
2098
+		$format = _n('%1$s rating based on %2$s rating', '%1$s rating based on %2$s ratings', $r['number']);
2099
+		$title = sprintf($format, number_format_i18n($rating, 1), number_format_i18n($r['number']));
2100 2100
 	} else {
2101 2101
 		/* translators: 1: The rating */
2102
-		$title = sprintf( __( '%s rating' ), number_format_i18n( $rating, 1 ) );
2102
+		$title = sprintf(__('%s rating'), number_format_i18n($rating, 1));
2103 2103
 	}
2104 2104
 
2105 2105
 	$output = '<div class="star-rating">';
2106
-	$output .= '<span class="screen-reader-text">' . $title . '</span>';
2107
-	$output .= str_repeat( '<div class="star star-full" aria-hidden="true"></div>', $full_stars );
2108
-	$output .= str_repeat( '<div class="star star-half" aria-hidden="true"></div>', $half_stars );
2109
-	$output .= str_repeat( '<div class="star star-empty" aria-hidden="true"></div>', $empty_stars );
2106
+	$output .= '<span class="screen-reader-text">'.$title.'</span>';
2107
+	$output .= str_repeat('<div class="star star-full" aria-hidden="true"></div>', $full_stars);
2108
+	$output .= str_repeat('<div class="star star-half" aria-hidden="true"></div>', $half_stars);
2109
+	$output .= str_repeat('<div class="star star-empty" aria-hidden="true"></div>', $empty_stars);
2110 2110
 	$output .= '</div>';
2111 2111
 
2112
-	if ( $r['echo'] ) {
2112
+	if ($r['echo']) {
2113 2113
 		echo $output;
2114 2114
 	}
2115 2115
 
@@ -2123,5 +2123,5 @@  discard block
 block discarded – undo
2123 2123
  * @since 4.2.0
2124 2124
  */
2125 2125
 function _wp_posts_page_notice() {
2126
-	echo '<div class="notice notice-warning inline"><p>' . __( 'You are currently editing the page that shows your latest posts.' ) . '</p></div>';
2126
+	echo '<div class="notice notice-warning inline"><p>'.__('You are currently editing the page that shows your latest posts.').'</p></div>';
2127 2127
 }
Please login to merge, or discard this patch.
Braces   +194 added lines, -125 removed lines patch added patch discarded remove patch
@@ -191,10 +191,11 @@  discard block
 block discarded – undo
191 191
 function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $echo = true ) {
192 192
 	$post = get_post();
193 193
 
194
-	if ( $post && $post->ID )
195
-		$checked_terms = wp_get_object_terms($post->ID, $taxonomy, array('fields'=>'ids'));
196
-	else
197
-		$checked_terms = array();
194
+	if ( $post && $post->ID ) {
195
+			$checked_terms = wp_get_object_terms($post->ID, $taxonomy, array('fields'=>'ids'));
196
+	} else {
197
+			$checked_terms = array();
198
+	}
198 199
 
199 200
 	$terms = get_terms( $taxonomy, array( 'orderby' => 'count', 'order' => 'DESC', 'number' => $number, 'hierarchical' => false ) );
200 201
 
@@ -203,8 +204,10 @@  discard block
 block discarded – undo
203 204
 	$popular_ids = array();
204 205
 	foreach ( (array) $terms as $term ) {
205 206
 		$popular_ids[] = $term->term_id;
206
-		if ( !$echo ) // Hack for Ajax use.
207
+		if ( !$echo ) {
208
+			// Hack for Ajax use.
207 209
 			continue;
210
+		}
208 211
 		$id = "popular-$taxonomy-$term->term_id";
209 212
 		$checked = in_array( $term->term_id, $checked_terms ) ? 'checked="checked"' : '';
210 213
 		?>
@@ -248,8 +251,9 @@  discard block
 block discarded – undo
248 251
 
249 252
 	$categories = get_terms( 'link_category', array( 'orderby' => 'name', 'hide_empty' => 0 ) );
250 253
 
251
-	if ( empty( $categories ) )
252
-		return;
254
+	if ( empty( $categories ) ) {
255
+			return;
256
+	}
253 257
 
254 258
 	foreach ( $categories as $category ) {
255 259
 		$cat_id = $category->term_id;
@@ -270,8 +274,9 @@  discard block
 block discarded – undo
270 274
  */
271 275
 function get_inline_data($post) {
272 276
 	$post_type_object = get_post_type_object($post->post_type);
273
-	if ( ! current_user_can( 'edit_post', $post->ID ) )
274
-		return;
277
+	if ( ! current_user_can( 'edit_post', $post->ID ) ) {
278
+			return;
279
+	}
275 280
 
276 281
 	$title = esc_textarea( trim( $post->post_title ) );
277 282
 
@@ -331,11 +336,13 @@  discard block
 block discarded – undo
331 336
 		}
332 337
 	}
333 338
 
334
-	if ( !$post_type_object->hierarchical )
335
-		echo '<div class="sticky">' . (is_sticky($post->ID) ? 'sticky' : '') . '</div>';
339
+	if ( !$post_type_object->hierarchical ) {
340
+			echo '<div class="sticky">' . (is_sticky($post->ID) ? 'sticky' : '') . '</div>';
341
+	}
336 342
 
337
-	if ( post_type_supports( $post->post_type, 'post-formats' ) )
338
-		echo '<div class="post_format">' . esc_html( get_post_format( $post->ID ) ) . '</div>';
343
+	if ( post_type_supports( $post->post_type, 'post-formats' ) ) {
344
+			echo '<div class="post_format">' . esc_html( get_post_format( $post->ID ) ) . '</div>';
345
+	}
339 346
 
340 347
 	echo '</div>';
341 348
 }
@@ -388,9 +395,12 @@  discard block
 block discarded – undo
388 395
 <form method="get">
389 396
 <?php if ( $table_row ) : ?>
390 397
 <table style="display:none;"><tbody id="com-reply"><tr id="replyrow" class="inline-edit-row" style="display:none;"><td colspan="<?php echo $wp_list_table->get_column_count(); ?>" class="colspanchange">
391
-<?php else : ?>
398
+<?php else {
399
+	: ?>
392 400
 <div id="com-reply" style="display:none;"><div id="replyrow" style="display:none;">
393
-<?php endif; ?>
401
+<?php endif;
402
+}
403
+?>
394 404
 	<fieldset class="comment-reply">
395 405
 	<legend>
396 406
 		<span class="hidden" id="editlegend"><?php _e( 'Edit Comment' ); ?></span>
@@ -442,15 +452,19 @@  discard block
 block discarded – undo
442 452
 	<input type="hidden" name="mode" id="mode" value="<?php echo esc_attr($mode); ?>" />
443 453
 	<?php
444 454
 		wp_nonce_field( 'replyto-comment', '_ajax_nonce-replyto-comment', false );
445
-		if ( current_user_can( 'unfiltered_html' ) )
446
-			wp_nonce_field( 'unfiltered-html-comment', '_wp_unfiltered_html_comment', false );
455
+		if ( current_user_can( 'unfiltered_html' ) ) {
456
+					wp_nonce_field( 'unfiltered-html-comment', '_wp_unfiltered_html_comment', false );
457
+		}
447 458
 	?>
448 459
 	</fieldset>
449 460
 <?php if ( $table_row ) : ?>
450 461
 </td></tr></tbody></table>
451
-<?php else : ?>
462
+<?php else {
463
+	: ?>
452 464
 </div></div>
453
-<?php endif; ?>
465
+<?php endif;
466
+}
467
+?>
454 468
 </form>
455 469
 <?php
456 470
 }
@@ -506,9 +520,10 @@  discard block
 block discarded – undo
506 520
 	</thead>
507 521
 	<tbody id='the-list' data-wp-lists='list:meta'>
508 522
 <?php
509
-	foreach ( $meta as $entry )
510
-		echo _list_meta_row( $entry, $count );
511
-?>
523
+	foreach ( $meta as $entry ) {
524
+			echo _list_meta_row( $entry, $count );
525
+	}
526
+	?>
512 527
 	</tbody>
513 528
 </table>
514 529
 <?php
@@ -528,11 +543,13 @@  discard block
 block discarded – undo
528 543
 function _list_meta_row( $entry, &$count ) {
529 544
 	static $update_nonce = '';
530 545
 
531
-	if ( is_protected_meta( $entry['meta_key'], 'post' ) )
532
-		return '';
546
+	if ( is_protected_meta( $entry['meta_key'], 'post' ) ) {
547
+			return '';
548
+	}
533 549
 
534
-	if ( ! $update_nonce )
535
-		$update_nonce = wp_create_nonce( 'add-meta' );
550
+	if ( ! $update_nonce ) {
551
+			$update_nonce = wp_create_nonce( 'add-meta' );
552
+	}
536 553
 
537 554
 	$r = '';
538 555
 	++ $count;
@@ -639,8 +656,9 @@  discard block
 block discarded – undo
639 656
 <?php
640 657
 
641 658
 	foreach ( $keys as $key ) {
642
-		if ( is_protected_meta( $key, 'post' ) || ! current_user_can( 'add_post_meta', $post->ID, $key ) )
643
-			continue;
659
+		if ( is_protected_meta( $key, 'post' ) || ! current_user_can( 'add_post_meta', $post->ID, $key ) ) {
660
+					continue;
661
+		}
644 662
 		echo "\n<option value='" . esc_attr($key) . "'>" . esc_html($key) . "</option>";
645 663
 	}
646 664
 ?>
@@ -686,12 +704,14 @@  discard block
 block discarded – undo
686 704
 	global $wp_locale;
687 705
 	$post = get_post();
688 706
 
689
-	if ( $for_post )
690
-		$edit = ! ( in_array($post->post_status, array('draft', 'pending') ) && (!$post->post_date_gmt || '0000-00-00 00:00:00' == $post->post_date_gmt ) );
707
+	if ( $for_post ) {
708
+			$edit = ! ( in_array($post->post_status, array('draft', 'pending') ) && (!$post->post_date_gmt || '0000-00-00 00:00:00' == $post->post_date_gmt ) );
709
+	}
691 710
 
692 711
 	$tab_index_attribute = '';
693
-	if ( (int) $tab_index > 0 )
694
-		$tab_index_attribute = " tabindex=\"$tab_index\"";
712
+	if ( (int) $tab_index > 0 ) {
713
+			$tab_index_attribute = " tabindex=\"$tab_index\"";
714
+	}
695 715
 
696 716
 	// todo: Remove this?
697 717
 	// echo '<label for="timestamp" style="display: block;"><input type="checkbox" class="checkbox" name="edit_date" value="1" id="timestamp"'.$tab_index_attribute.' /> '.__( 'Edit timestamp' ).'</label><br />';
@@ -732,7 +752,9 @@  discard block
 block discarded – undo
732 752
 
733 753
 	echo '</div><input type="hidden" id="ss" name="ss" value="' . $ss . '" />';
734 754
 
735
-	if ( $multi ) return;
755
+	if ( $multi ) {
756
+		return;
757
+	}
736 758
 
737 759
 	echo "\n\n";
738 760
 	$map = array(
@@ -799,8 +821,9 @@  discard block
 block discarded – undo
799 821
 	if ( $items ) {
800 822
 		foreach ( $items as $item ) {
801 823
 			// A page cannot be its own parent.
802
-			if ( $post && $post->ID && $item->ID == $post->ID )
803
-				continue;
824
+			if ( $post && $post->ID && $item->ID == $post->ID ) {
825
+							continue;
826
+			}
804 827
 
805 828
 			$pad = str_repeat( '&nbsp;', $level * 3 );
806 829
 			$selected = selected( $default, $item->ID, false );
@@ -828,10 +851,12 @@  discard block
 block discarded – undo
828 851
 
829 852
 	foreach ( $editable_roles as $role => $details ) {
830 853
 		$name = translate_user_role($details['name'] );
831
-		if ( $selected == $role ) // preselect specified role
854
+		if ( $selected == $role ) {
855
+			// preselect specified role
832 856
 			$p = "\n\t<option selected='selected' value='" . esc_attr($role) . "'>$name</option>";
833
-		else
834
-			$r .= "\n\t<option value='" . esc_attr($role) . "'>$name</option>";
857
+		} else {
858
+					$r .= "\n\t<option value='" . esc_attr($role) . "'>$name</option>";
859
+		}
835 860
 	}
836 861
 	echo $p . $r;
837 862
 }
@@ -860,9 +885,12 @@  discard block
 block discarded – undo
860 885
 	if ( ! empty( $upload_dir['error'] ) ) :
861 886
 		?><div class="error"><p><?php _e('Before you can upload your import file, you will need to fix the following error:'); ?></p>
862 887
 		<p><strong><?php echo $upload_dir['error']; ?></strong></p></div><?php
863
-	else :
888
+	else {
889
+		:
864 890
 ?>
865
-<form enctype="multipart/form-data" id="import-upload-form" method="post" class="wp-upload-form" action="<?php echo esc_url( wp_nonce_url( $action, 'import-upload' ) ); ?>">
891
+<form enctype="multipart/form-data" id="import-upload-form" method="post" class="wp-upload-form" action="<?php echo esc_url( wp_nonce_url( $action, 'import-upload' ) );
892
+	}
893
+	?>">
866 894
 <p>
867 895
 <label for="upload"><?php _e( 'Choose a file from your computer:' ); ?></label> (<?php printf( __('Maximum size: %s' ), $size ); ?>)
868 896
 <input type="file" id="upload" name="import" size="25" />
@@ -922,23 +950,28 @@  discard block
 block discarded – undo
922 950
 
923 951
 	$page = $screen->id;
924 952
 
925
-	if ( !isset($wp_meta_boxes) )
926
-		$wp_meta_boxes = array();
927
-	if ( !isset($wp_meta_boxes[$page]) )
928
-		$wp_meta_boxes[$page] = array();
929
-	if ( !isset($wp_meta_boxes[$page][$context]) )
930
-		$wp_meta_boxes[$page][$context] = array();
953
+	if ( !isset($wp_meta_boxes) ) {
954
+			$wp_meta_boxes = array();
955
+	}
956
+	if ( !isset($wp_meta_boxes[$page]) ) {
957
+			$wp_meta_boxes[$page] = array();
958
+	}
959
+	if ( !isset($wp_meta_boxes[$page][$context]) ) {
960
+			$wp_meta_boxes[$page][$context] = array();
961
+	}
931 962
 
932 963
 	foreach ( array_keys($wp_meta_boxes[$page]) as $a_context ) {
933 964
 		foreach ( array('high', 'core', 'default', 'low') as $a_priority ) {
934
-			if ( !isset($wp_meta_boxes[$page][$a_context][$a_priority][$id]) )
935
-				continue;
965
+			if ( !isset($wp_meta_boxes[$page][$a_context][$a_priority][$id]) ) {
966
+							continue;
967
+			}
936 968
 
937 969
 			// If a core box was previously added or removed by a plugin, don't add.
938 970
 			if ( 'core' == $priority ) {
939 971
 				// If core box previously deleted, don't add
940
-				if ( false === $wp_meta_boxes[$page][$a_context][$a_priority][$id] )
941
-					return;
972
+				if ( false === $wp_meta_boxes[$page][$a_context][$a_priority][$id] ) {
973
+									return;
974
+				}
942 975
 
943 976
 				/*
944 977
 				 * If box was added with default priority, give it core priority to
@@ -963,16 +996,19 @@  discard block
 block discarded – undo
963 996
 				$callback_args = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['args'];
964 997
 			}
965 998
 			// An id can be in only one priority and one context.
966
-			if ( $priority != $a_priority || $context != $a_context )
967
-				unset($wp_meta_boxes[$page][$a_context][$a_priority][$id]);
999
+			if ( $priority != $a_priority || $context != $a_context ) {
1000
+							unset($wp_meta_boxes[$page][$a_context][$a_priority][$id]);
1001
+			}
968 1002
 		}
969 1003
 	}
970 1004
 
971
-	if ( empty($priority) )
972
-		$priority = 'low';
1005
+	if ( empty($priority) ) {
1006
+			$priority = 'low';
1007
+	}
973 1008
 
974
-	if ( !isset($wp_meta_boxes[$page][$context][$priority]) )
975
-		$wp_meta_boxes[$page][$context][$priority] = array();
1009
+	if ( !isset($wp_meta_boxes[$page][$context][$priority]) ) {
1010
+			$wp_meta_boxes[$page][$context][$priority] = array();
1011
+	}
976 1012
 
977 1013
 	$wp_meta_boxes[$page][$context][$priority][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback, 'args' => $callback_args);
978 1014
 }
@@ -994,10 +1030,11 @@  discard block
 block discarded – undo
994 1030
 	global $wp_meta_boxes;
995 1031
 	static $already_sorted = false;
996 1032
 
997
-	if ( empty( $screen ) )
998
-		$screen = get_current_screen();
999
-	elseif ( is_string( $screen ) )
1000
-		$screen = convert_to_screen( $screen );
1033
+	if ( empty( $screen ) ) {
1034
+			$screen = get_current_screen();
1035
+	} elseif ( is_string( $screen ) ) {
1036
+			$screen = convert_to_screen( $screen );
1037
+	}
1001 1038
 
1002 1039
 	$page = $screen->id;
1003 1040
 
@@ -1024,8 +1061,9 @@  discard block
 block discarded – undo
1024 1061
 		foreach ( array( 'high', 'sorted', 'core', 'default', 'low' ) as $priority ) {
1025 1062
 			if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ]) ) {
1026 1063
 				foreach ( (array) $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) {
1027
-					if ( false == $box || ! $box['title'] )
1028
-						continue;
1064
+					if ( false == $box || ! $box['title'] ) {
1065
+											continue;
1066
+					}
1029 1067
 					$i++;
1030 1068
 					$hidden_class = in_array($box['id'], $hidden) ? ' hide-if-js' : '';
1031 1069
 					echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . $hidden_class . '" ' . '>' . "\n";
@@ -1096,16 +1134,20 @@  discard block
 block discarded – undo
1096 1134
 
1097 1135
 	$page = $screen->id;
1098 1136
 
1099
-	if ( !isset($wp_meta_boxes) )
1100
-		$wp_meta_boxes = array();
1101
-	if ( !isset($wp_meta_boxes[$page]) )
1102
-		$wp_meta_boxes[$page] = array();
1103
-	if ( !isset($wp_meta_boxes[$page][$context]) )
1104
-		$wp_meta_boxes[$page][$context] = array();
1137
+	if ( !isset($wp_meta_boxes) ) {
1138
+			$wp_meta_boxes = array();
1139
+	}
1140
+	if ( !isset($wp_meta_boxes[$page]) ) {
1141
+			$wp_meta_boxes[$page] = array();
1142
+	}
1143
+	if ( !isset($wp_meta_boxes[$page][$context]) ) {
1144
+			$wp_meta_boxes[$page][$context] = array();
1145
+	}
1105 1146
 
1106
-	foreach ( array('high', 'core', 'default', 'low') as $priority )
1107
-		$wp_meta_boxes[$page][$context][$priority][$id] = false;
1108
-}
1147
+	foreach ( array('high', 'core', 'default', 'low') as $priority ) {
1148
+			$wp_meta_boxes[$page][$context][$priority][$id] = false;
1149
+	}
1150
+	}
1109 1151
 
1110 1152
 /**
1111 1153
  * Meta Box Accordion Template Function
@@ -1128,10 +1170,11 @@  discard block
 block discarded – undo
1128 1170
 
1129 1171
 	wp_enqueue_script( 'accordion' );
1130 1172
 
1131
-	if ( empty( $screen ) )
1132
-		$screen = get_current_screen();
1133
-	elseif ( is_string( $screen ) )
1134
-		$screen = convert_to_screen( $screen );
1173
+	if ( empty( $screen ) ) {
1174
+			$screen = get_current_screen();
1175
+	} elseif ( is_string( $screen ) ) {
1176
+			$screen = convert_to_screen( $screen );
1177
+	}
1135 1178
 
1136 1179
 	$page = $screen->id;
1137 1180
 
@@ -1147,8 +1190,9 @@  discard block
 block discarded – undo
1147 1190
 		foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) {
1148 1191
 			if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) {
1149 1192
 				foreach ( $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) {
1150
-					if ( false == $box || ! $box['title'] )
1151
-						continue;
1193
+					if ( false == $box || ! $box['title'] ) {
1194
+											continue;
1195
+					}
1152 1196
 					$i++;
1153 1197
 					$hidden_class = in_array( $box['id'], $hidden ) ? 'hide-if-js' : '';
1154 1198
 
@@ -1286,18 +1330,22 @@  discard block
 block discarded – undo
1286 1330
 function do_settings_sections( $page ) {
1287 1331
 	global $wp_settings_sections, $wp_settings_fields;
1288 1332
 
1289
-	if ( ! isset( $wp_settings_sections[$page] ) )
1290
-		return;
1333
+	if ( ! isset( $wp_settings_sections[$page] ) ) {
1334
+			return;
1335
+	}
1291 1336
 
1292 1337
 	foreach ( (array) $wp_settings_sections[$page] as $section ) {
1293
-		if ( $section['title'] )
1294
-			echo "<h2>{$section['title']}</h2>\n";
1338
+		if ( $section['title'] ) {
1339
+					echo "<h2>{$section['title']}</h2>\n";
1340
+		}
1295 1341
 
1296
-		if ( $section['callback'] )
1297
-			call_user_func( $section['callback'], $section );
1342
+		if ( $section['callback'] ) {
1343
+					call_user_func( $section['callback'], $section );
1344
+		}
1298 1345
 
1299
-		if ( ! isset( $wp_settings_fields ) || !isset( $wp_settings_fields[$page] ) || !isset( $wp_settings_fields[$page][$section['id']] ) )
1300
-			continue;
1346
+		if ( ! isset( $wp_settings_fields ) || !isset( $wp_settings_fields[$page] ) || !isset( $wp_settings_fields[$page][$section['id']] ) ) {
1347
+					continue;
1348
+		}
1301 1349
 		echo '<table class="form-table">';
1302 1350
 		do_settings_fields( $page, $section['id'] );
1303 1351
 		echo '</table>';
@@ -1321,8 +1369,9 @@  discard block
 block discarded – undo
1321 1369
 function do_settings_fields($page, $section) {
1322 1370
 	global $wp_settings_fields;
1323 1371
 
1324
-	if ( ! isset( $wp_settings_fields[$page][$section] ) )
1325
-		return;
1372
+	if ( ! isset( $wp_settings_fields[$page][$section] ) ) {
1373
+			return;
1374
+	}
1326 1375
 
1327 1376
 	foreach ( (array) $wp_settings_fields[$page][$section] as $field ) {
1328 1377
 		$class = '';
@@ -1412,8 +1461,9 @@  discard block
 block discarded – undo
1412 1461
 	 * This allows the $sanitize_callback from register_setting() to run, adding
1413 1462
 	 * any settings errors you want to show by default.
1414 1463
 	 */
1415
-	if ( $sanitize )
1416
-		sanitize_option( $setting, get_option( $setting ) );
1464
+	if ( $sanitize ) {
1465
+			sanitize_option( $setting, get_option( $setting ) );
1466
+	}
1417 1467
 
1418 1468
 	// If settings were passed back from options.php then use them.
1419 1469
 	if ( isset( $_GET['settings-updated'] ) && $_GET['settings-updated'] && get_transient( 'settings_errors' ) ) {
@@ -1422,15 +1472,17 @@  discard block
 block discarded – undo
1422 1472
 	}
1423 1473
 
1424 1474
 	// Check global in case errors have been added on this pageload.
1425
-	if ( ! count( $wp_settings_errors ) )
1426
-		return array();
1475
+	if ( ! count( $wp_settings_errors ) ) {
1476
+			return array();
1477
+	}
1427 1478
 
1428 1479
 	// Filter the results to those of a specific setting if one was set.
1429 1480
 	if ( $setting ) {
1430 1481
 		$setting_errors = array();
1431 1482
 		foreach ( (array) $wp_settings_errors as $key => $details ) {
1432
-			if ( $setting == $details['setting'] )
1433
-				$setting_errors[] = $wp_settings_errors[$key];
1483
+			if ( $setting == $details['setting'] ) {
1484
+							$setting_errors[] = $wp_settings_errors[$key];
1485
+			}
1434 1486
 		}
1435 1487
 		return $setting_errors;
1436 1488
 	}
@@ -1467,13 +1519,15 @@  discard block
 block discarded – undo
1467 1519
  */
1468 1520
 function settings_errors( $setting = '', $sanitize = false, $hide_on_update = false ) {
1469 1521
 
1470
-	if ( $hide_on_update && ! empty( $_GET['settings-updated'] ) )
1471
-		return;
1522
+	if ( $hide_on_update && ! empty( $_GET['settings-updated'] ) ) {
1523
+			return;
1524
+	}
1472 1525
 
1473 1526
 	$settings_errors = get_settings_errors( $setting, $sanitize );
1474 1527
 
1475
-	if ( empty( $settings_errors ) )
1476
-		return;
1528
+	if ( empty( $settings_errors ) ) {
1529
+			return;
1530
+	}
1477 1531
 
1478 1532
 	$output = '';
1479 1533
 	foreach ( $settings_errors as $key => $details ) {
@@ -1532,9 +1586,10 @@  discard block
 block discarded – undo
1532 1586
  */
1533 1587
 function the_post_password() {
1534 1588
 	$post = get_post();
1535
-	if ( isset( $post->post_password ) )
1536
-		echo esc_attr( $post->post_password );
1537
-}
1589
+	if ( isset( $post->post_password ) ) {
1590
+			echo esc_attr( $post->post_password );
1591
+	}
1592
+	}
1538 1593
 
1539 1594
 /**
1540 1595
  * Get the post title.
@@ -1549,8 +1604,9 @@  discard block
 block discarded – undo
1549 1604
  */
1550 1605
 function _draft_or_post_title( $post = 0 ) {
1551 1606
 	$title = get_the_title( $post );
1552
-	if ( empty( $title ) )
1553
-		$title = __( '(no title)' );
1607
+	if ( empty( $title ) ) {
1608
+			$title = __( '(no title)' );
1609
+	}
1554 1610
 	return esc_html( $title );
1555 1611
 }
1556 1612
 
@@ -1627,8 +1683,9 @@  discard block
 block discarded – undo
1627 1683
 
1628 1684
 $admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_user_locale() ) ) );
1629 1685
 
1630
-if ( is_rtl() )
1686
+if ( is_rtl() ) {
1631 1687
 	$admin_body_class .= ' rtl';
1688
+}
1632 1689
 
1633 1690
 ?>
1634 1691
 </head>
@@ -1640,7 +1697,10 @@  discard block
 block discarded – undo
1640 1697
 /**
1641 1698
  * @global string $body_id
1642 1699
  */
1643
-if ( isset($GLOBALS['body_id']) ) echo ' id="' . $GLOBALS['body_id'] . '"'; ?> class="wp-admin wp-core-ui no-js iframe <?php echo $admin_body_classes . ' ' . $admin_body_class; ?>">
1700
+if ( isset($GLOBALS['body_id']) ) {
1701
+	echo ' id="' . $GLOBALS['body_id'] . '"';
1702
+}
1703
+?> class="wp-admin wp-core-ui no-js iframe <?php echo $admin_body_classes . ' ' . $admin_body_class; ?>">
1644 1704
 <script type="text/javascript">
1645 1705
 (function(){
1646 1706
 var c = document.body.className;
@@ -1692,21 +1752,27 @@  discard block
 block discarded – undo
1692 1752
  */
1693 1753
 function _post_states($post) {
1694 1754
 	$post_states = array();
1695
-	if ( isset( $_REQUEST['post_status'] ) )
1696
-		$post_status = $_REQUEST['post_status'];
1697
-	else
1698
-		$post_status = '';
1699
-
1700
-	if ( !empty($post->post_password) )
1701
-		$post_states['protected'] = __('Password protected');
1702
-	if ( 'private' == $post->post_status && 'private' != $post_status )
1703
-		$post_states['private'] = __('Private');
1704
-	if ( 'draft' == $post->post_status && 'draft' != $post_status )
1705
-		$post_states['draft'] = __('Draft');
1706
-	if ( 'pending' == $post->post_status && 'pending' != $post_status )
1707
-		$post_states['pending'] = _x('Pending', 'post status');
1708
-	if ( is_sticky($post->ID) )
1709
-		$post_states['sticky'] = __('Sticky');
1755
+	if ( isset( $_REQUEST['post_status'] ) ) {
1756
+			$post_status = $_REQUEST['post_status'];
1757
+	} else {
1758
+			$post_status = '';
1759
+	}
1760
+
1761
+	if ( !empty($post->post_password) ) {
1762
+			$post_states['protected'] = __('Password protected');
1763
+	}
1764
+	if ( 'private' == $post->post_status && 'private' != $post_status ) {
1765
+			$post_states['private'] = __('Private');
1766
+	}
1767
+	if ( 'draft' == $post->post_status && 'draft' != $post_status ) {
1768
+			$post_states['draft'] = __('Draft');
1769
+	}
1770
+	if ( 'pending' == $post->post_status && 'pending' != $post_status ) {
1771
+			$post_states['pending'] = _x('Pending', 'post status');
1772
+	}
1773
+	if ( is_sticky($post->ID) ) {
1774
+			$post_states['sticky'] = __('Sticky');
1775
+	}
1710 1776
 
1711 1777
 	if ( 'future' === $post->post_status ) {
1712 1778
 		$post_states['scheduled'] = __( 'Scheduled' );
@@ -1932,14 +1998,16 @@  discard block
 block discarded – undo
1932 1998
  * @return string Submit button HTML.
1933 1999
  */
1934 2000
 function get_submit_button( $text = '', $type = 'primary large', $name = 'submit', $wrap = true, $other_attributes = '' ) {
1935
-	if ( ! is_array( $type ) )
1936
-		$type = explode( ' ', $type );
2001
+	if ( ! is_array( $type ) ) {
2002
+			$type = explode( ' ', $type );
2003
+	}
1937 2004
 
1938 2005
 	$button_shorthand = array( 'primary', 'small', 'large' );
1939 2006
 	$classes = array( 'button' );
1940 2007
 	foreach ( $type as $t ) {
1941
-		if ( 'secondary' === $t || 'button-secondary' === $t )
1942
-			continue;
2008
+		if ( 'secondary' === $t || 'button-secondary' === $t ) {
2009
+					continue;
2010
+		}
1943 2011
 		$classes[] = in_array( $t, $button_shorthand ) ? 'button-' . $t : $t;
1944 2012
 	}
1945 2013
 	// Remove empty items, remove duplicate items, and finally build a string.
@@ -1986,8 +2054,9 @@  discard block
 block discarded – undo
1986 2054
 
1987 2055
 	$admin_html_class = ( is_admin_bar_showing() ) ? 'wp-toolbar' : '';
1988 2056
 
1989
-	if ( $is_IE )
1990
-		@header('X-UA-Compatible: IE=edge');
2057
+	if ( $is_IE ) {
2058
+			@header('X-UA-Compatible: IE=edge');
2059
+	}
1991 2060
 
1992 2061
 ?>
1993 2062
 <!DOCTYPE html>
Please login to merge, or discard this patch.
src/wp-includes/class-wp-theme.php 4 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 	 * and care should be taken to use `$theme::display( 'Name' )` to get a properly
441 441
 	 * translated header.
442 442
 	 *
443
-	 * @param mixed $offset
443
+	 * @param string $offset
444 444
 	 * @return mixed
445 445
 	 */
446 446
 	public function offsetGet( $offset ) {
@@ -976,7 +976,7 @@  discard block
 block discarded – undo
976 976
 	 * @since 3.4.0
977 977
 	 * @access public
978 978
 	 *
979
-	 * @param mixed $type Optional. Array of extensions to return. Defaults to all files (null).
979
+	 * @param string $type Optional. Array of extensions to return. Defaults to all files (null).
980 980
 	 * @param int $depth Optional. How deep to search for files. Defaults to a flat scan (0 depth). -1 depth is infinite.
981 981
 	 * @param bool $search_parent Optional. Whether to return parent files. Defaults to false.
982 982
 	 * @return array Array of files, keyed by the path to the file relative to the theme's directory, with the values
@@ -1352,7 +1352,7 @@  discard block
 block discarded – undo
1352 1352
 	 * @static
1353 1353
 	 * @access public
1354 1354
 	 *
1355
-	 * @param string|array $stylesheets Stylesheet name or array of stylesheet names.
1355
+	 * @param string $stylesheets Stylesheet name or array of stylesheet names.
1356 1356
 	 */
1357 1357
 	public static function network_disable_theme( $stylesheets ) {
1358 1358
 		if ( ! is_multisite() ) {
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -707,7 +707,7 @@
 block discarded – undo
707 707
 	/**
708 708
 	 * Mark up a theme header.
709 709
 	 *
710
-     * @since 3.4.0
710
+	 * @since 3.4.0
711 711
 	 * @access private
712 712
 	 *
713 713
 	 * @staticvar string $comma
Please login to merge, or discard this patch.
Spacing   +298 added lines, -298 removed lines patch added patch discarded remove patch
@@ -199,19 +199,19 @@  discard block
 block discarded – undo
199 199
 	 * @param string $theme_root Theme root.
200 200
 	 * @param WP_Error|void $_child If this theme is a parent theme, the child may be passed for validation purposes.
201 201
 	 */
202
-	public function __construct( $theme_dir, $theme_root, $_child = null ) {
202
+	public function __construct($theme_dir, $theme_root, $_child = null) {
203 203
 		global $wp_theme_directories;
204 204
 
205 205
 		// Initialize caching on first run.
206
-		if ( ! isset( self::$persistently_cache ) ) {
206
+		if ( ! isset(self::$persistently_cache)) {
207 207
 			/** This action is documented in wp-includes/theme.php */
208
-			self::$persistently_cache = apply_filters( 'wp_cache_themes_persistently', false, 'WP_Theme' );
209
-			if ( self::$persistently_cache ) {
210
-				wp_cache_add_global_groups( 'themes' );
211
-				if ( is_int( self::$persistently_cache ) )
208
+			self::$persistently_cache = apply_filters('wp_cache_themes_persistently', false, 'WP_Theme');
209
+			if (self::$persistently_cache) {
210
+				wp_cache_add_global_groups('themes');
211
+				if (is_int(self::$persistently_cache))
212 212
 					self::$cache_expiration = self::$persistently_cache;
213 213
 			} else {
214
-				wp_cache_add_non_persistent_groups( 'themes' );
214
+				wp_cache_add_non_persistent_groups('themes');
215 215
 			}
216 216
 		}
217 217
 
@@ -219,114 +219,114 @@  discard block
 block discarded – undo
219 219
 		$this->stylesheet = $theme_dir;
220 220
 
221 221
 		// Correct a situation where the theme is 'some-directory/some-theme' but 'some-directory' was passed in as part of the theme root instead.
222
-		if ( ! in_array( $theme_root, (array) $wp_theme_directories ) && in_array( dirname( $theme_root ), (array) $wp_theme_directories ) ) {
223
-			$this->stylesheet = basename( $this->theme_root ) . '/' . $this->stylesheet;
224
-			$this->theme_root = dirname( $theme_root );
222
+		if ( ! in_array($theme_root, (array) $wp_theme_directories) && in_array(dirname($theme_root), (array) $wp_theme_directories)) {
223
+			$this->stylesheet = basename($this->theme_root).'/'.$this->stylesheet;
224
+			$this->theme_root = dirname($theme_root);
225 225
 		}
226 226
 
227
-		$this->cache_hash = md5( $this->theme_root . '/' . $this->stylesheet );
228
-		$theme_file = $this->stylesheet . '/style.css';
227
+		$this->cache_hash = md5($this->theme_root.'/'.$this->stylesheet);
228
+		$theme_file = $this->stylesheet.'/style.css';
229 229
 
230
-		$cache = $this->cache_get( 'theme' );
230
+		$cache = $this->cache_get('theme');
231 231
 
232
-		if ( is_array( $cache ) ) {
233
-			foreach ( array( 'errors', 'headers', 'template' ) as $key ) {
234
-				if ( isset( $cache[ $key ] ) )
235
-					$this->$key = $cache[ $key ];
232
+		if (is_array($cache)) {
233
+			foreach (array('errors', 'headers', 'template') as $key) {
234
+				if (isset($cache[$key]))
235
+					$this->$key = $cache[$key];
236 236
 			}
237
-			if ( $this->errors )
237
+			if ($this->errors)
238 238
 				return;
239
-			if ( isset( $cache['theme_root_template'] ) )
239
+			if (isset($cache['theme_root_template']))
240 240
 				$theme_root_template = $cache['theme_root_template'];
241
-		} elseif ( ! file_exists( $this->theme_root . '/' . $theme_file ) ) {
241
+		} elseif ( ! file_exists($this->theme_root.'/'.$theme_file)) {
242 242
 			$this->headers['Name'] = $this->stylesheet;
243
-			if ( ! file_exists( $this->theme_root . '/' . $this->stylesheet ) )
244
-				$this->errors = new WP_Error( 'theme_not_found', sprintf( __( 'The theme directory "%s" does not exist.' ), esc_html( $this->stylesheet ) ) );
243
+			if ( ! file_exists($this->theme_root.'/'.$this->stylesheet))
244
+				$this->errors = new WP_Error('theme_not_found', sprintf(__('The theme directory "%s" does not exist.'), esc_html($this->stylesheet)));
245 245
 			else
246
-				$this->errors = new WP_Error( 'theme_no_stylesheet', __( 'Stylesheet is missing.' ) );
246
+				$this->errors = new WP_Error('theme_no_stylesheet', __('Stylesheet is missing.'));
247 247
 			$this->template = $this->stylesheet;
248
-			$this->cache_add( 'theme', array( 'headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet, 'template' => $this->template ) );
249
-			if ( ! file_exists( $this->theme_root ) ) // Don't cache this one.
250
-				$this->errors->add( 'theme_root_missing', __( 'ERROR: The themes directory is either empty or doesn&#8217;t exist. Please check your installation.' ) );
248
+			$this->cache_add('theme', array('headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet, 'template' => $this->template));
249
+			if ( ! file_exists($this->theme_root)) // Don't cache this one.
250
+				$this->errors->add('theme_root_missing', __('ERROR: The themes directory is either empty or doesn&#8217;t exist. Please check your installation.'));
251 251
 			return;
252
-		} elseif ( ! is_readable( $this->theme_root . '/' . $theme_file ) ) {
252
+		} elseif ( ! is_readable($this->theme_root.'/'.$theme_file)) {
253 253
 			$this->headers['Name'] = $this->stylesheet;
254
-			$this->errors = new WP_Error( 'theme_stylesheet_not_readable', __( 'Stylesheet is not readable.' ) );
254
+			$this->errors = new WP_Error('theme_stylesheet_not_readable', __('Stylesheet is not readable.'));
255 255
 			$this->template = $this->stylesheet;
256
-			$this->cache_add( 'theme', array( 'headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet, 'template' => $this->template ) );
256
+			$this->cache_add('theme', array('headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet, 'template' => $this->template));
257 257
 			return;
258 258
 		} else {
259
-			$this->headers = get_file_data( $this->theme_root . '/' . $theme_file, self::$file_headers, 'theme' );
259
+			$this->headers = get_file_data($this->theme_root.'/'.$theme_file, self::$file_headers, 'theme');
260 260
 			// Default themes always trump their pretenders.
261 261
 			// Properly identify default themes that are inside a directory within wp-content/themes.
262
-			if ( $default_theme_slug = array_search( $this->headers['Name'], self::$default_themes ) ) {
263
-				if ( basename( $this->stylesheet ) != $default_theme_slug )
264
-					$this->headers['Name'] .= '/' . $this->stylesheet;
262
+			if ($default_theme_slug = array_search($this->headers['Name'], self::$default_themes)) {
263
+				if (basename($this->stylesheet) != $default_theme_slug)
264
+					$this->headers['Name'] .= '/'.$this->stylesheet;
265 265
 			}
266 266
 		}
267 267
 
268 268
 		// (If template is set from cache [and there are no errors], we know it's good.)
269
-		if ( ! $this->template && ! ( $this->template = $this->headers['Template'] ) ) {
269
+		if ( ! $this->template && ! ($this->template = $this->headers['Template'])) {
270 270
 			$this->template = $this->stylesheet;
271
-			if ( ! file_exists( $this->theme_root . '/' . $this->stylesheet . '/index.php' ) ) {
271
+			if ( ! file_exists($this->theme_root.'/'.$this->stylesheet.'/index.php')) {
272 272
 				$error_message = sprintf(
273 273
 					/* translators: 1: index.php, 2: Codex URL, 3: style.css */
274
-					__( 'Template is missing. Standalone themes need to have a %1$s template file. <a href="%2$s">Child themes</a> need to have a Template header in the %3$s stylesheet.' ),
274
+					__('Template is missing. Standalone themes need to have a %1$s template file. <a href="%2$s">Child themes</a> need to have a Template header in the %3$s stylesheet.'),
275 275
 					'<code>index.php</code>',
276
-					__( 'https://codex.wordpress.org/Child_Themes' ),
276
+					__('https://codex.wordpress.org/Child_Themes'),
277 277
 					'<code>style.css</code>'
278 278
 				);
279
-				$this->errors = new WP_Error( 'theme_no_index', $error_message );
280
-				$this->cache_add( 'theme', array( 'headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet, 'template' => $this->template ) );
279
+				$this->errors = new WP_Error('theme_no_index', $error_message);
280
+				$this->cache_add('theme', array('headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet, 'template' => $this->template));
281 281
 				return;
282 282
 			}
283 283
 		}
284 284
 
285 285
 		// If we got our data from cache, we can assume that 'template' is pointing to the right place.
286
-		if ( ! is_array( $cache ) && $this->template != $this->stylesheet && ! file_exists( $this->theme_root . '/' . $this->template . '/index.php' ) ) {
286
+		if ( ! is_array($cache) && $this->template != $this->stylesheet && ! file_exists($this->theme_root.'/'.$this->template.'/index.php')) {
287 287
 			// If we're in a directory of themes inside /themes, look for the parent nearby.
288 288
 			// wp-content/themes/directory-of-themes/*
289
-			$parent_dir = dirname( $this->stylesheet );
290
-			if ( '.' != $parent_dir && file_exists( $this->theme_root . '/' . $parent_dir . '/' . $this->template . '/index.php' ) ) {
291
-				$this->template = $parent_dir . '/' . $this->template;
292
-			} elseif ( ( $directories = search_theme_directories() ) && isset( $directories[ $this->template ] ) ) {
289
+			$parent_dir = dirname($this->stylesheet);
290
+			if ('.' != $parent_dir && file_exists($this->theme_root.'/'.$parent_dir.'/'.$this->template.'/index.php')) {
291
+				$this->template = $parent_dir.'/'.$this->template;
292
+			} elseif (($directories = search_theme_directories()) && isset($directories[$this->template])) {
293 293
 				// Look for the template in the search_theme_directories() results, in case it is in another theme root.
294 294
 				// We don't look into directories of themes, just the theme root.
295
-				$theme_root_template = $directories[ $this->template ]['theme_root'];
295
+				$theme_root_template = $directories[$this->template]['theme_root'];
296 296
 			} else {
297 297
 				// Parent theme is missing.
298
-				$this->errors = new WP_Error( 'theme_no_parent', sprintf( __( 'The parent theme is missing. Please install the "%s" parent theme.' ), esc_html( $this->template ) ) );
299
-				$this->cache_add( 'theme', array( 'headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet, 'template' => $this->template ) );
300
-				$this->parent = new WP_Theme( $this->template, $this->theme_root, $this );
298
+				$this->errors = new WP_Error('theme_no_parent', sprintf(__('The parent theme is missing. Please install the "%s" parent theme.'), esc_html($this->template)));
299
+				$this->cache_add('theme', array('headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet, 'template' => $this->template));
300
+				$this->parent = new WP_Theme($this->template, $this->theme_root, $this);
301 301
 				return;
302 302
 			}
303 303
 		}
304 304
 
305 305
 		// Set the parent, if we're a child theme.
306
-		if ( $this->template != $this->stylesheet ) {
306
+		if ($this->template != $this->stylesheet) {
307 307
 			// If we are a parent, then there is a problem. Only two generations allowed! Cancel things out.
308
-			if ( $_child instanceof WP_Theme && $_child->template == $this->stylesheet ) {
308
+			if ($_child instanceof WP_Theme && $_child->template == $this->stylesheet) {
309 309
 				$_child->parent = null;
310
-				$_child->errors = new WP_Error( 'theme_parent_invalid', sprintf( __( 'The "%s" theme is not a valid parent theme.' ), esc_html( $_child->template ) ) );
311
-				$_child->cache_add( 'theme', array( 'headers' => $_child->headers, 'errors' => $_child->errors, 'stylesheet' => $_child->stylesheet, 'template' => $_child->template ) );
310
+				$_child->errors = new WP_Error('theme_parent_invalid', sprintf(__('The "%s" theme is not a valid parent theme.'), esc_html($_child->template)));
311
+				$_child->cache_add('theme', array('headers' => $_child->headers, 'errors' => $_child->errors, 'stylesheet' => $_child->stylesheet, 'template' => $_child->template));
312 312
 				// The two themes actually reference each other with the Template header.
313
-				if ( $_child->stylesheet == $this->template ) {
314
-					$this->errors = new WP_Error( 'theme_parent_invalid', sprintf( __( 'The "%s" theme is not a valid parent theme.' ), esc_html( $this->template ) ) );
315
-					$this->cache_add( 'theme', array( 'headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet, 'template' => $this->template ) );
313
+				if ($_child->stylesheet == $this->template) {
314
+					$this->errors = new WP_Error('theme_parent_invalid', sprintf(__('The "%s" theme is not a valid parent theme.'), esc_html($this->template)));
315
+					$this->cache_add('theme', array('headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet, 'template' => $this->template));
316 316
 				}
317 317
 				return;
318 318
 			}
319 319
 			// Set the parent. Pass the current instance so we can do the crazy checks above and assess errors.
320
-			$this->parent = new WP_Theme( $this->template, isset( $theme_root_template ) ? $theme_root_template : $this->theme_root, $this );
320
+			$this->parent = new WP_Theme($this->template, isset($theme_root_template) ? $theme_root_template : $this->theme_root, $this);
321 321
 		}
322 322
 
323 323
 		// We're good. If we didn't retrieve from cache, set it.
324
-		if ( ! is_array( $cache ) ) {
325
-			$cache = array( 'headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet, 'template' => $this->template );
324
+		if ( ! is_array($cache)) {
325
+			$cache = array('headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet, 'template' => $this->template);
326 326
 			// If the parent theme is in another root, we'll want to cache this. Avoids an entire branch of filesystem calls above.
327
-			if ( isset( $theme_root_template ) )
327
+			if (isset($theme_root_template))
328 328
 				$cache['theme_root_template'] = $theme_root_template;
329
-			$this->cache_add( 'theme', $cache );
329
+			$this->cache_add('theme', $cache);
330 330
 		}
331 331
 	}
332 332
 
@@ -347,13 +347,13 @@  discard block
 block discarded – undo
347 347
 	 * @param string $offset Property to check if set.
348 348
 	 * @return bool Whether the given property is set.
349 349
 	 */
350
-	public function __isset( $offset ) {
350
+	public function __isset($offset) {
351 351
 		static $properties = array(
352 352
 			'name', 'title', 'version', 'parent_theme', 'template_dir', 'stylesheet_dir', 'template', 'stylesheet',
353 353
 			'screenshot', 'description', 'author', 'tags', 'theme_root', 'theme_root_uri',
354 354
 		);
355 355
 
356
-		return in_array( $offset, $properties );
356
+		return in_array($offset, $properties);
357 357
 	}
358 358
 
359 359
 	/**
@@ -362,8 +362,8 @@  discard block
 block discarded – undo
362 362
 	 * @param string $offset Property to get.
363 363
 	 * @return mixed Property value.
364 364
 	 */
365
-	public function __get( $offset ) {
366
-		switch ( $offset ) {
365
+	public function __get($offset) {
366
+		switch ($offset) {
367 367
 			case 'name' :
368 368
 			case 'title' :
369 369
 				return $this->get('Name');
@@ -380,21 +380,21 @@  discard block
 block discarded – undo
380 380
 			case 'stylesheet' :
381 381
 				return $this->get_stylesheet();
382 382
 			case 'screenshot' :
383
-				return $this->get_screenshot( 'relative' );
383
+				return $this->get_screenshot('relative');
384 384
 			// 'author' and 'description' did not previously return translated data.
385 385
 			case 'description' :
386 386
 				return $this->display('Description');
387 387
 			case 'author' :
388 388
 				return $this->display('Author');
389 389
 			case 'tags' :
390
-				return $this->get( 'Tags' );
390
+				return $this->get('Tags');
391 391
 			case 'theme_root' :
392 392
 				return $this->get_theme_root();
393 393
 			case 'theme_root_uri' :
394 394
 				return $this->get_theme_root_uri();
395 395
 			// For cases where the array was converted to an object.
396 396
 			default :
397
-				return $this->offsetGet( $offset );
397
+				return $this->offsetGet($offset);
398 398
 		}
399 399
 	}
400 400
 
@@ -404,14 +404,14 @@  discard block
 block discarded – undo
404 404
 	 * @param mixed $offset
405 405
 	 * @param mixed $value
406 406
 	 */
407
-	public function offsetSet( $offset, $value ) {}
407
+	public function offsetSet($offset, $value) {}
408 408
 
409 409
 	/**
410 410
 	 * Method to implement ArrayAccess for keys formerly returned by get_themes()
411 411
 	 *
412 412
 	 * @param mixed $offset
413 413
 	 */
414
-	public function offsetUnset( $offset ) {}
414
+	public function offsetUnset($offset) {}
415 415
 
416 416
 	/**
417 417
 	 * Method to implement ArrayAccess for keys formerly returned by get_themes()
@@ -421,14 +421,14 @@  discard block
 block discarded – undo
421 421
 	 * @param mixed $offset
422 422
 	 * @return bool
423 423
 	 */
424
-	public function offsetExists( $offset ) {
424
+	public function offsetExists($offset) {
425 425
 		static $keys = array(
426 426
 			'Name', 'Version', 'Status', 'Title', 'Author', 'Author Name', 'Author URI', 'Description',
427 427
 			'Template', 'Stylesheet', 'Template Files', 'Stylesheet Files', 'Template Dir', 'Stylesheet Dir',
428 428
 			'Screenshot', 'Tags', 'Theme Root', 'Theme Root URI', 'Parent Theme',
429 429
 		);
430 430
 
431
-		return in_array( $offset, $keys );
431
+		return in_array($offset, $keys);
432 432
 	}
433 433
 
434 434
 	/**
@@ -444,8 +444,8 @@  discard block
 block discarded – undo
444 444
 	 * @param mixed $offset
445 445
 	 * @return mixed
446 446
 	 */
447
-	public function offsetGet( $offset ) {
448
-		switch ( $offset ) {
447
+	public function offsetGet($offset) {
448
+		switch ($offset) {
449 449
 			case 'Name' :
450 450
 			case 'Title' :
451 451
 				/*
@@ -454,30 +454,30 @@  discard block
 block discarded – undo
454 454
 				 */
455 455
 				return $this->get('Name');
456 456
 			case 'Author' :
457
-				return $this->display( 'Author');
457
+				return $this->display('Author');
458 458
 			case 'Author Name' :
459
-				return $this->display( 'Author', false);
459
+				return $this->display('Author', false);
460 460
 			case 'Author URI' :
461 461
 				return $this->display('AuthorURI');
462 462
 			case 'Description' :
463
-				return $this->display( 'Description');
463
+				return $this->display('Description');
464 464
 			case 'Version' :
465 465
 			case 'Status' :
466
-				return $this->get( $offset );
466
+				return $this->get($offset);
467 467
 			case 'Template' :
468 468
 				return $this->get_template();
469 469
 			case 'Stylesheet' :
470 470
 				return $this->get_stylesheet();
471 471
 			case 'Template Files' :
472
-				return $this->get_files( 'php', 1, true );
472
+				return $this->get_files('php', 1, true);
473 473
 			case 'Stylesheet Files' :
474
-				return $this->get_files( 'css', 0, false );
474
+				return $this->get_files('css', 0, false);
475 475
 			case 'Template Dir' :
476 476
 				return $this->get_template_directory();
477 477
 			case 'Stylesheet Dir' :
478 478
 				return $this->get_stylesheet_directory();
479 479
 			case 'Screenshot' :
480
-				return $this->get_screenshot( 'relative' );
480
+				return $this->get_screenshot('relative');
481 481
 			case 'Tags' :
482 482
 				return $this->get('Tags');
483 483
 			case 'Theme Root' :
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
 	 * @return WP_Error|false WP_Error if there are errors, or false.
501 501
 	 */
502 502
 	public function errors() {
503
-		return is_wp_error( $this->errors ) ? $this->errors : false;
503
+		return is_wp_error($this->errors) ? $this->errors : false;
504 504
 	}
505 505
 
506 506
 	/**
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
 	 * @return bool Whether the theme exists.
516 516
 	 */
517 517
 	public function exists() {
518
-		return ! ( $this->errors() && in_array( 'theme_not_found', $this->errors()->get_error_codes() ) );
518
+		return ! ($this->errors() && in_array('theme_not_found', $this->errors()->get_error_codes()));
519 519
 	}
520 520
 
521 521
 	/**
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 	 * @return WP_Theme|false Parent theme, or false if the current theme is not a child theme.
528 528
 	 */
529 529
 	public function parent() {
530
-		return isset( $this->parent ) ? $this->parent : false;
530
+		return isset($this->parent) ? $this->parent : false;
531 531
 	}
532 532
 
533 533
 	/**
@@ -542,8 +542,8 @@  discard block
 block discarded – undo
542 542
 	 * @param string $data Data to store
543 543
 	 * @return bool Return value from wp_cache_add()
544 544
 	 */
545
-	private function cache_add( $key, $data ) {
546
-		return wp_cache_add( $key . '-' . $this->cache_hash, $data, 'themes', self::$cache_expiration );
545
+	private function cache_add($key, $data) {
546
+		return wp_cache_add($key.'-'.$this->cache_hash, $data, 'themes', self::$cache_expiration);
547 547
 	}
548 548
 
549 549
 	/**
@@ -557,8 +557,8 @@  discard block
 block discarded – undo
557 557
 	 * @param string $key Type of data to retrieve (theme, screenshot, headers, post_templates)
558 558
 	 * @return mixed Retrieved data
559 559
 	 */
560
-	private function cache_get( $key ) {
561
-		return wp_cache_get( $key . '-' . $this->cache_hash, 'themes' );
560
+	private function cache_get($key) {
561
+		return wp_cache_get($key.'-'.$this->cache_hash, 'themes');
562 562
 	}
563 563
 
564 564
 	/**
@@ -568,11 +568,11 @@  discard block
 block discarded – undo
568 568
 	 * @access public
569 569
 	 */
570 570
 	public function cache_delete() {
571
-		foreach ( array( 'theme', 'screenshot', 'headers', 'post_templates' ) as $key )
572
-			wp_cache_delete( $key . '-' . $this->cache_hash, 'themes' );
571
+		foreach (array('theme', 'screenshot', 'headers', 'post_templates') as $key)
572
+			wp_cache_delete($key.'-'.$this->cache_hash, 'themes');
573 573
 		$this->template = $this->textdomain_loaded = $this->theme_root_uri = $this->parent = $this->errors = $this->headers_sanitized = $this->name_translated = null;
574 574
 		$this->headers = array();
575
-		$this->__construct( $this->stylesheet, $this->theme_root );
575
+		$this->__construct($this->stylesheet, $this->theme_root);
576 576
 	}
577 577
 
578 578
 	/**
@@ -592,29 +592,29 @@  discard block
 block discarded – undo
592 592
 	 * @param string $header Theme header. Name, Description, Author, Version, ThemeURI, AuthorURI, Status, Tags.
593 593
 	 * @return string|false String on success, false on failure.
594 594
 	 */
595
-	public function get( $header ) {
596
-		if ( ! isset( $this->headers[ $header ] ) )
595
+	public function get($header) {
596
+		if ( ! isset($this->headers[$header]))
597 597
 			return false;
598 598
 
599
-		if ( ! isset( $this->headers_sanitized ) ) {
600
-			$this->headers_sanitized = $this->cache_get( 'headers' );
601
-			if ( ! is_array( $this->headers_sanitized ) )
599
+		if ( ! isset($this->headers_sanitized)) {
600
+			$this->headers_sanitized = $this->cache_get('headers');
601
+			if ( ! is_array($this->headers_sanitized))
602 602
 				$this->headers_sanitized = array();
603 603
 		}
604 604
 
605
-		if ( isset( $this->headers_sanitized[ $header ] ) )
606
-			return $this->headers_sanitized[ $header ];
605
+		if (isset($this->headers_sanitized[$header]))
606
+			return $this->headers_sanitized[$header];
607 607
 
608 608
 		// If themes are a persistent group, sanitize everything and cache it. One cache add is better than many cache sets.
609
-		if ( self::$persistently_cache ) {
610
-			foreach ( array_keys( $this->headers ) as $_header )
611
-				$this->headers_sanitized[ $_header ] = $this->sanitize_header( $_header, $this->headers[ $_header ] );
612
-			$this->cache_add( 'headers', $this->headers_sanitized );
609
+		if (self::$persistently_cache) {
610
+			foreach (array_keys($this->headers) as $_header)
611
+				$this->headers_sanitized[$_header] = $this->sanitize_header($_header, $this->headers[$_header]);
612
+			$this->cache_add('headers', $this->headers_sanitized);
613 613
 		} else {
614
-			$this->headers_sanitized[ $header ] = $this->sanitize_header( $header, $this->headers[ $header ] );
614
+			$this->headers_sanitized[$header] = $this->sanitize_header($header, $this->headers[$header]);
615 615
 		}
616 616
 
617
-		return $this->headers_sanitized[ $header ];
617
+		return $this->headers_sanitized[$header];
618 618
 	}
619 619
 
620 620
 	/**
@@ -628,20 +628,20 @@  discard block
 block discarded – undo
628 628
 	 * @param bool $translate Optional. Whether to translate the header. Defaults to true.
629 629
 	 * @return string|false Processed header, false on failure.
630 630
 	 */
631
-	public function display( $header, $markup = true, $translate = true ) {
632
-		$value = $this->get( $header );
633
-		if ( false === $value ) {
631
+	public function display($header, $markup = true, $translate = true) {
632
+		$value = $this->get($header);
633
+		if (false === $value) {
634 634
 			return false;
635 635
 		}
636 636
 
637
-		if ( $translate && ( empty( $value ) || ! $this->load_textdomain() ) )
637
+		if ($translate && (empty($value) || ! $this->load_textdomain()))
638 638
 			$translate = false;
639 639
 
640
-		if ( $translate )
641
-			$value = $this->translate_header( $header, $value );
640
+		if ($translate)
641
+			$value = $this->translate_header($header, $value);
642 642
 
643
-		if ( $markup )
644
-			$value = $this->markup_header( $header, $value, $translate );
643
+		if ($markup)
644
+			$value = $this->markup_header($header, $value, $translate);
645 645
 
646 646
 		return $value;
647 647
 	}
@@ -659,46 +659,46 @@  discard block
 block discarded – undo
659 659
 	 * @param string $value Value to sanitize.
660 660
 	 * @return mixed
661 661
 	 */
662
-	private function sanitize_header( $header, $value ) {
663
-		switch ( $header ) {
662
+	private function sanitize_header($header, $value) {
663
+		switch ($header) {
664 664
 			case 'Status' :
665
-				if ( ! $value ) {
665
+				if ( ! $value) {
666 666
 					$value = 'publish';
667 667
 					break;
668 668
 				}
669 669
 				// Fall through otherwise.
670 670
 			case 'Name' :
671 671
 				static $header_tags = array(
672
-					'abbr'    => array( 'title' => true ),
673
-					'acronym' => array( 'title' => true ),
672
+					'abbr'    => array('title' => true),
673
+					'acronym' => array('title' => true),
674 674
 					'code'    => true,
675 675
 					'em'      => true,
676 676
 					'strong'  => true,
677 677
 				);
678
-				$value = wp_kses( $value, $header_tags );
678
+				$value = wp_kses($value, $header_tags);
679 679
 				break;
680 680
 			case 'Author' :
681 681
 				// There shouldn't be anchor tags in Author, but some themes like to be challenging.
682 682
 			case 'Description' :
683 683
 				static $header_tags_with_a = array(
684
-					'a'       => array( 'href' => true, 'title' => true ),
685
-					'abbr'    => array( 'title' => true ),
686
-					'acronym' => array( 'title' => true ),
684
+					'a'       => array('href' => true, 'title' => true),
685
+					'abbr'    => array('title' => true),
686
+					'acronym' => array('title' => true),
687 687
 					'code'    => true,
688 688
 					'em'      => true,
689 689
 					'strong'  => true,
690 690
 				);
691
-				$value = wp_kses( $value, $header_tags_with_a );
691
+				$value = wp_kses($value, $header_tags_with_a);
692 692
 				break;
693 693
 			case 'ThemeURI' :
694 694
 			case 'AuthorURI' :
695
-				$value = esc_url_raw( $value );
695
+				$value = esc_url_raw($value);
696 696
 				break;
697 697
 			case 'Tags' :
698
-				$value = array_filter( array_map( 'trim', explode( ',', strip_tags( $value ) ) ) );
698
+				$value = array_filter(array_map('trim', explode(',', strip_tags($value))));
699 699
 				break;
700 700
 			case 'Version' :
701
-				$value = strip_tags( $value );
701
+				$value = strip_tags($value);
702 702
 				break;
703 703
 		}
704 704
 
@@ -718,33 +718,33 @@  discard block
 block discarded – undo
718 718
 	 * @param string $translate Whether the header has been translated.
719 719
 	 * @return string Value, marked up.
720 720
 	 */
721
-	private function markup_header( $header, $value, $translate ) {
722
-		switch ( $header ) {
721
+	private function markup_header($header, $value, $translate) {
722
+		switch ($header) {
723 723
 			case 'Name' :
724
-				if ( empty( $value ) )
724
+				if (empty($value))
725 725
 					$value = $this->get_stylesheet();
726 726
 				break;
727 727
 			case 'Description' :
728
-				$value = wptexturize( $value );
728
+				$value = wptexturize($value);
729 729
 				break;
730 730
 			case 'Author' :
731
-				if ( $this->get('AuthorURI') ) {
732
-					$value = sprintf( '<a href="%1$s">%2$s</a>', $this->display( 'AuthorURI', true, $translate ), $value );
733
-				} elseif ( ! $value ) {
734
-					$value = __( 'Anonymous' );
731
+				if ($this->get('AuthorURI')) {
732
+					$value = sprintf('<a href="%1$s">%2$s</a>', $this->display('AuthorURI', true, $translate), $value);
733
+				} elseif ( ! $value) {
734
+					$value = __('Anonymous');
735 735
 				}
736 736
 				break;
737 737
 			case 'Tags' :
738 738
 				static $comma = null;
739
-				if ( ! isset( $comma ) ) {
739
+				if ( ! isset($comma)) {
740 740
 					/* translators: used between list items, there is a space after the comma */
741
-					$comma = __( ', ' );
741
+					$comma = __(', ');
742 742
 				}
743
-				$value = implode( $comma, $value );
743
+				$value = implode($comma, $value);
744 744
 				break;
745 745
 			case 'ThemeURI' :
746 746
 			case 'AuthorURI' :
747
-				$value = esc_url( $value );
747
+				$value = esc_url($value);
748 748
 				break;
749 749
 		}
750 750
 
@@ -763,51 +763,51 @@  discard block
 block discarded – undo
763 763
 	 * @param string $value Value to translate.
764 764
 	 * @return string Translated value.
765 765
 	 */
766
-	private function translate_header( $header, $value ) {
767
-		switch ( $header ) {
766
+	private function translate_header($header, $value) {
767
+		switch ($header) {
768 768
 			case 'Name' :
769 769
 				// Cached for sorting reasons.
770
-				if ( isset( $this->name_translated ) )
770
+				if (isset($this->name_translated))
771 771
 					return $this->name_translated;
772
-				$this->name_translated = translate( $value, $this->get('TextDomain' ) );
772
+				$this->name_translated = translate($value, $this->get('TextDomain'));
773 773
 				return $this->name_translated;
774 774
 			case 'Tags' :
775
-				if ( empty( $value ) || ! function_exists( 'get_theme_feature_list' ) ) {
775
+				if (empty($value) || ! function_exists('get_theme_feature_list')) {
776 776
 					return $value;
777 777
 				}
778 778
 
779 779
 				static $tags_list;
780
-				if ( ! isset( $tags_list ) ) {
780
+				if ( ! isset($tags_list)) {
781 781
 					$tags_list = array(
782 782
 						// As of 4.6, deprecated tags which are only used to provide translation for older themes.
783
-						'black' => __( 'Black' ), 'blue' => __( 'Blue' ), 'brown'  => __( 'Brown' ),
784
-						'gray' => __( 'Gray' ), 'green'  => __( 'Green' ), 'orange' => __( 'Orange' ),
785
-						'pink' => __( 'Pink' ), 'purple' => __( 'Purple' ), 'red' => __( 'Red' ),
786
-						'silver' => __( 'Silver' ), 'tan' => __( 'Tan' ), 'white' => __( 'White' ),
787
-						'yellow' => __( 'Yellow' ), 'dark' => __( 'Dark' ), 'light' => __( 'Light' ),
788
-						'fixed-layout' => __( 'Fixed Layout' ), 'fluid-layout' => __( 'Fluid Layout' ),
789
-						'responsive-layout' => __( 'Responsive Layout' ), 'blavatar' => __( 'Blavatar' ),
790
-						'photoblogging' => __( 'Photoblogging' ), 'seasonal' => __( 'Seasonal' ),
783
+						'black' => __('Black'), 'blue' => __('Blue'), 'brown'  => __('Brown'),
784
+						'gray' => __('Gray'), 'green'  => __('Green'), 'orange' => __('Orange'),
785
+						'pink' => __('Pink'), 'purple' => __('Purple'), 'red' => __('Red'),
786
+						'silver' => __('Silver'), 'tan' => __('Tan'), 'white' => __('White'),
787
+						'yellow' => __('Yellow'), 'dark' => __('Dark'), 'light' => __('Light'),
788
+						'fixed-layout' => __('Fixed Layout'), 'fluid-layout' => __('Fluid Layout'),
789
+						'responsive-layout' => __('Responsive Layout'), 'blavatar' => __('Blavatar'),
790
+						'photoblogging' => __('Photoblogging'), 'seasonal' => __('Seasonal'),
791 791
 					);
792 792
 
793
-					$feature_list = get_theme_feature_list( false ); // No API
794
-					foreach ( $feature_list as $tags ) {
793
+					$feature_list = get_theme_feature_list(false); // No API
794
+					foreach ($feature_list as $tags) {
795 795
 						$tags_list += $tags;
796 796
 					}
797 797
 				}
798 798
 
799
-				foreach ( $value as &$tag ) {
800
-					if ( isset( $tags_list[ $tag ] ) ) {
801
-						$tag = $tags_list[ $tag ];
802
-					} elseif ( isset( self::$tag_map[ $tag ] ) ) {
803
-						$tag = $tags_list[ self::$tag_map[ $tag ] ];
799
+				foreach ($value as &$tag) {
800
+					if (isset($tags_list[$tag])) {
801
+						$tag = $tags_list[$tag];
802
+					} elseif (isset(self::$tag_map[$tag])) {
803
+						$tag = $tags_list[self::$tag_map[$tag]];
804 804
 					}
805 805
 				}
806 806
 
807 807
 				return $value;
808 808
 
809 809
 			default :
810
-				$value = translate( $value, $this->get('TextDomain') );
810
+				$value = translate($value, $this->get('TextDomain'));
811 811
 		}
812 812
 		return $value;
813 813
 	}
@@ -854,10 +854,10 @@  discard block
 block discarded – undo
854 854
 	 * @return string Absolute path of the stylesheet directory.
855 855
 	 */
856 856
 	public function get_stylesheet_directory() {
857
-		if ( $this->errors() && in_array( 'theme_root_missing', $this->errors()->get_error_codes() ) )
857
+		if ($this->errors() && in_array('theme_root_missing', $this->errors()->get_error_codes()))
858 858
 			return '';
859 859
 
860
-		return $this->theme_root . '/' . $this->stylesheet;
860
+		return $this->theme_root.'/'.$this->stylesheet;
861 861
 	}
862 862
 
863 863
 	/**
@@ -872,12 +872,12 @@  discard block
 block discarded – undo
872 872
 	 * @return string Absolute path of the template directory.
873 873
 	 */
874 874
 	public function get_template_directory() {
875
-		if ( $this->parent() )
875
+		if ($this->parent())
876 876
 			$theme_root = $this->parent()->theme_root;
877 877
 		else
878 878
 			$theme_root = $this->theme_root;
879 879
 
880
-		return $theme_root . '/' . $this->template;
880
+		return $theme_root.'/'.$this->template;
881 881
 	}
882 882
 
883 883
 	/**
@@ -892,7 +892,7 @@  discard block
 block discarded – undo
892 892
 	 * @return string URL to the stylesheet directory.
893 893
 	 */
894 894
 	public function get_stylesheet_directory_uri() {
895
-		return $this->get_theme_root_uri() . '/' . str_replace( '%2F', '/', rawurlencode( $this->stylesheet ) );
895
+		return $this->get_theme_root_uri().'/'.str_replace('%2F', '/', rawurlencode($this->stylesheet));
896 896
 	}
897 897
 
898 898
 	/**
@@ -907,12 +907,12 @@  discard block
 block discarded – undo
907 907
 	 * @return string URL to the template directory.
908 908
 	 */
909 909
 	public function get_template_directory_uri() {
910
-		if ( $this->parent() )
910
+		if ($this->parent())
911 911
 			$theme_root_uri = $this->parent()->get_theme_root_uri();
912 912
 		else
913 913
 			$theme_root_uri = $this->get_theme_root_uri();
914 914
 
915
-		return $theme_root_uri . '/' . str_replace( '%2F', '/', rawurlencode( $this->template ) );
915
+		return $theme_root_uri.'/'.str_replace('%2F', '/', rawurlencode($this->template));
916 916
 	}
917 917
 
918 918
 	/**
@@ -942,8 +942,8 @@  discard block
 block discarded – undo
942 942
 	 * @return string Theme root URI.
943 943
 	 */
944 944
 	public function get_theme_root_uri() {
945
-		if ( ! isset( $this->theme_root_uri ) )
946
-			$this->theme_root_uri = get_theme_root_uri( $this->stylesheet, $this->theme_root );
945
+		if ( ! isset($this->theme_root_uri))
946
+			$this->theme_root_uri = get_theme_root_uri($this->stylesheet, $this->theme_root);
947 947
 		return $this->theme_root_uri;
948 948
 	}
949 949
 
@@ -961,26 +961,26 @@  discard block
 block discarded – undo
961 961
 	 * @param string $uri Type of URL to return, either 'relative' or an absolute URI. Defaults to absolute URI.
962 962
 	 * @return string|false Screenshot file. False if the theme does not have a screenshot.
963 963
 	 */
964
-	public function get_screenshot( $uri = 'uri' ) {
965
-		$screenshot = $this->cache_get( 'screenshot' );
966
-		if ( $screenshot ) {
967
-			if ( 'relative' == $uri )
964
+	public function get_screenshot($uri = 'uri') {
965
+		$screenshot = $this->cache_get('screenshot');
966
+		if ($screenshot) {
967
+			if ('relative' == $uri)
968 968
 				return $screenshot;
969
-			return $this->get_stylesheet_directory_uri() . '/' . $screenshot;
970
-		} elseif ( 0 === $screenshot ) {
969
+			return $this->get_stylesheet_directory_uri().'/'.$screenshot;
970
+		} elseif (0 === $screenshot) {
971 971
 			return false;
972 972
 		}
973 973
 
974
-		foreach ( array( 'png', 'gif', 'jpg', 'jpeg' ) as $ext ) {
975
-			if ( file_exists( $this->get_stylesheet_directory() . "/screenshot.$ext" ) ) {
976
-				$this->cache_add( 'screenshot', 'screenshot.' . $ext );
977
-				if ( 'relative' == $uri )
978
-					return 'screenshot.' . $ext;
979
-				return $this->get_stylesheet_directory_uri() . '/' . 'screenshot.' . $ext;
974
+		foreach (array('png', 'gif', 'jpg', 'jpeg') as $ext) {
975
+			if (file_exists($this->get_stylesheet_directory()."/screenshot.$ext")) {
976
+				$this->cache_add('screenshot', 'screenshot.'.$ext);
977
+				if ('relative' == $uri)
978
+					return 'screenshot.'.$ext;
979
+				return $this->get_stylesheet_directory_uri().'/'.'screenshot.'.$ext;
980 980
 			}
981 981
 		}
982 982
 
983
-		$this->cache_add( 'screenshot', 0 );
983
+		$this->cache_add('screenshot', 0);
984 984
 		return false;
985 985
 	}
986 986
 
@@ -996,11 +996,11 @@  discard block
 block discarded – undo
996 996
 	 * @return array Array of files, keyed by the path to the file relative to the theme's directory, with the values
997 997
 	 * 	             being absolute paths.
998 998
 	 */
999
-	public function get_files( $type = null, $depth = 0, $search_parent = false ) {
1000
-		$files = (array) self::scandir( $this->get_stylesheet_directory(), $type, $depth );
999
+	public function get_files($type = null, $depth = 0, $search_parent = false) {
1000
+		$files = (array) self::scandir($this->get_stylesheet_directory(), $type, $depth);
1001 1001
 
1002
-		if ( $search_parent && $this->parent() )
1003
-			$files += (array) self::scandir( $this->get_template_directory(), $type, $depth );
1002
+		if ($search_parent && $this->parent())
1003
+			$files += (array) self::scandir($this->get_template_directory(), $type, $depth);
1004 1004
 
1005 1005
 		return $files;
1006 1006
 	}
@@ -1016,44 +1016,44 @@  discard block
 block discarded – undo
1016 1016
 	 */
1017 1017
 	public function get_post_templates() {
1018 1018
 		// If you screw up your current theme and we invalidate your parent, most things still work. Let it slide.
1019
-		if ( $this->errors() && $this->errors()->get_error_codes() !== array( 'theme_parent_invalid' ) ) {
1019
+		if ($this->errors() && $this->errors()->get_error_codes() !== array('theme_parent_invalid')) {
1020 1020
 			return array();
1021 1021
 		}
1022 1022
 
1023
-		$post_templates = $this->cache_get( 'post_templates' );
1023
+		$post_templates = $this->cache_get('post_templates');
1024 1024
 
1025
-		if ( ! is_array( $post_templates ) ) {
1025
+		if ( ! is_array($post_templates)) {
1026 1026
 			$post_templates = array();
1027 1027
 
1028
-			$files = (array) $this->get_files( 'php', 1 );
1028
+			$files = (array) $this->get_files('php', 1);
1029 1029
 
1030
-			foreach ( $files as $file => $full_path ) {
1031
-				if ( ! preg_match( '|Template Name:(.*)$|mi', file_get_contents( $full_path ), $header ) ) {
1030
+			foreach ($files as $file => $full_path) {
1031
+				if ( ! preg_match('|Template Name:(.*)$|mi', file_get_contents($full_path), $header)) {
1032 1032
 					continue;
1033 1033
 				}
1034 1034
 
1035
-				$types = array( 'page' );
1036
-				if ( preg_match( '|Template Post Type:(.*)$|mi', file_get_contents( $full_path ), $type ) ) {
1037
-					$types = explode( ',', _cleanup_header_comment( $type[1] ) );
1035
+				$types = array('page');
1036
+				if (preg_match('|Template Post Type:(.*)$|mi', file_get_contents($full_path), $type)) {
1037
+					$types = explode(',', _cleanup_header_comment($type[1]));
1038 1038
 				}
1039 1039
 
1040
-				foreach ( $types as $type ) {
1041
-					$type = sanitize_key( $type );
1042
-					if ( ! isset( $post_templates[ $type ] ) ) {
1043
-						$post_templates[ $type ] = array();
1040
+				foreach ($types as $type) {
1041
+					$type = sanitize_key($type);
1042
+					if ( ! isset($post_templates[$type])) {
1043
+						$post_templates[$type] = array();
1044 1044
 					}
1045 1045
 
1046
-					$post_templates[ $type ][ $file ] = _cleanup_header_comment( $header[1] );
1046
+					$post_templates[$type][$file] = _cleanup_header_comment($header[1]);
1047 1047
 				}
1048 1048
 			}
1049 1049
 
1050
-			$this->cache_add( 'post_templates', $post_templates );
1050
+			$this->cache_add('post_templates', $post_templates);
1051 1051
 		}
1052 1052
 
1053
-		if ( $this->load_textdomain() ) {
1054
-			foreach ( $post_templates as &$post_type ) {
1055
-				foreach ( $post_type as &$post_template ) {
1056
-					$post_template = $this->translate_header( 'Template Name', $post_template );
1053
+		if ($this->load_textdomain()) {
1054
+			foreach ($post_templates as &$post_type) {
1055
+				foreach ($post_type as &$post_template) {
1056
+					$post_template = $this->translate_header('Template Name', $post_template);
1057 1057
 				}
1058 1058
 			}
1059 1059
 		}
@@ -1073,16 +1073,16 @@  discard block
 block discarded – undo
1073 1073
 	 *                                If a post is provided, its post type is used.
1074 1074
 	 * @return array Array of page templates, keyed by filename, with the value of the translated header name.
1075 1075
 	 */
1076
-	public function get_page_templates( $post = null, $post_type = 'page' ) {
1077
-		if ( $post ) {
1078
-			$post_type = get_post_type( $post );
1076
+	public function get_page_templates($post = null, $post_type = 'page') {
1077
+		if ($post) {
1078
+			$post_type = get_post_type($post);
1079 1079
 		}
1080 1080
 
1081 1081
 		$post_templates = $this->get_post_templates();
1082
-		$post_templates = isset( $post_templates[ $post_type ] ) ? $post_templates[ $post_type ] : array();
1082
+		$post_templates = isset($post_templates[$post_type]) ? $post_templates[$post_type] : array();
1083 1083
 
1084
-		if ( $this->parent() ) {
1085
-			$post_templates += $this->parent()->get_page_templates( $post, $post_type );
1084
+		if ($this->parent()) {
1085
+			$post_templates += $this->parent()->get_page_templates($post, $post_type);
1086 1086
 		}
1087 1087
 
1088 1088
 		/**
@@ -1100,7 +1100,7 @@  discard block
 block discarded – undo
1100 1100
 		 * @param WP_Post|null $post           The post being edited, provided for context, or null.
1101 1101
 		 * @param string       $post_type      Post type to get the templates for.
1102 1102
 		 */
1103
-		return (array) apply_filters( "theme_{$post_type}_templates", $post_templates, $this, $post, $post_type );
1103
+		return (array) apply_filters("theme_{$post_type}_templates", $post_templates, $this, $post, $post_type);
1104 1104
 	}
1105 1105
 
1106 1106
 	/**
@@ -1122,32 +1122,32 @@  discard block
 block discarded – undo
1122 1122
 	 * @return array|false Array of files, keyed by the path to the file relative to the `$path` directory prepended
1123 1123
 	 *                     with `$relative_path`, with the values being absolute paths. False otherwise.
1124 1124
 	 */
1125
-	private static function scandir( $path, $extensions = null, $depth = 0, $relative_path = '' ) {
1126
-		if ( ! is_dir( $path ) )
1125
+	private static function scandir($path, $extensions = null, $depth = 0, $relative_path = '') {
1126
+		if ( ! is_dir($path))
1127 1127
 			return false;
1128 1128
 
1129
-		if ( $extensions ) {
1129
+		if ($extensions) {
1130 1130
 			$extensions = (array) $extensions;
1131
-			$_extensions = implode( '|', $extensions );
1131
+			$_extensions = implode('|', $extensions);
1132 1132
 		}
1133 1133
 
1134
-		$relative_path = trailingslashit( $relative_path );
1135
-		if ( '/' == $relative_path )
1134
+		$relative_path = trailingslashit($relative_path);
1135
+		if ('/' == $relative_path)
1136 1136
 			$relative_path = '';
1137 1137
 
1138
-		$results = scandir( $path );
1138
+		$results = scandir($path);
1139 1139
 		$files = array();
1140 1140
 
1141
-		foreach ( $results as $result ) {
1142
-			if ( '.' == $result[0] )
1141
+		foreach ($results as $result) {
1142
+			if ('.' == $result[0])
1143 1143
 				continue;
1144
-			if ( is_dir( $path . '/' . $result ) ) {
1145
-				if ( ! $depth || 'CVS' == $result )
1144
+			if (is_dir($path.'/'.$result)) {
1145
+				if ( ! $depth || 'CVS' == $result)
1146 1146
 					continue;
1147
-				$found = self::scandir( $path . '/' . $result, $extensions, $depth - 1 , $relative_path . $result );
1148
-				$files = array_merge_recursive( $files, $found );
1149
-			} elseif ( ! $extensions || preg_match( '~\.(' . $_extensions . ')$~', $result ) ) {
1150
-				$files[ $relative_path . $result ] = $path . '/' . $result;
1147
+				$found = self::scandir($path.'/'.$result, $extensions, $depth - 1, $relative_path.$result);
1148
+				$files = array_merge_recursive($files, $found);
1149
+			} elseif ( ! $extensions || preg_match('~\.('.$_extensions.')$~', $result)) {
1150
+				$files[$relative_path.$result] = $path.'/'.$result;
1151 1151
 			}
1152 1152
 		}
1153 1153
 
@@ -1167,27 +1167,27 @@  discard block
 block discarded – undo
1167 1167
 	 * 	False if no textdomain was specified in the file headers, or if the domain could not be loaded.
1168 1168
 	 */
1169 1169
 	public function load_textdomain() {
1170
-		if ( isset( $this->textdomain_loaded ) )
1170
+		if (isset($this->textdomain_loaded))
1171 1171
 			return $this->textdomain_loaded;
1172 1172
 
1173 1173
 		$textdomain = $this->get('TextDomain');
1174
-		if ( ! $textdomain ) {
1174
+		if ( ! $textdomain) {
1175 1175
 			$this->textdomain_loaded = false;
1176 1176
 			return false;
1177 1177
 		}
1178 1178
 
1179
-		if ( is_textdomain_loaded( $textdomain ) ) {
1179
+		if (is_textdomain_loaded($textdomain)) {
1180 1180
 			$this->textdomain_loaded = true;
1181 1181
 			return true;
1182 1182
 		}
1183 1183
 
1184 1184
 		$path = $this->get_stylesheet_directory();
1185
-		if ( $domainpath = $this->get('DomainPath') )
1185
+		if ($domainpath = $this->get('DomainPath'))
1186 1186
 			$path .= $domainpath;
1187 1187
 		else
1188 1188
 			$path .= '/languages';
1189 1189
 
1190
-		$this->textdomain_loaded = load_theme_textdomain( $textdomain, $path );
1190
+		$this->textdomain_loaded = load_theme_textdomain($textdomain, $path);
1191 1191
 		return $this->textdomain_loaded;
1192 1192
 	}
1193 1193
 
@@ -1202,19 +1202,19 @@  discard block
 block discarded – undo
1202 1202
 	 * @param int $blog_id Optional. Ignored if only network-wide settings are checked. Defaults to current site.
1203 1203
 	 * @return bool Whether the theme is allowed for the network. Returns true in single-site.
1204 1204
 	 */
1205
-	public function is_allowed( $check = 'both', $blog_id = null ) {
1206
-		if ( ! is_multisite() )
1205
+	public function is_allowed($check = 'both', $blog_id = null) {
1206
+		if ( ! is_multisite())
1207 1207
 			return true;
1208 1208
 
1209
-		if ( 'both' == $check || 'network' == $check ) {
1209
+		if ('both' == $check || 'network' == $check) {
1210 1210
 			$allowed = self::get_allowed_on_network();
1211
-			if ( ! empty( $allowed[ $this->get_stylesheet() ] ) )
1211
+			if ( ! empty($allowed[$this->get_stylesheet()]))
1212 1212
 				return true;
1213 1213
 		}
1214 1214
 
1215
-		if ( 'both' == $check || 'site' == $check ) {
1216
-			$allowed = self::get_allowed_on_site( $blog_id );
1217
-			if ( ! empty( $allowed[ $this->get_stylesheet() ] ) )
1215
+		if ('both' == $check || 'site' == $check) {
1216
+			$allowed = self::get_allowed_on_site($blog_id);
1217
+			if ( ! empty($allowed[$this->get_stylesheet()]))
1218 1218
 				return true;
1219 1219
 		}
1220 1220
 
@@ -1229,9 +1229,9 @@  discard block
 block discarded – undo
1229 1229
 	 * @return WP_Theme|false Object, or false if no theme is installed, which would be bad.
1230 1230
 	 */
1231 1231
 	public static function get_core_default_theme() {
1232
-		foreach ( array_reverse( self::$default_themes ) as $slug => $name ) {
1233
-			$theme = wp_get_theme( $slug );
1234
-			if ( $theme->exists() ) {
1232
+		foreach (array_reverse(self::$default_themes) as $slug => $name) {
1233
+			$theme = wp_get_theme($slug);
1234
+			if ($theme->exists()) {
1235 1235
 				return $theme;
1236 1236
 			}
1237 1237
 		}
@@ -1249,7 +1249,7 @@  discard block
 block discarded – undo
1249 1249
 	 * @param int $blog_id Optional. ID of the site. Defaults to the current site.
1250 1250
 	 * @return array Array of stylesheet names.
1251 1251
 	 */
1252
-	public static function get_allowed( $blog_id = null ) {
1252
+	public static function get_allowed($blog_id = null) {
1253 1253
 		/**
1254 1254
 		 * Filters the array of themes allowed on the network.
1255 1255
 		 *
@@ -1261,8 +1261,8 @@  discard block
 block discarded – undo
1261 1261
 		 * @param array $allowed_themes An array of theme stylesheet names.
1262 1262
 		 * @param int   $blog_id        ID of the site.
1263 1263
 		 */
1264
-		$network = (array) apply_filters( 'network_allowed_themes', self::get_allowed_on_network(), $blog_id );
1265
-		return $network + self::get_allowed_on_site( $blog_id );
1264
+		$network = (array) apply_filters('network_allowed_themes', self::get_allowed_on_network(), $blog_id);
1265
+		return $network + self::get_allowed_on_site($blog_id);
1266 1266
 	}
1267 1267
 
1268 1268
 	/**
@@ -1279,8 +1279,8 @@  discard block
 block discarded – undo
1279 1279
 	 */
1280 1280
 	public static function get_allowed_on_network() {
1281 1281
 		static $allowed_themes;
1282
-		if ( ! isset( $allowed_themes ) ) {
1283
-			$allowed_themes = (array) get_site_option( 'allowedthemes' );
1282
+		if ( ! isset($allowed_themes)) {
1283
+			$allowed_themes = (array) get_site_option('allowedthemes');
1284 1284
 		}
1285 1285
 
1286 1286
 		/**
@@ -1290,7 +1290,7 @@  discard block
 block discarded – undo
1290 1290
 		 *
1291 1291
 		 * @param array $allowed_themes An array of theme stylesheet names.
1292 1292
 		 */
1293
-		$allowed_themes = apply_filters( 'allowed_themes', $allowed_themes );
1293
+		$allowed_themes = apply_filters('allowed_themes', $allowed_themes);
1294 1294
 
1295 1295
 		return $allowed_themes;
1296 1296
 	}
@@ -1308,13 +1308,13 @@  discard block
 block discarded – undo
1308 1308
 	 * @param int $blog_id Optional. ID of the site. Defaults to the current site.
1309 1309
 	 * @return array Array of stylesheet names.
1310 1310
 	 */
1311
-	public static function get_allowed_on_site( $blog_id = null ) {
1311
+	public static function get_allowed_on_site($blog_id = null) {
1312 1312
 		static $allowed_themes = array();
1313 1313
 
1314
-		if ( ! $blog_id || ! is_multisite() )
1314
+		if ( ! $blog_id || ! is_multisite())
1315 1315
 			$blog_id = get_current_blog_id();
1316 1316
 
1317
-		if ( isset( $allowed_themes[ $blog_id ] ) ) {
1317
+		if (isset($allowed_themes[$blog_id])) {
1318 1318
 			/**
1319 1319
 			 * Filters the array of themes allowed on the site.
1320 1320
 			 *
@@ -1323,57 +1323,57 @@  discard block
 block discarded – undo
1323 1323
 			 * @param array $allowed_themes An array of theme stylesheet names.
1324 1324
 			 * @param int   $blog_id        ID of the site. Defaults to current site.
1325 1325
 			 */
1326
-			return (array) apply_filters( 'site_allowed_themes', $allowed_themes[ $blog_id ], $blog_id );
1326
+			return (array) apply_filters('site_allowed_themes', $allowed_themes[$blog_id], $blog_id);
1327 1327
 		}
1328 1328
 
1329 1329
 		$current = $blog_id == get_current_blog_id();
1330 1330
 
1331
-		if ( $current ) {
1332
-			$allowed_themes[ $blog_id ] = get_option( 'allowedthemes' );
1331
+		if ($current) {
1332
+			$allowed_themes[$blog_id] = get_option('allowedthemes');
1333 1333
 		} else {
1334
-			switch_to_blog( $blog_id );
1335
-			$allowed_themes[ $blog_id ] = get_option( 'allowedthemes' );
1334
+			switch_to_blog($blog_id);
1335
+			$allowed_themes[$blog_id] = get_option('allowedthemes');
1336 1336
 			restore_current_blog();
1337 1337
 		}
1338 1338
 
1339 1339
 		// This is all super old MU back compat joy.
1340 1340
 		// 'allowedthemes' keys things by stylesheet. 'allowed_themes' keyed things by name.
1341
-		if ( false === $allowed_themes[ $blog_id ] ) {
1342
-			if ( $current ) {
1343
-				$allowed_themes[ $blog_id ] = get_option( 'allowed_themes' );
1341
+		if (false === $allowed_themes[$blog_id]) {
1342
+			if ($current) {
1343
+				$allowed_themes[$blog_id] = get_option('allowed_themes');
1344 1344
 			} else {
1345
-				switch_to_blog( $blog_id );
1346
-				$allowed_themes[ $blog_id ] = get_option( 'allowed_themes' );
1345
+				switch_to_blog($blog_id);
1346
+				$allowed_themes[$blog_id] = get_option('allowed_themes');
1347 1347
 				restore_current_blog();
1348 1348
 			}
1349 1349
 
1350
-			if ( ! is_array( $allowed_themes[ $blog_id ] ) || empty( $allowed_themes[ $blog_id ] ) ) {
1351
-				$allowed_themes[ $blog_id ] = array();
1350
+			if ( ! is_array($allowed_themes[$blog_id]) || empty($allowed_themes[$blog_id])) {
1351
+				$allowed_themes[$blog_id] = array();
1352 1352
 			} else {
1353 1353
 				$converted = array();
1354 1354
 				$themes = wp_get_themes();
1355
-				foreach ( $themes as $stylesheet => $theme_data ) {
1356
-					if ( isset( $allowed_themes[ $blog_id ][ $theme_data->get('Name') ] ) )
1357
-						$converted[ $stylesheet ] = true;
1355
+				foreach ($themes as $stylesheet => $theme_data) {
1356
+					if (isset($allowed_themes[$blog_id][$theme_data->get('Name')]))
1357
+						$converted[$stylesheet] = true;
1358 1358
 				}
1359
-				$allowed_themes[ $blog_id ] = $converted;
1359
+				$allowed_themes[$blog_id] = $converted;
1360 1360
 			}
1361 1361
 			// Set the option so we never have to go through this pain again.
1362
-			if ( is_admin() && $allowed_themes[ $blog_id ] ) {
1363
-				if ( $current ) {
1364
-					update_option( 'allowedthemes', $allowed_themes[ $blog_id ] );
1365
-					delete_option( 'allowed_themes' );
1362
+			if (is_admin() && $allowed_themes[$blog_id]) {
1363
+				if ($current) {
1364
+					update_option('allowedthemes', $allowed_themes[$blog_id]);
1365
+					delete_option('allowed_themes');
1366 1366
 				} else {
1367
-					switch_to_blog( $blog_id );
1368
-					update_option( 'allowedthemes', $allowed_themes[ $blog_id ] );
1369
-					delete_option( 'allowed_themes' );
1367
+					switch_to_blog($blog_id);
1368
+					update_option('allowedthemes', $allowed_themes[$blog_id]);
1369
+					delete_option('allowed_themes');
1370 1370
 					restore_current_blog();
1371 1371
 				}
1372 1372
 			}
1373 1373
 		}
1374 1374
 
1375 1375
 		/** This filter is documented in wp-includes/class-wp-theme.php */
1376
-		return (array) apply_filters( 'site_allowed_themes', $allowed_themes[ $blog_id ], $blog_id );
1376
+		return (array) apply_filters('site_allowed_themes', $allowed_themes[$blog_id], $blog_id);
1377 1377
 	}
1378 1378
 
1379 1379
 	/**
@@ -1385,21 +1385,21 @@  discard block
 block discarded – undo
1385 1385
 	 *
1386 1386
 	 * @param string|array $stylesheets Stylesheet name or array of stylesheet names.
1387 1387
 	 */
1388
-	public static function network_enable_theme( $stylesheets ) {
1389
-		if ( ! is_multisite() ) {
1388
+	public static function network_enable_theme($stylesheets) {
1389
+		if ( ! is_multisite()) {
1390 1390
 			return;
1391 1391
 		}
1392 1392
 
1393
-		if ( ! is_array( $stylesheets ) ) {
1394
-			$stylesheets = array( $stylesheets );
1393
+		if ( ! is_array($stylesheets)) {
1394
+			$stylesheets = array($stylesheets);
1395 1395
 		}
1396 1396
 
1397
-		$allowed_themes = get_site_option( 'allowedthemes' );
1398
-		foreach ( $stylesheets as $stylesheet ) {
1399
-			$allowed_themes[ $stylesheet ] = true;
1397
+		$allowed_themes = get_site_option('allowedthemes');
1398
+		foreach ($stylesheets as $stylesheet) {
1399
+			$allowed_themes[$stylesheet] = true;
1400 1400
 		}
1401 1401
 
1402
-		update_site_option( 'allowedthemes', $allowed_themes );
1402
+		update_site_option('allowedthemes', $allowed_themes);
1403 1403
 	}
1404 1404
 
1405 1405
 	/**
@@ -1411,23 +1411,23 @@  discard block
 block discarded – undo
1411 1411
 	 *
1412 1412
 	 * @param string|array $stylesheets Stylesheet name or array of stylesheet names.
1413 1413
 	 */
1414
-	public static function network_disable_theme( $stylesheets ) {
1415
-		if ( ! is_multisite() ) {
1414
+	public static function network_disable_theme($stylesheets) {
1415
+		if ( ! is_multisite()) {
1416 1416
 			return;
1417 1417
 		}
1418 1418
 
1419
-		if ( ! is_array( $stylesheets ) ) {
1420
-			$stylesheets = array( $stylesheets );
1419
+		if ( ! is_array($stylesheets)) {
1420
+			$stylesheets = array($stylesheets);
1421 1421
 		}
1422 1422
 
1423
-		$allowed_themes = get_site_option( 'allowedthemes' );
1424
-		foreach ( $stylesheets as $stylesheet ) {
1425
-			if ( isset( $allowed_themes[ $stylesheet ] ) ) {
1426
-				unset( $allowed_themes[ $stylesheet ] );
1423
+		$allowed_themes = get_site_option('allowedthemes');
1424
+		foreach ($stylesheets as $stylesheet) {
1425
+			if (isset($allowed_themes[$stylesheet])) {
1426
+				unset($allowed_themes[$stylesheet]);
1427 1427
 			}
1428 1428
 		}
1429 1429
 
1430
-		update_site_option( 'allowedthemes', $allowed_themes );
1430
+		update_site_option('allowedthemes', $allowed_themes);
1431 1431
 	}
1432 1432
 
1433 1433
 	/**
@@ -1440,11 +1440,11 @@  discard block
 block discarded – undo
1440 1440
 	 *
1441 1441
 	 * @param array $themes Array of themes to sort, passed by reference.
1442 1442
 	 */
1443
-	public static function sort_by_name( &$themes ) {
1444
-		if ( 0 === strpos( get_user_locale(), 'en_' ) ) {
1445
-			uasort( $themes, array( 'WP_Theme', '_name_sort' ) );
1443
+	public static function sort_by_name(&$themes) {
1444
+		if (0 === strpos(get_user_locale(), 'en_')) {
1445
+			uasort($themes, array('WP_Theme', '_name_sort'));
1446 1446
 		} else {
1447
-			uasort( $themes, array( 'WP_Theme', '_name_sort_i18n' ) );
1447
+			uasort($themes, array('WP_Theme', '_name_sort_i18n'));
1448 1448
 		}
1449 1449
 	}
1450 1450
 
@@ -1464,8 +1464,8 @@  discard block
 block discarded – undo
1464 1464
 	 * @return int Negative if `$a` falls lower in the natural order than `$b`. Zero if they fall equally.
1465 1465
 	 *             Greater than 0 if `$a` falls higher in the natural order than `$b`. Used with usort().
1466 1466
 	 */
1467
-	private static function _name_sort( $a, $b ) {
1468
-		return strnatcasecmp( $a->headers['Name'], $b->headers['Name'] );
1467
+	private static function _name_sort($a, $b) {
1468
+		return strnatcasecmp($a->headers['Name'], $b->headers['Name']);
1469 1469
 	}
1470 1470
 
1471 1471
 	/**
@@ -1481,8 +1481,8 @@  discard block
 block discarded – undo
1481 1481
 	 * @return int Negative if `$a` falls lower in the natural order than `$b`. Zero if they fall equally.
1482 1482
 	 *             Greater than 0 if `$a` falls higher in the natural order than `$b`. Used with usort().
1483 1483
 	 */
1484
-	private static function _name_sort_i18n( $a, $b ) {
1484
+	private static function _name_sort_i18n($a, $b) {
1485 1485
 		// Don't mark up; Do translate.
1486
-		return strnatcasecmp( $a->display( 'Name', false, true ), $b->display( 'Name', false, true ) );
1486
+		return strnatcasecmp($a->display('Name', false, true), $b->display('Name', false, true));
1487 1487
 	}
1488 1488
 }
Please login to merge, or discard this patch.
Braces   +116 added lines, -79 removed lines patch added patch discarded remove patch
@@ -208,8 +208,9 @@  discard block
 block discarded – undo
208 208
 			self::$persistently_cache = apply_filters( 'wp_cache_themes_persistently', false, 'WP_Theme' );
209 209
 			if ( self::$persistently_cache ) {
210 210
 				wp_cache_add_global_groups( 'themes' );
211
-				if ( is_int( self::$persistently_cache ) )
212
-					self::$cache_expiration = self::$persistently_cache;
211
+				if ( is_int( self::$persistently_cache ) ) {
212
+									self::$cache_expiration = self::$persistently_cache;
213
+				}
213 214
 			} else {
214 215
 				wp_cache_add_non_persistent_groups( 'themes' );
215 216
 			}
@@ -231,23 +232,29 @@  discard block
 block discarded – undo
231 232
 
232 233
 		if ( is_array( $cache ) ) {
233 234
 			foreach ( array( 'errors', 'headers', 'template' ) as $key ) {
234
-				if ( isset( $cache[ $key ] ) )
235
-					$this->$key = $cache[ $key ];
235
+				if ( isset( $cache[ $key ] ) ) {
236
+									$this->$key = $cache[ $key ];
237
+				}
238
+			}
239
+			if ( $this->errors ) {
240
+							return;
241
+			}
242
+			if ( isset( $cache['theme_root_template'] ) ) {
243
+							$theme_root_template = $cache['theme_root_template'];
236 244
 			}
237
-			if ( $this->errors )
238
-				return;
239
-			if ( isset( $cache['theme_root_template'] ) )
240
-				$theme_root_template = $cache['theme_root_template'];
241 245
 		} elseif ( ! file_exists( $this->theme_root . '/' . $theme_file ) ) {
242 246
 			$this->headers['Name'] = $this->stylesheet;
243
-			if ( ! file_exists( $this->theme_root . '/' . $this->stylesheet ) )
244
-				$this->errors = new WP_Error( 'theme_not_found', sprintf( __( 'The theme directory "%s" does not exist.' ), esc_html( $this->stylesheet ) ) );
245
-			else
246
-				$this->errors = new WP_Error( 'theme_no_stylesheet', __( 'Stylesheet is missing.' ) );
247
+			if ( ! file_exists( $this->theme_root . '/' . $this->stylesheet ) ) {
248
+							$this->errors = new WP_Error( 'theme_not_found', sprintf( __( 'The theme directory "%s" does not exist.' ), esc_html( $this->stylesheet ) ) );
249
+			} else {
250
+							$this->errors = new WP_Error( 'theme_no_stylesheet', __( 'Stylesheet is missing.' ) );
251
+			}
247 252
 			$this->template = $this->stylesheet;
248 253
 			$this->cache_add( 'theme', array( 'headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet, 'template' => $this->template ) );
249
-			if ( ! file_exists( $this->theme_root ) ) // Don't cache this one.
254
+			if ( ! file_exists( $this->theme_root ) ) {
255
+				// Don't cache this one.
250 256
 				$this->errors->add( 'theme_root_missing', __( 'ERROR: The themes directory is either empty or doesn&#8217;t exist. Please check your installation.' ) );
257
+			}
251 258
 			return;
252 259
 		} elseif ( ! is_readable( $this->theme_root . '/' . $theme_file ) ) {
253 260
 			$this->headers['Name'] = $this->stylesheet;
@@ -260,8 +267,9 @@  discard block
 block discarded – undo
260 267
 			// Default themes always trump their pretenders.
261 268
 			// Properly identify default themes that are inside a directory within wp-content/themes.
262 269
 			if ( $default_theme_slug = array_search( $this->headers['Name'], self::$default_themes ) ) {
263
-				if ( basename( $this->stylesheet ) != $default_theme_slug )
264
-					$this->headers['Name'] .= '/' . $this->stylesheet;
270
+				if ( basename( $this->stylesheet ) != $default_theme_slug ) {
271
+									$this->headers['Name'] .= '/' . $this->stylesheet;
272
+				}
265 273
 			}
266 274
 		}
267 275
 
@@ -324,8 +332,9 @@  discard block
 block discarded – undo
324 332
 		if ( ! is_array( $cache ) ) {
325 333
 			$cache = array( 'headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet, 'template' => $this->template );
326 334
 			// If the parent theme is in another root, we'll want to cache this. Avoids an entire branch of filesystem calls above.
327
-			if ( isset( $theme_root_template ) )
328
-				$cache['theme_root_template'] = $theme_root_template;
335
+			if ( isset( $theme_root_template ) ) {
336
+							$cache['theme_root_template'] = $theme_root_template;
337
+			}
329 338
 			$this->cache_add( 'theme', $cache );
330 339
 		}
331 340
 	}
@@ -568,8 +577,9 @@  discard block
 block discarded – undo
568 577
 	 * @access public
569 578
 	 */
570 579
 	public function cache_delete() {
571
-		foreach ( array( 'theme', 'screenshot', 'headers', 'post_templates' ) as $key )
572
-			wp_cache_delete( $key . '-' . $this->cache_hash, 'themes' );
580
+		foreach ( array( 'theme', 'screenshot', 'headers', 'post_templates' ) as $key ) {
581
+					wp_cache_delete( $key . '-' . $this->cache_hash, 'themes' );
582
+		}
573 583
 		$this->template = $this->textdomain_loaded = $this->theme_root_uri = $this->parent = $this->errors = $this->headers_sanitized = $this->name_translated = null;
574 584
 		$this->headers = array();
575 585
 		$this->__construct( $this->stylesheet, $this->theme_root );
@@ -593,22 +603,26 @@  discard block
 block discarded – undo
593 603
 	 * @return string|false String on success, false on failure.
594 604
 	 */
595 605
 	public function get( $header ) {
596
-		if ( ! isset( $this->headers[ $header ] ) )
597
-			return false;
606
+		if ( ! isset( $this->headers[ $header ] ) ) {
607
+					return false;
608
+		}
598 609
 
599 610
 		if ( ! isset( $this->headers_sanitized ) ) {
600 611
 			$this->headers_sanitized = $this->cache_get( 'headers' );
601
-			if ( ! is_array( $this->headers_sanitized ) )
602
-				$this->headers_sanitized = array();
612
+			if ( ! is_array( $this->headers_sanitized ) ) {
613
+							$this->headers_sanitized = array();
614
+			}
603 615
 		}
604 616
 
605
-		if ( isset( $this->headers_sanitized[ $header ] ) )
606
-			return $this->headers_sanitized[ $header ];
617
+		if ( isset( $this->headers_sanitized[ $header ] ) ) {
618
+					return $this->headers_sanitized[ $header ];
619
+		}
607 620
 
608 621
 		// If themes are a persistent group, sanitize everything and cache it. One cache add is better than many cache sets.
609 622
 		if ( self::$persistently_cache ) {
610
-			foreach ( array_keys( $this->headers ) as $_header )
611
-				$this->headers_sanitized[ $_header ] = $this->sanitize_header( $_header, $this->headers[ $_header ] );
623
+			foreach ( array_keys( $this->headers ) as $_header ) {
624
+							$this->headers_sanitized[ $_header ] = $this->sanitize_header( $_header, $this->headers[ $_header ] );
625
+			}
612 626
 			$this->cache_add( 'headers', $this->headers_sanitized );
613 627
 		} else {
614 628
 			$this->headers_sanitized[ $header ] = $this->sanitize_header( $header, $this->headers[ $header ] );
@@ -634,14 +648,17 @@  discard block
 block discarded – undo
634 648
 			return false;
635 649
 		}
636 650
 
637
-		if ( $translate && ( empty( $value ) || ! $this->load_textdomain() ) )
638
-			$translate = false;
651
+		if ( $translate && ( empty( $value ) || ! $this->load_textdomain() ) ) {
652
+					$translate = false;
653
+		}
639 654
 
640
-		if ( $translate )
641
-			$value = $this->translate_header( $header, $value );
655
+		if ( $translate ) {
656
+					$value = $this->translate_header( $header, $value );
657
+		}
642 658
 
643
-		if ( $markup )
644
-			$value = $this->markup_header( $header, $value, $translate );
659
+		if ( $markup ) {
660
+					$value = $this->markup_header( $header, $value, $translate );
661
+		}
645 662
 
646 663
 		return $value;
647 664
 	}
@@ -721,8 +738,9 @@  discard block
 block discarded – undo
721 738
 	private function markup_header( $header, $value, $translate ) {
722 739
 		switch ( $header ) {
723 740
 			case 'Name' :
724
-				if ( empty( $value ) )
725
-					$value = $this->get_stylesheet();
741
+				if ( empty( $value ) ) {
742
+									$value = $this->get_stylesheet();
743
+				}
726 744
 				break;
727 745
 			case 'Description' :
728 746
 				$value = wptexturize( $value );
@@ -767,8 +785,9 @@  discard block
 block discarded – undo
767 785
 		switch ( $header ) {
768 786
 			case 'Name' :
769 787
 				// Cached for sorting reasons.
770
-				if ( isset( $this->name_translated ) )
771
-					return $this->name_translated;
788
+				if ( isset( $this->name_translated ) ) {
789
+									return $this->name_translated;
790
+				}
772 791
 				$this->name_translated = translate( $value, $this->get('TextDomain' ) );
773 792
 				return $this->name_translated;
774 793
 			case 'Tags' :
@@ -854,8 +873,9 @@  discard block
 block discarded – undo
854 873
 	 * @return string Absolute path of the stylesheet directory.
855 874
 	 */
856 875
 	public function get_stylesheet_directory() {
857
-		if ( $this->errors() && in_array( 'theme_root_missing', $this->errors()->get_error_codes() ) )
858
-			return '';
876
+		if ( $this->errors() && in_array( 'theme_root_missing', $this->errors()->get_error_codes() ) ) {
877
+					return '';
878
+		}
859 879
 
860 880
 		return $this->theme_root . '/' . $this->stylesheet;
861 881
 	}
@@ -872,10 +892,11 @@  discard block
 block discarded – undo
872 892
 	 * @return string Absolute path of the template directory.
873 893
 	 */
874 894
 	public function get_template_directory() {
875
-		if ( $this->parent() )
876
-			$theme_root = $this->parent()->theme_root;
877
-		else
878
-			$theme_root = $this->theme_root;
895
+		if ( $this->parent() ) {
896
+					$theme_root = $this->parent()->theme_root;
897
+		} else {
898
+					$theme_root = $this->theme_root;
899
+		}
879 900
 
880 901
 		return $theme_root . '/' . $this->template;
881 902
 	}
@@ -907,10 +928,11 @@  discard block
 block discarded – undo
907 928
 	 * @return string URL to the template directory.
908 929
 	 */
909 930
 	public function get_template_directory_uri() {
910
-		if ( $this->parent() )
911
-			$theme_root_uri = $this->parent()->get_theme_root_uri();
912
-		else
913
-			$theme_root_uri = $this->get_theme_root_uri();
931
+		if ( $this->parent() ) {
932
+					$theme_root_uri = $this->parent()->get_theme_root_uri();
933
+		} else {
934
+					$theme_root_uri = $this->get_theme_root_uri();
935
+		}
914 936
 
915 937
 		return $theme_root_uri . '/' . str_replace( '%2F', '/', rawurlencode( $this->template ) );
916 938
 	}
@@ -942,8 +964,9 @@  discard block
 block discarded – undo
942 964
 	 * @return string Theme root URI.
943 965
 	 */
944 966
 	public function get_theme_root_uri() {
945
-		if ( ! isset( $this->theme_root_uri ) )
946
-			$this->theme_root_uri = get_theme_root_uri( $this->stylesheet, $this->theme_root );
967
+		if ( ! isset( $this->theme_root_uri ) ) {
968
+					$this->theme_root_uri = get_theme_root_uri( $this->stylesheet, $this->theme_root );
969
+		}
947 970
 		return $this->theme_root_uri;
948 971
 	}
949 972
 
@@ -964,8 +987,9 @@  discard block
 block discarded – undo
964 987
 	public function get_screenshot( $uri = 'uri' ) {
965 988
 		$screenshot = $this->cache_get( 'screenshot' );
966 989
 		if ( $screenshot ) {
967
-			if ( 'relative' == $uri )
968
-				return $screenshot;
990
+			if ( 'relative' == $uri ) {
991
+							return $screenshot;
992
+			}
969 993
 			return $this->get_stylesheet_directory_uri() . '/' . $screenshot;
970 994
 		} elseif ( 0 === $screenshot ) {
971 995
 			return false;
@@ -974,8 +998,9 @@  discard block
 block discarded – undo
974 998
 		foreach ( array( 'png', 'gif', 'jpg', 'jpeg' ) as $ext ) {
975 999
 			if ( file_exists( $this->get_stylesheet_directory() . "/screenshot.$ext" ) ) {
976 1000
 				$this->cache_add( 'screenshot', 'screenshot.' . $ext );
977
-				if ( 'relative' == $uri )
978
-					return 'screenshot.' . $ext;
1001
+				if ( 'relative' == $uri ) {
1002
+									return 'screenshot.' . $ext;
1003
+				}
979 1004
 				return $this->get_stylesheet_directory_uri() . '/' . 'screenshot.' . $ext;
980 1005
 			}
981 1006
 		}
@@ -999,8 +1024,9 @@  discard block
 block discarded – undo
999 1024
 	public function get_files( $type = null, $depth = 0, $search_parent = false ) {
1000 1025
 		$files = (array) self::scandir( $this->get_stylesheet_directory(), $type, $depth );
1001 1026
 
1002
-		if ( $search_parent && $this->parent() )
1003
-			$files += (array) self::scandir( $this->get_template_directory(), $type, $depth );
1027
+		if ( $search_parent && $this->parent() ) {
1028
+					$files += (array) self::scandir( $this->get_template_directory(), $type, $depth );
1029
+		}
1004 1030
 
1005 1031
 		return $files;
1006 1032
 	}
@@ -1123,8 +1149,9 @@  discard block
 block discarded – undo
1123 1149
 	 *                     with `$relative_path`, with the values being absolute paths. False otherwise.
1124 1150
 	 */
1125 1151
 	private static function scandir( $path, $extensions = null, $depth = 0, $relative_path = '' ) {
1126
-		if ( ! is_dir( $path ) )
1127
-			return false;
1152
+		if ( ! is_dir( $path ) ) {
1153
+					return false;
1154
+		}
1128 1155
 
1129 1156
 		if ( $extensions ) {
1130 1157
 			$extensions = (array) $extensions;
@@ -1132,18 +1159,21 @@  discard block
 block discarded – undo
1132 1159
 		}
1133 1160
 
1134 1161
 		$relative_path = trailingslashit( $relative_path );
1135
-		if ( '/' == $relative_path )
1136
-			$relative_path = '';
1162
+		if ( '/' == $relative_path ) {
1163
+					$relative_path = '';
1164
+		}
1137 1165
 
1138 1166
 		$results = scandir( $path );
1139 1167
 		$files = array();
1140 1168
 
1141 1169
 		foreach ( $results as $result ) {
1142
-			if ( '.' == $result[0] )
1143
-				continue;
1170
+			if ( '.' == $result[0] ) {
1171
+							continue;
1172
+			}
1144 1173
 			if ( is_dir( $path . '/' . $result ) ) {
1145
-				if ( ! $depth || 'CVS' == $result )
1146
-					continue;
1174
+				if ( ! $depth || 'CVS' == $result ) {
1175
+									continue;
1176
+				}
1147 1177
 				$found = self::scandir( $path . '/' . $result, $extensions, $depth - 1 , $relative_path . $result );
1148 1178
 				$files = array_merge_recursive( $files, $found );
1149 1179
 			} elseif ( ! $extensions || preg_match( '~\.(' . $_extensions . ')$~', $result ) ) {
@@ -1167,8 +1197,9 @@  discard block
 block discarded – undo
1167 1197
 	 * 	False if no textdomain was specified in the file headers, or if the domain could not be loaded.
1168 1198
 	 */
1169 1199
 	public function load_textdomain() {
1170
-		if ( isset( $this->textdomain_loaded ) )
1171
-			return $this->textdomain_loaded;
1200
+		if ( isset( $this->textdomain_loaded ) ) {
1201
+					return $this->textdomain_loaded;
1202
+		}
1172 1203
 
1173 1204
 		$textdomain = $this->get('TextDomain');
1174 1205
 		if ( ! $textdomain ) {
@@ -1182,10 +1213,11 @@  discard block
 block discarded – undo
1182 1213
 		}
1183 1214
 
1184 1215
 		$path = $this->get_stylesheet_directory();
1185
-		if ( $domainpath = $this->get('DomainPath') )
1186
-			$path .= $domainpath;
1187
-		else
1188
-			$path .= '/languages';
1216
+		if ( $domainpath = $this->get('DomainPath') ) {
1217
+					$path .= $domainpath;
1218
+		} else {
1219
+					$path .= '/languages';
1220
+		}
1189 1221
 
1190 1222
 		$this->textdomain_loaded = load_theme_textdomain( $textdomain, $path );
1191 1223
 		return $this->textdomain_loaded;
@@ -1203,19 +1235,22 @@  discard block
 block discarded – undo
1203 1235
 	 * @return bool Whether the theme is allowed for the network. Returns true in single-site.
1204 1236
 	 */
1205 1237
 	public function is_allowed( $check = 'both', $blog_id = null ) {
1206
-		if ( ! is_multisite() )
1207
-			return true;
1238
+		if ( ! is_multisite() ) {
1239
+					return true;
1240
+		}
1208 1241
 
1209 1242
 		if ( 'both' == $check || 'network' == $check ) {
1210 1243
 			$allowed = self::get_allowed_on_network();
1211
-			if ( ! empty( $allowed[ $this->get_stylesheet() ] ) )
1212
-				return true;
1244
+			if ( ! empty( $allowed[ $this->get_stylesheet() ] ) ) {
1245
+							return true;
1246
+			}
1213 1247
 		}
1214 1248
 
1215 1249
 		if ( 'both' == $check || 'site' == $check ) {
1216 1250
 			$allowed = self::get_allowed_on_site( $blog_id );
1217
-			if ( ! empty( $allowed[ $this->get_stylesheet() ] ) )
1218
-				return true;
1251
+			if ( ! empty( $allowed[ $this->get_stylesheet() ] ) ) {
1252
+							return true;
1253
+			}
1219 1254
 		}
1220 1255
 
1221 1256
 		return false;
@@ -1311,8 +1346,9 @@  discard block
 block discarded – undo
1311 1346
 	public static function get_allowed_on_site( $blog_id = null ) {
1312 1347
 		static $allowed_themes = array();
1313 1348
 
1314
-		if ( ! $blog_id || ! is_multisite() )
1315
-			$blog_id = get_current_blog_id();
1349
+		if ( ! $blog_id || ! is_multisite() ) {
1350
+					$blog_id = get_current_blog_id();
1351
+		}
1316 1352
 
1317 1353
 		if ( isset( $allowed_themes[ $blog_id ] ) ) {
1318 1354
 			/**
@@ -1353,8 +1389,9 @@  discard block
 block discarded – undo
1353 1389
 				$converted = array();
1354 1390
 				$themes = wp_get_themes();
1355 1391
 				foreach ( $themes as $stylesheet => $theme_data ) {
1356
-					if ( isset( $allowed_themes[ $blog_id ][ $theme_data->get('Name') ] ) )
1357
-						$converted[ $stylesheet ] = true;
1392
+					if ( isset( $allowed_themes[ $blog_id ][ $theme_data->get('Name') ] ) ) {
1393
+											$converted[ $stylesheet ] = true;
1394
+					}
1358 1395
 				}
1359 1396
 				$allowed_themes[ $blog_id ] = $converted;
1360 1397
 			}
Please login to merge, or discard this patch.
src/wp-includes/link-template.php 3 patches
Doc Comments   +9 added lines, -9 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
 	/**
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
  *
98 98
  * @see get_permalink()
99 99
  *
100
- * @param int|WP_Post $post      Optional. Post ID or post object. Default is the global `$post`.
100
+ * @param integer $post      Optional. Post ID or post object. Default is the global `$post`.
101 101
  * @param bool        $leavename Optional. Whether to keep post name or page name. Default false.
102 102
  *
103 103
  * @return string|false The permalink URL or false if post does not exist.
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
  *
112 112
  * @since 1.0.0
113 113
  *
114
- * @param int|WP_Post $post      Optional. Post ID or post object. Default is the global `$post`.
114
+ * @param integer $post      Optional. Post ID or post object. Default is the global `$post`.
115 115
  * @param bool        $leavename Optional. Whether to keep post name or page name. Default false.
116 116
  * @return string|false The permalink URL or false if post does not exist.
117 117
  */
@@ -1387,7 +1387,7 @@  discard block
 block discarded – undo
1387 1387
  *
1388 1388
  * @since 2.3.0
1389 1389
  *
1390
- * @param int|WP_Comment $comment_id Optional. Comment ID or WP_Comment object.
1390
+ * @param integer $comment_id Optional. Comment ID or WP_Comment object.
1391 1391
  * @return string|void The edit comment link URL for the given comment.
1392 1392
  */
1393 1393
 function get_edit_comment_link( $comment_id = 0 ) {
@@ -1447,7 +1447,7 @@  discard block
 block discarded – undo
1447 1447
  *
1448 1448
  * @since 2.7.0
1449 1449
  *
1450
- * @param int|stdClass $link Optional. Bookmark ID. Default is the id of the current bookmark.
1450
+ * @param integer $link Optional. Bookmark ID. Default is the id of the current bookmark.
1451 1451
  * @return string|void The edit bookmark link URL.
1452 1452
  */
1453 1453
 function get_edit_bookmark_link( $link = 0 ) {
@@ -1545,7 +1545,7 @@  discard block
 block discarded – undo
1545 1545
  * @since 1.5.0
1546 1546
  *
1547 1547
  * @param bool         $in_same_term   Optional. Whether post should be in a same taxonomy term. Default false.
1548
- * @param array|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs. Default empty.
1548
+ * @param string $excluded_terms Optional. Array or comma-separated list of excluded term IDs. Default empty.
1549 1549
  * @param string       $taxonomy       Optional. Taxonomy, if $in_same_term is true. Default 'category'.
1550 1550
  * @return null|string|WP_Post Post object if successful. Null if global $post is not set. Empty string if no
1551 1551
  *                             corresponding post exists.
@@ -1560,7 +1560,7 @@  discard block
 block discarded – undo
1560 1560
  * @since 1.5.0
1561 1561
  *
1562 1562
  * @param bool         $in_same_term   Optional. Whether post should be in a same taxonomy term. Default false.
1563
- * @param array|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs. Default empty.
1563
+ * @param string $excluded_terms Optional. Array or comma-separated list of excluded term IDs. Default empty.
1564 1564
  * @param string       $taxonomy       Optional. Taxonomy, if $in_same_term is true. Default 'category'.
1565 1565
  * @return null|string|WP_Post Post object if successful. Null if global $post is not set. Empty string if no
1566 1566
  *                             corresponding post exists.
@@ -1873,7 +1873,7 @@  discard block
 block discarded – undo
1873 1873
  *
1874 1874
  * @param bool         $in_same_term   Optional. Whether returned post should be in a same taxonomy term.
1875 1875
  *                                     Default false.
1876
- * @param array|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
1876
+ * @param string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
1877 1877
  *                                     Default empty.
1878 1878
  * @param bool         $start          Optional. Whether to retrieve first or last post. Default true
1879 1879
  * @param string       $taxonomy       Optional. Taxonomy, if $in_same_term is true. Default 'category'.
@@ -2761,7 +2761,7 @@  discard block
 block discarded – undo
2761 2761
  * @global WP_Rewrite $wp_rewrite
2762 2762
  *
2763 2763
  * @param string|array $args Optional args. See paginate_links(). Default empty array.
2764
- * @return string|void Markup for pagination links.
2764
+ * @return string Markup for pagination links.
2765 2765
  */
2766 2766
 function paginate_comments_links( $args = array() ) {
2767 2767
 	global $wp_rewrite;
Please login to merge, or discard this patch.
Spacing   +826 added lines, -826 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
 	 * Filters 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
 /**
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
  */
47 47
 function user_trailingslashit($string, $type_of_url = '') {
48 48
 	global $wp_rewrite;
49
-	if ( $wp_rewrite->use_trailing_slashes )
49
+	if ($wp_rewrite->use_trailing_slashes)
50 50
 		$string = trailingslashit($string);
51 51
 	else
52 52
 		$string = untrailingslashit($string);
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 	 *                            'single_feed', 'single_paged', 'commentpaged', 'paged', 'home', 'feed',
62 62
 	 *                            'category', 'page', 'year', 'month', 'day', 'post_type_archive'.
63 63
 	 */
64
-	return apply_filters( 'user_trailingslashit', $string, $type_of_url );
64
+	return apply_filters('user_trailingslashit', $string, $type_of_url);
65 65
 }
66 66
 
67 67
 /**
@@ -74,16 +74,16 @@  discard block
 block discarded – undo
74 74
  *
75 75
  * @param string $mode Optional. Permalink mode. Accepts 'title' or 'id'. Default 'id'.
76 76
  */
77
-function permalink_anchor( $mode = 'id' ) {
77
+function permalink_anchor($mode = 'id') {
78 78
 	$post = get_post();
79
-	switch ( strtolower( $mode ) ) {
79
+	switch (strtolower($mode)) {
80 80
 		case 'title':
81
-			$title = sanitize_title( $post->post_title ) . '-' . $post->ID;
81
+			$title = sanitize_title($post->post_title).'-'.$post->ID;
82 82
 			echo '<a id="'.$title.'"></a>';
83 83
 			break;
84 84
 		case 'id':
85 85
 		default:
86
-			echo '<a id="post-' . $post->ID . '"></a>';
86
+			echo '<a id="post-'.$post->ID.'"></a>';
87 87
 			break;
88 88
 	}
89 89
 }
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
  *
103 103
  * @return string|false The permalink URL or false if post does not exist.
104 104
  */
105
-function get_the_permalink( $post = 0, $leavename = false ) {
106
-	return get_permalink( $post, $leavename );
105
+function get_the_permalink($post = 0, $leavename = false) {
106
+	return get_permalink($post, $leavename);
107 107
 }
108 108
 
109 109
 /**
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
  * @param bool        $leavename Optional. Whether to keep post name or page name. Default false.
116 116
  * @return string|false The permalink URL or false if post does not exist.
117 117
  */
118
-function get_permalink( $post = 0, $leavename = false ) {
118
+function get_permalink($post = 0, $leavename = false) {
119 119
 	$rewritecode = array(
120 120
 		'%year%',
121 121
 		'%monthnum%',
@@ -123,28 +123,28 @@  discard block
 block discarded – undo
123 123
 		'%hour%',
124 124
 		'%minute%',
125 125
 		'%second%',
126
-		$leavename? '' : '%postname%',
126
+		$leavename ? '' : '%postname%',
127 127
 		'%post_id%',
128 128
 		'%category%',
129 129
 		'%author%',
130
-		$leavename? '' : '%pagename%',
130
+		$leavename ? '' : '%pagename%',
131 131
 	);
132 132
 
133
-	if ( is_object( $post ) && isset( $post->filter ) && 'sample' == $post->filter ) {
133
+	if (is_object($post) && isset($post->filter) && 'sample' == $post->filter) {
134 134
 		$sample = true;
135 135
 	} else {
136
-		$post = get_post( $post );
136
+		$post = get_post($post);
137 137
 		$sample = false;
138 138
 	}
139 139
 
140
-	if ( empty($post->ID) )
140
+	if (empty($post->ID))
141 141
 		return false;
142 142
 
143
-	if ( $post->post_type == 'page' )
143
+	if ($post->post_type == 'page')
144 144
 		return get_page_link($post, $leavename, $sample);
145
-	elseif ( $post->post_type == 'attachment' )
146
-		return get_attachment_link( $post, $leavename );
147
-	elseif ( in_array($post->post_type, get_post_types( array('_builtin' => false) ) ) )
145
+	elseif ($post->post_type == 'attachment')
146
+		return get_attachment_link($post, $leavename);
147
+	elseif (in_array($post->post_type, get_post_types(array('_builtin' => false))))
148 148
 		return get_post_permalink($post, $leavename, $sample);
149 149
 
150 150
 	$permalink = get_option('permalink_structure');
@@ -160,18 +160,18 @@  discard block
 block discarded – undo
160 160
 	 * @param WP_Post $post      The post in question.
161 161
 	 * @param bool    $leavename Whether to keep the post name.
162 162
 	 */
163
-	$permalink = apply_filters( 'pre_post_link', $permalink, $post, $leavename );
163
+	$permalink = apply_filters('pre_post_link', $permalink, $post, $leavename);
164 164
 
165
-	if ( '' != $permalink && !in_array( $post->post_status, array( 'draft', 'pending', 'auto-draft', 'future' ) ) ) {
165
+	if ('' != $permalink && ! in_array($post->post_status, array('draft', 'pending', 'auto-draft', 'future'))) {
166 166
 		$unixtime = strtotime($post->post_date);
167 167
 
168 168
 		$category = '';
169
-		if ( strpos($permalink, '%category%') !== false ) {
169
+		if (strpos($permalink, '%category%') !== false) {
170 170
 			$cats = get_the_category($post->ID);
171
-			if ( $cats ) {
172
-				$cats = wp_list_sort( $cats, array(
171
+			if ($cats) {
172
+				$cats = wp_list_sort($cats, array(
173 173
 					'term_id' => 'ASC',
174
-				) );
174
+				));
175 175
 
176 176
 				/**
177 177
 				 * Filters the category that gets used in the %category% permalink token.
@@ -182,30 +182,30 @@  discard block
 block discarded – undo
182 182
 				 * @param array    $cats Array of all categories (WP_Term objects) associated with the post.
183 183
 				 * @param WP_Post  $post The post in question.
184 184
 				 */
185
-				$category_object = apply_filters( 'post_link_category', $cats[0], $cats, $post );
185
+				$category_object = apply_filters('post_link_category', $cats[0], $cats, $post);
186 186
 
187
-				$category_object = get_term( $category_object, 'category' );
187
+				$category_object = get_term($category_object, 'category');
188 188
 				$category = $category_object->slug;
189
-				if ( $parent = $category_object->parent )
190
-					$category = get_category_parents($parent, false, '/', true) . $category;
189
+				if ($parent = $category_object->parent)
190
+					$category = get_category_parents($parent, false, '/', true).$category;
191 191
 			}
192 192
 			// show default category in permalinks, without
193 193
 			// having to assign it explicitly
194
-			if ( empty($category) ) {
195
-				$default_category = get_term( get_option( 'default_category' ), 'category' );
196
-				if ( $default_category && ! is_wp_error( $default_category ) ) {
194
+			if (empty($category)) {
195
+				$default_category = get_term(get_option('default_category'), 'category');
196
+				if ($default_category && ! is_wp_error($default_category)) {
197 197
 					$category = $default_category->slug;
198 198
 				}
199 199
 			}
200 200
 		}
201 201
 
202 202
 		$author = '';
203
-		if ( strpos($permalink, '%author%') !== false ) {
203
+		if (strpos($permalink, '%author%') !== false) {
204 204
 			$authordata = get_userdata($post->post_author);
205 205
 			$author = $authordata->user_nicename;
206 206
 		}
207 207
 
208
-		$date = explode(" ",date('Y m d H i s', $unixtime));
208
+		$date = explode(" ", date('Y m d H i s', $unixtime));
209 209
 		$rewritereplace =
210 210
 		array(
211 211
 			$date[0],
@@ -220,10 +220,10 @@  discard block
 block discarded – undo
220 220
 			$author,
221 221
 			$post->post_name,
222 222
 		);
223
-		$permalink = home_url( str_replace($rewritecode, $rewritereplace, $permalink) );
223
+		$permalink = home_url(str_replace($rewritecode, $rewritereplace, $permalink));
224 224
 		$permalink = user_trailingslashit($permalink, 'single');
225 225
 	} else { // if they're not using the fancy permalink option
226
-		$permalink = home_url('?p=' . $post->ID);
226
+		$permalink = home_url('?p='.$post->ID);
227 227
 	}
228 228
 
229 229
 	/**
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 	 * @param WP_Post $post      The post in question.
238 238
 	 * @param bool    $leavename Whether to keep the post name.
239 239
 	 */
240
-	return apply_filters( 'post_link', $permalink, $post, $leavename );
240
+	return apply_filters('post_link', $permalink, $post, $leavename);
241 241
 }
242 242
 
243 243
 /**
@@ -252,33 +252,33 @@  discard block
 block discarded – undo
252 252
  * @param bool $sample    Optional, defaults to false. Is it a sample permalink. Default false.
253 253
  * @return string|WP_Error The post permalink.
254 254
  */
255
-function get_post_permalink( $id = 0, $leavename = false, $sample = false ) {
255
+function get_post_permalink($id = 0, $leavename = false, $sample = false) {
256 256
 	global $wp_rewrite;
257 257
 
258 258
 	$post = get_post($id);
259 259
 
260
-	if ( is_wp_error( $post ) )
260
+	if (is_wp_error($post))
261 261
 		return $post;
262 262
 
263 263
 	$post_link = $wp_rewrite->get_extra_permastruct($post->post_type);
264 264
 
265 265
 	$slug = $post->post_name;
266 266
 
267
-	$draft_or_pending = get_post_status( $id ) && in_array( get_post_status( $id ), array( 'draft', 'pending', 'auto-draft', 'future' ) );
267
+	$draft_or_pending = get_post_status($id) && in_array(get_post_status($id), array('draft', 'pending', 'auto-draft', 'future'));
268 268
 
269 269
 	$post_type = get_post_type_object($post->post_type);
270 270
 
271
-	if ( $post_type->hierarchical ) {
272
-		$slug = get_page_uri( $id );
271
+	if ($post_type->hierarchical) {
272
+		$slug = get_page_uri($id);
273 273
 	}
274 274
 
275
-	if ( !empty($post_link) && ( !$draft_or_pending || $sample ) ) {
276
-		if ( ! $leavename ) {
275
+	if ( ! empty($post_link) && ( ! $draft_or_pending || $sample)) {
276
+		if ( ! $leavename) {
277 277
 			$post_link = str_replace("%$post->post_type%", $slug, $post_link);
278 278
 		}
279
-		$post_link = home_url( user_trailingslashit($post_link) );
279
+		$post_link = home_url(user_trailingslashit($post_link));
280 280
 	} else {
281
-		if ( $post_type->query_var && ( isset($post->post_status) && !$draft_or_pending ) )
281
+		if ($post_type->query_var && (isset($post->post_status) && ! $draft_or_pending))
282 282
 			$post_link = add_query_arg($post_type->query_var, $slug, '');
283 283
 		else
284 284
 			$post_link = add_query_arg(array('post_type' => $post->post_type, 'p' => $post->ID), '');
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 	 * @param bool    $leavename Whether to keep the post name.
296 296
 	 * @param bool    $sample    Is it a sample permalink.
297 297
 	 */
298
-	return apply_filters( 'post_type_link', $post_link, $post, $leavename, $sample );
298
+	return apply_filters('post_type_link', $post_link, $post, $leavename, $sample);
299 299
 }
300 300
 
301 301
 /**
@@ -311,13 +311,13 @@  discard block
 block discarded – undo
311 311
  *                               Default false.
312 312
  * @return string The page permalink.
313 313
  */
314
-function get_page_link( $post = false, $leavename = false, $sample = false ) {
315
-	$post = get_post( $post );
314
+function get_page_link($post = false, $leavename = false, $sample = false) {
315
+	$post = get_post($post);
316 316
 
317
-	if ( 'page' == get_option( 'show_on_front' ) && $post->ID == get_option( 'page_on_front' ) )
317
+	if ('page' == get_option('show_on_front') && $post->ID == get_option('page_on_front'))
318 318
 		$link = home_url('/');
319 319
 	else
320
-		$link = _get_page_link( $post, $leavename, $sample );
320
+		$link = _get_page_link($post, $leavename, $sample);
321 321
 
322 322
 	/**
323 323
 	 * Filters the permalink for a page.
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 	 * @param int    $post_id The ID of the page.
329 329
 	 * @param bool   $sample  Is it a sample permalink.
330 330
 	 */
331
-	return apply_filters( 'page_link', $link, $post->ID, $sample );
331
+	return apply_filters('page_link', $link, $post->ID, $sample);
332 332
 }
333 333
 
334 334
 /**
@@ -347,24 +347,24 @@  discard block
 block discarded – undo
347 347
  *                               Default false.
348 348
  * @return string The page permalink.
349 349
  */
350
-function _get_page_link( $post = false, $leavename = false, $sample = false ) {
350
+function _get_page_link($post = false, $leavename = false, $sample = false) {
351 351
 	global $wp_rewrite;
352 352
 
353
-	$post = get_post( $post );
353
+	$post = get_post($post);
354 354
 
355
-	$draft_or_pending = in_array( $post->post_status, array( 'draft', 'pending', 'auto-draft' ) );
355
+	$draft_or_pending = in_array($post->post_status, array('draft', 'pending', 'auto-draft'));
356 356
 
357 357
 	$link = $wp_rewrite->get_page_permastruct();
358 358
 
359
-	if ( !empty($link) && ( ( isset($post->post_status) && !$draft_or_pending ) || $sample ) ) {
360
-		if ( ! $leavename ) {
361
-			$link = str_replace('%pagename%', get_page_uri( $post ), $link);
359
+	if ( ! empty($link) && ((isset($post->post_status) && ! $draft_or_pending) || $sample)) {
360
+		if ( ! $leavename) {
361
+			$link = str_replace('%pagename%', get_page_uri($post), $link);
362 362
 		}
363 363
 
364 364
 		$link = home_url($link);
365 365
 		$link = user_trailingslashit($link, 'page');
366 366
 	} else {
367
-		$link = home_url( '?page_id=' . $post->ID );
367
+		$link = home_url('?page_id='.$post->ID);
368 368
 	}
369 369
 
370 370
 	/**
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 	 * @param string $link    The page's permalink.
376 376
 	 * @param int    $post_id The ID of the page.
377 377
 	 */
378
-	return apply_filters( '_get_page_link', $link, $post->ID );
378
+	return apply_filters('_get_page_link', $link, $post->ID);
379 379
 }
380 380
 
381 381
 /**
@@ -391,39 +391,39 @@  discard block
 block discarded – undo
391 391
  * @param bool       $leavename Optional. Whether to keep the page name. Default false.
392 392
  * @return string The attachment permalink.
393 393
  */
394
-function get_attachment_link( $post = null, $leavename = false ) {
394
+function get_attachment_link($post = null, $leavename = false) {
395 395
 	global $wp_rewrite;
396 396
 
397 397
 	$link = false;
398 398
 
399
-	$post = get_post( $post );
400
-	$parent = ( $post->post_parent > 0 && $post->post_parent != $post->ID ) ? get_post( $post->post_parent ) : false;
401
-	if ( $parent && ! in_array( $parent->post_type, get_post_types() ) ) {
399
+	$post = get_post($post);
400
+	$parent = ($post->post_parent > 0 && $post->post_parent != $post->ID) ? get_post($post->post_parent) : false;
401
+	if ($parent && ! in_array($parent->post_type, get_post_types())) {
402 402
 		$parent = false;
403 403
 	}
404 404
 
405
-	if ( $wp_rewrite->using_permalinks() && $parent ) {
406
-		if ( 'page' == $parent->post_type )
407
-			$parentlink = _get_page_link( $post->post_parent ); // Ignores page_on_front
405
+	if ($wp_rewrite->using_permalinks() && $parent) {
406
+		if ('page' == $parent->post_type)
407
+			$parentlink = _get_page_link($post->post_parent); // Ignores page_on_front
408 408
 		else
409
-			$parentlink = get_permalink( $post->post_parent );
409
+			$parentlink = get_permalink($post->post_parent);
410 410
 
411
-		if ( is_numeric($post->post_name) || false !== strpos(get_option('permalink_structure'), '%category%') )
412
-			$name = 'attachment/' . $post->post_name; // <permalink>/<int>/ is paged so we use the explicit attachment marker
411
+		if (is_numeric($post->post_name) || false !== strpos(get_option('permalink_structure'), '%category%'))
412
+			$name = 'attachment/'.$post->post_name; // <permalink>/<int>/ is paged so we use the explicit attachment marker
413 413
 		else
414 414
 			$name = $post->post_name;
415 415
 
416
-		if ( strpos($parentlink, '?') === false )
417
-			$link = user_trailingslashit( trailingslashit($parentlink) . '%postname%' );
416
+		if (strpos($parentlink, '?') === false)
417
+			$link = user_trailingslashit(trailingslashit($parentlink).'%postname%');
418 418
 
419
-		if ( ! $leavename )
420
-			$link = str_replace( '%postname%', $name, $link );
421
-	} elseif ( $wp_rewrite->using_permalinks() && ! $leavename ) {
422
-		$link = home_url( user_trailingslashit( $post->post_name ) );
419
+		if ( ! $leavename)
420
+			$link = str_replace('%postname%', $name, $link);
421
+	} elseif ($wp_rewrite->using_permalinks() && ! $leavename) {
422
+		$link = home_url(user_trailingslashit($post->post_name));
423 423
 	}
424 424
 
425
-	if ( ! $link )
426
-		$link = home_url( '/?attachment_id=' . $post->ID );
425
+	if ( ! $link)
426
+		$link = home_url('/?attachment_id='.$post->ID);
427 427
 
428 428
 	/**
429 429
 	 * Filters the permalink for an attachment.
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 	 * @param string $link    The attachment's permalink.
434 434
 	 * @param int    $post_id Attachment ID.
435 435
 	 */
436
-	return apply_filters( 'attachment_link', $link, $post->ID );
436
+	return apply_filters('attachment_link', $link, $post->ID);
437 437
 }
438 438
 
439 439
 /**
@@ -446,16 +446,16 @@  discard block
 block discarded – undo
446 446
  * @param int|bool $year False for current year or year for permalink.
447 447
  * @return string The permalink for the specified year archive.
448 448
  */
449
-function get_year_link( $year ) {
449
+function get_year_link($year) {
450 450
 	global $wp_rewrite;
451
-	if ( !$year )
451
+	if ( ! $year)
452 452
 		$year = gmdate('Y', current_time('timestamp'));
453 453
 	$yearlink = $wp_rewrite->get_year_permastruct();
454
-	if ( !empty($yearlink) ) {
454
+	if ( ! empty($yearlink)) {
455 455
 		$yearlink = str_replace('%year%', $year, $yearlink);
456
-		$yearlink = home_url( user_trailingslashit( $yearlink, 'year' ) );
456
+		$yearlink = home_url(user_trailingslashit($yearlink, 'year'));
457 457
 	} else {
458
-		$yearlink = home_url( '?m=' . $year );
458
+		$yearlink = home_url('?m='.$year);
459 459
 	}
460 460
 
461 461
 	/**
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
 	 * @param string $yearlink Permalink for the year archive.
467 467
 	 * @param int    $year     Year for the archive.
468 468
 	 */
469
-	return apply_filters( 'year_link', $yearlink, $year );
469
+	return apply_filters('year_link', $yearlink, $year);
470 470
 }
471 471
 
472 472
 /**
@@ -482,17 +482,17 @@  discard block
 block discarded – undo
482 482
  */
483 483
 function get_month_link($year, $month) {
484 484
 	global $wp_rewrite;
485
-	if ( !$year )
485
+	if ( ! $year)
486 486
 		$year = gmdate('Y', current_time('timestamp'));
487
-	if ( !$month )
487
+	if ( ! $month)
488 488
 		$month = gmdate('m', current_time('timestamp'));
489 489
 	$monthlink = $wp_rewrite->get_month_permastruct();
490
-	if ( !empty($monthlink) ) {
490
+	if ( ! empty($monthlink)) {
491 491
 		$monthlink = str_replace('%year%', $year, $monthlink);
492 492
 		$monthlink = str_replace('%monthnum%', zeroise(intval($month), 2), $monthlink);
493
-		$monthlink = home_url( user_trailingslashit( $monthlink, 'month' ) );
493
+		$monthlink = home_url(user_trailingslashit($monthlink, 'month'));
494 494
 	} else {
495
-		$monthlink = home_url( '?m=' . $year . zeroise( $month, 2 ) );
495
+		$monthlink = home_url('?m='.$year.zeroise($month, 2));
496 496
 	}
497 497
 
498 498
 	/**
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 	 * @param int    $year      Year for the archive.
505 505
 	 * @param int    $month     The month for the archive.
506 506
 	 */
507
-	return apply_filters( 'month_link', $monthlink, $year, $month );
507
+	return apply_filters('month_link', $monthlink, $year, $month);
508 508
 }
509 509
 
510 510
 /**
@@ -521,21 +521,21 @@  discard block
 block discarded – undo
521 521
  */
522 522
 function get_day_link($year, $month, $day) {
523 523
 	global $wp_rewrite;
524
-	if ( !$year )
524
+	if ( ! $year)
525 525
 		$year = gmdate('Y', current_time('timestamp'));
526
-	if ( !$month )
526
+	if ( ! $month)
527 527
 		$month = gmdate('m', current_time('timestamp'));
528
-	if ( !$day )
528
+	if ( ! $day)
529 529
 		$day = gmdate('j', current_time('timestamp'));
530 530
 
531 531
 	$daylink = $wp_rewrite->get_day_permastruct();
532
-	if ( !empty($daylink) ) {
532
+	if ( ! empty($daylink)) {
533 533
 		$daylink = str_replace('%year%', $year, $daylink);
534 534
 		$daylink = str_replace('%monthnum%', zeroise(intval($month), 2), $daylink);
535 535
 		$daylink = str_replace('%day%', zeroise(intval($day), 2), $daylink);
536
-		$daylink = home_url( user_trailingslashit( $daylink, 'day' ) );
536
+		$daylink = home_url(user_trailingslashit($daylink, 'day'));
537 537
 	} else {
538
-		$daylink = home_url( '?m=' . $year . zeroise( $month, 2 ) . zeroise( $day, 2 ) );
538
+		$daylink = home_url('?m='.$year.zeroise($month, 2).zeroise($day, 2));
539 539
 	}
540 540
 
541 541
 	/**
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
 	 * @param int    $month   Month for the archive.
549 549
 	 * @param int    $day     The day for the archive.
550 550
 	 */
551
-	return apply_filters( 'day_link', $daylink, $year, $month, $day );
551
+	return apply_filters('day_link', $daylink, $year, $month, $day);
552 552
 }
553 553
 
554 554
 /**
@@ -559,8 +559,8 @@  discard block
 block discarded – undo
559 559
  * @param string $anchor The link's anchor text.
560 560
  * @param string $feed   Optional. Feed type. Default empty.
561 561
  */
562
-function the_feed_link( $anchor, $feed = '' ) {
563
-	$link = '<a href="' . esc_url( get_feed_link( $feed ) ) . '">' . $anchor . '</a>';
562
+function the_feed_link($anchor, $feed = '') {
563
+	$link = '<a href="'.esc_url(get_feed_link($feed)).'">'.$anchor.'</a>';
564 564
 
565 565
 	/**
566 566
 	 * Filters the feed link anchor tag.
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
 	 * @param string $feed The feed type, or an empty string for the
572 572
 	 *                     default feed type.
573 573
 	 */
574
-	echo apply_filters( 'the_feed_link', $link, $feed );
574
+	echo apply_filters('the_feed_link', $link, $feed);
575 575
 }
576 576
 
577 577
 /**
@@ -584,27 +584,27 @@  discard block
 block discarded – undo
584 584
  * @param string $feed Optional. Feed type. Default empty.
585 585
  * @return string The feed permalink.
586 586
  */
587
-function get_feed_link( $feed = '' ) {
587
+function get_feed_link($feed = '') {
588 588
 	global $wp_rewrite;
589 589
 
590 590
 	$permalink = $wp_rewrite->get_feed_permastruct();
591
-	if ( '' != $permalink ) {
592
-		if ( false !== strpos($feed, 'comments_') ) {
591
+	if ('' != $permalink) {
592
+		if (false !== strpos($feed, 'comments_')) {
593 593
 			$feed = str_replace('comments_', '', $feed);
594 594
 			$permalink = $wp_rewrite->get_comment_feed_permastruct();
595 595
 		}
596 596
 
597
-		if ( get_default_feed() == $feed )
597
+		if (get_default_feed() == $feed)
598 598
 			$feed = '';
599 599
 
600 600
 		$permalink = str_replace('%feed%', $feed, $permalink);
601 601
 		$permalink = preg_replace('#/+#', '/', "/$permalink");
602
-		$output =  home_url( user_trailingslashit($permalink, 'feed') );
602
+		$output = home_url(user_trailingslashit($permalink, 'feed'));
603 603
 	} else {
604
-		if ( empty($feed) )
604
+		if (empty($feed))
605 605
 			$feed = get_default_feed();
606 606
 
607
-		if ( false !== strpos($feed, 'comments_') )
607
+		if (false !== strpos($feed, 'comments_'))
608 608
 			$feed = str_replace('comments_', 'comments-', $feed);
609 609
 
610 610
 		$output = home_url("?feed={$feed}");
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
 	 * @param string $output The feed permalink.
619 619
 	 * @param string $feed   Feed type.
620 620
 	 */
621
-	return apply_filters( 'feed_link', $output, $feed );
621
+	return apply_filters('feed_link', $output, $feed);
622 622
 }
623 623
 
624 624
 /**
@@ -630,43 +630,43 @@  discard block
 block discarded – undo
630 630
  * @param string $feed    Optional. Feed type. Default empty.
631 631
  * @return string The permalink for the comments feed for the given post.
632 632
  */
633
-function get_post_comments_feed_link( $post_id = 0, $feed = '' ) {
634
-	$post_id = absint( $post_id );
633
+function get_post_comments_feed_link($post_id = 0, $feed = '') {
634
+	$post_id = absint($post_id);
635 635
 
636
-	if ( ! $post_id )
636
+	if ( ! $post_id)
637 637
 		$post_id = get_the_ID();
638 638
 
639
-	if ( empty( $feed ) )
639
+	if (empty($feed))
640 640
 		$feed = get_default_feed();
641 641
 
642
-	$post = get_post( $post_id );
642
+	$post = get_post($post_id);
643 643
 	$unattached = 'attachment' === $post->post_type && 0 === (int) $post->post_parent;
644 644
 
645
-	if ( '' != get_option('permalink_structure') ) {
646
-		if ( 'page' == get_option('show_on_front') && $post_id == get_option('page_on_front') )
647
-			$url = _get_page_link( $post_id );
645
+	if ('' != get_option('permalink_structure')) {
646
+		if ('page' == get_option('show_on_front') && $post_id == get_option('page_on_front'))
647
+			$url = _get_page_link($post_id);
648 648
 		else
649 649
 			$url = get_permalink($post_id);
650 650
 
651
-		if ( $unattached ) {
652
-			$url =  home_url( '/feed/' );
653
-			if ( $feed !== get_default_feed() ) {
651
+		if ($unattached) {
652
+			$url = home_url('/feed/');
653
+			if ($feed !== get_default_feed()) {
654 654
 				$url .= "$feed/";
655 655
 			}
656
-			$url = add_query_arg( 'attachment_id', $post_id, $url );
656
+			$url = add_query_arg('attachment_id', $post_id, $url);
657 657
 		} else {
658
-			$url = trailingslashit($url) . 'feed';
659
-			if ( $feed != get_default_feed() )
658
+			$url = trailingslashit($url).'feed';
659
+			if ($feed != get_default_feed())
660 660
 				$url .= "/$feed";
661 661
 			$url = user_trailingslashit($url, 'single_feed');
662 662
 		}
663 663
 	} else {
664
-		if ( $unattached ) {
665
-			$url = add_query_arg( array( 'feed' => $feed, 'attachment_id' => $post_id ), home_url( '/' ) );
666
-		} elseif ( 'page' == $post->post_type ) {
667
-			$url = add_query_arg( array( 'feed' => $feed, 'page_id' => $post_id ), home_url( '/' ) );
664
+		if ($unattached) {
665
+			$url = add_query_arg(array('feed' => $feed, 'attachment_id' => $post_id), home_url('/'));
666
+		} elseif ('page' == $post->post_type) {
667
+			$url = add_query_arg(array('feed' => $feed, 'page_id' => $post_id), home_url('/'));
668 668
 		} else {
669
-			$url = add_query_arg( array( 'feed' => $feed, 'p' => $post_id ), home_url( '/' ) );
669
+			$url = add_query_arg(array('feed' => $feed, 'p' => $post_id), home_url('/'));
670 670
 		}
671 671
 	}
672 672
 
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
 	 *
678 678
 	 * @param string $url Post comments feed permalink.
679 679
 	 */
680
-	return apply_filters( 'post_comments_feed_link', $url );
680
+	return apply_filters('post_comments_feed_link', $url);
681 681
 }
682 682
 
683 683
 /**
@@ -693,13 +693,13 @@  discard block
 block discarded – undo
693 693
  * @param int    $post_id   Optional. Post ID. Default is the ID of the global `$post`.
694 694
  * @param string $feed      Optional. Feed format. Default empty.
695 695
  */
696
-function post_comments_feed_link( $link_text = '', $post_id = '', $feed = '' ) {
697
-	$url = get_post_comments_feed_link( $post_id, $feed );
698
-	if ( empty( $link_text ) ) {
696
+function post_comments_feed_link($link_text = '', $post_id = '', $feed = '') {
697
+	$url = get_post_comments_feed_link($post_id, $feed);
698
+	if (empty($link_text)) {
699 699
 		$link_text = __('Comments Feed');
700 700
 	}
701 701
 
702
-	$link = '<a href="' . esc_url( $url ) . '">' . $link_text . '</a>';
702
+	$link = '<a href="'.esc_url($url).'">'.$link_text.'</a>';
703 703
 	/**
704 704
 	 * Filters the post comment feed link anchor tag.
705 705
 	 *
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
 	 * @param int    $post_id Post ID.
710 710
 	 * @param string $feed    The feed type, or an empty string for the default feed type.
711 711
 	 */
712
-	echo apply_filters( 'post_comments_feed_link_html', $link, $post_id, $feed );
712
+	echo apply_filters('post_comments_feed_link_html', $link, $post_id, $feed);
713 713
 }
714 714
 
715 715
 /**
@@ -724,23 +724,23 @@  discard block
 block discarded – undo
724 724
  * @param string $feed      Optional. Feed type. Default empty.
725 725
  * @return string Link to the feed for the author specified by $author_id.
726 726
  */
727
-function get_author_feed_link( $author_id, $feed = '' ) {
727
+function get_author_feed_link($author_id, $feed = '') {
728 728
 	$author_id = (int) $author_id;
729 729
 	$permalink_structure = get_option('permalink_structure');
730 730
 
731
-	if ( empty($feed) )
731
+	if (empty($feed))
732 732
 		$feed = get_default_feed();
733 733
 
734
-	if ( '' == $permalink_structure ) {
735
-		$link = home_url("?feed=$feed&amp;author=" . $author_id);
734
+	if ('' == $permalink_structure) {
735
+		$link = home_url("?feed=$feed&amp;author=".$author_id);
736 736
 	} else {
737 737
 		$link = get_author_posts_url($author_id);
738
-		if ( $feed == get_default_feed() )
738
+		if ($feed == get_default_feed())
739 739
 			$feed_link = 'feed';
740 740
 		else
741 741
 			$feed_link = "feed/$feed";
742 742
 
743
-		$link = trailingslashit($link) . user_trailingslashit($feed_link, 'feed');
743
+		$link = trailingslashit($link).user_trailingslashit($feed_link, 'feed');
744 744
 	}
745 745
 
746 746
 	/**
@@ -751,7 +751,7 @@  discard block
 block discarded – undo
751 751
 	 * @param string $link The author feed link.
752 752
 	 * @param string $feed Feed type.
753 753
 	 */
754
-	$link = apply_filters( 'author_feed_link', $link, $feed );
754
+	$link = apply_filters('author_feed_link', $link, $feed);
755 755
 
756 756
 	return $link;
757 757
 }
@@ -768,8 +768,8 @@  discard block
 block discarded – undo
768 768
  * @param string $feed   Optional. Feed type. Default empty.
769 769
  * @return string Link to the feed for the category specified by $cat_id.
770 770
  */
771
-function get_category_feed_link( $cat_id, $feed = '' ) {
772
-	return get_term_feed_link( $cat_id, 'category', $feed );
771
+function get_category_feed_link($cat_id, $feed = '') {
772
+	return get_term_feed_link($cat_id, 'category', $feed);
773 773
 }
774 774
 
775 775
 /**
@@ -785,40 +785,40 @@  discard block
 block discarded – undo
785 785
  * @param string $feed     Optional. Feed type. Default empty.
786 786
  * @return string|false Link to the feed for the term specified by $term_id and $taxonomy.
787 787
  */
788
-function get_term_feed_link( $term_id, $taxonomy = 'category', $feed = '' ) {
789
-	$term_id = ( int ) $term_id;
788
+function get_term_feed_link($term_id, $taxonomy = 'category', $feed = '') {
789
+	$term_id = (int) $term_id;
790 790
 
791
-	$term = get_term( $term_id, $taxonomy  );
791
+	$term = get_term($term_id, $taxonomy);
792 792
 
793
-	if ( empty( $term ) || is_wp_error( $term ) )
793
+	if (empty($term) || is_wp_error($term))
794 794
 		return false;
795 795
 
796
-	if ( empty( $feed ) )
796
+	if (empty($feed))
797 797
 		$feed = get_default_feed();
798 798
 
799
-	$permalink_structure = get_option( 'permalink_structure' );
799
+	$permalink_structure = get_option('permalink_structure');
800 800
 
801
-	if ( '' == $permalink_structure ) {
802
-		if ( 'category' == $taxonomy ) {
801
+	if ('' == $permalink_structure) {
802
+		if ('category' == $taxonomy) {
803 803
 			$link = home_url("?feed=$feed&amp;cat=$term_id");
804 804
 		}
805
-		elseif ( 'post_tag' == $taxonomy ) {
805
+		elseif ('post_tag' == $taxonomy) {
806 806
 			$link = home_url("?feed=$feed&amp;tag=$term->slug");
807 807
 		} else {
808
-			$t = get_taxonomy( $taxonomy );
808
+			$t = get_taxonomy($taxonomy);
809 809
 			$link = home_url("?feed=$feed&amp;$t->query_var=$term->slug");
810 810
 		}
811 811
 	} else {
812
-		$link = get_term_link( $term_id, $term->taxonomy );
813
-		if ( $feed == get_default_feed() )
812
+		$link = get_term_link($term_id, $term->taxonomy);
813
+		if ($feed == get_default_feed())
814 814
 			$feed_link = 'feed';
815 815
 		else
816 816
 			$feed_link = "feed/$feed";
817 817
 
818
-		$link = trailingslashit( $link ) . user_trailingslashit( $feed_link, 'feed' );
818
+		$link = trailingslashit($link).user_trailingslashit($feed_link, 'feed');
819 819
 	}
820 820
 
821
-	if ( 'category' == $taxonomy ) {
821
+	if ('category' == $taxonomy) {
822 822
 		/**
823 823
 		 * Filters the category feed link.
824 824
 		 *
@@ -827,8 +827,8 @@  discard block
 block discarded – undo
827 827
 		 * @param string $link The category feed link.
828 828
 		 * @param string $feed Feed type.
829 829
 		 */
830
-		$link = apply_filters( 'category_feed_link', $link, $feed );
831
-	} elseif ( 'post_tag' == $taxonomy ) {
830
+		$link = apply_filters('category_feed_link', $link, $feed);
831
+	} elseif ('post_tag' == $taxonomy) {
832 832
 		/**
833 833
 		 * Filters the post tag feed link.
834 834
 		 *
@@ -837,7 +837,7 @@  discard block
 block discarded – undo
837 837
 		 * @param string $link The tag feed link.
838 838
 		 * @param string $feed Feed type.
839 839
 		 */
840
-		$link = apply_filters( 'tag_feed_link', $link, $feed );
840
+		$link = apply_filters('tag_feed_link', $link, $feed);
841 841
 	} else {
842 842
 		/**
843 843
 		 * Filters the feed link for a taxonomy other than 'category' or 'post_tag'.
@@ -848,7 +848,7 @@  discard block
 block discarded – undo
848 848
 		 * @param string $feed Feed type.
849 849
 		 * @param string $taxonomy The taxonomy name.
850 850
 		 */
851
-		$link = apply_filters( 'taxonomy_feed_link', $link, $feed, $taxonomy );
851
+		$link = apply_filters('taxonomy_feed_link', $link, $feed, $taxonomy);
852 852
 	}
853 853
 
854 854
 	return $link;
@@ -863,8 +863,8 @@  discard block
 block discarded – undo
863 863
  * @param string $feed   Optional. Feed type. Default empty.
864 864
  * @return string The feed permalink for the given tag.
865 865
  */
866
-function get_tag_feed_link( $tag_id, $feed = '' ) {
867
-	return get_term_feed_link( $tag_id, 'post_tag', $feed );
866
+function get_tag_feed_link($tag_id, $feed = '') {
867
+	return get_term_feed_link($tag_id, 'post_tag', $feed);
868 868
 }
869 869
 
870 870
 /**
@@ -876,7 +876,7 @@  discard block
 block discarded – undo
876 876
  * @param string $taxonomy Optional. Taxonomy slug. Default 'post_tag'.
877 877
  * @return string The edit tag link URL for the given tag.
878 878
  */
879
-function get_edit_tag_link( $tag_id, $taxonomy = 'post_tag' ) {
879
+function get_edit_tag_link($tag_id, $taxonomy = 'post_tag') {
880 880
 	/**
881 881
 	 * Filters the edit link for a tag (or term in another taxonomy).
882 882
 	 *
@@ -884,7 +884,7 @@  discard block
 block discarded – undo
884 884
 	 *
885 885
 	 * @param string $link The term edit link.
886 886
 	 */
887
-	return apply_filters( 'get_edit_tag_link', get_edit_term_link( $tag_id, $taxonomy ) );
887
+	return apply_filters('get_edit_tag_link', get_edit_term_link($tag_id, $taxonomy));
888 888
 }
889 889
 
890 890
 /**
@@ -898,8 +898,8 @@  discard block
 block discarded – undo
898 898
  * @param WP_Term $tag    Optional. Term object. If null, the queried object will be inspected.
899 899
  *                        Default null.
900 900
  */
901
-function edit_tag_link( $link = '', $before = '', $after = '', $tag = null ) {
902
-	$link = edit_term_link( $link, '', '', $tag, false );
901
+function edit_tag_link($link = '', $before = '', $after = '', $tag = null) {
902
+	$link = edit_term_link($link, '', '', $tag, false);
903 903
 
904 904
 	/**
905 905
 	 * Filters the anchor tag for the edit link for a tag (or term in another taxonomy).
@@ -908,7 +908,7 @@  discard block
 block discarded – undo
908 908
 	 *
909 909
 	 * @param string $link The anchor tag for the edit link.
910 910
 	 */
911
-	echo $before . apply_filters( 'edit_tag_link', $link ) . $after;
911
+	echo $before.apply_filters('edit_tag_link', $link).$after;
912 912
 }
913 913
 
914 914
 /**
@@ -925,14 +925,14 @@  discard block
 block discarded – undo
925 925
  *                            with the taxonomy.
926 926
  * @return string|null The edit term link URL for the given term, or null on failure.
927 927
  */
928
-function get_edit_term_link( $term_id, $taxonomy = '', $object_type = '' ) {
929
-	$term = get_term( $term_id, $taxonomy );
930
-	if ( ! $term || is_wp_error( $term ) ) {
928
+function get_edit_term_link($term_id, $taxonomy = '', $object_type = '') {
929
+	$term = get_term($term_id, $taxonomy);
930
+	if ( ! $term || is_wp_error($term)) {
931 931
 		return;
932 932
 	}
933 933
 
934
-	$tax = get_taxonomy( $term->taxonomy );
935
-	if ( ! $tax || ! current_user_can( 'edit_term', $term->term_id ) ) {
934
+	$tax = get_taxonomy($term->taxonomy);
935
+	if ( ! $tax || ! current_user_can('edit_term', $term->term_id)) {
936 936
 		return;
937 937
 	}
938 938
 
@@ -941,14 +941,14 @@  discard block
 block discarded – undo
941 941
 		'tag_ID'   => $term->term_id,
942 942
 	);
943 943
 
944
-	if ( $object_type ) {
944
+	if ($object_type) {
945 945
 		$args['post_type'] = $object_type;
946
-	} elseif ( ! empty( $tax->object_type ) ) {
947
-		$args['post_type'] = reset( $tax->object_type );
946
+	} elseif ( ! empty($tax->object_type)) {
947
+		$args['post_type'] = reset($tax->object_type);
948 948
 	}
949 949
 
950
-	if ( $tax->show_ui ) {
951
-		$location = add_query_arg( $args, admin_url( 'term.php' ) );
950
+	if ($tax->show_ui) {
951
+		$location = add_query_arg($args, admin_url('term.php'));
952 952
 	} else {
953 953
 		$location = '';
954 954
 	}
@@ -963,7 +963,7 @@  discard block
 block discarded – undo
963 963
 	 * @param string $taxonomy    Taxonomy name.
964 964
 	 * @param string $object_type The object type (eg. the post type).
965 965
 	 */
966
-	return apply_filters( 'get_edit_term_link', $location, $term_id, $taxonomy, $object_type );
966
+	return apply_filters('get_edit_term_link', $location, $term_id, $taxonomy, $object_type);
967 967
 }
968 968
 
969 969
 /**
@@ -978,22 +978,22 @@  discard block
 block discarded – undo
978 978
  * @param bool   $echo   Optional. Whether or not to echo the return. Default true.
979 979
  * @return string|void HTML content.
980 980
  */
981
-function edit_term_link( $link = '', $before = '', $after = '', $term = null, $echo = true ) {
982
-	if ( is_null( $term ) )
981
+function edit_term_link($link = '', $before = '', $after = '', $term = null, $echo = true) {
982
+	if (is_null($term))
983 983
 		$term = get_queried_object();
984 984
 
985
-	if ( ! $term )
985
+	if ( ! $term)
986 986
 		return;
987 987
 
988
-	$tax = get_taxonomy( $term->taxonomy );
989
-	if ( ! current_user_can( 'edit_term', $term->term_id ) ) {
988
+	$tax = get_taxonomy($term->taxonomy);
989
+	if ( ! current_user_can('edit_term', $term->term_id)) {
990 990
 		return;
991 991
 	}
992 992
 
993
-	if ( empty( $link ) )
993
+	if (empty($link))
994 994
 		$link = __('Edit This');
995 995
 
996
-	$link = '<a href="' . get_edit_term_link( $term->term_id, $term->taxonomy ) . '">' . $link . '</a>';
996
+	$link = '<a href="'.get_edit_term_link($term->term_id, $term->taxonomy).'">'.$link.'</a>';
997 997
 
998 998
 	/**
999 999
 	 * Filters the anchor tag for the edit link of a term.
@@ -1003,9 +1003,9 @@  discard block
 block discarded – undo
1003 1003
 	 * @param string $link    The anchor tag for the edit link.
1004 1004
 	 * @param int    $term_id Term ID.
1005 1005
 	 */
1006
-	$link = $before . apply_filters( 'edit_term_link', $link, $term->term_id ) . $after;
1006
+	$link = $before.apply_filters('edit_term_link', $link, $term->term_id).$after;
1007 1007
 
1008
-	if ( $echo )
1008
+	if ($echo)
1009 1009
 		echo $link;
1010 1010
 	else
1011 1011
 		return $link;
@@ -1021,23 +1021,23 @@  discard block
 block discarded – undo
1021 1021
  * @param string $query Optional. The query string to use. If empty the current query is used. Default empty.
1022 1022
  * @return string The search permalink.
1023 1023
  */
1024
-function get_search_link( $query = '' ) {
1024
+function get_search_link($query = '') {
1025 1025
 	global $wp_rewrite;
1026 1026
 
1027
-	if ( empty($query) )
1028
-		$search = get_search_query( false );
1027
+	if (empty($query))
1028
+		$search = get_search_query(false);
1029 1029
 	else
1030 1030
 		$search = stripslashes($query);
1031 1031
 
1032 1032
 	$permastruct = $wp_rewrite->get_search_permastruct();
1033 1033
 
1034
-	if ( empty( $permastruct ) ) {
1035
-		$link = home_url('?s=' . urlencode($search) );
1034
+	if (empty($permastruct)) {
1035
+		$link = home_url('?s='.urlencode($search));
1036 1036
 	} else {
1037 1037
 		$search = urlencode($search);
1038 1038
 		$search = str_replace('%2F', '/', $search); // %2F(/) is not valid within a URL, send it un-encoded.
1039
-		$link = str_replace( '%search%', $search, $permastruct );
1040
-		$link = home_url( user_trailingslashit( $link, 'search' ) );
1039
+		$link = str_replace('%search%', $search, $permastruct);
1040
+		$link = home_url(user_trailingslashit($link, 'search'));
1041 1041
 	}
1042 1042
 
1043 1043
 	/**
@@ -1048,7 +1048,7 @@  discard block
 block discarded – undo
1048 1048
 	 * @param string $link   Search permalink.
1049 1049
 	 * @param string $search The URL-encoded search term.
1050 1050
 	 */
1051
-	return apply_filters( 'search_link', $link, $search );
1051
+	return apply_filters('search_link', $link, $search);
1052 1052
 }
1053 1053
 
1054 1054
 /**
@@ -1066,12 +1066,12 @@  discard block
 block discarded – undo
1066 1066
 	global $wp_rewrite;
1067 1067
 	$link = get_search_link($search_query);
1068 1068
 
1069
-	if ( empty($feed) )
1069
+	if (empty($feed))
1070 1070
 		$feed = get_default_feed();
1071 1071
 
1072 1072
 	$permastruct = $wp_rewrite->get_search_permastruct();
1073 1073
 
1074
-	if ( empty($permastruct) ) {
1074
+	if (empty($permastruct)) {
1075 1075
 		$link = add_query_arg('feed', $feed, $link);
1076 1076
 	} else {
1077 1077
 		$link = trailingslashit($link);
@@ -1087,7 +1087,7 @@  discard block
 block discarded – undo
1087 1087
 	 * @param string $feed Feed type.
1088 1088
 	 * @param string $type The search type. One of 'posts' or 'comments'.
1089 1089
 	 */
1090
-	return apply_filters( 'search_feed_link', $link, $feed, 'posts' );
1090
+	return apply_filters('search_feed_link', $link, $feed, 'posts');
1091 1091
 }
1092 1092
 
1093 1093
 /**
@@ -1104,20 +1104,20 @@  discard block
 block discarded – undo
1104 1104
 function get_search_comments_feed_link($search_query = '', $feed = '') {
1105 1105
 	global $wp_rewrite;
1106 1106
 
1107
-	if ( empty($feed) )
1107
+	if (empty($feed))
1108 1108
 		$feed = get_default_feed();
1109 1109
 
1110 1110
 	$link = get_search_feed_link($search_query, $feed);
1111 1111
 
1112 1112
 	$permastruct = $wp_rewrite->get_search_permastruct();
1113 1113
 
1114
-	if ( empty($permastruct) )
1115
-		$link = add_query_arg('feed', 'comments-' . $feed, $link);
1114
+	if (empty($permastruct))
1115
+		$link = add_query_arg('feed', 'comments-'.$feed, $link);
1116 1116
 	else
1117 1117
 		$link = add_query_arg('withcomments', 1, $link);
1118 1118
 
1119 1119
 	/** This filter is documented in wp-includes/link-template.php */
1120
-	return apply_filters( 'search_feed_link', $link, $feed, 'comments' );
1120
+	return apply_filters('search_feed_link', $link, $feed, 'comments');
1121 1121
 }
1122 1122
 
1123 1123
 /**
@@ -1131,36 +1131,36 @@  discard block
 block discarded – undo
1131 1131
  * @param string $post_type Post type.
1132 1132
  * @return string|false The post type archive permalink.
1133 1133
  */
1134
-function get_post_type_archive_link( $post_type ) {
1134
+function get_post_type_archive_link($post_type) {
1135 1135
 	global $wp_rewrite;
1136
-	if ( ! $post_type_obj = get_post_type_object( $post_type ) )
1136
+	if ( ! $post_type_obj = get_post_type_object($post_type))
1137 1137
 		return false;
1138 1138
 
1139
-	if ( 'post' === $post_type ) {
1140
-		$show_on_front = get_option( 'show_on_front' );
1141
-		$page_for_posts  = get_option( 'page_for_posts' );
1139
+	if ('post' === $post_type) {
1140
+		$show_on_front = get_option('show_on_front');
1141
+		$page_for_posts = get_option('page_for_posts');
1142 1142
 
1143
-		if ( 'page' == $show_on_front && $page_for_posts ) {
1144
-			$link = get_permalink( $page_for_posts );
1143
+		if ('page' == $show_on_front && $page_for_posts) {
1144
+			$link = get_permalink($page_for_posts);
1145 1145
 		} else {
1146 1146
 			$link = get_home_url();
1147 1147
 		}
1148 1148
 		/** This filter is documented in wp-includes/link-template.php */
1149
-		return apply_filters( 'post_type_archive_link', $link, $post_type );
1149
+		return apply_filters('post_type_archive_link', $link, $post_type);
1150 1150
 	}
1151 1151
 
1152
-	if ( ! $post_type_obj->has_archive )
1152
+	if ( ! $post_type_obj->has_archive)
1153 1153
 		return false;
1154 1154
 
1155
-	if ( get_option( 'permalink_structure' ) && is_array( $post_type_obj->rewrite ) ) {
1156
-		$struct = ( true === $post_type_obj->has_archive ) ? $post_type_obj->rewrite['slug'] : $post_type_obj->has_archive;
1157
-		if ( $post_type_obj->rewrite['with_front'] )
1158
-			$struct = $wp_rewrite->front . $struct;
1155
+	if (get_option('permalink_structure') && is_array($post_type_obj->rewrite)) {
1156
+		$struct = (true === $post_type_obj->has_archive) ? $post_type_obj->rewrite['slug'] : $post_type_obj->has_archive;
1157
+		if ($post_type_obj->rewrite['with_front'])
1158
+			$struct = $wp_rewrite->front.$struct;
1159 1159
 		else
1160
-			$struct = $wp_rewrite->root . $struct;
1161
-		$link = home_url( user_trailingslashit( $struct, 'post_type_archive' ) );
1160
+			$struct = $wp_rewrite->root.$struct;
1161
+		$link = home_url(user_trailingslashit($struct, 'post_type_archive'));
1162 1162
 	} else {
1163
-		$link = home_url( '?post_type=' . $post_type );
1163
+		$link = home_url('?post_type='.$post_type);
1164 1164
 	}
1165 1165
 
1166 1166
 	/**
@@ -1171,7 +1171,7 @@  discard block
 block discarded – undo
1171 1171
 	 * @param string $link      The post type archive permalink.
1172 1172
 	 * @param string $post_type Post type name.
1173 1173
 	 */
1174
-	return apply_filters( 'post_type_archive_link', $link, $post_type );
1174
+	return apply_filters('post_type_archive_link', $link, $post_type);
1175 1175
 }
1176 1176
 
1177 1177
 /**
@@ -1183,22 +1183,22 @@  discard block
 block discarded – undo
1183 1183
  * @param string $feed      Optional. Feed type. Default empty.
1184 1184
  * @return string|false The post type feed permalink.
1185 1185
  */
1186
-function get_post_type_archive_feed_link( $post_type, $feed = '' ) {
1186
+function get_post_type_archive_feed_link($post_type, $feed = '') {
1187 1187
 	$default_feed = get_default_feed();
1188
-	if ( empty( $feed ) )
1188
+	if (empty($feed))
1189 1189
 		$feed = $default_feed;
1190 1190
 
1191
-	if ( ! $link = get_post_type_archive_link( $post_type ) )
1191
+	if ( ! $link = get_post_type_archive_link($post_type))
1192 1192
 		return false;
1193 1193
 
1194
-	$post_type_obj = get_post_type_object( $post_type );
1195
-	if ( get_option( 'permalink_structure' ) && is_array( $post_type_obj->rewrite ) && $post_type_obj->rewrite['feeds'] ) {
1196
-		$link = trailingslashit( $link );
1194
+	$post_type_obj = get_post_type_object($post_type);
1195
+	if (get_option('permalink_structure') && is_array($post_type_obj->rewrite) && $post_type_obj->rewrite['feeds']) {
1196
+		$link = trailingslashit($link);
1197 1197
 		$link .= 'feed/';
1198
-		if ( $feed != $default_feed )
1198
+		if ($feed != $default_feed)
1199 1199
 			$link .= "$feed/";
1200 1200
 	} else {
1201
-		$link = add_query_arg( 'feed', $feed, $link );
1201
+		$link = add_query_arg('feed', $feed, $link);
1202 1202
 	}
1203 1203
 
1204 1204
 	/**
@@ -1209,7 +1209,7 @@  discard block
 block discarded – undo
1209 1209
 	 * @param string $link The post type archive feed link.
1210 1210
 	 * @param string $feed Feed type.
1211 1211
 	 */
1212
-	return apply_filters( 'post_type_archive_feed_link', $link, $feed );
1212
+	return apply_filters('post_type_archive_feed_link', $link, $feed);
1213 1213
 }
1214 1214
 
1215 1215
 /**
@@ -1226,20 +1226,20 @@  discard block
 block discarded – undo
1226 1226
  *                                  post permalink. Default empty.
1227 1227
  * @return string|null URL used for the post preview, or null if the post does not exist.
1228 1228
  */
1229
-function get_preview_post_link( $post = null, $query_args = array(), $preview_link = '' ) {
1230
-	$post = get_post( $post );
1231
-	if ( ! $post ) {
1229
+function get_preview_post_link($post = null, $query_args = array(), $preview_link = '') {
1230
+	$post = get_post($post);
1231
+	if ( ! $post) {
1232 1232
 		return;
1233 1233
 	}
1234 1234
 
1235
-	$post_type_object = get_post_type_object( $post->post_type );
1236
-	if ( is_post_type_viewable( $post_type_object ) ) {
1237
-		if ( ! $preview_link ) {
1238
-			$preview_link = set_url_scheme( get_permalink( $post ) );
1235
+	$post_type_object = get_post_type_object($post->post_type);
1236
+	if (is_post_type_viewable($post_type_object)) {
1237
+		if ( ! $preview_link) {
1238
+			$preview_link = set_url_scheme(get_permalink($post));
1239 1239
 		}
1240 1240
 
1241 1241
 		$query_args['preview'] = 'true';
1242
-		$preview_link = add_query_arg( $query_args, $preview_link );
1242
+		$preview_link = add_query_arg($query_args, $preview_link);
1243 1243
 	}
1244 1244
 
1245 1245
 	/**
@@ -1251,7 +1251,7 @@  discard block
 block discarded – undo
1251 1251
 	 * @param string  $preview_link URL used for the post preview.
1252 1252
 	 * @param WP_Post $post         Post object.
1253 1253
 	 */
1254
-	return apply_filters( 'preview_post_link', $preview_link, $post );
1254
+	return apply_filters('preview_post_link', $preview_link, $post);
1255 1255
 }
1256 1256
 
1257 1257
 /**
@@ -1267,26 +1267,26 @@  discard block
 block discarded – undo
1267 1267
  * @return string|null The edit post link for the given post. null if the post type is invalid or does
1268 1268
  *                     not allow an editing UI.
1269 1269
  */
1270
-function get_edit_post_link( $id = 0, $context = 'display' ) {
1271
-	if ( ! $post = get_post( $id ) )
1270
+function get_edit_post_link($id = 0, $context = 'display') {
1271
+	if ( ! $post = get_post($id))
1272 1272
 		return;
1273 1273
 
1274
-	if ( 'revision' === $post->post_type )
1274
+	if ('revision' === $post->post_type)
1275 1275
 		$action = '';
1276
-	elseif ( 'display' == $context )
1276
+	elseif ('display' == $context)
1277 1277
 		$action = '&amp;action=edit';
1278 1278
 	else
1279 1279
 		$action = '&action=edit';
1280 1280
 
1281
-	$post_type_object = get_post_type_object( $post->post_type );
1282
-	if ( !$post_type_object )
1281
+	$post_type_object = get_post_type_object($post->post_type);
1282
+	if ( ! $post_type_object)
1283 1283
 		return;
1284 1284
 
1285
-	if ( !current_user_can( 'edit_post', $post->ID ) )
1285
+	if ( ! current_user_can('edit_post', $post->ID))
1286 1286
 		return;
1287 1287
 
1288
-	if ( $post_type_object->_edit_link ) {
1289
-		$link = admin_url( sprintf( $post_type_object->_edit_link . $action, $post->ID ) );
1288
+	if ($post_type_object->_edit_link) {
1289
+		$link = admin_url(sprintf($post_type_object->_edit_link.$action, $post->ID));
1290 1290
 	} else {
1291 1291
 		$link = '';
1292 1292
 	}
@@ -1301,7 +1301,7 @@  discard block
 block discarded – undo
1301 1301
 	 * @param string $context The link context. If set to 'display' then ampersands
1302 1302
 	 *                        are encoded.
1303 1303
 	 */
1304
-	return apply_filters( 'get_edit_post_link', $link, $post->ID, $context );
1304
+	return apply_filters('get_edit_post_link', $link, $post->ID, $context);
1305 1305
 }
1306 1306
 
1307 1307
 /**
@@ -1316,20 +1316,20 @@  discard block
 block discarded – undo
1316 1316
  * @param int    $id     Optional. Post ID. Default is the ID of the global `$post`.
1317 1317
  * @param string $class  Optional. Add custom class to link. Default 'post-edit-link'.
1318 1318
  */
1319
-function edit_post_link( $text = null, $before = '', $after = '', $id = 0, $class = 'post-edit-link' ) {
1320
-	if ( ! $post = get_post( $id ) ) {
1319
+function edit_post_link($text = null, $before = '', $after = '', $id = 0, $class = 'post-edit-link') {
1320
+	if ( ! $post = get_post($id)) {
1321 1321
 		return;
1322 1322
 	}
1323 1323
 
1324
-	if ( ! $url = get_edit_post_link( $post->ID ) ) {
1324
+	if ( ! $url = get_edit_post_link($post->ID)) {
1325 1325
 		return;
1326 1326
 	}
1327 1327
 
1328
-	if ( null === $text ) {
1329
-		$text = __( 'Edit This' );
1328
+	if (null === $text) {
1329
+		$text = __('Edit This');
1330 1330
 	}
1331 1331
 
1332
-	$link = '<a class="' . esc_attr( $class ) . '" href="' . esc_url( $url ) . '">' . $text . '</a>';
1332
+	$link = '<a class="'.esc_attr($class).'" href="'.esc_url($url).'">'.$text.'</a>';
1333 1333
 
1334 1334
 	/**
1335 1335
 	 * Filters the post edit link anchor tag.
@@ -1340,7 +1340,7 @@  discard block
 block discarded – undo
1340 1340
 	 * @param int    $post_id Post ID.
1341 1341
 	 * @param string $text    Anchor text.
1342 1342
 	 */
1343
-	echo $before . apply_filters( 'edit_post_link', $link, $post->ID, $text ) . $after;
1343
+	echo $before.apply_filters('edit_post_link', $link, $post->ID, $text).$after;
1344 1344
 }
1345 1345
 
1346 1346
 /**
@@ -1355,23 +1355,23 @@  discard block
 block discarded – undo
1355 1355
  * @param bool   $force_delete Optional. Whether to bypass trash and force deletion. Default false.
1356 1356
  * @return string|void The delete post link URL for the given post.
1357 1357
  */
1358
-function get_delete_post_link( $id = 0, $deprecated = '', $force_delete = false ) {
1359
-	if ( ! empty( $deprecated ) )
1360
-		_deprecated_argument( __FUNCTION__, '3.0.0' );
1358
+function get_delete_post_link($id = 0, $deprecated = '', $force_delete = false) {
1359
+	if ( ! empty($deprecated))
1360
+		_deprecated_argument(__FUNCTION__, '3.0.0');
1361 1361
 
1362
-	if ( !$post = get_post( $id ) )
1362
+	if ( ! $post = get_post($id))
1363 1363
 		return;
1364 1364
 
1365
-	$post_type_object = get_post_type_object( $post->post_type );
1366
-	if ( !$post_type_object )
1365
+	$post_type_object = get_post_type_object($post->post_type);
1366
+	if ( ! $post_type_object)
1367 1367
 		return;
1368 1368
 
1369
-	if ( !current_user_can( 'delete_post', $post->ID ) )
1369
+	if ( ! current_user_can('delete_post', $post->ID))
1370 1370
 		return;
1371 1371
 
1372
-	$action = ( $force_delete || !EMPTY_TRASH_DAYS ) ? 'delete' : 'trash';
1372
+	$action = ($force_delete || ! EMPTY_TRASH_DAYS) ? 'delete' : 'trash';
1373 1373
 
1374
-	$delete_link = add_query_arg( 'action', $action, admin_url( sprintf( $post_type_object->_edit_link, $post->ID ) ) );
1374
+	$delete_link = add_query_arg('action', $action, admin_url(sprintf($post_type_object->_edit_link, $post->ID)));
1375 1375
 
1376 1376
 	/**
1377 1377
 	 * Filters the post delete link.
@@ -1382,7 +1382,7 @@  discard block
 block discarded – undo
1382 1382
 	 * @param int    $post_id      Post ID.
1383 1383
 	 * @param bool   $force_delete Whether to bypass the trash and force deletion. Default false.
1384 1384
 	 */
1385
-	return apply_filters( 'get_delete_post_link', wp_nonce_url( $delete_link, "$action-post_{$post->ID}" ), $post->ID, $force_delete );
1385
+	return apply_filters('get_delete_post_link', wp_nonce_url($delete_link, "$action-post_{$post->ID}"), $post->ID, $force_delete);
1386 1386
 }
1387 1387
 
1388 1388
 /**
@@ -1393,13 +1393,13 @@  discard block
 block discarded – undo
1393 1393
  * @param int|WP_Comment $comment_id Optional. Comment ID or WP_Comment object.
1394 1394
  * @return string|void The edit comment link URL for the given comment.
1395 1395
  */
1396
-function get_edit_comment_link( $comment_id = 0 ) {
1397
-	$comment = get_comment( $comment_id );
1396
+function get_edit_comment_link($comment_id = 0) {
1397
+	$comment = get_comment($comment_id);
1398 1398
 
1399
-	if ( !current_user_can( 'edit_comment', $comment->comment_ID ) )
1399
+	if ( ! current_user_can('edit_comment', $comment->comment_ID))
1400 1400
 		return;
1401 1401
 
1402
-	$location = admin_url('comment.php?action=editcomment&amp;c=') . $comment->comment_ID;
1402
+	$location = admin_url('comment.php?action=editcomment&amp;c=').$comment->comment_ID;
1403 1403
 
1404 1404
 	/**
1405 1405
 	 * Filters the comment edit link.
@@ -1408,7 +1408,7 @@  discard block
 block discarded – undo
1408 1408
 	 *
1409 1409
 	 * @param string $location The edit link.
1410 1410
 	 */
1411
-	return apply_filters( 'get_edit_comment_link', $location );
1411
+	return apply_filters('get_edit_comment_link', $location);
1412 1412
 }
1413 1413
 
1414 1414
 /**
@@ -1420,18 +1420,18 @@  discard block
 block discarded – undo
1420 1420
  * @param string $before Optional. Display before edit link. Default empty.
1421 1421
  * @param string $after  Optional. Display after edit link. Default empty.
1422 1422
  */
1423
-function edit_comment_link( $text = null, $before = '', $after = '' ) {
1423
+function edit_comment_link($text = null, $before = '', $after = '') {
1424 1424
 	$comment = get_comment();
1425 1425
 
1426
-	if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) ) {
1426
+	if ( ! current_user_can('edit_comment', $comment->comment_ID)) {
1427 1427
 		return;
1428 1428
 	}
1429 1429
 
1430
-	if ( null === $text ) {
1431
-		$text = __( 'Edit This' );
1430
+	if (null === $text) {
1431
+		$text = __('Edit This');
1432 1432
 	}
1433 1433
 
1434
-	$link = '<a class="comment-edit-link" href="' . esc_url( get_edit_comment_link( $comment ) ) . '">' . $text . '</a>';
1434
+	$link = '<a class="comment-edit-link" href="'.esc_url(get_edit_comment_link($comment)).'">'.$text.'</a>';
1435 1435
 
1436 1436
 	/**
1437 1437
 	 * Filters the comment edit link anchor tag.
@@ -1442,7 +1442,7 @@  discard block
 block discarded – undo
1442 1442
 	 * @param int    $comment_id Comment ID.
1443 1443
 	 * @param string $text       Anchor text.
1444 1444
 	 */
1445
-	echo $before . apply_filters( 'edit_comment_link', $link, $comment->comment_ID, $text ) . $after;
1445
+	echo $before.apply_filters('edit_comment_link', $link, $comment->comment_ID, $text).$after;
1446 1446
 }
1447 1447
 
1448 1448
 /**
@@ -1453,13 +1453,13 @@  discard block
 block discarded – undo
1453 1453
  * @param int|stdClass $link Optional. Bookmark ID. Default is the id of the current bookmark.
1454 1454
  * @return string|void The edit bookmark link URL.
1455 1455
  */
1456
-function get_edit_bookmark_link( $link = 0 ) {
1457
-	$link = get_bookmark( $link );
1456
+function get_edit_bookmark_link($link = 0) {
1457
+	$link = get_bookmark($link);
1458 1458
 
1459
-	if ( !current_user_can('manage_links') )
1459
+	if ( ! current_user_can('manage_links'))
1460 1460
 		return;
1461 1461
 
1462
-	$location = admin_url('link.php?action=edit&amp;link_id=') . $link->link_id;
1462
+	$location = admin_url('link.php?action=edit&amp;link_id=').$link->link_id;
1463 1463
 
1464 1464
 	/**
1465 1465
 	 * Filters the bookmark edit link.
@@ -1469,7 +1469,7 @@  discard block
 block discarded – undo
1469 1469
 	 * @param string $location The edit link.
1470 1470
 	 * @param int    $link_id  Bookmark ID.
1471 1471
 	 */
1472
-	return apply_filters( 'get_edit_bookmark_link', $location, $link->link_id );
1472
+	return apply_filters('get_edit_bookmark_link', $location, $link->link_id);
1473 1473
 }
1474 1474
 
1475 1475
 /**
@@ -1482,16 +1482,16 @@  discard block
 block discarded – undo
1482 1482
  * @param string $after    Optional. Display after edit link. Default empty.
1483 1483
  * @param int    $bookmark Optional. Bookmark ID. Default is the current bookmark.
1484 1484
  */
1485
-function edit_bookmark_link( $link = '', $before = '', $after = '', $bookmark = null ) {
1485
+function edit_bookmark_link($link = '', $before = '', $after = '', $bookmark = null) {
1486 1486
 	$bookmark = get_bookmark($bookmark);
1487 1487
 
1488
-	if ( !current_user_can('manage_links') )
1488
+	if ( ! current_user_can('manage_links'))
1489 1489
 		return;
1490 1490
 
1491
-	if ( empty($link) )
1491
+	if (empty($link))
1492 1492
 		$link = __('Edit This');
1493 1493
 
1494
-	$link = '<a href="' . esc_url( get_edit_bookmark_link( $bookmark ) ) . '">' . $link . '</a>';
1494
+	$link = '<a href="'.esc_url(get_edit_bookmark_link($bookmark)).'">'.$link.'</a>';
1495 1495
 
1496 1496
 	/**
1497 1497
 	 * Filters the bookmark edit link anchor tag.
@@ -1501,7 +1501,7 @@  discard block
 block discarded – undo
1501 1501
 	 * @param string $link    Anchor tag for the edit link.
1502 1502
 	 * @param int    $link_id Bookmark ID.
1503 1503
 	 */
1504
-	echo $before . apply_filters( 'edit_bookmark_link', $link, $bookmark->link_id ) . $after;
1504
+	echo $before.apply_filters('edit_bookmark_link', $link, $bookmark->link_id).$after;
1505 1505
 }
1506 1506
 
1507 1507
 /**
@@ -1512,22 +1512,22 @@  discard block
 block discarded – undo
1512 1512
  * @param int $user_id Optional. User ID. Defaults to the current user.
1513 1513
  * @return string URL to edit user page or empty string.
1514 1514
  */
1515
-function get_edit_user_link( $user_id = null ) {
1516
-	if ( ! $user_id )
1515
+function get_edit_user_link($user_id = null) {
1516
+	if ( ! $user_id)
1517 1517
 		$user_id = get_current_user_id();
1518 1518
 
1519
-	if ( empty( $user_id ) || ! current_user_can( 'edit_user', $user_id ) )
1519
+	if (empty($user_id) || ! current_user_can('edit_user', $user_id))
1520 1520
 		return '';
1521 1521
 
1522
-	$user = get_userdata( $user_id );
1522
+	$user = get_userdata($user_id);
1523 1523
 
1524
-	if ( ! $user )
1524
+	if ( ! $user)
1525 1525
 		return '';
1526 1526
 
1527
-	if ( get_current_user_id() == $user->ID )
1528
-		$link = get_edit_profile_url( $user->ID );
1527
+	if (get_current_user_id() == $user->ID)
1528
+		$link = get_edit_profile_url($user->ID);
1529 1529
 	else
1530
-		$link = add_query_arg( 'user_id', $user->ID, self_admin_url( 'user-edit.php' ) );
1530
+		$link = add_query_arg('user_id', $user->ID, self_admin_url('user-edit.php'));
1531 1531
 
1532 1532
 	/**
1533 1533
 	 * Filters the user edit link.
@@ -1537,7 +1537,7 @@  discard block
 block discarded – undo
1537 1537
 	 * @param string $link    The edit link.
1538 1538
 	 * @param int    $user_id User ID.
1539 1539
 	 */
1540
-	return apply_filters( 'get_edit_user_link', $link, $user->ID );
1540
+	return apply_filters('get_edit_user_link', $link, $user->ID);
1541 1541
 }
1542 1542
 
1543 1543
 // Navigation links
@@ -1553,8 +1553,8 @@  discard block
 block discarded – undo
1553 1553
  * @return null|string|WP_Post Post object if successful. Null if global $post is not set. Empty string if no
1554 1554
  *                             corresponding post exists.
1555 1555
  */
1556
-function get_previous_post( $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
1557
-	return get_adjacent_post( $in_same_term, $excluded_terms, true, $taxonomy );
1556
+function get_previous_post($in_same_term = false, $excluded_terms = '', $taxonomy = 'category') {
1557
+	return get_adjacent_post($in_same_term, $excluded_terms, true, $taxonomy);
1558 1558
 }
1559 1559
 
1560 1560
 /**
@@ -1568,8 +1568,8 @@  discard block
 block discarded – undo
1568 1568
  * @return null|string|WP_Post Post object if successful. Null if global $post is not set. Empty string if no
1569 1569
  *                             corresponding post exists.
1570 1570
  */
1571
-function get_next_post( $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
1572
-	return get_adjacent_post( $in_same_term, $excluded_terms, false, $taxonomy );
1571
+function get_next_post($in_same_term = false, $excluded_terms = '', $taxonomy = 'category') {
1572
+	return get_adjacent_post($in_same_term, $excluded_terms, false, $taxonomy);
1573 1573
 }
1574 1574
 
1575 1575
 /**
@@ -1588,10 +1588,10 @@  discard block
 block discarded – undo
1588 1588
  * @return null|string|WP_Post Post object if successful. Null if global $post is not set. Empty string if no
1589 1589
  *                             corresponding post exists.
1590 1590
  */
1591
-function get_adjacent_post( $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category' ) {
1591
+function get_adjacent_post($in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category') {
1592 1592
 	global $wpdb;
1593 1593
 
1594
-	if ( ( ! $post = get_post() ) || ! taxonomy_exists( $taxonomy ) )
1594
+	if (( ! $post = get_post()) || ! taxonomy_exists($taxonomy))
1595 1595
 		return null;
1596 1596
 
1597 1597
 	$current_post_date = $post->post_date;
@@ -1600,35 +1600,35 @@  discard block
 block discarded – undo
1600 1600
 	$where = '';
1601 1601
 	$adjacent = $previous ? 'previous' : 'next';
1602 1602
 
1603
-	if ( $in_same_term || ! empty( $excluded_terms ) ) {
1604
-		if ( ! empty( $excluded_terms ) && ! is_array( $excluded_terms ) ) {
1603
+	if ($in_same_term || ! empty($excluded_terms)) {
1604
+		if ( ! empty($excluded_terms) && ! is_array($excluded_terms)) {
1605 1605
 			// back-compat, $excluded_terms used to be $excluded_terms with IDs separated by " and "
1606
-			if ( false !== strpos( $excluded_terms, ' and ' ) ) {
1607
-				_deprecated_argument( __FUNCTION__, '3.3.0', sprintf( __( 'Use commas instead of %s to separate excluded terms.' ), "'and'" ) );
1608
-				$excluded_terms = explode( ' and ', $excluded_terms );
1606
+			if (false !== strpos($excluded_terms, ' and ')) {
1607
+				_deprecated_argument(__FUNCTION__, '3.3.0', sprintf(__('Use commas instead of %s to separate excluded terms.'), "'and'"));
1608
+				$excluded_terms = explode(' and ', $excluded_terms);
1609 1609
 			} else {
1610
-				$excluded_terms = explode( ',', $excluded_terms );
1610
+				$excluded_terms = explode(',', $excluded_terms);
1611 1611
 			}
1612 1612
 
1613
-			$excluded_terms = array_map( 'intval', $excluded_terms );
1613
+			$excluded_terms = array_map('intval', $excluded_terms);
1614 1614
 		}
1615 1615
 
1616
-		if ( $in_same_term ) {
1616
+		if ($in_same_term) {
1617 1617
 			$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";
1618
-			$where .= $wpdb->prepare( "AND tt.taxonomy = %s", $taxonomy );
1618
+			$where .= $wpdb->prepare("AND tt.taxonomy = %s", $taxonomy);
1619 1619
 
1620
-			if ( ! is_object_in_taxonomy( $post->post_type, $taxonomy ) )
1620
+			if ( ! is_object_in_taxonomy($post->post_type, $taxonomy))
1621 1621
 				return '';
1622
-			$term_array = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'ids' ) );
1622
+			$term_array = wp_get_object_terms($post->ID, $taxonomy, array('fields' => 'ids'));
1623 1623
 
1624 1624
 			// Remove any exclusions from the term array to include.
1625
-			$term_array = array_diff( $term_array, (array) $excluded_terms );
1626
-			$term_array = array_map( 'intval', $term_array );
1625
+			$term_array = array_diff($term_array, (array) $excluded_terms);
1626
+			$term_array = array_map('intval', $term_array);
1627 1627
 
1628
-			if ( ! $term_array || is_wp_error( $term_array ) )
1628
+			if ( ! $term_array || is_wp_error($term_array))
1629 1629
 				return '';
1630 1630
 
1631
-			$where .= " AND tt.term_id IN (" . implode( ',', $term_array ) . ")";
1631
+			$where .= " AND tt.term_id IN (".implode(',', $term_array).")";
1632 1632
 		}
1633 1633
 
1634 1634
 		/**
@@ -1641,21 +1641,21 @@  discard block
 block discarded – undo
1641 1641
 		 *
1642 1642
 		 * @param string $excluded_terms Array of excluded term IDs.
1643 1643
 		 */
1644
-		$excluded_terms = apply_filters( "get_{$adjacent}_post_excluded_terms", $excluded_terms );
1644
+		$excluded_terms = apply_filters("get_{$adjacent}_post_excluded_terms", $excluded_terms);
1645 1645
 
1646
-		if ( ! empty( $excluded_terms ) ) {
1647
-			$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 ) ) . ') )';
1646
+		if ( ! empty($excluded_terms)) {
1647
+			$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)).') )';
1648 1648
 		}
1649 1649
 	}
1650 1650
 
1651 1651
 	// 'post_status' clause depends on the current user.
1652
-	if ( is_user_logged_in() ) {
1652
+	if (is_user_logged_in()) {
1653 1653
 		$user_id = get_current_user_id();
1654 1654
 
1655
-		$post_type_object = get_post_type_object( $post->post_type );
1656
-		if ( empty( $post_type_object ) ) {
1655
+		$post_type_object = get_post_type_object($post->post_type);
1656
+		if (empty($post_type_object)) {
1657 1657
 			$post_type_cap    = $post->post_type;
1658
-			$read_private_cap = 'read_private_' . $post_type_cap . 's';
1658
+			$read_private_cap = 'read_private_'.$post_type_cap.'s';
1659 1659
 		} else {
1660 1660
 			$read_private_cap = $post_type_object->cap->read_private_posts;
1661 1661
 		}
@@ -1664,13 +1664,13 @@  discard block
 block discarded – undo
1664 1664
 		 * Results should include private posts belonging to the current user, or private posts where the
1665 1665
 		 * current user has the 'read_private_posts' cap.
1666 1666
 		 */
1667
-		$private_states = get_post_stati( array( 'private' => true ) );
1667
+		$private_states = get_post_stati(array('private' => true));
1668 1668
 		$where .= " AND ( p.post_status = 'publish'";
1669
-		foreach ( (array) $private_states as $state ) {
1670
-			if ( current_user_can( $read_private_cap ) ) {
1671
-				$where .= $wpdb->prepare( " OR p.post_status = %s", $state );
1669
+		foreach ((array) $private_states as $state) {
1670
+			if (current_user_can($read_private_cap)) {
1671
+				$where .= $wpdb->prepare(" OR p.post_status = %s", $state);
1672 1672
 			} else {
1673
-				$where .= $wpdb->prepare( " OR (p.post_author = %d AND p.post_status = %s)", $user_id, $state );
1673
+				$where .= $wpdb->prepare(" OR (p.post_author = %d AND p.post_status = %s)", $user_id, $state);
1674 1674
 			}
1675 1675
 		}
1676 1676
 		$where .= " )";
@@ -1696,7 +1696,7 @@  discard block
 block discarded – undo
1696 1696
 	 * @param string  $taxonomy       Taxonomy. Used to identify the term used when `$in_same_term` is true.
1697 1697
 	 * @param WP_Post $post           WP_Post object.
1698 1698
 	 */
1699
-	$join = apply_filters( "get_{$adjacent}_post_join", $join, $in_same_term, $excluded_terms, $taxonomy, $post );
1699
+	$join = apply_filters("get_{$adjacent}_post_join", $join, $in_same_term, $excluded_terms, $taxonomy, $post);
1700 1700
 
1701 1701
 	/**
1702 1702
 	 * Filters the WHERE clause in the SQL for an adjacent post query.
@@ -1713,7 +1713,7 @@  discard block
 block discarded – undo
1713 1713
 	 * @param string $taxonomy       Taxonomy. Used to identify the term used when `$in_same_term` is true.
1714 1714
 	 * @param WP_Post $post           WP_Post object.
1715 1715
 	 */
1716
-	$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 );
1716
+	$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);
1717 1717
 
1718 1718
 	/**
1719 1719
 	 * Filters the ORDER BY clause in the SQL for an adjacent post query.
@@ -1727,25 +1727,25 @@  discard block
 block discarded – undo
1727 1727
 	 * @param string $order_by The `ORDER BY` clause in the SQL.
1728 1728
 	 * @param WP_Post $post    WP_Post object.
1729 1729
 	 */
1730
-	$sort  = apply_filters( "get_{$adjacent}_post_sort", "ORDER BY p.post_date $order LIMIT 1", $post );
1730
+	$sort  = apply_filters("get_{$adjacent}_post_sort", "ORDER BY p.post_date $order LIMIT 1", $post);
1731 1731
 
1732 1732
 	$query = "SELECT p.ID FROM $wpdb->posts AS p $join $where $sort";
1733
-	$query_key = 'adjacent_post_' . md5( $query );
1734
-	$result = wp_cache_get( $query_key, 'counts' );
1735
-	if ( false !== $result ) {
1736
-		if ( $result )
1737
-			$result = get_post( $result );
1733
+	$query_key = 'adjacent_post_'.md5($query);
1734
+	$result = wp_cache_get($query_key, 'counts');
1735
+	if (false !== $result) {
1736
+		if ($result)
1737
+			$result = get_post($result);
1738 1738
 		return $result;
1739 1739
 	}
1740 1740
 
1741
-	$result = $wpdb->get_var( $query );
1742
-	if ( null === $result )
1741
+	$result = $wpdb->get_var($query);
1742
+	if (null === $result)
1743 1743
 		$result = '';
1744 1744
 
1745
-	wp_cache_set( $query_key, $result, 'counts' );
1745
+	wp_cache_set($query_key, $result, 'counts');
1746 1746
 
1747
-	if ( $result )
1748
-		$result = get_post( $result );
1747
+	if ($result)
1748
+		$result = get_post($result);
1749 1749
 
1750 1750
 	return $result;
1751 1751
 }
@@ -1764,28 +1764,28 @@  discard block
 block discarded – undo
1764 1764
  * @param string       $taxonomy       Optional. Taxonomy, if $in_same_term is true. Default 'category'.
1765 1765
  * @return string|void The adjacent post relational link URL.
1766 1766
  */
1767
-function get_adjacent_post_rel_link( $title = '%title', $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category' ) {
1768
-	if ( $previous && is_attachment() && $post = get_post() )
1769
-		$post = get_post( $post->post_parent );
1767
+function get_adjacent_post_rel_link($title = '%title', $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category') {
1768
+	if ($previous && is_attachment() && $post = get_post())
1769
+		$post = get_post($post->post_parent);
1770 1770
 	else
1771
-		$post = get_adjacent_post( $in_same_term, $excluded_terms, $previous, $taxonomy );
1771
+		$post = get_adjacent_post($in_same_term, $excluded_terms, $previous, $taxonomy);
1772 1772
 
1773
-	if ( empty( $post ) )
1773
+	if (empty($post))
1774 1774
 		return;
1775 1775
 
1776
-	$post_title = the_title_attribute( array( 'echo' => false, 'post' => $post ) );
1776
+	$post_title = the_title_attribute(array('echo' => false, 'post' => $post));
1777 1777
 
1778
-	if ( empty( $post_title ) )
1779
-		$post_title = $previous ? __( 'Previous Post' ) : __( 'Next Post' );
1778
+	if (empty($post_title))
1779
+		$post_title = $previous ? __('Previous Post') : __('Next Post');
1780 1780
 
1781
-	$date = mysql2date( get_option( 'date_format' ), $post->post_date );
1781
+	$date = mysql2date(get_option('date_format'), $post->post_date);
1782 1782
 
1783
-	$title = str_replace( '%title', $post_title, $title );
1784
-	$title = str_replace( '%date', $date, $title );
1783
+	$title = str_replace('%title', $post_title, $title);
1784
+	$title = str_replace('%date', $date, $title);
1785 1785
 
1786 1786
 	$link = $previous ? "<link rel='prev' title='" : "<link rel='next' title='";
1787
-	$link .= esc_attr( $title );
1788
-	$link .= "' href='" . get_permalink( $post ) . "' />\n";
1787
+	$link .= esc_attr($title);
1788
+	$link .= "' href='".get_permalink($post)."' />\n";
1789 1789
 
1790 1790
 	$adjacent = $previous ? 'previous' : 'next';
1791 1791
 
@@ -1799,7 +1799,7 @@  discard block
 block discarded – undo
1799 1799
 	 *
1800 1800
 	 * @param string $link The relational link.
1801 1801
 	 */
1802
-	return apply_filters( "{$adjacent}_post_rel_link", $link );
1802
+	return apply_filters("{$adjacent}_post_rel_link", $link);
1803 1803
 }
1804 1804
 
1805 1805
 /**
@@ -1812,9 +1812,9 @@  discard block
 block discarded – undo
1812 1812
  * @param array|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs. Default empty.
1813 1813
  * @param string       $taxonomy       Optional. Taxonomy, if $in_same_term is true. Default 'category'.
1814 1814
  */
1815
-function adjacent_posts_rel_link( $title = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
1816
-	echo get_adjacent_post_rel_link( $title, $in_same_term, $excluded_terms, true, $taxonomy );
1817
-	echo get_adjacent_post_rel_link( $title, $in_same_term, $excluded_terms, false, $taxonomy );
1815
+function adjacent_posts_rel_link($title = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category') {
1816
+	echo get_adjacent_post_rel_link($title, $in_same_term, $excluded_terms, true, $taxonomy);
1817
+	echo get_adjacent_post_rel_link($title, $in_same_term, $excluded_terms, false, $taxonomy);
1818 1818
 }
1819 1819
 
1820 1820
 /**
@@ -1828,7 +1828,7 @@  discard block
 block discarded – undo
1828 1828
  * @see adjacent_posts_rel_link()
1829 1829
  */
1830 1830
 function adjacent_posts_rel_link_wp_head() {
1831
-	if ( ! is_single() || is_attachment() ) {
1831
+	if ( ! is_single() || is_attachment()) {
1832 1832
 		return;
1833 1833
 	}
1834 1834
 	adjacent_posts_rel_link();
@@ -1846,8 +1846,8 @@  discard block
 block discarded – undo
1846 1846
  * @param array|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs. Default empty.
1847 1847
  * @param string       $taxonomy       Optional. Taxonomy, if $in_same_term is true. Default 'category'.
1848 1848
  */
1849
-function next_post_rel_link( $title = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
1850
-	echo get_adjacent_post_rel_link( $title, $in_same_term, $excluded_terms, false, $taxonomy );
1849
+function next_post_rel_link($title = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category') {
1850
+	echo get_adjacent_post_rel_link($title, $in_same_term, $excluded_terms, false, $taxonomy);
1851 1851
 }
1852 1852
 
1853 1853
 /**
@@ -1862,8 +1862,8 @@  discard block
 block discarded – undo
1862 1862
  * @param array|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs. Default true.
1863 1863
  * @param string       $taxonomy       Optional. Taxonomy, if $in_same_term is true. Default 'category'.
1864 1864
  */
1865
-function prev_post_rel_link( $title = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
1866
-	echo get_adjacent_post_rel_link( $title, $in_same_term, $excluded_terms, true, $taxonomy );
1865
+function prev_post_rel_link($title = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category') {
1866
+	echo get_adjacent_post_rel_link($title, $in_same_term, $excluded_terms, true, $taxonomy);
1867 1867
 }
1868 1868
 
1869 1869
 /**
@@ -1882,9 +1882,9 @@  discard block
 block discarded – undo
1882 1882
  * @param string       $taxonomy       Optional. Taxonomy, if $in_same_term is true. Default 'category'.
1883 1883
  * @return null|array Array containing the boundary post object if successful, null otherwise.
1884 1884
  */
1885
-function get_boundary_post( $in_same_term = false, $excluded_terms = '', $start = true, $taxonomy = 'category' ) {
1885
+function get_boundary_post($in_same_term = false, $excluded_terms = '', $start = true, $taxonomy = 'category') {
1886 1886
 	$post = get_post();
1887
-	if ( ! $post || ! is_single() || is_attachment() || ! taxonomy_exists( $taxonomy ) )
1887
+	if ( ! $post || ! is_single() || is_attachment() || ! taxonomy_exists($taxonomy))
1888 1888
 		return null;
1889 1889
 
1890 1890
 	$query_args = array(
@@ -1896,34 +1896,34 @@  discard block
 block discarded – undo
1896 1896
 
1897 1897
 	$term_array = array();
1898 1898
 
1899
-	if ( ! is_array( $excluded_terms ) ) {
1900
-		if ( ! empty( $excluded_terms ) )
1901
-			$excluded_terms = explode( ',', $excluded_terms );
1899
+	if ( ! is_array($excluded_terms)) {
1900
+		if ( ! empty($excluded_terms))
1901
+			$excluded_terms = explode(',', $excluded_terms);
1902 1902
 		else
1903 1903
 			$excluded_terms = array();
1904 1904
 	}
1905 1905
 
1906
-	if ( $in_same_term || ! empty( $excluded_terms ) ) {
1907
-		if ( $in_same_term )
1908
-			$term_array = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'ids' ) );
1906
+	if ($in_same_term || ! empty($excluded_terms)) {
1907
+		if ($in_same_term)
1908
+			$term_array = wp_get_object_terms($post->ID, $taxonomy, array('fields' => 'ids'));
1909 1909
 
1910
-		if ( ! empty( $excluded_terms ) ) {
1911
-			$excluded_terms = array_map( 'intval', $excluded_terms );
1912
-			$excluded_terms = array_diff( $excluded_terms, $term_array );
1910
+		if ( ! empty($excluded_terms)) {
1911
+			$excluded_terms = array_map('intval', $excluded_terms);
1912
+			$excluded_terms = array_diff($excluded_terms, $term_array);
1913 1913
 
1914 1914
 			$inverse_terms = array();
1915
-			foreach ( $excluded_terms as $excluded_term )
1915
+			foreach ($excluded_terms as $excluded_term)
1916 1916
 				$inverse_terms[] = $excluded_term * -1;
1917 1917
 			$excluded_terms = $inverse_terms;
1918 1918
 		}
1919 1919
 
1920
-		$query_args[ 'tax_query' ] = array( array(
1920
+		$query_args['tax_query'] = array(array(
1921 1921
 			'taxonomy' => $taxonomy,
1922
-			'terms' => array_merge( $term_array, $excluded_terms )
1923
-		) );
1922
+			'terms' => array_merge($term_array, $excluded_terms)
1923
+		));
1924 1924
 	}
1925 1925
 
1926
-	return get_posts( $query_args );
1926
+	return get_posts($query_args);
1927 1927
 }
1928 1928
 
1929 1929
 /**
@@ -1938,8 +1938,8 @@  discard block
 block discarded – undo
1938 1938
  * @param string       $taxonomy       Optional. Taxonomy, if $in_same_term is true. Default 'category'.
1939 1939
  * @return string The link URL of the previous post in relation to the current post.
1940 1940
  */
1941
-function get_previous_post_link( $format = '&laquo; %link', $link = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
1942
-	return get_adjacent_post_link( $format, $link, $in_same_term, $excluded_terms, true, $taxonomy );
1941
+function get_previous_post_link($format = '&laquo; %link', $link = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category') {
1942
+	return get_adjacent_post_link($format, $link, $in_same_term, $excluded_terms, true, $taxonomy);
1943 1943
 }
1944 1944
 
1945 1945
 /**
@@ -1955,8 +1955,8 @@  discard block
 block discarded – undo
1955 1955
  * @param array|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs. Default empty.
1956 1956
  * @param string       $taxonomy       Optional. Taxonomy, if $in_same_term is true. Default 'category'.
1957 1957
  */
1958
-function previous_post_link( $format = '&laquo; %link', $link = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
1959
-	echo get_previous_post_link( $format, $link, $in_same_term, $excluded_terms, $taxonomy );
1958
+function previous_post_link($format = '&laquo; %link', $link = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category') {
1959
+	echo get_previous_post_link($format, $link, $in_same_term, $excluded_terms, $taxonomy);
1960 1960
 }
1961 1961
 
1962 1962
 /**
@@ -1971,8 +1971,8 @@  discard block
 block discarded – undo
1971 1971
  * @param string       $taxonomy       Optional. Taxonomy, if $in_same_term is true. Default 'category'.
1972 1972
  * @return string The link URL of the next post in relation to the current post.
1973 1973
  */
1974
-function get_next_post_link( $format = '%link &raquo;', $link = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
1975
-	return get_adjacent_post_link( $format, $link, $in_same_term, $excluded_terms, false, $taxonomy );
1974
+function get_next_post_link($format = '%link &raquo;', $link = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category') {
1975
+	return get_adjacent_post_link($format, $link, $in_same_term, $excluded_terms, false, $taxonomy);
1976 1976
 }
1977 1977
 
1978 1978
 /**
@@ -1987,8 +1987,8 @@  discard block
 block discarded – undo
1987 1987
  * @param array|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs. Default empty.
1988 1988
  * @param string       $taxonomy       Optional. Taxonomy, if $in_same_term is true. Default 'category'.
1989 1989
  */
1990
-function next_post_link( $format = '%link &raquo;', $link = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
1991
-	 echo get_next_post_link( $format, $link, $in_same_term, $excluded_terms, $taxonomy );
1990
+function next_post_link($format = '%link &raquo;', $link = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category') {
1991
+	 echo get_next_post_link($format, $link, $in_same_term, $excluded_terms, $taxonomy);
1992 1992
 }
1993 1993
 
1994 1994
 /**
@@ -2006,32 +2006,32 @@  discard block
 block discarded – undo
2006 2006
  * @param string       $taxonomy       Optional. Taxonomy, if $in_same_term is true. Default 'category'.
2007 2007
  * @return string The link URL of the previous or next post in relation to the current post.
2008 2008
  */
2009
-function get_adjacent_post_link( $format, $link, $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category' ) {
2010
-	if ( $previous && is_attachment() )
2011
-		$post = get_post( get_post()->post_parent );
2009
+function get_adjacent_post_link($format, $link, $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category') {
2010
+	if ($previous && is_attachment())
2011
+		$post = get_post(get_post()->post_parent);
2012 2012
 	else
2013
-		$post = get_adjacent_post( $in_same_term, $excluded_terms, $previous, $taxonomy );
2013
+		$post = get_adjacent_post($in_same_term, $excluded_terms, $previous, $taxonomy);
2014 2014
 
2015
-	if ( ! $post ) {
2015
+	if ( ! $post) {
2016 2016
 		$output = '';
2017 2017
 	} else {
2018 2018
 		$title = $post->post_title;
2019 2019
 
2020
-		if ( empty( $post->post_title ) )
2021
-			$title = $previous ? __( 'Previous Post' ) : __( 'Next Post' );
2020
+		if (empty($post->post_title))
2021
+			$title = $previous ? __('Previous Post') : __('Next Post');
2022 2022
 
2023 2023
 		/** This filter is documented in wp-includes/post-template.php */
2024
-		$title = apply_filters( 'the_title', $title, $post->ID );
2024
+		$title = apply_filters('the_title', $title, $post->ID);
2025 2025
 
2026
-		$date = mysql2date( get_option( 'date_format' ), $post->post_date );
2026
+		$date = mysql2date(get_option('date_format'), $post->post_date);
2027 2027
 		$rel = $previous ? 'prev' : 'next';
2028 2028
 
2029
-		$string = '<a href="' . get_permalink( $post ) . '" rel="'.$rel.'">';
2030
-		$inlink = str_replace( '%title', $title, $link );
2031
-		$inlink = str_replace( '%date', $date, $inlink );
2032
-		$inlink = $string . $inlink . '</a>';
2029
+		$string = '<a href="'.get_permalink($post).'" rel="'.$rel.'">';
2030
+		$inlink = str_replace('%title', $title, $link);
2031
+		$inlink = str_replace('%date', $date, $inlink);
2032
+		$inlink = $string.$inlink.'</a>';
2033 2033
 
2034
-		$output = str_replace( '%link', $inlink, $format );
2034
+		$output = str_replace('%link', $inlink, $format);
2035 2035
 	}
2036 2036
 
2037 2037
 	$adjacent = $previous ? 'previous' : 'next';
@@ -2051,7 +2051,7 @@  discard block
 block discarded – undo
2051 2051
 	 * @param WP_Post $post     The adjacent post.
2052 2052
 	 * @param string  $adjacent Whether the post is previous or next.
2053 2053
 	 */
2054
-	return apply_filters( "{$adjacent}_post_link", $output, $format, $link, $post, $adjacent );
2054
+	return apply_filters("{$adjacent}_post_link", $output, $format, $link, $post, $adjacent);
2055 2055
 }
2056 2056
 
2057 2057
 /**
@@ -2068,8 +2068,8 @@  discard block
 block discarded – undo
2068 2068
  * @param bool         $previous       Optional. Whether to display link to previous or next post. Default true.
2069 2069
  * @param string       $taxonomy       Optional. Taxonomy, if $in_same_term is true. Default 'category'.
2070 2070
  */
2071
-function adjacent_post_link( $format, $link, $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category' ) {
2072
-	echo get_adjacent_post_link( $format, $link, $in_same_term, $excluded_terms, $previous, $taxonomy );
2071
+function adjacent_post_link($format, $link, $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category') {
2072
+	echo get_adjacent_post_link($format, $link, $in_same_term, $excluded_terms, $previous, $taxonomy);
2073 2073
 }
2074 2074
 
2075 2075
 /**
@@ -2084,53 +2084,53 @@  discard block
 block discarded – undo
2084 2084
  * 	                    Otherwise, prepares the URL with esc_url_raw().
2085 2085
  * @return string The link URL for the given page number.
2086 2086
  */
2087
-function get_pagenum_link($pagenum = 1, $escape = true ) {
2087
+function get_pagenum_link($pagenum = 1, $escape = true) {
2088 2088
 	global $wp_rewrite;
2089 2089
 
2090 2090
 	$pagenum = (int) $pagenum;
2091 2091
 
2092
-	$request = remove_query_arg( 'paged' );
2092
+	$request = remove_query_arg('paged');
2093 2093
 
2094 2094
 	$home_root = parse_url(home_url());
2095
-	$home_root = ( isset($home_root['path']) ) ? $home_root['path'] : '';
2096
-	$home_root = preg_quote( $home_root, '|' );
2095
+	$home_root = (isset($home_root['path'])) ? $home_root['path'] : '';
2096
+	$home_root = preg_quote($home_root, '|');
2097 2097
 
2098
-	$request = preg_replace('|^'. $home_root . '|i', '', $request);
2098
+	$request = preg_replace('|^'.$home_root.'|i', '', $request);
2099 2099
 	$request = preg_replace('|^/+|', '', $request);
2100 2100
 
2101
-	if ( !$wp_rewrite->using_permalinks() || is_admin() ) {
2102
-		$base = trailingslashit( get_bloginfo( 'url' ) );
2101
+	if ( ! $wp_rewrite->using_permalinks() || is_admin()) {
2102
+		$base = trailingslashit(get_bloginfo('url'));
2103 2103
 
2104
-		if ( $pagenum > 1 ) {
2105
-			$result = add_query_arg( 'paged', $pagenum, $base . $request );
2104
+		if ($pagenum > 1) {
2105
+			$result = add_query_arg('paged', $pagenum, $base.$request);
2106 2106
 		} else {
2107
-			$result = $base . $request;
2107
+			$result = $base.$request;
2108 2108
 		}
2109 2109
 	} else {
2110 2110
 		$qs_regex = '|\?.*?$|';
2111
-		preg_match( $qs_regex, $request, $qs_match );
2111
+		preg_match($qs_regex, $request, $qs_match);
2112 2112
 
2113
-		if ( !empty( $qs_match[0] ) ) {
2113
+		if ( ! empty($qs_match[0])) {
2114 2114
 			$query_string = $qs_match[0];
2115
-			$request = preg_replace( $qs_regex, '', $request );
2115
+			$request = preg_replace($qs_regex, '', $request);
2116 2116
 		} else {
2117 2117
 			$query_string = '';
2118 2118
 		}
2119 2119
 
2120
-		$request = preg_replace( "|$wp_rewrite->pagination_base/\d+/?$|", '', $request);
2121
-		$request = preg_replace( '|^' . preg_quote( $wp_rewrite->index, '|' ) . '|i', '', $request);
2120
+		$request = preg_replace("|$wp_rewrite->pagination_base/\d+/?$|", '', $request);
2121
+		$request = preg_replace('|^'.preg_quote($wp_rewrite->index, '|').'|i', '', $request);
2122 2122
 		$request = ltrim($request, '/');
2123 2123
 
2124
-		$base = trailingslashit( get_bloginfo( 'url' ) );
2124
+		$base = trailingslashit(get_bloginfo('url'));
2125 2125
 
2126
-		if ( $wp_rewrite->using_index_permalinks() && ( $pagenum > 1 || '' != $request ) )
2127
-			$base .= $wp_rewrite->index . '/';
2126
+		if ($wp_rewrite->using_index_permalinks() && ($pagenum > 1 || '' != $request))
2127
+			$base .= $wp_rewrite->index.'/';
2128 2128
 
2129
-		if ( $pagenum > 1 ) {
2130
-			$request = ( ( !empty( $request ) ) ? trailingslashit( $request ) : $request ) . user_trailingslashit( $wp_rewrite->pagination_base . "/" . $pagenum, 'paged' );
2129
+		if ($pagenum > 1) {
2130
+			$request = (( ! empty($request)) ? trailingslashit($request) : $request).user_trailingslashit($wp_rewrite->pagination_base."/".$pagenum, 'paged');
2131 2131
 		}
2132 2132
 
2133
-		$result = $base . $request . $query_string;
2133
+		$result = $base.$request.$query_string;
2134 2134
 	}
2135 2135
 
2136 2136
 	/**
@@ -2140,12 +2140,12 @@  discard block
 block discarded – undo
2140 2140
 	 *
2141 2141
 	 * @param string $result The page number link.
2142 2142
 	 */
2143
-	$result = apply_filters( 'get_pagenum_link', $result );
2143
+	$result = apply_filters('get_pagenum_link', $result);
2144 2144
 
2145
-	if ( $escape )
2146
-		return esc_url( $result );
2145
+	if ($escape)
2146
+		return esc_url($result);
2147 2147
 	else
2148
-		return esc_url_raw( $result );
2148
+		return esc_url_raw($result);
2149 2149
 }
2150 2150
 
2151 2151
 /**
@@ -2163,11 +2163,11 @@  discard block
 block discarded – undo
2163 2163
 function get_next_posts_page_link($max_page = 0) {
2164 2164
 	global $paged;
2165 2165
 
2166
-	if ( !is_single() ) {
2167
-		if ( !$paged )
2166
+	if ( ! is_single()) {
2167
+		if ( ! $paged)
2168 2168
 			$paged = 1;
2169 2169
 		$nextpage = intval($paged) + 1;
2170
-		if ( !$max_page || $max_page >= $nextpage )
2170
+		if ( ! $max_page || $max_page >= $nextpage)
2171 2171
 			return get_pagenum_link($nextpage);
2172 2172
 	}
2173 2173
 }
@@ -2181,10 +2181,10 @@  discard block
 block discarded – undo
2181 2181
  * @param bool  $echo     Optional. Whether to echo the link. Default true.
2182 2182
  * @return string|void The link URL for next posts page if `$echo = false`.
2183 2183
  */
2184
-function next_posts( $max_page = 0, $echo = true ) {
2185
-	$output = esc_url( get_next_posts_page_link( $max_page ) );
2184
+function next_posts($max_page = 0, $echo = true) {
2185
+	$output = esc_url(get_next_posts_page_link($max_page));
2186 2186
 
2187
-	if ( $echo )
2187
+	if ($echo)
2188 2188
 		echo $output;
2189 2189
 	else
2190 2190
 		return $output;
@@ -2202,21 +2202,21 @@  discard block
 block discarded – undo
2202 2202
  * @param int    $max_page Optional. Max pages. Default 0.
2203 2203
  * @return string|void HTML-formatted next posts page link.
2204 2204
  */
2205
-function get_next_posts_link( $label = null, $max_page = 0 ) {
2205
+function get_next_posts_link($label = null, $max_page = 0) {
2206 2206
 	global $paged, $wp_query;
2207 2207
 
2208
-	if ( !$max_page )
2208
+	if ( ! $max_page)
2209 2209
 		$max_page = $wp_query->max_num_pages;
2210 2210
 
2211
-	if ( !$paged )
2211
+	if ( ! $paged)
2212 2212
 		$paged = 1;
2213 2213
 
2214 2214
 	$nextpage = intval($paged) + 1;
2215 2215
 
2216
-	if ( null === $label )
2217
-		$label = __( 'Next Page &raquo;' );
2216
+	if (null === $label)
2217
+		$label = __('Next Page &raquo;');
2218 2218
 
2219
-	if ( !is_single() && ( $nextpage <= $max_page ) ) {
2219
+	if ( ! is_single() && ($nextpage <= $max_page)) {
2220 2220
 		/**
2221 2221
 		 * Filters the anchor tag attributes for the next posts page link.
2222 2222
 		 *
@@ -2224,9 +2224,9 @@  discard block
 block discarded – undo
2224 2224
 		 *
2225 2225
 		 * @param string $attributes Attributes for the anchor tag.
2226 2226
 		 */
2227
-		$attr = apply_filters( 'next_posts_link_attributes', '' );
2227
+		$attr = apply_filters('next_posts_link_attributes', '');
2228 2228
 
2229
-		return '<a href="' . next_posts( $max_page, false ) . "\" $attr>" . preg_replace('/&([^#])(?![a-z]{1,8};)/i', '&#038;$1', $label) . '</a>';
2229
+		return '<a href="'.next_posts($max_page, false)."\" $attr>".preg_replace('/&([^#])(?![a-z]{1,8};)/i', '&#038;$1', $label).'</a>';
2230 2230
 	}
2231 2231
 }
2232 2232
 
@@ -2238,8 +2238,8 @@  discard block
 block discarded – undo
2238 2238
  * @param string $label    Content for link text.
2239 2239
  * @param int    $max_page Optional. Max pages. Default 0.
2240 2240
  */
2241
-function next_posts_link( $label = null, $max_page = 0 ) {
2242
-	echo get_next_posts_link( $label, $max_page );
2241
+function next_posts_link($label = null, $max_page = 0) {
2242
+	echo get_next_posts_link($label, $max_page);
2243 2243
 }
2244 2244
 
2245 2245
 /**
@@ -2258,9 +2258,9 @@  discard block
 block discarded – undo
2258 2258
 function get_previous_posts_page_link() {
2259 2259
 	global $paged;
2260 2260
 
2261
-	if ( !is_single() ) {
2261
+	if ( ! is_single()) {
2262 2262
 		$nextpage = intval($paged) - 1;
2263
-		if ( $nextpage < 1 )
2263
+		if ($nextpage < 1)
2264 2264
 			$nextpage = 1;
2265 2265
 		return get_pagenum_link($nextpage);
2266 2266
 	}
@@ -2274,10 +2274,10 @@  discard block
 block discarded – undo
2274 2274
  * @param bool $echo Optional. Whether to echo the link. Default true.
2275 2275
  * @return string|void The previous posts page link if `$echo = false`.
2276 2276
  */
2277
-function previous_posts( $echo = true ) {
2278
-	$output = esc_url( get_previous_posts_page_link() );
2277
+function previous_posts($echo = true) {
2278
+	$output = esc_url(get_previous_posts_page_link());
2279 2279
 
2280
-	if ( $echo )
2280
+	if ($echo)
2281 2281
 		echo $output;
2282 2282
 	else
2283 2283
 		return $output;
@@ -2293,13 +2293,13 @@  discard block
 block discarded – undo
2293 2293
  * @param string $label Optional. Previous page link text.
2294 2294
  * @return string|void HTML-formatted previous page link.
2295 2295
  */
2296
-function get_previous_posts_link( $label = null ) {
2296
+function get_previous_posts_link($label = null) {
2297 2297
 	global $paged;
2298 2298
 
2299
-	if ( null === $label )
2300
-		$label = __( '&laquo; Previous Page' );
2299
+	if (null === $label)
2300
+		$label = __('&laquo; Previous Page');
2301 2301
 
2302
-	if ( !is_single() && $paged > 1 ) {
2302
+	if ( ! is_single() && $paged > 1) {
2303 2303
 		/**
2304 2304
 		 * Filters the anchor tag attributes for the previous posts page link.
2305 2305
 		 *
@@ -2307,8 +2307,8 @@  discard block
 block discarded – undo
2307 2307
 		 *
2308 2308
 		 * @param string $attributes Attributes for the anchor tag.
2309 2309
 		 */
2310
-		$attr = apply_filters( 'previous_posts_link_attributes', '' );
2311
-		return '<a href="' . previous_posts( false ) . "\" $attr>". preg_replace( '/&([^#])(?![a-z]{1,8};)/i', '&#038;$1', $label ) .'</a>';
2310
+		$attr = apply_filters('previous_posts_link_attributes', '');
2311
+		return '<a href="'.previous_posts(false)."\" $attr>".preg_replace('/&([^#])(?![a-z]{1,8};)/i', '&#038;$1', $label).'</a>';
2312 2312
 	}
2313 2313
 }
2314 2314
 
@@ -2319,8 +2319,8 @@  discard block
 block discarded – undo
2319 2319
  *
2320 2320
  * @param string $label Optional. Previous page link text.
2321 2321
  */
2322
-function previous_posts_link( $label = null ) {
2323
-	echo get_previous_posts_link( $label );
2322
+function previous_posts_link($label = null) {
2323
+	echo get_previous_posts_link($label);
2324 2324
 }
2325 2325
 
2326 2326
 /**
@@ -2341,18 +2341,18 @@  discard block
 block discarded – undo
2341 2341
  * }
2342 2342
  * @return string The posts link navigation.
2343 2343
  */
2344
-function get_posts_nav_link( $args = array() ) {
2344
+function get_posts_nav_link($args = array()) {
2345 2345
 	global $wp_query;
2346 2346
 
2347 2347
 	$return = '';
2348 2348
 
2349
-	if ( !is_singular() ) {
2349
+	if ( ! is_singular()) {
2350 2350
 		$defaults = array(
2351 2351
 			'sep' => ' &#8212; ',
2352 2352
 			'prelabel' => __('&laquo; Previous Page'),
2353 2353
 			'nxtlabel' => __('Next Page &raquo;'),
2354 2354
 		);
2355
-		$args = wp_parse_args( $args, $defaults );
2355
+		$args = wp_parse_args($args, $defaults);
2356 2356
 
2357 2357
 		$max_num_pages = $wp_query->max_num_pages;
2358 2358
 		$paged = get_query_var('paged');
@@ -2362,7 +2362,7 @@  discard block
 block discarded – undo
2362 2362
 			$args['sep'] = '';
2363 2363
 		}
2364 2364
 
2365
-		if ( $max_num_pages > 1 ) {
2365
+		if ($max_num_pages > 1) {
2366 2366
 			$return = get_previous_posts_link($args['prelabel']);
2367 2367
 			$return .= preg_replace('/&([^#])(?![a-z]{1,8};)/i', '&#038;$1', $args['sep']);
2368 2368
 			$return .= get_next_posts_link($args['nxtlabel']);
@@ -2381,8 +2381,8 @@  discard block
 block discarded – undo
2381 2381
  * @param string $prelabel Optional. Label for previous pages. Default empty.
2382 2382
  * @param string $nxtlabel Optional Label for next pages. Default empty.
2383 2383
  */
2384
-function posts_nav_link( $sep = '', $prelabel = '', $nxtlabel = '' ) {
2385
-	$args = array_filter( compact('sep', 'prelabel', 'nxtlabel') );
2384
+function posts_nav_link($sep = '', $prelabel = '', $nxtlabel = '') {
2385
+	$args = array_filter(compact('sep', 'prelabel', 'nxtlabel'));
2386 2386
 	echo get_posts_nav_link($args);
2387 2387
 }
2388 2388
 
@@ -2404,15 +2404,15 @@  discard block
 block discarded – undo
2404 2404
  * }
2405 2405
  * @return string Markup for post links.
2406 2406
  */
2407
-function get_the_post_navigation( $args = array() ) {
2408
-	$args = wp_parse_args( $args, array(
2407
+function get_the_post_navigation($args = array()) {
2408
+	$args = wp_parse_args($args, array(
2409 2409
 		'prev_text'          => '%title',
2410 2410
 		'next_text'          => '%title',
2411 2411
 		'in_same_term'       => false,
2412 2412
 		'excluded_terms'     => '',
2413 2413
 		'taxonomy'           => 'category',
2414
-		'screen_reader_text' => __( 'Post navigation' ),
2415
-	) );
2414
+		'screen_reader_text' => __('Post navigation'),
2415
+	));
2416 2416
 
2417 2417
 	$navigation = '';
2418 2418
 
@@ -2433,8 +2433,8 @@  discard block
 block discarded – undo
2433 2433
 	);
2434 2434
 
2435 2435
 	// Only add markup if there's somewhere to navigate to.
2436
-	if ( $previous || $next ) {
2437
-		$navigation = _navigation_markup( $previous . $next, 'post-navigation', $args['screen_reader_text'] );
2436
+	if ($previous || $next) {
2437
+		$navigation = _navigation_markup($previous.$next, 'post-navigation', $args['screen_reader_text']);
2438 2438
 	}
2439 2439
 
2440 2440
 	return $navigation;
@@ -2448,8 +2448,8 @@  discard block
 block discarded – undo
2448 2448
  * @param array $args Optional. See get_the_post_navigation() for available arguments.
2449 2449
  *                    Default empty array.
2450 2450
  */
2451
-function the_post_navigation( $args = array() ) {
2452
-	echo get_the_post_navigation( $args );
2451
+function the_post_navigation($args = array()) {
2452
+	echo get_the_post_navigation($args);
2453 2453
 }
2454 2454
 
2455 2455
 /**
@@ -2471,29 +2471,29 @@  discard block
 block discarded – undo
2471 2471
  * }
2472 2472
  * @return string Markup for posts links.
2473 2473
  */
2474
-function get_the_posts_navigation( $args = array() ) {
2474
+function get_the_posts_navigation($args = array()) {
2475 2475
 	$navigation = '';
2476 2476
 
2477 2477
 	// Don't print empty markup if there's only one page.
2478
-	if ( $GLOBALS['wp_query']->max_num_pages > 1 ) {
2479
-		$args = wp_parse_args( $args, array(
2480
-			'prev_text'          => __( 'Older posts' ),
2481
-			'next_text'          => __( 'Newer posts' ),
2482
-			'screen_reader_text' => __( 'Posts navigation' ),
2483
-		) );
2484
-
2485
-		$next_link = get_previous_posts_link( $args['next_text'] );
2486
-		$prev_link = get_next_posts_link( $args['prev_text'] );
2487
-
2488
-		if ( $prev_link ) {
2489
-			$navigation .= '<div class="nav-previous">' . $prev_link . '</div>';
2478
+	if ($GLOBALS['wp_query']->max_num_pages > 1) {
2479
+		$args = wp_parse_args($args, array(
2480
+			'prev_text'          => __('Older posts'),
2481
+			'next_text'          => __('Newer posts'),
2482
+			'screen_reader_text' => __('Posts navigation'),
2483
+		));
2484
+
2485
+		$next_link = get_previous_posts_link($args['next_text']);
2486
+		$prev_link = get_next_posts_link($args['prev_text']);
2487
+
2488
+		if ($prev_link) {
2489
+			$navigation .= '<div class="nav-previous">'.$prev_link.'</div>';
2490 2490
 		}
2491 2491
 
2492
-		if ( $next_link ) {
2493
-			$navigation .= '<div class="nav-next">' . $next_link . '</div>';
2492
+		if ($next_link) {
2493
+			$navigation .= '<div class="nav-next">'.$next_link.'</div>';
2494 2494
 		}
2495 2495
 
2496
-		$navigation = _navigation_markup( $navigation, 'posts-navigation', $args['screen_reader_text'] );
2496
+		$navigation = _navigation_markup($navigation, 'posts-navigation', $args['screen_reader_text']);
2497 2497
 	}
2498 2498
 
2499 2499
 	return $navigation;
@@ -2507,8 +2507,8 @@  discard block
 block discarded – undo
2507 2507
  * @param array $args Optional. See get_the_posts_navigation() for available arguments.
2508 2508
  *                    Default empty array.
2509 2509
  */
2510
-function the_posts_navigation( $args = array() ) {
2511
-	echo get_the_posts_navigation( $args );
2510
+function the_posts_navigation($args = array()) {
2511
+	echo get_the_posts_navigation($args);
2512 2512
 }
2513 2513
 
2514 2514
 /**
@@ -2524,28 +2524,28 @@  discard block
 block discarded – undo
2524 2524
  * }
2525 2525
  * @return string Markup for pagination links.
2526 2526
  */
2527
-function get_the_posts_pagination( $args = array() ) {
2527
+function get_the_posts_pagination($args = array()) {
2528 2528
 	$navigation = '';
2529 2529
 
2530 2530
 	// Don't print empty markup if there's only one page.
2531
-	if ( $GLOBALS['wp_query']->max_num_pages > 1 ) {
2532
-		$args = wp_parse_args( $args, array(
2531
+	if ($GLOBALS['wp_query']->max_num_pages > 1) {
2532
+		$args = wp_parse_args($args, array(
2533 2533
 			'mid_size'           => 1,
2534
-			'prev_text'          => _x( 'Previous', 'previous set of posts' ),
2535
-			'next_text'          => _x( 'Next', 'next set of posts' ),
2536
-			'screen_reader_text' => __( 'Posts navigation' ),
2537
-		) );
2534
+			'prev_text'          => _x('Previous', 'previous set of posts'),
2535
+			'next_text'          => _x('Next', 'next set of posts'),
2536
+			'screen_reader_text' => __('Posts navigation'),
2537
+		));
2538 2538
 
2539 2539
 		// Make sure we get a string back. Plain is the next best thing.
2540
-		if ( isset( $args['type'] ) && 'array' == $args['type'] ) {
2540
+		if (isset($args['type']) && 'array' == $args['type']) {
2541 2541
 			$args['type'] = 'plain';
2542 2542
 		}
2543 2543
 
2544 2544
 		// Set up paginated links.
2545
-		$links = paginate_links( $args );
2545
+		$links = paginate_links($args);
2546 2546
 
2547
-		if ( $links ) {
2548
-			$navigation = _navigation_markup( $links, 'pagination', $args['screen_reader_text'] );
2547
+		if ($links) {
2548
+			$navigation = _navigation_markup($links, 'pagination', $args['screen_reader_text']);
2549 2549
 		}
2550 2550
 	}
2551 2551
 
@@ -2560,8 +2560,8 @@  discard block
 block discarded – undo
2560 2560
  * @param array $args Optional. See get_the_posts_pagination() for available arguments.
2561 2561
  *                    Default empty array.
2562 2562
  */
2563
-function the_posts_pagination( $args = array() ) {
2564
-	echo get_the_posts_pagination( $args );
2563
+function the_posts_pagination($args = array()) {
2564
+	echo get_the_posts_pagination($args);
2565 2565
 }
2566 2566
 
2567 2567
 /**
@@ -2575,9 +2575,9 @@  discard block
 block discarded – undo
2575 2575
  * @param string $screen_reader_text Optional. Screen reader text for nav element. Default: 'Posts navigation'.
2576 2576
  * @return string Navigation template tag.
2577 2577
  */
2578
-function _navigation_markup( $links, $class = 'posts-navigation', $screen_reader_text = '' ) {
2579
-	if ( empty( $screen_reader_text ) ) {
2580
-		$screen_reader_text = __( 'Posts navigation' );
2578
+function _navigation_markup($links, $class = 'posts-navigation', $screen_reader_text = '') {
2579
+	if (empty($screen_reader_text)) {
2580
+		$screen_reader_text = __('Posts navigation');
2581 2581
 	}
2582 2582
 
2583 2583
 	$template = '
@@ -2604,9 +2604,9 @@  discard block
 block discarded – undo
2604 2604
 	 * @param string $class    The class passed by the calling function.
2605 2605
 	 * @return string Navigation template.
2606 2606
 	 */
2607
-	$template = apply_filters( 'navigation_markup_template', $template, $class );
2607
+	$template = apply_filters('navigation_markup_template', $template, $class);
2608 2608
 
2609
-	return sprintf( $template, sanitize_html_class( $class ), esc_html( $screen_reader_text ), $links );
2609
+	return sprintf($template, sanitize_html_class($class), esc_html($screen_reader_text), $links);
2610 2610
 }
2611 2611
 
2612 2612
 /**
@@ -2620,25 +2620,25 @@  discard block
 block discarded – undo
2620 2620
  * @param int $max_page Optional. The maximum number of comment pages. Default 0.
2621 2621
  * @return string The comments page number link URL.
2622 2622
  */
2623
-function get_comments_pagenum_link( $pagenum = 1, $max_page = 0 ) {
2623
+function get_comments_pagenum_link($pagenum = 1, $max_page = 0) {
2624 2624
 	global $wp_rewrite;
2625 2625
 
2626 2626
 	$pagenum = (int) $pagenum;
2627 2627
 
2628 2628
 	$result = get_permalink();
2629 2629
 
2630
-	if ( 'newest' == get_option('default_comments_page') ) {
2631
-		if ( $pagenum != $max_page ) {
2632
-			if ( $wp_rewrite->using_permalinks() )
2633
-				$result = user_trailingslashit( trailingslashit($result) . $wp_rewrite->comments_pagination_base . '-' . $pagenum, 'commentpaged');
2630
+	if ('newest' == get_option('default_comments_page')) {
2631
+		if ($pagenum != $max_page) {
2632
+			if ($wp_rewrite->using_permalinks())
2633
+				$result = user_trailingslashit(trailingslashit($result).$wp_rewrite->comments_pagination_base.'-'.$pagenum, 'commentpaged');
2634 2634
 			else
2635
-				$result = add_query_arg( 'cpage', $pagenum, $result );
2635
+				$result = add_query_arg('cpage', $pagenum, $result);
2636 2636
 		}
2637
-	} elseif ( $pagenum > 1 ) {
2638
-		if ( $wp_rewrite->using_permalinks() )
2639
-			$result = user_trailingslashit( trailingslashit($result) . $wp_rewrite->comments_pagination_base . '-' . $pagenum, 'commentpaged');
2637
+	} elseif ($pagenum > 1) {
2638
+		if ($wp_rewrite->using_permalinks())
2639
+			$result = user_trailingslashit(trailingslashit($result).$wp_rewrite->comments_pagination_base.'-'.$pagenum, 'commentpaged');
2640 2640
 		else
2641
-			$result = add_query_arg( 'cpage', $pagenum, $result );
2641
+			$result = add_query_arg('cpage', $pagenum, $result);
2642 2642
 	}
2643 2643
 
2644 2644
 	$result .= '#comments';
@@ -2650,7 +2650,7 @@  discard block
 block discarded – undo
2650 2650
 	 *
2651 2651
 	 * @param string $result The comments page number link.
2652 2652
 	 */
2653
-	return apply_filters( 'get_comments_pagenum_link', $result );
2653
+	return apply_filters('get_comments_pagenum_link', $result);
2654 2654
 }
2655 2655
 
2656 2656
 /**
@@ -2664,30 +2664,30 @@  discard block
 block discarded – undo
2664 2664
  * @param int    $max_page Optional. Max page. Default 0.
2665 2665
  * @return string|void HTML-formatted link for the next page of comments.
2666 2666
  */
2667
-function get_next_comments_link( $label = '', $max_page = 0 ) {
2667
+function get_next_comments_link($label = '', $max_page = 0) {
2668 2668
 	global $wp_query;
2669 2669
 
2670
-	if ( ! is_singular() )
2670
+	if ( ! is_singular())
2671 2671
 		return;
2672 2672
 
2673 2673
 	$page = get_query_var('cpage');
2674 2674
 
2675
-	if ( ! $page ) {
2675
+	if ( ! $page) {
2676 2676
 		$page = 1;
2677 2677
 	}
2678 2678
 
2679 2679
 	$nextpage = intval($page) + 1;
2680 2680
 
2681
-	if ( empty($max_page) )
2681
+	if (empty($max_page))
2682 2682
 		$max_page = $wp_query->max_num_comment_pages;
2683 2683
 
2684
-	if ( empty($max_page) )
2684
+	if (empty($max_page))
2685 2685
 		$max_page = get_comment_pages_count();
2686 2686
 
2687
-	if ( $nextpage > $max_page )
2687
+	if ($nextpage > $max_page)
2688 2688
 		return;
2689 2689
 
2690
-	if ( empty($label) )
2690
+	if (empty($label))
2691 2691
 		$label = __('Newer Comments &raquo;');
2692 2692
 
2693 2693
 	/**
@@ -2697,7 +2697,7 @@  discard block
 block discarded – undo
2697 2697
 	 *
2698 2698
 	 * @param string $attributes Attributes for the anchor tag.
2699 2699
 	 */
2700
-	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>';
2700
+	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>';
2701 2701
 }
2702 2702
 
2703 2703
 /**
@@ -2708,8 +2708,8 @@  discard block
 block discarded – undo
2708 2708
  * @param string $label    Optional. Label for link text. Default empty.
2709 2709
  * @param int    $max_page Optional. Max page. Default 0.
2710 2710
  */
2711
-function next_comments_link( $label = '', $max_page = 0 ) {
2712
-	echo get_next_comments_link( $label, $max_page );
2711
+function next_comments_link($label = '', $max_page = 0) {
2712
+	echo get_next_comments_link($label, $max_page);
2713 2713
 }
2714 2714
 
2715 2715
 /**
@@ -2720,18 +2720,18 @@  discard block
 block discarded – undo
2720 2720
  * @param string $label Optional. Label for comments link text. Default empty.
2721 2721
  * @return string|void HTML-formatted link for the previous page of comments.
2722 2722
  */
2723
-function get_previous_comments_link( $label = '' ) {
2724
-	if ( ! is_singular() )
2723
+function get_previous_comments_link($label = '') {
2724
+	if ( ! is_singular())
2725 2725
 		return;
2726 2726
 
2727 2727
 	$page = get_query_var('cpage');
2728 2728
 
2729
-	if ( intval($page) <= 1 )
2729
+	if (intval($page) <= 1)
2730 2730
 		return;
2731 2731
 
2732 2732
 	$prevpage = intval($page) - 1;
2733 2733
 
2734
-	if ( empty($label) )
2734
+	if (empty($label))
2735 2735
 		$label = __('&laquo; Older Comments');
2736 2736
 
2737 2737
 	/**
@@ -2741,7 +2741,7 @@  discard block
 block discarded – undo
2741 2741
 	 *
2742 2742
 	 * @param string $attributes Attributes for the anchor tag.
2743 2743
 	 */
2744
-	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>';
2744
+	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>';
2745 2745
 }
2746 2746
 
2747 2747
 /**
@@ -2751,8 +2751,8 @@  discard block
 block discarded – undo
2751 2751
  *
2752 2752
  * @param string $label Optional. Label for comments link text. Default empty.
2753 2753
  */
2754
-function previous_comments_link( $label = '' ) {
2755
-	echo get_previous_comments_link( $label );
2754
+function previous_comments_link($label = '') {
2755
+	echo get_previous_comments_link($label);
2756 2756
 }
2757 2757
 
2758 2758
 /**
@@ -2766,31 +2766,31 @@  discard block
 block discarded – undo
2766 2766
  * @param string|array $args Optional args. See paginate_links(). Default empty array.
2767 2767
  * @return string|void Markup for pagination links.
2768 2768
  */
2769
-function paginate_comments_links( $args = array() ) {
2769
+function paginate_comments_links($args = array()) {
2770 2770
 	global $wp_rewrite;
2771 2771
 
2772
-	if ( ! is_singular() )
2772
+	if ( ! is_singular())
2773 2773
 		return;
2774 2774
 
2775 2775
 	$page = get_query_var('cpage');
2776
-	if ( !$page )
2776
+	if ( ! $page)
2777 2777
 		$page = 1;
2778 2778
 	$max_page = get_comment_pages_count();
2779 2779
 	$defaults = array(
2780
-		'base' => add_query_arg( 'cpage', '%#%' ),
2780
+		'base' => add_query_arg('cpage', '%#%'),
2781 2781
 		'format' => '',
2782 2782
 		'total' => $max_page,
2783 2783
 		'current' => $page,
2784 2784
 		'echo' => true,
2785 2785
 		'add_fragment' => '#comments'
2786 2786
 	);
2787
-	if ( $wp_rewrite->using_permalinks() )
2788
-		$defaults['base'] = user_trailingslashit(trailingslashit(get_permalink()) . $wp_rewrite->comments_pagination_base . '-%#%', 'commentpaged');
2787
+	if ($wp_rewrite->using_permalinks())
2788
+		$defaults['base'] = user_trailingslashit(trailingslashit(get_permalink()).$wp_rewrite->comments_pagination_base.'-%#%', 'commentpaged');
2789 2789
 
2790
-	$args = wp_parse_args( $args, $defaults );
2791
-	$page_links = paginate_links( $args );
2790
+	$args = wp_parse_args($args, $defaults);
2791
+	$page_links = paginate_links($args);
2792 2792
 
2793
-	if ( $args['echo'] )
2793
+	if ($args['echo'])
2794 2794
 		echo $page_links;
2795 2795
 	else
2796 2796
 		return $page_links;
@@ -2812,29 +2812,29 @@  discard block
 block discarded – undo
2812 2812
  * }
2813 2813
  * @return string Markup for comments links.
2814 2814
  */
2815
-function get_the_comments_navigation( $args = array() ) {
2815
+function get_the_comments_navigation($args = array()) {
2816 2816
 	$navigation = '';
2817 2817
 
2818 2818
 	// Are there comments to navigate through?
2819
-	if ( get_comment_pages_count() > 1 ) {
2820
-		$args = wp_parse_args( $args, array(
2821
-			'prev_text'          => __( 'Older comments' ),
2822
-			'next_text'          => __( 'Newer comments' ),
2823
-			'screen_reader_text' => __( 'Comments navigation' ),
2824
-		) );
2825
-
2826
-		$prev_link = get_previous_comments_link( $args['prev_text'] );
2827
-		$next_link = get_next_comments_link( $args['next_text'] );
2828
-
2829
-		if ( $prev_link ) {
2830
-			$navigation .= '<div class="nav-previous">' . $prev_link . '</div>';
2819
+	if (get_comment_pages_count() > 1) {
2820
+		$args = wp_parse_args($args, array(
2821
+			'prev_text'          => __('Older comments'),
2822
+			'next_text'          => __('Newer comments'),
2823
+			'screen_reader_text' => __('Comments navigation'),
2824
+		));
2825
+
2826
+		$prev_link = get_previous_comments_link($args['prev_text']);
2827
+		$next_link = get_next_comments_link($args['next_text']);
2828
+
2829
+		if ($prev_link) {
2830
+			$navigation .= '<div class="nav-previous">'.$prev_link.'</div>';
2831 2831
 		}
2832 2832
 
2833
-		if ( $next_link ) {
2834
-			$navigation .= '<div class="nav-next">' . $next_link . '</div>';
2833
+		if ($next_link) {
2834
+			$navigation .= '<div class="nav-next">'.$next_link.'</div>';
2835 2835
 		}
2836 2836
 
2837
-		$navigation = _navigation_markup( $navigation, 'comment-navigation', $args['screen_reader_text'] );
2837
+		$navigation = _navigation_markup($navigation, 'comment-navigation', $args['screen_reader_text']);
2838 2838
 	}
2839 2839
 
2840 2840
 	return $navigation;
@@ -2847,8 +2847,8 @@  discard block
 block discarded – undo
2847 2847
  *
2848 2848
  * @param array $args See get_the_comments_navigation() for available arguments. Default empty array.
2849 2849
  */
2850
-function the_comments_navigation( $args = array() ) {
2851
-	echo get_the_comments_navigation( $args );
2850
+function the_comments_navigation($args = array()) {
2851
+	echo get_the_comments_navigation($args);
2852 2852
 }
2853 2853
 
2854 2854
 /**
@@ -2865,20 +2865,20 @@  discard block
 block discarded – undo
2865 2865
  * }
2866 2866
  * @return string Markup for pagination links.
2867 2867
  */
2868
-function get_the_comments_pagination( $args = array() ) {
2868
+function get_the_comments_pagination($args = array()) {
2869 2869
 	$navigation = '';
2870
-	$args       = wp_parse_args( $args, array(
2871
-		'screen_reader_text' => __( 'Comments navigation' ),
2872
-	) );
2870
+	$args       = wp_parse_args($args, array(
2871
+		'screen_reader_text' => __('Comments navigation'),
2872
+	));
2873 2873
 	$args['echo'] = false;
2874 2874
 
2875 2875
 	// Make sure we get plain links, so we get a string we can work with.
2876 2876
 	$args['type'] = 'plain';
2877 2877
 
2878
-	$links = paginate_comments_links( $args );
2878
+	$links = paginate_comments_links($args);
2879 2879
 
2880
-	if ( $links ) {
2881
-		$navigation = _navigation_markup( $links, 'comments-pagination', $args['screen_reader_text'] );
2880
+	if ($links) {
2881
+		$navigation = _navigation_markup($links, 'comments-pagination', $args['screen_reader_text']);
2882 2882
 	}
2883 2883
 
2884 2884
 	return $navigation;
@@ -2891,8 +2891,8 @@  discard block
 block discarded – undo
2891 2891
  *
2892 2892
  * @param array $args See get_the_comments_pagination() for available arguments. Default empty array.
2893 2893
  */
2894
-function the_comments_pagination( $args = array() ) {
2895
-	echo get_the_comments_pagination( $args );
2894
+function the_comments_pagination($args = array()) {
2895
+	echo get_the_comments_pagination($args);
2896 2896
 }
2897 2897
 
2898 2898
 /**
@@ -2905,11 +2905,11 @@  discard block
 block discarded – undo
2905 2905
 function get_shortcut_link() {
2906 2906
 	global $is_IE;
2907 2907
 
2908
-	include_once( ABSPATH . 'wp-admin/includes/class-wp-press-this.php' );
2908
+	include_once(ABSPATH.'wp-admin/includes/class-wp-press-this.php');
2909 2909
 
2910 2910
 	$link = '';
2911 2911
 
2912
-	if ( $is_IE ) {
2912
+	if ($is_IE) {
2913 2913
 		/*
2914 2914
 		 * Return the old/shorter bookmarklet code for MSIE 8 and lower,
2915 2915
 		 * since they only support a max length of ~2000 characters for
@@ -2919,27 +2919,27 @@  discard block
 block discarded – undo
2919 2919
 		 */
2920 2920
 		$ua = $_SERVER['HTTP_USER_AGENT'];
2921 2921
 
2922
-		if ( ! empty( $ua ) && preg_match( '/\bMSIE (\d)/', $ua, $matches ) && (int) $matches[1] <= 8 ) {
2923
-			$url = wp_json_encode( admin_url( 'press-this.php' ) );
2922
+		if ( ! empty($ua) && preg_match('/\bMSIE (\d)/', $ua, $matches) && (int) $matches[1] <= 8) {
2923
+			$url = wp_json_encode(admin_url('press-this.php'));
2924 2924
 
2925
-			$link = 'javascript:var d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,' .
2926
-				's=(e?e():(k)?k():(x?x.createRange().text:0)),f=' . $url . ',l=d.location,e=encodeURIComponent,' .
2927
-				'u=f+"?u="+e(l.href)+"&t="+e(d.title)+"&s="+e(s)+"&v=' . WP_Press_This::VERSION . '";' .
2928
-				'a=function(){if(!w.open(u,"t","toolbar=0,resizable=1,scrollbars=1,status=1,width=600,height=700"))l.href=u;};' .
2925
+			$link = 'javascript:var d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,'.
2926
+				's=(e?e():(k)?k():(x?x.createRange().text:0)),f='.$url.',l=d.location,e=encodeURIComponent,'.
2927
+				'u=f+"?u="+e(l.href)+"&t="+e(d.title)+"&s="+e(s)+"&v='.WP_Press_This::VERSION.'";'.
2928
+				'a=function(){if(!w.open(u,"t","toolbar=0,resizable=1,scrollbars=1,status=1,width=600,height=700"))l.href=u;};'.
2929 2929
 				'if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else a();void(0)';
2930 2930
 		}
2931 2931
 	}
2932 2932
 
2933
-	if ( empty( $link ) ) {
2934
-		$src = @file_get_contents( ABSPATH . 'wp-admin/js/bookmarklet.min.js' );
2933
+	if (empty($link)) {
2934
+		$src = @file_get_contents(ABSPATH.'wp-admin/js/bookmarklet.min.js');
2935 2935
 
2936
-		if ( $src ) {
2937
-			$url = wp_json_encode( admin_url( 'press-this.php' ) . '?v=' . WP_Press_This::VERSION );
2938
-			$link = 'javascript:' . str_replace( 'window.pt_url', $url, $src );
2936
+		if ($src) {
2937
+			$url = wp_json_encode(admin_url('press-this.php').'?v='.WP_Press_This::VERSION);
2938
+			$link = 'javascript:'.str_replace('window.pt_url', $url, $src);
2939 2939
 		}
2940 2940
 	}
2941 2941
 
2942
-	$link = str_replace( array( "\r", "\n", "\t" ),  '', $link );
2942
+	$link = str_replace(array("\r", "\n", "\t"), '', $link);
2943 2943
 
2944 2944
 	/**
2945 2945
 	 * Filters the Press This bookmarklet link.
@@ -2948,7 +2948,7 @@  discard block
 block discarded – undo
2948 2948
 	 *
2949 2949
 	 * @param string $link The Press This bookmarklet link.
2950 2950
 	 */
2951
-	return apply_filters( 'shortcut_link', $link );
2951
+	return apply_filters('shortcut_link', $link);
2952 2952
 }
2953 2953
 
2954 2954
 /**
@@ -2965,8 +2965,8 @@  discard block
 block discarded – undo
2965 2965
  *                             'http', 'https', 'relative', 'rest', or null. Default null.
2966 2966
  * @return string Home URL link with optional path appended.
2967 2967
  */
2968
-function home_url( $path = '', $scheme = null ) {
2969
-	return get_home_url( null, $path, $scheme );
2968
+function home_url($path = '', $scheme = null) {
2969
+	return get_home_url(null, $path, $scheme);
2970 2970
 }
2971 2971
 
2972 2972
 /**
@@ -2986,30 +2986,30 @@  discard block
 block discarded – undo
2986 2986
  *                              'http', 'https', 'relative', 'rest', or null. Default null.
2987 2987
  * @return string Home URL link with optional path appended.
2988 2988
  */
2989
-function get_home_url( $blog_id = null, $path = '', $scheme = null ) {
2989
+function get_home_url($blog_id = null, $path = '', $scheme = null) {
2990 2990
 	global $pagenow;
2991 2991
 
2992 2992
 	$orig_scheme = $scheme;
2993 2993
 
2994
-	if ( empty( $blog_id ) || !is_multisite() ) {
2995
-		$url = get_option( 'home' );
2994
+	if (empty($blog_id) || ! is_multisite()) {
2995
+		$url = get_option('home');
2996 2996
 	} else {
2997
-		switch_to_blog( $blog_id );
2998
-		$url = get_option( 'home' );
2997
+		switch_to_blog($blog_id);
2998
+		$url = get_option('home');
2999 2999
 		restore_current_blog();
3000 3000
 	}
3001 3001
 
3002
-	if ( ! in_array( $scheme, array( 'http', 'https', 'relative' ) ) ) {
3003
-		if ( is_ssl() && ! is_admin() && 'wp-login.php' !== $pagenow )
3002
+	if ( ! in_array($scheme, array('http', 'https', 'relative'))) {
3003
+		if (is_ssl() && ! is_admin() && 'wp-login.php' !== $pagenow)
3004 3004
 			$scheme = 'https';
3005 3005
 		else
3006
-			$scheme = parse_url( $url, PHP_URL_SCHEME );
3006
+			$scheme = parse_url($url, PHP_URL_SCHEME);
3007 3007
 	}
3008 3008
 
3009
-	$url = set_url_scheme( $url, $scheme );
3009
+	$url = set_url_scheme($url, $scheme);
3010 3010
 
3011
-	if ( $path && is_string( $path ) )
3012
-		$url .= '/' . ltrim( $path, '/' );
3011
+	if ($path && is_string($path))
3012
+		$url .= '/'.ltrim($path, '/');
3013 3013
 
3014 3014
 	/**
3015 3015
 	 * Filters the home URL.
@@ -3022,7 +3022,7 @@  discard block
 block discarded – undo
3022 3022
 	 *                                 'relative', 'rest', or null.
3023 3023
 	 * @param int|null    $blog_id     Site ID, or null for the current site.
3024 3024
 	 */
3025
-	return apply_filters( 'home_url', $url, $path, $orig_scheme, $blog_id );
3025
+	return apply_filters('home_url', $url, $path, $orig_scheme, $blog_id);
3026 3026
 }
3027 3027
 
3028 3028
 /**
@@ -3039,8 +3039,8 @@  discard block
 block discarded – undo
3039 3039
  * @param string $scheme Optional. Scheme to give the site URL context. See set_url_scheme().
3040 3040
  * @return string Site URL link with optional path appended.
3041 3041
  */
3042
-function site_url( $path = '', $scheme = null ) {
3043
-	return get_site_url( null, $path, $scheme );
3042
+function site_url($path = '', $scheme = null) {
3043
+	return get_site_url(null, $path, $scheme);
3044 3044
 }
3045 3045
 
3046 3046
 /**
@@ -3060,19 +3060,19 @@  discard block
 block discarded – undo
3060 3060
  *                        'relative'. Default null.
3061 3061
  * @return string Site URL link with optional path appended.
3062 3062
  */
3063
-function get_site_url( $blog_id = null, $path = '', $scheme = null ) {
3064
-	if ( empty( $blog_id ) || !is_multisite() ) {
3065
-		$url = get_option( 'siteurl' );
3063
+function get_site_url($blog_id = null, $path = '', $scheme = null) {
3064
+	if (empty($blog_id) || ! is_multisite()) {
3065
+		$url = get_option('siteurl');
3066 3066
 	} else {
3067
-		switch_to_blog( $blog_id );
3068
-		$url = get_option( 'siteurl' );
3067
+		switch_to_blog($blog_id);
3068
+		$url = get_option('siteurl');
3069 3069
 		restore_current_blog();
3070 3070
 	}
3071 3071
 
3072
-	$url = set_url_scheme( $url, $scheme );
3072
+	$url = set_url_scheme($url, $scheme);
3073 3073
 
3074
-	if ( $path && is_string( $path ) )
3075
-		$url .= '/' . ltrim( $path, '/' );
3074
+	if ($path && is_string($path))
3075
+		$url .= '/'.ltrim($path, '/');
3076 3076
 
3077 3077
 	/**
3078 3078
 	 * Filters the site URL.
@@ -3085,7 +3085,7 @@  discard block
 block discarded – undo
3085 3085
 	 *                             'login_post', 'admin', 'relative' or null.
3086 3086
 	 * @param int|null    $blog_id Site ID, or null for the current site.
3087 3087
 	 */
3088
-	return apply_filters( 'site_url', $url, $path, $scheme, $blog_id );
3088
+	return apply_filters('site_url', $url, $path, $scheme, $blog_id);
3089 3089
 }
3090 3090
 
3091 3091
 /**
@@ -3098,8 +3098,8 @@  discard block
 block discarded – undo
3098 3098
  *                       'http' or 'https' can be passed to force those schemes.
3099 3099
  * @return string Admin URL link with optional path appended.
3100 3100
  */
3101
-function admin_url( $path = '', $scheme = 'admin' ) {
3102
-	return get_admin_url( null, $path, $scheme );
3101
+function admin_url($path = '', $scheme = 'admin') {
3102
+	return get_admin_url(null, $path, $scheme);
3103 3103
 }
3104 3104
 
3105 3105
 /**
@@ -3114,11 +3114,11 @@  discard block
 block discarded – undo
3114 3114
  *                        force_ssl_admin() and is_ssl().
3115 3115
  * @return string Admin URL link with optional path appended.
3116 3116
  */
3117
-function get_admin_url( $blog_id = null, $path = '', $scheme = 'admin' ) {
3117
+function get_admin_url($blog_id = null, $path = '', $scheme = 'admin') {
3118 3118
 	$url = get_site_url($blog_id, 'wp-admin/', $scheme);
3119 3119
 
3120
-	if ( $path && is_string( $path ) )
3121
-		$url .= ltrim( $path, '/' );
3120
+	if ($path && is_string($path))
3121
+		$url .= ltrim($path, '/');
3122 3122
 
3123 3123
 	/**
3124 3124
 	 * Filters the admin area URL.
@@ -3129,7 +3129,7 @@  discard block
 block discarded – undo
3129 3129
 	 * @param string   $path    Path relative to the admin area URL. Blank string if no path is specified.
3130 3130
 	 * @param int|null $blog_id Site ID, or null for the current site.
3131 3131
 	 */
3132
-	return apply_filters( 'admin_url', $url, $path, $blog_id );
3132
+	return apply_filters('admin_url', $url, $path, $blog_id);
3133 3133
 }
3134 3134
 
3135 3135
 /**
@@ -3142,10 +3142,10 @@  discard block
 block discarded – undo
3142 3142
  *                       'http', 'https', or 'relative'. Default null.
3143 3143
  * @return string Includes URL link with optional path appended.
3144 3144
  */
3145
-function includes_url( $path = '', $scheme = null ) {
3146
-	$url = site_url( '/' . WPINC . '/', $scheme );
3145
+function includes_url($path = '', $scheme = null) {
3146
+	$url = site_url('/'.WPINC.'/', $scheme);
3147 3147
 
3148
-	if ( $path && is_string( $path ) )
3148
+	if ($path && is_string($path))
3149 3149
 		$url .= ltrim($path, '/');
3150 3150
 
3151 3151
 	/**
@@ -3157,7 +3157,7 @@  discard block
 block discarded – undo
3157 3157
 	 * @param string $path Path relative to the URL to the wp-includes directory. Blank string
3158 3158
 	 *                     if no path is specified.
3159 3159
 	 */
3160
-	return apply_filters( 'includes_url', $url, $path );
3160
+	return apply_filters('includes_url', $url, $path);
3161 3161
 }
3162 3162
 
3163 3163
 /**
@@ -3168,11 +3168,11 @@  discard block
 block discarded – undo
3168 3168
  * @param string $path Optional. Path relative to the content URL. Default empty.
3169 3169
  * @return string Content URL link with optional path appended.
3170 3170
  */
3171
-function content_url( $path = '' ) {
3172
-	$url = set_url_scheme( WP_CONTENT_URL );
3171
+function content_url($path = '') {
3172
+	$url = set_url_scheme(WP_CONTENT_URL);
3173 3173
 
3174
-	if ( $path && is_string( $path ) )
3175
-		$url .= '/' . ltrim($path, '/');
3174
+	if ($path && is_string($path))
3175
+		$url .= '/'.ltrim($path, '/');
3176 3176
 
3177 3177
 	/**
3178 3178
 	 * Filters the URL to the content directory.
@@ -3183,7 +3183,7 @@  discard block
 block discarded – undo
3183 3183
 	 * @param string $path Path relative to the URL to the content directory. Blank string
3184 3184
 	 *                     if no path is specified.
3185 3185
 	 */
3186
-	return apply_filters( 'content_url', $url, $path);
3186
+	return apply_filters('content_url', $url, $path);
3187 3187
 }
3188 3188
 
3189 3189
 /**
@@ -3200,28 +3200,28 @@  discard block
 block discarded – undo
3200 3200
  *                        Typically this is done by passing `__FILE__` as the argument.
3201 3201
  * @return string Plugins URL link with optional paths appended.
3202 3202
  */
3203
-function plugins_url( $path = '', $plugin = '' ) {
3203
+function plugins_url($path = '', $plugin = '') {
3204 3204
 
3205
-	$path = wp_normalize_path( $path );
3206
-	$plugin = wp_normalize_path( $plugin );
3207
-	$mu_plugin_dir = wp_normalize_path( WPMU_PLUGIN_DIR );
3205
+	$path = wp_normalize_path($path);
3206
+	$plugin = wp_normalize_path($plugin);
3207
+	$mu_plugin_dir = wp_normalize_path(WPMU_PLUGIN_DIR);
3208 3208
 
3209
-	if ( !empty($plugin) && 0 === strpos($plugin, $mu_plugin_dir) )
3209
+	if ( ! empty($plugin) && 0 === strpos($plugin, $mu_plugin_dir))
3210 3210
 		$url = WPMU_PLUGIN_URL;
3211 3211
 	else
3212 3212
 		$url = WP_PLUGIN_URL;
3213 3213
 
3214 3214
 
3215
-	$url = set_url_scheme( $url );
3215
+	$url = set_url_scheme($url);
3216 3216
 
3217
-	if ( !empty($plugin) && is_string($plugin) ) {
3217
+	if ( ! empty($plugin) && is_string($plugin)) {
3218 3218
 		$folder = dirname(plugin_basename($plugin));
3219
-		if ( '.' != $folder )
3220
-			$url .= '/' . ltrim($folder, '/');
3219
+		if ('.' != $folder)
3220
+			$url .= '/'.ltrim($folder, '/');
3221 3221
 	}
3222 3222
 
3223
-	if ( $path && is_string( $path ) )
3224
-		$url .= '/' . ltrim($path, '/');
3223
+	if ($path && is_string($path))
3224
+		$url .= '/'.ltrim($path, '/');
3225 3225
 
3226 3226
 	/**
3227 3227
 	 * Filters the URL to the plugins directory.
@@ -3234,7 +3234,7 @@  discard block
 block discarded – undo
3234 3234
 	 * @param string $plugin The plugin file path to be relative to. Blank string if no plugin
3235 3235
 	 *                       is specified.
3236 3236
 	 */
3237
-	return apply_filters( 'plugins_url', $url, $path, $plugin );
3237
+	return apply_filters('plugins_url', $url, $path, $plugin);
3238 3238
 }
3239 3239
 
3240 3240
 /**
@@ -3253,19 +3253,19 @@  discard block
 block discarded – undo
3253 3253
  *                       'http', 'https', or 'relative'. Default null.
3254 3254
  * @return string Site URL link with optional path appended.
3255 3255
  */
3256
-function network_site_url( $path = '', $scheme = null ) {
3257
-	if ( ! is_multisite() )
3256
+function network_site_url($path = '', $scheme = null) {
3257
+	if ( ! is_multisite())
3258 3258
 		return site_url($path, $scheme);
3259 3259
 
3260 3260
 	$current_network = get_network();
3261 3261
 
3262
-	if ( 'relative' == $scheme )
3262
+	if ('relative' == $scheme)
3263 3263
 		$url = $current_network->path;
3264 3264
 	else
3265
-		$url = set_url_scheme( 'http://' . $current_network->domain . $current_network->path, $scheme );
3265
+		$url = set_url_scheme('http://'.$current_network->domain.$current_network->path, $scheme);
3266 3266
 
3267
-	if ( $path && is_string( $path ) )
3268
-		$url .= ltrim( $path, '/' );
3267
+	if ($path && is_string($path))
3268
+		$url .= ltrim($path, '/');
3269 3269
 
3270 3270
 	/**
3271 3271
 	 * Filters the network site URL.
@@ -3278,7 +3278,7 @@  discard block
 block discarded – undo
3278 3278
 	 * @param string|null $scheme Scheme to give the URL context. Accepts 'http', 'https',
3279 3279
 	 *                            'relative' or null.
3280 3280
 	 */
3281
-	return apply_filters( 'network_site_url', $url, $path, $scheme );
3281
+	return apply_filters('network_site_url', $url, $path, $scheme);
3282 3282
 }
3283 3283
 
3284 3284
 /**
@@ -3295,23 +3295,23 @@  discard block
 block discarded – undo
3295 3295
  *                        'http', 'https', or 'relative'. Default null.
3296 3296
  * @return string Home URL link with optional path appended.
3297 3297
  */
3298
-function network_home_url( $path = '', $scheme = null ) {
3299
-	if ( ! is_multisite() )
3298
+function network_home_url($path = '', $scheme = null) {
3299
+	if ( ! is_multisite())
3300 3300
 		return home_url($path, $scheme);
3301 3301
 
3302 3302
 	$current_network = get_network();
3303 3303
 	$orig_scheme = $scheme;
3304 3304
 
3305
-	if ( ! in_array( $scheme, array( 'http', 'https', 'relative' ) ) )
3305
+	if ( ! in_array($scheme, array('http', 'https', 'relative')))
3306 3306
 		$scheme = is_ssl() && ! is_admin() ? 'https' : 'http';
3307 3307
 
3308
-	if ( 'relative' == $scheme )
3308
+	if ('relative' == $scheme)
3309 3309
 		$url = $current_network->path;
3310 3310
 	else
3311
-		$url = set_url_scheme( 'http://' . $current_network->domain . $current_network->path, $scheme );
3311
+		$url = set_url_scheme('http://'.$current_network->domain.$current_network->path, $scheme);
3312 3312
 
3313
-	if ( $path && is_string( $path ) )
3314
-		$url .= ltrim( $path, '/' );
3313
+	if ($path && is_string($path))
3314
+		$url .= ltrim($path, '/');
3315 3315
 
3316 3316
 	/**
3317 3317
 	 * Filters the network home URL.
@@ -3324,7 +3324,7 @@  discard block
 block discarded – undo
3324 3324
 	 * @param string|null $orig_scheme Scheme to give the URL context. Accepts 'http', 'https',
3325 3325
 	 *                                 'relative' or null.
3326 3326
 	 */
3327
-	return apply_filters( 'network_home_url', $url, $path, $orig_scheme);
3327
+	return apply_filters('network_home_url', $url, $path, $orig_scheme);
3328 3328
 }
3329 3329
 
3330 3330
 /**
@@ -3337,13 +3337,13 @@  discard block
 block discarded – undo
3337 3337
  *                       and is_ssl(). 'http' or 'https' can be passed to force those schemes.
3338 3338
  * @return string Admin URL link with optional path appended.
3339 3339
  */
3340
-function network_admin_url( $path = '', $scheme = 'admin' ) {
3341
-	if ( ! is_multisite() )
3342
-		return admin_url( $path, $scheme );
3340
+function network_admin_url($path = '', $scheme = 'admin') {
3341
+	if ( ! is_multisite())
3342
+		return admin_url($path, $scheme);
3343 3343
 
3344 3344
 	$url = network_site_url('wp-admin/network/', $scheme);
3345 3345
 
3346
-	if ( $path && is_string( $path ) )
3346
+	if ($path && is_string($path))
3347 3347
 		$url .= ltrim($path, '/');
3348 3348
 
3349 3349
 	/**
@@ -3355,7 +3355,7 @@  discard block
 block discarded – undo
3355 3355
 	 * @param string $path Path relative to the network admin URL. Blank string if
3356 3356
 	 *                     no path is specified.
3357 3357
 	 */
3358
-	return apply_filters( 'network_admin_url', $url, $path );
3358
+	return apply_filters('network_admin_url', $url, $path);
3359 3359
 }
3360 3360
 
3361 3361
 /**
@@ -3368,10 +3368,10 @@  discard block
 block discarded – undo
3368 3368
  *                       and is_ssl(). 'http' or 'https' can be passed to force those schemes.
3369 3369
  * @return string Admin URL link with optional path appended.
3370 3370
  */
3371
-function user_admin_url( $path = '', $scheme = 'admin' ) {
3371
+function user_admin_url($path = '', $scheme = 'admin') {
3372 3372
 	$url = network_site_url('wp-admin/user/', $scheme);
3373 3373
 
3374
-	if ( $path && is_string( $path ) )
3374
+	if ($path && is_string($path))
3375 3375
 		$url .= ltrim($path, '/');
3376 3376
 
3377 3377
 	/**
@@ -3383,7 +3383,7 @@  discard block
 block discarded – undo
3383 3383
 	 * @param string $path Path relative to the URL. Blank string if
3384 3384
 	 *                     no path is specified.
3385 3385
 	 */
3386
-	return apply_filters( 'user_admin_url', $url, $path );
3386
+	return apply_filters('user_admin_url', $url, $path);
3387 3387
 }
3388 3388
 
3389 3389
 /**
@@ -3396,10 +3396,10 @@  discard block
 block discarded – undo
3396 3396
  *                       and is_ssl(). 'http' or 'https' can be passed to force those schemes.
3397 3397
  * @return string Admin URL link with optional path appended.
3398 3398
  */
3399
-function self_admin_url( $path = '', $scheme = 'admin' ) {
3400
-	if ( is_network_admin() )
3399
+function self_admin_url($path = '', $scheme = 'admin') {
3400
+	if (is_network_admin())
3401 3401
 		return network_admin_url($path, $scheme);
3402
-	elseif ( is_user_admin() )
3402
+	elseif (is_user_admin())
3403 3403
 		return user_admin_url($path, $scheme);
3404 3404
 	else
3405 3405
 		return admin_url($path, $scheme);
@@ -3416,27 +3416,27 @@  discard block
 block discarded – undo
3416 3416
  *                            'login_post', 'admin', 'relative', 'rest', 'rpc', or null. Default null.
3417 3417
  * @return string $url URL with chosen scheme.
3418 3418
  */
3419
-function set_url_scheme( $url, $scheme = null ) {
3419
+function set_url_scheme($url, $scheme = null) {
3420 3420
 	$orig_scheme = $scheme;
3421 3421
 
3422
-	if ( ! $scheme ) {
3422
+	if ( ! $scheme) {
3423 3423
 		$scheme = is_ssl() ? 'https' : 'http';
3424
-	} elseif ( $scheme === 'admin' || $scheme === 'login' || $scheme === 'login_post' || $scheme === 'rpc' ) {
3424
+	} elseif ($scheme === 'admin' || $scheme === 'login' || $scheme === 'login_post' || $scheme === 'rpc') {
3425 3425
 		$scheme = is_ssl() || force_ssl_admin() ? 'https' : 'http';
3426
-	} elseif ( $scheme !== 'http' && $scheme !== 'https' && $scheme !== 'relative' ) {
3426
+	} elseif ($scheme !== 'http' && $scheme !== 'https' && $scheme !== 'relative') {
3427 3427
 		$scheme = is_ssl() ? 'https' : 'http';
3428 3428
 	}
3429 3429
 
3430
-	$url = trim( $url );
3431
-	if ( substr( $url, 0, 2 ) === '//' )
3432
-		$url = 'http:' . $url;
3430
+	$url = trim($url);
3431
+	if (substr($url, 0, 2) === '//')
3432
+		$url = 'http:'.$url;
3433 3433
 
3434
-	if ( 'relative' == $scheme ) {
3435
-		$url = ltrim( preg_replace( '#^\w+://[^/]*#', '', $url ) );
3436
-		if ( $url !== '' && $url[0] === '/' )
3437
-			$url = '/' . ltrim($url , "/ \t\n\r\0\x0B" );
3434
+	if ('relative' == $scheme) {
3435
+		$url = ltrim(preg_replace('#^\w+://[^/]*#', '', $url));
3436
+		if ($url !== '' && $url[0] === '/')
3437
+			$url = '/'.ltrim($url, "/ \t\n\r\0\x0B");
3438 3438
 	} else {
3439
-		$url = preg_replace( '#^\w+://#', $scheme . '://', $url );
3439
+		$url = preg_replace('#^\w+://#', $scheme.'://', $url);
3440 3440
 	}
3441 3441
 
3442 3442
 	/**
@@ -3449,7 +3449,7 @@  discard block
 block discarded – undo
3449 3449
 	 * @param string|null $orig_scheme Scheme requested for the URL. One of 'http', 'https', 'login',
3450 3450
 	 *                                 'login_post', 'admin', 'relative', 'rest', 'rpc', or null.
3451 3451
 	 */
3452
-	return apply_filters( 'set_url_scheme', $url, $scheme, $orig_scheme );
3452
+	return apply_filters('set_url_scheme', $url, $scheme, $orig_scheme);
3453 3453
 }
3454 3454
 
3455 3455
 /**
@@ -3468,24 +3468,24 @@  discard block
 block discarded – undo
3468 3468
  *                        and is_ssl(). 'http' or 'https' can be passed to force those schemes.
3469 3469
  * @return string Dashboard URL link with optional path appended.
3470 3470
  */
3471
-function get_dashboard_url( $user_id = 0, $path = '', $scheme = 'admin' ) {
3471
+function get_dashboard_url($user_id = 0, $path = '', $scheme = 'admin') {
3472 3472
 	$user_id = $user_id ? (int) $user_id : get_current_user_id();
3473 3473
 
3474
-	$blogs = get_blogs_of_user( $user_id );
3475
-	if ( is_multisite() && ! user_can( $user_id, 'manage_network' ) && empty($blogs) ) {
3476
-		$url = user_admin_url( $path, $scheme );
3477
-	} elseif ( ! is_multisite() ) {
3478
-		$url = admin_url( $path, $scheme );
3474
+	$blogs = get_blogs_of_user($user_id);
3475
+	if (is_multisite() && ! user_can($user_id, 'manage_network') && empty($blogs)) {
3476
+		$url = user_admin_url($path, $scheme);
3477
+	} elseif ( ! is_multisite()) {
3478
+		$url = admin_url($path, $scheme);
3479 3479
 	} else {
3480 3480
 		$current_blog = get_current_blog_id();
3481
-		if ( $current_blog  && ( user_can( $user_id, 'manage_network' ) || in_array( $current_blog, array_keys( $blogs ) ) ) ) {
3482
-			$url = admin_url( $path, $scheme );
3481
+		if ($current_blog && (user_can($user_id, 'manage_network') || in_array($current_blog, array_keys($blogs)))) {
3482
+			$url = admin_url($path, $scheme);
3483 3483
 		} else {
3484
-			$active = get_active_blog_for_user( $user_id );
3485
-			if ( $active )
3486
-				$url = get_admin_url( $active->blog_id, $path, $scheme );
3484
+			$active = get_active_blog_for_user($user_id);
3485
+			if ($active)
3486
+				$url = get_admin_url($active->blog_id, $path, $scheme);
3487 3487
 			else
3488
-				$url = user_admin_url( $path, $scheme );
3488
+				$url = user_admin_url($path, $scheme);
3489 3489
 		}
3490 3490
 	}
3491 3491
 
@@ -3500,7 +3500,7 @@  discard block
 block discarded – undo
3500 3500
 	 * @param string $scheme  Scheme to give the URL context. Accepts 'http', 'https', 'login',
3501 3501
 	 *                        'login_post', 'admin', 'relative' or null.
3502 3502
 	 */
3503
-	return apply_filters( 'user_dashboard_url', $url, $user_id, $path, $scheme);
3503
+	return apply_filters('user_dashboard_url', $url, $user_id, $path, $scheme);
3504 3504
 }
3505 3505
 
3506 3506
 /**
@@ -3513,15 +3513,15 @@  discard block
 block discarded – undo
3513 3513
  *                        and is_ssl(). 'http' or 'https' can be passed to force those schemes.
3514 3514
  * @return string Dashboard URL link with optional path appended.
3515 3515
  */
3516
-function get_edit_profile_url( $user_id = 0, $scheme = 'admin' ) {
3516
+function get_edit_profile_url($user_id = 0, $scheme = 'admin') {
3517 3517
 	$user_id = $user_id ? (int) $user_id : get_current_user_id();
3518 3518
 
3519
-	if ( is_user_admin() )
3520
-		$url = user_admin_url( 'profile.php', $scheme );
3521
-	elseif ( is_network_admin() )
3522
-		$url = network_admin_url( 'profile.php', $scheme );
3519
+	if (is_user_admin())
3520
+		$url = user_admin_url('profile.php', $scheme);
3521
+	elseif (is_network_admin())
3522
+		$url = network_admin_url('profile.php', $scheme);
3523 3523
 	else
3524
-		$url = get_dashboard_url( $user_id, 'profile.php', $scheme );
3524
+		$url = get_dashboard_url($user_id, 'profile.php', $scheme);
3525 3525
 
3526 3526
 	/**
3527 3527
 	 * Filters the URL for a user's profile editor.
@@ -3533,7 +3533,7 @@  discard block
 block discarded – undo
3533 3533
 	 * @param string $scheme  Scheme to give the URL context. Accepts 'http', 'https', 'login',
3534 3534
 	 *                        'login_post', 'admin', 'relative' or null.
3535 3535
 	 */
3536
-	return apply_filters( 'edit_profile_url', $url, $user_id, $scheme);
3536
+	return apply_filters('edit_profile_url', $url, $user_id, $scheme);
3537 3537
 }
3538 3538
 
3539 3539
 /**
@@ -3548,33 +3548,33 @@  discard block
 block discarded – undo
3548 3548
  * @return string|false The canonical URL, or false if the post does not exist or has not
3549 3549
  *                      been published yet.
3550 3550
  */
3551
-function wp_get_canonical_url( $post = null ) {
3552
-	$post = get_post( $post );
3551
+function wp_get_canonical_url($post = null) {
3552
+	$post = get_post($post);
3553 3553
 
3554
-	if ( ! $post ) {
3554
+	if ( ! $post) {
3555 3555
 		return false;
3556 3556
 	}
3557 3557
 
3558
-	if ( 'publish' !== $post->post_status ) {
3558
+	if ('publish' !== $post->post_status) {
3559 3559
 		return false;
3560 3560
 	}
3561 3561
 
3562
-	$canonical_url = get_permalink( $post );
3562
+	$canonical_url = get_permalink($post);
3563 3563
 
3564 3564
 	// If a canonical is being generated for the current page, make sure it has pagination if needed.
3565
-	if ( $post->ID === get_queried_object_id() ) {
3566
-		$page = get_query_var( 'page', 0 );
3567
-		if ( $page >= 2 ) {
3568
-			if ( '' == get_option( 'permalink_structure' ) ) {
3569
-				$canonical_url = add_query_arg( 'page', $page, $canonical_url );
3565
+	if ($post->ID === get_queried_object_id()) {
3566
+		$page = get_query_var('page', 0);
3567
+		if ($page >= 2) {
3568
+			if ('' == get_option('permalink_structure')) {
3569
+				$canonical_url = add_query_arg('page', $page, $canonical_url);
3570 3570
 			} else {
3571
-				$canonical_url = trailingslashit( $canonical_url ) . user_trailingslashit( $page, 'single_paged' );
3571
+				$canonical_url = trailingslashit($canonical_url).user_trailingslashit($page, 'single_paged');
3572 3572
 			}
3573 3573
 		}
3574 3574
 
3575
-		$cpage = get_query_var( 'cpage', 0 );
3576
-		if ( $cpage ) {
3577
-			$canonical_url = get_comments_pagenum_link( $cpage );
3575
+		$cpage = get_query_var('cpage', 0);
3576
+		if ($cpage) {
3577
+			$canonical_url = get_comments_pagenum_link($cpage);
3578 3578
 		}
3579 3579
 	}
3580 3580
 
@@ -3586,7 +3586,7 @@  discard block
 block discarded – undo
3586 3586
 	 * @param string  $canonical_url The post's canonical URL.
3587 3587
 	 * @param WP_Post $post          Post object.
3588 3588
 	 */
3589
-	return apply_filters( 'get_canonical_url', $canonical_url, $post );
3589
+	return apply_filters('get_canonical_url', $canonical_url, $post);
3590 3590
 }
3591 3591
 
3592 3592
 /**
@@ -3596,20 +3596,20 @@  discard block
 block discarded – undo
3596 3596
  * @since 4.6.0 Adjusted to use wp_get_canonical_url().
3597 3597
  */
3598 3598
 function rel_canonical() {
3599
-	if ( ! is_singular() ) {
3599
+	if ( ! is_singular()) {
3600 3600
 		return;
3601 3601
 	}
3602 3602
 
3603 3603
 	$id = get_queried_object_id();
3604 3604
 
3605
-	if ( 0 === $id ) {
3605
+	if (0 === $id) {
3606 3606
 		return;
3607 3607
 	}
3608 3608
 
3609
-	$url = wp_get_canonical_url( $id );
3609
+	$url = wp_get_canonical_url($id);
3610 3610
 
3611
-	if ( ! empty( $url ) ) {
3612
-		echo '<link rel="canonical" href="' . esc_url( $url ) . '" />' . "\n";
3611
+	if ( ! empty($url)) {
3612
+		echo '<link rel="canonical" href="'.esc_url($url).'" />'."\n";
3613 3613
 	}
3614 3614
 }
3615 3615
 
@@ -3633,7 +3633,7 @@  discard block
 block discarded – undo
3633 3633
  * @return string A shortlink or an empty string if no shortlink exists for the requested resource or if shortlinks
3634 3634
  *                are not enabled.
3635 3635
  */
3636
-function wp_get_shortlink( $id = 0, $context = 'post', $allow_slugs = true ) {
3636
+function wp_get_shortlink($id = 0, $context = 'post', $allow_slugs = true) {
3637 3637
 	/**
3638 3638
 	 * Filters whether to preempt generating a shortlink for the given post.
3639 3639
 	 *
@@ -3647,32 +3647,32 @@  discard block
 block discarded – undo
3647 3647
 	 * @param string      $context     The context for the link. One of 'post' or 'query',
3648 3648
 	 * @param bool        $allow_slugs Whether to allow post slugs in the shortlink.
3649 3649
 	 */
3650
-	$shortlink = apply_filters( 'pre_get_shortlink', false, $id, $context, $allow_slugs );
3650
+	$shortlink = apply_filters('pre_get_shortlink', false, $id, $context, $allow_slugs);
3651 3651
 
3652
-	if ( false !== $shortlink ) {
3652
+	if (false !== $shortlink) {
3653 3653
 		return $shortlink;
3654 3654
 	}
3655 3655
 
3656 3656
 	$post_id = 0;
3657
-	if ( 'query' == $context && is_singular() ) {
3657
+	if ('query' == $context && is_singular()) {
3658 3658
 		$post_id = get_queried_object_id();
3659
-		$post = get_post( $post_id );
3660
-	} elseif ( 'post' == $context ) {
3661
-		$post = get_post( $id );
3662
-		if ( ! empty( $post->ID ) )
3659
+		$post = get_post($post_id);
3660
+	} elseif ('post' == $context) {
3661
+		$post = get_post($id);
3662
+		if ( ! empty($post->ID))
3663 3663
 			$post_id = $post->ID;
3664 3664
 	}
3665 3665
 
3666 3666
 	$shortlink = '';
3667 3667
 
3668 3668
 	// Return p= link for all public post types.
3669
-	if ( ! empty( $post_id ) ) {
3670
-		$post_type = get_post_type_object( $post->post_type );
3669
+	if ( ! empty($post_id)) {
3670
+		$post_type = get_post_type_object($post->post_type);
3671 3671
 
3672
-		if ( 'page' === $post->post_type && $post->ID == get_option( 'page_on_front' ) && 'page' == get_option( 'show_on_front' ) ) {
3673
-			$shortlink = home_url( '/' );
3674
-		} elseif ( $post_type->public ) {
3675
-			$shortlink = home_url( '?p=' . $post_id );
3672
+		if ('page' === $post->post_type && $post->ID == get_option('page_on_front') && 'page' == get_option('show_on_front')) {
3673
+			$shortlink = home_url('/');
3674
+		} elseif ($post_type->public) {
3675
+			$shortlink = home_url('?p='.$post_id);
3676 3676
 		}
3677 3677
 	}
3678 3678
 
@@ -3686,7 +3686,7 @@  discard block
 block discarded – undo
3686 3686
 	 * @param string $context     The context for the link. One of 'post' or 'query',
3687 3687
 	 * @param bool   $allow_slugs Whether to allow post slugs in the shortlink. Not used by default.
3688 3688
 	 */
3689
-	return apply_filters( 'get_shortlink', $shortlink, $id, $context, $allow_slugs );
3689
+	return apply_filters('get_shortlink', $shortlink, $id, $context, $allow_slugs);
3690 3690
 }
3691 3691
 
3692 3692
 /**
@@ -3697,12 +3697,12 @@  discard block
 block discarded – undo
3697 3697
  * @since 3.0.0
3698 3698
  */
3699 3699
 function wp_shortlink_wp_head() {
3700
-	$shortlink = wp_get_shortlink( 0, 'query' );
3700
+	$shortlink = wp_get_shortlink(0, 'query');
3701 3701
 
3702
-	if ( empty( $shortlink ) )
3702
+	if (empty($shortlink))
3703 3703
 		return;
3704 3704
 
3705
-	echo "<link rel='shortlink' href='" . esc_url( $shortlink ) . "' />\n";
3705
+	echo "<link rel='shortlink' href='".esc_url($shortlink)."' />\n";
3706 3706
 }
3707 3707
 
3708 3708
 /**
@@ -3713,15 +3713,15 @@  discard block
 block discarded – undo
3713 3713
  * @since 3.0.0
3714 3714
  */
3715 3715
 function wp_shortlink_header() {
3716
-	if ( headers_sent() )
3716
+	if (headers_sent())
3717 3717
 		return;
3718 3718
 
3719 3719
 	$shortlink = wp_get_shortlink(0, 'query');
3720 3720
 
3721
-	if ( empty($shortlink) )
3721
+	if (empty($shortlink))
3722 3722
 		return;
3723 3723
 
3724
-	header('Link: <' . $shortlink . '>; rel=shortlink', false);
3724
+	header('Link: <'.$shortlink.'>; rel=shortlink', false);
3725 3725
 }
3726 3726
 
3727 3727
 /**
@@ -3738,19 +3738,19 @@  discard block
 block discarded – undo
3738 3738
  * @param string $before Optional HTML to display before the link. Default empty.
3739 3739
  * @param string $after  Optional HTML to display after the link. Default empty.
3740 3740
  */
3741
-function the_shortlink( $text = '', $title = '', $before = '', $after = '' ) {
3741
+function the_shortlink($text = '', $title = '', $before = '', $after = '') {
3742 3742
 	$post = get_post();
3743 3743
 
3744
-	if ( empty( $text ) )
3744
+	if (empty($text))
3745 3745
 		$text = __('This is the short link.');
3746 3746
 
3747
-	if ( empty( $title ) )
3748
-		$title = the_title_attribute( array( 'echo' => false ) );
3747
+	if (empty($title))
3748
+		$title = the_title_attribute(array('echo' => false));
3749 3749
 
3750
-	$shortlink = wp_get_shortlink( $post->ID );
3750
+	$shortlink = wp_get_shortlink($post->ID);
3751 3751
 
3752
-	if ( !empty( $shortlink ) ) {
3753
-		$link = '<a rel="shortlink" href="' . esc_url( $shortlink ) . '" title="' . $title . '">' . $text . '</a>';
3752
+	if ( ! empty($shortlink)) {
3753
+		$link = '<a rel="shortlink" href="'.esc_url($shortlink).'" title="'.$title.'">'.$text.'</a>';
3754 3754
 
3755 3755
 		/**
3756 3756
 		 * Filters the short link anchor tag for a post.
@@ -3762,7 +3762,7 @@  discard block
 block discarded – undo
3762 3762
 		 * @param string $text      Shortlink's text.
3763 3763
 		 * @param string $title     Shortlink's title attribute.
3764 3764
 		 */
3765
-		$link = apply_filters( 'the_shortlink', $link, $shortlink, $text, $title );
3765
+		$link = apply_filters('the_shortlink', $link, $shortlink, $text, $title);
3766 3766
 		echo $before, $link, $after;
3767 3767
 	}
3768 3768
 }
@@ -3795,8 +3795,8 @@  discard block
 block discarded – undo
3795 3795
  * }
3796 3796
  * @return false|string The URL of the avatar we found, or false if we couldn't find an avatar.
3797 3797
  */
3798
-function get_avatar_url( $id_or_email, $args = null ) {
3799
-	$args = get_avatar_data( $id_or_email, $args );
3798
+function get_avatar_url($id_or_email, $args = null) {
3799
+	$args = get_avatar_data($id_or_email, $args);
3800 3800
 	return $args['url'];
3801 3801
 }
3802 3802
 
@@ -3836,51 +3836,51 @@  discard block
 block discarded – undo
3836 3836
  *     @type string $url          The URL of the avatar we found.
3837 3837
  * }
3838 3838
  */
3839
-function get_avatar_data( $id_or_email, $args = null ) {
3840
-	$args = wp_parse_args( $args, array(
3839
+function get_avatar_data($id_or_email, $args = null) {
3840
+	$args = wp_parse_args($args, array(
3841 3841
 		'size'           => 96,
3842 3842
 		'height'         => null,
3843 3843
 		'width'          => null,
3844
-		'default'        => get_option( 'avatar_default', 'mystery' ),
3844
+		'default'        => get_option('avatar_default', 'mystery'),
3845 3845
 		'force_default'  => false,
3846
-		'rating'         => get_option( 'avatar_rating' ),
3846
+		'rating'         => get_option('avatar_rating'),
3847 3847
 		'scheme'         => null,
3848 3848
 		'processed_args' => null, // if used, should be a reference
3849 3849
 		'extra_attr'     => '',
3850
-	) );
3850
+	));
3851 3851
 
3852
-	if ( is_numeric( $args['size'] ) ) {
3853
-		$args['size'] = absint( $args['size'] );
3854
-		if ( ! $args['size'] ) {
3852
+	if (is_numeric($args['size'])) {
3853
+		$args['size'] = absint($args['size']);
3854
+		if ( ! $args['size']) {
3855 3855
 			$args['size'] = 96;
3856 3856
 		}
3857 3857
 	} else {
3858 3858
 		$args['size'] = 96;
3859 3859
 	}
3860 3860
 
3861
-	if ( is_numeric( $args['height'] ) ) {
3862
-		$args['height'] = absint( $args['height'] );
3863
-		if ( ! $args['height'] ) {
3861
+	if (is_numeric($args['height'])) {
3862
+		$args['height'] = absint($args['height']);
3863
+		if ( ! $args['height']) {
3864 3864
 			$args['height'] = $args['size'];
3865 3865
 		}
3866 3866
 	} else {
3867 3867
 		$args['height'] = $args['size'];
3868 3868
 	}
3869 3869
 
3870
-	if ( is_numeric( $args['width'] ) ) {
3871
-		$args['width'] = absint( $args['width'] );
3872
-		if ( ! $args['width'] ) {
3870
+	if (is_numeric($args['width'])) {
3871
+		$args['width'] = absint($args['width']);
3872
+		if ( ! $args['width']) {
3873 3873
 			$args['width'] = $args['size'];
3874 3874
 		}
3875 3875
 	} else {
3876 3876
 		$args['width'] = $args['size'];
3877 3877
 	}
3878 3878
 
3879
-	if ( empty( $args['default'] ) ) {
3880
-		$args['default'] = get_option( 'avatar_default', 'mystery' );
3879
+	if (empty($args['default'])) {
3880
+		$args['default'] = get_option('avatar_default', 'mystery');
3881 3881
 	}
3882 3882
 
3883
-	switch ( $args['default'] ) {
3883
+	switch ($args['default']) {
3884 3884
 		case 'mm' :
3885 3885
 		case 'mystery' :
3886 3886
 		case 'mysteryman' :
@@ -3893,7 +3893,7 @@  discard block
 block discarded – undo
3893 3893
 
3894 3894
 	$args['force_default'] = (bool) $args['force_default'];
3895 3895
 
3896
-	$args['rating'] = strtolower( $args['rating'] );
3896
+	$args['rating'] = strtolower($args['rating']);
3897 3897
 
3898 3898
 	$args['found_avatar'] = false;
3899 3899
 
@@ -3910,38 +3910,38 @@  discard block
 block discarded – undo
3910 3910
 	 * @param mixed  $id_or_email The Gravatar to retrieve. Accepts a user_id, gravatar md5 hash,
3911 3911
 	 *                            user email, WP_User object, WP_Post object, or WP_Comment object.
3912 3912
 	 */
3913
-	$args = apply_filters( 'pre_get_avatar_data', $args, $id_or_email );
3913
+	$args = apply_filters('pre_get_avatar_data', $args, $id_or_email);
3914 3914
 
3915
-	if ( isset( $args['url'] ) && ! is_null( $args['url'] ) ) {
3915
+	if (isset($args['url']) && ! is_null($args['url'])) {
3916 3916
 		/** This filter is documented in wp-includes/link-template.php */
3917
-		return apply_filters( 'get_avatar_data', $args, $id_or_email );
3917
+		return apply_filters('get_avatar_data', $args, $id_or_email);
3918 3918
 	}
3919 3919
 
3920 3920
 	$email_hash = '';
3921 3921
 	$user = $email = false;
3922 3922
 
3923
-	if ( is_object( $id_or_email ) && isset( $id_or_email->comment_ID ) ) {
3924
-		$id_or_email = get_comment( $id_or_email );
3923
+	if (is_object($id_or_email) && isset($id_or_email->comment_ID)) {
3924
+		$id_or_email = get_comment($id_or_email);
3925 3925
 	}
3926 3926
 
3927 3927
 	// Process the user identifier.
3928
-	if ( is_numeric( $id_or_email ) ) {
3929
-		$user = get_user_by( 'id', absint( $id_or_email ) );
3930
-	} elseif ( is_string( $id_or_email ) ) {
3931
-		if ( strpos( $id_or_email, '@md5.gravatar.com' ) ) {
3928
+	if (is_numeric($id_or_email)) {
3929
+		$user = get_user_by('id', absint($id_or_email));
3930
+	} elseif (is_string($id_or_email)) {
3931
+		if (strpos($id_or_email, '@md5.gravatar.com')) {
3932 3932
 			// md5 hash
3933
-			list( $email_hash ) = explode( '@', $id_or_email );
3933
+			list($email_hash) = explode('@', $id_or_email);
3934 3934
 		} else {
3935 3935
 			// email address
3936 3936
 			$email = $id_or_email;
3937 3937
 		}
3938
-	} elseif ( $id_or_email instanceof WP_User ) {
3938
+	} elseif ($id_or_email instanceof WP_User) {
3939 3939
 		// User Object
3940 3940
 		$user = $id_or_email;
3941
-	} elseif ( $id_or_email instanceof WP_Post ) {
3941
+	} elseif ($id_or_email instanceof WP_Post) {
3942 3942
 		// Post Object
3943
-		$user = get_user_by( 'id', (int) $id_or_email->post_author );
3944
-	} elseif ( $id_or_email instanceof WP_Comment ) {
3943
+		$user = get_user_by('id', (int) $id_or_email->post_author);
3944
+	} elseif ($id_or_email instanceof WP_Comment) {
3945 3945
 		/**
3946 3946
 		 * Filters the list of allowed comment types for retrieving avatars.
3947 3947
 		 *
@@ -3949,36 +3949,36 @@  discard block
 block discarded – undo
3949 3949
 		 *
3950 3950
 		 * @param array $types An array of content types. Default only contains 'comment'.
3951 3951
 		 */
3952
-		$allowed_comment_types = apply_filters( 'get_avatar_comment_types', array( 'comment' ) );
3953
-		if ( ! empty( $id_or_email->comment_type ) && ! in_array( $id_or_email->comment_type, (array) $allowed_comment_types ) ) {
3952
+		$allowed_comment_types = apply_filters('get_avatar_comment_types', array('comment'));
3953
+		if ( ! empty($id_or_email->comment_type) && ! in_array($id_or_email->comment_type, (array) $allowed_comment_types)) {
3954 3954
 			$args['url'] = false;
3955 3955
 			/** This filter is documented in wp-includes/link-template.php */
3956
-			return apply_filters( 'get_avatar_data', $args, $id_or_email );
3956
+			return apply_filters('get_avatar_data', $args, $id_or_email);
3957 3957
 		}
3958 3958
 
3959
-		if ( ! empty( $id_or_email->user_id ) ) {
3960
-			$user = get_user_by( 'id', (int) $id_or_email->user_id );
3959
+		if ( ! empty($id_or_email->user_id)) {
3960
+			$user = get_user_by('id', (int) $id_or_email->user_id);
3961 3961
 		}
3962
-		if ( ( ! $user || is_wp_error( $user ) ) && ! empty( $id_or_email->comment_author_email ) ) {
3962
+		if (( ! $user || is_wp_error($user)) && ! empty($id_or_email->comment_author_email)) {
3963 3963
 			$email = $id_or_email->comment_author_email;
3964 3964
 		}
3965 3965
 	}
3966 3966
 
3967
-	if ( ! $email_hash ) {
3968
-		if ( $user ) {
3967
+	if ( ! $email_hash) {
3968
+		if ($user) {
3969 3969
 			$email = $user->user_email;
3970 3970
 		}
3971 3971
 
3972
-		if ( $email ) {
3973
-			$email_hash = md5( strtolower( trim( $email ) ) );
3972
+		if ($email) {
3973
+			$email_hash = md5(strtolower(trim($email)));
3974 3974
 		}
3975 3975
 	}
3976 3976
 
3977
-	if ( $email_hash ) {
3977
+	if ($email_hash) {
3978 3978
 		$args['found_avatar'] = true;
3979
-		$gravatar_server = hexdec( $email_hash[0] ) % 3;
3979
+		$gravatar_server = hexdec($email_hash[0]) % 3;
3980 3980
 	} else {
3981
-		$gravatar_server = rand( 0, 2 );
3981
+		$gravatar_server = rand(0, 2);
3982 3982
 	}
3983 3983
 
3984 3984
 	$url_args = array(
@@ -3988,15 +3988,15 @@  discard block
 block discarded – undo
3988 3988
 		'r' => $args['rating'],
3989 3989
 	);
3990 3990
 
3991
-	if ( is_ssl() ) {
3992
-		$url = 'https://secure.gravatar.com/avatar/' . $email_hash;
3991
+	if (is_ssl()) {
3992
+		$url = 'https://secure.gravatar.com/avatar/'.$email_hash;
3993 3993
 	} else {
3994
-		$url = sprintf( 'http://%d.gravatar.com/avatar/%s', $gravatar_server, $email_hash );
3994
+		$url = sprintf('http://%d.gravatar.com/avatar/%s', $gravatar_server, $email_hash);
3995 3995
 	}
3996 3996
 
3997 3997
 	$url = add_query_arg(
3998
-		rawurlencode_deep( array_filter( $url_args ) ),
3999
-		set_url_scheme( $url, $args['scheme'] )
3998
+		rawurlencode_deep(array_filter($url_args)),
3999
+		set_url_scheme($url, $args['scheme'])
4000 4000
 	);
4001 4001
 
4002 4002
 	/**
@@ -4009,7 +4009,7 @@  discard block
 block discarded – undo
4009 4009
 	 *                            user email, WP_User object, WP_Post object, or WP_Comment object.
4010 4010
 	 * @param array  $args        Arguments passed to get_avatar_data(), after processing.
4011 4011
 	 */
4012
-	$args['url'] = apply_filters( 'get_avatar_url', $url, $id_or_email, $args );
4012
+	$args['url'] = apply_filters('get_avatar_url', $url, $id_or_email, $args);
4013 4013
 
4014 4014
 	/**
4015 4015
 	 * Filters the avatar data.
@@ -4020,7 +4020,7 @@  discard block
 block discarded – undo
4020 4020
 	 * @param mixed  $id_or_email The Gravatar to retrieve. Accepts a user_id, gravatar md5 hash,
4021 4021
 	 *                            user email, WP_User object, WP_Post object, or WP_Comment object.
4022 4022
 	 */
4023
-	return apply_filters( 'get_avatar_data', $args, $id_or_email );
4023
+	return apply_filters('get_avatar_data', $args, $id_or_email);
4024 4024
 }
4025 4025
 
4026 4026
 /**
@@ -4034,15 +4034,15 @@  discard block
 block discarded – undo
4034 4034
  * @param string $file Optional. File to search for in the stylesheet directory.
4035 4035
  * @return string The URL of the file.
4036 4036
  */
4037
-function get_theme_file_uri( $file = '' ) {
4038
-	$file = ltrim( $file, '/' );
4037
+function get_theme_file_uri($file = '') {
4038
+	$file = ltrim($file, '/');
4039 4039
 
4040
-	if ( empty( $file ) ) {
4040
+	if (empty($file)) {
4041 4041
 		$url = get_stylesheet_directory_uri();
4042
-	} elseif ( file_exists( get_stylesheet_directory() . '/' . $file ) ) {
4043
-		$url = get_stylesheet_directory_uri() . '/' . $file;
4042
+	} elseif (file_exists(get_stylesheet_directory().'/'.$file)) {
4043
+		$url = get_stylesheet_directory_uri().'/'.$file;
4044 4044
 	} else {
4045
-		$url = get_template_directory_uri() . '/' . $file;
4045
+		$url = get_template_directory_uri().'/'.$file;
4046 4046
 	}
4047 4047
 
4048 4048
 	/**
@@ -4053,7 +4053,7 @@  discard block
 block discarded – undo
4053 4053
 	 * @param string $url  The file URL.
4054 4054
 	 * @param string $file The requested file to search for.
4055 4055
 	 */
4056
-	return apply_filters( 'theme_file_uri', $url, $file );
4056
+	return apply_filters('theme_file_uri', $url, $file);
4057 4057
 }
4058 4058
 
4059 4059
 /**
@@ -4064,13 +4064,13 @@  discard block
 block discarded – undo
4064 4064
  * @param string $file Optional. File to return the URL for in the template directory.
4065 4065
  * @return string The URL of the file.
4066 4066
  */
4067
-function get_parent_theme_file_uri( $file = '' ) {
4068
-	$file = ltrim( $file, '/' );
4067
+function get_parent_theme_file_uri($file = '') {
4068
+	$file = ltrim($file, '/');
4069 4069
 
4070
-	if ( empty( $file ) ) {
4070
+	if (empty($file)) {
4071 4071
 		$url = get_template_directory_uri();
4072 4072
 	} else {
4073
-		$url = get_template_directory_uri() . '/' . $file;
4073
+		$url = get_template_directory_uri().'/'.$file;
4074 4074
 	}
4075 4075
 
4076 4076
 	/**
@@ -4081,7 +4081,7 @@  discard block
 block discarded – undo
4081 4081
 	 * @param string $url  The file URL.
4082 4082
 	 * @param string $file The requested file to search for.
4083 4083
 	 */
4084
-	return apply_filters( 'parent_theme_file_uri', $url, $file );
4084
+	return apply_filters('parent_theme_file_uri', $url, $file);
4085 4085
 }
4086 4086
 
4087 4087
 /**
@@ -4095,15 +4095,15 @@  discard block
 block discarded – undo
4095 4095
  * @param string $file Optional. File to search for in the stylesheet directory.
4096 4096
  * @return string The path of the file.
4097 4097
  */
4098
-function get_theme_file_path( $file = '' ) {
4099
-	$file = ltrim( $file, '/' );
4098
+function get_theme_file_path($file = '') {
4099
+	$file = ltrim($file, '/');
4100 4100
 
4101
-	if ( empty( $file ) ) {
4101
+	if (empty($file)) {
4102 4102
 		$path = get_stylesheet_directory();
4103
-	} elseif ( file_exists( get_stylesheet_directory() . '/' . $file ) ) {
4104
-		$path = get_stylesheet_directory() . '/' . $file;
4103
+	} elseif (file_exists(get_stylesheet_directory().'/'.$file)) {
4104
+		$path = get_stylesheet_directory().'/'.$file;
4105 4105
 	} else {
4106
-		$path = get_template_directory() . '/' . $file;
4106
+		$path = get_template_directory().'/'.$file;
4107 4107
 	}
4108 4108
 
4109 4109
 	/**
@@ -4114,7 +4114,7 @@  discard block
 block discarded – undo
4114 4114
 	 * @param string $path The file path.
4115 4115
 	 * @param string $file The requested file to search for.
4116 4116
 	 */
4117
-	return apply_filters( 'theme_file_path', $path, $file );
4117
+	return apply_filters('theme_file_path', $path, $file);
4118 4118
 }
4119 4119
 
4120 4120
 /**
@@ -4125,13 +4125,13 @@  discard block
 block discarded – undo
4125 4125
  * @param string $file Optional. File to return the path for in the template directory.
4126 4126
  * @return string The path of the file.
4127 4127
  */
4128
-function get_parent_theme_file_path( $file = '' ) {
4129
-	$file = ltrim( $file, '/' );
4128
+function get_parent_theme_file_path($file = '') {
4129
+	$file = ltrim($file, '/');
4130 4130
 
4131
-	if ( empty( $file ) ) {
4131
+	if (empty($file)) {
4132 4132
 		$path = get_template_directory();
4133 4133
 	} else {
4134
-		$path = get_template_directory() . '/' . $file;
4134
+		$path = get_template_directory().'/'.$file;
4135 4135
 	}
4136 4136
 
4137 4137
 	/**
@@ -4142,5 +4142,5 @@  discard block
 block discarded – undo
4142 4142
 	 * @param string $path The file path.
4143 4143
 	 * @param string $file The requested file to search for.
4144 4144
 	 */
4145
-	return apply_filters( 'parent_theme_file_path', $path, $file );
4145
+	return apply_filters('parent_theme_file_path', $path, $file);
4146 4146
 }
Please login to merge, or discard this patch.
Braces   +471 added lines, -338 removed lines patch added patch discarded remove patch
@@ -46,10 +46,11 @@  discard block
 block discarded – undo
46 46
  */
47 47
 function user_trailingslashit($string, $type_of_url = '') {
48 48
 	global $wp_rewrite;
49
-	if ( $wp_rewrite->use_trailing_slashes )
50
-		$string = trailingslashit($string);
51
-	else
52
-		$string = untrailingslashit($string);
49
+	if ( $wp_rewrite->use_trailing_slashes ) {
50
+			$string = trailingslashit($string);
51
+	} else {
52
+			$string = untrailingslashit($string);
53
+	}
53 54
 
54 55
 	/**
55 56
 	 * Filters the trailing-slashed string, depending on whether the site is set to use trailing slashes.
@@ -137,15 +138,17 @@  discard block
 block discarded – undo
137 138
 		$sample = false;
138 139
 	}
139 140
 
140
-	if ( empty($post->ID) )
141
-		return false;
141
+	if ( empty($post->ID) ) {
142
+			return false;
143
+	}
142 144
 
143
-	if ( $post->post_type == 'page' )
144
-		return get_page_link($post, $leavename, $sample);
145
-	elseif ( $post->post_type == 'attachment' )
146
-		return get_attachment_link( $post, $leavename );
147
-	elseif ( in_array($post->post_type, get_post_types( array('_builtin' => false) ) ) )
148
-		return get_post_permalink($post, $leavename, $sample);
145
+	if ( $post->post_type == 'page' ) {
146
+			return get_page_link($post, $leavename, $sample);
147
+	} elseif ( $post->post_type == 'attachment' ) {
148
+			return get_attachment_link( $post, $leavename );
149
+	} elseif ( in_array($post->post_type, get_post_types( array('_builtin' => false) ) ) ) {
150
+			return get_post_permalink($post, $leavename, $sample);
151
+	}
149 152
 
150 153
 	$permalink = get_option('permalink_structure');
151 154
 
@@ -186,8 +189,9 @@  discard block
 block discarded – undo
186 189
 
187 190
 				$category_object = get_term( $category_object, 'category' );
188 191
 				$category = $category_object->slug;
189
-				if ( $parent = $category_object->parent )
190
-					$category = get_category_parents($parent, false, '/', true) . $category;
192
+				if ( $parent = $category_object->parent ) {
193
+									$category = get_category_parents($parent, false, '/', true) . $category;
194
+				}
191 195
 			}
192 196
 			// show default category in permalinks, without
193 197
 			// having to assign it explicitly
@@ -257,8 +261,9 @@  discard block
 block discarded – undo
257 261
 
258 262
 	$post = get_post($id);
259 263
 
260
-	if ( is_wp_error( $post ) )
261
-		return $post;
264
+	if ( is_wp_error( $post ) ) {
265
+			return $post;
266
+	}
262 267
 
263 268
 	$post_link = $wp_rewrite->get_extra_permastruct($post->post_type);
264 269
 
@@ -278,10 +283,11 @@  discard block
 block discarded – undo
278 283
 		}
279 284
 		$post_link = home_url( user_trailingslashit($post_link) );
280 285
 	} else {
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), '');
286
+		if ( $post_type->query_var && ( isset($post->post_status) && !$draft_or_pending ) ) {
287
+					$post_link = add_query_arg($post_type->query_var, $slug, '');
288
+		} else {
289
+					$post_link = add_query_arg(array('post_type' => $post->post_type, 'p' => $post->ID), '');
290
+		}
285 291
 		$post_link = home_url($post_link);
286 292
 	}
287 293
 
@@ -314,10 +320,11 @@  discard block
 block discarded – undo
314 320
 function get_page_link( $post = false, $leavename = false, $sample = false ) {
315 321
 	$post = get_post( $post );
316 322
 
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 );
323
+	if ( 'page' == get_option( 'show_on_front' ) && $post->ID == get_option( 'page_on_front' ) ) {
324
+			$link = home_url('/');
325
+	} else {
326
+			$link = _get_page_link( $post, $leavename, $sample );
327
+	}
321 328
 
322 329
 	/**
323 330
 	 * Filters the permalink for a page.
@@ -403,27 +410,36 @@  discard block
 block discarded – undo
403 410
 	}
404 411
 
405 412
 	if ( $wp_rewrite->using_permalinks() && $parent ) {
406
-		if ( 'page' == $parent->post_type )
407
-			$parentlink = _get_page_link( $post->post_parent ); // Ignores page_on_front
408
-		else
409
-			$parentlink = get_permalink( $post->post_parent );
413
+		if ( 'page' == $parent->post_type ) {
414
+					$parentlink = _get_page_link( $post->post_parent );
415
+		}
416
+		// Ignores page_on_front
417
+		else {
418
+					$parentlink = get_permalink( $post->post_parent );
419
+		}
410 420
 
411
-		if ( is_numeric($post->post_name) || false !== strpos(get_option('permalink_structure'), '%category%') )
412
-			$name = 'attachment/' . $post->post_name; // <permalink>/<int>/ is paged so we use the explicit attachment marker
413
-		else
414
-			$name = $post->post_name;
421
+		if ( is_numeric($post->post_name) || false !== strpos(get_option('permalink_structure'), '%category%') ) {
422
+					$name = 'attachment/' . $post->post_name;
423
+		}
424
+		// <permalink>/<int>/ is paged so we use the explicit attachment marker
425
+		else {
426
+					$name = $post->post_name;
427
+		}
415 428
 
416
-		if ( strpos($parentlink, '?') === false )
417
-			$link = user_trailingslashit( trailingslashit($parentlink) . '%postname%' );
429
+		if ( strpos($parentlink, '?') === false ) {
430
+					$link = user_trailingslashit( trailingslashit($parentlink) . '%postname%' );
431
+		}
418 432
 
419
-		if ( ! $leavename )
420
-			$link = str_replace( '%postname%', $name, $link );
433
+		if ( ! $leavename ) {
434
+					$link = str_replace( '%postname%', $name, $link );
435
+		}
421 436
 	} elseif ( $wp_rewrite->using_permalinks() && ! $leavename ) {
422 437
 		$link = home_url( user_trailingslashit( $post->post_name ) );
423 438
 	}
424 439
 
425
-	if ( ! $link )
426
-		$link = home_url( '/?attachment_id=' . $post->ID );
440
+	if ( ! $link ) {
441
+			$link = home_url( '/?attachment_id=' . $post->ID );
442
+	}
427 443
 
428 444
 	/**
429 445
 	 * Filters the permalink for an attachment.
@@ -448,8 +464,9 @@  discard block
 block discarded – undo
448 464
  */
449 465
 function get_year_link( $year ) {
450 466
 	global $wp_rewrite;
451
-	if ( !$year )
452
-		$year = gmdate('Y', current_time('timestamp'));
467
+	if ( !$year ) {
468
+			$year = gmdate('Y', current_time('timestamp'));
469
+	}
453 470
 	$yearlink = $wp_rewrite->get_year_permastruct();
454 471
 	if ( !empty($yearlink) ) {
455 472
 		$yearlink = str_replace('%year%', $year, $yearlink);
@@ -482,10 +499,12 @@  discard block
 block discarded – undo
482 499
  */
483 500
 function get_month_link($year, $month) {
484 501
 	global $wp_rewrite;
485
-	if ( !$year )
486
-		$year = gmdate('Y', current_time('timestamp'));
487
-	if ( !$month )
488
-		$month = gmdate('m', current_time('timestamp'));
502
+	if ( !$year ) {
503
+			$year = gmdate('Y', current_time('timestamp'));
504
+	}
505
+	if ( !$month ) {
506
+			$month = gmdate('m', current_time('timestamp'));
507
+	}
489 508
 	$monthlink = $wp_rewrite->get_month_permastruct();
490 509
 	if ( !empty($monthlink) ) {
491 510
 		$monthlink = str_replace('%year%', $year, $monthlink);
@@ -521,12 +540,15 @@  discard block
 block discarded – undo
521 540
  */
522 541
 function get_day_link($year, $month, $day) {
523 542
 	global $wp_rewrite;
524
-	if ( !$year )
525
-		$year = gmdate('Y', current_time('timestamp'));
526
-	if ( !$month )
527
-		$month = gmdate('m', current_time('timestamp'));
528
-	if ( !$day )
529
-		$day = gmdate('j', current_time('timestamp'));
543
+	if ( !$year ) {
544
+			$year = gmdate('Y', current_time('timestamp'));
545
+	}
546
+	if ( !$month ) {
547
+			$month = gmdate('m', current_time('timestamp'));
548
+	}
549
+	if ( !$day ) {
550
+			$day = gmdate('j', current_time('timestamp'));
551
+	}
530 552
 
531 553
 	$daylink = $wp_rewrite->get_day_permastruct();
532 554
 	if ( !empty($daylink) ) {
@@ -594,18 +616,21 @@  discard block
 block discarded – undo
594 616
 			$permalink = $wp_rewrite->get_comment_feed_permastruct();
595 617
 		}
596 618
 
597
-		if ( get_default_feed() == $feed )
598
-			$feed = '';
619
+		if ( get_default_feed() == $feed ) {
620
+					$feed = '';
621
+		}
599 622
 
600 623
 		$permalink = str_replace('%feed%', $feed, $permalink);
601 624
 		$permalink = preg_replace('#/+#', '/', "/$permalink");
602 625
 		$output =  home_url( user_trailingslashit($permalink, 'feed') );
603 626
 	} else {
604
-		if ( empty($feed) )
605
-			$feed = get_default_feed();
627
+		if ( empty($feed) ) {
628
+					$feed = get_default_feed();
629
+		}
606 630
 
607
-		if ( false !== strpos($feed, 'comments_') )
608
-			$feed = str_replace('comments_', 'comments-', $feed);
631
+		if ( false !== strpos($feed, 'comments_') ) {
632
+					$feed = str_replace('comments_', 'comments-', $feed);
633
+		}
609 634
 
610 635
 		$output = home_url("?feed={$feed}");
611 636
 	}
@@ -633,20 +658,23 @@  discard block
 block discarded – undo
633 658
 function get_post_comments_feed_link( $post_id = 0, $feed = '' ) {
634 659
 	$post_id = absint( $post_id );
635 660
 
636
-	if ( ! $post_id )
637
-		$post_id = get_the_ID();
661
+	if ( ! $post_id ) {
662
+			$post_id = get_the_ID();
663
+	}
638 664
 
639
-	if ( empty( $feed ) )
640
-		$feed = get_default_feed();
665
+	if ( empty( $feed ) ) {
666
+			$feed = get_default_feed();
667
+	}
641 668
 
642 669
 	$post = get_post( $post_id );
643 670
 	$unattached = 'attachment' === $post->post_type && 0 === (int) $post->post_parent;
644 671
 
645 672
 	if ( '' != get_option('permalink_structure') ) {
646
-		if ( 'page' == get_option('show_on_front') && $post_id == get_option('page_on_front') )
647
-			$url = _get_page_link( $post_id );
648
-		else
649
-			$url = get_permalink($post_id);
673
+		if ( 'page' == get_option('show_on_front') && $post_id == get_option('page_on_front') ) {
674
+					$url = _get_page_link( $post_id );
675
+		} else {
676
+					$url = get_permalink($post_id);
677
+		}
650 678
 
651 679
 		if ( $unattached ) {
652 680
 			$url =  home_url( '/feed/' );
@@ -656,8 +684,9 @@  discard block
 block discarded – undo
656 684
 			$url = add_query_arg( 'attachment_id', $post_id, $url );
657 685
 		} else {
658 686
 			$url = trailingslashit($url) . 'feed';
659
-			if ( $feed != get_default_feed() )
660
-				$url .= "/$feed";
687
+			if ( $feed != get_default_feed() ) {
688
+							$url .= "/$feed";
689
+			}
661 690
 			$url = user_trailingslashit($url, 'single_feed');
662 691
 		}
663 692
 	} else {
@@ -728,17 +757,19 @@  discard block
 block discarded – undo
728 757
 	$author_id = (int) $author_id;
729 758
 	$permalink_structure = get_option('permalink_structure');
730 759
 
731
-	if ( empty($feed) )
732
-		$feed = get_default_feed();
760
+	if ( empty($feed) ) {
761
+			$feed = get_default_feed();
762
+	}
733 763
 
734 764
 	if ( '' == $permalink_structure ) {
735 765
 		$link = home_url("?feed=$feed&amp;author=" . $author_id);
736 766
 	} else {
737 767
 		$link = get_author_posts_url($author_id);
738
-		if ( $feed == get_default_feed() )
739
-			$feed_link = 'feed';
740
-		else
741
-			$feed_link = "feed/$feed";
768
+		if ( $feed == get_default_feed() ) {
769
+					$feed_link = 'feed';
770
+		} else {
771
+					$feed_link = "feed/$feed";
772
+		}
742 773
 
743 774
 		$link = trailingslashit($link) . user_trailingslashit($feed_link, 'feed');
744 775
 	}
@@ -790,19 +821,20 @@  discard block
 block discarded – undo
790 821
 
791 822
 	$term = get_term( $term_id, $taxonomy  );
792 823
 
793
-	if ( empty( $term ) || is_wp_error( $term ) )
794
-		return false;
824
+	if ( empty( $term ) || is_wp_error( $term ) ) {
825
+			return false;
826
+	}
795 827
 
796
-	if ( empty( $feed ) )
797
-		$feed = get_default_feed();
828
+	if ( empty( $feed ) ) {
829
+			$feed = get_default_feed();
830
+	}
798 831
 
799 832
 	$permalink_structure = get_option( 'permalink_structure' );
800 833
 
801 834
 	if ( '' == $permalink_structure ) {
802 835
 		if ( 'category' == $taxonomy ) {
803 836
 			$link = home_url("?feed=$feed&amp;cat=$term_id");
804
-		}
805
-		elseif ( 'post_tag' == $taxonomy ) {
837
+		} elseif ( 'post_tag' == $taxonomy ) {
806 838
 			$link = home_url("?feed=$feed&amp;tag=$term->slug");
807 839
 		} else {
808 840
 			$t = get_taxonomy( $taxonomy );
@@ -810,10 +842,11 @@  discard block
 block discarded – undo
810 842
 		}
811 843
 	} else {
812 844
 		$link = get_term_link( $term_id, $term->taxonomy );
813
-		if ( $feed == get_default_feed() )
814
-			$feed_link = 'feed';
815
-		else
816
-			$feed_link = "feed/$feed";
845
+		if ( $feed == get_default_feed() ) {
846
+					$feed_link = 'feed';
847
+		} else {
848
+					$feed_link = "feed/$feed";
849
+		}
817 850
 
818 851
 		$link = trailingslashit( $link ) . user_trailingslashit( $feed_link, 'feed' );
819 852
 	}
@@ -979,19 +1012,22 @@  discard block
 block discarded – undo
979 1012
  * @return string|void HTML content.
980 1013
  */
981 1014
 function edit_term_link( $link = '', $before = '', $after = '', $term = null, $echo = true ) {
982
-	if ( is_null( $term ) )
983
-		$term = get_queried_object();
1015
+	if ( is_null( $term ) ) {
1016
+			$term = get_queried_object();
1017
+	}
984 1018
 
985
-	if ( ! $term )
986
-		return;
1019
+	if ( ! $term ) {
1020
+			return;
1021
+	}
987 1022
 
988 1023
 	$tax = get_taxonomy( $term->taxonomy );
989 1024
 	if ( ! current_user_can( 'edit_term', $term->term_id ) ) {
990 1025
 		return;
991 1026
 	}
992 1027
 
993
-	if ( empty( $link ) )
994
-		$link = __('Edit This');
1028
+	if ( empty( $link ) ) {
1029
+			$link = __('Edit This');
1030
+	}
995 1031
 
996 1032
 	$link = '<a href="' . get_edit_term_link( $term->term_id, $term->taxonomy ) . '">' . $link . '</a>';
997 1033
 
@@ -1005,11 +1041,12 @@  discard block
 block discarded – undo
1005 1041
 	 */
1006 1042
 	$link = $before . apply_filters( 'edit_term_link', $link, $term->term_id ) . $after;
1007 1043
 
1008
-	if ( $echo )
1009
-		echo $link;
1010
-	else
1011
-		return $link;
1012
-}
1044
+	if ( $echo ) {
1045
+			echo $link;
1046
+	} else {
1047
+			return $link;
1048
+	}
1049
+	}
1013 1050
 
1014 1051
 /**
1015 1052
  * Retrieves the permalink for a search.
@@ -1024,10 +1061,11 @@  discard block
 block discarded – undo
1024 1061
 function get_search_link( $query = '' ) {
1025 1062
 	global $wp_rewrite;
1026 1063
 
1027
-	if ( empty($query) )
1028
-		$search = get_search_query( false );
1029
-	else
1030
-		$search = stripslashes($query);
1064
+	if ( empty($query) ) {
1065
+			$search = get_search_query( false );
1066
+	} else {
1067
+			$search = stripslashes($query);
1068
+	}
1031 1069
 
1032 1070
 	$permastruct = $wp_rewrite->get_search_permastruct();
1033 1071
 
@@ -1066,8 +1104,9 @@  discard block
 block discarded – undo
1066 1104
 	global $wp_rewrite;
1067 1105
 	$link = get_search_link($search_query);
1068 1106
 
1069
-	if ( empty($feed) )
1070
-		$feed = get_default_feed();
1107
+	if ( empty($feed) ) {
1108
+			$feed = get_default_feed();
1109
+	}
1071 1110
 
1072 1111
 	$permastruct = $wp_rewrite->get_search_permastruct();
1073 1112
 
@@ -1104,17 +1143,19 @@  discard block
 block discarded – undo
1104 1143
 function get_search_comments_feed_link($search_query = '', $feed = '') {
1105 1144
 	global $wp_rewrite;
1106 1145
 
1107
-	if ( empty($feed) )
1108
-		$feed = get_default_feed();
1146
+	if ( empty($feed) ) {
1147
+			$feed = get_default_feed();
1148
+	}
1109 1149
 
1110 1150
 	$link = get_search_feed_link($search_query, $feed);
1111 1151
 
1112 1152
 	$permastruct = $wp_rewrite->get_search_permastruct();
1113 1153
 
1114
-	if ( empty($permastruct) )
1115
-		$link = add_query_arg('feed', 'comments-' . $feed, $link);
1116
-	else
1117
-		$link = add_query_arg('withcomments', 1, $link);
1154
+	if ( empty($permastruct) ) {
1155
+			$link = add_query_arg('feed', 'comments-' . $feed, $link);
1156
+	} else {
1157
+			$link = add_query_arg('withcomments', 1, $link);
1158
+	}
1118 1159
 
1119 1160
 	/** This filter is documented in wp-includes/link-template.php */
1120 1161
 	return apply_filters( 'search_feed_link', $link, $feed, 'comments' );
@@ -1133,8 +1174,9 @@  discard block
 block discarded – undo
1133 1174
  */
1134 1175
 function get_post_type_archive_link( $post_type ) {
1135 1176
 	global $wp_rewrite;
1136
-	if ( ! $post_type_obj = get_post_type_object( $post_type ) )
1137
-		return false;
1177
+	if ( ! $post_type_obj = get_post_type_object( $post_type ) ) {
1178
+			return false;
1179
+	}
1138 1180
 
1139 1181
 	if ( 'post' === $post_type ) {
1140 1182
 		$show_on_front = get_option( 'show_on_front' );
@@ -1149,15 +1191,17 @@  discard block
 block discarded – undo
1149 1191
 		return apply_filters( 'post_type_archive_link', $link, $post_type );
1150 1192
 	}
1151 1193
 
1152
-	if ( ! $post_type_obj->has_archive )
1153
-		return false;
1194
+	if ( ! $post_type_obj->has_archive ) {
1195
+			return false;
1196
+	}
1154 1197
 
1155 1198
 	if ( get_option( 'permalink_structure' ) && is_array( $post_type_obj->rewrite ) ) {
1156 1199
 		$struct = ( true === $post_type_obj->has_archive ) ? $post_type_obj->rewrite['slug'] : $post_type_obj->has_archive;
1157
-		if ( $post_type_obj->rewrite['with_front'] )
1158
-			$struct = $wp_rewrite->front . $struct;
1159
-		else
1160
-			$struct = $wp_rewrite->root . $struct;
1200
+		if ( $post_type_obj->rewrite['with_front'] ) {
1201
+					$struct = $wp_rewrite->front . $struct;
1202
+		} else {
1203
+					$struct = $wp_rewrite->root . $struct;
1204
+		}
1161 1205
 		$link = home_url( user_trailingslashit( $struct, 'post_type_archive' ) );
1162 1206
 	} else {
1163 1207
 		$link = home_url( '?post_type=' . $post_type );
@@ -1185,18 +1229,21 @@  discard block
 block discarded – undo
1185 1229
  */
1186 1230
 function get_post_type_archive_feed_link( $post_type, $feed = '' ) {
1187 1231
 	$default_feed = get_default_feed();
1188
-	if ( empty( $feed ) )
1189
-		$feed = $default_feed;
1232
+	if ( empty( $feed ) ) {
1233
+			$feed = $default_feed;
1234
+	}
1190 1235
 
1191
-	if ( ! $link = get_post_type_archive_link( $post_type ) )
1192
-		return false;
1236
+	if ( ! $link = get_post_type_archive_link( $post_type ) ) {
1237
+			return false;
1238
+	}
1193 1239
 
1194 1240
 	$post_type_obj = get_post_type_object( $post_type );
1195 1241
 	if ( get_option( 'permalink_structure' ) && is_array( $post_type_obj->rewrite ) && $post_type_obj->rewrite['feeds'] ) {
1196 1242
 		$link = trailingslashit( $link );
1197 1243
 		$link .= 'feed/';
1198
-		if ( $feed != $default_feed )
1199
-			$link .= "$feed/";
1244
+		if ( $feed != $default_feed ) {
1245
+					$link .= "$feed/";
1246
+		}
1200 1247
 	} else {
1201 1248
 		$link = add_query_arg( 'feed', $feed, $link );
1202 1249
 	}
@@ -1268,22 +1315,26 @@  discard block
 block discarded – undo
1268 1315
  *                     not allow an editing UI.
1269 1316
  */
1270 1317
 function get_edit_post_link( $id = 0, $context = 'display' ) {
1271
-	if ( ! $post = get_post( $id ) )
1272
-		return;
1318
+	if ( ! $post = get_post( $id ) ) {
1319
+			return;
1320
+	}
1273 1321
 
1274
-	if ( 'revision' === $post->post_type )
1275
-		$action = '';
1276
-	elseif ( 'display' == $context )
1277
-		$action = '&amp;action=edit';
1278
-	else
1279
-		$action = '&action=edit';
1322
+	if ( 'revision' === $post->post_type ) {
1323
+			$action = '';
1324
+	} elseif ( 'display' == $context ) {
1325
+			$action = '&amp;action=edit';
1326
+	} else {
1327
+			$action = '&action=edit';
1328
+	}
1280 1329
 
1281 1330
 	$post_type_object = get_post_type_object( $post->post_type );
1282
-	if ( !$post_type_object )
1283
-		return;
1331
+	if ( !$post_type_object ) {
1332
+			return;
1333
+	}
1284 1334
 
1285
-	if ( !current_user_can( 'edit_post', $post->ID ) )
1286
-		return;
1335
+	if ( !current_user_can( 'edit_post', $post->ID ) ) {
1336
+			return;
1337
+	}
1287 1338
 
1288 1339
 	if ( $post_type_object->_edit_link ) {
1289 1340
 		$link = admin_url( sprintf( $post_type_object->_edit_link . $action, $post->ID ) );
@@ -1356,18 +1407,22 @@  discard block
 block discarded – undo
1356 1407
  * @return string|void The delete post link URL for the given post.
1357 1408
  */
1358 1409
 function get_delete_post_link( $id = 0, $deprecated = '', $force_delete = false ) {
1359
-	if ( ! empty( $deprecated ) )
1360
-		_deprecated_argument( __FUNCTION__, '3.0.0' );
1410
+	if ( ! empty( $deprecated ) ) {
1411
+			_deprecated_argument( __FUNCTION__, '3.0.0' );
1412
+	}
1361 1413
 
1362
-	if ( !$post = get_post( $id ) )
1363
-		return;
1414
+	if ( !$post = get_post( $id ) ) {
1415
+			return;
1416
+	}
1364 1417
 
1365 1418
 	$post_type_object = get_post_type_object( $post->post_type );
1366
-	if ( !$post_type_object )
1367
-		return;
1419
+	if ( !$post_type_object ) {
1420
+			return;
1421
+	}
1368 1422
 
1369
-	if ( !current_user_can( 'delete_post', $post->ID ) )
1370
-		return;
1423
+	if ( !current_user_can( 'delete_post', $post->ID ) ) {
1424
+			return;
1425
+	}
1371 1426
 
1372 1427
 	$action = ( $force_delete || !EMPTY_TRASH_DAYS ) ? 'delete' : 'trash';
1373 1428
 
@@ -1396,8 +1451,9 @@  discard block
 block discarded – undo
1396 1451
 function get_edit_comment_link( $comment_id = 0 ) {
1397 1452
 	$comment = get_comment( $comment_id );
1398 1453
 
1399
-	if ( !current_user_can( 'edit_comment', $comment->comment_ID ) )
1400
-		return;
1454
+	if ( !current_user_can( 'edit_comment', $comment->comment_ID ) ) {
1455
+			return;
1456
+	}
1401 1457
 
1402 1458
 	$location = admin_url('comment.php?action=editcomment&amp;c=') . $comment->comment_ID;
1403 1459
 
@@ -1456,8 +1512,9 @@  discard block
 block discarded – undo
1456 1512
 function get_edit_bookmark_link( $link = 0 ) {
1457 1513
 	$link = get_bookmark( $link );
1458 1514
 
1459
-	if ( !current_user_can('manage_links') )
1460
-		return;
1515
+	if ( !current_user_can('manage_links') ) {
1516
+			return;
1517
+	}
1461 1518
 
1462 1519
 	$location = admin_url('link.php?action=edit&amp;link_id=') . $link->link_id;
1463 1520
 
@@ -1485,11 +1542,13 @@  discard block
 block discarded – undo
1485 1542
 function edit_bookmark_link( $link = '', $before = '', $after = '', $bookmark = null ) {
1486 1543
 	$bookmark = get_bookmark($bookmark);
1487 1544
 
1488
-	if ( !current_user_can('manage_links') )
1489
-		return;
1545
+	if ( !current_user_can('manage_links') ) {
1546
+			return;
1547
+	}
1490 1548
 
1491
-	if ( empty($link) )
1492
-		$link = __('Edit This');
1549
+	if ( empty($link) ) {
1550
+			$link = __('Edit This');
1551
+	}
1493 1552
 
1494 1553
 	$link = '<a href="' . esc_url( get_edit_bookmark_link( $bookmark ) ) . '">' . $link . '</a>';
1495 1554
 
@@ -1513,21 +1572,25 @@  discard block
 block discarded – undo
1513 1572
  * @return string URL to edit user page or empty string.
1514 1573
  */
1515 1574
 function get_edit_user_link( $user_id = null ) {
1516
-	if ( ! $user_id )
1517
-		$user_id = get_current_user_id();
1575
+	if ( ! $user_id ) {
1576
+			$user_id = get_current_user_id();
1577
+	}
1518 1578
 
1519
-	if ( empty( $user_id ) || ! current_user_can( 'edit_user', $user_id ) )
1520
-		return '';
1579
+	if ( empty( $user_id ) || ! current_user_can( 'edit_user', $user_id ) ) {
1580
+			return '';
1581
+	}
1521 1582
 
1522 1583
 	$user = get_userdata( $user_id );
1523 1584
 
1524
-	if ( ! $user )
1525
-		return '';
1585
+	if ( ! $user ) {
1586
+			return '';
1587
+	}
1526 1588
 
1527
-	if ( get_current_user_id() == $user->ID )
1528
-		$link = get_edit_profile_url( $user->ID );
1529
-	else
1530
-		$link = add_query_arg( 'user_id', $user->ID, self_admin_url( 'user-edit.php' ) );
1589
+	if ( get_current_user_id() == $user->ID ) {
1590
+			$link = get_edit_profile_url( $user->ID );
1591
+	} else {
1592
+			$link = add_query_arg( 'user_id', $user->ID, self_admin_url( 'user-edit.php' ) );
1593
+	}
1531 1594
 
1532 1595
 	/**
1533 1596
 	 * Filters the user edit link.
@@ -1591,8 +1654,9 @@  discard block
 block discarded – undo
1591 1654
 function get_adjacent_post( $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category' ) {
1592 1655
 	global $wpdb;
1593 1656
 
1594
-	if ( ( ! $post = get_post() ) || ! taxonomy_exists( $taxonomy ) )
1595
-		return null;
1657
+	if ( ( ! $post = get_post() ) || ! taxonomy_exists( $taxonomy ) ) {
1658
+			return null;
1659
+	}
1596 1660
 
1597 1661
 	$current_post_date = $post->post_date;
1598 1662
 
@@ -1617,16 +1681,18 @@  discard block
 block discarded – undo
1617 1681
 			$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";
1618 1682
 			$where .= $wpdb->prepare( "AND tt.taxonomy = %s", $taxonomy );
1619 1683
 
1620
-			if ( ! is_object_in_taxonomy( $post->post_type, $taxonomy ) )
1621
-				return '';
1684
+			if ( ! is_object_in_taxonomy( $post->post_type, $taxonomy ) ) {
1685
+							return '';
1686
+			}
1622 1687
 			$term_array = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'ids' ) );
1623 1688
 
1624 1689
 			// Remove any exclusions from the term array to include.
1625 1690
 			$term_array = array_diff( $term_array, (array) $excluded_terms );
1626 1691
 			$term_array = array_map( 'intval', $term_array );
1627 1692
 
1628
-			if ( ! $term_array || is_wp_error( $term_array ) )
1629
-				return '';
1693
+			if ( ! $term_array || is_wp_error( $term_array ) ) {
1694
+							return '';
1695
+			}
1630 1696
 
1631 1697
 			$where .= " AND tt.term_id IN (" . implode( ',', $term_array ) . ")";
1632 1698
 		}
@@ -1733,19 +1799,22 @@  discard block
 block discarded – undo
1733 1799
 	$query_key = 'adjacent_post_' . md5( $query );
1734 1800
 	$result = wp_cache_get( $query_key, 'counts' );
1735 1801
 	if ( false !== $result ) {
1736
-		if ( $result )
1737
-			$result = get_post( $result );
1802
+		if ( $result ) {
1803
+					$result = get_post( $result );
1804
+		}
1738 1805
 		return $result;
1739 1806
 	}
1740 1807
 
1741 1808
 	$result = $wpdb->get_var( $query );
1742
-	if ( null === $result )
1743
-		$result = '';
1809
+	if ( null === $result ) {
1810
+			$result = '';
1811
+	}
1744 1812
 
1745 1813
 	wp_cache_set( $query_key, $result, 'counts' );
1746 1814
 
1747
-	if ( $result )
1748
-		$result = get_post( $result );
1815
+	if ( $result ) {
1816
+			$result = get_post( $result );
1817
+	}
1749 1818
 
1750 1819
 	return $result;
1751 1820
 }
@@ -1765,18 +1834,21 @@  discard block
 block discarded – undo
1765 1834
  * @return string|void The adjacent post relational link URL.
1766 1835
  */
1767 1836
 function get_adjacent_post_rel_link( $title = '%title', $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category' ) {
1768
-	if ( $previous && is_attachment() && $post = get_post() )
1769
-		$post = get_post( $post->post_parent );
1770
-	else
1771
-		$post = get_adjacent_post( $in_same_term, $excluded_terms, $previous, $taxonomy );
1837
+	if ( $previous && is_attachment() && $post = get_post() ) {
1838
+			$post = get_post( $post->post_parent );
1839
+	} else {
1840
+			$post = get_adjacent_post( $in_same_term, $excluded_terms, $previous, $taxonomy );
1841
+	}
1772 1842
 
1773
-	if ( empty( $post ) )
1774
-		return;
1843
+	if ( empty( $post ) ) {
1844
+			return;
1845
+	}
1775 1846
 
1776 1847
 	$post_title = the_title_attribute( array( 'echo' => false, 'post' => $post ) );
1777 1848
 
1778
-	if ( empty( $post_title ) )
1779
-		$post_title = $previous ? __( 'Previous Post' ) : __( 'Next Post' );
1849
+	if ( empty( $post_title ) ) {
1850
+			$post_title = $previous ? __( 'Previous Post' ) : __( 'Next Post' );
1851
+	}
1780 1852
 
1781 1853
 	$date = mysql2date( get_option( 'date_format' ), $post->post_date );
1782 1854
 
@@ -1884,8 +1956,9 @@  discard block
 block discarded – undo
1884 1956
  */
1885 1957
 function get_boundary_post( $in_same_term = false, $excluded_terms = '', $start = true, $taxonomy = 'category' ) {
1886 1958
 	$post = get_post();
1887
-	if ( ! $post || ! is_single() || is_attachment() || ! taxonomy_exists( $taxonomy ) )
1888
-		return null;
1959
+	if ( ! $post || ! is_single() || is_attachment() || ! taxonomy_exists( $taxonomy ) ) {
1960
+			return null;
1961
+	}
1889 1962
 
1890 1963
 	$query_args = array(
1891 1964
 		'posts_per_page' => 1,
@@ -1897,23 +1970,26 @@  discard block
 block discarded – undo
1897 1970
 	$term_array = array();
1898 1971
 
1899 1972
 	if ( ! is_array( $excluded_terms ) ) {
1900
-		if ( ! empty( $excluded_terms ) )
1901
-			$excluded_terms = explode( ',', $excluded_terms );
1902
-		else
1903
-			$excluded_terms = array();
1973
+		if ( ! empty( $excluded_terms ) ) {
1974
+					$excluded_terms = explode( ',', $excluded_terms );
1975
+		} else {
1976
+					$excluded_terms = array();
1977
+		}
1904 1978
 	}
1905 1979
 
1906 1980
 	if ( $in_same_term || ! empty( $excluded_terms ) ) {
1907
-		if ( $in_same_term )
1908
-			$term_array = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'ids' ) );
1981
+		if ( $in_same_term ) {
1982
+					$term_array = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'ids' ) );
1983
+		}
1909 1984
 
1910 1985
 		if ( ! empty( $excluded_terms ) ) {
1911 1986
 			$excluded_terms = array_map( 'intval', $excluded_terms );
1912 1987
 			$excluded_terms = array_diff( $excluded_terms, $term_array );
1913 1988
 
1914 1989
 			$inverse_terms = array();
1915
-			foreach ( $excluded_terms as $excluded_term )
1916
-				$inverse_terms[] = $excluded_term * -1;
1990
+			foreach ( $excluded_terms as $excluded_term ) {
1991
+							$inverse_terms[] = $excluded_term * -1;
1992
+			}
1917 1993
 			$excluded_terms = $inverse_terms;
1918 1994
 		}
1919 1995
 
@@ -2007,18 +2083,20 @@  discard block
 block discarded – undo
2007 2083
  * @return string The link URL of the previous or next post in relation to the current post.
2008 2084
  */
2009 2085
 function get_adjacent_post_link( $format, $link, $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category' ) {
2010
-	if ( $previous && is_attachment() )
2011
-		$post = get_post( get_post()->post_parent );
2012
-	else
2013
-		$post = get_adjacent_post( $in_same_term, $excluded_terms, $previous, $taxonomy );
2086
+	if ( $previous && is_attachment() ) {
2087
+			$post = get_post( get_post()->post_parent );
2088
+	} else {
2089
+			$post = get_adjacent_post( $in_same_term, $excluded_terms, $previous, $taxonomy );
2090
+	}
2014 2091
 
2015 2092
 	if ( ! $post ) {
2016 2093
 		$output = '';
2017 2094
 	} else {
2018 2095
 		$title = $post->post_title;
2019 2096
 
2020
-		if ( empty( $post->post_title ) )
2021
-			$title = $previous ? __( 'Previous Post' ) : __( 'Next Post' );
2097
+		if ( empty( $post->post_title ) ) {
2098
+					$title = $previous ? __( 'Previous Post' ) : __( 'Next Post' );
2099
+		}
2022 2100
 
2023 2101
 		/** This filter is documented in wp-includes/post-template.php */
2024 2102
 		$title = apply_filters( 'the_title', $title, $post->ID );
@@ -2123,8 +2201,9 @@  discard block
 block discarded – undo
2123 2201
 
2124 2202
 		$base = trailingslashit( get_bloginfo( 'url' ) );
2125 2203
 
2126
-		if ( $wp_rewrite->using_index_permalinks() && ( $pagenum > 1 || '' != $request ) )
2127
-			$base .= $wp_rewrite->index . '/';
2204
+		if ( $wp_rewrite->using_index_permalinks() && ( $pagenum > 1 || '' != $request ) ) {
2205
+					$base .= $wp_rewrite->index . '/';
2206
+		}
2128 2207
 
2129 2208
 		if ( $pagenum > 1 ) {
2130 2209
 			$request = ( ( !empty( $request ) ) ? trailingslashit( $request ) : $request ) . user_trailingslashit( $wp_rewrite->pagination_base . "/" . $pagenum, 'paged' );
@@ -2142,11 +2221,12 @@  discard block
 block discarded – undo
2142 2221
 	 */
2143 2222
 	$result = apply_filters( 'get_pagenum_link', $result );
2144 2223
 
2145
-	if ( $escape )
2146
-		return esc_url( $result );
2147
-	else
2148
-		return esc_url_raw( $result );
2149
-}
2224
+	if ( $escape ) {
2225
+			return esc_url( $result );
2226
+	} else {
2227
+			return esc_url_raw( $result );
2228
+	}
2229
+	}
2150 2230
 
2151 2231
 /**
2152 2232
  * Retrieves the next posts page link.
@@ -2164,11 +2244,13 @@  discard block
 block discarded – undo
2164 2244
 	global $paged;
2165 2245
 
2166 2246
 	if ( !is_single() ) {
2167
-		if ( !$paged )
2168
-			$paged = 1;
2247
+		if ( !$paged ) {
2248
+					$paged = 1;
2249
+		}
2169 2250
 		$nextpage = intval($paged) + 1;
2170
-		if ( !$max_page || $max_page >= $nextpage )
2171
-			return get_pagenum_link($nextpage);
2251
+		if ( !$max_page || $max_page >= $nextpage ) {
2252
+					return get_pagenum_link($nextpage);
2253
+		}
2172 2254
 	}
2173 2255
 }
2174 2256
 
@@ -2184,11 +2266,12 @@  discard block
 block discarded – undo
2184 2266
 function next_posts( $max_page = 0, $echo = true ) {
2185 2267
 	$output = esc_url( get_next_posts_page_link( $max_page ) );
2186 2268
 
2187
-	if ( $echo )
2188
-		echo $output;
2189
-	else
2190
-		return $output;
2191
-}
2269
+	if ( $echo ) {
2270
+			echo $output;
2271
+	} else {
2272
+			return $output;
2273
+	}
2274
+	}
2192 2275
 
2193 2276
 /**
2194 2277
  * Retrieves the next posts page link.
@@ -2205,16 +2288,19 @@  discard block
 block discarded – undo
2205 2288
 function get_next_posts_link( $label = null, $max_page = 0 ) {
2206 2289
 	global $paged, $wp_query;
2207 2290
 
2208
-	if ( !$max_page )
2209
-		$max_page = $wp_query->max_num_pages;
2291
+	if ( !$max_page ) {
2292
+			$max_page = $wp_query->max_num_pages;
2293
+	}
2210 2294
 
2211
-	if ( !$paged )
2212
-		$paged = 1;
2295
+	if ( !$paged ) {
2296
+			$paged = 1;
2297
+	}
2213 2298
 
2214 2299
 	$nextpage = intval($paged) + 1;
2215 2300
 
2216
-	if ( null === $label )
2217
-		$label = __( 'Next Page &raquo;' );
2301
+	if ( null === $label ) {
2302
+			$label = __( 'Next Page &raquo;' );
2303
+	}
2218 2304
 
2219 2305
 	if ( !is_single() && ( $nextpage <= $max_page ) ) {
2220 2306
 		/**
@@ -2260,8 +2346,9 @@  discard block
 block discarded – undo
2260 2346
 
2261 2347
 	if ( !is_single() ) {
2262 2348
 		$nextpage = intval($paged) - 1;
2263
-		if ( $nextpage < 1 )
2264
-			$nextpage = 1;
2349
+		if ( $nextpage < 1 ) {
2350
+					$nextpage = 1;
2351
+		}
2265 2352
 		return get_pagenum_link($nextpage);
2266 2353
 	}
2267 2354
 }
@@ -2277,11 +2364,12 @@  discard block
 block discarded – undo
2277 2364
 function previous_posts( $echo = true ) {
2278 2365
 	$output = esc_url( get_previous_posts_page_link() );
2279 2366
 
2280
-	if ( $echo )
2281
-		echo $output;
2282
-	else
2283
-		return $output;
2284
-}
2367
+	if ( $echo ) {
2368
+			echo $output;
2369
+	} else {
2370
+			return $output;
2371
+	}
2372
+	}
2285 2373
 
2286 2374
 /**
2287 2375
  * Retrieves the previous posts page link.
@@ -2296,8 +2384,9 @@  discard block
 block discarded – undo
2296 2384
 function get_previous_posts_link( $label = null ) {
2297 2385
 	global $paged;
2298 2386
 
2299
-	if ( null === $label )
2300
-		$label = __( '&laquo; Previous Page' );
2387
+	if ( null === $label ) {
2388
+			$label = __( '&laquo; Previous Page' );
2389
+	}
2301 2390
 
2302 2391
 	if ( !is_single() && $paged > 1 ) {
2303 2392
 		/**
@@ -2629,16 +2718,18 @@  discard block
 block discarded – undo
2629 2718
 
2630 2719
 	if ( 'newest' == get_option('default_comments_page') ) {
2631 2720
 		if ( $pagenum != $max_page ) {
2632
-			if ( $wp_rewrite->using_permalinks() )
2633
-				$result = user_trailingslashit( trailingslashit($result) . $wp_rewrite->comments_pagination_base . '-' . $pagenum, 'commentpaged');
2634
-			else
2635
-				$result = add_query_arg( 'cpage', $pagenum, $result );
2721
+			if ( $wp_rewrite->using_permalinks() ) {
2722
+							$result = user_trailingslashit( trailingslashit($result) . $wp_rewrite->comments_pagination_base . '-' . $pagenum, 'commentpaged');
2723
+			} else {
2724
+							$result = add_query_arg( 'cpage', $pagenum, $result );
2725
+			}
2636 2726
 		}
2637 2727
 	} elseif ( $pagenum > 1 ) {
2638
-		if ( $wp_rewrite->using_permalinks() )
2639
-			$result = user_trailingslashit( trailingslashit($result) . $wp_rewrite->comments_pagination_base . '-' . $pagenum, 'commentpaged');
2640
-		else
2641
-			$result = add_query_arg( 'cpage', $pagenum, $result );
2728
+		if ( $wp_rewrite->using_permalinks() ) {
2729
+					$result = user_trailingslashit( trailingslashit($result) . $wp_rewrite->comments_pagination_base . '-' . $pagenum, 'commentpaged');
2730
+		} else {
2731
+					$result = add_query_arg( 'cpage', $pagenum, $result );
2732
+		}
2642 2733
 	}
2643 2734
 
2644 2735
 	$result .= '#comments';
@@ -2667,8 +2758,9 @@  discard block
 block discarded – undo
2667 2758
 function get_next_comments_link( $label = '', $max_page = 0 ) {
2668 2759
 	global $wp_query;
2669 2760
 
2670
-	if ( ! is_singular() )
2671
-		return;
2761
+	if ( ! is_singular() ) {
2762
+			return;
2763
+	}
2672 2764
 
2673 2765
 	$page = get_query_var('cpage');
2674 2766
 
@@ -2678,17 +2770,21 @@  discard block
 block discarded – undo
2678 2770
 
2679 2771
 	$nextpage = intval($page) + 1;
2680 2772
 
2681
-	if ( empty($max_page) )
2682
-		$max_page = $wp_query->max_num_comment_pages;
2773
+	if ( empty($max_page) ) {
2774
+			$max_page = $wp_query->max_num_comment_pages;
2775
+	}
2683 2776
 
2684
-	if ( empty($max_page) )
2685
-		$max_page = get_comment_pages_count();
2777
+	if ( empty($max_page) ) {
2778
+			$max_page = get_comment_pages_count();
2779
+	}
2686 2780
 
2687
-	if ( $nextpage > $max_page )
2688
-		return;
2781
+	if ( $nextpage > $max_page ) {
2782
+			return;
2783
+	}
2689 2784
 
2690
-	if ( empty($label) )
2691
-		$label = __('Newer Comments &raquo;');
2785
+	if ( empty($label) ) {
2786
+			$label = __('Newer Comments &raquo;');
2787
+	}
2692 2788
 
2693 2789
 	/**
2694 2790
 	 * Filters the anchor tag attributes for the next comments page link.
@@ -2721,18 +2817,21 @@  discard block
 block discarded – undo
2721 2817
  * @return string|void HTML-formatted link for the previous page of comments.
2722 2818
  */
2723 2819
 function get_previous_comments_link( $label = '' ) {
2724
-	if ( ! is_singular() )
2725
-		return;
2820
+	if ( ! is_singular() ) {
2821
+			return;
2822
+	}
2726 2823
 
2727 2824
 	$page = get_query_var('cpage');
2728 2825
 
2729
-	if ( intval($page) <= 1 )
2730
-		return;
2826
+	if ( intval($page) <= 1 ) {
2827
+			return;
2828
+	}
2731 2829
 
2732 2830
 	$prevpage = intval($page) - 1;
2733 2831
 
2734
-	if ( empty($label) )
2735
-		$label = __('&laquo; Older Comments');
2832
+	if ( empty($label) ) {
2833
+			$label = __('&laquo; Older Comments');
2834
+	}
2736 2835
 
2737 2836
 	/**
2738 2837
 	 * Filters the anchor tag attributes for the previous comments page link.
@@ -2769,12 +2868,14 @@  discard block
 block discarded – undo
2769 2868
 function paginate_comments_links( $args = array() ) {
2770 2869
 	global $wp_rewrite;
2771 2870
 
2772
-	if ( ! is_singular() )
2773
-		return;
2871
+	if ( ! is_singular() ) {
2872
+			return;
2873
+	}
2774 2874
 
2775 2875
 	$page = get_query_var('cpage');
2776
-	if ( !$page )
2777
-		$page = 1;
2876
+	if ( !$page ) {
2877
+			$page = 1;
2878
+	}
2778 2879
 	$max_page = get_comment_pages_count();
2779 2880
 	$defaults = array(
2780 2881
 		'base' => add_query_arg( 'cpage', '%#%' ),
@@ -2784,17 +2885,19 @@  discard block
 block discarded – undo
2784 2885
 		'echo' => true,
2785 2886
 		'add_fragment' => '#comments'
2786 2887
 	);
2787
-	if ( $wp_rewrite->using_permalinks() )
2788
-		$defaults['base'] = user_trailingslashit(trailingslashit(get_permalink()) . $wp_rewrite->comments_pagination_base . '-%#%', 'commentpaged');
2888
+	if ( $wp_rewrite->using_permalinks() ) {
2889
+			$defaults['base'] = user_trailingslashit(trailingslashit(get_permalink()) . $wp_rewrite->comments_pagination_base . '-%#%', 'commentpaged');
2890
+	}
2789 2891
 
2790 2892
 	$args = wp_parse_args( $args, $defaults );
2791 2893
 	$page_links = paginate_links( $args );
2792 2894
 
2793
-	if ( $args['echo'] )
2794
-		echo $page_links;
2795
-	else
2796
-		return $page_links;
2797
-}
2895
+	if ( $args['echo'] ) {
2896
+			echo $page_links;
2897
+	} else {
2898
+			return $page_links;
2899
+	}
2900
+	}
2798 2901
 
2799 2902
 /**
2800 2903
  * Retrieves navigation to next/previous set of comments, when applicable.
@@ -3000,16 +3103,18 @@  discard block
 block discarded – undo
3000 3103
 	}
3001 3104
 
3002 3105
 	if ( ! in_array( $scheme, array( 'http', 'https', 'relative' ) ) ) {
3003
-		if ( is_ssl() && ! is_admin() && 'wp-login.php' !== $pagenow )
3004
-			$scheme = 'https';
3005
-		else
3006
-			$scheme = parse_url( $url, PHP_URL_SCHEME );
3106
+		if ( is_ssl() && ! is_admin() && 'wp-login.php' !== $pagenow ) {
3107
+					$scheme = 'https';
3108
+		} else {
3109
+					$scheme = parse_url( $url, PHP_URL_SCHEME );
3110
+		}
3007 3111
 	}
3008 3112
 
3009 3113
 	$url = set_url_scheme( $url, $scheme );
3010 3114
 
3011
-	if ( $path && is_string( $path ) )
3012
-		$url .= '/' . ltrim( $path, '/' );
3115
+	if ( $path && is_string( $path ) ) {
3116
+			$url .= '/' . ltrim( $path, '/' );
3117
+	}
3013 3118
 
3014 3119
 	/**
3015 3120
 	 * Filters the home URL.
@@ -3071,8 +3176,9 @@  discard block
 block discarded – undo
3071 3176
 
3072 3177
 	$url = set_url_scheme( $url, $scheme );
3073 3178
 
3074
-	if ( $path && is_string( $path ) )
3075
-		$url .= '/' . ltrim( $path, '/' );
3179
+	if ( $path && is_string( $path ) ) {
3180
+			$url .= '/' . ltrim( $path, '/' );
3181
+	}
3076 3182
 
3077 3183
 	/**
3078 3184
 	 * Filters the site URL.
@@ -3117,8 +3223,9 @@  discard block
 block discarded – undo
3117 3223
 function get_admin_url( $blog_id = null, $path = '', $scheme = 'admin' ) {
3118 3224
 	$url = get_site_url($blog_id, 'wp-admin/', $scheme);
3119 3225
 
3120
-	if ( $path && is_string( $path ) )
3121
-		$url .= ltrim( $path, '/' );
3226
+	if ( $path && is_string( $path ) ) {
3227
+			$url .= ltrim( $path, '/' );
3228
+	}
3122 3229
 
3123 3230
 	/**
3124 3231
 	 * Filters the admin area URL.
@@ -3145,8 +3252,9 @@  discard block
 block discarded – undo
3145 3252
 function includes_url( $path = '', $scheme = null ) {
3146 3253
 	$url = site_url( '/' . WPINC . '/', $scheme );
3147 3254
 
3148
-	if ( $path && is_string( $path ) )
3149
-		$url .= ltrim($path, '/');
3255
+	if ( $path && is_string( $path ) ) {
3256
+			$url .= ltrim($path, '/');
3257
+	}
3150 3258
 
3151 3259
 	/**
3152 3260
 	 * Filters the URL to the includes directory.
@@ -3171,8 +3279,9 @@  discard block
 block discarded – undo
3171 3279
 function content_url( $path = '' ) {
3172 3280
 	$url = set_url_scheme( WP_CONTENT_URL );
3173 3281
 
3174
-	if ( $path && is_string( $path ) )
3175
-		$url .= '/' . ltrim($path, '/');
3282
+	if ( $path && is_string( $path ) ) {
3283
+			$url .= '/' . ltrim($path, '/');
3284
+	}
3176 3285
 
3177 3286
 	/**
3178 3287
 	 * Filters the URL to the content directory.
@@ -3206,22 +3315,25 @@  discard block
 block discarded – undo
3206 3315
 	$plugin = wp_normalize_path( $plugin );
3207 3316
 	$mu_plugin_dir = wp_normalize_path( WPMU_PLUGIN_DIR );
3208 3317
 
3209
-	if ( !empty($plugin) && 0 === strpos($plugin, $mu_plugin_dir) )
3210
-		$url = WPMU_PLUGIN_URL;
3211
-	else
3212
-		$url = WP_PLUGIN_URL;
3318
+	if ( !empty($plugin) && 0 === strpos($plugin, $mu_plugin_dir) ) {
3319
+			$url = WPMU_PLUGIN_URL;
3320
+	} else {
3321
+			$url = WP_PLUGIN_URL;
3322
+	}
3213 3323
 
3214 3324
 
3215 3325
 	$url = set_url_scheme( $url );
3216 3326
 
3217 3327
 	if ( !empty($plugin) && is_string($plugin) ) {
3218 3328
 		$folder = dirname(plugin_basename($plugin));
3219
-		if ( '.' != $folder )
3220
-			$url .= '/' . ltrim($folder, '/');
3329
+		if ( '.' != $folder ) {
3330
+					$url .= '/' . ltrim($folder, '/');
3331
+		}
3221 3332
 	}
3222 3333
 
3223
-	if ( $path && is_string( $path ) )
3224
-		$url .= '/' . ltrim($path, '/');
3334
+	if ( $path && is_string( $path ) ) {
3335
+			$url .= '/' . ltrim($path, '/');
3336
+	}
3225 3337
 
3226 3338
 	/**
3227 3339
 	 * Filters the URL to the plugins directory.
@@ -3254,18 +3366,21 @@  discard block
 block discarded – undo
3254 3366
  * @return string Site URL link with optional path appended.
3255 3367
  */
3256 3368
 function network_site_url( $path = '', $scheme = null ) {
3257
-	if ( ! is_multisite() )
3258
-		return site_url($path, $scheme);
3369
+	if ( ! is_multisite() ) {
3370
+			return site_url($path, $scheme);
3371
+	}
3259 3372
 
3260 3373
 	$current_network = get_network();
3261 3374
 
3262
-	if ( 'relative' == $scheme )
3263
-		$url = $current_network->path;
3264
-	else
3265
-		$url = set_url_scheme( 'http://' . $current_network->domain . $current_network->path, $scheme );
3375
+	if ( 'relative' == $scheme ) {
3376
+			$url = $current_network->path;
3377
+	} else {
3378
+			$url = set_url_scheme( 'http://' . $current_network->domain . $current_network->path, $scheme );
3379
+	}
3266 3380
 
3267
-	if ( $path && is_string( $path ) )
3268
-		$url .= ltrim( $path, '/' );
3381
+	if ( $path && is_string( $path ) ) {
3382
+			$url .= ltrim( $path, '/' );
3383
+	}
3269 3384
 
3270 3385
 	/**
3271 3386
 	 * Filters the network site URL.
@@ -3296,22 +3411,26 @@  discard block
 block discarded – undo
3296 3411
  * @return string Home URL link with optional path appended.
3297 3412
  */
3298 3413
 function network_home_url( $path = '', $scheme = null ) {
3299
-	if ( ! is_multisite() )
3300
-		return home_url($path, $scheme);
3414
+	if ( ! is_multisite() ) {
3415
+			return home_url($path, $scheme);
3416
+	}
3301 3417
 
3302 3418
 	$current_network = get_network();
3303 3419
 	$orig_scheme = $scheme;
3304 3420
 
3305
-	if ( ! in_array( $scheme, array( 'http', 'https', 'relative' ) ) )
3306
-		$scheme = is_ssl() && ! is_admin() ? 'https' : 'http';
3421
+	if ( ! in_array( $scheme, array( 'http', 'https', 'relative' ) ) ) {
3422
+			$scheme = is_ssl() && ! is_admin() ? 'https' : 'http';
3423
+	}
3307 3424
 
3308
-	if ( 'relative' == $scheme )
3309
-		$url = $current_network->path;
3310
-	else
3311
-		$url = set_url_scheme( 'http://' . $current_network->domain . $current_network->path, $scheme );
3425
+	if ( 'relative' == $scheme ) {
3426
+			$url = $current_network->path;
3427
+	} else {
3428
+			$url = set_url_scheme( 'http://' . $current_network->domain . $current_network->path, $scheme );
3429
+	}
3312 3430
 
3313
-	if ( $path && is_string( $path ) )
3314
-		$url .= ltrim( $path, '/' );
3431
+	if ( $path && is_string( $path ) ) {
3432
+			$url .= ltrim( $path, '/' );
3433
+	}
3315 3434
 
3316 3435
 	/**
3317 3436
 	 * Filters the network home URL.
@@ -3338,13 +3457,15 @@  discard block
 block discarded – undo
3338 3457
  * @return string Admin URL link with optional path appended.
3339 3458
  */
3340 3459
 function network_admin_url( $path = '', $scheme = 'admin' ) {
3341
-	if ( ! is_multisite() )
3342
-		return admin_url( $path, $scheme );
3460
+	if ( ! is_multisite() ) {
3461
+			return admin_url( $path, $scheme );
3462
+	}
3343 3463
 
3344 3464
 	$url = network_site_url('wp-admin/network/', $scheme);
3345 3465
 
3346
-	if ( $path && is_string( $path ) )
3347
-		$url .= ltrim($path, '/');
3466
+	if ( $path && is_string( $path ) ) {
3467
+			$url .= ltrim($path, '/');
3468
+	}
3348 3469
 
3349 3470
 	/**
3350 3471
 	 * Filters the network admin URL.
@@ -3371,8 +3492,9 @@  discard block
 block discarded – undo
3371 3492
 function user_admin_url( $path = '', $scheme = 'admin' ) {
3372 3493
 	$url = network_site_url('wp-admin/user/', $scheme);
3373 3494
 
3374
-	if ( $path && is_string( $path ) )
3375
-		$url .= ltrim($path, '/');
3495
+	if ( $path && is_string( $path ) ) {
3496
+			$url .= ltrim($path, '/');
3497
+	}
3376 3498
 
3377 3499
 	/**
3378 3500
 	 * Filters the user admin URL for the current user.
@@ -3397,13 +3519,14 @@  discard block
 block discarded – undo
3397 3519
  * @return string Admin URL link with optional path appended.
3398 3520
  */
3399 3521
 function self_admin_url( $path = '', $scheme = 'admin' ) {
3400
-	if ( is_network_admin() )
3401
-		return network_admin_url($path, $scheme);
3402
-	elseif ( is_user_admin() )
3403
-		return user_admin_url($path, $scheme);
3404
-	else
3405
-		return admin_url($path, $scheme);
3406
-}
3522
+	if ( is_network_admin() ) {
3523
+			return network_admin_url($path, $scheme);
3524
+	} elseif ( is_user_admin() ) {
3525
+			return user_admin_url($path, $scheme);
3526
+	} else {
3527
+			return admin_url($path, $scheme);
3528
+	}
3529
+	}
3407 3530
 
3408 3531
 /**
3409 3532
  * Sets the scheme for a URL.
@@ -3428,13 +3551,15 @@  discard block
 block discarded – undo
3428 3551
 	}
3429 3552
 
3430 3553
 	$url = trim( $url );
3431
-	if ( substr( $url, 0, 2 ) === '//' )
3432
-		$url = 'http:' . $url;
3554
+	if ( substr( $url, 0, 2 ) === '//' ) {
3555
+			$url = 'http:' . $url;
3556
+	}
3433 3557
 
3434 3558
 	if ( 'relative' == $scheme ) {
3435 3559
 		$url = ltrim( preg_replace( '#^\w+://[^/]*#', '', $url ) );
3436
-		if ( $url !== '' && $url[0] === '/' )
3437
-			$url = '/' . ltrim($url , "/ \t\n\r\0\x0B" );
3560
+		if ( $url !== '' && $url[0] === '/' ) {
3561
+					$url = '/' . ltrim($url , "/ \t\n\r\0\x0B" );
3562
+		}
3438 3563
 	} else {
3439 3564
 		$url = preg_replace( '#^\w+://#', $scheme . '://', $url );
3440 3565
 	}
@@ -3482,10 +3607,11 @@  discard block
 block discarded – undo
3482 3607
 			$url = admin_url( $path, $scheme );
3483 3608
 		} else {
3484 3609
 			$active = get_active_blog_for_user( $user_id );
3485
-			if ( $active )
3486
-				$url = get_admin_url( $active->blog_id, $path, $scheme );
3487
-			else
3488
-				$url = user_admin_url( $path, $scheme );
3610
+			if ( $active ) {
3611
+							$url = get_admin_url( $active->blog_id, $path, $scheme );
3612
+			} else {
3613
+							$url = user_admin_url( $path, $scheme );
3614
+			}
3489 3615
 		}
3490 3616
 	}
3491 3617
 
@@ -3516,12 +3642,13 @@  discard block
 block discarded – undo
3516 3642
 function get_edit_profile_url( $user_id = 0, $scheme = 'admin' ) {
3517 3643
 	$user_id = $user_id ? (int) $user_id : get_current_user_id();
3518 3644
 
3519
-	if ( is_user_admin() )
3520
-		$url = user_admin_url( 'profile.php', $scheme );
3521
-	elseif ( is_network_admin() )
3522
-		$url = network_admin_url( 'profile.php', $scheme );
3523
-	else
3524
-		$url = get_dashboard_url( $user_id, 'profile.php', $scheme );
3645
+	if ( is_user_admin() ) {
3646
+			$url = user_admin_url( 'profile.php', $scheme );
3647
+	} elseif ( is_network_admin() ) {
3648
+			$url = network_admin_url( 'profile.php', $scheme );
3649
+	} else {
3650
+			$url = get_dashboard_url( $user_id, 'profile.php', $scheme );
3651
+	}
3525 3652
 
3526 3653
 	/**
3527 3654
 	 * Filters the URL for a user's profile editor.
@@ -3659,8 +3786,9 @@  discard block
 block discarded – undo
3659 3786
 		$post = get_post( $post_id );
3660 3787
 	} elseif ( 'post' == $context ) {
3661 3788
 		$post = get_post( $id );
3662
-		if ( ! empty( $post->ID ) )
3663
-			$post_id = $post->ID;
3789
+		if ( ! empty( $post->ID ) ) {
3790
+					$post_id = $post->ID;
3791
+		}
3664 3792
 	}
3665 3793
 
3666 3794
 	$shortlink = '';
@@ -3699,8 +3827,9 @@  discard block
 block discarded – undo
3699 3827
 function wp_shortlink_wp_head() {
3700 3828
 	$shortlink = wp_get_shortlink( 0, 'query' );
3701 3829
 
3702
-	if ( empty( $shortlink ) )
3703
-		return;
3830
+	if ( empty( $shortlink ) ) {
3831
+			return;
3832
+	}
3704 3833
 
3705 3834
 	echo "<link rel='shortlink' href='" . esc_url( $shortlink ) . "' />\n";
3706 3835
 }
@@ -3713,13 +3842,15 @@  discard block
 block discarded – undo
3713 3842
  * @since 3.0.0
3714 3843
  */
3715 3844
 function wp_shortlink_header() {
3716
-	if ( headers_sent() )
3717
-		return;
3845
+	if ( headers_sent() ) {
3846
+			return;
3847
+	}
3718 3848
 
3719 3849
 	$shortlink = wp_get_shortlink(0, 'query');
3720 3850
 
3721
-	if ( empty($shortlink) )
3722
-		return;
3851
+	if ( empty($shortlink) ) {
3852
+			return;
3853
+	}
3723 3854
 
3724 3855
 	header('Link: <' . $shortlink . '>; rel=shortlink', false);
3725 3856
 }
@@ -3741,11 +3872,13 @@  discard block
 block discarded – undo
3741 3872
 function the_shortlink( $text = '', $title = '', $before = '', $after = '' ) {
3742 3873
 	$post = get_post();
3743 3874
 
3744
-	if ( empty( $text ) )
3745
-		$text = __('This is the short link.');
3875
+	if ( empty( $text ) ) {
3876
+			$text = __('This is the short link.');
3877
+	}
3746 3878
 
3747
-	if ( empty( $title ) )
3748
-		$title = the_title_attribute( array( 'echo' => false ) );
3879
+	if ( empty( $title ) ) {
3880
+			$title = the_title_attribute( array( 'echo' => false ) );
3881
+	}
3749 3882
 
3750 3883
 	$shortlink = wp_get_shortlink( $post->ID );
3751 3884
 
Please login to merge, or discard this patch.
src/wp-includes/Requests/IDNAEncoder.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -357,7 +357,7 @@
 block discarded – undo
357 357
 	 * @param int $delta
358 358
 	 * @param int $numpoints
359 359
 	 * @param bool $firsttime
360
-	 * @return int New bias
360
+	 * @return double New bias
361 361
 	 */
362 362
 	protected static function adapt($delta, $numpoints, $firsttime) {
363 363
 #	function adapt(delta,numpoints,firsttime):
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@
 block discarded – undo
93 93
 		$string = self::punycode_encode($string);
94 94
 
95 95
 		// Step 7: Prepend ACE prefix
96
-		$string = self::ACE_PREFIX . $string;
96
+		$string = self::ACE_PREFIX.$string;
97 97
 
98 98
 		// Step 8: Check size
99 99
 		if (strlen($string) < 64) {
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -291,11 +291,9 @@
 block discarded – undo
291 291
 #								tmax if k >= bias + tmax, or k - bias otherwise
292 292
 						if ($k <= ($bias + self::BOOTSTRAP_TMIN)) {
293 293
 							$t = self::BOOTSTRAP_TMIN;
294
-						}
295
-						elseif ($k >= ($bias + self::BOOTSTRAP_TMAX)) {
294
+						} elseif ($k >= ($bias + self::BOOTSTRAP_TMAX)) {
296 295
 							$t = self::BOOTSTRAP_TMAX;
297
-						}
298
-						else {
296
+						} else {
299 297
 							$t = $k - $bias;
300 298
 						}
301 299
 #						if q < t then break
Please login to merge, or discard this patch.
src/wp-includes/Requests/IRI.php 3 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 	 *
250 250
 	 * Returns false if $base is not absolute, otherwise an IRI.
251 251
 	 *
252
-	 * @param IRI|string $base (Absolute) Base IRI
252
+	 * @param string $base (Absolute) Base IRI
253 253
 	 * @param IRI|string $relative Relative IRI
254 254
 	 * @return IRI|false
255 255
 	 */
@@ -987,6 +987,7 @@  discard block
 block discarded – undo
987 987
 	 * Convert an IRI to a URI (or parts thereof)
988 988
 	 *
989 989
 	 * @param string|bool IRI to convert (or false from {@see get_iri})
990
+	 * @param false|string $string
990 991
 	 * @return string|false URI if IRI is valid, false otherwise.
991 992
 	 */
992 993
 	protected function to_uri($string) {
Please login to merge, or discard this patch.
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -153,8 +153,8 @@  discard block
 block discarded – undo
153 153
 	 * @param mixed $value Property value
154 154
 	 */
155 155
 	public function __set($name, $value) {
156
-		if (method_exists($this, 'set_' . $name)) {
157
-			call_user_func(array($this, 'set_' . $name), $value);
156
+		if (method_exists($this, 'set_'.$name)) {
157
+			call_user_func(array($this, 'set_'.$name), $value);
158 158
 		}
159 159
 		elseif (
160 160
 			   $name === 'iauthority'
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 			|| $name === 'iquery'
165 165
 			|| $name === 'ifragment'
166 166
 		) {
167
-			call_user_func(array($this, 'set_' . substr($name, 1)), $value);
167
+			call_user_func(array($this, 'set_'.substr($name, 1)), $value);
168 168
 		}
169 169
 	}
170 170
 
@@ -185,14 +185,14 @@  discard block
 block discarded – undo
185 185
 			$name === 'iauthority' ||
186 186
 			$name === 'authority'
187 187
 		) {
188
-			$method = 'get_' . $name;
188
+			$method = 'get_'.$name;
189 189
 			$return = $this->$method();
190 190
 		}
191 191
 		elseif (array_key_exists($name, $props)) {
192 192
 			$return = $this->$name;
193 193
 		}
194 194
 		// host -> ihost
195
-		elseif (($prop = 'i' . $name) && array_key_exists($prop, $props)) {
195
+		elseif (($prop = 'i'.$name) && array_key_exists($prop, $props)) {
196 196
 			$name = $prop;
197 197
 			$return = $this->$prop;
198 198
 		}
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 			$return = $this->$prop;
203 203
 		}
204 204
 		else {
205
-			trigger_error('Undefined property: ' . get_class($this) . '::' . $name, E_USER_NOTICE);
205
+			trigger_error('Undefined property: '.get_class($this).'::'.$name, E_USER_NOTICE);
206 206
 			$return = null;
207 207
 		}
208 208
 
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 	 * @return bool
222 222
 	 */
223 223
 	public function __isset($name) {
224
-		return (method_exists($this, 'get_' . $name) || isset($this->$name));
224
+		return (method_exists($this, 'get_'.$name) || isset($this->$name));
225 225
 	}
226 226
 
227 227
 	/**
@@ -230,8 +230,8 @@  discard block
 block discarded – undo
230 230
 	 * @param string $name Property name
231 231
 	 */
232 232
 	public function __unset($name) {
233
-		if (method_exists($this, 'set_' . $name)) {
234
-			call_user_func(array($this, 'set_' . $name), '');
233
+		if (method_exists($this, 'set_'.$name)) {
234
+			call_user_func(array($this, 'set_'.$name), '');
235 235
 		}
236 236
 	}
237 237
 
@@ -254,20 +254,20 @@  discard block
 block discarded – undo
254 254
 	 * @return IRI|false
255 255
 	 */
256 256
 	public static function absolutize($base, $relative) {
257
-		if (!($relative instanceof Requests_IRI)) {
257
+		if ( ! ($relative instanceof Requests_IRI)) {
258 258
 			$relative = new Requests_IRI($relative);
259 259
 		}
260
-		if (!$relative->is_valid()) {
260
+		if ( ! $relative->is_valid()) {
261 261
 			return false;
262 262
 		}
263 263
 		elseif ($relative->scheme !== null) {
264 264
 			return clone $relative;
265 265
 		}
266 266
 
267
-		if (!($base instanceof Requests_IRI)) {
267
+		if ( ! ($base instanceof Requests_IRI)) {
268 268
 			$base = new Requests_IRI($base);
269 269
 		}
270
-		if ($base->scheme === null || !$base->is_valid()) {
270
+		if ($base->scheme === null || ! $base->is_valid()) {
271 271
 			return false;
272 272
 		}
273 273
 
@@ -287,10 +287,10 @@  discard block
 block discarded – undo
287 287
 						$target->ipath = $relative->ipath;
288 288
 					}
289 289
 					elseif (($base->iuserinfo !== null || $base->ihost !== null || $base->port !== null) && $base->ipath === '') {
290
-						$target->ipath = '/' . $relative->ipath;
290
+						$target->ipath = '/'.$relative->ipath;
291 291
 					}
292 292
 					elseif (($last_segment = strrpos($base->ipath, '/')) !== false) {
293
-						$target->ipath = substr($base->ipath, 0, $last_segment + 1) . $relative->ipath;
293
+						$target->ipath = substr($base->ipath, 0, $last_segment + 1).$relative->ipath;
294 294
 					}
295 295
 					else {
296 296
 						$target->ipath = $relative->ipath;
@@ -327,23 +327,23 @@  discard block
 block discarded – undo
327 327
 	protected function parse_iri($iri) {
328 328
 		$iri = trim($iri, "\x20\x09\x0A\x0C\x0D");
329 329
 		$has_match = preg_match('/^((?P<scheme>[^:\/?#]+):)?(\/\/(?P<authority>[^\/?#]*))?(?P<path>[^?#]*)(\?(?P<query>[^#]*))?(#(?P<fragment>.*))?$/', $iri, $match);
330
-		if (!$has_match) {
330
+		if ( ! $has_match) {
331 331
 			throw new Requests_Exception('Cannot parse supplied IRI', 'iri.cannot_parse', $iri);
332 332
 		}
333 333
 
334 334
 		if ($match[1] === '') {
335 335
 			$match['scheme'] = null;
336 336
 		}
337
-		if (!isset($match[3]) || $match[3] === '') {
337
+		if ( ! isset($match[3]) || $match[3] === '') {
338 338
 			$match['authority'] = null;
339 339
 		}
340
-		if (!isset($match[5])) {
340
+		if ( ! isset($match[5])) {
341 341
 			$match['path'] = '';
342 342
 		}
343
-		if (!isset($match[6]) || $match[6] === '') {
343
+		if ( ! isset($match[6]) || $match[6] === '') {
344 344
 			$match['query'] = null;
345 345
 		}
346
-		if (!isset($match[8]) || $match[8] === '') {
346
+		if ( ! isset($match[8]) || $match[8] === '') {
347 347
 			$match['fragment'] = null;
348 348
 		}
349 349
 		return $match;
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
 				$input = '';
406 406
 			}
407 407
 		}
408
-		return $output . $input;
408
+		return $output.$input;
409 409
 	}
410 410
 
411 411
 	/**
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
 			// Percent encode anything invalid or not in ucschar
493 493
 			if (
494 494
 				// Invalid sequences
495
-				!$valid
495
+				! $valid
496 496
 				// Non-shortest form sequences are invalid
497 497
 				|| $length > 1 && $character <= 0x7F
498 498
 				|| $length > 2 && $character <= 0x7FF
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
 				)
510 510
 				&& (
511 511
 					// Everything not in iprivate, if it applies
512
-					   !$iprivate
512
+					   ! $iprivate
513 513
 					|| $character < 0xE000
514 514
 					|| $character > 0x10FFFD
515 515
 				)
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
 			$value = hexdec($bytes[$i]);
557 557
 
558 558
 			// If we're the first byte of sequence:
559
-			if (!$remaining) {
559
+			if ( ! $remaining) {
560 560
 				// Start position
561 561
 				$start = $i;
562 562
 
@@ -608,11 +608,11 @@  discard block
 block discarded – undo
608 608
 			}
609 609
 
610 610
 			// If we've reached the end of the current byte sequence, append it to Unicode::$data
611
-			if (!$remaining) {
611
+			if ( ! $remaining) {
612 612
 				// Percent encode anything invalid or not in iunreserved
613 613
 				if (
614 614
 					// Invalid sequences
615
-					!$valid
615
+					! $valid
616 616
 					// Non-shortest form sequences are invalid
617 617
 					|| $length > 1 && $character <= 0x7F
618 618
 					|| $length > 2 && $character <= 0x7FF
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
 					|| $character > 0xD7FF && $character < 0xF900
633 633
 				) {
634 634
 					for ($j = $start; $j <= $i; $j++) {
635
-						$string .= '%' . strtoupper($bytes[$j]);
635
+						$string .= '%'.strtoupper($bytes[$j]);
636 636
 					}
637 637
 				}
638 638
 				else {
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
 		// mid-way through a multi-byte sequence)
648 648
 		if ($remaining) {
649 649
 			for ($j = $start; $j < $len; $j++) {
650
-				$string .= '%' . strtoupper($bytes[$j]);
650
+				$string .= '%'.strtoupper($bytes[$j]);
651 651
 			}
652 652
 		}
653 653
 
@@ -694,7 +694,7 @@  discard block
 block discarded – undo
694 694
 				) ||
695 695
 				(
696 696
 					$this->scheme === null &&
697
-					!$isauthority &&
697
+					! $isauthority &&
698 698
 					strpos($this->ipath, ':') !== false &&
699 699
 					(strpos($this->ipath, '/') === false ? true : strpos($this->ipath, ':') < strpos($this->ipath, '/'))
700 700
 				)
@@ -715,7 +715,7 @@  discard block
 block discarded – undo
715 715
 	 */
716 716
 	protected function set_iri($iri) {
717 717
 		static $cache;
718
-		if (!$cache) {
718
+		if ( ! $cache) {
719 719
 			$cache = array();
720 720
 		}
721 721
 
@@ -764,7 +764,7 @@  discard block
 block discarded – undo
764 764
 		if ($scheme === null) {
765 765
 			$this->scheme = null;
766 766
 		}
767
-		elseif (!preg_match('/^[A-Za-z][0-9A-Za-z+\-.]*$/', $scheme)) {
767
+		elseif ( ! preg_match('/^[A-Za-z][0-9A-Za-z+\-.]*$/', $scheme)) {
768 768
 			$this->scheme = null;
769 769
 			return false;
770 770
 		}
@@ -783,7 +783,7 @@  discard block
 block discarded – undo
783 783
 	 */
784 784
 	protected function set_authority($authority) {
785 785
 		static $cache;
786
-		if (!$cache) {
786
+		if ( ! $cache) {
787 787
 			$cache = array();
788 788
 		}
789 789
 
@@ -865,7 +865,7 @@  discard block
 block discarded – undo
865 865
 		}
866 866
 		if (substr($ihost, 0, 1) === '[' && substr($ihost, -1) === ']') {
867 867
 			if (Requests_IPv6::check_ipv6(substr($ihost, 1, -1))) {
868
-				$this->ihost = '[' . Requests_IPv6::compress(substr($ihost, 1, -1)) . ']';
868
+				$this->ihost = '['.Requests_IPv6::compress(substr($ihost, 1, -1)).']';
869 869
 			}
870 870
 			else {
871 871
 				$this->ihost = null;
@@ -929,7 +929,7 @@  discard block
 block discarded – undo
929 929
 	 */
930 930
 	protected function set_path($ipath) {
931 931
 		static $cache;
932
-		if (!$cache) {
932
+		if ( ! $cache) {
933 933
 			$cache = array();
934 934
 		}
935 935
 
@@ -990,12 +990,12 @@  discard block
 block discarded – undo
990 990
 	 * @return string|false URI if IRI is valid, false otherwise.
991 991
 	 */
992 992
 	protected function to_uri($string) {
993
-		if (!is_string($string)) {
993
+		if ( ! is_string($string)) {
994 994
 			return false;
995 995
 		}
996 996
 
997 997
 		static $non_ascii;
998
-		if (!$non_ascii) {
998
+		if ( ! $non_ascii) {
999 999
 			$non_ascii = implode('', range("\x80", "\xFF"));
1000 1000
 		}
1001 1001
 
@@ -1016,23 +1016,23 @@  discard block
 block discarded – undo
1016 1016
 	 * @return string
1017 1017
 	 */
1018 1018
 	protected function get_iri() {
1019
-		if (!$this->is_valid()) {
1019
+		if ( ! $this->is_valid()) {
1020 1020
 			return false;
1021 1021
 		}
1022 1022
 
1023 1023
 		$iri = '';
1024 1024
 		if ($this->scheme !== null) {
1025
-			$iri .= $this->scheme . ':';
1025
+			$iri .= $this->scheme.':';
1026 1026
 		}
1027 1027
 		if (($iauthority = $this->get_iauthority()) !== null) {
1028
-			$iri .= '//' . $iauthority;
1028
+			$iri .= '//'.$iauthority;
1029 1029
 		}
1030 1030
 		$iri .= $this->ipath;
1031 1031
 		if ($this->iquery !== null) {
1032
-			$iri .= '?' . $this->iquery;
1032
+			$iri .= '?'.$this->iquery;
1033 1033
 		}
1034 1034
 		if ($this->ifragment !== null) {
1035
-			$iri .= '#' . $this->ifragment;
1035
+			$iri .= '#'.$this->ifragment;
1036 1036
 		}
1037 1037
 
1038 1038
 		return $iri;
@@ -1059,13 +1059,13 @@  discard block
 block discarded – undo
1059 1059
 
1060 1060
 		$iauthority = '';
1061 1061
 		if ($this->iuserinfo !== null) {
1062
-			$iauthority .= $this->iuserinfo . '@';
1062
+			$iauthority .= $this->iuserinfo.'@';
1063 1063
 		}
1064 1064
 		if ($this->ihost !== null) {
1065 1065
 			$iauthority .= $this->ihost;
1066 1066
 		}
1067 1067
 		if ($this->port !== null) {
1068
-			$iauthority .= ':' . $this->port;
1068
+			$iauthority .= ':'.$this->port;
1069 1069
 		}
1070 1070
 		return $iauthority;
1071 1071
 	}
Please login to merge, or discard this patch.
Braces   +30 added lines, -60 removed lines patch added patch discarded remove patch
@@ -155,8 +155,7 @@  discard block
 block discarded – undo
155 155
 	public function __set($name, $value) {
156 156
 		if (method_exists($this, 'set_' . $name)) {
157 157
 			call_user_func(array($this, 'set_' . $name), $value);
158
-		}
159
-		elseif (
158
+		} elseif (
160 159
 			   $name === 'iauthority'
161 160
 			|| $name === 'iuserinfo'
162 161
 			|| $name === 'ihost'
@@ -187,8 +186,7 @@  discard block
 block discarded – undo
187 186
 		) {
188 187
 			$method = 'get_' . $name;
189 188
 			$return = $this->$method();
190
-		}
191
-		elseif (array_key_exists($name, $props)) {
189
+		} elseif (array_key_exists($name, $props)) {
192 190
 			$return = $this->$name;
193 191
 		}
194 192
 		// host -> ihost
@@ -200,16 +198,14 @@  discard block
 block discarded – undo
200 198
 		elseif (($prop = substr($name, 1)) && array_key_exists($prop, $props)) {
201 199
 			$name = $prop;
202 200
 			$return = $this->$prop;
203
-		}
204
-		else {
201
+		} else {
205 202
 			trigger_error('Undefined property: ' . get_class($this) . '::' . $name, E_USER_NOTICE);
206 203
 			$return = null;
207 204
 		}
208 205
 
209 206
 		if ($return === null && isset($this->normalization[$this->scheme][$name])) {
210 207
 			return $this->normalization[$this->scheme][$name];
211
-		}
212
-		else {
208
+		} else {
213 209
 			return $return;
214 210
 		}
215 211
 	}
@@ -259,8 +255,7 @@  discard block
 block discarded – undo
259 255
 		}
260 256
 		if (!$relative->is_valid()) {
261 257
 			return false;
262
-		}
263
-		elseif ($relative->scheme !== null) {
258
+		} elseif ($relative->scheme !== null) {
264 259
 			return clone $relative;
265 260
 		}
266 261
 
@@ -275,8 +270,7 @@  discard block
 block discarded – undo
275 270
 			if ($relative->iuserinfo !== null || $relative->ihost !== null || $relative->port !== null) {
276 271
 				$target = clone $relative;
277 272
 				$target->scheme = $base->scheme;
278
-			}
279
-			else {
273
+			} else {
280 274
 				$target = new Requests_IRI;
281 275
 				$target->scheme = $base->scheme;
282 276
 				$target->iuserinfo = $base->iuserinfo;
@@ -285,32 +279,26 @@  discard block
 block discarded – undo
285 279
 				if ($relative->ipath !== '') {
286 280
 					if ($relative->ipath[0] === '/') {
287 281
 						$target->ipath = $relative->ipath;
288
-					}
289
-					elseif (($base->iuserinfo !== null || $base->ihost !== null || $base->port !== null) && $base->ipath === '') {
282
+					} elseif (($base->iuserinfo !== null || $base->ihost !== null || $base->port !== null) && $base->ipath === '') {
290 283
 						$target->ipath = '/' . $relative->ipath;
291
-					}
292
-					elseif (($last_segment = strrpos($base->ipath, '/')) !== false) {
284
+					} elseif (($last_segment = strrpos($base->ipath, '/')) !== false) {
293 285
 						$target->ipath = substr($base->ipath, 0, $last_segment + 1) . $relative->ipath;
294
-					}
295
-					else {
286
+					} else {
296 287
 						$target->ipath = $relative->ipath;
297 288
 					}
298 289
 					$target->ipath = $target->remove_dot_segments($target->ipath);
299 290
 					$target->iquery = $relative->iquery;
300
-				}
301
-				else {
291
+				} else {
302 292
 					$target->ipath = $base->ipath;
303 293
 					if ($relative->iquery !== null) {
304 294
 						$target->iquery = $relative->iquery;
305
-					}
306
-					elseif ($base->iquery !== null) {
295
+					} elseif ($base->iquery !== null) {
307 296
 						$target->iquery = $base->iquery;
308 297
 					}
309 298
 				}
310 299
 				$target->ifragment = $relative->ifragment;
311 300
 			}
312
-		}
313
-		else {
301
+		} else {
314 302
 			$target = clone $base;
315 303
 			$target->ifragment = null;
316 304
 		}
@@ -362,8 +350,7 @@  discard block
 block discarded – undo
362 350
 			// then remove that prefix from the input buffer; otherwise,
363 351
 			if (strpos($input, '../') === 0) {
364 352
 				$input = substr($input, 3);
365
-			}
366
-			elseif (strpos($input, './') === 0) {
353
+			} elseif (strpos($input, './') === 0) {
367 354
 				$input = substr($input, 2);
368 355
 			}
369 356
 			// B: if the input buffer begins with a prefix of "/./" or "/.",
@@ -371,8 +358,7 @@  discard block
 block discarded – undo
371 358
 			// with "/" in the input buffer; otherwise,
372 359
 			elseif (strpos($input, '/./') === 0) {
373 360
 				$input = substr($input, 2);
374
-			}
375
-			elseif ($input === '/.') {
361
+			} elseif ($input === '/.') {
376 362
 				$input = '/';
377 363
 			}
378 364
 			// C: if the input buffer begins with a prefix of "/../" or "/..",
@@ -382,8 +368,7 @@  discard block
 block discarded – undo
382 368
 			elseif (strpos($input, '/../') === 0) {
383 369
 				$input = substr($input, 3);
384 370
 				$output = substr_replace($output, '', strrpos($output, '/'));
385
-			}
386
-			elseif ($input === '/..') {
371
+			} elseif ($input === '/..') {
387 372
 				$input = '/';
388 373
 				$output = substr_replace($output, '', strrpos($output, '/'));
389 374
 			}
@@ -399,8 +384,7 @@  discard block
 block discarded – undo
399 384
 			elseif (($pos = strpos($input, '/', 1)) !== false) {
400 385
 				$output .= substr($input, 0, $pos);
401 386
 				$input = substr_replace($input, '', 0, $pos);
402
-			}
403
-			else {
387
+			} else {
404 388
 				$output .= $input;
405 389
 				$input = '';
406 390
 			}
@@ -482,8 +466,7 @@  discard block
 block discarded – undo
482 466
 							break;
483 467
 						}
484 468
 					}
485
-				}
486
-				else {
469
+				} else {
487 470
 					$position = $strlen - 1;
488 471
 					$valid = false;
489 472
 				}
@@ -634,8 +617,7 @@  discard block
 block discarded – undo
634 617
 					for ($j = $start; $j <= $i; $j++) {
635 618
 						$string .= '%' . strtoupper($bytes[$j]);
636 619
 					}
637
-				}
638
-				else {
620
+				} else {
639 621
 					for ($j = $start; $j <= $i; $j++) {
640 622
 						$string .= chr(hexdec($bytes[$j]));
641 623
 					}
@@ -763,12 +745,10 @@  discard block
 block discarded – undo
763 745
 	protected function set_scheme($scheme) {
764 746
 		if ($scheme === null) {
765 747
 			$this->scheme = null;
766
-		}
767
-		elseif (!preg_match('/^[A-Za-z][0-9A-Za-z+\-.]*$/', $scheme)) {
748
+		} elseif (!preg_match('/^[A-Za-z][0-9A-Za-z+\-.]*$/', $scheme)) {
768 749
 			$this->scheme = null;
769 750
 			return false;
770
-		}
771
-		else {
751
+		} else {
772 752
 			$this->scheme = strtolower($scheme);
773 753
 		}
774 754
 		return true;
@@ -806,8 +786,7 @@  discard block
 block discarded – undo
806 786
 		if (($iuserinfo_end = strrpos($remaining, '@')) !== false) {
807 787
 			$iuserinfo = substr($remaining, 0, $iuserinfo_end);
808 788
 			$remaining = substr($remaining, $iuserinfo_end + 1);
809
-		}
810
-		else {
789
+		} else {
811 790
 			$iuserinfo = null;
812 791
 		}
813 792
 		if (($port_start = strpos($remaining, ':', strpos($remaining, ']'))) !== false) {
@@ -816,8 +795,7 @@  discard block
 block discarded – undo
816 795
 				$port = null;
817 796
 			}
818 797
 			$remaining = substr($remaining, 0, $port_start);
819
-		}
820
-		else {
798
+		} else {
821 799
 			$port = null;
822 800
 		}
823 801
 
@@ -842,8 +820,7 @@  discard block
 block discarded – undo
842 820
 	protected function set_userinfo($iuserinfo) {
843 821
 		if ($iuserinfo === null) {
844 822
 			$this->iuserinfo = null;
845
-		}
846
-		else {
823
+		} else {
847 824
 			$this->iuserinfo = $this->replace_invalid_with_pct_encoding($iuserinfo, '!$&\'()*+,;=:');
848 825
 			$this->scheme_normalization();
849 826
 		}
@@ -866,13 +843,11 @@  discard block
 block discarded – undo
866 843
 		if (substr($ihost, 0, 1) === '[' && substr($ihost, -1) === ']') {
867 844
 			if (Requests_IPv6::check_ipv6(substr($ihost, 1, -1))) {
868 845
 				$this->ihost = '[' . Requests_IPv6::compress(substr($ihost, 1, -1)) . ']';
869
-			}
870
-			else {
846
+			} else {
871 847
 				$this->ihost = null;
872 848
 				return false;
873 849
 			}
874
-		}
875
-		else {
850
+		} else {
876 851
 			$ihost = $this->replace_invalid_with_pct_encoding($ihost, '!$&\'()*+,;=');
877 852
 
878 853
 			// Lowercase, but ignore pct-encoded sections (as they should
@@ -883,8 +858,7 @@  discard block
 block discarded – undo
883 858
 			while (($position += strcspn($ihost, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ%', $position)) < $strlen) {
884 859
 				if ($ihost[$position] === '%') {
885 860
 					$position += 3;
886
-				}
887
-				else {
861
+				} else {
888 862
 					$ihost[$position] = strtolower($ihost[$position]);
889 863
 					$position++;
890 864
 				}
@@ -937,8 +911,7 @@  discard block
 block discarded – undo
937 911
 
938 912
 		if (isset($cache[$ipath])) {
939 913
 			$this->ipath = $cache[$ipath][(int) ($this->scheme !== null)];
940
-		}
941
-		else {
914
+		} else {
942 915
 			$valid = $this->replace_invalid_with_pct_encoding($ipath, '!$&\'()*+,;=@:/');
943 916
 			$removed = $this->remove_dot_segments($valid);
944 917
 
@@ -958,8 +931,7 @@  discard block
 block discarded – undo
958 931
 	protected function set_query($iquery) {
959 932
 		if ($iquery === null) {
960 933
 			$this->iquery = null;
961
-		}
962
-		else {
934
+		} else {
963 935
 			$this->iquery = $this->replace_invalid_with_pct_encoding($iquery, '!$&\'()*+,;=:@/?', true);
964 936
 			$this->scheme_normalization();
965 937
 		}
@@ -975,8 +947,7 @@  discard block
 block discarded – undo
975 947
 	protected function set_fragment($ifragment) {
976 948
 		if ($ifragment === null) {
977 949
 			$this->ifragment = null;
978
-		}
979
-		else {
950
+		} else {
980 951
 			$this->ifragment = $this->replace_invalid_with_pct_encoding($ifragment, '!$&\'()*+,;=:@/?');
981 952
 			$this->scheme_normalization();
982 953
 		}
@@ -1079,8 +1050,7 @@  discard block
 block discarded – undo
1079 1050
 		$iauthority = $this->get_iauthority();
1080 1051
 		if (is_string($iauthority)) {
1081 1052
 			return $this->to_uri($iauthority);
1082
-		}
1083
-		else {
1053
+		} else {
1084 1054
 			return $iauthority;
1085 1055
 		}
1086 1056
 	}
Please login to merge, or discard this patch.
src/wp-includes/Requests/Session.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -232,7 +232,7 @@
 block discarded – undo
232 232
 	 *
233 233
 	 * @param array $request Request data (same form as {@see request_multiple})
234 234
 	 * @param boolean $merge_options Should we merge options as well?
235
-	 * @return array Request data
235
+	 * @return string Request data
236 236
 	 */
237 237
 	protected function merge_request($request, $merge_options = true) {
238 238
 		if ($this->url !== null) {
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -249,8 +249,7 @@
 block discarded – undo
249 249
 			if (is_array($this->data)) {
250 250
 				$request['data'] = $this->data;
251 251
 			}
252
-		}
253
-		elseif (is_array($request['data']) && is_array($this->data)) {
252
+		} elseif (is_array($request['data']) && is_array($this->data)) {
254 253
 			$request['data'] = array_merge($this->data, $request['data']);
255 254
 		}
256 255
 
Please login to merge, or discard this patch.
src/wp-includes/theme.php 3 patches
Doc Comments   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1419,7 +1419,7 @@  discard block
 block discarded – undo
1419 1419
  *
1420 1420
  * @global array $editor_styles
1421 1421
  *
1422
- * @param array|string $stylesheet Optional. Stylesheet name or array thereof, relative to theme root.
1422
+ * @param string[] $stylesheet Optional. Stylesheet name or array thereof, relative to theme root.
1423 1423
  * 	                               Defaults to 'editor-style.css'
1424 1424
  */
1425 1425
 function add_editor_style( $stylesheet = 'editor-style.css' ) {
@@ -1531,7 +1531,6 @@  discard block
 block discarded – undo
1531 1531
  * @param string $feature  The feature being added. Likely core values include 'post-formats',
1532 1532
  *                         'post-thumbnails', 'html5', 'custom-logo', 'custom-header-uploads',
1533 1533
  *                         'custom-header', 'custom-background', 'title-tag', etc.
1534
- * @param mixed  $args,... Optional extra arguments to pass along with certain features.
1535 1534
  * @return void|bool False on failure, void otherwise.
1536 1535
  */
1537 1536
 function add_theme_support( $feature ) {
Please login to merge, or discard this patch.
Spacing   +693 added lines, -693 removed lines patch added patch discarded remove patch
@@ -27,55 +27,55 @@  discard block
 block discarded – undo
27 27
  *                      synonymous for the current blog.
28 28
  * @return array Array of WP_Theme objects.
29 29
  */
30
-function wp_get_themes( $args = array() ) {
30
+function wp_get_themes($args = array()) {
31 31
 	global $wp_theme_directories;
32 32
 
33
-	$defaults = array( 'errors' => false, 'allowed' => null, 'blog_id' => 0 );
34
-	$args = wp_parse_args( $args, $defaults );
33
+	$defaults = array('errors' => false, 'allowed' => null, 'blog_id' => 0);
34
+	$args = wp_parse_args($args, $defaults);
35 35
 
36 36
 	$theme_directories = search_theme_directories();
37 37
 
38
-	if ( count( $wp_theme_directories ) > 1 ) {
38
+	if (count($wp_theme_directories) > 1) {
39 39
 		// Make sure the current theme wins out, in case search_theme_directories() picks the wrong
40 40
 		// one in the case of a conflict. (Normally, last registered theme root wins.)
41 41
 		$current_theme = get_stylesheet();
42
-		if ( isset( $theme_directories[ $current_theme ] ) ) {
43
-			$root_of_current_theme = get_raw_theme_root( $current_theme );
44
-			if ( ! in_array( $root_of_current_theme, $wp_theme_directories ) )
45
-				$root_of_current_theme = WP_CONTENT_DIR . $root_of_current_theme;
46
-			$theme_directories[ $current_theme ]['theme_root'] = $root_of_current_theme;
42
+		if (isset($theme_directories[$current_theme])) {
43
+			$root_of_current_theme = get_raw_theme_root($current_theme);
44
+			if ( ! in_array($root_of_current_theme, $wp_theme_directories))
45
+				$root_of_current_theme = WP_CONTENT_DIR.$root_of_current_theme;
46
+			$theme_directories[$current_theme]['theme_root'] = $root_of_current_theme;
47 47
 		}
48 48
 	}
49 49
 
50
-	if ( empty( $theme_directories ) )
50
+	if (empty($theme_directories))
51 51
 		return array();
52 52
 
53
-	if ( is_multisite() && null !== $args['allowed'] ) {
53
+	if (is_multisite() && null !== $args['allowed']) {
54 54
 		$allowed = $args['allowed'];
55
-		if ( 'network' === $allowed )
56
-			$theme_directories = array_intersect_key( $theme_directories, WP_Theme::get_allowed_on_network() );
57
-		elseif ( 'site' === $allowed )
58
-			$theme_directories = array_intersect_key( $theme_directories, WP_Theme::get_allowed_on_site( $args['blog_id'] ) );
59
-		elseif ( $allowed )
60
-			$theme_directories = array_intersect_key( $theme_directories, WP_Theme::get_allowed( $args['blog_id'] ) );
55
+		if ('network' === $allowed)
56
+			$theme_directories = array_intersect_key($theme_directories, WP_Theme::get_allowed_on_network());
57
+		elseif ('site' === $allowed)
58
+			$theme_directories = array_intersect_key($theme_directories, WP_Theme::get_allowed_on_site($args['blog_id']));
59
+		elseif ($allowed)
60
+			$theme_directories = array_intersect_key($theme_directories, WP_Theme::get_allowed($args['blog_id']));
61 61
 		else
62
-			$theme_directories = array_diff_key( $theme_directories, WP_Theme::get_allowed( $args['blog_id'] ) );
62
+			$theme_directories = array_diff_key($theme_directories, WP_Theme::get_allowed($args['blog_id']));
63 63
 	}
64 64
 
65 65
 	$themes = array();
66 66
 	static $_themes = array();
67 67
 
68
-	foreach ( $theme_directories as $theme => $theme_root ) {
69
-		if ( isset( $_themes[ $theme_root['theme_root'] . '/' . $theme ] ) )
70
-			$themes[ $theme ] = $_themes[ $theme_root['theme_root'] . '/' . $theme ];
68
+	foreach ($theme_directories as $theme => $theme_root) {
69
+		if (isset($_themes[$theme_root['theme_root'].'/'.$theme]))
70
+			$themes[$theme] = $_themes[$theme_root['theme_root'].'/'.$theme];
71 71
 		else
72
-			$themes[ $theme ] = $_themes[ $theme_root['theme_root'] . '/' . $theme ] = new WP_Theme( $theme, $theme_root['theme_root'] );
72
+			$themes[$theme] = $_themes[$theme_root['theme_root'].'/'.$theme] = new WP_Theme($theme, $theme_root['theme_root']);
73 73
 	}
74 74
 
75
-	if ( null !== $args['errors'] ) {
76
-		foreach ( $themes as $theme => $wp_theme ) {
77
-			if ( $wp_theme->errors() != $args['errors'] )
78
-				unset( $themes[ $theme ] );
75
+	if (null !== $args['errors']) {
76
+		foreach ($themes as $theme => $wp_theme) {
77
+			if ($wp_theme->errors() != $args['errors'])
78
+				unset($themes[$theme]);
79 79
 		}
80 80
 	}
81 81
 
@@ -94,21 +94,21 @@  discard block
 block discarded – undo
94 94
  * 	                         is used to calculate the theme root for the $stylesheet provided (or current theme).
95 95
  * @return WP_Theme Theme object. Be sure to check the object's exists() method if you need to confirm the theme's existence.
96 96
  */
97
-function wp_get_theme( $stylesheet = null, $theme_root = null ) {
97
+function wp_get_theme($stylesheet = null, $theme_root = null) {
98 98
 	global $wp_theme_directories;
99 99
 
100
-	if ( empty( $stylesheet ) )
100
+	if (empty($stylesheet))
101 101
 		$stylesheet = get_stylesheet();
102 102
 
103
-	if ( empty( $theme_root ) ) {
104
-		$theme_root = get_raw_theme_root( $stylesheet );
105
-		if ( false === $theme_root )
106
-			$theme_root = WP_CONTENT_DIR . '/themes';
107
-		elseif ( ! in_array( $theme_root, (array) $wp_theme_directories ) )
108
-			$theme_root = WP_CONTENT_DIR . $theme_root;
103
+	if (empty($theme_root)) {
104
+		$theme_root = get_raw_theme_root($stylesheet);
105
+		if (false === $theme_root)
106
+			$theme_root = WP_CONTENT_DIR.'/themes';
107
+		elseif ( ! in_array($theme_root, (array) $wp_theme_directories))
108
+			$theme_root = WP_CONTENT_DIR.$theme_root;
109 109
 	}
110 110
 
111
-	return new WP_Theme( $stylesheet, $theme_root );
111
+	return new WP_Theme($stylesheet, $theme_root);
112 112
 }
113 113
 
114 114
 /**
@@ -117,11 +117,11 @@  discard block
 block discarded – undo
117 117
  * @since 3.5.0
118 118
  * @param bool $clear_update_cache Whether to clear the Theme updates cache
119 119
  */
120
-function wp_clean_themes_cache( $clear_update_cache = true ) {
121
-	if ( $clear_update_cache )
122
-		delete_site_transient( 'update_themes' );
123
-	search_theme_directories( true );
124
-	foreach ( wp_get_themes( array( 'errors' => null ) ) as $theme )
120
+function wp_clean_themes_cache($clear_update_cache = true) {
121
+	if ($clear_update_cache)
122
+		delete_site_transient('update_themes');
123
+	search_theme_directories(true);
124
+	foreach (wp_get_themes(array('errors' => null)) as $theme)
125 125
 		$theme->cache_delete();
126 126
 }
127 127
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
  * @return bool true if a child theme is in use, false otherwise.
134 134
  **/
135 135
 function is_child_theme() {
136
-	return ( TEMPLATEPATH !== STYLESHEETPATH );
136
+	return (TEMPLATEPATH !== STYLESHEETPATH);
137 137
 }
138 138
 
139 139
 /**
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 	 *
158 158
 	 * @param string $stylesheet Name of the current stylesheet.
159 159
 	 */
160
-	return apply_filters( 'stylesheet', get_option( 'stylesheet' ) );
160
+	return apply_filters('stylesheet', get_option('stylesheet'));
161 161
 }
162 162
 
163 163
 /**
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
  */
170 170
 function get_stylesheet_directory() {
171 171
 	$stylesheet = get_stylesheet();
172
-	$theme_root = get_theme_root( $stylesheet );
172
+	$theme_root = get_theme_root($stylesheet);
173 173
 	$stylesheet_dir = "$theme_root/$stylesheet";
174 174
 
175 175
 	/**
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	 * @param string $stylesheet     Directory name of the current theme.
182 182
 	 * @param string $theme_root     Absolute path to themes directory.
183 183
 	 */
184
-	return apply_filters( 'stylesheet_directory', $stylesheet_dir, $stylesheet, $theme_root );
184
+	return apply_filters('stylesheet_directory', $stylesheet_dir, $stylesheet, $theme_root);
185 185
 }
186 186
 
187 187
 /**
@@ -192,8 +192,8 @@  discard block
 block discarded – undo
192 192
  * @return string
193 193
  */
194 194
 function get_stylesheet_directory_uri() {
195
-	$stylesheet = str_replace( '%2F', '/', rawurlencode( get_stylesheet() ) );
196
-	$theme_root_uri = get_theme_root_uri( $stylesheet );
195
+	$stylesheet = str_replace('%2F', '/', rawurlencode(get_stylesheet()));
196
+	$theme_root_uri = get_theme_root_uri($stylesheet);
197 197
 	$stylesheet_dir_uri = "$theme_root_uri/$stylesheet";
198 198
 
199 199
 	/**
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 	 * @param string $stylesheet         Name of the activated theme's directory.
206 206
 	 * @param string $theme_root_uri     Themes root URI.
207 207
 	 */
208
-	return apply_filters( 'stylesheet_directory_uri', $stylesheet_dir_uri, $stylesheet, $theme_root_uri );
208
+	return apply_filters('stylesheet_directory_uri', $stylesheet_dir_uri, $stylesheet, $theme_root_uri);
209 209
 }
210 210
 
211 211
 /**
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
  */
221 221
 function get_stylesheet_uri() {
222 222
 	$stylesheet_dir_uri = get_stylesheet_directory_uri();
223
-	$stylesheet_uri = $stylesheet_dir_uri . '/style.css';
223
+	$stylesheet_uri = $stylesheet_dir_uri.'/style.css';
224 224
 	/**
225 225
 	 * Filters the URI of the current theme stylesheet.
226 226
 	 *
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 	 * @param string $stylesheet_uri     Stylesheet URI for the current theme/child theme.
230 230
 	 * @param string $stylesheet_dir_uri Stylesheet directory URI for the current theme/child theme.
231 231
 	 */
232
-	return apply_filters( 'stylesheet_uri', $stylesheet_uri, $stylesheet_dir_uri );
232
+	return apply_filters('stylesheet_uri', $stylesheet_uri, $stylesheet_dir_uri);
233 233
 }
234 234
 
235 235
 /**
@@ -258,9 +258,9 @@  discard block
 block discarded – undo
258 258
 	$stylesheet_dir_uri = get_stylesheet_directory_uri();
259 259
 	$dir = get_stylesheet_directory();
260 260
 	$locale = get_locale();
261
-	if ( file_exists("$dir/$locale.css") )
261
+	if (file_exists("$dir/$locale.css"))
262 262
 		$stylesheet_uri = "$stylesheet_dir_uri/$locale.css";
263
-	elseif ( !empty($wp_locale->text_direction) && file_exists("$dir/{$wp_locale->text_direction}.css") )
263
+	elseif ( ! empty($wp_locale->text_direction) && file_exists("$dir/{$wp_locale->text_direction}.css"))
264 264
 		$stylesheet_uri = "$stylesheet_dir_uri/{$wp_locale->text_direction}.css";
265 265
 	else
266 266
 		$stylesheet_uri = '';
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 	 * @param string $stylesheet_uri     Localized stylesheet URI.
273 273
 	 * @param string $stylesheet_dir_uri Stylesheet directory URI.
274 274
 	 */
275
-	return apply_filters( 'locale_stylesheet_uri', $stylesheet_uri, $stylesheet_dir_uri );
275
+	return apply_filters('locale_stylesheet_uri', $stylesheet_uri, $stylesheet_dir_uri);
276 276
 }
277 277
 
278 278
 /**
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 	 *
291 291
 	 * @param string $template Current theme's directory name.
292 292
 	 */
293
-	return apply_filters( 'template', get_option( 'template' ) );
293
+	return apply_filters('template', get_option('template'));
294 294
 }
295 295
 
296 296
 /**
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
  */
303 303
 function get_template_directory() {
304 304
 	$template = get_template();
305
-	$theme_root = get_theme_root( $template );
305
+	$theme_root = get_theme_root($template);
306 306
 	$template_dir = "$theme_root/$template";
307 307
 
308 308
 	/**
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 	 * @param string $template     Directory name of the current theme.
315 315
 	 * @param string $theme_root   Absolute path to the themes directory.
316 316
 	 */
317
-	return apply_filters( 'template_directory', $template_dir, $template, $theme_root );
317
+	return apply_filters('template_directory', $template_dir, $template, $theme_root);
318 318
 }
319 319
 
320 320
 /**
@@ -325,8 +325,8 @@  discard block
 block discarded – undo
325 325
  * @return string Template directory URI.
326 326
  */
327 327
 function get_template_directory_uri() {
328
-	$template = str_replace( '%2F', '/', rawurlencode( get_template() ) );
329
-	$theme_root_uri = get_theme_root_uri( $template );
328
+	$template = str_replace('%2F', '/', rawurlencode(get_template()));
329
+	$theme_root_uri = get_theme_root_uri($template);
330 330
 	$template_dir_uri = "$theme_root_uri/$template";
331 331
 
332 332
 	/**
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 	 * @param string $template         Directory name of the current theme.
339 339
 	 * @param string $theme_root_uri   The themes root URI.
340 340
 	 */
341
-	return apply_filters( 'template_directory_uri', $template_dir_uri, $template, $theme_root_uri );
341
+	return apply_filters('template_directory_uri', $template_dir_uri, $template, $theme_root_uri);
342 342
 }
343 343
 
344 344
 /**
@@ -353,13 +353,13 @@  discard block
 block discarded – undo
353 353
 function get_theme_roots() {
354 354
 	global $wp_theme_directories;
355 355
 
356
-	if ( count($wp_theme_directories) <= 1 )
356
+	if (count($wp_theme_directories) <= 1)
357 357
 		return '/themes';
358 358
 
359
-	$theme_roots = get_site_transient( 'theme_roots' );
360
-	if ( false === $theme_roots ) {
361
-		search_theme_directories( true ); // Regenerate the transient.
362
-		$theme_roots = get_site_transient( 'theme_roots' );
359
+	$theme_roots = get_site_transient('theme_roots');
360
+	if (false === $theme_roots) {
361
+		search_theme_directories(true); // Regenerate the transient.
362
+		$theme_roots = get_site_transient('theme_roots');
363 363
 	}
364 364
 	return $theme_roots;
365 365
 }
@@ -374,24 +374,24 @@  discard block
 block discarded – undo
374 374
  * @param string $directory Either the full filesystem path to a theme folder or a folder within WP_CONTENT_DIR
375 375
  * @return bool
376 376
  */
377
-function register_theme_directory( $directory ) {
377
+function register_theme_directory($directory) {
378 378
 	global $wp_theme_directories;
379 379
 
380
-	if ( ! file_exists( $directory ) ) {
380
+	if ( ! file_exists($directory)) {
381 381
 		// Try prepending as the theme directory could be relative to the content directory
382
-		$directory = WP_CONTENT_DIR . '/' . $directory;
382
+		$directory = WP_CONTENT_DIR.'/'.$directory;
383 383
 		// If this directory does not exist, return and do not register
384
-		if ( ! file_exists( $directory ) ) {
384
+		if ( ! file_exists($directory)) {
385 385
 			return false;
386 386
 		}
387 387
 	}
388 388
 
389
-	if ( ! is_array( $wp_theme_directories ) ) {
389
+	if ( ! is_array($wp_theme_directories)) {
390 390
 		$wp_theme_directories = array();
391 391
 	}
392 392
 
393
-	$untrailed = untrailingslashit( $directory );
394
-	if ( ! empty( $untrailed ) && ! in_array( $untrailed, $wp_theme_directories ) ) {
393
+	$untrailed = untrailingslashit($directory);
394
+	if ( ! empty($untrailed) && ! in_array($untrailed, $wp_theme_directories)) {
395 395
 		$wp_theme_directories[] = $untrailed;
396 396
 	}
397 397
 
@@ -409,14 +409,14 @@  discard block
 block discarded – undo
409 409
  * @param bool $force Optional. Whether to force a new directory scan. Defaults to false.
410 410
  * @return array|false Valid themes found
411 411
  */
412
-function search_theme_directories( $force = false ) {
412
+function search_theme_directories($force = false) {
413 413
 	global $wp_theme_directories;
414 414
 	static $found_themes = null;
415 415
 
416
-	if ( empty( $wp_theme_directories ) )
416
+	if (empty($wp_theme_directories))
417 417
 		return false;
418 418
 
419
-	if ( ! $force && isset( $found_themes ) )
419
+	if ( ! $force && isset($found_themes))
420 420
 		return $found_themes;
421 421
 
422 422
 	$found_themes = array();
@@ -427,11 +427,11 @@  discard block
 block discarded – undo
427 427
 	// Set up maybe-relative, maybe-absolute array of theme directories.
428 428
 	// We always want to return absolute, but we need to cache relative
429 429
 	// to use in get_theme_root().
430
-	foreach ( $wp_theme_directories as $theme_root ) {
431
-		if ( 0 === strpos( $theme_root, WP_CONTENT_DIR ) )
432
-			$relative_theme_roots[ str_replace( WP_CONTENT_DIR, '', $theme_root ) ] = $theme_root;
430
+	foreach ($wp_theme_directories as $theme_root) {
431
+		if (0 === strpos($theme_root, WP_CONTENT_DIR))
432
+			$relative_theme_roots[str_replace(WP_CONTENT_DIR, '', $theme_root)] = $theme_root;
433 433
 		else
434
-			$relative_theme_roots[ $theme_root ] = $theme_root;
434
+			$relative_theme_roots[$theme_root] = $theme_root;
435 435
 	}
436 436
 
437 437
 	/**
@@ -442,87 +442,87 @@  discard block
 block discarded – undo
442 442
 	 * @param bool   $cache_expiration Whether to get the cache of the theme directories. Default false.
443 443
 	 * @param string $cache_directory  Directory to be searched for the cache.
444 444
 	 */
445
-	if ( $cache_expiration = apply_filters( 'wp_cache_themes_persistently', false, 'search_theme_directories' ) ) {
446
-		$cached_roots = get_site_transient( 'theme_roots' );
447
-		if ( is_array( $cached_roots ) ) {
448
-			foreach ( $cached_roots as $theme_dir => $theme_root ) {
445
+	if ($cache_expiration = apply_filters('wp_cache_themes_persistently', false, 'search_theme_directories')) {
446
+		$cached_roots = get_site_transient('theme_roots');
447
+		if (is_array($cached_roots)) {
448
+			foreach ($cached_roots as $theme_dir => $theme_root) {
449 449
 				// A cached theme root is no longer around, so skip it.
450
-				if ( ! isset( $relative_theme_roots[ $theme_root ] ) )
450
+				if ( ! isset($relative_theme_roots[$theme_root]))
451 451
 					continue;
452
-				$found_themes[ $theme_dir ] = array(
453
-					'theme_file' => $theme_dir . '/style.css',
454
-					'theme_root' => $relative_theme_roots[ $theme_root ], // Convert relative to absolute.
452
+				$found_themes[$theme_dir] = array(
453
+					'theme_file' => $theme_dir.'/style.css',
454
+					'theme_root' => $relative_theme_roots[$theme_root], // Convert relative to absolute.
455 455
 				);
456 456
 			}
457 457
 			return $found_themes;
458 458
 		}
459
-		if ( ! is_int( $cache_expiration ) )
459
+		if ( ! is_int($cache_expiration))
460 460
 			$cache_expiration = 1800; // half hour
461 461
 	} else {
462 462
 		$cache_expiration = 1800; // half hour
463 463
 	}
464 464
 
465 465
 	/* Loop the registered theme directories and extract all themes */
466
-	foreach ( $wp_theme_directories as $theme_root ) {
466
+	foreach ($wp_theme_directories as $theme_root) {
467 467
 
468 468
 		// Start with directories in the root of the current theme directory.
469
-		$dirs = @ scandir( $theme_root );
470
-		if ( ! $dirs ) {
471
-			trigger_error( "$theme_root is not readable", E_USER_NOTICE );
469
+		$dirs = @ scandir($theme_root);
470
+		if ( ! $dirs) {
471
+			trigger_error("$theme_root is not readable", E_USER_NOTICE);
472 472
 			continue;
473 473
 		}
474
-		foreach ( $dirs as $dir ) {
475
-			if ( ! is_dir( $theme_root . '/' . $dir ) || $dir[0] == '.' || $dir == 'CVS' )
474
+		foreach ($dirs as $dir) {
475
+			if ( ! is_dir($theme_root.'/'.$dir) || $dir[0] == '.' || $dir == 'CVS')
476 476
 				continue;
477
-			if ( file_exists( $theme_root . '/' . $dir . '/style.css' ) ) {
477
+			if (file_exists($theme_root.'/'.$dir.'/style.css')) {
478 478
 				// wp-content/themes/a-single-theme
479 479
 				// wp-content/themes is $theme_root, a-single-theme is $dir
480
-				$found_themes[ $dir ] = array(
481
-					'theme_file' => $dir . '/style.css',
480
+				$found_themes[$dir] = array(
481
+					'theme_file' => $dir.'/style.css',
482 482
 					'theme_root' => $theme_root,
483 483
 				);
484 484
 			} else {
485 485
 				$found_theme = false;
486 486
 				// wp-content/themes/a-folder-of-themes/*
487 487
 				// wp-content/themes is $theme_root, a-folder-of-themes is $dir, then themes are $sub_dirs
488
-				$sub_dirs = @ scandir( $theme_root . '/' . $dir );
489
-				if ( ! $sub_dirs ) {
490
-					trigger_error( "$theme_root/$dir is not readable", E_USER_NOTICE );
488
+				$sub_dirs = @ scandir($theme_root.'/'.$dir);
489
+				if ( ! $sub_dirs) {
490
+					trigger_error("$theme_root/$dir is not readable", E_USER_NOTICE);
491 491
 					continue;
492 492
 				}
493
-				foreach ( $sub_dirs as $sub_dir ) {
494
-					if ( ! is_dir( $theme_root . '/' . $dir . '/' . $sub_dir ) || $dir[0] == '.' || $dir == 'CVS' )
493
+				foreach ($sub_dirs as $sub_dir) {
494
+					if ( ! is_dir($theme_root.'/'.$dir.'/'.$sub_dir) || $dir[0] == '.' || $dir == 'CVS')
495 495
 						continue;
496
-					if ( ! file_exists( $theme_root . '/' . $dir . '/' . $sub_dir . '/style.css' ) )
496
+					if ( ! file_exists($theme_root.'/'.$dir.'/'.$sub_dir.'/style.css'))
497 497
 						continue;
498
-					$found_themes[ $dir . '/' . $sub_dir ] = array(
499
-						'theme_file' => $dir . '/' . $sub_dir . '/style.css',
498
+					$found_themes[$dir.'/'.$sub_dir] = array(
499
+						'theme_file' => $dir.'/'.$sub_dir.'/style.css',
500 500
 						'theme_root' => $theme_root,
501 501
 					);
502 502
 					$found_theme = true;
503 503
 				}
504 504
 				// Never mind the above, it's just a theme missing a style.css.
505 505
 				// Return it; WP_Theme will catch the error.
506
-				if ( ! $found_theme )
507
-					$found_themes[ $dir ] = array(
508
-						'theme_file' => $dir . '/style.css',
506
+				if ( ! $found_theme)
507
+					$found_themes[$dir] = array(
508
+						'theme_file' => $dir.'/style.css',
509 509
 						'theme_root' => $theme_root,
510 510
 					);
511 511
 			}
512 512
 		}
513 513
 	}
514 514
 
515
-	asort( $found_themes );
515
+	asort($found_themes);
516 516
 
517 517
 	$theme_roots = array();
518
-	$relative_theme_roots = array_flip( $relative_theme_roots );
518
+	$relative_theme_roots = array_flip($relative_theme_roots);
519 519
 
520
-	foreach ( $found_themes as $theme_dir => $theme_data ) {
521
-		$theme_roots[ $theme_dir ] = $relative_theme_roots[ $theme_data['theme_root'] ]; // Convert absolute to relative.
520
+	foreach ($found_themes as $theme_dir => $theme_data) {
521
+		$theme_roots[$theme_dir] = $relative_theme_roots[$theme_data['theme_root']]; // Convert absolute to relative.
522 522
 	}
523 523
 
524
-	if ( $theme_roots != get_site_transient( 'theme_roots' ) )
525
-		set_site_transient( 'theme_roots', $theme_roots, $cache_expiration );
524
+	if ($theme_roots != get_site_transient('theme_roots'))
525
+		set_site_transient('theme_roots', $theme_roots, $cache_expiration);
526 526
 
527 527
 	return $found_themes;
528 528
 }
@@ -539,16 +539,16 @@  discard block
 block discarded – undo
539 539
  * @param string $stylesheet_or_template The stylesheet or template name of the theme
540 540
  * @return string Theme path.
541 541
  */
542
-function get_theme_root( $stylesheet_or_template = false ) {
542
+function get_theme_root($stylesheet_or_template = false) {
543 543
 	global $wp_theme_directories;
544 544
 
545
-	if ( $stylesheet_or_template && $theme_root = get_raw_theme_root( $stylesheet_or_template ) ) {
545
+	if ($stylesheet_or_template && $theme_root = get_raw_theme_root($stylesheet_or_template)) {
546 546
 		// Always prepend WP_CONTENT_DIR unless the root currently registered as a theme directory.
547 547
 		// This gives relative theme roots the benefit of the doubt when things go haywire.
548
-		if ( ! in_array( $theme_root, (array) $wp_theme_directories ) )
549
-			$theme_root = WP_CONTENT_DIR . $theme_root;
548
+		if ( ! in_array($theme_root, (array) $wp_theme_directories))
549
+			$theme_root = WP_CONTENT_DIR.$theme_root;
550 550
 	} else {
551
-		$theme_root = WP_CONTENT_DIR . '/themes';
551
+		$theme_root = WP_CONTENT_DIR.'/themes';
552 552
 	}
553 553
 
554 554
 	/**
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
 	 *
559 559
 	 * @param string $theme_root Absolute path to themes directory.
560 560
 	 */
561
-	return apply_filters( 'theme_root', $theme_root );
561
+	return apply_filters('theme_root', $theme_root);
562 562
 }
563 563
 
564 564
 /**
@@ -576,28 +576,28 @@  discard block
 block discarded – undo
576 576
  * 	                                     the need for a get_raw_theme_root() call.
577 577
  * @return string Themes URI.
578 578
  */
579
-function get_theme_root_uri( $stylesheet_or_template = false, $theme_root = false ) {
579
+function get_theme_root_uri($stylesheet_or_template = false, $theme_root = false) {
580 580
 	global $wp_theme_directories;
581 581
 
582
-	if ( $stylesheet_or_template && ! $theme_root )
583
-		$theme_root = get_raw_theme_root( $stylesheet_or_template );
582
+	if ($stylesheet_or_template && ! $theme_root)
583
+		$theme_root = get_raw_theme_root($stylesheet_or_template);
584 584
 
585
-	if ( $stylesheet_or_template && $theme_root ) {
586
-		if ( in_array( $theme_root, (array) $wp_theme_directories ) ) {
585
+	if ($stylesheet_or_template && $theme_root) {
586
+		if (in_array($theme_root, (array) $wp_theme_directories)) {
587 587
 			// Absolute path. Make an educated guess. YMMV -- but note the filter below.
588
-			if ( 0 === strpos( $theme_root, WP_CONTENT_DIR ) )
589
-				$theme_root_uri = content_url( str_replace( WP_CONTENT_DIR, '', $theme_root ) );
590
-			elseif ( 0 === strpos( $theme_root, ABSPATH ) )
591
-				$theme_root_uri = site_url( str_replace( ABSPATH, '', $theme_root ) );
592
-			elseif ( 0 === strpos( $theme_root, WP_PLUGIN_DIR ) || 0 === strpos( $theme_root, WPMU_PLUGIN_DIR ) )
593
-				$theme_root_uri = plugins_url( basename( $theme_root ), $theme_root );
588
+			if (0 === strpos($theme_root, WP_CONTENT_DIR))
589
+				$theme_root_uri = content_url(str_replace(WP_CONTENT_DIR, '', $theme_root));
590
+			elseif (0 === strpos($theme_root, ABSPATH))
591
+				$theme_root_uri = site_url(str_replace(ABSPATH, '', $theme_root));
592
+			elseif (0 === strpos($theme_root, WP_PLUGIN_DIR) || 0 === strpos($theme_root, WPMU_PLUGIN_DIR))
593
+				$theme_root_uri = plugins_url(basename($theme_root), $theme_root);
594 594
 			else
595 595
 				$theme_root_uri = $theme_root;
596 596
 		} else {
597
-			$theme_root_uri = content_url( $theme_root );
597
+			$theme_root_uri = content_url($theme_root);
598 598
 		}
599 599
 	} else {
600
-		$theme_root_uri = content_url( 'themes' );
600
+		$theme_root_uri = content_url('themes');
601 601
 	}
602 602
 
603 603
 	/**
@@ -609,7 +609,7 @@  discard block
 block discarded – undo
609 609
 	 * @param string $siteurl                WordPress web address which is set in General Options.
610 610
 	 * @param string $stylesheet_or_template Stylesheet or template name of the theme.
611 611
 	 */
612
-	return apply_filters( 'theme_root_uri', $theme_root_uri, get_option( 'siteurl' ), $stylesheet_or_template );
612
+	return apply_filters('theme_root_uri', $theme_root_uri, get_option('siteurl'), $stylesheet_or_template);
613 613
 }
614 614
 
615 615
 /**
@@ -624,25 +624,25 @@  discard block
 block discarded – undo
624 624
  *                                       Defaults to false, meaning the cache is used.
625 625
  * @return string Theme root
626 626
  */
627
-function get_raw_theme_root( $stylesheet_or_template, $skip_cache = false ) {
627
+function get_raw_theme_root($stylesheet_or_template, $skip_cache = false) {
628 628
 	global $wp_theme_directories;
629 629
 
630
-	if ( count($wp_theme_directories) <= 1 )
630
+	if (count($wp_theme_directories) <= 1)
631 631
 		return '/themes';
632 632
 
633 633
 	$theme_root = false;
634 634
 
635 635
 	// If requesting the root for the current theme, consult options to avoid calling get_theme_roots()
636
-	if ( ! $skip_cache ) {
637
-		if ( get_option('stylesheet') == $stylesheet_or_template )
636
+	if ( ! $skip_cache) {
637
+		if (get_option('stylesheet') == $stylesheet_or_template)
638 638
 			$theme_root = get_option('stylesheet_root');
639
-		elseif ( get_option('template') == $stylesheet_or_template )
639
+		elseif (get_option('template') == $stylesheet_or_template)
640 640
 			$theme_root = get_option('template_root');
641 641
 	}
642 642
 
643
-	if ( empty($theme_root) ) {
643
+	if (empty($theme_root)) {
644 644
 		$theme_roots = get_theme_roots();
645
-		if ( !empty($theme_roots[$stylesheet_or_template]) )
645
+		if ( ! empty($theme_roots[$stylesheet_or_template]))
646 646
 			$theme_root = $theme_roots[$stylesheet_or_template];
647 647
 	}
648 648
 
@@ -656,9 +656,9 @@  discard block
 block discarded – undo
656 656
  */
657 657
 function locale_stylesheet() {
658 658
 	$stylesheet = get_locale_stylesheet_uri();
659
-	if ( empty($stylesheet) )
659
+	if (empty($stylesheet))
660 660
 		return;
661
-	echo '<link rel="stylesheet" href="' . $stylesheet . '" type="text/css" media="screen" />';
661
+	echo '<link rel="stylesheet" href="'.$stylesheet.'" type="text/css" media="screen" />';
662 662
 }
663 663
 
664 664
 /**
@@ -675,71 +675,71 @@  discard block
 block discarded – undo
675 675
  *
676 676
  * @param string $stylesheet Stylesheet name
677 677
  */
678
-function switch_theme( $stylesheet ) {
678
+function switch_theme($stylesheet) {
679 679
 	global $wp_theme_directories, $wp_customize, $sidebars_widgets;
680 680
 
681 681
 	$_sidebars_widgets = null;
682
-	if ( 'wp_ajax_customize_save' === current_action() ) {
683
-		$_sidebars_widgets = $wp_customize->post_value( $wp_customize->get_setting( 'old_sidebars_widgets_data' ) );
684
-	} elseif ( is_array( $sidebars_widgets ) ) {
682
+	if ('wp_ajax_customize_save' === current_action()) {
683
+		$_sidebars_widgets = $wp_customize->post_value($wp_customize->get_setting('old_sidebars_widgets_data'));
684
+	} elseif (is_array($sidebars_widgets)) {
685 685
 		$_sidebars_widgets = $sidebars_widgets;
686 686
 	}
687 687
 
688
-	if ( is_array( $_sidebars_widgets ) ) {
689
-		set_theme_mod( 'sidebars_widgets', array( 'time' => time(), 'data' => $_sidebars_widgets ) );
688
+	if (is_array($_sidebars_widgets)) {
689
+		set_theme_mod('sidebars_widgets', array('time' => time(), 'data' => $_sidebars_widgets));
690 690
 	}
691 691
 
692
-	$nav_menu_locations = get_theme_mod( 'nav_menu_locations' );
692
+	$nav_menu_locations = get_theme_mod('nav_menu_locations');
693 693
 
694
-	if ( func_num_args() > 1 ) {
695
-		$stylesheet = func_get_arg( 1 );
694
+	if (func_num_args() > 1) {
695
+		$stylesheet = func_get_arg(1);
696 696
 	}
697 697
 
698 698
 	$old_theme = wp_get_theme();
699
-	$new_theme = wp_get_theme( $stylesheet );
699
+	$new_theme = wp_get_theme($stylesheet);
700 700
 	$template  = $new_theme->get_template();
701 701
 
702
-	update_option( 'template', $template );
703
-	update_option( 'stylesheet', $stylesheet );
702
+	update_option('template', $template);
703
+	update_option('stylesheet', $stylesheet);
704 704
 
705
-	if ( count( $wp_theme_directories ) > 1 ) {
706
-		update_option( 'template_root', get_raw_theme_root( $template, true ) );
707
-		update_option( 'stylesheet_root', get_raw_theme_root( $stylesheet, true ) );
705
+	if (count($wp_theme_directories) > 1) {
706
+		update_option('template_root', get_raw_theme_root($template, true));
707
+		update_option('stylesheet_root', get_raw_theme_root($stylesheet, true));
708 708
 	} else {
709
-		delete_option( 'template_root' );
710
-		delete_option( 'stylesheet_root' );
709
+		delete_option('template_root');
710
+		delete_option('stylesheet_root');
711 711
 	}
712 712
 
713
-	$new_name  = $new_theme->get('Name');
713
+	$new_name = $new_theme->get('Name');
714 714
 
715
-	update_option( 'current_theme', $new_name );
715
+	update_option('current_theme', $new_name);
716 716
 
717 717
 	// Migrate from the old mods_{name} option to theme_mods_{slug}.
718
-	if ( is_admin() && false === get_option( 'theme_mods_' . $stylesheet ) ) {
719
-		$default_theme_mods = (array) get_option( 'mods_' . $new_name );
720
-		if ( ! empty( $nav_menu_locations ) && empty( $default_theme_mods['nav_menu_locations'] ) ) {
718
+	if (is_admin() && false === get_option('theme_mods_'.$stylesheet)) {
719
+		$default_theme_mods = (array) get_option('mods_'.$new_name);
720
+		if ( ! empty($nav_menu_locations) && empty($default_theme_mods['nav_menu_locations'])) {
721 721
 			$default_theme_mods['nav_menu_locations'] = $nav_menu_locations;
722 722
 		}
723
-		add_option( "theme_mods_$stylesheet", $default_theme_mods );
723
+		add_option("theme_mods_$stylesheet", $default_theme_mods);
724 724
 	} else {
725 725
 		/*
726 726
 		 * Since retrieve_widgets() is called when initializing a theme in the Customizer,
727 727
 		 * we need to remove the theme mods to avoid overwriting changes made via
728 728
 		 * the Customizer when accessing wp-admin/widgets.php.
729 729
 		 */
730
-		if ( 'wp_ajax_customize_save' === current_action() ) {
731
-			remove_theme_mod( 'sidebars_widgets' );
730
+		if ('wp_ajax_customize_save' === current_action()) {
731
+			remove_theme_mod('sidebars_widgets');
732 732
 		}
733 733
 
734
-		if ( ! empty( $nav_menu_locations ) ) {
735
-			$nav_mods = get_theme_mod( 'nav_menu_locations' );
736
-			if ( empty( $nav_mods ) ) {
737
-				set_theme_mod( 'nav_menu_locations', $nav_menu_locations );
734
+		if ( ! empty($nav_menu_locations)) {
735
+			$nav_mods = get_theme_mod('nav_menu_locations');
736
+			if (empty($nav_mods)) {
737
+				set_theme_mod('nav_menu_locations', $nav_menu_locations);
738 738
 			}
739 739
 		}
740 740
 	}
741 741
 
742
-	update_option( 'theme_switched', $old_theme->get_stylesheet() );
742
+	update_option('theme_switched', $old_theme->get_stylesheet());
743 743
 
744 744
 	/**
745 745
 	 * Fires after the theme is switched.
@@ -751,7 +751,7 @@  discard block
 block discarded – undo
751 751
 	 * @param WP_Theme $new_theme WP_Theme instance of the new theme.
752 752
 	 * @param WP_Theme $old_theme WP_Theme instance of the old theme.
753 753
 	 */
754
-	do_action( 'switch_theme', $new_name, $new_theme, $old_theme );
754
+	do_action('switch_theme', $new_name, $new_theme, $old_theme);
755 755
 }
756 756
 
757 757
 /**
@@ -777,23 +777,23 @@  discard block
 block discarded – undo
777 777
 	 *
778 778
 	 * @param bool $validate Whether to validate the current theme. Default true.
779 779
 	 */
780
-	if ( wp_installing() || ! apply_filters( 'validate_current_theme', true ) )
780
+	if (wp_installing() || ! apply_filters('validate_current_theme', true))
781 781
 		return true;
782 782
 
783
-	if ( ! file_exists( get_template_directory() . '/index.php' ) ) {
783
+	if ( ! file_exists(get_template_directory().'/index.php')) {
784 784
 		// Invalid.
785
-	} elseif ( ! file_exists( get_template_directory() . '/style.css' ) ) {
785
+	} elseif ( ! file_exists(get_template_directory().'/style.css')) {
786 786
 		// Invalid.
787
-	} elseif ( is_child_theme() && ! file_exists( get_stylesheet_directory() . '/style.css' ) ) {
787
+	} elseif (is_child_theme() && ! file_exists(get_stylesheet_directory().'/style.css')) {
788 788
 		// Invalid.
789 789
 	} else {
790 790
 		// Valid.
791 791
 		return true;
792 792
 	}
793 793
 
794
-	$default = wp_get_theme( WP_DEFAULT_THEME );
795
-	if ( $default->exists() ) {
796
-		switch_theme( WP_DEFAULT_THEME );
794
+	$default = wp_get_theme(WP_DEFAULT_THEME);
795
+	if ($default->exists()) {
796
+		switch_theme(WP_DEFAULT_THEME);
797 797
 		return false;
798 798
 	}
799 799
 
@@ -807,11 +807,11 @@  discard block
 block discarded – undo
807 807
 	 * if it turns out there is no default theme installed. (That's `false`.)
808 808
 	 */
809 809
 	$default = WP_Theme::get_core_default_theme();
810
-	if ( false === $default || get_stylesheet() == $default->get_stylesheet() ) {
810
+	if (false === $default || get_stylesheet() == $default->get_stylesheet()) {
811 811
 		return true;
812 812
 	}
813 813
 
814
-	switch_theme( $default->get_stylesheet() );
814
+	switch_theme($default->get_stylesheet());
815 815
 	return false;
816 816
 }
817 817
 
@@ -823,16 +823,16 @@  discard block
 block discarded – undo
823 823
  * @return array|void Theme modifications.
824 824
  */
825 825
 function get_theme_mods() {
826
-	$theme_slug = get_option( 'stylesheet' );
827
-	$mods = get_option( "theme_mods_$theme_slug" );
828
-	if ( false === $mods ) {
829
-		$theme_name = get_option( 'current_theme' );
830
-		if ( false === $theme_name )
826
+	$theme_slug = get_option('stylesheet');
827
+	$mods = get_option("theme_mods_$theme_slug");
828
+	if (false === $mods) {
829
+		$theme_name = get_option('current_theme');
830
+		if (false === $theme_name)
831 831
 			$theme_name = wp_get_theme()->get('Name');
832
-		$mods = get_option( "mods_$theme_name" ); // Deprecated location.
833
-		if ( is_admin() && false !== $mods ) {
834
-			update_option( "theme_mods_$theme_slug", $mods );
835
-			delete_option( "mods_$theme_name" );
832
+		$mods = get_option("mods_$theme_name"); // Deprecated location.
833
+		if (is_admin() && false !== $mods) {
834
+			update_option("theme_mods_$theme_slug", $mods);
835
+			delete_option("mods_$theme_name");
836 836
 		}
837 837
 	}
838 838
 	return $mods;
@@ -852,10 +852,10 @@  discard block
 block discarded – undo
852 852
  * @param bool|string $default
853 853
  * @return string
854 854
  */
855
-function get_theme_mod( $name, $default = false ) {
855
+function get_theme_mod($name, $default = false) {
856 856
 	$mods = get_theme_mods();
857 857
 
858
-	if ( isset( $mods[$name] ) ) {
858
+	if (isset($mods[$name])) {
859 859
 		/**
860 860
 		 * Filters the theme modification, or 'theme_mod', value.
861 861
 		 *
@@ -868,14 +868,14 @@  discard block
 block discarded – undo
868 868
 		 *
869 869
 		 * @param string $current_mod The value of the current theme modification.
870 870
 		 */
871
-		return apply_filters( "theme_mod_{$name}", $mods[$name] );
871
+		return apply_filters("theme_mod_{$name}", $mods[$name]);
872 872
 	}
873 873
 
874
-	if ( is_string( $default ) )
875
-		$default = sprintf( $default, get_template_directory_uri(), get_stylesheet_directory_uri() );
874
+	if (is_string($default))
875
+		$default = sprintf($default, get_template_directory_uri(), get_stylesheet_directory_uri());
876 876
 
877 877
 	/** This filter is documented in wp-includes/theme.php */
878
-	return apply_filters( "theme_mod_{$name}", $default );
878
+	return apply_filters("theme_mod_{$name}", $default);
879 879
 }
880 880
 
881 881
 /**
@@ -886,9 +886,9 @@  discard block
 block discarded – undo
886 886
  * @param string $name  Theme modification name.
887 887
  * @param mixed  $value Theme modification value.
888 888
  */
889
-function set_theme_mod( $name, $value ) {
889
+function set_theme_mod($name, $value) {
890 890
 	$mods = get_theme_mods();
891
-	$old_value = isset( $mods[ $name ] ) ? $mods[ $name ] : false;
891
+	$old_value = isset($mods[$name]) ? $mods[$name] : false;
892 892
 
893 893
 	/**
894 894
 	 * Filters the theme mod value on save.
@@ -902,10 +902,10 @@  discard block
 block discarded – undo
902 902
 	 * @param string $value     The new value of the theme mod.
903 903
 	 * @param string $old_value The current value of the theme mod.
904 904
 	 */
905
-	$mods[ $name ] = apply_filters( "pre_set_theme_mod_{$name}", $value, $old_value );
905
+	$mods[$name] = apply_filters("pre_set_theme_mod_{$name}", $value, $old_value);
906 906
 
907
-	$theme = get_option( 'stylesheet' );
908
-	update_option( "theme_mods_$theme", $mods );
907
+	$theme = get_option('stylesheet');
908
+	update_option("theme_mods_$theme", $mods);
909 909
 }
910 910
 
911 911
 /**
@@ -918,20 +918,20 @@  discard block
 block discarded – undo
918 918
  *
919 919
  * @param string $name Theme modification name.
920 920
  */
921
-function remove_theme_mod( $name ) {
921
+function remove_theme_mod($name) {
922 922
 	$mods = get_theme_mods();
923 923
 
924
-	if ( ! isset( $mods[ $name ] ) )
924
+	if ( ! isset($mods[$name]))
925 925
 		return;
926 926
 
927
-	unset( $mods[ $name ] );
927
+	unset($mods[$name]);
928 928
 
929
-	if ( empty( $mods ) ) {
929
+	if (empty($mods)) {
930 930
 		remove_theme_mods();
931 931
 		return;
932 932
 	}
933
-	$theme = get_option( 'stylesheet' );
934
-	update_option( "theme_mods_$theme", $mods );
933
+	$theme = get_option('stylesheet');
934
+	update_option("theme_mods_$theme", $mods);
935 935
 }
936 936
 
937 937
 /**
@@ -940,13 +940,13 @@  discard block
 block discarded – undo
940 940
  * @since 2.1.0
941 941
  */
942 942
 function remove_theme_mods() {
943
-	delete_option( 'theme_mods_' . get_option( 'stylesheet' ) );
943
+	delete_option('theme_mods_'.get_option('stylesheet'));
944 944
 
945 945
 	// Old style.
946
-	$theme_name = get_option( 'current_theme' );
947
-	if ( false === $theme_name )
946
+	$theme_name = get_option('current_theme');
947
+	if (false === $theme_name)
948 948
 		$theme_name = wp_get_theme()->get('Name');
949
-	delete_option( 'mods_' . $theme_name );
949
+	delete_option('mods_'.$theme_name);
950 950
 }
951 951
 
952 952
 /**
@@ -957,7 +957,7 @@  discard block
 block discarded – undo
957 957
  * @return string Header text color in HEX format (minus the hash symbol).
958 958
  */
959 959
 function get_header_textcolor() {
960
-	return get_theme_mod('header_textcolor', get_theme_support( 'custom-header', 'default-text-color' ) );
960
+	return get_theme_mod('header_textcolor', get_theme_support('custom-header', 'default-text-color'));
961 961
 }
962 962
 
963 963
 /**
@@ -977,10 +977,10 @@  discard block
 block discarded – undo
977 977
  * @return bool
978 978
  */
979 979
 function display_header_text() {
980
-	if ( ! current_theme_supports( 'custom-header', 'header-text' ) )
980
+	if ( ! current_theme_supports('custom-header', 'header-text'))
981 981
 		return false;
982 982
 
983
-	$text_color = get_theme_mod( 'header_textcolor', get_theme_support( 'custom-header', 'default-text-color' ) );
983
+	$text_color = get_theme_mod('header_textcolor', get_theme_support('custom-header', 'default-text-color'));
984 984
 	return 'blank' !== $text_color;
985 985
 }
986 986
 
@@ -1005,15 +1005,15 @@  discard block
 block discarded – undo
1005 1005
  * @return string|false
1006 1006
  */
1007 1007
 function get_header_image() {
1008
-	$url = get_theme_mod( 'header_image', get_theme_support( 'custom-header', 'default-image' ) );
1008
+	$url = get_theme_mod('header_image', get_theme_support('custom-header', 'default-image'));
1009 1009
 
1010
-	if ( 'remove-header' == $url )
1010
+	if ('remove-header' == $url)
1011 1011
 		return false;
1012 1012
 
1013
-	if ( is_random_header_image() )
1013
+	if (is_random_header_image())
1014 1014
 		$url = get_random_header_image();
1015 1015
 
1016
-	return esc_url_raw( set_url_scheme( $url ) );
1016
+	return esc_url_raw(set_url_scheme($url));
1017 1017
 }
1018 1018
 
1019 1019
 /**
@@ -1025,16 +1025,16 @@  discard block
 block discarded – undo
1025 1025
  *                              to override the default attributes. Default empty.
1026 1026
  * @return string HTML image element markup or empty string on failure.
1027 1027
  */
1028
-function get_header_image_tag( $attr = array() ) {
1028
+function get_header_image_tag($attr = array()) {
1029 1029
 	$header = get_custom_header();
1030 1030
 	$header->url = get_header_image();
1031 1031
 
1032
-	if ( ! $header->url ) {
1032
+	if ( ! $header->url) {
1033 1033
 		return '';
1034 1034
 	}
1035 1035
 
1036
-	$width = absint( $header->width );
1037
-	$height = absint( $header->height );
1036
+	$width = absint($header->width);
1037
+	$height = absint($header->height);
1038 1038
 
1039 1039
 	$attr = wp_parse_args(
1040 1040
 		$attr,
@@ -1042,31 +1042,31 @@  discard block
 block discarded – undo
1042 1042
 			'src' => $header->url,
1043 1043
 			'width' => $width,
1044 1044
 			'height' => $height,
1045
-			'alt' => get_bloginfo( 'name' ),
1045
+			'alt' => get_bloginfo('name'),
1046 1046
 		)
1047 1047
 	);
1048 1048
 
1049 1049
 	// Generate 'srcset' and 'sizes' if not already present.
1050
-	if ( empty( $attr['srcset'] ) && ! empty( $header->attachment_id ) ) {
1051
-		$image_meta = get_post_meta( $header->attachment_id, '_wp_attachment_metadata', true );
1052
-		$size_array = array( $width, $height );
1050
+	if (empty($attr['srcset']) && ! empty($header->attachment_id)) {
1051
+		$image_meta = get_post_meta($header->attachment_id, '_wp_attachment_metadata', true);
1052
+		$size_array = array($width, $height);
1053 1053
 
1054
-		if ( is_array( $image_meta ) ) {
1055
-			$srcset = wp_calculate_image_srcset( $size_array, $header->url, $image_meta, $header->attachment_id );
1056
-			$sizes = ! empty( $attr['sizes'] ) ? $attr['sizes'] : wp_calculate_image_sizes( $size_array, $header->url, $image_meta, $header->attachment_id );
1054
+		if (is_array($image_meta)) {
1055
+			$srcset = wp_calculate_image_srcset($size_array, $header->url, $image_meta, $header->attachment_id);
1056
+			$sizes = ! empty($attr['sizes']) ? $attr['sizes'] : wp_calculate_image_sizes($size_array, $header->url, $image_meta, $header->attachment_id);
1057 1057
 
1058
-			if ( $srcset && $sizes ) {
1058
+			if ($srcset && $sizes) {
1059 1059
 				$attr['srcset'] = $srcset;
1060 1060
 				$attr['sizes'] = $sizes;
1061 1061
 			}
1062 1062
 		}
1063 1063
 	}
1064 1064
 
1065
-	$attr = array_map( 'esc_attr', $attr );
1065
+	$attr = array_map('esc_attr', $attr);
1066 1066
 	$html = '<img';
1067 1067
 
1068
-	foreach ( $attr as $name => $value ) {
1069
-		$html .= ' ' . $name . '="' . $value . '"';
1068
+	foreach ($attr as $name => $value) {
1069
+		$html .= ' '.$name.'="'.$value.'"';
1070 1070
 	}
1071 1071
 
1072 1072
 	$html .= ' />';
@@ -1080,7 +1080,7 @@  discard block
 block discarded – undo
1080 1080
 	 * @param object $header The custom header object returned by 'get_custom_header()'.
1081 1081
 	 * @param array  $attr   Array of the attributes for the image tag.
1082 1082
 	 */
1083
-	return apply_filters( 'get_header_image_tag', $html, $header, $attr );
1083
+	return apply_filters('get_header_image_tag', $html, $header, $attr);
1084 1084
 }
1085 1085
 
1086 1086
 /**
@@ -1090,8 +1090,8 @@  discard block
 block discarded – undo
1090 1090
  *
1091 1091
  * @param array $attr Optional. Attributes for the image markup. Default empty.
1092 1092
  */
1093
-function the_header_image_tag( $attr = array() ) {
1094
-	echo get_header_image_tag( $attr );
1093
+function the_header_image_tag($attr = array()) {
1094
+	echo get_header_image_tag($attr);
1095 1095
 }
1096 1096
 
1097 1097
 /**
@@ -1109,29 +1109,29 @@  discard block
 block discarded – undo
1109 1109
 function _get_random_header_data() {
1110 1110
 	static $_wp_random_header = null;
1111 1111
 
1112
-	if ( empty( $_wp_random_header ) ) {
1112
+	if (empty($_wp_random_header)) {
1113 1113
 		global $_wp_default_headers;
1114
-		$header_image_mod = get_theme_mod( 'header_image', '' );
1114
+		$header_image_mod = get_theme_mod('header_image', '');
1115 1115
 		$headers = array();
1116 1116
 
1117
-		if ( 'random-uploaded-image' == $header_image_mod )
1117
+		if ('random-uploaded-image' == $header_image_mod)
1118 1118
 			$headers = get_uploaded_header_images();
1119
-		elseif ( ! empty( $_wp_default_headers ) ) {
1120
-			if ( 'random-default-image' == $header_image_mod ) {
1119
+		elseif ( ! empty($_wp_default_headers)) {
1120
+			if ('random-default-image' == $header_image_mod) {
1121 1121
 				$headers = $_wp_default_headers;
1122 1122
 			} else {
1123
-				if ( current_theme_supports( 'custom-header', 'random-default' ) )
1123
+				if (current_theme_supports('custom-header', 'random-default'))
1124 1124
 					$headers = $_wp_default_headers;
1125 1125
 			}
1126 1126
 		}
1127 1127
 
1128
-		if ( empty( $headers ) )
1128
+		if (empty($headers))
1129 1129
 			return new stdClass;
1130 1130
 
1131
-		$_wp_random_header = (object) $headers[ array_rand( $headers ) ];
1131
+		$_wp_random_header = (object) $headers[array_rand($headers)];
1132 1132
 
1133
-		$_wp_random_header->url =  sprintf( $_wp_random_header->url, get_template_directory_uri(), get_stylesheet_directory_uri() );
1134
-		$_wp_random_header->thumbnail_url =  sprintf( $_wp_random_header->thumbnail_url, get_template_directory_uri(), get_stylesheet_directory_uri() );
1133
+		$_wp_random_header->url = sprintf($_wp_random_header->url, get_template_directory_uri(), get_stylesheet_directory_uri());
1134
+		$_wp_random_header->thumbnail_url = sprintf($_wp_random_header->thumbnail_url, get_template_directory_uri(), get_stylesheet_directory_uri());
1135 1135
 	}
1136 1136
 	return $_wp_random_header;
1137 1137
 }
@@ -1145,7 +1145,7 @@  discard block
 block discarded – undo
1145 1145
  */
1146 1146
 function get_random_header_image() {
1147 1147
 	$random_image = _get_random_header_data();
1148
-	if ( empty( $random_image->url ) )
1148
+	if (empty($random_image->url))
1149 1149
 		return '';
1150 1150
 	return $random_image->url;
1151 1151
 }
@@ -1162,16 +1162,16 @@  discard block
 block discarded – undo
1162 1162
  * @param string $type The random pool to use. any|default|uploaded
1163 1163
  * @return bool
1164 1164
  */
1165
-function is_random_header_image( $type = 'any' ) {
1166
-	$header_image_mod = get_theme_mod( 'header_image', get_theme_support( 'custom-header', 'default-image' ) );
1165
+function is_random_header_image($type = 'any') {
1166
+	$header_image_mod = get_theme_mod('header_image', get_theme_support('custom-header', 'default-image'));
1167 1167
 
1168
-	if ( 'any' == $type ) {
1169
-		if ( 'random-default-image' == $header_image_mod || 'random-uploaded-image' == $header_image_mod || ( '' != get_random_header_image() && empty( $header_image_mod ) ) )
1168
+	if ('any' == $type) {
1169
+		if ('random-default-image' == $header_image_mod || 'random-uploaded-image' == $header_image_mod || ('' != get_random_header_image() && empty($header_image_mod)))
1170 1170
 			return true;
1171 1171
 	} else {
1172
-		if ( "random-$type-image" == $header_image_mod )
1172
+		if ("random-$type-image" == $header_image_mod)
1173 1173
 			return true;
1174
-		elseif ( 'default' == $type && empty( $header_image_mod ) && '' != get_random_header_image() )
1174
+		elseif ('default' == $type && empty($header_image_mod) && '' != get_random_header_image())
1175 1175
 			return true;
1176 1176
 	}
1177 1177
 
@@ -1185,8 +1185,8 @@  discard block
 block discarded – undo
1185 1185
  */
1186 1186
 function header_image() {
1187 1187
 	$image = get_header_image();
1188
-	if ( $image ) {
1189
-		echo esc_url( $image );
1188
+	if ($image) {
1189
+		echo esc_url($image);
1190 1190
 	}
1191 1191
 }
1192 1192
 
@@ -1201,25 +1201,25 @@  discard block
 block discarded – undo
1201 1201
 	$header_images = array();
1202 1202
 
1203 1203
 	// @todo caching
1204
-	$headers = get_posts( array( 'post_type' => 'attachment', 'meta_key' => '_wp_attachment_is_custom_header', 'meta_value' => get_option('stylesheet'), 'orderby' => 'none', 'nopaging' => true ) );
1204
+	$headers = get_posts(array('post_type' => 'attachment', 'meta_key' => '_wp_attachment_is_custom_header', 'meta_value' => get_option('stylesheet'), 'orderby' => 'none', 'nopaging' => true));
1205 1205
 
1206
-	if ( empty( $headers ) )
1206
+	if (empty($headers))
1207 1207
 		return array();
1208 1208
 
1209
-	foreach ( (array) $headers as $header ) {
1210
-		$url = esc_url_raw( wp_get_attachment_url( $header->ID ) );
1211
-		$header_data = wp_get_attachment_metadata( $header->ID );
1209
+	foreach ((array) $headers as $header) {
1210
+		$url = esc_url_raw(wp_get_attachment_url($header->ID));
1211
+		$header_data = wp_get_attachment_metadata($header->ID);
1212 1212
 		$header_index = $header->ID;
1213 1213
 
1214 1214
 		$header_images[$header_index] = array();
1215 1215
 		$header_images[$header_index]['attachment_id'] = $header->ID;
1216
-		$header_images[$header_index]['url'] =  $url;
1216
+		$header_images[$header_index]['url'] = $url;
1217 1217
 		$header_images[$header_index]['thumbnail_url'] = $url;
1218
-		$header_images[$header_index]['alt_text'] = get_post_meta( $header->ID, '_wp_attachment_image_alt', true );
1218
+		$header_images[$header_index]['alt_text'] = get_post_meta($header->ID, '_wp_attachment_image_alt', true);
1219 1219
 
1220
-		if ( isset( $header_data['width'] ) )
1220
+		if (isset($header_data['width']))
1221 1221
 			$header_images[$header_index]['width'] = $header_data['width'];
1222
-		if ( isset( $header_data['height'] ) )
1222
+		if (isset($header_data['height']))
1223 1223
 			$header_images[$header_index]['height'] = $header_data['height'];
1224 1224
 	}
1225 1225
 
@@ -1238,21 +1238,21 @@  discard block
 block discarded – undo
1238 1238
 function get_custom_header() {
1239 1239
 	global $_wp_default_headers;
1240 1240
 
1241
-	if ( is_random_header_image() ) {
1241
+	if (is_random_header_image()) {
1242 1242
 		$data = _get_random_header_data();
1243 1243
 	} else {
1244
-		$data = get_theme_mod( 'header_image_data' );
1245
-		if ( ! $data && current_theme_supports( 'custom-header', 'default-image' ) ) {
1246
-			$directory_args = array( get_template_directory_uri(), get_stylesheet_directory_uri() );
1244
+		$data = get_theme_mod('header_image_data');
1245
+		if ( ! $data && current_theme_supports('custom-header', 'default-image')) {
1246
+			$directory_args = array(get_template_directory_uri(), get_stylesheet_directory_uri());
1247 1247
 			$data = array();
1248
-			$data['url'] = $data['thumbnail_url'] = vsprintf( get_theme_support( 'custom-header', 'default-image' ), $directory_args );
1249
-			if ( ! empty( $_wp_default_headers ) ) {
1250
-				foreach ( (array) $_wp_default_headers as $default_header ) {
1251
-					$url = vsprintf( $default_header['url'], $directory_args );
1252
-					if ( $data['url'] == $url ) {
1248
+			$data['url'] = $data['thumbnail_url'] = vsprintf(get_theme_support('custom-header', 'default-image'), $directory_args);
1249
+			if ( ! empty($_wp_default_headers)) {
1250
+				foreach ((array) $_wp_default_headers as $default_header) {
1251
+					$url = vsprintf($default_header['url'], $directory_args);
1252
+					if ($data['url'] == $url) {
1253 1253
 						$data = $default_header;
1254 1254
 						$data['url'] = $url;
1255
-						$data['thumbnail_url'] = vsprintf( $data['thumbnail_url'], $directory_args );
1255
+						$data['thumbnail_url'] = vsprintf($data['thumbnail_url'], $directory_args);
1256 1256
 						break;
1257 1257
 					}
1258 1258
 				}
@@ -1263,11 +1263,11 @@  discard block
 block discarded – undo
1263 1263
 	$default = array(
1264 1264
 		'url'           => '',
1265 1265
 		'thumbnail_url' => '',
1266
-		'width'         => get_theme_support( 'custom-header', 'width' ),
1267
-		'height'        => get_theme_support( 'custom-header', 'height' ),
1268
-		'video'         => get_theme_support( 'custom-header', 'video' ),
1266
+		'width'         => get_theme_support('custom-header', 'width'),
1267
+		'height'        => get_theme_support('custom-header', 'height'),
1268
+		'video'         => get_theme_support('custom-header', 'video'),
1269 1269
 	);
1270
-	return (object) wp_parse_args( $data, $default );
1270
+	return (object) wp_parse_args($data, $default);
1271 1271
 }
1272 1272
 
1273 1273
 /**
@@ -1279,10 +1279,10 @@  discard block
 block discarded – undo
1279 1279
  *
1280 1280
  * @param array $headers Array of headers keyed by a string id. The ids point to arrays containing 'url', 'thumbnail_url', and 'description' keys.
1281 1281
  */
1282
-function register_default_headers( $headers ) {
1282
+function register_default_headers($headers) {
1283 1283
 	global $_wp_default_headers;
1284 1284
 
1285
-	$_wp_default_headers = array_merge( (array) $_wp_default_headers, (array) $headers );
1285
+	$_wp_default_headers = array_merge((array) $_wp_default_headers, (array) $headers);
1286 1286
 }
1287 1287
 
1288 1288
 /**
@@ -1300,12 +1300,12 @@  discard block
 block discarded – undo
1300 1300
  * @return bool|void A single header returns true on success, false on failure.
1301 1301
  *                   There is currently no return value for multiple headers.
1302 1302
  */
1303
-function unregister_default_headers( $header ) {
1303
+function unregister_default_headers($header) {
1304 1304
 	global $_wp_default_headers;
1305
-	if ( is_array( $header ) ) {
1306
-		array_map( 'unregister_default_headers', $header );
1307
-	} elseif ( isset( $_wp_default_headers[ $header ] ) ) {
1308
-		unset( $_wp_default_headers[ $header ] );
1305
+	if (is_array($header)) {
1306
+		array_map('unregister_default_headers', $header);
1307
+	} elseif (isset($_wp_default_headers[$header])) {
1308
+		unset($_wp_default_headers[$header]);
1309 1309
 		return true;
1310 1310
 	} else {
1311 1311
 		return false;
@@ -1335,19 +1335,19 @@  discard block
 block discarded – undo
1335 1335
  * @return string|false Header video URL or false if there is no video.
1336 1336
  */
1337 1337
 function get_header_video_url() {
1338
-	$id = absint( get_theme_mod( 'header_video' ) );
1339
-	$url = esc_url( get_theme_mod( 'external_header_video' ) );
1338
+	$id = absint(get_theme_mod('header_video'));
1339
+	$url = esc_url(get_theme_mod('external_header_video'));
1340 1340
 
1341
-	if ( ! $id && ! $url ) {
1341
+	if ( ! $id && ! $url) {
1342 1342
 		return false;
1343 1343
 	}
1344 1344
 
1345
-	if ( $id ) {
1345
+	if ($id) {
1346 1346
 		// Get the file URL from the attachment ID.
1347
-		$url = wp_get_attachment_url( $id );
1347
+		$url = wp_get_attachment_url($id);
1348 1348
 	}
1349 1349
 
1350
-	return esc_url_raw( set_url_scheme( $url ) );
1350
+	return esc_url_raw(set_url_scheme($url));
1351 1351
 }
1352 1352
 
1353 1353
 /**
@@ -1357,8 +1357,8 @@  discard block
 block discarded – undo
1357 1357
  */
1358 1358
 function the_header_video_url() {
1359 1359
 	$video = get_header_video_url();
1360
-	if ( $video ) {
1361
-		echo esc_url( $video );
1360
+	if ($video) {
1361
+		echo esc_url($video);
1362 1362
 	}
1363 1363
 }
1364 1364
 
@@ -1372,31 +1372,31 @@  discard block
 block discarded – undo
1372 1372
 function get_header_video_settings() {
1373 1373
 	$header     = get_custom_header();
1374 1374
 	$video_url  = get_header_video_url();
1375
-	$video_type = wp_check_filetype( $video_url, wp_get_mime_types() );
1375
+	$video_type = wp_check_filetype($video_url, wp_get_mime_types());
1376 1376
 
1377 1377
 	$settings = array(
1378 1378
 		'mimeType'  => '',
1379 1379
 		'posterUrl' => get_header_image(),
1380 1380
 		'videoUrl'  => $video_url,
1381
-		'width'     => absint( $header->width ),
1382
-		'height'    => absint( $header->height ),
1381
+		'width'     => absint($header->width),
1382
+		'height'    => absint($header->height),
1383 1383
 		'minWidth'  => 900,
1384 1384
 		'minHeight' => 500,
1385 1385
 		'l10n'      => array(
1386
-			'pause'      => __( 'Pause' ),
1387
-			'play'       => __( 'Play' ),
1388
-			'pauseSpeak' => __( 'Video is paused.'),
1389
-			'playSpeak'  => __( 'Video is playing.'),
1386
+			'pause'      => __('Pause'),
1387
+			'play'       => __('Play'),
1388
+			'pauseSpeak' => __('Video is paused.'),
1389
+			'playSpeak'  => __('Video is playing.'),
1390 1390
 		),
1391 1391
 	);
1392 1392
 
1393
-	if ( preg_match( '#^https?://(?:www\.)?(?:youtube\.com/watch|youtu\.be/)#', $video_url ) ) {
1393
+	if (preg_match('#^https?://(?:www\.)?(?:youtube\.com/watch|youtu\.be/)#', $video_url)) {
1394 1394
 		$settings['mimeType'] = 'video/x-youtube';
1395
-	} elseif ( ! empty( $video_type['type'] ) ) {
1395
+	} elseif ( ! empty($video_type['type'])) {
1396 1396
 		$settings['mimeType'] = $video_type['type'];
1397 1397
 	}
1398 1398
 
1399
-	return apply_filters( 'header_video_settings', $settings );
1399
+	return apply_filters('header_video_settings', $settings);
1400 1400
 }
1401 1401
 
1402 1402
 /**
@@ -1407,7 +1407,7 @@  discard block
 block discarded – undo
1407 1407
  * @return bool True if a custom header is set. False if not.
1408 1408
  */
1409 1409
 function has_custom_header() {
1410
-	if ( has_header_image() || ( has_header_video() && is_header_video_active() ) ) {
1410
+	if (has_header_image() || (has_header_video() && is_header_video_active())) {
1411 1411
 		return true;
1412 1412
 	}
1413 1413
 
@@ -1422,16 +1422,16 @@  discard block
 block discarded – undo
1422 1422
  * @return bool True if the custom header video should be shown. False if not.
1423 1423
  */
1424 1424
 function is_header_video_active() {
1425
-	if ( ! get_theme_support( 'custom-header', 'video' ) ) {
1425
+	if ( ! get_theme_support('custom-header', 'video')) {
1426 1426
 		return false;
1427 1427
 	}
1428 1428
 
1429
-	$video_active_cb = get_theme_support( 'custom-header', 'video-active-callback' );
1429
+	$video_active_cb = get_theme_support('custom-header', 'video-active-callback');
1430 1430
 
1431
-	if ( empty( $video_active_cb ) || ! is_callable( $video_active_cb ) ) {
1431
+	if (empty($video_active_cb) || ! is_callable($video_active_cb)) {
1432 1432
 		$show_video = true;
1433 1433
 	} else {
1434
-		$show_video = call_user_func( $video_active_cb );
1434
+		$show_video = call_user_func($video_active_cb);
1435 1435
 	}
1436 1436
 
1437 1437
 	/**
@@ -1443,7 +1443,7 @@  discard block
 block discarded – undo
1443 1443
 	 *                         of the theme setting for the `custom-header`'s `video-active-callback`.
1444 1444
 	 *                         If no callback is set, the default value is that of `is_front_page()`.
1445 1445
 	 */
1446
-	return apply_filters( 'is_header_video_active', $show_video );
1446
+	return apply_filters('is_header_video_active', $show_video);
1447 1447
 }
1448 1448
 
1449 1449
 /**
@@ -1456,7 +1456,7 @@  discard block
 block discarded – undo
1456 1456
  * @return string The markup for a custom header on success.
1457 1457
  */
1458 1458
 function get_custom_header_markup() {
1459
-	if ( ! has_custom_header() && ! is_customize_preview() ) {
1459
+	if ( ! has_custom_header() && ! is_customize_preview()) {
1460 1460
 		return '';
1461 1461
 	}
1462 1462
 
@@ -1475,15 +1475,15 @@  discard block
 block discarded – undo
1475 1475
  */
1476 1476
 function the_custom_header_markup() {
1477 1477
 	$custom_header = get_custom_header_markup();
1478
-	if ( empty( $custom_header ) ) {
1478
+	if (empty($custom_header)) {
1479 1479
 		return;
1480 1480
 	}
1481 1481
 
1482 1482
 	echo $custom_header;
1483 1483
 
1484
-	if ( is_header_video_active() && ( has_header_video() || is_customize_preview() ) ) {
1485
-		wp_enqueue_script( 'wp-custom-header' );
1486
-		wp_localize_script( 'wp-custom-header', '_wpCustomHeaderSettings', get_header_video_settings() );
1484
+	if (is_header_video_active() && (has_header_video() || is_customize_preview())) {
1485
+		wp_enqueue_script('wp-custom-header');
1486
+		wp_localize_script('wp-custom-header', '_wpCustomHeaderSettings', get_header_video_settings());
1487 1487
 	}
1488 1488
 }
1489 1489
 
@@ -1495,7 +1495,7 @@  discard block
 block discarded – undo
1495 1495
  * @return string
1496 1496
  */
1497 1497
 function get_background_image() {
1498
-	return get_theme_mod('background_image', get_theme_support( 'custom-background', 'default-image' ) );
1498
+	return get_theme_mod('background_image', get_theme_support('custom-background', 'default-image'));
1499 1499
 }
1500 1500
 
1501 1501
 /**
@@ -1515,7 +1515,7 @@  discard block
 block discarded – undo
1515 1515
  * @return string
1516 1516
  */
1517 1517
 function get_background_color() {
1518
-	return get_theme_mod('background_color', get_theme_support( 'custom-background', 'default-color' ) );
1518
+	return get_theme_mod('background_color', get_theme_support('custom-background', 'default-color'));
1519 1519
 }
1520 1520
 
1521 1521
 /**
@@ -1535,18 +1535,18 @@  discard block
 block discarded – undo
1535 1535
  */
1536 1536
 function _custom_background_cb() {
1537 1537
 	// $background is the saved custom image, or the default image.
1538
-	$background = set_url_scheme( get_background_image() );
1538
+	$background = set_url_scheme(get_background_image());
1539 1539
 
1540 1540
 	// $color is the saved custom color.
1541 1541
 	// A default has to be specified in style.css. It will not be printed here.
1542 1542
 	$color = get_background_color();
1543 1543
 
1544
-	if ( $color === get_theme_support( 'custom-background', 'default-color' ) ) {
1544
+	if ($color === get_theme_support('custom-background', 'default-color')) {
1545 1545
 		$color = false;
1546 1546
 	}
1547 1547
 
1548
-	if ( ! $background && ! $color ) {
1549
-		if ( is_customize_preview() ) {
1548
+	if ( ! $background && ! $color) {
1549
+		if (is_customize_preview()) {
1550 1550
 			echo '<style type="text/css" id="custom-background-css"></style>';
1551 1551
 		}
1552 1552
 		return;
@@ -1554,55 +1554,55 @@  discard block
 block discarded – undo
1554 1554
 
1555 1555
 	$style = $color ? "background-color: #$color;" : '';
1556 1556
 
1557
-	if ( $background ) {
1558
-		$image = ' background-image: url("' . esc_url_raw( $background ) . '");';
1557
+	if ($background) {
1558
+		$image = ' background-image: url("'.esc_url_raw($background).'");';
1559 1559
 
1560 1560
 		// Background Position.
1561
-		$position_x = get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) );
1562
-		$position_y = get_theme_mod( 'background_position_y', get_theme_support( 'custom-background', 'default-position-y' ) );
1561
+		$position_x = get_theme_mod('background_position_x', get_theme_support('custom-background', 'default-position-x'));
1562
+		$position_y = get_theme_mod('background_position_y', get_theme_support('custom-background', 'default-position-y'));
1563 1563
 
1564
-		if ( ! in_array( $position_x, array( 'left', 'center', 'right' ), true ) ) {
1564
+		if ( ! in_array($position_x, array('left', 'center', 'right'), true)) {
1565 1565
 			$position_x = 'left';
1566 1566
 		}
1567 1567
 
1568
-		if ( ! in_array( $position_y, array( 'top', 'center', 'bottom' ), true ) ) {
1568
+		if ( ! in_array($position_y, array('top', 'center', 'bottom'), true)) {
1569 1569
 			$position_y = 'top';
1570 1570
 		}
1571 1571
 
1572 1572
 		$position = " background-position: $position_x $position_y;";
1573 1573
 
1574 1574
 		// Background Size.
1575
-		$size = get_theme_mod( 'background_size', get_theme_support( 'custom-background', 'default-size' ) );
1575
+		$size = get_theme_mod('background_size', get_theme_support('custom-background', 'default-size'));
1576 1576
 
1577
-		if ( ! in_array( $size, array( 'auto', 'contain', 'cover' ), true ) ) {
1577
+		if ( ! in_array($size, array('auto', 'contain', 'cover'), true)) {
1578 1578
 			$size = 'auto';
1579 1579
 		}
1580 1580
 
1581 1581
 		$size = " background-size: $size;";
1582 1582
 
1583 1583
 		// Background Repeat.
1584
-		$repeat = get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) );
1584
+		$repeat = get_theme_mod('background_repeat', get_theme_support('custom-background', 'default-repeat'));
1585 1585
 
1586
-		if ( ! in_array( $repeat, array( 'repeat-x', 'repeat-y', 'repeat', 'no-repeat' ), true ) ) {
1586
+		if ( ! in_array($repeat, array('repeat-x', 'repeat-y', 'repeat', 'no-repeat'), true)) {
1587 1587
 			$repeat = 'repeat';
1588 1588
 		}
1589 1589
 
1590 1590
 		$repeat = " background-repeat: $repeat;";
1591 1591
 
1592 1592
 		// Background Scroll.
1593
-		$attachment = get_theme_mod( 'background_attachment', get_theme_support( 'custom-background', 'default-attachment' ) );
1593
+		$attachment = get_theme_mod('background_attachment', get_theme_support('custom-background', 'default-attachment'));
1594 1594
 
1595
-		if ( 'fixed' !== $attachment ) {
1595
+		if ('fixed' !== $attachment) {
1596 1596
 			$attachment = 'scroll';
1597 1597
 		}
1598 1598
 
1599 1599
 		$attachment = " background-attachment: $attachment;";
1600 1600
 
1601
-		$style .= $image . $position . $size . $repeat . $attachment;
1601
+		$style .= $image.$position.$size.$repeat.$attachment;
1602 1602
 	}
1603 1603
 ?>
1604 1604
 <style type="text/css" id="custom-background-css">
1605
-body.custom-background { <?php echo trim( $style ); ?> }
1605
+body.custom-background { <?php echo trim($style); ?> }
1606 1606
 </style>
1607 1607
 <?php
1608 1608
 }
@@ -1615,9 +1615,9 @@  discard block
 block discarded – undo
1615 1615
  */
1616 1616
 function wp_custom_css_cb() {
1617 1617
 	$styles = wp_get_custom_css();
1618
-	if ( $styles || is_customize_preview() ) : ?>
1618
+	if ($styles || is_customize_preview()) : ?>
1619 1619
 		<style type="text/css" id="wp-custom-css">
1620
-			<?php echo strip_tags( $styles ); // Note that esc_html() cannot be used because `div &gt; span` is not interpreted properly. ?>
1620
+			<?php echo strip_tags($styles); // Note that esc_html() cannot be used because `div &gt; span` is not interpreted properly. ?>
1621 1621
 		</style>
1622 1622
 	<?php endif;
1623 1623
 }
@@ -1631,15 +1631,15 @@  discard block
 block discarded – undo
1631 1631
  * @param string $stylesheet Optional. A theme object stylesheet name. Defaults to the current theme.
1632 1632
  * @return WP_Post|null The custom_css post or null if none exists.
1633 1633
  */
1634
-function wp_get_custom_css_post( $stylesheet = '' ) {
1635
-	if ( empty( $stylesheet ) ) {
1634
+function wp_get_custom_css_post($stylesheet = '') {
1635
+	if (empty($stylesheet)) {
1636 1636
 		$stylesheet = get_stylesheet();
1637 1637
 	}
1638 1638
 
1639 1639
 	$custom_css_query_vars = array(
1640 1640
 		'post_type'              => 'custom_css',
1641 1641
 		'post_status'            => get_post_stati(),
1642
-		'name'                   => sanitize_title( $stylesheet ),
1642
+		'name'                   => sanitize_title($stylesheet),
1643 1643
 		'posts_per_page'         => 1,
1644 1644
 		'no_found_rows'          => true,
1645 1645
 		'cache_results'          => true,
@@ -1649,25 +1649,25 @@  discard block
 block discarded – undo
1649 1649
 	);
1650 1650
 
1651 1651
 	$post = null;
1652
-	if ( get_stylesheet() === $stylesheet ) {
1653
-		$post_id = get_theme_mod( 'custom_css_post_id' );
1652
+	if (get_stylesheet() === $stylesheet) {
1653
+		$post_id = get_theme_mod('custom_css_post_id');
1654 1654
 
1655
-		if ( $post_id > 0 && get_post( $post_id ) ) {
1656
-			$post = get_post( $post_id );
1655
+		if ($post_id > 0 && get_post($post_id)) {
1656
+			$post = get_post($post_id);
1657 1657
 		}
1658 1658
 
1659 1659
 		// `-1` indicates no post exists; no query necessary.
1660
-		if ( ! $post && -1 !== $post_id ) {
1661
-			$query = new WP_Query( $custom_css_query_vars );
1660
+		if ( ! $post && -1 !== $post_id) {
1661
+			$query = new WP_Query($custom_css_query_vars);
1662 1662
 			$post = $query->post;
1663 1663
 			/*
1664 1664
 			 * Cache the lookup. See wp_update_custom_css_post().
1665 1665
 			 * @todo This should get cleared if a custom_css post is added/removed.
1666 1666
 			 */
1667
-			set_theme_mod( 'custom_css_post_id', $post ? $post->ID : -1 );
1667
+			set_theme_mod('custom_css_post_id', $post ? $post->ID : -1);
1668 1668
 		}
1669 1669
 	} else {
1670
-		$query = new WP_Query( $custom_css_query_vars );
1670
+		$query = new WP_Query($custom_css_query_vars);
1671 1671
 		$post = $query->post;
1672 1672
 	}
1673 1673
 
@@ -1683,15 +1683,15 @@  discard block
 block discarded – undo
1683 1683
  * @param string $stylesheet Optional. A theme object stylesheet name. Defaults to the current theme.
1684 1684
  * @return string The Custom CSS Post content.
1685 1685
  */
1686
-function wp_get_custom_css( $stylesheet = '' ) {
1686
+function wp_get_custom_css($stylesheet = '') {
1687 1687
 	$css = '';
1688 1688
 
1689
-	if ( empty( $stylesheet ) ) {
1689
+	if (empty($stylesheet)) {
1690 1690
 		$stylesheet = get_stylesheet();
1691 1691
 	}
1692 1692
 
1693
-	$post = wp_get_custom_css_post( $stylesheet );
1694
-	if ( $post ) {
1693
+	$post = wp_get_custom_css_post($stylesheet);
1694
+	if ($post) {
1695 1695
 		$css = $post->post_content;
1696 1696
 	}
1697 1697
 
@@ -1703,7 +1703,7 @@  discard block
 block discarded – undo
1703 1703
 	 * @param string $css        CSS pulled in from the Custom CSS CPT.
1704 1704
 	 * @param string $stylesheet The theme stylesheet name.
1705 1705
 	 */
1706
-	$css = apply_filters( 'wp_get_custom_css', $css, $stylesheet );
1706
+	$css = apply_filters('wp_get_custom_css', $css, $stylesheet);
1707 1707
 
1708 1708
 	return $css;
1709 1709
 }
@@ -1725,11 +1725,11 @@  discard block
 block discarded – undo
1725 1725
  * }
1726 1726
  * @return WP_Post|WP_Error Post on success, error on failure.
1727 1727
  */
1728
-function wp_update_custom_css_post( $css, $args = array() ) {
1729
-	$args = wp_parse_args( $args, array(
1728
+function wp_update_custom_css_post($css, $args = array()) {
1729
+	$args = wp_parse_args($args, array(
1730 1730
 		'preprocessed' => '',
1731 1731
 		'stylesheet' => get_stylesheet(),
1732
-	) );
1732
+	));
1733 1733
 
1734 1734
 	$data = array(
1735 1735
 		'css' => $css,
@@ -1769,11 +1769,11 @@  discard block
 block discarded – undo
1769 1769
 	 *     @type string $stylesheet   The stylesheet (theme) being updated.
1770 1770
 	 * }
1771 1771
 	 */
1772
-	$data = apply_filters( 'update_custom_css_data', $data, array_merge( $args, compact( 'css' ) ) );
1772
+	$data = apply_filters('update_custom_css_data', $data, array_merge($args, compact('css')));
1773 1773
 
1774 1774
 	$post_data = array(
1775 1775
 		'post_title' => $args['stylesheet'],
1776
-		'post_name' => sanitize_title( $args['stylesheet'] ),
1776
+		'post_name' => sanitize_title($args['stylesheet']),
1777 1777
 		'post_type' => 'custom_css',
1778 1778
 		'post_status' => 'publish',
1779 1779
 		'post_content' => $data['css'],
@@ -1781,29 +1781,29 @@  discard block
 block discarded – undo
1781 1781
 	);
1782 1782
 
1783 1783
 	// Update post if it already exists, otherwise create a new one.
1784
-	$post = wp_get_custom_css_post( $args['stylesheet'] );
1785
-	if ( $post ) {
1784
+	$post = wp_get_custom_css_post($args['stylesheet']);
1785
+	if ($post) {
1786 1786
 		$post_data['ID'] = $post->ID;
1787
-		$r = wp_update_post( wp_slash( $post_data ), true );
1787
+		$r = wp_update_post(wp_slash($post_data), true);
1788 1788
 	} else {
1789
-		$r = wp_insert_post( wp_slash( $post_data ), true );
1789
+		$r = wp_insert_post(wp_slash($post_data), true);
1790 1790
 
1791
-		if ( ! is_wp_error( $r ) ) {
1792
-			if ( get_stylesheet() === $args['stylesheet'] ) {
1793
-				set_theme_mod( 'custom_css_post_id', $r );
1791
+		if ( ! is_wp_error($r)) {
1792
+			if (get_stylesheet() === $args['stylesheet']) {
1793
+				set_theme_mod('custom_css_post_id', $r);
1794 1794
 			}
1795 1795
 
1796 1796
 			// Trigger creation of a revision. This should be removed once #30854 is resolved.
1797
-			if ( 0 === count( wp_get_post_revisions( $r ) ) ) {
1798
-				wp_save_post_revision( $r );
1797
+			if (0 === count(wp_get_post_revisions($r))) {
1798
+				wp_save_post_revision($r);
1799 1799
 			}
1800 1800
 		}
1801 1801
 	}
1802 1802
 
1803
-	if ( is_wp_error( $r ) ) {
1803
+	if (is_wp_error($r)) {
1804 1804
 		return $r;
1805 1805
 	}
1806
-	return get_post( $r );
1806
+	return get_post($r);
1807 1807
 }
1808 1808
 
1809 1809
 /**
@@ -1828,21 +1828,21 @@  discard block
 block discarded – undo
1828 1828
  * @param array|string $stylesheet Optional. Stylesheet name or array thereof, relative to theme root.
1829 1829
  * 	                               Defaults to 'editor-style.css'
1830 1830
  */
1831
-function add_editor_style( $stylesheet = 'editor-style.css' ) {
1832
-	add_theme_support( 'editor-style' );
1831
+function add_editor_style($stylesheet = 'editor-style.css') {
1832
+	add_theme_support('editor-style');
1833 1833
 
1834
-	if ( ! is_admin() )
1834
+	if ( ! is_admin())
1835 1835
 		return;
1836 1836
 
1837 1837
 	global $editor_styles;
1838 1838
 	$editor_styles = (array) $editor_styles;
1839 1839
 	$stylesheet    = (array) $stylesheet;
1840
-	if ( is_rtl() ) {
1840
+	if (is_rtl()) {
1841 1841
 		$rtl_stylesheet = str_replace('.css', '-rtl.css', $stylesheet[0]);
1842 1842
 		$stylesheet[] = $rtl_stylesheet;
1843 1843
 	}
1844 1844
 
1845
-	$editor_styles = array_merge( $editor_styles, $stylesheet );
1845
+	$editor_styles = array_merge($editor_styles, $stylesheet);
1846 1846
 }
1847 1847
 
1848 1848
 /**
@@ -1855,10 +1855,10 @@  discard block
 block discarded – undo
1855 1855
  * @return bool True on success, false if there were no stylesheets to remove.
1856 1856
  */
1857 1857
 function remove_editor_styles() {
1858
-	if ( ! current_theme_supports( 'editor-style' ) )
1858
+	if ( ! current_theme_supports('editor-style'))
1859 1859
 		return false;
1860
-	_remove_theme_support( 'editor-style' );
1861
-	if ( is_admin() )
1860
+	_remove_theme_support('editor-style');
1861
+	if (is_admin())
1862 1862
 		$GLOBALS['editor_styles'] = array();
1863 1863
 	return true;
1864 1864
 }
@@ -1875,35 +1875,35 @@  discard block
 block discarded – undo
1875 1875
 function get_editor_stylesheets() {
1876 1876
 	$stylesheets = array();
1877 1877
 	// load editor_style.css if the current theme supports it
1878
-	if ( ! empty( $GLOBALS['editor_styles'] ) && is_array( $GLOBALS['editor_styles'] ) ) {
1878
+	if ( ! empty($GLOBALS['editor_styles']) && is_array($GLOBALS['editor_styles'])) {
1879 1879
 		$editor_styles = $GLOBALS['editor_styles'];
1880 1880
 
1881
-		$editor_styles = array_unique( array_filter( $editor_styles ) );
1881
+		$editor_styles = array_unique(array_filter($editor_styles));
1882 1882
 		$style_uri = get_stylesheet_directory_uri();
1883 1883
 		$style_dir = get_stylesheet_directory();
1884 1884
 
1885 1885
 		// Support externally referenced styles (like, say, fonts).
1886
-		foreach ( $editor_styles as $key => $file ) {
1887
-			if ( preg_match( '~^(https?:)?//~', $file ) ) {
1888
-				$stylesheets[] = esc_url_raw( $file );
1889
-				unset( $editor_styles[ $key ] );
1886
+		foreach ($editor_styles as $key => $file) {
1887
+			if (preg_match('~^(https?:)?//~', $file)) {
1888
+				$stylesheets[] = esc_url_raw($file);
1889
+				unset($editor_styles[$key]);
1890 1890
 			}
1891 1891
 		}
1892 1892
 
1893 1893
 		// Look in a parent theme first, that way child theme CSS overrides.
1894
-		if ( is_child_theme() ) {
1894
+		if (is_child_theme()) {
1895 1895
 			$template_uri = get_template_directory_uri();
1896 1896
 			$template_dir = get_template_directory();
1897 1897
 
1898
-			foreach ( $editor_styles as $key => $file ) {
1899
-				if ( $file && file_exists( "$template_dir/$file" ) ) {
1898
+			foreach ($editor_styles as $key => $file) {
1899
+				if ($file && file_exists("$template_dir/$file")) {
1900 1900
 					$stylesheets[] = "$template_uri/$file";
1901 1901
 				}
1902 1902
 			}
1903 1903
 		}
1904 1904
 
1905
-		foreach ( $editor_styles as $file ) {
1906
-			if ( $file && file_exists( "$style_dir/$file" ) ) {
1905
+		foreach ($editor_styles as $file) {
1906
+			if ($file && file_exists("$style_dir/$file")) {
1907 1907
 				$stylesheets[] = "$style_uri/$file";
1908 1908
 			}
1909 1909
 		}
@@ -1916,7 +1916,7 @@  discard block
 block discarded – undo
1916 1916
 	 *
1917 1917
 	 * @param array $stylesheets Array of stylesheets to be applied to the editor.
1918 1918
 	 */
1919
-	return apply_filters( 'editor_stylesheets', $stylesheets );
1919
+	return apply_filters('editor_stylesheets', $stylesheets);
1920 1920
 }
1921 1921
 
1922 1922
 /**
@@ -1927,8 +1927,8 @@  discard block
 block discarded – undo
1927 1927
  * @return array Array of starter content.
1928 1928
  */
1929 1929
 function get_theme_starter_content() {
1930
-	$theme_support = get_theme_support( 'starter-content' );
1931
-	if ( is_array( $theme_support ) && ! empty( $theme_support[0] ) && is_array( $theme_support[0] ) ) {
1930
+	$theme_support = get_theme_support('starter-content');
1931
+	if (is_array($theme_support) && ! empty($theme_support[0]) && is_array($theme_support[0])) {
1932 1932
 		$config = $theme_support[0];
1933 1933
 	} else {
1934 1934
 		$config = array();
@@ -1936,45 +1936,45 @@  discard block
 block discarded – undo
1936 1936
 
1937 1937
 	$core_content = array(
1938 1938
 		'widgets' => array(
1939
-			'text_business_info' => array( 'text', array(
1940
-				'title' => _x( 'Find Us', 'Theme starter content' ),
1941
-				'text' => join( '', array(
1942
-					'<p><strong>' . _x( 'Address', 'Theme starter content' ) . '</strong><br />',
1943
-					_x( '123 Main Street', 'Theme starter content' ) . '<br />' . _x( 'New York, NY 10001', 'Theme starter content' ) . '</p>',
1944
-					'<p><strong>' . _x( 'Hours', 'Theme starter content' ) . '</strong><br />',
1945
-					_x( 'Monday&mdash;Friday: 9:00AM&ndash;5:00PM', 'Theme starter content' ) . '<br />' . _x( 'Saturday &amp; Sunday: 11:00AM&ndash;3:00PM', 'Theme starter content' ) . '</p>'
1946
-				) ),
1947
-			) ),
1948
-			'text_about' => array( 'text', array(
1949
-				'title' => _x( 'About This Site', 'Theme starter content' ),
1950
-				'text' => _x( 'This may be a good place to introduce yourself and your site or include some credits.', 'Theme starter content' ),
1951
-			) ),
1952
-			'archives' => array( 'archives', array(
1953
-				'title' => _x( 'Archives', 'Theme starter content' ),
1954
-			) ),
1955
-			'calendar' => array( 'calendar', array(
1956
-				'title' => _x( 'Calendar', 'Theme starter content' ),
1957
-			) ),
1958
-			'categories' => array( 'categories', array(
1959
-				'title' => _x( 'Categories', 'Theme starter content' ),
1960
-			) ),
1961
-			'meta' => array( 'meta', array(
1962
-				'title' => _x( 'Meta', 'Theme starter content' ),
1963
-			) ),
1964
-			'recent-comments' => array( 'recent-comments', array(
1965
-				'title' => _x( 'Recent Comments', 'Theme starter content' ),
1966
-			) ),
1967
-			'recent-posts' => array( 'recent-posts', array(
1968
-				'title' => _x( 'Recent Posts', 'Theme starter content' ),
1969
-			) ),
1970
-			'search' => array( 'search', array(
1971
-				'title' => _x( 'Search', 'Theme starter content' ),
1972
-			) ),
1939
+			'text_business_info' => array('text', array(
1940
+				'title' => _x('Find Us', 'Theme starter content'),
1941
+				'text' => join('', array(
1942
+					'<p><strong>'._x('Address', 'Theme starter content').'</strong><br />',
1943
+					_x('123 Main Street', 'Theme starter content').'<br />'._x('New York, NY 10001', 'Theme starter content').'</p>',
1944
+					'<p><strong>'._x('Hours', 'Theme starter content').'</strong><br />',
1945
+					_x('Monday&mdash;Friday: 9:00AM&ndash;5:00PM', 'Theme starter content').'<br />'._x('Saturday &amp; Sunday: 11:00AM&ndash;3:00PM', 'Theme starter content').'</p>'
1946
+				)),
1947
+			)),
1948
+			'text_about' => array('text', array(
1949
+				'title' => _x('About This Site', 'Theme starter content'),
1950
+				'text' => _x('This may be a good place to introduce yourself and your site or include some credits.', 'Theme starter content'),
1951
+			)),
1952
+			'archives' => array('archives', array(
1953
+				'title' => _x('Archives', 'Theme starter content'),
1954
+			)),
1955
+			'calendar' => array('calendar', array(
1956
+				'title' => _x('Calendar', 'Theme starter content'),
1957
+			)),
1958
+			'categories' => array('categories', array(
1959
+				'title' => _x('Categories', 'Theme starter content'),
1960
+			)),
1961
+			'meta' => array('meta', array(
1962
+				'title' => _x('Meta', 'Theme starter content'),
1963
+			)),
1964
+			'recent-comments' => array('recent-comments', array(
1965
+				'title' => _x('Recent Comments', 'Theme starter content'),
1966
+			)),
1967
+			'recent-posts' => array('recent-posts', array(
1968
+				'title' => _x('Recent Posts', 'Theme starter content'),
1969
+			)),
1970
+			'search' => array('search', array(
1971
+				'title' => _x('Search', 'Theme starter content'),
1972
+			)),
1973 1973
 		),
1974 1974
 		'nav_menus' => array(
1975 1975
 			'link_home' => array(
1976 1976
 				'type' => 'custom',
1977
-				'title' => _x( 'Home', 'Theme starter content' ),
1977
+				'title' => _x('Home', 'Theme starter content'),
1978 1978
 				'url' => home_url(),
1979 1979
 			),
1980 1980
 			'page_home' => array( // Deprecated in favor of home_link.
@@ -2004,106 +2004,106 @@  discard block
 block discarded – undo
2004 2004
 			),
2005 2005
 
2006 2006
 			'link_email' => array(
2007
-				'title' => _x( 'Email', 'Theme starter content' ),
2007
+				'title' => _x('Email', 'Theme starter content'),
2008 2008
 				'url' => 'mailto:[email protected]',
2009 2009
 			),
2010 2010
 			'link_facebook' => array(
2011
-				'title' => _x( 'Facebook', 'Theme starter content' ),
2011
+				'title' => _x('Facebook', 'Theme starter content'),
2012 2012
 				'url' => 'https://www.facebook.com/wordpress',
2013 2013
 			),
2014 2014
 			'link_foursquare' => array(
2015
-				'title' => _x( 'Foursquare', 'Theme starter content' ),
2015
+				'title' => _x('Foursquare', 'Theme starter content'),
2016 2016
 				'url' => 'https://foursquare.com/',
2017 2017
 			),
2018 2018
 			'link_github' => array(
2019
-				'title' => _x( 'GitHub', 'Theme starter content' ),
2019
+				'title' => _x('GitHub', 'Theme starter content'),
2020 2020
 				'url' => 'https://github.com/wordpress/',
2021 2021
 			),
2022 2022
 			'link_instagram' => array(
2023
-				'title' => _x( 'Instagram', 'Theme starter content' ),
2023
+				'title' => _x('Instagram', 'Theme starter content'),
2024 2024
 				'url' => 'https://www.instagram.com/explore/tags/wordcamp/',
2025 2025
 			),
2026 2026
 			'link_linkedin' => array(
2027
-				'title' => _x( 'LinkedIn', 'Theme starter content' ),
2027
+				'title' => _x('LinkedIn', 'Theme starter content'),
2028 2028
 				'url' => 'https://www.linkedin.com/company/1089783',
2029 2029
 			),
2030 2030
 			'link_pinterest' => array(
2031
-				'title' => _x( 'Pinterest', 'Theme starter content' ),
2031
+				'title' => _x('Pinterest', 'Theme starter content'),
2032 2032
 				'url' => 'https://www.pinterest.com/',
2033 2033
 			),
2034 2034
 			'link_twitter' => array(
2035
-				'title' => _x( 'Twitter', 'Theme starter content' ),
2035
+				'title' => _x('Twitter', 'Theme starter content'),
2036 2036
 				'url' => 'https://twitter.com/wordpress',
2037 2037
 			),
2038 2038
 			'link_yelp' => array(
2039
-				'title' => _x( 'Yelp', 'Theme starter content' ),
2039
+				'title' => _x('Yelp', 'Theme starter content'),
2040 2040
 				'url' => 'https://www.yelp.com',
2041 2041
 			),
2042 2042
 			'link_youtube' => array(
2043
-				'title' => _x( 'YouTube', 'Theme starter content' ),
2043
+				'title' => _x('YouTube', 'Theme starter content'),
2044 2044
 				'url' => 'https://www.youtube.com/channel/UCdof4Ju7amm1chz1gi1T2ZA',
2045 2045
 			),
2046 2046
 		),
2047 2047
 		'posts' => array(
2048 2048
 			'home' => array(
2049 2049
 				'post_type' => 'page',
2050
-				'post_title' => _x( 'Home', 'Theme starter content' ),
2051
-				'post_content' => _x( 'Welcome to your site! This is your homepage, which is what most visitors will see when they come to your site for the first time.', 'Theme starter content' ),
2050
+				'post_title' => _x('Home', 'Theme starter content'),
2051
+				'post_content' => _x('Welcome to your site! This is your homepage, which is what most visitors will see when they come to your site for the first time.', 'Theme starter content'),
2052 2052
 			),
2053 2053
 			'about' => array(
2054 2054
 				'post_type' => 'page',
2055
-				'post_title' => _x( 'About', 'Theme starter content' ),
2056
-				'post_content' => _x( 'You might be an artist who would like to introduce yourself and your work here or maybe you&rsquo;re a business with a mission to describe.', 'Theme starter content' ),
2055
+				'post_title' => _x('About', 'Theme starter content'),
2056
+				'post_content' => _x('You might be an artist who would like to introduce yourself and your work here or maybe you&rsquo;re a business with a mission to describe.', 'Theme starter content'),
2057 2057
 			),
2058 2058
 			'contact' => array(
2059 2059
 				'post_type' => 'page',
2060
-				'post_title' => _x( 'Contact', 'Theme starter content' ),
2061
-				'post_content' => _x( 'This is a page with some basic contact information, such as an address and phone number. You might also try a plugin to add a contact form.', 'Theme starter content' ),
2060
+				'post_title' => _x('Contact', 'Theme starter content'),
2061
+				'post_content' => _x('This is a page with some basic contact information, such as an address and phone number. You might also try a plugin to add a contact form.', 'Theme starter content'),
2062 2062
 			),
2063 2063
 			'blog' => array(
2064 2064
 				'post_type' => 'page',
2065
-				'post_title' => _x( 'Blog', 'Theme starter content' ),
2065
+				'post_title' => _x('Blog', 'Theme starter content'),
2066 2066
 			),
2067 2067
 			'news' => array(
2068 2068
 				'post_type' => 'page',
2069
-				'post_title' => _x( 'News', 'Theme starter content' ),
2069
+				'post_title' => _x('News', 'Theme starter content'),
2070 2070
 			),
2071 2071
 
2072 2072
 			'homepage-section' => array(
2073 2073
 				'post_type' => 'page',
2074
-				'post_title' => _x( 'A homepage section', 'Theme starter content' ),
2075
-				'post_content' => _x( 'This is an example of a homepage section. Homepage sections can be any page other than the homepage itself, including the page that shows your latest blog posts.', 'Theme starter content' ),
2074
+				'post_title' => _x('A homepage section', 'Theme starter content'),
2075
+				'post_content' => _x('This is an example of a homepage section. Homepage sections can be any page other than the homepage itself, including the page that shows your latest blog posts.', 'Theme starter content'),
2076 2076
 			),
2077 2077
 		),
2078 2078
 	);
2079 2079
 
2080 2080
 	$content = array();
2081 2081
 
2082
-	foreach ( $config as $type => $args ) {
2083
-		switch( $type ) {
2082
+	foreach ($config as $type => $args) {
2083
+		switch ($type) {
2084 2084
 			// Use options and theme_mods as-is.
2085 2085
 			case 'options' :
2086 2086
 			case 'theme_mods' :
2087
-				$content[ $type ] = $config[ $type ];
2087
+				$content[$type] = $config[$type];
2088 2088
 				break;
2089 2089
 
2090 2090
 			// Widgets are grouped into sidebars.
2091 2091
 			case 'widgets' :
2092
-				foreach ( $config[ $type ] as $sidebar_id => $widgets ) {
2093
-					foreach ( $widgets as $id => $widget ) {
2094
-						if ( is_array( $widget ) ) {
2092
+				foreach ($config[$type] as $sidebar_id => $widgets) {
2093
+					foreach ($widgets as $id => $widget) {
2094
+						if (is_array($widget)) {
2095 2095
 
2096 2096
 							// Item extends core content.
2097
-							if ( ! empty( $core_content[ $type ][ $id ] ) ) {
2097
+							if ( ! empty($core_content[$type][$id])) {
2098 2098
 								$widget = array(
2099
-									$core_content[ $type ][ $id ][0],
2100
-									array_merge( $core_content[ $type ][ $id ][1], $widget ),
2099
+									$core_content[$type][$id][0],
2100
+									array_merge($core_content[$type][$id][1], $widget),
2101 2101
 								);
2102 2102
 							}
2103 2103
 
2104
-							$content[ $type ][ $sidebar_id ][] = $widget;
2105
-						} elseif ( is_string( $widget ) && ! empty( $core_content[ $type ] ) && ! empty( $core_content[ $type ][ $widget ] ) ) {
2106
-							$content[ $type ][ $sidebar_id ][] = $core_content[ $type ][ $widget ];
2104
+							$content[$type][$sidebar_id][] = $widget;
2105
+						} elseif (is_string($widget) && ! empty($core_content[$type]) && ! empty($core_content[$type][$widget])) {
2106
+							$content[$type][$sidebar_id][] = $core_content[$type][$widget];
2107 2107
 						}
2108 2108
 					}
2109 2109
 				}
@@ -2111,26 +2111,26 @@  discard block
 block discarded – undo
2111 2111
 
2112 2112
 			// And nav menu items are grouped into nav menus.
2113 2113
 			case 'nav_menus' :
2114
-				foreach ( $config[ $type ] as $nav_menu_location => $nav_menu ) {
2114
+				foreach ($config[$type] as $nav_menu_location => $nav_menu) {
2115 2115
 
2116 2116
 					// Ensure nav menus get a name.
2117
-					if ( empty( $nav_menu['name'] ) ) {
2117
+					if (empty($nav_menu['name'])) {
2118 2118
 						$nav_menu['name'] = $nav_menu_location;
2119 2119
 					}
2120 2120
 
2121
-					$content[ $type ][ $nav_menu_location ]['name'] = $nav_menu['name'];
2121
+					$content[$type][$nav_menu_location]['name'] = $nav_menu['name'];
2122 2122
 
2123
-					foreach ( $nav_menu['items'] as $id => $nav_menu_item ) {
2124
-						if ( is_array( $nav_menu_item ) ) {
2123
+					foreach ($nav_menu['items'] as $id => $nav_menu_item) {
2124
+						if (is_array($nav_menu_item)) {
2125 2125
 
2126 2126
 							// Item extends core content.
2127
-							if ( ! empty( $core_content[ $type ][ $id ] ) ) {
2128
-								$nav_menu_item = array_merge( $core_content[ $type ][ $id ], $nav_menu_item );
2127
+							if ( ! empty($core_content[$type][$id])) {
2128
+								$nav_menu_item = array_merge($core_content[$type][$id], $nav_menu_item);
2129 2129
 							}
2130 2130
 
2131
-							$content[ $type ][ $nav_menu_location ]['items'][] = $nav_menu_item;
2132
-						} elseif ( is_string( $nav_menu_item ) && ! empty( $core_content[ $type ] ) && ! empty( $core_content[ $type ][ $nav_menu_item ] ) ) {
2133
-							$content[ $type ][ $nav_menu_location ]['items'][] = $core_content[ $type ][ $nav_menu_item ];
2131
+							$content[$type][$nav_menu_location]['items'][] = $nav_menu_item;
2132
+						} elseif (is_string($nav_menu_item) && ! empty($core_content[$type]) && ! empty($core_content[$type][$nav_menu_item])) {
2133
+							$content[$type][$nav_menu_location]['items'][] = $core_content[$type][$nav_menu_item];
2134 2134
 						}
2135 2135
 					}
2136 2136
 				}
@@ -2138,25 +2138,25 @@  discard block
 block discarded – undo
2138 2138
 
2139 2139
 			// Attachments are posts but have special treatment.
2140 2140
 			case 'attachments' :
2141
-				foreach ( $config[ $type ] as $id => $item ) {
2142
-					if ( ! empty( $item['file'] ) ) {
2143
-						$content[ $type ][ $id ] = $item;
2141
+				foreach ($config[$type] as $id => $item) {
2142
+					if ( ! empty($item['file'])) {
2143
+						$content[$type][$id] = $item;
2144 2144
 					}
2145 2145
 				}
2146 2146
 				break;
2147 2147
 
2148 2148
 			// All that's left now are posts (besides attachments). Not a default case for the sake of clarity and future work.
2149 2149
 			case 'posts' :
2150
-				foreach ( $config[ $type ] as $id => $item ) {
2151
-					if ( is_array( $item ) ) {
2150
+				foreach ($config[$type] as $id => $item) {
2151
+					if (is_array($item)) {
2152 2152
 
2153 2153
 						// Item extends core content.
2154
-						if ( ! empty( $core_content[ $type ][ $id ] ) ) {
2155
-							$item = array_merge( $core_content[ $type ][ $id ], $item );
2154
+						if ( ! empty($core_content[$type][$id])) {
2155
+							$item = array_merge($core_content[$type][$id], $item);
2156 2156
 						}
2157 2157
 
2158 2158
 						// Enforce a subset of fields.
2159
-						$content[ $type ][ $id ] = wp_array_slice_assoc(
2159
+						$content[$type][$id] = wp_array_slice_assoc(
2160 2160
 							$item,
2161 2161
 							array(
2162 2162
 								'post_type',
@@ -2170,8 +2170,8 @@  discard block
 block discarded – undo
2170 2170
 								'template',
2171 2171
 							)
2172 2172
 						);
2173
-					} elseif ( is_string( $item ) && ! empty( $core_content[ $type ][ $item ] ) ) {
2174
-						$content[ $type ][ $item ] = $core_content[ $type ][ $item ];
2173
+					} elseif (is_string($item) && ! empty($core_content[$type][$item])) {
2174
+						$content[$type][$item] = $core_content[$type][$item];
2175 2175
 					}
2176 2176
 				}
2177 2177
 				break;
@@ -2186,7 +2186,7 @@  discard block
 block discarded – undo
2186 2186
 	 * @param array $content Array of starter content.
2187 2187
 	 * @param array $config  Array of theme-specific starter content configuration.
2188 2188
 	 */
2189
-	return apply_filters( 'get_theme_starter_content', $content, $config );
2189
+	return apply_filters('get_theme_starter_content', $content, $config);
2190 2190
 }
2191 2191
 
2192 2192
 /**
@@ -2211,18 +2211,18 @@  discard block
 block discarded – undo
2211 2211
  * @param mixed  $args,... Optional extra arguments to pass along with certain features.
2212 2212
  * @return void|bool False on failure, void otherwise.
2213 2213
  */
2214
-function add_theme_support( $feature ) {
2214
+function add_theme_support($feature) {
2215 2215
 	global $_wp_theme_features;
2216 2216
 
2217
-	if ( func_num_args() == 1 )
2217
+	if (func_num_args() == 1)
2218 2218
 		$args = true;
2219 2219
 	else
2220
-		$args = array_slice( func_get_args(), 1 );
2220
+		$args = array_slice(func_get_args(), 1);
2221 2221
 
2222
-	switch ( $feature ) {
2222
+	switch ($feature) {
2223 2223
 		case 'post-thumbnails':
2224 2224
 			// All post types are already supported.
2225
-			if ( true === get_theme_support( 'post-thumbnails' ) ) {
2225
+			if (true === get_theme_support('post-thumbnails')) {
2226 2226
 				return;
2227 2227
 			}
2228 2228
 
@@ -2230,39 +2230,39 @@  discard block
 block discarded – undo
2230 2230
 			 * Merge post types with any that already declared their support
2231 2231
 			 * for post thumbnails.
2232 2232
 			 */
2233
-			if ( is_array( $args[0] ) && isset( $_wp_theme_features['post-thumbnails'] ) ) {
2234
-				$args[0] = array_unique( array_merge( $_wp_theme_features['post-thumbnails'][0], $args[0] ) );
2233
+			if (is_array($args[0]) && isset($_wp_theme_features['post-thumbnails'])) {
2234
+				$args[0] = array_unique(array_merge($_wp_theme_features['post-thumbnails'][0], $args[0]));
2235 2235
 			}
2236 2236
 
2237 2237
 			break;
2238 2238
 
2239 2239
 		case 'post-formats' :
2240
-			if ( is_array( $args[0] ) ) {
2240
+			if (is_array($args[0])) {
2241 2241
 				$post_formats = get_post_format_slugs();
2242
-				unset( $post_formats['standard'] );
2242
+				unset($post_formats['standard']);
2243 2243
 
2244
-				$args[0] = array_intersect( $args[0], array_keys( $post_formats ) );
2244
+				$args[0] = array_intersect($args[0], array_keys($post_formats));
2245 2245
 			}
2246 2246
 			break;
2247 2247
 
2248 2248
 		case 'html5' :
2249 2249
 			// You can't just pass 'html5', you need to pass an array of types.
2250
-			if ( empty( $args[0] ) ) {
2250
+			if (empty($args[0])) {
2251 2251
 				// Build an array of types for back-compat.
2252
-				$args = array( 0 => array( 'comment-list', 'comment-form', 'search-form' ) );
2253
-			} elseif ( ! is_array( $args[0] ) ) {
2254
-				_doing_it_wrong( "add_theme_support( 'html5' )", __( 'You need to pass an array of types.' ), '3.6.1' );
2252
+				$args = array(0 => array('comment-list', 'comment-form', 'search-form'));
2253
+			} elseif ( ! is_array($args[0])) {
2254
+				_doing_it_wrong("add_theme_support( 'html5' )", __('You need to pass an array of types.'), '3.6.1');
2255 2255
 				return false;
2256 2256
 			}
2257 2257
 
2258 2258
 			// Calling 'html5' again merges, rather than overwrites.
2259
-			if ( isset( $_wp_theme_features['html5'] ) )
2260
-				$args[0] = array_merge( $_wp_theme_features['html5'][0], $args[0] );
2259
+			if (isset($_wp_theme_features['html5']))
2260
+				$args[0] = array_merge($_wp_theme_features['html5'][0], $args[0]);
2261 2261
 			break;
2262 2262
 
2263 2263
 		case 'custom-logo':
2264
-			if ( ! is_array( $args ) ) {
2265
-				$args = array( 0 => array() );
2264
+			if ( ! is_array($args)) {
2265
+				$args = array(0 => array());
2266 2266
 			}
2267 2267
 			$defaults = array(
2268 2268
 				'width'       => null,
@@ -2271,21 +2271,21 @@  discard block
 block discarded – undo
2271 2271
 				'flex-height' => false,
2272 2272
 				'header-text' => '',
2273 2273
 			);
2274
-			$args[0] = wp_parse_args( array_intersect_key( $args[0], $defaults ), $defaults );
2274
+			$args[0] = wp_parse_args(array_intersect_key($args[0], $defaults), $defaults);
2275 2275
 
2276 2276
 			// Allow full flexibility if no size is specified.
2277
-			if ( is_null( $args[0]['width'] ) && is_null( $args[0]['height'] ) ) {
2277
+			if (is_null($args[0]['width']) && is_null($args[0]['height'])) {
2278 2278
 				$args[0]['flex-width']  = true;
2279 2279
 				$args[0]['flex-height'] = true;
2280 2280
 			}
2281 2281
 			break;
2282 2282
 
2283 2283
 		case 'custom-header-uploads' :
2284
-			return add_theme_support( 'custom-header', array( 'uploads' => true ) );
2284
+			return add_theme_support('custom-header', array('uploads' => true));
2285 2285
 
2286 2286
 		case 'custom-header' :
2287
-			if ( ! is_array( $args ) )
2288
-				$args = array( 0 => array() );
2287
+			if ( ! is_array($args))
2288
+				$args = array(0 => array());
2289 2289
 
2290 2290
 			$defaults = array(
2291 2291
 				'default-image' => '',
@@ -2304,18 +2304,18 @@  discard block
 block discarded – undo
2304 2304
 				'video-active-callback' => 'is_front_page',
2305 2305
 			);
2306 2306
 
2307
-			$jit = isset( $args[0]['__jit'] );
2308
-			unset( $args[0]['__jit'] );
2307
+			$jit = isset($args[0]['__jit']);
2308
+			unset($args[0]['__jit']);
2309 2309
 
2310 2310
 			// Merge in data from previous add_theme_support() calls.
2311 2311
 			// The first value registered wins. (A child theme is set up first.)
2312
-			if ( isset( $_wp_theme_features['custom-header'] ) )
2313
-				$args[0] = wp_parse_args( $_wp_theme_features['custom-header'][0], $args[0] );
2312
+			if (isset($_wp_theme_features['custom-header']))
2313
+				$args[0] = wp_parse_args($_wp_theme_features['custom-header'][0], $args[0]);
2314 2314
 
2315 2315
 			// Load in the defaults at the end, as we need to insure first one wins.
2316 2316
 			// This will cause all constants to be defined, as each arg will then be set to the default.
2317
-			if ( $jit )
2318
-				$args[0] = wp_parse_args( $args[0], $defaults );
2317
+			if ($jit)
2318
+				$args[0] = wp_parse_args($args[0], $defaults);
2319 2319
 
2320 2320
 			// If a constant was defined, use that value. Otherwise, define the constant to ensure
2321 2321
 			// the constant is always accurate (and is not defined later,  overriding our value).
@@ -2323,48 +2323,48 @@  discard block
 block discarded – undo
2323 2323
 			// Once we get to wp_loaded (just-in-time), define any constants we haven't already.
2324 2324
 			// Constants are lame. Don't reference them. This is just for backward compatibility.
2325 2325
 
2326
-			if ( defined( 'NO_HEADER_TEXT' ) )
2326
+			if (defined('NO_HEADER_TEXT'))
2327 2327
 				$args[0]['header-text'] = ! NO_HEADER_TEXT;
2328
-			elseif ( isset( $args[0]['header-text'] ) )
2329
-				define( 'NO_HEADER_TEXT', empty( $args[0]['header-text'] ) );
2328
+			elseif (isset($args[0]['header-text']))
2329
+				define('NO_HEADER_TEXT', empty($args[0]['header-text']));
2330 2330
 
2331
-			if ( defined( 'HEADER_IMAGE_WIDTH' ) )
2331
+			if (defined('HEADER_IMAGE_WIDTH'))
2332 2332
 				$args[0]['width'] = (int) HEADER_IMAGE_WIDTH;
2333
-			elseif ( isset( $args[0]['width'] ) )
2334
-				define( 'HEADER_IMAGE_WIDTH', (int) $args[0]['width'] );
2333
+			elseif (isset($args[0]['width']))
2334
+				define('HEADER_IMAGE_WIDTH', (int) $args[0]['width']);
2335 2335
 
2336
-			if ( defined( 'HEADER_IMAGE_HEIGHT' ) )
2336
+			if (defined('HEADER_IMAGE_HEIGHT'))
2337 2337
 				$args[0]['height'] = (int) HEADER_IMAGE_HEIGHT;
2338
-			elseif ( isset( $args[0]['height'] ) )
2339
-				define( 'HEADER_IMAGE_HEIGHT', (int) $args[0]['height'] );
2338
+			elseif (isset($args[0]['height']))
2339
+				define('HEADER_IMAGE_HEIGHT', (int) $args[0]['height']);
2340 2340
 
2341
-			if ( defined( 'HEADER_TEXTCOLOR' ) )
2341
+			if (defined('HEADER_TEXTCOLOR'))
2342 2342
 				$args[0]['default-text-color'] = HEADER_TEXTCOLOR;
2343
-			elseif ( isset( $args[0]['default-text-color'] ) )
2344
-				define( 'HEADER_TEXTCOLOR', $args[0]['default-text-color'] );
2343
+			elseif (isset($args[0]['default-text-color']))
2344
+				define('HEADER_TEXTCOLOR', $args[0]['default-text-color']);
2345 2345
 
2346
-			if ( defined( 'HEADER_IMAGE' ) )
2346
+			if (defined('HEADER_IMAGE'))
2347 2347
 				$args[0]['default-image'] = HEADER_IMAGE;
2348
-			elseif ( isset( $args[0]['default-image'] ) )
2349
-				define( 'HEADER_IMAGE', $args[0]['default-image'] );
2348
+			elseif (isset($args[0]['default-image']))
2349
+				define('HEADER_IMAGE', $args[0]['default-image']);
2350 2350
 
2351
-			if ( $jit && ! empty( $args[0]['default-image'] ) )
2351
+			if ($jit && ! empty($args[0]['default-image']))
2352 2352
 				$args[0]['random-default'] = false;
2353 2353
 
2354 2354
 			// If headers are supported, and we still don't have a defined width or height,
2355 2355
 			// we have implicit flex sizes.
2356
-			if ( $jit ) {
2357
-				if ( empty( $args[0]['width'] ) && empty( $args[0]['flex-width'] ) )
2356
+			if ($jit) {
2357
+				if (empty($args[0]['width']) && empty($args[0]['flex-width']))
2358 2358
 					$args[0]['flex-width'] = true;
2359
-				if ( empty( $args[0]['height'] ) && empty( $args[0]['flex-height'] ) )
2359
+				if (empty($args[0]['height']) && empty($args[0]['flex-height']))
2360 2360
 					$args[0]['flex-height'] = true;
2361 2361
 			}
2362 2362
 
2363 2363
 			break;
2364 2364
 
2365 2365
 		case 'custom-background' :
2366
-			if ( ! is_array( $args ) )
2367
-				$args = array( 0 => array() );
2366
+			if ( ! is_array($args))
2367
+				$args = array(0 => array());
2368 2368
 
2369 2369
 			$defaults = array(
2370 2370
 				'default-image'          => '',
@@ -2380,41 +2380,41 @@  discard block
 block discarded – undo
2380 2380
 				'admin-preview-callback' => '',
2381 2381
 			);
2382 2382
 
2383
-			$jit = isset( $args[0]['__jit'] );
2384
-			unset( $args[0]['__jit'] );
2383
+			$jit = isset($args[0]['__jit']);
2384
+			unset($args[0]['__jit']);
2385 2385
 
2386 2386
 			// Merge in data from previous add_theme_support() calls. The first value registered wins.
2387
-			if ( isset( $_wp_theme_features['custom-background'] ) )
2388
-				$args[0] = wp_parse_args( $_wp_theme_features['custom-background'][0], $args[0] );
2387
+			if (isset($_wp_theme_features['custom-background']))
2388
+				$args[0] = wp_parse_args($_wp_theme_features['custom-background'][0], $args[0]);
2389 2389
 
2390
-			if ( $jit )
2391
-				$args[0] = wp_parse_args( $args[0], $defaults );
2390
+			if ($jit)
2391
+				$args[0] = wp_parse_args($args[0], $defaults);
2392 2392
 
2393
-			if ( defined( 'BACKGROUND_COLOR' ) )
2393
+			if (defined('BACKGROUND_COLOR'))
2394 2394
 				$args[0]['default-color'] = BACKGROUND_COLOR;
2395
-			elseif ( isset( $args[0]['default-color'] ) || $jit )
2396
-				define( 'BACKGROUND_COLOR', $args[0]['default-color'] );
2395
+			elseif (isset($args[0]['default-color']) || $jit)
2396
+				define('BACKGROUND_COLOR', $args[0]['default-color']);
2397 2397
 
2398
-			if ( defined( 'BACKGROUND_IMAGE' ) )
2398
+			if (defined('BACKGROUND_IMAGE'))
2399 2399
 				$args[0]['default-image'] = BACKGROUND_IMAGE;
2400
-			elseif ( isset( $args[0]['default-image'] ) || $jit )
2401
-				define( 'BACKGROUND_IMAGE', $args[0]['default-image'] );
2400
+			elseif (isset($args[0]['default-image']) || $jit)
2401
+				define('BACKGROUND_IMAGE', $args[0]['default-image']);
2402 2402
 
2403 2403
 			break;
2404 2404
 
2405 2405
 		// Ensure that 'title-tag' is accessible in the admin.
2406 2406
 		case 'title-tag' :
2407 2407
 			// Can be called in functions.php but must happen before wp_loaded, i.e. not in header.php.
2408
-			if ( did_action( 'wp_loaded' ) ) {
2408
+			if (did_action('wp_loaded')) {
2409 2409
 				/* translators: 1: Theme support 2: hook name */
2410
-				_doing_it_wrong( "add_theme_support( 'title-tag' )", sprintf( __( 'Theme support for %1$s should be registered before the %2$s hook.' ),
2411
-					'<code>title-tag</code>', '<code>wp_loaded</code>' ), '4.1.0' );
2410
+				_doing_it_wrong("add_theme_support( 'title-tag' )", sprintf(__('Theme support for %1$s should be registered before the %2$s hook.'),
2411
+					'<code>title-tag</code>', '<code>wp_loaded</code>'), '4.1.0');
2412 2412
 
2413 2413
 				return false;
2414 2414
 			}
2415 2415
 	}
2416 2416
 
2417
-	$_wp_theme_features[ $feature ] = $args;
2417
+	$_wp_theme_features[$feature] = $args;
2418 2418
 }
2419 2419
 
2420 2420
 /**
@@ -2429,30 +2429,30 @@  discard block
 block discarded – undo
2429 2429
 function _custom_header_background_just_in_time() {
2430 2430
 	global $custom_image_header, $custom_background;
2431 2431
 
2432
-	if ( current_theme_supports( 'custom-header' ) ) {
2432
+	if (current_theme_supports('custom-header')) {
2433 2433
 		// In case any constants were defined after an add_custom_image_header() call, re-run.
2434
-		add_theme_support( 'custom-header', array( '__jit' => true ) );
2434
+		add_theme_support('custom-header', array('__jit' => true));
2435 2435
 
2436
-		$args = get_theme_support( 'custom-header' );
2437
-		if ( $args[0]['wp-head-callback'] )
2438
-			add_action( 'wp_head', $args[0]['wp-head-callback'] );
2436
+		$args = get_theme_support('custom-header');
2437
+		if ($args[0]['wp-head-callback'])
2438
+			add_action('wp_head', $args[0]['wp-head-callback']);
2439 2439
 
2440
-		if ( is_admin() ) {
2441
-			require_once( ABSPATH . 'wp-admin/custom-header.php' );
2442
-			$custom_image_header = new Custom_Image_Header( $args[0]['admin-head-callback'], $args[0]['admin-preview-callback'] );
2440
+		if (is_admin()) {
2441
+			require_once(ABSPATH.'wp-admin/custom-header.php');
2442
+			$custom_image_header = new Custom_Image_Header($args[0]['admin-head-callback'], $args[0]['admin-preview-callback']);
2443 2443
 		}
2444 2444
 	}
2445 2445
 
2446
-	if ( current_theme_supports( 'custom-background' ) ) {
2446
+	if (current_theme_supports('custom-background')) {
2447 2447
 		// In case any constants were defined after an add_custom_background() call, re-run.
2448
-		add_theme_support( 'custom-background', array( '__jit' => true ) );
2448
+		add_theme_support('custom-background', array('__jit' => true));
2449 2449
 
2450
-		$args = get_theme_support( 'custom-background' );
2451
-		add_action( 'wp_head', $args[0]['wp-head-callback'] );
2450
+		$args = get_theme_support('custom-background');
2451
+		add_action('wp_head', $args[0]['wp-head-callback']);
2452 2452
 
2453
-		if ( is_admin() ) {
2454
-			require_once( ABSPATH . 'wp-admin/custom-background.php' );
2455
-			$custom_background = new Custom_Background( $args[0]['admin-head-callback'], $args[0]['admin-preview-callback'] );
2453
+		if (is_admin()) {
2454
+			require_once(ABSPATH.'wp-admin/custom-background.php');
2455
+			$custom_background = new Custom_Background($args[0]['admin-head-callback'], $args[0]['admin-preview-callback']);
2456 2456
 		}
2457 2457
 	}
2458 2458
 }
@@ -2464,10 +2464,10 @@  discard block
 block discarded – undo
2464 2464
  * @access private
2465 2465
  */
2466 2466
 function _custom_logo_header_styles() {
2467
-	if ( ! current_theme_supports( 'custom-header', 'header-text' ) && get_theme_support( 'custom-logo', 'header-text' ) && ! get_theme_mod( 'header_text', true ) ) {
2468
-		$classes = (array) get_theme_support( 'custom-logo', 'header-text' );
2469
-		$classes = array_map( 'sanitize_html_class', $classes );
2470
-		$classes = '.' . implode( ', .', $classes );
2467
+	if ( ! current_theme_supports('custom-header', 'header-text') && get_theme_support('custom-logo', 'header-text') && ! get_theme_mod('header_text', true)) {
2468
+		$classes = (array) get_theme_support('custom-logo', 'header-text');
2469
+		$classes = array_map('sanitize_html_class', $classes);
2470
+		$classes = '.'.implode(', .', $classes);
2471 2471
 
2472 2472
 		?>
2473 2473
 		<!-- Custom Logo: hide header text -->
@@ -2491,25 +2491,25 @@  discard block
 block discarded – undo
2491 2491
  * @param string $feature the feature to check
2492 2492
  * @return mixed The array of extra arguments or the value for the registered feature.
2493 2493
  */
2494
-function get_theme_support( $feature ) {
2494
+function get_theme_support($feature) {
2495 2495
 	global $_wp_theme_features;
2496
-	if ( ! isset( $_wp_theme_features[ $feature ] ) )
2496
+	if ( ! isset($_wp_theme_features[$feature]))
2497 2497
 		return false;
2498 2498
 
2499
-	if ( func_num_args() <= 1 )
2500
-		return $_wp_theme_features[ $feature ];
2499
+	if (func_num_args() <= 1)
2500
+		return $_wp_theme_features[$feature];
2501 2501
 
2502
-	$args = array_slice( func_get_args(), 1 );
2503
-	switch ( $feature ) {
2502
+	$args = array_slice(func_get_args(), 1);
2503
+	switch ($feature) {
2504 2504
 		case 'custom-logo' :
2505 2505
 		case 'custom-header' :
2506 2506
 		case 'custom-background' :
2507
-			if ( isset( $_wp_theme_features[ $feature ][0][ $args[0] ] ) )
2508
-				return $_wp_theme_features[ $feature ][0][ $args[0] ];
2507
+			if (isset($_wp_theme_features[$feature][0][$args[0]]))
2508
+				return $_wp_theme_features[$feature][0][$args[0]];
2509 2509
 			return false;
2510 2510
 
2511 2511
 		default :
2512
-			return $_wp_theme_features[ $feature ];
2512
+			return $_wp_theme_features[$feature];
2513 2513
 	}
2514 2514
 }
2515 2515
 
@@ -2524,12 +2524,12 @@  discard block
 block discarded – undo
2524 2524
  * @param string $feature the feature being added
2525 2525
  * @return bool|void Whether feature was removed.
2526 2526
  */
2527
-function remove_theme_support( $feature ) {
2527
+function remove_theme_support($feature) {
2528 2528
 	// Blacklist: for internal registrations not used directly by themes.
2529
-	if ( in_array( $feature, array( 'editor-style', 'widgets', 'menus' ) ) )
2529
+	if (in_array($feature, array('editor-style', 'widgets', 'menus')))
2530 2530
 		return false;
2531 2531
 
2532
-	return _remove_theme_support( $feature );
2532
+	return _remove_theme_support($feature);
2533 2533
 }
2534 2534
 
2535 2535
 /**
@@ -2544,45 +2544,45 @@  discard block
 block discarded – undo
2544 2544
  *
2545 2545
  * @param string $feature
2546 2546
  */
2547
-function _remove_theme_support( $feature ) {
2547
+function _remove_theme_support($feature) {
2548 2548
 	global $_wp_theme_features;
2549 2549
 
2550
-	switch ( $feature ) {
2550
+	switch ($feature) {
2551 2551
 		case 'custom-header-uploads' :
2552
-			if ( ! isset( $_wp_theme_features['custom-header'] ) )
2552
+			if ( ! isset($_wp_theme_features['custom-header']))
2553 2553
 				return false;
2554
-			add_theme_support( 'custom-header', array( 'uploads' => false ) );
2554
+			add_theme_support('custom-header', array('uploads' => false));
2555 2555
 			return; // Do not continue - custom-header-uploads no longer exists.
2556 2556
 	}
2557 2557
 
2558
-	if ( ! isset( $_wp_theme_features[ $feature ] ) )
2558
+	if ( ! isset($_wp_theme_features[$feature]))
2559 2559
 		return false;
2560 2560
 
2561
-	switch ( $feature ) {
2561
+	switch ($feature) {
2562 2562
 		case 'custom-header' :
2563
-			if ( ! did_action( 'wp_loaded' ) )
2563
+			if ( ! did_action('wp_loaded'))
2564 2564
 				break;
2565
-			$support = get_theme_support( 'custom-header' );
2566
-			if ( isset( $support[0]['wp-head-callback'] ) ) {
2567
-				remove_action( 'wp_head', $support[0]['wp-head-callback'] );
2565
+			$support = get_theme_support('custom-header');
2566
+			if (isset($support[0]['wp-head-callback'])) {
2567
+				remove_action('wp_head', $support[0]['wp-head-callback']);
2568 2568
 			}
2569
-			if ( isset( $GLOBALS['custom_image_header'] ) ) {
2570
-				remove_action( 'admin_menu', array( $GLOBALS['custom_image_header'], 'init' ) );
2571
-				unset( $GLOBALS['custom_image_header'] );
2569
+			if (isset($GLOBALS['custom_image_header'])) {
2570
+				remove_action('admin_menu', array($GLOBALS['custom_image_header'], 'init'));
2571
+				unset($GLOBALS['custom_image_header']);
2572 2572
 			}
2573 2573
 			break;
2574 2574
 
2575 2575
 		case 'custom-background' :
2576
-			if ( ! did_action( 'wp_loaded' ) )
2576
+			if ( ! did_action('wp_loaded'))
2577 2577
 				break;
2578
-			$support = get_theme_support( 'custom-background' );
2579
-			remove_action( 'wp_head', $support[0]['wp-head-callback'] );
2580
-			remove_action( 'admin_menu', array( $GLOBALS['custom_background'], 'init' ) );
2581
-			unset( $GLOBALS['custom_background'] );
2578
+			$support = get_theme_support('custom-background');
2579
+			remove_action('wp_head', $support[0]['wp-head-callback']);
2580
+			remove_action('admin_menu', array($GLOBALS['custom_background'], 'init'));
2581
+			unset($GLOBALS['custom_background']);
2582 2582
 			break;
2583 2583
 	}
2584 2584
 
2585
-	unset( $_wp_theme_features[ $feature ] );
2585
+	unset($_wp_theme_features[$feature]);
2586 2586
 	return true;
2587 2587
 }
2588 2588
 
@@ -2596,30 +2596,30 @@  discard block
 block discarded – undo
2596 2596
  * @param string $feature the feature being checked
2597 2597
  * @return bool
2598 2598
  */
2599
-function current_theme_supports( $feature ) {
2599
+function current_theme_supports($feature) {
2600 2600
 	global $_wp_theme_features;
2601 2601
 
2602
-	if ( 'custom-header-uploads' == $feature )
2603
-		return current_theme_supports( 'custom-header', 'uploads' );
2602
+	if ('custom-header-uploads' == $feature)
2603
+		return current_theme_supports('custom-header', 'uploads');
2604 2604
 
2605
-	if ( !isset( $_wp_theme_features[$feature] ) )
2605
+	if ( ! isset($_wp_theme_features[$feature]))
2606 2606
 		return false;
2607 2607
 
2608 2608
 	// If no args passed then no extra checks need be performed
2609
-	if ( func_num_args() <= 1 )
2609
+	if (func_num_args() <= 1)
2610 2610
 		return true;
2611 2611
 
2612
-	$args = array_slice( func_get_args(), 1 );
2612
+	$args = array_slice(func_get_args(), 1);
2613 2613
 
2614
-	switch ( $feature ) {
2614
+	switch ($feature) {
2615 2615
 		case 'post-thumbnails':
2616 2616
 			// post-thumbnails can be registered for only certain content/post types by passing
2617 2617
 			// an array of types to add_theme_support(). If no array was passed, then
2618 2618
 			// any type is accepted
2619
-			if ( true === $_wp_theme_features[$feature] )  // Registered for all types
2619
+			if (true === $_wp_theme_features[$feature])  // Registered for all types
2620 2620
 				return true;
2621 2621
 			$content_type = $args[0];
2622
-			return in_array( $content_type, $_wp_theme_features[$feature][0] );
2622
+			return in_array($content_type, $_wp_theme_features[$feature][0]);
2623 2623
 
2624 2624
 		case 'html5':
2625 2625
 		case 'post-formats':
@@ -2629,13 +2629,13 @@  discard block
 block discarded – undo
2629 2629
 			// Specific areas of HTML5 support *must* be passed via an array to add_theme_support()
2630 2630
 
2631 2631
 			$type = $args[0];
2632
-			return in_array( $type, $_wp_theme_features[$feature][0] );
2632
+			return in_array($type, $_wp_theme_features[$feature][0]);
2633 2633
 
2634 2634
 		case 'custom-logo':
2635 2635
 		case 'custom-header':
2636 2636
 		case 'custom-background':
2637 2637
 			// Specific capabilities can be registered by passing an array to add_theme_support().
2638
-			return ( isset( $_wp_theme_features[ $feature ][0][ $args[0] ] ) && $_wp_theme_features[ $feature ][0][ $args[0] ] );
2638
+			return (isset($_wp_theme_features[$feature][0][$args[0]]) && $_wp_theme_features[$feature][0][$args[0]]);
2639 2639
 	}
2640 2640
 
2641 2641
 	/**
@@ -2652,7 +2652,7 @@  discard block
 block discarded – undo
2652 2652
 	 * @param array  $args    Array of arguments for the feature.
2653 2653
 	 * @param string $feature The theme feature.
2654 2654
 	 */
2655
-	return apply_filters( "current_theme_supports-{$feature}", true, $args, $_wp_theme_features[$feature] );
2655
+	return apply_filters("current_theme_supports-{$feature}", true, $args, $_wp_theme_features[$feature]);
2656 2656
 }
2657 2657
 
2658 2658
 /**
@@ -2664,9 +2664,9 @@  discard block
 block discarded – undo
2664 2664
  * @param string $include Path to the file.
2665 2665
  * @return bool True if the current theme supports the supplied feature, false otherwise.
2666 2666
  */
2667
-function require_if_theme_supports( $feature, $include ) {
2668
-	if ( current_theme_supports( $feature ) ) {
2669
-		require ( $include );
2667
+function require_if_theme_supports($feature, $include) {
2668
+	if (current_theme_supports($feature)) {
2669
+		require ($include);
2670 2670
 		return true;
2671 2671
 	}
2672 2672
 	return false;
@@ -2685,24 +2685,24 @@  discard block
 block discarded – undo
2685 2685
  *
2686 2686
  * @param int $id The attachment id.
2687 2687
  */
2688
-function _delete_attachment_theme_mod( $id ) {
2689
-	$attachment_image = wp_get_attachment_url( $id );
2688
+function _delete_attachment_theme_mod($id) {
2689
+	$attachment_image = wp_get_attachment_url($id);
2690 2690
 	$header_image     = get_header_image();
2691 2691
 	$background_image = get_background_image();
2692
-	$custom_logo_id   = get_theme_mod( 'custom_logo' );
2692
+	$custom_logo_id   = get_theme_mod('custom_logo');
2693 2693
 
2694
-	if ( $custom_logo_id && $custom_logo_id == $id ) {
2695
-		remove_theme_mod( 'custom_logo' );
2696
-		remove_theme_mod( 'header_text' );
2694
+	if ($custom_logo_id && $custom_logo_id == $id) {
2695
+		remove_theme_mod('custom_logo');
2696
+		remove_theme_mod('header_text');
2697 2697
 	}
2698 2698
 
2699
-	if ( $header_image && $header_image == $attachment_image ) {
2700
-		remove_theme_mod( 'header_image' );
2701
-		remove_theme_mod( 'header_image_data' );
2699
+	if ($header_image && $header_image == $attachment_image) {
2700
+		remove_theme_mod('header_image');
2701
+		remove_theme_mod('header_image_data');
2702 2702
 	}
2703 2703
 
2704
-	if ( $background_image && $background_image == $attachment_image ) {
2705
-		remove_theme_mod( 'background_image' );
2704
+	if ($background_image && $background_image == $attachment_image) {
2705
+		remove_theme_mod('background_image');
2706 2706
 	}
2707 2707
 }
2708 2708
 
@@ -2714,16 +2714,16 @@  discard block
 block discarded – undo
2714 2714
  * @since 3.3.0
2715 2715
  */
2716 2716
 function check_theme_switched() {
2717
-	if ( $stylesheet = get_option( 'theme_switched' ) ) {
2718
-		$old_theme = wp_get_theme( $stylesheet );
2717
+	if ($stylesheet = get_option('theme_switched')) {
2718
+		$old_theme = wp_get_theme($stylesheet);
2719 2719
 
2720 2720
 		// Prevent retrieve_widgets() from running since Customizer already called it up front
2721
-		if ( get_option( 'theme_switched_via_customizer' ) ) {
2722
-			remove_action( 'after_switch_theme', '_wp_sidebars_changed' );
2723
-			update_option( 'theme_switched_via_customizer', false );
2721
+		if (get_option('theme_switched_via_customizer')) {
2722
+			remove_action('after_switch_theme', '_wp_sidebars_changed');
2723
+			update_option('theme_switched_via_customizer', false);
2724 2724
 		}
2725 2725
 
2726
-		if ( $old_theme->exists() ) {
2726
+		if ($old_theme->exists()) {
2727 2727
 			/**
2728 2728
 			 * Fires on the first WP load after a theme switch if the old theme still exists.
2729 2729
 			 *
@@ -2737,14 +2737,14 @@  discard block
 block discarded – undo
2737 2737
 			 * @param string   $old_name  Old theme name.
2738 2738
 			 * @param WP_Theme $old_theme WP_Theme instance of the old theme.
2739 2739
 			 */
2740
-			do_action( 'after_switch_theme', $old_theme->get( 'Name' ), $old_theme );
2740
+			do_action('after_switch_theme', $old_theme->get('Name'), $old_theme);
2741 2741
 		} else {
2742 2742
 			/** This action is documented in wp-includes/theme.php */
2743
-			do_action( 'after_switch_theme', $stylesheet );
2743
+			do_action('after_switch_theme', $stylesheet);
2744 2744
 		}
2745 2745
 		flush_rewrite_rules();
2746 2746
 
2747
-		update_option( 'theme_switched', false );
2747
+		update_option('theme_switched', false);
2748 2748
 	}
2749 2749
 }
2750 2750
 
@@ -2763,16 +2763,16 @@  discard block
 block discarded – undo
2763 2763
  */
2764 2764
 function _wp_customize_include() {
2765 2765
 
2766
-	$is_customize_admin_page = ( is_admin() && 'customize.php' == basename( $_SERVER['PHP_SELF'] ) );
2766
+	$is_customize_admin_page = (is_admin() && 'customize.php' == basename($_SERVER['PHP_SELF']));
2767 2767
 	$should_include = (
2768 2768
 		$is_customize_admin_page
2769 2769
 		||
2770
-		( isset( $_REQUEST['wp_customize'] ) && 'on' == $_REQUEST['wp_customize'] )
2770
+		(isset($_REQUEST['wp_customize']) && 'on' == $_REQUEST['wp_customize'])
2771 2771
 		||
2772
-		( ! empty( $_GET['customize_changeset_uuid'] ) || ! empty( $_POST['customize_changeset_uuid'] ) )
2772
+		( ! empty($_GET['customize_changeset_uuid']) || ! empty($_POST['customize_changeset_uuid']))
2773 2773
 	);
2774 2774
 
2775
-	if ( ! $should_include ) {
2775
+	if ( ! $should_include) {
2776 2776
 		return;
2777 2777
 	}
2778 2778
 
@@ -2781,34 +2781,34 @@  discard block
 block discarded – undo
2781 2781
 	 * called before wp_magic_quotes() gets called. Besides this fact, none of
2782 2782
 	 * the values should contain any characters needing slashes anyway.
2783 2783
 	 */
2784
-	$keys = array( 'changeset_uuid', 'customize_changeset_uuid', 'customize_theme', 'theme', 'customize_messenger_channel' );
2784
+	$keys = array('changeset_uuid', 'customize_changeset_uuid', 'customize_theme', 'theme', 'customize_messenger_channel');
2785 2785
 	$input_vars = array_merge(
2786
-		wp_array_slice_assoc( $_GET, $keys ),
2787
-		wp_array_slice_assoc( $_POST, $keys )
2786
+		wp_array_slice_assoc($_GET, $keys),
2787
+		wp_array_slice_assoc($_POST, $keys)
2788 2788
 	);
2789 2789
 
2790 2790
 	$theme = null;
2791 2791
 	$changeset_uuid = null;
2792 2792
 	$messenger_channel = null;
2793 2793
 
2794
-	if ( $is_customize_admin_page && isset( $input_vars['changeset_uuid'] ) ) {
2795
-		$changeset_uuid = sanitize_key( $input_vars['changeset_uuid'] );
2796
-	} elseif ( ! empty( $input_vars['customize_changeset_uuid'] ) ) {
2797
-		$changeset_uuid = sanitize_key( $input_vars['customize_changeset_uuid'] );
2794
+	if ($is_customize_admin_page && isset($input_vars['changeset_uuid'])) {
2795
+		$changeset_uuid = sanitize_key($input_vars['changeset_uuid']);
2796
+	} elseif ( ! empty($input_vars['customize_changeset_uuid'])) {
2797
+		$changeset_uuid = sanitize_key($input_vars['customize_changeset_uuid']);
2798 2798
 	}
2799 2799
 
2800 2800
 	// Note that theme will be sanitized via WP_Theme.
2801
-	if ( $is_customize_admin_page && isset( $input_vars['theme'] ) ) {
2801
+	if ($is_customize_admin_page && isset($input_vars['theme'])) {
2802 2802
 		$theme = $input_vars['theme'];
2803
-	} elseif ( isset( $input_vars['customize_theme'] ) ) {
2803
+	} elseif (isset($input_vars['customize_theme'])) {
2804 2804
 		$theme = $input_vars['customize_theme'];
2805 2805
 	}
2806
-	if ( isset( $input_vars['customize_messenger_channel'] ) ) {
2807
-		$messenger_channel = sanitize_key( $input_vars['customize_messenger_channel'] );
2806
+	if (isset($input_vars['customize_messenger_channel'])) {
2807
+		$messenger_channel = sanitize_key($input_vars['customize_messenger_channel']);
2808 2808
 	}
2809 2809
 
2810
-	require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
2811
-	$GLOBALS['wp_customize'] = new WP_Customize_Manager( compact( 'changeset_uuid', 'theme', 'messenger_channel' ) );
2810
+	require_once ABSPATH.WPINC.'/class-wp-customize-manager.php';
2811
+	$GLOBALS['wp_customize'] = new WP_Customize_Manager(compact('changeset_uuid', 'theme', 'messenger_channel'));
2812 2812
 }
2813 2813
 
2814 2814
 /**
@@ -2818,7 +2818,7 @@  discard block
 block discarded – undo
2818 2818
  * @param string  $old_status     Old post status.
2819 2819
  * @param WP_Post $changeset_post Changeset post object.
2820 2820
  */
2821
-function _wp_customize_publish_changeset( $new_status, $old_status, $changeset_post ) {
2821
+function _wp_customize_publish_changeset($new_status, $old_status, $changeset_post) {
2822 2822
 	global $wp_customize, $wpdb;
2823 2823
 
2824 2824
 	$is_publishing_changeset = (
@@ -2828,16 +2828,16 @@  discard block
 block discarded – undo
2828 2828
 		&&
2829 2829
 		'publish' !== $old_status
2830 2830
 	);
2831
-	if ( ! $is_publishing_changeset ) {
2831
+	if ( ! $is_publishing_changeset) {
2832 2832
 		return;
2833 2833
 	}
2834 2834
 
2835
-	if ( empty( $wp_customize ) ) {
2836
-		require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
2837
-		$wp_customize = new WP_Customize_Manager( array( 'changeset_uuid' => $changeset_post->post_name ) );
2835
+	if (empty($wp_customize)) {
2836
+		require_once ABSPATH.WPINC.'/class-wp-customize-manager.php';
2837
+		$wp_customize = new WP_Customize_Manager(array('changeset_uuid' => $changeset_post->post_name));
2838 2838
 	}
2839 2839
 
2840
-	if ( ! did_action( 'customize_register' ) ) {
2840
+	if ( ! did_action('customize_register')) {
2841 2841
 		/*
2842 2842
 		 * When running from CLI or Cron, the customize_register action will need
2843 2843
 		 * to be triggered in order for core, themes, and plugins to register their
@@ -2852,13 +2852,13 @@  discard block
 block discarded – undo
2852 2852
 		 * So the following manually calls the method that registers the core
2853 2853
 		 * settings up front before doing the action.
2854 2854
 		 */
2855
-		remove_action( 'customize_register', array( $wp_customize, 'register_controls' ) );
2855
+		remove_action('customize_register', array($wp_customize, 'register_controls'));
2856 2856
 		$wp_customize->register_controls();
2857 2857
 
2858 2858
 		/** This filter is documented in /wp-includes/class-wp-customize-manager.php */
2859
-		do_action( 'customize_register', $wp_customize );
2859
+		do_action('customize_register', $wp_customize);
2860 2860
 	}
2861
-	$wp_customize->_publish_changeset_values( $changeset_post->ID ) ;
2861
+	$wp_customize->_publish_changeset_values($changeset_post->ID);
2862 2862
 
2863 2863
 	/*
2864 2864
 	 * Trash the changeset post if revisions are not enabled. Unpublished
@@ -2869,7 +2869,7 @@  discard block
 block discarded – undo
2869 2869
 	 * feature to indicate whether or not a published changeset should get trashed
2870 2870
 	 * and thus garbage collected.
2871 2871
 	 */
2872
-	if ( ! wp_revisions_enabled( $changeset_post ) ) {
2872
+	if ( ! wp_revisions_enabled($changeset_post)) {
2873 2873
 		$post = $changeset_post;
2874 2874
 		$post_id = $changeset_post->ID;
2875 2875
 
@@ -2879,37 +2879,37 @@  discard block
 block discarded – undo
2879 2879
 		 * will mutate the the post_content and the post_name when they should be
2880 2880
 		 * untouched.
2881 2881
 		 */
2882
-		if ( ! EMPTY_TRASH_DAYS ) {
2883
-			wp_delete_post( $post_id, true );
2882
+		if ( ! EMPTY_TRASH_DAYS) {
2883
+			wp_delete_post($post_id, true);
2884 2884
 		} else {
2885 2885
 			/** This action is documented in wp-includes/post.php */
2886
-			do_action( 'wp_trash_post', $post_id );
2886
+			do_action('wp_trash_post', $post_id);
2887 2887
 
2888
-			add_post_meta( $post_id, '_wp_trash_meta_status', $post->post_status );
2889
-			add_post_meta( $post_id, '_wp_trash_meta_time', time() );
2888
+			add_post_meta($post_id, '_wp_trash_meta_status', $post->post_status);
2889
+			add_post_meta($post_id, '_wp_trash_meta_time', time());
2890 2890
 
2891 2891
 			$old_status = $post->post_status;
2892 2892
 			$new_status = 'trash';
2893
-			$wpdb->update( $wpdb->posts, array( 'post_status' => $new_status ), array( 'ID' => $post->ID ) );
2894
-			clean_post_cache( $post->ID );
2893
+			$wpdb->update($wpdb->posts, array('post_status' => $new_status), array('ID' => $post->ID));
2894
+			clean_post_cache($post->ID);
2895 2895
 
2896 2896
 			$post->post_status = $new_status;
2897
-			wp_transition_post_status( $new_status, $old_status, $post );
2897
+			wp_transition_post_status($new_status, $old_status, $post);
2898 2898
 
2899 2899
 			/** This action is documented in wp-includes/post.php */
2900
-			do_action( 'edit_post', $post->ID, $post );
2900
+			do_action('edit_post', $post->ID, $post);
2901 2901
 
2902 2902
 			/** This action is documented in wp-includes/post.php */
2903
-			do_action( "save_post_{$post->post_type}", $post->ID, $post, true );
2903
+			do_action("save_post_{$post->post_type}", $post->ID, $post, true);
2904 2904
 
2905 2905
 			/** This action is documented in wp-includes/post.php */
2906
-			do_action( 'save_post', $post->ID, $post, true );
2906
+			do_action('save_post', $post->ID, $post, true);
2907 2907
 
2908 2908
 			/** This action is documented in wp-includes/post.php */
2909
-			do_action( 'wp_insert_post', $post->ID, $post, true );
2909
+			do_action('wp_insert_post', $post->ID, $post, true);
2910 2910
 
2911 2911
 			/** This action is documented in wp-includes/post.php */
2912
-			do_action( 'trashed_post', $post_id );
2912
+			do_action('trashed_post', $post_id);
2913 2913
 		}
2914 2914
 	}
2915 2915
 }
@@ -2927,11 +2927,11 @@  discard block
 block discarded – undo
2927 2927
  * @param array $supplied_post_data An array of sanitized, but otherwise unmodified post data.
2928 2928
  * @returns array Filtered data.
2929 2929
  */
2930
-function _wp_customize_changeset_filter_insert_post_data( $post_data, $supplied_post_data ) {
2931
-	if ( isset( $post_data['post_type'] ) && 'customize_changeset' === $post_data['post_type'] ) {
2930
+function _wp_customize_changeset_filter_insert_post_data($post_data, $supplied_post_data) {
2931
+	if (isset($post_data['post_type']) && 'customize_changeset' === $post_data['post_type']) {
2932 2932
 
2933 2933
 		// Prevent post_name from being dropped, such as when contributor saves a changeset post as pending.
2934
-		if ( empty( $post_data['post_name'] ) && ! empty( $supplied_post_data['post_name'] ) ) {
2934
+		if (empty($post_data['post_name']) && ! empty($supplied_post_data['post_name'])) {
2935 2935
 			$post_data['post_name'] = $supplied_post_data['post_name'];
2936 2936
 		}
2937 2937
 	}
@@ -2944,33 +2944,33 @@  discard block
 block discarded – undo
2944 2944
  * @since 3.4.0
2945 2945
  */
2946 2946
 function _wp_customize_loader_settings() {
2947
-	$admin_origin = parse_url( admin_url() );
2948
-	$home_origin  = parse_url( home_url() );
2949
-	$cross_domain = ( strtolower( $admin_origin[ 'host' ] ) != strtolower( $home_origin[ 'host' ] ) );
2947
+	$admin_origin = parse_url(admin_url());
2948
+	$home_origin  = parse_url(home_url());
2949
+	$cross_domain = (strtolower($admin_origin['host']) != strtolower($home_origin['host']));
2950 2950
 
2951 2951
 	$browser = array(
2952 2952
 		'mobile' => wp_is_mobile(),
2953
-		'ios'    => wp_is_mobile() && preg_match( '/iPad|iPod|iPhone/', $_SERVER['HTTP_USER_AGENT'] ),
2953
+		'ios'    => wp_is_mobile() && preg_match('/iPad|iPod|iPhone/', $_SERVER['HTTP_USER_AGENT']),
2954 2954
 	);
2955 2955
 
2956 2956
 	$settings = array(
2957
-		'url'           => esc_url( admin_url( 'customize.php' ) ),
2957
+		'url'           => esc_url(admin_url('customize.php')),
2958 2958
 		'isCrossDomain' => $cross_domain,
2959 2959
 		'browser'       => $browser,
2960 2960
 		'l10n'          => array(
2961
-			'saveAlert'       => __( 'The changes you made will be lost if you navigate away from this page.' ),
2962
-			'mainIframeTitle' => __( 'Customizer' ),
2961
+			'saveAlert'       => __('The changes you made will be lost if you navigate away from this page.'),
2962
+			'mainIframeTitle' => __('Customizer'),
2963 2963
 		),
2964 2964
 	);
2965 2965
 
2966
-	$script = 'var _wpCustomizeLoaderSettings = ' . wp_json_encode( $settings ) . ';';
2966
+	$script = 'var _wpCustomizeLoaderSettings = '.wp_json_encode($settings).';';
2967 2967
 
2968 2968
 	$wp_scripts = wp_scripts();
2969
-	$data = $wp_scripts->get_data( 'customize-loader', 'data' );
2970
-	if ( $data )
2969
+	$data = $wp_scripts->get_data('customize-loader', 'data');
2970
+	if ($data)
2971 2971
 		$script = "$data\n$script";
2972 2972
 
2973
-	$wp_scripts->add_data( 'customize-loader', 'data', $script );
2973
+	$wp_scripts->add_data('customize-loader', 'data', $script);
2974 2974
 }
2975 2975
 
2976 2976
 /**
@@ -2982,11 +2982,11 @@  discard block
 block discarded – undo
2982 2982
  * 	                         The theme's stylesheet will be urlencoded if necessary.
2983 2983
  * @return string
2984 2984
  */
2985
-function wp_customize_url( $stylesheet = null ) {
2986
-	$url = admin_url( 'customize.php' );
2987
-	if ( $stylesheet )
2988
-		$url .= '?theme=' . urlencode( $stylesheet );
2989
-	return esc_url( $url );
2985
+function wp_customize_url($stylesheet = null) {
2986
+	$url = admin_url('customize.php');
2987
+	if ($stylesheet)
2988
+		$url .= '?theme='.urlencode($stylesheet);
2989
+	return esc_url($url);
2990 2990
 }
2991 2991
 
2992 2992
 /**
@@ -3006,9 +3006,9 @@  discard block
 block discarded – undo
3006 3006
  * @since 4.7.0 Support for IE8 and below is explicitly removed via conditional comments.
3007 3007
  */
3008 3008
 function wp_customize_support_script() {
3009
-	$admin_origin = parse_url( admin_url() );
3010
-	$home_origin  = parse_url( home_url() );
3011
-	$cross_domain = ( strtolower( $admin_origin[ 'host' ] ) != strtolower( $home_origin[ 'host' ] ) );
3009
+	$admin_origin = parse_url(admin_url());
3010
+	$home_origin  = parse_url(home_url());
3011
+	$cross_domain = (strtolower($admin_origin['host']) != strtolower($home_origin['host']));
3012 3012
 
3013 3013
 	?>
3014 3014
 	<!--[if lte IE 8]>
@@ -3021,7 +3021,7 @@  discard block
 block discarded – undo
3021 3021
 			(function() {
3022 3022
 				var request, b = document.body, c = 'className', cs = 'customize-support', rcs = new RegExp('(^|\\s+)(no-)?'+cs+'(\\s+|$)');
3023 3023
 
3024
-		<?php	if ( $cross_domain ) : ?>
3024
+		<?php	if ($cross_domain) : ?>
3025 3025
 				request = (function(){ var xhr = new XMLHttpRequest(); return ('withCredentials' in xhr); })();
3026 3026
 		<?php	else : ?>
3027 3027
 				request = true;
@@ -3048,5 +3048,5 @@  discard block
 block discarded – undo
3048 3048
 function is_customize_preview() {
3049 3049
 	global $wp_customize;
3050 3050
 
3051
-	return ( $wp_customize instanceof WP_Customize_Manager ) && $wp_customize->is_preview();
3051
+	return ($wp_customize instanceof WP_Customize_Manager) && $wp_customize->is_preview();
3052 3052
 }
Please login to merge, or discard this patch.
Braces   +292 added lines, -207 removed lines patch added patch discarded remove patch
@@ -41,41 +41,46 @@  discard block
 block discarded – undo
41 41
 		$current_theme = get_stylesheet();
42 42
 		if ( isset( $theme_directories[ $current_theme ] ) ) {
43 43
 			$root_of_current_theme = get_raw_theme_root( $current_theme );
44
-			if ( ! in_array( $root_of_current_theme, $wp_theme_directories ) )
45
-				$root_of_current_theme = WP_CONTENT_DIR . $root_of_current_theme;
44
+			if ( ! in_array( $root_of_current_theme, $wp_theme_directories ) ) {
45
+							$root_of_current_theme = WP_CONTENT_DIR . $root_of_current_theme;
46
+			}
46 47
 			$theme_directories[ $current_theme ]['theme_root'] = $root_of_current_theme;
47 48
 		}
48 49
 	}
49 50
 
50
-	if ( empty( $theme_directories ) )
51
-		return array();
51
+	if ( empty( $theme_directories ) ) {
52
+			return array();
53
+	}
52 54
 
53 55
 	if ( is_multisite() && null !== $args['allowed'] ) {
54 56
 		$allowed = $args['allowed'];
55
-		if ( 'network' === $allowed )
56
-			$theme_directories = array_intersect_key( $theme_directories, WP_Theme::get_allowed_on_network() );
57
-		elseif ( 'site' === $allowed )
58
-			$theme_directories = array_intersect_key( $theme_directories, WP_Theme::get_allowed_on_site( $args['blog_id'] ) );
59
-		elseif ( $allowed )
60
-			$theme_directories = array_intersect_key( $theme_directories, WP_Theme::get_allowed( $args['blog_id'] ) );
61
-		else
62
-			$theme_directories = array_diff_key( $theme_directories, WP_Theme::get_allowed( $args['blog_id'] ) );
57
+		if ( 'network' === $allowed ) {
58
+					$theme_directories = array_intersect_key( $theme_directories, WP_Theme::get_allowed_on_network() );
59
+		} elseif ( 'site' === $allowed ) {
60
+					$theme_directories = array_intersect_key( $theme_directories, WP_Theme::get_allowed_on_site( $args['blog_id'] ) );
61
+		} elseif ( $allowed ) {
62
+					$theme_directories = array_intersect_key( $theme_directories, WP_Theme::get_allowed( $args['blog_id'] ) );
63
+		} else {
64
+					$theme_directories = array_diff_key( $theme_directories, WP_Theme::get_allowed( $args['blog_id'] ) );
65
+		}
63 66
 	}
64 67
 
65 68
 	$themes = array();
66 69
 	static $_themes = array();
67 70
 
68 71
 	foreach ( $theme_directories as $theme => $theme_root ) {
69
-		if ( isset( $_themes[ $theme_root['theme_root'] . '/' . $theme ] ) )
70
-			$themes[ $theme ] = $_themes[ $theme_root['theme_root'] . '/' . $theme ];
71
-		else
72
-			$themes[ $theme ] = $_themes[ $theme_root['theme_root'] . '/' . $theme ] = new WP_Theme( $theme, $theme_root['theme_root'] );
72
+		if ( isset( $_themes[ $theme_root['theme_root'] . '/' . $theme ] ) ) {
73
+					$themes[ $theme ] = $_themes[ $theme_root['theme_root'] . '/' . $theme ];
74
+		} else {
75
+					$themes[ $theme ] = $_themes[ $theme_root['theme_root'] . '/' . $theme ] = new WP_Theme( $theme, $theme_root['theme_root'] );
76
+		}
73 77
 	}
74 78
 
75 79
 	if ( null !== $args['errors'] ) {
76 80
 		foreach ( $themes as $theme => $wp_theme ) {
77
-			if ( $wp_theme->errors() != $args['errors'] )
78
-				unset( $themes[ $theme ] );
81
+			if ( $wp_theme->errors() != $args['errors'] ) {
82
+							unset( $themes[ $theme ] );
83
+			}
79 84
 		}
80 85
 	}
81 86
 
@@ -97,15 +102,17 @@  discard block
 block discarded – undo
97 102
 function wp_get_theme( $stylesheet = null, $theme_root = null ) {
98 103
 	global $wp_theme_directories;
99 104
 
100
-	if ( empty( $stylesheet ) )
101
-		$stylesheet = get_stylesheet();
105
+	if ( empty( $stylesheet ) ) {
106
+			$stylesheet = get_stylesheet();
107
+	}
102 108
 
103 109
 	if ( empty( $theme_root ) ) {
104 110
 		$theme_root = get_raw_theme_root( $stylesheet );
105
-		if ( false === $theme_root )
106
-			$theme_root = WP_CONTENT_DIR . '/themes';
107
-		elseif ( ! in_array( $theme_root, (array) $wp_theme_directories ) )
108
-			$theme_root = WP_CONTENT_DIR . $theme_root;
111
+		if ( false === $theme_root ) {
112
+					$theme_root = WP_CONTENT_DIR . '/themes';
113
+		} elseif ( ! in_array( $theme_root, (array) $wp_theme_directories ) ) {
114
+					$theme_root = WP_CONTENT_DIR . $theme_root;
115
+		}
109 116
 	}
110 117
 
111 118
 	return new WP_Theme( $stylesheet, $theme_root );
@@ -118,12 +125,14 @@  discard block
 block discarded – undo
118 125
  * @param bool $clear_update_cache Whether to clear the Theme updates cache
119 126
  */
120 127
 function wp_clean_themes_cache( $clear_update_cache = true ) {
121
-	if ( $clear_update_cache )
122
-		delete_site_transient( 'update_themes' );
128
+	if ( $clear_update_cache ) {
129
+			delete_site_transient( 'update_themes' );
130
+	}
123 131
 	search_theme_directories( true );
124
-	foreach ( wp_get_themes( array( 'errors' => null ) ) as $theme )
125
-		$theme->cache_delete();
126
-}
132
+	foreach ( wp_get_themes( array( 'errors' => null ) ) as $theme ) {
133
+			$theme->cache_delete();
134
+	}
135
+	}
127 136
 
128 137
 /**
129 138
  * Whether a child theme is in use.
@@ -258,12 +267,13 @@  discard block
 block discarded – undo
258 267
 	$stylesheet_dir_uri = get_stylesheet_directory_uri();
259 268
 	$dir = get_stylesheet_directory();
260 269
 	$locale = get_locale();
261
-	if ( file_exists("$dir/$locale.css") )
262
-		$stylesheet_uri = "$stylesheet_dir_uri/$locale.css";
263
-	elseif ( !empty($wp_locale->text_direction) && file_exists("$dir/{$wp_locale->text_direction}.css") )
264
-		$stylesheet_uri = "$stylesheet_dir_uri/{$wp_locale->text_direction}.css";
265
-	else
266
-		$stylesheet_uri = '';
270
+	if ( file_exists("$dir/$locale.css") ) {
271
+			$stylesheet_uri = "$stylesheet_dir_uri/$locale.css";
272
+	} elseif ( !empty($wp_locale->text_direction) && file_exists("$dir/{$wp_locale->text_direction}.css") ) {
273
+			$stylesheet_uri = "$stylesheet_dir_uri/{$wp_locale->text_direction}.css";
274
+	} else {
275
+			$stylesheet_uri = '';
276
+	}
267 277
 	/**
268 278
 	 * Filters the localized stylesheet URI.
269 279
 	 *
@@ -353,8 +363,9 @@  discard block
 block discarded – undo
353 363
 function get_theme_roots() {
354 364
 	global $wp_theme_directories;
355 365
 
356
-	if ( count($wp_theme_directories) <= 1 )
357
-		return '/themes';
366
+	if ( count($wp_theme_directories) <= 1 ) {
367
+			return '/themes';
368
+	}
358 369
 
359 370
 	$theme_roots = get_site_transient( 'theme_roots' );
360 371
 	if ( false === $theme_roots ) {
@@ -413,11 +424,13 @@  discard block
 block discarded – undo
413 424
 	global $wp_theme_directories;
414 425
 	static $found_themes = null;
415 426
 
416
-	if ( empty( $wp_theme_directories ) )
417
-		return false;
427
+	if ( empty( $wp_theme_directories ) ) {
428
+			return false;
429
+	}
418 430
 
419
-	if ( ! $force && isset( $found_themes ) )
420
-		return $found_themes;
431
+	if ( ! $force && isset( $found_themes ) ) {
432
+			return $found_themes;
433
+	}
421 434
 
422 435
 	$found_themes = array();
423 436
 
@@ -428,10 +441,11 @@  discard block
 block discarded – undo
428 441
 	// We always want to return absolute, but we need to cache relative
429 442
 	// to use in get_theme_root().
430 443
 	foreach ( $wp_theme_directories as $theme_root ) {
431
-		if ( 0 === strpos( $theme_root, WP_CONTENT_DIR ) )
432
-			$relative_theme_roots[ str_replace( WP_CONTENT_DIR, '', $theme_root ) ] = $theme_root;
433
-		else
434
-			$relative_theme_roots[ $theme_root ] = $theme_root;
444
+		if ( 0 === strpos( $theme_root, WP_CONTENT_DIR ) ) {
445
+					$relative_theme_roots[ str_replace( WP_CONTENT_DIR, '', $theme_root ) ] = $theme_root;
446
+		} else {
447
+					$relative_theme_roots[ $theme_root ] = $theme_root;
448
+		}
435 449
 	}
436 450
 
437 451
 	/**
@@ -447,8 +461,9 @@  discard block
 block discarded – undo
447 461
 		if ( is_array( $cached_roots ) ) {
448 462
 			foreach ( $cached_roots as $theme_dir => $theme_root ) {
449 463
 				// A cached theme root is no longer around, so skip it.
450
-				if ( ! isset( $relative_theme_roots[ $theme_root ] ) )
451
-					continue;
464
+				if ( ! isset( $relative_theme_roots[ $theme_root ] ) ) {
465
+									continue;
466
+				}
452 467
 				$found_themes[ $theme_dir ] = array(
453 468
 					'theme_file' => $theme_dir . '/style.css',
454 469
 					'theme_root' => $relative_theme_roots[ $theme_root ], // Convert relative to absolute.
@@ -456,8 +471,10 @@  discard block
 block discarded – undo
456 471
 			}
457 472
 			return $found_themes;
458 473
 		}
459
-		if ( ! is_int( $cache_expiration ) )
460
-			$cache_expiration = 1800; // half hour
474
+		if ( ! is_int( $cache_expiration ) ) {
475
+					$cache_expiration = 1800;
476
+		}
477
+		// half hour
461 478
 	} else {
462 479
 		$cache_expiration = 1800; // half hour
463 480
 	}
@@ -472,8 +489,9 @@  discard block
 block discarded – undo
472 489
 			continue;
473 490
 		}
474 491
 		foreach ( $dirs as $dir ) {
475
-			if ( ! is_dir( $theme_root . '/' . $dir ) || $dir[0] == '.' || $dir == 'CVS' )
476
-				continue;
492
+			if ( ! is_dir( $theme_root . '/' . $dir ) || $dir[0] == '.' || $dir == 'CVS' ) {
493
+							continue;
494
+			}
477 495
 			if ( file_exists( $theme_root . '/' . $dir . '/style.css' ) ) {
478 496
 				// wp-content/themes/a-single-theme
479 497
 				// wp-content/themes is $theme_root, a-single-theme is $dir
@@ -491,10 +509,12 @@  discard block
 block discarded – undo
491 509
 					continue;
492 510
 				}
493 511
 				foreach ( $sub_dirs as $sub_dir ) {
494
-					if ( ! is_dir( $theme_root . '/' . $dir . '/' . $sub_dir ) || $dir[0] == '.' || $dir == 'CVS' )
495
-						continue;
496
-					if ( ! file_exists( $theme_root . '/' . $dir . '/' . $sub_dir . '/style.css' ) )
497
-						continue;
512
+					if ( ! is_dir( $theme_root . '/' . $dir . '/' . $sub_dir ) || $dir[0] == '.' || $dir == 'CVS' ) {
513
+											continue;
514
+					}
515
+					if ( ! file_exists( $theme_root . '/' . $dir . '/' . $sub_dir . '/style.css' ) ) {
516
+											continue;
517
+					}
498 518
 					$found_themes[ $dir . '/' . $sub_dir ] = array(
499 519
 						'theme_file' => $dir . '/' . $sub_dir . '/style.css',
500 520
 						'theme_root' => $theme_root,
@@ -503,11 +523,12 @@  discard block
 block discarded – undo
503 523
 				}
504 524
 				// Never mind the above, it's just a theme missing a style.css.
505 525
 				// Return it; WP_Theme will catch the error.
506
-				if ( ! $found_theme )
507
-					$found_themes[ $dir ] = array(
526
+				if ( ! $found_theme ) {
527
+									$found_themes[ $dir ] = array(
508 528
 						'theme_file' => $dir . '/style.css',
509 529
 						'theme_root' => $theme_root,
510 530
 					);
531
+				}
511 532
 			}
512 533
 		}
513 534
 	}
@@ -521,8 +542,9 @@  discard block
 block discarded – undo
521 542
 		$theme_roots[ $theme_dir ] = $relative_theme_roots[ $theme_data['theme_root'] ]; // Convert absolute to relative.
522 543
 	}
523 544
 
524
-	if ( $theme_roots != get_site_transient( 'theme_roots' ) )
525
-		set_site_transient( 'theme_roots', $theme_roots, $cache_expiration );
545
+	if ( $theme_roots != get_site_transient( 'theme_roots' ) ) {
546
+			set_site_transient( 'theme_roots', $theme_roots, $cache_expiration );
547
+	}
526 548
 
527 549
 	return $found_themes;
528 550
 }
@@ -545,8 +567,9 @@  discard block
 block discarded – undo
545 567
 	if ( $stylesheet_or_template && $theme_root = get_raw_theme_root( $stylesheet_or_template ) ) {
546 568
 		// Always prepend WP_CONTENT_DIR unless the root currently registered as a theme directory.
547 569
 		// This gives relative theme roots the benefit of the doubt when things go haywire.
548
-		if ( ! in_array( $theme_root, (array) $wp_theme_directories ) )
549
-			$theme_root = WP_CONTENT_DIR . $theme_root;
570
+		if ( ! in_array( $theme_root, (array) $wp_theme_directories ) ) {
571
+					$theme_root = WP_CONTENT_DIR . $theme_root;
572
+		}
550 573
 	} else {
551 574
 		$theme_root = WP_CONTENT_DIR . '/themes';
552 575
 	}
@@ -579,20 +602,22 @@  discard block
 block discarded – undo
579 602
 function get_theme_root_uri( $stylesheet_or_template = false, $theme_root = false ) {
580 603
 	global $wp_theme_directories;
581 604
 
582
-	if ( $stylesheet_or_template && ! $theme_root )
583
-		$theme_root = get_raw_theme_root( $stylesheet_or_template );
605
+	if ( $stylesheet_or_template && ! $theme_root ) {
606
+			$theme_root = get_raw_theme_root( $stylesheet_or_template );
607
+	}
584 608
 
585 609
 	if ( $stylesheet_or_template && $theme_root ) {
586 610
 		if ( in_array( $theme_root, (array) $wp_theme_directories ) ) {
587 611
 			// Absolute path. Make an educated guess. YMMV -- but note the filter below.
588
-			if ( 0 === strpos( $theme_root, WP_CONTENT_DIR ) )
589
-				$theme_root_uri = content_url( str_replace( WP_CONTENT_DIR, '', $theme_root ) );
590
-			elseif ( 0 === strpos( $theme_root, ABSPATH ) )
591
-				$theme_root_uri = site_url( str_replace( ABSPATH, '', $theme_root ) );
592
-			elseif ( 0 === strpos( $theme_root, WP_PLUGIN_DIR ) || 0 === strpos( $theme_root, WPMU_PLUGIN_DIR ) )
593
-				$theme_root_uri = plugins_url( basename( $theme_root ), $theme_root );
594
-			else
595
-				$theme_root_uri = $theme_root;
612
+			if ( 0 === strpos( $theme_root, WP_CONTENT_DIR ) ) {
613
+							$theme_root_uri = content_url( str_replace( WP_CONTENT_DIR, '', $theme_root ) );
614
+			} elseif ( 0 === strpos( $theme_root, ABSPATH ) ) {
615
+							$theme_root_uri = site_url( str_replace( ABSPATH, '', $theme_root ) );
616
+			} elseif ( 0 === strpos( $theme_root, WP_PLUGIN_DIR ) || 0 === strpos( $theme_root, WPMU_PLUGIN_DIR ) ) {
617
+							$theme_root_uri = plugins_url( basename( $theme_root ), $theme_root );
618
+			} else {
619
+							$theme_root_uri = $theme_root;
620
+			}
596 621
 		} else {
597 622
 			$theme_root_uri = content_url( $theme_root );
598 623
 		}
@@ -627,23 +652,26 @@  discard block
 block discarded – undo
627 652
 function get_raw_theme_root( $stylesheet_or_template, $skip_cache = false ) {
628 653
 	global $wp_theme_directories;
629 654
 
630
-	if ( count($wp_theme_directories) <= 1 )
631
-		return '/themes';
655
+	if ( count($wp_theme_directories) <= 1 ) {
656
+			return '/themes';
657
+	}
632 658
 
633 659
 	$theme_root = false;
634 660
 
635 661
 	// If requesting the root for the current theme, consult options to avoid calling get_theme_roots()
636 662
 	if ( ! $skip_cache ) {
637
-		if ( get_option('stylesheet') == $stylesheet_or_template )
638
-			$theme_root = get_option('stylesheet_root');
639
-		elseif ( get_option('template') == $stylesheet_or_template )
640
-			$theme_root = get_option('template_root');
663
+		if ( get_option('stylesheet') == $stylesheet_or_template ) {
664
+					$theme_root = get_option('stylesheet_root');
665
+		} elseif ( get_option('template') == $stylesheet_or_template ) {
666
+					$theme_root = get_option('template_root');
667
+		}
641 668
 	}
642 669
 
643 670
 	if ( empty($theme_root) ) {
644 671
 		$theme_roots = get_theme_roots();
645
-		if ( !empty($theme_roots[$stylesheet_or_template]) )
646
-			$theme_root = $theme_roots[$stylesheet_or_template];
672
+		if ( !empty($theme_roots[$stylesheet_or_template]) ) {
673
+					$theme_root = $theme_roots[$stylesheet_or_template];
674
+		}
647 675
 	}
648 676
 
649 677
 	return $theme_root;
@@ -656,8 +684,9 @@  discard block
 block discarded – undo
656 684
  */
657 685
 function locale_stylesheet() {
658 686
 	$stylesheet = get_locale_stylesheet_uri();
659
-	if ( empty($stylesheet) )
660
-		return;
687
+	if ( empty($stylesheet) ) {
688
+			return;
689
+	}
661 690
 	echo '<link rel="stylesheet" href="' . $stylesheet . '" type="text/css" media="screen" />';
662 691
 }
663 692
 
@@ -777,8 +806,9 @@  discard block
 block discarded – undo
777 806
 	 *
778 807
 	 * @param bool $validate Whether to validate the current theme. Default true.
779 808
 	 */
780
-	if ( wp_installing() || ! apply_filters( 'validate_current_theme', true ) )
781
-		return true;
809
+	if ( wp_installing() || ! apply_filters( 'validate_current_theme', true ) ) {
810
+			return true;
811
+	}
782 812
 
783 813
 	if ( ! file_exists( get_template_directory() . '/index.php' ) ) {
784 814
 		// Invalid.
@@ -827,8 +857,9 @@  discard block
 block discarded – undo
827 857
 	$mods = get_option( "theme_mods_$theme_slug" );
828 858
 	if ( false === $mods ) {
829 859
 		$theme_name = get_option( 'current_theme' );
830
-		if ( false === $theme_name )
831
-			$theme_name = wp_get_theme()->get('Name');
860
+		if ( false === $theme_name ) {
861
+					$theme_name = wp_get_theme()->get('Name');
862
+		}
832 863
 		$mods = get_option( "mods_$theme_name" ); // Deprecated location.
833 864
 		if ( is_admin() && false !== $mods ) {
834 865
 			update_option( "theme_mods_$theme_slug", $mods );
@@ -871,8 +902,9 @@  discard block
 block discarded – undo
871 902
 		return apply_filters( "theme_mod_{$name}", $mods[$name] );
872 903
 	}
873 904
 
874
-	if ( is_string( $default ) )
875
-		$default = sprintf( $default, get_template_directory_uri(), get_stylesheet_directory_uri() );
905
+	if ( is_string( $default ) ) {
906
+			$default = sprintf( $default, get_template_directory_uri(), get_stylesheet_directory_uri() );
907
+	}
876 908
 
877 909
 	/** This filter is documented in wp-includes/theme.php */
878 910
 	return apply_filters( "theme_mod_{$name}", $default );
@@ -921,8 +953,9 @@  discard block
 block discarded – undo
921 953
 function remove_theme_mod( $name ) {
922 954
 	$mods = get_theme_mods();
923 955
 
924
-	if ( ! isset( $mods[ $name ] ) )
925
-		return;
956
+	if ( ! isset( $mods[ $name ] ) ) {
957
+			return;
958
+	}
926 959
 
927 960
 	unset( $mods[ $name ] );
928 961
 
@@ -944,8 +977,9 @@  discard block
 block discarded – undo
944 977
 
945 978
 	// Old style.
946 979
 	$theme_name = get_option( 'current_theme' );
947
-	if ( false === $theme_name )
948
-		$theme_name = wp_get_theme()->get('Name');
980
+	if ( false === $theme_name ) {
981
+			$theme_name = wp_get_theme()->get('Name');
982
+	}
949 983
 	delete_option( 'mods_' . $theme_name );
950 984
 }
951 985
 
@@ -977,8 +1011,9 @@  discard block
 block discarded – undo
977 1011
  * @return bool
978 1012
  */
979 1013
 function display_header_text() {
980
-	if ( ! current_theme_supports( 'custom-header', 'header-text' ) )
981
-		return false;
1014
+	if ( ! current_theme_supports( 'custom-header', 'header-text' ) ) {
1015
+			return false;
1016
+	}
982 1017
 
983 1018
 	$text_color = get_theme_mod( 'header_textcolor', get_theme_support( 'custom-header', 'default-text-color' ) );
984 1019
 	return 'blank' !== $text_color;
@@ -1007,11 +1042,13 @@  discard block
 block discarded – undo
1007 1042
 function get_header_image() {
1008 1043
 	$url = get_theme_mod( 'header_image', get_theme_support( 'custom-header', 'default-image' ) );
1009 1044
 
1010
-	if ( 'remove-header' == $url )
1011
-		return false;
1045
+	if ( 'remove-header' == $url ) {
1046
+			return false;
1047
+	}
1012 1048
 
1013
-	if ( is_random_header_image() )
1014
-		$url = get_random_header_image();
1049
+	if ( is_random_header_image() ) {
1050
+			$url = get_random_header_image();
1051
+	}
1015 1052
 
1016 1053
 	return esc_url_raw( set_url_scheme( $url ) );
1017 1054
 }
@@ -1114,19 +1151,21 @@  discard block
 block discarded – undo
1114 1151
 		$header_image_mod = get_theme_mod( 'header_image', '' );
1115 1152
 		$headers = array();
1116 1153
 
1117
-		if ( 'random-uploaded-image' == $header_image_mod )
1118
-			$headers = get_uploaded_header_images();
1119
-		elseif ( ! empty( $_wp_default_headers ) ) {
1154
+		if ( 'random-uploaded-image' == $header_image_mod ) {
1155
+					$headers = get_uploaded_header_images();
1156
+		} elseif ( ! empty( $_wp_default_headers ) ) {
1120 1157
 			if ( 'random-default-image' == $header_image_mod ) {
1121 1158
 				$headers = $_wp_default_headers;
1122 1159
 			} else {
1123
-				if ( current_theme_supports( 'custom-header', 'random-default' ) )
1124
-					$headers = $_wp_default_headers;
1160
+				if ( current_theme_supports( 'custom-header', 'random-default' ) ) {
1161
+									$headers = $_wp_default_headers;
1162
+				}
1125 1163
 			}
1126 1164
 		}
1127 1165
 
1128
-		if ( empty( $headers ) )
1129
-			return new stdClass;
1166
+		if ( empty( $headers ) ) {
1167
+					return new stdClass;
1168
+		}
1130 1169
 
1131 1170
 		$_wp_random_header = (object) $headers[ array_rand( $headers ) ];
1132 1171
 
@@ -1145,8 +1184,9 @@  discard block
 block discarded – undo
1145 1184
  */
1146 1185
 function get_random_header_image() {
1147 1186
 	$random_image = _get_random_header_data();
1148
-	if ( empty( $random_image->url ) )
1149
-		return '';
1187
+	if ( empty( $random_image->url ) ) {
1188
+			return '';
1189
+	}
1150 1190
 	return $random_image->url;
1151 1191
 }
1152 1192
 
@@ -1166,13 +1206,15 @@  discard block
 block discarded – undo
1166 1206
 	$header_image_mod = get_theme_mod( 'header_image', get_theme_support( 'custom-header', 'default-image' ) );
1167 1207
 
1168 1208
 	if ( 'any' == $type ) {
1169
-		if ( 'random-default-image' == $header_image_mod || 'random-uploaded-image' == $header_image_mod || ( '' != get_random_header_image() && empty( $header_image_mod ) ) )
1170
-			return true;
1209
+		if ( 'random-default-image' == $header_image_mod || 'random-uploaded-image' == $header_image_mod || ( '' != get_random_header_image() && empty( $header_image_mod ) ) ) {
1210
+					return true;
1211
+		}
1171 1212
 	} else {
1172
-		if ( "random-$type-image" == $header_image_mod )
1173
-			return true;
1174
-		elseif ( 'default' == $type && empty( $header_image_mod ) && '' != get_random_header_image() )
1175
-			return true;
1213
+		if ( "random-$type-image" == $header_image_mod ) {
1214
+					return true;
1215
+		} elseif ( 'default' == $type && empty( $header_image_mod ) && '' != get_random_header_image() ) {
1216
+					return true;
1217
+		}
1176 1218
 	}
1177 1219
 
1178 1220
 	return false;
@@ -1203,8 +1245,9 @@  discard block
 block discarded – undo
1203 1245
 	// @todo caching
1204 1246
 	$headers = get_posts( array( 'post_type' => 'attachment', 'meta_key' => '_wp_attachment_is_custom_header', 'meta_value' => get_option('stylesheet'), 'orderby' => 'none', 'nopaging' => true ) );
1205 1247
 
1206
-	if ( empty( $headers ) )
1207
-		return array();
1248
+	if ( empty( $headers ) ) {
1249
+			return array();
1250
+	}
1208 1251
 
1209 1252
 	foreach ( (array) $headers as $header ) {
1210 1253
 		$url = esc_url_raw( wp_get_attachment_url( $header->ID ) );
@@ -1217,10 +1260,12 @@  discard block
 block discarded – undo
1217 1260
 		$header_images[$header_index]['thumbnail_url'] = $url;
1218 1261
 		$header_images[$header_index]['alt_text'] = get_post_meta( $header->ID, '_wp_attachment_image_alt', true );
1219 1262
 
1220
-		if ( isset( $header_data['width'] ) )
1221
-			$header_images[$header_index]['width'] = $header_data['width'];
1222
-		if ( isset( $header_data['height'] ) )
1223
-			$header_images[$header_index]['height'] = $header_data['height'];
1263
+		if ( isset( $header_data['width'] ) ) {
1264
+					$header_images[$header_index]['width'] = $header_data['width'];
1265
+		}
1266
+		if ( isset( $header_data['height'] ) ) {
1267
+					$header_images[$header_index]['height'] = $header_data['height'];
1268
+		}
1224 1269
 	}
1225 1270
 
1226 1271
 	return $header_images;
@@ -1831,8 +1876,9 @@  discard block
 block discarded – undo
1831 1876
 function add_editor_style( $stylesheet = 'editor-style.css' ) {
1832 1877
 	add_theme_support( 'editor-style' );
1833 1878
 
1834
-	if ( ! is_admin() )
1835
-		return;
1879
+	if ( ! is_admin() ) {
1880
+			return;
1881
+	}
1836 1882
 
1837 1883
 	global $editor_styles;
1838 1884
 	$editor_styles = (array) $editor_styles;
@@ -1855,11 +1901,13 @@  discard block
 block discarded – undo
1855 1901
  * @return bool True on success, false if there were no stylesheets to remove.
1856 1902
  */
1857 1903
 function remove_editor_styles() {
1858
-	if ( ! current_theme_supports( 'editor-style' ) )
1859
-		return false;
1904
+	if ( ! current_theme_supports( 'editor-style' ) ) {
1905
+			return false;
1906
+	}
1860 1907
 	_remove_theme_support( 'editor-style' );
1861
-	if ( is_admin() )
1862
-		$GLOBALS['editor_styles'] = array();
1908
+	if ( is_admin() ) {
1909
+			$GLOBALS['editor_styles'] = array();
1910
+	}
1863 1911
 	return true;
1864 1912
 }
1865 1913
 
@@ -2214,10 +2262,11 @@  discard block
 block discarded – undo
2214 2262
 function add_theme_support( $feature ) {
2215 2263
 	global $_wp_theme_features;
2216 2264
 
2217
-	if ( func_num_args() == 1 )
2218
-		$args = true;
2219
-	else
2220
-		$args = array_slice( func_get_args(), 1 );
2265
+	if ( func_num_args() == 1 ) {
2266
+			$args = true;
2267
+	} else {
2268
+			$args = array_slice( func_get_args(), 1 );
2269
+	}
2221 2270
 
2222 2271
 	switch ( $feature ) {
2223 2272
 		case 'post-thumbnails':
@@ -2256,8 +2305,9 @@  discard block
 block discarded – undo
2256 2305
 			}
2257 2306
 
2258 2307
 			// Calling 'html5' again merges, rather than overwrites.
2259
-			if ( isset( $_wp_theme_features['html5'] ) )
2260
-				$args[0] = array_merge( $_wp_theme_features['html5'][0], $args[0] );
2308
+			if ( isset( $_wp_theme_features['html5'] ) ) {
2309
+							$args[0] = array_merge( $_wp_theme_features['html5'][0], $args[0] );
2310
+			}
2261 2311
 			break;
2262 2312
 
2263 2313
 		case 'custom-logo':
@@ -2284,8 +2334,9 @@  discard block
 block discarded – undo
2284 2334
 			return add_theme_support( 'custom-header', array( 'uploads' => true ) );
2285 2335
 
2286 2336
 		case 'custom-header' :
2287
-			if ( ! is_array( $args ) )
2288
-				$args = array( 0 => array() );
2337
+			if ( ! is_array( $args ) ) {
2338
+							$args = array( 0 => array() );
2339
+			}
2289 2340
 
2290 2341
 			$defaults = array(
2291 2342
 				'default-image' => '',
@@ -2309,13 +2360,15 @@  discard block
 block discarded – undo
2309 2360
 
2310 2361
 			// Merge in data from previous add_theme_support() calls.
2311 2362
 			// The first value registered wins. (A child theme is set up first.)
2312
-			if ( isset( $_wp_theme_features['custom-header'] ) )
2313
-				$args[0] = wp_parse_args( $_wp_theme_features['custom-header'][0], $args[0] );
2363
+			if ( isset( $_wp_theme_features['custom-header'] ) ) {
2364
+							$args[0] = wp_parse_args( $_wp_theme_features['custom-header'][0], $args[0] );
2365
+			}
2314 2366
 
2315 2367
 			// Load in the defaults at the end, as we need to insure first one wins.
2316 2368
 			// This will cause all constants to be defined, as each arg will then be set to the default.
2317
-			if ( $jit )
2318
-				$args[0] = wp_parse_args( $args[0], $defaults );
2369
+			if ( $jit ) {
2370
+							$args[0] = wp_parse_args( $args[0], $defaults );
2371
+			}
2319 2372
 
2320 2373
 			// If a constant was defined, use that value. Otherwise, define the constant to ensure
2321 2374
 			// the constant is always accurate (and is not defined later,  overriding our value).
@@ -2323,48 +2376,57 @@  discard block
 block discarded – undo
2323 2376
 			// Once we get to wp_loaded (just-in-time), define any constants we haven't already.
2324 2377
 			// Constants are lame. Don't reference them. This is just for backward compatibility.
2325 2378
 
2326
-			if ( defined( 'NO_HEADER_TEXT' ) )
2327
-				$args[0]['header-text'] = ! NO_HEADER_TEXT;
2328
-			elseif ( isset( $args[0]['header-text'] ) )
2329
-				define( 'NO_HEADER_TEXT', empty( $args[0]['header-text'] ) );
2379
+			if ( defined( 'NO_HEADER_TEXT' ) ) {
2380
+							$args[0]['header-text'] = ! NO_HEADER_TEXT;
2381
+			} elseif ( isset( $args[0]['header-text'] ) ) {
2382
+							define( 'NO_HEADER_TEXT', empty( $args[0]['header-text'] ) );
2383
+			}
2330 2384
 
2331
-			if ( defined( 'HEADER_IMAGE_WIDTH' ) )
2332
-				$args[0]['width'] = (int) HEADER_IMAGE_WIDTH;
2333
-			elseif ( isset( $args[0]['width'] ) )
2334
-				define( 'HEADER_IMAGE_WIDTH', (int) $args[0]['width'] );
2385
+			if ( defined( 'HEADER_IMAGE_WIDTH' ) ) {
2386
+							$args[0]['width'] = (int) HEADER_IMAGE_WIDTH;
2387
+			} elseif ( isset( $args[0]['width'] ) ) {
2388
+							define( 'HEADER_IMAGE_WIDTH', (int) $args[0]['width'] );
2389
+			}
2335 2390
 
2336
-			if ( defined( 'HEADER_IMAGE_HEIGHT' ) )
2337
-				$args[0]['height'] = (int) HEADER_IMAGE_HEIGHT;
2338
-			elseif ( isset( $args[0]['height'] ) )
2339
-				define( 'HEADER_IMAGE_HEIGHT', (int) $args[0]['height'] );
2391
+			if ( defined( 'HEADER_IMAGE_HEIGHT' ) ) {
2392
+							$args[0]['height'] = (int) HEADER_IMAGE_HEIGHT;
2393
+			} elseif ( isset( $args[0]['height'] ) ) {
2394
+							define( 'HEADER_IMAGE_HEIGHT', (int) $args[0]['height'] );
2395
+			}
2340 2396
 
2341
-			if ( defined( 'HEADER_TEXTCOLOR' ) )
2342
-				$args[0]['default-text-color'] = HEADER_TEXTCOLOR;
2343
-			elseif ( isset( $args[0]['default-text-color'] ) )
2344
-				define( 'HEADER_TEXTCOLOR', $args[0]['default-text-color'] );
2397
+			if ( defined( 'HEADER_TEXTCOLOR' ) ) {
2398
+							$args[0]['default-text-color'] = HEADER_TEXTCOLOR;
2399
+			} elseif ( isset( $args[0]['default-text-color'] ) ) {
2400
+							define( 'HEADER_TEXTCOLOR', $args[0]['default-text-color'] );
2401
+			}
2345 2402
 
2346
-			if ( defined( 'HEADER_IMAGE' ) )
2347
-				$args[0]['default-image'] = HEADER_IMAGE;
2348
-			elseif ( isset( $args[0]['default-image'] ) )
2349
-				define( 'HEADER_IMAGE', $args[0]['default-image'] );
2403
+			if ( defined( 'HEADER_IMAGE' ) ) {
2404
+							$args[0]['default-image'] = HEADER_IMAGE;
2405
+			} elseif ( isset( $args[0]['default-image'] ) ) {
2406
+							define( 'HEADER_IMAGE', $args[0]['default-image'] );
2407
+			}
2350 2408
 
2351
-			if ( $jit && ! empty( $args[0]['default-image'] ) )
2352
-				$args[0]['random-default'] = false;
2409
+			if ( $jit && ! empty( $args[0]['default-image'] ) ) {
2410
+							$args[0]['random-default'] = false;
2411
+			}
2353 2412
 
2354 2413
 			// If headers are supported, and we still don't have a defined width or height,
2355 2414
 			// we have implicit flex sizes.
2356 2415
 			if ( $jit ) {
2357
-				if ( empty( $args[0]['width'] ) && empty( $args[0]['flex-width'] ) )
2358
-					$args[0]['flex-width'] = true;
2359
-				if ( empty( $args[0]['height'] ) && empty( $args[0]['flex-height'] ) )
2360
-					$args[0]['flex-height'] = true;
2416
+				if ( empty( $args[0]['width'] ) && empty( $args[0]['flex-width'] ) ) {
2417
+									$args[0]['flex-width'] = true;
2418
+				}
2419
+				if ( empty( $args[0]['height'] ) && empty( $args[0]['flex-height'] ) ) {
2420
+									$args[0]['flex-height'] = true;
2421
+				}
2361 2422
 			}
2362 2423
 
2363 2424
 			break;
2364 2425
 
2365 2426
 		case 'custom-background' :
2366
-			if ( ! is_array( $args ) )
2367
-				$args = array( 0 => array() );
2427
+			if ( ! is_array( $args ) ) {
2428
+							$args = array( 0 => array() );
2429
+			}
2368 2430
 
2369 2431
 			$defaults = array(
2370 2432
 				'default-image'          => '',
@@ -2384,21 +2446,25 @@  discard block
 block discarded – undo
2384 2446
 			unset( $args[0]['__jit'] );
2385 2447
 
2386 2448
 			// Merge in data from previous add_theme_support() calls. The first value registered wins.
2387
-			if ( isset( $_wp_theme_features['custom-background'] ) )
2388
-				$args[0] = wp_parse_args( $_wp_theme_features['custom-background'][0], $args[0] );
2449
+			if ( isset( $_wp_theme_features['custom-background'] ) ) {
2450
+							$args[0] = wp_parse_args( $_wp_theme_features['custom-background'][0], $args[0] );
2451
+			}
2389 2452
 
2390
-			if ( $jit )
2391
-				$args[0] = wp_parse_args( $args[0], $defaults );
2453
+			if ( $jit ) {
2454
+							$args[0] = wp_parse_args( $args[0], $defaults );
2455
+			}
2392 2456
 
2393
-			if ( defined( 'BACKGROUND_COLOR' ) )
2394
-				$args[0]['default-color'] = BACKGROUND_COLOR;
2395
-			elseif ( isset( $args[0]['default-color'] ) || $jit )
2396
-				define( 'BACKGROUND_COLOR', $args[0]['default-color'] );
2457
+			if ( defined( 'BACKGROUND_COLOR' ) ) {
2458
+							$args[0]['default-color'] = BACKGROUND_COLOR;
2459
+			} elseif ( isset( $args[0]['default-color'] ) || $jit ) {
2460
+							define( 'BACKGROUND_COLOR', $args[0]['default-color'] );
2461
+			}
2397 2462
 
2398
-			if ( defined( 'BACKGROUND_IMAGE' ) )
2399
-				$args[0]['default-image'] = BACKGROUND_IMAGE;
2400
-			elseif ( isset( $args[0]['default-image'] ) || $jit )
2401
-				define( 'BACKGROUND_IMAGE', $args[0]['default-image'] );
2463
+			if ( defined( 'BACKGROUND_IMAGE' ) ) {
2464
+							$args[0]['default-image'] = BACKGROUND_IMAGE;
2465
+			} elseif ( isset( $args[0]['default-image'] ) || $jit ) {
2466
+							define( 'BACKGROUND_IMAGE', $args[0]['default-image'] );
2467
+			}
2402 2468
 
2403 2469
 			break;
2404 2470
 
@@ -2434,8 +2500,9 @@  discard block
 block discarded – undo
2434 2500
 		add_theme_support( 'custom-header', array( '__jit' => true ) );
2435 2501
 
2436 2502
 		$args = get_theme_support( 'custom-header' );
2437
-		if ( $args[0]['wp-head-callback'] )
2438
-			add_action( 'wp_head', $args[0]['wp-head-callback'] );
2503
+		if ( $args[0]['wp-head-callback'] ) {
2504
+					add_action( 'wp_head', $args[0]['wp-head-callback'] );
2505
+		}
2439 2506
 
2440 2507
 		if ( is_admin() ) {
2441 2508
 			require_once( ABSPATH . 'wp-admin/custom-header.php' );
@@ -2493,19 +2560,22 @@  discard block
 block discarded – undo
2493 2560
  */
2494 2561
 function get_theme_support( $feature ) {
2495 2562
 	global $_wp_theme_features;
2496
-	if ( ! isset( $_wp_theme_features[ $feature ] ) )
2497
-		return false;
2563
+	if ( ! isset( $_wp_theme_features[ $feature ] ) ) {
2564
+			return false;
2565
+	}
2498 2566
 
2499
-	if ( func_num_args() <= 1 )
2500
-		return $_wp_theme_features[ $feature ];
2567
+	if ( func_num_args() <= 1 ) {
2568
+			return $_wp_theme_features[ $feature ];
2569
+	}
2501 2570
 
2502 2571
 	$args = array_slice( func_get_args(), 1 );
2503 2572
 	switch ( $feature ) {
2504 2573
 		case 'custom-logo' :
2505 2574
 		case 'custom-header' :
2506 2575
 		case 'custom-background' :
2507
-			if ( isset( $_wp_theme_features[ $feature ][0][ $args[0] ] ) )
2508
-				return $_wp_theme_features[ $feature ][0][ $args[0] ];
2576
+			if ( isset( $_wp_theme_features[ $feature ][0][ $args[0] ] ) ) {
2577
+							return $_wp_theme_features[ $feature ][0][ $args[0] ];
2578
+			}
2509 2579
 			return false;
2510 2580
 
2511 2581
 		default :
@@ -2526,8 +2596,9 @@  discard block
 block discarded – undo
2526 2596
  */
2527 2597
 function remove_theme_support( $feature ) {
2528 2598
 	// Blacklist: for internal registrations not used directly by themes.
2529
-	if ( in_array( $feature, array( 'editor-style', 'widgets', 'menus' ) ) )
2530
-		return false;
2599
+	if ( in_array( $feature, array( 'editor-style', 'widgets', 'menus' ) ) ) {
2600
+			return false;
2601
+	}
2531 2602
 
2532 2603
 	return _remove_theme_support( $feature );
2533 2604
 }
@@ -2549,19 +2620,22 @@  discard block
 block discarded – undo
2549 2620
 
2550 2621
 	switch ( $feature ) {
2551 2622
 		case 'custom-header-uploads' :
2552
-			if ( ! isset( $_wp_theme_features['custom-header'] ) )
2553
-				return false;
2623
+			if ( ! isset( $_wp_theme_features['custom-header'] ) ) {
2624
+							return false;
2625
+			}
2554 2626
 			add_theme_support( 'custom-header', array( 'uploads' => false ) );
2555 2627
 			return; // Do not continue - custom-header-uploads no longer exists.
2556 2628
 	}
2557 2629
 
2558
-	if ( ! isset( $_wp_theme_features[ $feature ] ) )
2559
-		return false;
2630
+	if ( ! isset( $_wp_theme_features[ $feature ] ) ) {
2631
+			return false;
2632
+	}
2560 2633
 
2561 2634
 	switch ( $feature ) {
2562 2635
 		case 'custom-header' :
2563
-			if ( ! did_action( 'wp_loaded' ) )
2564
-				break;
2636
+			if ( ! did_action( 'wp_loaded' ) ) {
2637
+							break;
2638
+			}
2565 2639
 			$support = get_theme_support( 'custom-header' );
2566 2640
 			if ( isset( $support[0]['wp-head-callback'] ) ) {
2567 2641
 				remove_action( 'wp_head', $support[0]['wp-head-callback'] );
@@ -2573,8 +2647,9 @@  discard block
 block discarded – undo
2573 2647
 			break;
2574 2648
 
2575 2649
 		case 'custom-background' :
2576
-			if ( ! did_action( 'wp_loaded' ) )
2577
-				break;
2650
+			if ( ! did_action( 'wp_loaded' ) ) {
2651
+							break;
2652
+			}
2578 2653
 			$support = get_theme_support( 'custom-background' );
2579 2654
 			remove_action( 'wp_head', $support[0]['wp-head-callback'] );
2580 2655
 			remove_action( 'admin_menu', array( $GLOBALS['custom_background'], 'init' ) );
@@ -2599,15 +2674,18 @@  discard block
 block discarded – undo
2599 2674
 function current_theme_supports( $feature ) {
2600 2675
 	global $_wp_theme_features;
2601 2676
 
2602
-	if ( 'custom-header-uploads' == $feature )
2603
-		return current_theme_supports( 'custom-header', 'uploads' );
2677
+	if ( 'custom-header-uploads' == $feature ) {
2678
+			return current_theme_supports( 'custom-header', 'uploads' );
2679
+	}
2604 2680
 
2605
-	if ( !isset( $_wp_theme_features[$feature] ) )
2606
-		return false;
2681
+	if ( !isset( $_wp_theme_features[$feature] ) ) {
2682
+			return false;
2683
+	}
2607 2684
 
2608 2685
 	// If no args passed then no extra checks need be performed
2609
-	if ( func_num_args() <= 1 )
2610
-		return true;
2686
+	if ( func_num_args() <= 1 ) {
2687
+			return true;
2688
+	}
2611 2689
 
2612 2690
 	$args = array_slice( func_get_args(), 1 );
2613 2691
 
@@ -2616,8 +2694,10 @@  discard block
 block discarded – undo
2616 2694
 			// post-thumbnails can be registered for only certain content/post types by passing
2617 2695
 			// an array of types to add_theme_support(). If no array was passed, then
2618 2696
 			// any type is accepted
2619
-			if ( true === $_wp_theme_features[$feature] )  // Registered for all types
2697
+			if ( true === $_wp_theme_features[$feature] ) {
2698
+				// Registered for all types
2620 2699
 				return true;
2700
+			}
2621 2701
 			$content_type = $args[0];
2622 2702
 			return in_array( $content_type, $_wp_theme_features[$feature][0] );
2623 2703
 
@@ -2967,8 +3047,9 @@  discard block
 block discarded – undo
2967 3047
 
2968 3048
 	$wp_scripts = wp_scripts();
2969 3049
 	$data = $wp_scripts->get_data( 'customize-loader', 'data' );
2970
-	if ( $data )
2971
-		$script = "$data\n$script";
3050
+	if ( $data ) {
3051
+			$script = "$data\n$script";
3052
+	}
2972 3053
 
2973 3054
 	$wp_scripts->add_data( 'customize-loader', 'data', $script );
2974 3055
 }
@@ -2984,8 +3065,9 @@  discard block
 block discarded – undo
2984 3065
  */
2985 3066
 function wp_customize_url( $stylesheet = null ) {
2986 3067
 	$url = admin_url( 'customize.php' );
2987
-	if ( $stylesheet )
2988
-		$url .= '?theme=' . urlencode( $stylesheet );
3068
+	if ( $stylesheet ) {
3069
+			$url .= '?theme=' . urlencode( $stylesheet );
3070
+	}
2989 3071
 	return esc_url( $url );
2990 3072
 }
2991 3073
 
@@ -3023,9 +3105,12 @@  discard block
 block discarded – undo
3023 3105
 
3024 3106
 		<?php	if ( $cross_domain ) : ?>
3025 3107
 				request = (function(){ var xhr = new XMLHttpRequest(); return ('withCredentials' in xhr); })();
3026
-		<?php	else : ?>
3108
+		<?php	else {
3109
+	: ?>
3027 3110
 				request = true;
3028
-		<?php	endif; ?>
3111
+		<?php	endif;
3112
+}
3113
+?>
3029 3114
 
3030 3115
 				b[c] = b[c].replace( rcs, ' ' );
3031 3116
 				// The customizer requires postMessage and CORS (if the site is cross domain)
Please login to merge, or discard this patch.
src/wp-includes/class-wp-editor.php 2 patches
Braces   +72 added lines, -50 removed lines patch added patch discarded remove patch
@@ -106,31 +106,36 @@  discard block
 block discarded – undo
106 106
 
107 107
 		self::$this_quicktags = (bool) $set['quicktags'];
108 108
 
109
-		if ( self::$this_tinymce )
110
-			self::$has_tinymce = true;
109
+		if ( self::$this_tinymce ) {
110
+					self::$has_tinymce = true;
111
+		}
111 112
 
112
-		if ( self::$this_quicktags )
113
-			self::$has_quicktags = true;
113
+		if ( self::$this_quicktags ) {
114
+					self::$has_quicktags = true;
115
+		}
114 116
 
115 117
 		if ( $set['dfw'] ) {
116 118
 			self::$old_dfw_compat = true;
117 119
 		}
118 120
 
119
-		if ( empty( $set['editor_height'] ) )
120
-			return $set;
121
+		if ( empty( $set['editor_height'] ) ) {
122
+					return $set;
123
+		}
121 124
 
122 125
 		if ( 'content' === $editor_id && empty( $set['tinymce']['wp_autoresize_on'] ) ) {
123 126
 			// A cookie (set when a user resizes the editor) overrides the height.
124 127
 			$cookie = (int) get_user_setting( 'ed_size' );
125 128
 
126
-			if ( $cookie )
127
-				$set['editor_height'] = $cookie;
129
+			if ( $cookie ) {
130
+							$set['editor_height'] = $cookie;
131
+			}
128 132
 		}
129 133
 
130
-		if ( $set['editor_height'] < 50 )
131
-			$set['editor_height'] = 50;
132
-		elseif ( $set['editor_height'] > 5000 )
133
-			$set['editor_height'] = 5000;
134
+		if ( $set['editor_height'] < 50 ) {
135
+					$set['editor_height'] = 50;
136
+		} elseif ( $set['editor_height'] > 5000 ) {
137
+					$set['editor_height'] = 5000;
138
+		}
134 139
 
135 140
 		return $set;
136 141
 	}
@@ -208,8 +213,9 @@  discard block
 block discarded – undo
208 213
 			if ( $set['media_buttons'] ) {
209 214
 				self::$has_medialib = true;
210 215
 
211
-				if ( ! function_exists( 'media_buttons' ) )
212
-					include( ABSPATH . 'wp-admin/includes/media.php' );
216
+				if ( ! function_exists( 'media_buttons' ) ) {
217
+									include( ABSPATH . 'wp-admin/includes/media.php' );
218
+				}
213 219
 
214 220
 				echo '<div id="wp-' . $editor_id_attr . '-media-buttons" class="wp-media-buttons">';
215 221
 
@@ -322,11 +328,13 @@  discard block
 block discarded – undo
322 328
 				'buttons' => ''
323 329
 			);
324 330
 
325
-			if ( is_array($set['quicktags']) )
326
-				$qtInit = array_merge($qtInit, $set['quicktags']);
331
+			if ( is_array($set['quicktags']) ) {
332
+							$qtInit = array_merge($qtInit, $set['quicktags']);
333
+			}
327 334
 
328
-			if ( empty($qtInit['buttons']) )
329
-				$qtInit['buttons'] = 'strong,em,link,block,del,ins,img,ul,ol,li,code,more,close';
335
+			if ( empty($qtInit['buttons']) ) {
336
+							$qtInit['buttons'] = 'strong,em,link,block,del,ins,img,ul,ol,li,code,more,close';
337
+			}
330 338
 
331 339
 			if ( $set['_content_editor_dfw'] ) {
332 340
 				$qtInit['buttons'] .= ',dfw';
@@ -481,14 +489,17 @@  discard block
 block discarded – undo
481 489
 								$path = str_replace( content_url(), '', $plugurl );
482 490
 								$path = WP_CONTENT_DIR . $path . '/langs/';
483 491
 
484
-								if ( function_exists('realpath') )
485
-									$path = trailingslashit( realpath($path) );
492
+								if ( function_exists('realpath') ) {
493
+																	$path = trailingslashit( realpath($path) );
494
+								}
486 495
 
487
-								if ( @is_file( $path . $mce_locale . '.js' ) )
488
-									$strings .= @file_get_contents( $path . $mce_locale . '.js' ) . "\n";
496
+								if ( @is_file( $path . $mce_locale . '.js' ) ) {
497
+																	$strings .= @file_get_contents( $path . $mce_locale . '.js' ) . "\n";
498
+								}
489 499
 
490
-								if ( @is_file( $path . $mce_locale . '_dlg.js' ) )
491
-									$strings .= @file_get_contents( $path . $mce_locale . '_dlg.js' ) . "\n";
500
+								if ( @is_file( $path . $mce_locale . '_dlg.js' ) ) {
501
+																	$strings .= @file_get_contents( $path . $mce_locale . '_dlg.js' ) . "\n";
502
+								}
492 503
 
493 504
 								if ( 'en' != $mce_locale && empty( $strings ) ) {
494 505
 									if ( @is_file( $path . 'en.js' ) ) {
@@ -502,8 +513,9 @@  discard block
 block discarded – undo
502 513
 									}
503 514
 								}
504 515
 
505
-								if ( ! empty( $strings ) )
506
-									$ext_plugins .= "\n" . $strings . "\n";
516
+								if ( ! empty( $strings ) ) {
517
+																	$ext_plugins .= "\n" . $strings . "\n";
518
+								}
507 519
 							}
508 520
 
509 521
 							$ext_plugins .= 'tinyMCEPreInit.load_ext("' . $plugurl . '", "' . $mce_locale . '");' . "\n";
@@ -584,8 +596,9 @@  discard block
 block discarded – undo
584 596
 				 */
585 597
 				$mce_css = trim( apply_filters( 'mce_css', implode( ',', $mce_css ) ), ' ,' );
586 598
 
587
-				if ( ! empty($mce_css) )
588
-					self::$first_init['content_css'] = $mce_css;
599
+				if ( ! empty($mce_css) ) {
600
+									self::$first_init['content_css'] = $mce_css;
601
+				}
589 602
 			}
590 603
 
591 604
 			if ( $set['teeny'] ) {
@@ -666,10 +679,11 @@  discard block
 block discarded – undo
666 679
 				$body_class .= ' post-type-' . sanitize_html_class( $post->post_type ) . ' post-status-' . sanitize_html_class( $post->post_status );
667 680
 				if ( post_type_supports( $post->post_type, 'post-formats' ) ) {
668 681
 					$post_format = get_post_format( $post );
669
-					if ( $post_format && ! is_wp_error( $post_format ) )
670
-						$body_class .= ' post-format-' . sanitize_html_class( $post_format );
671
-					else
672
-						$body_class .= ' post-format-standard';
682
+					if ( $post_format && ! is_wp_error( $post_format ) ) {
683
+											$body_class .= ' post-format-' . sanitize_html_class( $post_format );
684
+					} else {
685
+											$body_class .= ' post-format-standard';
686
+					}
673 687
 				}
674 688
 			}
675 689
 
@@ -697,8 +711,9 @@  discard block
 block discarded – undo
697 711
 			// Merge with the first part of the init array
698 712
 			$mceInit = array_merge( self::$first_init, $mceInit );
699 713
 
700
-			if ( is_array( $set['tinymce'] ) )
701
-				$mceInit = array_merge( $mceInit, $set['tinymce'] );
714
+			if ( is_array( $set['tinymce'] ) ) {
715
+							$mceInit = array_merge( $mceInit, $set['tinymce'] );
716
+			}
702 717
 
703 718
 			/*
704 719
 			 * For people who really REALLY know what they're doing with TinyMCE
@@ -770,8 +785,9 @@  discard block
 block discarded – undo
770 785
 	 * @static
771 786
 	 */
772 787
 	public static function enqueue_scripts() {
773
-		if ( self::$has_tinymce )
774
-			wp_enqueue_script('editor');
788
+		if ( self::$has_tinymce ) {
789
+					wp_enqueue_script('editor');
790
+		}
775 791
 
776 792
 		if ( self::$has_quicktags ) {
777 793
 			wp_enqueue_script( 'quicktags' );
@@ -1147,8 +1163,9 @@  discard block
 block discarded – undo
1147 1163
 		$version = 'ver=' . $tinymce_version;
1148 1164
 		$tmce_on = !empty(self::$mce_settings);
1149 1165
 
1150
-		if ( ! isset($concatenate_scripts) )
1151
-			script_concat_settings();
1166
+		if ( ! isset($concatenate_scripts) ) {
1167
+					script_concat_settings();
1168
+		}
1152 1169
 
1153 1170
 		$compressed = $compress_scripts && $concatenate_scripts && isset($_SERVER['HTTP_ACCEPT_ENCODING'])
1154 1171
 			&& false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip');
@@ -1245,11 +1262,13 @@  discard block
 block discarded – undo
1245 1262
 		<script type="text/javascript">
1246 1263
 		<?php
1247 1264
 
1248
-		if ( self::$ext_plugins )
1249
-			echo self::$ext_plugins . "\n";
1265
+		if ( self::$ext_plugins ) {
1266
+					echo self::$ext_plugins . "\n";
1267
+		}
1250 1268
 
1251
-		if ( ! is_admin() )
1252
-			echo 'var ajaxurl = "' . admin_url( 'admin-ajax.php', 'relative' ) . '";';
1269
+		if ( ! is_admin() ) {
1270
+					echo 'var ajaxurl = "' . admin_url( 'admin-ajax.php', 'relative' ) . '";';
1271
+		}
1253 1272
 
1254 1273
 		?>
1255 1274
 
@@ -1337,8 +1356,9 @@  discard block
 block discarded – undo
1337 1356
 
1338 1357
 		$args['pagenum'] = isset( $args['pagenum'] ) ? absint( $args['pagenum'] ) : 1;
1339 1358
 
1340
-		if ( isset( $args['s'] ) )
1341
-			$query['s'] = $args['s'];
1359
+		if ( isset( $args['s'] ) ) {
1360
+					$query['s'] = $args['s'];
1361
+		}
1342 1362
 
1343 1363
 		$query['offset'] = $args['pagenum'] > 1 ? $query['posts_per_page'] * ( $args['pagenum'] - 1 ) : 0;
1344 1364
 
@@ -1359,16 +1379,18 @@  discard block
 block discarded – undo
1359 1379
 		$get_posts = new WP_Query;
1360 1380
 		$posts = $get_posts->query( $query );
1361 1381
 		// Check if any posts were found.
1362
-		if ( ! $get_posts->post_count )
1363
-			return false;
1382
+		if ( ! $get_posts->post_count ) {
1383
+					return false;
1384
+		}
1364 1385
 
1365 1386
 		// Build results.
1366 1387
 		$results = array();
1367 1388
 		foreach ( $posts as $post ) {
1368
-			if ( 'post' == $post->post_type )
1369
-				$info = mysql2date( __( 'Y/m/d' ), $post->post_date );
1370
-			else
1371
-				$info = $pts[ $post->post_type ]->labels->singular_name;
1389
+			if ( 'post' == $post->post_type ) {
1390
+							$info = mysql2date( __( 'Y/m/d' ), $post->post_date );
1391
+			} else {
1392
+							$info = $pts[ $post->post_type ]->labels->singular_name;
1393
+			}
1372 1394
 
1373 1395
 			$results[] = array(
1374 1396
 				'ID' => $post->ID,
Please login to merge, or discard this patch.
Spacing   +509 added lines, -509 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 * }
65 65
 	 * @return array Parsed arguments array.
66 66
 	 */
67
-	public static function parse_settings( $editor_id, $settings ) {
67
+	public static function parse_settings($editor_id, $settings) {
68 68
 
69 69
 		/**
70 70
 		 * Filters the wp_editor() settings.
@@ -76,9 +76,9 @@  discard block
 block discarded – undo
76 76
 		 * @param array  $settings  Array of editor arguments.
77 77
 		 * @param string $editor_id ID for the current editor instance.
78 78
 		 */
79
-		$settings = apply_filters( 'wp_editor_settings', $settings, $editor_id );
79
+		$settings = apply_filters('wp_editor_settings', $settings, $editor_id);
80 80
 
81
-		$set = wp_parse_args( $settings, array(
81
+		$set = wp_parse_args($settings, array(
82 82
 			'wpautop'             => true,
83 83
 			'media_buttons'       => true,
84 84
 			'default_editor'      => '',
@@ -94,43 +94,43 @@  discard block
 block discarded – undo
94 94
 			'_content_editor_dfw' => false,
95 95
 			'tinymce'             => true,
96 96
 			'quicktags'           => true
97
-		) );
97
+		));
98 98
 
99
-		self::$this_tinymce = ( $set['tinymce'] && user_can_richedit() );
99
+		self::$this_tinymce = ($set['tinymce'] && user_can_richedit());
100 100
 
101
-		if ( self::$this_tinymce ) {
102
-			if ( false !== strpos( $editor_id, '[' ) ) {
101
+		if (self::$this_tinymce) {
102
+			if (false !== strpos($editor_id, '[')) {
103 103
 				self::$this_tinymce = false;
104
-				_deprecated_argument( 'wp_editor()', '3.9.0', 'TinyMCE editor IDs cannot have brackets.' );
104
+				_deprecated_argument('wp_editor()', '3.9.0', 'TinyMCE editor IDs cannot have brackets.');
105 105
 			}
106 106
 		}
107 107
 
108 108
 		self::$this_quicktags = (bool) $set['quicktags'];
109 109
 
110
-		if ( self::$this_tinymce )
110
+		if (self::$this_tinymce)
111 111
 			self::$has_tinymce = true;
112 112
 
113
-		if ( self::$this_quicktags )
113
+		if (self::$this_quicktags)
114 114
 			self::$has_quicktags = true;
115 115
 
116
-		if ( $set['dfw'] ) {
116
+		if ($set['dfw']) {
117 117
 			self::$old_dfw_compat = true;
118 118
 		}
119 119
 
120
-		if ( empty( $set['editor_height'] ) )
120
+		if (empty($set['editor_height']))
121 121
 			return $set;
122 122
 
123
-		if ( 'content' === $editor_id && empty( $set['tinymce']['wp_autoresize_on'] ) ) {
123
+		if ('content' === $editor_id && empty($set['tinymce']['wp_autoresize_on'])) {
124 124
 			// A cookie (set when a user resizes the editor) overrides the height.
125
-			$cookie = (int) get_user_setting( 'ed_size' );
125
+			$cookie = (int) get_user_setting('ed_size');
126 126
 
127
-			if ( $cookie )
127
+			if ($cookie)
128 128
 				$set['editor_height'] = $cookie;
129 129
 		}
130 130
 
131
-		if ( $set['editor_height'] < 50 )
131
+		if ($set['editor_height'] < 50)
132 132
 			$set['editor_height'] = 50;
133
-		elseif ( $set['editor_height'] > 5000 )
133
+		elseif ($set['editor_height'] > 5000)
134 134
 			$set['editor_height'] = 5000;
135 135
 
136 136
 		return $set;
@@ -144,75 +144,75 @@  discard block
 block discarded – undo
144 144
 	 * @param string $editor_id ID for the textarea and TinyMCE and Quicktags instances (can contain only ASCII letters and numbers).
145 145
 	 * @param array $settings See the _parse_settings() method for description.
146 146
 	 */
147
-	public static function editor( $content, $editor_id, $settings = array() ) {
148
-		$set = self::parse_settings( $editor_id, $settings );
149
-		$editor_class = ' class="' . trim( esc_attr( $set['editor_class'] ) . ' wp-editor-area' ) . '"';
150
-		$tabindex = $set['tabindex'] ? ' tabindex="' . (int) $set['tabindex'] . '"' : '';
147
+	public static function editor($content, $editor_id, $settings = array()) {
148
+		$set = self::parse_settings($editor_id, $settings);
149
+		$editor_class = ' class="'.trim(esc_attr($set['editor_class']).' wp-editor-area').'"';
150
+		$tabindex = $set['tabindex'] ? ' tabindex="'.(int) $set['tabindex'].'"' : '';
151 151
 		$default_editor = 'html';
152 152
 		$buttons = $autocomplete = '';
153
-		$editor_id_attr = esc_attr( $editor_id );
153
+		$editor_id_attr = esc_attr($editor_id);
154 154
 
155
-		if ( $set['drag_drop_upload'] ) {
155
+		if ($set['drag_drop_upload']) {
156 156
 			self::$drag_drop_upload = true;
157 157
 		}
158 158
 
159
-		if ( ! empty( $set['editor_height'] ) ) {
160
-			$height = ' style="height: ' . (int) $set['editor_height'] . 'px"';
159
+		if ( ! empty($set['editor_height'])) {
160
+			$height = ' style="height: '.(int) $set['editor_height'].'px"';
161 161
 		} else {
162
-			$height = ' rows="' . (int) $set['textarea_rows'] . '"';
162
+			$height = ' rows="'.(int) $set['textarea_rows'].'"';
163 163
 		}
164 164
 
165
-		if ( ! current_user_can( 'upload_files' ) ) {
165
+		if ( ! current_user_can('upload_files')) {
166 166
 			$set['media_buttons'] = false;
167 167
 		}
168 168
 
169
-		if ( self::$this_tinymce ) {
169
+		if (self::$this_tinymce) {
170 170
 			$autocomplete = ' autocomplete="off"';
171 171
 
172
-			if ( self::$this_quicktags ) {
172
+			if (self::$this_quicktags) {
173 173
 				$default_editor = $set['default_editor'] ? $set['default_editor'] : wp_default_editor();
174 174
 				// 'html' is used for the "Text" editor tab.
175
-				if ( 'html' !== $default_editor ) {
175
+				if ('html' !== $default_editor) {
176 176
 					$default_editor = 'tinymce';
177 177
 				}
178 178
 
179
-				$buttons .= '<button type="button" id="' . $editor_id_attr . '-tmce" class="wp-switch-editor switch-tmce"' .
180
-					' data-wp-editor-id="' . $editor_id_attr . '">' . __('Visual') . "</button>\n";
181
-				$buttons .= '<button type="button" id="' . $editor_id_attr . '-html" class="wp-switch-editor switch-html"' .
182
-					' data-wp-editor-id="' . $editor_id_attr . '">' . _x( 'Text', 'Name for the Text editor tab (formerly HTML)' ) . "</button>\n";
179
+				$buttons .= '<button type="button" id="'.$editor_id_attr.'-tmce" class="wp-switch-editor switch-tmce"'.
180
+					' data-wp-editor-id="'.$editor_id_attr.'">'.__('Visual')."</button>\n";
181
+				$buttons .= '<button type="button" id="'.$editor_id_attr.'-html" class="wp-switch-editor switch-html"'.
182
+					' data-wp-editor-id="'.$editor_id_attr.'">'._x('Text', 'Name for the Text editor tab (formerly HTML)')."</button>\n";
183 183
 			} else {
184 184
 				$default_editor = 'tinymce';
185 185
 			}
186 186
 		}
187 187
 
188 188
 		$switch_class = 'html' === $default_editor ? 'html-active' : 'tmce-active';
189
-		$wrap_class = 'wp-core-ui wp-editor-wrap ' . $switch_class;
189
+		$wrap_class = 'wp-core-ui wp-editor-wrap '.$switch_class;
190 190
 
191
-		if ( $set['_content_editor_dfw'] ) {
191
+		if ($set['_content_editor_dfw']) {
192 192
 			$wrap_class .= ' has-dfw';
193 193
 		}
194 194
 
195
-		echo '<div id="wp-' . $editor_id_attr . '-wrap" class="' . $wrap_class . '">';
195
+		echo '<div id="wp-'.$editor_id_attr.'-wrap" class="'.$wrap_class.'">';
196 196
 
197
-		if ( self::$editor_buttons_css ) {
198
-			wp_print_styles( 'editor-buttons' );
197
+		if (self::$editor_buttons_css) {
198
+			wp_print_styles('editor-buttons');
199 199
 			self::$editor_buttons_css = false;
200 200
 		}
201 201
 
202
-		if ( ! empty( $set['editor_css'] ) ) {
203
-			echo $set['editor_css'] . "\n";
202
+		if ( ! empty($set['editor_css'])) {
203
+			echo $set['editor_css']."\n";
204 204
 		}
205 205
 
206
-		if ( ! empty( $buttons ) || $set['media_buttons'] ) {
207
-			echo '<div id="wp-' . $editor_id_attr . '-editor-tools" class="wp-editor-tools hide-if-no-js">';
206
+		if ( ! empty($buttons) || $set['media_buttons']) {
207
+			echo '<div id="wp-'.$editor_id_attr.'-editor-tools" class="wp-editor-tools hide-if-no-js">';
208 208
 
209
-			if ( $set['media_buttons'] ) {
209
+			if ($set['media_buttons']) {
210 210
 				self::$has_medialib = true;
211 211
 
212
-				if ( ! function_exists( 'media_buttons' ) )
213
-					include( ABSPATH . 'wp-admin/includes/media.php' );
212
+				if ( ! function_exists('media_buttons'))
213
+					include(ABSPATH.'wp-admin/includes/media.php');
214 214
 
215
-				echo '<div id="wp-' . $editor_id_attr . '-media-buttons" class="wp-media-buttons">';
215
+				echo '<div id="wp-'.$editor_id_attr.'-media-buttons" class="wp-media-buttons">';
216 216
 
217 217
 				/**
218 218
 				 * Fires after the default media button(s) are displayed.
@@ -221,24 +221,24 @@  discard block
 block discarded – undo
221 221
 				 *
222 222
 				 * @param string $editor_id Unique editor identifier, e.g. 'content'.
223 223
 				 */
224
-				do_action( 'media_buttons', $editor_id );
224
+				do_action('media_buttons', $editor_id);
225 225
 				echo "</div>\n";
226 226
 			}
227 227
 
228
-			echo '<div class="wp-editor-tabs">' . $buttons . "</div>\n";
228
+			echo '<div class="wp-editor-tabs">'.$buttons."</div>\n";
229 229
 			echo "</div>\n";
230 230
 		}
231 231
 
232 232
 		$quicktags_toolbar = '';
233 233
 
234
-		if ( self::$this_quicktags ) {
235
-			if ( 'content' === $editor_id && ! empty( $GLOBALS['current_screen'] ) && $GLOBALS['current_screen']->base === 'post' ) {
234
+		if (self::$this_quicktags) {
235
+			if ('content' === $editor_id && ! empty($GLOBALS['current_screen']) && $GLOBALS['current_screen']->base === 'post') {
236 236
 				$toolbar_id = 'ed_toolbar';
237 237
 			} else {
238
-				$toolbar_id = 'qt_' . $editor_id_attr . '_toolbar';
238
+				$toolbar_id = 'qt_'.$editor_id_attr.'_toolbar';
239 239
 			}
240 240
 
241
-			$quicktags_toolbar = '<div id="' . $toolbar_id . '" class="quicktags-toolbar"></div>';
241
+			$quicktags_toolbar = '<div id="'.$toolbar_id.'" class="quicktags-toolbar"></div>';
242 242
 		}
243 243
 
244 244
 		/**
@@ -248,14 +248,14 @@  discard block
 block discarded – undo
248 248
 		 *
249 249
 		 * @param string $output Editor's HTML markup.
250 250
 		 */
251
-		$the_editor = apply_filters( 'the_editor', '<div id="wp-' . $editor_id_attr . '-editor-container" class="wp-editor-container">' .
252
-			$quicktags_toolbar .
253
-			'<textarea' . $editor_class . $height . $tabindex . $autocomplete . ' cols="40" name="' . esc_attr( $set['textarea_name'] ) . '" ' .
254
-			'id="' . $editor_id_attr . '">%s</textarea></div>' );
251
+		$the_editor = apply_filters('the_editor', '<div id="wp-'.$editor_id_attr.'-editor-container" class="wp-editor-container">'.
252
+			$quicktags_toolbar.
253
+			'<textarea'.$editor_class.$height.$tabindex.$autocomplete.' cols="40" name="'.esc_attr($set['textarea_name']).'" '.
254
+			'id="'.$editor_id_attr.'">%s</textarea></div>');
255 255
 
256 256
 		// Prepare the content for the Visual or Text editor, only when TinyMCE is used (back-compat).
257
-		if ( self::$this_tinymce ) {
258
-			add_filter( 'the_editor_content', 'format_for_editor', 10, 2 );
257
+		if (self::$this_tinymce) {
258
+			add_filter('the_editor_content', 'format_for_editor', 10, 2);
259 259
 		}
260 260
 
261 261
 		/**
@@ -267,31 +267,31 @@  discard block
 block discarded – undo
267 267
 		 * @param string $default_editor The default editor for the current user.
268 268
 		 *                               Either 'html' or 'tinymce'.
269 269
 		 */
270
-		$content = apply_filters( 'the_editor_content', $content, $default_editor );
270
+		$content = apply_filters('the_editor_content', $content, $default_editor);
271 271
 
272 272
 		// Remove the filter as the next editor on the same page may not need it.
273
-		if ( self::$this_tinymce ) {
274
-			remove_filter( 'the_editor_content', 'format_for_editor' );
273
+		if (self::$this_tinymce) {
274
+			remove_filter('the_editor_content', 'format_for_editor');
275 275
 		}
276 276
 
277 277
 		// Back-compat for the `htmledit_pre` and `richedit_pre` filters
278
-		if ( 'html' === $default_editor && has_filter( 'htmledit_pre' ) ) {
278
+		if ('html' === $default_editor && has_filter('htmledit_pre')) {
279 279
 			// TODO: needs _deprecated_filter(), use _deprecated_function() as substitute for now
280
-			_deprecated_function( 'add_filter( htmledit_pre )', '4.3.0', 'add_filter( format_for_editor )' );
281
-			$content = apply_filters( 'htmledit_pre', $content );
282
-		} elseif ( 'tinymce' === $default_editor && has_filter( 'richedit_pre' ) ) {
283
-			_deprecated_function( 'add_filter( richedit_pre )', '4.3.0', 'add_filter( format_for_editor )' );
284
-			$content = apply_filters( 'richedit_pre', $content );
280
+			_deprecated_function('add_filter( htmledit_pre )', '4.3.0', 'add_filter( format_for_editor )');
281
+			$content = apply_filters('htmledit_pre', $content);
282
+		} elseif ('tinymce' === $default_editor && has_filter('richedit_pre')) {
283
+			_deprecated_function('add_filter( richedit_pre )', '4.3.0', 'add_filter( format_for_editor )');
284
+			$content = apply_filters('richedit_pre', $content);
285 285
 		}
286 286
 
287
-		if ( false !== stripos( $content, 'textarea' ) ) {
288
-			$content = preg_replace( '%</textarea%i', '&lt;/textarea', $content );
287
+		if (false !== stripos($content, 'textarea')) {
288
+			$content = preg_replace('%</textarea%i', '&lt;/textarea', $content);
289 289
 		}
290 290
 
291
-		printf( $the_editor, $content );
291
+		printf($the_editor, $content);
292 292
 		echo "\n</div>\n\n";
293 293
 
294
-		self::editor_settings( $editor_id, $set );
294
+		self::editor_settings($editor_id, $set);
295 295
 	}
296 296
 
297 297
 	/**
@@ -305,30 +305,30 @@  discard block
 block discarded – undo
305 305
 	public static function editor_settings($editor_id, $set) {
306 306
 		global $tinymce_version;
307 307
 
308
-		if ( empty(self::$first_init) ) {
309
-			if ( is_admin() ) {
310
-				add_action( 'admin_print_footer_scripts', array( __CLASS__, 'editor_js' ), 50 );
311
-				add_action( 'admin_print_footer_scripts', array( __CLASS__, 'enqueue_scripts' ), 1 );
308
+		if (empty(self::$first_init)) {
309
+			if (is_admin()) {
310
+				add_action('admin_print_footer_scripts', array(__CLASS__, 'editor_js'), 50);
311
+				add_action('admin_print_footer_scripts', array(__CLASS__, 'enqueue_scripts'), 1);
312 312
 			} else {
313
-				add_action( 'wp_print_footer_scripts', array( __CLASS__, 'editor_js' ), 50 );
314
-				add_action( 'wp_print_footer_scripts', array( __CLASS__, 'enqueue_scripts' ), 1 );
313
+				add_action('wp_print_footer_scripts', array(__CLASS__, 'editor_js'), 50);
314
+				add_action('wp_print_footer_scripts', array(__CLASS__, 'enqueue_scripts'), 1);
315 315
 			}
316 316
 		}
317 317
 
318
-		if ( self::$this_quicktags ) {
318
+		if (self::$this_quicktags) {
319 319
 
320 320
 			$qtInit = array(
321 321
 				'id' => $editor_id,
322 322
 				'buttons' => ''
323 323
 			);
324 324
 
325
-			if ( is_array($set['quicktags']) )
325
+			if (is_array($set['quicktags']))
326 326
 				$qtInit = array_merge($qtInit, $set['quicktags']);
327 327
 
328
-			if ( empty($qtInit['buttons']) )
328
+			if (empty($qtInit['buttons']))
329 329
 				$qtInit['buttons'] = 'strong,em,link,block,del,ins,img,ul,ol,li,code,more,close';
330 330
 
331
-			if ( $set['_content_editor_dfw'] ) {
331
+			if ($set['_content_editor_dfw']) {
332 332
 				$qtInit['buttons'] .= ',dfw';
333 333
 			}
334 334
 
@@ -340,33 +340,33 @@  discard block
 block discarded – undo
340 340
 			 * @param array  $qtInit    Quicktags settings.
341 341
 			 * @param string $editor_id The unique editor ID, e.g. 'content'.
342 342
 			 */
343
-			$qtInit = apply_filters( 'quicktags_settings', $qtInit, $editor_id );
343
+			$qtInit = apply_filters('quicktags_settings', $qtInit, $editor_id);
344 344
 
345 345
 			self::$qt_settings[$editor_id] = $qtInit;
346 346
 
347
-			self::$qt_buttons = array_merge( self::$qt_buttons, explode(',', $qtInit['buttons']) );
347
+			self::$qt_buttons = array_merge(self::$qt_buttons, explode(',', $qtInit['buttons']));
348 348
 		}
349 349
 
350
-		if ( self::$this_tinymce ) {
350
+		if (self::$this_tinymce) {
351 351
 
352
-			if ( empty( self::$first_init ) ) {
353
-				self::$baseurl = includes_url( 'js/tinymce' );
352
+			if (empty(self::$first_init)) {
353
+				self::$baseurl = includes_url('js/tinymce');
354 354
 
355 355
 				$mce_locale = get_user_locale();
356
-				self::$mce_locale = $mce_locale = empty( $mce_locale ) ? 'en' : strtolower( substr( $mce_locale, 0, 2 ) ); // ISO 639-1
356
+				self::$mce_locale = $mce_locale = empty($mce_locale) ? 'en' : strtolower(substr($mce_locale, 0, 2)); // ISO 639-1
357 357
 
358 358
 				/** This filter is documented in wp-admin/includes/media.php */
359
-				$no_captions = (bool) apply_filters( 'disable_captions', '' );
359
+				$no_captions = (bool) apply_filters('disable_captions', '');
360 360
 				$ext_plugins = '';
361 361
 				$shortcut_labels = array();
362 362
 
363
-				foreach ( self::get_translation() as $name => $value ) {
364
-					if ( is_array( $value ) ) {
363
+				foreach (self::get_translation() as $name => $value) {
364
+					if (is_array($value)) {
365 365
 						$shortcut_labels[$name] = $value[1];
366 366
 					}
367 367
 				}
368 368
 
369
-				if ( $set['teeny'] ) {
369
+				if ($set['teeny']) {
370 370
 
371 371
 					/**
372 372
 					 * Filters the list of teenyMCE plugins.
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 					 * @param array  $plugins   An array of teenyMCE plugins.
377 377
 					 * @param string $editor_id Unique editor identifier, e.g. 'content'.
378 378
 					 */
379
-					self::$plugins = $plugins = apply_filters( 'teeny_mce_plugins', array( 'colorpicker', 'lists', 'fullscreen', 'image', 'wordpress', 'wpeditimage', 'wplink' ), $editor_id );
379
+					self::$plugins = $plugins = apply_filters('teeny_mce_plugins', array('colorpicker', 'lists', 'fullscreen', 'image', 'wordpress', 'wpeditimage', 'wplink'), $editor_id);
380 380
 				} else {
381 381
 
382 382
 					/**
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 					 *
397 397
 					 * @param array $external_plugins An array of external TinyMCE plugins.
398 398
 					 */
399
-					$mce_external_plugins = apply_filters( 'mce_external_plugins', array() );
399
+					$mce_external_plugins = apply_filters('mce_external_plugins', array());
400 400
 
401 401
 					$plugins = array(
402 402
 						'charmap',
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
 						'wpembed',
421 421
 					);
422 422
 
423
-					if ( ! self::$has_medialib ) {
423
+					if ( ! self::$has_medialib) {
424 424
 						$plugins[] = 'image';
425 425
 					}
426 426
 
@@ -434,15 +434,15 @@  discard block
 block discarded – undo
434 434
 					 *
435 435
 					 * @param array $plugins An array of default TinyMCE plugins.
436 436
 					 */
437
-					$plugins = array_unique( apply_filters( 'tiny_mce_plugins', $plugins ) );
437
+					$plugins = array_unique(apply_filters('tiny_mce_plugins', $plugins));
438 438
 
439
-					if ( ( $key = array_search( 'spellchecker', $plugins ) ) !== false ) {
439
+					if (($key = array_search('spellchecker', $plugins)) !== false) {
440 440
 						// Remove 'spellchecker' from the internal plugins if added with 'tiny_mce_plugins' filter to prevent errors.
441 441
 						// It can be added with 'mce_external_plugins'.
442
-						unset( $plugins[$key] );
442
+						unset($plugins[$key]);
443 443
 					}
444 444
 
445
-					if ( ! empty( $mce_external_plugins ) ) {
445
+					if ( ! empty($mce_external_plugins)) {
446 446
 
447 447
 						/**
448 448
 						 * Filters the translations loaded for external TinyMCE 3.x plugins.
@@ -457,64 +457,64 @@  discard block
 block discarded – undo
457 457
 						 *
458 458
 						 * @param array $translations Translations for external TinyMCE plugins.
459 459
 						 */
460
-						$mce_external_languages = apply_filters( 'mce_external_languages', array() );
460
+						$mce_external_languages = apply_filters('mce_external_languages', array());
461 461
 
462 462
 						$loaded_langs = array();
463 463
 						$strings = '';
464 464
 
465
-						if ( ! empty( $mce_external_languages ) ) {
466
-							foreach ( $mce_external_languages as $name => $path ) {
467
-								if ( @is_file( $path ) && @is_readable( $path ) ) {
468
-									include_once( $path );
469
-									$ext_plugins .= $strings . "\n";
465
+						if ( ! empty($mce_external_languages)) {
466
+							foreach ($mce_external_languages as $name => $path) {
467
+								if (@is_file($path) && @is_readable($path)) {
468
+									include_once($path);
469
+									$ext_plugins .= $strings."\n";
470 470
 									$loaded_langs[] = $name;
471 471
 								}
472 472
 							}
473 473
 						}
474 474
 
475
-						foreach ( $mce_external_plugins as $name => $url ) {
476
-							if ( in_array( $name, $plugins, true ) ) {
477
-								unset( $mce_external_plugins[ $name ] );
475
+						foreach ($mce_external_plugins as $name => $url) {
476
+							if (in_array($name, $plugins, true)) {
477
+								unset($mce_external_plugins[$name]);
478 478
 								continue;
479 479
 							}
480 480
 
481
-							$url = set_url_scheme( $url );
482
-							$mce_external_plugins[ $name ] = $url;
483
-							$plugurl = dirname( $url );
481
+							$url = set_url_scheme($url);
482
+							$mce_external_plugins[$name] = $url;
483
+							$plugurl = dirname($url);
484 484
 							$strings = '';
485 485
 
486 486
 							// Try to load langs/[locale].js and langs/[locale]_dlg.js
487
-							if ( ! in_array( $name, $loaded_langs, true ) ) {
488
-								$path = str_replace( content_url(), '', $plugurl );
489
-								$path = WP_CONTENT_DIR . $path . '/langs/';
487
+							if ( ! in_array($name, $loaded_langs, true)) {
488
+								$path = str_replace(content_url(), '', $plugurl);
489
+								$path = WP_CONTENT_DIR.$path.'/langs/';
490 490
 
491
-								if ( function_exists('realpath') )
492
-									$path = trailingslashit( realpath($path) );
491
+								if (function_exists('realpath'))
492
+									$path = trailingslashit(realpath($path));
493 493
 
494
-								if ( @is_file( $path . $mce_locale . '.js' ) )
495
-									$strings .= @file_get_contents( $path . $mce_locale . '.js' ) . "\n";
494
+								if (@is_file($path.$mce_locale.'.js'))
495
+									$strings .= @file_get_contents($path.$mce_locale.'.js')."\n";
496 496
 
497
-								if ( @is_file( $path . $mce_locale . '_dlg.js' ) )
498
-									$strings .= @file_get_contents( $path . $mce_locale . '_dlg.js' ) . "\n";
497
+								if (@is_file($path.$mce_locale.'_dlg.js'))
498
+									$strings .= @file_get_contents($path.$mce_locale.'_dlg.js')."\n";
499 499
 
500
-								if ( 'en' != $mce_locale && empty( $strings ) ) {
501
-									if ( @is_file( $path . 'en.js' ) ) {
502
-										$str1 = @file_get_contents( $path . 'en.js' );
503
-										$strings .= preg_replace( '/([\'"])en\./', '$1' . $mce_locale . '.', $str1, 1 ) . "\n";
500
+								if ('en' != $mce_locale && empty($strings)) {
501
+									if (@is_file($path.'en.js')) {
502
+										$str1 = @file_get_contents($path.'en.js');
503
+										$strings .= preg_replace('/([\'"])en\./', '$1'.$mce_locale.'.', $str1, 1)."\n";
504 504
 									}
505 505
 
506
-									if ( @is_file( $path . 'en_dlg.js' ) ) {
507
-										$str2 = @file_get_contents( $path . 'en_dlg.js' );
508
-										$strings .= preg_replace( '/([\'"])en\./', '$1' . $mce_locale . '.', $str2, 1 ) . "\n";
506
+									if (@is_file($path.'en_dlg.js')) {
507
+										$str2 = @file_get_contents($path.'en_dlg.js');
508
+										$strings .= preg_replace('/([\'"])en\./', '$1'.$mce_locale.'.', $str2, 1)."\n";
509 509
 									}
510 510
 								}
511 511
 
512
-								if ( ! empty( $strings ) )
513
-									$ext_plugins .= "\n" . $strings . "\n";
512
+								if ( ! empty($strings))
513
+									$ext_plugins .= "\n".$strings."\n";
514 514
 							}
515 515
 
516
-							$ext_plugins .= 'tinyMCEPreInit.load_ext("' . $plugurl . '", "' . $mce_locale . '");' . "\n";
517
-							$ext_plugins .= 'tinymce.PluginManager.load("' . $name . '", "' . $url . '");' . "\n";
516
+							$ext_plugins .= 'tinyMCEPreInit.load_ext("'.$plugurl.'", "'.$mce_locale.'");'."\n";
517
+							$ext_plugins .= 'tinymce.PluginManager.load("'.$name.'", "'.$url.'");'."\n";
518 518
 						}
519 519
 					}
520 520
 				}
@@ -526,20 +526,20 @@  discard block
 block discarded – undo
526 526
 					'theme' => 'modern',
527 527
 					'skin' => 'lightgray',
528 528
 					'language' => self::$mce_locale,
529
-					'formats' => '{' .
530
-						'alignleft: [' .
531
-							'{selector: "p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li", styles: {textAlign:"left"}},' .
532
-							'{selector: "img,table,dl.wp-caption", classes: "alignleft"}' .
533
-						'],' .
534
-						'aligncenter: [' .
535
-							'{selector: "p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li", styles: {textAlign:"center"}},' .
536
-							'{selector: "img,table,dl.wp-caption", classes: "aligncenter"}' .
537
-						'],' .
538
-						'alignright: [' .
539
-							'{selector: "p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li", styles: {textAlign:"right"}},' .
540
-							'{selector: "img,table,dl.wp-caption", classes: "alignright"}' .
541
-						'],' .
542
-						'strikethrough: {inline: "del"}' .
529
+					'formats' => '{'.
530
+						'alignleft: ['.
531
+							'{selector: "p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li", styles: {textAlign:"left"}},'.
532
+							'{selector: "img,table,dl.wp-caption", classes: "alignleft"}'.
533
+						'],'.
534
+						'aligncenter: ['.
535
+							'{selector: "p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li", styles: {textAlign:"center"}},'.
536
+							'{selector: "img,table,dl.wp-caption", classes: "aligncenter"}'.
537
+						'],'.
538
+						'alignright: ['.
539
+							'{selector: "p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li", styles: {textAlign:"right"}},'.
540
+							'{selector: "img,table,dl.wp-caption", classes: "alignright"}'.
541
+						'],'.
542
+						'strikethrough: {inline: "del"}'.
543 543
 					'}',
544 544
 					'relative_urls' => false,
545 545
 					'remove_script_host' => false,
@@ -549,36 +549,36 @@  discard block
 block discarded – undo
549 549
 					'entities' => '38,amp,60,lt,62,gt',
550 550
 					'entity_encoding' => 'raw',
551 551
 					'keep_styles' => false,
552
-					'cache_suffix' => 'wp-mce-' . $tinymce_version,
552
+					'cache_suffix' => 'wp-mce-'.$tinymce_version,
553 553
 
554 554
 					// Limit the preview styles in the menu/toolbar
555 555
 					'preview_styles' => 'font-family font-size font-weight font-style text-decoration text-transform',
556 556
 
557 557
 					'end_container_on_empty_block' => true,
558 558
 					'wpeditimage_disable_captions' => $no_captions,
559
-					'wpeditimage_html5_captions' => current_theme_supports( 'html5', 'caption' ),
560
-					'plugins' => implode( ',', $plugins ),
561
-					'wp_lang_attr' => get_bloginfo( 'language' ),
562
-					'wp_shortcut_labels' => wp_json_encode( $shortcut_labels ),
559
+					'wpeditimage_html5_captions' => current_theme_supports('html5', 'caption'),
560
+					'plugins' => implode(',', $plugins),
561
+					'wp_lang_attr' => get_bloginfo('language'),
562
+					'wp_shortcut_labels' => wp_json_encode($shortcut_labels),
563 563
 				);
564 564
 
565
-				if ( ! empty( $mce_external_plugins ) ) {
566
-					self::$first_init['external_plugins'] = wp_json_encode( $mce_external_plugins );
565
+				if ( ! empty($mce_external_plugins)) {
566
+					self::$first_init['external_plugins'] = wp_json_encode($mce_external_plugins);
567 567
 				}
568 568
 
569 569
 				$suffix = SCRIPT_DEBUG ? '' : '.min';
570
-				$version = 'ver=' . get_bloginfo( 'version' );
571
-				$dashicons = includes_url( "css/dashicons$suffix.css?$version" );
570
+				$version = 'ver='.get_bloginfo('version');
571
+				$dashicons = includes_url("css/dashicons$suffix.css?$version");
572 572
 
573 573
 				// WordPress default stylesheet and dashicons
574 574
 				$mce_css = array(
575 575
 					$dashicons,
576
-					self::$baseurl . '/skins/wordpress/wp-content.css?' . $version
576
+					self::$baseurl.'/skins/wordpress/wp-content.css?'.$version
577 577
 				);
578 578
 
579 579
 				$editor_styles = get_editor_stylesheets();
580
-				if ( ! empty( $editor_styles ) ) {
581
-					foreach ( $editor_styles as $style ) {
580
+				if ( ! empty($editor_styles)) {
581
+					foreach ($editor_styles as $style) {
582 582
 						$mce_css[] = $style;
583 583
 					}
584 584
 				}
@@ -590,13 +590,13 @@  discard block
 block discarded – undo
590 590
 				 *
591 591
 				 * @param string $stylesheets Comma-delimited list of stylesheets.
592 592
 				 */
593
-				$mce_css = trim( apply_filters( 'mce_css', implode( ',', $mce_css ) ), ' ,' );
593
+				$mce_css = trim(apply_filters('mce_css', implode(',', $mce_css)), ' ,');
594 594
 
595
-				if ( ! empty($mce_css) )
595
+				if ( ! empty($mce_css))
596 596
 					self::$first_init['content_css'] = $mce_css;
597 597
 			}
598 598
 
599
-			if ( $set['teeny'] ) {
599
+			if ($set['teeny']) {
600 600
 
601 601
 				/**
602 602
 				 * Filters the list of teenyMCE buttons (Text tab).
@@ -606,13 +606,13 @@  discard block
 block discarded – undo
606 606
 				 * @param array  $buttons   An array of teenyMCE buttons.
607 607
 				 * @param string $editor_id Unique editor identifier, e.g. 'content'.
608 608
 				 */
609
-				$mce_buttons = apply_filters( 'teeny_mce_buttons', array('bold', 'italic', 'underline', 'blockquote', 'strikethrough', 'bullist', 'numlist', 'alignleft', 'aligncenter', 'alignright', 'undo', 'redo', 'link', 'unlink', 'fullscreen'), $editor_id );
609
+				$mce_buttons = apply_filters('teeny_mce_buttons', array('bold', 'italic', 'underline', 'blockquote', 'strikethrough', 'bullist', 'numlist', 'alignleft', 'aligncenter', 'alignright', 'undo', 'redo', 'link', 'unlink', 'fullscreen'), $editor_id);
610 610
 				$mce_buttons_2 = $mce_buttons_3 = $mce_buttons_4 = array();
611 611
 			} else {
612
-				$mce_buttons = array( 'formatselect', 'bold', 'italic', 'bullist', 'numlist', 'blockquote', 'alignleft', 'aligncenter', 'alignright', 'link', 'unlink', 'wp_more', 'spellchecker' );
612
+				$mce_buttons = array('formatselect', 'bold', 'italic', 'bullist', 'numlist', 'blockquote', 'alignleft', 'aligncenter', 'alignright', 'link', 'unlink', 'wp_more', 'spellchecker');
613 613
 
614
-				if ( ! wp_is_mobile() ) {
615
-					if ( $set['_content_editor_dfw'] ) {
614
+				if ( ! wp_is_mobile()) {
615
+					if ($set['_content_editor_dfw']) {
616 616
 						$mce_buttons[] = 'dfw';
617 617
 					} else {
618 618
 						$mce_buttons[] = 'fullscreen';
@@ -629,11 +629,11 @@  discard block
 block discarded – undo
629 629
 				 * @param array  $buttons   First-row list of buttons.
630 630
 				 * @param string $editor_id Unique editor identifier, e.g. 'content'.
631 631
 				 */
632
-				$mce_buttons = apply_filters( 'mce_buttons', $mce_buttons, $editor_id );
632
+				$mce_buttons = apply_filters('mce_buttons', $mce_buttons, $editor_id);
633 633
 
634
-				$mce_buttons_2 = array( 'strikethrough', 'hr', 'forecolor', 'pastetext', 'removeformat', 'charmap', 'outdent', 'indent', 'undo', 'redo' );
634
+				$mce_buttons_2 = array('strikethrough', 'hr', 'forecolor', 'pastetext', 'removeformat', 'charmap', 'outdent', 'indent', 'undo', 'redo');
635 635
 
636
-				if ( ! wp_is_mobile() ) {
636
+				if ( ! wp_is_mobile()) {
637 637
 					$mce_buttons_2[] = 'wp_help';
638 638
 				}
639 639
 
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
 				 * @param array  $buttons   Second-row list of buttons.
646 646
 				 * @param string $editor_id Unique editor identifier, e.g. 'content'.
647 647
 				 */
648
-				$mce_buttons_2 = apply_filters( 'mce_buttons_2', $mce_buttons_2, $editor_id );
648
+				$mce_buttons_2 = apply_filters('mce_buttons_2', $mce_buttons_2, $editor_id);
649 649
 
650 650
 				/**
651 651
 				 * Filters the third-row list of TinyMCE buttons (Visual tab).
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
 				 * @param array  $buttons   Third-row list of buttons.
656 656
 				 * @param string $editor_id Unique editor identifier, e.g. 'content'.
657 657
 				 */
658
-				$mce_buttons_3 = apply_filters( 'mce_buttons_3', array(), $editor_id );
658
+				$mce_buttons_3 = apply_filters('mce_buttons_3', array(), $editor_id);
659 659
 
660 660
 				/**
661 661
 				 * Filters the fourth-row list of TinyMCE buttons (Visual tab).
@@ -665,38 +665,38 @@  discard block
 block discarded – undo
665 665
 				 * @param array  $buttons   Fourth-row list of buttons.
666 666
 				 * @param string $editor_id Unique editor identifier, e.g. 'content'.
667 667
 				 */
668
-				$mce_buttons_4 = apply_filters( 'mce_buttons_4', array(), $editor_id );
668
+				$mce_buttons_4 = apply_filters('mce_buttons_4', array(), $editor_id);
669 669
 			}
670 670
 
671 671
 			$body_class = $editor_id;
672 672
 
673
-			if ( $post = get_post() ) {
674
-				$body_class .= ' post-type-' . sanitize_html_class( $post->post_type ) . ' post-status-' . sanitize_html_class( $post->post_status );
673
+			if ($post = get_post()) {
674
+				$body_class .= ' post-type-'.sanitize_html_class($post->post_type).' post-status-'.sanitize_html_class($post->post_status);
675 675
 
676
-				if ( post_type_supports( $post->post_type, 'post-formats' ) ) {
677
-					$post_format = get_post_format( $post );
678
-					if ( $post_format && ! is_wp_error( $post_format ) )
679
-						$body_class .= ' post-format-' . sanitize_html_class( $post_format );
676
+				if (post_type_supports($post->post_type, 'post-formats')) {
677
+					$post_format = get_post_format($post);
678
+					if ($post_format && ! is_wp_error($post_format))
679
+						$body_class .= ' post-format-'.sanitize_html_class($post_format);
680 680
 					else
681 681
 						$body_class .= ' post-format-standard';
682 682
 				}
683 683
 
684
-				$page_template = get_page_template_slug( $post );
684
+				$page_template = get_page_template_slug($post);
685 685
 
686
-				if ( $page_template !== false ) {
687
-					$page_template = empty( $page_template ) ? 'default' : str_replace( '.', '-', basename( $page_template, '.php' ) );
688
-					$body_class .= ' page-template-' . sanitize_html_class( $page_template );
686
+				if ($page_template !== false) {
687
+					$page_template = empty($page_template) ? 'default' : str_replace('.', '-', basename($page_template, '.php'));
688
+					$body_class .= ' page-template-'.sanitize_html_class($page_template);
689 689
 				}
690 690
 			}
691 691
 
692
-			$body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_user_locale() ) ) );
692
+			$body_class .= ' locale-'.sanitize_html_class(strtolower(str_replace('_', '-', get_user_locale())));
693 693
 
694
-			if ( !empty($set['tinymce']['body_class']) ) {
695
-				$body_class .= ' ' . $set['tinymce']['body_class'];
694
+			if ( ! empty($set['tinymce']['body_class'])) {
695
+				$body_class .= ' '.$set['tinymce']['body_class'];
696 696
 				unset($set['tinymce']['body_class']);
697 697
 			}
698 698
 
699
-			$mceInit = array (
699
+			$mceInit = array(
700 700
 				'selector' => "#$editor_id",
701 701
 				'resize' => 'vertical',
702 702
 				'menubar' => false,
@@ -711,10 +711,10 @@  discard block
 block discarded – undo
711 711
 			);
712 712
 
713 713
 			// Merge with the first part of the init array
714
-			$mceInit = array_merge( self::$first_init, $mceInit );
714
+			$mceInit = array_merge(self::$first_init, $mceInit);
715 715
 
716
-			if ( is_array( $set['tinymce'] ) )
717
-				$mceInit = array_merge( $mceInit, $set['tinymce'] );
716
+			if (is_array($set['tinymce']))
717
+				$mceInit = array_merge($mceInit, $set['tinymce']);
718 718
 
719 719
 			/*
720 720
 			 * For people who really REALLY know what they're doing with TinyMCE
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
 			 * is to use the default cleanup by not specifying valid_elements,
725 725
 			 * as TinyMCE checks against the full set of HTML 5.0 elements and attributes.
726 726
 			 */
727
-			if ( $set['teeny'] ) {
727
+			if ($set['teeny']) {
728 728
 
729 729
 				/**
730 730
 				 * Filters the teenyMCE config before init.
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
 				 * @param array  $mceInit   An array with teenyMCE config.
735 735
 				 * @param string $editor_id Unique editor identifier, e.g. 'content'.
736 736
 				 */
737
-				$mceInit = apply_filters( 'teeny_mce_before_init', $mceInit, $editor_id );
737
+				$mceInit = apply_filters('teeny_mce_before_init', $mceInit, $editor_id);
738 738
 			} else {
739 739
 
740 740
 				/**
@@ -745,10 +745,10 @@  discard block
 block discarded – undo
745 745
 				 * @param array  $mceInit   An array with TinyMCE config.
746 746
 				 * @param string $editor_id Unique editor identifier, e.g. 'content'.
747 747
 				 */
748
-				$mceInit = apply_filters( 'tiny_mce_before_init', $mceInit, $editor_id );
748
+				$mceInit = apply_filters('tiny_mce_before_init', $mceInit, $editor_id);
749 749
 			}
750 750
 
751
-			if ( empty( $mceInit['toolbar3'] ) && ! empty( $mceInit['toolbar4'] ) ) {
751
+			if (empty($mceInit['toolbar3']) && ! empty($mceInit['toolbar4'])) {
752 752
 				$mceInit['toolbar3'] = $mceInit['toolbar4'];
753 753
 				$mceInit['toolbar4'] = '';
754 754
 			}
@@ -766,19 +766,19 @@  discard block
 block discarded – undo
766 766
 	private static function _parse_init($init) {
767 767
 		$options = '';
768 768
 
769
-		foreach ( $init as $k => $v ) {
770
-			if ( is_bool($v) ) {
769
+		foreach ($init as $k => $v) {
770
+			if (is_bool($v)) {
771 771
 				$val = $v ? 'true' : 'false';
772
-				$options .= $k . ':' . $val . ',';
772
+				$options .= $k.':'.$val.',';
773 773
 				continue;
774
-			} elseif ( !empty($v) && is_string($v) && ( ('{' == $v{0} && '}' == $v{strlen($v) - 1}) || ('[' == $v{0} && ']' == $v{strlen($v) - 1}) || preg_match('/^\(?function ?\(/', $v) ) ) {
775
-				$options .= $k . ':' . $v . ',';
774
+			} elseif ( ! empty($v) && is_string($v) && (('{' == $v{0} && '}' == $v{strlen($v) - 1}) || ('[' == $v{0} && ']' == $v{strlen($v) - 1}) || preg_match('/^\(?function ?\(/', $v))) {
775
+				$options .= $k.':'.$v.',';
776 776
 				continue;
777 777
 			}
778
-			$options .= $k . ':"' . $v . '",';
778
+			$options .= $k.':"'.$v.'",';
779 779
 		}
780 780
 
781
-		return '{' . trim( $options, ' ,' ) . '}';
781
+		return '{'.trim($options, ' ,').'}';
782 782
 	}
783 783
 
784 784
 	/**
@@ -786,27 +786,27 @@  discard block
 block discarded – undo
786 786
 	 * @static
787 787
 	 */
788 788
 	public static function enqueue_scripts() {
789
-		if ( self::$has_tinymce )
789
+		if (self::$has_tinymce)
790 790
 			wp_enqueue_script('editor');
791 791
 
792
-		if ( self::$has_quicktags ) {
793
-			wp_enqueue_script( 'quicktags' );
794
-			wp_enqueue_style( 'buttons' );
792
+		if (self::$has_quicktags) {
793
+			wp_enqueue_script('quicktags');
794
+			wp_enqueue_style('buttons');
795 795
 		}
796 796
 
797
-		if ( in_array('wplink', self::$plugins, true) || in_array('link', self::$qt_buttons, true) ) {
797
+		if (in_array('wplink', self::$plugins, true) || in_array('link', self::$qt_buttons, true)) {
798 798
 			wp_enqueue_script('wplink');
799
-			wp_enqueue_script( 'jquery-ui-autocomplete' );
799
+			wp_enqueue_script('jquery-ui-autocomplete');
800 800
 		}
801 801
 
802
-		if ( self::$old_dfw_compat ) {
802
+		if (self::$old_dfw_compat) {
803 803
 			wp_enqueue_script('wp-fullscreen-stub');
804 804
 		}
805 805
 
806
-		if ( self::$has_medialib ) {
806
+		if (self::$has_medialib) {
807 807
 			add_thickbox();
808
-			wp_enqueue_script( 'media-upload' );
809
-			wp_enqueue_script( 'wp-embed' );
808
+			wp_enqueue_script('media-upload');
809
+			wp_enqueue_script('wp-embed');
810 810
 		}
811 811
 
812 812
 		/**
@@ -817,270 +817,270 @@  discard block
 block discarded – undo
817 817
 		 * @param array $to_load An array containing boolean values whether TinyMCE
818 818
 		 *                       and Quicktags are being loaded.
819 819
 		 */
820
-		do_action( 'wp_enqueue_editor', array(
820
+		do_action('wp_enqueue_editor', array(
821 821
 			'tinymce'   => self::$has_tinymce,
822 822
 			'quicktags' => self::$has_quicktags,
823
-		) );
823
+		));
824 824
 	}
825 825
 
826 826
 	private static function get_translation() {
827
-		if ( empty( self::$translation ) ) {
827
+		if (empty(self::$translation)) {
828 828
 			self::$translation = array(
829 829
 			// Default TinyMCE strings
830
-			'New document' => __( 'New document' ),
831
-			'Formats' => _x( 'Formats', 'TinyMCE' ),
830
+			'New document' => __('New document'),
831
+			'Formats' => _x('Formats', 'TinyMCE'),
832 832
 
833
-			'Headings' => _x( 'Headings', 'TinyMCE' ),
834
-			'Heading 1' => array( __( 'Heading 1' ), 'access1' ),
835
-			'Heading 2' => array( __( 'Heading 2' ), 'access2' ),
836
-			'Heading 3' => array( __( 'Heading 3' ), 'access3' ),
837
-			'Heading 4' => array( __( 'Heading 4' ), 'access4' ),
838
-			'Heading 5' => array( __( 'Heading 5' ), 'access5' ),
839
-			'Heading 6' => array( __( 'Heading 6' ), 'access6' ),
833
+			'Headings' => _x('Headings', 'TinyMCE'),
834
+			'Heading 1' => array(__('Heading 1'), 'access1'),
835
+			'Heading 2' => array(__('Heading 2'), 'access2'),
836
+			'Heading 3' => array(__('Heading 3'), 'access3'),
837
+			'Heading 4' => array(__('Heading 4'), 'access4'),
838
+			'Heading 5' => array(__('Heading 5'), 'access5'),
839
+			'Heading 6' => array(__('Heading 6'), 'access6'),
840 840
 
841 841
 			/* translators: block tags */
842
-			'Blocks' => _x( 'Blocks', 'TinyMCE' ),
843
-			'Paragraph' => array( __( 'Paragraph' ), 'access7' ),
844
-			'Blockquote' => array( __( 'Blockquote' ), 'accessQ' ),
845
-			'Div' => _x( 'Div', 'HTML tag' ),
846
-			'Pre' => _x( 'Pre', 'HTML tag' ),
847
-			'Preformatted' => _x( 'Preformatted', 'HTML tag' ),
848
-			'Address' => _x( 'Address', 'HTML tag' ),
849
-
850
-			'Inline' => _x( 'Inline', 'HTML elements' ),
851
-			'Underline' => array( __( 'Underline' ), 'metaU' ),
852
-			'Strikethrough' => array( __( 'Strikethrough' ), 'accessD' ),
853
-			'Subscript' => __( 'Subscript' ),
854
-			'Superscript' => __( 'Superscript' ),
855
-			'Clear formatting' => __( 'Clear formatting' ),
856
-			'Bold' => array( __( 'Bold' ), 'metaB' ),
857
-			'Italic' => array( __( 'Italic' ), 'metaI' ),
858
-			'Code' => array( __( 'Code' ), 'accessX' ),
859
-			'Source code' => __( 'Source code' ),
860
-			'Font Family' => __( 'Font Family' ),
861
-			'Font Sizes' => __( 'Font Sizes' ),
862
-
863
-			'Align center' => array( __( 'Align center' ), 'accessC' ),
864
-			'Align right' => array( __( 'Align right' ), 'accessR' ),
865
-			'Align left' => array( __( 'Align left' ), 'accessL' ),
866
-			'Justify' => array( __( 'Justify' ), 'accessJ' ),
867
-			'Increase indent' => __( 'Increase indent' ),
868
-			'Decrease indent' => __( 'Decrease indent' ),
869
-
870
-			'Cut' => array( __( 'Cut' ), 'metaX' ),
871
-			'Copy' => array( __( 'Copy' ), 'metaC' ),
872
-			'Paste' => array( __( 'Paste' ), 'metaV' ),
873
-			'Select all' => array( __( 'Select all' ), 'metaA' ),
874
-			'Undo' => array( __( 'Undo' ), 'metaZ' ),
875
-			'Redo' => array( __( 'Redo' ), 'metaY' ),
876
-
877
-			'Ok' => __( 'OK' ),
878
-			'Cancel' => __( 'Cancel' ),
879
-			'Close' => __( 'Close' ),
880
-			'Visual aids' => __( 'Visual aids' ),
881
-
882
-			'Bullet list' => array( __( 'Bulleted list' ), 'accessU' ),
883
-			'Numbered list' => array( __( 'Numbered list' ), 'accessO' ),
884
-			'Square' => _x( 'Square', 'list style' ),
885
-			'Default' => _x( 'Default', 'list style' ),
886
-			'Circle' => _x( 'Circle', 'list style' ),
887
-			'Disc' => _x('Disc', 'list style' ),
888
-			'Lower Greek' => _x( 'Lower Greek', 'list style' ),
889
-			'Lower Alpha' => _x( 'Lower Alpha', 'list style' ),
890
-			'Upper Alpha' => _x( 'Upper Alpha', 'list style' ),
891
-			'Upper Roman' => _x( 'Upper Roman', 'list style' ),
892
-			'Lower Roman' => _x( 'Lower Roman', 'list style' ),
842
+			'Blocks' => _x('Blocks', 'TinyMCE'),
843
+			'Paragraph' => array(__('Paragraph'), 'access7'),
844
+			'Blockquote' => array(__('Blockquote'), 'accessQ'),
845
+			'Div' => _x('Div', 'HTML tag'),
846
+			'Pre' => _x('Pre', 'HTML tag'),
847
+			'Preformatted' => _x('Preformatted', 'HTML tag'),
848
+			'Address' => _x('Address', 'HTML tag'),
849
+
850
+			'Inline' => _x('Inline', 'HTML elements'),
851
+			'Underline' => array(__('Underline'), 'metaU'),
852
+			'Strikethrough' => array(__('Strikethrough'), 'accessD'),
853
+			'Subscript' => __('Subscript'),
854
+			'Superscript' => __('Superscript'),
855
+			'Clear formatting' => __('Clear formatting'),
856
+			'Bold' => array(__('Bold'), 'metaB'),
857
+			'Italic' => array(__('Italic'), 'metaI'),
858
+			'Code' => array(__('Code'), 'accessX'),
859
+			'Source code' => __('Source code'),
860
+			'Font Family' => __('Font Family'),
861
+			'Font Sizes' => __('Font Sizes'),
862
+
863
+			'Align center' => array(__('Align center'), 'accessC'),
864
+			'Align right' => array(__('Align right'), 'accessR'),
865
+			'Align left' => array(__('Align left'), 'accessL'),
866
+			'Justify' => array(__('Justify'), 'accessJ'),
867
+			'Increase indent' => __('Increase indent'),
868
+			'Decrease indent' => __('Decrease indent'),
869
+
870
+			'Cut' => array(__('Cut'), 'metaX'),
871
+			'Copy' => array(__('Copy'), 'metaC'),
872
+			'Paste' => array(__('Paste'), 'metaV'),
873
+			'Select all' => array(__('Select all'), 'metaA'),
874
+			'Undo' => array(__('Undo'), 'metaZ'),
875
+			'Redo' => array(__('Redo'), 'metaY'),
876
+
877
+			'Ok' => __('OK'),
878
+			'Cancel' => __('Cancel'),
879
+			'Close' => __('Close'),
880
+			'Visual aids' => __('Visual aids'),
881
+
882
+			'Bullet list' => array(__('Bulleted list'), 'accessU'),
883
+			'Numbered list' => array(__('Numbered list'), 'accessO'),
884
+			'Square' => _x('Square', 'list style'),
885
+			'Default' => _x('Default', 'list style'),
886
+			'Circle' => _x('Circle', 'list style'),
887
+			'Disc' => _x('Disc', 'list style'),
888
+			'Lower Greek' => _x('Lower Greek', 'list style'),
889
+			'Lower Alpha' => _x('Lower Alpha', 'list style'),
890
+			'Upper Alpha' => _x('Upper Alpha', 'list style'),
891
+			'Upper Roman' => _x('Upper Roman', 'list style'),
892
+			'Lower Roman' => _x('Lower Roman', 'list style'),
893 893
 
894 894
 			// Anchor plugin
895
-			'Name' => _x( 'Name', 'Name of link anchor (TinyMCE)' ),
896
-			'Anchor' => _x( 'Anchor', 'Link anchor (TinyMCE)' ),
897
-			'Anchors' => _x( 'Anchors', 'Link anchors (TinyMCE)' ),
895
+			'Name' => _x('Name', 'Name of link anchor (TinyMCE)'),
896
+			'Anchor' => _x('Anchor', 'Link anchor (TinyMCE)'),
897
+			'Anchors' => _x('Anchors', 'Link anchors (TinyMCE)'),
898 898
 
899 899
 			// Fullpage plugin
900
-			'Document properties' => __( 'Document properties' ),
901
-			'Robots' => __( 'Robots' ),
902
-			'Title' => __( 'Title' ),
903
-			'Keywords' => __( 'Keywords' ),
904
-			'Encoding' => __( 'Encoding' ),
905
-			'Description' => __( 'Description' ),
906
-			'Author' => __( 'Author' ),
900
+			'Document properties' => __('Document properties'),
901
+			'Robots' => __('Robots'),
902
+			'Title' => __('Title'),
903
+			'Keywords' => __('Keywords'),
904
+			'Encoding' => __('Encoding'),
905
+			'Description' => __('Description'),
906
+			'Author' => __('Author'),
907 907
 
908 908
 			// Media, image plugins
909
-			'Insert/edit image' => array( __( 'Insert/edit image' ), 'accessM' ),
910
-			'General' => __( 'General' ),
911
-			'Advanced' => __( 'Advanced' ),
912
-			'Source' => __( 'Source' ),
913
-			'Border' => __( 'Border' ),
914
-			'Constrain proportions' => __( 'Constrain proportions' ),
915
-			'Vertical space' => __( 'Vertical space' ),
916
-			'Image description' => __( 'Image description' ),
917
-			'Style' => __( 'Style' ),
918
-			'Dimensions' => __( 'Dimensions' ),
919
-			'Insert image' => __( 'Insert image' ),
920
-			'Insert date/time' => __( 'Insert date/time' ),
921
-			'Insert/edit video' => __( 'Insert/edit video' ),
922
-			'Poster' => __( 'Poster' ),
923
-			'Alternative source' => __( 'Alternative source' ),
924
-			'Paste your embed code below:' => __( 'Paste your embed code below:' ),
925
-			'Insert video' => __( 'Insert video' ),
926
-			'Embed' => __( 'Embed' ),
909
+			'Insert/edit image' => array(__('Insert/edit image'), 'accessM'),
910
+			'General' => __('General'),
911
+			'Advanced' => __('Advanced'),
912
+			'Source' => __('Source'),
913
+			'Border' => __('Border'),
914
+			'Constrain proportions' => __('Constrain proportions'),
915
+			'Vertical space' => __('Vertical space'),
916
+			'Image description' => __('Image description'),
917
+			'Style' => __('Style'),
918
+			'Dimensions' => __('Dimensions'),
919
+			'Insert image' => __('Insert image'),
920
+			'Insert date/time' => __('Insert date/time'),
921
+			'Insert/edit video' => __('Insert/edit video'),
922
+			'Poster' => __('Poster'),
923
+			'Alternative source' => __('Alternative source'),
924
+			'Paste your embed code below:' => __('Paste your embed code below:'),
925
+			'Insert video' => __('Insert video'),
926
+			'Embed' => __('Embed'),
927 927
 
928 928
 			// Each of these have a corresponding plugin
929
-			'Special character' => __( 'Special character' ),
930
-			'Right to left' => _x( 'Right to left', 'editor button' ),
931
-			'Left to right' => _x( 'Left to right', 'editor button' ),
932
-			'Emoticons' => __( 'Emoticons' ),
933
-			'Nonbreaking space' => __( 'Nonbreaking space' ),
934
-			'Page break' => __( 'Page break' ),
935
-			'Paste as text' => __( 'Paste as text' ),
936
-			'Preview' => __( 'Preview' ),
937
-			'Print' => __( 'Print' ),
938
-			'Save' => __( 'Save' ),
939
-			'Fullscreen' => __( 'Fullscreen' ),
940
-			'Horizontal line' => __( 'Horizontal line' ),
941
-			'Horizontal space' => __( 'Horizontal space' ),
942
-			'Restore last draft' => __( 'Restore last draft' ),
943
-			'Insert/edit link' => array( __( 'Insert/edit link' ), 'metaK' ),
944
-			'Remove link' => array( __( 'Remove link' ), 'accessS' ),
945
-
946
-			'Color' => __( 'Color' ),
947
-			'Custom color' => __( 'Custom color' ),
948
-			'Custom...' => _x( 'Custom...', 'label for custom color' ), // no ellipsis
949
-			'No color' => __( 'No color' ),
929
+			'Special character' => __('Special character'),
930
+			'Right to left' => _x('Right to left', 'editor button'),
931
+			'Left to right' => _x('Left to right', 'editor button'),
932
+			'Emoticons' => __('Emoticons'),
933
+			'Nonbreaking space' => __('Nonbreaking space'),
934
+			'Page break' => __('Page break'),
935
+			'Paste as text' => __('Paste as text'),
936
+			'Preview' => __('Preview'),
937
+			'Print' => __('Print'),
938
+			'Save' => __('Save'),
939
+			'Fullscreen' => __('Fullscreen'),
940
+			'Horizontal line' => __('Horizontal line'),
941
+			'Horizontal space' => __('Horizontal space'),
942
+			'Restore last draft' => __('Restore last draft'),
943
+			'Insert/edit link' => array(__('Insert/edit link'), 'metaK'),
944
+			'Remove link' => array(__('Remove link'), 'accessS'),
945
+
946
+			'Color' => __('Color'),
947
+			'Custom color' => __('Custom color'),
948
+			'Custom...' => _x('Custom...', 'label for custom color'), // no ellipsis
949
+			'No color' => __('No color'),
950 950
 
951 951
 			// Spelling, search/replace plugins
952
-			'Could not find the specified string.' => __( 'Could not find the specified string.' ),
953
-			'Replace' => _x( 'Replace', 'find/replace' ),
954
-			'Next' => _x( 'Next', 'find/replace' ),
952
+			'Could not find the specified string.' => __('Could not find the specified string.'),
953
+			'Replace' => _x('Replace', 'find/replace'),
954
+			'Next' => _x('Next', 'find/replace'),
955 955
 			/* translators: previous */
956
-			'Prev' => _x( 'Prev', 'find/replace' ),
957
-			'Whole words' => _x( 'Whole words', 'find/replace' ),
958
-			'Find and replace' => __( 'Find and replace' ),
959
-			'Replace with' => _x('Replace with', 'find/replace' ),
960
-			'Find' => _x( 'Find', 'find/replace' ),
961
-			'Replace all' => _x( 'Replace all', 'find/replace' ),
962
-			'Match case' => __( 'Match case' ),
963
-			'Spellcheck' => __( 'Check Spelling' ),
964
-			'Finish' => _x( 'Finish', 'spellcheck' ),
965
-			'Ignore all' => _x( 'Ignore all', 'spellcheck' ),
966
-			'Ignore' => _x( 'Ignore', 'spellcheck' ),
967
-			'Add to Dictionary' => __( 'Add to Dictionary' ),
956
+			'Prev' => _x('Prev', 'find/replace'),
957
+			'Whole words' => _x('Whole words', 'find/replace'),
958
+			'Find and replace' => __('Find and replace'),
959
+			'Replace with' => _x('Replace with', 'find/replace'),
960
+			'Find' => _x('Find', 'find/replace'),
961
+			'Replace all' => _x('Replace all', 'find/replace'),
962
+			'Match case' => __('Match case'),
963
+			'Spellcheck' => __('Check Spelling'),
964
+			'Finish' => _x('Finish', 'spellcheck'),
965
+			'Ignore all' => _x('Ignore all', 'spellcheck'),
966
+			'Ignore' => _x('Ignore', 'spellcheck'),
967
+			'Add to Dictionary' => __('Add to Dictionary'),
968 968
 
969 969
 			// TinyMCE tables
970
-			'Insert table' => __( 'Insert table' ),
971
-			'Delete table' => __( 'Delete table' ),
972
-			'Table properties' => __( 'Table properties' ),
973
-			'Row properties' => __( 'Table row properties' ),
974
-			'Cell properties' => __( 'Table cell properties' ),
975
-			'Border color' => __( 'Border color' ),
976
-
977
-			'Row' => __( 'Row' ),
978
-			'Rows' => __( 'Rows' ),
979
-			'Column' => _x( 'Column', 'table column' ),
980
-			'Cols' => _x( 'Cols', 'table columns' ),
981
-			'Cell' => _x( 'Cell', 'table cell' ),
982
-			'Header cell' => __( 'Header cell' ),
983
-			'Header' => _x( 'Header', 'table header' ),
984
-			'Body' => _x( 'Body', 'table body' ),
985
-			'Footer' => _x( 'Footer', 'table footer' ),
986
-
987
-			'Insert row before' => __( 'Insert row before' ),
988
-			'Insert row after' => __( 'Insert row after' ),
989
-			'Insert column before' => __( 'Insert column before' ),
990
-			'Insert column after' => __( 'Insert column after' ),
991
-			'Paste row before' => __( 'Paste table row before' ),
992
-			'Paste row after' => __( 'Paste table row after' ),
993
-			'Delete row' => __( 'Delete row' ),
994
-			'Delete column' => __( 'Delete column' ),
995
-			'Cut row' => __( 'Cut table row' ),
996
-			'Copy row' => __( 'Copy table row' ),
997
-			'Merge cells' => __( 'Merge table cells' ),
998
-			'Split cell' => __( 'Split table cell' ),
999
-
1000
-			'Height' => __( 'Height' ),
1001
-			'Width' => __( 'Width' ),
1002
-			'Caption' => __( 'Caption' ),
1003
-			'Alignment' => __( 'Alignment' ),
1004
-			'H Align' => _x( 'H Align', 'horizontal table cell alignment' ),
1005
-			'Left' => __( 'Left' ),
1006
-			'Center' => __( 'Center' ),
1007
-			'Right' => __( 'Right' ),
1008
-			'None' => _x( 'None', 'table cell alignment attribute' ),
1009
-			'V Align' => _x( 'V Align', 'vertical table cell alignment' ),
1010
-			'Top' => __( 'Top' ),
1011
-			'Middle' => __( 'Middle' ),
1012
-			'Bottom' => __( 'Bottom' ),
1013
-
1014
-			'Row group' => __( 'Row group' ),
1015
-			'Column group' => __( 'Column group' ),
1016
-			'Row type' => __( 'Row type' ),
1017
-			'Cell type' => __( 'Cell type' ),
1018
-			'Cell padding' => __( 'Cell padding' ),
1019
-			'Cell spacing' => __( 'Cell spacing' ),
1020
-			'Scope' => _x( 'Scope', 'table cell scope attribute' ),
1021
-
1022
-			'Insert template' => _x( 'Insert template', 'TinyMCE' ),
1023
-			'Templates' => _x( 'Templates', 'TinyMCE' ),
1024
-
1025
-			'Background color' => __( 'Background color' ),
1026
-			'Text color' => __( 'Text color' ),
1027
-			'Show blocks' => _x( 'Show blocks', 'editor button' ),
1028
-			'Show invisible characters' => __( 'Show invisible characters' ),
970
+			'Insert table' => __('Insert table'),
971
+			'Delete table' => __('Delete table'),
972
+			'Table properties' => __('Table properties'),
973
+			'Row properties' => __('Table row properties'),
974
+			'Cell properties' => __('Table cell properties'),
975
+			'Border color' => __('Border color'),
976
+
977
+			'Row' => __('Row'),
978
+			'Rows' => __('Rows'),
979
+			'Column' => _x('Column', 'table column'),
980
+			'Cols' => _x('Cols', 'table columns'),
981
+			'Cell' => _x('Cell', 'table cell'),
982
+			'Header cell' => __('Header cell'),
983
+			'Header' => _x('Header', 'table header'),
984
+			'Body' => _x('Body', 'table body'),
985
+			'Footer' => _x('Footer', 'table footer'),
986
+
987
+			'Insert row before' => __('Insert row before'),
988
+			'Insert row after' => __('Insert row after'),
989
+			'Insert column before' => __('Insert column before'),
990
+			'Insert column after' => __('Insert column after'),
991
+			'Paste row before' => __('Paste table row before'),
992
+			'Paste row after' => __('Paste table row after'),
993
+			'Delete row' => __('Delete row'),
994
+			'Delete column' => __('Delete column'),
995
+			'Cut row' => __('Cut table row'),
996
+			'Copy row' => __('Copy table row'),
997
+			'Merge cells' => __('Merge table cells'),
998
+			'Split cell' => __('Split table cell'),
999
+
1000
+			'Height' => __('Height'),
1001
+			'Width' => __('Width'),
1002
+			'Caption' => __('Caption'),
1003
+			'Alignment' => __('Alignment'),
1004
+			'H Align' => _x('H Align', 'horizontal table cell alignment'),
1005
+			'Left' => __('Left'),
1006
+			'Center' => __('Center'),
1007
+			'Right' => __('Right'),
1008
+			'None' => _x('None', 'table cell alignment attribute'),
1009
+			'V Align' => _x('V Align', 'vertical table cell alignment'),
1010
+			'Top' => __('Top'),
1011
+			'Middle' => __('Middle'),
1012
+			'Bottom' => __('Bottom'),
1013
+
1014
+			'Row group' => __('Row group'),
1015
+			'Column group' => __('Column group'),
1016
+			'Row type' => __('Row type'),
1017
+			'Cell type' => __('Cell type'),
1018
+			'Cell padding' => __('Cell padding'),
1019
+			'Cell spacing' => __('Cell spacing'),
1020
+			'Scope' => _x('Scope', 'table cell scope attribute'),
1021
+
1022
+			'Insert template' => _x('Insert template', 'TinyMCE'),
1023
+			'Templates' => _x('Templates', 'TinyMCE'),
1024
+
1025
+			'Background color' => __('Background color'),
1026
+			'Text color' => __('Text color'),
1027
+			'Show blocks' => _x('Show blocks', 'editor button'),
1028
+			'Show invisible characters' => __('Show invisible characters'),
1029 1029
 
1030 1030
 			/* translators: word count */
1031
-			'Words: {0}' => sprintf( __( 'Words: %s' ), '{0}' ),
1032
-			'Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.' => __( 'Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.' ) . "\n\n" . __( 'If you&#8217;re looking to paste rich content from Microsoft Word, try turning this option off. The editor will clean up text pasted from Word automatically.' ),
1033
-			'Rich Text Area. Press ALT-F9 for menu. Press ALT-F10 for toolbar. Press ALT-0 for help' => __( 'Rich Text Area. Press Alt-Shift-H for help.' ),
1034
-			'Rich Text Area. Press Control-Option-H for help.' => __( 'Rich Text Area. Press Control-Option-H for help.' ),
1035
-			'You have unsaved changes are you sure you want to navigate away?' => __( 'The changes you made will be lost if you navigate away from this page.' ),
1036
-			'Your browser doesn\'t support direct access to the clipboard. Please use the Ctrl+X/C/V keyboard shortcuts instead.' => __( 'Your browser does not support direct access to the clipboard. Please use keyboard shortcuts or your browser&#8217;s edit menu instead.' ),
1031
+			'Words: {0}' => sprintf(__('Words: %s'), '{0}'),
1032
+			'Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.' => __('Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.')."\n\n".__('If you&#8217;re looking to paste rich content from Microsoft Word, try turning this option off. The editor will clean up text pasted from Word automatically.'),
1033
+			'Rich Text Area. Press ALT-F9 for menu. Press ALT-F10 for toolbar. Press ALT-0 for help' => __('Rich Text Area. Press Alt-Shift-H for help.'),
1034
+			'Rich Text Area. Press Control-Option-H for help.' => __('Rich Text Area. Press Control-Option-H for help.'),
1035
+			'You have unsaved changes are you sure you want to navigate away?' => __('The changes you made will be lost if you navigate away from this page.'),
1036
+			'Your browser doesn\'t support direct access to the clipboard. Please use the Ctrl+X/C/V keyboard shortcuts instead.' => __('Your browser does not support direct access to the clipboard. Please use keyboard shortcuts or your browser&#8217;s edit menu instead.'),
1037 1037
 
1038 1038
 			// TinyMCE menus
1039
-			'Insert' => _x( 'Insert', 'TinyMCE menu' ),
1040
-			'File' => _x( 'File', 'TinyMCE menu' ),
1041
-			'Edit' => _x( 'Edit', 'TinyMCE menu' ),
1042
-			'Tools' => _x( 'Tools', 'TinyMCE menu' ),
1043
-			'View' => _x( 'View', 'TinyMCE menu' ),
1044
-			'Table' => _x( 'Table', 'TinyMCE menu' ),
1045
-			'Format' => _x( 'Format', 'TinyMCE menu' ),
1039
+			'Insert' => _x('Insert', 'TinyMCE menu'),
1040
+			'File' => _x('File', 'TinyMCE menu'),
1041
+			'Edit' => _x('Edit', 'TinyMCE menu'),
1042
+			'Tools' => _x('Tools', 'TinyMCE menu'),
1043
+			'View' => _x('View', 'TinyMCE menu'),
1044
+			'Table' => _x('Table', 'TinyMCE menu'),
1045
+			'Format' => _x('Format', 'TinyMCE menu'),
1046 1046
 
1047 1047
 			// WordPress strings
1048
-			'Toolbar Toggle' => array( __( 'Toolbar Toggle' ), 'accessZ' ),
1049
-			'Insert Read More tag' => array( __( 'Insert Read More tag' ), 'accessT' ),
1050
-			'Insert Page Break tag' => array( __( 'Insert Page Break tag' ), 'accessP' ),
1051
-			'Read more...' => __( 'Read more...' ), // Title on the placeholder inside the editor (no ellipsis)
1052
-			'Distraction-free writing mode' => array( __( 'Distraction-free writing mode' ), 'accessW' ),
1053
-			'No alignment' => __( 'No alignment' ), // Tooltip for the 'alignnone' button in the image toolbar
1054
-			'Remove' => __( 'Remove' ), // Tooltip for the 'remove' button in the image toolbar
1055
-			'Edit ' => __( 'Edit' ), // Tooltip for the 'edit' button in the image toolbar
1056
-			'Paste URL or type to search' => __( 'Paste URL or type to search' ), // Placeholder for the inline link dialog
1057
-			'Apply'  => __( 'Apply' ), // Tooltip for the 'apply' button in the inline link dialog
1058
-			'Link options'  => __( 'Link options' ), // Tooltip for the 'link options' button in the inline link dialog
1048
+			'Toolbar Toggle' => array(__('Toolbar Toggle'), 'accessZ'),
1049
+			'Insert Read More tag' => array(__('Insert Read More tag'), 'accessT'),
1050
+			'Insert Page Break tag' => array(__('Insert Page Break tag'), 'accessP'),
1051
+			'Read more...' => __('Read more...'), // Title on the placeholder inside the editor (no ellipsis)
1052
+			'Distraction-free writing mode' => array(__('Distraction-free writing mode'), 'accessW'),
1053
+			'No alignment' => __('No alignment'), // Tooltip for the 'alignnone' button in the image toolbar
1054
+			'Remove' => __('Remove'), // Tooltip for the 'remove' button in the image toolbar
1055
+			'Edit ' => __('Edit'), // Tooltip for the 'edit' button in the image toolbar
1056
+			'Paste URL or type to search' => __('Paste URL or type to search'), // Placeholder for the inline link dialog
1057
+			'Apply'  => __('Apply'), // Tooltip for the 'apply' button in the inline link dialog
1058
+			'Link options'  => __('Link options'), // Tooltip for the 'link options' button in the inline link dialog
1059 1059
 
1060 1060
 			// Shortcuts help modal
1061
-			'Keyboard Shortcuts' => array( __( 'Keyboard Shortcuts' ), 'accessH' ),
1062
-			'Default shortcuts,' => __( 'Default shortcuts,' ),
1063
-			'Additional shortcuts,' => __( 'Additional shortcuts,' ),
1064
-			'Focus shortcuts:' => __( 'Focus shortcuts:' ),
1065
-			'Inline toolbar (when an image, link or preview is selected)' => __( 'Inline toolbar (when an image, link or preview is selected)' ),
1066
-			'Editor menu (when enabled)' => __( 'Editor menu (when enabled)' ),
1067
-			'Editor toolbar' => __( 'Editor toolbar' ),
1068
-			'Elements path' => __( 'Elements path' ),
1069
-			'Ctrl + Alt + letter:' => __( 'Ctrl + Alt + letter:' ),
1070
-			'Shift + Alt + letter:' => __( 'Shift + Alt + letter:' ),
1071
-			'Cmd + letter:' => __( 'Cmd + letter:' ),
1072
-			'Ctrl + letter:' => __( 'Ctrl + letter:' ),
1073
-			'Letter' => __( 'Letter' ),
1074
-			'Action' => __( 'Action' ),
1075
-			'Warning: the link has been inserted but may have errors. Please test it.' => __( 'Warning: the link has been inserted but may have errors. Please test it.' ),
1061
+			'Keyboard Shortcuts' => array(__('Keyboard Shortcuts'), 'accessH'),
1062
+			'Default shortcuts,' => __('Default shortcuts,'),
1063
+			'Additional shortcuts,' => __('Additional shortcuts,'),
1064
+			'Focus shortcuts:' => __('Focus shortcuts:'),
1065
+			'Inline toolbar (when an image, link or preview is selected)' => __('Inline toolbar (when an image, link or preview is selected)'),
1066
+			'Editor menu (when enabled)' => __('Editor menu (when enabled)'),
1067
+			'Editor toolbar' => __('Editor toolbar'),
1068
+			'Elements path' => __('Elements path'),
1069
+			'Ctrl + Alt + letter:' => __('Ctrl + Alt + letter:'),
1070
+			'Shift + Alt + letter:' => __('Shift + Alt + letter:'),
1071
+			'Cmd + letter:' => __('Cmd + letter:'),
1072
+			'Ctrl + letter:' => __('Ctrl + letter:'),
1073
+			'Letter' => __('Letter'),
1074
+			'Action' => __('Action'),
1075
+			'Warning: the link has been inserted but may have errors. Please test it.' => __('Warning: the link has been inserted but may have errors. Please test it.'),
1076 1076
 			'To move focus to other buttons use Tab or the arrow keys. To return focus to the editor press Escape or use one of the buttons.' =>
1077
-				__( 'To move focus to other buttons use Tab or the arrow keys. To return focus to the editor press Escape or use one of the buttons.' ),
1077
+				__('To move focus to other buttons use Tab or the arrow keys. To return focus to the editor press Escape or use one of the buttons.'),
1078 1078
 			'When starting a new paragraph with one of these formatting shortcuts followed by a space, the formatting will be applied automatically. Press Backspace or Escape to undo.' =>
1079
-				__( 'When starting a new paragraph with one of these formatting shortcuts followed by a space, the formatting will be applied automatically. Press Backspace or Escape to undo.' ),
1079
+				__('When starting a new paragraph with one of these formatting shortcuts followed by a space, the formatting will be applied automatically. Press Backspace or Escape to undo.'),
1080 1080
 			'The following formatting shortcuts are replaced when pressing Enter. Press Escape or the Undo button to undo.' =>
1081
-				__( 'The following formatting shortcuts are replaced when pressing Enter. Press Escape or the Undo button to undo.' ),
1081
+				__('The following formatting shortcuts are replaced when pressing Enter. Press Escape or the Undo button to undo.'),
1082 1082
 			'The next group of formatting shortcuts are applied as you type or when you insert them around plain text in the same paragraph. Press Escape or the Undo button to undo.' =>
1083
-				__( 'The next group of formatting shortcuts are applied as you type or when you insert them around plain text in the same paragraph. Press Escape or the Undo button to undo.' ),
1083
+				__('The next group of formatting shortcuts are applied as you type or when you insert them around plain text in the same paragraph. Press Escape or the Undo button to undo.'),
1084 1084
 			);
1085 1085
 		}
1086 1086
 
@@ -1107,15 +1107,15 @@  discard block
 block discarded – undo
1107 1107
 	 * @param bool $json_only optional Whether to include the JavaScript calls to tinymce.addI18n() and tinymce.ScriptLoader.markDone().
1108 1108
 	 * @return string Translation object, JSON encoded.
1109 1109
 	 */
1110
-	public static function wp_mce_translation( $mce_locale = '', $json_only = false ) {
1111
-		if ( ! $mce_locale ) {
1110
+	public static function wp_mce_translation($mce_locale = '', $json_only = false) {
1111
+		if ( ! $mce_locale) {
1112 1112
 			$mce_locale = self::$mce_locale;
1113 1113
 		}
1114 1114
 
1115 1115
 		$mce_translation = self::get_translation();
1116 1116
 		
1117
-		foreach ( $mce_translation as $name => $value ) {
1118
-			if ( is_array( $value ) ) {
1117
+		foreach ($mce_translation as $name => $value) {
1118
+			if (is_array($value)) {
1119 1119
 				$mce_translation[$name] = $value[0];
1120 1120
 			}
1121 1121
 		}
@@ -1128,32 +1128,32 @@  discard block
 block discarded – undo
1128 1128
 		 * @param array  $mce_translation Key/value pairs of strings.
1129 1129
 		 * @param string $mce_locale      Locale.
1130 1130
 		 */
1131
-		$mce_translation = apply_filters( 'wp_mce_translation', $mce_translation, $mce_locale );
1131
+		$mce_translation = apply_filters('wp_mce_translation', $mce_translation, $mce_locale);
1132 1132
 
1133
-		foreach ( $mce_translation as $key => $value ) {
1133
+		foreach ($mce_translation as $key => $value) {
1134 1134
 			// Remove strings that are not translated.
1135
-			if ( $key === $value ) {
1136
-				unset( $mce_translation[$key] );
1135
+			if ($key === $value) {
1136
+				unset($mce_translation[$key]);
1137 1137
 				continue;
1138 1138
 			}
1139 1139
 
1140
-			if ( false !== strpos( $value, '&' ) ) {
1141
-				$mce_translation[$key] = html_entity_decode( $value, ENT_QUOTES, 'UTF-8' );
1140
+			if (false !== strpos($value, '&')) {
1141
+				$mce_translation[$key] = html_entity_decode($value, ENT_QUOTES, 'UTF-8');
1142 1142
 			}
1143 1143
 		}
1144 1144
 
1145 1145
 		// Set direction
1146
-		if ( is_rtl() ) {
1146
+		if (is_rtl()) {
1147 1147
 			$mce_translation['_dir'] = 'rtl';
1148 1148
 		}
1149 1149
 
1150
-		if ( $json_only ) {
1151
-			return wp_json_encode( $mce_translation );
1150
+		if ($json_only) {
1151
+			return wp_json_encode($mce_translation);
1152 1152
 		}
1153 1153
 
1154
-		$baseurl = self::$baseurl ? self::$baseurl : includes_url( 'js/tinymce' );
1154
+		$baseurl = self::$baseurl ? self::$baseurl : includes_url('js/tinymce');
1155 1155
 
1156
-		return "tinymce.addI18n( '$mce_locale', " . wp_json_encode( $mce_translation ) . ");\n" .
1156
+		return "tinymce.addI18n( '$mce_locale', ".wp_json_encode($mce_translation).");\n".
1157 1157
 			"tinymce.ScriptLoader.markDone( '$baseurl/langs/$mce_locale.js' );\n";
1158 1158
 	}
1159 1159
 
@@ -1174,38 +1174,38 @@  discard block
 block discarded – undo
1174 1174
 		 * These plugins can be refreshed by appending query string to the URL passed to "mce_external_plugins" filter.
1175 1175
 		 * If the plugin has a popup dialog, a query string can be added to the button action that opens it (in the plugin's code).
1176 1176
 		 */
1177
-		$version = 'ver=' . $tinymce_version;
1178
-		$tmce_on = !empty(self::$mce_settings);
1177
+		$version = 'ver='.$tinymce_version;
1178
+		$tmce_on = ! empty(self::$mce_settings);
1179 1179
 
1180
-		if ( ! isset($concatenate_scripts) )
1180
+		if ( ! isset($concatenate_scripts))
1181 1181
 			script_concat_settings();
1182 1182
 
1183 1183
 		$compressed = $compress_scripts && $concatenate_scripts && isset($_SERVER['HTTP_ACCEPT_ENCODING'])
1184 1184
 			&& false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip');
1185 1185
 
1186 1186
 		$mceInit = $qtInit = '';
1187
-		if ( $tmce_on ) {
1188
-			foreach ( self::$mce_settings as $editor_id => $init ) {
1189
-				$options = self::_parse_init( $init );
1187
+		if ($tmce_on) {
1188
+			foreach (self::$mce_settings as $editor_id => $init) {
1189
+				$options = self::_parse_init($init);
1190 1190
 				$mceInit .= "'$editor_id':{$options},";
1191 1191
 			}
1192
-			$mceInit = '{' . trim($mceInit, ',') . '}';
1192
+			$mceInit = '{'.trim($mceInit, ',').'}';
1193 1193
 		} else {
1194 1194
 			$mceInit = '{}';
1195 1195
 		}
1196 1196
 
1197
-		if ( !empty(self::$qt_settings) ) {
1198
-			foreach ( self::$qt_settings as $editor_id => $init ) {
1199
-				$options = self::_parse_init( $init );
1197
+		if ( ! empty(self::$qt_settings)) {
1198
+			foreach (self::$qt_settings as $editor_id => $init) {
1199
+				$options = self::_parse_init($init);
1200 1200
 				$qtInit .= "'$editor_id':{$options},";
1201 1201
 			}
1202
-			$qtInit = '{' . trim($qtInit, ',') . '}';
1202
+			$qtInit = '{'.trim($qtInit, ',').'}';
1203 1203
 		} else {
1204 1204
 			$qtInit = '{}';
1205 1205
 		}
1206 1206
 
1207 1207
 		$ref = array(
1208
-			'plugins' => implode( ',', self::$plugins ),
1208
+			'plugins' => implode(',', self::$plugins),
1209 1209
 			'theme' => 'modern',
1210 1210
 			'language' => self::$mce_locale
1211 1211
 		);
@@ -1219,7 +1219,7 @@  discard block
 block discarded – undo
1219 1219
 		 *
1220 1220
 		 * @param array $mce_settings TinyMCE settings array.
1221 1221
 		 */
1222
-		do_action( 'before_wp_tiny_mce', self::$mce_settings );
1222
+		do_action('before_wp_tiny_mce', self::$mce_settings);
1223 1223
 		?>
1224 1224
 
1225 1225
 		<script type="text/javascript">
@@ -1228,14 +1228,14 @@  discard block
 block discarded – undo
1228 1228
 			suffix: "<?php echo $suffix; ?>",
1229 1229
 			<?php
1230 1230
 
1231
-			if ( self::$drag_drop_upload ) {
1231
+			if (self::$drag_drop_upload) {
1232 1232
 				echo 'dragDropUpload: true,';
1233 1233
 			}
1234 1234
 
1235 1235
 			?>
1236 1236
 			mceInit: <?php echo $mceInit; ?>,
1237 1237
 			qtInit: <?php echo $qtInit; ?>,
1238
-			ref: <?php echo self::_parse_init( $ref ); ?>,
1238
+			ref: <?php echo self::_parse_init($ref); ?>,
1239 1239
 			load_ext: function(url,lang){var sl=tinymce.ScriptLoader;sl.markDone(url+'/langs/'+lang+'.js');sl.markDone(url+'/langs/'+lang+'_dlg.js');}
1240 1240
 		};
1241 1241
 		</script>
@@ -1243,19 +1243,19 @@  discard block
 block discarded – undo
1243 1243
 
1244 1244
 		$baseurl = self::$baseurl;
1245 1245
 		// Load tinymce.js when running from /src, else load wp-tinymce.js.gz (production) or tinymce.min.js (SCRIPT_DEBUG)
1246
-		$mce_suffix = false !== strpos( get_bloginfo( 'version' ), '-src' ) ? '' : '.min';
1246
+		$mce_suffix = false !== strpos(get_bloginfo('version'), '-src') ? '' : '.min';
1247 1247
 
1248
-		if ( $tmce_on ) {
1249
-			if ( $compressed ) {
1248
+		if ($tmce_on) {
1249
+			if ($compressed) {
1250 1250
 				echo "<script type='text/javascript' src='{$baseurl}/wp-tinymce.php?c=1&amp;$version'></script>\n";
1251 1251
 			} else {
1252 1252
 				echo "<script type='text/javascript' src='{$baseurl}/tinymce{$mce_suffix}.js?$version'></script>\n";
1253 1253
 				echo "<script type='text/javascript' src='{$baseurl}/plugins/compat3x/plugin{$suffix}.js?$version'></script>\n";
1254 1254
 			}
1255 1255
 
1256
-			echo "<script type='text/javascript'>\n" . self::wp_mce_translation() . "</script>\n";
1256
+			echo "<script type='text/javascript'>\n".self::wp_mce_translation()."</script>\n";
1257 1257
 
1258
-			if ( self::$ext_plugins ) {
1258
+			if (self::$ext_plugins) {
1259 1259
 				// Load the old-format English strings to prevent unsightly labels in old style popups
1260 1260
 				echo "<script type='text/javascript' src='{$baseurl}/langs/wp-langs-en.js?$version'></script>\n";
1261 1261
 			}
@@ -1269,17 +1269,17 @@  discard block
 block discarded – undo
1269 1269
 		 *
1270 1270
 		 * @param array $mce_settings TinyMCE settings array.
1271 1271
 		 */
1272
-		do_action( 'wp_tiny_mce_init', self::$mce_settings );
1272
+		do_action('wp_tiny_mce_init', self::$mce_settings);
1273 1273
 
1274 1274
 		?>
1275 1275
 		<script type="text/javascript">
1276 1276
 		<?php
1277 1277
 
1278
-		if ( self::$ext_plugins )
1279
-			echo self::$ext_plugins . "\n";
1278
+		if (self::$ext_plugins)
1279
+			echo self::$ext_plugins."\n";
1280 1280
 
1281
-		if ( ! is_admin() )
1282
-			echo 'var ajaxurl = "' . admin_url( 'admin-ajax.php', 'relative' ) . '";';
1281
+		if ( ! is_admin())
1282
+			echo 'var ajaxurl = "'.admin_url('admin-ajax.php', 'relative').'";';
1283 1283
 
1284 1284
 		?>
1285 1285
 
@@ -1314,7 +1314,7 @@  discard block
 block discarded – undo
1314 1314
 		</script>
1315 1315
 		<?php
1316 1316
 
1317
-		if ( in_array( 'wplink', self::$plugins, true ) || in_array( 'link', self::$qt_buttons, true ) ) {
1317
+		if (in_array('wplink', self::$plugins, true) || in_array('link', self::$qt_buttons, true)) {
1318 1318
 			self::wp_link_dialog();
1319 1319
 		}
1320 1320
 
@@ -1325,7 +1325,7 @@  discard block
 block discarded – undo
1325 1325
 		 *
1326 1326
 		 * @param array $mce_settings TinyMCE settings array.
1327 1327
 		 */
1328
-		do_action( 'after_wp_tiny_mce', self::$mce_settings );
1328
+		do_action('after_wp_tiny_mce', self::$mce_settings);
1329 1329
 	}
1330 1330
 
1331 1331
 	/**
@@ -1334,7 +1334,7 @@  discard block
 block discarded – undo
1334 1334
 	 * @global int $content_width
1335 1335
 	 */
1336 1336
 	public static function wp_fullscreen_html() {
1337
-		_deprecated_function( __FUNCTION__, '4.3.0' );
1337
+		_deprecated_function(__FUNCTION__, '4.3.0');
1338 1338
 	}
1339 1339
 
1340 1340
 	/**
@@ -1346,9 +1346,9 @@  discard block
 block discarded – undo
1346 1346
 	 * @param array $args Optional. Accepts 'pagenum' and 's' (search) arguments.
1347 1347
 	 * @return false|array Results.
1348 1348
 	 */
1349
-	public static function wp_link_query( $args = array() ) {
1350
-		$pts = get_post_types( array( 'public' => true ), 'objects' );
1351
-		$pt_names = array_keys( $pts );
1349
+	public static function wp_link_query($args = array()) {
1350
+		$pts = get_post_types(array('public' => true), 'objects');
1351
+		$pt_names = array_keys($pts);
1352 1352
 
1353 1353
 		$query = array(
1354 1354
 			'post_type' => $pt_names,
@@ -1359,12 +1359,12 @@  discard block
 block discarded – undo
1359 1359
 			'posts_per_page' => 20,
1360 1360
 		);
1361 1361
 
1362
-		$args['pagenum'] = isset( $args['pagenum'] ) ? absint( $args['pagenum'] ) : 1;
1362
+		$args['pagenum'] = isset($args['pagenum']) ? absint($args['pagenum']) : 1;
1363 1363
 
1364
-		if ( isset( $args['s'] ) )
1364
+		if (isset($args['s']))
1365 1365
 			$query['s'] = $args['s'];
1366 1366
 
1367
-		$query['offset'] = $args['pagenum'] > 1 ? $query['posts_per_page'] * ( $args['pagenum'] - 1 ) : 0;
1367
+		$query['offset'] = $args['pagenum'] > 1 ? $query['posts_per_page'] * ($args['pagenum'] - 1) : 0;
1368 1368
 
1369 1369
 		/**
1370 1370
 		 * Filters the link query arguments.
@@ -1377,27 +1377,27 @@  discard block
 block discarded – undo
1377 1377
 		 *
1378 1378
 		 * @param array $query An array of WP_Query arguments.
1379 1379
 		 */
1380
-		$query = apply_filters( 'wp_link_query_args', $query );
1380
+		$query = apply_filters('wp_link_query_args', $query);
1381 1381
 
1382 1382
 		// Do main query.
1383 1383
 		$get_posts = new WP_Query;
1384
-		$posts = $get_posts->query( $query );
1384
+		$posts = $get_posts->query($query);
1385 1385
 		// Check if any posts were found.
1386
-		if ( ! $get_posts->post_count )
1386
+		if ( ! $get_posts->post_count)
1387 1387
 			return false;
1388 1388
 
1389 1389
 		// Build results.
1390 1390
 		$results = array();
1391
-		foreach ( $posts as $post ) {
1392
-			if ( 'post' == $post->post_type )
1393
-				$info = mysql2date( __( 'Y/m/d' ), $post->post_date );
1391
+		foreach ($posts as $post) {
1392
+			if ('post' == $post->post_type)
1393
+				$info = mysql2date(__('Y/m/d'), $post->post_date);
1394 1394
 			else
1395
-				$info = $pts[ $post->post_type ]->labels->singular_name;
1395
+				$info = $pts[$post->post_type]->labels->singular_name;
1396 1396
 
1397 1397
 			$results[] = array(
1398 1398
 				'ID' => $post->ID,
1399
-				'title' => trim( esc_html( strip_tags( get_the_title( $post ) ) ) ),
1400
-				'permalink' => get_permalink( $post->ID ),
1399
+				'title' => trim(esc_html(strip_tags(get_the_title($post)))),
1400
+				'permalink' => get_permalink($post->ID),
1401 1401
 				'info' => $info,
1402 1402
 			);
1403 1403
 		}
@@ -1424,7 +1424,7 @@  discard block
 block discarded – undo
1424 1424
 		 * }
1425 1425
 		 * @param array $query  An array of WP_Query arguments.
1426 1426
 		 */
1427
-		return apply_filters( 'wp_link_query', $results, $query );
1427
+		return apply_filters('wp_link_query', $results, $query);
1428 1428
 	}
1429 1429
 
1430 1430
 	/**
@@ -1440,30 +1440,30 @@  discard block
 block discarded – undo
1440 1440
 		<div id="wp-link-backdrop" style="display: none"></div>
1441 1441
 		<div id="wp-link-wrap" class="wp-core-ui" style="display: none" role="dialog" aria-labelledby="link-modal-title">
1442 1442
 		<form id="wp-link" tabindex="-1">
1443
-		<?php wp_nonce_field( 'internal-linking', '_ajax_linking_nonce', false ); ?>
1444
-		<h1 id="link-modal-title"><?php _e( 'Insert/edit link' ) ?></h1>
1445
-		<button type="button" id="wp-link-close"><span class="screen-reader-text"><?php _e( 'Close' ); ?></span></button>
1443
+		<?php wp_nonce_field('internal-linking', '_ajax_linking_nonce', false); ?>
1444
+		<h1 id="link-modal-title"><?php _e('Insert/edit link') ?></h1>
1445
+		<button type="button" id="wp-link-close"><span class="screen-reader-text"><?php _e('Close'); ?></span></button>
1446 1446
 		<div id="link-selector">
1447 1447
 			<div id="link-options">
1448
-				<p class="howto" id="wplink-enter-url"><?php _e( 'Enter the destination URL' ); ?></p>
1448
+				<p class="howto" id="wplink-enter-url"><?php _e('Enter the destination URL'); ?></p>
1449 1449
 				<div>
1450
-					<label><span><?php _e( 'URL' ); ?></span>
1450
+					<label><span><?php _e('URL'); ?></span>
1451 1451
 					<input id="wp-link-url" type="text" aria-describedby="wplink-enter-url" /></label>
1452 1452
 				</div>
1453 1453
 				<div class="wp-link-text-field">
1454
-					<label><span><?php _e( 'Link Text' ); ?></span>
1454
+					<label><span><?php _e('Link Text'); ?></span>
1455 1455
 					<input id="wp-link-text" type="text" /></label>
1456 1456
 				</div>
1457 1457
 				<div class="link-target">
1458 1458
 					<label><span></span>
1459
-					<input type="checkbox" id="wp-link-target" /> <?php _e( 'Open link in a new tab' ); ?></label>
1459
+					<input type="checkbox" id="wp-link-target" /> <?php _e('Open link in a new tab'); ?></label>
1460 1460
 				</div>
1461 1461
 			</div>
1462
-			<p class="howto" id="wplink-link-existing-content"><?php _e( 'Or link to existing content' ); ?></p>
1462
+			<p class="howto" id="wplink-link-existing-content"><?php _e('Or link to existing content'); ?></p>
1463 1463
 			<div id="search-panel">
1464 1464
 				<div class="link-search-wrapper">
1465 1465
 					<label>
1466
-						<span class="search-label"><?php _e( 'Search' ); ?></span>
1466
+						<span class="search-label"><?php _e('Search'); ?></span>
1467 1467
 						<input type="search" id="wp-link-search" class="link-search-field" autocomplete="off" aria-describedby="wplink-link-existing-content" />
1468 1468
 						<span class="spinner"></span>
1469 1469
 					</label>
@@ -1476,8 +1476,8 @@  discard block
 block discarded – undo
1476 1476
 				</div>
1477 1477
 				<div id="most-recent-results" class="query-results" tabindex="0">
1478 1478
 					<div class="query-notice" id="query-notice-message">
1479
-						<em class="query-notice-default"><?php _e( 'No search term specified. Showing recent items.' ); ?></em>
1480
-						<em class="query-notice-hint screen-reader-text"><?php _e( 'Search or use up and down arrow keys to select an item.' ); ?></em>
1479
+						<em class="query-notice-default"><?php _e('No search term specified. Showing recent items.'); ?></em>
1480
+						<em class="query-notice-hint screen-reader-text"><?php _e('Search or use up and down arrow keys to select an item.'); ?></em>
1481 1481
 					</div>
1482 1482
 					<ul></ul>
1483 1483
 					<div class="river-waiting">
@@ -1488,10 +1488,10 @@  discard block
 block discarded – undo
1488 1488
 		</div>
1489 1489
 		<div class="submitbox">
1490 1490
 			<div id="wp-link-cancel">
1491
-				<button type="button" class="button"><?php _e( 'Cancel' ); ?></button>
1491
+				<button type="button" class="button"><?php _e('Cancel'); ?></button>
1492 1492
 			</div>
1493 1493
 			<div id="wp-link-update">
1494
-				<input type="submit" value="<?php esc_attr_e( 'Add Link' ); ?>" class="button button-primary" id="wp-link-submit" name="wp-link-submit">
1494
+				<input type="submit" value="<?php esc_attr_e('Add Link'); ?>" class="button button-primary" id="wp-link-submit" name="wp-link-submit">
1495 1495
 			</div>
1496 1496
 		</div>
1497 1497
 		</form>
Please login to merge, or discard this patch.
src/wp-includes/class-oembed.php 2 patches
Braces   +58 added lines, -40 removed lines patch added patch discarded remove patch
@@ -225,8 +225,9 @@  discard block
 block discarded – undo
225 225
 
226 226
 		$provider = false;
227 227
 
228
-		if ( !isset($args['discover']) )
229
-			$args['discover'] = true;
228
+		if ( !isset($args['discover']) ) {
229
+					$args['discover'] = true;
230
+		}
230 231
 
231 232
 		foreach ( $this->providers as $matchmask => $data ) {
232 233
 			list( $providerurl, $regex ) = $data;
@@ -243,8 +244,9 @@  discard block
 block discarded – undo
243 244
 			}
244 245
 		}
245 246
 
246
-		if ( !$provider && $args['discover'] )
247
-			$provider = $this->discover( $url );
247
+		if ( !$provider && $args['discover'] ) {
248
+					$provider = $this->discover( $url );
249
+		}
248 250
 
249 251
 		return $provider;
250 252
 	}
@@ -425,20 +427,22 @@  discard block
 block discarded – undo
425 427
 						$providers[$linktypes[$atts['type']]] = htmlspecialchars_decode( $atts['href'] );
426 428
 
427 429
 						// Stop here if it's JSON (that's all we need)
428
-						if ( 'json' == $linktypes[$atts['type']] )
429
-							break;
430
+						if ( 'json' == $linktypes[$atts['type']] ) {
431
+													break;
432
+						}
430 433
 					}
431 434
 				}
432 435
 			}
433 436
 		}
434 437
 
435 438
 		// JSON is preferred to XML
436
-		if ( !empty($providers['json']) )
437
-			return $providers['json'];
438
-		elseif ( !empty($providers['xml']) )
439
-			return $providers['xml'];
440
-		else
441
-			return false;
439
+		if ( !empty($providers['json']) ) {
440
+					return $providers['json'];
441
+		} elseif ( !empty($providers['xml']) ) {
442
+					return $providers['xml'];
443
+		} else {
444
+					return false;
445
+		}
442 446
 	}
443 447
 
444 448
 	/**
@@ -472,8 +476,9 @@  discard block
 block discarded – undo
472 476
 
473 477
 		foreach ( array( 'json', 'xml' ) as $format ) {
474 478
 			$result = $this->_fetch_with_format( $provider, $format );
475
-			if ( is_wp_error( $result ) && 'not-implemented' == $result->get_error_code() )
476
-				continue;
479
+			if ( is_wp_error( $result ) && 'not-implemented' == $result->get_error_code() ) {
480
+							continue;
481
+			}
477 482
 			return ( $result && ! is_wp_error( $result ) ) ? $result : false;
478 483
 		}
479 484
 		return false;
@@ -496,10 +501,12 @@  discard block
 block discarded – undo
496 501
 		$args = apply_filters( 'oembed_remote_get_args', array(), $provider_url_with_args );
497 502
 
498 503
 		$response = wp_safe_remote_get( $provider_url_with_args, $args );
499
-		if ( 501 == wp_remote_retrieve_response_code( $response ) )
500
-			return new WP_Error( 'not-implemented' );
501
-		if ( ! $body = wp_remote_retrieve_body( $response ) )
502
-			return false;
504
+		if ( 501 == wp_remote_retrieve_response_code( $response ) ) {
505
+					return new WP_Error( 'not-implemented' );
506
+		}
507
+		if ( ! $body = wp_remote_retrieve_body( $response ) ) {
508
+					return false;
509
+		}
503 510
 		$parse_method = "_parse_$format";
504 511
 		return $this->$parse_method( $body );
505 512
 	}
@@ -528,8 +535,9 @@  discard block
 block discarded – undo
528 535
 	 * @return object|false
529 536
 	 */
530 537
 	private function _parse_xml( $response_body ) {
531
-		if ( ! function_exists( 'libxml_disable_entity_loader' ) )
532
-			return false;
538
+		if ( ! function_exists( 'libxml_disable_entity_loader' ) ) {
539
+					return false;
540
+		}
533 541
 
534 542
 		$loader = libxml_disable_entity_loader( true );
535 543
 		$errors = libxml_use_internal_errors( true );
@@ -552,25 +560,30 @@  discard block
 block discarded – undo
552 560
 	 * @return object|false
553 561
 	 */
554 562
 	private function _parse_xml_body( $response_body ) {
555
-		if ( ! function_exists( 'simplexml_import_dom' ) || ! class_exists( 'DOMDocument', false ) )
556
-			return false;
563
+		if ( ! function_exists( 'simplexml_import_dom' ) || ! class_exists( 'DOMDocument', false ) ) {
564
+					return false;
565
+		}
557 566
 
558 567
 		$dom = new DOMDocument;
559 568
 		$success = $dom->loadXML( $response_body );
560
-		if ( ! $success )
561
-			return false;
569
+		if ( ! $success ) {
570
+					return false;
571
+		}
562 572
 
563
-		if ( isset( $dom->doctype ) )
564
-			return false;
573
+		if ( isset( $dom->doctype ) ) {
574
+					return false;
575
+		}
565 576
 
566 577
 		foreach ( $dom->childNodes as $child ) {
567
-			if ( XML_DOCUMENT_TYPE_NODE === $child->nodeType )
568
-				return false;
578
+			if ( XML_DOCUMENT_TYPE_NODE === $child->nodeType ) {
579
+							return false;
580
+			}
569 581
 		}
570 582
 
571 583
 		$xml = simplexml_import_dom( $dom );
572
-		if ( ! $xml )
573
-			return false;
584
+		if ( ! $xml ) {
585
+					return false;
586
+		}
574 587
 
575 588
 		$return = new stdClass;
576 589
 		foreach ( $xml as $key => $value ) {
@@ -591,17 +604,20 @@  discard block
 block discarded – undo
591 604
 	 * @return false|string False on error, otherwise the HTML needed to embed.
592 605
 	 */
593 606
 	public function data2html( $data, $url ) {
594
-		if ( ! is_object( $data ) || empty( $data->type ) )
595
-			return false;
607
+		if ( ! is_object( $data ) || empty( $data->type ) ) {
608
+					return false;
609
+		}
596 610
 
597 611
 		$return = false;
598 612
 
599 613
 		switch ( $data->type ) {
600 614
 			case 'photo':
601
-				if ( empty( $data->url ) || empty( $data->width ) || empty( $data->height ) )
602
-					break;
603
-				if ( ! is_string( $data->url ) || ! is_numeric( $data->width ) || ! is_numeric( $data->height ) )
604
-					break;
615
+				if ( empty( $data->url ) || empty( $data->width ) || empty( $data->height ) ) {
616
+									break;
617
+				}
618
+				if ( ! is_string( $data->url ) || ! is_numeric( $data->width ) || ! is_numeric( $data->height ) ) {
619
+									break;
620
+				}
605 621
 
606 622
 				$title = ! empty( $data->title ) && is_string( $data->title ) ? $data->title : '';
607 623
 				$return = '<a href="' . esc_url( $url ) . '"><img src="' . esc_url( $data->url ) . '" alt="' . esc_attr($title) . '" width="' . esc_attr($data->width) . '" height="' . esc_attr($data->height) . '" /></a>';
@@ -609,13 +625,15 @@  discard block
 block discarded – undo
609 625
 
610 626
 			case 'video':
611 627
 			case 'rich':
612
-				if ( ! empty( $data->html ) && is_string( $data->html ) )
613
-					$return = $data->html;
628
+				if ( ! empty( $data->html ) && is_string( $data->html ) ) {
629
+									$return = $data->html;
630
+				}
614 631
 				break;
615 632
 
616 633
 			case 'link':
617
-				if ( ! empty( $data->title ) && is_string( $data->title ) )
618
-					$return = '<a href="' . esc_url( $url ) . '">' . esc_html( $data->title ) . '</a>';
634
+				if ( ! empty( $data->title ) && is_string( $data->title ) ) {
635
+									$return = '<a href="' . esc_url( $url ) . '">' . esc_html( $data->title ) . '</a>';
636
+				}
619 637
 				break;
620 638
 
621 639
 			default:
Please login to merge, or discard this patch.
Spacing   +173 added lines, -173 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	 * @access private
45 45
 	 * @var array
46 46
 	 */
47
-	private $compat_methods = array( '_fetch_with_format', '_parse_json', '_parse_xml', '_parse_body' );
47
+	private $compat_methods = array('_fetch_with_format', '_parse_json', '_parse_xml', '_parse_body');
48 48
 
49 49
 	/**
50 50
 	 * Constructor.
@@ -53,72 +53,72 @@  discard block
 block discarded – undo
53 53
 	 * @access public
54 54
 	 */
55 55
 	public function __construct() {
56
-		$host = urlencode( home_url() );
56
+		$host = urlencode(home_url());
57 57
 		$providers = array(
58
-			'#https?://((m|www)\.)?youtube\.com/watch.*#i'             => array( 'https://www.youtube.com/oembed',                            true  ),
59
-			'#https?://((m|www)\.)?youtube\.com/playlist.*#i'          => array( 'https://www.youtube.com/oembed',                            true  ),
60
-			'#https?://youtu\.be/.*#i'                                 => array( 'https://www.youtube.com/oembed',                            true  ),
61
-			'#https?://(.+\.)?vimeo\.com/.*#i'                         => array( 'https://vimeo.com/api/oembed.{format}',                     true  ),
62
-			'#https?://(www\.)?dailymotion\.com/.*#i'                  => array( 'https://www.dailymotion.com/services/oembed',               true  ),
63
-			'#https?://dai\.ly/.*#i'                                   => array( 'https://www.dailymotion.com/services/oembed',               true  ),
64
-			'#https?://(www\.)?flickr\.com/.*#i'                       => array( 'https://www.flickr.com/services/oembed/',                   true  ),
65
-			'#https?://flic\.kr/.*#i'                                  => array( 'https://www.flickr.com/services/oembed/',                   true  ),
66
-			'#https?://(.+\.)?smugmug\.com/.*#i'                       => array( 'https://api.smugmug.com/services/oembed/',                  true  ),
67
-			'#https?://(www\.)?hulu\.com/watch/.*#i'                   => array( 'http://www.hulu.com/api/oembed.{format}',                   true  ),
68
-			'http://i*.photobucket.com/albums/*'                       => array( 'http://api.photobucket.com/oembed',                         false ),
69
-			'http://gi*.photobucket.com/groups/*'                      => array( 'http://api.photobucket.com/oembed',                         false ),
70
-			'#https?://(www\.)?scribd\.com/doc/.*#i'                   => array( 'https://www.scribd.com/services/oembed',                    true  ),
71
-			'#https?://wordpress\.tv/.*#i'                             => array( 'https://wordpress.tv/oembed/',                              true  ),
72
-			'#https?://(.+\.)?polldaddy\.com/.*#i'                     => array( 'https://polldaddy.com/oembed/',                             true  ),
73
-			'#https?://poll\.fm/.*#i'                                  => array( 'https://polldaddy.com/oembed/',                             true  ),
74
-			'#https?://(www\.)?funnyordie\.com/videos/.*#i'            => array( 'http://www.funnyordie.com/oembed',                          true  ),
75
-			'#https?://(www\.)?twitter\.com/\w{1,15}/status(es)?/.*#i' => array( 'https://publish.twitter.com/oembed',                        true  ),
76
-			'#https?://(www\.)?twitter\.com/\w{1,15}$#i'               => array( 'https://publish.twitter.com/oembed',                        true  ),
77
-			'#https?://(www\.)?twitter\.com/\w{1,15}/likes$#i'         => array( 'https://publish.twitter.com/oembed',                        true  ),
78
-			'#https?://(www\.)?twitter\.com/\w{1,15}/lists/.*#i'       => array( 'https://publish.twitter.com/oembed',                        true  ),
79
-			'#https?://(www\.)?twitter\.com/\w{1,15}/timelines/.*#i'   => array( 'https://publish.twitter.com/oembed',                        true  ),
80
-			'#https?://(www\.)?twitter\.com/i/moments/.*#i'            => array( 'https://publish.twitter.com/oembed',                        true  ),
81
-			'#https?://vine\.co/v/.*#i'                                => array( 'https://vine.co/oembed.{format}',                           true  ),
82
-			'#https?://(www\.)?soundcloud\.com/.*#i'                   => array( 'https://soundcloud.com/oembed',                             true  ),
83
-			'#https?://(.+?\.)?slideshare\.net/.*#i'                   => array( 'https://www.slideshare.net/api/oembed/2',                   true  ),
84
-			'#https?://(www\.)?instagr(\.am|am\.com)/p/.*#i'           => array( 'https://api.instagram.com/oembed',                          true  ),
85
-			'#https?://(open|play)\.spotify\.com/.*#i'                 => array( 'https://embed.spotify.com/oembed/',                         true  ),
86
-			'#https?://(.+\.)?imgur\.com/.*#i'                         => array( 'http://api.imgur.com/oembed',                               true  ),
87
-			'#https?://(www\.)?meetu(\.ps|p\.com)/.*#i'                => array( 'https://api.meetup.com/oembed',                             true  ),
88
-			'#https?://(www\.)?issuu\.com/.+/docs/.+#i'                => array( 'https://issuu.com/oembed_wp',                               true  ),
89
-			'#https?://(www\.)?collegehumor\.com/video/.*#i'           => array( 'http://www.collegehumor.com/oembed.{format}',               true  ),
90
-			'#https?://(www\.)?mixcloud\.com/.*#i'                     => array( 'https://www.mixcloud.com/oembed',                           true  ),
91
-			'#https?://(www\.|embed\.)?ted\.com/talks/.*#i'            => array( 'https://www.ted.com/services/v1/oembed.{format}',           true  ),
92
-			'#https?://(www\.)?(animoto|video214)\.com/play/.*#i'      => array( 'https://animoto.com/oembeds/create',                        true  ),
93
-			'#https?://(.+)\.tumblr\.com/post/.*#i'                    => array( 'https://www.tumblr.com/oembed/1.0',                         true  ),
94
-			'#https?://(www\.)?kickstarter\.com/projects/.*#i'         => array( 'https://www.kickstarter.com/services/oembed',               true  ),
95
-			'#https?://kck\.st/.*#i'                                   => array( 'https://www.kickstarter.com/services/oembed',               true  ),
96
-			'#https?://cloudup\.com/.*#i'                              => array( 'https://cloudup.com/oembed',                                true  ),
97
-			'#https?://(www\.)?reverbnation\.com/.*#i'                 => array( 'https://www.reverbnation.com/oembed',                       true  ),
98
-			'#https?://videopress\.com/v/.*#'                          => array( 'https://public-api.wordpress.com/oembed/1.0/?for=' . $host, true  ),
99
-			'#https?://(www\.)?reddit\.com/r/[^/]+/comments/.*#i'      => array( 'https://www.reddit.com/oembed',                             true  ),
100
-			'#https?://(www\.)?speakerdeck\.com/.*#i'                  => array( 'https://speakerdeck.com/oembed.{format}',                   true  ),
101
-			'#https?://www\.facebook\.com/.*/posts/.*#i'               => array( 'https://www.facebook.com/plugins/post/oembed.json/',        true  ),
102
-			'#https?://www\.facebook\.com/.*/activity/.*#i'            => array( 'https://www.facebook.com/plugins/post/oembed.json/',        true  ),
103
-			'#https?://www\.facebook\.com/.*/photos/.*#i'              => array( 'https://www.facebook.com/plugins/post/oembed.json/',        true  ),
104
-			'#https?://www\.facebook\.com/photo(s/|\.php).*#i'         => array( 'https://www.facebook.com/plugins/post/oembed.json/',        true  ),
105
-			'#https?://www\.facebook\.com/permalink\.php.*#i'          => array( 'https://www.facebook.com/plugins/post/oembed.json/',        true  ),
106
-			'#https?://www\.facebook\.com/media/.*#i'                  => array( 'https://www.facebook.com/plugins/post/oembed.json/',        true  ),
107
-			'#https?://www\.facebook\.com/questions/.*#i'              => array( 'https://www.facebook.com/plugins/post/oembed.json/',        true  ),
108
-			'#https?://www\.facebook\.com/notes/.*#i'                  => array( 'https://www.facebook.com/plugins/post/oembed.json/',        true  ),
109
-			'#https?://www\.facebook\.com/.*/videos/.*#i'              => array( 'https://www.facebook.com/plugins/video/oembed.json/',       true  ),
110
-			'#https?://www\.facebook\.com/video\.php.*#i'              => array( 'https://www.facebook.com/plugins/video/oembed.json/',       true  ),
58
+			'#https?://((m|www)\.)?youtube\.com/watch.*#i'             => array('https://www.youtube.com/oembed', true),
59
+			'#https?://((m|www)\.)?youtube\.com/playlist.*#i'          => array('https://www.youtube.com/oembed', true),
60
+			'#https?://youtu\.be/.*#i'                                 => array('https://www.youtube.com/oembed', true),
61
+			'#https?://(.+\.)?vimeo\.com/.*#i'                         => array('https://vimeo.com/api/oembed.{format}', true),
62
+			'#https?://(www\.)?dailymotion\.com/.*#i'                  => array('https://www.dailymotion.com/services/oembed', true),
63
+			'#https?://dai\.ly/.*#i'                                   => array('https://www.dailymotion.com/services/oembed', true),
64
+			'#https?://(www\.)?flickr\.com/.*#i'                       => array('https://www.flickr.com/services/oembed/', true),
65
+			'#https?://flic\.kr/.*#i'                                  => array('https://www.flickr.com/services/oembed/', true),
66
+			'#https?://(.+\.)?smugmug\.com/.*#i'                       => array('https://api.smugmug.com/services/oembed/', true),
67
+			'#https?://(www\.)?hulu\.com/watch/.*#i'                   => array('http://www.hulu.com/api/oembed.{format}', true),
68
+			'http://i*.photobucket.com/albums/*'                       => array('http://api.photobucket.com/oembed', false),
69
+			'http://gi*.photobucket.com/groups/*'                      => array('http://api.photobucket.com/oembed', false),
70
+			'#https?://(www\.)?scribd\.com/doc/.*#i'                   => array('https://www.scribd.com/services/oembed', true),
71
+			'#https?://wordpress\.tv/.*#i'                             => array('https://wordpress.tv/oembed/', true),
72
+			'#https?://(.+\.)?polldaddy\.com/.*#i'                     => array('https://polldaddy.com/oembed/', true),
73
+			'#https?://poll\.fm/.*#i'                                  => array('https://polldaddy.com/oembed/', true),
74
+			'#https?://(www\.)?funnyordie\.com/videos/.*#i'            => array('http://www.funnyordie.com/oembed', true),
75
+			'#https?://(www\.)?twitter\.com/\w{1,15}/status(es)?/.*#i' => array('https://publish.twitter.com/oembed', true),
76
+			'#https?://(www\.)?twitter\.com/\w{1,15}$#i'               => array('https://publish.twitter.com/oembed', true),
77
+			'#https?://(www\.)?twitter\.com/\w{1,15}/likes$#i'         => array('https://publish.twitter.com/oembed', true),
78
+			'#https?://(www\.)?twitter\.com/\w{1,15}/lists/.*#i'       => array('https://publish.twitter.com/oembed', true),
79
+			'#https?://(www\.)?twitter\.com/\w{1,15}/timelines/.*#i'   => array('https://publish.twitter.com/oembed', true),
80
+			'#https?://(www\.)?twitter\.com/i/moments/.*#i'            => array('https://publish.twitter.com/oembed', true),
81
+			'#https?://vine\.co/v/.*#i'                                => array('https://vine.co/oembed.{format}', true),
82
+			'#https?://(www\.)?soundcloud\.com/.*#i'                   => array('https://soundcloud.com/oembed', true),
83
+			'#https?://(.+?\.)?slideshare\.net/.*#i'                   => array('https://www.slideshare.net/api/oembed/2', true),
84
+			'#https?://(www\.)?instagr(\.am|am\.com)/p/.*#i'           => array('https://api.instagram.com/oembed', true),
85
+			'#https?://(open|play)\.spotify\.com/.*#i'                 => array('https://embed.spotify.com/oembed/', true),
86
+			'#https?://(.+\.)?imgur\.com/.*#i'                         => array('http://api.imgur.com/oembed', true),
87
+			'#https?://(www\.)?meetu(\.ps|p\.com)/.*#i'                => array('https://api.meetup.com/oembed', true),
88
+			'#https?://(www\.)?issuu\.com/.+/docs/.+#i'                => array('https://issuu.com/oembed_wp', true),
89
+			'#https?://(www\.)?collegehumor\.com/video/.*#i'           => array('http://www.collegehumor.com/oembed.{format}', true),
90
+			'#https?://(www\.)?mixcloud\.com/.*#i'                     => array('https://www.mixcloud.com/oembed', true),
91
+			'#https?://(www\.|embed\.)?ted\.com/talks/.*#i'            => array('https://www.ted.com/services/v1/oembed.{format}', true),
92
+			'#https?://(www\.)?(animoto|video214)\.com/play/.*#i'      => array('https://animoto.com/oembeds/create', true),
93
+			'#https?://(.+)\.tumblr\.com/post/.*#i'                    => array('https://www.tumblr.com/oembed/1.0', true),
94
+			'#https?://(www\.)?kickstarter\.com/projects/.*#i'         => array('https://www.kickstarter.com/services/oembed', true),
95
+			'#https?://kck\.st/.*#i'                                   => array('https://www.kickstarter.com/services/oembed', true),
96
+			'#https?://cloudup\.com/.*#i'                              => array('https://cloudup.com/oembed', true),
97
+			'#https?://(www\.)?reverbnation\.com/.*#i'                 => array('https://www.reverbnation.com/oembed', true),
98
+			'#https?://videopress\.com/v/.*#'                          => array('https://public-api.wordpress.com/oembed/1.0/?for='.$host, true),
99
+			'#https?://(www\.)?reddit\.com/r/[^/]+/comments/.*#i'      => array('https://www.reddit.com/oembed', true),
100
+			'#https?://(www\.)?speakerdeck\.com/.*#i'                  => array('https://speakerdeck.com/oembed.{format}', true),
101
+			'#https?://www\.facebook\.com/.*/posts/.*#i'               => array('https://www.facebook.com/plugins/post/oembed.json/', true),
102
+			'#https?://www\.facebook\.com/.*/activity/.*#i'            => array('https://www.facebook.com/plugins/post/oembed.json/', true),
103
+			'#https?://www\.facebook\.com/.*/photos/.*#i'              => array('https://www.facebook.com/plugins/post/oembed.json/', true),
104
+			'#https?://www\.facebook\.com/photo(s/|\.php).*#i'         => array('https://www.facebook.com/plugins/post/oembed.json/', true),
105
+			'#https?://www\.facebook\.com/permalink\.php.*#i'          => array('https://www.facebook.com/plugins/post/oembed.json/', true),
106
+			'#https?://www\.facebook\.com/media/.*#i'                  => array('https://www.facebook.com/plugins/post/oembed.json/', true),
107
+			'#https?://www\.facebook\.com/questions/.*#i'              => array('https://www.facebook.com/plugins/post/oembed.json/', true),
108
+			'#https?://www\.facebook\.com/notes/.*#i'                  => array('https://www.facebook.com/plugins/post/oembed.json/', true),
109
+			'#https?://www\.facebook\.com/.*/videos/.*#i'              => array('https://www.facebook.com/plugins/video/oembed.json/', true),
110
+			'#https?://www\.facebook\.com/video\.php.*#i'              => array('https://www.facebook.com/plugins/video/oembed.json/', true),
111 111
 		);
112 112
 
113
-		if ( ! empty( self::$early_providers['add'] ) ) {
114
-			foreach ( self::$early_providers['add'] as $format => $data ) {
115
-				$providers[ $format ] = $data;
113
+		if ( ! empty(self::$early_providers['add'])) {
114
+			foreach (self::$early_providers['add'] as $format => $data) {
115
+				$providers[$format] = $data;
116 116
 			}
117 117
 		}
118 118
 
119
-		if ( ! empty( self::$early_providers['remove'] ) ) {
120
-			foreach ( self::$early_providers['remove'] as $format ) {
121
-				unset( $providers[ $format ] );
119
+		if ( ! empty(self::$early_providers['remove'])) {
120
+			foreach (self::$early_providers['remove'] as $format) {
121
+				unset($providers[$format]);
122 122
 			}
123 123
 		}
124 124
 
@@ -199,10 +199,10 @@  discard block
 block discarded – undo
199 199
 		 *
200 200
 		 * @param array $providers An array of popular oEmbed providers.
201 201
 		 */
202
-		$this->providers = apply_filters( 'oembed_providers', $providers );
202
+		$this->providers = apply_filters('oembed_providers', $providers);
203 203
 
204 204
 		// Fix any embeds that contain new lines in the middle of the HTML which breaks wpautop().
205
-		add_filter( 'oembed_dataparse', array($this, '_strip_newlines'), 10, 3 );
205
+		add_filter('oembed_dataparse', array($this, '_strip_newlines'), 10, 3);
206 206
 	}
207 207
 
208 208
 	/**
@@ -215,9 +215,9 @@  discard block
 block discarded – undo
215 215
 	 * @param array    $arguments Arguments to pass when calling.
216 216
 	 * @return mixed|bool Return value of the callback, false otherwise.
217 217
 	 */
218
-	public function __call( $name, $arguments ) {
219
-		if ( in_array( $name, $this->compat_methods ) ) {
220
-			return call_user_func_array( array( $this, $name ), $arguments );
218
+	public function __call($name, $arguments) {
219
+		if (in_array($name, $this->compat_methods)) {
220
+			return call_user_func_array(array($this, $name), $arguments);
221 221
 		}
222 222
 		return false;
223 223
 	}
@@ -234,31 +234,31 @@  discard block
 block discarded – undo
234 234
 	 * @param string|array  $args Optional provider arguments.
235 235
 	 * @return false|string False on failure, otherwise the oEmbed provider URL.
236 236
 	 */
237
-	public function get_provider( $url, $args = '' ) {
238
-		$args = wp_parse_args( $args );
237
+	public function get_provider($url, $args = '') {
238
+		$args = wp_parse_args($args);
239 239
 
240 240
 		$provider = false;
241 241
 
242
-		if ( !isset($args['discover']) )
242
+		if ( ! isset($args['discover']))
243 243
 			$args['discover'] = true;
244 244
 
245
-		foreach ( $this->providers as $matchmask => $data ) {
246
-			list( $providerurl, $regex ) = $data;
245
+		foreach ($this->providers as $matchmask => $data) {
246
+			list($providerurl, $regex) = $data;
247 247
 
248 248
 			// Turn the asterisk-type provider URLs into regex
249
-			if ( !$regex ) {
250
-				$matchmask = '#' . str_replace( '___wildcard___', '(.+)', preg_quote( str_replace( '*', '___wildcard___', $matchmask ), '#' ) ) . '#i';
251
-				$matchmask = preg_replace( '|^#http\\\://|', '#https?\://', $matchmask );
249
+			if ( ! $regex) {
250
+				$matchmask = '#'.str_replace('___wildcard___', '(.+)', preg_quote(str_replace('*', '___wildcard___', $matchmask), '#')).'#i';
251
+				$matchmask = preg_replace('|^#http\\\://|', '#https?\://', $matchmask);
252 252
 			}
253 253
 
254
-			if ( preg_match( $matchmask, $url ) ) {
255
-				$provider = str_replace( '{format}', 'json', $providerurl ); // JSON is easier to deal with than XML
254
+			if (preg_match($matchmask, $url)) {
255
+				$provider = str_replace('{format}', 'json', $providerurl); // JSON is easier to deal with than XML
256 256
 				break;
257 257
 			}
258 258
 		}
259 259
 
260
-		if ( !$provider && $args['discover'] )
261
-			$provider = $this->discover( $url );
260
+		if ( ! $provider && $args['discover'])
261
+			$provider = $this->discover($url);
262 262
 
263 263
 		return $provider;
264 264
 	}
@@ -283,12 +283,12 @@  discard block
 block discarded – undo
283 283
 	 * @param bool   $regex    Optional. Whether the $format parameter is in a regex format.
284 284
 	 *                         Default false.
285 285
 	 */
286
-	public static function _add_provider_early( $format, $provider, $regex = false ) {
287
-		if ( empty( self::$early_providers['add'] ) ) {
286
+	public static function _add_provider_early($format, $provider, $regex = false) {
287
+		if (empty(self::$early_providers['add'])) {
288 288
 			self::$early_providers['add'] = array();
289 289
 		}
290 290
 
291
-		self::$early_providers['add'][ $format ] = array( $provider, $regex );
291
+		self::$early_providers['add'][$format] = array($provider, $regex);
292 292
 	}
293 293
 
294 294
 	/**
@@ -308,8 +308,8 @@  discard block
 block discarded – undo
308 308
 	 * @param string $format The format of URL that this provider can handle. You can use
309 309
 	 *                       asterisks as wildcards.
310 310
 	 */
311
-	public static function _remove_provider_early( $format ) {
312
-		if ( empty( self::$early_providers['remove'] ) ) {
311
+	public static function _remove_provider_early($format) {
312
+		if (empty(self::$early_providers['remove'])) {
313 313
 			self::$early_providers['remove'] = array();
314 314
 		}
315 315
 
@@ -329,8 +329,8 @@  discard block
 block discarded – undo
329 329
 	 * @param array|string $args Optional. Arguments, usually passed from a shortcode. Default empty.
330 330
 	 * @return false|string False on failure, otherwise the UNSANITIZED (and potentially unsafe) HTML that should be used to embed.
331 331
 	 */
332
-	public function get_html( $url, $args = '' ) {
333
-		$args = wp_parse_args( $args );
332
+	public function get_html($url, $args = '') {
333
+		$args = wp_parse_args($args);
334 334
 
335 335
 		/**
336 336
 		 * Filters the oEmbed result before any HTTP requests are made.
@@ -347,15 +347,15 @@  discard block
 block discarded – undo
347 347
 		 * @param string      $url    The URL to the content that should be attempted to be embedded.
348 348
 		 * @param array       $args   Optional. Arguments, usually passed from a shortcode. Default empty.
349 349
 		 */
350
-		$pre = apply_filters( 'pre_oembed_result', null, $url, $args );
350
+		$pre = apply_filters('pre_oembed_result', null, $url, $args);
351 351
 
352
-		if ( null !== $pre ) {
352
+		if (null !== $pre) {
353 353
 			return $pre;
354 354
 		}
355 355
 
356
-		$provider = $this->get_provider( $url, $args );
356
+		$provider = $this->get_provider($url, $args);
357 357
 
358
-		if ( ! $provider || false === $data = $this->fetch( $provider, $url, $args ) ) {
358
+		if ( ! $provider || false === $data = $this->fetch($provider, $url, $args)) {
359 359
 			return false;
360 360
 		}
361 361
 
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 		 * @param string $url  URL of the content to be embedded.
369 369
 		 * @param array  $args Optional arguments, usually passed from a shortcode.
370 370
 		 */
371
-		return apply_filters( 'oembed_result', $this->data2html( $data, $url ), $url, $args );
371
+		return apply_filters('oembed_result', $this->data2html($data, $url), $url, $args);
372 372
 	}
373 373
 
374 374
 	/**
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 	 * @param string $url The URL that should be inspected for discovery `<link>` tags.
381 381
 	 * @return false|string False on failure, otherwise the oEmbed provider URL.
382 382
 	 */
383
-	public function discover( $url ) {
383
+	public function discover($url) {
384 384
 		$providers = array();
385 385
 		$args = array(
386 386
 			'limit_response_size' => 153600, // 150 KB
@@ -396,11 +396,11 @@  discard block
 block discarded – undo
396 396
 		 * @param array  $args oEmbed remote get arguments.
397 397
 		 * @param string $url  URL to be inspected.
398 398
 		 */
399
-		$args = apply_filters( 'oembed_remote_get_args', $args, $url );
399
+		$args = apply_filters('oembed_remote_get_args', $args, $url);
400 400
 
401 401
 		// Fetch URL content
402
-		$request = wp_safe_remote_get( $url, $args );
403
-		if ( $html = wp_remote_retrieve_body( $request ) ) {
402
+		$request = wp_safe_remote_get($url, $args);
403
+		if ($html = wp_remote_retrieve_body($request)) {
404 404
 
405 405
 			/**
406 406
 			 * Filters the link types that contain oEmbed provider URLs.
@@ -411,35 +411,35 @@  discard block
 block discarded – undo
411 411
 			 *                      'text/xml+oembed', and 'application/xml+oembed' (incorrect,
412 412
 			 *                      used by at least Vimeo).
413 413
 			 */
414
-			$linktypes = apply_filters( 'oembed_linktypes', array(
414
+			$linktypes = apply_filters('oembed_linktypes', array(
415 415
 				'application/json+oembed' => 'json',
416 416
 				'text/xml+oembed' => 'xml',
417 417
 				'application/xml+oembed' => 'xml',
418
-			) );
418
+			));
419 419
 
420 420
 			// Strip <body>
421
-			if ( $html_head_end = stripos( $html, '</head>' ) ) {
422
-				$html = substr( $html, 0, $html_head_end );
421
+			if ($html_head_end = stripos($html, '</head>')) {
422
+				$html = substr($html, 0, $html_head_end);
423 423
 			}
424 424
 
425 425
 			// Do a quick check
426 426
 			$tagfound = false;
427
-			foreach ( $linktypes as $linktype => $format ) {
428
-				if ( stripos($html, $linktype) ) {
427
+			foreach ($linktypes as $linktype => $format) {
428
+				if (stripos($html, $linktype)) {
429 429
 					$tagfound = true;
430 430
 					break;
431 431
 				}
432 432
 			}
433 433
 
434
-			if ( $tagfound && preg_match_all( '#<link([^<>]+)/?>#iU', $html, $links ) ) {
435
-				foreach ( $links[1] as $link ) {
436
-					$atts = shortcode_parse_atts( $link );
434
+			if ($tagfound && preg_match_all('#<link([^<>]+)/?>#iU', $html, $links)) {
435
+				foreach ($links[1] as $link) {
436
+					$atts = shortcode_parse_atts($link);
437 437
 
438
-					if ( !empty($atts['type']) && !empty($linktypes[$atts['type']]) && !empty($atts['href']) ) {
439
-						$providers[$linktypes[$atts['type']]] = htmlspecialchars_decode( $atts['href'] );
438
+					if ( ! empty($atts['type']) && ! empty($linktypes[$atts['type']]) && ! empty($atts['href'])) {
439
+						$providers[$linktypes[$atts['type']]] = htmlspecialchars_decode($atts['href']);
440 440
 
441 441
 						// Stop here if it's JSON (that's all we need)
442
-						if ( 'json' == $linktypes[$atts['type']] )
442
+						if ('json' == $linktypes[$atts['type']])
443 443
 							break;
444 444
 					}
445 445
 				}
@@ -447,9 +447,9 @@  discard block
 block discarded – undo
447 447
 		}
448 448
 
449 449
 		// JSON is preferred to XML
450
-		if ( !empty($providers['json']) )
450
+		if ( ! empty($providers['json']))
451 451
 			return $providers['json'];
452
-		elseif ( !empty($providers['xml']) )
452
+		elseif ( ! empty($providers['xml']))
453 453
 			return $providers['xml'];
454 454
 		else
455 455
 			return false;
@@ -466,12 +466,12 @@  discard block
 block discarded – undo
466 466
 	 * @param array|string $args     Optional. Arguments, usually passed from a shortcode. Default empty.
467 467
 	 * @return false|object False on failure, otherwise the result in the form of an object.
468 468
 	 */
469
-	public function fetch( $provider, $url, $args = '' ) {
470
-		$args = wp_parse_args( $args, wp_embed_defaults( $url ) );
469
+	public function fetch($provider, $url, $args = '') {
470
+		$args = wp_parse_args($args, wp_embed_defaults($url));
471 471
 
472
-		$provider = add_query_arg( 'maxwidth', (int) $args['width'], $provider );
473
-		$provider = add_query_arg( 'maxheight', (int) $args['height'], $provider );
474
-		$provider = add_query_arg( 'url', urlencode($url), $provider );
472
+		$provider = add_query_arg('maxwidth', (int) $args['width'], $provider);
473
+		$provider = add_query_arg('maxheight', (int) $args['height'], $provider);
474
+		$provider = add_query_arg('url', urlencode($url), $provider);
475 475
 
476 476
 		/**
477 477
 		 * Filters the oEmbed URL to be fetched.
@@ -482,13 +482,13 @@  discard block
 block discarded – undo
482 482
 		 * @param string $url      URL of the content to be embedded.
483 483
 		 * @param array  $args     Optional arguments, usually passed from a shortcode.
484 484
 		 */
485
-		$provider = apply_filters( 'oembed_fetch_url', $provider, $url, $args );
485
+		$provider = apply_filters('oembed_fetch_url', $provider, $url, $args);
486 486
 
487
-		foreach ( array( 'json', 'xml' ) as $format ) {
488
-			$result = $this->_fetch_with_format( $provider, $format );
489
-			if ( is_wp_error( $result ) && 'not-implemented' == $result->get_error_code() )
487
+		foreach (array('json', 'xml') as $format) {
488
+			$result = $this->_fetch_with_format($provider, $format);
489
+			if (is_wp_error($result) && 'not-implemented' == $result->get_error_code())
490 490
 				continue;
491
-			return ( $result && ! is_wp_error( $result ) ) ? $result : false;
491
+			return ($result && ! is_wp_error($result)) ? $result : false;
492 492
 		}
493 493
 		return false;
494 494
 	}
@@ -503,19 +503,19 @@  discard block
 block discarded – undo
503 503
 	 * @param string $format Format to use
504 504
 	 * @return false|object|WP_Error False on failure, otherwise the result in the form of an object.
505 505
 	 */
506
-	private function _fetch_with_format( $provider_url_with_args, $format ) {
507
-		$provider_url_with_args = add_query_arg( 'format', $format, $provider_url_with_args );
506
+	private function _fetch_with_format($provider_url_with_args, $format) {
507
+		$provider_url_with_args = add_query_arg('format', $format, $provider_url_with_args);
508 508
 
509 509
 		/** This filter is documented in wp-includes/class-oembed.php */
510
-		$args = apply_filters( 'oembed_remote_get_args', array(), $provider_url_with_args );
510
+		$args = apply_filters('oembed_remote_get_args', array(), $provider_url_with_args);
511 511
 
512
-		$response = wp_safe_remote_get( $provider_url_with_args, $args );
513
-		if ( 501 == wp_remote_retrieve_response_code( $response ) )
514
-			return new WP_Error( 'not-implemented' );
515
-		if ( ! $body = wp_remote_retrieve_body( $response ) )
512
+		$response = wp_safe_remote_get($provider_url_with_args, $args);
513
+		if (501 == wp_remote_retrieve_response_code($response))
514
+			return new WP_Error('not-implemented');
515
+		if ( ! $body = wp_remote_retrieve_body($response))
516 516
 			return false;
517 517
 		$parse_method = "_parse_$format";
518
-		return $this->$parse_method( $body );
518
+		return $this->$parse_method($body);
519 519
 	}
520 520
 
521 521
 	/**
@@ -527,9 +527,9 @@  discard block
 block discarded – undo
527 527
 	 * @param string $response_body
528 528
 	 * @return object|false
529 529
 	 */
530
-	private function _parse_json( $response_body ) {
531
-		$data = json_decode( trim( $response_body ) );
532
-		return ( $data && is_object( $data ) ) ? $data : false;
530
+	private function _parse_json($response_body) {
531
+		$data = json_decode(trim($response_body));
532
+		return ($data && is_object($data)) ? $data : false;
533 533
 	}
534 534
 
535 535
 	/**
@@ -541,17 +541,17 @@  discard block
 block discarded – undo
541 541
 	 * @param string $response_body
542 542
 	 * @return object|false
543 543
 	 */
544
-	private function _parse_xml( $response_body ) {
545
-		if ( ! function_exists( 'libxml_disable_entity_loader' ) )
544
+	private function _parse_xml($response_body) {
545
+		if ( ! function_exists('libxml_disable_entity_loader'))
546 546
 			return false;
547 547
 
548
-		$loader = libxml_disable_entity_loader( true );
549
-		$errors = libxml_use_internal_errors( true );
548
+		$loader = libxml_disable_entity_loader(true);
549
+		$errors = libxml_use_internal_errors(true);
550 550
 
551
-		$return = $this->_parse_xml_body( $response_body );
551
+		$return = $this->_parse_xml_body($response_body);
552 552
 
553
-		libxml_use_internal_errors( $errors );
554
-		libxml_disable_entity_loader( $loader );
553
+		libxml_use_internal_errors($errors);
554
+		libxml_disable_entity_loader($loader);
555 555
 
556 556
 		return $return;
557 557
 	}
@@ -565,29 +565,29 @@  discard block
 block discarded – undo
565 565
 	 * @param string $response_body
566 566
 	 * @return stdClass|false
567 567
 	 */
568
-	private function _parse_xml_body( $response_body ) {
569
-		if ( ! function_exists( 'simplexml_import_dom' ) || ! class_exists( 'DOMDocument', false ) )
568
+	private function _parse_xml_body($response_body) {
569
+		if ( ! function_exists('simplexml_import_dom') || ! class_exists('DOMDocument', false))
570 570
 			return false;
571 571
 
572 572
 		$dom = new DOMDocument;
573
-		$success = $dom->loadXML( $response_body );
574
-		if ( ! $success )
573
+		$success = $dom->loadXML($response_body);
574
+		if ( ! $success)
575 575
 			return false;
576 576
 
577
-		if ( isset( $dom->doctype ) )
577
+		if (isset($dom->doctype))
578 578
 			return false;
579 579
 
580
-		foreach ( $dom->childNodes as $child ) {
581
-			if ( XML_DOCUMENT_TYPE_NODE === $child->nodeType )
580
+		foreach ($dom->childNodes as $child) {
581
+			if (XML_DOCUMENT_TYPE_NODE === $child->nodeType)
582 582
 				return false;
583 583
 		}
584 584
 
585
-		$xml = simplexml_import_dom( $dom );
586
-		if ( ! $xml )
585
+		$xml = simplexml_import_dom($dom);
586
+		if ( ! $xml)
587 587
 			return false;
588 588
 
589 589
 		$return = new stdClass;
590
-		foreach ( $xml as $key => $value ) {
590
+		foreach ($xml as $key => $value) {
591 591
 			$return->$key = (string) $value;
592 592
 		}
593 593
 
@@ -604,32 +604,32 @@  discard block
 block discarded – undo
604 604
 	 * @param string $url The URL to the content that is desired to be embedded.
605 605
 	 * @return false|string False on error, otherwise the HTML needed to embed.
606 606
 	 */
607
-	public function data2html( $data, $url ) {
608
-		if ( ! is_object( $data ) || empty( $data->type ) )
607
+	public function data2html($data, $url) {
608
+		if ( ! is_object($data) || empty($data->type))
609 609
 			return false;
610 610
 
611 611
 		$return = false;
612 612
 
613
-		switch ( $data->type ) {
613
+		switch ($data->type) {
614 614
 			case 'photo':
615
-				if ( empty( $data->url ) || empty( $data->width ) || empty( $data->height ) )
615
+				if (empty($data->url) || empty($data->width) || empty($data->height))
616 616
 					break;
617
-				if ( ! is_string( $data->url ) || ! is_numeric( $data->width ) || ! is_numeric( $data->height ) )
617
+				if ( ! is_string($data->url) || ! is_numeric($data->width) || ! is_numeric($data->height))
618 618
 					break;
619 619
 
620
-				$title = ! empty( $data->title ) && is_string( $data->title ) ? $data->title : '';
621
-				$return = '<a href="' . esc_url( $url ) . '"><img src="' . esc_url( $data->url ) . '" alt="' . esc_attr($title) . '" width="' . esc_attr($data->width) . '" height="' . esc_attr($data->height) . '" /></a>';
620
+				$title = ! empty($data->title) && is_string($data->title) ? $data->title : '';
621
+				$return = '<a href="'.esc_url($url).'"><img src="'.esc_url($data->url).'" alt="'.esc_attr($title).'" width="'.esc_attr($data->width).'" height="'.esc_attr($data->height).'" /></a>';
622 622
 				break;
623 623
 
624 624
 			case 'video':
625 625
 			case 'rich':
626
-				if ( ! empty( $data->html ) && is_string( $data->html ) )
626
+				if ( ! empty($data->html) && is_string($data->html))
627 627
 					$return = $data->html;
628 628
 				break;
629 629
 
630 630
 			case 'link':
631
-				if ( ! empty( $data->title ) && is_string( $data->title ) )
632
-					$return = '<a href="' . esc_url( $url ) . '">' . esc_html( $data->title ) . '</a>';
631
+				if ( ! empty($data->title) && is_string($data->title))
632
+					$return = '<a href="'.esc_url($url).'">'.esc_html($data->title).'</a>';
633 633
 				break;
634 634
 
635 635
 			default:
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
 		 * @param object $data   A data object result from an oEmbed provider.
648 648
 		 * @param string $url    The URL of the content to be embedded.
649 649
 		 */
650
-		return apply_filters( 'oembed_dataparse', $return, $data, $url );
650
+		return apply_filters('oembed_dataparse', $return, $data, $url);
651 651
 	}
652 652
 
653 653
 	/**
@@ -662,32 +662,32 @@  discard block
 block discarded – undo
662 662
 	 * @param string $url The original URL passed to oEmbed.
663 663
 	 * @return string Possibly modified $html
664 664
 	 */
665
-	public function _strip_newlines( $html, $data, $url ) {
666
-		if ( false === strpos( $html, "\n" ) ) {
665
+	public function _strip_newlines($html, $data, $url) {
666
+		if (false === strpos($html, "\n")) {
667 667
 			return $html;
668 668
 		}
669 669
 
670 670
 		$count = 1;
671 671
 		$found = array();
672 672
 		$token = '__PRE__';
673
-		$search = array( "\t", "\n", "\r", ' ' );
674
-		$replace = array( '__TAB__', '__NL__', '__CR__', '__SPACE__' );
675
-		$tokenized = str_replace( $search, $replace, $html );
673
+		$search = array("\t", "\n", "\r", ' ');
674
+		$replace = array('__TAB__', '__NL__', '__CR__', '__SPACE__');
675
+		$tokenized = str_replace($search, $replace, $html);
676 676
 
677
-		preg_match_all( '#(<pre[^>]*>.+?</pre>)#i', $tokenized, $matches, PREG_SET_ORDER );
678
-		foreach ( $matches as $i => $match ) {
679
-			$tag_html = str_replace( $replace, $search, $match[0] );
680
-			$tag_token = $token . $i;
677
+		preg_match_all('#(<pre[^>]*>.+?</pre>)#i', $tokenized, $matches, PREG_SET_ORDER);
678
+		foreach ($matches as $i => $match) {
679
+			$tag_html = str_replace($replace, $search, $match[0]);
680
+			$tag_token = $token.$i;
681 681
 
682
-			$found[ $tag_token ] = $tag_html;
683
-			$html = str_replace( $tag_html, $tag_token, $html, $count );
682
+			$found[$tag_token] = $tag_html;
683
+			$html = str_replace($tag_html, $tag_token, $html, $count);
684 684
 		}
685 685
 
686
-		$replaced = str_replace( $replace, $search, $html );
687
-		$stripped = str_replace( array( "\r\n", "\n" ), '', $replaced );
688
-		$pre = array_values( $found );
689
-		$tokens = array_keys( $found );
686
+		$replaced = str_replace($replace, $search, $html);
687
+		$stripped = str_replace(array("\r\n", "\n"), '', $replaced);
688
+		$pre = array_values($found);
689
+		$tokens = array_keys($found);
690 690
 
691
-		return str_replace( $tokens, $pre, $stripped );
691
+		return str_replace($tokens, $pre, $stripped);
692 692
 	}
693 693
 }
Please login to merge, or discard this patch.