Completed
Push — master ( a7cd2a...eabd6c )
by Stephen
38:42
created
src/wp-admin/ms-users.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Multisite users administration panel.
4
- *
5
- * @package WordPress
6
- * @subpackage Multisite
7
- * @since 3.0.0
8
- */
3
+	 * Multisite users administration panel.
4
+	 *
5
+	 * @package WordPress
6
+	 * @subpackage Multisite
7
+	 * @since 3.0.0
8
+	 */
9 9
 
10 10
 require_once( dirname( __FILE__ ) . '/admin.php' );
11 11
 
Please login to merge, or discard this 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 4 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * WordPress Post Thumbnail Template Functions.
4
- *
5
- * Support for post thumbnails.
6
- * Theme's functions.php must call add_theme_support( 'post-thumbnails' ) to use these.
7
- *
8
- * @package WordPress
9
- * @subpackage Template
10
- */
3
+	 * WordPress Post Thumbnail Template Functions.
4
+	 *
5
+	 * Support for post thumbnails.
6
+	 * Theme's functions.php must call add_theme_support( 'post-thumbnails' ) to use these.
7
+	 *
8
+	 * @package WordPress
9
+	 * @subpackage Template
10
+	 */
11 11
 
12 12
 /**
13 13
  * Check if post has an image attached.
Please login to merge, or discard this patch.
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   +34 added lines, -34 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
 	 * Filter 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,9 +204,9 @@  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
 }
Please login to merge, or discard this patch.
src/wp-includes/version.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * The WordPress version string
4
- *
5
- * @global string $wp_version
6
- */
3
+	 * The WordPress version string
4
+	 *
5
+	 * @global string $wp_version
6
+	 */
7 7
 $wp_version = '4.4-alpha-33636-src';
8 8
 
9 9
 /**
Please login to merge, or discard this patch.
src/wp-includes/vars.php 3 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.
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,19 +1,19 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Creates common globals for the rest of WordPress
4
- *
5
- * Sets $pagenow global which is the current page. Checks
6
- * for the browser to set which one is currently being used.
7
- *
8
- * Detects which user environment WordPress is being used on.
9
- * Only attempts to check for Apache, Nginx and IIS -- three web
10
- * servers with known pretty permalink capability.
11
- *
12
- * Note: Though Nginx is detected, WordPress does not currently
13
- * generate rewrite rules for it. See https://codex.wordpress.org/Nginx
14
- *
15
- * @package WordPress
16
- */
3
+	 * Creates common globals for the rest of WordPress
4
+	 *
5
+	 * Sets $pagenow global which is the current page. Checks
6
+	 * for the browser to set which one is currently being used.
7
+	 *
8
+	 * Detects which user environment WordPress is being used on.
9
+	 * Only attempts to check for Apache, Nginx and IIS -- three web
10
+	 * servers with known pretty permalink capability.
11
+	 *
12
+	 * Note: Though Nginx is detected, WordPress does not currently
13
+	 * generate rewrite rules for it. See https://codex.wordpress.org/Nginx
14
+	 *
15
+	 * @package WordPress
16
+	 */
17 17
 
18 18
 global $pagenow,
19 19
 	$is_lynx, $is_gecko, $is_winIE, $is_macIE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone, $is_IE, $is_edge,
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/functions.wp-styles.php 3 patches
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
  */
20 20
 function wp_styles() {
21 21
 	global $wp_styles;
22
-	if ( ! ( $wp_styles instanceof WP_Styles ) ) {
22
+	if ( ! ($wp_styles instanceof WP_Styles)) {
23 23
 		$wp_styles = new WP_Styles();
24 24
 	}
25 25
 	return $wp_styles;
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
  * @param string|bool|array $handles Styles to be printed. Default 'false'.
40 40
  * @return array On success, a processed array of WP_Dependencies items; otherwise, an empty array.
41 41
  */
42
-function wp_print_styles( $handles = false ) {
43
-	if ( '' === $handles ) { // for wp_head
42
+function wp_print_styles($handles = false) {
43
+	if ('' === $handles) { // for wp_head
44 44
 		$handles = false;
45 45
 	}
46 46
 	/**
@@ -48,20 +48,20 @@  discard block
 block discarded – undo
48 48
 	 *
49 49
 	 * @since 2.6.0
50 50
 	 */
51
-	if ( ! $handles ) {
52
-		do_action( 'wp_print_styles' );
51
+	if ( ! $handles) {
52
+		do_action('wp_print_styles');
53 53
 	}
54 54
 
55
-	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
55
+	_wp_scripts_maybe_doing_it_wrong(__FUNCTION__);
56 56
 
57 57
 	global $wp_styles;
58
-	if ( ! ( $wp_styles instanceof WP_Styles ) ) {
59
-		if ( ! $handles ) {
58
+	if ( ! ($wp_styles instanceof WP_Styles)) {
59
+		if ( ! $handles) {
60 60
 			return array(); // No need to instantiate if nothing is there.
61 61
 		}
62 62
 	}
63 63
 
64
-	return wp_styles()->do_items( $handles );
64
+	return wp_styles()->do_items($handles);
65 65
 }
66 66
 
67 67
 /**
@@ -80,15 +80,15 @@  discard block
 block discarded – undo
80 80
  * @param string $data   String containing the CSS styles to be added.
81 81
  * @return bool True on success, false on failure.
82 82
  */
83
-function wp_add_inline_style( $handle, $data ) {
84
-	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
83
+function wp_add_inline_style($handle, $data) {
84
+	_wp_scripts_maybe_doing_it_wrong(__FUNCTION__);
85 85
 
86
-	if ( false !== stripos( $data, '</style>' ) ) {
87
-		_doing_it_wrong( __FUNCTION__, __( 'Do not pass style tags to wp_add_inline_style().' ), '3.7' );
88
-		$data = trim( preg_replace( '#<style[^>]*>(.*)</style>#is', '$1', $data ) );
86
+	if (false !== stripos($data, '</style>')) {
87
+		_doing_it_wrong(__FUNCTION__, __('Do not pass style tags to wp_add_inline_style().'), '3.7');
88
+		$data = trim(preg_replace('#<style[^>]*>(.*)</style>#is', '$1', $data));
89 89
 	}
90 90
 
91
-	return wp_styles()->add_inline_style( $handle, $data );
91
+	return wp_styles()->add_inline_style($handle, $data);
92 92
 }
93 93
 
94 94
 /**
@@ -110,10 +110,10 @@  discard block
 block discarded – undo
110 110
  *                            'screen', 'tty', or 'tv'.
111 111
  * @return bool Whether the style has been registered. True on success, false on failure.
112 112
  */
113
-function wp_register_style( $handle, $src, $deps = array(), $ver = false, $media = 'all' ) {
114
-	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
113
+function wp_register_style($handle, $src, $deps = array(), $ver = false, $media = 'all') {
114
+	_wp_scripts_maybe_doing_it_wrong(__FUNCTION__);
115 115
 
116
-	return wp_styles()->add( $handle, $src, $deps, $ver, $media );
116
+	return wp_styles()->add($handle, $src, $deps, $ver, $media);
117 117
 }
118 118
 
119 119
 /**
@@ -125,10 +125,10 @@  discard block
 block discarded – undo
125 125
  *
126 126
  * @param string $handle Name of the stylesheet to be removed.
127 127
  */
128
-function wp_deregister_style( $handle ) {
129
-	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
128
+function wp_deregister_style($handle) {
129
+	_wp_scripts_maybe_doing_it_wrong(__FUNCTION__);
130 130
 
131
-	wp_styles()->remove( $handle );
131
+	wp_styles()->remove($handle);
132 132
 }
133 133
 
134 134
 /**
@@ -151,16 +151,16 @@  discard block
 block discarded – undo
151 151
  *                            Default 'all'. Accepts 'all', 'aural', 'braille', 'handheld', 'projection', 'print',
152 152
  *                            'screen', 'tty', or 'tv'.
153 153
  */
154
-function wp_enqueue_style( $handle, $src = false, $deps = array(), $ver = false, $media = 'all' ) {
155
-	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
154
+function wp_enqueue_style($handle, $src = false, $deps = array(), $ver = false, $media = 'all') {
155
+	_wp_scripts_maybe_doing_it_wrong(__FUNCTION__);
156 156
 
157 157
 	$wp_styles = wp_styles();
158 158
 
159
-	if ( $src ) {
159
+	if ($src) {
160 160
 		$_handle = explode('?', $handle);
161
-		$wp_styles->add( $_handle[0], $src, $deps, $ver, $media );
161
+		$wp_styles->add($_handle[0], $src, $deps, $ver, $media);
162 162
 	}
163
-	$wp_styles->enqueue( $handle );
163
+	$wp_styles->enqueue($handle);
164 164
 }
165 165
 
166 166
 /**
@@ -172,10 +172,10 @@  discard block
 block discarded – undo
172 172
  *
173 173
  * @param string $handle Name of the stylesheet to be removed.
174 174
  */
175
-function wp_dequeue_style( $handle ) {
176
-	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
175
+function wp_dequeue_style($handle) {
176
+	_wp_scripts_maybe_doing_it_wrong(__FUNCTION__);
177 177
 
178
-	wp_styles()->dequeue( $handle );
178
+	wp_styles()->dequeue($handle);
179 179
 }
180 180
 
181 181
 /**
@@ -188,10 +188,10 @@  discard block
 block discarded – undo
188 188
  *                       Accepts 'enqueued', 'registered', 'queue', 'to_do', and 'done'.
189 189
  * @return bool Whether style is queued.
190 190
  */
191
-function wp_style_is( $handle, $list = 'enqueued' ) {
192
-	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
191
+function wp_style_is($handle, $list = 'enqueued') {
192
+	_wp_scripts_maybe_doing_it_wrong(__FUNCTION__);
193 193
 
194
-	return (bool) wp_styles()->query( $handle, $list );
194
+	return (bool) wp_styles()->query($handle, $list);
195 195
 }
196 196
 
197 197
 /**
@@ -216,6 +216,6 @@  discard block
 block discarded – undo
216 216
  * @param mixed  $value  String containing the CSS data to be added.
217 217
  * @return bool True on success, false on failure.
218 218
  */
219
-function wp_style_add_data( $handle, $key, $value ) {
220
-	return wp_styles()->add_data( $handle, $key, $value );
219
+function wp_style_add_data($handle, $key, $value) {
220
+	return wp_styles()->add_data($handle, $key, $value);
221 221
 }
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
  *
37 37
  * @since 2.6.0
38 38
  *
39
- * @param string|bool|array $handles Styles to be printed. Default 'false'.
39
+ * @param string $handles Styles to be printed. Default 'false'.
40 40
  * @return array On success, a processed array of WP_Dependencies items; otherwise, an empty array.
41 41
  */
42 42
 function wp_print_styles( $handles = false ) {
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
  * @param string           $handle Name of the stylesheet. Should be unique.
148 148
  * @param string           $src    Full URL of the stylesheet, or path of the stylesheet relative to the WordPress root directory.
149 149
  * @param array            $deps   Optional. An array of registered stylesheet handles this stylesheet depends on. Default empty array.
150
- * @param string|bool|null $ver    Optional. String specifying stylesheet version number, if it has one, which is added to the URL
150
+ * @param string|null $ver    Optional. String specifying stylesheet version number, if it has one, which is added to the URL
151 151
  *                                 as a query string for cache busting purposes. If version is set to false, a version
152 152
  *                                 number is automatically added equal to current installed WordPress version.
153 153
  *                                 If set to null, no version is added.
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
  * @param string $handle Name of the stylesheet.
218 218
  * @param string $key    Name of data point for which we're storing a value.
219 219
  *                       Accepts 'conditional', 'rtl' and 'suffix', 'alt' and 'title'.
220
- * @param mixed  $value  String containing the CSS data to be added.
220
+ * @param string  $value  String containing the CSS data to be added.
221 221
  * @return bool True on success, false on failure.
222 222
  */
223 223
 function wp_style_add_data( $handle, $key, $value ) {
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Dependencies API: Styles functions
4
- *
5
- * @since 2.6.0
6
- *
7
- * @package WordPress
8
- * @subpackage Dependencies
9
- */
3
+	 * Dependencies API: Styles functions
4
+	 *
5
+	 * @since 2.6.0
6
+	 *
7
+	 * @package WordPress
8
+	 * @subpackage Dependencies
9
+	 */
10 10
 
11 11
 /**
12 12
  * Initialize $wp_styles if it has not been set.
Please login to merge, or discard this patch.
src/wp-includes/class-wp-http-ixr-client.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * WP_HTTP_IXR_Client
4
- *
5
- * @package WordPress
6
- * @since 3.1.0
7
- *
8
- */
3
+	 * WP_HTTP_IXR_Client
4
+	 *
5
+	 * @package WordPress
6
+	 * @since 3.1.0
7
+	 *
8
+	 */
9 9
 class WP_HTTP_IXR_Client extends IXR_Client {
10 10
 	public $scheme;
11 11
 	/**
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -20,21 +20,21 @@  discard block
 block discarded – undo
20 20
 	 * @param int $timeout
21 21
 	 */
22 22
 	public function __construct($server, $path = false, $port = false, $timeout = 15) {
23
-		if ( ! $path ) {
23
+		if ( ! $path) {
24 24
 			// Assume we have been given a URL instead
25 25
 			$bits = parse_url($server);
26 26
 			$this->scheme = $bits['scheme'];
27 27
 			$this->server = $bits['host'];
28 28
 			$this->port = isset($bits['port']) ? $bits['port'] : $port;
29
-			$this->path = !empty($bits['path']) ? $bits['path'] : '/';
29
+			$this->path = ! empty($bits['path']) ? $bits['path'] : '/';
30 30
 
31 31
 			// Make absolutely sure we have a path
32
-			if ( ! $this->path ) {
32
+			if ( ! $this->path) {
33 33
 				$this->path = '/';
34 34
 			}
35 35
 
36
-			if ( ! empty( $bits['query'] ) ) {
37
-				$this->path .= '?' . $bits['query'];
36
+			if ( ! empty($bits['query'])) {
37
+				$this->path .= '?'.$bits['query'];
38 38
 			}
39 39
 		} else {
40 40
 			$this->scheme = 'http';
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 		$xml = $request->getXml();
57 57
 
58 58
 		$port = $this->port ? ":$this->port" : '';
59
-		$url = $this->scheme . '://' . $this->server . $port . $this->path;
59
+		$url = $this->scheme.'://'.$this->server.$port.$this->path;
60 60
 		$args = array(
61 61
 			'headers'    => array('Content-Type' => 'text/xml'),
62 62
 			'user-agent' => $this->useragent,
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 		);
65 65
 
66 66
 		// Merge Custom headers ala #8145
67
-		foreach ( $this->headers as $header => $value ) {
67
+		foreach ($this->headers as $header => $value) {
68 68
 			$args['headers'][$header] = $value;
69 69
 		}
70 70
 
@@ -75,45 +75,45 @@  discard block
 block discarded – undo
75 75
 		 *
76 76
 		 * @param array $headers Array of headers to be sent.
77 77
 		 */
78
-		$args['headers'] = apply_filters( 'wp_http_ixr_client_headers', $args['headers'] );
78
+		$args['headers'] = apply_filters('wp_http_ixr_client_headers', $args['headers']);
79 79
 
80
-		if ( $this->timeout !== false ) {
80
+		if ($this->timeout !== false) {
81 81
 			$args['timeout'] = $this->timeout;
82 82
 		}
83 83
 
84 84
 		// Now send the request
85
-		if ( $this->debug ) {
86
-			echo '<pre class="ixr_request">' . htmlspecialchars($xml) . "\n</pre>\n\n";
85
+		if ($this->debug) {
86
+			echo '<pre class="ixr_request">'.htmlspecialchars($xml)."\n</pre>\n\n";
87 87
 		}
88 88
 
89 89
 		$response = wp_remote_post($url, $args);
90 90
 
91
-		if ( is_wp_error($response) ) {
91
+		if (is_wp_error($response)) {
92 92
 			$errno    = $response->get_error_code();
93 93
 			$errorstr = $response->get_error_message();
94 94
 			$this->error = new IXR_Error(-32300, "transport error: $errno $errorstr");
95 95
 			return false;
96 96
 		}
97 97
 
98
-		if ( 200 != wp_remote_retrieve_response_code( $response ) ) {
99
-			$this->error = new IXR_Error(-32301, 'transport error - HTTP status code was not 200 (' . wp_remote_retrieve_response_code( $response ) . ')');
98
+		if (200 != wp_remote_retrieve_response_code($response)) {
99
+			$this->error = new IXR_Error(-32301, 'transport error - HTTP status code was not 200 ('.wp_remote_retrieve_response_code($response).')');
100 100
 			return false;
101 101
 		}
102 102
 
103
-		if ( $this->debug ) {
104
-			echo '<pre class="ixr_response">' . htmlspecialchars( wp_remote_retrieve_body( $response ) ) . "\n</pre>\n\n";
103
+		if ($this->debug) {
104
+			echo '<pre class="ixr_response">'.htmlspecialchars(wp_remote_retrieve_body($response))."\n</pre>\n\n";
105 105
 		}
106 106
 
107 107
 		// Now parse what we've got back
108
-		$this->message = new IXR_Message( wp_remote_retrieve_body( $response ) );
109
-		if ( ! $this->message->parse() ) {
108
+		$this->message = new IXR_Message(wp_remote_retrieve_body($response));
109
+		if ( ! $this->message->parse()) {
110 110
 			// XML error
111 111
 			$this->error = new IXR_Error(-32700, 'parse error. not well formed');
112 112
 			return false;
113 113
 		}
114 114
 
115 115
 		// Is the message a fault?
116
-		if ( $this->message->messageType == 'fault' ) {
116
+		if ($this->message->messageType == 'fault') {
117 117
 			$this->error = new IXR_Error($this->message->faultCode, $this->message->faultString);
118 118
 			return false;
119 119
 		}
Please login to merge, or discard this patch.
src/wp-includes/ms-functions.php 4 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Multisite WordPress API
4
- *
5
- * @package WordPress
6
- * @subpackage Multisite
7
- * @since 3.0.0
8
- */
3
+	 * Multisite WordPress API
4
+	 *
5
+	 * @package WordPress
6
+	 * @subpackage Multisite
7
+	 * @since 3.0.0
8
+	 */
9 9
 
10 10
 /**
11 11
  * Gets the network's site and user counts.
@@ -1552,7 +1552,7 @@  discard block
 block discarded – undo
1552 1552
 	$current_site = get_current_site();
1553 1553
 
1554 1554
 	/**
1555
- 	 * Filter whether to bypass the welcome email after user activation.
1555
+	 * Filter whether to bypass the welcome email after user activation.
1556 1556
 	 *
1557 1557
 	 * Returning false disables the welcome email.
1558 1558
 	 *
@@ -2063,7 +2063,7 @@  discard block
 block discarded – undo
2063 2063
  * @return bool
2064 2064
  */
2065 2065
 function is_user_spammy( $user = null ) {
2066
-    if ( ! ( $user instanceof WP_User ) ) {
2066
+	if ( ! ( $user instanceof WP_User ) ) {
2067 2067
 		if ( $user ) {
2068 2068
 			$user = get_user_by( 'login', $user );
2069 2069
 		} else {
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1861,7 +1861,7 @@  discard block
 block discarded – undo
1861 1861
  * @since MU
1862 1862
  *
1863 1863
  * @param array|string $deprecated Not used.
1864
- * @return array The current site's domain
1864
+ * @return string[] The current site's domain
1865 1865
  */
1866 1866
 function redirect_this_site( $deprecated = '' ) {
1867 1867
 	return array( get_current_site()->domain );
@@ -2139,7 +2139,7 @@  discard block
 block discarded – undo
2139 2139
  *
2140 2140
  * @staticvar bool $forced_content
2141 2141
  *
2142
- * @param bool $force
2142
+ * @param string|boolean $force
2143 2143
  * @return bool True if forced, false if not forced.
2144 2144
  */
2145 2145
 function force_ssl_content( $force = '' ) {
Please login to merge, or discard this patch.
Spacing   +511 added lines, -511 removed lines patch added patch discarded remove patch
@@ -39,45 +39,45 @@  discard block
 block discarded – undo
39 39
  * @param int $user_id The unique ID of the user
40 40
  * @return WP_Site|void The blog object
41 41
  */
42
-function get_active_blog_for_user( $user_id ) {
42
+function get_active_blog_for_user($user_id) {
43 43
 	global $wpdb;
44
-	$blogs = get_blogs_of_user( $user_id );
45
-	if ( empty( $blogs ) )
44
+	$blogs = get_blogs_of_user($user_id);
45
+	if (empty($blogs))
46 46
 		return;
47 47
 
48
-	if ( !is_multisite() )
48
+	if ( ! is_multisite())
49 49
 		return $blogs[$wpdb->blogid];
50 50
 
51
-	$primary_blog = get_user_meta( $user_id, 'primary_blog', true );
51
+	$primary_blog = get_user_meta($user_id, 'primary_blog', true);
52 52
 	$first_blog = current($blogs);
53
-	if ( false !== $primary_blog ) {
54
-		if ( ! isset( $blogs[ $primary_blog ] ) ) {
55
-			update_user_meta( $user_id, 'primary_blog', $first_blog->userblog_id );
56
-			$primary = get_blog_details( $first_blog->userblog_id );
53
+	if (false !== $primary_blog) {
54
+		if ( ! isset($blogs[$primary_blog])) {
55
+			update_user_meta($user_id, 'primary_blog', $first_blog->userblog_id);
56
+			$primary = get_blog_details($first_blog->userblog_id);
57 57
 		} else {
58
-			$primary = get_blog_details( $primary_blog );
58
+			$primary = get_blog_details($primary_blog);
59 59
 		}
60 60
 	} else {
61 61
 		//TODO Review this call to add_user_to_blog too - to get here the user must have a role on this blog?
62
-		add_user_to_blog( $first_blog->userblog_id, $user_id, 'subscriber' );
63
-		update_user_meta( $user_id, 'primary_blog', $first_blog->userblog_id );
62
+		add_user_to_blog($first_blog->userblog_id, $user_id, 'subscriber');
63
+		update_user_meta($user_id, 'primary_blog', $first_blog->userblog_id);
64 64
 		$primary = $first_blog;
65 65
 	}
66 66
 
67
-	if ( ( ! is_object( $primary ) ) || ( $primary->archived == 1 || $primary->spam == 1 || $primary->deleted == 1 ) ) {
68
-		$blogs = get_blogs_of_user( $user_id, true ); // if a user's primary blog is shut down, check their other blogs.
67
+	if (( ! is_object($primary)) || ($primary->archived == 1 || $primary->spam == 1 || $primary->deleted == 1)) {
68
+		$blogs = get_blogs_of_user($user_id, true); // if a user's primary blog is shut down, check their other blogs.
69 69
 		$ret = false;
70
-		if ( is_array( $blogs ) && count( $blogs ) > 0 ) {
71
-			foreach ( (array) $blogs as $blog_id => $blog ) {
72
-				if ( $blog->site_id != $wpdb->siteid )
70
+		if (is_array($blogs) && count($blogs) > 0) {
71
+			foreach ((array) $blogs as $blog_id => $blog) {
72
+				if ($blog->site_id != $wpdb->siteid)
73 73
 					continue;
74
-				$details = get_blog_details( $blog_id );
75
-				if ( is_object( $details ) && $details->archived == 0 && $details->spam == 0 && $details->deleted == 0 ) {
74
+				$details = get_blog_details($blog_id);
75
+				if (is_object($details) && $details->archived == 0 && $details->spam == 0 && $details->deleted == 0) {
76 76
 					$ret = $blog;
77
-					if ( get_user_meta( $user_id , 'primary_blog', true ) != $blog_id )
78
-						update_user_meta( $user_id, 'primary_blog', $blog_id );
79
-					if ( !get_user_meta($user_id , 'source_domain', true) )
80
-						update_user_meta( $user_id, 'source_domain', $blog->domain );
77
+					if (get_user_meta($user_id, 'primary_blog', true) != $blog_id)
78
+						update_user_meta($user_id, 'primary_blog', $blog_id);
79
+					if ( ! get_user_meta($user_id, 'source_domain', true))
80
+						update_user_meta($user_id, 'source_domain', $blog->domain);
81 81
 					break;
82 82
 				}
83 83
 			}
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
  * @return int
101 101
  */
102 102
 function get_user_count() {
103
-	return get_site_option( 'user_count' );
103
+	return get_site_option('user_count');
104 104
 }
105 105
 
106 106
 /**
@@ -113,11 +113,11 @@  discard block
 block discarded – undo
113 113
  * @param int $network_id Deprecated, not supported.
114 114
  * @return int
115 115
  */
116
-function get_blog_count( $network_id = 0 ) {
117
-	if ( func_num_args() )
118
-		_deprecated_argument( __FUNCTION__, '3.1' );
116
+function get_blog_count($network_id = 0) {
117
+	if (func_num_args())
118
+		_deprecated_argument(__FUNCTION__, '3.1');
119 119
 
120
-	return get_site_option( 'blog_count' );
120
+	return get_site_option('blog_count');
121 121
 }
122 122
 
123 123
 /**
@@ -129,9 +129,9 @@  discard block
 block discarded – undo
129 129
  * @param int $post_id ID of the post you're looking for.
130 130
  * @return WP_Post|null WP_Post on success or null on failure
131 131
  */
132
-function get_blog_post( $blog_id, $post_id ) {
133
-	switch_to_blog( $blog_id );
134
-	$post = get_post( $post_id );
132
+function get_blog_post($blog_id, $post_id) {
133
+	switch_to_blog($blog_id);
134
+	$post = get_post($post_id);
135 135
 	restore_current_blog();
136 136
 
137 137
 	return $post;
@@ -150,17 +150,17 @@  discard block
 block discarded – undo
150 150
  * @param string $role    The role you want the user to have
151 151
  * @return true|WP_Error
152 152
  */
153
-function add_user_to_blog( $blog_id, $user_id, $role ) {
153
+function add_user_to_blog($blog_id, $user_id, $role) {
154 154
 	switch_to_blog($blog_id);
155 155
 
156
-	$user = get_userdata( $user_id );
156
+	$user = get_userdata($user_id);
157 157
 
158
-	if ( ! $user ) {
158
+	if ( ! $user) {
159 159
 		restore_current_blog();
160
-		return new WP_Error( 'user_does_not_exist', __( 'The requested user does not exist.' ) );
160
+		return new WP_Error('user_does_not_exist', __('The requested user does not exist.'));
161 161
 	}
162 162
 
163
-	if ( !get_user_meta($user_id, 'primary_blog', true) ) {
163
+	if ( ! get_user_meta($user_id, 'primary_blog', true)) {
164 164
 		update_user_meta($user_id, 'primary_blog', $blog_id);
165 165
 		$details = get_blog_details($blog_id);
166 166
 		update_user_meta($user_id, 'source_domain', $details->domain);
@@ -177,9 +177,9 @@  discard block
 block discarded – undo
177 177
 	 * @param string $role    User role.
178 178
 	 * @param int    $blog_id Blog ID.
179 179
 	 */
180
-	do_action( 'add_user_to_blog', $user_id, $role, $blog_id );
181
-	wp_cache_delete( $user_id, 'users' );
182
-	wp_cache_delete( $blog_id . '_user_count', 'blog-details' );
180
+	do_action('add_user_to_blog', $user_id, $role, $blog_id);
181
+	wp_cache_delete($user_id, 'users');
182
+	wp_cache_delete($blog_id.'_user_count', 'blog-details');
183 183
 	restore_current_blog();
184 184
 	return true;
185 185
 }
@@ -214,17 +214,17 @@  discard block
 block discarded – undo
214 214
 	 * @param int $user_id User ID.
215 215
 	 * @param int $blog_id Blog ID.
216 216
 	 */
217
-	do_action( 'remove_user_from_blog', $user_id, $blog_id );
217
+	do_action('remove_user_from_blog', $user_id, $blog_id);
218 218
 
219 219
 	// If being removed from the primary blog, set a new primary if the user is assigned
220 220
 	// to multiple blogs.
221 221
 	$primary_blog = get_user_meta($user_id, 'primary_blog', true);
222
-	if ( $primary_blog == $blog_id ) {
222
+	if ($primary_blog == $blog_id) {
223 223
 		$new_id = '';
224 224
 		$new_domain = '';
225 225
 		$blogs = get_blogs_of_user($user_id);
226
-		foreach ( (array) $blogs as $blog ) {
227
-			if ( $blog->userblog_id == $blog_id )
226
+		foreach ((array) $blogs as $blog) {
227
+			if ($blog->userblog_id == $blog_id)
228 228
 				continue;
229 229
 			$new_id = $blog->userblog_id;
230 230
 			$new_domain = $blog->domain;
@@ -236,8 +236,8 @@  discard block
 block discarded – undo
236 236
 	}
237 237
 
238 238
 	// wp_revoke_user($user_id);
239
-	$user = get_userdata( $user_id );
240
-	if ( ! $user ) {
239
+	$user = get_userdata($user_id);
240
+	if ( ! $user) {
241 241
 		restore_current_blog();
242 242
 		return new WP_Error('user_does_not_exist', __('That user does not exist.'));
243 243
 	}
@@ -245,24 +245,24 @@  discard block
 block discarded – undo
245 245
 	$user->remove_all_caps();
246 246
 
247 247
 	$blogs = get_blogs_of_user($user_id);
248
-	if ( count($blogs) == 0 ) {
248
+	if (count($blogs) == 0) {
249 249
 		update_user_meta($user_id, 'primary_blog', '');
250 250
 		update_user_meta($user_id, 'source_domain', '');
251 251
 	}
252 252
 
253
-	if ( $reassign != '' ) {
253
+	if ($reassign != '') {
254 254
 		$reassign = (int) $reassign;
255
-		$post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_author = %d", $user_id ) );
256
-		$link_ids = $wpdb->get_col( $wpdb->prepare( "SELECT link_id FROM $wpdb->links WHERE link_owner = %d", $user_id ) );
255
+		$post_ids = $wpdb->get_col($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_author = %d", $user_id));
256
+		$link_ids = $wpdb->get_col($wpdb->prepare("SELECT link_id FROM $wpdb->links WHERE link_owner = %d", $user_id));
257 257
 
258
-		if ( ! empty( $post_ids ) ) {
259
-			$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_author = %d WHERE post_author = %d", $reassign, $user_id ) );
260
-			array_walk( $post_ids, 'clean_post_cache' );
258
+		if ( ! empty($post_ids)) {
259
+			$wpdb->query($wpdb->prepare("UPDATE $wpdb->posts SET post_author = %d WHERE post_author = %d", $reassign, $user_id));
260
+			array_walk($post_ids, 'clean_post_cache');
261 261
 		}
262 262
 
263
-		if ( ! empty( $link_ids ) ) {
264
-			$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->links SET link_owner = %d WHERE link_owner = %d", $reassign, $user_id ) );
265
-			array_walk( $link_ids, 'clean_bookmark_cache' );
263
+		if ( ! empty($link_ids)) {
264
+			$wpdb->query($wpdb->prepare("UPDATE $wpdb->links SET link_owner = %d WHERE link_owner = %d", $reassign, $user_id));
265
+			array_walk($link_ids, 'clean_bookmark_cache');
266 266
 		}
267 267
 	}
268 268
 
@@ -280,9 +280,9 @@  discard block
 block discarded – undo
280 280
  * @param int $post_id ID of the desired post.
281 281
  * @return string The post's permalink
282 282
  */
283
-function get_blog_permalink( $blog_id, $post_id ) {
284
-	switch_to_blog( $blog_id );
285
-	$link = get_permalink( $post_id );
283
+function get_blog_permalink($blog_id, $post_id) {
284
+	switch_to_blog($blog_id);
285
+	$link = get_permalink($post_id);
286 286
 	restore_current_blog();
287 287
 
288 288
 	return $link;
@@ -304,26 +304,26 @@  discard block
 block discarded – undo
304 304
  * @param string $path   Optional. Not required for subdomain installations.
305 305
  * @return int 0 if no blog found, otherwise the ID of the matching blog
306 306
  */
307
-function get_blog_id_from_url( $domain, $path = '/' ) {
307
+function get_blog_id_from_url($domain, $path = '/') {
308 308
 	global $wpdb;
309 309
 
310
-	$domain = strtolower( $domain );
311
-	$path = strtolower( $path );
312
-	$id = wp_cache_get( md5( $domain . $path ), 'blog-id-cache' );
310
+	$domain = strtolower($domain);
311
+	$path = strtolower($path);
312
+	$id = wp_cache_get(md5($domain.$path), 'blog-id-cache');
313 313
 
314
-	if ( $id == -1 ) // blog does not exist
314
+	if ($id == -1) // blog does not exist
315 315
 		return 0;
316
-	elseif ( $id )
316
+	elseif ($id)
317 317
 		return (int) $id;
318 318
 
319
-	$id = $wpdb->get_var( $wpdb->prepare( "SELECT blog_id FROM $wpdb->blogs WHERE domain = %s and path = %s /* get_blog_id_from_url */", $domain, $path ) );
319
+	$id = $wpdb->get_var($wpdb->prepare("SELECT blog_id FROM $wpdb->blogs WHERE domain = %s and path = %s /* get_blog_id_from_url */", $domain, $path));
320 320
 
321
-	if ( ! $id ) {
322
-		wp_cache_set( md5( $domain . $path ), -1, 'blog-id-cache' );
321
+	if ( ! $id) {
322
+		wp_cache_set(md5($domain.$path), -1, 'blog-id-cache');
323 323
 		return 0;
324 324
 	}
325 325
 
326
-	wp_cache_set( md5( $domain . $path ), $id, 'blog-id-cache' );
326
+	wp_cache_set(md5($domain.$path), $id, 'blog-id-cache');
327 327
 
328 328
 	return $id;
329 329
 }
@@ -343,30 +343,30 @@  discard block
 block discarded – undo
343 343
  * @param string $user_email The email provided by the user at registration.
344 344
  * @return bool Returns true when the email address is banned.
345 345
  */
346
-function is_email_address_unsafe( $user_email ) {
347
-	$banned_names = get_site_option( 'banned_email_domains' );
348
-	if ( $banned_names && ! is_array( $banned_names ) )
349
-		$banned_names = explode( "\n", $banned_names );
346
+function is_email_address_unsafe($user_email) {
347
+	$banned_names = get_site_option('banned_email_domains');
348
+	if ($banned_names && ! is_array($banned_names))
349
+		$banned_names = explode("\n", $banned_names);
350 350
 
351 351
 	$is_email_address_unsafe = false;
352 352
 
353
-	if ( $banned_names && is_array( $banned_names ) ) {
354
-		$banned_names = array_map( 'strtolower', $banned_names );
355
-		$normalized_email = strtolower( $user_email );
353
+	if ($banned_names && is_array($banned_names)) {
354
+		$banned_names = array_map('strtolower', $banned_names);
355
+		$normalized_email = strtolower($user_email);
356 356
 
357
-		list( $email_local_part, $email_domain ) = explode( '@', $normalized_email );
357
+		list($email_local_part, $email_domain) = explode('@', $normalized_email);
358 358
 
359
-		foreach ( $banned_names as $banned_domain ) {
360
-			if ( ! $banned_domain )
359
+		foreach ($banned_names as $banned_domain) {
360
+			if ( ! $banned_domain)
361 361
 				continue;
362 362
 
363
-			if ( $email_domain == $banned_domain ) {
363
+			if ($email_domain == $banned_domain) {
364 364
 				$is_email_address_unsafe = true;
365 365
 				break;
366 366
 			}
367 367
 
368 368
 			$dotted_domain = ".$banned_domain";
369
-			if ( $dotted_domain === substr( $normalized_email, -strlen( $dotted_domain ) ) ) {
369
+			if ($dotted_domain === substr($normalized_email, -strlen($dotted_domain))) {
370 370
 				$is_email_address_unsafe = true;
371 371
 				break;
372 372
 			}
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
 	 * @param bool   $is_email_address_unsafe Whether the email address is "unsafe". Default false.
382 382
 	 * @param string $user_email              User email address.
383 383
 	 */
384
-	return apply_filters( 'is_email_address_unsafe', $is_email_address_unsafe, $user_email );
384
+	return apply_filters('is_email_address_unsafe', $is_email_address_unsafe, $user_email);
385 385
 }
386 386
 
387 387
 /**
@@ -410,86 +410,86 @@  discard block
 block discarded – undo
410 410
 	$errors = new WP_Error();
411 411
 
412 412
 	$orig_username = $user_name;
413
-	$user_name = preg_replace( '/\s+/', '', sanitize_user( $user_name, true ) );
413
+	$user_name = preg_replace('/\s+/', '', sanitize_user($user_name, true));
414 414
 
415
-	if ( $user_name != $orig_username || preg_match( '/[^a-z0-9]/', $user_name ) ) {
416
-		$errors->add( 'user_name', __( 'Usernames can only contain lowercase letters (a-z) and numbers.' ) );
415
+	if ($user_name != $orig_username || preg_match('/[^a-z0-9]/', $user_name)) {
416
+		$errors->add('user_name', __('Usernames can only contain lowercase letters (a-z) and numbers.'));
417 417
 		$user_name = $orig_username;
418 418
 	}
419 419
 
420
-	$user_email = sanitize_email( $user_email );
420
+	$user_email = sanitize_email($user_email);
421 421
 
422
-	if ( empty( $user_name ) )
423
-	   	$errors->add('user_name', __( 'Please enter a username.' ) );
422
+	if (empty($user_name))
423
+	   	$errors->add('user_name', __('Please enter a username.'));
424 424
 
425
-	$illegal_names = get_site_option( 'illegal_names' );
426
-	if ( ! is_array( $illegal_names ) ) {
427
-		$illegal_names = array(  'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator' );
428
-		add_site_option( 'illegal_names', $illegal_names );
425
+	$illegal_names = get_site_option('illegal_names');
426
+	if ( ! is_array($illegal_names)) {
427
+		$illegal_names = array('www', 'web', 'root', 'admin', 'main', 'invite', 'administrator');
428
+		add_site_option('illegal_names', $illegal_names);
429 429
 	}
430
-	if ( in_array( $user_name, $illegal_names ) ) {
431
-		$errors->add( 'user_name',  __( 'Sorry, that username is not allowed.' ) );
430
+	if (in_array($user_name, $illegal_names)) {
431
+		$errors->add('user_name', __('Sorry, that username is not allowed.'));
432 432
 	}
433 433
 
434 434
 	/** This filter is documented in wp-includes/user.php */
435
-	$illegal_logins = (array) apply_filters( 'illegal_user_logins', array() );
435
+	$illegal_logins = (array) apply_filters('illegal_user_logins', array());
436 436
 
437
-	if ( in_array( strtolower( $user_name ), array_map( 'strtolower', $illegal_logins ) ) ) {
438
-		$errors->add( 'user_name',  __( 'Sorry, that username is not allowed.' ) );
437
+	if (in_array(strtolower($user_name), array_map('strtolower', $illegal_logins))) {
438
+		$errors->add('user_name', __('Sorry, that username is not allowed.'));
439 439
 	}
440 440
 
441
-	if ( is_email_address_unsafe( $user_email ) )
442
-		$errors->add('user_email',  __('You cannot use that email address to signup. We are having problems with them blocking some of our email. Please use another email provider.'));
441
+	if (is_email_address_unsafe($user_email))
442
+		$errors->add('user_email', __('You cannot use that email address to signup. We are having problems with them blocking some of our email. Please use another email provider.'));
443 443
 
444
-	if ( strlen( $user_name ) < 4 )
445
-		$errors->add('user_name',  __( 'Username must be at least 4 characters.' ) );
444
+	if (strlen($user_name) < 4)
445
+		$errors->add('user_name', __('Username must be at least 4 characters.'));
446 446
 
447
-	if ( strlen( $user_name ) > 60 ) {
448
-		$errors->add( 'user_name', __( 'Username may not be longer than 60 characters.' ) );
447
+	if (strlen($user_name) > 60) {
448
+		$errors->add('user_name', __('Username may not be longer than 60 characters.'));
449 449
 	}
450 450
 
451 451
 	// all numeric?
452
-	if ( preg_match( '/^[0-9]*$/', $user_name ) )
452
+	if (preg_match('/^[0-9]*$/', $user_name))
453 453
 		$errors->add('user_name', __('Sorry, usernames must have letters too!'));
454 454
 
455
-	if ( !is_email( $user_email ) )
456
-		$errors->add('user_email', __( 'Please enter a valid email address.' ) );
455
+	if ( ! is_email($user_email))
456
+		$errors->add('user_email', __('Please enter a valid email address.'));
457 457
 
458
-	$limited_email_domains = get_site_option( 'limited_email_domains' );
459
-	if ( is_array( $limited_email_domains ) && ! empty( $limited_email_domains ) ) {
460
-		$emaildomain = substr( $user_email, 1 + strpos( $user_email, '@' ) );
461
-		if ( ! in_array( $emaildomain, $limited_email_domains ) ) {
458
+	$limited_email_domains = get_site_option('limited_email_domains');
459
+	if (is_array($limited_email_domains) && ! empty($limited_email_domains)) {
460
+		$emaildomain = substr($user_email, 1 + strpos($user_email, '@'));
461
+		if ( ! in_array($emaildomain, $limited_email_domains)) {
462 462
 			$errors->add('user_email', __('Sorry, that email address is not allowed!'));
463 463
 		}
464 464
 	}
465 465
 
466 466
 	// Check if the username has been used already.
467
-	if ( username_exists($user_name) )
468
-		$errors->add( 'user_name', __( 'Sorry, that username already exists!' ) );
467
+	if (username_exists($user_name))
468
+		$errors->add('user_name', __('Sorry, that username already exists!'));
469 469
 
470 470
 	// Check if the email address has been used already.
471
-	if ( email_exists($user_email) )
472
-		$errors->add( 'user_email', __( 'Sorry, that email address is already used!' ) );
471
+	if (email_exists($user_email))
472
+		$errors->add('user_email', __('Sorry, that email address is already used!'));
473 473
 
474 474
 	// Has someone already signed up for this username?
475
-	$signup = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->signups WHERE user_login = %s", $user_name) );
476
-	if ( $signup != null ) {
477
-		$registered_at =  mysql2date('U', $signup->registered);
478
-		$now = current_time( 'timestamp', true );
475
+	$signup = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->signups WHERE user_login = %s", $user_name));
476
+	if ($signup != null) {
477
+		$registered_at = mysql2date('U', $signup->registered);
478
+		$now = current_time('timestamp', true);
479 479
 		$diff = $now - $registered_at;
480 480
 		// If registered more than two days ago, cancel registration and let this signup go through.
481
-		if ( $diff > 2 * DAY_IN_SECONDS )
482
-			$wpdb->delete( $wpdb->signups, array( 'user_login' => $user_name ) );
481
+		if ($diff > 2 * DAY_IN_SECONDS)
482
+			$wpdb->delete($wpdb->signups, array('user_login' => $user_name));
483 483
 		else
484 484
 			$errors->add('user_name', __('That username is currently reserved but may be available in a couple of days.'));
485 485
 	}
486 486
 
487
-	$signup = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->signups WHERE user_email = %s", $user_email) );
488
-	if ( $signup != null ) {
489
-		$diff = current_time( 'timestamp', true ) - mysql2date('U', $signup->registered);
487
+	$signup = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->signups WHERE user_email = %s", $user_email));
488
+	if ($signup != null) {
489
+		$diff = current_time('timestamp', true) - mysql2date('U', $signup->registered);
490 490
 		// If registered more than two days ago, cancel registration and let this signup go through.
491
-		if ( $diff > 2 * DAY_IN_SECONDS )
492
-			$wpdb->delete( $wpdb->signups, array( 'user_email' => $user_email ) );
491
+		if ($diff > 2 * DAY_IN_SECONDS)
492
+			$wpdb->delete($wpdb->signups, array('user_email' => $user_email));
493 493
 		else
494 494
 			$errors->add('user_email', __('That email address has already been used. Please check your inbox for an activation email. It will become available in a couple of days if you do nothing.'));
495 495
 	}
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
 	 *     @type WP_Error $errors        WP_Error object containing any errors found.
514 514
 	 * }
515 515
 	 */
516
-	return apply_filters( 'wpmu_validate_user_signup', $result );
516
+	return apply_filters('wpmu_validate_user_signup', $result);
517 517
 }
518 518
 
519 519
 /**
@@ -540,48 +540,48 @@  discard block
 block discarded – undo
540 540
  * @param WP_User|string $user       Optional. The user object to check against the new site name.
541 541
  * @return array Contains the new site data and error messages.
542 542
  */
543
-function wpmu_validate_blog_signup( $blogname, $blog_title, $user = '' ) {
543
+function wpmu_validate_blog_signup($blogname, $blog_title, $user = '') {
544 544
 	global $wpdb, $domain;
545 545
 
546 546
 	$current_site = get_current_site();
547 547
 	$base = $current_site->path;
548 548
 
549
-	$blog_title = strip_tags( $blog_title );
549
+	$blog_title = strip_tags($blog_title);
550 550
 
551 551
 	$errors = new WP_Error();
552
-	$illegal_names = get_site_option( 'illegal_names' );
553
-	if ( $illegal_names == false ) {
554
-		$illegal_names = array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator' );
555
-		add_site_option( 'illegal_names', $illegal_names );
552
+	$illegal_names = get_site_option('illegal_names');
553
+	if ($illegal_names == false) {
554
+		$illegal_names = array('www', 'web', 'root', 'admin', 'main', 'invite', 'administrator');
555
+		add_site_option('illegal_names', $illegal_names);
556 556
 	}
557 557
 
558 558
 	/*
559 559
 	 * On sub dir installs, some names are so illegal, only a filter can
560 560
 	 * spring them from jail.
561 561
 	 */
562
-	if ( ! is_subdomain_install() ) {
563
-		$illegal_names = array_merge( $illegal_names, get_subdirectory_reserved_names() );
562
+	if ( ! is_subdomain_install()) {
563
+		$illegal_names = array_merge($illegal_names, get_subdirectory_reserved_names());
564 564
 	}
565 565
 
566
-	if ( empty( $blogname ) )
567
-		$errors->add('blogname', __( 'Please enter a site name.' ) );
566
+	if (empty($blogname))
567
+		$errors->add('blogname', __('Please enter a site name.'));
568 568
 
569
-	if ( preg_match( '/[^a-z0-9]+/', $blogname ) ) {
570
-		$errors->add( 'blogname', __( 'Site names can only contain lowercase letters (a-z) and numbers.' ) );
569
+	if (preg_match('/[^a-z0-9]+/', $blogname)) {
570
+		$errors->add('blogname', __('Site names can only contain lowercase letters (a-z) and numbers.'));
571 571
 	}
572 572
 
573
-	if ( in_array( $blogname, $illegal_names ) )
574
-		$errors->add('blogname',  __( 'That name is not allowed.' ) );
573
+	if (in_array($blogname, $illegal_names))
574
+		$errors->add('blogname', __('That name is not allowed.'));
575 575
 
576
-	if ( strlen( $blogname ) < 4 && !is_super_admin() )
577
-		$errors->add('blogname',  __( 'Site name must be at least 4 characters.' ) );
576
+	if (strlen($blogname) < 4 && ! is_super_admin())
577
+		$errors->add('blogname', __('Site name must be at least 4 characters.'));
578 578
 
579 579
 	// do not allow users to create a blog that conflicts with a page on the main blog.
580
-	if ( !is_subdomain_install() && $wpdb->get_var( $wpdb->prepare( "SELECT post_name FROM " . $wpdb->get_blog_prefix( $current_site->blog_id ) . "posts WHERE post_type = 'page' AND post_name = %s", $blogname ) ) )
581
-		$errors->add( 'blogname', __( 'Sorry, you may not use that site name.' ) );
580
+	if ( ! is_subdomain_install() && $wpdb->get_var($wpdb->prepare("SELECT post_name FROM ".$wpdb->get_blog_prefix($current_site->blog_id)."posts WHERE post_type = 'page' AND post_name = %s", $blogname)))
581
+		$errors->add('blogname', __('Sorry, you may not use that site name.'));
582 582
 
583 583
 	// all numeric?
584
-	if ( preg_match( '/^[0-9]*$/', $blogname ) )
584
+	if (preg_match('/^[0-9]*$/', $blogname))
585 585
 		$errors->add('blogname', __('Sorry, site names must have letters too!'));
586 586
 
587 587
 	/**
@@ -594,36 +594,36 @@  discard block
 block discarded – undo
594 594
 	 *
595 595
 	 * @param string $blogname Site name.
596 596
 	 */
597
-	$blogname = apply_filters( 'newblogname', $blogname );
597
+	$blogname = apply_filters('newblogname', $blogname);
598 598
 
599
-	$blog_title = wp_unslash(  $blog_title );
599
+	$blog_title = wp_unslash($blog_title);
600 600
 
601
-	if ( empty( $blog_title ) )
602
-		$errors->add('blog_title', __( 'Please enter a site title.' ) );
601
+	if (empty($blog_title))
602
+		$errors->add('blog_title', __('Please enter a site title.'));
603 603
 
604 604
 	// Check if the domain/path has been used already.
605
-	if ( is_subdomain_install() ) {
606
-		$mydomain = $blogname . '.' . preg_replace( '|^www\.|', '', $domain );
605
+	if (is_subdomain_install()) {
606
+		$mydomain = $blogname.'.'.preg_replace('|^www\.|', '', $domain);
607 607
 		$path = $base;
608 608
 	} else {
609 609
 		$mydomain = "$domain";
610 610
 		$path = $base.$blogname.'/';
611 611
 	}
612
-	if ( domain_exists($mydomain, $path, $current_site->id) )
613
-		$errors->add( 'blogname', __( 'Sorry, that site already exists!' ) );
612
+	if (domain_exists($mydomain, $path, $current_site->id))
613
+		$errors->add('blogname', __('Sorry, that site already exists!'));
614 614
 
615
-	if ( username_exists( $blogname ) ) {
616
-		if ( ! is_object( $user ) || ( is_object($user) && ( $user->user_login != $blogname ) ) )
617
-			$errors->add( 'blogname', __( 'Sorry, that site is reserved!' ) );
615
+	if (username_exists($blogname)) {
616
+		if ( ! is_object($user) || (is_object($user) && ($user->user_login != $blogname)))
617
+			$errors->add('blogname', __('Sorry, that site is reserved!'));
618 618
 	}
619 619
 
620 620
 	// Has someone already signed up for this domain?
621
-	$signup = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->signups WHERE domain = %s AND path = %s", $mydomain, $path) ); // TODO: Check email too?
622
-	if ( ! empty($signup) ) {
623
-		$diff = current_time( 'timestamp', true ) - mysql2date('U', $signup->registered);
621
+	$signup = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->signups WHERE domain = %s AND path = %s", $mydomain, $path)); // TODO: Check email too?
622
+	if ( ! empty($signup)) {
623
+		$diff = current_time('timestamp', true) - mysql2date('U', $signup->registered);
624 624
 		// If registered more than two days ago, cancel registration and let this signup go through.
625
-		if ( $diff > 2 * DAY_IN_SECONDS )
626
-			$wpdb->delete( $wpdb->signups, array( 'domain' => $mydomain , 'path' => $path ) );
625
+		if ($diff > 2 * DAY_IN_SECONDS)
626
+			$wpdb->delete($wpdb->signups, array('domain' => $mydomain, 'path' => $path));
627 627
 		else
628 628
 			$errors->add('blogname', __('That site is currently reserved but may be available in a couple days.'));
629 629
 	}
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
 	 *     @type WP_Error       $errors     WP_Error containing any errors found.
647 647
 	 * }
648 648
 	 */
649
-	return apply_filters( 'wpmu_validate_blog_signup', $result );
649
+	return apply_filters('wpmu_validate_blog_signup', $result);
650 650
 }
651 651
 
652 652
 /**
@@ -663,13 +663,13 @@  discard block
 block discarded – undo
663 663
  * @param string $user_email The user's email address.
664 664
  * @param array  $meta       By default, contains the requested privacy setting and lang_id.
665 665
  */
666
-function wpmu_signup_blog( $domain, $path, $title, $user, $user_email, $meta = array() )  {
666
+function wpmu_signup_blog($domain, $path, $title, $user, $user_email, $meta = array()) {
667 667
 	global $wpdb;
668 668
 
669
-	$key = substr( md5( time() . rand() . $domain ), 0, 16 );
669
+	$key = substr(md5(time().rand().$domain), 0, 16);
670 670
 	$meta = serialize($meta);
671 671
 
672
-	$wpdb->insert( $wpdb->signups, array(
672
+	$wpdb->insert($wpdb->signups, array(
673 673
 		'domain' => $domain,
674 674
 		'path' => $path,
675 675
 		'title' => $title,
@@ -678,7 +678,7 @@  discard block
 block discarded – undo
678 678
 		'registered' => current_time('mysql', true),
679 679
 		'activation_key' => $key,
680 680
 		'meta' => $meta
681
-	) );
681
+	));
682 682
 
683 683
 	/**
684 684
 	 * Fires after site signup information has been written to the database.
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
 	 * @param string $key        The user's activation key
694 694
 	 * @param array  $meta       By default, contains the requested privacy setting and lang_id.
695 695
 	 */
696
-	do_action( 'after_signup_site', $domain, $path, $title, $user, $user_email, $key, $meta );
696
+	do_action('after_signup_site', $domain, $path, $title, $user, $user_email, $key, $meta);
697 697
 }
698 698
 
699 699
 /**
@@ -710,16 +710,16 @@  discard block
 block discarded – undo
710 710
  * @param string $user_email The user's email address.
711 711
  * @param array  $meta       By default, this is an empty array.
712 712
  */
713
-function wpmu_signup_user( $user, $user_email, $meta = array() ) {
713
+function wpmu_signup_user($user, $user_email, $meta = array()) {
714 714
 	global $wpdb;
715 715
 
716 716
 	// Format data
717
-	$user = preg_replace( '/\s+/', '', sanitize_user( $user, true ) );
718
-	$user_email = sanitize_email( $user_email );
719
-	$key = substr( md5( time() . rand() . $user_email ), 0, 16 );
717
+	$user = preg_replace('/\s+/', '', sanitize_user($user, true));
718
+	$user_email = sanitize_email($user_email);
719
+	$key = substr(md5(time().rand().$user_email), 0, 16);
720 720
 	$meta = serialize($meta);
721 721
 
722
-	$wpdb->insert( $wpdb->signups, array(
722
+	$wpdb->insert($wpdb->signups, array(
723 723
 		'domain' => '',
724 724
 		'path' => '',
725 725
 		'title' => '',
@@ -728,7 +728,7 @@  discard block
 block discarded – undo
728 728
 		'registered' => current_time('mysql', true),
729 729
 		'activation_key' => $key,
730 730
 		'meta' => $meta
731
-	) );
731
+	));
732 732
 
733 733
 	/**
734 734
 	 * Fires after a user's signup information has been written to the database.
@@ -740,7 +740,7 @@  discard block
 block discarded – undo
740 740
 	 * @param string $key        The user's activation key
741 741
 	 * @param array  $meta       Additional signup meta. By default, this is an empty array.
742 742
 	 */
743
-	do_action( 'after_signup_user', $user, $user_email, $key, $meta );
743
+	do_action('after_signup_user', $user, $user_email, $key, $meta);
744 744
 }
745 745
 
746 746
 /**
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
  * @param array  $meta       By default, contains the requested privacy setting and lang_id.
768 768
  * @return bool
769 769
  */
770
-function wpmu_signup_blog_notification( $domain, $path, $title, $user, $user_email, $key, $meta = array() ) {
770
+function wpmu_signup_blog_notification($domain, $path, $title, $user, $user_email, $key, $meta = array()) {
771 771
 	/**
772 772
 	 * Filter whether to bypass the new site email notification.
773 773
 	 *
@@ -781,22 +781,22 @@  discard block
 block discarded – undo
781 781
 	 * @param string      $key        Activation key created in wpmu_signup_blog().
782 782
 	 * @param array       $meta       By default, contains the requested privacy setting and lang_id.
783 783
 	 */
784
-	if ( ! apply_filters( 'wpmu_signup_blog_notification', $domain, $path, $title, $user, $user_email, $key, $meta ) ) {
784
+	if ( ! apply_filters('wpmu_signup_blog_notification', $domain, $path, $title, $user, $user_email, $key, $meta)) {
785 785
 		return false;
786 786
 	}
787 787
 
788 788
 	// Send email with activation link.
789
-	if ( !is_subdomain_install() || get_current_site()->id != 1 )
789
+	if ( ! is_subdomain_install() || get_current_site()->id != 1)
790 790
 		$activate_url = network_site_url("wp-activate.php?key=$key");
791 791
 	else
792 792
 		$activate_url = "http://{$domain}{$path}wp-activate.php?key=$key"; // @todo use *_url() API
793 793
 
794 794
 	$activate_url = esc_url($activate_url);
795
-	$admin_email = get_site_option( 'admin_email' );
796
-	if ( $admin_email == '' )
797
-		$admin_email = 'support@' . $_SERVER['SERVER_NAME'];
798
-	$from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
799
-	$message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
795
+	$admin_email = get_site_option('admin_email');
796
+	if ($admin_email == '')
797
+		$admin_email = 'support@'.$_SERVER['SERVER_NAME'];
798
+	$from_name = get_site_option('site_name') == '' ? 'WordPress' : esc_html(get_site_option('site_name'));
799
+	$message_headers = "From: \"{$from_name}\" <{$admin_email}>\n"."Content-Type: text/plain; charset=\"".get_option('blog_charset')."\"\n";
800 800
 	$message = sprintf(
801 801
 		/**
802 802
 		 * Filter the message content of the new blog notification email.
@@ -814,12 +814,12 @@  discard block
 block discarded – undo
814 814
 		 * @param string $key        Activation key created in wpmu_signup_blog().
815 815
 		 * @param array  $meta       By default, contains the requested privacy setting and lang_id.
816 816
 		 */
817
-		apply_filters( 'wpmu_signup_blog_notification_email',
818
-			__( "To activate your blog, please click the following link:\n\n%s\n\nAfter you activate, you will receive *another email* with your login.\n\nAfter you activate, you can visit your site here:\n\n%s" ),
817
+		apply_filters('wpmu_signup_blog_notification_email',
818
+			__("To activate your blog, please click the following link:\n\n%s\n\nAfter you activate, you will receive *another email* with your login.\n\nAfter you activate, you can visit your site here:\n\n%s"),
819 819
 			$domain, $path, $title, $user, $user_email, $key, $meta
820 820
 		),
821 821
 		$activate_url,
822
-		esc_url( "http://{$domain}{$path}" ),
822
+		esc_url("http://{$domain}{$path}"),
823 823
 		$key
824 824
 	);
825 825
 	// TODO: Don't hard code activation link.
@@ -838,14 +838,14 @@  discard block
 block discarded – undo
838 838
 		 * @param string $key        Activation key created in wpmu_signup_blog().
839 839
 		 * @param array  $meta       By default, contains the requested privacy setting and lang_id.
840 840
 		 */
841
-		apply_filters( 'wpmu_signup_blog_notification_subject',
842
-			__( '[%1$s] Activate %2$s' ),
841
+		apply_filters('wpmu_signup_blog_notification_subject',
842
+			__('[%1$s] Activate %2$s'),
843 843
 			$domain, $path, $title, $user, $user_email, $key, $meta
844 844
 		),
845 845
 		$from_name,
846
-		esc_url( 'http://' . $domain . $path )
846
+		esc_url('http://'.$domain.$path)
847 847
 	);
848
-	wp_mail( $user_email, wp_specialchars_decode( $subject ), $message, $message_headers );
848
+	wp_mail($user_email, wp_specialchars_decode($subject), $message, $message_headers);
849 849
 	return true;
850 850
 }
851 851
 
@@ -870,7 +870,7 @@  discard block
 block discarded – undo
870 870
  * @param array  $meta       By default, an empty array.
871 871
  * @return bool
872 872
  */
873
-function wpmu_signup_user_notification( $user, $user_email, $key, $meta = array() ) {
873
+function wpmu_signup_user_notification($user, $user_email, $key, $meta = array()) {
874 874
 	/**
875 875
 	 * Filter whether to bypass the email notification for new user sign-up.
876 876
 	 *
@@ -881,15 +881,15 @@  discard block
 block discarded – undo
881 881
 	 * @param string $key        Activation key created in wpmu_signup_user().
882 882
 	 * @param array  $meta       Signup meta data.
883 883
 	 */
884
-	if ( ! apply_filters( 'wpmu_signup_user_notification', $user, $user_email, $key, $meta ) )
884
+	if ( ! apply_filters('wpmu_signup_user_notification', $user, $user_email, $key, $meta))
885 885
 		return false;
886 886
 
887 887
 	// Send email with activation link.
888
-	$admin_email = get_site_option( 'admin_email' );
889
-	if ( $admin_email == '' )
890
-		$admin_email = 'support@' . $_SERVER['SERVER_NAME'];
891
-	$from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
892
-	$message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
888
+	$admin_email = get_site_option('admin_email');
889
+	if ($admin_email == '')
890
+		$admin_email = 'support@'.$_SERVER['SERVER_NAME'];
891
+	$from_name = get_site_option('site_name') == '' ? 'WordPress' : esc_html(get_site_option('site_name'));
892
+	$message_headers = "From: \"{$from_name}\" <{$admin_email}>\n"."Content-Type: text/plain; charset=\"".get_option('blog_charset')."\"\n";
893 893
 	$message = sprintf(
894 894
 		/**
895 895
 		 * Filter the content of the notification email for new user sign-up.
@@ -904,11 +904,11 @@  discard block
 block discarded – undo
904 904
 		 * @param string $key        Activation key created in wpmu_signup_user().
905 905
 		 * @param array  $meta       Signup meta data.
906 906
 		 */
907
-		apply_filters( 'wpmu_signup_user_notification_email',
908
-			__( "To activate your user, please click the following link:\n\n%s\n\nAfter you activate, you will receive *another email* with your login." ),
907
+		apply_filters('wpmu_signup_user_notification_email',
908
+			__("To activate your user, please click the following link:\n\n%s\n\nAfter you activate, you will receive *another email* with your login."),
909 909
 			$user, $user_email, $key, $meta
910 910
 		),
911
-		site_url( "wp-activate.php?key=$key" )
911
+		site_url("wp-activate.php?key=$key")
912 912
 	);
913 913
 	// TODO: Don't hard code activation link.
914 914
 	$subject = sprintf(
@@ -923,14 +923,14 @@  discard block
 block discarded – undo
923 923
 		 * @param string $key        Activation key created in wpmu_signup_user().
924 924
 		 * @param array  $meta       Signup meta data.
925 925
 		 */
926
-		apply_filters( 'wpmu_signup_user_notification_subject',
927
-			__( '[%1$s] Activate %2$s' ),
926
+		apply_filters('wpmu_signup_user_notification_subject',
927
+			__('[%1$s] Activate %2$s'),
928 928
 			$user, $user_email, $key, $meta
929 929
 		),
930 930
 		$from_name,
931 931
 		$user
932 932
 	);
933
-	wp_mail( $user_email, wp_specialchars_decode( $subject ), $message, $message_headers );
933
+	wp_mail($user_email, wp_specialchars_decode($subject), $message, $message_headers);
934 934
 	return true;
935 935
 }
936 936
 
@@ -952,38 +952,38 @@  discard block
 block discarded – undo
952 952
 function wpmu_activate_signup($key) {
953 953
 	global $wpdb;
954 954
 
955
-	$signup = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->signups WHERE activation_key = %s", $key) );
955
+	$signup = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->signups WHERE activation_key = %s", $key));
956 956
 
957
-	if ( empty( $signup ) )
958
-		return new WP_Error( 'invalid_key', __( 'Invalid activation key.' ) );
957
+	if (empty($signup))
958
+		return new WP_Error('invalid_key', __('Invalid activation key.'));
959 959
 
960
-	if ( $signup->active ) {
961
-		if ( empty( $signup->domain ) )
962
-			return new WP_Error( 'already_active', __( 'The user is already active.' ), $signup );
960
+	if ($signup->active) {
961
+		if (empty($signup->domain))
962
+			return new WP_Error('already_active', __('The user is already active.'), $signup);
963 963
 		else
964
-			return new WP_Error( 'already_active', __( 'The site is already active.' ), $signup );
964
+			return new WP_Error('already_active', __('The site is already active.'), $signup);
965 965
 	}
966 966
 
967 967
 	$meta = maybe_unserialize($signup->meta);
968
-	$password = wp_generate_password( 12, false );
968
+	$password = wp_generate_password(12, false);
969 969
 
970 970
 	$user_id = username_exists($signup->user_login);
971 971
 
972
-	if ( ! $user_id )
972
+	if ( ! $user_id)
973 973
 		$user_id = wpmu_create_user($signup->user_login, $password, $signup->user_email);
974 974
 	else
975 975
 		$user_already_exists = true;
976 976
 
977
-	if ( ! $user_id )
977
+	if ( ! $user_id)
978 978
 		return new WP_Error('create_user', __('Could not create user'), $signup);
979 979
 
980 980
 	$now = current_time('mysql', true);
981 981
 
982
-	if ( empty($signup->domain) ) {
983
-		$wpdb->update( $wpdb->signups, array('active' => 1, 'activated' => $now), array('activation_key' => $key) );
982
+	if (empty($signup->domain)) {
983
+		$wpdb->update($wpdb->signups, array('active' => 1, 'activated' => $now), array('activation_key' => $key));
984 984
 
985
-		if ( isset( $user_already_exists ) )
986
-			return new WP_Error( 'user_already_exists', __( 'That username is already activated.' ), $signup);
985
+		if (isset($user_already_exists))
986
+			return new WP_Error('user_already_exists', __('That username is already activated.'), $signup);
987 987
 
988 988
 		/**
989 989
 		 * Fires immediately after a new user is activated.
@@ -994,24 +994,24 @@  discard block
 block discarded – undo
994 994
 		 * @param int   $password User password.
995 995
 		 * @param array $meta     Signup meta data.
996 996
 		 */
997
-		do_action( 'wpmu_activate_user', $user_id, $password, $meta );
998
-		return array( 'user_id' => $user_id, 'password' => $password, 'meta' => $meta );
997
+		do_action('wpmu_activate_user', $user_id, $password, $meta);
998
+		return array('user_id' => $user_id, 'password' => $password, 'meta' => $meta);
999 999
 	}
1000 1000
 
1001
-	$blog_id = wpmu_create_blog( $signup->domain, $signup->path, $signup->title, $user_id, $meta, $wpdb->siteid );
1001
+	$blog_id = wpmu_create_blog($signup->domain, $signup->path, $signup->title, $user_id, $meta, $wpdb->siteid);
1002 1002
 
1003 1003
 	// TODO: What to do if we create a user but cannot create a blog?
1004
-	if ( is_wp_error($blog_id) ) {
1004
+	if (is_wp_error($blog_id)) {
1005 1005
 		// If blog is taken, that means a previous attempt to activate this blog failed in between creating the blog and
1006 1006
 		// setting the activation flag. Let's just set the active flag and instruct the user to reset their password.
1007
-		if ( 'blog_taken' == $blog_id->get_error_code() ) {
1008
-			$blog_id->add_data( $signup );
1009
-			$wpdb->update( $wpdb->signups, array( 'active' => 1, 'activated' => $now ), array( 'activation_key' => $key ) );
1007
+		if ('blog_taken' == $blog_id->get_error_code()) {
1008
+			$blog_id->add_data($signup);
1009
+			$wpdb->update($wpdb->signups, array('active' => 1, 'activated' => $now), array('activation_key' => $key));
1010 1010
 		}
1011 1011
 		return $blog_id;
1012 1012
 	}
1013 1013
 
1014
-	$wpdb->update( $wpdb->signups, array('active' => 1, 'activated' => $now), array('activation_key' => $key) );
1014
+	$wpdb->update($wpdb->signups, array('active' => 1, 'activated' => $now), array('activation_key' => $key));
1015 1015
 	/**
1016 1016
 	 * Fires immediately after a site is activated.
1017 1017
 	 *
@@ -1023,7 +1023,7 @@  discard block
 block discarded – undo
1023 1023
 	 * @param string $signup_title  Site title.
1024 1024
 	 * @param array  $meta          Signup meta data.
1025 1025
 	 */
1026
-	do_action( 'wpmu_activate_blog', $blog_id, $user_id, $password, $signup->title, $meta );
1026
+	do_action('wpmu_activate_blog', $blog_id, $user_id, $password, $signup->title, $meta);
1027 1027
 
1028 1028
 	return array('blog_id' => $blog_id, 'user_id' => $user_id, 'password' => $password, 'title' => $signup->title, 'meta' => $meta);
1029 1029
 }
@@ -1043,16 +1043,16 @@  discard block
 block discarded – undo
1043 1043
  * @param string $email     The new user's email address.
1044 1044
  * @return int|false Returns false on failure, or int $user_id on success
1045 1045
  */
1046
-function wpmu_create_user( $user_name, $password, $email ) {
1047
-	$user_name = preg_replace( '/\s+/', '', sanitize_user( $user_name, true ) );
1046
+function wpmu_create_user($user_name, $password, $email) {
1047
+	$user_name = preg_replace('/\s+/', '', sanitize_user($user_name, true));
1048 1048
 
1049
-	$user_id = wp_create_user( $user_name, $password, $email );
1050
-	if ( is_wp_error( $user_id ) )
1049
+	$user_id = wp_create_user($user_name, $password, $email);
1050
+	if (is_wp_error($user_id))
1051 1051
 		return false;
1052 1052
 
1053 1053
 	// Newly created users have no roles or caps until they are added to a blog.
1054
-	delete_user_option( $user_id, 'capabilities' );
1055
-	delete_user_option( $user_id, 'user_level' );
1054
+	delete_user_option($user_id, 'capabilities');
1055
+	delete_user_option($user_id, 'user_level');
1056 1056
 
1057 1057
 	/**
1058 1058
 	 * Fires immediately after a new user is created.
@@ -1061,7 +1061,7 @@  discard block
 block discarded – undo
1061 1061
 	 *
1062 1062
 	 * @param int $user_id User ID.
1063 1063
 	 */
1064
-	do_action( 'wpmu_new_user', $user_id );
1064
+	do_action('wpmu_new_user', $user_id);
1065 1065
 
1066 1066
 	return $user_id;
1067 1067
 }
@@ -1088,30 +1088,30 @@  discard block
 block discarded – undo
1088 1088
  * @param int    $site_id Optional. Only relevant on multi-network installs.
1089 1089
  * @return int|WP_Error Returns WP_Error object on failure, int $blog_id on success
1090 1090
  */
1091
-function wpmu_create_blog( $domain, $path, $title, $user_id, $meta = array(), $site_id = 1 ) {
1092
-	$defaults = array( 'public' => 0 );
1093
-	$meta = wp_parse_args( $meta, $defaults );
1091
+function wpmu_create_blog($domain, $path, $title, $user_id, $meta = array(), $site_id = 1) {
1092
+	$defaults = array('public' => 0);
1093
+	$meta = wp_parse_args($meta, $defaults);
1094 1094
 
1095
-	$domain = preg_replace( '/\s+/', '', sanitize_user( $domain, true ) );
1095
+	$domain = preg_replace('/\s+/', '', sanitize_user($domain, true));
1096 1096
 
1097
-	if ( is_subdomain_install() )
1098
-		$domain = str_replace( '@', '', $domain );
1097
+	if (is_subdomain_install())
1098
+		$domain = str_replace('@', '', $domain);
1099 1099
 
1100
-	$title = strip_tags( $title );
1100
+	$title = strip_tags($title);
1101 1101
 	$user_id = (int) $user_id;
1102 1102
 
1103
-	if ( empty($path) )
1103
+	if (empty($path))
1104 1104
 		$path = '/';
1105 1105
 
1106 1106
 	// Check if the domain has been used already. We should return an error message.
1107
-	if ( domain_exists($domain, $path, $site_id) )
1108
-		return new WP_Error( 'blog_taken', __( 'Sorry, that site already exists!' ) );
1107
+	if (domain_exists($domain, $path, $site_id))
1108
+		return new WP_Error('blog_taken', __('Sorry, that site already exists!'));
1109 1109
 
1110
-	if ( ! wp_installing() ) {
1111
-		wp_installing( true );
1110
+	if ( ! wp_installing()) {
1111
+		wp_installing(true);
1112 1112
 	}
1113 1113
 
1114
-	if ( ! $blog_id = insert_blog($domain, $path, $site_id) )
1114
+	if ( ! $blog_id = insert_blog($domain, $path, $site_id))
1115 1115
 		return new WP_Error('insert_blog', __('Could not create site.'));
1116 1116
 
1117 1117
 	switch_to_blog($blog_id);
@@ -1120,18 +1120,18 @@  discard block
 block discarded – undo
1120 1120
 
1121 1121
 	add_user_to_blog($blog_id, $user_id, 'administrator');
1122 1122
 
1123
-	foreach ( $meta as $key => $value ) {
1124
-		if ( in_array( $key, array( 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id' ) ) )
1125
-			update_blog_status( $blog_id, $key, $value );
1123
+	foreach ($meta as $key => $value) {
1124
+		if (in_array($key, array('public', 'archived', 'mature', 'spam', 'deleted', 'lang_id')))
1125
+			update_blog_status($blog_id, $key, $value);
1126 1126
 		else
1127
-			update_option( $key, $value );
1127
+			update_option($key, $value);
1128 1128
 	}
1129 1129
 
1130
-	add_option( 'WPLANG', get_site_option( 'WPLANG' ) );
1131
-	update_option( 'blog_public', (int) $meta['public'] );
1130
+	add_option('WPLANG', get_site_option('WPLANG'));
1131
+	update_option('blog_public', (int) $meta['public']);
1132 1132
 
1133
-	if ( ! is_super_admin( $user_id ) && ! get_user_meta( $user_id, 'primary_blog', true ) )
1134
-		update_user_meta( $user_id, 'primary_blog', $blog_id );
1133
+	if ( ! is_super_admin($user_id) && ! get_user_meta($user_id, 'primary_blog', true))
1134
+		update_user_meta($user_id, 'primary_blog', $blog_id);
1135 1135
 
1136 1136
 	restore_current_blog();
1137 1137
 	/**
@@ -1146,7 +1146,7 @@  discard block
 block discarded – undo
1146 1146
 	 * @param int    $site_id Site ID. Only relevant on multi-network installs.
1147 1147
 	 * @param array  $meta    Meta data. Used to set initial site options.
1148 1148
 	 */
1149
-	do_action( 'wpmu_new_blog', $blog_id, $user_id, $domain, $path, $site_id, $meta );
1149
+	do_action('wpmu_new_blog', $blog_id, $user_id, $domain, $path, $site_id, $meta);
1150 1150
 
1151 1151
 	return $blog_id;
1152 1152
 }
@@ -1163,26 +1163,26 @@  discard block
 block discarded – undo
1163 1163
  * @param string $deprecated Not used.
1164 1164
  * @return bool
1165 1165
  */
1166
-function newblog_notify_siteadmin( $blog_id, $deprecated = '' ) {
1167
-	if ( get_site_option( 'registrationnotification' ) != 'yes' )
1166
+function newblog_notify_siteadmin($blog_id, $deprecated = '') {
1167
+	if (get_site_option('registrationnotification') != 'yes')
1168 1168
 		return false;
1169 1169
 
1170
-	$email = get_site_option( 'admin_email' );
1171
-	if ( is_email($email) == false )
1170
+	$email = get_site_option('admin_email');
1171
+	if (is_email($email) == false)
1172 1172
 		return false;
1173 1173
 
1174 1174
 	$options_site_url = esc_url(network_admin_url('settings.php'));
1175 1175
 
1176
-	switch_to_blog( $blog_id );
1177
-	$blogname = get_option( 'blogname' );
1176
+	switch_to_blog($blog_id);
1177
+	$blogname = get_option('blogname');
1178 1178
 	$siteurl = site_url();
1179 1179
 	restore_current_blog();
1180 1180
 
1181
-	$msg = sprintf( __( 'New Site: %1$s
1181
+	$msg = sprintf(__('New Site: %1$s
1182 1182
 URL: %2$s
1183 1183
 Remote IP: %3$s
1184 1184
 
1185
-Disable these notifications: %4$s' ), $blogname, $siteurl, wp_unslash( $_SERVER['REMOTE_ADDR'] ), $options_site_url);
1185
+Disable these notifications: %4$s' ), $blogname, $siteurl, wp_unslash($_SERVER['REMOTE_ADDR']), $options_site_url);
1186 1186
 	/**
1187 1187
 	 * Filter the message body of the new site activation email sent
1188 1188
 	 * to the network administrator.
@@ -1191,9 +1191,9 @@  discard block
 block discarded – undo
1191 1191
 	 *
1192 1192
 	 * @param string $msg Email body.
1193 1193
 	 */
1194
-	$msg = apply_filters( 'newblog_notify_siteadmin', $msg );
1194
+	$msg = apply_filters('newblog_notify_siteadmin', $msg);
1195 1195
 
1196
-	wp_mail( $email, sprintf( __( 'New Site Registration: %s' ), $siteurl ), $msg );
1196
+	wp_mail($email, sprintf(__('New Site Registration: %s'), $siteurl), $msg);
1197 1197
 	return true;
1198 1198
 }
1199 1199
 
@@ -1208,22 +1208,22 @@  discard block
 block discarded – undo
1208 1208
  * @param int $user_id The new user's ID.
1209 1209
  * @return bool
1210 1210
  */
1211
-function newuser_notify_siteadmin( $user_id ) {
1212
-	if ( get_site_option( 'registrationnotification' ) != 'yes' )
1211
+function newuser_notify_siteadmin($user_id) {
1212
+	if (get_site_option('registrationnotification') != 'yes')
1213 1213
 		return false;
1214 1214
 
1215
-	$email = get_site_option( 'admin_email' );
1215
+	$email = get_site_option('admin_email');
1216 1216
 
1217
-	if ( is_email($email) == false )
1217
+	if (is_email($email) == false)
1218 1218
 		return false;
1219 1219
 
1220
-	$user = get_userdata( $user_id );
1220
+	$user = get_userdata($user_id);
1221 1221
 
1222 1222
 	$options_site_url = esc_url(network_admin_url('settings.php'));
1223 1223
 	$msg = sprintf(__('New User: %1$s
1224 1224
 Remote IP: %2$s
1225 1225
 
1226
-Disable these notifications: %3$s'), $user->user_login, wp_unslash( $_SERVER['REMOTE_ADDR'] ), $options_site_url);
1226
+Disable these notifications: %3$s'), $user->user_login, wp_unslash($_SERVER['REMOTE_ADDR']), $options_site_url);
1227 1227
 
1228 1228
 	/**
1229 1229
 	 * Filter the message body of the new user activation email sent
@@ -1234,8 +1234,8 @@  discard block
 block discarded – undo
1234 1234
 	 * @param string  $msg  Email body.
1235 1235
 	 * @param WP_User $user WP_User instance of the new user.
1236 1236
 	 */
1237
-	$msg = apply_filters( 'newuser_notify_siteadmin', $msg, $user );
1238
-	wp_mail( $email, sprintf(__('New User Registration: %s'), $user->user_login), $msg );
1237
+	$msg = apply_filters('newuser_notify_siteadmin', $msg, $user);
1238
+	wp_mail($email, sprintf(__('New User Registration: %s'), $user->user_login), $msg);
1239 1239
 	return true;
1240 1240
 }
1241 1241
 
@@ -1256,8 +1256,8 @@  discard block
 block discarded – undo
1256 1256
  */
1257 1257
 function domain_exists($domain, $path, $site_id = 1) {
1258 1258
 	global $wpdb;
1259
-	$path = trailingslashit( $path );
1260
-	$result = $wpdb->get_var( $wpdb->prepare("SELECT blog_id FROM $wpdb->blogs WHERE domain = %s AND path = %s AND site_id = %d", $domain, $path, $site_id) );
1259
+	$path = trailingslashit($path);
1260
+	$result = $wpdb->get_var($wpdb->prepare("SELECT blog_id FROM $wpdb->blogs WHERE domain = %s AND path = %s AND site_id = %d", $domain, $path, $site_id));
1261 1261
 
1262 1262
 	/**
1263 1263
 	 * Filter whether a blogname is taken.
@@ -1269,7 +1269,7 @@  discard block
 block discarded – undo
1269 1269
 	 * @param string   $path    Path to be checked.
1270 1270
 	 * @param int      $site_id Site ID. Relevant only on multi-network installs.
1271 1271
 	 */
1272
-	return apply_filters( 'domain_exists', $result, $domain, $path, $site_id );
1272
+	return apply_filters('domain_exists', $result, $domain, $path, $site_id);
1273 1273
 }
1274 1274
 
1275 1275
 /**
@@ -1293,12 +1293,12 @@  discard block
 block discarded – undo
1293 1293
 	$path = trailingslashit($path);
1294 1294
 	$site_id = (int) $site_id;
1295 1295
 
1296
-	$result = $wpdb->insert( $wpdb->blogs, array('site_id' => $site_id, 'domain' => $domain, 'path' => $path, 'registered' => current_time('mysql')) );
1297
-	if ( ! $result )
1296
+	$result = $wpdb->insert($wpdb->blogs, array('site_id' => $site_id, 'domain' => $domain, 'path' => $path, 'registered' => current_time('mysql')));
1297
+	if ( ! $result)
1298 1298
 		return false;
1299 1299
 
1300 1300
 	$blog_id = $wpdb->insert_id;
1301
-	refresh_blog_details( $blog_id );
1301
+	refresh_blog_details($blog_id);
1302 1302
 
1303 1303
 	wp_maybe_update_network_site_counts();
1304 1304
 
@@ -1320,57 +1320,57 @@  discard block
 block discarded – undo
1320 1320
  * @param int    $blog_id    The value returned by insert_blog().
1321 1321
  * @param string $blog_title The title of the new site.
1322 1322
  */
1323
-function install_blog( $blog_id, $blog_title = '' ) {
1323
+function install_blog($blog_id, $blog_title = '') {
1324 1324
 	global $wpdb, $wp_roles, $current_site;
1325 1325
 
1326 1326
 	// Cast for security
1327 1327
 	$blog_id = (int) $blog_id;
1328 1328
 
1329
-	require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
1329
+	require_once(ABSPATH.'wp-admin/includes/upgrade.php');
1330 1330
 
1331 1331
 	$suppress = $wpdb->suppress_errors();
1332
-	if ( $wpdb->get_results( "DESCRIBE {$wpdb->posts}" ) )
1333
-		die( '<h1>' . __( 'Already Installed' ) . '</h1><p>' . __( 'You appear to have already installed WordPress. To reinstall please clear your old database tables first.' ) . '</p></body></html>' );
1334
-	$wpdb->suppress_errors( $suppress );
1332
+	if ($wpdb->get_results("DESCRIBE {$wpdb->posts}"))
1333
+		die('<h1>'.__('Already Installed').'</h1><p>'.__('You appear to have already installed WordPress. To reinstall please clear your old database tables first.').'</p></body></html>');
1334
+	$wpdb->suppress_errors($suppress);
1335 1335
 
1336
-	$url = get_blogaddress_by_id( $blog_id );
1336
+	$url = get_blogaddress_by_id($blog_id);
1337 1337
 
1338 1338
 	// Set everything up
1339
-	make_db_current_silent( 'blog' );
1339
+	make_db_current_silent('blog');
1340 1340
 	populate_options();
1341 1341
 	populate_roles();
1342 1342
 
1343 1343
 	// populate_roles() clears previous role definitions so we start over.
1344 1344
 	$wp_roles = new WP_Roles();
1345 1345
 
1346
-	$siteurl = $home = untrailingslashit( $url );
1346
+	$siteurl = $home = untrailingslashit($url);
1347 1347
 
1348
-	if ( ! is_subdomain_install() ) {
1348
+	if ( ! is_subdomain_install()) {
1349 1349
 
1350
- 		if ( 'https' === parse_url( get_site_option( 'siteurl' ), PHP_URL_SCHEME ) ) {
1351
- 			$siteurl = set_url_scheme( $siteurl, 'https' );
1350
+ 		if ('https' === parse_url(get_site_option('siteurl'), PHP_URL_SCHEME)) {
1351
+ 			$siteurl = set_url_scheme($siteurl, 'https');
1352 1352
  		}
1353
- 		if ( 'https' === parse_url( get_home_url( $current_site->blog_id ), PHP_URL_SCHEME ) ) {
1354
- 			$home = set_url_scheme( $home, 'https' );
1353
+ 		if ('https' === parse_url(get_home_url($current_site->blog_id), PHP_URL_SCHEME)) {
1354
+ 			$home = set_url_scheme($home, 'https');
1355 1355
  		}
1356 1356
 
1357 1357
 	}
1358 1358
 
1359
-	update_option( 'siteurl', $siteurl );
1360
-	update_option( 'home', $home );
1359
+	update_option('siteurl', $siteurl);
1360
+	update_option('home', $home);
1361 1361
 
1362
-	if ( get_site_option( 'ms_files_rewriting' ) )
1363
-		update_option( 'upload_path', UPLOADBLOGSDIR . "/$blog_id/files" );
1362
+	if (get_site_option('ms_files_rewriting'))
1363
+		update_option('upload_path', UPLOADBLOGSDIR."/$blog_id/files");
1364 1364
 	else
1365
-		update_option( 'upload_path', get_blog_option( get_current_site()->blog_id, 'upload_path' ) );
1365
+		update_option('upload_path', get_blog_option(get_current_site()->blog_id, 'upload_path'));
1366 1366
 
1367
-	update_option( 'blogname', wp_unslash( $blog_title ) );
1368
-	update_option( 'admin_email', '' );
1367
+	update_option('blogname', wp_unslash($blog_title));
1368
+	update_option('admin_email', '');
1369 1369
 
1370 1370
 	// remove all perms
1371 1371
 	$table_prefix = $wpdb->get_blog_prefix();
1372
-	delete_metadata( 'user', 0, $table_prefix . 'user_level',   null, true ); // delete all
1373
-	delete_metadata( 'user', 0, $table_prefix . 'capabilities', null, true ); // delete all
1372
+	delete_metadata('user', 0, $table_prefix.'user_level', null, true); // delete all
1373
+	delete_metadata('user', 0, $table_prefix.'capabilities', null, true); // delete all
1374 1374
 }
1375 1375
 
1376 1376
 /**
@@ -1390,13 +1390,13 @@  discard block
 block discarded – undo
1390 1390
 function install_blog_defaults($blog_id, $user_id) {
1391 1391
 	global $wpdb;
1392 1392
 
1393
-	require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
1393
+	require_once(ABSPATH.'wp-admin/includes/upgrade.php');
1394 1394
 
1395 1395
 	$suppress = $wpdb->suppress_errors();
1396 1396
 
1397 1397
 	wp_install_defaults($user_id);
1398 1398
 
1399
-	$wpdb->suppress_errors( $suppress );
1399
+	$wpdb->suppress_errors($suppress);
1400 1400
 }
1401 1401
 
1402 1402
 /**
@@ -1416,7 +1416,7 @@  discard block
 block discarded – undo
1416 1416
  * @param array  $meta     Optional. Not used in the default function, but is passed along to hooks for customization.
1417 1417
  * @return bool
1418 1418
  */
1419
-function wpmu_welcome_notification( $blog_id, $user_id, $password, $title, $meta = array() ) {
1419
+function wpmu_welcome_notification($blog_id, $user_id, $password, $title, $meta = array()) {
1420 1420
 	$current_site = get_current_site();
1421 1421
 
1422 1422
 	/**
@@ -1432,13 +1432,13 @@  discard block
 block discarded – undo
1432 1432
 	 * @param string   $title    Site title.
1433 1433
 	 * @param array    $meta     Signup meta data.
1434 1434
 	 */
1435
-	if ( ! apply_filters( 'wpmu_welcome_notification', $blog_id, $user_id, $password, $title, $meta ) )
1435
+	if ( ! apply_filters('wpmu_welcome_notification', $blog_id, $user_id, $password, $title, $meta))
1436 1436
 		return false;
1437 1437
 
1438
-	$welcome_email = get_site_option( 'welcome_email' );
1439
-	if ( $welcome_email == false ) {
1438
+	$welcome_email = get_site_option('welcome_email');
1439
+	if ($welcome_email == false) {
1440 1440
 		/* translators: Do not translate USERNAME, SITE_NAME, BLOG_URL, PASSWORD: those are placeholders. */
1441
-		$welcome_email = __( 'Howdy USERNAME,
1441
+		$welcome_email = __('Howdy USERNAME,
1442 1442
 
1443 1443
 Your new SITE_NAME site has been successfully set up at:
1444 1444
 BLOG_URL
@@ -1455,13 +1455,13 @@  discard block
 block discarded – undo
1455 1455
 	}
1456 1456
 
1457 1457
 	$url = get_blogaddress_by_id($blog_id);
1458
-	$user = get_userdata( $user_id );
1458
+	$user = get_userdata($user_id);
1459 1459
 
1460
-	$welcome_email = str_replace( 'SITE_NAME', $current_site->site_name, $welcome_email );
1461
-	$welcome_email = str_replace( 'BLOG_TITLE', $title, $welcome_email );
1462
-	$welcome_email = str_replace( 'BLOG_URL', $url, $welcome_email );
1463
-	$welcome_email = str_replace( 'USERNAME', $user->user_login, $welcome_email );
1464
-	$welcome_email = str_replace( 'PASSWORD', $password, $welcome_email );
1460
+	$welcome_email = str_replace('SITE_NAME', $current_site->site_name, $welcome_email);
1461
+	$welcome_email = str_replace('BLOG_TITLE', $title, $welcome_email);
1462
+	$welcome_email = str_replace('BLOG_URL', $url, $welcome_email);
1463
+	$welcome_email = str_replace('USERNAME', $user->user_login, $welcome_email);
1464
+	$welcome_email = str_replace('PASSWORD', $password, $welcome_email);
1465 1465
 
1466 1466
 	/**
1467 1467
 	 * Filter the content of the welcome email after site activation.
@@ -1477,17 +1477,17 @@  discard block
 block discarded – undo
1477 1477
 	 * @param string $title         Site title.
1478 1478
 	 * @param array  $meta          Signup meta data.
1479 1479
 	 */
1480
-	$welcome_email = apply_filters( 'update_welcome_email', $welcome_email, $blog_id, $user_id, $password, $title, $meta );
1481
-	$admin_email = get_site_option( 'admin_email' );
1480
+	$welcome_email = apply_filters('update_welcome_email', $welcome_email, $blog_id, $user_id, $password, $title, $meta);
1481
+	$admin_email = get_site_option('admin_email');
1482 1482
 
1483
-	if ( $admin_email == '' )
1484
-		$admin_email = 'support@' . $_SERVER['SERVER_NAME'];
1483
+	if ($admin_email == '')
1484
+		$admin_email = 'support@'.$_SERVER['SERVER_NAME'];
1485 1485
 
1486
-	$from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
1487
-	$message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
1486
+	$from_name = get_site_option('site_name') == '' ? 'WordPress' : esc_html(get_site_option('site_name'));
1487
+	$message_headers = "From: \"{$from_name}\" <{$admin_email}>\n"."Content-Type: text/plain; charset=\"".get_option('blog_charset')."\"\n";
1488 1488
 	$message = $welcome_email;
1489 1489
 
1490
-	if ( empty( $current_site->site_name ) )
1490
+	if (empty($current_site->site_name))
1491 1491
 		$current_site->site_name = 'WordPress';
1492 1492
 
1493 1493
 	/**
@@ -1497,8 +1497,8 @@  discard block
 block discarded – undo
1497 1497
 	 *
1498 1498
 	 * @param string $subject Subject of the email.
1499 1499
 	 */
1500
-	$subject = apply_filters( 'update_welcome_subject', sprintf( __( 'New %1$s Site: %2$s' ), $current_site->site_name, wp_unslash( $title ) ) );
1501
-	wp_mail( $user->user_email, wp_specialchars_decode( $subject ), $message, $message_headers );
1500
+	$subject = apply_filters('update_welcome_subject', sprintf(__('New %1$s Site: %2$s'), $current_site->site_name, wp_unslash($title)));
1501
+	wp_mail($user->user_email, wp_specialchars_decode($subject), $message, $message_headers);
1502 1502
 	return true;
1503 1503
 }
1504 1504
 
@@ -1517,7 +1517,7 @@  discard block
 block discarded – undo
1517 1517
  * @param array  $meta     Optional. Not used in the default function, but is passed along to hooks for customization.
1518 1518
  * @return bool
1519 1519
  */
1520
-function wpmu_welcome_user_notification( $user_id, $password, $meta = array() ) {
1520
+function wpmu_welcome_user_notification($user_id, $password, $meta = array()) {
1521 1521
 	$current_site = get_current_site();
1522 1522
 
1523 1523
 	/**
@@ -1531,12 +1531,12 @@  discard block
 block discarded – undo
1531 1531
 	 * @param string $password User password.
1532 1532
 	 * @param array  $meta     Signup meta data.
1533 1533
 	 */
1534
-	if ( ! apply_filters( 'wpmu_welcome_user_notification', $user_id, $password, $meta ) )
1534
+	if ( ! apply_filters('wpmu_welcome_user_notification', $user_id, $password, $meta))
1535 1535
 		return false;
1536 1536
 
1537
-	$welcome_email = get_site_option( 'welcome_user_email' );
1537
+	$welcome_email = get_site_option('welcome_user_email');
1538 1538
 
1539
-	$user = get_userdata( $user_id );
1539
+	$user = get_userdata($user_id);
1540 1540
 
1541 1541
 	/**
1542 1542
 	 * Filters the content of the welcome email after user activation.
@@ -1550,22 +1550,22 @@  discard block
 block discarded – undo
1550 1550
 	 * @param string $password      User password.
1551 1551
 	 * @param array  $meta          Signup meta data.
1552 1552
 	 */
1553
-	$welcome_email = apply_filters( 'update_welcome_user_email', $welcome_email, $user_id, $password, $meta );
1554
-	$welcome_email = str_replace( 'SITE_NAME', $current_site->site_name, $welcome_email );
1555
-	$welcome_email = str_replace( 'USERNAME', $user->user_login, $welcome_email );
1556
-	$welcome_email = str_replace( 'PASSWORD', $password, $welcome_email );
1557
-	$welcome_email = str_replace( 'LOGINLINK', wp_login_url(), $welcome_email );
1553
+	$welcome_email = apply_filters('update_welcome_user_email', $welcome_email, $user_id, $password, $meta);
1554
+	$welcome_email = str_replace('SITE_NAME', $current_site->site_name, $welcome_email);
1555
+	$welcome_email = str_replace('USERNAME', $user->user_login, $welcome_email);
1556
+	$welcome_email = str_replace('PASSWORD', $password, $welcome_email);
1557
+	$welcome_email = str_replace('LOGINLINK', wp_login_url(), $welcome_email);
1558 1558
 
1559
-	$admin_email = get_site_option( 'admin_email' );
1559
+	$admin_email = get_site_option('admin_email');
1560 1560
 
1561
-	if ( $admin_email == '' )
1562
-		$admin_email = 'support@' . $_SERVER['SERVER_NAME'];
1561
+	if ($admin_email == '')
1562
+		$admin_email = 'support@'.$_SERVER['SERVER_NAME'];
1563 1563
 
1564
-	$from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
1565
-	$message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
1564
+	$from_name = get_site_option('site_name') == '' ? 'WordPress' : esc_html(get_site_option('site_name'));
1565
+	$message_headers = "From: \"{$from_name}\" <{$admin_email}>\n"."Content-Type: text/plain; charset=\"".get_option('blog_charset')."\"\n";
1566 1566
 	$message = $welcome_email;
1567 1567
 
1568
-	if ( empty( $current_site->site_name ) )
1568
+	if (empty($current_site->site_name))
1569 1569
 		$current_site->site_name = 'WordPress';
1570 1570
 
1571 1571
 	/**
@@ -1575,8 +1575,8 @@  discard block
 block discarded – undo
1575 1575
 	 *
1576 1576
 	 * @param string $subject Subject of the email.
1577 1577
 	 */
1578
-	$subject = apply_filters( 'update_welcome_user_subject', sprintf( __( 'New %1$s User: %2$s' ), $current_site->site_name, $user->user_login) );
1579
-	wp_mail( $user->user_email, wp_specialchars_decode( $subject ), $message, $message_headers );
1578
+	$subject = apply_filters('update_welcome_user_subject', sprintf(__('New %1$s User: %2$s'), $current_site->site_name, $user->user_login));
1579
+	wp_mail($user->user_email, wp_specialchars_decode($subject), $message, $message_headers);
1580 1580
 	return true;
1581 1581
 }
1582 1582
 
@@ -1612,26 +1612,26 @@  discard block
 block discarded – undo
1612 1612
  * @param int $user_id
1613 1613
  * @return array Contains the blog_id, post_id, post_date_gmt, and post_gmt_ts
1614 1614
  */
1615
-function get_most_recent_post_of_user( $user_id ) {
1615
+function get_most_recent_post_of_user($user_id) {
1616 1616
 	global $wpdb;
1617 1617
 
1618
-	$user_blogs = get_blogs_of_user( (int) $user_id );
1618
+	$user_blogs = get_blogs_of_user((int) $user_id);
1619 1619
 	$most_recent_post = array();
1620 1620
 
1621 1621
 	// Walk through each blog and get the most recent post
1622 1622
 	// published by $user_id
1623
-	foreach ( (array) $user_blogs as $blog ) {
1624
-		$prefix = $wpdb->get_blog_prefix( $blog->userblog_id );
1625
-		$recent_post = $wpdb->get_row( $wpdb->prepare("SELECT ID, post_date_gmt FROM {$prefix}posts WHERE post_author = %d AND post_type = 'post' AND post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1", $user_id ), ARRAY_A);
1623
+	foreach ((array) $user_blogs as $blog) {
1624
+		$prefix = $wpdb->get_blog_prefix($blog->userblog_id);
1625
+		$recent_post = $wpdb->get_row($wpdb->prepare("SELECT ID, post_date_gmt FROM {$prefix}posts WHERE post_author = %d AND post_type = 'post' AND post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1", $user_id), ARRAY_A);
1626 1626
 
1627 1627
 		// Make sure we found a post
1628
-		if ( isset($recent_post['ID']) ) {
1628
+		if (isset($recent_post['ID'])) {
1629 1629
 			$post_gmt_ts = strtotime($recent_post['post_date_gmt']);
1630 1630
 
1631 1631
 			// If this is the first post checked or if this post is
1632 1632
 			// newer than the current recent post, make it the new
1633 1633
 			// most recent post.
1634
-			if ( !isset($most_recent_post['post_gmt_ts']) || ( $post_gmt_ts > $most_recent_post['post_gmt_ts'] ) ) {
1634
+			if ( ! isset($most_recent_post['post_gmt_ts']) || ($post_gmt_ts > $most_recent_post['post_gmt_ts'])) {
1635 1635
 				$most_recent_post = array(
1636 1636
 					'blog_id'		=> $blog->userblog_id,
1637 1637
 					'post_id'		=> $recent_post['ID'],
@@ -1658,24 +1658,24 @@  discard block
 block discarded – undo
1658 1658
  * @param string $directory Full path of a directory.
1659 1659
  * @return int Size of the directory in MB.
1660 1660
  */
1661
-function get_dirsize( $directory ) {
1662
-	$dirsize = get_transient( 'dirsize_cache' );
1663
-	if ( is_array( $dirsize ) && isset( $dirsize[ $directory ][ 'size' ] ) )
1664
-		return $dirsize[ $directory ][ 'size' ];
1661
+function get_dirsize($directory) {
1662
+	$dirsize = get_transient('dirsize_cache');
1663
+	if (is_array($dirsize) && isset($dirsize[$directory]['size']))
1664
+		return $dirsize[$directory]['size'];
1665 1665
 
1666
-	if ( ! is_array( $dirsize ) )
1666
+	if ( ! is_array($dirsize))
1667 1667
 		$dirsize = array();
1668 1668
 
1669 1669
 	// Exclude individual site directories from the total when checking the main site,
1670 1670
 	// as they are subdirectories and should not be counted.
1671
-	if ( is_main_site() ) {
1672
-		$dirsize[ $directory ][ 'size' ] = recurse_dirsize( $directory, $directory . '/sites' );
1671
+	if (is_main_site()) {
1672
+		$dirsize[$directory]['size'] = recurse_dirsize($directory, $directory.'/sites');
1673 1673
 	} else {
1674
-		$dirsize[ $directory ][ 'size' ] = recurse_dirsize( $directory );
1674
+		$dirsize[$directory]['size'] = recurse_dirsize($directory);
1675 1675
 	}
1676 1676
 
1677
-	set_transient( 'dirsize_cache', $dirsize, HOUR_IN_SECONDS );
1678
-	return $dirsize[ $directory ][ 'size' ];
1677
+	set_transient('dirsize_cache', $dirsize, HOUR_IN_SECONDS);
1678
+	return $dirsize[$directory]['size'];
1679 1679
 }
1680 1680
 
1681 1681
 /**
@@ -1691,23 +1691,23 @@  discard block
 block discarded – undo
1691 1691
  * @param string $exclude   Optional. Full path of a subdirectory to exclude from the total.
1692 1692
  * @return int|false Size in MB if a valid directory. False if not.
1693 1693
  */
1694
-function recurse_dirsize( $directory, $exclude = null ) {
1694
+function recurse_dirsize($directory, $exclude = null) {
1695 1695
 	$size = 0;
1696 1696
 
1697
-	$directory = untrailingslashit( $directory );
1697
+	$directory = untrailingslashit($directory);
1698 1698
 
1699
-	if ( ! file_exists( $directory ) || ! is_dir( $directory ) || ! is_readable( $directory ) || $directory === $exclude ) {
1699
+	if ( ! file_exists($directory) || ! is_dir($directory) || ! is_readable($directory) || $directory === $exclude) {
1700 1700
 		return false;
1701 1701
 	}
1702 1702
 
1703 1703
 	if ($handle = opendir($directory)) {
1704
-		while(($file = readdir($handle)) !== false) {
1704
+		while (($file = readdir($handle)) !== false) {
1705 1705
 			$path = $directory.'/'.$file;
1706 1706
 			if ($file != '.' && $file != '..') {
1707 1707
 				if (is_file($path)) {
1708 1708
 					$size += filesize($path);
1709 1709
 				} elseif (is_dir($path)) {
1710
-					$handlesize = recurse_dirsize( $path, $exclude );
1710
+					$handlesize = recurse_dirsize($path, $exclude);
1711 1711
 					if ($handlesize > 0)
1712 1712
 						$size += $handlesize;
1713 1713
 				}
@@ -1732,12 +1732,12 @@  discard block
 block discarded – undo
1732 1732
  * @param array $mimes
1733 1733
  * @return array
1734 1734
  */
1735
-function check_upload_mimes( $mimes ) {
1736
-	$site_exts = explode( ' ', get_site_option( 'upload_filetypes', 'jpg jpeg png gif' ) );
1735
+function check_upload_mimes($mimes) {
1736
+	$site_exts = explode(' ', get_site_option('upload_filetypes', 'jpg jpeg png gif'));
1737 1737
 	$site_mimes = array();
1738
-	foreach ( $site_exts as $ext ) {
1739
-		foreach ( $mimes as $ext_pattern => $mime ) {
1740
-			if ( $ext != '' && strpos( $ext_pattern, $ext ) !== false )
1738
+	foreach ($site_exts as $ext) {
1739
+		foreach ($mimes as $ext_pattern => $mime) {
1740
+			if ($ext != '' && strpos($ext_pattern, $ext) !== false)
1741 1741
 				$site_mimes[$ext_pattern] = $mime;
1742 1742
 		}
1743 1743
 	}
@@ -1758,9 +1758,9 @@  discard block
 block discarded – undo
1758 1758
  *
1759 1759
  * @param string $deprecated Not used.
1760 1760
  */
1761
-function update_posts_count( $deprecated = '' ) {
1761
+function update_posts_count($deprecated = '') {
1762 1762
 	global $wpdb;
1763
-	update_option( 'post_count', (int) $wpdb->get_var( "SELECT COUNT(ID) FROM {$wpdb->posts} WHERE post_status = 'publish' and post_type = 'post'" ) );
1763
+	update_option('post_count', (int) $wpdb->get_var("SELECT COUNT(ID) FROM {$wpdb->posts} WHERE post_status = 'publish' and post_type = 'post'"));
1764 1764
 }
1765 1765
 
1766 1766
 /**
@@ -1773,11 +1773,11 @@  discard block
 block discarded – undo
1773 1773
  * @param int $blog_id
1774 1774
  * @param int $user_id
1775 1775
  */
1776
-function wpmu_log_new_registrations( $blog_id, $user_id ) {
1776
+function wpmu_log_new_registrations($blog_id, $user_id) {
1777 1777
 	global $wpdb;
1778
-	$user = get_userdata( (int) $user_id );
1779
-	if ( $user )
1780
-		$wpdb->insert( $wpdb->registration_log, array('email' => $user->user_email, 'IP' => preg_replace( '/[^0-9., ]/', '', wp_unslash( $_SERVER['REMOTE_ADDR'] ) ), 'blog_id' => $blog_id, 'date_registered' => current_time('mysql')) );
1778
+	$user = get_userdata((int) $user_id);
1779
+	if ($user)
1780
+		$wpdb->insert($wpdb->registration_log, array('email' => $user->user_email, 'IP' => preg_replace('/[^0-9., ]/', '', wp_unslash($_SERVER['REMOTE_ADDR'])), 'blog_id' => $blog_id, 'date_registered' => current_time('mysql')));
1781 1781
 }
1782 1782
 
1783 1783
 /**
@@ -1794,61 +1794,61 @@  discard block
 block discarded – undo
1794 1794
  * @param string $deprecated Not used.
1795 1795
  * @return int An ID from the global terms table mapped from $term_id.
1796 1796
  */
1797
-function global_terms( $term_id, $deprecated = '' ) {
1797
+function global_terms($term_id, $deprecated = '') {
1798 1798
 	global $wpdb;
1799 1799
 	static $global_terms_recurse = null;
1800 1800
 
1801
-	if ( !global_terms_enabled() )
1801
+	if ( ! global_terms_enabled())
1802 1802
 		return $term_id;
1803 1803
 
1804 1804
 	// prevent a race condition
1805 1805
 	$recurse_start = false;
1806
-	if ( $global_terms_recurse === null ) {
1806
+	if ($global_terms_recurse === null) {
1807 1807
 		$recurse_start = true;
1808 1808
 		$global_terms_recurse = 1;
1809
-	} elseif ( 10 < $global_terms_recurse++ ) {
1809
+	} elseif (10 < $global_terms_recurse++) {
1810 1810
 		return $term_id;
1811 1811
 	}
1812 1812
 
1813
-	$term_id = intval( $term_id );
1814
-	$c = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->terms WHERE term_id = %d", $term_id ) );
1813
+	$term_id = intval($term_id);
1814
+	$c = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->terms WHERE term_id = %d", $term_id));
1815 1815
 
1816
-	$global_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM $wpdb->sitecategories WHERE category_nicename = %s", $c->slug ) );
1817
-	if ( $global_id == null ) {
1818
-		$used_global_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM $wpdb->sitecategories WHERE cat_ID = %d", $c->term_id ) );
1819
-		if ( null == $used_global_id ) {
1820
-			$wpdb->insert( $wpdb->sitecategories, array( 'cat_ID' => $term_id, 'cat_name' => $c->name, 'category_nicename' => $c->slug ) );
1816
+	$global_id = $wpdb->get_var($wpdb->prepare("SELECT cat_ID FROM $wpdb->sitecategories WHERE category_nicename = %s", $c->slug));
1817
+	if ($global_id == null) {
1818
+		$used_global_id = $wpdb->get_var($wpdb->prepare("SELECT cat_ID FROM $wpdb->sitecategories WHERE cat_ID = %d", $c->term_id));
1819
+		if (null == $used_global_id) {
1820
+			$wpdb->insert($wpdb->sitecategories, array('cat_ID' => $term_id, 'cat_name' => $c->name, 'category_nicename' => $c->slug));
1821 1821
 			$global_id = $wpdb->insert_id;
1822
-			if ( empty( $global_id ) )
1822
+			if (empty($global_id))
1823 1823
 				return $term_id;
1824 1824
 		} else {
1825
-			$max_global_id = $wpdb->get_var( "SELECT MAX(cat_ID) FROM $wpdb->sitecategories" );
1826
-			$max_local_id = $wpdb->get_var( "SELECT MAX(term_id) FROM $wpdb->terms" );
1827
-			$new_global_id = max( $max_global_id, $max_local_id ) + mt_rand( 100, 400 );
1828
-			$wpdb->insert( $wpdb->sitecategories, array( 'cat_ID' => $new_global_id, 'cat_name' => $c->name, 'category_nicename' => $c->slug ) );
1825
+			$max_global_id = $wpdb->get_var("SELECT MAX(cat_ID) FROM $wpdb->sitecategories");
1826
+			$max_local_id = $wpdb->get_var("SELECT MAX(term_id) FROM $wpdb->terms");
1827
+			$new_global_id = max($max_global_id, $max_local_id) + mt_rand(100, 400);
1828
+			$wpdb->insert($wpdb->sitecategories, array('cat_ID' => $new_global_id, 'cat_name' => $c->name, 'category_nicename' => $c->slug));
1829 1829
 			$global_id = $wpdb->insert_id;
1830 1830
 		}
1831
-	} elseif ( $global_id != $term_id ) {
1832
-		$local_id = $wpdb->get_var( $wpdb->prepare( "SELECT term_id FROM $wpdb->terms WHERE term_id = %d", $global_id ) );
1833
-		if ( null != $local_id ) {
1834
-			global_terms( $local_id );
1835
-			if ( 10 < $global_terms_recurse ) {
1831
+	} elseif ($global_id != $term_id) {
1832
+		$local_id = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms WHERE term_id = %d", $global_id));
1833
+		if (null != $local_id) {
1834
+			global_terms($local_id);
1835
+			if (10 < $global_terms_recurse) {
1836 1836
 				$global_id = $term_id;
1837 1837
 			}
1838 1838
 		}
1839 1839
 	}
1840 1840
 
1841
-	if ( $global_id != $term_id ) {
1842
-		if ( get_option( 'default_category' ) == $term_id )
1843
-			update_option( 'default_category', $global_id );
1841
+	if ($global_id != $term_id) {
1842
+		if (get_option('default_category') == $term_id)
1843
+			update_option('default_category', $global_id);
1844 1844
 
1845
-		$wpdb->update( $wpdb->terms, array('term_id' => $global_id), array('term_id' => $term_id) );
1846
-		$wpdb->update( $wpdb->term_taxonomy, array('term_id' => $global_id), array('term_id' => $term_id) );
1847
-		$wpdb->update( $wpdb->term_taxonomy, array('parent' => $global_id), array('parent' => $term_id) );
1845
+		$wpdb->update($wpdb->terms, array('term_id' => $global_id), array('term_id' => $term_id));
1846
+		$wpdb->update($wpdb->term_taxonomy, array('term_id' => $global_id), array('term_id' => $term_id));
1847
+		$wpdb->update($wpdb->term_taxonomy, array('parent' => $global_id), array('parent' => $term_id));
1848 1848
 
1849 1849
 		clean_term_cache($term_id);
1850 1850
 	}
1851
-	if ( $recurse_start )
1851
+	if ($recurse_start)
1852 1852
 		$global_terms_recurse = null;
1853 1853
 
1854 1854
 	return $global_id;
@@ -1863,8 +1863,8 @@  discard block
 block discarded – undo
1863 1863
  * @param array|string $deprecated Not used.
1864 1864
  * @return array The current site's domain
1865 1865
  */
1866
-function redirect_this_site( $deprecated = '' ) {
1867
-	return array( get_current_site()->domain );
1866
+function redirect_this_site($deprecated = '') {
1867
+	return array(get_current_site()->domain);
1868 1868
 }
1869 1869
 
1870 1870
 /**
@@ -1877,12 +1877,12 @@  discard block
 block discarded – undo
1877 1877
  * @param array $upload
1878 1878
  * @return string|array If the upload is under the size limit, $upload is returned. Otherwise returns an error message.
1879 1879
  */
1880
-function upload_is_file_too_big( $upload ) {
1881
-	if ( ! is_array( $upload ) || defined( 'WP_IMPORTING' ) || get_site_option( 'upload_space_check_disabled' ) )
1880
+function upload_is_file_too_big($upload) {
1881
+	if ( ! is_array($upload) || defined('WP_IMPORTING') || get_site_option('upload_space_check_disabled'))
1882 1882
 		return $upload;
1883 1883
 
1884
-	if ( strlen( $upload['bits'] )  > ( KB_IN_BYTES * get_site_option( 'fileupload_maxk', 1500 ) ) ) {
1885
-		return sprintf( __( 'This file is too big. Files must be less than %d KB in size.' ) . '<br />', get_site_option( 'fileupload_maxk', 1500 ) );
1884
+	if (strlen($upload['bits']) > (KB_IN_BYTES * get_site_option('fileupload_maxk', 1500))) {
1885
+		return sprintf(__('This file is too big. Files must be less than %d KB in size.').'<br />', get_site_option('fileupload_maxk', 1500));
1886 1886
 	}
1887 1887
 
1888 1888
 	return $upload;
@@ -1896,7 +1896,7 @@  discard block
 block discarded – undo
1896 1896
 function signup_nonce_fields() {
1897 1897
 	$id = mt_rand();
1898 1898
 	echo "<input type='hidden' name='signup_form_id' value='{$id}' />";
1899
-	wp_nonce_field('signup_form_' . $id, '_signup_form', false);
1899
+	wp_nonce_field('signup_form_'.$id, '_signup_form', false);
1900 1900
 }
1901 1901
 
1902 1902
 /**
@@ -1907,12 +1907,12 @@  discard block
 block discarded – undo
1907 1907
  * @param array $result
1908 1908
  * @return array
1909 1909
  */
1910
-function signup_nonce_check( $result ) {
1911
-	if ( !strpos( $_SERVER[ 'PHP_SELF' ], 'wp-signup.php' ) )
1910
+function signup_nonce_check($result) {
1911
+	if ( ! strpos($_SERVER['PHP_SELF'], 'wp-signup.php'))
1912 1912
 		return $result;
1913 1913
 
1914
-	if ( wp_create_nonce('signup_form_' . $_POST[ 'signup_form_id' ]) != $_POST['_signup_form'] )
1915
-		wp_die( __( 'Please try again.' ) );
1914
+	if (wp_create_nonce('signup_form_'.$_POST['signup_form_id']) != $_POST['_signup_form'])
1915
+		wp_die(__('Please try again.'));
1916 1916
 
1917 1917
 	return $result;
1918 1918
 }
@@ -1932,10 +1932,10 @@  discard block
 block discarded – undo
1932 1932
 	 *
1933 1933
 	 * @param string $no_blog_redirect The redirect URL defined in NOBLOGREDIRECT.
1934 1934
 	 */
1935
-	if ( is_main_site() && is_404() && defined( 'NOBLOGREDIRECT' ) && ( $destination = apply_filters( 'blog_redirect_404', NOBLOGREDIRECT ) ) ) {
1936
-		if ( $destination == '%siteurl%' )
1935
+	if (is_main_site() && is_404() && defined('NOBLOGREDIRECT') && ($destination = apply_filters('blog_redirect_404', NOBLOGREDIRECT))) {
1936
+		if ($destination == '%siteurl%')
1937 1937
 			$destination = network_home_url();
1938
-		wp_redirect( $destination );
1938
+		wp_redirect($destination);
1939 1939
 		exit();
1940 1940
 	}
1941 1941
 }
@@ -1950,23 +1950,23 @@  discard block
 block discarded – undo
1950 1950
  * @since MU
1951 1951
  */
1952 1952
 function maybe_add_existing_user_to_blog() {
1953
-	if ( false === strpos( $_SERVER[ 'REQUEST_URI' ], '/newbloguser/' ) )
1953
+	if (false === strpos($_SERVER['REQUEST_URI'], '/newbloguser/'))
1954 1954
 		return;
1955 1955
 
1956
-	$parts = explode( '/', $_SERVER[ 'REQUEST_URI' ] );
1957
-	$key = array_pop( $parts );
1956
+	$parts = explode('/', $_SERVER['REQUEST_URI']);
1957
+	$key = array_pop($parts);
1958 1958
 
1959
-	if ( $key == '' )
1960
-		$key = array_pop( $parts );
1959
+	if ($key == '')
1960
+		$key = array_pop($parts);
1961 1961
 
1962
-	$details = get_option( 'new_user_' . $key );
1963
-	if ( !empty( $details ) )
1964
-		delete_option( 'new_user_' . $key );
1962
+	$details = get_option('new_user_'.$key);
1963
+	if ( ! empty($details))
1964
+		delete_option('new_user_'.$key);
1965 1965
 
1966
-	if ( empty( $details ) || is_wp_error( add_existing_user_to_blog( $details ) ) )
1967
-		wp_die( sprintf(__('An error occurred adding you to this site. Back to the <a href="%s">homepage</a>.'), home_url() ) );
1966
+	if (empty($details) || is_wp_error(add_existing_user_to_blog($details)))
1967
+		wp_die(sprintf(__('An error occurred adding you to this site. Back to the <a href="%s">homepage</a>.'), home_url()));
1968 1968
 
1969
-	wp_die( sprintf( __( 'You have been added to this site. Please visit the <a href="%s">homepage</a> or <a href="%s">log in</a> using your username and password.' ), home_url(), admin_url() ), __( 'WordPress &rsaquo; Success' ), array( 'response' => 200 ) );
1969
+	wp_die(sprintf(__('You have been added to this site. Please visit the <a href="%s">homepage</a> or <a href="%s">log in</a> using your username and password.'), home_url(), admin_url()), __('WordPress &rsaquo; Success'), array('response' => 200));
1970 1970
 }
1971 1971
 
1972 1972
 /**
@@ -1979,11 +1979,11 @@  discard block
 block discarded – undo
1979 1979
  * @param array $details
1980 1980
  * @return true|WP_Error|void
1981 1981
  */
1982
-function add_existing_user_to_blog( $details = false ) {
1982
+function add_existing_user_to_blog($details = false) {
1983 1983
 	global $blog_id;
1984 1984
 
1985
-	if ( is_array( $details ) ) {
1986
-		$result = add_user_to_blog( $blog_id, $details[ 'user_id' ], $details[ 'role' ] );
1985
+	if (is_array($details)) {
1986
+		$result = add_user_to_blog($blog_id, $details['user_id'], $details['role']);
1987 1987
 		/**
1988 1988
 		 * Fires immediately after an existing user is added to a site.
1989 1989
 		 *
@@ -1992,7 +1992,7 @@  discard block
 block discarded – undo
1992 1992
 		 * @param int   $user_id User ID.
1993 1993
 		 * @param mixed $result  True on success or a WP_Error object if the user doesn't exist.
1994 1994
 		 */
1995
-		do_action( 'added_existing_user', $details['user_id'], $result );
1995
+		do_action('added_existing_user', $details['user_id'], $result);
1996 1996
 		return $result;
1997 1997
 	}
1998 1998
 }
@@ -2010,13 +2010,13 @@  discard block
 block discarded – undo
2010 2010
  * @param mixed $password Ignored.
2011 2011
  * @param array $meta
2012 2012
  */
2013
-function add_new_user_to_blog( $user_id, $password, $meta ) {
2014
-	if ( !empty( $meta[ 'add_to_blog' ] ) ) {
2015
-		$blog_id = $meta[ 'add_to_blog' ];
2016
-		$role = $meta[ 'new_role' ];
2013
+function add_new_user_to_blog($user_id, $password, $meta) {
2014
+	if ( ! empty($meta['add_to_blog'])) {
2015
+		$blog_id = $meta['add_to_blog'];
2016
+		$role = $meta['new_role'];
2017 2017
 		remove_user_from_blog($user_id, get_current_site()->blog_id); // remove user from main blog.
2018
-		add_user_to_blog( $blog_id, $user_id, $role );
2019
-		update_user_meta( $user_id, 'primary_blog', $blog_id );
2018
+		add_user_to_blog($blog_id, $user_id, $role);
2019
+		update_user_meta($user_id, 'primary_blog', $blog_id);
2020 2020
 	}
2021 2021
 }
2022 2022
 
@@ -2027,7 +2027,7 @@  discard block
 block discarded – undo
2027 2027
  *
2028 2028
  * @param PHPMailer $phpmailer The PHPMailer instance, passed by reference.
2029 2029
  */
2030
-function fix_phpmailer_messageid( $phpmailer ) {
2030
+function fix_phpmailer_messageid($phpmailer) {
2031 2031
 	$phpmailer->Hostname = get_current_site()->domain;
2032 2032
 }
2033 2033
 
@@ -2040,16 +2040,16 @@  discard block
 block discarded – undo
2040 2040
  * 	                           or user login name as a string.
2041 2041
  * @return bool
2042 2042
  */
2043
-function is_user_spammy( $user = null ) {
2044
-    if ( ! ( $user instanceof WP_User ) ) {
2045
-		if ( $user ) {
2046
-			$user = get_user_by( 'login', $user );
2043
+function is_user_spammy($user = null) {
2044
+    if ( ! ($user instanceof WP_User)) {
2045
+		if ($user) {
2046
+			$user = get_user_by('login', $user);
2047 2047
 		} else {
2048 2048
 			$user = wp_get_current_user();
2049 2049
 		}
2050 2050
 	}
2051 2051
 
2052
-	return $user && isset( $user->spam ) && 1 == $user->spam;
2052
+	return $user && isset($user->spam) && 1 == $user->spam;
2053 2053
 }
2054 2054
 
2055 2055
 /**
@@ -2062,8 +2062,8 @@  discard block
 block discarded – undo
2062 2062
  * @param int $old_value
2063 2063
  * @param int $value     The new public value
2064 2064
  */
2065
-function update_blog_public( $old_value, $value ) {
2066
-	update_blog_status( get_current_blog_id(), 'public', (int) $value );
2065
+function update_blog_public($old_value, $value) {
2066
+	update_blog_status(get_current_blog_id(), 'public', (int) $value);
2067 2067
 }
2068 2068
 
2069 2069
 /**
@@ -2078,16 +2078,16 @@  discard block
 block discarded – undo
2078 2078
  * @param int    $blog_id Optional. Defaults to current blog.
2079 2079
  * @return bool
2080 2080
  */
2081
-function is_user_option_local( $key, $user_id = 0, $blog_id = 0 ) {
2081
+function is_user_option_local($key, $user_id = 0, $blog_id = 0) {
2082 2082
 	global $wpdb;
2083 2083
 
2084 2084
 	$current_user = wp_get_current_user();
2085
-	if ( $blog_id == 0 ) {
2085
+	if ($blog_id == 0) {
2086 2086
 		$blog_id = $wpdb->blogid;
2087 2087
 	}
2088
-	$local_key = $wpdb->get_blog_prefix( $blog_id ) . $key;
2088
+	$local_key = $wpdb->get_blog_prefix($blog_id).$key;
2089 2089
 
2090
-	return isset( $current_user->$local_key );
2090
+	return isset($current_user->$local_key);
2091 2091
 }
2092 2092
 
2093 2093
 /**
@@ -2099,7 +2099,7 @@  discard block
 block discarded – undo
2099 2099
  */
2100 2100
 function users_can_register_signup_filter() {
2101 2101
 	$registration = get_site_option('registration');
2102
-	return ( $registration == 'all' || $registration == 'user' );
2102
+	return ($registration == 'all' || $registration == 'user');
2103 2103
 }
2104 2104
 
2105 2105
 /**
@@ -2110,12 +2110,12 @@  discard block
 block discarded – undo
2110 2110
  * @param string $text
2111 2111
  * @return string
2112 2112
  */
2113
-function welcome_user_msg_filter( $text ) {
2114
-	if ( !$text ) {
2115
-		remove_filter( 'site_option_welcome_user_email', 'welcome_user_msg_filter' );
2113
+function welcome_user_msg_filter($text) {
2114
+	if ( ! $text) {
2115
+		remove_filter('site_option_welcome_user_email', 'welcome_user_msg_filter');
2116 2116
 
2117 2117
 		/* translators: Do not translate USERNAME, PASSWORD, LOGINLINK, SITE_NAME: those are placeholders. */
2118
-		$text = __( 'Howdy USERNAME,
2118
+		$text = __('Howdy USERNAME,
2119 2119
 
2120 2120
 Your new account is set up.
2121 2121
 
@@ -2127,7 +2127,7 @@  discard block
 block discarded – undo
2127 2127
 Thanks!
2128 2128
 
2129 2129
 --The Team @ SITE_NAME' );
2130
-		update_site_option( 'welcome_user_email', $text );
2130
+		update_site_option('welcome_user_email', $text);
2131 2131
 	}
2132 2132
 	return $text;
2133 2133
 }
@@ -2142,10 +2142,10 @@  discard block
 block discarded – undo
2142 2142
  * @param bool $force
2143 2143
  * @return bool True if forced, false if not forced.
2144 2144
  */
2145
-function force_ssl_content( $force = '' ) {
2145
+function force_ssl_content($force = '') {
2146 2146
 	static $forced_content = false;
2147 2147
 
2148
-	if ( '' != $force ) {
2148
+	if ('' != $force) {
2149 2149
 		$old_forced = $forced_content;
2150 2150
 		$forced_content = $force;
2151 2151
 		return $old_forced;
@@ -2164,12 +2164,12 @@  discard block
 block discarded – undo
2164 2164
  * @param string $url URL
2165 2165
  * @return string URL with https as the scheme
2166 2166
  */
2167
-function filter_SSL( $url ) {
2168
-	if ( ! is_string( $url ) )
2169
-		return get_bloginfo( 'url' ); // Return home blog url with proper scheme
2167
+function filter_SSL($url) {
2168
+	if ( ! is_string($url))
2169
+		return get_bloginfo('url'); // Return home blog url with proper scheme
2170 2170
 
2171
-	if ( force_ssl_content() && is_ssl() )
2172
-		$url = set_url_scheme( $url, 'https' );
2171
+	if (force_ssl_content() && is_ssl())
2172
+		$url = set_url_scheme($url, 'https');
2173 2173
 
2174 2174
 	return $url;
2175 2175
 }
@@ -2180,10 +2180,10 @@  discard block
 block discarded – undo
2180 2180
  * @since 3.1.0
2181 2181
  */
2182 2182
 function wp_schedule_update_network_counts() {
2183
-	if ( !is_main_site() )
2183
+	if ( ! is_main_site())
2184 2184
 		return;
2185 2185
 
2186
-	if ( ! wp_next_scheduled('update_network_counts') && ! wp_installing() )
2186
+	if ( ! wp_next_scheduled('update_network_counts') && ! wp_installing())
2187 2187
 		wp_schedule_event(time(), 'twicedaily', 'update_network_counts');
2188 2188
 }
2189 2189
 
@@ -2206,7 +2206,7 @@  discard block
 block discarded – undo
2206 2206
  * @since 3.7.0
2207 2207
  */
2208 2208
 function wp_maybe_update_network_site_counts() {
2209
-	$is_small_network = ! wp_is_large_network( 'sites' );
2209
+	$is_small_network = ! wp_is_large_network('sites');
2210 2210
 
2211 2211
 	/**
2212 2212
 	 * Filter whether to update network site or user counts when a new site is created.
@@ -2218,7 +2218,7 @@  discard block
 block discarded – undo
2218 2218
 	 * @param bool   $small_network Whether the network is considered small.
2219 2219
 	 * @param string $context       Context. Either 'users' or 'sites'.
2220 2220
 	 */
2221
-	if ( ! apply_filters( 'enable_live_network_counts', $is_small_network, 'sites' ) )
2221
+	if ( ! apply_filters('enable_live_network_counts', $is_small_network, 'sites'))
2222 2222
 		return;
2223 2223
 
2224 2224
 	wp_update_network_site_counts();
@@ -2233,10 +2233,10 @@  discard block
 block discarded – undo
2233 2233
  * @since 3.7.0
2234 2234
  */
2235 2235
 function wp_maybe_update_network_user_counts() {
2236
-	$is_small_network = ! wp_is_large_network( 'users' );
2236
+	$is_small_network = ! wp_is_large_network('users');
2237 2237
 
2238 2238
 	/** This filter is documented in wp-includes/ms-functions.php */
2239
-	if ( ! apply_filters( 'enable_live_network_counts', $is_small_network, 'users' ) )
2239
+	if ( ! apply_filters('enable_live_network_counts', $is_small_network, 'users'))
2240 2240
 		return;
2241 2241
 
2242 2242
 	wp_update_network_user_counts();
@@ -2252,8 +2252,8 @@  discard block
 block discarded – undo
2252 2252
 function wp_update_network_site_counts() {
2253 2253
 	global $wpdb;
2254 2254
 
2255
-	$count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(blog_id) as c FROM $wpdb->blogs WHERE site_id = %d AND spam = '0' AND deleted = '0' and archived = '0'", $wpdb->siteid) );
2256
-	update_site_option( 'blog_count', $count );
2255
+	$count = $wpdb->get_var($wpdb->prepare("SELECT COUNT(blog_id) as c FROM $wpdb->blogs WHERE site_id = %d AND spam = '0' AND deleted = '0' and archived = '0'", $wpdb->siteid));
2256
+	update_site_option('blog_count', $count);
2257 2257
 }
2258 2258
 
2259 2259
 /**
@@ -2266,8 +2266,8 @@  discard block
 block discarded – undo
2266 2266
 function wp_update_network_user_counts() {
2267 2267
 	global $wpdb;
2268 2268
 
2269
-	$count = $wpdb->get_var( "SELECT COUNT(ID) as c FROM $wpdb->users WHERE spam = '0' AND deleted = '0'" );
2270
-	update_site_option( 'user_count', $count );
2269
+	$count = $wpdb->get_var("SELECT COUNT(ID) as c FROM $wpdb->users WHERE spam = '0' AND deleted = '0'");
2270
+	update_site_option('user_count', $count);
2271 2271
 }
2272 2272
 
2273 2273
 /**
@@ -2285,10 +2285,10 @@  discard block
 block discarded – undo
2285 2285
 	 *
2286 2286
 	 * @param int|bool $space_used The amount of used space, in megabytes. Default false.
2287 2287
 	 */
2288
-	$space_used = apply_filters( 'pre_get_space_used', false );
2289
-	if ( false === $space_used ) {
2288
+	$space_used = apply_filters('pre_get_space_used', false);
2289
+	if (false === $space_used) {
2290 2290
 		$upload_dir = wp_upload_dir();
2291
-		$space_used = get_dirsize( $upload_dir['basedir'] ) / MB_IN_BYTES;
2291
+		$space_used = get_dirsize($upload_dir['basedir']) / MB_IN_BYTES;
2292 2292
 	}
2293 2293
 
2294 2294
 	return $space_used;
@@ -2302,12 +2302,12 @@  discard block
 block discarded – undo
2302 2302
  * @return int Quota in megabytes
2303 2303
  */
2304 2304
 function get_space_allowed() {
2305
-	$space_allowed = get_option( 'blog_upload_space' );
2305
+	$space_allowed = get_option('blog_upload_space');
2306 2306
 
2307
-	if ( ! is_numeric( $space_allowed ) )
2308
-		$space_allowed = get_site_option( 'blog_upload_space' );
2307
+	if ( ! is_numeric($space_allowed))
2308
+		$space_allowed = get_site_option('blog_upload_space');
2309 2309
 
2310
-	if ( ! is_numeric( $space_allowed ) )
2310
+	if ( ! is_numeric($space_allowed))
2311 2311
 		$space_allowed = 100;
2312 2312
 
2313 2313
 	/**
@@ -2317,7 +2317,7 @@  discard block
 block discarded – undo
2317 2317
 	 *
2318 2318
 	 * @param int $space_allowed Upload quota in megabytes for the current blog.
2319 2319
 	 */
2320
-	return apply_filters( 'get_space_allowed', $space_allowed );
2320
+	return apply_filters('get_space_allowed', $space_allowed);
2321 2321
 }
2322 2322
 
2323 2323
 /**
@@ -2329,16 +2329,16 @@  discard block
 block discarded – undo
2329 2329
  */
2330 2330
 function get_upload_space_available() {
2331 2331
 	$allowed = get_space_allowed();
2332
-	if ( $allowed < 0 ) {
2332
+	if ($allowed < 0) {
2333 2333
 		$allowed = 0;
2334 2334
 	}
2335 2335
 	$space_allowed = $allowed * MB_IN_BYTES;
2336
-	if ( get_site_option( 'upload_space_check_disabled' ) )
2336
+	if (get_site_option('upload_space_check_disabled'))
2337 2337
 		return $space_allowed;
2338 2338
 
2339 2339
 	$space_used = get_space_used() * MB_IN_BYTES;
2340 2340
 
2341
-	if ( ( $space_allowed - $space_used ) <= 0 )
2341
+	if (($space_allowed - $space_used) <= 0)
2342 2342
 		return 0;
2343 2343
 
2344 2344
 	return $space_allowed - $space_used;
@@ -2351,7 +2351,7 @@  discard block
 block discarded – undo
2351 2351
  * @return bool True if space is available, false otherwise.
2352 2352
  */
2353 2353
 function is_upload_space_available() {
2354
-	if ( get_site_option( 'upload_space_check_disabled' ) )
2354
+	if (get_site_option('upload_space_check_disabled'))
2355 2355
 		return true;
2356 2356
 
2357 2357
 	return (bool) get_upload_space_available();
@@ -2365,12 +2365,12 @@  discard block
 block discarded – undo
2365 2365
  * @param  int $size Upload size limit in bytes.
2366 2366
  * @return int       Upload size limit in bytes.
2367 2367
  */
2368
-function upload_size_limit_filter( $size ) {
2369
-	$fileupload_maxk = KB_IN_BYTES * get_site_option( 'fileupload_maxk', 1500 );
2370
-	if ( get_site_option( 'upload_space_check_disabled' ) )
2371
-		return min( $size, $fileupload_maxk );
2368
+function upload_size_limit_filter($size) {
2369
+	$fileupload_maxk = KB_IN_BYTES * get_site_option('fileupload_maxk', 1500);
2370
+	if (get_site_option('upload_space_check_disabled'))
2371
+		return min($size, $fileupload_maxk);
2372 2372
 
2373
-	return min( $size, $fileupload_maxk, get_upload_space_available() );
2373
+	return min($size, $fileupload_maxk, get_upload_space_available());
2374 2374
 }
2375 2375
 
2376 2376
 /**
@@ -2383,8 +2383,8 @@  discard block
 block discarded – undo
2383 2383
  * @param string $using 'sites or 'users'. Default is 'sites'.
2384 2384
  * @return bool True if the network meets the criteria for large. False otherwise.
2385 2385
  */
2386
-function wp_is_large_network( $using = 'sites' ) {
2387
-	if ( 'users' == $using ) {
2386
+function wp_is_large_network($using = 'sites') {
2387
+	if ('users' == $using) {
2388 2388
 		$count = get_user_count();
2389 2389
 		/**
2390 2390
 		 * Filter whether the network is considered large.
@@ -2395,12 +2395,12 @@  discard block
 block discarded – undo
2395 2395
 		 * @param string $component        The component to count. Accepts 'users', or 'sites'.
2396 2396
 		 * @param int    $count            The count of items for the component.
2397 2397
 		 */
2398
-		return apply_filters( 'wp_is_large_network', $count > 10000, 'users', $count );
2398
+		return apply_filters('wp_is_large_network', $count > 10000, 'users', $count);
2399 2399
 	}
2400 2400
 
2401 2401
 	$count = get_blog_count();
2402 2402
 	/** This filter is documented in wp-includes/ms-functions.php */
2403
-	return apply_filters( 'wp_is_large_network', $count > 10000, 'sites', $count );
2403
+	return apply_filters('wp_is_large_network', $count > 10000, 'sites', $count);
2404 2404
 }
2405 2405
 
2406 2406
 
@@ -2429,10 +2429,10 @@  discard block
 block discarded – undo
2429 2429
  *               site domain and path, dates registered and modified, and the language ID. Also, boolean
2430 2430
  *               values for whether the site is public, archived, mature, spam, and/or deleted.
2431 2431
  */
2432
-function wp_get_sites( $args = array() ) {
2432
+function wp_get_sites($args = array()) {
2433 2433
 	global $wpdb;
2434 2434
 
2435
-	if ( wp_is_large_network() )
2435
+	if (wp_is_large_network())
2436 2436
 		return array();
2437 2437
 
2438 2438
 	$defaults = array(
@@ -2446,38 +2446,38 @@  discard block
 block discarded – undo
2446 2446
 		'offset'     => 0,
2447 2447
 	);
2448 2448
 
2449
-	$args = wp_parse_args( $args, $defaults );
2449
+	$args = wp_parse_args($args, $defaults);
2450 2450
 
2451 2451
 	$query = "SELECT * FROM $wpdb->blogs WHERE 1=1 ";
2452 2452
 
2453
-	if ( isset( $args['network_id'] ) && ( is_array( $args['network_id'] ) || is_numeric( $args['network_id'] ) ) ) {
2454
-		$network_ids = implode( ',', wp_parse_id_list( $args['network_id'] ) );
2453
+	if (isset($args['network_id']) && (is_array($args['network_id']) || is_numeric($args['network_id']))) {
2454
+		$network_ids = implode(',', wp_parse_id_list($args['network_id']));
2455 2455
 		$query .= "AND site_id IN ($network_ids) ";
2456 2456
 	}
2457 2457
 
2458
-	if ( isset( $args['public'] ) )
2459
-		$query .= $wpdb->prepare( "AND public = %d ", $args['public'] );
2458
+	if (isset($args['public']))
2459
+		$query .= $wpdb->prepare("AND public = %d ", $args['public']);
2460 2460
 
2461
-	if ( isset( $args['archived'] ) )
2462
-		$query .= $wpdb->prepare( "AND archived = %d ", $args['archived'] );
2461
+	if (isset($args['archived']))
2462
+		$query .= $wpdb->prepare("AND archived = %d ", $args['archived']);
2463 2463
 
2464
-	if ( isset( $args['mature'] ) )
2465
-		$query .= $wpdb->prepare( "AND mature = %d ", $args['mature'] );
2464
+	if (isset($args['mature']))
2465
+		$query .= $wpdb->prepare("AND mature = %d ", $args['mature']);
2466 2466
 
2467
-	if ( isset( $args['spam'] ) )
2468
-		$query .= $wpdb->prepare( "AND spam = %d ", $args['spam'] );
2467
+	if (isset($args['spam']))
2468
+		$query .= $wpdb->prepare("AND spam = %d ", $args['spam']);
2469 2469
 
2470
-	if ( isset( $args['deleted'] ) )
2471
-		$query .= $wpdb->prepare( "AND deleted = %d ", $args['deleted'] );
2470
+	if (isset($args['deleted']))
2471
+		$query .= $wpdb->prepare("AND deleted = %d ", $args['deleted']);
2472 2472
 
2473
-	if ( isset( $args['limit'] ) && $args['limit'] ) {
2474
-		if ( isset( $args['offset'] ) && $args['offset'] )
2475
-			$query .= $wpdb->prepare( "LIMIT %d , %d ", $args['offset'], $args['limit'] );
2473
+	if (isset($args['limit']) && $args['limit']) {
2474
+		if (isset($args['offset']) && $args['offset'])
2475
+			$query .= $wpdb->prepare("LIMIT %d , %d ", $args['offset'], $args['limit']);
2476 2476
 		else
2477
-			$query .= $wpdb->prepare( "LIMIT %d ", $args['limit'] );
2477
+			$query .= $wpdb->prepare("LIMIT %d ", $args['limit']);
2478 2478
 	}
2479 2479
 
2480
-	$site_results = $wpdb->get_results( $query, ARRAY_A );
2480
+	$site_results = $wpdb->get_results($query, ARRAY_A);
2481 2481
 
2482 2482
 	return $site_results;
2483 2483
 }
@@ -2504,5 +2504,5 @@  discard block
 block discarded – undo
2504 2504
 	 *
2505 2505
 	 * @param array $subdirectory_reserved_names Array of reserved names.
2506 2506
 	 */
2507
-	return apply_filters( 'subdirectory_reserved_names', $names );
2507
+	return apply_filters('subdirectory_reserved_names', $names);
2508 2508
 }
Please login to merge, or discard this patch.
Braces   +303 added lines, -207 removed lines patch added patch discarded remove patch
@@ -42,11 +42,13 @@  discard block
 block discarded – undo
42 42
 function get_active_blog_for_user( $user_id ) {
43 43
 	global $wpdb;
44 44
 	$blogs = get_blogs_of_user( $user_id );
45
-	if ( empty( $blogs ) )
46
-		return;
45
+	if ( empty( $blogs ) ) {
46
+			return;
47
+	}
47 48
 
48
-	if ( !is_multisite() )
49
-		return $blogs[$wpdb->blogid];
49
+	if ( !is_multisite() ) {
50
+			return $blogs[$wpdb->blogid];
51
+	}
50 52
 
51 53
 	$primary_blog = get_user_meta( $user_id, 'primary_blog', true );
52 54
 	$first_blog = current($blogs);
@@ -69,15 +71,18 @@  discard block
 block discarded – undo
69 71
 		$ret = false;
70 72
 		if ( is_array( $blogs ) && count( $blogs ) > 0 ) {
71 73
 			foreach ( (array) $blogs as $blog_id => $blog ) {
72
-				if ( $blog->site_id != $wpdb->siteid )
73
-					continue;
74
+				if ( $blog->site_id != $wpdb->siteid ) {
75
+									continue;
76
+				}
74 77
 				$details = get_blog_details( $blog_id );
75 78
 				if ( is_object( $details ) && $details->archived == 0 && $details->spam == 0 && $details->deleted == 0 ) {
76 79
 					$ret = $blog;
77
-					if ( get_user_meta( $user_id , 'primary_blog', true ) != $blog_id )
78
-						update_user_meta( $user_id, 'primary_blog', $blog_id );
79
-					if ( !get_user_meta($user_id , 'source_domain', true) )
80
-						update_user_meta( $user_id, 'source_domain', $blog->domain );
80
+					if ( get_user_meta( $user_id , 'primary_blog', true ) != $blog_id ) {
81
+											update_user_meta( $user_id, 'primary_blog', $blog_id );
82
+					}
83
+					if ( !get_user_meta($user_id , 'source_domain', true) ) {
84
+											update_user_meta( $user_id, 'source_domain', $blog->domain );
85
+					}
81 86
 					break;
82 87
 				}
83 88
 			}
@@ -114,8 +119,9 @@  discard block
 block discarded – undo
114 119
  * @return int
115 120
  */
116 121
 function get_blog_count( $network_id = 0 ) {
117
-	if ( func_num_args() )
118
-		_deprecated_argument( __FUNCTION__, '3.1' );
122
+	if ( func_num_args() ) {
123
+			_deprecated_argument( __FUNCTION__, '3.1' );
124
+	}
119 125
 
120 126
 	return get_site_option( 'blog_count' );
121 127
 }
@@ -224,8 +230,9 @@  discard block
 block discarded – undo
224 230
 		$new_domain = '';
225 231
 		$blogs = get_blogs_of_user($user_id);
226 232
 		foreach ( (array) $blogs as $blog ) {
227
-			if ( $blog->userblog_id == $blog_id )
228
-				continue;
233
+			if ( $blog->userblog_id == $blog_id ) {
234
+							continue;
235
+			}
229 236
 			$new_id = $blog->userblog_id;
230 237
 			$new_domain = $blog->domain;
231 238
 			break;
@@ -311,10 +318,12 @@  discard block
 block discarded – undo
311 318
 	$path = strtolower( $path );
312 319
 	$id = wp_cache_get( md5( $domain . $path ), 'blog-id-cache' );
313 320
 
314
-	if ( $id == -1 ) // blog does not exist
321
+	if ( $id == -1 ) {
322
+		// blog does not exist
315 323
 		return 0;
316
-	elseif ( $id )
317
-		return (int) $id;
324
+	} elseif ( $id ) {
325
+			return (int) $id;
326
+	}
318 327
 
319 328
 	$id = $wpdb->get_var( $wpdb->prepare( "SELECT blog_id FROM $wpdb->blogs WHERE domain = %s and path = %s /* get_blog_id_from_url */", $domain, $path ) );
320 329
 
@@ -345,8 +354,9 @@  discard block
 block discarded – undo
345 354
  */
346 355
 function is_email_address_unsafe( $user_email ) {
347 356
 	$banned_names = get_site_option( 'banned_email_domains' );
348
-	if ( $banned_names && ! is_array( $banned_names ) )
349
-		$banned_names = explode( "\n", $banned_names );
357
+	if ( $banned_names && ! is_array( $banned_names ) ) {
358
+			$banned_names = explode( "\n", $banned_names );
359
+	}
350 360
 
351 361
 	$is_email_address_unsafe = false;
352 362
 
@@ -357,8 +367,9 @@  discard block
 block discarded – undo
357 367
 		list( $email_local_part, $email_domain ) = explode( '@', $normalized_email );
358 368
 
359 369
 		foreach ( $banned_names as $banned_domain ) {
360
-			if ( ! $banned_domain )
361
-				continue;
370
+			if ( ! $banned_domain ) {
371
+							continue;
372
+			}
362 373
 
363 374
 			if ( $email_domain == $banned_domain ) {
364 375
 				$is_email_address_unsafe = true;
@@ -419,8 +430,9 @@  discard block
 block discarded – undo
419 430
 
420 431
 	$user_email = sanitize_email( $user_email );
421 432
 
422
-	if ( empty( $user_name ) )
423
-	   	$errors->add('user_name', __( 'Please enter a username.' ) );
433
+	if ( empty( $user_name ) ) {
434
+		   	$errors->add('user_name', __( 'Please enter a username.' ) );
435
+	}
424 436
 
425 437
 	$illegal_names = get_site_option( 'illegal_names' );
426 438
 	if ( ! is_array( $illegal_names ) ) {
@@ -438,22 +450,26 @@  discard block
 block discarded – undo
438 450
 		$errors->add( 'user_name',  __( 'Sorry, that username is not allowed.' ) );
439 451
 	}
440 452
 
441
-	if ( is_email_address_unsafe( $user_email ) )
442
-		$errors->add('user_email',  __('You cannot use that email address to signup. We are having problems with them blocking some of our email. Please use another email provider.'));
453
+	if ( is_email_address_unsafe( $user_email ) ) {
454
+			$errors->add('user_email',  __('You cannot use that email address to signup. We are having problems with them blocking some of our email. Please use another email provider.'));
455
+	}
443 456
 
444
-	if ( strlen( $user_name ) < 4 )
445
-		$errors->add('user_name',  __( 'Username must be at least 4 characters.' ) );
457
+	if ( strlen( $user_name ) < 4 ) {
458
+			$errors->add('user_name',  __( 'Username must be at least 4 characters.' ) );
459
+	}
446 460
 
447 461
 	if ( strlen( $user_name ) > 60 ) {
448 462
 		$errors->add( 'user_name', __( 'Username may not be longer than 60 characters.' ) );
449 463
 	}
450 464
 
451 465
 	// all numeric?
452
-	if ( preg_match( '/^[0-9]*$/', $user_name ) )
453
-		$errors->add('user_name', __('Sorry, usernames must have letters too!'));
466
+	if ( preg_match( '/^[0-9]*$/', $user_name ) ) {
467
+			$errors->add('user_name', __('Sorry, usernames must have letters too!'));
468
+	}
454 469
 
455
-	if ( !is_email( $user_email ) )
456
-		$errors->add('user_email', __( 'Please enter a valid email address.' ) );
470
+	if ( !is_email( $user_email ) ) {
471
+			$errors->add('user_email', __( 'Please enter a valid email address.' ) );
472
+	}
457 473
 
458 474
 	$limited_email_domains = get_site_option( 'limited_email_domains' );
459 475
 	if ( is_array( $limited_email_domains ) && ! empty( $limited_email_domains ) ) {
@@ -464,12 +480,14 @@  discard block
 block discarded – undo
464 480
 	}
465 481
 
466 482
 	// Check if the username has been used already.
467
-	if ( username_exists($user_name) )
468
-		$errors->add( 'user_name', __( 'Sorry, that username already exists!' ) );
483
+	if ( username_exists($user_name) ) {
484
+			$errors->add( 'user_name', __( 'Sorry, that username already exists!' ) );
485
+	}
469 486
 
470 487
 	// Check if the email address has been used already.
471
-	if ( email_exists($user_email) )
472
-		$errors->add( 'user_email', __( 'Sorry, that email address is already used!' ) );
488
+	if ( email_exists($user_email) ) {
489
+			$errors->add( 'user_email', __( 'Sorry, that email address is already used!' ) );
490
+	}
473 491
 
474 492
 	// Has someone already signed up for this username?
475 493
 	$signup = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->signups WHERE user_login = %s", $user_name) );
@@ -478,20 +496,22 @@  discard block
 block discarded – undo
478 496
 		$now = current_time( 'timestamp', true );
479 497
 		$diff = $now - $registered_at;
480 498
 		// If registered more than two days ago, cancel registration and let this signup go through.
481
-		if ( $diff > 2 * DAY_IN_SECONDS )
482
-			$wpdb->delete( $wpdb->signups, array( 'user_login' => $user_name ) );
483
-		else
484
-			$errors->add('user_name', __('That username is currently reserved but may be available in a couple of days.'));
499
+		if ( $diff > 2 * DAY_IN_SECONDS ) {
500
+					$wpdb->delete( $wpdb->signups, array( 'user_login' => $user_name ) );
501
+		} else {
502
+					$errors->add('user_name', __('That username is currently reserved but may be available in a couple of days.'));
503
+		}
485 504
 	}
486 505
 
487 506
 	$signup = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->signups WHERE user_email = %s", $user_email) );
488 507
 	if ( $signup != null ) {
489 508
 		$diff = current_time( 'timestamp', true ) - mysql2date('U', $signup->registered);
490 509
 		// If registered more than two days ago, cancel registration and let this signup go through.
491
-		if ( $diff > 2 * DAY_IN_SECONDS )
492
-			$wpdb->delete( $wpdb->signups, array( 'user_email' => $user_email ) );
493
-		else
494
-			$errors->add('user_email', __('That email address has already been used. Please check your inbox for an activation email. It will become available in a couple of days if you do nothing.'));
510
+		if ( $diff > 2 * DAY_IN_SECONDS ) {
511
+					$wpdb->delete( $wpdb->signups, array( 'user_email' => $user_email ) );
512
+		} else {
513
+					$errors->add('user_email', __('That email address has already been used. Please check your inbox for an activation email. It will become available in a couple of days if you do nothing.'));
514
+		}
495 515
 	}
496 516
 
497 517
 	$result = array('user_name' => $user_name, 'orig_username' => $orig_username, 'user_email' => $user_email, 'errors' => $errors);
@@ -563,26 +583,31 @@  discard block
 block discarded – undo
563 583
 		$illegal_names = array_merge( $illegal_names, get_subdirectory_reserved_names() );
564 584
 	}
565 585
 
566
-	if ( empty( $blogname ) )
567
-		$errors->add('blogname', __( 'Please enter a site name.' ) );
586
+	if ( empty( $blogname ) ) {
587
+			$errors->add('blogname', __( 'Please enter a site name.' ) );
588
+	}
568 589
 
569 590
 	if ( preg_match( '/[^a-z0-9]+/', $blogname ) ) {
570 591
 		$errors->add( 'blogname', __( 'Site names can only contain lowercase letters (a-z) and numbers.' ) );
571 592
 	}
572 593
 
573
-	if ( in_array( $blogname, $illegal_names ) )
574
-		$errors->add('blogname',  __( 'That name is not allowed.' ) );
594
+	if ( in_array( $blogname, $illegal_names ) ) {
595
+			$errors->add('blogname',  __( 'That name is not allowed.' ) );
596
+	}
575 597
 
576
-	if ( strlen( $blogname ) < 4 && !is_super_admin() )
577
-		$errors->add('blogname',  __( 'Site name must be at least 4 characters.' ) );
598
+	if ( strlen( $blogname ) < 4 && !is_super_admin() ) {
599
+			$errors->add('blogname',  __( 'Site name must be at least 4 characters.' ) );
600
+	}
578 601
 
579 602
 	// do not allow users to create a blog that conflicts with a page on the main blog.
580
-	if ( !is_subdomain_install() && $wpdb->get_var( $wpdb->prepare( "SELECT post_name FROM " . $wpdb->get_blog_prefix( $current_site->blog_id ) . "posts WHERE post_type = 'page' AND post_name = %s", $blogname ) ) )
581
-		$errors->add( 'blogname', __( 'Sorry, you may not use that site name.' ) );
603
+	if ( !is_subdomain_install() && $wpdb->get_var( $wpdb->prepare( "SELECT post_name FROM " . $wpdb->get_blog_prefix( $current_site->blog_id ) . "posts WHERE post_type = 'page' AND post_name = %s", $blogname ) ) ) {
604
+			$errors->add( 'blogname', __( 'Sorry, you may not use that site name.' ) );
605
+	}
582 606
 
583 607
 	// all numeric?
584
-	if ( preg_match( '/^[0-9]*$/', $blogname ) )
585
-		$errors->add('blogname', __('Sorry, site names must have letters too!'));
608
+	if ( preg_match( '/^[0-9]*$/', $blogname ) ) {
609
+			$errors->add('blogname', __('Sorry, site names must have letters too!'));
610
+	}
586 611
 
587 612
 	/**
588 613
 	 * Filter the new site name during registration.
@@ -598,8 +623,9 @@  discard block
 block discarded – undo
598 623
 
599 624
 	$blog_title = wp_unslash(  $blog_title );
600 625
 
601
-	if ( empty( $blog_title ) )
602
-		$errors->add('blog_title', __( 'Please enter a site title.' ) );
626
+	if ( empty( $blog_title ) ) {
627
+			$errors->add('blog_title', __( 'Please enter a site title.' ) );
628
+	}
603 629
 
604 630
 	// Check if the domain/path has been used already.
605 631
 	if ( is_subdomain_install() ) {
@@ -609,12 +635,14 @@  discard block
 block discarded – undo
609 635
 		$mydomain = "$domain";
610 636
 		$path = $base.$blogname.'/';
611 637
 	}
612
-	if ( domain_exists($mydomain, $path, $current_site->id) )
613
-		$errors->add( 'blogname', __( 'Sorry, that site already exists!' ) );
638
+	if ( domain_exists($mydomain, $path, $current_site->id) ) {
639
+			$errors->add( 'blogname', __( 'Sorry, that site already exists!' ) );
640
+	}
614 641
 
615 642
 	if ( username_exists( $blogname ) ) {
616
-		if ( ! is_object( $user ) || ( is_object($user) && ( $user->user_login != $blogname ) ) )
617
-			$errors->add( 'blogname', __( 'Sorry, that site is reserved!' ) );
643
+		if ( ! is_object( $user ) || ( is_object($user) && ( $user->user_login != $blogname ) ) ) {
644
+					$errors->add( 'blogname', __( 'Sorry, that site is reserved!' ) );
645
+		}
618 646
 	}
619 647
 
620 648
 	// Has someone already signed up for this domain?
@@ -622,10 +650,11 @@  discard block
 block discarded – undo
622 650
 	if ( ! empty($signup) ) {
623 651
 		$diff = current_time( 'timestamp', true ) - mysql2date('U', $signup->registered);
624 652
 		// If registered more than two days ago, cancel registration and let this signup go through.
625
-		if ( $diff > 2 * DAY_IN_SECONDS )
626
-			$wpdb->delete( $wpdb->signups, array( 'domain' => $mydomain , 'path' => $path ) );
627
-		else
628
-			$errors->add('blogname', __('That site is currently reserved but may be available in a couple days.'));
653
+		if ( $diff > 2 * DAY_IN_SECONDS ) {
654
+					$wpdb->delete( $wpdb->signups, array( 'domain' => $mydomain , 'path' => $path ) );
655
+		} else {
656
+					$errors->add('blogname', __('That site is currently reserved but may be available in a couple days.'));
657
+		}
629 658
 	}
630 659
 
631 660
 	$result = array('domain' => $mydomain, 'path' => $path, 'blogname' => $blogname, 'blog_title' => $blog_title, 'user' => $user, 'errors' => $errors);
@@ -786,15 +815,18 @@  discard block
 block discarded – undo
786 815
 	}
787 816
 
788 817
 	// Send email with activation link.
789
-	if ( !is_subdomain_install() || get_current_site()->id != 1 )
790
-		$activate_url = network_site_url("wp-activate.php?key=$key");
791
-	else
792
-		$activate_url = "http://{$domain}{$path}wp-activate.php?key=$key"; // @todo use *_url() API
818
+	if ( !is_subdomain_install() || get_current_site()->id != 1 ) {
819
+			$activate_url = network_site_url("wp-activate.php?key=$key");
820
+	} else {
821
+			$activate_url = "http://{$domain}{$path}wp-activate.php?key=$key";
822
+	}
823
+	// @todo use *_url() API
793 824
 
794 825
 	$activate_url = esc_url($activate_url);
795 826
 	$admin_email = get_site_option( 'admin_email' );
796
-	if ( $admin_email == '' )
797
-		$admin_email = 'support@' . $_SERVER['SERVER_NAME'];
827
+	if ( $admin_email == '' ) {
828
+			$admin_email = 'support@' . $_SERVER['SERVER_NAME'];
829
+	}
798 830
 	$from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
799 831
 	$message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
800 832
 	$message = sprintf(
@@ -881,13 +913,15 @@  discard block
 block discarded – undo
881 913
 	 * @param string $key        Activation key created in wpmu_signup_user().
882 914
 	 * @param array  $meta       Signup meta data.
883 915
 	 */
884
-	if ( ! apply_filters( 'wpmu_signup_user_notification', $user, $user_email, $key, $meta ) )
885
-		return false;
916
+	if ( ! apply_filters( 'wpmu_signup_user_notification', $user, $user_email, $key, $meta ) ) {
917
+			return false;
918
+	}
886 919
 
887 920
 	// Send email with activation link.
888 921
 	$admin_email = get_site_option( 'admin_email' );
889
-	if ( $admin_email == '' )
890
-		$admin_email = 'support@' . $_SERVER['SERVER_NAME'];
922
+	if ( $admin_email == '' ) {
923
+			$admin_email = 'support@' . $_SERVER['SERVER_NAME'];
924
+	}
891 925
 	$from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
892 926
 	$message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
893 927
 	$message = sprintf(
@@ -954,14 +988,16 @@  discard block
 block discarded – undo
954 988
 
955 989
 	$signup = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->signups WHERE activation_key = %s", $key) );
956 990
 
957
-	if ( empty( $signup ) )
958
-		return new WP_Error( 'invalid_key', __( 'Invalid activation key.' ) );
991
+	if ( empty( $signup ) ) {
992
+			return new WP_Error( 'invalid_key', __( 'Invalid activation key.' ) );
993
+	}
959 994
 
960 995
 	if ( $signup->active ) {
961
-		if ( empty( $signup->domain ) )
962
-			return new WP_Error( 'already_active', __( 'The user is already active.' ), $signup );
963
-		else
964
-			return new WP_Error( 'already_active', __( 'The site is already active.' ), $signup );
996
+		if ( empty( $signup->domain ) ) {
997
+					return new WP_Error( 'already_active', __( 'The user is already active.' ), $signup );
998
+		} else {
999
+					return new WP_Error( 'already_active', __( 'The site is already active.' ), $signup );
1000
+		}
965 1001
 	}
966 1002
 
967 1003
 	$meta = maybe_unserialize($signup->meta);
@@ -969,21 +1005,24 @@  discard block
 block discarded – undo
969 1005
 
970 1006
 	$user_id = username_exists($signup->user_login);
971 1007
 
972
-	if ( ! $user_id )
973
-		$user_id = wpmu_create_user($signup->user_login, $password, $signup->user_email);
974
-	else
975
-		$user_already_exists = true;
1008
+	if ( ! $user_id ) {
1009
+			$user_id = wpmu_create_user($signup->user_login, $password, $signup->user_email);
1010
+	} else {
1011
+			$user_already_exists = true;
1012
+	}
976 1013
 
977
-	if ( ! $user_id )
978
-		return new WP_Error('create_user', __('Could not create user'), $signup);
1014
+	if ( ! $user_id ) {
1015
+			return new WP_Error('create_user', __('Could not create user'), $signup);
1016
+	}
979 1017
 
980 1018
 	$now = current_time('mysql', true);
981 1019
 
982 1020
 	if ( empty($signup->domain) ) {
983 1021
 		$wpdb->update( $wpdb->signups, array('active' => 1, 'activated' => $now), array('activation_key' => $key) );
984 1022
 
985
-		if ( isset( $user_already_exists ) )
986
-			return new WP_Error( 'user_already_exists', __( 'That username is already activated.' ), $signup);
1023
+		if ( isset( $user_already_exists ) ) {
1024
+					return new WP_Error( 'user_already_exists', __( 'That username is already activated.' ), $signup);
1025
+		}
987 1026
 
988 1027
 		/**
989 1028
 		 * Fires immediately after a new user is activated.
@@ -1047,8 +1086,9 @@  discard block
 block discarded – undo
1047 1086
 	$user_name = preg_replace( '/\s+/', '', sanitize_user( $user_name, true ) );
1048 1087
 
1049 1088
 	$user_id = wp_create_user( $user_name, $password, $email );
1050
-	if ( is_wp_error( $user_id ) )
1051
-		return false;
1089
+	if ( is_wp_error( $user_id ) ) {
1090
+			return false;
1091
+	}
1052 1092
 
1053 1093
 	// Newly created users have no roles or caps until they are added to a blog.
1054 1094
 	delete_user_option( $user_id, 'capabilities' );
@@ -1094,25 +1134,29 @@  discard block
 block discarded – undo
1094 1134
 
1095 1135
 	$domain = preg_replace( '/\s+/', '', sanitize_user( $domain, true ) );
1096 1136
 
1097
-	if ( is_subdomain_install() )
1098
-		$domain = str_replace( '@', '', $domain );
1137
+	if ( is_subdomain_install() ) {
1138
+			$domain = str_replace( '@', '', $domain );
1139
+	}
1099 1140
 
1100 1141
 	$title = strip_tags( $title );
1101 1142
 	$user_id = (int) $user_id;
1102 1143
 
1103
-	if ( empty($path) )
1104
-		$path = '/';
1144
+	if ( empty($path) ) {
1145
+			$path = '/';
1146
+	}
1105 1147
 
1106 1148
 	// Check if the domain has been used already. We should return an error message.
1107
-	if ( domain_exists($domain, $path, $site_id) )
1108
-		return new WP_Error( 'blog_taken', __( 'Sorry, that site already exists!' ) );
1149
+	if ( domain_exists($domain, $path, $site_id) ) {
1150
+			return new WP_Error( 'blog_taken', __( 'Sorry, that site already exists!' ) );
1151
+	}
1109 1152
 
1110 1153
 	if ( ! wp_installing() ) {
1111 1154
 		wp_installing( true );
1112 1155
 	}
1113 1156
 
1114
-	if ( ! $blog_id = insert_blog($domain, $path, $site_id) )
1115
-		return new WP_Error('insert_blog', __('Could not create site.'));
1157
+	if ( ! $blog_id = insert_blog($domain, $path, $site_id) ) {
1158
+			return new WP_Error('insert_blog', __('Could not create site.'));
1159
+	}
1116 1160
 
1117 1161
 	switch_to_blog($blog_id);
1118 1162
 	install_blog($blog_id, $title);
@@ -1121,17 +1165,19 @@  discard block
 block discarded – undo
1121 1165
 	add_user_to_blog($blog_id, $user_id, 'administrator');
1122 1166
 
1123 1167
 	foreach ( $meta as $key => $value ) {
1124
-		if ( in_array( $key, array( 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id' ) ) )
1125
-			update_blog_status( $blog_id, $key, $value );
1126
-		else
1127
-			update_option( $key, $value );
1168
+		if ( in_array( $key, array( 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id' ) ) ) {
1169
+					update_blog_status( $blog_id, $key, $value );
1170
+		} else {
1171
+					update_option( $key, $value );
1172
+		}
1128 1173
 	}
1129 1174
 
1130 1175
 	add_option( 'WPLANG', get_site_option( 'WPLANG' ) );
1131 1176
 	update_option( 'blog_public', (int) $meta['public'] );
1132 1177
 
1133
-	if ( ! is_super_admin( $user_id ) && ! get_user_meta( $user_id, 'primary_blog', true ) )
1134
-		update_user_meta( $user_id, 'primary_blog', $blog_id );
1178
+	if ( ! is_super_admin( $user_id ) && ! get_user_meta( $user_id, 'primary_blog', true ) ) {
1179
+			update_user_meta( $user_id, 'primary_blog', $blog_id );
1180
+	}
1135 1181
 
1136 1182
 	restore_current_blog();
1137 1183
 	/**
@@ -1164,12 +1210,14 @@  discard block
 block discarded – undo
1164 1210
  * @return bool
1165 1211
  */
1166 1212
 function newblog_notify_siteadmin( $blog_id, $deprecated = '' ) {
1167
-	if ( get_site_option( 'registrationnotification' ) != 'yes' )
1168
-		return false;
1213
+	if ( get_site_option( 'registrationnotification' ) != 'yes' ) {
1214
+			return false;
1215
+	}
1169 1216
 
1170 1217
 	$email = get_site_option( 'admin_email' );
1171
-	if ( is_email($email) == false )
1172
-		return false;
1218
+	if ( is_email($email) == false ) {
1219
+			return false;
1220
+	}
1173 1221
 
1174 1222
 	$options_site_url = esc_url(network_admin_url('settings.php'));
1175 1223
 
@@ -1209,13 +1257,15 @@  discard block
 block discarded – undo
1209 1257
  * @return bool
1210 1258
  */
1211 1259
 function newuser_notify_siteadmin( $user_id ) {
1212
-	if ( get_site_option( 'registrationnotification' ) != 'yes' )
1213
-		return false;
1260
+	if ( get_site_option( 'registrationnotification' ) != 'yes' ) {
1261
+			return false;
1262
+	}
1214 1263
 
1215 1264
 	$email = get_site_option( 'admin_email' );
1216 1265
 
1217
-	if ( is_email($email) == false )
1218
-		return false;
1266
+	if ( is_email($email) == false ) {
1267
+			return false;
1268
+	}
1219 1269
 
1220 1270
 	$user = get_userdata( $user_id );
1221 1271
 
@@ -1294,8 +1344,9 @@  discard block
 block discarded – undo
1294 1344
 	$site_id = (int) $site_id;
1295 1345
 
1296 1346
 	$result = $wpdb->insert( $wpdb->blogs, array('site_id' => $site_id, 'domain' => $domain, 'path' => $path, 'registered' => current_time('mysql')) );
1297
-	if ( ! $result )
1298
-		return false;
1347
+	if ( ! $result ) {
1348
+			return false;
1349
+	}
1299 1350
 
1300 1351
 	$blog_id = $wpdb->insert_id;
1301 1352
 	refresh_blog_details( $blog_id );
@@ -1329,8 +1380,9 @@  discard block
 block discarded – undo
1329 1380
 	require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
1330 1381
 
1331 1382
 	$suppress = $wpdb->suppress_errors();
1332
-	if ( $wpdb->get_results( "DESCRIBE {$wpdb->posts}" ) )
1333
-		die( '<h1>' . __( 'Already Installed' ) . '</h1><p>' . __( 'You appear to have already installed WordPress. To reinstall please clear your old database tables first.' ) . '</p></body></html>' );
1383
+	if ( $wpdb->get_results( "DESCRIBE {$wpdb->posts}" ) ) {
1384
+			die( '<h1>' . __( 'Already Installed' ) . '</h1><p>' . __( 'You appear to have already installed WordPress. To reinstall please clear your old database tables first.' ) . '</p></body></html>' );
1385
+	}
1334 1386
 	$wpdb->suppress_errors( $suppress );
1335 1387
 
1336 1388
 	$url = get_blogaddress_by_id( $blog_id );
@@ -1359,10 +1411,11 @@  discard block
 block discarded – undo
1359 1411
 	update_option( 'siteurl', $siteurl );
1360 1412
 	update_option( 'home', $home );
1361 1413
 
1362
-	if ( get_site_option( 'ms_files_rewriting' ) )
1363
-		update_option( 'upload_path', UPLOADBLOGSDIR . "/$blog_id/files" );
1364
-	else
1365
-		update_option( 'upload_path', get_blog_option( get_current_site()->blog_id, 'upload_path' ) );
1414
+	if ( get_site_option( 'ms_files_rewriting' ) ) {
1415
+			update_option( 'upload_path', UPLOADBLOGSDIR . "/$blog_id/files" );
1416
+	} else {
1417
+			update_option( 'upload_path', get_blog_option( get_current_site()->blog_id, 'upload_path' ) );
1418
+	}
1366 1419
 
1367 1420
 	update_option( 'blogname', wp_unslash( $blog_title ) );
1368 1421
 	update_option( 'admin_email', '' );
@@ -1432,8 +1485,9 @@  discard block
 block discarded – undo
1432 1485
 	 * @param string   $title    Site title.
1433 1486
 	 * @param array    $meta     Signup meta data.
1434 1487
 	 */
1435
-	if ( ! apply_filters( 'wpmu_welcome_notification', $blog_id, $user_id, $password, $title, $meta ) )
1436
-		return false;
1488
+	if ( ! apply_filters( 'wpmu_welcome_notification', $blog_id, $user_id, $password, $title, $meta ) ) {
1489
+			return false;
1490
+	}
1437 1491
 
1438 1492
 	$welcome_email = get_site_option( 'welcome_email' );
1439 1493
 	if ( $welcome_email == false ) {
@@ -1480,15 +1534,17 @@  discard block
 block discarded – undo
1480 1534
 	$welcome_email = apply_filters( 'update_welcome_email', $welcome_email, $blog_id, $user_id, $password, $title, $meta );
1481 1535
 	$admin_email = get_site_option( 'admin_email' );
1482 1536
 
1483
-	if ( $admin_email == '' )
1484
-		$admin_email = 'support@' . $_SERVER['SERVER_NAME'];
1537
+	if ( $admin_email == '' ) {
1538
+			$admin_email = 'support@' . $_SERVER['SERVER_NAME'];
1539
+	}
1485 1540
 
1486 1541
 	$from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
1487 1542
 	$message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
1488 1543
 	$message = $welcome_email;
1489 1544
 
1490
-	if ( empty( $current_site->site_name ) )
1491
-		$current_site->site_name = 'WordPress';
1545
+	if ( empty( $current_site->site_name ) ) {
1546
+			$current_site->site_name = 'WordPress';
1547
+	}
1492 1548
 
1493 1549
 	/**
1494 1550
 	 * Filter the subject of the welcome email after site activation.
@@ -1531,8 +1587,9 @@  discard block
 block discarded – undo
1531 1587
 	 * @param string $password User password.
1532 1588
 	 * @param array  $meta     Signup meta data.
1533 1589
 	 */
1534
-	if ( ! apply_filters( 'wpmu_welcome_user_notification', $user_id, $password, $meta ) )
1535
-		return false;
1590
+	if ( ! apply_filters( 'wpmu_welcome_user_notification', $user_id, $password, $meta ) ) {
1591
+			return false;
1592
+	}
1536 1593
 
1537 1594
 	$welcome_email = get_site_option( 'welcome_user_email' );
1538 1595
 
@@ -1558,15 +1615,17 @@  discard block
 block discarded – undo
1558 1615
 
1559 1616
 	$admin_email = get_site_option( 'admin_email' );
1560 1617
 
1561
-	if ( $admin_email == '' )
1562
-		$admin_email = 'support@' . $_SERVER['SERVER_NAME'];
1618
+	if ( $admin_email == '' ) {
1619
+			$admin_email = 'support@' . $_SERVER['SERVER_NAME'];
1620
+	}
1563 1621
 
1564 1622
 	$from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
1565 1623
 	$message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
1566 1624
 	$message = $welcome_email;
1567 1625
 
1568
-	if ( empty( $current_site->site_name ) )
1569
-		$current_site->site_name = 'WordPress';
1626
+	if ( empty( $current_site->site_name ) ) {
1627
+			$current_site->site_name = 'WordPress';
1628
+	}
1570 1629
 
1571 1630
 	/**
1572 1631
 	 * Filter the subject of the welcome email after user activation.
@@ -1660,11 +1719,13 @@  discard block
 block discarded – undo
1660 1719
  */
1661 1720
 function get_dirsize( $directory ) {
1662 1721
 	$dirsize = get_transient( 'dirsize_cache' );
1663
-	if ( is_array( $dirsize ) && isset( $dirsize[ $directory ][ 'size' ] ) )
1664
-		return $dirsize[ $directory ][ 'size' ];
1722
+	if ( is_array( $dirsize ) && isset( $dirsize[ $directory ][ 'size' ] ) ) {
1723
+			return $dirsize[ $directory ][ 'size' ];
1724
+	}
1665 1725
 
1666
-	if ( ! is_array( $dirsize ) )
1667
-		$dirsize = array();
1726
+	if ( ! is_array( $dirsize ) ) {
1727
+			$dirsize = array();
1728
+	}
1668 1729
 
1669 1730
 	// Exclude individual site directories from the total when checking the main site,
1670 1731
 	// as they are subdirectories and should not be counted.
@@ -1708,8 +1769,9 @@  discard block
 block discarded – undo
1708 1769
 					$size += filesize($path);
1709 1770
 				} elseif (is_dir($path)) {
1710 1771
 					$handlesize = recurse_dirsize( $path, $exclude );
1711
-					if ($handlesize > 0)
1712
-						$size += $handlesize;
1772
+					if ($handlesize > 0) {
1773
+											$size += $handlesize;
1774
+					}
1713 1775
 				}
1714 1776
 			}
1715 1777
 		}
@@ -1737,8 +1799,9 @@  discard block
 block discarded – undo
1737 1799
 	$site_mimes = array();
1738 1800
 	foreach ( $site_exts as $ext ) {
1739 1801
 		foreach ( $mimes as $ext_pattern => $mime ) {
1740
-			if ( $ext != '' && strpos( $ext_pattern, $ext ) !== false )
1741
-				$site_mimes[$ext_pattern] = $mime;
1802
+			if ( $ext != '' && strpos( $ext_pattern, $ext ) !== false ) {
1803
+							$site_mimes[$ext_pattern] = $mime;
1804
+			}
1742 1805
 		}
1743 1806
 	}
1744 1807
 	return $site_mimes;
@@ -1776,9 +1839,10 @@  discard block
 block discarded – undo
1776 1839
 function wpmu_log_new_registrations( $blog_id, $user_id ) {
1777 1840
 	global $wpdb;
1778 1841
 	$user = get_userdata( (int) $user_id );
1779
-	if ( $user )
1780
-		$wpdb->insert( $wpdb->registration_log, array('email' => $user->user_email, 'IP' => preg_replace( '/[^0-9., ]/', '', wp_unslash( $_SERVER['REMOTE_ADDR'] ) ), 'blog_id' => $blog_id, 'date_registered' => current_time('mysql')) );
1781
-}
1842
+	if ( $user ) {
1843
+			$wpdb->insert( $wpdb->registration_log, array('email' => $user->user_email, 'IP' => preg_replace( '/[^0-9., ]/', '', wp_unslash( $_SERVER['REMOTE_ADDR'] ) ), 'blog_id' => $blog_id, 'date_registered' => current_time('mysql')) );
1844
+	}
1845
+	}
1782 1846
 
1783 1847
 /**
1784 1848
  * Maintains a canonical list of terms by syncing terms created for each blog with the global terms table.
@@ -1798,8 +1862,9 @@  discard block
 block discarded – undo
1798 1862
 	global $wpdb;
1799 1863
 	static $global_terms_recurse = null;
1800 1864
 
1801
-	if ( !global_terms_enabled() )
1802
-		return $term_id;
1865
+	if ( !global_terms_enabled() ) {
1866
+			return $term_id;
1867
+	}
1803 1868
 
1804 1869
 	// prevent a race condition
1805 1870
 	$recurse_start = false;
@@ -1819,8 +1884,9 @@  discard block
 block discarded – undo
1819 1884
 		if ( null == $used_global_id ) {
1820 1885
 			$wpdb->insert( $wpdb->sitecategories, array( 'cat_ID' => $term_id, 'cat_name' => $c->name, 'category_nicename' => $c->slug ) );
1821 1886
 			$global_id = $wpdb->insert_id;
1822
-			if ( empty( $global_id ) )
1823
-				return $term_id;
1887
+			if ( empty( $global_id ) ) {
1888
+							return $term_id;
1889
+			}
1824 1890
 		} else {
1825 1891
 			$max_global_id = $wpdb->get_var( "SELECT MAX(cat_ID) FROM $wpdb->sitecategories" );
1826 1892
 			$max_local_id = $wpdb->get_var( "SELECT MAX(term_id) FROM $wpdb->terms" );
@@ -1839,8 +1905,9 @@  discard block
 block discarded – undo
1839 1905
 	}
1840 1906
 
1841 1907
 	if ( $global_id != $term_id ) {
1842
-		if ( get_option( 'default_category' ) == $term_id )
1843
-			update_option( 'default_category', $global_id );
1908
+		if ( get_option( 'default_category' ) == $term_id ) {
1909
+					update_option( 'default_category', $global_id );
1910
+		}
1844 1911
 
1845 1912
 		$wpdb->update( $wpdb->terms, array('term_id' => $global_id), array('term_id' => $term_id) );
1846 1913
 		$wpdb->update( $wpdb->term_taxonomy, array('term_id' => $global_id), array('term_id' => $term_id) );
@@ -1848,8 +1915,9 @@  discard block
 block discarded – undo
1848 1915
 
1849 1916
 		clean_term_cache($term_id);
1850 1917
 	}
1851
-	if ( $recurse_start )
1852
-		$global_terms_recurse = null;
1918
+	if ( $recurse_start ) {
1919
+			$global_terms_recurse = null;
1920
+	}
1853 1921
 
1854 1922
 	return $global_id;
1855 1923
 }
@@ -1878,8 +1946,9 @@  discard block
 block discarded – undo
1878 1946
  * @return string|array If the upload is under the size limit, $upload is returned. Otherwise returns an error message.
1879 1947
  */
1880 1948
 function upload_is_file_too_big( $upload ) {
1881
-	if ( ! is_array( $upload ) || defined( 'WP_IMPORTING' ) || get_site_option( 'upload_space_check_disabled' ) )
1882
-		return $upload;
1949
+	if ( ! is_array( $upload ) || defined( 'WP_IMPORTING' ) || get_site_option( 'upload_space_check_disabled' ) ) {
1950
+			return $upload;
1951
+	}
1883 1952
 
1884 1953
 	if ( strlen( $upload['bits'] )  > ( KB_IN_BYTES * get_site_option( 'fileupload_maxk', 1500 ) ) ) {
1885 1954
 		return sprintf( __( 'This file is too big. Files must be less than %d KB in size.' ) . '<br />', get_site_option( 'fileupload_maxk', 1500 ) );
@@ -1908,11 +1977,13 @@  discard block
 block discarded – undo
1908 1977
  * @return array
1909 1978
  */
1910 1979
 function signup_nonce_check( $result ) {
1911
-	if ( !strpos( $_SERVER[ 'PHP_SELF' ], 'wp-signup.php' ) )
1912
-		return $result;
1980
+	if ( !strpos( $_SERVER[ 'PHP_SELF' ], 'wp-signup.php' ) ) {
1981
+			return $result;
1982
+	}
1913 1983
 
1914
-	if ( wp_create_nonce('signup_form_' . $_POST[ 'signup_form_id' ]) != $_POST['_signup_form'] )
1915
-		wp_die( __( 'Please try again.' ) );
1984
+	if ( wp_create_nonce('signup_form_' . $_POST[ 'signup_form_id' ]) != $_POST['_signup_form'] ) {
1985
+			wp_die( __( 'Please try again.' ) );
1986
+	}
1916 1987
 
1917 1988
 	return $result;
1918 1989
 }
@@ -1933,8 +2004,9 @@  discard block
 block discarded – undo
1933 2004
 	 * @param string $no_blog_redirect The redirect URL defined in NOBLOGREDIRECT.
1934 2005
 	 */
1935 2006
 	if ( is_main_site() && is_404() && defined( 'NOBLOGREDIRECT' ) && ( $destination = apply_filters( 'blog_redirect_404', NOBLOGREDIRECT ) ) ) {
1936
-		if ( $destination == '%siteurl%' )
1937
-			$destination = network_home_url();
2007
+		if ( $destination == '%siteurl%' ) {
2008
+					$destination = network_home_url();
2009
+		}
1938 2010
 		wp_redirect( $destination );
1939 2011
 		exit();
1940 2012
 	}
@@ -1950,21 +2022,25 @@  discard block
 block discarded – undo
1950 2022
  * @since MU
1951 2023
  */
1952 2024
 function maybe_add_existing_user_to_blog() {
1953
-	if ( false === strpos( $_SERVER[ 'REQUEST_URI' ], '/newbloguser/' ) )
1954
-		return;
2025
+	if ( false === strpos( $_SERVER[ 'REQUEST_URI' ], '/newbloguser/' ) ) {
2026
+			return;
2027
+	}
1955 2028
 
1956 2029
 	$parts = explode( '/', $_SERVER[ 'REQUEST_URI' ] );
1957 2030
 	$key = array_pop( $parts );
1958 2031
 
1959
-	if ( $key == '' )
1960
-		$key = array_pop( $parts );
2032
+	if ( $key == '' ) {
2033
+			$key = array_pop( $parts );
2034
+	}
1961 2035
 
1962 2036
 	$details = get_option( 'new_user_' . $key );
1963
-	if ( !empty( $details ) )
1964
-		delete_option( 'new_user_' . $key );
2037
+	if ( !empty( $details ) ) {
2038
+			delete_option( 'new_user_' . $key );
2039
+	}
1965 2040
 
1966
-	if ( empty( $details ) || is_wp_error( add_existing_user_to_blog( $details ) ) )
1967
-		wp_die( sprintf(__('An error occurred adding you to this site. Back to the <a href="%s">homepage</a>.'), home_url() ) );
2041
+	if ( empty( $details ) || is_wp_error( add_existing_user_to_blog( $details ) ) ) {
2042
+			wp_die( sprintf(__('An error occurred adding you to this site. Back to the <a href="%s">homepage</a>.'), home_url() ) );
2043
+	}
1968 2044
 
1969 2045
 	wp_die( sprintf( __( 'You have been added to this site. Please visit the <a href="%s">homepage</a> or <a href="%s">log in</a> using your username and password.' ), home_url(), admin_url() ), __( 'WordPress &rsaquo; Success' ), array( 'response' => 200 ) );
1970 2046
 }
@@ -2165,11 +2241,14 @@  discard block
 block discarded – undo
2165 2241
  * @return string URL with https as the scheme
2166 2242
  */
2167 2243
 function filter_SSL( $url ) {
2168
-	if ( ! is_string( $url ) )
2169
-		return get_bloginfo( 'url' ); // Return home blog url with proper scheme
2244
+	if ( ! is_string( $url ) ) {
2245
+			return get_bloginfo( 'url' );
2246
+	}
2247
+	// Return home blog url with proper scheme
2170 2248
 
2171
-	if ( force_ssl_content() && is_ssl() )
2172
-		$url = set_url_scheme( $url, 'https' );
2249
+	if ( force_ssl_content() && is_ssl() ) {
2250
+			$url = set_url_scheme( $url, 'https' );
2251
+	}
2173 2252
 
2174 2253
 	return $url;
2175 2254
 }
@@ -2180,12 +2259,14 @@  discard block
 block discarded – undo
2180 2259
  * @since 3.1.0
2181 2260
  */
2182 2261
 function wp_schedule_update_network_counts() {
2183
-	if ( !is_main_site() )
2184
-		return;
2262
+	if ( !is_main_site() ) {
2263
+			return;
2264
+	}
2185 2265
 
2186
-	if ( ! wp_next_scheduled('update_network_counts') && ! wp_installing() )
2187
-		wp_schedule_event(time(), 'twicedaily', 'update_network_counts');
2188
-}
2266
+	if ( ! wp_next_scheduled('update_network_counts') && ! wp_installing() ) {
2267
+			wp_schedule_event(time(), 'twicedaily', 'update_network_counts');
2268
+	}
2269
+	}
2189 2270
 
2190 2271
 /**
2191 2272
  *  Update the network-wide counts for the current network.
@@ -2218,8 +2299,9 @@  discard block
 block discarded – undo
2218 2299
 	 * @param bool   $small_network Whether the network is considered small.
2219 2300
 	 * @param string $context       Context. Either 'users' or 'sites'.
2220 2301
 	 */
2221
-	if ( ! apply_filters( 'enable_live_network_counts', $is_small_network, 'sites' ) )
2222
-		return;
2302
+	if ( ! apply_filters( 'enable_live_network_counts', $is_small_network, 'sites' ) ) {
2303
+			return;
2304
+	}
2223 2305
 
2224 2306
 	wp_update_network_site_counts();
2225 2307
 }
@@ -2236,8 +2318,9 @@  discard block
 block discarded – undo
2236 2318
 	$is_small_network = ! wp_is_large_network( 'users' );
2237 2319
 
2238 2320
 	/** This filter is documented in wp-includes/ms-functions.php */
2239
-	if ( ! apply_filters( 'enable_live_network_counts', $is_small_network, 'users' ) )
2240
-		return;
2321
+	if ( ! apply_filters( 'enable_live_network_counts', $is_small_network, 'users' ) ) {
2322
+			return;
2323
+	}
2241 2324
 
2242 2325
 	wp_update_network_user_counts();
2243 2326
 }
@@ -2304,11 +2387,13 @@  discard block
 block discarded – undo
2304 2387
 function get_space_allowed() {
2305 2388
 	$space_allowed = get_option( 'blog_upload_space' );
2306 2389
 
2307
-	if ( ! is_numeric( $space_allowed ) )
2308
-		$space_allowed = get_site_option( 'blog_upload_space' );
2390
+	if ( ! is_numeric( $space_allowed ) ) {
2391
+			$space_allowed = get_site_option( 'blog_upload_space' );
2392
+	}
2309 2393
 
2310
-	if ( ! is_numeric( $space_allowed ) )
2311
-		$space_allowed = 100;
2394
+	if ( ! is_numeric( $space_allowed ) ) {
2395
+			$space_allowed = 100;
2396
+	}
2312 2397
 
2313 2398
 	/**
2314 2399
 	 * Filter the upload quota for the current site.
@@ -2333,13 +2418,15 @@  discard block
 block discarded – undo
2333 2418
 		$allowed = 0;
2334 2419
 	}
2335 2420
 	$space_allowed = $allowed * MB_IN_BYTES;
2336
-	if ( get_site_option( 'upload_space_check_disabled' ) )
2337
-		return $space_allowed;
2421
+	if ( get_site_option( 'upload_space_check_disabled' ) ) {
2422
+			return $space_allowed;
2423
+	}
2338 2424
 
2339 2425
 	$space_used = get_space_used() * MB_IN_BYTES;
2340 2426
 
2341
-	if ( ( $space_allowed - $space_used ) <= 0 )
2342
-		return 0;
2427
+	if ( ( $space_allowed - $space_used ) <= 0 ) {
2428
+			return 0;
2429
+	}
2343 2430
 
2344 2431
 	return $space_allowed - $space_used;
2345 2432
 }
@@ -2351,8 +2438,9 @@  discard block
 block discarded – undo
2351 2438
  * @return bool True if space is available, false otherwise.
2352 2439
  */
2353 2440
 function is_upload_space_available() {
2354
-	if ( get_site_option( 'upload_space_check_disabled' ) )
2355
-		return true;
2441
+	if ( get_site_option( 'upload_space_check_disabled' ) ) {
2442
+			return true;
2443
+	}
2356 2444
 
2357 2445
 	return (bool) get_upload_space_available();
2358 2446
 }
@@ -2367,8 +2455,9 @@  discard block
 block discarded – undo
2367 2455
  */
2368 2456
 function upload_size_limit_filter( $size ) {
2369 2457
 	$fileupload_maxk = KB_IN_BYTES * get_site_option( 'fileupload_maxk', 1500 );
2370
-	if ( get_site_option( 'upload_space_check_disabled' ) )
2371
-		return min( $size, $fileupload_maxk );
2458
+	if ( get_site_option( 'upload_space_check_disabled' ) ) {
2459
+			return min( $size, $fileupload_maxk );
2460
+	}
2372 2461
 
2373 2462
 	return min( $size, $fileupload_maxk, get_upload_space_available() );
2374 2463
 }
@@ -2432,8 +2521,9 @@  discard block
 block discarded – undo
2432 2521
 function wp_get_sites( $args = array() ) {
2433 2522
 	global $wpdb;
2434 2523
 
2435
-	if ( wp_is_large_network() )
2436
-		return array();
2524
+	if ( wp_is_large_network() ) {
2525
+			return array();
2526
+	}
2437 2527
 
2438 2528
 	$defaults = array(
2439 2529
 		'network_id' => $wpdb->siteid,
@@ -2455,26 +2545,32 @@  discard block
 block discarded – undo
2455 2545
 		$query .= "AND site_id IN ($network_ids) ";
2456 2546
 	}
2457 2547
 
2458
-	if ( isset( $args['public'] ) )
2459
-		$query .= $wpdb->prepare( "AND public = %d ", $args['public'] );
2548
+	if ( isset( $args['public'] ) ) {
2549
+			$query .= $wpdb->prepare( "AND public = %d ", $args['public'] );
2550
+	}
2460 2551
 
2461
-	if ( isset( $args['archived'] ) )
2462
-		$query .= $wpdb->prepare( "AND archived = %d ", $args['archived'] );
2552
+	if ( isset( $args['archived'] ) ) {
2553
+			$query .= $wpdb->prepare( "AND archived = %d ", $args['archived'] );
2554
+	}
2463 2555
 
2464
-	if ( isset( $args['mature'] ) )
2465
-		$query .= $wpdb->prepare( "AND mature = %d ", $args['mature'] );
2556
+	if ( isset( $args['mature'] ) ) {
2557
+			$query .= $wpdb->prepare( "AND mature = %d ", $args['mature'] );
2558
+	}
2466 2559
 
2467
-	if ( isset( $args['spam'] ) )
2468
-		$query .= $wpdb->prepare( "AND spam = %d ", $args['spam'] );
2560
+	if ( isset( $args['spam'] ) ) {
2561
+			$query .= $wpdb->prepare( "AND spam = %d ", $args['spam'] );
2562
+	}
2469 2563
 
2470
-	if ( isset( $args['deleted'] ) )
2471
-		$query .= $wpdb->prepare( "AND deleted = %d ", $args['deleted'] );
2564
+	if ( isset( $args['deleted'] ) ) {
2565
+			$query .= $wpdb->prepare( "AND deleted = %d ", $args['deleted'] );
2566
+	}
2472 2567
 
2473 2568
 	if ( isset( $args['limit'] ) && $args['limit'] ) {
2474
-		if ( isset( $args['offset'] ) && $args['offset'] )
2475
-			$query .= $wpdb->prepare( "LIMIT %d , %d ", $args['offset'], $args['limit'] );
2476
-		else
2477
-			$query .= $wpdb->prepare( "LIMIT %d ", $args['limit'] );
2569
+		if ( isset( $args['offset'] ) && $args['offset'] ) {
2570
+					$query .= $wpdb->prepare( "LIMIT %d , %d ", $args['offset'], $args['limit'] );
2571
+		} else {
2572
+					$query .= $wpdb->prepare( "LIMIT %d ", $args['limit'] );
2573
+		}
2478 2574
 	}
2479 2575
 
2480 2576
 	$site_results = $wpdb->get_results( $query, ARRAY_A );
Please login to merge, or discard this patch.
src/wp-includes/js/tinymce/wp-tinymce.php 3 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Disable error reporting
4
- *
5
- * Set this to error_reporting( -1 ) for debugging.
6
- */
3
+	 * Disable error reporting
4
+	 *
5
+	 * Set this to error_reporting( -1 ) for debugging.
6
+	 */
7 7
 error_reporting(0);
8 8
 
9 9
 $basepath = dirname(__FILE__);
Please login to merge, or discard this patch.
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 3 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * WordPress Error API.
4
- *
5
- * Contains the WP_Error class and the is_wp_error() function.
6
- *
7
- * @package WordPress
8
- */
3
+	 * WordPress Error API.
4
+	 *
5
+	 * Contains the WP_Error class and the is_wp_error() function.
6
+	 *
7
+	 * @package WordPress
8
+	 */
9 9
 
10 10
 /**
11 11
  * WordPress Error class.
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 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,9 +197,9 @@  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
 }
205 205
 
@@ -213,6 +213,6 @@  discard block
 block discarded – undo
213 213
  * @param mixed $thing Check if unknown variable is a WP_Error object.
214 214
  * @return bool True, if WP_Error. False, if not WP_Error.
215 215
  */
216
-function is_wp_error( $thing ) {
217
-	return ( $thing instanceof WP_Error );
216
+function is_wp_error($thing) {
217
+	return ($thing instanceof WP_Error);
218 218
 }
Please login to merge, or discard this patch.
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.