Completed
Push — master ( cde0c6...d99bf9 )
by Stephen
15:46
created
src/wp-admin/profile.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,4 +15,4 @@
 block discarded – undo
15 15
 define('IS_PROFILE_PAGE', true);
16 16
 
17 17
 /** Load User Editing Page */
18
-require_once( dirname( __FILE__ ) . '/user-edit.php' );
18
+require_once(dirname(__FILE__).'/user-edit.php');
Please login to merge, or discard this patch.
src/wp-admin/install-helper.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 /** Load WordPress Bootstrap */
38 38
 require_once(dirname(dirname(__FILE__)).'/wp-load.php');
39 39
 
40
-if ( ! function_exists('maybe_create_table') ) :
40
+if ( ! function_exists('maybe_create_table')) :
41 41
 /**
42 42
  * Create database table, if it doesn't already exist.
43 43
  *
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
  */
52 52
 function maybe_create_table($table_name, $create_ddl) {
53 53
 	global $wpdb;
54
-	foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
54
+	foreach ($wpdb->get_col("SHOW TABLES", 0) as $table) {
55 55
 		if ($table == $table_name) {
56 56
 			return true;
57 57
 		}
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	$wpdb->query($create_ddl);
61 61
 
62 62
 	// We cannot directly tell that whether this succeeded!
63
-	foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
63
+	foreach ($wpdb->get_col("SHOW TABLES", 0) as $table) {
64 64
 		if ($table == $table_name) {
65 65
 			return true;
66 66
 		}
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 }
70 70
 endif;
71 71
 
72
-if ( ! function_exists('maybe_add_column') ) :
72
+if ( ! function_exists('maybe_add_column')) :
73 73
 /**
74 74
  * Add column to database table, if column doesn't already exist in table.
75 75
  *
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
  */
85 85
 function maybe_add_column($table_name, $column_name, $create_ddl) {
86 86
 	global $wpdb;
87
-	foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
87
+	foreach ($wpdb->get_col("DESC $table_name", 0) as $column) {
88 88
 
89 89
 		if ($column == $column_name) {
90 90
 			return true;
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	$wpdb->query($create_ddl);
96 96
 
97 97
 	// We cannot directly tell that whether this succeeded!
98
-	foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
98
+	foreach ($wpdb->get_col("DESC $table_name", 0) as $column) {
99 99
 		if ($column == $column_name) {
100 100
 			return true;
101 101
 		}
@@ -118,14 +118,14 @@  discard block
 block discarded – undo
118 118
  */
119 119
 function maybe_drop_column($table_name, $column_name, $drop_ddl) {
120 120
 	global $wpdb;
121
-	foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
121
+	foreach ($wpdb->get_col("DESC $table_name", 0) as $column) {
122 122
 		if ($column == $column_name) {
123 123
 
124 124
 			// Found it, so try to drop it.
125 125
 			$wpdb->query($drop_ddl);
126 126
 
127 127
 			// We cannot directly tell that whether this succeeded!
128
-			foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
128
+			foreach ($wpdb->get_col("DESC $table_name", 0) as $column) {
129 129
 				if ($column == $column_name) {
130 130
 					return false;
131 131
 				}
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	$diffs = 0;
171 171
 	$results = $wpdb->get_results("DESC $table_name");
172 172
 
173
-	foreach ($results as $row ) {
173
+	foreach ($results as $row) {
174 174
 
175 175
 		if ($row->Field == $col_name) {
176 176
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 			if (($is_null != null) && ($row->Null != $is_null)) {
182 182
 				++$diffs;
183 183
 			}
184
-			if (($key != null) && ($row->Key  != $key)) {
184
+			if (($key != null) && ($row->Key != $key)) {
185 185
 				++$diffs;
186 186
 			}
187 187
 			if (($default != null) && ($row->Default != $default)) {
Please login to merge, or discard this patch.
src/wp-admin/ms-users.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
  * @since 3.0.0
8 8
  */
9 9
 
10
-require_once( dirname( __FILE__ ) . '/admin.php' );
10
+require_once(dirname(__FILE__).'/admin.php');
11 11
 
12
-wp_redirect( network_admin_url('users.php') );
12
+wp_redirect(network_admin_url('users.php'));
13 13
 exit;
Please login to merge, or discard this patch.
src/wp-includes/post-thumbnail-template.php 3 patches
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -66,16 +66,19 @@  discard block
 block discarded – undo
66 66
  * @param WP_Query $wp_query Optional. A WP_Query instance. Defaults to the $wp_query global.
67 67
  */
68 68
 function update_post_thumbnail_cache( $wp_query = null ) {
69
-	if ( ! $wp_query )
70
-		$wp_query = $GLOBALS['wp_query'];
69
+	if ( ! $wp_query ) {
70
+			$wp_query = $GLOBALS['wp_query'];
71
+	}
71 72
 
72
-	if ( $wp_query->thumbnails_cached )
73
-		return;
73
+	if ( $wp_query->thumbnails_cached ) {
74
+			return;
75
+	}
74 76
 
75 77
 	$thumb_ids = array();
76 78
 	foreach ( $wp_query->posts as $post ) {
77
-		if ( $id = get_post_thumbnail_id( $post->ID ) )
78
-			$thumb_ids[] = $id;
79
+		if ( $id = get_post_thumbnail_id( $post->ID ) ) {
80
+					$thumb_ids[] = $id;
81
+		}
79 82
 	}
80 83
 
81 84
 	if ( ! empty ( $thumb_ids ) ) {
@@ -130,8 +133,9 @@  discard block
 block discarded – undo
130 133
 		 * @param string $size              The post thumbnail size.
131 134
 		 */
132 135
 		do_action( 'begin_fetch_post_thumbnail_html', $post_id, $post_thumbnail_id, $size );
133
-		if ( in_the_loop() )
134
-			update_post_thumbnail_cache();
136
+		if ( in_the_loop() ) {
137
+					update_post_thumbnail_cache();
138
+		}
135 139
 		$html = wp_get_attachment_image( $post_thumbnail_id, $size, false, $attr );
136 140
 
137 141
 		/**
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@
 block discarded – undo
53 53
  *
54 54
  * @see get_the_post_thumbnail()
55 55
  *
56
- * @param string|array $size Optional. Image size to use. Accepts any valid image size, or
56
+ * @param string $size Optional. Image size to use. Accepts any valid image size, or
57 57
  *                           an array of width and height values in pixels (in that order).
58 58
  *                           Default 'post-thumbnail'.
59 59
  * @param string|array $attr Optional. Query string or array of attributes. Default empty.
Please login to merge, or discard this patch.
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -18,8 +18,8 @@  discard block
 block discarded – undo
18 18
  * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`.
19 19
  * @return bool Whether the post has an image attached.
20 20
  */
21
-function has_post_thumbnail( $post = null ) {
22
-	return (bool) get_post_thumbnail_id( $post );
21
+function has_post_thumbnail($post = null) {
22
+	return (bool) get_post_thumbnail_id($post);
23 23
 }
24 24
 
25 25
 /**
@@ -31,12 +31,12 @@  discard block
 block discarded – undo
31 31
  * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`.
32 32
  * @return string|int Post thumbnail ID or empty string.
33 33
  */
34
-function get_post_thumbnail_id( $post = null ) {
35
-	$post = get_post( $post );
36
-	if ( ! $post ) {
34
+function get_post_thumbnail_id($post = null) {
35
+	$post = get_post($post);
36
+	if ( ! $post) {
37 37
 		return '';
38 38
 	}
39
-	return get_post_meta( $post->ID, '_thumbnail_id', true );
39
+	return get_post_meta($post->ID, '_thumbnail_id', true);
40 40
 }
41 41
 
42 42
 /**
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
  *                           Default 'post-thumbnail'.
59 59
  * @param string|array $attr Optional. Query string or array of attributes. Default empty.
60 60
  */
61
-function the_post_thumbnail( $size = 'post-thumbnail', $attr = '' ) {
62
-	echo get_the_post_thumbnail( null, $size, $attr );
61
+function the_post_thumbnail($size = 'post-thumbnail', $attr = '') {
62
+	echo get_the_post_thumbnail(null, $size, $attr);
63 63
 }
64 64
 
65 65
 /**
@@ -71,21 +71,21 @@  discard block
 block discarded – undo
71 71
  *
72 72
  * @param WP_Query $wp_query Optional. A WP_Query instance. Defaults to the $wp_query global.
73 73
  */
74
-function update_post_thumbnail_cache( $wp_query = null ) {
75
-	if ( ! $wp_query )
74
+function update_post_thumbnail_cache($wp_query = null) {
75
+	if ( ! $wp_query)
76 76
 		$wp_query = $GLOBALS['wp_query'];
77 77
 
78
-	if ( $wp_query->thumbnails_cached )
78
+	if ($wp_query->thumbnails_cached)
79 79
 		return;
80 80
 
81 81
 	$thumb_ids = array();
82
-	foreach ( $wp_query->posts as $post ) {
83
-		if ( $id = get_post_thumbnail_id( $post->ID ) )
82
+	foreach ($wp_query->posts as $post) {
83
+		if ($id = get_post_thumbnail_id($post->ID))
84 84
 			$thumb_ids[] = $id;
85 85
 	}
86 86
 
87
-	if ( ! empty ( $thumb_ids ) ) {
88
-		_prime_post_caches( $thumb_ids, false, true );
87
+	if ( ! empty ($thumb_ids)) {
88
+		_prime_post_caches($thumb_ids, false, true);
89 89
 	}
90 90
 
91 91
 	$wp_query->thumbnails_cached = true;
@@ -111,12 +111,12 @@  discard block
 block discarded – undo
111 111
  * @param string|array $attr Optional. Query string or array of attributes. Default empty.
112 112
  * @return string The post thumbnail image tag.
113 113
  */
114
-function get_the_post_thumbnail( $post = null, $size = 'post-thumbnail', $attr = '' ) {
115
-	$post = get_post( $post );
116
-	if ( ! $post ) {
114
+function get_the_post_thumbnail($post = null, $size = 'post-thumbnail', $attr = '') {
115
+	$post = get_post($post);
116
+	if ( ! $post) {
117 117
 		return '';
118 118
 	}
119
-	$post_thumbnail_id = get_post_thumbnail_id( $post );
119
+	$post_thumbnail_id = get_post_thumbnail_id($post);
120 120
 
121 121
 	/**
122 122
 	 * Filters the post thumbnail size.
@@ -126,9 +126,9 @@  discard block
 block discarded – undo
126 126
 	 * @param string|array $size The post thumbnail size. Image size or array of width and height
127 127
 	 *                           values (in that order). Default 'post-thumbnail'.
128 128
 	 */
129
-	$size = apply_filters( 'post_thumbnail_size', $size );
129
+	$size = apply_filters('post_thumbnail_size', $size);
130 130
 
131
-	if ( $post_thumbnail_id ) {
131
+	if ($post_thumbnail_id) {
132 132
 
133 133
 		/**
134 134
 		 * Fires before fetching the post thumbnail HTML.
@@ -142,10 +142,10 @@  discard block
 block discarded – undo
142 142
 		 * @param string|array $size              The post thumbnail size. Image size or array of width
143 143
 		 *                                        and height values (in that order). Default 'post-thumbnail'.
144 144
 		 */
145
-		do_action( 'begin_fetch_post_thumbnail_html', $post->ID, $post_thumbnail_id, $size );
146
-		if ( in_the_loop() )
145
+		do_action('begin_fetch_post_thumbnail_html', $post->ID, $post_thumbnail_id, $size);
146
+		if (in_the_loop())
147 147
 			update_post_thumbnail_cache();
148
-		$html = wp_get_attachment_image( $post_thumbnail_id, $size, false, $attr );
148
+		$html = wp_get_attachment_image($post_thumbnail_id, $size, false, $attr);
149 149
 
150 150
 		/**
151 151
 		 * Fires after fetching the post thumbnail HTML.
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 		 * @param string|array $size              The post thumbnail size. Image size or array of width
158 158
 		 *                                        and height values (in that order). Default 'post-thumbnail'.
159 159
 		 */
160
-		do_action( 'end_fetch_post_thumbnail_html', $post->ID, $post_thumbnail_id, $size );
160
+		do_action('end_fetch_post_thumbnail_html', $post->ID, $post_thumbnail_id, $size);
161 161
 
162 162
 	} else {
163 163
 		$html = '';
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 	 *                                        values (in that order). Default 'post-thumbnail'.
175 175
 	 * @param string       $attr              Query string of attributes.
176 176
 	 */
177
-	return apply_filters( 'post_thumbnail_html', $html, $post->ID, $post_thumbnail_id, $size, $attr );
177
+	return apply_filters('post_thumbnail_html', $html, $post->ID, $post_thumbnail_id, $size, $attr);
178 178
 }
179 179
 
180 180
 /**
@@ -187,12 +187,12 @@  discard block
 block discarded – undo
187 187
  *                           array of height and width dimensions. Default 'post-thumbnail'.
188 188
  * @return string|false Post thumbnail URL or false if no URL is available.
189 189
  */
190
-function get_the_post_thumbnail_url( $post = null, $size = 'post-thumbnail' ) {
191
-	$post_thumbnail_id = get_post_thumbnail_id( $post );
192
-	if ( ! $post_thumbnail_id ) {
190
+function get_the_post_thumbnail_url($post = null, $size = 'post-thumbnail') {
191
+	$post_thumbnail_id = get_post_thumbnail_id($post);
192
+	if ( ! $post_thumbnail_id) {
193 193
 		return false;
194 194
 	}
195
-	return wp_get_attachment_image_url( $post_thumbnail_id, $size );
195
+	return wp_get_attachment_image_url($post_thumbnail_id, $size);
196 196
 }
197 197
 
198 198
 /**
@@ -204,10 +204,10 @@  discard block
 block discarded – undo
204 204
  *                           or an array of width and height values in pixels (in that order).
205 205
  *                           Default 'post-thumbnail'.
206 206
  */
207
-function the_post_thumbnail_url( $size = 'post-thumbnail' ) {
208
-	$url = get_the_post_thumbnail_url( null, $size );
209
-	if ( $url ) {
210
-		echo esc_url( $url );
207
+function the_post_thumbnail_url($size = 'post-thumbnail') {
208
+	$url = get_the_post_thumbnail_url(null, $size);
209
+	if ($url) {
210
+		echo esc_url($url);
211 211
 	}
212 212
 }
213 213
 
@@ -219,15 +219,15 @@  discard block
 block discarded – undo
219 219
  * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`.
220 220
  * @return string Post thumbnail caption.
221 221
  */
222
-function get_the_post_thumbnail_caption( $post = null ) {
223
-	$post_thumbnail_id = get_post_thumbnail_id( $post );
224
-	if ( ! $post_thumbnail_id ) {
222
+function get_the_post_thumbnail_caption($post = null) {
223
+	$post_thumbnail_id = get_post_thumbnail_id($post);
224
+	if ( ! $post_thumbnail_id) {
225 225
 		return '';
226 226
 	}
227 227
 
228
-	$caption = wp_get_attachment_caption( $post_thumbnail_id );
228
+	$caption = wp_get_attachment_caption($post_thumbnail_id);
229 229
 
230
-	if ( ! $caption ) {
230
+	if ( ! $caption) {
231 231
 		$caption = '';
232 232
 	}
233 233
 
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
  *
242 242
  * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`.
243 243
  */
244
-function the_post_thumbnail_caption( $post = null ) {
244
+function the_post_thumbnail_caption($post = null) {
245 245
 	/**
246 246
 	 * Filters the displayed post thumbnail caption.
247 247
 	 *
@@ -249,5 +249,5 @@  discard block
 block discarded – undo
249 249
 	 *
250 250
 	 * @param string $caption Caption for the given attachment.
251 251
 	 */
252
-	echo apply_filters( 'the_post_thumbnail_caption', get_the_post_thumbnail_caption( $post ) );
252
+	echo apply_filters('the_post_thumbnail_caption', get_the_post_thumbnail_caption($post));
253 253
 }
Please login to merge, or discard this patch.
src/wp-includes/vars.php 2 patches
Braces   +22 added lines, -16 removed lines patch added patch discarded remove patch
@@ -22,12 +22,13 @@  discard block
 block discarded – undo
22 22
 // On which page are we ?
23 23
 if ( is_admin() ) {
24 24
 	// wp-admin pages are checked more carefully
25
-	if ( is_network_admin() )
26
-		preg_match('#/wp-admin/network/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches);
27
-	elseif ( is_user_admin() )
28
-		preg_match('#/wp-admin/user/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches);
29
-	else
30
-		preg_match('#/wp-admin/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches);
25
+	if ( is_network_admin() ) {
26
+			preg_match('#/wp-admin/network/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches);
27
+	} elseif ( is_user_admin() ) {
28
+			preg_match('#/wp-admin/user/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches);
29
+	} else {
30
+			preg_match('#/wp-admin/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches);
31
+	}
31 32
 	$pagenow = $self_matches[1];
32 33
 	$pagenow = trim($pagenow, '/');
33 34
 	$pagenow = preg_replace('#\?.*?$#', '', $pagenow);
@@ -36,15 +37,18 @@  discard block
 block discarded – undo
36 37
 	} else {
37 38
 		preg_match('#(.*?)(/|$)#', $pagenow, $self_matches);
38 39
 		$pagenow = strtolower($self_matches[1]);
39
-		if ( '.php' !== substr($pagenow, -4, 4) )
40
-			$pagenow .= '.php'; // for Options +Multiviews: /wp-admin/themes/index.php (themes.php is queried)
40
+		if ( '.php' !== substr($pagenow, -4, 4) ) {
41
+					$pagenow .= '.php';
42
+		}
43
+		// for Options +Multiviews: /wp-admin/themes/index.php (themes.php is queried)
41 44
 	}
42 45
 } else {
43
-	if ( preg_match('#([^/]+\.php)([?/].*?)?$#i', $_SERVER['PHP_SELF'], $self_matches) )
44
-		$pagenow = strtolower($self_matches[1]);
45
-	else
46
-		$pagenow = 'index.php';
47
-}
46
+	if ( preg_match('#([^/]+\.php)([?/].*?)?$#i', $_SERVER['PHP_SELF'], $self_matches) ) {
47
+			$pagenow = strtolower($self_matches[1]);
48
+	} else {
49
+			$pagenow = 'index.php';
50
+	}
51
+	}
48 52
 unset($self_matches);
49 53
 
50 54
 // Simple browser detection
@@ -63,8 +67,9 @@  discard block
 block discarded – undo
63 67
 			 *
64 68
 			 * @param bool $is_admin Whether to use the Google Chrome Frame. Default is the value of is_admin().
65 69
 			 */
66
-			if ( $is_chrome = apply_filters( 'use_google_chrome_frame', $is_admin ) )
67
-				header( 'X-UA-Compatible: chrome=1' );
70
+			if ( $is_chrome = apply_filters( 'use_google_chrome_frame', $is_admin ) ) {
71
+							header( 'X-UA-Compatible: chrome=1' );
72
+			}
68 73
 			$is_winIE = ! $is_chrome;
69 74
 		} else {
70 75
 			$is_chrome = true;
@@ -84,8 +89,9 @@  discard block
 block discarded – undo
84 89
 	}
85 90
 }
86 91
 
87
-if ( $is_safari && stripos($_SERVER['HTTP_USER_AGENT'], 'mobile') !== false )
92
+if ( $is_safari && stripos($_SERVER['HTTP_USER_AGENT'], 'mobile') !== false ) {
88 93
 	$is_iphone = true;
94
+}
89 95
 
90 96
 $is_IE = ( $is_macIE || $is_winIE );
91 97
 
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -20,27 +20,27 @@  discard block
 block discarded – undo
20 20
 	$is_apache, $is_IIS, $is_iis7, $is_nginx;
21 21
 
22 22
 // On which page are we ?
23
-if ( is_admin() ) {
23
+if (is_admin()) {
24 24
 	// wp-admin pages are checked more carefully
25
-	if ( is_network_admin() )
25
+	if (is_network_admin())
26 26
 		preg_match('#/wp-admin/network/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches);
27
-	elseif ( is_user_admin() )
27
+	elseif (is_user_admin())
28 28
 		preg_match('#/wp-admin/user/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches);
29 29
 	else
30 30
 		preg_match('#/wp-admin/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches);
31 31
 	$pagenow = $self_matches[1];
32 32
 	$pagenow = trim($pagenow, '/');
33 33
 	$pagenow = preg_replace('#\?.*?$#', '', $pagenow);
34
-	if ( '' === $pagenow || 'index' === $pagenow || 'index.php' === $pagenow ) {
34
+	if ('' === $pagenow || 'index' === $pagenow || 'index.php' === $pagenow) {
35 35
 		$pagenow = 'index.php';
36 36
 	} else {
37 37
 		preg_match('#(.*?)(/|$)#', $pagenow, $self_matches);
38 38
 		$pagenow = strtolower($self_matches[1]);
39
-		if ( '.php' !== substr($pagenow, -4, 4) )
39
+		if ('.php' !== substr($pagenow, -4, 4))
40 40
 			$pagenow .= '.php'; // for Options +Multiviews: /wp-admin/themes/index.php (themes.php is queried)
41 41
 	}
42 42
 } else {
43
-	if ( preg_match('#([^/]+\.php)([?/].*?)?$#i', $_SERVER['PHP_SELF'], $self_matches) )
43
+	if (preg_match('#([^/]+\.php)([?/].*?)?$#i', $_SERVER['PHP_SELF'], $self_matches))
44 44
 		$pagenow = strtolower($self_matches[1]);
45 45
 	else
46 46
 		$pagenow = 'index.php';
@@ -50,13 +50,13 @@  discard block
 block discarded – undo
50 50
 // Simple browser detection
51 51
 $is_lynx = $is_gecko = $is_winIE = $is_macIE = $is_opera = $is_NS4 = $is_safari = $is_chrome = $is_iphone = $is_edge = false;
52 52
 
53
-if ( isset($_SERVER['HTTP_USER_AGENT']) ) {
54
-	if ( strpos($_SERVER['HTTP_USER_AGENT'], 'Lynx') !== false ) {
53
+if (isset($_SERVER['HTTP_USER_AGENT'])) {
54
+	if (strpos($_SERVER['HTTP_USER_AGENT'], 'Lynx') !== false) {
55 55
 		$is_lynx = true;
56
-	} elseif ( strpos( $_SERVER['HTTP_USER_AGENT'], 'Edge' ) !== false ) {
56
+	} elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'Edge') !== false) {
57 57
 		$is_edge = true;
58
-	} elseif ( stripos($_SERVER['HTTP_USER_AGENT'], 'chrome') !== false ) {
59
-		if ( stripos( $_SERVER['HTTP_USER_AGENT'], 'chromeframe' ) !== false ) {
58
+	} elseif (stripos($_SERVER['HTTP_USER_AGENT'], 'chrome') !== false) {
59
+		if (stripos($_SERVER['HTTP_USER_AGENT'], 'chromeframe') !== false) {
60 60
 			$is_admin = is_admin();
61 61
 			/**
62 62
 			 * Filter whether Google Chrome Frame should be used, if available.
@@ -65,31 +65,31 @@  discard block
 block discarded – undo
65 65
 			 *
66 66
 			 * @param bool $is_admin Whether to use the Google Chrome Frame. Default is the value of is_admin().
67 67
 			 */
68
-			if ( $is_chrome = apply_filters( 'use_google_chrome_frame', $is_admin ) )
69
-				header( 'X-UA-Compatible: chrome=1' );
68
+			if ($is_chrome = apply_filters('use_google_chrome_frame', $is_admin))
69
+				header('X-UA-Compatible: chrome=1');
70 70
 			$is_winIE = ! $is_chrome;
71 71
 		} else {
72 72
 			$is_chrome = true;
73 73
 		}
74
-	} elseif ( stripos($_SERVER['HTTP_USER_AGENT'], 'safari') !== false ) {
74
+	} elseif (stripos($_SERVER['HTTP_USER_AGENT'], 'safari') !== false) {
75 75
 		$is_safari = true;
76
-	} elseif ( ( strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'Trident') !== false ) && strpos($_SERVER['HTTP_USER_AGENT'], 'Win') !== false ) {
76
+	} elseif ((strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'Trident') !== false) && strpos($_SERVER['HTTP_USER_AGENT'], 'Win') !== false) {
77 77
 		$is_winIE = true;
78
-	} elseif ( strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false && strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false ) {
78
+	} elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false && strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) {
79 79
 		$is_macIE = true;
80
-	} elseif ( strpos($_SERVER['HTTP_USER_AGENT'], 'Gecko') !== false ) {
80
+	} elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'Gecko') !== false) {
81 81
 		$is_gecko = true;
82
-	} elseif ( strpos($_SERVER['HTTP_USER_AGENT'], 'Opera') !== false ) {
82
+	} elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'Opera') !== false) {
83 83
 		$is_opera = true;
84
-	} elseif ( strpos($_SERVER['HTTP_USER_AGENT'], 'Nav') !== false && strpos($_SERVER['HTTP_USER_AGENT'], 'Mozilla/4.') !== false ) {
84
+	} elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'Nav') !== false && strpos($_SERVER['HTTP_USER_AGENT'], 'Mozilla/4.') !== false) {
85 85
 		$is_NS4 = true;
86 86
 	}
87 87
 }
88 88
 
89
-if ( $is_safari && stripos($_SERVER['HTTP_USER_AGENT'], 'mobile') !== false )
89
+if ($is_safari && stripos($_SERVER['HTTP_USER_AGENT'], 'mobile') !== false)
90 90
 	$is_iphone = true;
91 91
 
92
-$is_IE = ( $is_macIE || $is_winIE );
92
+$is_IE = ($is_macIE || $is_winIE);
93 93
 
94 94
 // Server detection
95 95
 
@@ -109,13 +109,13 @@  discard block
 block discarded – undo
109 109
  * Whether the server software is IIS or something else
110 110
  * @global bool $is_IIS
111 111
  */
112
-$is_IIS = !$is_apache && (strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== false || strpos($_SERVER['SERVER_SOFTWARE'], 'ExpressionDevServer') !== false);
112
+$is_IIS = ! $is_apache && (strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== false || strpos($_SERVER['SERVER_SOFTWARE'], 'ExpressionDevServer') !== false);
113 113
 
114 114
 /**
115 115
  * Whether the server software is IIS 7.X or greater
116 116
  * @global bool $is_iis7
117 117
  */
118
-$is_iis7 = $is_IIS && intval( substr( $_SERVER['SERVER_SOFTWARE'], strpos( $_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS/' ) + 14 ) ) >= 7;
118
+$is_iis7 = $is_IIS && intval(substr($_SERVER['SERVER_SOFTWARE'], strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS/') + 14)) >= 7;
119 119
 
120 120
 /**
121 121
  * Test if the current browser runs on a mobile device (smart phone, tablet, etc.)
@@ -123,15 +123,15 @@  discard block
 block discarded – undo
123 123
  * @return bool
124 124
  */
125 125
 function wp_is_mobile() {
126
-	if ( empty($_SERVER['HTTP_USER_AGENT']) ) {
126
+	if (empty($_SERVER['HTTP_USER_AGENT'])) {
127 127
 		$is_mobile = false;
128
-	} elseif ( strpos($_SERVER['HTTP_USER_AGENT'], 'Mobile') !== false // many mobile devices (all iPhone, iPad, etc.)
128
+	} elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'Mobile') !== false // many mobile devices (all iPhone, iPad, etc.)
129 129
 		|| strpos($_SERVER['HTTP_USER_AGENT'], 'Android') !== false
130 130
 		|| strpos($_SERVER['HTTP_USER_AGENT'], 'Silk/') !== false
131 131
 		|| strpos($_SERVER['HTTP_USER_AGENT'], 'Kindle') !== false
132 132
 		|| strpos($_SERVER['HTTP_USER_AGENT'], 'BlackBerry') !== false
133 133
 		|| strpos($_SERVER['HTTP_USER_AGENT'], 'Opera Mini') !== false
134
-		|| strpos($_SERVER['HTTP_USER_AGENT'], 'Opera Mobi') !== false ) {
134
+		|| strpos($_SERVER['HTTP_USER_AGENT'], 'Opera Mobi') !== false) {
135 135
 			$is_mobile = true;
136 136
 	} else {
137 137
 		$is_mobile = false;
Please login to merge, or discard this patch.
src/wp-includes/js/tinymce/wp-tinymce.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -10,10 +10,10 @@  discard block
 block discarded – undo
10 10
 
11 11
 function get_file($path) {
12 12
 
13
-	if ( function_exists('realpath') )
13
+	if (function_exists('realpath'))
14 14
 		$path = realpath($path);
15 15
 
16
-	if ( ! $path || ! @is_file($path) )
16
+	if ( ! $path || ! @is_file($path))
17 17
 		return false;
18 18
 
19 19
 	return @file_get_contents($path);
@@ -23,17 +23,17 @@  discard block
 block discarded – undo
23 23
 
24 24
 header('Content-Type: application/javascript; charset=UTF-8');
25 25
 header('Vary: Accept-Encoding'); // Handle proxies
26
-header('Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expires_offset ) . ' GMT');
26
+header('Expires: '.gmdate("D, d M Y H:i:s", time() + $expires_offset).' GMT');
27 27
 header("Cache-Control: public, max-age=$expires_offset");
28 28
 
29
-if ( isset($_GET['c']) && 1 == $_GET['c'] && isset($_SERVER['HTTP_ACCEPT_ENCODING'])
30
-	&& false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') && ( $file = get_file($basepath . '/wp-tinymce.js.gz') ) ) {
29
+if (isset($_GET['c']) && 1 == $_GET['c'] && isset($_SERVER['HTTP_ACCEPT_ENCODING'])
30
+	&& false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') && ($file = get_file($basepath.'/wp-tinymce.js.gz'))) {
31 31
 
32 32
 	header('Content-Encoding: gzip');
33 33
 	echo $file;
34 34
 } else {
35 35
 	// Back compat. This file shouldn't be used if this condition can occur (as in, if gzip isn't accepted).
36
-	echo get_file( $basepath . '/tinymce.min.js' );
37
-	echo get_file( $basepath . '/plugins/compat3x/plugin.min.js' );
36
+	echo get_file($basepath.'/tinymce.min.js');
37
+	echo get_file($basepath.'/plugins/compat3x/plugin.min.js');
38 38
 }
39 39
 exit;
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -10,11 +10,13 @@
 block discarded – undo
10 10
 
11 11
 function get_file($path) {
12 12
 
13
-	if ( function_exists('realpath') )
14
-		$path = realpath($path);
13
+	if ( function_exists('realpath') ) {
14
+			$path = realpath($path);
15
+	}
15 16
 
16
-	if ( ! $path || ! @is_file($path) )
17
-		return false;
17
+	if ( ! $path || ! @is_file($path) ) {
18
+			return false;
19
+	}
18 20
 
19 21
 	return @file_get_contents($path);
20 22
 }
Please login to merge, or discard this patch.
src/wp-includes/class-wp-error.php 2 patches
Braces   +38 added lines, -26 removed lines patch added patch discarded remove patch
@@ -53,13 +53,15 @@  discard block
 block discarded – undo
53 53
 	 * @param mixed $data Optional. Error data.
54 54
 	 */
55 55
 	public function __construct( $code = '', $message = '', $data = '' ) {
56
-		if ( empty($code) )
57
-			return;
56
+		if ( empty($code) ) {
57
+					return;
58
+		}
58 59
 
59 60
 		$this->errors[$code][] = $message;
60 61
 
61
-		if ( ! empty($data) )
62
-			$this->error_data[$code] = $data;
62
+		if ( ! empty($data) ) {
63
+					$this->error_data[$code] = $data;
64
+		}
63 65
 	}
64 66
 
65 67
 	/**
@@ -71,8 +73,9 @@  discard block
 block discarded – undo
71 73
 	 * @return array List of error codes, if available.
72 74
 	 */
73 75
 	public function get_error_codes() {
74
-		if ( empty($this->errors) )
75
-			return array();
76
+		if ( empty($this->errors) ) {
77
+					return array();
78
+		}
76 79
 
77 80
 		return array_keys($this->errors);
78 81
 	}
@@ -88,8 +91,9 @@  discard block
 block discarded – undo
88 91
 	public function get_error_code() {
89 92
 		$codes = $this->get_error_codes();
90 93
 
91
-		if ( empty($codes) )
92
-			return '';
94
+		if ( empty($codes) ) {
95
+					return '';
96
+		}
93 97
 
94 98
 		return $codes[0];
95 99
 	}
@@ -106,16 +110,18 @@  discard block
 block discarded – undo
106 110
 		// Return all messages if no code specified.
107 111
 		if ( empty($code) ) {
108 112
 			$all_messages = array();
109
-			foreach ( (array) $this->errors as $code => $messages )
110
-				$all_messages = array_merge($all_messages, $messages);
113
+			foreach ( (array) $this->errors as $code => $messages ) {
114
+							$all_messages = array_merge($all_messages, $messages);
115
+			}
111 116
 
112 117
 			return $all_messages;
113 118
 		}
114 119
 
115
-		if ( isset($this->errors[$code]) )
116
-			return $this->errors[$code];
117
-		else
118
-			return array();
120
+		if ( isset($this->errors[$code]) ) {
121
+					return $this->errors[$code];
122
+		} else {
123
+					return array();
124
+		}
119 125
 	}
120 126
 
121 127
 	/**
@@ -130,11 +136,13 @@  discard block
 block discarded – undo
130 136
 	 * @return string
131 137
 	 */
132 138
 	public function get_error_message($code = '') {
133
-		if ( empty($code) )
134
-			$code = $this->get_error_code();
139
+		if ( empty($code) ) {
140
+					$code = $this->get_error_code();
141
+		}
135 142
 		$messages = $this->get_error_messages($code);
136
-		if ( empty($messages) )
137
-			return '';
143
+		if ( empty($messages) ) {
144
+					return '';
145
+		}
138 146
 		return $messages[0];
139 147
 	}
140 148
 
@@ -147,11 +155,13 @@  discard block
 block discarded – undo
147 155
 	 * @return mixed Error data, if it exists.
148 156
 	 */
149 157
 	public function get_error_data($code = '') {
150
-		if ( empty($code) )
151
-			$code = $this->get_error_code();
158
+		if ( empty($code) ) {
159
+					$code = $this->get_error_code();
160
+		}
152 161
 
153
-		if ( isset($this->error_data[$code]) )
154
-			return $this->error_data[$code];
162
+		if ( isset($this->error_data[$code]) ) {
163
+					return $this->error_data[$code];
164
+		}
155 165
 	}
156 166
 
157 167
 	/**
@@ -166,8 +176,9 @@  discard block
 block discarded – undo
166 176
 	 */
167 177
 	public function add($code, $message, $data = '') {
168 178
 		$this->errors[$code][] = $message;
169
-		if ( ! empty($data) )
170
-			$this->error_data[$code] = $data;
179
+		if ( ! empty($data) ) {
180
+					$this->error_data[$code] = $data;
181
+		}
171 182
 	}
172 183
 
173 184
 	/**
@@ -181,8 +192,9 @@  discard block
 block discarded – undo
181 192
 	 * @param string|int $code Error code.
182 193
 	 */
183 194
 	public function add_data($data, $code = '') {
184
-		if ( empty($code) )
185
-			$code = $this->get_error_code();
195
+		if ( empty($code) ) {
196
+					$code = $this->get_error_code();
197
+		}
186 198
 
187 199
 		$this->error_data[$code] = $data;
188 200
 	}
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -52,13 +52,13 @@  discard block
 block discarded – undo
52 52
 	 * @param string $message Error message
53 53
 	 * @param mixed $data Optional. Error data.
54 54
 	 */
55
-	public function __construct( $code = '', $message = '', $data = '' ) {
56
-		if ( empty($code) )
55
+	public function __construct($code = '', $message = '', $data = '') {
56
+		if (empty($code))
57 57
 			return;
58 58
 
59 59
 		$this->errors[$code][] = $message;
60 60
 
61
-		if ( ! empty($data) )
61
+		if ( ! empty($data))
62 62
 			$this->error_data[$code] = $data;
63 63
 	}
64 64
 
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	 * @return array List of error codes, if available.
72 72
 	 */
73 73
 	public function get_error_codes() {
74
-		if ( empty($this->errors) )
74
+		if (empty($this->errors))
75 75
 			return array();
76 76
 
77 77
 		return array_keys($this->errors);
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	public function get_error_code() {
89 89
 		$codes = $this->get_error_codes();
90 90
 
91
-		if ( empty($codes) )
91
+		if (empty($codes))
92 92
 			return '';
93 93
 
94 94
 		return $codes[0];
@@ -104,15 +104,15 @@  discard block
 block discarded – undo
104 104
 	 */
105 105
 	public function get_error_messages($code = '') {
106 106
 		// Return all messages if no code specified.
107
-		if ( empty($code) ) {
107
+		if (empty($code)) {
108 108
 			$all_messages = array();
109
-			foreach ( (array) $this->errors as $code => $messages )
109
+			foreach ((array) $this->errors as $code => $messages)
110 110
 				$all_messages = array_merge($all_messages, $messages);
111 111
 
112 112
 			return $all_messages;
113 113
 		}
114 114
 
115
-		if ( isset($this->errors[$code]) )
115
+		if (isset($this->errors[$code]))
116 116
 			return $this->errors[$code];
117 117
 		else
118 118
 			return array();
@@ -130,10 +130,10 @@  discard block
 block discarded – undo
130 130
 	 * @return string
131 131
 	 */
132 132
 	public function get_error_message($code = '') {
133
-		if ( empty($code) )
133
+		if (empty($code))
134 134
 			$code = $this->get_error_code();
135 135
 		$messages = $this->get_error_messages($code);
136
-		if ( empty($messages) )
136
+		if (empty($messages))
137 137
 			return '';
138 138
 		return $messages[0];
139 139
 	}
@@ -147,10 +147,10 @@  discard block
 block discarded – undo
147 147
 	 * @return mixed Error data, if it exists.
148 148
 	 */
149 149
 	public function get_error_data($code = '') {
150
-		if ( empty($code) )
150
+		if (empty($code))
151 151
 			$code = $this->get_error_code();
152 152
 
153
-		if ( isset($this->error_data[$code]) )
153
+		if (isset($this->error_data[$code]))
154 154
 			return $this->error_data[$code];
155 155
 	}
156 156
 
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 	 */
167 167
 	public function add($code, $message, $data = '') {
168 168
 		$this->errors[$code][] = $message;
169
-		if ( ! empty($data) )
169
+		if ( ! empty($data))
170 170
 			$this->error_data[$code] = $data;
171 171
 	}
172 172
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	 * @param string|int $code Error code.
182 182
 	 */
183 183
 	public function add_data($data, $code = '') {
184
-		if ( empty($code) )
184
+		if (empty($code))
185 185
 			$code = $this->get_error_code();
186 186
 
187 187
 		$this->error_data[$code] = $data;
@@ -197,8 +197,8 @@  discard block
 block discarded – undo
197 197
 	 *
198 198
 	 * @param string|int $code Error code.
199 199
 	 */
200
-	public function remove( $code ) {
201
-		unset( $this->errors[ $code ] );
202
-		unset( $this->error_data[ $code ] );
200
+	public function remove($code) {
201
+		unset($this->errors[$code]);
202
+		unset($this->error_data[$code]);
203 203
 	}
204 204
 }
Please login to merge, or discard this patch.
src/wp-includes/class-wp-admin-bar.php 2 patches
Braces   +94 added lines, -64 removed lines patch added patch discarded remove patch
@@ -60,8 +60,9 @@  discard block
 block discarded – undo
60 60
 			$header_callback = $admin_bar_args[0]['callback'];
61 61
 		}
62 62
 
63
-		if ( empty($header_callback) )
64
-			$header_callback = '_admin_bar_bump_cb';
63
+		if ( empty($header_callback) ) {
64
+					$header_callback = '_admin_bar_bump_cb';
65
+		}
65 66
 
66 67
 		add_action('wp_head', $header_callback);
67 68
 
@@ -107,16 +108,19 @@  discard block
 block discarded – undo
107 108
 	 */
108 109
 	public function add_node( $args ) {
109 110
 		// Shim for old method signature: add_node( $parent_id, $menu_obj, $args )
110
-		if ( func_num_args() >= 3 && is_string( func_get_arg(0) ) )
111
-			$args = array_merge( array( 'parent' => func_get_arg(0) ), func_get_arg(2) );
111
+		if ( func_num_args() >= 3 && is_string( func_get_arg(0) ) ) {
112
+					$args = array_merge( array( 'parent' => func_get_arg(0) ), func_get_arg(2) );
113
+		}
112 114
 
113
-		if ( is_object( $args ) )
114
-			$args = get_object_vars( $args );
115
+		if ( is_object( $args ) ) {
116
+					$args = get_object_vars( $args );
117
+		}
115 118
 
116 119
 		// Ensure we have a valid title.
117 120
 		if ( empty( $args['id'] ) ) {
118
-			if ( empty( $args['title'] ) )
119
-				return;
121
+			if ( empty( $args['title'] ) ) {
122
+							return;
123
+			}
120 124
 
121 125
 			_doing_it_wrong( __METHOD__, __( 'The menu ID should not be empty.' ), '3.3' );
122 126
 			// Deprecated: Generate an ID from the title.
@@ -133,12 +137,14 @@  discard block
 block discarded – undo
133 137
 		);
134 138
 
135 139
 		// If the node already exists, keep any data that isn't provided.
136
-		if ( $maybe_defaults = $this->get_node( $args['id'] ) )
137
-			$defaults = get_object_vars( $maybe_defaults );
140
+		if ( $maybe_defaults = $this->get_node( $args['id'] ) ) {
141
+					$defaults = get_object_vars( $maybe_defaults );
142
+		}
138 143
 
139 144
 		// Do the same for 'meta' items.
140
-		if ( ! empty( $defaults['meta'] ) && ! empty( $args['meta'] ) )
141
-			$args['meta'] = wp_parse_args( $args['meta'], $defaults['meta'] );
145
+		if ( ! empty( $defaults['meta'] ) && ! empty( $args['meta'] ) ) {
146
+					$args['meta'] = wp_parse_args( $args['meta'], $defaults['meta'] );
147
+		}
142 148
 
143 149
 		$args = wp_parse_args( $args, $defaults );
144 150
 
@@ -170,8 +176,9 @@  discard block
 block discarded – undo
170 176
 	 * @return object Node.
171 177
 	 */
172 178
 	final public function get_node( $id ) {
173
-		if ( $node = $this->_get_node( $id ) )
174
-			return clone $node;
179
+		if ( $node = $this->_get_node( $id ) ) {
180
+					return clone $node;
181
+		}
175 182
 	}
176 183
 
177 184
 	/**
@@ -179,22 +186,26 @@  discard block
 block discarded – undo
179 186
 	 * @return object|void
180 187
 	 */
181 188
 	final protected function _get_node( $id ) {
182
-		if ( $this->bound )
183
-			return;
189
+		if ( $this->bound ) {
190
+					return;
191
+		}
184 192
 
185
-		if ( empty( $id ) )
186
-			$id = 'root';
193
+		if ( empty( $id ) ) {
194
+					$id = 'root';
195
+		}
187 196
 
188
-		if ( isset( $this->nodes[ $id ] ) )
189
-			return $this->nodes[ $id ];
197
+		if ( isset( $this->nodes[ $id ] ) ) {
198
+					return $this->nodes[ $id ];
199
+		}
190 200
 	}
191 201
 
192 202
 	/**
193 203
 	 * @return array|void
194 204
 	 */
195 205
 	final public function get_nodes() {
196
-		if ( ! $nodes = $this->_get_nodes() )
197
-			return;
206
+		if ( ! $nodes = $this->_get_nodes() ) {
207
+					return;
208
+		}
198 209
 
199 210
 		foreach ( $nodes as &$node ) {
200 211
 			$node = clone $node;
@@ -206,8 +217,9 @@  discard block
 block discarded – undo
206 217
 	 * @return array|void
207 218
 	 */
208 219
 	final protected function _get_nodes() {
209
-		if ( $this->bound )
210
-			return;
220
+		if ( $this->bound ) {
221
+					return;
222
+		}
211 223
 
212 224
 		return $this->nodes;
213 225
 	}
@@ -253,16 +265,18 @@  discard block
 block discarded – undo
253 265
 	 */
254 266
 	public function render() {
255 267
 		$root = $this->_bind();
256
-		if ( $root )
257
-			$this->_render( $root );
268
+		if ( $root ) {
269
+					$this->_render( $root );
270
+		}
258 271
 	}
259 272
 
260 273
 	/**
261 274
 	 * @return object|void
262 275
 	 */
263 276
 	final protected function _bind() {
264
-		if ( $this->bound )
265
-			return;
277
+		if ( $this->bound ) {
278
+					return;
279
+		}
266 280
 
267 281
 		// Add the root node.
268 282
 		// Clear it first, just in case. Don't mess with The Root.
@@ -279,13 +293,15 @@  discard block
 block discarded – undo
279 293
 			unset( $node->group );
280 294
 
281 295
 			// The Root wants your orphans. No lonely items allowed.
282
-			if ( ! $node->parent )
283
-				$node->parent = 'root';
296
+			if ( ! $node->parent ) {
297
+							$node->parent = 'root';
298
+			}
284 299
 		}
285 300
 
286 301
 		foreach ( $this->_get_nodes() as $node ) {
287
-			if ( 'root' == $node->id )
288
-				continue;
302
+			if ( 'root' == $node->id ) {
303
+							continue;
304
+			}
289 305
 
290 306
 			// Fetch the parent node. If it isn't registered, ignore the node.
291 307
 			if ( ! $parent = $this->_get_node( $node->parent ) ) {
@@ -296,10 +312,11 @@  discard block
 block discarded – undo
296 312
 			$group_class = ( $node->parent == 'root' ) ? 'ab-top-menu' : 'ab-submenu';
297 313
 
298 314
 			if ( $node->type == 'group' ) {
299
-				if ( empty( $node->meta['class'] ) )
300
-					$node->meta['class'] = $group_class;
301
-				else
302
-					$node->meta['class'] .= ' ' . $group_class;
315
+				if ( empty( $node->meta['class'] ) ) {
316
+									$node->meta['class'] = $group_class;
317
+				} else {
318
+									$node->meta['class'] .= ' ' . $group_class;
319
+				}
303 320
 			}
304 321
 
305 322
 			// Items in items aren't allowed. Wrap nested items in 'default' groups.
@@ -357,10 +374,11 @@  discard block
 block discarded – undo
357 374
 						$container->parent = $grandparent->id;
358 375
 
359 376
 						$index = array_search( $parent, $grandparent->children, true );
360
-						if ( $index === false )
361
-							$grandparent->children[] = $container;
362
-						else
363
-							array_splice( $grandparent->children, $index, 1, array( $container ) );
377
+						if ( $index === false ) {
378
+													$grandparent->children[] = $container;
379
+						} else {
380
+													array_splice( $grandparent->children, $index, 1, array( $container ) );
381
+						}
364 382
 					}
365 383
 
366 384
 					$parent->parent = $container->id;
@@ -393,12 +411,13 @@  discard block
 block discarded – undo
393 411
 		// We have to do this here since admin bar shows on the front end.
394 412
 		$class = 'nojq nojs';
395 413
 		if ( $is_IE ) {
396
-			if ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE 7' ) )
397
-				$class .= ' ie7';
398
-			elseif ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE 8' ) )
399
-				$class .= ' ie8';
400
-			elseif ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE 9' ) )
401
-				$class .= ' ie9';
414
+			if ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE 7' ) ) {
415
+							$class .= ' ie7';
416
+			} elseif ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE 8' ) ) {
417
+							$class .= ' ie8';
418
+			} elseif ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE 9' ) ) {
419
+							$class .= ' ie9';
420
+			}
402 421
 		} elseif ( wp_is_mobile() ) {
403 422
 			$class .= ' mobile';
404 423
 		}
@@ -425,8 +444,9 @@  discard block
 block discarded – undo
425 444
 	 * @param object $node
426 445
 	 */
427 446
 	final protected function _render_container( $node ) {
428
-		if ( $node->type != 'container' || empty( $node->children ) )
429
-			return;
447
+		if ( $node->type != 'container' || empty( $node->children ) ) {
448
+					return;
449
+		}
430 450
 
431 451
 		?><div id="<?php echo esc_attr( 'wp-admin-bar-' . $node->id ); ?>" class="ab-group-container"><?php
432 452
 			foreach ( $node->children as $group ) {
@@ -443,13 +463,15 @@  discard block
 block discarded – undo
443 463
 			$this->_render_container( $node );
444 464
 			return;
445 465
 		}
446
-		if ( $node->type != 'group' || empty( $node->children ) )
447
-			return;
466
+		if ( $node->type != 'group' || empty( $node->children ) ) {
467
+					return;
468
+		}
448 469
 
449
-		if ( ! empty( $node->meta['class'] ) )
450
-			$class = ' class="' . esc_attr( trim( $node->meta['class'] ) ) . '"';
451
-		else
452
-			$class = '';
470
+		if ( ! empty( $node->meta['class'] ) ) {
471
+					$class = ' class="' . esc_attr( trim( $node->meta['class'] ) ) . '"';
472
+		} else {
473
+					$class = '';
474
+		}
453 475
 
454 476
 		?><ul id="<?php echo esc_attr( 'wp-admin-bar-' . $node->id ); ?>"<?php echo $class; ?>><?php
455 477
 			foreach ( $node->children as $item ) {
@@ -462,8 +484,9 @@  discard block
 block discarded – undo
462 484
 	 * @param object $node
463 485
 	 */
464 486
 	final protected function _render_item( $node ) {
465
-		if ( $node->type != 'item' )
466
-			return;
487
+		if ( $node->type != 'item' ) {
488
+					return;
489
+		}
467 490
 
468 491
 		$is_parent = ! empty( $node->children );
469 492
 		$has_link  = ! empty( $node->href );
@@ -478,11 +501,13 @@  discard block
 block discarded – undo
478 501
 			$aria_attributes .= ' aria-haspopup="true"';
479 502
 		}
480 503
 
481
-		if ( ! empty( $node->meta['class'] ) )
482
-			$menuclass .= $node->meta['class'];
504
+		if ( ! empty( $node->meta['class'] ) ) {
505
+					$menuclass .= $node->meta['class'];
506
+		}
483 507
 
484
-		if ( $menuclass )
485
-			$menuclass = ' class="' . esc_attr( trim( $menuclass ) ) . '"';
508
+		if ( $menuclass ) {
509
+					$menuclass = ' class="' . esc_attr( trim( $menuclass ) ) . '"';
510
+		}
486 511
 
487 512
 		?>
488 513
 
@@ -502,8 +527,10 @@  discard block
 block discarded – undo
502 527
 					?> rel="<?php echo esc_attr( $node->meta['rel'] ); ?>"<?php
503 528
 				endif;
504 529
 				?>><?php
505
-			else:
530
+			else {
531
+				:
506 532
 				?><div class="ab-item ab-empty-item" <?php echo $aria_attributes;
533
+			}
507 534
 				if ( ! empty( $node->meta['title'] ) ) :
508 535
 					?> title="<?php echo esc_attr( $node->meta['title'] ); ?>"<?php
509 536
 				endif;
@@ -514,9 +541,11 @@  discard block
 block discarded – undo
514 541
 
515 542
 			if ( $has_link ) :
516 543
 				?></a><?php
517
-			else:
544
+			else {
545
+				:
518 546
 				?></div><?php
519 547
 			endif;
548
+			}
520 549
 
521 550
 			if ( $is_parent ) :
522 551
 				?><div class="ab-sub-wrapper"><?php
@@ -526,8 +555,9 @@  discard block
 block discarded – undo
526 555
 				?></div><?php
527 556
 			endif;
528 557
 
529
-			if ( ! empty( $node->meta['html'] ) )
530
-				echo $node->meta['html'];
558
+			if ( ! empty( $node->meta['html'] ) ) {
559
+							echo $node->meta['html'];
560
+			}
531 561
 
532 562
 			?>
533 563
 		</li><?php
Please login to merge, or discard this patch.
Spacing   +178 added lines, -178 removed lines patch added patch discarded remove patch
@@ -21,13 +21,13 @@  discard block
 block discarded – undo
21 21
 	 * @param string $name
22 22
 	 * @return string|array|void
23 23
 	 */
24
-	public function __get( $name ) {
25
-		switch ( $name ) {
24
+	public function __get($name) {
25
+		switch ($name) {
26 26
 			case 'proto' :
27 27
 				return is_ssl() ? 'https://' : 'http://';
28 28
 
29 29
 			case 'menu' :
30
-				_deprecated_argument( 'WP_Admin_Bar', '3.3.0', 'Modify admin bar nodes with WP_Admin_Bar::get_node(), WP_Admin_Bar::add_node(), and WP_Admin_Bar::remove_node(), not the <code>menu</code> property.' );
30
+				_deprecated_argument('WP_Admin_Bar', '3.3.0', 'Modify admin bar nodes with WP_Admin_Bar::get_node(), WP_Admin_Bar::add_node(), and WP_Admin_Bar::remove_node(), not the <code>menu</code> property.');
31 31
 				return array(); // Sorry, folks.
32 32
 		}
33 33
 	}
@@ -38,61 +38,61 @@  discard block
 block discarded – undo
38 38
 	public function initialize() {
39 39
 		$this->user = new stdClass;
40 40
 
41
-		if ( is_user_logged_in() ) {
41
+		if (is_user_logged_in()) {
42 42
 			/* Populate settings we need for the menu based on the current user. */
43
-			$this->user->blogs = get_blogs_of_user( get_current_user_id() );
44
-			if ( is_multisite() ) {
45
-				$this->user->active_blog = get_active_blog_for_user( get_current_user_id() );
46
-				$this->user->domain = empty( $this->user->active_blog ) ? user_admin_url() : trailingslashit( get_home_url( $this->user->active_blog->blog_id ) );
43
+			$this->user->blogs = get_blogs_of_user(get_current_user_id());
44
+			if (is_multisite()) {
45
+				$this->user->active_blog = get_active_blog_for_user(get_current_user_id());
46
+				$this->user->domain = empty($this->user->active_blog) ? user_admin_url() : trailingslashit(get_home_url($this->user->active_blog->blog_id));
47 47
 				$this->user->account_domain = $this->user->domain;
48 48
 			} else {
49 49
 				$this->user->active_blog = $this->user->blogs[get_current_blog_id()];
50
-				$this->user->domain = trailingslashit( home_url() );
50
+				$this->user->domain = trailingslashit(home_url());
51 51
 				$this->user->account_domain = $this->user->domain;
52 52
 			}
53 53
 		}
54 54
 
55
-		add_action( 'wp_head', 'wp_admin_bar_header' );
55
+		add_action('wp_head', 'wp_admin_bar_header');
56 56
 
57
-		add_action( 'admin_head', 'wp_admin_bar_header' );
57
+		add_action('admin_head', 'wp_admin_bar_header');
58 58
 
59
-		if ( current_theme_supports( 'admin-bar' ) ) {
59
+		if (current_theme_supports('admin-bar')) {
60 60
 			/**
61 61
 			 * To remove the default padding styles from WordPress for the Toolbar, use the following code:
62 62
 			 * add_theme_support( 'admin-bar', array( 'callback' => '__return_false' ) );
63 63
 			 */
64
-			$admin_bar_args = get_theme_support( 'admin-bar' );
64
+			$admin_bar_args = get_theme_support('admin-bar');
65 65
 			$header_callback = $admin_bar_args[0]['callback'];
66 66
 		}
67 67
 
68
-		if ( empty($header_callback) )
68
+		if (empty($header_callback))
69 69
 			$header_callback = '_admin_bar_bump_cb';
70 70
 
71 71
 		add_action('wp_head', $header_callback);
72 72
 
73
-		wp_enqueue_script( 'admin-bar' );
74
-		wp_enqueue_style( 'admin-bar' );
73
+		wp_enqueue_script('admin-bar');
74
+		wp_enqueue_style('admin-bar');
75 75
 
76 76
 		/**
77 77
 		 * Fires after WP_Admin_Bar is initialized.
78 78
 		 *
79 79
 		 * @since 3.1.0
80 80
 		 */
81
-		do_action( 'admin_bar_init' );
81
+		do_action('admin_bar_init');
82 82
 	}
83 83
 
84 84
 	/**
85 85
 	 * @param array $node
86 86
 	 */
87
-	public function add_menu( $node ) {
88
-		$this->add_node( $node );
87
+	public function add_menu($node) {
88
+		$this->add_node($node);
89 89
 	}
90 90
 
91 91
 	/**
92 92
 	 * @param string $id
93 93
 	 */
94
-	public function remove_menu( $id ) {
95
-		$this->remove_node( $id );
94
+	public function remove_menu($id) {
95
+		$this->remove_node($id);
96 96
 	}
97 97
 
98 98
 	/**
@@ -114,22 +114,22 @@  discard block
 block discarded – undo
114 114
 	 *                          'onclick', 'target', 'title', 'tabindex'. Default empty.
115 115
 	 * }
116 116
 	 */
117
-	public function add_node( $args ) {
117
+	public function add_node($args) {
118 118
 		// Shim for old method signature: add_node( $parent_id, $menu_obj, $args )
119
-		if ( func_num_args() >= 3 && is_string( func_get_arg(0) ) )
120
-			$args = array_merge( array( 'parent' => func_get_arg(0) ), func_get_arg(2) );
119
+		if (func_num_args() >= 3 && is_string(func_get_arg(0)))
120
+			$args = array_merge(array('parent' => func_get_arg(0)), func_get_arg(2));
121 121
 
122
-		if ( is_object( $args ) )
123
-			$args = get_object_vars( $args );
122
+		if (is_object($args))
123
+			$args = get_object_vars($args);
124 124
 
125 125
 		// Ensure we have a valid title.
126
-		if ( empty( $args['id'] ) ) {
127
-			if ( empty( $args['title'] ) )
126
+		if (empty($args['id'])) {
127
+			if (empty($args['title']))
128 128
 				return;
129 129
 
130
-			_doing_it_wrong( __METHOD__, __( 'The menu ID should not be empty.' ), '3.3.0' );
130
+			_doing_it_wrong(__METHOD__, __('The menu ID should not be empty.'), '3.3.0');
131 131
 			// Deprecated: Generate an ID from the title.
132
-			$args['id'] = esc_attr( sanitize_title( trim( $args['title'] ) ) );
132
+			$args['id'] = esc_attr(sanitize_title(trim($args['title'])));
133 133
 		}
134 134
 
135 135
 		$defaults = array(
@@ -142,34 +142,34 @@  discard block
 block discarded – undo
142 142
 		);
143 143
 
144 144
 		// If the node already exists, keep any data that isn't provided.
145
-		if ( $maybe_defaults = $this->get_node( $args['id'] ) )
146
-			$defaults = get_object_vars( $maybe_defaults );
145
+		if ($maybe_defaults = $this->get_node($args['id']))
146
+			$defaults = get_object_vars($maybe_defaults);
147 147
 
148 148
 		// Do the same for 'meta' items.
149
-		if ( ! empty( $defaults['meta'] ) && ! empty( $args['meta'] ) )
150
-			$args['meta'] = wp_parse_args( $args['meta'], $defaults['meta'] );
149
+		if ( ! empty($defaults['meta']) && ! empty($args['meta']))
150
+			$args['meta'] = wp_parse_args($args['meta'], $defaults['meta']);
151 151
 
152
-		$args = wp_parse_args( $args, $defaults );
152
+		$args = wp_parse_args($args, $defaults);
153 153
 
154 154
 		$back_compat_parents = array(
155
-			'my-account-with-avatar' => array( 'my-account', '3.3' ),
156
-			'my-blogs'               => array( 'my-sites',   '3.3' ),
155
+			'my-account-with-avatar' => array('my-account', '3.3'),
156
+			'my-blogs'               => array('my-sites', '3.3'),
157 157
 		);
158 158
 
159
-		if ( isset( $back_compat_parents[ $args['parent'] ] ) ) {
160
-			list( $new_parent, $version ) = $back_compat_parents[ $args['parent'] ];
161
-			_deprecated_argument( __METHOD__, $version, sprintf( 'Use <code>%s</code> as the parent for the <code>%s</code> admin bar node instead of <code>%s</code>.', $new_parent, $args['id'], $args['parent'] ) );
159
+		if (isset($back_compat_parents[$args['parent']])) {
160
+			list($new_parent, $version) = $back_compat_parents[$args['parent']];
161
+			_deprecated_argument(__METHOD__, $version, sprintf('Use <code>%s</code> as the parent for the <code>%s</code> admin bar node instead of <code>%s</code>.', $new_parent, $args['id'], $args['parent']));
162 162
 			$args['parent'] = $new_parent;
163 163
 		}
164 164
 
165
-		$this->_set_node( $args );
165
+		$this->_set_node($args);
166 166
 	}
167 167
 
168 168
 	/**
169 169
 	 * @param array $args
170 170
 	 */
171
-	final protected function _set_node( $args ) {
172
-		$this->nodes[ $args['id'] ] = (object) $args;
171
+	final protected function _set_node($args) {
172
+		$this->nodes[$args['id']] = (object) $args;
173 173
 	}
174 174
 
175 175
 	/**
@@ -178,8 +178,8 @@  discard block
 block discarded – undo
178 178
 	 * @param string $id
179 179
 	 * @return object Node.
180 180
 	 */
181
-	final public function get_node( $id ) {
182
-		if ( $node = $this->_get_node( $id ) )
181
+	final public function get_node($id) {
182
+		if ($node = $this->_get_node($id))
183 183
 			return clone $node;
184 184
 	}
185 185
 
@@ -187,25 +187,25 @@  discard block
 block discarded – undo
187 187
 	 * @param string $id
188 188
 	 * @return object|void
189 189
 	 */
190
-	final protected function _get_node( $id ) {
191
-		if ( $this->bound )
190
+	final protected function _get_node($id) {
191
+		if ($this->bound)
192 192
 			return;
193 193
 
194
-		if ( empty( $id ) )
194
+		if (empty($id))
195 195
 			$id = 'root';
196 196
 
197
-		if ( isset( $this->nodes[ $id ] ) )
198
-			return $this->nodes[ $id ];
197
+		if (isset($this->nodes[$id]))
198
+			return $this->nodes[$id];
199 199
 	}
200 200
 
201 201
 	/**
202 202
 	 * @return array|void
203 203
 	 */
204 204
 	final public function get_nodes() {
205
-		if ( ! $nodes = $this->_get_nodes() )
205
+		if ( ! $nodes = $this->_get_nodes())
206 206
 			return;
207 207
 
208
-		foreach ( $nodes as &$node ) {
208
+		foreach ($nodes as &$node) {
209 209
 			$node = clone $node;
210 210
 		}
211 211
 		return $nodes;
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 	 * @return array|void
216 216
 	 */
217 217
 	final protected function _get_nodes() {
218
-		if ( $this->bound )
218
+		if ($this->bound)
219 219
 			return;
220 220
 
221 221
 		return $this->nodes;
@@ -235,10 +235,10 @@  discard block
 block discarded – undo
235 235
 	 *                         'class', 'onclick', 'target', and 'title'.
236 236
 	 * }
237 237
 	 */
238
-	final public function add_group( $args ) {
238
+	final public function add_group($args) {
239 239
 		$args['group'] = true;
240 240
 
241
-		$this->add_node( $args );
241
+		$this->add_node($args);
242 242
 	}
243 243
 
244 244
 	/**
@@ -246,15 +246,15 @@  discard block
 block discarded – undo
246 246
 	 *
247 247
 	 * @param string $id The ID of the item.
248 248
 	 */
249
-	public function remove_node( $id ) {
250
-		$this->_unset_node( $id );
249
+	public function remove_node($id) {
250
+		$this->_unset_node($id);
251 251
 	}
252 252
 
253 253
 	/**
254 254
 	 * @param string $id
255 255
 	 */
256
-	final protected function _unset_node( $id ) {
257
-		unset( $this->nodes[ $id ] );
256
+	final protected function _unset_node($id) {
257
+		unset($this->nodes[$id]);
258 258
 	}
259 259
 
260 260
 	/**
@@ -262,66 +262,66 @@  discard block
 block discarded – undo
262 262
 	 */
263 263
 	public function render() {
264 264
 		$root = $this->_bind();
265
-		if ( $root )
266
-			$this->_render( $root );
265
+		if ($root)
266
+			$this->_render($root);
267 267
 	}
268 268
 
269 269
 	/**
270 270
 	 * @return object|void
271 271
 	 */
272 272
 	final protected function _bind() {
273
-		if ( $this->bound )
273
+		if ($this->bound)
274 274
 			return;
275 275
 
276 276
 		// Add the root node.
277 277
 		// Clear it first, just in case. Don't mess with The Root.
278
-		$this->remove_node( 'root' );
279
-		$this->add_node( array(
278
+		$this->remove_node('root');
279
+		$this->add_node(array(
280 280
 			'id'    => 'root',
281 281
 			'group' => false,
282
-		) );
282
+		));
283 283
 
284 284
 		// Normalize nodes: define internal 'children' and 'type' properties.
285
-		foreach ( $this->_get_nodes() as $node ) {
285
+		foreach ($this->_get_nodes() as $node) {
286 286
 			$node->children = array();
287
-			$node->type = ( $node->group ) ? 'group' : 'item';
288
-			unset( $node->group );
287
+			$node->type = ($node->group) ? 'group' : 'item';
288
+			unset($node->group);
289 289
 
290 290
 			// The Root wants your orphans. No lonely items allowed.
291
-			if ( ! $node->parent )
291
+			if ( ! $node->parent)
292 292
 				$node->parent = 'root';
293 293
 		}
294 294
 
295
-		foreach ( $this->_get_nodes() as $node ) {
296
-			if ( 'root' == $node->id )
295
+		foreach ($this->_get_nodes() as $node) {
296
+			if ('root' == $node->id)
297 297
 				continue;
298 298
 
299 299
 			// Fetch the parent node. If it isn't registered, ignore the node.
300
-			if ( ! $parent = $this->_get_node( $node->parent ) ) {
300
+			if ( ! $parent = $this->_get_node($node->parent)) {
301 301
 				continue;
302 302
 			}
303 303
 
304 304
 			// Generate the group class (we distinguish between top level and other level groups).
305
-			$group_class = ( $node->parent == 'root' ) ? 'ab-top-menu' : 'ab-submenu';
305
+			$group_class = ($node->parent == 'root') ? 'ab-top-menu' : 'ab-submenu';
306 306
 
307
-			if ( $node->type == 'group' ) {
308
-				if ( empty( $node->meta['class'] ) )
307
+			if ($node->type == 'group') {
308
+				if (empty($node->meta['class']))
309 309
 					$node->meta['class'] = $group_class;
310 310
 				else
311
-					$node->meta['class'] .= ' ' . $group_class;
311
+					$node->meta['class'] .= ' '.$group_class;
312 312
 			}
313 313
 
314 314
 			// Items in items aren't allowed. Wrap nested items in 'default' groups.
315
-			if ( $parent->type == 'item' && $node->type == 'item' ) {
316
-				$default_id = $parent->id . '-default';
317
-				$default    = $this->_get_node( $default_id );
315
+			if ($parent->type == 'item' && $node->type == 'item') {
316
+				$default_id = $parent->id.'-default';
317
+				$default    = $this->_get_node($default_id);
318 318
 
319 319
 				// The default group is added here to allow groups that are
320 320
 				// added before standard menu items to render first.
321
-				if ( ! $default ) {
321
+				if ( ! $default) {
322 322
 					// Use _set_node because add_node can be overloaded.
323 323
 					// Make sure to specify default settings for all properties.
324
-					$this->_set_node( array(
324
+					$this->_set_node(array(
325 325
 						'id'        => $default_id,
326 326
 						'parent'    => $parent->id,
327 327
 						'type'      => 'group',
@@ -331,45 +331,45 @@  discard block
 block discarded – undo
331 331
 						),
332 332
 						'title'     => false,
333 333
 						'href'      => false,
334
-					) );
335
-					$default = $this->_get_node( $default_id );
334
+					));
335
+					$default = $this->_get_node($default_id);
336 336
 					$parent->children[] = $default;
337 337
 				}
338 338
 				$parent = $default;
339 339
 
340 340
 			// Groups in groups aren't allowed. Add a special 'container' node.
341 341
 			// The container will invisibly wrap both groups.
342
-			} elseif ( $parent->type == 'group' && $node->type == 'group' ) {
343
-				$container_id = $parent->id . '-container';
344
-				$container    = $this->_get_node( $container_id );
342
+			} elseif ($parent->type == 'group' && $node->type == 'group') {
343
+				$container_id = $parent->id.'-container';
344
+				$container    = $this->_get_node($container_id);
345 345
 
346 346
 				// We need to create a container for this group, life is sad.
347
-				if ( ! $container ) {
347
+				if ( ! $container) {
348 348
 					// Use _set_node because add_node can be overloaded.
349 349
 					// Make sure to specify default settings for all properties.
350
-					$this->_set_node( array(
350
+					$this->_set_node(array(
351 351
 						'id'       => $container_id,
352 352
 						'type'     => 'container',
353
-						'children' => array( $parent ),
353
+						'children' => array($parent),
354 354
 						'parent'   => false,
355 355
 						'title'    => false,
356 356
 						'href'     => false,
357 357
 						'meta'     => array(),
358
-					) );
358
+					));
359 359
 
360
-					$container = $this->_get_node( $container_id );
360
+					$container = $this->_get_node($container_id);
361 361
 
362 362
 					// Link the container node if a grandparent node exists.
363
-					$grandparent = $this->_get_node( $parent->parent );
363
+					$grandparent = $this->_get_node($parent->parent);
364 364
 
365
-					if ( $grandparent ) {
365
+					if ($grandparent) {
366 366
 						$container->parent = $grandparent->id;
367 367
 
368
-						$index = array_search( $parent, $grandparent->children, true );
369
-						if ( $index === false )
368
+						$index = array_search($parent, $grandparent->children, true);
369
+						if ($index === false)
370 370
 							$grandparent->children[] = $container;
371 371
 						else
372
-							array_splice( $grandparent->children, $index, 1, array( $container ) );
372
+							array_splice($grandparent->children, $index, 1, array($container));
373 373
 					}
374 374
 
375 375
 					$parent->parent = $container->id;
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
 			$parent->children[] = $node;
386 386
 		}
387 387
 
388
-		$root = $this->_get_node( 'root' );
388
+		$root = $this->_get_node('root');
389 389
 		$this->bound = true;
390 390
 		return $root;
391 391
 	}
@@ -395,35 +395,35 @@  discard block
 block discarded – undo
395 395
 	 * @global bool $is_IE
396 396
 	 * @param object $root
397 397
 	 */
398
-	final protected function _render( $root ) {
398
+	final protected function _render($root) {
399 399
 		global $is_IE;
400 400
 
401 401
 		// Add browser classes.
402 402
 		// We have to do this here since admin bar shows on the front end.
403 403
 		$class = 'nojq nojs';
404
-		if ( $is_IE ) {
405
-			if ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE 7' ) )
404
+		if ($is_IE) {
405
+			if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 7'))
406 406
 				$class .= ' ie7';
407
-			elseif ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE 8' ) )
407
+			elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 8'))
408 408
 				$class .= ' ie8';
409
-			elseif ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE 9' ) )
409
+			elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 9'))
410 410
 				$class .= ' ie9';
411
-		} elseif ( wp_is_mobile() ) {
411
+		} elseif (wp_is_mobile()) {
412 412
 			$class .= ' mobile';
413 413
 		}
414 414
 
415 415
 		?>
416 416
 		<div id="wpadminbar" class="<?php echo $class; ?>">
417
-			<?php if ( ! is_admin() ) { ?>
418
-				<a class="screen-reader-shortcut" href="#wp-toolbar" tabindex="1"><?php _e( 'Skip to toolbar' ); ?></a>
417
+			<?php if ( ! is_admin()) { ?>
418
+				<a class="screen-reader-shortcut" href="#wp-toolbar" tabindex="1"><?php _e('Skip to toolbar'); ?></a>
419 419
 			<?php } ?>
420
-			<div class="quicklinks" id="wp-toolbar" role="navigation" aria-label="<?php esc_attr_e( 'Toolbar' ); ?>" tabindex="0">
421
-				<?php foreach ( $root->children as $group ) {
422
-					$this->_render_group( $group );
420
+			<div class="quicklinks" id="wp-toolbar" role="navigation" aria-label="<?php esc_attr_e('Toolbar'); ?>" tabindex="0">
421
+				<?php foreach ($root->children as $group) {
422
+					$this->_render_group($group);
423 423
 				} ?>
424 424
 			</div>
425
-			<?php if ( is_user_logged_in() ) : ?>
426
-			<a class="screen-reader-shortcut" href="<?php echo esc_url( wp_logout_url() ); ?>"><?php _e('Log Out'); ?></a>
425
+			<?php if (is_user_logged_in()) : ?>
426
+			<a class="screen-reader-shortcut" href="<?php echo esc_url(wp_logout_url()); ?>"><?php _e('Log Out'); ?></a>
427 427
 			<?php endif; ?>
428 428
 		</div>
429 429
 
@@ -433,13 +433,13 @@  discard block
 block discarded – undo
433 433
 	/**
434 434
 	 * @param object $node
435 435
 	 */
436
-	final protected function _render_container( $node ) {
437
-		if ( $node->type != 'container' || empty( $node->children ) )
436
+	final protected function _render_container($node) {
437
+		if ($node->type != 'container' || empty($node->children))
438 438
 			return;
439 439
 
440
-		?><div id="<?php echo esc_attr( 'wp-admin-bar-' . $node->id ); ?>" class="ab-group-container"><?php
441
-			foreach ( $node->children as $group ) {
442
-				$this->_render_group( $group );
440
+		?><div id="<?php echo esc_attr('wp-admin-bar-'.$node->id); ?>" class="ab-group-container"><?php
441
+			foreach ($node->children as $group) {
442
+				$this->_render_group($group);
443 443
 			}
444 444
 		?></div><?php
445 445
 	}
@@ -447,22 +447,22 @@  discard block
 block discarded – undo
447 447
 	/**
448 448
 	 * @param object $node
449 449
 	 */
450
-	final protected function _render_group( $node ) {
451
-		if ( $node->type == 'container' ) {
452
-			$this->_render_container( $node );
450
+	final protected function _render_group($node) {
451
+		if ($node->type == 'container') {
452
+			$this->_render_container($node);
453 453
 			return;
454 454
 		}
455
-		if ( $node->type != 'group' || empty( $node->children ) )
455
+		if ($node->type != 'group' || empty($node->children))
456 456
 			return;
457 457
 
458
-		if ( ! empty( $node->meta['class'] ) )
459
-			$class = ' class="' . esc_attr( trim( $node->meta['class'] ) ) . '"';
458
+		if ( ! empty($node->meta['class']))
459
+			$class = ' class="'.esc_attr(trim($node->meta['class'])).'"';
460 460
 		else
461 461
 			$class = '';
462 462
 
463
-		?><ul id="<?php echo esc_attr( 'wp-admin-bar-' . $node->id ); ?>"<?php echo $class; ?>><?php
464
-			foreach ( $node->children as $item ) {
465
-				$this->_render_item( $item );
463
+		?><ul id="<?php echo esc_attr('wp-admin-bar-'.$node->id); ?>"<?php echo $class; ?>><?php
464
+			foreach ($node->children as $item) {
465
+				$this->_render_item($item);
466 466
 			}
467 467
 		?></ul><?php
468 468
 	}
@@ -470,85 +470,85 @@  discard block
 block discarded – undo
470 470
 	/**
471 471
 	 * @param object $node
472 472
 	 */
473
-	final protected function _render_item( $node ) {
474
-		if ( $node->type != 'item' )
473
+	final protected function _render_item($node) {
474
+		if ($node->type != 'item')
475 475
 			return;
476 476
 
477
-		$is_parent = ! empty( $node->children );
478
-		$has_link  = ! empty( $node->href );
477
+		$is_parent = ! empty($node->children);
478
+		$has_link  = ! empty($node->href);
479 479
 
480 480
 		// Allow only numeric values, then casted to integers, and allow a tabindex value of `0` for a11y.
481
-		$tabindex = ( isset( $node->meta['tabindex'] ) && is_numeric( $node->meta['tabindex'] ) ) ? (int) $node->meta['tabindex'] : '';
482
-		$aria_attributes = ( '' !== $tabindex ) ? ' tabindex="' . $tabindex . '"' : '';
481
+		$tabindex = (isset($node->meta['tabindex']) && is_numeric($node->meta['tabindex'])) ? (int) $node->meta['tabindex'] : '';
482
+		$aria_attributes = ('' !== $tabindex) ? ' tabindex="'.$tabindex.'"' : '';
483 483
 
484 484
 		$menuclass = '';
485 485
 
486
-		if ( $is_parent ) {
486
+		if ($is_parent) {
487 487
 			$menuclass = 'menupop ';
488 488
 			$aria_attributes .= ' aria-haspopup="true"';
489 489
 		}
490 490
 
491
-		if ( ! empty( $node->meta['class'] ) )
491
+		if ( ! empty($node->meta['class']))
492 492
 			$menuclass .= $node->meta['class'];
493 493
 
494
-		if ( $menuclass )
495
-			$menuclass = ' class="' . esc_attr( trim( $menuclass ) ) . '"';
494
+		if ($menuclass)
495
+			$menuclass = ' class="'.esc_attr(trim($menuclass)).'"';
496 496
 
497 497
 		?>
498 498
 
499
-		<li id="<?php echo esc_attr( 'wp-admin-bar-' . $node->id ); ?>"<?php echo $menuclass; ?>><?php
500
-			if ( $has_link ):
501
-				?><a class="ab-item"<?php echo $aria_attributes; ?> href="<?php echo esc_url( $node->href ) ?>"<?php
502
-					if ( ! empty( $node->meta['onclick'] ) ) :
503
-						?> onclick="<?php echo esc_js( $node->meta['onclick'] ); ?>"<?php
499
+		<li id="<?php echo esc_attr('wp-admin-bar-'.$node->id); ?>"<?php echo $menuclass; ?>><?php
500
+			if ($has_link):
501
+				?><a class="ab-item"<?php echo $aria_attributes; ?> href="<?php echo esc_url($node->href) ?>"<?php
502
+					if ( ! empty($node->meta['onclick'])) :
503
+						?> onclick="<?php echo esc_js($node->meta['onclick']); ?>"<?php
504 504
 					endif;
505
-				if ( ! empty( $node->meta['target'] ) ) :
506
-					?> target="<?php echo esc_attr( $node->meta['target'] ); ?>"<?php
505
+				if ( ! empty($node->meta['target'])) :
506
+					?> target="<?php echo esc_attr($node->meta['target']); ?>"<?php
507 507
 				endif;
508
-				if ( ! empty( $node->meta['title'] ) ) :
509
-					?> title="<?php echo esc_attr( $node->meta['title'] ); ?>"<?php
508
+				if ( ! empty($node->meta['title'])) :
509
+					?> title="<?php echo esc_attr($node->meta['title']); ?>"<?php
510 510
 				endif;
511
-				if ( ! empty( $node->meta['rel'] ) ) :
512
-					?> rel="<?php echo esc_attr( $node->meta['rel'] ); ?>"<?php
511
+				if ( ! empty($node->meta['rel'])) :
512
+					?> rel="<?php echo esc_attr($node->meta['rel']); ?>"<?php
513 513
 				endif;
514
-				if ( ! empty( $node->meta['lang'] ) ) :
515
-					?> lang="<?php echo esc_attr( $node->meta['lang'] ); ?>"<?php
514
+				if ( ! empty($node->meta['lang'])) :
515
+					?> lang="<?php echo esc_attr($node->meta['lang']); ?>"<?php
516 516
 				endif;
517
-				if ( ! empty( $node->meta['dir'] ) ) :
518
-					?> dir="<?php echo esc_attr( $node->meta['dir'] ); ?>"<?php
517
+				if ( ! empty($node->meta['dir'])) :
518
+					?> dir="<?php echo esc_attr($node->meta['dir']); ?>"<?php
519 519
 				endif;
520 520
 				?>><?php
521 521
 			else:
522 522
 				?><div class="ab-item ab-empty-item"<?php echo $aria_attributes;
523
-				if ( ! empty( $node->meta['title'] ) ) :
524
-					?> title="<?php echo esc_attr( $node->meta['title'] ); ?>"<?php
523
+				if ( ! empty($node->meta['title'])) :
524
+					?> title="<?php echo esc_attr($node->meta['title']); ?>"<?php
525 525
 				endif;
526
-				if ( ! empty( $node->meta['lang'] ) ) :
527
-					?> lang="<?php echo esc_attr( $node->meta['lang'] ); ?>"<?php
526
+				if ( ! empty($node->meta['lang'])) :
527
+					?> lang="<?php echo esc_attr($node->meta['lang']); ?>"<?php
528 528
 				endif;
529
-				if ( ! empty( $node->meta['dir'] ) ) :
530
-					?> dir="<?php echo esc_attr( $node->meta['dir'] ); ?>"<?php
529
+				if ( ! empty($node->meta['dir'])) :
530
+					?> dir="<?php echo esc_attr($node->meta['dir']); ?>"<?php
531 531
 				endif;
532 532
 				?>><?php
533 533
 			endif;
534 534
 
535 535
 			echo $node->title;
536 536
 
537
-			if ( $has_link ) :
537
+			if ($has_link) :
538 538
 				?></a><?php
539 539
 			else:
540 540
 				?></div><?php
541 541
 			endif;
542 542
 
543
-			if ( $is_parent ) :
543
+			if ($is_parent) :
544 544
 				?><div class="ab-sub-wrapper"><?php
545
-					foreach ( $node->children as $group ) {
546
-						$this->_render_group( $group );
545
+					foreach ($node->children as $group) {
546
+						$this->_render_group($group);
547 547
 					}
548 548
 				?></div><?php
549 549
 			endif;
550 550
 
551
-			if ( ! empty( $node->meta['html'] ) )
551
+			if ( ! empty($node->meta['html']))
552 552
 				echo $node->meta['html'];
553 553
 
554 554
 			?>
@@ -559,9 +559,9 @@  discard block
 block discarded – undo
559 559
 	 * @param string $id    Unused.
560 560
 	 * @param object $node
561 561
 	 */
562
-	public function recursive_render( $id, $node ) {
563
-		_deprecated_function( __METHOD__, '3.3.0', 'WP_Admin_bar::render(), WP_Admin_Bar::_render_item()' );
564
-		$this->_render_item( $node );
562
+	public function recursive_render($id, $node) {
563
+		_deprecated_function(__METHOD__, '3.3.0', 'WP_Admin_bar::render(), WP_Admin_Bar::_render_item()');
564
+		$this->_render_item($node);
565 565
 	}
566 566
 
567 567
 	/**
@@ -569,32 +569,32 @@  discard block
 block discarded – undo
569 569
 	 */
570 570
 	public function add_menus() {
571 571
 		// User related, aligned right.
572
-		add_action( 'admin_bar_menu', 'wp_admin_bar_my_account_menu', 0 );
573
-		add_action( 'admin_bar_menu', 'wp_admin_bar_search_menu', 4 );
574
-		add_action( 'admin_bar_menu', 'wp_admin_bar_my_account_item', 7 );
572
+		add_action('admin_bar_menu', 'wp_admin_bar_my_account_menu', 0);
573
+		add_action('admin_bar_menu', 'wp_admin_bar_search_menu', 4);
574
+		add_action('admin_bar_menu', 'wp_admin_bar_my_account_item', 7);
575 575
 
576 576
 		// Site related.
577
-		add_action( 'admin_bar_menu', 'wp_admin_bar_sidebar_toggle', 0 );
578
-		add_action( 'admin_bar_menu', 'wp_admin_bar_wp_menu', 10 );
579
-		add_action( 'admin_bar_menu', 'wp_admin_bar_my_sites_menu', 20 );
580
-		add_action( 'admin_bar_menu', 'wp_admin_bar_site_menu', 30 );
581
-		add_action( 'admin_bar_menu', 'wp_admin_bar_customize_menu', 40 );
582
-		add_action( 'admin_bar_menu', 'wp_admin_bar_updates_menu', 50 );
577
+		add_action('admin_bar_menu', 'wp_admin_bar_sidebar_toggle', 0);
578
+		add_action('admin_bar_menu', 'wp_admin_bar_wp_menu', 10);
579
+		add_action('admin_bar_menu', 'wp_admin_bar_my_sites_menu', 20);
580
+		add_action('admin_bar_menu', 'wp_admin_bar_site_menu', 30);
581
+		add_action('admin_bar_menu', 'wp_admin_bar_customize_menu', 40);
582
+		add_action('admin_bar_menu', 'wp_admin_bar_updates_menu', 50);
583 583
 
584 584
 		// Content related.
585
-		if ( ! is_network_admin() && ! is_user_admin() ) {
586
-			add_action( 'admin_bar_menu', 'wp_admin_bar_comments_menu', 60 );
587
-			add_action( 'admin_bar_menu', 'wp_admin_bar_new_content_menu', 70 );
585
+		if ( ! is_network_admin() && ! is_user_admin()) {
586
+			add_action('admin_bar_menu', 'wp_admin_bar_comments_menu', 60);
587
+			add_action('admin_bar_menu', 'wp_admin_bar_new_content_menu', 70);
588 588
 		}
589
-		add_action( 'admin_bar_menu', 'wp_admin_bar_edit_menu', 80 );
589
+		add_action('admin_bar_menu', 'wp_admin_bar_edit_menu', 80);
590 590
 
591
-		add_action( 'admin_bar_menu', 'wp_admin_bar_add_secondary_groups', 200 );
591
+		add_action('admin_bar_menu', 'wp_admin_bar_add_secondary_groups', 200);
592 592
 
593 593
 		/**
594 594
 		 * Fires after menus are added to the menu bar.
595 595
 		 *
596 596
 		 * @since 3.1.0
597 597
 		 */
598
-		do_action( 'add_admin_bar_menus' );
598
+		do_action('add_admin_bar_menus');
599 599
 	}
600 600
 }
Please login to merge, or discard this patch.
src/wp-includes/bookmark.php 3 patches
Switch Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -354,24 +354,24 @@
 block discarded – undo
354 354
  */
355 355
 function sanitize_bookmark_field($field, $value, $bookmark_id, $context) {
356 356
 	switch ( $field ) {
357
-	case 'link_id' : // ints
358
-	case 'link_rating' :
359
-		$value = (int) $value;
360
-		break;
361
-	case 'link_category' : // array( ints )
362
-		$value = array_map('absint', (array) $value);
363
-		// We return here so that the categories aren't filtered.
364
-		// The 'link_category' filter is for the name of a link category, not an array of a link's link categories
365
-		return $value;
366
-
367
-	case 'link_visible' : // bool stored as Y|N
368
-		$value = preg_replace('/[^YNyn]/', '', $value);
369
-		break;
370
-	case 'link_target' : // "enum"
371
-		$targets = array('_top', '_blank');
372
-		if ( ! in_array($value, $targets) )
373
-			$value = '';
374
-		break;
357
+		case 'link_id' : // ints
358
+		case 'link_rating' :
359
+			$value = (int) $value;
360
+			break;
361
+		case 'link_category' : // array( ints )
362
+			$value = array_map('absint', (array) $value);
363
+			// We return here so that the categories aren't filtered.
364
+			// The 'link_category' filter is for the name of a link category, not an array of a link's link categories
365
+			return $value;
366
+
367
+		case 'link_visible' : // bool stored as Y|N
368
+			$value = preg_replace('/[^YNyn]/', '', $value);
369
+			break;
370
+		case 'link_target' : // "enum"
371
+			$targets = array('_top', '_blank');
372
+			if ( ! in_array($value, $targets) )
373
+				$value = '';
374
+			break;
375 375
 	}
376 376
 
377 377
 	if ( 'raw' == $context )
Please login to merge, or discard this patch.
Braces   +29 added lines, -20 removed lines patch added patch discarded remove patch
@@ -22,10 +22,11 @@  discard block
 block discarded – undo
22 22
 	global $wpdb;
23 23
 
24 24
 	if ( empty($bookmark) ) {
25
-		if ( isset($GLOBALS['link']) )
26
-			$_bookmark = & $GLOBALS['link'];
27
-		else
28
-			$_bookmark = null;
25
+		if ( isset($GLOBALS['link']) ) {
26
+					$_bookmark = & $GLOBALS['link'];
27
+		} else {
28
+					$_bookmark = null;
29
+		}
29 30
 	} elseif ( is_object($bookmark) ) {
30 31
 		wp_cache_add($bookmark->link_id, $bookmark, 'bookmark');
31 32
 		$_bookmark = $bookmark;
@@ -41,8 +42,9 @@  discard block
 block discarded – undo
41 42
 		}
42 43
 	}
43 44
 
44
-	if ( ! $_bookmark )
45
-		return $_bookmark;
45
+	if ( ! $_bookmark ) {
46
+			return $_bookmark;
47
+	}
46 48
 
47 49
 	$_bookmark = sanitize_bookmark($_bookmark, $filter);
48 50
 
@@ -71,14 +73,17 @@  discard block
 block discarded – undo
71 73
 	$bookmark = (int) $bookmark;
72 74
 	$bookmark = get_bookmark( $bookmark );
73 75
 
74
-	if ( is_wp_error($bookmark) )
75
-		return $bookmark;
76
+	if ( is_wp_error($bookmark) ) {
77
+			return $bookmark;
78
+	}
76 79
 
77
-	if ( !is_object($bookmark) )
78
-		return '';
80
+	if ( !is_object($bookmark) ) {
81
+			return '';
82
+	}
79 83
 
80
-	if ( !isset($bookmark->$field) )
81
-		return '';
84
+	if ( !isset($bookmark->$field) ) {
85
+			return '';
86
+	}
82 87
 
83 88
 	return sanitize_bookmark_field($field, $bookmark->$field, $bookmark->link_id, $context);
84 89
 }
@@ -317,11 +322,13 @@  discard block
 block discarded – undo
317 322
 
318 323
 	foreach ( $fields as $field ) {
319 324
 		if ( $do_object ) {
320
-			if ( isset($bookmark->$field) )
321
-				$bookmark->$field = sanitize_bookmark_field($field, $bookmark->$field, $link_id, $context);
325
+			if ( isset($bookmark->$field) ) {
326
+							$bookmark->$field = sanitize_bookmark_field($field, $bookmark->$field, $link_id, $context);
327
+			}
322 328
 		} else {
323
-			if ( isset($bookmark[$field]) )
324
-				$bookmark[$field] = sanitize_bookmark_field($field, $bookmark[$field], $link_id, $context);
329
+			if ( isset($bookmark[$field]) ) {
330
+							$bookmark[$field] = sanitize_bookmark_field($field, $bookmark[$field], $link_id, $context);
331
+			}
325 332
 		}
326 333
 	}
327 334
 
@@ -369,13 +376,15 @@  discard block
 block discarded – undo
369 376
 		break;
370 377
 	case 'link_target' : // "enum"
371 378
 		$targets = array('_top', '_blank');
372
-		if ( ! in_array($value, $targets) )
373
-			$value = '';
379
+		if ( ! in_array($value, $targets) ) {
380
+					$value = '';
381
+		}
374 382
 		break;
375 383
 	}
376 384
 
377
-	if ( 'raw' == $context )
378
-		return $value;
385
+	if ( 'raw' == $context ) {
386
+			return $value;
387
+	}
379 388
 
380 389
 	if ( 'edit' == $context ) {
381 390
 		/** This filter is documented in wp-includes/post.php */
Please login to merge, or discard this patch.
Spacing   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -22,36 +22,36 @@  discard block
 block discarded – undo
22 22
 function get_bookmark($bookmark, $output = OBJECT, $filter = 'raw') {
23 23
 	global $wpdb;
24 24
 
25
-	if ( empty($bookmark) ) {
26
-		if ( isset($GLOBALS['link']) )
25
+	if (empty($bookmark)) {
26
+		if (isset($GLOBALS['link']))
27 27
 			$_bookmark = & $GLOBALS['link'];
28 28
 		else
29 29
 			$_bookmark = null;
30
-	} elseif ( is_object($bookmark) ) {
30
+	} elseif (is_object($bookmark)) {
31 31
 		wp_cache_add($bookmark->link_id, $bookmark, 'bookmark');
32 32
 		$_bookmark = $bookmark;
33 33
 	} else {
34
-		if ( isset($GLOBALS['link']) && ($GLOBALS['link']->link_id == $bookmark) ) {
34
+		if (isset($GLOBALS['link']) && ($GLOBALS['link']->link_id == $bookmark)) {
35 35
 			$_bookmark = & $GLOBALS['link'];
36
-		} elseif ( ! $_bookmark = wp_cache_get($bookmark, 'bookmark') ) {
36
+		} elseif ( ! $_bookmark = wp_cache_get($bookmark, 'bookmark')) {
37 37
 			$_bookmark = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->links WHERE link_id = %d LIMIT 1", $bookmark));
38
-			if ( $_bookmark ) {
39
-				$_bookmark->link_category = array_unique( wp_get_object_terms( $_bookmark->link_id, 'link_category', array( 'fields' => 'ids' ) ) );
40
-				wp_cache_add( $_bookmark->link_id, $_bookmark, 'bookmark' );
38
+			if ($_bookmark) {
39
+				$_bookmark->link_category = array_unique(wp_get_object_terms($_bookmark->link_id, 'link_category', array('fields' => 'ids')));
40
+				wp_cache_add($_bookmark->link_id, $_bookmark, 'bookmark');
41 41
 			}
42 42
 		}
43 43
 	}
44 44
 
45
-	if ( ! $_bookmark )
45
+	if ( ! $_bookmark)
46 46
 		return $_bookmark;
47 47
 
48 48
 	$_bookmark = sanitize_bookmark($_bookmark, $filter);
49 49
 
50
-	if ( $output == OBJECT ) {
50
+	if ($output == OBJECT) {
51 51
 		return $_bookmark;
52
-	} elseif ( $output == ARRAY_A ) {
52
+	} elseif ($output == ARRAY_A) {
53 53
 		return get_object_vars($_bookmark);
54
-	} elseif ( $output == ARRAY_N ) {
54
+	} elseif ($output == ARRAY_N) {
55 55
 		return array_values(get_object_vars($_bookmark));
56 56
 	} else {
57 57
 		return $_bookmark;
@@ -68,17 +68,17 @@  discard block
 block discarded – undo
68 68
  * @param string $context Optional. The context of how the field will be used.
69 69
  * @return string|WP_Error
70 70
  */
71
-function get_bookmark_field( $field, $bookmark, $context = 'display' ) {
71
+function get_bookmark_field($field, $bookmark, $context = 'display') {
72 72
 	$bookmark = (int) $bookmark;
73
-	$bookmark = get_bookmark( $bookmark );
73
+	$bookmark = get_bookmark($bookmark);
74 74
 
75
-	if ( is_wp_error($bookmark) )
75
+	if (is_wp_error($bookmark))
76 76
 		return $bookmark;
77 77
 
78
-	if ( !is_object($bookmark) )
78
+	if ( ! is_object($bookmark))
79 79
 		return '';
80 80
 
81
-	if ( !isset($bookmark->$field) )
81
+	if ( ! isset($bookmark->$field))
82 82
 		return '';
83 83
 
84 84
 	return sanitize_bookmark_field($field, $bookmark->$field, $bookmark->link_id, $context);
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
  * }
116 116
  * @return array List of bookmark row objects.
117 117
  */
118
-function get_bookmarks( $args = '' ) {
118
+function get_bookmarks($args = '') {
119 119
 	global $wpdb;
120 120
 
121 121
 	$defaults = array(
@@ -126,13 +126,13 @@  discard block
 block discarded – undo
126 126
 		'exclude' => '', 'search' => ''
127 127
 	);
128 128
 
129
-	$r = wp_parse_args( $args, $defaults );
129
+	$r = wp_parse_args($args, $defaults);
130 130
 
131
-	$key = md5( serialize( $r ) );
131
+	$key = md5(serialize($r));
132 132
 	$cache = false;
133
-	if ( 'rand' !== $r['orderby'] && $cache = wp_cache_get( 'get_bookmarks', 'bookmark' ) ) {
134
-		if ( is_array( $cache ) && isset( $cache[ $key ] ) ) {
135
-			$bookmarks = $cache[ $key ];
133
+	if ('rand' !== $r['orderby'] && $cache = wp_cache_get('get_bookmarks', 'bookmark')) {
134
+		if (is_array($cache) && isset($cache[$key])) {
135
+			$bookmarks = $cache[$key];
136 136
 			/**
137 137
 			 * Filters the returned list of bookmarks.
138 138
 			 *
@@ -148,98 +148,98 @@  discard block
 block discarded – undo
148 148
 			 * @param array $bookmarks List of the cached bookmarks.
149 149
 			 * @param array $r         An array of bookmark query arguments.
150 150
 			 */
151
-			return apply_filters( 'get_bookmarks', $bookmarks, $r );
151
+			return apply_filters('get_bookmarks', $bookmarks, $r);
152 152
 		}
153 153
 	}
154 154
 
155
-	if ( ! is_array( $cache ) ) {
155
+	if ( ! is_array($cache)) {
156 156
 		$cache = array();
157 157
 	}
158 158
 
159 159
 	$inclusions = '';
160
-	if ( ! empty( $r['include'] ) ) {
161
-		$r['exclude'] = '';  //ignore exclude, category, and category_name params if using include
160
+	if ( ! empty($r['include'])) {
161
+		$r['exclude'] = ''; //ignore exclude, category, and category_name params if using include
162 162
 		$r['category'] = '';
163 163
 		$r['category_name'] = '';
164
-		$inclinks = preg_split( '/[\s,]+/', $r['include'] );
165
-		if ( count( $inclinks ) ) {
166
-			foreach ( $inclinks as $inclink ) {
167
-				if ( empty( $inclusions ) ) {
168
-					$inclusions = ' AND ( link_id = ' . intval( $inclink ) . ' ';
164
+		$inclinks = preg_split('/[\s,]+/', $r['include']);
165
+		if (count($inclinks)) {
166
+			foreach ($inclinks as $inclink) {
167
+				if (empty($inclusions)) {
168
+					$inclusions = ' AND ( link_id = '.intval($inclink).' ';
169 169
 				} else {
170
-					$inclusions .= ' OR link_id = ' . intval( $inclink ) . ' ';
170
+					$inclusions .= ' OR link_id = '.intval($inclink).' ';
171 171
 				}
172 172
 			}
173 173
 		}
174 174
 	}
175
-	if (! empty( $inclusions ) ) {
175
+	if ( ! empty($inclusions)) {
176 176
 		$inclusions .= ')';
177 177
 	}
178 178
 
179 179
 	$exclusions = '';
180
-	if ( ! empty( $r['exclude'] ) ) {
181
-		$exlinks = preg_split( '/[\s,]+/', $r['exclude'] );
182
-		if ( count( $exlinks ) ) {
183
-			foreach ( $exlinks as $exlink ) {
184
-				if ( empty( $exclusions ) ) {
185
-					$exclusions = ' AND ( link_id <> ' . intval( $exlink ) . ' ';
180
+	if ( ! empty($r['exclude'])) {
181
+		$exlinks = preg_split('/[\s,]+/', $r['exclude']);
182
+		if (count($exlinks)) {
183
+			foreach ($exlinks as $exlink) {
184
+				if (empty($exclusions)) {
185
+					$exclusions = ' AND ( link_id <> '.intval($exlink).' ';
186 186
 				} else {
187
-					$exclusions .= ' AND link_id <> ' . intval( $exlink ) . ' ';
187
+					$exclusions .= ' AND link_id <> '.intval($exlink).' ';
188 188
 				}
189 189
 			}
190 190
 		}
191 191
 	}
192
-	if ( ! empty( $exclusions ) ) {
192
+	if ( ! empty($exclusions)) {
193 193
 		$exclusions .= ')';
194 194
 	}
195 195
 
196
-	if ( ! empty( $r['category_name'] ) ) {
197
-		if ( $r['category'] = get_term_by('name', $r['category_name'], 'link_category') ) {
196
+	if ( ! empty($r['category_name'])) {
197
+		if ($r['category'] = get_term_by('name', $r['category_name'], 'link_category')) {
198 198
 			$r['category'] = $r['category']->term_id;
199 199
 		} else {
200
-			$cache[ $key ] = array();
201
-			wp_cache_set( 'get_bookmarks', $cache, 'bookmark' );
200
+			$cache[$key] = array();
201
+			wp_cache_set('get_bookmarks', $cache, 'bookmark');
202 202
 			/** This filter is documented in wp-includes/bookmark.php */
203
-			return apply_filters( 'get_bookmarks', array(), $r );
203
+			return apply_filters('get_bookmarks', array(), $r);
204 204
 		}
205 205
 	}
206 206
 
207 207
 	$search = '';
208
-	if ( ! empty( $r['search'] ) ) {
209
-		$like = '%' . $wpdb->esc_like( $r['search'] ) . '%';
210
-		$search = $wpdb->prepare(" AND ( (link_url LIKE %s) OR (link_name LIKE %s) OR (link_description LIKE %s) ) ", $like, $like, $like );
208
+	if ( ! empty($r['search'])) {
209
+		$like = '%'.$wpdb->esc_like($r['search']).'%';
210
+		$search = $wpdb->prepare(" AND ( (link_url LIKE %s) OR (link_name LIKE %s) OR (link_description LIKE %s) ) ", $like, $like, $like);
211 211
 	}
212 212
 
213 213
 	$category_query = '';
214 214
 	$join = '';
215
-	if ( ! empty( $r['category'] ) ) {
216
-		$incategories = preg_split( '/[\s,]+/', $r['category'] );
217
-		if ( count($incategories) ) {
218
-			foreach ( $incategories as $incat ) {
219
-				if ( empty( $category_query ) ) {
220
-					$category_query = ' AND ( tt.term_id = ' . intval( $incat ) . ' ';
215
+	if ( ! empty($r['category'])) {
216
+		$incategories = preg_split('/[\s,]+/', $r['category']);
217
+		if (count($incategories)) {
218
+			foreach ($incategories as $incat) {
219
+				if (empty($category_query)) {
220
+					$category_query = ' AND ( tt.term_id = '.intval($incat).' ';
221 221
 				} else {
222
-					$category_query .= ' OR tt.term_id = ' . intval( $incat ) . ' ';
222
+					$category_query .= ' OR tt.term_id = '.intval($incat).' ';
223 223
 				}
224 224
 			}
225 225
 		}
226 226
 	}
227
-	if ( ! empty( $category_query ) ) {
227
+	if ( ! empty($category_query)) {
228 228
 		$category_query .= ") AND taxonomy = 'link_category'";
229 229
 		$join = " INNER JOIN $wpdb->term_relationships AS tr ON ($wpdb->links.link_id = tr.object_id) INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_taxonomy_id = tr.term_taxonomy_id";
230 230
 	}
231 231
 
232
-	if ( $r['show_updated'] ) {
232
+	if ($r['show_updated']) {
233 233
 		$recently_updated_test = ", IF (DATE_ADD(link_updated, INTERVAL 120 MINUTE) >= NOW(), 1,0) as recently_updated ";
234 234
 	} else {
235 235
 		$recently_updated_test = '';
236 236
 	}
237 237
 
238
-	$get_updated = ( $r['show_updated'] ) ? ', UNIX_TIMESTAMP(link_updated) AS link_updated_f ' : '';
238
+	$get_updated = ($r['show_updated']) ? ', UNIX_TIMESTAMP(link_updated) AS link_updated_f ' : '';
239 239
 
240
-	$orderby = strtolower( $r['orderby'] );
240
+	$orderby = strtolower($r['orderby']);
241 241
 	$length = '';
242
-	switch ( $orderby ) {
242
+	switch ($orderby) {
243 243
 		case 'length':
244 244
 			$length = ", CHAR_LENGTH(link_name) AS length";
245 245
 			break;
@@ -251,49 +251,49 @@  discard block
 block discarded – undo
251 251
 			break;
252 252
 		default:
253 253
 			$orderparams = array();
254
-			$keys = array( 'link_id', 'link_name', 'link_url', 'link_visible', 'link_rating', 'link_owner', 'link_updated', 'link_notes', 'link_description' );
255
-			foreach ( explode( ',', $orderby ) as $ordparam ) {
256
-				$ordparam = trim( $ordparam );
254
+			$keys = array('link_id', 'link_name', 'link_url', 'link_visible', 'link_rating', 'link_owner', 'link_updated', 'link_notes', 'link_description');
255
+			foreach (explode(',', $orderby) as $ordparam) {
256
+				$ordparam = trim($ordparam);
257 257
 
258
-				if ( in_array( 'link_' . $ordparam, $keys ) ) {
259
-					$orderparams[] = 'link_' . $ordparam;
260
-				} elseif ( in_array( $ordparam, $keys ) ) {
258
+				if (in_array('link_'.$ordparam, $keys)) {
259
+					$orderparams[] = 'link_'.$ordparam;
260
+				} elseif (in_array($ordparam, $keys)) {
261 261
 					$orderparams[] = $ordparam;
262 262
 				}
263 263
 			}
264
-			$orderby = implode( ',', $orderparams );
264
+			$orderby = implode(',', $orderparams);
265 265
 	}
266 266
 
267
-	if ( empty( $orderby ) ) {
267
+	if (empty($orderby)) {
268 268
 		$orderby = 'link_name';
269 269
 	}
270 270
 
271
-	$order = strtoupper( $r['order'] );
272
-	if ( '' !== $order && ! in_array( $order, array( 'ASC', 'DESC' ) ) ) {
271
+	$order = strtoupper($r['order']);
272
+	if ('' !== $order && ! in_array($order, array('ASC', 'DESC'))) {
273 273
 		$order = 'ASC';
274 274
 	}
275 275
 
276 276
 	$visible = '';
277
-	if ( $r['hide_invisible'] ) {
277
+	if ($r['hide_invisible']) {
278 278
 		$visible = "AND link_visible = 'Y'";
279 279
 	}
280 280
 
281 281
 	$query = "SELECT * $length $recently_updated_test $get_updated FROM $wpdb->links $join WHERE 1=1 $visible $category_query";
282 282
 	$query .= " $exclusions $inclusions $search";
283 283
 	$query .= " ORDER BY $orderby $order";
284
-	if ( $r['limit'] != -1 ) {
285
-		$query .= ' LIMIT ' . $r['limit'];
284
+	if ($r['limit'] != -1) {
285
+		$query .= ' LIMIT '.$r['limit'];
286 286
 	}
287 287
 
288
-	$results = $wpdb->get_results( $query );
288
+	$results = $wpdb->get_results($query);
289 289
 
290
-	if ( 'rand()' !== $orderby ) {
291
-		$cache[ $key ] = $results;
292
-		wp_cache_set( 'get_bookmarks', $cache, 'bookmark' );
290
+	if ('rand()' !== $orderby) {
291
+		$cache[$key] = $results;
292
+		wp_cache_set('get_bookmarks', $cache, 'bookmark');
293 293
 	}
294 294
 
295 295
 	/** This filter is documented in wp-includes/bookmark.php */
296
-	return apply_filters( 'get_bookmarks', $results, $r );
296
+	return apply_filters('get_bookmarks', $results, $r);
297 297
 }
298 298
 
299 299
 /**
@@ -309,9 +309,9 @@  discard block
 block discarded – undo
309 309
 function sanitize_bookmark($bookmark, $context = 'display') {
310 310
 	$fields = array('link_id', 'link_url', 'link_name', 'link_image', 'link_target', 'link_category',
311 311
 		'link_description', 'link_visible', 'link_owner', 'link_rating', 'link_updated',
312
-		'link_rel', 'link_notes', 'link_rss', );
312
+		'link_rel', 'link_notes', 'link_rss',);
313 313
 
314
-	if ( is_object($bookmark) ) {
314
+	if (is_object($bookmark)) {
315 315
 		$do_object = true;
316 316
 		$link_id = $bookmark->link_id;
317 317
 	} else {
@@ -319,12 +319,12 @@  discard block
 block discarded – undo
319 319
 		$link_id = $bookmark['link_id'];
320 320
 	}
321 321
 
322
-	foreach ( $fields as $field ) {
323
-		if ( $do_object ) {
324
-			if ( isset($bookmark->$field) )
322
+	foreach ($fields as $field) {
323
+		if ($do_object) {
324
+			if (isset($bookmark->$field))
325 325
 				$bookmark->$field = sanitize_bookmark_field($field, $bookmark->$field, $link_id, $context);
326 326
 		} else {
327
-			if ( isset($bookmark[$field]) )
327
+			if (isset($bookmark[$field]))
328 328
 				$bookmark[$field] = sanitize_bookmark_field($field, $bookmark[$field], $link_id, $context);
329 329
 		}
330 330
 	}
@@ -356,8 +356,8 @@  discard block
 block discarded – undo
356 356
  *                            'js', 'db', or 'display'
357 357
  * @return mixed The filtered value.
358 358
  */
359
-function sanitize_bookmark_field( $field, $value, $bookmark_id, $context ) {
360
-	switch ( $field ) {
359
+function sanitize_bookmark_field($field, $value, $bookmark_id, $context) {
360
+	switch ($field) {
361 361
 	case 'link_id' : // ints
362 362
 	case 'link_rating' :
363 363
 		$value = (int) $value;
@@ -373,34 +373,34 @@  discard block
 block discarded – undo
373 373
 		break;
374 374
 	case 'link_target' : // "enum"
375 375
 		$targets = array('_top', '_blank');
376
-		if ( ! in_array($value, $targets) )
376
+		if ( ! in_array($value, $targets))
377 377
 			$value = '';
378 378
 		break;
379 379
 	}
380 380
 
381
-	if ( 'raw' == $context )
381
+	if ('raw' == $context)
382 382
 		return $value;
383 383
 
384
-	if ( 'edit' == $context ) {
384
+	if ('edit' == $context) {
385 385
 		/** This filter is documented in wp-includes/post.php */
386
-		$value = apply_filters( "edit_{$field}", $value, $bookmark_id );
386
+		$value = apply_filters("edit_{$field}", $value, $bookmark_id);
387 387
 
388
-		if ( 'link_notes' == $field ) {
389
-			$value = esc_html( $value ); // textarea_escaped
388
+		if ('link_notes' == $field) {
389
+			$value = esc_html($value); // textarea_escaped
390 390
 		} else {
391 391
 			$value = esc_attr($value);
392 392
 		}
393
-	} elseif ( 'db' == $context ) {
393
+	} elseif ('db' == $context) {
394 394
 		/** This filter is documented in wp-includes/post.php */
395
-		$value = apply_filters( "pre_{$field}", $value );
395
+		$value = apply_filters("pre_{$field}", $value);
396 396
 	} else {
397 397
 		/** This filter is documented in wp-includes/post.php */
398
-		$value = apply_filters( "{$field}", $value, $bookmark_id, $context );
398
+		$value = apply_filters("{$field}", $value, $bookmark_id, $context);
399 399
 
400
-		if ( 'attribute' == $context ) {
401
-			$value = esc_attr( $value );
402
-		} elseif ( 'js' == $context ) {
403
-			$value = esc_js( $value );
400
+		if ('attribute' == $context) {
401
+			$value = esc_attr($value);
402
+		} elseif ('js' == $context) {
403
+			$value = esc_js($value);
404 404
 		}
405 405
 	}
406 406
 
@@ -414,8 +414,8 @@  discard block
 block discarded – undo
414 414
  *
415 415
  * @param int $bookmark_id Bookmark ID.
416 416
  */
417
-function clean_bookmark_cache( $bookmark_id ) {
418
-	wp_cache_delete( $bookmark_id, 'bookmark' );
419
-	wp_cache_delete( 'get_bookmarks', 'bookmark' );
420
-	clean_object_term_cache( $bookmark_id, 'link');
417
+function clean_bookmark_cache($bookmark_id) {
418
+	wp_cache_delete($bookmark_id, 'bookmark');
419
+	wp_cache_delete('get_bookmarks', 'bookmark');
420
+	clean_object_term_cache($bookmark_id, 'link');
421 421
 }
Please login to merge, or discard this patch.