Completed
Push — master ( d99bf9...491baf )
by Stephen
13:47
created
src/wp-activate.php 3 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -43,10 +43,10 @@
 block discarded – undo
43 43
 	 * Fires before the Site Activation page is loaded.
44 44
 	 *
45 45
 	 * Fires on the {@see 'wp_head'} action.
46
-     *
47
-     * @since 3.0.0
48
-     */
49
-    do_action( 'activate_wp_head' );
46
+	 *
47
+	 * @since 3.0.0
48
+	 */
49
+	do_action( 'activate_wp_head' );
50 50
 }
51 51
 add_action( 'wp_head', 'do_activate_header' );
52 52
 
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,8 +18,9 @@  discard block
 block discarded – undo
18 18
 	die();
19 19
 }
20 20
 
21
-if ( is_object( $wp_object_cache ) )
21
+if ( is_object( $wp_object_cache ) ) {
22 22
 	$wp_object_cache->cache_enabled = false;
23
+}
23 24
 
24 25
 // Fix for page title
25 26
 $wp_query->is_404 = false;
@@ -144,10 +145,12 @@  discard block
 block discarded – undo
144 145
 					/* translators: 1: site URL, 2: login URL */
145 146
 					printf( __( 'Your account is now activated. <a href="%1$s">View your site</a> or <a href="%2$s">Log in</a>' ), $url, esc_url( $login_url ) );
146 147
 				?></p>
147
-			<?php else: ?>
148
+			<?php else {
149
+	: ?>
148 150
 				<p class="view"><?php
149 151
 					/* translators: 1: login URL, 2: network home URL */
150 152
 					printf( __( 'Your account is now activated. <a href="%1$s">Log in</a> or go back to the <a href="%2$s">homepage</a>.' ), network_site_url( 'wp-login.php', 'login' ), network_home_url() );
153
+}
151 154
 				?></p>
152 155
 			<?php endif;
153 156
 		}
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -6,19 +6,19 @@  discard block
 block discarded – undo
6 6
  * @package WordPress
7 7
  */
8 8
 
9
-define( 'WP_INSTALLING', true );
9
+define('WP_INSTALLING', true);
10 10
 
11 11
 /** Sets up the WordPress Environment. */
12
-require( dirname(__FILE__) . '/wp-load.php' );
12
+require(dirname(__FILE__).'/wp-load.php');
13 13
 
14
-require( dirname( __FILE__ ) . '/wp-blog-header.php' );
14
+require(dirname(__FILE__).'/wp-blog-header.php');
15 15
 
16
-if ( !is_multisite() ) {
17
-	wp_redirect( wp_registration_url() );
16
+if ( ! is_multisite()) {
17
+	wp_redirect(wp_registration_url());
18 18
 	die();
19 19
 }
20 20
 
21
-if ( is_object( $wp_object_cache ) )
21
+if (is_object($wp_object_cache))
22 22
 	$wp_object_cache->cache_enabled = false;
23 23
 
24 24
 // Fix for page title
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
  *
30 30
  * @since 3.0.0
31 31
  */
32
-do_action( 'activate_header' );
32
+do_action('activate_header');
33 33
 
34 34
 /**
35 35
  * Adds an action hook specific to this page.
@@ -46,9 +46,9 @@  discard block
 block discarded – undo
46 46
      *
47 47
      * @since 3.0.0
48 48
      */
49
-    do_action( 'activate_wp_head' );
49
+    do_action('activate_wp_head');
50 50
 }
51
-add_action( 'wp_head', 'do_activate_header' );
51
+add_action('wp_head', 'do_activate_header');
52 52
 
53 53
 /**
54 54
  * Loads styles specific to this page.
@@ -66,14 +66,14 @@  discard block
 block discarded – undo
66 66
 	</style>
67 67
 	<?php
68 68
 }
69
-add_action( 'wp_head', 'wpmu_activate_stylesheet' );
69
+add_action('wp_head', 'wpmu_activate_stylesheet');
70 70
 
71
-get_header( 'wp-activate' );
71
+get_header('wp-activate');
72 72
 ?>
73 73
 
74 74
 <div id="signup-content" class="widecolumn">
75 75
 	<div class="wp-activate-container">
76
-	<?php if ( empty($_GET['key']) && empty($_POST['key']) ) { ?>
76
+	<?php if (empty($_GET['key']) && empty($_POST['key'])) { ?>
77 77
 
78 78
 		<h2><?php _e('Activation Key Required') ?></h2>
79 79
 		<form name="activateform" id="activateform" method="post" action="<?php echo network_site_url('wp-activate.php'); ?>">
@@ -88,20 +88,20 @@  discard block
 block discarded – undo
88 88
 
89 89
 	<?php } else {
90 90
 
91
-		$key = !empty($_GET['key']) ? $_GET['key'] : $_POST['key'];
92
-		$result = wpmu_activate_signup( $key );
93
-		if ( is_wp_error($result) ) {
94
-			if ( 'already_active' == $result->get_error_code() || 'blog_taken' == $result->get_error_code() ) {
91
+		$key = ! empty($_GET['key']) ? $_GET['key'] : $_POST['key'];
92
+		$result = wpmu_activate_signup($key);
93
+		if (is_wp_error($result)) {
94
+			if ('already_active' == $result->get_error_code() || 'blog_taken' == $result->get_error_code()) {
95 95
 				$signup = $result->get_error_data();
96 96
 				?>
97 97
 				<h2><?php _e('Your account is now active!'); ?></h2>
98 98
 				<?php
99 99
 				echo '<p class="lead-in">';
100
-				if ( $signup->domain . $signup->path == '' ) {
100
+				if ($signup->domain.$signup->path == '') {
101 101
 					printf(
102 102
 						/* translators: 1: login URL, 2: username, 3: user email, 4: lost password URL */
103
-						__( 'Your account has been activated. You may now <a href="%1$s">log in</a> to the site using your chosen username of &#8220;%2$s&#8221;. Please check your email inbox at %3$s for your password and login instructions. If you do not receive an email, please check your junk or spam folder. If you still do not receive an email within an hour, you can <a href="%4$s">reset your password</a>.' ),
104
-						network_site_url( 'wp-login.php', 'login' ),
103
+						__('Your account has been activated. You may now <a href="%1$s">log in</a> to the site using your chosen username of &#8220;%2$s&#8221;. Please check your email inbox at %3$s for your password and login instructions. If you do not receive an email, please check your junk or spam folder. If you still do not receive an email within an hour, you can <a href="%4$s">reset your password</a>.'),
104
+						network_site_url('wp-login.php', 'login'),
105 105
 						$signup->user_login,
106 106
 						$signup->user_email,
107 107
 						wp_lostpassword_url()
@@ -109,8 +109,8 @@  discard block
 block discarded – undo
109 109
 				} else {
110 110
 					printf(
111 111
 						/* translators: 1: site URL, 2: site domain, 3: username, 4: user email, 5: lost password URL */
112
-						__( 'Your site at <a href="%1$s">%2$s</a> is active. You may now log in to your site using your chosen username of &#8220;%3$s&#8221;. Please check your email inbox at %4$s for your password and login instructions. If you do not receive an email, please check your junk or spam folder. If you still do not receive an email within an hour, you can <a href="%5$s">reset your password</a>.' ),
113
-						'http://' . $signup->domain,
112
+						__('Your site at <a href="%1$s">%2$s</a> is active. You may now log in to your site using your chosen username of &#8220;%3$s&#8221;. Please check your email inbox at %4$s for your password and login instructions. If you do not receive an email, please check your junk or spam folder. If you still do not receive an email within an hour, you can <a href="%5$s">reset your password</a>.'),
113
+						'http://'.$signup->domain,
114 114
 						$signup->domain,
115 115
 						$signup->user_login,
116 116
 						$signup->user_email,
@@ -120,13 +120,13 @@  discard block
 block discarded – undo
120 120
 				echo '</p>';
121 121
 			} else {
122 122
 				?>
123
-				<h2><?php _e( 'An error occurred during the activation' ); ?></h2>
123
+				<h2><?php _e('An error occurred during the activation'); ?></h2>
124 124
 				<p><?php echo $result->get_error_message(); ?></p>
125 125
 				<?php
126 126
 			}
127 127
 		} else {
128
-			$url = isset( $result['blog_id'] ) ? get_home_url( (int) $result['blog_id'] ) : '';
129
-			$user = get_userdata( (int) $result['user_id'] );
128
+			$url = isset($result['blog_id']) ? get_home_url((int) $result['blog_id']) : '';
129
+			$user = get_userdata((int) $result['user_id']);
130 130
 			?>
131 131
 			<h2><?php _e('Your account is now active!'); ?></h2>
132 132
 
@@ -135,19 +135,19 @@  discard block
 block discarded – undo
135 135
 				<p><span class="h3"><?php _e('Password:'); ?></span> <?php echo $result['password']; ?></p>
136 136
 			</div>
137 137
 
138
-			<?php if ( $url && $url != network_home_url( '', 'http' ) ) :
139
-				switch_to_blog( (int) $result['blog_id'] );
138
+			<?php if ($url && $url != network_home_url('', 'http')) :
139
+				switch_to_blog((int) $result['blog_id']);
140 140
 				$login_url = wp_login_url();
141 141
 				restore_current_blog();
142 142
 				?>
143 143
 				<p class="view"><?php
144 144
 					/* translators: 1: site URL, 2: login URL */
145
-					printf( __( 'Your account is now activated. <a href="%1$s">View your site</a> or <a href="%2$s">Log in</a>' ), $url, esc_url( $login_url ) );
145
+					printf(__('Your account is now activated. <a href="%1$s">View your site</a> or <a href="%2$s">Log in</a>'), $url, esc_url($login_url));
146 146
 				?></p>
147 147
 			<?php else: ?>
148 148
 				<p class="view"><?php
149 149
 					/* translators: 1: login URL, 2: network home URL */
150
-					printf( __( 'Your account is now activated. <a href="%1$s">Log in</a> or go back to the <a href="%2$s">homepage</a>.' ), network_site_url( 'wp-login.php', 'login' ), network_home_url() );
150
+					printf(__('Your account is now activated. <a href="%1$s">Log in</a> or go back to the <a href="%2$s">homepage</a>.'), network_site_url('wp-login.php', 'login'), network_home_url());
151 151
 				?></p>
152 152
 			<?php endif;
153 153
 		}
@@ -159,4 +159,4 @@  discard block
 block discarded – undo
159 159
 	var key_input = document.getElementById('key');
160 160
 	key_input && key_input.focus();
161 161
 </script>
162
-<?php get_footer( 'wp-activate' );
162
+<?php get_footer('wp-activate');
Please login to merge, or discard this patch.
tools/i18n/t/data/not-gettexted-0.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,23 +1,23 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (! isset($wp_did_header)):
4
-if ( !file_exists( dirname(__FILE__) . '/wp-config.php') ) {
3
+if ( ! isset($wp_did_header)):
4
+if ( ! file_exists(dirname(__FILE__).'/wp-config.php')) {
5 5
 	if (strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false) $path = '';
6 6
 	else $path = 'wp-admin/';
7 7
 
8
-	require_once( dirname(__FILE__) . '/wp-includes/classes.php');
9
-	require_once( dirname(__FILE__) . '/wp-includes/functions.php');
10
-	require_once( dirname(__FILE__) . '/wp-includes/plugin.php');
11
-	wp_die( sprintf(/*WP_I18N_CONFIG*/" There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started. Need more help? <a href='https://codex.wordpress.org/Editing_wp-config.php'>We got it</a>. You can create a <code>wp-config.php</code> file through a web interface, but this doesn't work for all server setups. The safest way is to manually create the file.</p><p><a href='%s' class='button'>Create a Configuration File</a>" /*/WP_I18N_CONFIG*/, $path.'setup-config.php'), /*WP_I18N_ERROR*/ "WordPress &rsaquo; Error" /*/WP_I18N_ERROR*/);
8
+	require_once(dirname(__FILE__).'/wp-includes/classes.php');
9
+	require_once(dirname(__FILE__).'/wp-includes/functions.php');
10
+	require_once(dirname(__FILE__).'/wp-includes/plugin.php');
11
+	wp_die(sprintf(/*WP_I18N_CONFIG*/" There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started. Need more help? <a href='https://codex.wordpress.org/Editing_wp-config.php'>We got it</a>. You can create a <code>wp-config.php</code> file through a web interface, but this doesn't work for all server setups. The safest way is to manually create the file.</p><p><a href='%s' class='button'>Create a Configuration File</a>" /*/WP_I18N_CONFIG*/, $path.'setup-config.php'), /*WP_I18N_ERROR*/ "WordPress &rsaquo; Error" /*/WP_I18N_ERROR*/);
12 12
 }
13 13
 
14 14
 $wp_did_header = true;
15 15
 
16
-require_once( dirname(__FILE__) . '/wp-config.php');
16
+require_once(dirname(__FILE__).'/wp-config.php');
17 17
 
18 18
 wp();
19 19
 
20
-require_once(ABSPATH . WPINC . '/template-loader.php');
20
+require_once(ABSPATH.WPINC.'/template-loader.php');
21 21
 
22 22
 endif;
23 23
 
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,8 +2,11 @@
 block discarded – undo
2 2
 
3 3
 if (! isset($wp_did_header)):
4 4
 if ( !file_exists( dirname(__FILE__) . '/wp-config.php') ) {
5
-	if (strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false) $path = '';
6
-	else $path = 'wp-admin/';
5
+	if (strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false) {
6
+		$path = '';
7
+	} else {
8
+		$path = 'wp-admin/';
9
+	}
7 10
 
8 11
 	require_once( dirname(__FILE__) . '/wp-includes/classes.php');
9 12
 	require_once( dirname(__FILE__) . '/wp-includes/functions.php');
Please login to merge, or discard this patch.
src/wp-admin/includes/class-wp-filesystem-ssh2.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 	/**
264 264
 	 * @access public
265 265
 	 *
266
-	 * @return bool
266
+	 * @return string
267 267
 	 */
268 268
 	public function cwd() {
269 269
 		$cwd = ssh2_sftp_realpath( $this->sftp_link, '.' );
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 	 * @param string $group
291 291
 	 * @param bool   $recursive
292 292
 	 *
293
-	 * @return bool
293
+	 * @return boolean|string
294 294
 	 */
295 295
 	public function chgrp($file, $group, $recursive = false ) {
296 296
 		if ( ! $this->exists($file) )
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 	 * @param string     $file      Path to the file.
335 335
 	 * @param string|int $owner     A user name or number.
336 336
 	 * @param bool       $recursive Optional. If set True changes file owner recursivly. Default False.
337
-	 * @return bool True on success or false on failure.
337
+	 * @return boolean|string True on success or false on failure.
338 338
 	 */
339 339
 	public function chown( $file, $owner, $recursive = false ) {
340 340
 		if ( ! $this->exists($file) )
Please login to merge, or discard this patch.
Spacing   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -52,21 +52,21 @@  discard block
 block discarded – undo
52 52
 	 *
53 53
 	 * @param array $opt
54 54
 	 */
55
-	public function __construct( $opt = '' ) {
55
+	public function __construct($opt = '') {
56 56
 		$this->method = 'ssh2';
57 57
 		$this->errors = new WP_Error();
58 58
 
59 59
 		//Check if possible to use ssh2 functions.
60
-		if ( ! extension_loaded('ssh2') ) {
60
+		if ( ! extension_loaded('ssh2')) {
61 61
 			$this->errors->add('no_ssh2_ext', __('The ssh2 PHP extension is not available'));
62 62
 			return;
63 63
 		}
64
-		if ( !function_exists('stream_get_contents') ) {
64
+		if ( ! function_exists('stream_get_contents')) {
65 65
 			$this->errors->add(
66 66
 				'ssh2_php_requirement',
67 67
 				sprintf(
68 68
 					/* translators: %s: stream_get_contents() */
69
-					__( 'The ssh2 PHP extension is available, however, we require the PHP5 function %s' ),
69
+					__('The ssh2 PHP extension is available, however, we require the PHP5 function %s'),
70 70
 					'<code>stream_get_contents()</code>'
71 71
 				)
72 72
 			);
@@ -74,34 +74,34 @@  discard block
 block discarded – undo
74 74
 		}
75 75
 
76 76
 		// Set defaults:
77
-		if ( empty($opt['port']) )
77
+		if (empty($opt['port']))
78 78
 			$this->options['port'] = 22;
79 79
 		else
80 80
 			$this->options['port'] = $opt['port'];
81 81
 
82
-		if ( empty($opt['hostname']) )
82
+		if (empty($opt['hostname']))
83 83
 			$this->errors->add('empty_hostname', __('SSH2 hostname is required'));
84 84
 		else
85 85
 			$this->options['hostname'] = $opt['hostname'];
86 86
 
87 87
 		// Check if the options provided are OK.
88
-		if ( !empty ($opt['public_key']) && !empty ($opt['private_key']) ) {
88
+		if ( ! empty ($opt['public_key']) && ! empty ($opt['private_key'])) {
89 89
 			$this->options['public_key'] = $opt['public_key'];
90 90
 			$this->options['private_key'] = $opt['private_key'];
91 91
 
92 92
 			$this->options['hostkey'] = array('hostkey' => 'ssh-rsa');
93 93
 
94 94
 			$this->keys = true;
95
-		} elseif ( empty ($opt['username']) ) {
95
+		} elseif (empty ($opt['username'])) {
96 96
 			$this->errors->add('empty_username', __('SSH2 username is required'));
97 97
 		}
98 98
 
99
-		if ( !empty($opt['username']) )
99
+		if ( ! empty($opt['username']))
100 100
 			$this->options['username'] = $opt['username'];
101 101
 
102
-		if ( empty ($opt['password']) ) {
102
+		if (empty ($opt['password'])) {
103 103
 			// Password can be blank if we are using keys.
104
-			if ( !$this->keys )
104
+			if ( ! $this->keys)
105 105
 				$this->errors->add('empty_password', __('SSH2 password is required'));
106 106
 		} else {
107 107
 			$this->options['password'] = $opt['password'];
@@ -114,37 +114,37 @@  discard block
 block discarded – undo
114 114
 	 * @return bool
115 115
 	 */
116 116
 	public function connect() {
117
-		if ( ! $this->keys ) {
117
+		if ( ! $this->keys) {
118 118
 			$this->link = @ssh2_connect($this->options['hostname'], $this->options['port']);
119 119
 		} else {
120 120
 			$this->link = @ssh2_connect($this->options['hostname'], $this->options['port'], $this->options['hostkey']);
121 121
 		}
122 122
 
123
-		if ( ! $this->link ) {
124
-			$this->errors->add( 'connect',
123
+		if ( ! $this->link) {
124
+			$this->errors->add('connect',
125 125
 				/* translators: %s: hostname:port */
126
-				sprintf( __( 'Failed to connect to SSH2 Server %s' ),
127
-					$this->options['hostname'] . ':' . $this->options['port']
126
+				sprintf(__('Failed to connect to SSH2 Server %s'),
127
+					$this->options['hostname'].':'.$this->options['port']
128 128
 				)
129 129
 			);
130 130
 			return false;
131 131
 		}
132 132
 
133
-		if ( !$this->keys ) {
134
-			if ( ! @ssh2_auth_password($this->link, $this->options['username'], $this->options['password']) ) {
135
-				$this->errors->add( 'auth',
133
+		if ( ! $this->keys) {
134
+			if ( ! @ssh2_auth_password($this->link, $this->options['username'], $this->options['password'])) {
135
+				$this->errors->add('auth',
136 136
 					/* translators: %s: username */
137
-					sprintf( __( 'Username/Password incorrect for %s' ),
137
+					sprintf(__('Username/Password incorrect for %s'),
138 138
 						$this->options['username']
139 139
 					)
140 140
 				);
141 141
 				return false;
142 142
 			}
143 143
 		} else {
144
-			if ( ! @ssh2_auth_pubkey_file($this->link, $this->options['username'], $this->options['public_key'], $this->options['private_key'], $this->options['password'] ) ) {
145
-				$this->errors->add( 'auth',
144
+			if ( ! @ssh2_auth_pubkey_file($this->link, $this->options['username'], $this->options['public_key'], $this->options['private_key'], $this->options['password'])) {
145
+				$this->errors->add('auth',
146 146
 					/* translators: %s: username */
147
-					sprintf( __( 'Public and Private keys incorrect for %s' ),
147
+					sprintf(__('Public and Private keys incorrect for %s'),
148 148
 						$this->options['username']
149 149
 					)
150 150
 				);
@@ -152,12 +152,12 @@  discard block
 block discarded – undo
152 152
 			}
153 153
 		}
154 154
 
155
-		$this->sftp_link = ssh2_sftp( $this->link );
156
-		if ( ! $this->sftp_link ) {
157
-			$this->errors->add( 'connect',
155
+		$this->sftp_link = ssh2_sftp($this->link);
156
+		if ( ! $this->sftp_link) {
157
+			$this->errors->add('connect',
158 158
 				/* translators: %s: hostname:port */
159
-				sprintf( __( 'Failed to initialize a SFTP subsystem session with the SSH2 Server %s' ),
160
-					$this->options['hostname'] . ':' . $this->options['port']
159
+				sprintf(__('Failed to initialize a SFTP subsystem session with the SSH2 Server %s'),
160
+					$this->options['hostname'].':'.$this->options['port']
161 161
 				)
162 162
 			);
163 163
 			return false;
@@ -181,11 +181,11 @@  discard block
 block discarded – undo
181 181
 	 * @param string $path The File/Directory path on the remote server to return
182 182
 	 * @return string The ssh2.sftp:// wrapped path to use.
183 183
 	 */
184
-	public function sftp_path( $path ) {
185
-		if ( '/' === $path ) {
184
+	public function sftp_path($path) {
185
+		if ('/' === $path) {
186 186
 			$path = '/./';
187 187
 		}
188
-		return 'ssh2.sftp://' . $this->sftp_link . '/' . ltrim( $path, '/' );
188
+		return 'ssh2.sftp://'.$this->sftp_link.'/'.ltrim($path, '/');
189 189
 	}
190 190
 
191 191
 	/**
@@ -196,25 +196,25 @@  discard block
 block discarded – undo
196 196
 	 * @return bool|string True on success, false on failure. String if the command was executed, `$returnbool`
197 197
 	 *                     is false (default), and data from the resulting stream was retrieved.
198 198
 	 */
199
-	public function run_command( $command, $returnbool = false ) {
200
-		if ( ! $this->link )
199
+	public function run_command($command, $returnbool = false) {
200
+		if ( ! $this->link)
201 201
 			return false;
202 202
 
203
-		if ( ! ($stream = ssh2_exec($this->link, $command)) ) {
204
-			$this->errors->add( 'command',
203
+		if ( ! ($stream = ssh2_exec($this->link, $command))) {
204
+			$this->errors->add('command',
205 205
 				/* translators: %s: command */
206
-				sprintf( __( 'Unable to perform command: %s'),
206
+				sprintf(__('Unable to perform command: %s'),
207 207
 					$command
208 208
 				)
209 209
 			);
210 210
 		} else {
211
-			stream_set_blocking( $stream, true );
212
-			stream_set_timeout( $stream, FS_TIMEOUT );
213
-			$data = stream_get_contents( $stream );
214
-			fclose( $stream );
211
+			stream_set_blocking($stream, true);
212
+			stream_set_timeout($stream, FS_TIMEOUT);
213
+			$data = stream_get_contents($stream);
214
+			fclose($stream);
215 215
 
216
-			if ( $returnbool )
217
-				return ( $data === false ) ? false : '' != trim($data);
216
+			if ($returnbool)
217
+				return ($data === false) ? false : '' != trim($data);
218 218
 			else
219 219
 				return $data;
220 220
 		}
@@ -227,8 +227,8 @@  discard block
 block discarded – undo
227 227
 	 * @param string $file
228 228
 	 * @return string|false
229 229
 	 */
230
-	public function get_contents( $file ) {
231
-		return file_get_contents( $this->sftp_path( $file ) );
230
+	public function get_contents($file) {
231
+		return file_get_contents($this->sftp_path($file));
232 232
 	}
233 233
 
234 234
 	/**
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 	 * @return array
239 239
 	 */
240 240
 	public function get_contents_array($file) {
241
-		return file( $this->sftp_path( $file ) );
241
+		return file($this->sftp_path($file));
242 242
 	}
243 243
 
244 244
 	/**
@@ -249,10 +249,10 @@  discard block
 block discarded – undo
249 249
 	 * @param bool|int $mode
250 250
 	 * @return bool
251 251
 	 */
252
-	public function put_contents($file, $contents, $mode = false ) {
253
-		$ret = file_put_contents( $this->sftp_path( $file ), $contents );
252
+	public function put_contents($file, $contents, $mode = false) {
253
+		$ret = file_put_contents($this->sftp_path($file), $contents);
254 254
 
255
-		if ( $ret !== strlen( $contents ) )
255
+		if ($ret !== strlen($contents))
256 256
 			return false;
257 257
 
258 258
 		$this->chmod($file, $mode);
@@ -266,9 +266,9 @@  discard block
 block discarded – undo
266 266
 	 * @return bool
267 267
 	 */
268 268
 	public function cwd() {
269
-		$cwd = ssh2_sftp_realpath( $this->sftp_link, '.' );
270
-		if ( $cwd ) {
271
-			$cwd = trailingslashit( trim( $cwd ) );
269
+		$cwd = ssh2_sftp_realpath($this->sftp_link, '.');
270
+		if ($cwd) {
271
+			$cwd = trailingslashit(trim($cwd));
272 272
 		}
273 273
 		return $cwd;
274 274
 	}
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 	 * @return bool|string
281 281
 	 */
282 282
 	public function chdir($dir) {
283
-		return $this->run_command('cd ' . $dir, true);
283
+		return $this->run_command('cd '.$dir, true);
284 284
 	}
285 285
 
286 286
 	/**
@@ -292,10 +292,10 @@  discard block
 block discarded – undo
292 292
 	 *
293 293
 	 * @return bool
294 294
 	 */
295
-	public function chgrp($file, $group, $recursive = false ) {
296
-		if ( ! $this->exists($file) )
295
+	public function chgrp($file, $group, $recursive = false) {
296
+		if ( ! $this->exists($file))
297 297
 			return false;
298
-		if ( ! $recursive || ! $this->is_dir($file) )
298
+		if ( ! $recursive || ! $this->is_dir($file))
299 299
 			return $this->run_command(sprintf('chgrp %s %s', escapeshellarg($group), escapeshellarg($file)), true);
300 300
 		return $this->run_command(sprintf('chgrp -R %s %s', escapeshellarg($group), escapeshellarg($file)), true);
301 301
 	}
@@ -309,19 +309,19 @@  discard block
 block discarded – undo
309 309
 	 * @return bool|string
310 310
 	 */
311 311
 	public function chmod($file, $mode = false, $recursive = false) {
312
-		if ( ! $this->exists($file) )
312
+		if ( ! $this->exists($file))
313 313
 			return false;
314 314
 
315
-		if ( ! $mode ) {
316
-			if ( $this->is_file($file) )
315
+		if ( ! $mode) {
316
+			if ($this->is_file($file))
317 317
 				$mode = FS_CHMOD_FILE;
318
-			elseif ( $this->is_dir($file) )
318
+			elseif ($this->is_dir($file))
319 319
 				$mode = FS_CHMOD_DIR;
320 320
 			else
321 321
 				return false;
322 322
 		}
323 323
 
324
-		if ( ! $recursive || ! $this->is_dir($file) )
324
+		if ( ! $recursive || ! $this->is_dir($file))
325 325
 			return $this->run_command(sprintf('chmod %o %s', $mode, escapeshellarg($file)), true);
326 326
 		return $this->run_command(sprintf('chmod -R %o %s', $mode, escapeshellarg($file)), true);
327 327
 	}
@@ -336,10 +336,10 @@  discard block
 block discarded – undo
336 336
 	 * @param bool       $recursive Optional. If set True changes file owner recursivly. Default False.
337 337
 	 * @return bool True on success or false on failure.
338 338
 	 */
339
-	public function chown( $file, $owner, $recursive = false ) {
340
-		if ( ! $this->exists($file) )
339
+	public function chown($file, $owner, $recursive = false) {
340
+		if ( ! $this->exists($file))
341 341
 			return false;
342
-		if ( ! $recursive || ! $this->is_dir($file) )
342
+		if ( ! $recursive || ! $this->is_dir($file))
343 343
 			return $this->run_command(sprintf('chown %s %s', escapeshellarg($owner), escapeshellarg($file)), true);
344 344
 		return $this->run_command(sprintf('chown -R %s %s', escapeshellarg($owner), escapeshellarg($file)), true);
345 345
 	}
@@ -351,10 +351,10 @@  discard block
 block discarded – undo
351 351
 	 * @return string|false
352 352
 	 */
353 353
 	public function owner($file) {
354
-		$owneruid = @fileowner( $this->sftp_path( $file ) );
355
-		if ( ! $owneruid )
354
+		$owneruid = @fileowner($this->sftp_path($file));
355
+		if ( ! $owneruid)
356 356
 			return false;
357
-		if ( ! function_exists('posix_getpwuid') )
357
+		if ( ! function_exists('posix_getpwuid'))
358 358
 			return $owneruid;
359 359
 		$ownerarray = posix_getpwuid($owneruid);
360 360
 		return $ownerarray['name'];
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
 	 * @return string
368 368
 	 */
369 369
 	public function getchmod($file) {
370
-		return substr( decoct( @fileperms( $this->sftp_path( $file ) ) ), -3 );
370
+		return substr(decoct(@fileperms($this->sftp_path($file))), -3);
371 371
 	}
372 372
 
373 373
 	/**
@@ -377,10 +377,10 @@  discard block
 block discarded – undo
377 377
 	 * @return string|false
378 378
 	 */
379 379
 	public function group($file) {
380
-		$gid = @filegroup( $this->sftp_path( $file ) );
381
-		if ( ! $gid )
380
+		$gid = @filegroup($this->sftp_path($file));
381
+		if ( ! $gid)
382 382
 			return false;
383
-		if ( ! function_exists('posix_getgrgid') )
383
+		if ( ! function_exists('posix_getgrgid'))
384 384
 			return $gid;
385 385
 		$grouparray = posix_getgrgid($gid);
386 386
 		return $grouparray['name'];
@@ -396,10 +396,10 @@  discard block
 block discarded – undo
396 396
 	 * @return bool
397 397
 	 */
398 398
 	public function copy($source, $destination, $overwrite = false, $mode = false) {
399
-		if ( ! $overwrite && $this->exists($destination) )
399
+		if ( ! $overwrite && $this->exists($destination))
400 400
 			return false;
401 401
 		$content = $this->get_contents($source);
402
-		if ( false === $content)
402
+		if (false === $content)
403 403
 			return false;
404 404
 		return $this->put_contents($destination, $content, $mode);
405 405
 	}
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 	 * @return bool
414 414
 	 */
415 415
 	public function move($source, $destination, $overwrite = false) {
416
-		return @ssh2_sftp_rename( $this->sftp_link, $source, $destination );
416
+		return @ssh2_sftp_rename($this->sftp_link, $source, $destination);
417 417
 	}
418 418
 
419 419
 	/**
@@ -425,14 +425,14 @@  discard block
 block discarded – undo
425 425
 	 * @return bool
426 426
 	 */
427 427
 	public function delete($file, $recursive = false, $type = false) {
428
-		if ( 'f' == $type || $this->is_file($file) )
428
+		if ('f' == $type || $this->is_file($file))
429 429
 			return ssh2_sftp_unlink($this->sftp_link, $file);
430
-		if ( ! $recursive )
430
+		if ( ! $recursive)
431 431
 			 return ssh2_sftp_rmdir($this->sftp_link, $file);
432 432
 		$filelist = $this->dirlist($file);
433
-		if ( is_array($filelist) ) {
434
-			foreach ( $filelist as $filename => $fileinfo) {
435
-				$this->delete($file . '/' . $filename, $recursive, $fileinfo['type']);
433
+		if (is_array($filelist)) {
434
+			foreach ($filelist as $filename => $fileinfo) {
435
+				$this->delete($file.'/'.$filename, $recursive, $fileinfo['type']);
436 436
 			}
437 437
 		}
438 438
 		return ssh2_sftp_rmdir($this->sftp_link, $file);
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 	 * @return bool
446 446
 	 */
447 447
 	public function exists($file) {
448
-		return file_exists( $this->sftp_path( $file ) );
448
+		return file_exists($this->sftp_path($file));
449 449
 	}
450 450
 
451 451
 	/**
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
 	 * @return bool
456 456
 	 */
457 457
 	public function is_file($file) {
458
-		return is_file( $this->sftp_path( $file ) );
458
+		return is_file($this->sftp_path($file));
459 459
 	}
460 460
 
461 461
 	/**
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 	 * @return bool
466 466
 	 */
467 467
 	public function is_dir($path) {
468
-		return is_dir( $this->sftp_path( $path ) );
468
+		return is_dir($this->sftp_path($path));
469 469
 	}
470 470
 
471 471
 	/**
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
 	 * @return bool
476 476
 	 */
477 477
 	public function is_readable($file) {
478
-		return is_readable( $this->sftp_path( $file ) );
478
+		return is_readable($this->sftp_path($file));
479 479
 	}
480 480
 
481 481
 	/**
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 	 * @return int
497 497
 	 */
498 498
 	public function atime($file) {
499
-		return fileatime( $this->sftp_path( $file ) );
499
+		return fileatime($this->sftp_path($file));
500 500
 	}
501 501
 
502 502
 	/**
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
 	 * @return int
507 507
 	 */
508 508
 	public function mtime($file) {
509
-		return filemtime( $this->sftp_path( $file ) );
509
+		return filemtime($this->sftp_path($file));
510 510
 	}
511 511
 
512 512
 	/**
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
 	 * @return int
517 517
 	 */
518 518
 	public function size($file) {
519
-		return filesize( $this->sftp_path( $file ) );
519
+		return filesize($this->sftp_path($file));
520 520
 	}
521 521
 
522 522
 	/**
@@ -541,16 +541,16 @@  discard block
 block discarded – undo
541 541
 	 */
542 542
 	public function mkdir($path, $chmod = false, $chown = false, $chgrp = false) {
543 543
 		$path = untrailingslashit($path);
544
-		if ( empty($path) )
544
+		if (empty($path))
545 545
 			return false;
546 546
 
547
-		if ( ! $chmod )
547
+		if ( ! $chmod)
548 548
 			$chmod = FS_CHMOD_DIR;
549
-		if ( ! ssh2_sftp_mkdir($this->sftp_link, $path, $chmod, true) )
549
+		if ( ! ssh2_sftp_mkdir($this->sftp_link, $path, $chmod, true))
550 550
 			return false;
551
-		if ( $chown )
551
+		if ($chown)
552 552
 			$this->chown($path, $chown);
553
-		if ( $chgrp )
553
+		if ($chgrp)
554 554
 			$this->chgrp($path, $chgrp);
555 555
 		return true;
556 556
 	}
@@ -575,54 +575,54 @@  discard block
 block discarded – undo
575 575
 	 * @return bool|array
576 576
 	 */
577 577
 	public function dirlist($path, $include_hidden = true, $recursive = false) {
578
-		if ( $this->is_file($path) ) {
578
+		if ($this->is_file($path)) {
579 579
 			$limit_file = basename($path);
580 580
 			$path = dirname($path);
581 581
 		} else {
582 582
 			$limit_file = false;
583 583
 		}
584 584
 
585
-		if ( ! $this->is_dir($path) )
585
+		if ( ! $this->is_dir($path))
586 586
 			return false;
587 587
 
588 588
 		$ret = array();
589
-		$dir = @dir( $this->sftp_path( $path ) );
589
+		$dir = @dir($this->sftp_path($path));
590 590
 
591
-		if ( ! $dir )
591
+		if ( ! $dir)
592 592
 			return false;
593 593
 
594
-		while (false !== ($entry = $dir->read()) ) {
594
+		while (false !== ($entry = $dir->read())) {
595 595
 			$struc = array();
596 596
 			$struc['name'] = $entry;
597 597
 
598
-			if ( '.' == $struc['name'] || '..' == $struc['name'] )
598
+			if ('.' == $struc['name'] || '..' == $struc['name'])
599 599
 				continue; //Do not care about these folders.
600 600
 
601
-			if ( ! $include_hidden && '.' == $struc['name'][0] )
601
+			if ( ! $include_hidden && '.' == $struc['name'][0])
602 602
 				continue;
603 603
 
604
-			if ( $limit_file && $struc['name'] != $limit_file )
604
+			if ($limit_file && $struc['name'] != $limit_file)
605 605
 				continue;
606 606
 
607 607
 			$struc['perms'] 	= $this->gethchmod($path.'/'.$entry);
608 608
 			$struc['permsn']	= $this->getnumchmodfromh($struc['perms']);
609
-			$struc['number'] 	= false;
609
+			$struc['number'] = false;
610 610
 			$struc['owner']    	= $this->owner($path.'/'.$entry);
611 611
 			$struc['group']    	= $this->group($path.'/'.$entry);
612 612
 			$struc['size']    	= $this->size($path.'/'.$entry);
613
-			$struc['lastmodunix']= $this->mtime($path.'/'.$entry);
614
-			$struc['lastmod']   = date('M j',$struc['lastmodunix']);
615
-			$struc['time']    	= date('h:i:s',$struc['lastmodunix']);
616
-			$struc['type']		= $this->is_dir($path.'/'.$entry) ? 'd' : 'f';
617
-
618
-			if ( 'd' == $struc['type'] ) {
619
-				if ( $recursive )
620
-					$struc['files'] = $this->dirlist($path . '/' . $struc['name'], $include_hidden, $recursive);
613
+			$struc['lastmodunix'] = $this->mtime($path.'/'.$entry);
614
+			$struc['lastmod']   = date('M j', $struc['lastmodunix']);
615
+			$struc['time']    	= date('h:i:s', $struc['lastmodunix']);
616
+			$struc['type'] = $this->is_dir($path.'/'.$entry) ? 'd' : 'f';
617
+
618
+			if ('d' == $struc['type']) {
619
+				if ($recursive)
620
+					$struc['files'] = $this->dirlist($path.'/'.$struc['name'], $include_hidden, $recursive);
621 621
 				else
622 622
 					$struc['files'] = array();
623 623
 			}
624 624
 
625
-			$ret[ $struc['name'] ] = $struc;
625
+			$ret[$struc['name']] = $struc;
626 626
 		}
627 627
 		$dir->close();
628 628
 		unset($dir);
Please login to merge, or discard this patch.
Braces   +112 added lines, -78 removed lines patch added patch discarded remove patch
@@ -74,15 +74,17 @@  discard block
 block discarded – undo
74 74
 		}
75 75
 
76 76
 		// Set defaults:
77
-		if ( empty($opt['port']) )
78
-			$this->options['port'] = 22;
79
-		else
80
-			$this->options['port'] = $opt['port'];
77
+		if ( empty($opt['port']) ) {
78
+					$this->options['port'] = 22;
79
+		} else {
80
+					$this->options['port'] = $opt['port'];
81
+		}
81 82
 
82
-		if ( empty($opt['hostname']) )
83
-			$this->errors->add('empty_hostname', __('SSH2 hostname is required'));
84
-		else
85
-			$this->options['hostname'] = $opt['hostname'];
83
+		if ( empty($opt['hostname']) ) {
84
+					$this->errors->add('empty_hostname', __('SSH2 hostname is required'));
85
+		} else {
86
+					$this->options['hostname'] = $opt['hostname'];
87
+		}
86 88
 
87 89
 		// Check if the options provided are OK.
88 90
 		if ( !empty ($opt['public_key']) && !empty ($opt['private_key']) ) {
@@ -96,13 +98,15 @@  discard block
 block discarded – undo
96 98
 			$this->errors->add('empty_username', __('SSH2 username is required'));
97 99
 		}
98 100
 
99
-		if ( !empty($opt['username']) )
100
-			$this->options['username'] = $opt['username'];
101
+		if ( !empty($opt['username']) ) {
102
+					$this->options['username'] = $opt['username'];
103
+		}
101 104
 
102 105
 		if ( empty ($opt['password']) ) {
103 106
 			// Password can be blank if we are using keys.
104
-			if ( !$this->keys )
105
-				$this->errors->add('empty_password', __('SSH2 password is required'));
107
+			if ( !$this->keys ) {
108
+							$this->errors->add('empty_password', __('SSH2 password is required'));
109
+			}
106 110
 		} else {
107 111
 			$this->options['password'] = $opt['password'];
108 112
 		}
@@ -197,8 +201,9 @@  discard block
 block discarded – undo
197 201
 	 *                     is false (default), and data from the resulting stream was retrieved.
198 202
 	 */
199 203
 	public function run_command( $command, $returnbool = false ) {
200
-		if ( ! $this->link )
201
-			return false;
204
+		if ( ! $this->link ) {
205
+					return false;
206
+		}
202 207
 
203 208
 		if ( ! ($stream = ssh2_exec($this->link, $command)) ) {
204 209
 			$this->errors->add( 'command',
@@ -213,10 +218,11 @@  discard block
 block discarded – undo
213 218
 			$data = stream_get_contents( $stream );
214 219
 			fclose( $stream );
215 220
 
216
-			if ( $returnbool )
217
-				return ( $data === false ) ? false : '' != trim($data);
218
-			else
219
-				return $data;
221
+			if ( $returnbool ) {
222
+							return ( $data === false ) ? false : '' != trim($data);
223
+			} else {
224
+							return $data;
225
+			}
220 226
 		}
221 227
 		return false;
222 228
 	}
@@ -252,8 +258,9 @@  discard block
 block discarded – undo
252 258
 	public function put_contents($file, $contents, $mode = false ) {
253 259
 		$ret = file_put_contents( $this->sftp_path( $file ), $contents );
254 260
 
255
-		if ( $ret !== strlen( $contents ) )
256
-			return false;
261
+		if ( $ret !== strlen( $contents ) ) {
262
+					return false;
263
+		}
257 264
 
258 265
 		$this->chmod($file, $mode);
259 266
 
@@ -293,10 +300,12 @@  discard block
 block discarded – undo
293 300
 	 * @return bool
294 301
 	 */
295 302
 	public function chgrp($file, $group, $recursive = false ) {
296
-		if ( ! $this->exists($file) )
297
-			return false;
298
-		if ( ! $recursive || ! $this->is_dir($file) )
299
-			return $this->run_command(sprintf('chgrp %s %s', escapeshellarg($group), escapeshellarg($file)), true);
303
+		if ( ! $this->exists($file) ) {
304
+					return false;
305
+		}
306
+		if ( ! $recursive || ! $this->is_dir($file) ) {
307
+					return $this->run_command(sprintf('chgrp %s %s', escapeshellarg($group), escapeshellarg($file)), true);
308
+		}
300 309
 		return $this->run_command(sprintf('chgrp -R %s %s', escapeshellarg($group), escapeshellarg($file)), true);
301 310
 	}
302 311
 
@@ -309,20 +318,23 @@  discard block
 block discarded – undo
309 318
 	 * @return bool|string
310 319
 	 */
311 320
 	public function chmod($file, $mode = false, $recursive = false) {
312
-		if ( ! $this->exists($file) )
313
-			return false;
321
+		if ( ! $this->exists($file) ) {
322
+					return false;
323
+		}
314 324
 
315 325
 		if ( ! $mode ) {
316
-			if ( $this->is_file($file) )
317
-				$mode = FS_CHMOD_FILE;
318
-			elseif ( $this->is_dir($file) )
319
-				$mode = FS_CHMOD_DIR;
320
-			else
321
-				return false;
326
+			if ( $this->is_file($file) ) {
327
+							$mode = FS_CHMOD_FILE;
328
+			} elseif ( $this->is_dir($file) ) {
329
+							$mode = FS_CHMOD_DIR;
330
+			} else {
331
+							return false;
332
+			}
322 333
 		}
323 334
 
324
-		if ( ! $recursive || ! $this->is_dir($file) )
325
-			return $this->run_command(sprintf('chmod %o %s', $mode, escapeshellarg($file)), true);
335
+		if ( ! $recursive || ! $this->is_dir($file) ) {
336
+					return $this->run_command(sprintf('chmod %o %s', $mode, escapeshellarg($file)), true);
337
+		}
326 338
 		return $this->run_command(sprintf('chmod -R %o %s', $mode, escapeshellarg($file)), true);
327 339
 	}
328 340
 
@@ -337,10 +349,12 @@  discard block
 block discarded – undo
337 349
 	 * @return bool True on success or false on failure.
338 350
 	 */
339 351
 	public function chown( $file, $owner, $recursive = false ) {
340
-		if ( ! $this->exists($file) )
341
-			return false;
342
-		if ( ! $recursive || ! $this->is_dir($file) )
343
-			return $this->run_command(sprintf('chown %s %s', escapeshellarg($owner), escapeshellarg($file)), true);
352
+		if ( ! $this->exists($file) ) {
353
+					return false;
354
+		}
355
+		if ( ! $recursive || ! $this->is_dir($file) ) {
356
+					return $this->run_command(sprintf('chown %s %s', escapeshellarg($owner), escapeshellarg($file)), true);
357
+		}
344 358
 		return $this->run_command(sprintf('chown -R %s %s', escapeshellarg($owner), escapeshellarg($file)), true);
345 359
 	}
346 360
 
@@ -352,10 +366,12 @@  discard block
 block discarded – undo
352 366
 	 */
353 367
 	public function owner($file) {
354 368
 		$owneruid = @fileowner( $this->sftp_path( $file ) );
355
-		if ( ! $owneruid )
356
-			return false;
357
-		if ( ! function_exists('posix_getpwuid') )
358
-			return $owneruid;
369
+		if ( ! $owneruid ) {
370
+					return false;
371
+		}
372
+		if ( ! function_exists('posix_getpwuid') ) {
373
+					return $owneruid;
374
+		}
359 375
 		$ownerarray = posix_getpwuid($owneruid);
360 376
 		return $ownerarray['name'];
361 377
 	}
@@ -378,10 +394,12 @@  discard block
 block discarded – undo
378 394
 	 */
379 395
 	public function group($file) {
380 396
 		$gid = @filegroup( $this->sftp_path( $file ) );
381
-		if ( ! $gid )
382
-			return false;
383
-		if ( ! function_exists('posix_getgrgid') )
384
-			return $gid;
397
+		if ( ! $gid ) {
398
+					return false;
399
+		}
400
+		if ( ! function_exists('posix_getgrgid') ) {
401
+					return $gid;
402
+		}
385 403
 		$grouparray = posix_getgrgid($gid);
386 404
 		return $grouparray['name'];
387 405
 	}
@@ -396,11 +414,13 @@  discard block
 block discarded – undo
396 414
 	 * @return bool
397 415
 	 */
398 416
 	public function copy($source, $destination, $overwrite = false, $mode = false) {
399
-		if ( ! $overwrite && $this->exists($destination) )
400
-			return false;
417
+		if ( ! $overwrite && $this->exists($destination) ) {
418
+					return false;
419
+		}
401 420
 		$content = $this->get_contents($source);
402
-		if ( false === $content)
403
-			return false;
421
+		if ( false === $content) {
422
+					return false;
423
+		}
404 424
 		return $this->put_contents($destination, $content, $mode);
405 425
 	}
406 426
 
@@ -425,10 +445,12 @@  discard block
 block discarded – undo
425 445
 	 * @return bool
426 446
 	 */
427 447
 	public function delete($file, $recursive = false, $type = false) {
428
-		if ( 'f' == $type || $this->is_file($file) )
429
-			return ssh2_sftp_unlink($this->sftp_link, $file);
430
-		if ( ! $recursive )
431
-			 return ssh2_sftp_rmdir($this->sftp_link, $file);
448
+		if ( 'f' == $type || $this->is_file($file) ) {
449
+					return ssh2_sftp_unlink($this->sftp_link, $file);
450
+		}
451
+		if ( ! $recursive ) {
452
+					 return ssh2_sftp_rmdir($this->sftp_link, $file);
453
+		}
432 454
 		$filelist = $this->dirlist($file);
433 455
 		if ( is_array($filelist) ) {
434 456
 			foreach ( $filelist as $filename => $fileinfo) {
@@ -541,17 +563,22 @@  discard block
 block discarded – undo
541 563
 	 */
542 564
 	public function mkdir($path, $chmod = false, $chown = false, $chgrp = false) {
543 565
 		$path = untrailingslashit($path);
544
-		if ( empty($path) )
545
-			return false;
566
+		if ( empty($path) ) {
567
+					return false;
568
+		}
546 569
 
547
-		if ( ! $chmod )
548
-			$chmod = FS_CHMOD_DIR;
549
-		if ( ! ssh2_sftp_mkdir($this->sftp_link, $path, $chmod, true) )
550
-			return false;
551
-		if ( $chown )
552
-			$this->chown($path, $chown);
553
-		if ( $chgrp )
554
-			$this->chgrp($path, $chgrp);
570
+		if ( ! $chmod ) {
571
+					$chmod = FS_CHMOD_DIR;
572
+		}
573
+		if ( ! ssh2_sftp_mkdir($this->sftp_link, $path, $chmod, true) ) {
574
+					return false;
575
+		}
576
+		if ( $chown ) {
577
+					$this->chown($path, $chown);
578
+		}
579
+		if ( $chgrp ) {
580
+					$this->chgrp($path, $chgrp);
581
+		}
555 582
 		return true;
556 583
 	}
557 584
 
@@ -582,27 +609,33 @@  discard block
 block discarded – undo
582 609
 			$limit_file = false;
583 610
 		}
584 611
 
585
-		if ( ! $this->is_dir($path) )
586
-			return false;
612
+		if ( ! $this->is_dir($path) ) {
613
+					return false;
614
+		}
587 615
 
588 616
 		$ret = array();
589 617
 		$dir = @dir( $this->sftp_path( $path ) );
590 618
 
591
-		if ( ! $dir )
592
-			return false;
619
+		if ( ! $dir ) {
620
+					return false;
621
+		}
593 622
 
594 623
 		while (false !== ($entry = $dir->read()) ) {
595 624
 			$struc = array();
596 625
 			$struc['name'] = $entry;
597 626
 
598
-			if ( '.' == $struc['name'] || '..' == $struc['name'] )
599
-				continue; //Do not care about these folders.
627
+			if ( '.' == $struc['name'] || '..' == $struc['name'] ) {
628
+							continue;
629
+			}
630
+			//Do not care about these folders.
600 631
 
601
-			if ( ! $include_hidden && '.' == $struc['name'][0] )
602
-				continue;
632
+			if ( ! $include_hidden && '.' == $struc['name'][0] ) {
633
+							continue;
634
+			}
603 635
 
604
-			if ( $limit_file && $struc['name'] != $limit_file )
605
-				continue;
636
+			if ( $limit_file && $struc['name'] != $limit_file ) {
637
+							continue;
638
+			}
606 639
 
607 640
 			$struc['perms'] 	= $this->gethchmod($path.'/'.$entry);
608 641
 			$struc['permsn']	= $this->getnumchmodfromh($struc['perms']);
@@ -616,10 +649,11 @@  discard block
 block discarded – undo
616 649
 			$struc['type']		= $this->is_dir($path.'/'.$entry) ? 'd' : 'f';
617 650
 
618 651
 			if ( 'd' == $struc['type'] ) {
619
-				if ( $recursive )
620
-					$struc['files'] = $this->dirlist($path . '/' . $struc['name'], $include_hidden, $recursive);
621
-				else
622
-					$struc['files'] = array();
652
+				if ( $recursive ) {
653
+									$struc['files'] = $this->dirlist($path . '/' . $struc['name'], $include_hidden, $recursive);
654
+				} else {
655
+									$struc['files'] = array();
656
+				}
623 657
 			}
624 658
 
625 659
 			$ret[ $struc['name'] ] = $struc;
Please login to merge, or discard this patch.
src/wp-includes/date.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -804,7 +804,7 @@
 block discarded – undo
804 804
 	 *
805 805
 	 * @param string $compare The compare operator to use
806 806
 	 * @param string|array $value The value
807
-	 * @return string|false|int The value to be used in SQL or false on error.
807
+	 * @return string The value to be used in SQL or false on error.
808 808
 	 */
809 809
 	public function build_value( $compare, $value ) {
810 810
 		if ( ! isset( $value ) )
Please login to merge, or discard this patch.
Spacing   +197 added lines, -197 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	 * @access public
61 61
 	 * @var array
62 62
 	 */
63
-	public $time_keys = array( 'after', 'before', 'year', 'month', 'monthnum', 'week', 'w', 'dayofyear', 'day', 'dayofweek', 'dayofweek_iso', 'hour', 'minute', 'second' );
63
+	public $time_keys = array('after', 'before', 'year', 'month', 'monthnum', 'week', 'w', 'dayofyear', 'day', 'dayofweek', 'dayofweek_iso', 'hour', 'minute', 'second');
64 64
 
65 65
 	/**
66 66
 	 * Constructor.
@@ -150,37 +150,37 @@  discard block
 block discarded – undo
150 150
 	 *                              Accepts 'post_date', 'post_date_gmt', 'post_modified', 'post_modified_gmt',
151 151
 	 *                              'comment_date', 'comment_date_gmt'.
152 152
 	 */
153
-	public function __construct( $date_query, $default_column = 'post_date' ) {
154
-		if ( isset( $date_query['relation'] ) && 'OR' === strtoupper( $date_query['relation'] ) ) {
153
+	public function __construct($date_query, $default_column = 'post_date') {
154
+		if (isset($date_query['relation']) && 'OR' === strtoupper($date_query['relation'])) {
155 155
 			$this->relation = 'OR';
156 156
 		} else {
157 157
 			$this->relation = 'AND';
158 158
 		}
159 159
 
160
-		if ( ! is_array( $date_query ) ) {
160
+		if ( ! is_array($date_query)) {
161 161
 			return;
162 162
 		}
163 163
 
164 164
 		// Support for passing time-based keys in the top level of the $date_query array.
165
-		if ( ! isset( $date_query[0] ) && ! empty( $date_query ) ) {
166
-			$date_query = array( $date_query );
165
+		if ( ! isset($date_query[0]) && ! empty($date_query)) {
166
+			$date_query = array($date_query);
167 167
 		}
168 168
 
169
-		if ( empty( $date_query ) ) {
169
+		if (empty($date_query)) {
170 170
 			return;
171 171
 		}
172 172
 
173
-		if ( ! empty( $date_query['column'] ) ) {
174
-			$date_query['column'] = esc_sql( $date_query['column'] );
173
+		if ( ! empty($date_query['column'])) {
174
+			$date_query['column'] = esc_sql($date_query['column']);
175 175
 		} else {
176
-			$date_query['column'] = esc_sql( $default_column );
176
+			$date_query['column'] = esc_sql($default_column);
177 177
 		}
178 178
 
179
-		$this->column = $this->validate_column( $this->column );
179
+		$this->column = $this->validate_column($this->column);
180 180
 
181
-		$this->compare = $this->get_compare( $date_query );
181
+		$this->compare = $this->get_compare($date_query);
182 182
 
183
-		$this->queries = $this->sanitize_query( $date_query );
183
+		$this->queries = $this->sanitize_query($date_query);
184 184
 	}
185 185
 
186 186
 	/**
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 	 *
199 199
 	 * @return array Sanitized queries.
200 200
 	 */
201
-	public function sanitize_query( $queries, $parent_query = null ) {
201
+	public function sanitize_query($queries, $parent_query = null) {
202 202
 		$cleaned_query = array();
203 203
 
204 204
 		$defaults = array(
@@ -208,37 +208,37 @@  discard block
 block discarded – undo
208 208
 		);
209 209
 
210 210
 		// Numeric keys should always have array values.
211
-		foreach ( $queries as $qkey => $qvalue ) {
212
-			if ( is_numeric( $qkey ) && ! is_array( $qvalue ) ) {
213
-				unset( $queries[ $qkey ] );
211
+		foreach ($queries as $qkey => $qvalue) {
212
+			if (is_numeric($qkey) && ! is_array($qvalue)) {
213
+				unset($queries[$qkey]);
214 214
 			}
215 215
 		}
216 216
 
217 217
 		// Each query should have a value for each default key. Inherit from the parent when possible.
218
-		foreach ( $defaults as $dkey => $dvalue ) {
219
-			if ( isset( $queries[ $dkey ] ) ) {
218
+		foreach ($defaults as $dkey => $dvalue) {
219
+			if (isset($queries[$dkey])) {
220 220
 				continue;
221 221
 			}
222 222
 
223
-			if ( isset( $parent_query[ $dkey ] ) ) {
224
-				$queries[ $dkey ] = $parent_query[ $dkey ];
223
+			if (isset($parent_query[$dkey])) {
224
+				$queries[$dkey] = $parent_query[$dkey];
225 225
 			} else {
226
-				$queries[ $dkey ] = $dvalue;
226
+				$queries[$dkey] = $dvalue;
227 227
 			}
228 228
 		}
229 229
 
230 230
 		// Validate the dates passed in the query.
231
-		if ( $this->is_first_order_clause( $queries ) ) {
232
-			$this->validate_date_values( $queries );
231
+		if ($this->is_first_order_clause($queries)) {
232
+			$this->validate_date_values($queries);
233 233
 		}
234 234
 
235
-		foreach ( $queries as $key => $q ) {
236
-			if ( ! is_array( $q ) || in_array( $key, $this->time_keys, true ) ) {
235
+		foreach ($queries as $key => $q) {
236
+			if ( ! is_array($q) || in_array($key, $this->time_keys, true)) {
237 237
 				// This is a first-order query. Trust the values and sanitize when building SQL.
238
-				$cleaned_query[ $key ] = $q;
238
+				$cleaned_query[$key] = $q;
239 239
 			} else {
240 240
 				// Any array without a time key is another query, so we recurse.
241
-				$cleaned_query[] = $this->sanitize_query( $q, $queries );
241
+				$cleaned_query[] = $this->sanitize_query($q, $queries);
242 242
 			}
243 243
 		}
244 244
 
@@ -257,9 +257,9 @@  discard block
 block discarded – undo
257 257
 	 * @param  array $query Query clause.
258 258
 	 * @return bool True if this is a first-order clause.
259 259
 	 */
260
-	protected function is_first_order_clause( $query ) {
261
-		$time_keys = array_intersect( $this->time_keys, array_keys( $query ) );
262
-		return ! empty( $time_keys );
260
+	protected function is_first_order_clause($query) {
261
+		$time_keys = array_intersect($this->time_keys, array_keys($query));
262
+		return ! empty($time_keys);
263 263
 	}
264 264
 
265 265
 	/**
@@ -271,9 +271,9 @@  discard block
 block discarded – undo
271 271
 	 * @param array $query A date query or a date subquery.
272 272
 	 * @return string The comparison operator.
273 273
 	 */
274
-	public function get_compare( $query ) {
275
-		if ( ! empty( $query['compare'] ) && in_array( $query['compare'], array( '=', '!=', '>', '>=', '<', '<=', 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN' ) ) )
276
-			return strtoupper( $query['compare'] );
274
+	public function get_compare($query) {
275
+		if ( ! empty($query['compare']) && in_array($query['compare'], array('=', '!=', '>', '>=', '<', '<=', 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN')))
276
+			return strtoupper($query['compare']);
277 277
 
278 278
 		return $this->compare;
279 279
 	}
@@ -291,8 +291,8 @@  discard block
 block discarded – undo
291 291
 	 * @param  array $date_query The date_query array.
292 292
 	 * @return bool  True if all values in the query are valid, false if one or more fail.
293 293
 	 */
294
-	public function validate_date_values( $date_query = array() ) {
295
-		if ( empty( $date_query ) ) {
294
+	public function validate_date_values($date_query = array()) {
295
+		if (empty($date_query)) {
296 296
 			return false;
297 297
 		}
298 298
 
@@ -303,30 +303,30 @@  discard block
 block discarded – undo
303 303
 		 * validation routine continue to be sure that all invalid
304 304
 		 * values generate errors too.
305 305
 		 */
306
-		if ( array_key_exists( 'before', $date_query ) && is_array( $date_query['before'] ) ){
307
-			$valid = $this->validate_date_values( $date_query['before'] );
306
+		if (array_key_exists('before', $date_query) && is_array($date_query['before'])) {
307
+			$valid = $this->validate_date_values($date_query['before']);
308 308
 		}
309 309
 
310
-		if ( array_key_exists( 'after', $date_query ) && is_array( $date_query['after'] ) ){
311
-			$valid = $this->validate_date_values( $date_query['after'] );
310
+		if (array_key_exists('after', $date_query) && is_array($date_query['after'])) {
311
+			$valid = $this->validate_date_values($date_query['after']);
312 312
 		}
313 313
 
314 314
 		// Array containing all min-max checks.
315 315
 		$min_max_checks = array();
316 316
 
317 317
 		// Days per year.
318
-		if ( array_key_exists( 'year', $date_query ) ) {
318
+		if (array_key_exists('year', $date_query)) {
319 319
 			/*
320 320
 			 * If a year exists in the date query, we can use it to get the days.
321 321
 			 * If multiple years are provided (as in a BETWEEN), use the first one.
322 322
 			 */
323
-			if ( is_array( $date_query['year'] ) ) {
324
-				$_year = reset( $date_query['year'] );
323
+			if (is_array($date_query['year'])) {
324
+				$_year = reset($date_query['year']);
325 325
 			} else {
326 326
 				$_year = $date_query['year'];
327 327
 			}
328 328
 
329
-			$max_days_of_year = date( 'z', mktime( 0, 0, 0, 12, 31, $_year ) ) + 1;
329
+			$max_days_of_year = date('z', mktime(0, 0, 0, 12, 31, $_year)) + 1;
330 330
 		} else {
331 331
 			// otherwise we use the max of 366 (leap-year)
332 332
 			$max_days_of_year = 366;
@@ -356,12 +356,12 @@  discard block
 block discarded – undo
356 356
 		);
357 357
 
358 358
 		// Weeks per year.
359
-		if ( isset( $_year ) ) {
359
+		if (isset($_year)) {
360 360
 			/*
361 361
 			 * If we have a specific year, use it to calculate number of weeks.
362 362
 			 * Note: the number of weeks in a year is the date in which Dec 28 appears.
363 363
 			 */
364
-			$week_count = date( 'W', mktime( 0, 0, 0, 12, 28, $_year ) );
364
+			$week_count = date('W', mktime(0, 0, 0, 12, 28, $_year));
365 365
 
366 366
 		} else {
367 367
 			// Otherwise set the week-count to a maximum of 53.
@@ -398,26 +398,26 @@  discard block
 block discarded – undo
398 398
 		);
399 399
 
400 400
 		// Concatenate and throw a notice for each invalid value.
401
-		foreach ( $min_max_checks as $key => $check ) {
402
-			if ( ! array_key_exists( $key, $date_query ) ) {
401
+		foreach ($min_max_checks as $key => $check) {
402
+			if ( ! array_key_exists($key, $date_query)) {
403 403
 				continue;
404 404
 			}
405 405
 
406 406
 			// Throw a notice for each failing value.
407
-			foreach ( (array) $date_query[ $key ] as $_value ) {
407
+			foreach ((array) $date_query[$key] as $_value) {
408 408
 				$is_between = $_value >= $check['min'] && $_value <= $check['max'];
409 409
 
410
-				if ( ! is_numeric( $_value ) || ! $is_between ) {
410
+				if ( ! is_numeric($_value) || ! $is_between) {
411 411
 					$error = sprintf(
412 412
 						/* translators: Date query invalid date message: 1: invalid value, 2: type of value, 3: minimum valid value, 4: maximum valid value */
413
-						__( 'Invalid value %1$s for %2$s. Expected value should be between %3$s and %4$s.' ),
414
-						'<code>' . esc_html( $_value ) . '</code>',
415
-						'<code>' . esc_html( $key ) . '</code>',
416
-						'<code>' . esc_html( $check['min'] ) . '</code>',
417
-						'<code>' . esc_html( $check['max'] ) . '</code>'
413
+						__('Invalid value %1$s for %2$s. Expected value should be between %3$s and %4$s.'),
414
+						'<code>'.esc_html($_value).'</code>',
415
+						'<code>'.esc_html($key).'</code>',
416
+						'<code>'.esc_html($check['min']).'</code>',
417
+						'<code>'.esc_html($check['max']).'</code>'
418 418
 					);
419 419
 
420
-					_doing_it_wrong( __CLASS__, $error, '4.1.0' );
420
+					_doing_it_wrong(__CLASS__, $error, '4.1.0');
421 421
 
422 422
 					$valid = false;
423 423
 				}
@@ -425,49 +425,49 @@  discard block
 block discarded – undo
425 425
 		}
426 426
 
427 427
 		// If we already have invalid date messages, don't bother running through checkdate().
428
-		if ( ! $valid ) {
428
+		if ( ! $valid) {
429 429
 			return $valid;
430 430
 		}
431 431
 
432 432
 		$day_month_year_error_msg = '';
433 433
 
434
-		$day_exists   = array_key_exists( 'day', $date_query ) && is_numeric( $date_query['day'] );
435
-		$month_exists = array_key_exists( 'month', $date_query ) && is_numeric( $date_query['month'] );
436
-		$year_exists  = array_key_exists( 'year', $date_query ) && is_numeric( $date_query['year'] );
434
+		$day_exists   = array_key_exists('day', $date_query) && is_numeric($date_query['day']);
435
+		$month_exists = array_key_exists('month', $date_query) && is_numeric($date_query['month']);
436
+		$year_exists  = array_key_exists('year', $date_query) && is_numeric($date_query['year']);
437 437
 
438
-		if ( $day_exists && $month_exists && $year_exists ) {
438
+		if ($day_exists && $month_exists && $year_exists) {
439 439
 			// 1. Checking day, month, year combination.
440
-			if ( ! wp_checkdate( $date_query['month'], $date_query['day'], $date_query['year'], sprintf( '%s-%s-%s', $date_query['year'], $date_query['month'], $date_query['day'] ) ) ) {
440
+			if ( ! wp_checkdate($date_query['month'], $date_query['day'], $date_query['year'], sprintf('%s-%s-%s', $date_query['year'], $date_query['month'], $date_query['day']))) {
441 441
 				/* translators: 1: year, 2: month, 3: day of month */
442 442
 				$day_month_year_error_msg = sprintf(
443
-					__( 'The following values do not describe a valid date: year %1$s, month %2$s, day %3$s.' ),
444
-					'<code>' . esc_html( $date_query['year'] ) . '</code>',
445
-					'<code>' . esc_html( $date_query['month'] ) . '</code>',
446
-					'<code>' . esc_html( $date_query['day'] ) . '</code>'
443
+					__('The following values do not describe a valid date: year %1$s, month %2$s, day %3$s.'),
444
+					'<code>'.esc_html($date_query['year']).'</code>',
445
+					'<code>'.esc_html($date_query['month']).'</code>',
446
+					'<code>'.esc_html($date_query['day']).'</code>'
447 447
 				);
448 448
 
449 449
 				$valid = false;
450 450
 			}
451 451
 
452
-		} elseif ( $day_exists && $month_exists ) {
452
+		} elseif ($day_exists && $month_exists) {
453 453
 			/*
454 454
 			 * 2. checking day, month combination
455 455
 			 * We use 2012 because, as a leap year, it's the most permissive.
456 456
 			 */
457
-			if ( ! wp_checkdate( $date_query['month'], $date_query['day'], 2012, sprintf( '2012-%s-%s', $date_query['month'], $date_query['day'] ) ) ) {
457
+			if ( ! wp_checkdate($date_query['month'], $date_query['day'], 2012, sprintf('2012-%s-%s', $date_query['month'], $date_query['day']))) {
458 458
 				/* translators: 1: month, 2: day of month */
459 459
 				$day_month_year_error_msg = sprintf(
460
-					__( 'The following values do not describe a valid date: month %1$s, day %2$s.' ),
461
-					'<code>' . esc_html( $date_query['month'] ) . '</code>',
462
-					'<code>' . esc_html( $date_query['day'] ) . '</code>'
460
+					__('The following values do not describe a valid date: month %1$s, day %2$s.'),
461
+					'<code>'.esc_html($date_query['month']).'</code>',
462
+					'<code>'.esc_html($date_query['day']).'</code>'
463 463
 				);
464 464
 
465 465
 				$valid = false;
466 466
 			}
467 467
 		}
468 468
 
469
-		if ( ! empty( $day_month_year_error_msg ) ) {
470
-			_doing_it_wrong( __CLASS__, $day_month_year_error_msg, '4.1.0' );
469
+		if ( ! empty($day_month_year_error_msg)) {
470
+			_doing_it_wrong(__CLASS__, $day_month_year_error_msg, '4.1.0');
471 471
 		}
472 472
 
473 473
 		return $valid;
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
 	 * @param string $column The user-supplied column name.
488 488
 	 * @return string A validated column name value.
489 489
 	 */
490
-	public function validate_column( $column ) {
490
+	public function validate_column($column) {
491 491
 		global $wpdb;
492 492
 
493 493
 		$valid_columns = array(
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
 		);
498 498
 
499 499
 		// Attempt to detect a table prefix.
500
-		if ( false === strpos( $column, '.' ) ) {
500
+		if (false === strpos($column, '.')) {
501 501
 			/**
502 502
 			 * Filters the list of valid date query columns.
503 503
 			 *
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
 			 *                             'post_modified_gmt', 'comment_date', 'comment_date_gmt',
510 510
 			 *	                           'user_registered'
511 511
 			 */
512
-			if ( ! in_array( $column, apply_filters( 'date_query_valid_columns', $valid_columns ) ) ) {
512
+			if ( ! in_array($column, apply_filters('date_query_valid_columns', $valid_columns))) {
513 513
 				$column = 'post_date';
514 514
 			}
515 515
 
@@ -534,9 +534,9 @@  discard block
 block discarded – undo
534 534
 			);
535 535
 
536 536
 			// If it's a known column name, add the appropriate table prefix.
537
-			foreach ( $known_columns as $table_name => $table_columns ) {
538
-				if ( in_array( $column, $table_columns ) ) {
539
-					$column = $table_name . '.' . $column;
537
+			foreach ($known_columns as $table_name => $table_columns) {
538
+				if (in_array($column, $table_columns)) {
539
+					$column = $table_name.'.'.$column;
540 540
 					break;
541 541
 				}
542 542
 			}
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
 		}
545 545
 
546 546
 		// Remove unsafe characters.
547
-		return preg_replace( '/[^a-zA-Z0-9_$\.]/', '', $column );
547
+		return preg_replace('/[^a-zA-Z0-9_$\.]/', '', $column);
548 548
 	}
549 549
 
550 550
 	/**
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
 		 * @param string        $where WHERE clause of the date query.
569 569
 		 * @param WP_Date_Query $this  The WP_Date_Query instance.
570 570
 		 */
571
-		return apply_filters( 'get_date_sql', $where, $this );
571
+		return apply_filters('get_date_sql', $where, $this);
572 572
 	}
573 573
 
574 574
 	/**
@@ -588,10 +588,10 @@  discard block
 block discarded – undo
588 588
 	 * }
589 589
 	 */
590 590
 	protected function get_sql_clauses() {
591
-		$sql = $this->get_sql_for_query( $this->queries );
591
+		$sql = $this->get_sql_for_query($this->queries);
592 592
 
593
-		if ( ! empty( $sql['where'] ) ) {
594
-			$sql['where'] = ' AND ' . $sql['where'];
593
+		if ( ! empty($sql['where'])) {
594
+			$sql['where'] = ' AND '.$sql['where'];
595 595
 		}
596 596
 
597 597
 		return $sql;
@@ -616,7 +616,7 @@  discard block
 block discarded – undo
616 616
 	 *     @type string $where SQL fragment to append to the main WHERE clause.
617 617
 	 * }
618 618
 	 */
619
-	protected function get_sql_for_query( $query, $depth = 0 ) {
619
+	protected function get_sql_for_query($query, $depth = 0) {
620 620
 		$sql_chunks = array(
621 621
 			'join'  => array(),
622 622
 			'where' => array(),
@@ -628,32 +628,32 @@  discard block
 block discarded – undo
628 628
 		);
629 629
 
630 630
 		$indent = '';
631
-		for ( $i = 0; $i < $depth; $i++ ) {
631
+		for ($i = 0; $i < $depth; $i++) {
632 632
 			$indent .= "  ";
633 633
 		}
634 634
 
635
-		foreach ( $query as $key => $clause ) {
636
-			if ( 'relation' === $key ) {
635
+		foreach ($query as $key => $clause) {
636
+			if ('relation' === $key) {
637 637
 				$relation = $query['relation'];
638
-			} elseif ( is_array( $clause ) ) {
638
+			} elseif (is_array($clause)) {
639 639
 
640 640
 				// This is a first-order clause.
641
-				if ( $this->is_first_order_clause( $clause ) ) {
642
-					$clause_sql = $this->get_sql_for_clause( $clause, $query );
641
+				if ($this->is_first_order_clause($clause)) {
642
+					$clause_sql = $this->get_sql_for_clause($clause, $query);
643 643
 
644
-					$where_count = count( $clause_sql['where'] );
645
-					if ( ! $where_count ) {
644
+					$where_count = count($clause_sql['where']);
645
+					if ( ! $where_count) {
646 646
 						$sql_chunks['where'][] = '';
647
-					} elseif ( 1 === $where_count ) {
647
+					} elseif (1 === $where_count) {
648 648
 						$sql_chunks['where'][] = $clause_sql['where'][0];
649 649
 					} else {
650
-						$sql_chunks['where'][] = '( ' . implode( ' AND ', $clause_sql['where'] ) . ' )';
650
+						$sql_chunks['where'][] = '( '.implode(' AND ', $clause_sql['where']).' )';
651 651
 					}
652 652
 
653
-					$sql_chunks['join'] = array_merge( $sql_chunks['join'], $clause_sql['join'] );
653
+					$sql_chunks['join'] = array_merge($sql_chunks['join'], $clause_sql['join']);
654 654
 				// This is a subquery, so we recurse.
655 655
 				} else {
656
-					$clause_sql = $this->get_sql_for_query( $clause, $depth + 1 );
656
+					$clause_sql = $this->get_sql_for_query($clause, $depth + 1);
657 657
 
658 658
 					$sql_chunks['where'][] = $clause_sql['where'];
659 659
 					$sql_chunks['join'][]  = $clause_sql['join'];
@@ -662,21 +662,21 @@  discard block
 block discarded – undo
662 662
 		}
663 663
 
664 664
 		// Filter to remove empties.
665
-		$sql_chunks['join']  = array_filter( $sql_chunks['join'] );
666
-		$sql_chunks['where'] = array_filter( $sql_chunks['where'] );
665
+		$sql_chunks['join']  = array_filter($sql_chunks['join']);
666
+		$sql_chunks['where'] = array_filter($sql_chunks['where']);
667 667
 
668
-		if ( empty( $relation ) ) {
668
+		if (empty($relation)) {
669 669
 			$relation = 'AND';
670 670
 		}
671 671
 
672 672
 		// Filter duplicate JOIN clauses and combine into a single string.
673
-		if ( ! empty( $sql_chunks['join'] ) ) {
674
-			$sql['join'] = implode( ' ', array_unique( $sql_chunks['join'] ) );
673
+		if ( ! empty($sql_chunks['join'])) {
674
+			$sql['join'] = implode(' ', array_unique($sql_chunks['join']));
675 675
 		}
676 676
 
677 677
 		// Generate a single WHERE clause with proper brackets and indentation.
678
-		if ( ! empty( $sql_chunks['where'] ) ) {
679
-			$sql['where'] = '( ' . "\n  " . $indent . implode( ' ' . "\n  " . $indent . $relation . ' ' . "\n  " . $indent, $sql_chunks['where'] ) . "\n" . $indent . ')';
678
+		if ( ! empty($sql_chunks['where'])) {
679
+			$sql['where'] = '( '."\n  ".$indent.implode(' '."\n  ".$indent.$relation.' '."\n  ".$indent, $sql_chunks['where'])."\n".$indent.')';
680 680
 		}
681 681
 
682 682
 		return $sql;
@@ -699,8 +699,8 @@  discard block
 block discarded – undo
699 699
 	 *     @type string $where SQL fragment to append to the main WHERE clause.
700 700
 	 * }
701 701
 	 */
702
-	protected function get_sql_for_subquery( $query ) {
703
-		return $this->get_sql_for_clause( $query, '' );
702
+	protected function get_sql_for_subquery($query) {
703
+		return $this->get_sql_for_clause($query, '');
704 704
 	}
705 705
 
706 706
 	/**
@@ -718,72 +718,72 @@  discard block
 block discarded – undo
718 718
 	 *     @type string $where SQL fragment to append to the main WHERE clause.
719 719
 	 * }
720 720
 	 */
721
-	protected function get_sql_for_clause( $query, $parent_query ) {
721
+	protected function get_sql_for_clause($query, $parent_query) {
722 722
 		global $wpdb;
723 723
 
724 724
 		// The sub-parts of a $where part.
725 725
 		$where_parts = array();
726 726
 
727
-		$column = ( ! empty( $query['column'] ) ) ? esc_sql( $query['column'] ) : $this->column;
727
+		$column = ( ! empty($query['column'])) ? esc_sql($query['column']) : $this->column;
728 728
 
729
-		$column = $this->validate_column( $column );
729
+		$column = $this->validate_column($column);
730 730
 
731
-		$compare = $this->get_compare( $query );
731
+		$compare = $this->get_compare($query);
732 732
 
733
-		$inclusive = ! empty( $query['inclusive'] );
733
+		$inclusive = ! empty($query['inclusive']);
734 734
 
735 735
 		// Assign greater- and less-than values.
736 736
 		$lt = '<';
737 737
 		$gt = '>';
738 738
 
739
-		if ( $inclusive ) {
739
+		if ($inclusive) {
740 740
 			$lt .= '=';
741 741
 			$gt .= '=';
742 742
 		}
743 743
 
744 744
 		// Range queries.
745
-		if ( ! empty( $query['after'] ) ) {
746
-			$where_parts[] = $wpdb->prepare( "$column $gt %s", $this->build_mysql_datetime( $query['after'], ! $inclusive ) );
745
+		if ( ! empty($query['after'])) {
746
+			$where_parts[] = $wpdb->prepare("$column $gt %s", $this->build_mysql_datetime($query['after'], ! $inclusive));
747 747
 		}
748
-		if ( ! empty( $query['before'] ) ) {
749
-			$where_parts[] = $wpdb->prepare( "$column $lt %s", $this->build_mysql_datetime( $query['before'], $inclusive ) );
748
+		if ( ! empty($query['before'])) {
749
+			$where_parts[] = $wpdb->prepare("$column $lt %s", $this->build_mysql_datetime($query['before'], $inclusive));
750 750
 		}
751 751
 		// Specific value queries.
752 752
 
753
-		if ( isset( $query['year'] ) && $value = $this->build_value( $compare, $query['year'] ) )
753
+		if (isset($query['year']) && $value = $this->build_value($compare, $query['year']))
754 754
 			$where_parts[] = "YEAR( $column ) $compare $value";
755 755
 
756
-		if ( isset( $query['month'] ) && $value = $this->build_value( $compare, $query['month'] ) ) {
756
+		if (isset($query['month']) && $value = $this->build_value($compare, $query['month'])) {
757 757
 			$where_parts[] = "MONTH( $column ) $compare $value";
758
-		} elseif ( isset( $query['monthnum'] ) && $value = $this->build_value( $compare, $query['monthnum'] ) ) {
758
+		} elseif (isset($query['monthnum']) && $value = $this->build_value($compare, $query['monthnum'])) {
759 759
 			$where_parts[] = "MONTH( $column ) $compare $value";
760 760
 		}
761
-		if ( isset( $query['week'] ) && false !== ( $value = $this->build_value( $compare, $query['week'] ) ) ) {
762
-			$where_parts[] = _wp_mysql_week( $column ) . " $compare $value";
763
-		} elseif ( isset( $query['w'] ) && false !== ( $value = $this->build_value( $compare, $query['w'] ) ) ) {
764
-			$where_parts[] = _wp_mysql_week( $column ) . " $compare $value";
761
+		if (isset($query['week']) && false !== ($value = $this->build_value($compare, $query['week']))) {
762
+			$where_parts[] = _wp_mysql_week($column)." $compare $value";
763
+		} elseif (isset($query['w']) && false !== ($value = $this->build_value($compare, $query['w']))) {
764
+			$where_parts[] = _wp_mysql_week($column)." $compare $value";
765 765
 		}
766
-		if ( isset( $query['dayofyear'] ) && $value = $this->build_value( $compare, $query['dayofyear'] ) )
766
+		if (isset($query['dayofyear']) && $value = $this->build_value($compare, $query['dayofyear']))
767 767
 			$where_parts[] = "DAYOFYEAR( $column ) $compare $value";
768 768
 
769
-		if ( isset( $query['day'] ) && $value = $this->build_value( $compare, $query['day'] ) )
769
+		if (isset($query['day']) && $value = $this->build_value($compare, $query['day']))
770 770
 			$where_parts[] = "DAYOFMONTH( $column ) $compare $value";
771 771
 
772
-		if ( isset( $query['dayofweek'] ) && $value = $this->build_value( $compare, $query['dayofweek'] ) )
772
+		if (isset($query['dayofweek']) && $value = $this->build_value($compare, $query['dayofweek']))
773 773
 			$where_parts[] = "DAYOFWEEK( $column ) $compare $value";
774 774
 
775
-		if ( isset( $query['dayofweek_iso'] ) && $value = $this->build_value( $compare, $query['dayofweek_iso'] ) )
775
+		if (isset($query['dayofweek_iso']) && $value = $this->build_value($compare, $query['dayofweek_iso']))
776 776
 			$where_parts[] = "WEEKDAY( $column ) + 1 $compare $value";
777 777
 
778
-		if ( isset( $query['hour'] ) || isset( $query['minute'] ) || isset( $query['second'] ) ) {
778
+		if (isset($query['hour']) || isset($query['minute']) || isset($query['second'])) {
779 779
 			// Avoid notices.
780
-			foreach ( array( 'hour', 'minute', 'second' ) as $unit ) {
781
-				if ( ! isset( $query[ $unit ] ) ) {
782
-					$query[ $unit ] = null;
780
+			foreach (array('hour', 'minute', 'second') as $unit) {
781
+				if ( ! isset($query[$unit])) {
782
+					$query[$unit] = null;
783 783
 				}
784 784
 			}
785 785
 
786
-			if ( $time_query = $this->build_time_query( $column, $compare, $query['hour'], $query['minute'], $query['second'] ) ) {
786
+			if ($time_query = $this->build_time_query($column, $compare, $query['hour'], $query['minute'], $query['second'])) {
787 787
 				$where_parts[] = $time_query;
788 788
 			}
789 789
 		}
@@ -808,45 +808,45 @@  discard block
 block discarded – undo
808 808
 	 * @param string|array $value The value
809 809
 	 * @return string|false|int The value to be used in SQL or false on error.
810 810
 	 */
811
-	public function build_value( $compare, $value ) {
812
-		if ( ! isset( $value ) )
811
+	public function build_value($compare, $value) {
812
+		if ( ! isset($value))
813 813
 			return false;
814 814
 
815
-		switch ( $compare ) {
815
+		switch ($compare) {
816 816
 			case 'IN':
817 817
 			case 'NOT IN':
818 818
 				$value = (array) $value;
819 819
 
820 820
 				// Remove non-numeric values.
821
-				$value = array_filter( $value, 'is_numeric' );
821
+				$value = array_filter($value, 'is_numeric');
822 822
 
823
-				if ( empty( $value ) ) {
823
+				if (empty($value)) {
824 824
 					return false;
825 825
 				}
826 826
 
827
-				return '(' . implode( ',', array_map( 'intval', $value ) ) . ')';
827
+				return '('.implode(',', array_map('intval', $value)).')';
828 828
 
829 829
 			case 'BETWEEN':
830 830
 			case 'NOT BETWEEN':
831
-				if ( ! is_array( $value ) || 2 != count( $value ) ) {
832
-					$value = array( $value, $value );
831
+				if ( ! is_array($value) || 2 != count($value)) {
832
+					$value = array($value, $value);
833 833
 				} else {
834
-					$value = array_values( $value );
834
+					$value = array_values($value);
835 835
 				}
836 836
 
837 837
 				// If either value is non-numeric, bail.
838
-				foreach ( $value as $v ) {
839
-					if ( ! is_numeric( $v ) ) {
838
+				foreach ($value as $v) {
839
+					if ( ! is_numeric($v)) {
840 840
 						return false;
841 841
 					}
842 842
 				}
843 843
 
844
-				$value = array_map( 'intval', $value );
844
+				$value = array_map('intval', $value);
845 845
 
846
-				return $value[0] . ' AND ' . $value[1];
846
+				return $value[0].' AND '.$value[1];
847 847
 
848 848
 			default;
849
-				if ( ! is_numeric( $value ) ) {
849
+				if ( ! is_numeric($value)) {
850 850
 					return false;
851 851
 				}
852 852
 
@@ -871,75 +871,75 @@  discard block
 block discarded – undo
871 871
 	 *                                     Default: false.
872 872
 	 * @return string|false A MySQL format date/time or false on failure
873 873
 	 */
874
-	public function build_mysql_datetime( $datetime, $default_to_max = false ) {
875
-		$now = current_time( 'timestamp' );
874
+	public function build_mysql_datetime($datetime, $default_to_max = false) {
875
+		$now = current_time('timestamp');
876 876
 
877
-		if ( ! is_array( $datetime ) ) {
877
+		if ( ! is_array($datetime)) {
878 878
 
879 879
 			/*
880 880
 			 * Try to parse some common date formats, so we can detect
881 881
 			 * the level of precision and support the 'inclusive' parameter.
882 882
 			 */
883
-			if ( preg_match( '/^(\d{4})$/', $datetime, $matches ) ) {
883
+			if (preg_match('/^(\d{4})$/', $datetime, $matches)) {
884 884
 				// Y
885 885
 				$datetime = array(
886
-					'year' => intval( $matches[1] ),
886
+					'year' => intval($matches[1]),
887 887
 				);
888 888
 
889
-			} elseif ( preg_match( '/^(\d{4})\-(\d{2})$/', $datetime, $matches ) ) {
889
+			} elseif (preg_match('/^(\d{4})\-(\d{2})$/', $datetime, $matches)) {
890 890
 				// Y-m
891 891
 				$datetime = array(
892
-					'year'  => intval( $matches[1] ),
893
-					'month' => intval( $matches[2] ),
892
+					'year'  => intval($matches[1]),
893
+					'month' => intval($matches[2]),
894 894
 				);
895 895
 
896
-			} elseif ( preg_match( '/^(\d{4})\-(\d{2})\-(\d{2})$/', $datetime, $matches ) ) {
896
+			} elseif (preg_match('/^(\d{4})\-(\d{2})\-(\d{2})$/', $datetime, $matches)) {
897 897
 				// Y-m-d
898 898
 				$datetime = array(
899
-					'year'  => intval( $matches[1] ),
900
-					'month' => intval( $matches[2] ),
901
-					'day'   => intval( $matches[3] ),
899
+					'year'  => intval($matches[1]),
900
+					'month' => intval($matches[2]),
901
+					'day'   => intval($matches[3]),
902 902
 				);
903 903
 
904
-			} elseif ( preg_match( '/^(\d{4})\-(\d{2})\-(\d{2}) (\d{2}):(\d{2})$/', $datetime, $matches ) ) {
904
+			} elseif (preg_match('/^(\d{4})\-(\d{2})\-(\d{2}) (\d{2}):(\d{2})$/', $datetime, $matches)) {
905 905
 				// Y-m-d H:i
906 906
 				$datetime = array(
907
-					'year'   => intval( $matches[1] ),
908
-					'month'  => intval( $matches[2] ),
909
-					'day'    => intval( $matches[3] ),
910
-					'hour'   => intval( $matches[4] ),
911
-					'minute' => intval( $matches[5] ),
907
+					'year'   => intval($matches[1]),
908
+					'month'  => intval($matches[2]),
909
+					'day'    => intval($matches[3]),
910
+					'hour'   => intval($matches[4]),
911
+					'minute' => intval($matches[5]),
912 912
 				);
913 913
 			}
914 914
 
915 915
 			// If no match is found, we don't support default_to_max.
916
-			if ( ! is_array( $datetime ) ) {
916
+			if ( ! is_array($datetime)) {
917 917
 				// @todo Timezone issues here possibly
918
-				return gmdate( 'Y-m-d H:i:s', strtotime( $datetime, $now ) );
918
+				return gmdate('Y-m-d H:i:s', strtotime($datetime, $now));
919 919
 			}
920 920
 		}
921 921
 
922
-		$datetime = array_map( 'absint', $datetime );
922
+		$datetime = array_map('absint', $datetime);
923 923
 
924
-		if ( ! isset( $datetime['year'] ) )
925
-			$datetime['year'] = gmdate( 'Y', $now );
924
+		if ( ! isset($datetime['year']))
925
+			$datetime['year'] = gmdate('Y', $now);
926 926
 
927
-		if ( ! isset( $datetime['month'] ) )
928
-			$datetime['month'] = ( $default_to_max ) ? 12 : 1;
927
+		if ( ! isset($datetime['month']))
928
+			$datetime['month'] = ($default_to_max) ? 12 : 1;
929 929
 
930
-		if ( ! isset( $datetime['day'] ) )
931
-			$datetime['day'] = ( $default_to_max ) ? (int) date( 't', mktime( 0, 0, 0, $datetime['month'], 1, $datetime['year'] ) ) : 1;
930
+		if ( ! isset($datetime['day']))
931
+			$datetime['day'] = ($default_to_max) ? (int) date('t', mktime(0, 0, 0, $datetime['month'], 1, $datetime['year'])) : 1;
932 932
 
933
-		if ( ! isset( $datetime['hour'] ) )
934
-			$datetime['hour'] = ( $default_to_max ) ? 23 : 0;
933
+		if ( ! isset($datetime['hour']))
934
+			$datetime['hour'] = ($default_to_max) ? 23 : 0;
935 935
 
936
-		if ( ! isset( $datetime['minute'] ) )
937
-			$datetime['minute'] = ( $default_to_max ) ? 59 : 0;
936
+		if ( ! isset($datetime['minute']))
937
+			$datetime['minute'] = ($default_to_max) ? 59 : 0;
938 938
 
939
-		if ( ! isset( $datetime['second'] ) )
940
-			$datetime['second'] = ( $default_to_max ) ? 59 : 0;
939
+		if ( ! isset($datetime['second']))
940
+			$datetime['second'] = ($default_to_max) ? 59 : 0;
941 941
 
942
-		return sprintf( '%04d-%02d-%02d %02d:%02d:%02d', $datetime['year'], $datetime['month'], $datetime['day'], $datetime['hour'], $datetime['minute'], $datetime['second'] );
942
+		return sprintf('%04d-%02d-%02d %02d:%02d:%02d', $datetime['year'], $datetime['month'], $datetime['day'], $datetime['hour'], $datetime['minute'], $datetime['second']);
943 943
 	}
944 944
 
945 945
 	/**
@@ -959,48 +959,48 @@  discard block
 block discarded – undo
959 959
 	 * @param int|null $second Optional. A second value (0-59).
960 960
 	 * @return string|false A query part or false on failure.
961 961
 	 */
962
-	public function build_time_query( $column, $compare, $hour = null, $minute = null, $second = null ) {
962
+	public function build_time_query($column, $compare, $hour = null, $minute = null, $second = null) {
963 963
 		global $wpdb;
964 964
 
965 965
 		// Have to have at least one
966
-		if ( ! isset( $hour ) && ! isset( $minute ) && ! isset( $second ) )
966
+		if ( ! isset($hour) && ! isset($minute) && ! isset($second))
967 967
 			return false;
968 968
 
969 969
 		// Complex combined queries aren't supported for multi-value queries
970
-		if ( in_array( $compare, array( 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN' ) ) ) {
970
+		if (in_array($compare, array('IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN'))) {
971 971
 			$return = array();
972 972
 
973
-			if ( isset( $hour ) && false !== ( $value = $this->build_value( $compare, $hour ) ) )
973
+			if (isset($hour) && false !== ($value = $this->build_value($compare, $hour)))
974 974
 				$return[] = "HOUR( $column ) $compare $value";
975 975
 
976
-			if ( isset( $minute ) && false !== ( $value = $this->build_value( $compare, $minute ) ) )
976
+			if (isset($minute) && false !== ($value = $this->build_value($compare, $minute)))
977 977
 				$return[] = "MINUTE( $column ) $compare $value";
978 978
 
979
-			if ( isset( $second ) && false !== ( $value = $this->build_value( $compare, $second ) ) )
979
+			if (isset($second) && false !== ($value = $this->build_value($compare, $second)))
980 980
 				$return[] = "SECOND( $column ) $compare $value";
981 981
 
982
-			return implode( ' AND ', $return );
982
+			return implode(' AND ', $return);
983 983
 		}
984 984
 
985 985
 		// Cases where just one unit is set
986
-		if ( isset( $hour ) && ! isset( $minute ) && ! isset( $second ) && false !== ( $value = $this->build_value( $compare, $hour ) ) ) {
986
+		if (isset($hour) && ! isset($minute) && ! isset($second) && false !== ($value = $this->build_value($compare, $hour))) {
987 987
 			return "HOUR( $column ) $compare $value";
988
-		} elseif ( ! isset( $hour ) && isset( $minute ) && ! isset( $second ) && false !== ( $value = $this->build_value( $compare, $minute ) ) ) {
988
+		} elseif ( ! isset($hour) && isset($minute) && ! isset($second) && false !== ($value = $this->build_value($compare, $minute))) {
989 989
 			return "MINUTE( $column ) $compare $value";
990
-		} elseif ( ! isset( $hour ) && ! isset( $minute ) && isset( $second ) && false !== ( $value = $this->build_value( $compare, $second ) ) ) {
990
+		} elseif ( ! isset($hour) && ! isset($minute) && isset($second) && false !== ($value = $this->build_value($compare, $second))) {
991 991
 			return "SECOND( $column ) $compare $value";
992 992
 		}
993 993
 
994 994
 		// Single units were already handled. Since hour & second isn't allowed, minute must to be set.
995
-		if ( ! isset( $minute ) )
995
+		if ( ! isset($minute))
996 996
 			return false;
997 997
 
998 998
 		$format = $time = '';
999 999
 
1000 1000
 		// Hour
1001
-		if ( null !== $hour ) {
1001
+		if (null !== $hour) {
1002 1002
 			$format .= '%H.';
1003
-			$time   .= sprintf( '%02d', $hour ) . '.';
1003
+			$time   .= sprintf('%02d', $hour).'.';
1004 1004
 		} else {
1005 1005
 			$format .= '0.';
1006 1006
 			$time   .= '0.';
@@ -1008,13 +1008,13 @@  discard block
 block discarded – undo
1008 1008
 
1009 1009
 		// Minute
1010 1010
 		$format .= '%i';
1011
-		$time   .= sprintf( '%02d', $minute );
1011
+		$time   .= sprintf('%02d', $minute);
1012 1012
 
1013
-		if ( isset( $second ) ) {
1013
+		if (isset($second)) {
1014 1014
 			$format .= '%s';
1015
-			$time   .= sprintf( '%02d', $second );
1015
+			$time   .= sprintf('%02d', $second);
1016 1016
 		}
1017 1017
 
1018
-		return $wpdb->prepare( "DATE_FORMAT( $column, %s ) $compare %f", $format, $time );
1018
+		return $wpdb->prepare("DATE_FORMAT( $column, %s ) $compare %f", $format, $time);
1019 1019
 	}
1020 1020
 }
Please login to merge, or discard this patch.
Braces   +54 added lines, -36 removed lines patch added patch discarded remove patch
@@ -272,8 +272,9 @@  discard block
 block discarded – undo
272 272
 	 * @return string The comparison operator.
273 273
 	 */
274 274
 	public function get_compare( $query ) {
275
-		if ( ! empty( $query['compare'] ) && in_array( $query['compare'], array( '=', '!=', '>', '>=', '<', '<=', 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN' ) ) )
276
-			return strtoupper( $query['compare'] );
275
+		if ( ! empty( $query['compare'] ) && in_array( $query['compare'], array( '=', '!=', '>', '>=', '<', '<=', 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN' ) ) ) {
276
+					return strtoupper( $query['compare'] );
277
+		}
277 278
 
278 279
 		return $this->compare;
279 280
 	}
@@ -750,8 +751,9 @@  discard block
 block discarded – undo
750 751
 		}
751 752
 		// Specific value queries.
752 753
 
753
-		if ( isset( $query['year'] ) && $value = $this->build_value( $compare, $query['year'] ) )
754
-			$where_parts[] = "YEAR( $column ) $compare $value";
754
+		if ( isset( $query['year'] ) && $value = $this->build_value( $compare, $query['year'] ) ) {
755
+					$where_parts[] = "YEAR( $column ) $compare $value";
756
+		}
755 757
 
756 758
 		if ( isset( $query['month'] ) && $value = $this->build_value( $compare, $query['month'] ) ) {
757 759
 			$where_parts[] = "MONTH( $column ) $compare $value";
@@ -763,17 +765,21 @@  discard block
 block discarded – undo
763 765
 		} elseif ( isset( $query['w'] ) && false !== ( $value = $this->build_value( $compare, $query['w'] ) ) ) {
764 766
 			$where_parts[] = _wp_mysql_week( $column ) . " $compare $value";
765 767
 		}
766
-		if ( isset( $query['dayofyear'] ) && $value = $this->build_value( $compare, $query['dayofyear'] ) )
767
-			$where_parts[] = "DAYOFYEAR( $column ) $compare $value";
768
+		if ( isset( $query['dayofyear'] ) && $value = $this->build_value( $compare, $query['dayofyear'] ) ) {
769
+					$where_parts[] = "DAYOFYEAR( $column ) $compare $value";
770
+		}
768 771
 
769
-		if ( isset( $query['day'] ) && $value = $this->build_value( $compare, $query['day'] ) )
770
-			$where_parts[] = "DAYOFMONTH( $column ) $compare $value";
772
+		if ( isset( $query['day'] ) && $value = $this->build_value( $compare, $query['day'] ) ) {
773
+					$where_parts[] = "DAYOFMONTH( $column ) $compare $value";
774
+		}
771 775
 
772
-		if ( isset( $query['dayofweek'] ) && $value = $this->build_value( $compare, $query['dayofweek'] ) )
773
-			$where_parts[] = "DAYOFWEEK( $column ) $compare $value";
776
+		if ( isset( $query['dayofweek'] ) && $value = $this->build_value( $compare, $query['dayofweek'] ) ) {
777
+					$where_parts[] = "DAYOFWEEK( $column ) $compare $value";
778
+		}
774 779
 
775
-		if ( isset( $query['dayofweek_iso'] ) && $value = $this->build_value( $compare, $query['dayofweek_iso'] ) )
776
-			$where_parts[] = "WEEKDAY( $column ) + 1 $compare $value";
780
+		if ( isset( $query['dayofweek_iso'] ) && $value = $this->build_value( $compare, $query['dayofweek_iso'] ) ) {
781
+					$where_parts[] = "WEEKDAY( $column ) + 1 $compare $value";
782
+		}
777 783
 
778 784
 		if ( isset( $query['hour'] ) || isset( $query['minute'] ) || isset( $query['second'] ) ) {
779 785
 			// Avoid notices.
@@ -809,8 +815,9 @@  discard block
 block discarded – undo
809 815
 	 * @return string|false|int The value to be used in SQL or false on error.
810 816
 	 */
811 817
 	public function build_value( $compare, $value ) {
812
-		if ( ! isset( $value ) )
813
-			return false;
818
+		if ( ! isset( $value ) ) {
819
+					return false;
820
+		}
814 821
 
815 822
 		switch ( $compare ) {
816 823
 			case 'IN':
@@ -921,23 +928,29 @@  discard block
 block discarded – undo
921 928
 
922 929
 		$datetime = array_map( 'absint', $datetime );
923 930
 
924
-		if ( ! isset( $datetime['year'] ) )
925
-			$datetime['year'] = gmdate( 'Y', $now );
931
+		if ( ! isset( $datetime['year'] ) ) {
932
+					$datetime['year'] = gmdate( 'Y', $now );
933
+		}
926 934
 
927
-		if ( ! isset( $datetime['month'] ) )
928
-			$datetime['month'] = ( $default_to_max ) ? 12 : 1;
935
+		if ( ! isset( $datetime['month'] ) ) {
936
+					$datetime['month'] = ( $default_to_max ) ? 12 : 1;
937
+		}
929 938
 
930
-		if ( ! isset( $datetime['day'] ) )
931
-			$datetime['day'] = ( $default_to_max ) ? (int) date( 't', mktime( 0, 0, 0, $datetime['month'], 1, $datetime['year'] ) ) : 1;
939
+		if ( ! isset( $datetime['day'] ) ) {
940
+					$datetime['day'] = ( $default_to_max ) ? (int) date( 't', mktime( 0, 0, 0, $datetime['month'], 1, $datetime['year'] ) ) : 1;
941
+		}
932 942
 
933
-		if ( ! isset( $datetime['hour'] ) )
934
-			$datetime['hour'] = ( $default_to_max ) ? 23 : 0;
943
+		if ( ! isset( $datetime['hour'] ) ) {
944
+					$datetime['hour'] = ( $default_to_max ) ? 23 : 0;
945
+		}
935 946
 
936
-		if ( ! isset( $datetime['minute'] ) )
937
-			$datetime['minute'] = ( $default_to_max ) ? 59 : 0;
947
+		if ( ! isset( $datetime['minute'] ) ) {
948
+					$datetime['minute'] = ( $default_to_max ) ? 59 : 0;
949
+		}
938 950
 
939
-		if ( ! isset( $datetime['second'] ) )
940
-			$datetime['second'] = ( $default_to_max ) ? 59 : 0;
951
+		if ( ! isset( $datetime['second'] ) ) {
952
+					$datetime['second'] = ( $default_to_max ) ? 59 : 0;
953
+		}
941 954
 
942 955
 		return sprintf( '%04d-%02d-%02d %02d:%02d:%02d', $datetime['year'], $datetime['month'], $datetime['day'], $datetime['hour'], $datetime['minute'], $datetime['second'] );
943 956
 	}
@@ -963,21 +976,25 @@  discard block
 block discarded – undo
963 976
 		global $wpdb;
964 977
 
965 978
 		// Have to have at least one
966
-		if ( ! isset( $hour ) && ! isset( $minute ) && ! isset( $second ) )
967
-			return false;
979
+		if ( ! isset( $hour ) && ! isset( $minute ) && ! isset( $second ) ) {
980
+					return false;
981
+		}
968 982
 
969 983
 		// Complex combined queries aren't supported for multi-value queries
970 984
 		if ( in_array( $compare, array( 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN' ) ) ) {
971 985
 			$return = array();
972 986
 
973
-			if ( isset( $hour ) && false !== ( $value = $this->build_value( $compare, $hour ) ) )
974
-				$return[] = "HOUR( $column ) $compare $value";
987
+			if ( isset( $hour ) && false !== ( $value = $this->build_value( $compare, $hour ) ) ) {
988
+							$return[] = "HOUR( $column ) $compare $value";
989
+			}
975 990
 
976
-			if ( isset( $minute ) && false !== ( $value = $this->build_value( $compare, $minute ) ) )
977
-				$return[] = "MINUTE( $column ) $compare $value";
991
+			if ( isset( $minute ) && false !== ( $value = $this->build_value( $compare, $minute ) ) ) {
992
+							$return[] = "MINUTE( $column ) $compare $value";
993
+			}
978 994
 
979
-			if ( isset( $second ) && false !== ( $value = $this->build_value( $compare, $second ) ) )
980
-				$return[] = "SECOND( $column ) $compare $value";
995
+			if ( isset( $second ) && false !== ( $value = $this->build_value( $compare, $second ) ) ) {
996
+							$return[] = "SECOND( $column ) $compare $value";
997
+			}
981 998
 
982 999
 			return implode( ' AND ', $return );
983 1000
 		}
@@ -992,8 +1009,9 @@  discard block
 block discarded – undo
992 1009
 		}
993 1010
 
994 1011
 		// Single units were already handled. Since hour & second isn't allowed, minute must to be set.
995
-		if ( ! isset( $minute ) )
996
-			return false;
1012
+		if ( ! isset( $minute ) ) {
1013
+					return false;
1014
+		}
997 1015
 
998 1016
 		$format = $time = '';
999 1017
 
Please login to merge, or discard this patch.
src/wp-includes/deprecated.php 3 patches
Doc Comments   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -610,7 +610,7 @@  discard block
 block discarded – undo
610 610
  * @param string $feed_image
611 611
  * @param string $exclude
612 612
  * @param bool $hierarchical
613
- * @return false|null
613
+ * @return false|string
614 614
  */
615 615
 function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0,
616 616
 				   $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=false, $child_of=0, $categories=0,
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
  * @see wp_list_categories()
631 631
  *
632 632
  * @param string|array $args
633
- * @return false|null|string
633
+ * @return false|string
634 634
  */
635 635
 function wp_list_cats($args = '') {
636 636
 	_deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_categories()' );
@@ -2101,7 +2101,6 @@  discard block
 block discarded – undo
2101 2101
  * @param string|int $name            Widget ID.
2102 2102
  * @param callable   $output_callback Run when widget is called.
2103 2103
  * @param string     $classname       Optional. Classname widget option. Default empty.
2104
- * @param mixed      $params ,...     Widget parameters.
2105 2104
  */
2106 2105
 function register_sidebar_widget($name, $output_callback, $classname = '') {
2107 2106
 	_deprecated_function( __FUNCTION__, '2.8.0', 'wp_register_sidebar_widget()' );
@@ -2419,7 +2418,7 @@  discard block
 block discarded – undo
2419 2418
  * @see count_user_posts()
2420 2419
  *
2421 2420
  * @param int $userid User to count posts for.
2422
- * @return int Number of posts the given user has written.
2421
+ * @return string Number of posts the given user has written.
2423 2422
  */
2424 2423
 function get_usernumposts( $userid ) {
2425 2424
 	_deprecated_function( __FUNCTION__, '3.0.0', 'count_user_posts()' );
@@ -3601,7 +3600,7 @@  discard block
 block discarded – undo
3601 3600
  * @deprecated 4.4.0 Use get_permalink()
3602 3601
  * @see get_permalink()
3603 3602
  *
3604
- * @param int|WP_Post $post_id Optional. Post ID or WP_Post object. Default is global $post.
3603
+ * @param integer $post_id Optional. Post ID or WP_Post object. Default is global $post.
3605 3604
  * @return string|false
3606 3605
  */
3607 3606
 function post_permalink( $post_id = 0 ) {
Please login to merge, or discard this patch.
Spacing   +548 added lines, -548 removed lines patch added patch discarded remove patch
@@ -23,11 +23,11 @@  discard block
 block discarded – undo
23 23
  * @return array Post data.
24 24
  */
25 25
 function get_postdata($postid) {
26
-	_deprecated_function( __FUNCTION__, '1.5.1', 'get_post()' );
26
+	_deprecated_function(__FUNCTION__, '1.5.1', 'get_post()');
27 27
 
28 28
 	$post = get_post($postid);
29 29
 
30
-	$postdata = array (
30
+	$postdata = array(
31 31
 		'ID' => $post->ID,
32 32
 		'Author_ID' => $post->post_author,
33 33
 		'Date' => $post->post_date,
@@ -61,12 +61,12 @@  discard block
 block discarded – undo
61 61
 function start_wp() {
62 62
 	global $wp_query;
63 63
 
64
-	_deprecated_function( __FUNCTION__, '1.5.0', __('new WordPress Loop') );
64
+	_deprecated_function(__FUNCTION__, '1.5.0', __('new WordPress Loop'));
65 65
 
66 66
 	// Since the old style loop is being used, advance the query iterator here.
67 67
 	$wp_query->next_post();
68 68
 
69
-	setup_postdata( get_post() );
69
+	setup_postdata(get_post());
70 70
 }
71 71
 
72 72
 /**
@@ -80,13 +80,13 @@  discard block
 block discarded – undo
80 80
  * @return int Category ID.
81 81
  */
82 82
 function the_category_ID($echo = true) {
83
-	_deprecated_function( __FUNCTION__, '0.71', 'get_the_category()' );
83
+	_deprecated_function(__FUNCTION__, '0.71', 'get_the_category()');
84 84
 
85 85
 	// Grab the first cat in the list.
86 86
 	$categories = get_the_category();
87 87
 	$cat = $categories[0]->term_id;
88 88
 
89
-	if ( $echo )
89
+	if ($echo)
90 90
 		echo $cat;
91 91
 
92 92
 	return $cat;
@@ -102,15 +102,15 @@  discard block
 block discarded – undo
102 102
  * @param string $before Optional. Text to display before the category. Default empty.
103 103
  * @param string $after  Optional. Text to display after the category. Default empty.
104 104
  */
105
-function the_category_head( $before = '', $after = '' ) {
105
+function the_category_head($before = '', $after = '') {
106 106
 	global $currentcat, $previouscat;
107 107
 
108
-	_deprecated_function( __FUNCTION__, '0.71', 'get_the_category_by_ID()' );
108
+	_deprecated_function(__FUNCTION__, '0.71', 'get_the_category_by_ID()');
109 109
 
110 110
 	// Grab the first cat in the list.
111 111
 	$categories = get_the_category();
112 112
 	$currentcat = $categories[0]->category_id;
113
-	if ( $currentcat != $previouscat ) {
113
+	if ($currentcat != $previouscat) {
114 114
 		echo $before;
115 115
 		echo get_the_category_by_ID($currentcat);
116 116
 		echo $after;
@@ -132,22 +132,22 @@  discard block
 block discarded – undo
132 132
  * @param int    $limitprev
133 133
  * @param string $excluded_categories
134 134
  */
135
-function previous_post($format='%', $previous='previous post: ', $title='yes', $in_same_cat='no', $limitprev=1, $excluded_categories='') {
135
+function previous_post($format = '%', $previous = 'previous post: ', $title = 'yes', $in_same_cat = 'no', $limitprev = 1, $excluded_categories = '') {
136 136
 
137
-	_deprecated_function( __FUNCTION__, '2.0.0', 'previous_post_link()' );
137
+	_deprecated_function(__FUNCTION__, '2.0.0', 'previous_post_link()');
138 138
 
139
-	if ( empty($in_same_cat) || 'no' == $in_same_cat )
139
+	if (empty($in_same_cat) || 'no' == $in_same_cat)
140 140
 		$in_same_cat = false;
141 141
 	else
142 142
 		$in_same_cat = true;
143 143
 
144 144
 	$post = get_previous_post($in_same_cat, $excluded_categories);
145 145
 
146
-	if ( !$post )
146
+	if ( ! $post)
147 147
 		return;
148 148
 
149 149
 	$string = '<a href="'.get_permalink($post->ID).'">'.$previous;
150
-	if ( 'yes' == $title )
150
+	if ('yes' == $title)
151 151
 		$string .= apply_filters('the_title', $post->post_title, $post->ID);
152 152
 	$string .= '</a>';
153 153
 	$format = str_replace('%', $string, $format);
@@ -168,21 +168,21 @@  discard block
 block discarded – undo
168 168
  * @param int $limitnext
169 169
  * @param string $excluded_categories
170 170
  */
171
-function next_post($format='%', $next='next post: ', $title='yes', $in_same_cat='no', $limitnext=1, $excluded_categories='') {
172
-	_deprecated_function( __FUNCTION__, '2.0.0', 'next_post_link()' );
171
+function next_post($format = '%', $next = 'next post: ', $title = 'yes', $in_same_cat = 'no', $limitnext = 1, $excluded_categories = '') {
172
+	_deprecated_function(__FUNCTION__, '2.0.0', 'next_post_link()');
173 173
 
174
-	if ( empty($in_same_cat) || 'no' == $in_same_cat )
174
+	if (empty($in_same_cat) || 'no' == $in_same_cat)
175 175
 		$in_same_cat = false;
176 176
 	else
177 177
 		$in_same_cat = true;
178 178
 
179 179
 	$post = get_next_post($in_same_cat, $excluded_categories);
180 180
 
181
-	if ( !$post	)
181
+	if ( ! $post)
182 182
 		return;
183 183
 
184 184
 	$string = '<a href="'.get_permalink($post->ID).'">'.$next;
185
-	if ( 'yes' == $title )
185
+	if ('yes' == $title)
186 186
 		$string .= apply_filters('the_title', $post->post_title, $post->ID);
187 187
 	$string .= '</a>';
188 188
 	$format = str_replace('%', $string, $format);
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
  * @return bool
203 203
  */
204 204
 function user_can_create_post($user_id, $blog_id = 1, $category_id = 'None') {
205
-	_deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
205
+	_deprecated_function(__FUNCTION__, '2.0.0', 'current_user_can()');
206 206
 
207 207
 	$author_data = get_userdata($user_id);
208 208
 	return ($author_data->user_level > 1);
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
  * @return bool
222 222
  */
223 223
 function user_can_create_draft($user_id, $blog_id = 1, $category_id = 'None') {
224
-	_deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
224
+	_deprecated_function(__FUNCTION__, '2.0.0', 'current_user_can()');
225 225
 
226 226
 	$author_data = get_userdata($user_id);
227 227
 	return ($author_data->user_level >= 1);
@@ -240,15 +240,15 @@  discard block
 block discarded – undo
240 240
  * @return bool
241 241
  */
242 242
 function user_can_edit_post($user_id, $post_id, $blog_id = 1) {
243
-	_deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
243
+	_deprecated_function(__FUNCTION__, '2.0.0', 'current_user_can()');
244 244
 
245 245
 	$author_data = get_userdata($user_id);
246 246
 	$post = get_post($post_id);
247 247
 	$post_author_data = get_userdata($post->post_author);
248 248
 
249
-	if ( (($user_id == $post_author_data->ID) && !($post->post_status == 'publish' && $author_data->user_level < 2))
249
+	if ((($user_id == $post_author_data->ID) && ! ($post->post_status == 'publish' && $author_data->user_level < 2))
250 250
 			 || ($author_data->user_level > $post_author_data->user_level)
251
-			 || ($author_data->user_level >= 10) ) {
251
+			 || ($author_data->user_level >= 10)) {
252 252
 		return true;
253 253
 	} else {
254 254
 		return false;
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
  * @return bool
269 269
  */
270 270
 function user_can_delete_post($user_id, $post_id, $blog_id = 1) {
271
-	_deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
271
+	_deprecated_function(__FUNCTION__, '2.0.0', 'current_user_can()');
272 272
 
273 273
 	// right now if one can edit, one can delete
274 274
 	return user_can_edit_post($user_id, $post_id, $blog_id);
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
  * @return bool
288 288
  */
289 289
 function user_can_set_post_date($user_id, $blog_id = 1, $category_id = 'None') {
290
-	_deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
290
+	_deprecated_function(__FUNCTION__, '2.0.0', 'current_user_can()');
291 291
 
292 292
 	$author_data = get_userdata($user_id);
293 293
 	return (($author_data->user_level > 4) && user_can_create_post($user_id, $blog_id, $category_id));
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
  * @return bool returns true if $user_id can edit $post_id's date
307 307
  */
308 308
 function user_can_edit_post_date($user_id, $post_id, $blog_id = 1) {
309
-	_deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
309
+	_deprecated_function(__FUNCTION__, '2.0.0', 'current_user_can()');
310 310
 
311 311
 	$author_data = get_userdata($user_id);
312 312
 	return (($author_data->user_level > 4) && user_can_edit_post($user_id, $post_id, $blog_id));
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
  * @return bool returns true if $user_id can edit $post_id's comments
326 326
  */
327 327
 function user_can_edit_post_comments($user_id, $post_id, $blog_id = 1) {
328
-	_deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
328
+	_deprecated_function(__FUNCTION__, '2.0.0', 'current_user_can()');
329 329
 
330 330
 	// right now if one can edit a post, one can edit comments made on it
331 331
 	return user_can_edit_post($user_id, $post_id, $blog_id);
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
  * @return bool returns true if $user_id can delete $post_id's comments
345 345
  */
346 346
 function user_can_delete_post_comments($user_id, $post_id, $blog_id = 1) {
347
-	_deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
347
+	_deprecated_function(__FUNCTION__, '2.0.0', 'current_user_can()');
348 348
 
349 349
 	// right now if one can edit comments, one can delete comments
350 350
 	return user_can_edit_post_comments($user_id, $post_id, $blog_id);
@@ -362,11 +362,11 @@  discard block
 block discarded – undo
362 362
  * @return bool
363 363
  */
364 364
 function user_can_edit_user($user_id, $other_user) {
365
-	_deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
365
+	_deprecated_function(__FUNCTION__, '2.0.0', 'current_user_can()');
366 366
 
367 367
 	$user  = get_userdata($user_id);
368 368
 	$other = get_userdata($other_user);
369
-	if ( $user->user_level > $other->user_level || $user->user_level > 8 || $user->ID == $other->ID )
369
+	if ($user->user_level > $other->user_level || $user->user_level > 8 || $user->ID == $other->ID)
370 370
 		return true;
371 371
 	else
372 372
 		return false;
@@ -395,11 +395,11 @@  discard block
 block discarded – undo
395 395
 function get_linksbyname($cat_name = "noname", $before = '', $after = '<br />', $between = " ", $show_images = true, $orderby = 'id',
396 396
 						 $show_description = true, $show_rating = false,
397 397
 						 $limit = -1, $show_updated = 0) {
398
-	_deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' );
398
+	_deprecated_function(__FUNCTION__, '2.1.0', 'get_bookmarks()');
399 399
 
400 400
 	$cat_id = -1;
401 401
 	$cat = get_term_by('name', $cat_name, 'link_category');
402
-	if ( $cat )
402
+	if ($cat)
403 403
 		$cat_id = $cat->term_id;
404 404
 
405 405
 	get_links($cat_id, $before, $after, $between, $show_images, $orderby, $show_description, $show_rating, $limit, $show_updated);
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
 		'title_li' => '',
431 431
 	);
432 432
 
433
-	$r = wp_parse_args( $args, $defaults );
433
+	$r = wp_parse_args($args, $defaults);
434 434
 
435 435
 	return wp_list_bookmarks($r);
436 436
 }
@@ -454,12 +454,12 @@  discard block
 block discarded – undo
454 454
  * @param int $limit Limit to X entries. If not specified, all entries are shown.
455 455
  * @return array
456 456
  */
457
-function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit = -1) {
458
-	_deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' );
457
+function get_linkobjectsbyname($cat_name = "noname", $orderby = 'name', $limit = -1) {
458
+	_deprecated_function(__FUNCTION__, '2.1.0', 'get_bookmarks()');
459 459
 
460 460
 	$cat_id = -1;
461 461
 	$cat = get_term_by('name', $cat_name, 'link_category');
462
-	if ( $cat )
462
+	if ($cat)
463 463
 		$cat_id = $cat->term_id;
464 464
 
465 465
 	return get_linkobjects($cat_id, $orderby, $limit);
@@ -506,9 +506,9 @@  discard block
 block discarded – undo
506 506
  * @return array
507 507
  */
508 508
 function get_linkobjects($category = 0, $orderby = 'name', $limit = 0) {
509
-	_deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' );
509
+	_deprecated_function(__FUNCTION__, '2.1.0', 'get_bookmarks()');
510 510
 
511
-	$links = get_bookmarks( array( 'category' => $category, 'orderby' => $orderby, 'limit' => $limit ) ) ;
511
+	$links = get_bookmarks(array('category' => $category, 'orderby' => $orderby, 'limit' => $limit));
512 512
 
513 513
 	$links_array = array();
514 514
 	foreach ($links as $link)
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
  */
540 540
 function get_linksbyname_withrating($cat_name = "noname", $before = '', $after = '<br />', $between = " ",
541 541
 									$show_images = true, $orderby = 'id', $show_description = true, $limit = -1, $show_updated = 0) {
542
-	_deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' );
542
+	_deprecated_function(__FUNCTION__, '2.1.0', 'get_bookmarks()');
543 543
 
544 544
 	get_linksbyname($cat_name, $before, $after, $between, $show_images, $orderby, $show_description, true, $limit, $show_updated);
545 545
 }
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
  */
567 567
 function get_links_withrating($category = -1, $before = '', $after = '<br />', $between = " ", $show_images = true,
568 568
 							  $orderby = 'id', $show_description = true, $limit = -1, $show_updated = 0) {
569
-	_deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' );
569
+	_deprecated_function(__FUNCTION__, '2.1.0', 'get_bookmarks()');
570 570
 
571 571
 	get_links($category, $before, $after, $between, $show_images, $orderby, $show_description, true, $limit, $show_updated);
572 572
 }
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
  * @return int Only returns 0.
582 582
  */
583 583
 function get_autotoggle($id = 0) {
584
-	_deprecated_function( __FUNCTION__, '2.1.0' );
584
+	_deprecated_function(__FUNCTION__, '2.1.0');
585 585
 	return 0;
586 586
 }
587 587
 
@@ -613,9 +613,9 @@  discard block
 block discarded – undo
613 613
  * @return false|null
614 614
  */
615 615
 function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0,
616
-				   $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=false, $child_of=0, $categories=0,
617
-				   $recurse=0, $feed = '', $feed_image = '', $exclude = '', $hierarchical=false) {
618
-	_deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_categories()' );
616
+				   $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children = false, $child_of = 0, $categories = 0,
617
+				   $recurse = 0, $feed = '', $feed_image = '', $exclude = '', $hierarchical = false) {
618
+	_deprecated_function(__FUNCTION__, '2.1.0', 'wp_list_categories()');
619 619
 
620 620
 	$query = compact('optionall', 'all', 'sort_column', 'sort_order', 'file', 'list', 'optiondates', 'optioncount', 'hide_empty', 'use_desc_for_title', 'children',
621 621
 		'child_of', 'categories', 'recurse', 'feed', 'feed_image', 'exclude', 'hierarchical');
@@ -633,22 +633,22 @@  discard block
 block discarded – undo
633 633
  * @return false|null|string
634 634
  */
635 635
 function wp_list_cats($args = '') {
636
-	_deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_categories()' );
636
+	_deprecated_function(__FUNCTION__, '2.1.0', 'wp_list_categories()');
637 637
 
638
-	$r = wp_parse_args( $args );
638
+	$r = wp_parse_args($args);
639 639
 
640 640
 	// Map to new names.
641
-	if ( isset($r['optionall']) && isset($r['all']))
641
+	if (isset($r['optionall']) && isset($r['all']))
642 642
 		$r['show_option_all'] = $r['all'];
643
-	if ( isset($r['sort_column']) )
643
+	if (isset($r['sort_column']))
644 644
 		$r['orderby'] = $r['sort_column'];
645
-	if ( isset($r['sort_order']) )
645
+	if (isset($r['sort_order']))
646 646
 		$r['order'] = $r['sort_order'];
647
-	if ( isset($r['optiondates']) )
647
+	if (isset($r['optiondates']))
648 648
 		$r['show_last_update'] = $r['optiondates'];
649
-	if ( isset($r['optioncount']) )
649
+	if (isset($r['optioncount']))
650 650
 		$r['show_count'] = $r['optioncount'];
651
-	if ( isset($r['list']) )
651
+	if (isset($r['list']))
652 652
 		$r['style'] = $r['list'] ? 'list' : 'break';
653 653
 	$r['title_li'] = '';
654 654
 
@@ -677,14 +677,14 @@  discard block
 block discarded – undo
677 677
 function dropdown_cats($optionall = 1, $all = 'All', $orderby = 'ID', $order = 'asc',
678 678
 		$show_last_update = 0, $show_count = 0, $hide_empty = 1, $optionnone = false,
679 679
 		$selected = 0, $exclude = 0) {
680
-	_deprecated_function( __FUNCTION__, '2.1.0', 'wp_dropdown_categories()' );
680
+	_deprecated_function(__FUNCTION__, '2.1.0', 'wp_dropdown_categories()');
681 681
 
682 682
 	$show_option_all = '';
683
-	if ( $optionall )
683
+	if ($optionall)
684 684
 		$show_option_all = $all;
685 685
 
686 686
 	$show_option_none = '';
687
-	if ( $optionnone )
687
+	if ($optionnone)
688 688
 		$show_option_none = __('None');
689 689
 
690 690
 	$vars = compact('show_option_all', 'show_option_none', 'orderby', 'order',
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
  * @return null|string
710 710
  */
711 711
 function list_authors($optioncount = false, $exclude_admin = true, $show_fullname = false, $hide_empty = true, $feed = '', $feed_image = '') {
712
-	_deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_authors()' );
712
+	_deprecated_function(__FUNCTION__, '2.1.0', 'wp_list_authors()');
713 713
 
714 714
 	$args = compact('optioncount', 'exclude_admin', 'show_fullname', 'hide_empty', 'feed', 'feed_image');
715 715
 	return wp_list_authors($args);
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
  * @return array
728 728
  */
729 729
 function wp_get_post_cats($blogid = '1', $post_ID = 0) {
730
-	_deprecated_function( __FUNCTION__, '2.1.0', 'wp_get_post_categories()' );
730
+	_deprecated_function(__FUNCTION__, '2.1.0', 'wp_get_post_categories()');
731 731
 	return wp_get_post_categories($post_ID);
732 732
 }
733 733
 
@@ -745,7 +745,7 @@  discard block
 block discarded – undo
745 745
  * @return bool|mixed
746 746
  */
747 747
 function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array()) {
748
-	_deprecated_function( __FUNCTION__, '2.1.0', 'wp_set_post_categories()' );
748
+	_deprecated_function(__FUNCTION__, '2.1.0', 'wp_set_post_categories()');
749 749
 	return wp_set_post_categories($post_ID, $post_categories);
750 750
 }
751 751
 
@@ -764,8 +764,8 @@  discard block
 block discarded – undo
764 764
  * @param bool $show_post_count
765 765
  * @return string|null
766 766
  */
767
-function get_archives($type='', $limit='', $format='html', $before = '', $after = '', $show_post_count = false) {
768
-	_deprecated_function( __FUNCTION__, '2.1.0', 'wp_get_archives()' );
767
+function get_archives($type = '', $limit = '', $format = 'html', $before = '', $after = '', $show_post_count = false) {
768
+	_deprecated_function(__FUNCTION__, '2.1.0', 'wp_get_archives()');
769 769
 	$args = compact('type', 'limit', 'format', 'before', 'after', 'show_post_count');
770 770
 	return wp_get_archives($args);
771 771
 }
@@ -783,11 +783,11 @@  discard block
 block discarded – undo
783 783
  * @return string|null
784 784
  */
785 785
 function get_author_link($echo, $author_id, $author_nicename = '') {
786
-	_deprecated_function( __FUNCTION__, '2.1.0', 'get_author_posts_url()' );
786
+	_deprecated_function(__FUNCTION__, '2.1.0', 'get_author_posts_url()');
787 787
 
788 788
 	$link = get_author_posts_url($author_id, $author_nicename);
789 789
 
790
-	if ( $echo )
790
+	if ($echo)
791 791
 		echo $link;
792 792
 	return $link;
793 793
 }
@@ -808,9 +808,9 @@  discard block
 block discarded – undo
808 808
  * @param string $more_file
809 809
  * @return string
810 810
  */
811
-function link_pages($before='<br />', $after='<br />', $next_or_number='number', $nextpagelink='next page', $previouspagelink='previous page',
812
-					$pagelink='%', $more_file='') {
813
-	_deprecated_function( __FUNCTION__, '2.1.0', 'wp_link_pages()' );
811
+function link_pages($before = '<br />', $after = '<br />', $next_or_number = 'number', $nextpagelink = 'next page', $previouspagelink = 'previous page',
812
+					$pagelink = '%', $more_file = '') {
813
+	_deprecated_function(__FUNCTION__, '2.1.0', 'wp_link_pages()');
814 814
 
815 815
 	$args = compact('before', 'after', 'next_or_number', 'nextpagelink', 'previouspagelink', 'pagelink', 'more_file');
816 816
 	return wp_link_pages($args);
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
  * @return string
828 828
  */
829 829
 function get_settings($option) {
830
-	_deprecated_function( __FUNCTION__, '2.1.0', 'get_option()' );
830
+	_deprecated_function(__FUNCTION__, '2.1.0', 'get_option()');
831 831
 
832 832
 	return get_option($option);
833 833
 }
@@ -840,7 +840,7 @@  discard block
 block discarded – undo
840 840
  * @see the_permalink()
841 841
  */
842 842
 function permalink_link() {
843
-	_deprecated_function( __FUNCTION__, '1.2.0', 'the_permalink()' );
843
+	_deprecated_function(__FUNCTION__, '1.2.0', 'the_permalink()');
844 844
 	the_permalink();
845 845
 }
846 846
 
@@ -854,7 +854,7 @@  discard block
 block discarded – undo
854 854
  * @param string $deprecated
855 855
  */
856 856
 function permalink_single_rss($deprecated = '') {
857
-	_deprecated_function( __FUNCTION__, '2.3.0', 'the_permalink_rss()' );
857
+	_deprecated_function(__FUNCTION__, '2.3.0', 'the_permalink_rss()');
858 858
 	the_permalink_rss();
859 859
 }
860 860
 
@@ -869,11 +869,11 @@  discard block
 block discarded – undo
869 869
  * @return null|string
870 870
  */
871 871
 function wp_get_links($args = '') {
872
-	_deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_bookmarks()' );
872
+	_deprecated_function(__FUNCTION__, '2.1.0', 'wp_list_bookmarks()');
873 873
 
874
-	if ( strpos( $args, '=' ) === false ) {
874
+	if (strpos($args, '=') === false) {
875 875
 		$cat_id = $args;
876
-		$args = add_query_arg( 'category', $cat_id, $args );
876
+		$args = add_query_arg('category', $cat_id, $args);
877 877
 	}
878 878
 
879 879
 	$defaults = array(
@@ -892,7 +892,7 @@  discard block
 block discarded – undo
892 892
 		'title_li' => '',
893 893
 	);
894 894
 
895
-	$r = wp_parse_args( $args, $defaults );
895
+	$r = wp_parse_args($args, $defaults);
896 896
 
897 897
 	return wp_list_bookmarks($r);
898 898
 }
@@ -923,81 +923,81 @@  discard block
 block discarded – undo
923 923
  */
924 924
 function get_links($category = -1, $before = '', $after = '<br />', $between = ' ', $show_images = true, $orderby = 'name',
925 925
 			$show_description = true, $show_rating = false, $limit = -1, $show_updated = 1, $echo = true) {
926
-	_deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' );
926
+	_deprecated_function(__FUNCTION__, '2.1.0', 'get_bookmarks()');
927 927
 
928 928
 	$order = 'ASC';
929
-	if ( substr($orderby, 0, 1) == '_' ) {
929
+	if (substr($orderby, 0, 1) == '_') {
930 930
 		$order = 'DESC';
931 931
 		$orderby = substr($orderby, 1);
932 932
 	}
933 933
 
934
-	if ( $category == -1 ) //get_bookmarks uses '' to signify all categories
934
+	if ($category == -1) //get_bookmarks uses '' to signify all categories
935 935
 		$category = '';
936 936
 
937 937
 	$results = get_bookmarks(array('category' => $category, 'orderby' => $orderby, 'order' => $order, 'show_updated' => $show_updated, 'limit' => $limit));
938 938
 
939
-	if ( !$results )
939
+	if ( ! $results)
940 940
 		return;
941 941
 
942 942
 	$output = '';
943 943
 
944
-	foreach ( (array) $results as $row ) {
945
-		if ( !isset($row->recently_updated) )
944
+	foreach ((array) $results as $row) {
945
+		if ( ! isset($row->recently_updated))
946 946
 			$row->recently_updated = false;
947 947
 		$output .= $before;
948
-		if ( $show_updated && $row->recently_updated )
948
+		if ($show_updated && $row->recently_updated)
949 949
 			$output .= get_option('links_recently_updated_prepend');
950 950
 		$the_link = '#';
951
-		if ( !empty($row->link_url) )
951
+		if ( ! empty($row->link_url))
952 952
 			$the_link = esc_url($row->link_url);
953 953
 		$rel = $row->link_rel;
954
-		if ( '' != $rel )
955
-			$rel = ' rel="' . $rel . '"';
954
+		if ('' != $rel)
955
+			$rel = ' rel="'.$rel.'"';
956 956
 
957 957
 		$desc = esc_attr(sanitize_bookmark_field('link_description', $row->link_description, $row->link_id, 'display'));
958 958
 		$name = esc_attr(sanitize_bookmark_field('link_name', $row->link_name, $row->link_id, 'display'));
959 959
 		$title = $desc;
960 960
 
961
-		if ( $show_updated )
961
+		if ($show_updated)
962 962
 			if (substr($row->link_updated_f, 0, 2) != '00')
963
-				$title .= ' ('.__('Last updated') . ' ' . date(get_option('links_updated_date_format'), $row->link_updated_f + (get_option('gmt_offset') * HOUR_IN_SECONDS)) . ')';
963
+				$title .= ' ('.__('Last updated').' '.date(get_option('links_updated_date_format'), $row->link_updated_f + (get_option('gmt_offset') * HOUR_IN_SECONDS)).')';
964 964
 
965
-		if ( '' != $title )
966
-			$title = ' title="' . $title . '"';
965
+		if ('' != $title)
966
+			$title = ' title="'.$title.'"';
967 967
 
968
-		$alt = ' alt="' . $name . '"';
968
+		$alt = ' alt="'.$name.'"';
969 969
 
970 970
 		$target = $row->link_target;
971
-		if ( '' != $target )
972
-			$target = ' target="' . $target . '"';
971
+		if ('' != $target)
972
+			$target = ' target="'.$target.'"';
973 973
 
974
-		$output .= '<a href="' . $the_link . '"' . $rel . $title . $target. '>';
974
+		$output .= '<a href="'.$the_link.'"'.$rel.$title.$target.'>';
975 975
 
976
-		if ( $row->link_image != null && $show_images ) {
977
-			if ( strpos($row->link_image, 'http') !== false )
976
+		if ($row->link_image != null && $show_images) {
977
+			if (strpos($row->link_image, 'http') !== false)
978 978
 				$output .= "<img src=\"$row->link_image\" $alt $title />";
979 979
 			else // If it's a relative path
980
-				$output .= "<img src=\"" . get_option('siteurl') . "$row->link_image\" $alt $title />";
980
+				$output .= "<img src=\"".get_option('siteurl')."$row->link_image\" $alt $title />";
981 981
 		} else {
982 982
 			$output .= $name;
983 983
 		}
984 984
 
985 985
 		$output .= '</a>';
986 986
 
987
-		if ( $show_updated && $row->recently_updated )
987
+		if ($show_updated && $row->recently_updated)
988 988
 			$output .= get_option('links_recently_updated_append');
989 989
 
990
-		if ( $show_description && '' != $desc )
991
-			$output .= $between . $desc;
990
+		if ($show_description && '' != $desc)
991
+			$output .= $between.$desc;
992 992
 
993 993
 		if ($show_rating) {
994
-			$output .= $between . get_linkrating($row);
994
+			$output .= $between.get_linkrating($row);
995 995
 		}
996 996
 
997 997
 		$output .= "$after\n";
998 998
 	} // end while
999 999
 
1000
-	if ( !$echo )
1000
+	if ( ! $echo)
1001 1001
 		return $output;
1002 1002
 	echo $output;
1003 1003
 }
@@ -1015,29 +1015,29 @@  discard block
 block discarded – undo
1015 1015
  * @param string $order Sort link categories by 'name' or 'id'
1016 1016
  */
1017 1017
 function get_links_list($order = 'name') {
1018
-	_deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_bookmarks()' );
1018
+	_deprecated_function(__FUNCTION__, '2.1.0', 'wp_list_bookmarks()');
1019 1019
 
1020 1020
 	$order = strtolower($order);
1021 1021
 
1022 1022
 	// Handle link category sorting
1023 1023
 	$direction = 'ASC';
1024
-	if ( '_' == substr($order,0,1) ) {
1024
+	if ('_' == substr($order, 0, 1)) {
1025 1025
 		$direction = 'DESC';
1026
-		$order = substr($order,1);
1026
+		$order = substr($order, 1);
1027 1027
 	}
1028 1028
 
1029
-	if ( !isset($direction) )
1029
+	if ( ! isset($direction))
1030 1030
 		$direction = '';
1031 1031
 
1032 1032
 	$cats = get_categories(array('type' => 'link', 'orderby' => $order, 'order' => $direction, 'hierarchical' => 0));
1033 1033
 
1034 1034
 	// Display each category
1035
-	if ( $cats ) {
1036
-		foreach ( (array) $cats as $cat ) {
1035
+	if ($cats) {
1036
+		foreach ((array) $cats as $cat) {
1037 1037
 			// Handle each category.
1038 1038
 
1039 1039
 			// Display the category name
1040
-			echo '  <li id="linkcat-' . $cat->term_id . '" class="linkcat"><h2>' . apply_filters('link_category', $cat->name ) . "</h2>\n\t<ul>\n";
1040
+			echo '  <li id="linkcat-'.$cat->term_id.'" class="linkcat"><h2>'.apply_filters('link_category', $cat->name)."</h2>\n\t<ul>\n";
1041 1041
 			// Call get_links() with all the appropriate params
1042 1042
 			get_links($cat->term_id, '<li>', "</li>", "\n", true, 'name', false);
1043 1043
 
@@ -1059,8 +1059,8 @@  discard block
 block discarded – undo
1059 1059
  * @param string $file the page to open in the popup window
1060 1060
  * @param bool $count the number of links in the db
1061 1061
  */
1062
-function links_popup_script($text = 'Links', $width=400, $height=400, $file='links.all.php', $count = true) {
1063
-	_deprecated_function( __FUNCTION__, '2.1.0' );
1062
+function links_popup_script($text = 'Links', $width = 400, $height = 400, $file = 'links.all.php', $count = true) {
1063
+	_deprecated_function(__FUNCTION__, '2.1.0');
1064 1064
 }
1065 1065
 
1066 1066
 /**
@@ -1073,8 +1073,8 @@  discard block
 block discarded – undo
1073 1073
  * @param object $link Link object.
1074 1074
  * @return mixed Value of the 'link_rating' field, false otherwise.
1075 1075
  */
1076
-function get_linkrating( $link ) {
1077
-	_deprecated_function( __FUNCTION__, '2.1.0', 'sanitize_bookmark_field()' );
1076
+function get_linkrating($link) {
1077
+	_deprecated_function(__FUNCTION__, '2.1.0', 'sanitize_bookmark_field()');
1078 1078
 	return sanitize_bookmark_field('link_rating', $link->link_rating, $link->link_id, 'display');
1079 1079
 }
1080 1080
 
@@ -1089,16 +1089,16 @@  discard block
 block discarded – undo
1089 1089
  * @return string
1090 1090
  */
1091 1091
 function get_linkcatname($id = 0) {
1092
-	_deprecated_function( __FUNCTION__, '2.1.0', 'get_category()' );
1092
+	_deprecated_function(__FUNCTION__, '2.1.0', 'get_category()');
1093 1093
 
1094 1094
 	$id = (int) $id;
1095 1095
 
1096
-	if ( empty($id) )
1096
+	if (empty($id))
1097 1097
 		return '';
1098 1098
 
1099 1099
 	$cats = wp_get_link_cats($id);
1100 1100
 
1101
-	if ( empty($cats) || ! is_array($cats) )
1101
+	if (empty($cats) || ! is_array($cats))
1102 1102
 		return '';
1103 1103
 
1104 1104
 	$cat_id = (int) $cats[0]; // Take the first cat.
@@ -1117,7 +1117,7 @@  discard block
 block discarded – undo
1117 1117
  * @param string $link_text
1118 1118
  */
1119 1119
 function comments_rss_link($link_text = 'Comments RSS') {
1120
-	_deprecated_function( __FUNCTION__, '2.5.0', 'post_comments_feed_link()' );
1120
+	_deprecated_function(__FUNCTION__, '2.5.0', 'post_comments_feed_link()');
1121 1121
 	post_comments_feed_link($link_text);
1122 1122
 }
1123 1123
 
@@ -1133,11 +1133,11 @@  discard block
 block discarded – undo
1133 1133
  * @return string
1134 1134
  */
1135 1135
 function get_category_rss_link($echo = false, $cat_ID = 1) {
1136
-	_deprecated_function( __FUNCTION__, '2.5.0', 'get_category_feed_link()' );
1136
+	_deprecated_function(__FUNCTION__, '2.5.0', 'get_category_feed_link()');
1137 1137
 
1138 1138
 	$link = get_category_feed_link($cat_ID, 'rss2');
1139 1139
 
1140
-	if ( $echo )
1140
+	if ($echo)
1141 1141
 		echo $link;
1142 1142
 	return $link;
1143 1143
 }
@@ -1154,10 +1154,10 @@  discard block
 block discarded – undo
1154 1154
  * @return string
1155 1155
  */
1156 1156
 function get_author_rss_link($echo = false, $author_id = 1) {
1157
-	_deprecated_function( __FUNCTION__, '2.5.0', 'get_author_feed_link()' );
1157
+	_deprecated_function(__FUNCTION__, '2.5.0', 'get_author_feed_link()');
1158 1158
 
1159 1159
 	$link = get_author_feed_link($author_id);
1160
-	if ( $echo )
1160
+	if ($echo)
1161 1161
 		echo $link;
1162 1162
 	return $link;
1163 1163
 }
@@ -1172,8 +1172,8 @@  discard block
 block discarded – undo
1172 1172
  * @return string
1173 1173
  */
1174 1174
 function comments_rss() {
1175
-	_deprecated_function( __FUNCTION__, '2.2.0', 'get_post_comments_feed_link()' );
1176
-	return esc_url( get_post_comments_feed_link() );
1175
+	_deprecated_function(__FUNCTION__, '2.2.0', 'get_post_comments_feed_link()');
1176
+	return esc_url(get_post_comments_feed_link());
1177 1177
 }
1178 1178
 
1179 1179
 /**
@@ -1189,7 +1189,7 @@  discard block
 block discarded – undo
1189 1189
  * @return int The new user's ID.
1190 1190
  */
1191 1191
 function create_user($username, $password, $email) {
1192
-	_deprecated_function( __FUNCTION__, '2.0.0', 'wp_create_user()' );
1192
+	_deprecated_function(__FUNCTION__, '2.0.0', 'wp_create_user()');
1193 1193
 	return wp_create_user($username, $password, $email);
1194 1194
 }
1195 1195
 
@@ -1199,7 +1199,7 @@  discard block
 block discarded – undo
1199 1199
  * @deprecated 2.5.0
1200 1200
  */
1201 1201
 function gzip_compression() {
1202
-	_deprecated_function( __FUNCTION__, '2.5.0' );
1202
+	_deprecated_function(__FUNCTION__, '2.5.0');
1203 1203
 	return false;
1204 1204
 }
1205 1205
 
@@ -1215,8 +1215,8 @@  discard block
 block discarded – undo
1215 1215
  * @param bool $include_unapproved Whether to include unapproved comments
1216 1216
  * @return array The comment data
1217 1217
  */
1218
-function get_commentdata( $comment_ID, $no_cache = 0, $include_unapproved = false ) {
1219
-	_deprecated_function( __FUNCTION__, '2.7.0', 'get_comment()' );
1218
+function get_commentdata($comment_ID, $no_cache = 0, $include_unapproved = false) {
1219
+	_deprecated_function(__FUNCTION__, '2.7.0', 'get_comment()');
1220 1220
 	return get_comment($comment_ID, ARRAY_A);
1221 1221
 }
1222 1222
 
@@ -1230,9 +1230,9 @@  discard block
 block discarded – undo
1230 1230
  * @param int $cat_ID Category ID
1231 1231
  * @return string category name
1232 1232
  */
1233
-function get_catname( $cat_ID ) {
1234
-	_deprecated_function( __FUNCTION__, '2.8.0', 'get_cat_name()' );
1235
-	return get_cat_name( $cat_ID );
1233
+function get_catname($cat_ID) {
1234
+	_deprecated_function(__FUNCTION__, '2.8.0', 'get_cat_name()');
1235
+	return get_cat_name($cat_ID);
1236 1236
 }
1237 1237
 
1238 1238
 /**
@@ -1248,25 +1248,25 @@  discard block
 block discarded – undo
1248 1248
  * @param array $visited Optional. Category Term IDs that have already been added.
1249 1249
  * @return string
1250 1250
  */
1251
-function get_category_children( $id, $before = '/', $after = '', $visited = array() ) {
1252
-	_deprecated_function( __FUNCTION__, '2.8.0', 'get_term_children()' );
1253
-	if ( 0 == $id )
1251
+function get_category_children($id, $before = '/', $after = '', $visited = array()) {
1252
+	_deprecated_function(__FUNCTION__, '2.8.0', 'get_term_children()');
1253
+	if (0 == $id)
1254 1254
 		return '';
1255 1255
 
1256 1256
 	$chain = '';
1257 1257
 	/** TODO: consult hierarchy */
1258 1258
 	$cat_ids = get_all_category_ids();
1259
-	foreach ( (array) $cat_ids as $cat_id ) {
1260
-		if ( $cat_id == $id )
1259
+	foreach ((array) $cat_ids as $cat_id) {
1260
+		if ($cat_id == $id)
1261 1261
 			continue;
1262 1262
 
1263
-		$category = get_category( $cat_id );
1264
-		if ( is_wp_error( $category ) )
1263
+		$category = get_category($cat_id);
1264
+		if (is_wp_error($category))
1265 1265
 			return $category;
1266
-		if ( $category->parent == $id && !in_array( $category->term_id, $visited ) ) {
1266
+		if ($category->parent == $id && ! in_array($category->term_id, $visited)) {
1267 1267
 			$visited[] = $category->term_id;
1268 1268
 			$chain .= $before.$category->term_id.$after;
1269
-			$chain .= get_category_children( $category->term_id, $before, $after );
1269
+			$chain .= get_category_children($category->term_id, $before, $after);
1270 1270
 		}
1271 1271
 	}
1272 1272
 	return $chain;
@@ -1284,11 +1284,11 @@  discard block
 block discarded – undo
1284 1284
  * @return object List of all of the category IDs.
1285 1285
  */
1286 1286
 function get_all_category_ids() {
1287
-	_deprecated_function( __FUNCTION__, '4.0.0', 'get_terms()' );
1287
+	_deprecated_function(__FUNCTION__, '4.0.0', 'get_terms()');
1288 1288
 
1289
-	if ( ! $cat_ids = wp_cache_get( 'all_category_ids', 'category' ) ) {
1290
-		$cat_ids = get_terms( 'category', array('fields' => 'ids', 'get' => 'all') );
1291
-		wp_cache_add( 'all_category_ids', $cat_ids, 'category' );
1289
+	if ( ! $cat_ids = wp_cache_get('all_category_ids', 'category')) {
1290
+		$cat_ids = get_terms('category', array('fields' => 'ids', 'get' => 'all'));
1291
+		wp_cache_add('all_category_ids', $cat_ids, 'category');
1292 1292
 	}
1293 1293
 
1294 1294
 	return $cat_ids;
@@ -1304,7 +1304,7 @@  discard block
 block discarded – undo
1304 1304
  * @return string The author's description.
1305 1305
  */
1306 1306
 function get_the_author_description() {
1307
-	_deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'description\')' );
1307
+	_deprecated_function(__FUNCTION__, '2.8.0', 'get_the_author_meta(\'description\')');
1308 1308
 	return get_the_author_meta('description');
1309 1309
 }
1310 1310
 
@@ -1316,7 +1316,7 @@  discard block
 block discarded – undo
1316 1316
  * @see the_author_meta()
1317 1317
  */
1318 1318
 function the_author_description() {
1319
-	_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'description\')' );
1319
+	_deprecated_function(__FUNCTION__, '2.8.0', 'the_author_meta(\'description\')');
1320 1320
 	the_author_meta('description');
1321 1321
 }
1322 1322
 
@@ -1330,7 +1330,7 @@  discard block
 block discarded – undo
1330 1330
  * @return string The author's login name (username).
1331 1331
  */
1332 1332
 function get_the_author_login() {
1333
-	_deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'login\')' );
1333
+	_deprecated_function(__FUNCTION__, '2.8.0', 'get_the_author_meta(\'login\')');
1334 1334
 	return get_the_author_meta('login');
1335 1335
 }
1336 1336
 
@@ -1342,7 +1342,7 @@  discard block
 block discarded – undo
1342 1342
  * @see the_author_meta()
1343 1343
  */
1344 1344
 function the_author_login() {
1345
-	_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'login\')' );
1345
+	_deprecated_function(__FUNCTION__, '2.8.0', 'the_author_meta(\'login\')');
1346 1346
 	the_author_meta('login');
1347 1347
 }
1348 1348
 
@@ -1356,7 +1356,7 @@  discard block
 block discarded – undo
1356 1356
  * @return string The author's first name.
1357 1357
  */
1358 1358
 function get_the_author_firstname() {
1359
-	_deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'first_name\')' );
1359
+	_deprecated_function(__FUNCTION__, '2.8.0', 'get_the_author_meta(\'first_name\')');
1360 1360
 	return get_the_author_meta('first_name');
1361 1361
 }
1362 1362
 
@@ -1368,7 +1368,7 @@  discard block
 block discarded – undo
1368 1368
  * @see the_author_meta()
1369 1369
  */
1370 1370
 function the_author_firstname() {
1371
-	_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'first_name\')' );
1371
+	_deprecated_function(__FUNCTION__, '2.8.0', 'the_author_meta(\'first_name\')');
1372 1372
 	the_author_meta('first_name');
1373 1373
 }
1374 1374
 
@@ -1382,7 +1382,7 @@  discard block
 block discarded – undo
1382 1382
  * @return string The author's last name.
1383 1383
  */
1384 1384
 function get_the_author_lastname() {
1385
-	_deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'last_name\')' );
1385
+	_deprecated_function(__FUNCTION__, '2.8.0', 'get_the_author_meta(\'last_name\')');
1386 1386
 	return get_the_author_meta('last_name');
1387 1387
 }
1388 1388
 
@@ -1394,7 +1394,7 @@  discard block
 block discarded – undo
1394 1394
  * @see the_author_meta()
1395 1395
  */
1396 1396
 function the_author_lastname() {
1397
-	_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'last_name\')' );
1397
+	_deprecated_function(__FUNCTION__, '2.8.0', 'the_author_meta(\'last_name\')');
1398 1398
 	the_author_meta('last_name');
1399 1399
 }
1400 1400
 
@@ -1408,7 +1408,7 @@  discard block
 block discarded – undo
1408 1408
  * @return string The author's nickname.
1409 1409
  */
1410 1410
 function get_the_author_nickname() {
1411
-	_deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'nickname\')' );
1411
+	_deprecated_function(__FUNCTION__, '2.8.0', 'get_the_author_meta(\'nickname\')');
1412 1412
 	return get_the_author_meta('nickname');
1413 1413
 }
1414 1414
 
@@ -1420,7 +1420,7 @@  discard block
 block discarded – undo
1420 1420
  * @see the_author_meta()
1421 1421
  */
1422 1422
 function the_author_nickname() {
1423
-	_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'nickname\')' );
1423
+	_deprecated_function(__FUNCTION__, '2.8.0', 'the_author_meta(\'nickname\')');
1424 1424
 	the_author_meta('nickname');
1425 1425
 }
1426 1426
 
@@ -1434,7 +1434,7 @@  discard block
 block discarded – undo
1434 1434
  * @return string The author's username.
1435 1435
  */
1436 1436
 function get_the_author_email() {
1437
-	_deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'email\')' );
1437
+	_deprecated_function(__FUNCTION__, '2.8.0', 'get_the_author_meta(\'email\')');
1438 1438
 	return get_the_author_meta('email');
1439 1439
 }
1440 1440
 
@@ -1446,7 +1446,7 @@  discard block
 block discarded – undo
1446 1446
  * @see the_author_meta()
1447 1447
  */
1448 1448
 function the_author_email() {
1449
-	_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'email\')' );
1449
+	_deprecated_function(__FUNCTION__, '2.8.0', 'the_author_meta(\'email\')');
1450 1450
 	the_author_meta('email');
1451 1451
 }
1452 1452
 
@@ -1460,7 +1460,7 @@  discard block
 block discarded – undo
1460 1460
  * @return string The author's ICQ number.
1461 1461
  */
1462 1462
 function get_the_author_icq() {
1463
-	_deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'icq\')' );
1463
+	_deprecated_function(__FUNCTION__, '2.8.0', 'get_the_author_meta(\'icq\')');
1464 1464
 	return get_the_author_meta('icq');
1465 1465
 }
1466 1466
 
@@ -1472,7 +1472,7 @@  discard block
 block discarded – undo
1472 1472
  * @see the_author_meta()
1473 1473
  */
1474 1474
 function the_author_icq() {
1475
-	_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'icq\')' );
1475
+	_deprecated_function(__FUNCTION__, '2.8.0', 'the_author_meta(\'icq\')');
1476 1476
 	the_author_meta('icq');
1477 1477
 }
1478 1478
 
@@ -1486,7 +1486,7 @@  discard block
 block discarded – undo
1486 1486
  * @return string The author's Yahoo! IM name.
1487 1487
  */
1488 1488
 function get_the_author_yim() {
1489
-	_deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'yim\')' );
1489
+	_deprecated_function(__FUNCTION__, '2.8.0', 'get_the_author_meta(\'yim\')');
1490 1490
 	return get_the_author_meta('yim');
1491 1491
 }
1492 1492
 
@@ -1498,7 +1498,7 @@  discard block
 block discarded – undo
1498 1498
  * @see the_author_meta()
1499 1499
  */
1500 1500
 function the_author_yim() {
1501
-	_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'yim\')' );
1501
+	_deprecated_function(__FUNCTION__, '2.8.0', 'the_author_meta(\'yim\')');
1502 1502
 	the_author_meta('yim');
1503 1503
 }
1504 1504
 
@@ -1512,7 +1512,7 @@  discard block
 block discarded – undo
1512 1512
  * @return string The author's MSN address.
1513 1513
  */
1514 1514
 function get_the_author_msn() {
1515
-	_deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'msn\')' );
1515
+	_deprecated_function(__FUNCTION__, '2.8.0', 'get_the_author_meta(\'msn\')');
1516 1516
 	return get_the_author_meta('msn');
1517 1517
 }
1518 1518
 
@@ -1524,7 +1524,7 @@  discard block
 block discarded – undo
1524 1524
  * @see the_author_meta()
1525 1525
  */
1526 1526
 function the_author_msn() {
1527
-	_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'msn\')' );
1527
+	_deprecated_function(__FUNCTION__, '2.8.0', 'the_author_meta(\'msn\')');
1528 1528
 	the_author_meta('msn');
1529 1529
 }
1530 1530
 
@@ -1538,7 +1538,7 @@  discard block
 block discarded – undo
1538 1538
  * @return string The author's AIM address.
1539 1539
  */
1540 1540
 function get_the_author_aim() {
1541
-	_deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'aim\')' );
1541
+	_deprecated_function(__FUNCTION__, '2.8.0', 'get_the_author_meta(\'aim\')');
1542 1542
 	return get_the_author_meta('aim');
1543 1543
 }
1544 1544
 
@@ -1550,7 +1550,7 @@  discard block
 block discarded – undo
1550 1550
  * @see the_author_meta()
1551 1551
  */
1552 1552
 function the_author_aim() {
1553
-	_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'aim\')' );
1553
+	_deprecated_function(__FUNCTION__, '2.8.0', 'the_author_meta(\'aim\')');
1554 1554
 	the_author_meta('aim');
1555 1555
 }
1556 1556
 
@@ -1564,8 +1564,8 @@  discard block
 block discarded – undo
1564 1564
  * @param int $auth_id The ID of the author.
1565 1565
  * @return string The author's display name.
1566 1566
  */
1567
-function get_author_name( $auth_id = false ) {
1568
-	_deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'display_name\')' );
1567
+function get_author_name($auth_id = false) {
1568
+	_deprecated_function(__FUNCTION__, '2.8.0', 'get_the_author_meta(\'display_name\')');
1569 1569
 	return get_the_author_meta('display_name', $auth_id);
1570 1570
 }
1571 1571
 
@@ -1579,7 +1579,7 @@  discard block
 block discarded – undo
1579 1579
  * @return string The URL to the author's page.
1580 1580
  */
1581 1581
 function get_the_author_url() {
1582
-	_deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'url\')' );
1582
+	_deprecated_function(__FUNCTION__, '2.8.0', 'get_the_author_meta(\'url\')');
1583 1583
 	return get_the_author_meta('url');
1584 1584
 }
1585 1585
 
@@ -1591,7 +1591,7 @@  discard block
 block discarded – undo
1591 1591
  * @see the_author_meta()
1592 1592
  */
1593 1593
 function the_author_url() {
1594
-	_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'url\')' );
1594
+	_deprecated_function(__FUNCTION__, '2.8.0', 'the_author_meta(\'url\')');
1595 1595
 	the_author_meta('url');
1596 1596
 }
1597 1597
 
@@ -1605,7 +1605,7 @@  discard block
 block discarded – undo
1605 1605
  * @return string|int The author's ID.
1606 1606
  */
1607 1607
 function get_the_author_ID() {
1608
-	_deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'ID\')' );
1608
+	_deprecated_function(__FUNCTION__, '2.8.0', 'get_the_author_meta(\'ID\')');
1609 1609
 	return get_the_author_meta('ID');
1610 1610
 }
1611 1611
 
@@ -1617,7 +1617,7 @@  discard block
 block discarded – undo
1617 1617
  * @see the_author_meta()
1618 1618
  */
1619 1619
 function the_author_ID() {
1620
-	_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'ID\')' );
1620
+	_deprecated_function(__FUNCTION__, '2.8.0', 'the_author_meta(\'ID\')');
1621 1621
 	the_author_meta('ID');
1622 1622
 }
1623 1623
 
@@ -1649,23 +1649,23 @@  discard block
 block discarded – undo
1649 1649
  * @param int $cut Optional. Amount of words to keep for the content.
1650 1650
  * @param int $encode_html Optional. How to encode the content.
1651 1651
  */
1652
-function the_content_rss($more_link_text='(more...)', $stripteaser=0, $more_file='', $cut = 0, $encode_html = 0) {
1653
-	_deprecated_function( __FUNCTION__, '2.9.0', 'the_content_feed' );
1652
+function the_content_rss($more_link_text = '(more...)', $stripteaser = 0, $more_file = '', $cut = 0, $encode_html = 0) {
1653
+	_deprecated_function(__FUNCTION__, '2.9.0', 'the_content_feed');
1654 1654
 	$content = get_the_content($more_link_text, $stripteaser);
1655 1655
 	$content = apply_filters('the_content_rss', $content);
1656
-	if ( $cut && !$encode_html )
1656
+	if ($cut && ! $encode_html)
1657 1657
 		$encode_html = 2;
1658
-	if ( 1== $encode_html ) {
1658
+	if (1 == $encode_html) {
1659 1659
 		$content = esc_html($content);
1660 1660
 		$cut = 0;
1661
-	} elseif ( 0 == $encode_html ) {
1661
+	} elseif (0 == $encode_html) {
1662 1662
 		$content = make_url_footnote($content);
1663
-	} elseif ( 2 == $encode_html ) {
1663
+	} elseif (2 == $encode_html) {
1664 1664
 		$content = strip_tags($content);
1665 1665
 	}
1666
-	if ( $cut ) {
1666
+	if ($cut) {
1667 1667
 		$blah = explode(' ', $content);
1668
-		if ( count($blah) > $cut ) {
1668
+		if (count($blah) > $cut) {
1669 1669
 			$k = $cut;
1670 1670
 			$use_dotdotdot = 1;
1671 1671
 		} else {
@@ -1674,7 +1674,7 @@  discard block
 block discarded – undo
1674 1674
 		}
1675 1675
 
1676 1676
 		/** @todo Check performance, might be faster to use array slice instead. */
1677
-		for ( $i=0; $i<$k; $i++ )
1677
+		for ($i = 0; $i < $k; $i++)
1678 1678
 			$excerpt .= $blah[$i].' ';
1679 1679
 		$excerpt .= ($use_dotdotdot) ? '...' : '';
1680 1680
 		$content = $excerpt;
@@ -1695,20 +1695,20 @@  discard block
 block discarded – undo
1695 1695
  * @param string $content Content to get links
1696 1696
  * @return string HTML stripped out of content with links at the bottom.
1697 1697
  */
1698
-function make_url_footnote( $content ) {
1699
-	_deprecated_function( __FUNCTION__, '2.9.0', '' );
1700
-	preg_match_all( '/<a(.+?)href=\"(.+?)\"(.*?)>(.+?)<\/a>/', $content, $matches );
1698
+function make_url_footnote($content) {
1699
+	_deprecated_function(__FUNCTION__, '2.9.0', '');
1700
+	preg_match_all('/<a(.+?)href=\"(.+?)\"(.*?)>(.+?)<\/a>/', $content, $matches);
1701 1701
 	$links_summary = "\n";
1702
-	for ( $i = 0, $c = count( $matches[0] ); $i < $c; $i++ ) {
1702
+	for ($i = 0, $c = count($matches[0]); $i < $c; $i++) {
1703 1703
 		$link_match = $matches[0][$i];
1704
-		$link_number = '['.($i+1).']';
1704
+		$link_number = '['.($i + 1).']';
1705 1705
 		$link_url = $matches[2][$i];
1706 1706
 		$link_text = $matches[4][$i];
1707
-		$content = str_replace( $link_match, $link_text . ' ' . $link_number, $content );
1708
-		$link_url = ( ( strtolower( substr( $link_url, 0, 7 ) ) != 'http://' ) && ( strtolower( substr( $link_url, 0, 8 ) ) != 'https://' ) ) ? get_option( 'home' ) . $link_url : $link_url;
1709
-		$links_summary .= "\n" . $link_number . ' ' . $link_url;
1707
+		$content = str_replace($link_match, $link_text.' '.$link_number, $content);
1708
+		$link_url = ((strtolower(substr($link_url, 0, 7)) != 'http://') && (strtolower(substr($link_url, 0, 8)) != 'https://')) ? get_option('home').$link_url : $link_url;
1709
+		$links_summary .= "\n".$link_number.' '.$link_url;
1710 1710
 	}
1711
-	$content  = strip_tags( $content );
1711
+	$content  = strip_tags($content);
1712 1712
 	$content .= $links_summary;
1713 1713
 	return $content;
1714 1714
 }
@@ -1734,9 +1734,9 @@  discard block
 block discarded – undo
1734 1734
  * @param string $domain Optional. Domain to retrieve the translated text
1735 1735
  * @return string Translated context string without pipe
1736 1736
  */
1737
-function _c( $text, $domain = 'default' ) {
1738
-	_deprecated_function( __FUNCTION__, '2.9.0', '_x()' );
1739
-	return before_last_bar( translate( $text, $domain ) );
1737
+function _c($text, $domain = 'default') {
1738
+	_deprecated_function(__FUNCTION__, '2.9.0', '_x()');
1739
+	return before_last_bar(translate($text, $domain));
1740 1740
 }
1741 1741
 
1742 1742
 /**
@@ -1751,9 +1751,9 @@  discard block
 block discarded – undo
1751 1751
  * @param string $domain Domain to retrieve the translated text
1752 1752
  * @return string Translated text
1753 1753
  */
1754
-function translate_with_context( $text, $domain = 'default' ) {
1755
-	_deprecated_function( __FUNCTION__, '2.9.0', '_x()' );
1756
-	return before_last_bar( translate( $text, $domain ) );
1754
+function translate_with_context($text, $domain = 'default') {
1755
+	_deprecated_function(__FUNCTION__, '2.9.0', '_x()');
1756
+	return before_last_bar(translate($text, $domain));
1757 1757
 }
1758 1758
 
1759 1759
 /**
@@ -1772,9 +1772,9 @@  discard block
 block discarded – undo
1772 1772
  *                       Default 'default'.
1773 1773
  * @return string The translated singular or plural form.
1774 1774
  */
1775
-function _nc( $single, $plural, $number, $domain = 'default' ) {
1776
-	_deprecated_function( __FUNCTION__, '2.9.0', '_nx()' );
1777
-	return before_last_bar( _n( $single, $plural, $number, $domain ) );
1775
+function _nc($single, $plural, $number, $domain = 'default') {
1776
+	_deprecated_function(__FUNCTION__, '2.9.0', '_nx()');
1777
+	return before_last_bar(_n($single, $plural, $number, $domain));
1778 1778
 }
1779 1779
 
1780 1780
 /**
@@ -1785,7 +1785,7 @@  discard block
 block discarded – undo
1785 1785
  * @see _n()
1786 1786
  */
1787 1787
 function __ngettext() {
1788
-	_deprecated_function( __FUNCTION__, '2.8.0', '_n()' );
1788
+	_deprecated_function(__FUNCTION__, '2.8.0', '_n()');
1789 1789
 	$args = func_get_args();
1790 1790
 	return call_user_func_array('_n', $args);
1791 1791
 }
@@ -1798,7 +1798,7 @@  discard block
 block discarded – undo
1798 1798
  * @see _n_noop()
1799 1799
  */
1800 1800
 function __ngettext_noop() {
1801
-	_deprecated_function( __FUNCTION__, '2.8.0', '_n_noop()' );
1801
+	_deprecated_function(__FUNCTION__, '2.8.0', '_n_noop()');
1802 1802
 	$args = func_get_args();
1803 1803
 	return call_user_func_array('_n_noop', $args);
1804 1804
 
@@ -1814,7 +1814,7 @@  discard block
 block discarded – undo
1814 1814
  * @return array List of all options.
1815 1815
  */
1816 1816
 function get_alloptions() {
1817
-	_deprecated_function( __FUNCTION__, '3.0.0', 'wp_load_alloptions()' );
1817
+	_deprecated_function(__FUNCTION__, '3.0.0', 'wp_load_alloptions()');
1818 1818
 	return wp_load_alloptions();
1819 1819
 }
1820 1820
 
@@ -1832,14 +1832,14 @@  discard block
 block discarded – undo
1832 1832
  * @return string
1833 1833
  */
1834 1834
 function get_the_attachment_link($id = 0, $fullsize = false, $max_dims = false, $permalink = false) {
1835
-	_deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_link()' );
1835
+	_deprecated_function(__FUNCTION__, '2.5.0', 'wp_get_attachment_link()');
1836 1836
 	$id = (int) $id;
1837 1837
 	$_post = get_post($id);
1838 1838
 
1839
-	if ( ('attachment' != $_post->post_type) || !$url = wp_get_attachment_url($_post->ID) )
1839
+	if (('attachment' != $_post->post_type) || ! $url = wp_get_attachment_url($_post->ID))
1840 1840
 		return __('Missing Attachment');
1841 1841
 
1842
-	if ( $permalink )
1842
+	if ($permalink)
1843 1843
 		$url = get_attachment_link($_post->ID);
1844 1844
 
1845 1845
 	$post_title = esc_attr($_post->post_title);
@@ -1859,31 +1859,31 @@  discard block
 block discarded – undo
1859 1859
  * @param bool $fullsize Optional, default to false. Whether to have full image.
1860 1860
  * @return array Icon URL and full path to file, respectively.
1861 1861
  */
1862
-function get_attachment_icon_src( $id = 0, $fullsize = false ) {
1863
-	_deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_image_src()' );
1862
+function get_attachment_icon_src($id = 0, $fullsize = false) {
1863
+	_deprecated_function(__FUNCTION__, '2.5.0', 'wp_get_attachment_image_src()');
1864 1864
 	$id = (int) $id;
1865
-	if ( !$post = get_post($id) )
1865
+	if ( ! $post = get_post($id))
1866 1866
 		return false;
1867 1867
 
1868
-	$file = get_attached_file( $post->ID );
1868
+	$file = get_attached_file($post->ID);
1869 1869
 
1870
-	if ( !$fullsize && $src = wp_get_attachment_thumb_url( $post->ID ) ) {
1870
+	if ( ! $fullsize && $src = wp_get_attachment_thumb_url($post->ID)) {
1871 1871
 		// We have a thumbnail desired, specified and existing
1872 1872
 
1873 1873
 		$src_file = basename($src);
1874
-	} elseif ( wp_attachment_is_image( $post->ID ) ) {
1874
+	} elseif (wp_attachment_is_image($post->ID)) {
1875 1875
 		// We have an image without a thumbnail
1876 1876
 
1877
-		$src = wp_get_attachment_url( $post->ID );
1877
+		$src = wp_get_attachment_url($post->ID);
1878 1878
 		$src_file = & $file;
1879
-	} elseif ( $src = wp_mime_type_icon( $post->ID ) ) {
1879
+	} elseif ($src = wp_mime_type_icon($post->ID)) {
1880 1880
 		// No thumb, no image. We'll look for a mime-related icon instead.
1881 1881
 
1882
-		$icon_dir = apply_filters( 'icon_dir', get_template_directory() . '/images' );
1883
-		$src_file = $icon_dir . '/' . basename($src);
1882
+		$icon_dir = apply_filters('icon_dir', get_template_directory().'/images');
1883
+		$src_file = $icon_dir.'/'.basename($src);
1884 1884
 	}
1885 1885
 
1886
-	if ( !isset($src) || !$src )
1886
+	if ( ! isset($src) || ! $src)
1887 1887
 		return false;
1888 1888
 
1889 1889
 	return array($src, $src_file);
@@ -1901,27 +1901,27 @@  discard block
 block discarded – undo
1901 1901
  * @param array $max_dims Optional. Dimensions of image.
1902 1902
  * @return false|string HTML content.
1903 1903
  */
1904
-function get_attachment_icon( $id = 0, $fullsize = false, $max_dims = false ) {
1905
-	_deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_image()' );
1904
+function get_attachment_icon($id = 0, $fullsize = false, $max_dims = false) {
1905
+	_deprecated_function(__FUNCTION__, '2.5.0', 'wp_get_attachment_image()');
1906 1906
 	$id = (int) $id;
1907
-	if ( !$post = get_post($id) )
1907
+	if ( ! $post = get_post($id))
1908 1908
 		return false;
1909 1909
 
1910
-	if ( !$src = get_attachment_icon_src( $post->ID, $fullsize ) )
1910
+	if ( ! $src = get_attachment_icon_src($post->ID, $fullsize))
1911 1911
 		return false;
1912 1912
 
1913 1913
 	list($src, $src_file) = $src;
1914 1914
 
1915 1915
 	// Do we need to constrain the image?
1916
-	if ( ($max_dims = apply_filters('attachment_max_dims', $max_dims)) && file_exists($src_file) ) {
1916
+	if (($max_dims = apply_filters('attachment_max_dims', $max_dims)) && file_exists($src_file)) {
1917 1917
 
1918 1918
 		$imagesize = getimagesize($src_file);
1919 1919
 
1920
-		if (($imagesize[0] > $max_dims[0]) || $imagesize[1] > $max_dims[1] ) {
1920
+		if (($imagesize[0] > $max_dims[0]) || $imagesize[1] > $max_dims[1]) {
1921 1921
 			$actual_aspect = $imagesize[0] / $imagesize[1];
1922 1922
 			$desired_aspect = $max_dims[0] / $max_dims[1];
1923 1923
 
1924
-			if ( $actual_aspect >= $desired_aspect ) {
1924
+			if ($actual_aspect >= $desired_aspect) {
1925 1925
 				$height = $actual_aspect * $max_dims[0];
1926 1926
 				$constraint = "width='{$max_dims[0]}' ";
1927 1927
 				$post->iconsize = array($max_dims[0], $height);
@@ -1942,7 +1942,7 @@  discard block
 block discarded – undo
1942 1942
 
1943 1943
 	$icon = "<img src='$src' title='$post_title' alt='$post_title' $constraint/>";
1944 1944
 
1945
-	return apply_filters( 'attachment_icon', $icon, $post->ID );
1945
+	return apply_filters('attachment_icon', $icon, $post->ID);
1946 1946
 }
1947 1947
 
1948 1948
 /**
@@ -1958,12 +1958,12 @@  discard block
 block discarded – undo
1958 1958
  * @return false|string
1959 1959
  */
1960 1960
 function get_attachment_innerHTML($id = 0, $fullsize = false, $max_dims = false) {
1961
-	_deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_image()' );
1961
+	_deprecated_function(__FUNCTION__, '2.5.0', 'wp_get_attachment_image()');
1962 1962
 	$id = (int) $id;
1963
-	if ( !$post = get_post($id) )
1963
+	if ( ! $post = get_post($id))
1964 1964
 		return false;
1965 1965
 
1966
-	if ( $innerHTML = get_attachment_icon($post->ID, $fullsize, $max_dims))
1966
+	if ($innerHTML = get_attachment_icon($post->ID, $fullsize, $max_dims))
1967 1967
 		return $innerHTML;
1968 1968
 
1969 1969
 	$innerHTML = esc_attr($post->post_title);
@@ -1985,8 +1985,8 @@  discard block
 block discarded – undo
1985 1985
  *                            'attribute', 'js', 'db', or 'display'. Default 'raw'.
1986 1986
  * @return object|array Bookmark object or array, depending on the type specified by `$output`.
1987 1987
  */
1988
-function get_link( $bookmark_id, $output = OBJECT, $filter = 'raw' ) {
1989
-	_deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmark()' );
1988
+function get_link($bookmark_id, $output = OBJECT, $filter = 'raw') {
1989
+	_deprecated_function(__FUNCTION__, '2.1.0', 'get_bookmark()');
1990 1990
 	return get_bookmark($bookmark_id, $output, $filter);
1991 1991
 }
1992 1992
 
@@ -2001,9 +2001,9 @@  discard block
 block discarded – undo
2001 2001
  * @param array $protocols An array of acceptable protocols.
2002 2002
  * @return string The cleaned URL.
2003 2003
  */
2004
-function sanitize_url( $url, $protocols = null ) {
2005
-	_deprecated_function( __FUNCTION__, '2.8.0', 'esc_url_raw()' );
2006
-	return esc_url_raw( $url, $protocols );
2004
+function sanitize_url($url, $protocols = null) {
2005
+	_deprecated_function(__FUNCTION__, '2.8.0', 'esc_url_raw()');
2006
+	return esc_url_raw($url, $protocols);
2007 2007
 }
2008 2008
 
2009 2009
 /**
@@ -2022,12 +2022,12 @@  discard block
 block discarded – undo
2022 2022
  * @param string $context Optional. How the URL will be used. Default is 'display'.
2023 2023
  * @return string The cleaned $url after the {@see 'clean_url'} filter is applied.
2024 2024
  */
2025
-function clean_url( $url, $protocols = null, $context = 'display' ) {
2026
-	if ( $context == 'db' )
2027
-		_deprecated_function( 'clean_url( $context = \'db\' )', '3.0.0', 'esc_url_raw()' );
2025
+function clean_url($url, $protocols = null, $context = 'display') {
2026
+	if ($context == 'db')
2027
+		_deprecated_function('clean_url( $context = \'db\' )', '3.0.0', 'esc_url_raw()');
2028 2028
 	else
2029
-		_deprecated_function( __FUNCTION__, '3.0.0', 'esc_url()' );
2030
-	return esc_url( $url, $protocols, $context );
2029
+		_deprecated_function(__FUNCTION__, '3.0.0', 'esc_url()');
2030
+	return esc_url($url, $protocols, $context);
2031 2031
 }
2032 2032
 
2033 2033
 /**
@@ -2042,9 +2042,9 @@  discard block
 block discarded – undo
2042 2042
  * @param string $text The text to be escaped.
2043 2043
  * @return string Escaped text.
2044 2044
  */
2045
-function js_escape( $text ) {
2046
-	_deprecated_function( __FUNCTION__, '2.8.0', 'esc_js()' );
2047
-	return esc_js( $text );
2045
+function js_escape($text) {
2046
+	_deprecated_function(__FUNCTION__, '2.8.0', 'esc_js()');
2047
+	return esc_js($text);
2048 2048
 }
2049 2049
 
2050 2050
 /**
@@ -2059,13 +2059,13 @@  discard block
 block discarded – undo
2059 2059
  * @param false        $double_encode Whether to double encode. Unused.
2060 2060
  * @return string Escaped `$string`.
2061 2061
  */
2062
-function wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) {
2063
-	_deprecated_function( __FUNCTION__, '2.8.0', 'esc_html()' );
2064
-	if ( func_num_args() > 1 ) { // Maintain back-compat for people passing additional arguments.
2062
+function wp_specialchars($string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false) {
2063
+	_deprecated_function(__FUNCTION__, '2.8.0', 'esc_html()');
2064
+	if (func_num_args() > 1) { // Maintain back-compat for people passing additional arguments.
2065 2065
 		$args = func_get_args();
2066
-		return call_user_func_array( '_wp_specialchars', $args );
2066
+		return call_user_func_array('_wp_specialchars', $args);
2067 2067
 	} else {
2068
-		return esc_html( $string );
2068
+		return esc_html($string);
2069 2069
 	}
2070 2070
 }
2071 2071
 
@@ -2079,9 +2079,9 @@  discard block
 block discarded – undo
2079 2079
  * @param string $text
2080 2080
  * @return string
2081 2081
  */
2082
-function attribute_escape( $text ) {
2083
-	_deprecated_function( __FUNCTION__, '2.8.0', 'esc_attr()' );
2084
-	return esc_attr( $text );
2082
+function attribute_escape($text) {
2083
+	_deprecated_function(__FUNCTION__, '2.8.0', 'esc_attr()');
2084
+	return esc_attr($text);
2085 2085
 }
2086 2086
 
2087 2087
 /**
@@ -2104,10 +2104,10 @@  discard block
 block discarded – undo
2104 2104
  * @param mixed      $params ,...     Widget parameters.
2105 2105
  */
2106 2106
 function register_sidebar_widget($name, $output_callback, $classname = '') {
2107
-	_deprecated_function( __FUNCTION__, '2.8.0', 'wp_register_sidebar_widget()' );
2107
+	_deprecated_function(__FUNCTION__, '2.8.0', 'wp_register_sidebar_widget()');
2108 2108
 	// Compat
2109
-	if ( is_array($name) ) {
2110
-		if ( count($name) == 3 )
2109
+	if (is_array($name)) {
2110
+		if (count($name) == 3)
2111 2111
 			$name = sprintf($name[0], $name[2]);
2112 2112
 		else
2113 2113
 			$name = $name[0];
@@ -2115,11 +2115,11 @@  discard block
 block discarded – undo
2115 2115
 
2116 2116
 	$id = sanitize_title($name);
2117 2117
 	$options = array();
2118
-	if ( !empty($classname) && is_string($classname) )
2118
+	if ( ! empty($classname) && is_string($classname))
2119 2119
 		$options['classname'] = $classname;
2120 2120
 	$params = array_slice(func_get_args(), 2);
2121 2121
 	$args = array($id, $name, $output_callback, $options);
2122
-	if ( !empty($params) )
2122
+	if ( ! empty($params))
2123 2123
 		$args = array_merge($args, $params);
2124 2124
 
2125 2125
 	call_user_func_array('wp_register_sidebar_widget', $args);
@@ -2135,7 +2135,7 @@  discard block
 block discarded – undo
2135 2135
  * @param int|string $id Widget ID.
2136 2136
  */
2137 2137
 function unregister_sidebar_widget($id) {
2138
-	_deprecated_function( __FUNCTION__, '2.8.0', 'wp_unregister_sidebar_widget()' );
2138
+	_deprecated_function(__FUNCTION__, '2.8.0', 'wp_unregister_sidebar_widget()');
2139 2139
 	return wp_unregister_sidebar_widget($id);
2140 2140
 }
2141 2141
 
@@ -2159,10 +2159,10 @@  discard block
 block discarded – undo
2159 2159
  * @param int $height Widget height.
2160 2160
  */
2161 2161
 function register_widget_control($name, $control_callback, $width = '', $height = '') {
2162
-	_deprecated_function( __FUNCTION__, '2.8.0', 'wp_register_widget_control()' );
2162
+	_deprecated_function(__FUNCTION__, '2.8.0', 'wp_register_widget_control()');
2163 2163
 	// Compat
2164
-	if ( is_array($name) ) {
2165
-		if ( count($name) == 3 )
2164
+	if (is_array($name)) {
2165
+		if (count($name) == 3)
2166 2166
 			$name = sprintf($name[0], $name[2]);
2167 2167
 		else
2168 2168
 			$name = $name[0];
@@ -2170,13 +2170,13 @@  discard block
 block discarded – undo
2170 2170
 
2171 2171
 	$id = sanitize_title($name);
2172 2172
 	$options = array();
2173
-	if ( !empty($width) )
2173
+	if ( ! empty($width))
2174 2174
 		$options['width'] = $width;
2175
-	if ( !empty($height) )
2175
+	if ( ! empty($height))
2176 2176
 		$options['height'] = $height;
2177 2177
 	$params = array_slice(func_get_args(), 4);
2178 2178
 	$args = array($id, $name, $control_callback, $options);
2179
-	if ( !empty($params) )
2179
+	if ( ! empty($params))
2180 2180
 		$args = array_merge($args, $params);
2181 2181
 
2182 2182
 	call_user_func_array('wp_register_widget_control', $args);
@@ -2192,7 +2192,7 @@  discard block
 block discarded – undo
2192 2192
  * @param int|string $id Widget ID.
2193 2193
  */
2194 2194
 function unregister_widget_control($id) {
2195
-	_deprecated_function( __FUNCTION__, '2.8.0', 'wp_unregister_widget_control()' );
2195
+	_deprecated_function(__FUNCTION__, '2.8.0', 'wp_unregister_widget_control()');
2196 2196
 	return wp_unregister_widget_control($id);
2197 2197
 }
2198 2198
 
@@ -2208,32 +2208,32 @@  discard block
 block discarded – undo
2208 2208
  * @param mixed $meta_value Metadata value.
2209 2209
  * @return bool True deletion completed and false if user_id is not a number.
2210 2210
  */
2211
-function delete_usermeta( $user_id, $meta_key, $meta_value = '' ) {
2212
-	_deprecated_function( __FUNCTION__, '3.0.0', 'delete_user_meta()' );
2211
+function delete_usermeta($user_id, $meta_key, $meta_value = '') {
2212
+	_deprecated_function(__FUNCTION__, '3.0.0', 'delete_user_meta()');
2213 2213
 	global $wpdb;
2214
-	if ( !is_numeric( $user_id ) )
2214
+	if ( ! is_numeric($user_id))
2215 2215
 		return false;
2216 2216
 	$meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);
2217 2217
 
2218
-	if ( is_array($meta_value) || is_object($meta_value) )
2218
+	if (is_array($meta_value) || is_object($meta_value))
2219 2219
 		$meta_value = serialize($meta_value);
2220
-	$meta_value = trim( $meta_value );
2220
+	$meta_value = trim($meta_value);
2221 2221
 
2222
-	$cur = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
2222
+	$cur = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key));
2223 2223
 
2224
-	if ( $cur && $cur->umeta_id )
2225
-		do_action( 'delete_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );
2224
+	if ($cur && $cur->umeta_id)
2225
+		do_action('delete_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value);
2226 2226
 
2227
-	if ( ! empty($meta_value) )
2228
-		$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s AND meta_value = %s", $user_id, $meta_key, $meta_value) );
2227
+	if ( ! empty($meta_value))
2228
+		$wpdb->query($wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s AND meta_value = %s", $user_id, $meta_key, $meta_value));
2229 2229
 	else
2230
-		$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
2230
+		$wpdb->query($wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key));
2231 2231
 
2232
-	clean_user_cache( $user_id );
2233
-	wp_cache_delete( $user_id, 'user_meta' );
2232
+	clean_user_cache($user_id);
2233
+	wp_cache_delete($user_id, 'user_meta');
2234 2234
 
2235
-	if ( $cur && $cur->umeta_id )
2236
-		do_action( 'deleted_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );
2235
+	if ($cur && $cur->umeta_id)
2236
+		do_action('deleted_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value);
2237 2237
 
2238 2238
 	return true;
2239 2239
 }
@@ -2254,28 +2254,28 @@  discard block
 block discarded – undo
2254 2254
  * @param string $meta_key Optional. Metadata key.
2255 2255
  * @return mixed
2256 2256
  */
2257
-function get_usermeta( $user_id, $meta_key = '' ) {
2258
-	_deprecated_function( __FUNCTION__, '3.0.0', 'get_user_meta()' );
2257
+function get_usermeta($user_id, $meta_key = '') {
2258
+	_deprecated_function(__FUNCTION__, '3.0.0', 'get_user_meta()');
2259 2259
 	global $wpdb;
2260 2260
 	$user_id = (int) $user_id;
2261 2261
 
2262
-	if ( !$user_id )
2262
+	if ( ! $user_id)
2263 2263
 		return false;
2264 2264
 
2265
-	if ( !empty($meta_key) ) {
2265
+	if ( ! empty($meta_key)) {
2266 2266
 		$meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);
2267 2267
 		$user = wp_cache_get($user_id, 'users');
2268 2268
 		// Check the cached user object
2269
-		if ( false !== $user && isset($user->$meta_key) )
2269
+		if (false !== $user && isset($user->$meta_key))
2270 2270
 			$metas = array($user->$meta_key);
2271 2271
 		else
2272
-			$metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
2272
+			$metas = $wpdb->get_col($wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key));
2273 2273
 	} else {
2274
-		$metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d", $user_id) );
2274
+		$metas = $wpdb->get_col($wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d", $user_id));
2275 2275
 	}
2276 2276
 
2277
-	if ( empty($metas) ) {
2278
-		if ( empty($meta_key) )
2277
+	if (empty($metas)) {
2278
+		if (empty($meta_key))
2279 2279
 			return array();
2280 2280
 		else
2281 2281
 			return '';
@@ -2283,7 +2283,7 @@  discard block
 block discarded – undo
2283 2283
 
2284 2284
 	$metas = array_map('maybe_unserialize', $metas);
2285 2285
 
2286
-	if ( count($metas) == 1 )
2286
+	if (count($metas) == 1)
2287 2287
 		return $metas[0];
2288 2288
 	else
2289 2289
 		return $metas;
@@ -2307,15 +2307,15 @@  discard block
 block discarded – undo
2307 2307
  * @param mixed $meta_value Metadata value.
2308 2308
  * @return bool True on successful update, false on failure.
2309 2309
  */
2310
-function update_usermeta( $user_id, $meta_key, $meta_value ) {
2311
-	_deprecated_function( __FUNCTION__, '3.0.0', 'update_user_meta()' );
2310
+function update_usermeta($user_id, $meta_key, $meta_value) {
2311
+	_deprecated_function(__FUNCTION__, '3.0.0', 'update_user_meta()');
2312 2312
 	global $wpdb;
2313
-	if ( !is_numeric( $user_id ) )
2313
+	if ( ! is_numeric($user_id))
2314 2314
 		return false;
2315 2315
 	$meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);
2316 2316
 
2317 2317
 	/** @todo Might need fix because usermeta data is assumed to be already escaped */
2318
-	if ( is_string($meta_value) )
2318
+	if (is_string($meta_value))
2319 2319
 		$meta_value = stripslashes($meta_value);
2320 2320
 	$meta_value = maybe_serialize($meta_value);
2321 2321
 
@@ -2323,25 +2323,25 @@  discard block
 block discarded – undo
2323 2323
 		return delete_usermeta($user_id, $meta_key);
2324 2324
 	}
2325 2325
 
2326
-	$cur = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
2326
+	$cur = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key));
2327 2327
 
2328
-	if ( $cur )
2329
-		do_action( 'update_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );
2328
+	if ($cur)
2329
+		do_action('update_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value);
2330 2330
 
2331
-	if ( !$cur )
2332
-		$wpdb->insert($wpdb->usermeta, compact('user_id', 'meta_key', 'meta_value') );
2333
-	elseif ( $cur->meta_value != $meta_value )
2334
-		$wpdb->update($wpdb->usermeta, compact('meta_value'), compact('user_id', 'meta_key') );
2331
+	if ( ! $cur)
2332
+		$wpdb->insert($wpdb->usermeta, compact('user_id', 'meta_key', 'meta_value'));
2333
+	elseif ($cur->meta_value != $meta_value)
2334
+		$wpdb->update($wpdb->usermeta, compact('meta_value'), compact('user_id', 'meta_key'));
2335 2335
 	else
2336 2336
 		return false;
2337 2337
 
2338
-	clean_user_cache( $user_id );
2339
-	wp_cache_delete( $user_id, 'user_meta' );
2338
+	clean_user_cache($user_id);
2339
+	wp_cache_delete($user_id, 'user_meta');
2340 2340
 
2341
-	if ( !$cur )
2342
-		do_action( 'added_usermeta', $wpdb->insert_id, $user_id, $meta_key, $meta_value );
2341
+	if ( ! $cur)
2342
+		do_action('added_usermeta', $wpdb->insert_id, $user_id, $meta_key, $meta_value);
2343 2343
 	else
2344
-		do_action( 'updated_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );
2344
+		do_action('updated_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value);
2345 2345
 
2346 2346
 	return true;
2347 2347
 }
@@ -2361,15 +2361,15 @@  discard block
 block discarded – undo
2361 2361
  * @param int $id Site ID.
2362 2362
  * @return array List of users that are part of that site ID
2363 2363
  */
2364
-function get_users_of_blog( $id = '' ) {
2365
-	_deprecated_function( __FUNCTION__, '3.1.0', 'get_users()' );
2364
+function get_users_of_blog($id = '') {
2365
+	_deprecated_function(__FUNCTION__, '3.1.0', 'get_users()');
2366 2366
 
2367 2367
 	global $wpdb;
2368
-	if ( empty( $id ) ) {
2368
+	if (empty($id)) {
2369 2369
 		$id = get_current_blog_id();
2370 2370
 	}
2371 2371
 	$blog_prefix = $wpdb->get_blog_prefix($id);
2372
-	$users = $wpdb->get_results( "SELECT user_id, user_id AS ID, user_login, display_name, user_email, meta_value FROM $wpdb->users, $wpdb->usermeta WHERE {$wpdb->users}.ID = {$wpdb->usermeta}.user_id AND meta_key = '{$blog_prefix}capabilities' ORDER BY {$wpdb->usermeta}.user_id" );
2372
+	$users = $wpdb->get_results("SELECT user_id, user_id AS ID, user_login, display_name, user_email, meta_value FROM $wpdb->users, $wpdb->usermeta WHERE {$wpdb->users}.ID = {$wpdb->usermeta}.user_id AND meta_key = '{$blog_prefix}capabilities' ORDER BY {$wpdb->usermeta}.user_id");
2373 2373
 	return $users;
2374 2374
 }
2375 2375
 
@@ -2382,13 +2382,13 @@  discard block
 block discarded – undo
2382 2382
  *
2383 2383
  * @param bool $add Optional, default is true. Add or remove links. Defaults to true.
2384 2384
  */
2385
-function automatic_feed_links( $add = true ) {
2386
-	_deprecated_function( __FUNCTION__, '3.0.0', "add_theme_support( 'automatic-feed-links' )" );
2385
+function automatic_feed_links($add = true) {
2386
+	_deprecated_function(__FUNCTION__, '3.0.0', "add_theme_support( 'automatic-feed-links' )");
2387 2387
 
2388
-	if ( $add )
2389
-		add_theme_support( 'automatic-feed-links' );
2388
+	if ($add)
2389
+		add_theme_support('automatic-feed-links');
2390 2390
 	else
2391
-		remove_action( 'wp_head', 'feed_links_extra', 3 ); // Just do this yourself in 3.0+
2391
+		remove_action('wp_head', 'feed_links_extra', 3); // Just do this yourself in 3.0+
2392 2392
 }
2393 2393
 
2394 2394
 /**
@@ -2402,13 +2402,13 @@  discard block
 block discarded – undo
2402 2402
  * @param false|int $user Optional. User ID to retrieve the field for. Default false (current user).
2403 2403
  * @return string The author's field from the current author's DB object.
2404 2404
  */
2405
-function get_profile( $field, $user = false ) {
2406
-	_deprecated_function( __FUNCTION__, '3.0.0', 'get_the_author_meta()' );
2407
-	if ( $user ) {
2408
-		$user = get_user_by( 'login', $user );
2405
+function get_profile($field, $user = false) {
2406
+	_deprecated_function(__FUNCTION__, '3.0.0', 'get_the_author_meta()');
2407
+	if ($user) {
2408
+		$user = get_user_by('login', $user);
2409 2409
 		$user = $user->ID;
2410 2410
 	}
2411
-	return get_the_author_meta( $field, $user );
2411
+	return get_the_author_meta($field, $user);
2412 2412
 }
2413 2413
 
2414 2414
 /**
@@ -2421,9 +2421,9 @@  discard block
 block discarded – undo
2421 2421
  * @param int $userid User to count posts for.
2422 2422
  * @return int Number of posts the given user has written.
2423 2423
  */
2424
-function get_usernumposts( $userid ) {
2425
-	_deprecated_function( __FUNCTION__, '3.0.0', 'count_user_posts()' );
2426
-	return count_user_posts( $userid );
2424
+function get_usernumposts($userid) {
2425
+	_deprecated_function(__FUNCTION__, '3.0.0', 'count_user_posts()');
2426
+	return count_user_posts($userid);
2427 2427
 }
2428 2428
 
2429 2429
 /**
@@ -2437,7 +2437,7 @@  discard block
 block discarded – undo
2437 2437
  * @return string An HTML entity
2438 2438
  */
2439 2439
 function funky_javascript_callback($matches) {
2440
-	return "&#".base_convert($matches[1],16,10).";";
2440
+	return "&#".base_convert($matches[1], 16, 10).";";
2441 2441
 }
2442 2442
 
2443 2443
 /**
@@ -2455,12 +2455,12 @@  discard block
 block discarded – undo
2455 2455
  * @return string Fixed text.
2456 2456
  */
2457 2457
 function funky_javascript_fix($text) {
2458
-	_deprecated_function( __FUNCTION__, '3.0.0' );
2458
+	_deprecated_function(__FUNCTION__, '3.0.0');
2459 2459
 	// Fixes for browsers' JavaScript bugs.
2460 2460
 	global $is_macIE, $is_winIE;
2461 2461
 
2462
-	if ( $is_winIE || $is_macIE )
2463
-		$text =  preg_replace_callback("/\%u([0-9A-F]{4,4})/",
2462
+	if ($is_winIE || $is_macIE)
2463
+		$text = preg_replace_callback("/\%u([0-9A-F]{4,4})/",
2464 2464
 					"funky_javascript_callback",
2465 2465
 					$text);
2466 2466
 
@@ -2477,9 +2477,9 @@  discard block
 block discarded – undo
2477 2477
  * @param string $taxonomy Name of taxonomy object
2478 2478
  * @return bool Whether the taxonomy exists.
2479 2479
  */
2480
-function is_taxonomy( $taxonomy ) {
2481
-	_deprecated_function( __FUNCTION__, '3.0.0', 'taxonomy_exists()' );
2482
-	return taxonomy_exists( $taxonomy );
2480
+function is_taxonomy($taxonomy) {
2481
+	_deprecated_function(__FUNCTION__, '3.0.0', 'taxonomy_exists()');
2482
+	return taxonomy_exists($taxonomy);
2483 2483
 }
2484 2484
 
2485 2485
 /**
@@ -2494,9 +2494,9 @@  discard block
 block discarded – undo
2494 2494
  * @param int $parent ID of parent term under which to confine the exists search.
2495 2495
  * @return mixed Get the term id or Term Object, if exists.
2496 2496
  */
2497
-function is_term( $term, $taxonomy = '', $parent = 0 ) {
2498
-	_deprecated_function( __FUNCTION__, '3.0.0', 'term_exists()' );
2499
-	return term_exists( $term, $taxonomy, $parent );
2497
+function is_term($term, $taxonomy = '', $parent = 0) {
2498
+	_deprecated_function(__FUNCTION__, '3.0.0', 'term_exists()');
2499
+	return term_exists($term, $taxonomy, $parent);
2500 2500
 }
2501 2501
 
2502 2502
 /**
@@ -2512,11 +2512,11 @@  discard block
 block discarded – undo
2512 2512
  * @return bool
2513 2513
  */
2514 2514
 function is_plugin_page() {
2515
-	_deprecated_function( __FUNCTION__, '3.1.0'  );
2515
+	_deprecated_function(__FUNCTION__, '3.1.0');
2516 2516
 
2517 2517
 	global $plugin_page;
2518 2518
 
2519
-	if ( isset($plugin_page) )
2519
+	if (isset($plugin_page))
2520 2520
 		return true;
2521 2521
 
2522 2522
 	return false;
@@ -2535,7 +2535,7 @@  discard block
 block discarded – undo
2535 2535
  * @return bool Always return True
2536 2536
  */
2537 2537
 function update_category_cache() {
2538
-	_deprecated_function( __FUNCTION__, '3.1.0'  );
2538
+	_deprecated_function(__FUNCTION__, '3.1.0');
2539 2539
 
2540 2540
 	return true;
2541 2541
 }
@@ -2549,7 +2549,7 @@  discard block
 block discarded – undo
2549 2549
  * @return bool
2550 2550
  */
2551 2551
 function wp_timezone_supported() {
2552
-	_deprecated_function( __FUNCTION__, '3.2.0' );
2552
+	_deprecated_function(__FUNCTION__, '3.2.0');
2553 2553
 
2554 2554
 	return true;
2555 2555
 }
@@ -2569,9 +2569,9 @@  discard block
 block discarded – undo
2569 2569
  * @param bool   $extended      Optional. Unused.
2570 2570
  */
2571 2571
 function the_editor($content, $id = 'content', $prev_id = 'title', $media_buttons = true, $tab_index = 2, $extended = true) {
2572
-	_deprecated_function( __FUNCTION__, '3.3.0', 'wp_editor()' );
2572
+	_deprecated_function(__FUNCTION__, '3.3.0', 'wp_editor()');
2573 2573
 
2574
-	wp_editor( $content, $id, array( 'media_buttons' => $media_buttons ) );
2574
+	wp_editor($content, $id, array('media_buttons' => $media_buttons));
2575 2575
 }
2576 2576
 
2577 2577
 /**
@@ -2584,20 +2584,20 @@  discard block
 block discarded – undo
2584 2584
  * @return array of arrays. The array is indexed by user_id, containing $metavalues object arrays.
2585 2585
  */
2586 2586
 function get_user_metavalues($ids) {
2587
-	_deprecated_function( __FUNCTION__, '3.3.0' );
2587
+	_deprecated_function(__FUNCTION__, '3.3.0');
2588 2588
 
2589 2589
 	$objects = array();
2590 2590
 
2591 2591
 	$ids = array_map('intval', $ids);
2592
-	foreach ( $ids as $id )
2592
+	foreach ($ids as $id)
2593 2593
 		$objects[$id] = array();
2594 2594
 
2595 2595
 	$metas = update_meta_cache('user', $ids);
2596 2596
 
2597
-	foreach ( $metas as $id => $meta ) {
2598
-		foreach ( $meta as $key => $metavalues ) {
2599
-			foreach ( $metavalues as $value ) {
2600
-				$objects[$id][] = (object)array( 'user_id' => $id, 'meta_key' => $key, 'meta_value' => $value);
2597
+	foreach ($metas as $id => $meta) {
2598
+		foreach ($meta as $key => $metavalues) {
2599
+			foreach ($metavalues as $value) {
2600
+				$objects[$id][] = (object) array('user_id' => $id, 'meta_key' => $key, 'meta_value' => $value);
2601 2601
 			}
2602 2602
 		}
2603 2603
 	}
@@ -2618,23 +2618,23 @@  discard block
 block discarded – undo
2618 2618
  * @return object|array The now sanitized User Object or Array (will be the same type as $user)
2619 2619
  */
2620 2620
 function sanitize_user_object($user, $context = 'display') {
2621
-	_deprecated_function( __FUNCTION__, '3.3.0' );
2621
+	_deprecated_function(__FUNCTION__, '3.3.0');
2622 2622
 
2623
-	if ( is_object($user) ) {
2624
-		if ( !isset($user->ID) )
2623
+	if (is_object($user)) {
2624
+		if ( ! isset($user->ID))
2625 2625
 			$user->ID = 0;
2626
-		if ( ! ( $user instanceof WP_User ) ) {
2626
+		if ( ! ($user instanceof WP_User)) {
2627 2627
 			$vars = get_object_vars($user);
2628
-			foreach ( array_keys($vars) as $field ) {
2629
-				if ( is_string($user->$field) || is_numeric($user->$field) )
2628
+			foreach (array_keys($vars) as $field) {
2629
+				if (is_string($user->$field) || is_numeric($user->$field))
2630 2630
 					$user->$field = sanitize_user_field($field, $user->$field, $user->ID, $context);
2631 2631
 			}
2632 2632
 		}
2633 2633
 		$user->filter = $context;
2634 2634
 	} else {
2635
-		if ( !isset($user['ID']) )
2635
+		if ( ! isset($user['ID']))
2636 2636
 			$user['ID'] = 0;
2637
-		foreach ( array_keys($user) as $field )
2637
+		foreach (array_keys($user) as $field)
2638 2638
 			$user[$field] = sanitize_user_field($field, $user[$field], $user['ID'], $context);
2639 2639
 		$user['filter'] = $context;
2640 2640
 	}
@@ -2657,17 +2657,17 @@  discard block
 block discarded – undo
2657 2657
  * @return string
2658 2658
  */
2659 2659
 function get_boundary_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '', $start = true) {
2660
-	_deprecated_function( __FUNCTION__, '3.3.0' );
2660
+	_deprecated_function(__FUNCTION__, '3.3.0');
2661 2661
 
2662 2662
 	$posts = get_boundary_post($in_same_cat, $excluded_categories, $start);
2663 2663
 	// If there is no post stop.
2664
-	if ( empty($posts) )
2664
+	if (empty($posts))
2665 2665
 		return;
2666 2666
 
2667 2667
 	// Even though we limited get_posts to return only 1 item it still returns an array of objects.
2668 2668
 	$post = $posts[0];
2669 2669
 
2670
-	if ( empty($post->post_title) )
2670
+	if (empty($post->post_title))
2671 2671
 		$post->post_title = $start ? __('First Post') : __('Last Post');
2672 2672
 
2673 2673
 	$date = mysql2date(get_option('date_format'), $post->post_date);
@@ -2678,10 +2678,10 @@  discard block
 block discarded – undo
2678 2678
 
2679 2679
 	$link = $start ? "<link rel='start' title='" : "<link rel='end' title='";
2680 2680
 	$link .= esc_attr($title);
2681
-	$link .= "' href='" . get_permalink($post) . "' />\n";
2681
+	$link .= "' href='".get_permalink($post)."' />\n";
2682 2682
 
2683 2683
 	$boundary = $start ? 'start' : 'end';
2684
-	return apply_filters( "{$boundary}_post_rel_link", $link );
2684
+	return apply_filters("{$boundary}_post_rel_link", $link);
2685 2685
 }
2686 2686
 
2687 2687
 /**
@@ -2695,7 +2695,7 @@  discard block
 block discarded – undo
2695 2695
  * @param string $excluded_categories Optional. Excluded categories IDs.
2696 2696
  */
2697 2697
 function start_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '') {
2698
-	_deprecated_function( __FUNCTION__, '3.3.0' );
2698
+	_deprecated_function(__FUNCTION__, '3.3.0');
2699 2699
 
2700 2700
 	echo get_boundary_post_rel_link($title, $in_same_cat, $excluded_categories, true);
2701 2701
 }
@@ -2709,10 +2709,10 @@  discard block
 block discarded – undo
2709 2709
  * @return string
2710 2710
  */
2711 2711
 function get_index_rel_link() {
2712
-	_deprecated_function( __FUNCTION__, '3.3.0' );
2712
+	_deprecated_function(__FUNCTION__, '3.3.0');
2713 2713
 
2714
-	$link = "<link rel='index' title='" . esc_attr( get_bloginfo( 'name', 'display' ) ) . "' href='" . esc_url( user_trailingslashit( get_bloginfo( 'url', 'display' ) ) ) . "' />\n";
2715
-	return apply_filters( "index_rel_link", $link );
2714
+	$link = "<link rel='index' title='".esc_attr(get_bloginfo('name', 'display'))."' href='".esc_url(user_trailingslashit(get_bloginfo('url', 'display')))."' />\n";
2715
+	return apply_filters("index_rel_link", $link);
2716 2716
 }
2717 2717
 
2718 2718
 /**
@@ -2722,7 +2722,7 @@  discard block
 block discarded – undo
2722 2722
  * @deprecated 3.3.0
2723 2723
  */
2724 2724
 function index_rel_link() {
2725
-	_deprecated_function( __FUNCTION__, '3.3.0' );
2725
+	_deprecated_function(__FUNCTION__, '3.3.0');
2726 2726
 
2727 2727
 	echo get_index_rel_link();
2728 2728
 }
@@ -2736,13 +2736,13 @@  discard block
 block discarded – undo
2736 2736
  * @param string $title Optional. Link title format. Default '%title'.
2737 2737
  * @return string
2738 2738
  */
2739
-function get_parent_post_rel_link( $title = '%title' ) {
2740
-	_deprecated_function( __FUNCTION__, '3.3.0' );
2739
+function get_parent_post_rel_link($title = '%title') {
2740
+	_deprecated_function(__FUNCTION__, '3.3.0');
2741 2741
 
2742
-	if ( ! empty( $GLOBALS['post'] ) && ! empty( $GLOBALS['post']->post_parent ) )
2742
+	if ( ! empty($GLOBALS['post']) && ! empty($GLOBALS['post']->post_parent))
2743 2743
 		$post = get_post($GLOBALS['post']->post_parent);
2744 2744
 
2745
-	if ( empty($post) )
2745
+	if (empty($post))
2746 2746
 		return;
2747 2747
 
2748 2748
 	$date = mysql2date(get_option('date_format'), $post->post_date);
@@ -2752,10 +2752,10 @@  discard block
 block discarded – undo
2752 2752
 	$title = apply_filters('the_title', $title, $post->ID);
2753 2753
 
2754 2754
 	$link = "<link rel='up' title='";
2755
-	$link .= esc_attr( $title );
2756
-	$link .= "' href='" . get_permalink($post) . "' />\n";
2755
+	$link .= esc_attr($title);
2756
+	$link .= "' href='".get_permalink($post)."' />\n";
2757 2757
 
2758
-	return apply_filters( "parent_post_rel_link", $link );
2758
+	return apply_filters("parent_post_rel_link", $link);
2759 2759
 }
2760 2760
 
2761 2761
 /**
@@ -2766,8 +2766,8 @@  discard block
 block discarded – undo
2766 2766
  *
2767 2767
  * @param string $title Optional. Link title format. Default '%title'.
2768 2768
  */
2769
-function parent_post_rel_link( $title = '%title' ) {
2770
-	_deprecated_function( __FUNCTION__, '3.3.0' );
2769
+function parent_post_rel_link($title = '%title') {
2770
+	_deprecated_function(__FUNCTION__, '3.3.0');
2771 2771
 
2772 2772
 	echo get_parent_post_rel_link($title);
2773 2773
 }
@@ -2780,18 +2780,18 @@  discard block
 block discarded – undo
2780 2780
  *
2781 2781
  * @param WP_Admin_Bar $wp_admin_bar WP_Admin_Bar instance.
2782 2782
  */
2783
-function wp_admin_bar_dashboard_view_site_menu( $wp_admin_bar ) {
2784
-	_deprecated_function( __FUNCTION__, '3.3.0' );
2783
+function wp_admin_bar_dashboard_view_site_menu($wp_admin_bar) {
2784
+	_deprecated_function(__FUNCTION__, '3.3.0');
2785 2785
 
2786 2786
 	$user_id = get_current_user_id();
2787 2787
 
2788
-	if ( 0 != $user_id ) {
2789
-		if ( is_admin() )
2790
-			$wp_admin_bar->add_menu( array( 'id' => 'view-site', 'title' => __( 'Visit Site' ), 'href' => home_url() ) );
2791
-		elseif ( is_multisite() )
2792
-			$wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => get_dashboard_url( $user_id ) ) );
2788
+	if (0 != $user_id) {
2789
+		if (is_admin())
2790
+			$wp_admin_bar->add_menu(array('id' => 'view-site', 'title' => __('Visit Site'), 'href' => home_url()));
2791
+		elseif (is_multisite())
2792
+			$wp_admin_bar->add_menu(array('id' => 'dashboard', 'title' => __('Dashboard'), 'href' => get_dashboard_url($user_id)));
2793 2793
 		else
2794
-			$wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => admin_url() ) );
2794
+			$wp_admin_bar->add_menu(array('id' => 'dashboard', 'title' => __('Dashboard'), 'href' => admin_url()));
2795 2795
 	}
2796 2796
 }
2797 2797
 
@@ -2805,10 +2805,10 @@  discard block
 block discarded – undo
2805 2805
  * @param int $blog_id Site ID
2806 2806
  * @return bool True if the current users belong to $blog_id, false if not.
2807 2807
  */
2808
-function is_blog_user( $blog_id = 0 ) {
2809
-	_deprecated_function( __FUNCTION__, '3.3.0', 'is_user_member_of_blog()' );
2808
+function is_blog_user($blog_id = 0) {
2809
+	_deprecated_function(__FUNCTION__, '3.3.0', 'is_user_member_of_blog()');
2810 2810
 
2811
-	return is_user_member_of_blog( get_current_user_id(), $blog_id );
2811
+	return is_user_member_of_blog(get_current_user_id(), $blog_id);
2812 2812
 }
2813 2813
 
2814 2814
 /**
@@ -2824,8 +2824,8 @@  discard block
 block discarded – undo
2824 2824
  * @param string $mode     Type of access you required to the stream.
2825 2825
  * @return false Always false.
2826 2826
  */
2827
-function debug_fopen( $filename, $mode ) {
2828
-	_deprecated_function( __FUNCTION__, 'error_log()' );
2827
+function debug_fopen($filename, $mode) {
2828
+	_deprecated_function(__FUNCTION__, 'error_log()');
2829 2829
 	return false;
2830 2830
 }
2831 2831
 
@@ -2841,10 +2841,10 @@  discard block
 block discarded – undo
2841 2841
  * @param mixed  $fp     Unused.
2842 2842
  * @param string $string Message to log.
2843 2843
  */
2844
-function debug_fwrite( $fp, $string ) {
2845
-	_deprecated_function( __FUNCTION__, 'error_log()' );
2846
-	if ( ! empty( $GLOBALS['debug'] ) )
2847
-		error_log( $string );
2844
+function debug_fwrite($fp, $string) {
2845
+	_deprecated_function(__FUNCTION__, 'error_log()');
2846
+	if ( ! empty($GLOBALS['debug']))
2847
+		error_log($string);
2848 2848
 }
2849 2849
 
2850 2850
 /**
@@ -2858,8 +2858,8 @@  discard block
 block discarded – undo
2858 2858
  *
2859 2859
  * @param mixed $fp Unused.
2860 2860
  */
2861
-function debug_fclose( $fp ) {
2862
-	_deprecated_function( __FUNCTION__, 'error_log()' );
2861
+function debug_fclose($fp) {
2862
+	_deprecated_function(__FUNCTION__, 'error_log()');
2863 2863
 }
2864 2864
 
2865 2865
 /**
@@ -2876,21 +2876,21 @@  discard block
 block discarded – undo
2876 2876
  * @return array Theme list with theme data.
2877 2877
  */
2878 2878
 function get_themes() {
2879
-	_deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_themes()' );
2879
+	_deprecated_function(__FUNCTION__, '3.4.0', 'wp_get_themes()');
2880 2880
 
2881 2881
 	global $wp_themes;
2882
-	if ( isset( $wp_themes ) )
2882
+	if (isset($wp_themes))
2883 2883
 		return $wp_themes;
2884 2884
 
2885 2885
 	$themes = wp_get_themes();
2886 2886
 	$wp_themes = array();
2887 2887
 
2888
-	foreach ( $themes as $theme ) {
2888
+	foreach ($themes as $theme) {
2889 2889
 		$name = $theme->get('Name');
2890
-		if ( isset( $wp_themes[ $name ] ) )
2891
-			$wp_themes[ $name . '/' . $theme->get_stylesheet() ] = $theme;
2890
+		if (isset($wp_themes[$name]))
2891
+			$wp_themes[$name.'/'.$theme->get_stylesheet()] = $theme;
2892 2892
 		else
2893
-			$wp_themes[ $name ] = $theme;
2893
+			$wp_themes[$name] = $theme;
2894 2894
 	}
2895 2895
 
2896 2896
 	return $wp_themes;
@@ -2906,12 +2906,12 @@  discard block
 block discarded – undo
2906 2906
  * @param string $theme Theme name.
2907 2907
  * @return array|null Null, if theme name does not exist. Theme data, if exists.
2908 2908
  */
2909
-function get_theme( $theme ) {
2910
-	_deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme( $stylesheet )' );
2909
+function get_theme($theme) {
2910
+	_deprecated_function(__FUNCTION__, '3.4.0', 'wp_get_theme( $stylesheet )');
2911 2911
 
2912 2912
 	$themes = get_themes();
2913
-	if ( is_array( $themes ) && array_key_exists( $theme, $themes ) )
2914
-		return $themes[ $theme ];
2913
+	if (is_array($themes) && array_key_exists($theme, $themes))
2914
+		return $themes[$theme];
2915 2915
 	return null;
2916 2916
 }
2917 2917
 
@@ -2925,9 +2925,9 @@  discard block
 block discarded – undo
2925 2925
  * @return string
2926 2926
  */
2927 2927
 function get_current_theme() {
2928
-	_deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme()' );
2928
+	_deprecated_function(__FUNCTION__, '3.4.0', 'wp_get_theme()');
2929 2929
 
2930
-	if ( $theme = get_option( 'current_theme' ) )
2930
+	if ($theme = get_option('current_theme'))
2931 2931
 		return $theme;
2932 2932
 
2933 2933
 	return wp_get_theme()->get('Name');
@@ -2946,10 +2946,10 @@  discard block
 block discarded – undo
2946 2946
  * @return string The pre block without paragraph/line-break conversion.
2947 2947
  */
2948 2948
 function clean_pre($matches) {
2949
-	_deprecated_function( __FUNCTION__, '3.4.0' );
2949
+	_deprecated_function(__FUNCTION__, '3.4.0');
2950 2950
 
2951
-	if ( is_array($matches) )
2952
-		$text = $matches[1] . $matches[2] . "</pre>";
2951
+	if (is_array($matches))
2952
+		$text = $matches[1].$matches[2]."</pre>";
2953 2953
 	else
2954 2954
 		$text = $matches;
2955 2955
 
@@ -2972,15 +2972,15 @@  discard block
 block discarded – undo
2972 2972
  * @param callable $admin_head_callback Call on custom header administration screen.
2973 2973
  * @param callable $admin_preview_callback Output a custom header image div on the custom header administration screen. Optional.
2974 2974
  */
2975
-function add_custom_image_header( $wp_head_callback, $admin_head_callback, $admin_preview_callback = '' ) {
2976
-	_deprecated_function( __FUNCTION__, '3.4.0', 'add_theme_support( \'custom-header\', $args )' );
2975
+function add_custom_image_header($wp_head_callback, $admin_head_callback, $admin_preview_callback = '') {
2976
+	_deprecated_function(__FUNCTION__, '3.4.0', 'add_theme_support( \'custom-header\', $args )');
2977 2977
 	$args = array(
2978 2978
 		'wp-head-callback'    => $wp_head_callback,
2979 2979
 		'admin-head-callback' => $admin_head_callback,
2980 2980
 	);
2981
-	if ( $admin_preview_callback )
2981
+	if ($admin_preview_callback)
2982 2982
 		$args['admin-preview-callback'] = $admin_preview_callback;
2983
-	return add_theme_support( 'custom-header', $args );
2983
+	return add_theme_support('custom-header', $args);
2984 2984
 }
2985 2985
 
2986 2986
 /**
@@ -2993,8 +2993,8 @@  discard block
 block discarded – undo
2993 2993
  * @return null|bool Whether support was removed.
2994 2994
  */
2995 2995
 function remove_custom_image_header() {
2996
-	_deprecated_function( __FUNCTION__, '3.4.0', 'remove_theme_support( \'custom-header\' )' );
2997
-	return remove_theme_support( 'custom-header' );
2996
+	_deprecated_function(__FUNCTION__, '3.4.0', 'remove_theme_support( \'custom-header\' )');
2997
+	return remove_theme_support('custom-header');
2998 2998
 }
2999 2999
 
3000 3000
 /**
@@ -3008,16 +3008,16 @@  discard block
 block discarded – undo
3008 3008
  * @param callable $admin_head_callback Call on custom background administration screen.
3009 3009
  * @param callable $admin_preview_callback Output a custom background image div on the custom background administration screen. Optional.
3010 3010
  */
3011
-function add_custom_background( $wp_head_callback = '', $admin_head_callback = '', $admin_preview_callback = '' ) {
3012
-	_deprecated_function( __FUNCTION__, '3.4.0', 'add_theme_support( \'custom-background\', $args )' );
3011
+function add_custom_background($wp_head_callback = '', $admin_head_callback = '', $admin_preview_callback = '') {
3012
+	_deprecated_function(__FUNCTION__, '3.4.0', 'add_theme_support( \'custom-background\', $args )');
3013 3013
 	$args = array();
3014
-	if ( $wp_head_callback )
3014
+	if ($wp_head_callback)
3015 3015
 		$args['wp-head-callback'] = $wp_head_callback;
3016
-	if ( $admin_head_callback )
3016
+	if ($admin_head_callback)
3017 3017
 		$args['admin-head-callback'] = $admin_head_callback;
3018
-	if ( $admin_preview_callback )
3018
+	if ($admin_preview_callback)
3019 3019
 		$args['admin-preview-callback'] = $admin_preview_callback;
3020
-	return add_theme_support( 'custom-background', $args );
3020
+	return add_theme_support('custom-background', $args);
3021 3021
 }
3022 3022
 
3023 3023
 /**
@@ -3030,8 +3030,8 @@  discard block
 block discarded – undo
3030 3030
  * @return null|bool Whether support was removed.
3031 3031
  */
3032 3032
 function remove_custom_background() {
3033
-	_deprecated_function( __FUNCTION__, '3.4.0', 'remove_theme_support( \'custom-background\' )' );
3034
-	return remove_theme_support( 'custom-background' );
3033
+	_deprecated_function(__FUNCTION__, '3.4.0', 'remove_theme_support( \'custom-background\' )');
3034
+	return remove_theme_support('custom-background');
3035 3035
 }
3036 3036
 
3037 3037
 /**
@@ -3044,9 +3044,9 @@  discard block
 block discarded – undo
3044 3044
  * @param string $theme_file Theme file path.
3045 3045
  * @return array Theme data.
3046 3046
  */
3047
-function get_theme_data( $theme_file ) {
3048
-	_deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme()' );
3049
-	$theme = new WP_Theme( basename( dirname( $theme_file ) ), dirname( dirname( $theme_file ) ) );
3047
+function get_theme_data($theme_file) {
3048
+	_deprecated_function(__FUNCTION__, '3.4.0', 'wp_get_theme()');
3049
+	$theme = new WP_Theme(basename(dirname($theme_file)), dirname(dirname($theme_file)));
3050 3050
 
3051 3051
 	$theme_data = array(
3052 3052
 		'Name' => $theme->get('Name'),
@@ -3062,9 +3062,9 @@  discard block
 block discarded – undo
3062 3062
 		'AuthorName' => $theme->get('Author'),
3063 3063
 	);
3064 3064
 
3065
-	foreach ( apply_filters( 'extra_theme_headers', array() ) as $extra_header ) {
3066
-		if ( ! isset( $theme_data[ $extra_header ] ) )
3067
-			$theme_data[ $extra_header ] = $theme->get( $extra_header );
3065
+	foreach (apply_filters('extra_theme_headers', array()) as $extra_header) {
3066
+		if ( ! isset($theme_data[$extra_header]))
3067
+			$theme_data[$extra_header] = $theme->get($extra_header);
3068 3068
 	}
3069 3069
 
3070 3070
 	return $theme_data;
@@ -3081,10 +3081,10 @@  discard block
 block discarded – undo
3081 3081
  *
3082 3082
  * @param array $pages list of page objects
3083 3083
  */
3084
-function update_page_cache( &$pages ) {
3085
-	_deprecated_function( __FUNCTION__, '3.4.0', 'update_post_cache()' );
3084
+function update_page_cache(&$pages) {
3085
+	_deprecated_function(__FUNCTION__, '3.4.0', 'update_post_cache()');
3086 3086
 
3087
-	update_post_cache( $pages );
3087
+	update_post_cache($pages);
3088 3088
 }
3089 3089
 
3090 3090
 /**
@@ -3099,10 +3099,10 @@  discard block
 block discarded – undo
3099 3099
  *
3100 3100
  * @param int $id Page ID to clean
3101 3101
  */
3102
-function clean_page_cache( $id ) {
3103
-	_deprecated_function( __FUNCTION__, '3.4.0', 'clean_post_cache()' );
3102
+function clean_page_cache($id) {
3103
+	_deprecated_function(__FUNCTION__, '3.4.0', 'clean_post_cache()');
3104 3104
 
3105
-	clean_post_cache( $id );
3105
+	clean_post_cache($id);
3106 3106
 }
3107 3107
 
3108 3108
 /**
@@ -3117,9 +3117,9 @@  discard block
 block discarded – undo
3117 3117
  * @param string $action Nonce action.
3118 3118
  * @return string Are you sure message.
3119 3119
  */
3120
-function wp_explain_nonce( $action ) {
3121
-	_deprecated_function( __FUNCTION__, '3.4.1', 'wp_nonce_ays()' );
3122
-	return __( 'Are you sure you want to do this?' );
3120
+function wp_explain_nonce($action) {
3121
+	_deprecated_function(__FUNCTION__, '3.4.1', 'wp_nonce_ays()');
3122
+	return __('Are you sure you want to do this?');
3123 3123
 }
3124 3124
 
3125 3125
 /**
@@ -3131,9 +3131,9 @@  discard block
 block discarded – undo
3131 3131
  *
3132 3132
  * @param int $post_id An optional post ID.
3133 3133
  */
3134
-function sticky_class( $post_id = null ) {
3135
-	_deprecated_function( __FUNCTION__, '3.5.0', 'post_class()' );
3136
-	if ( is_sticky( $post_id ) )
3134
+function sticky_class($post_id = null) {
3135
+	_deprecated_function(__FUNCTION__, '3.5.0', 'post_class()');
3136
+	if (is_sticky($post_id))
3137 3137
 		echo ' sticky';
3138 3138
 }
3139 3139
 
@@ -3149,8 +3149,8 @@  discard block
 block discarded – undo
3149 3149
  *
3150 3150
  * @param WP_Post &$post Post object, passed by reference (unused).
3151 3151
  */
3152
-function _get_post_ancestors( &$post ) {
3153
-	_deprecated_function( __FUNCTION__, '3.5.0' );
3152
+function _get_post_ancestors(&$post) {
3153
+	_deprecated_function(__FUNCTION__, '3.5.0');
3154 3154
 }
3155 3155
 
3156 3156
 /**
@@ -3163,28 +3163,28 @@  discard block
 block discarded – undo
3163 3163
  * @param string $file Filename of the image to load.
3164 3164
  * @return resource The resulting image resource on success, Error string on failure.
3165 3165
  */
3166
-function wp_load_image( $file ) {
3167
-	_deprecated_function( __FUNCTION__, '3.5.0', 'wp_get_image_editor()' );
3166
+function wp_load_image($file) {
3167
+	_deprecated_function(__FUNCTION__, '3.5.0', 'wp_get_image_editor()');
3168 3168
 
3169
-	if ( is_numeric( $file ) )
3170
-		$file = get_attached_file( $file );
3169
+	if (is_numeric($file))
3170
+		$file = get_attached_file($file);
3171 3171
 
3172
-	if ( ! is_file( $file ) ) {
3172
+	if ( ! is_file($file)) {
3173 3173
 		/* translators: %s: file name */
3174
-		return sprintf( __( 'File &#8220;%s&#8221; doesn&#8217;t exist?' ), $file );
3174
+		return sprintf(__('File &#8220;%s&#8221; doesn&#8217;t exist?'), $file);
3175 3175
 	}
3176 3176
 
3177
-	if ( ! function_exists('imagecreatefromstring') )
3177
+	if ( ! function_exists('imagecreatefromstring'))
3178 3178
 		return __('The GD image library is not installed.');
3179 3179
 
3180 3180
 	// Set artificially high because GD uses uncompressed images in memory.
3181
-	wp_raise_memory_limit( 'image' );
3181
+	wp_raise_memory_limit('image');
3182 3182
 
3183
-	$image = imagecreatefromstring( file_get_contents( $file ) );
3183
+	$image = imagecreatefromstring(file_get_contents($file));
3184 3184
 
3185
-	if ( ! is_resource( $image ) ) {
3185
+	if ( ! is_resource($image)) {
3186 3186
 		/* translators: %s: file name */
3187
-		return sprintf( __( 'File &#8220;%s&#8221; is not an image.' ), $file );
3187
+		return sprintf(__('File &#8220;%s&#8221; is not an image.'), $file);
3188 3188
 	}
3189 3189
 
3190 3190
 	return $image;
@@ -3214,22 +3214,22 @@  discard block
 block discarded – undo
3214 3214
  * @param int $jpeg_quality Optional, default is 90. Image quality percentage.
3215 3215
  * @return mixed WP_Error on failure. String with new destination path.
3216 3216
  */
3217
-function image_resize( $file, $max_w, $max_h, $crop = false, $suffix = null, $dest_path = null, $jpeg_quality = 90 ) {
3218
-	_deprecated_function( __FUNCTION__, '3.5.0', 'wp_get_image_editor()' );
3217
+function image_resize($file, $max_w, $max_h, $crop = false, $suffix = null, $dest_path = null, $jpeg_quality = 90) {
3218
+	_deprecated_function(__FUNCTION__, '3.5.0', 'wp_get_image_editor()');
3219 3219
 
3220
-	$editor = wp_get_image_editor( $file );
3221
-	if ( is_wp_error( $editor ) )
3220
+	$editor = wp_get_image_editor($file);
3221
+	if (is_wp_error($editor))
3222 3222
 		return $editor;
3223
-	$editor->set_quality( $jpeg_quality );
3223
+	$editor->set_quality($jpeg_quality);
3224 3224
 
3225
-	$resized = $editor->resize( $max_w, $max_h, $crop );
3226
-	if ( is_wp_error( $resized ) )
3225
+	$resized = $editor->resize($max_w, $max_h, $crop);
3226
+	if (is_wp_error($resized))
3227 3227
 		return $resized;
3228 3228
 
3229
-	$dest_file = $editor->generate_filename( $suffix, $dest_path );
3230
-	$saved = $editor->save( $dest_file );
3229
+	$dest_file = $editor->generate_filename($suffix, $dest_path);
3230
+	$saved = $editor->save($dest_file);
3231 3231
 
3232
-	if ( is_wp_error( $saved ) )
3232
+	if (is_wp_error($saved))
3233 3233
 		return $saved;
3234 3234
 
3235 3235
 	return $dest_file;
@@ -3249,9 +3249,9 @@  discard block
 block discarded – undo
3249 3249
  * @param string $mode How to return result, either OBJECT, ARRAY_N, or ARRAY_A.
3250 3250
  * @return WP_Post|null Post object or array holding post contents and information
3251 3251
  */
3252
-function wp_get_single_post( $postid = 0, $mode = OBJECT ) {
3253
-	_deprecated_function( __FUNCTION__, '3.5.0', 'get_post()' );
3254
-	return get_post( $postid, $mode );
3252
+function wp_get_single_post($postid = 0, $mode = OBJECT) {
3253
+	_deprecated_function(__FUNCTION__, '3.5.0', 'get_post()');
3254
+	return get_post($postid, $mode);
3255 3255
 }
3256 3256
 
3257 3257
 /**
@@ -3266,9 +3266,9 @@  discard block
 block discarded – undo
3266 3266
  * @return bool False if does not authenticate, true if username and password authenticates.
3267 3267
  */
3268 3268
 function user_pass_ok($user_login, $user_pass) {
3269
-	_deprecated_function( __FUNCTION__, '3.5.0', 'wp_authenticate()' );
3270
-	$user = wp_authenticate( $user_login, $user_pass );
3271
-	if ( is_wp_error( $user ) )
3269
+	_deprecated_function(__FUNCTION__, '3.5.0', 'wp_authenticate()');
3270
+	$user = wp_authenticate($user_login, $user_pass);
3271
+	if (is_wp_error($user))
3272 3272
 		return false;
3273 3273
 
3274 3274
 	return true;
@@ -3293,10 +3293,10 @@  discard block
 block discarded – undo
3293 3293
  * @return bool
3294 3294
  */
3295 3295
 function gd_edit_image_support($mime_type) {
3296
-	_deprecated_function( __FUNCTION__, '3.5.0', 'wp_image_editor_supports()' );
3296
+	_deprecated_function(__FUNCTION__, '3.5.0', 'wp_image_editor_supports()');
3297 3297
 
3298
-	if ( function_exists('imagetypes') ) {
3299
-		switch( $mime_type ) {
3298
+	if (function_exists('imagetypes')) {
3299
+		switch ($mime_type) {
3300 3300
 			case 'image/jpeg':
3301 3301
 				return (imagetypes() & IMG_JPG) != 0;
3302 3302
 			case 'image/png':
@@ -3305,7 +3305,7 @@  discard block
 block discarded – undo
3305 3305
 				return (imagetypes() & IMG_GIF) != 0;
3306 3306
 		}
3307 3307
 	} else {
3308
-		switch( $mime_type ) {
3308
+		switch ($mime_type) {
3309 3309
 			case 'image/jpeg':
3310 3310
 				return function_exists('imagecreatefromjpeg');
3311 3311
 			case 'image/png':
@@ -3327,22 +3327,22 @@  discard block
 block discarded – undo
3327 3327
  * @param int $bytes An integer byte value.
3328 3328
  * @return string A shorthand byte value.
3329 3329
  */
3330
-function wp_convert_bytes_to_hr( $bytes ) {
3331
-	_deprecated_function( __FUNCTION__, '3.6.0', 'size_format()' );
3330
+function wp_convert_bytes_to_hr($bytes) {
3331
+	_deprecated_function(__FUNCTION__, '3.6.0', 'size_format()');
3332 3332
 
3333
-	$units = array( 0 => 'B', 1 => 'KB', 2 => 'MB', 3 => 'GB', 4 => 'TB' );
3334
-	$log   = log( $bytes, KB_IN_BYTES );
3333
+	$units = array(0 => 'B', 1 => 'KB', 2 => 'MB', 3 => 'GB', 4 => 'TB');
3334
+	$log   = log($bytes, KB_IN_BYTES);
3335 3335
 	$power = (int) $log;
3336
-	$size  = pow( KB_IN_BYTES, $log - $power );
3336
+	$size  = pow(KB_IN_BYTES, $log - $power);
3337 3337
 
3338
-	if ( ! is_nan( $size ) && array_key_exists( $power, $units ) ) {
3339
-		$unit = $units[ $power ];
3338
+	if ( ! is_nan($size) && array_key_exists($power, $units)) {
3339
+		$unit = $units[$power];
3340 3340
 	} else {
3341 3341
 		$size = $bytes;
3342 3342
 		$unit = $units[0];
3343 3343
 	}
3344 3344
 
3345
-	return $size . $unit;
3345
+	return $size.$unit;
3346 3346
 }
3347 3347
 
3348 3348
 /**
@@ -3355,9 +3355,9 @@  discard block
 block discarded – undo
3355 3355
  * @param string $t Search terms to "tidy", e.g. trim.
3356 3356
  * @return string Trimmed search terms.
3357 3357
  */
3358
-function _search_terms_tidy( $t ) {
3359
-	_deprecated_function( __FUNCTION__, '3.7.0' );
3360
-	return trim( $t, "\"'\n\r " );
3358
+function _search_terms_tidy($t) {
3359
+	_deprecated_function(__FUNCTION__, '3.7.0');
3360
+	return trim($t, "\"'\n\r ");
3361 3361
 }
3362 3362
 
3363 3363
 /**
@@ -3373,10 +3373,10 @@  discard block
 block discarded – undo
3373 3373
  */
3374 3374
 function rich_edit_exists() {
3375 3375
 	global $wp_rich_edit_exists;
3376
-	_deprecated_function( __FUNCTION__, '3.9.0' );
3376
+	_deprecated_function(__FUNCTION__, '3.9.0');
3377 3377
 
3378
-	if ( ! isset( $wp_rich_edit_exists ) )
3379
-		$wp_rich_edit_exists = file_exists( ABSPATH . WPINC . '/js/tinymce/tinymce.js' );
3378
+	if ( ! isset($wp_rich_edit_exists))
3379
+		$wp_rich_edit_exists = file_exists(ABSPATH.WPINC.'/js/tinymce/tinymce.js');
3380 3380
 
3381 3381
 	return $wp_rich_edit_exists;
3382 3382
 }
@@ -3391,7 +3391,7 @@  discard block
 block discarded – undo
3391 3391
  * @param int $count Number of topics.
3392 3392
  * @return int Number of topics.
3393 3393
  */
3394
-function default_topic_count_text( $count ) {
3394
+function default_topic_count_text($count) {
3395 3395
 	return $count;
3396 3396
 }
3397 3397
 
@@ -3406,8 +3406,8 @@  discard block
 block discarded – undo
3406 3406
  * @param string $content The text to format.
3407 3407
  * @return string The very same text.
3408 3408
  */
3409
-function format_to_post( $content ) {
3410
-	_deprecated_function( __FUNCTION__, '3.9.0' );
3409
+function format_to_post($content) {
3410
+	_deprecated_function(__FUNCTION__, '3.9.0');
3411 3411
 	return $content;
3412 3412
 }
3413 3413
 
@@ -3422,8 +3422,8 @@  discard block
 block discarded – undo
3422 3422
  * @return string text, safe for inclusion in LIKE query.
3423 3423
  */
3424 3424
 function like_escape($text) {
3425
-	_deprecated_function( __FUNCTION__, '4.0.0', 'wpdb::esc_like()' );
3426
-	return str_replace( array( "%", "_" ), array( "\\%", "\\_" ), $text );
3425
+	_deprecated_function(__FUNCTION__, '4.0.0', 'wpdb::esc_like()');
3426
+	return str_replace(array("%", "_"), array("\\%", "\\_"), $text);
3427 3427
 }
3428 3428
 
3429 3429
 /**
@@ -3438,14 +3438,14 @@  discard block
 block discarded – undo
3438 3438
  * @param string $url The URL to test.
3439 3439
  * @return bool Whether SSL access is available.
3440 3440
  */
3441
-function url_is_accessable_via_ssl( $url ) {
3442
-	_deprecated_function( __FUNCTION__, '4.0.0' );
3441
+function url_is_accessable_via_ssl($url) {
3442
+	_deprecated_function(__FUNCTION__, '4.0.0');
3443 3443
 
3444
-	$response = wp_remote_get( set_url_scheme( $url, 'https' ) );
3444
+	$response = wp_remote_get(set_url_scheme($url, 'https'));
3445 3445
 
3446
-	if ( !is_wp_error( $response ) ) {
3447
-		$status = wp_remote_retrieve_response_code( $response );
3448
-		if ( 200 == $status || 401 == $status ) {
3446
+	if ( ! is_wp_error($response)) {
3447
+		$status = wp_remote_retrieve_response_code($response);
3448
+		if (200 == $status || 401 == $status) {
3449 3449
 			return true;
3450 3450
 		}
3451 3451
 	}
@@ -3463,7 +3463,7 @@  discard block
 block discarded – undo
3463 3463
  * @deprecated 4.3.0
3464 3464
  */
3465 3465
 function preview_theme() {
3466
-	_deprecated_function( __FUNCTION__, '4.3.0' );
3466
+	_deprecated_function(__FUNCTION__, '4.3.0');
3467 3467
 }
3468 3468
 
3469 3469
 /**
@@ -3476,7 +3476,7 @@  discard block
 block discarded – undo
3476 3476
  * @return string
3477 3477
  */
3478 3478
 function _preview_theme_template_filter() {
3479
-	_deprecated_function( __FUNCTION__, '4.3.0' );
3479
+	_deprecated_function(__FUNCTION__, '4.3.0');
3480 3480
 	return '';
3481 3481
 }
3482 3482
 
@@ -3490,7 +3490,7 @@  discard block
 block discarded – undo
3490 3490
  * @return string
3491 3491
  */
3492 3492
 function _preview_theme_stylesheet_filter() {
3493
-	_deprecated_function( __FUNCTION__, '4.3.0' );
3493
+	_deprecated_function(__FUNCTION__, '4.3.0');
3494 3494
 	return '';
3495 3495
 }
3496 3496
 
@@ -3504,8 +3504,8 @@  discard block
 block discarded – undo
3504 3504
  * @param string $content
3505 3505
  * @return string
3506 3506
  */
3507
-function preview_theme_ob_filter( $content ) {
3508
-	_deprecated_function( __FUNCTION__, '4.3.0' );
3507
+function preview_theme_ob_filter($content) {
3508
+	_deprecated_function(__FUNCTION__, '4.3.0');
3509 3509
 	return $content;
3510 3510
 }
3511 3511
 
@@ -3521,8 +3521,8 @@  discard block
 block discarded – undo
3521 3521
  * @param array $matches
3522 3522
  * @return string
3523 3523
  */
3524
-function preview_theme_ob_filter_callback( $matches ) {
3525
-	_deprecated_function( __FUNCTION__, '4.3.0' );
3524
+function preview_theme_ob_filter_callback($matches) {
3525
+	_deprecated_function(__FUNCTION__, '4.3.0');
3526 3526
 	return '';
3527 3527
 }
3528 3528
 
@@ -3539,9 +3539,9 @@  discard block
 block discarded – undo
3539 3539
  * @return string The formatted text after filter is applied.
3540 3540
  */
3541 3541
 function wp_richedit_pre($text) {
3542
-	_deprecated_function( __FUNCTION__, '4.3.0', 'format_for_editor()' );
3542
+	_deprecated_function(__FUNCTION__, '4.3.0', 'format_for_editor()');
3543 3543
 
3544
-	if ( empty( $text ) ) {
3544
+	if (empty($text)) {
3545 3545
 		/**
3546 3546
 		 * Filters text returned for the rich text editor.
3547 3547
 		 *
@@ -3557,15 +3557,15 @@  discard block
 block discarded – undo
3557 3557
 		 *
3558 3558
 		 * @param string $output Text for the rich text editor.
3559 3559
 		 */
3560
-		return apply_filters( 'richedit_pre', '' );
3560
+		return apply_filters('richedit_pre', '');
3561 3561
 	}
3562 3562
 
3563 3563
 	$output = convert_chars($text);
3564 3564
 	$output = wpautop($output);
3565
-	$output = htmlspecialchars($output, ENT_NOQUOTES, get_option( 'blog_charset' ) );
3565
+	$output = htmlspecialchars($output, ENT_NOQUOTES, get_option('blog_charset'));
3566 3566
 
3567 3567
 	/** This filter is documented in wp-includes/deprecated.php */
3568
-	return apply_filters( 'richedit_pre', $output );
3568
+	return apply_filters('richedit_pre', $output);
3569 3569
 }
3570 3570
 
3571 3571
 /**
@@ -3582,10 +3582,10 @@  discard block
 block discarded – undo
3582 3582
  * @return string Formatted text after filter applied.
3583 3583
  */
3584 3584
 function wp_htmledit_pre($output) {
3585
-	_deprecated_function( __FUNCTION__, '4.3.0', 'format_for_editor()' );
3585
+	_deprecated_function(__FUNCTION__, '4.3.0', 'format_for_editor()');
3586 3586
 
3587
-	if ( !empty($output) )
3588
-		$output = htmlspecialchars($output, ENT_NOQUOTES, get_option( 'blog_charset' ) ); // convert only < > &
3587
+	if ( ! empty($output))
3588
+		$output = htmlspecialchars($output, ENT_NOQUOTES, get_option('blog_charset')); // convert only < > &
3589 3589
 
3590 3590
 	/**
3591 3591
 	 * Filters the text before it is formatted for the HTML editor.
@@ -3595,7 +3595,7 @@  discard block
 block discarded – undo
3595 3595
 	 *
3596 3596
 	 * @param string $output The HTML-formatted text.
3597 3597
 	 */
3598
-	return apply_filters( 'htmledit_pre', $output );
3598
+	return apply_filters('htmledit_pre', $output);
3599 3599
 }
3600 3600
 
3601 3601
 /**
@@ -3608,10 +3608,10 @@  discard block
 block discarded – undo
3608 3608
  * @param int|WP_Post $post_id Optional. Post ID or WP_Post object. Default is global $post.
3609 3609
  * @return string|false
3610 3610
  */
3611
-function post_permalink( $post_id = 0 ) {
3612
-	_deprecated_function( __FUNCTION__, '4.4.0', 'get_permalink()' );
3611
+function post_permalink($post_id = 0) {
3612
+	_deprecated_function(__FUNCTION__, '4.4.0', 'get_permalink()');
3613 3613
 
3614
-	return get_permalink( $post_id );
3614
+	return get_permalink($post_id);
3615 3615
 }
3616 3616
 
3617 3617
 /**
@@ -3630,44 +3630,44 @@  discard block
 block discarded – undo
3630 3630
  *                               returns false. Default 1.
3631 3631
  * @return bool|string False on failure and string of headers if HEAD request.
3632 3632
  */
3633
-function wp_get_http( $url, $file_path = false, $red = 1 ) {
3634
-	_deprecated_function( __FUNCTION__, '4.4.0', 'WP_Http' );
3633
+function wp_get_http($url, $file_path = false, $red = 1) {
3634
+	_deprecated_function(__FUNCTION__, '4.4.0', 'WP_Http');
3635 3635
 
3636
-	@set_time_limit( 60 );
3636
+	@set_time_limit(60);
3637 3637
 
3638
-	if ( $red > 5 )
3638
+	if ($red > 5)
3639 3639
 		return false;
3640 3640
 
3641 3641
 	$options = array();
3642 3642
 	$options['redirection'] = 5;
3643 3643
 
3644
-	if ( false == $file_path )
3644
+	if (false == $file_path)
3645 3645
 		$options['method'] = 'HEAD';
3646 3646
 	else
3647 3647
 		$options['method'] = 'GET';
3648 3648
 
3649
-	$response = wp_safe_remote_request( $url, $options );
3649
+	$response = wp_safe_remote_request($url, $options);
3650 3650
 
3651
-	if ( is_wp_error( $response ) )
3651
+	if (is_wp_error($response))
3652 3652
 		return false;
3653 3653
 
3654
-	$headers = wp_remote_retrieve_headers( $response );
3655
-	$headers['response'] = wp_remote_retrieve_response_code( $response );
3654
+	$headers = wp_remote_retrieve_headers($response);
3655
+	$headers['response'] = wp_remote_retrieve_response_code($response);
3656 3656
 
3657 3657
 	// WP_HTTP no longer follows redirects for HEAD requests.
3658
-	if ( 'HEAD' == $options['method'] && in_array($headers['response'], array(301, 302)) && isset( $headers['location'] ) ) {
3659
-		return wp_get_http( $headers['location'], $file_path, ++$red );
3658
+	if ('HEAD' == $options['method'] && in_array($headers['response'], array(301, 302)) && isset($headers['location'])) {
3659
+		return wp_get_http($headers['location'], $file_path, ++$red);
3660 3660
 	}
3661 3661
 
3662
-	if ( false == $file_path )
3662
+	if (false == $file_path)
3663 3663
 		return $headers;
3664 3664
 
3665 3665
 	// GET request - write it to the supplied filename
3666 3666
 	$out_fp = fopen($file_path, 'w');
3667
-	if ( !$out_fp )
3667
+	if ( ! $out_fp)
3668 3668
 		return $headers;
3669 3669
 
3670
-	fwrite( $out_fp,  wp_remote_retrieve_body( $response ) );
3670
+	fwrite($out_fp, wp_remote_retrieve_body($response));
3671 3671
 	fclose($out_fp);
3672 3672
 	clearstatcache();
3673 3673
 
@@ -3684,9 +3684,9 @@  discard block
 block discarded – undo
3684 3684
  * @param string|bool $force Optional Whether to force SSL login. Default null.
3685 3685
  * @return bool True if forced, false if not forced.
3686 3686
  */
3687
-function force_ssl_login( $force = null ) {
3688
-	_deprecated_function( __FUNCTION__, '4.4.0', 'force_ssl_admin()' );
3689
-	return force_ssl_admin( $force );
3687
+function force_ssl_login($force = null) {
3688
+	_deprecated_function(__FUNCTION__, '4.4.0', 'force_ssl_admin()');
3689
+	return force_ssl_admin($force);
3690 3690
 }
3691 3691
 
3692 3692
 /**
@@ -3698,7 +3698,7 @@  discard block
 block discarded – undo
3698 3698
  * @return string Full path to comments popup template file.
3699 3699
  */
3700 3700
 function get_comments_popup_template() {
3701
-	_deprecated_function( __FUNCTION__, '4.5.0' );
3701
+	_deprecated_function(__FUNCTION__, '4.5.0');
3702 3702
 
3703 3703
 	return '';
3704 3704
 }
@@ -3712,7 +3712,7 @@  discard block
 block discarded – undo
3712 3712
  * @return bool
3713 3713
  */
3714 3714
 function is_comments_popup() {
3715
-	_deprecated_function( __FUNCTION__, '4.5.0' );
3715
+	_deprecated_function(__FUNCTION__, '4.5.0');
3716 3716
 
3717 3717
 	return false;
3718 3718
 }
@@ -3724,7 +3724,7 @@  discard block
 block discarded – undo
3724 3724
  * @deprecated 4.5.0
3725 3725
  */
3726 3726
 function comments_popup_script() {
3727
-	_deprecated_function( __FUNCTION__, '4.5.0' );
3727
+	_deprecated_function(__FUNCTION__, '4.5.0');
3728 3728
 }
3729 3729
 
3730 3730
 /**
@@ -3736,8 +3736,8 @@  discard block
 block discarded – undo
3736 3736
  * @param string $text Content to replace links to open in a new window.
3737 3737
  * @return string Content that has filtered links.
3738 3738
  */
3739
-function popuplinks( $text ) {
3740
-	_deprecated_function( __FUNCTION__, '4.5.0' );
3739
+function popuplinks($text) {
3740
+	_deprecated_function(__FUNCTION__, '4.5.0');
3741 3741
 	$text = preg_replace('/<a (.+?)>/i', "<a $1 target='_blank' rel='external'>", $text);
3742 3742
 	return $text;
3743 3743
 }
@@ -3753,8 +3753,8 @@  discard block
 block discarded – undo
3753 3753
  *
3754 3754
  * @return string An empty string.
3755 3755
  */
3756
-function wp_embed_handler_googlevideo( $matches, $attr, $url, $rawattr ) {
3757
-	_deprecated_function( __FUNCTION__, '4.6.0' );
3756
+function wp_embed_handler_googlevideo($matches, $attr, $url, $rawattr) {
3757
+	_deprecated_function(__FUNCTION__, '4.6.0');
3758 3758
 
3759 3759
 	return '';
3760 3760
 }
@@ -3768,9 +3768,9 @@  discard block
 block discarded – undo
3768 3768
  * @return string Full path to paged template file.
3769 3769
  */
3770 3770
 function get_paged_template() {
3771
-	_deprecated_function( __FUNCTION__, '4.7.0' );
3771
+	_deprecated_function(__FUNCTION__, '4.7.0');
3772 3772
 
3773
-	return get_query_template( 'paged' );
3773
+	return get_query_template('paged');
3774 3774
 }
3775 3775
 
3776 3776
 /**
@@ -3793,10 +3793,10 @@  discard block
 block discarded – undo
3793 3793
  * @param string $string
3794 3794
  * @return string
3795 3795
  */
3796
-function wp_kses_js_entities( $string ) {
3797
-	_deprecated_function( __FUNCTION__, '4.7.0' );
3796
+function wp_kses_js_entities($string) {
3797
+	_deprecated_function(__FUNCTION__, '4.7.0');
3798 3798
 
3799
-	return preg_replace( '%&\s*\{[^}]*(\}\s*;?|$)%', '', $string );
3799
+	return preg_replace('%&\s*\{[^}]*(\}\s*;?|$)%', '', $string);
3800 3800
 }
3801 3801
 
3802 3802
 /**
@@ -3813,12 +3813,12 @@  discard block
 block discarded – undo
3813 3813
  * @param object $b
3814 3814
  * @return int
3815 3815
  */
3816
-function _usort_terms_by_ID( $a, $b ) {
3817
-	_deprecated_function( __FUNCTION__, '4.7.0', 'wp_list_sort' );
3816
+function _usort_terms_by_ID($a, $b) {
3817
+	_deprecated_function(__FUNCTION__, '4.7.0', 'wp_list_sort');
3818 3818
 
3819
-	if ( $a->term_id > $b->term_id )
3819
+	if ($a->term_id > $b->term_id)
3820 3820
 		return 1;
3821
-	elseif ( $a->term_id < $b->term_id )
3821
+	elseif ($a->term_id < $b->term_id)
3822 3822
 		return -1;
3823 3823
 	else
3824 3824
 		return 0;
@@ -3838,10 +3838,10 @@  discard block
 block discarded – undo
3838 3838
  * @param object $b
3839 3839
  * @return int
3840 3840
  */
3841
-function _usort_terms_by_name( $a, $b ) {
3842
-	_deprecated_function( __FUNCTION__, '4.7.0', 'wp_list_sort' );
3841
+function _usort_terms_by_name($a, $b) {
3842
+	_deprecated_function(__FUNCTION__, '4.7.0', 'wp_list_sort');
3843 3843
 
3844
-	return strcmp( $a->name, $b->name );
3844
+	return strcmp($a->name, $b->name);
3845 3845
 }
3846 3846
 
3847 3847
 /**
@@ -3857,24 +3857,24 @@  discard block
 block discarded – undo
3857 3857
  * @param object $b The second object to compare
3858 3858
  * @return int -1, 0, or 1 if $a is considered to be respectively less than, equal to, or greater than $b.
3859 3859
  */
3860
-function _sort_nav_menu_items( $a, $b ) {
3860
+function _sort_nav_menu_items($a, $b) {
3861 3861
 	global $_menu_item_sort_prop;
3862 3862
 
3863
-	_deprecated_function( __FUNCTION__, '4.7.0', 'wp_list_sort' );
3863
+	_deprecated_function(__FUNCTION__, '4.7.0', 'wp_list_sort');
3864 3864
 
3865
-	if ( empty( $_menu_item_sort_prop ) )
3865
+	if (empty($_menu_item_sort_prop))
3866 3866
 		return 0;
3867 3867
 
3868
-	if ( ! isset( $a->$_menu_item_sort_prop ) || ! isset( $b->$_menu_item_sort_prop ) )
3868
+	if ( ! isset($a->$_menu_item_sort_prop) || ! isset($b->$_menu_item_sort_prop))
3869 3869
 		return 0;
3870 3870
 
3871 3871
 	$_a = (int) $a->$_menu_item_sort_prop;
3872 3872
 	$_b = (int) $b->$_menu_item_sort_prop;
3873 3873
 
3874
-	if ( $a->$_menu_item_sort_prop == $b->$_menu_item_sort_prop )
3874
+	if ($a->$_menu_item_sort_prop == $b->$_menu_item_sort_prop)
3875 3875
 		return 0;
3876
-	elseif ( $_a == $a->$_menu_item_sort_prop && $_b == $b->$_menu_item_sort_prop )
3876
+	elseif ($_a == $a->$_menu_item_sort_prop && $_b == $b->$_menu_item_sort_prop)
3877 3877
 		return $_a < $_b ? -1 : 1;
3878 3878
 	else
3879
-		return strcmp( $a->$_menu_item_sort_prop, $b->$_menu_item_sort_prop );
3879
+		return strcmp($a->$_menu_item_sort_prop, $b->$_menu_item_sort_prop);
3880 3880
 }
Please login to merge, or discard this patch.
Braces   +401 added lines, -282 removed lines patch added patch discarded remove patch
@@ -86,8 +86,9 @@  discard block
 block discarded – undo
86 86
 	$categories = get_the_category();
87 87
 	$cat = $categories[0]->term_id;
88 88
 
89
-	if ( $echo )
90
-		echo $cat;
89
+	if ( $echo ) {
90
+			echo $cat;
91
+	}
91 92
 
92 93
 	return $cat;
93 94
 }
@@ -136,19 +137,22 @@  discard block
 block discarded – undo
136 137
 
137 138
 	_deprecated_function( __FUNCTION__, '2.0.0', 'previous_post_link()' );
138 139
 
139
-	if ( empty($in_same_cat) || 'no' == $in_same_cat )
140
-		$in_same_cat = false;
141
-	else
142
-		$in_same_cat = true;
140
+	if ( empty($in_same_cat) || 'no' == $in_same_cat ) {
141
+			$in_same_cat = false;
142
+	} else {
143
+			$in_same_cat = true;
144
+	}
143 145
 
144 146
 	$post = get_previous_post($in_same_cat, $excluded_categories);
145 147
 
146
-	if ( !$post )
147
-		return;
148
+	if ( !$post ) {
149
+			return;
150
+	}
148 151
 
149 152
 	$string = '<a href="'.get_permalink($post->ID).'">'.$previous;
150
-	if ( 'yes' == $title )
151
-		$string .= apply_filters('the_title', $post->post_title, $post->ID);
153
+	if ( 'yes' == $title ) {
154
+			$string .= apply_filters('the_title', $post->post_title, $post->ID);
155
+	}
152 156
 	$string .= '</a>';
153 157
 	$format = str_replace('%', $string, $format);
154 158
 	echo $format;
@@ -171,19 +175,22 @@  discard block
 block discarded – undo
171 175
 function next_post($format='%', $next='next post: ', $title='yes', $in_same_cat='no', $limitnext=1, $excluded_categories='') {
172 176
 	_deprecated_function( __FUNCTION__, '2.0.0', 'next_post_link()' );
173 177
 
174
-	if ( empty($in_same_cat) || 'no' == $in_same_cat )
175
-		$in_same_cat = false;
176
-	else
177
-		$in_same_cat = true;
178
+	if ( empty($in_same_cat) || 'no' == $in_same_cat ) {
179
+			$in_same_cat = false;
180
+	} else {
181
+			$in_same_cat = true;
182
+	}
178 183
 
179 184
 	$post = get_next_post($in_same_cat, $excluded_categories);
180 185
 
181
-	if ( !$post	)
182
-		return;
186
+	if ( !$post	) {
187
+			return;
188
+	}
183 189
 
184 190
 	$string = '<a href="'.get_permalink($post->ID).'">'.$next;
185
-	if ( 'yes' == $title )
186
-		$string .= apply_filters('the_title', $post->post_title, $post->ID);
191
+	if ( 'yes' == $title ) {
192
+			$string .= apply_filters('the_title', $post->post_title, $post->ID);
193
+	}
187 194
 	$string .= '</a>';
188 195
 	$format = str_replace('%', $string, $format);
189 196
 	echo $format;
@@ -366,11 +373,12 @@  discard block
 block discarded – undo
366 373
 
367 374
 	$user  = get_userdata($user_id);
368 375
 	$other = get_userdata($other_user);
369
-	if ( $user->user_level > $other->user_level || $user->user_level > 8 || $user->ID == $other->ID )
370
-		return true;
371
-	else
372
-		return false;
373
-}
376
+	if ( $user->user_level > $other->user_level || $user->user_level > 8 || $user->ID == $other->ID ) {
377
+			return true;
378
+	} else {
379
+			return false;
380
+	}
381
+	}
374 382
 
375 383
 /**
376 384
  * Gets the links associated with category $cat_name.
@@ -399,8 +407,9 @@  discard block
 block discarded – undo
399 407
 
400 408
 	$cat_id = -1;
401 409
 	$cat = get_term_by('name', $cat_name, 'link_category');
402
-	if ( $cat )
403
-		$cat_id = $cat->term_id;
410
+	if ( $cat ) {
411
+			$cat_id = $cat->term_id;
412
+	}
404 413
 
405 414
 	get_links($cat_id, $before, $after, $between, $show_images, $orderby, $show_description, $show_rating, $limit, $show_updated);
406 415
 }
@@ -459,8 +468,9 @@  discard block
 block discarded – undo
459 468
 
460 469
 	$cat_id = -1;
461 470
 	$cat = get_term_by('name', $cat_name, 'link_category');
462
-	if ( $cat )
463
-		$cat_id = $cat->term_id;
471
+	if ( $cat ) {
472
+			$cat_id = $cat->term_id;
473
+	}
464 474
 
465 475
 	return get_linkobjects($cat_id, $orderby, $limit);
466 476
 }
@@ -511,8 +521,9 @@  discard block
 block discarded – undo
511 521
 	$links = get_bookmarks( array( 'category' => $category, 'orderby' => $orderby, 'limit' => $limit ) ) ;
512 522
 
513 523
 	$links_array = array();
514
-	foreach ($links as $link)
515
-		$links_array[] = $link;
524
+	foreach ($links as $link) {
525
+			$links_array[] = $link;
526
+	}
516 527
 
517 528
 	return $links_array;
518 529
 }
@@ -638,18 +649,24 @@  discard block
 block discarded – undo
638 649
 	$r = wp_parse_args( $args );
639 650
 
640 651
 	// Map to new names.
641
-	if ( isset($r['optionall']) && isset($r['all']))
642
-		$r['show_option_all'] = $r['all'];
643
-	if ( isset($r['sort_column']) )
644
-		$r['orderby'] = $r['sort_column'];
645
-	if ( isset($r['sort_order']) )
646
-		$r['order'] = $r['sort_order'];
647
-	if ( isset($r['optiondates']) )
648
-		$r['show_last_update'] = $r['optiondates'];
649
-	if ( isset($r['optioncount']) )
650
-		$r['show_count'] = $r['optioncount'];
651
-	if ( isset($r['list']) )
652
-		$r['style'] = $r['list'] ? 'list' : 'break';
652
+	if ( isset($r['optionall']) && isset($r['all'])) {
653
+			$r['show_option_all'] = $r['all'];
654
+	}
655
+	if ( isset($r['sort_column']) ) {
656
+			$r['orderby'] = $r['sort_column'];
657
+	}
658
+	if ( isset($r['sort_order']) ) {
659
+			$r['order'] = $r['sort_order'];
660
+	}
661
+	if ( isset($r['optiondates']) ) {
662
+			$r['show_last_update'] = $r['optiondates'];
663
+	}
664
+	if ( isset($r['optioncount']) ) {
665
+			$r['show_count'] = $r['optioncount'];
666
+	}
667
+	if ( isset($r['list']) ) {
668
+			$r['style'] = $r['list'] ? 'list' : 'break';
669
+	}
653 670
 	$r['title_li'] = '';
654 671
 
655 672
 	return wp_list_categories($r);
@@ -680,12 +697,14 @@  discard block
 block discarded – undo
680 697
 	_deprecated_function( __FUNCTION__, '2.1.0', 'wp_dropdown_categories()' );
681 698
 
682 699
 	$show_option_all = '';
683
-	if ( $optionall )
684
-		$show_option_all = $all;
700
+	if ( $optionall ) {
701
+			$show_option_all = $all;
702
+	}
685 703
 
686 704
 	$show_option_none = '';
687
-	if ( $optionnone )
688
-		$show_option_none = __('None');
705
+	if ( $optionnone ) {
706
+			$show_option_none = __('None');
707
+	}
689 708
 
690 709
 	$vars = compact('show_option_all', 'show_option_none', 'orderby', 'order',
691 710
 					'show_last_update', 'show_count', 'hide_empty', 'selected', 'exclude');
@@ -787,8 +806,9 @@  discard block
 block discarded – undo
787 806
 
788 807
 	$link = get_author_posts_url($author_id, $author_nicename);
789 808
 
790
-	if ( $echo )
791
-		echo $link;
809
+	if ( $echo ) {
810
+			echo $link;
811
+	}
792 812
 	return $link;
793 813
 }
794 814
 
@@ -931,64 +951,78 @@  discard block
 block discarded – undo
931 951
 		$orderby = substr($orderby, 1);
932 952
 	}
933 953
 
934
-	if ( $category == -1 ) //get_bookmarks uses '' to signify all categories
954
+	if ( $category == -1 ) {
955
+		//get_bookmarks uses '' to signify all categories
935 956
 		$category = '';
957
+	}
936 958
 
937 959
 	$results = get_bookmarks(array('category' => $category, 'orderby' => $orderby, 'order' => $order, 'show_updated' => $show_updated, 'limit' => $limit));
938 960
 
939
-	if ( !$results )
940
-		return;
961
+	if ( !$results ) {
962
+			return;
963
+	}
941 964
 
942 965
 	$output = '';
943 966
 
944 967
 	foreach ( (array) $results as $row ) {
945
-		if ( !isset($row->recently_updated) )
946
-			$row->recently_updated = false;
968
+		if ( !isset($row->recently_updated) ) {
969
+					$row->recently_updated = false;
970
+		}
947 971
 		$output .= $before;
948
-		if ( $show_updated && $row->recently_updated )
949
-			$output .= get_option('links_recently_updated_prepend');
972
+		if ( $show_updated && $row->recently_updated ) {
973
+					$output .= get_option('links_recently_updated_prepend');
974
+		}
950 975
 		$the_link = '#';
951
-		if ( !empty($row->link_url) )
952
-			$the_link = esc_url($row->link_url);
976
+		if ( !empty($row->link_url) ) {
977
+					$the_link = esc_url($row->link_url);
978
+		}
953 979
 		$rel = $row->link_rel;
954
-		if ( '' != $rel )
955
-			$rel = ' rel="' . $rel . '"';
980
+		if ( '' != $rel ) {
981
+					$rel = ' rel="' . $rel . '"';
982
+		}
956 983
 
957 984
 		$desc = esc_attr(sanitize_bookmark_field('link_description', $row->link_description, $row->link_id, 'display'));
958 985
 		$name = esc_attr(sanitize_bookmark_field('link_name', $row->link_name, $row->link_id, 'display'));
959 986
 		$title = $desc;
960 987
 
961
-		if ( $show_updated )
962
-			if (substr($row->link_updated_f, 0, 2) != '00')
988
+		if ( $show_updated ) {
989
+					if (substr($row->link_updated_f, 0, 2) != '00')
963 990
 				$title .= ' ('.__('Last updated') . ' ' . date(get_option('links_updated_date_format'), $row->link_updated_f + (get_option('gmt_offset') * HOUR_IN_SECONDS)) . ')';
991
+		}
964 992
 
965
-		if ( '' != $title )
966
-			$title = ' title="' . $title . '"';
993
+		if ( '' != $title ) {
994
+					$title = ' title="' . $title . '"';
995
+		}
967 996
 
968 997
 		$alt = ' alt="' . $name . '"';
969 998
 
970 999
 		$target = $row->link_target;
971
-		if ( '' != $target )
972
-			$target = ' target="' . $target . '"';
1000
+		if ( '' != $target ) {
1001
+					$target = ' target="' . $target . '"';
1002
+		}
973 1003
 
974 1004
 		$output .= '<a href="' . $the_link . '"' . $rel . $title . $target. '>';
975 1005
 
976 1006
 		if ( $row->link_image != null && $show_images ) {
977
-			if ( strpos($row->link_image, 'http') !== false )
978
-				$output .= "<img src=\"$row->link_image\" $alt $title />";
979
-			else // If it's a relative path
1007
+			if ( strpos($row->link_image, 'http') !== false ) {
1008
+							$output .= "<img src=\"$row->link_image\" $alt $title />";
1009
+			} else {
1010
+				// If it's a relative path
980 1011
 				$output .= "<img src=\"" . get_option('siteurl') . "$row->link_image\" $alt $title />";
1012
+			}
981 1013
 		} else {
982 1014
 			$output .= $name;
983 1015
 		}
984 1016
 
985 1017
 		$output .= '</a>';
986 1018
 
987
-		if ( $show_updated && $row->recently_updated )
988
-			$output .= get_option('links_recently_updated_append');
1019
+		if ( $show_updated && $row->recently_updated ) {
1020
+					$output .= get_option('links_recently_updated_append');
1021
+		}
989 1022
 
990
-		if ( $show_description && '' != $desc )
991
-			$output .= $between . $desc;
1023
+		if ( $show_description && '' != $desc ) {
1024
+					$output .= $between . $desc;
1025
+		}
992 1026
 
993 1027
 		if ($show_rating) {
994 1028
 			$output .= $between . get_linkrating($row);
@@ -997,8 +1031,9 @@  discard block
 block discarded – undo
997 1031
 		$output .= "$after\n";
998 1032
 	} // end while
999 1033
 
1000
-	if ( !$echo )
1001
-		return $output;
1034
+	if ( !$echo ) {
1035
+			return $output;
1036
+	}
1002 1037
 	echo $output;
1003 1038
 }
1004 1039
 
@@ -1026,8 +1061,9 @@  discard block
 block discarded – undo
1026 1061
 		$order = substr($order,1);
1027 1062
 	}
1028 1063
 
1029
-	if ( !isset($direction) )
1030
-		$direction = '';
1064
+	if ( !isset($direction) ) {
1065
+			$direction = '';
1066
+	}
1031 1067
 
1032 1068
 	$cats = get_categories(array('type' => 'link', 'orderby' => $order, 'order' => $direction, 'hierarchical' => 0));
1033 1069
 
@@ -1093,13 +1129,15 @@  discard block
 block discarded – undo
1093 1129
 
1094 1130
 	$id = (int) $id;
1095 1131
 
1096
-	if ( empty($id) )
1097
-		return '';
1132
+	if ( empty($id) ) {
1133
+			return '';
1134
+	}
1098 1135
 
1099 1136
 	$cats = wp_get_link_cats($id);
1100 1137
 
1101
-	if ( empty($cats) || ! is_array($cats) )
1102
-		return '';
1138
+	if ( empty($cats) || ! is_array($cats) ) {
1139
+			return '';
1140
+	}
1103 1141
 
1104 1142
 	$cat_id = (int) $cats[0]; // Take the first cat.
1105 1143
 
@@ -1137,8 +1175,9 @@  discard block
 block discarded – undo
1137 1175
 
1138 1176
 	$link = get_category_feed_link($cat_ID, 'rss2');
1139 1177
 
1140
-	if ( $echo )
1141
-		echo $link;
1178
+	if ( $echo ) {
1179
+			echo $link;
1180
+	}
1142 1181
 	return $link;
1143 1182
 }
1144 1183
 
@@ -1157,8 +1196,9 @@  discard block
 block discarded – undo
1157 1196
 	_deprecated_function( __FUNCTION__, '2.5.0', 'get_author_feed_link()' );
1158 1197
 
1159 1198
 	$link = get_author_feed_link($author_id);
1160
-	if ( $echo )
1161
-		echo $link;
1199
+	if ( $echo ) {
1200
+			echo $link;
1201
+	}
1162 1202
 	return $link;
1163 1203
 }
1164 1204
 
@@ -1250,19 +1290,22 @@  discard block
 block discarded – undo
1250 1290
  */
1251 1291
 function get_category_children( $id, $before = '/', $after = '', $visited = array() ) {
1252 1292
 	_deprecated_function( __FUNCTION__, '2.8.0', 'get_term_children()' );
1253
-	if ( 0 == $id )
1254
-		return '';
1293
+	if ( 0 == $id ) {
1294
+			return '';
1295
+	}
1255 1296
 
1256 1297
 	$chain = '';
1257 1298
 	/** TODO: consult hierarchy */
1258 1299
 	$cat_ids = get_all_category_ids();
1259 1300
 	foreach ( (array) $cat_ids as $cat_id ) {
1260
-		if ( $cat_id == $id )
1261
-			continue;
1301
+		if ( $cat_id == $id ) {
1302
+					continue;
1303
+		}
1262 1304
 
1263 1305
 		$category = get_category( $cat_id );
1264
-		if ( is_wp_error( $category ) )
1265
-			return $category;
1306
+		if ( is_wp_error( $category ) ) {
1307
+					return $category;
1308
+		}
1266 1309
 		if ( $category->parent == $id && !in_array( $category->term_id, $visited ) ) {
1267 1310
 			$visited[] = $category->term_id;
1268 1311
 			$chain .= $before.$category->term_id.$after;
@@ -1653,8 +1696,9 @@  discard block
 block discarded – undo
1653 1696
 	_deprecated_function( __FUNCTION__, '2.9.0', 'the_content_feed' );
1654 1697
 	$content = get_the_content($more_link_text, $stripteaser);
1655 1698
 	$content = apply_filters('the_content_rss', $content);
1656
-	if ( $cut && !$encode_html )
1657
-		$encode_html = 2;
1699
+	if ( $cut && !$encode_html ) {
1700
+			$encode_html = 2;
1701
+	}
1658 1702
 	if ( 1== $encode_html ) {
1659 1703
 		$content = esc_html($content);
1660 1704
 		$cut = 0;
@@ -1674,8 +1718,9 @@  discard block
 block discarded – undo
1674 1718
 		}
1675 1719
 
1676 1720
 		/** @todo Check performance, might be faster to use array slice instead. */
1677
-		for ( $i=0; $i<$k; $i++ )
1678
-			$excerpt .= $blah[$i].' ';
1721
+		for ( $i=0; $i<$k; $i++ ) {
1722
+					$excerpt .= $blah[$i].' ';
1723
+		}
1679 1724
 		$excerpt .= ($use_dotdotdot) ? '...' : '';
1680 1725
 		$content = $excerpt;
1681 1726
 	}
@@ -1836,11 +1881,13 @@  discard block
 block discarded – undo
1836 1881
 	$id = (int) $id;
1837 1882
 	$_post = get_post($id);
1838 1883
 
1839
-	if ( ('attachment' != $_post->post_type) || !$url = wp_get_attachment_url($_post->ID) )
1840
-		return __('Missing Attachment');
1884
+	if ( ('attachment' != $_post->post_type) || !$url = wp_get_attachment_url($_post->ID) ) {
1885
+			return __('Missing Attachment');
1886
+	}
1841 1887
 
1842
-	if ( $permalink )
1843
-		$url = get_attachment_link($_post->ID);
1888
+	if ( $permalink ) {
1889
+			$url = get_attachment_link($_post->ID);
1890
+	}
1844 1891
 
1845 1892
 	$post_title = esc_attr($_post->post_title);
1846 1893
 
@@ -1862,8 +1909,9 @@  discard block
 block discarded – undo
1862 1909
 function get_attachment_icon_src( $id = 0, $fullsize = false ) {
1863 1910
 	_deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_image_src()' );
1864 1911
 	$id = (int) $id;
1865
-	if ( !$post = get_post($id) )
1866
-		return false;
1912
+	if ( !$post = get_post($id) ) {
1913
+			return false;
1914
+	}
1867 1915
 
1868 1916
 	$file = get_attached_file( $post->ID );
1869 1917
 
@@ -1883,8 +1931,9 @@  discard block
 block discarded – undo
1883 1931
 		$src_file = $icon_dir . '/' . basename($src);
1884 1932
 	}
1885 1933
 
1886
-	if ( !isset($src) || !$src )
1887
-		return false;
1934
+	if ( !isset($src) || !$src ) {
1935
+			return false;
1936
+	}
1888 1937
 
1889 1938
 	return array($src, $src_file);
1890 1939
 }
@@ -1904,11 +1953,13 @@  discard block
 block discarded – undo
1904 1953
 function get_attachment_icon( $id = 0, $fullsize = false, $max_dims = false ) {
1905 1954
 	_deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_image()' );
1906 1955
 	$id = (int) $id;
1907
-	if ( !$post = get_post($id) )
1908
-		return false;
1956
+	if ( !$post = get_post($id) ) {
1957
+			return false;
1958
+	}
1909 1959
 
1910
-	if ( !$src = get_attachment_icon_src( $post->ID, $fullsize ) )
1911
-		return false;
1960
+	if ( !$src = get_attachment_icon_src( $post->ID, $fullsize ) ) {
1961
+			return false;
1962
+	}
1912 1963
 
1913 1964
 	list($src, $src_file) = $src;
1914 1965
 
@@ -1960,11 +2011,13 @@  discard block
 block discarded – undo
1960 2011
 function get_attachment_innerHTML($id = 0, $fullsize = false, $max_dims = false) {
1961 2012
 	_deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_image()' );
1962 2013
 	$id = (int) $id;
1963
-	if ( !$post = get_post($id) )
1964
-		return false;
2014
+	if ( !$post = get_post($id) ) {
2015
+			return false;
2016
+	}
1965 2017
 
1966
-	if ( $innerHTML = get_attachment_icon($post->ID, $fullsize, $max_dims))
1967
-		return $innerHTML;
2018
+	if ( $innerHTML = get_attachment_icon($post->ID, $fullsize, $max_dims)) {
2019
+			return $innerHTML;
2020
+	}
1968 2021
 
1969 2022
 	$innerHTML = esc_attr($post->post_title);
1970 2023
 
@@ -2023,10 +2076,11 @@  discard block
 block discarded – undo
2023 2076
  * @return string The cleaned $url after the {@see 'clean_url'} filter is applied.
2024 2077
  */
2025 2078
 function clean_url( $url, $protocols = null, $context = 'display' ) {
2026
-	if ( $context == 'db' )
2027
-		_deprecated_function( 'clean_url( $context = \'db\' )', '3.0.0', 'esc_url_raw()' );
2028
-	else
2029
-		_deprecated_function( __FUNCTION__, '3.0.0', 'esc_url()' );
2079
+	if ( $context == 'db' ) {
2080
+			_deprecated_function( 'clean_url( $context = \'db\' )', '3.0.0', 'esc_url_raw()' );
2081
+	} else {
2082
+			_deprecated_function( __FUNCTION__, '3.0.0', 'esc_url()' );
2083
+	}
2030 2084
 	return esc_url( $url, $protocols, $context );
2031 2085
 }
2032 2086
 
@@ -2107,20 +2161,23 @@  discard block
 block discarded – undo
2107 2161
 	_deprecated_function( __FUNCTION__, '2.8.0', 'wp_register_sidebar_widget()' );
2108 2162
 	// Compat
2109 2163
 	if ( is_array($name) ) {
2110
-		if ( count($name) == 3 )
2111
-			$name = sprintf($name[0], $name[2]);
2112
-		else
2113
-			$name = $name[0];
2164
+		if ( count($name) == 3 ) {
2165
+					$name = sprintf($name[0], $name[2]);
2166
+		} else {
2167
+					$name = $name[0];
2168
+		}
2114 2169
 	}
2115 2170
 
2116 2171
 	$id = sanitize_title($name);
2117 2172
 	$options = array();
2118
-	if ( !empty($classname) && is_string($classname) )
2119
-		$options['classname'] = $classname;
2173
+	if ( !empty($classname) && is_string($classname) ) {
2174
+			$options['classname'] = $classname;
2175
+	}
2120 2176
 	$params = array_slice(func_get_args(), 2);
2121 2177
 	$args = array($id, $name, $output_callback, $options);
2122
-	if ( !empty($params) )
2123
-		$args = array_merge($args, $params);
2178
+	if ( !empty($params) ) {
2179
+			$args = array_merge($args, $params);
2180
+	}
2124 2181
 
2125 2182
 	call_user_func_array('wp_register_sidebar_widget', $args);
2126 2183
 }
@@ -2162,22 +2219,26 @@  discard block
 block discarded – undo
2162 2219
 	_deprecated_function( __FUNCTION__, '2.8.0', 'wp_register_widget_control()' );
2163 2220
 	// Compat
2164 2221
 	if ( is_array($name) ) {
2165
-		if ( count($name) == 3 )
2166
-			$name = sprintf($name[0], $name[2]);
2167
-		else
2168
-			$name = $name[0];
2222
+		if ( count($name) == 3 ) {
2223
+					$name = sprintf($name[0], $name[2]);
2224
+		} else {
2225
+					$name = $name[0];
2226
+		}
2169 2227
 	}
2170 2228
 
2171 2229
 	$id = sanitize_title($name);
2172 2230
 	$options = array();
2173
-	if ( !empty($width) )
2174
-		$options['width'] = $width;
2175
-	if ( !empty($height) )
2176
-		$options['height'] = $height;
2231
+	if ( !empty($width) ) {
2232
+			$options['width'] = $width;
2233
+	}
2234
+	if ( !empty($height) ) {
2235
+			$options['height'] = $height;
2236
+	}
2177 2237
 	$params = array_slice(func_get_args(), 4);
2178 2238
 	$args = array($id, $name, $control_callback, $options);
2179
-	if ( !empty($params) )
2180
-		$args = array_merge($args, $params);
2239
+	if ( !empty($params) ) {
2240
+			$args = array_merge($args, $params);
2241
+	}
2181 2242
 
2182 2243
 	call_user_func_array('wp_register_widget_control', $args);
2183 2244
 }
@@ -2211,29 +2272,34 @@  discard block
 block discarded – undo
2211 2272
 function delete_usermeta( $user_id, $meta_key, $meta_value = '' ) {
2212 2273
 	_deprecated_function( __FUNCTION__, '3.0.0', 'delete_user_meta()' );
2213 2274
 	global $wpdb;
2214
-	if ( !is_numeric( $user_id ) )
2215
-		return false;
2275
+	if ( !is_numeric( $user_id ) ) {
2276
+			return false;
2277
+	}
2216 2278
 	$meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);
2217 2279
 
2218
-	if ( is_array($meta_value) || is_object($meta_value) )
2219
-		$meta_value = serialize($meta_value);
2280
+	if ( is_array($meta_value) || is_object($meta_value) ) {
2281
+			$meta_value = serialize($meta_value);
2282
+	}
2220 2283
 	$meta_value = trim( $meta_value );
2221 2284
 
2222 2285
 	$cur = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
2223 2286
 
2224
-	if ( $cur && $cur->umeta_id )
2225
-		do_action( 'delete_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );
2287
+	if ( $cur && $cur->umeta_id ) {
2288
+			do_action( 'delete_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );
2289
+	}
2226 2290
 
2227
-	if ( ! empty($meta_value) )
2228
-		$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s AND meta_value = %s", $user_id, $meta_key, $meta_value) );
2229
-	else
2230
-		$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
2291
+	if ( ! empty($meta_value) ) {
2292
+			$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s AND meta_value = %s", $user_id, $meta_key, $meta_value) );
2293
+	} else {
2294
+			$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
2295
+	}
2231 2296
 
2232 2297
 	clean_user_cache( $user_id );
2233 2298
 	wp_cache_delete( $user_id, 'user_meta' );
2234 2299
 
2235
-	if ( $cur && $cur->umeta_id )
2236
-		do_action( 'deleted_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );
2300
+	if ( $cur && $cur->umeta_id ) {
2301
+			do_action( 'deleted_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );
2302
+	}
2237 2303
 
2238 2304
 	return true;
2239 2305
 }
@@ -2259,35 +2325,39 @@  discard block
 block discarded – undo
2259 2325
 	global $wpdb;
2260 2326
 	$user_id = (int) $user_id;
2261 2327
 
2262
-	if ( !$user_id )
2263
-		return false;
2328
+	if ( !$user_id ) {
2329
+			return false;
2330
+	}
2264 2331
 
2265 2332
 	if ( !empty($meta_key) ) {
2266 2333
 		$meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);
2267 2334
 		$user = wp_cache_get($user_id, 'users');
2268 2335
 		// Check the cached user object
2269
-		if ( false !== $user && isset($user->$meta_key) )
2270
-			$metas = array($user->$meta_key);
2271
-		else
2272
-			$metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
2336
+		if ( false !== $user && isset($user->$meta_key) ) {
2337
+					$metas = array($user->$meta_key);
2338
+		} else {
2339
+					$metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
2340
+		}
2273 2341
 	} else {
2274 2342
 		$metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d", $user_id) );
2275 2343
 	}
2276 2344
 
2277 2345
 	if ( empty($metas) ) {
2278
-		if ( empty($meta_key) )
2279
-			return array();
2280
-		else
2281
-			return '';
2346
+		if ( empty($meta_key) ) {
2347
+					return array();
2348
+		} else {
2349
+					return '';
2350
+		}
2282 2351
 	}
2283 2352
 
2284 2353
 	$metas = array_map('maybe_unserialize', $metas);
2285 2354
 
2286
-	if ( count($metas) == 1 )
2287
-		return $metas[0];
2288
-	else
2289
-		return $metas;
2290
-}
2355
+	if ( count($metas) == 1 ) {
2356
+			return $metas[0];
2357
+	} else {
2358
+			return $metas;
2359
+	}
2360
+	}
2291 2361
 
2292 2362
 /**
2293 2363
  * Update metadata of user.
@@ -2310,13 +2380,15 @@  discard block
 block discarded – undo
2310 2380
 function update_usermeta( $user_id, $meta_key, $meta_value ) {
2311 2381
 	_deprecated_function( __FUNCTION__, '3.0.0', 'update_user_meta()' );
2312 2382
 	global $wpdb;
2313
-	if ( !is_numeric( $user_id ) )
2314
-		return false;
2383
+	if ( !is_numeric( $user_id ) ) {
2384
+			return false;
2385
+	}
2315 2386
 	$meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);
2316 2387
 
2317 2388
 	/** @todo Might need fix because usermeta data is assumed to be already escaped */
2318
-	if ( is_string($meta_value) )
2319
-		$meta_value = stripslashes($meta_value);
2389
+	if ( is_string($meta_value) ) {
2390
+			$meta_value = stripslashes($meta_value);
2391
+	}
2320 2392
 	$meta_value = maybe_serialize($meta_value);
2321 2393
 
2322 2394
 	if (empty($meta_value)) {
@@ -2325,23 +2397,26 @@  discard block
 block discarded – undo
2325 2397
 
2326 2398
 	$cur = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
2327 2399
 
2328
-	if ( $cur )
2329
-		do_action( 'update_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );
2400
+	if ( $cur ) {
2401
+			do_action( 'update_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );
2402
+	}
2330 2403
 
2331
-	if ( !$cur )
2332
-		$wpdb->insert($wpdb->usermeta, compact('user_id', 'meta_key', 'meta_value') );
2333
-	elseif ( $cur->meta_value != $meta_value )
2334
-		$wpdb->update($wpdb->usermeta, compact('meta_value'), compact('user_id', 'meta_key') );
2335
-	else
2336
-		return false;
2404
+	if ( !$cur ) {
2405
+			$wpdb->insert($wpdb->usermeta, compact('user_id', 'meta_key', 'meta_value') );
2406
+	} elseif ( $cur->meta_value != $meta_value ) {
2407
+			$wpdb->update($wpdb->usermeta, compact('meta_value'), compact('user_id', 'meta_key') );
2408
+	} else {
2409
+			return false;
2410
+	}
2337 2411
 
2338 2412
 	clean_user_cache( $user_id );
2339 2413
 	wp_cache_delete( $user_id, 'user_meta' );
2340 2414
 
2341
-	if ( !$cur )
2342
-		do_action( 'added_usermeta', $wpdb->insert_id, $user_id, $meta_key, $meta_value );
2343
-	else
2344
-		do_action( 'updated_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );
2415
+	if ( !$cur ) {
2416
+			do_action( 'added_usermeta', $wpdb->insert_id, $user_id, $meta_key, $meta_value );
2417
+	} else {
2418
+			do_action( 'updated_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );
2419
+	}
2345 2420
 
2346 2421
 	return true;
2347 2422
 }
@@ -2385,10 +2460,12 @@  discard block
 block discarded – undo
2385 2460
 function automatic_feed_links( $add = true ) {
2386 2461
 	_deprecated_function( __FUNCTION__, '3.0.0', "add_theme_support( 'automatic-feed-links' )" );
2387 2462
 
2388
-	if ( $add )
2389
-		add_theme_support( 'automatic-feed-links' );
2390
-	else
2391
-		remove_action( 'wp_head', 'feed_links_extra', 3 ); // Just do this yourself in 3.0+
2463
+	if ( $add ) {
2464
+			add_theme_support( 'automatic-feed-links' );
2465
+	} else {
2466
+			remove_action( 'wp_head', 'feed_links_extra', 3 );
2467
+	}
2468
+	// Just do this yourself in 3.0+
2392 2469
 }
2393 2470
 
2394 2471
 /**
@@ -2459,10 +2536,11 @@  discard block
 block discarded – undo
2459 2536
 	// Fixes for browsers' JavaScript bugs.
2460 2537
 	global $is_macIE, $is_winIE;
2461 2538
 
2462
-	if ( $is_winIE || $is_macIE )
2463
-		$text =  preg_replace_callback("/\%u([0-9A-F]{4,4})/",
2539
+	if ( $is_winIE || $is_macIE ) {
2540
+			$text =  preg_replace_callback("/\%u([0-9A-F]{4,4})/",
2464 2541
 					"funky_javascript_callback",
2465 2542
 					$text);
2543
+	}
2466 2544
 
2467 2545
 	return $text;
2468 2546
 }
@@ -2516,8 +2594,9 @@  discard block
 block discarded – undo
2516 2594
 
2517 2595
 	global $plugin_page;
2518 2596
 
2519
-	if ( isset($plugin_page) )
2520
-		return true;
2597
+	if ( isset($plugin_page) ) {
2598
+			return true;
2599
+	}
2521 2600
 
2522 2601
 	return false;
2523 2602
 }
@@ -2589,8 +2668,9 @@  discard block
 block discarded – undo
2589 2668
 	$objects = array();
2590 2669
 
2591 2670
 	$ids = array_map('intval', $ids);
2592
-	foreach ( $ids as $id )
2593
-		$objects[$id] = array();
2671
+	foreach ( $ids as $id ) {
2672
+			$objects[$id] = array();
2673
+	}
2594 2674
 
2595 2675
 	$metas = update_meta_cache('user', $ids);
2596 2676
 
@@ -2621,21 +2701,25 @@  discard block
 block discarded – undo
2621 2701
 	_deprecated_function( __FUNCTION__, '3.3.0' );
2622 2702
 
2623 2703
 	if ( is_object($user) ) {
2624
-		if ( !isset($user->ID) )
2625
-			$user->ID = 0;
2704
+		if ( !isset($user->ID) ) {
2705
+					$user->ID = 0;
2706
+		}
2626 2707
 		if ( ! ( $user instanceof WP_User ) ) {
2627 2708
 			$vars = get_object_vars($user);
2628 2709
 			foreach ( array_keys($vars) as $field ) {
2629
-				if ( is_string($user->$field) || is_numeric($user->$field) )
2630
-					$user->$field = sanitize_user_field($field, $user->$field, $user->ID, $context);
2710
+				if ( is_string($user->$field) || is_numeric($user->$field) ) {
2711
+									$user->$field = sanitize_user_field($field, $user->$field, $user->ID, $context);
2712
+				}
2631 2713
 			}
2632 2714
 		}
2633 2715
 		$user->filter = $context;
2634 2716
 	} else {
2635
-		if ( !isset($user['ID']) )
2636
-			$user['ID'] = 0;
2637
-		foreach ( array_keys($user) as $field )
2638
-			$user[$field] = sanitize_user_field($field, $user[$field], $user['ID'], $context);
2717
+		if ( !isset($user['ID']) ) {
2718
+					$user['ID'] = 0;
2719
+		}
2720
+		foreach ( array_keys($user) as $field ) {
2721
+					$user[$field] = sanitize_user_field($field, $user[$field], $user['ID'], $context);
2722
+		}
2639 2723
 		$user['filter'] = $context;
2640 2724
 	}
2641 2725
 
@@ -2661,14 +2745,16 @@  discard block
 block discarded – undo
2661 2745
 
2662 2746
 	$posts = get_boundary_post($in_same_cat, $excluded_categories, $start);
2663 2747
 	// If there is no post stop.
2664
-	if ( empty($posts) )
2665
-		return;
2748
+	if ( empty($posts) ) {
2749
+			return;
2750
+	}
2666 2751
 
2667 2752
 	// Even though we limited get_posts to return only 1 item it still returns an array of objects.
2668 2753
 	$post = $posts[0];
2669 2754
 
2670
-	if ( empty($post->post_title) )
2671
-		$post->post_title = $start ? __('First Post') : __('Last Post');
2755
+	if ( empty($post->post_title) ) {
2756
+			$post->post_title = $start ? __('First Post') : __('Last Post');
2757
+	}
2672 2758
 
2673 2759
 	$date = mysql2date(get_option('date_format'), $post->post_date);
2674 2760
 
@@ -2739,11 +2825,13 @@  discard block
 block discarded – undo
2739 2825
 function get_parent_post_rel_link( $title = '%title' ) {
2740 2826
 	_deprecated_function( __FUNCTION__, '3.3.0' );
2741 2827
 
2742
-	if ( ! empty( $GLOBALS['post'] ) && ! empty( $GLOBALS['post']->post_parent ) )
2743
-		$post = get_post($GLOBALS['post']->post_parent);
2828
+	if ( ! empty( $GLOBALS['post'] ) && ! empty( $GLOBALS['post']->post_parent ) ) {
2829
+			$post = get_post($GLOBALS['post']->post_parent);
2830
+	}
2744 2831
 
2745
-	if ( empty($post) )
2746
-		return;
2832
+	if ( empty($post) ) {
2833
+			return;
2834
+	}
2747 2835
 
2748 2836
 	$date = mysql2date(get_option('date_format'), $post->post_date);
2749 2837
 
@@ -2786,12 +2874,13 @@  discard block
 block discarded – undo
2786 2874
 	$user_id = get_current_user_id();
2787 2875
 
2788 2876
 	if ( 0 != $user_id ) {
2789
-		if ( is_admin() )
2790
-			$wp_admin_bar->add_menu( array( 'id' => 'view-site', 'title' => __( 'Visit Site' ), 'href' => home_url() ) );
2791
-		elseif ( is_multisite() )
2792
-			$wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => get_dashboard_url( $user_id ) ) );
2793
-		else
2794
-			$wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => admin_url() ) );
2877
+		if ( is_admin() ) {
2878
+					$wp_admin_bar->add_menu( array( 'id' => 'view-site', 'title' => __( 'Visit Site' ), 'href' => home_url() ) );
2879
+		} elseif ( is_multisite() ) {
2880
+					$wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => get_dashboard_url( $user_id ) ) );
2881
+		} else {
2882
+					$wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => admin_url() ) );
2883
+		}
2795 2884
 	}
2796 2885
 }
2797 2886
 
@@ -2843,9 +2932,10 @@  discard block
 block discarded – undo
2843 2932
  */
2844 2933
 function debug_fwrite( $fp, $string ) {
2845 2934
 	_deprecated_function( __FUNCTION__, 'error_log()' );
2846
-	if ( ! empty( $GLOBALS['debug'] ) )
2847
-		error_log( $string );
2848
-}
2935
+	if ( ! empty( $GLOBALS['debug'] ) ) {
2936
+			error_log( $string );
2937
+	}
2938
+	}
2849 2939
 
2850 2940
 /**
2851 2941
  * Close the debugging file handle.
@@ -2879,18 +2969,20 @@  discard block
 block discarded – undo
2879 2969
 	_deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_themes()' );
2880 2970
 
2881 2971
 	global $wp_themes;
2882
-	if ( isset( $wp_themes ) )
2883
-		return $wp_themes;
2972
+	if ( isset( $wp_themes ) ) {
2973
+			return $wp_themes;
2974
+	}
2884 2975
 
2885 2976
 	$themes = wp_get_themes();
2886 2977
 	$wp_themes = array();
2887 2978
 
2888 2979
 	foreach ( $themes as $theme ) {
2889 2980
 		$name = $theme->get('Name');
2890
-		if ( isset( $wp_themes[ $name ] ) )
2891
-			$wp_themes[ $name . '/' . $theme->get_stylesheet() ] = $theme;
2892
-		else
2893
-			$wp_themes[ $name ] = $theme;
2981
+		if ( isset( $wp_themes[ $name ] ) ) {
2982
+					$wp_themes[ $name . '/' . $theme->get_stylesheet() ] = $theme;
2983
+		} else {
2984
+					$wp_themes[ $name ] = $theme;
2985
+		}
2894 2986
 	}
2895 2987
 
2896 2988
 	return $wp_themes;
@@ -2910,8 +3002,9 @@  discard block
 block discarded – undo
2910 3002
 	_deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme( $stylesheet )' );
2911 3003
 
2912 3004
 	$themes = get_themes();
2913
-	if ( is_array( $themes ) && array_key_exists( $theme, $themes ) )
2914
-		return $themes[ $theme ];
3005
+	if ( is_array( $themes ) && array_key_exists( $theme, $themes ) ) {
3006
+			return $themes[ $theme ];
3007
+	}
2915 3008
 	return null;
2916 3009
 }
2917 3010
 
@@ -2927,8 +3020,9 @@  discard block
 block discarded – undo
2927 3020
 function get_current_theme() {
2928 3021
 	_deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme()' );
2929 3022
 
2930
-	if ( $theme = get_option( 'current_theme' ) )
2931
-		return $theme;
3023
+	if ( $theme = get_option( 'current_theme' ) ) {
3024
+			return $theme;
3025
+	}
2932 3026
 
2933 3027
 	return wp_get_theme()->get('Name');
2934 3028
 }
@@ -2948,10 +3042,11 @@  discard block
 block discarded – undo
2948 3042
 function clean_pre($matches) {
2949 3043
 	_deprecated_function( __FUNCTION__, '3.4.0' );
2950 3044
 
2951
-	if ( is_array($matches) )
2952
-		$text = $matches[1] . $matches[2] . "</pre>";
2953
-	else
2954
-		$text = $matches;
3045
+	if ( is_array($matches) ) {
3046
+			$text = $matches[1] . $matches[2] . "</pre>";
3047
+	} else {
3048
+			$text = $matches;
3049
+	}
2955 3050
 
2956 3051
 	$text = str_replace(array('<br />', '<br/>', '<br>'), array('', '', ''), $text);
2957 3052
 	$text = str_replace('<p>', "\n", $text);
@@ -2978,8 +3073,9 @@  discard block
 block discarded – undo
2978 3073
 		'wp-head-callback'    => $wp_head_callback,
2979 3074
 		'admin-head-callback' => $admin_head_callback,
2980 3075
 	);
2981
-	if ( $admin_preview_callback )
2982
-		$args['admin-preview-callback'] = $admin_preview_callback;
3076
+	if ( $admin_preview_callback ) {
3077
+			$args['admin-preview-callback'] = $admin_preview_callback;
3078
+	}
2983 3079
 	return add_theme_support( 'custom-header', $args );
2984 3080
 }
2985 3081
 
@@ -3011,12 +3107,15 @@  discard block
 block discarded – undo
3011 3107
 function add_custom_background( $wp_head_callback = '', $admin_head_callback = '', $admin_preview_callback = '' ) {
3012 3108
 	_deprecated_function( __FUNCTION__, '3.4.0', 'add_theme_support( \'custom-background\', $args )' );
3013 3109
 	$args = array();
3014
-	if ( $wp_head_callback )
3015
-		$args['wp-head-callback'] = $wp_head_callback;
3016
-	if ( $admin_head_callback )
3017
-		$args['admin-head-callback'] = $admin_head_callback;
3018
-	if ( $admin_preview_callback )
3019
-		$args['admin-preview-callback'] = $admin_preview_callback;
3110
+	if ( $wp_head_callback ) {
3111
+			$args['wp-head-callback'] = $wp_head_callback;
3112
+	}
3113
+	if ( $admin_head_callback ) {
3114
+			$args['admin-head-callback'] = $admin_head_callback;
3115
+	}
3116
+	if ( $admin_preview_callback ) {
3117
+			$args['admin-preview-callback'] = $admin_preview_callback;
3118
+	}
3020 3119
 	return add_theme_support( 'custom-background', $args );
3021 3120
 }
3022 3121
 
@@ -3063,8 +3162,9 @@  discard block
 block discarded – undo
3063 3162
 	);
3064 3163
 
3065 3164
 	foreach ( apply_filters( 'extra_theme_headers', array() ) as $extra_header ) {
3066
-		if ( ! isset( $theme_data[ $extra_header ] ) )
3067
-			$theme_data[ $extra_header ] = $theme->get( $extra_header );
3165
+		if ( ! isset( $theme_data[ $extra_header ] ) ) {
3166
+					$theme_data[ $extra_header ] = $theme->get( $extra_header );
3167
+		}
3068 3168
 	}
3069 3169
 
3070 3170
 	return $theme_data;
@@ -3133,9 +3233,10 @@  discard block
 block discarded – undo
3133 3233
  */
3134 3234
 function sticky_class( $post_id = null ) {
3135 3235
 	_deprecated_function( __FUNCTION__, '3.5.0', 'post_class()' );
3136
-	if ( is_sticky( $post_id ) )
3137
-		echo ' sticky';
3138
-}
3236
+	if ( is_sticky( $post_id ) ) {
3237
+			echo ' sticky';
3238
+	}
3239
+	}
3139 3240
 
3140 3241
 /**
3141 3242
  * Retrieve post ancestors.
@@ -3166,16 +3267,18 @@  discard block
 block discarded – undo
3166 3267
 function wp_load_image( $file ) {
3167 3268
 	_deprecated_function( __FUNCTION__, '3.5.0', 'wp_get_image_editor()' );
3168 3269
 
3169
-	if ( is_numeric( $file ) )
3170
-		$file = get_attached_file( $file );
3270
+	if ( is_numeric( $file ) ) {
3271
+			$file = get_attached_file( $file );
3272
+	}
3171 3273
 
3172 3274
 	if ( ! is_file( $file ) ) {
3173 3275
 		/* translators: %s: file name */
3174 3276
 		return sprintf( __( 'File &#8220;%s&#8221; doesn&#8217;t exist?' ), $file );
3175 3277
 	}
3176 3278
 
3177
-	if ( ! function_exists('imagecreatefromstring') )
3178
-		return __('The GD image library is not installed.');
3279
+	if ( ! function_exists('imagecreatefromstring') ) {
3280
+			return __('The GD image library is not installed.');
3281
+	}
3179 3282
 
3180 3283
 	// Set artificially high because GD uses uncompressed images in memory.
3181 3284
 	wp_raise_memory_limit( 'image' );
@@ -3218,19 +3321,22 @@  discard block
 block discarded – undo
3218 3321
 	_deprecated_function( __FUNCTION__, '3.5.0', 'wp_get_image_editor()' );
3219 3322
 
3220 3323
 	$editor = wp_get_image_editor( $file );
3221
-	if ( is_wp_error( $editor ) )
3222
-		return $editor;
3324
+	if ( is_wp_error( $editor ) ) {
3325
+			return $editor;
3326
+	}
3223 3327
 	$editor->set_quality( $jpeg_quality );
3224 3328
 
3225 3329
 	$resized = $editor->resize( $max_w, $max_h, $crop );
3226
-	if ( is_wp_error( $resized ) )
3227
-		return $resized;
3330
+	if ( is_wp_error( $resized ) ) {
3331
+			return $resized;
3332
+	}
3228 3333
 
3229 3334
 	$dest_file = $editor->generate_filename( $suffix, $dest_path );
3230 3335
 	$saved = $editor->save( $dest_file );
3231 3336
 
3232
-	if ( is_wp_error( $saved ) )
3233
-		return $saved;
3337
+	if ( is_wp_error( $saved ) ) {
3338
+			return $saved;
3339
+	}
3234 3340
 
3235 3341
 	return $dest_file;
3236 3342
 }
@@ -3268,8 +3374,9 @@  discard block
 block discarded – undo
3268 3374
 function user_pass_ok($user_login, $user_pass) {
3269 3375
 	_deprecated_function( __FUNCTION__, '3.5.0', 'wp_authenticate()' );
3270 3376
 	$user = wp_authenticate( $user_login, $user_pass );
3271
-	if ( is_wp_error( $user ) )
3272
-		return false;
3377
+	if ( is_wp_error( $user ) ) {
3378
+			return false;
3379
+	}
3273 3380
 
3274 3381
 	return true;
3275 3382
 }
@@ -3375,8 +3482,9 @@  discard block
 block discarded – undo
3375 3482
 	global $wp_rich_edit_exists;
3376 3483
 	_deprecated_function( __FUNCTION__, '3.9.0' );
3377 3484
 
3378
-	if ( ! isset( $wp_rich_edit_exists ) )
3379
-		$wp_rich_edit_exists = file_exists( ABSPATH . WPINC . '/js/tinymce/tinymce.js' );
3485
+	if ( ! isset( $wp_rich_edit_exists ) ) {
3486
+			$wp_rich_edit_exists = file_exists( ABSPATH . WPINC . '/js/tinymce/tinymce.js' );
3487
+	}
3380 3488
 
3381 3489
 	return $wp_rich_edit_exists;
3382 3490
 }
@@ -3584,8 +3692,10 @@  discard block
 block discarded – undo
3584 3692
 function wp_htmledit_pre($output) {
3585 3693
 	_deprecated_function( __FUNCTION__, '4.3.0', 'format_for_editor()' );
3586 3694
 
3587
-	if ( !empty($output) )
3588
-		$output = htmlspecialchars($output, ENT_NOQUOTES, get_option( 'blog_charset' ) ); // convert only < > &
3695
+	if ( !empty($output) ) {
3696
+			$output = htmlspecialchars($output, ENT_NOQUOTES, get_option( 'blog_charset' ) );
3697
+	}
3698
+	// convert only < > &
3589 3699
 
3590 3700
 	/**
3591 3701
 	 * Filters the text before it is formatted for the HTML editor.
@@ -3635,21 +3745,24 @@  discard block
 block discarded – undo
3635 3745
 
3636 3746
 	@set_time_limit( 60 );
3637 3747
 
3638
-	if ( $red > 5 )
3639
-		return false;
3748
+	if ( $red > 5 ) {
3749
+			return false;
3750
+	}
3640 3751
 
3641 3752
 	$options = array();
3642 3753
 	$options['redirection'] = 5;
3643 3754
 
3644
-	if ( false == $file_path )
3645
-		$options['method'] = 'HEAD';
3646
-	else
3647
-		$options['method'] = 'GET';
3755
+	if ( false == $file_path ) {
3756
+			$options['method'] = 'HEAD';
3757
+	} else {
3758
+			$options['method'] = 'GET';
3759
+	}
3648 3760
 
3649 3761
 	$response = wp_safe_remote_request( $url, $options );
3650 3762
 
3651
-	if ( is_wp_error( $response ) )
3652
-		return false;
3763
+	if ( is_wp_error( $response ) ) {
3764
+			return false;
3765
+	}
3653 3766
 
3654 3767
 	$headers = wp_remote_retrieve_headers( $response );
3655 3768
 	$headers['response'] = wp_remote_retrieve_response_code( $response );
@@ -3659,13 +3772,15 @@  discard block
 block discarded – undo
3659 3772
 		return wp_get_http( $headers['location'], $file_path, ++$red );
3660 3773
 	}
3661 3774
 
3662
-	if ( false == $file_path )
3663
-		return $headers;
3775
+	if ( false == $file_path ) {
3776
+			return $headers;
3777
+	}
3664 3778
 
3665 3779
 	// GET request - write it to the supplied filename
3666 3780
 	$out_fp = fopen($file_path, 'w');
3667
-	if ( !$out_fp )
3668
-		return $headers;
3781
+	if ( !$out_fp ) {
3782
+			return $headers;
3783
+	}
3669 3784
 
3670 3785
 	fwrite( $out_fp,  wp_remote_retrieve_body( $response ) );
3671 3786
 	fclose($out_fp);
@@ -3816,13 +3931,14 @@  discard block
 block discarded – undo
3816 3931
 function _usort_terms_by_ID( $a, $b ) {
3817 3932
 	_deprecated_function( __FUNCTION__, '4.7.0', 'wp_list_sort' );
3818 3933
 
3819
-	if ( $a->term_id > $b->term_id )
3820
-		return 1;
3821
-	elseif ( $a->term_id < $b->term_id )
3822
-		return -1;
3823
-	else
3824
-		return 0;
3825
-}
3934
+	if ( $a->term_id > $b->term_id ) {
3935
+			return 1;
3936
+	} elseif ( $a->term_id < $b->term_id ) {
3937
+			return -1;
3938
+	} else {
3939
+			return 0;
3940
+	}
3941
+	}
3826 3942
 
3827 3943
 /**
3828 3944
  * Sort categories by name.
@@ -3862,19 +3978,22 @@  discard block
 block discarded – undo
3862 3978
 
3863 3979
 	_deprecated_function( __FUNCTION__, '4.7.0', 'wp_list_sort' );
3864 3980
 
3865
-	if ( empty( $_menu_item_sort_prop ) )
3866
-		return 0;
3981
+	if ( empty( $_menu_item_sort_prop ) ) {
3982
+			return 0;
3983
+	}
3867 3984
 
3868
-	if ( ! isset( $a->$_menu_item_sort_prop ) || ! isset( $b->$_menu_item_sort_prop ) )
3869
-		return 0;
3985
+	if ( ! isset( $a->$_menu_item_sort_prop ) || ! isset( $b->$_menu_item_sort_prop ) ) {
3986
+			return 0;
3987
+	}
3870 3988
 
3871 3989
 	$_a = (int) $a->$_menu_item_sort_prop;
3872 3990
 	$_b = (int) $b->$_menu_item_sort_prop;
3873 3991
 
3874
-	if ( $a->$_menu_item_sort_prop == $b->$_menu_item_sort_prop )
3875
-		return 0;
3876
-	elseif ( $_a == $a->$_menu_item_sort_prop && $_b == $b->$_menu_item_sort_prop )
3877
-		return $_a < $_b ? -1 : 1;
3878
-	else
3879
-		return strcmp( $a->$_menu_item_sort_prop, $b->$_menu_item_sort_prop );
3880
-}
3992
+	if ( $a->$_menu_item_sort_prop == $b->$_menu_item_sort_prop ) {
3993
+			return 0;
3994
+	} elseif ( $_a == $a->$_menu_item_sort_prop && $_b == $b->$_menu_item_sort_prop ) {
3995
+			return $_a < $_b ? -1 : 1;
3996
+	} else {
3997
+			return strcmp( $a->$_menu_item_sort_prop, $b->$_menu_item_sort_prop );
3998
+	}
3999
+	}
Please login to merge, or discard this patch.
src/wp-includes/revision.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -432,7 +432,7 @@
 block discarded – undo
432 432
  *
433 433
  * @see get_children()
434 434
  *
435
- * @param int|WP_Post $post_id Optional. Post ID or WP_Post object. Default is global `$post`.
435
+ * @param integer $post_id Optional. Post ID or WP_Post object. Default is global `$post`.
436 436
  * @param array|null  $args    Optional. Arguments for retrieving post revisions. Default null.
437 437
  * @return array An array of revisions, or an empty array if none.
438 438
  */
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -596,11 +596,11 @@
 block discarded – undo
596 596
 	}
597 597
 
598 598
 	if ( empty( $_REQUEST['_thumbnail_id'] ) ||
599
-	     empty( $_REQUEST['preview_id'] ) ||
600
-	     $post->ID != $post_id ||
601
-	     '_thumbnail_id' != $meta_key ||
602
-	     'revision' == $post->post_type ||
603
-	     $post_id != $_REQUEST['preview_id']
599
+		 empty( $_REQUEST['preview_id'] ) ||
600
+		 $post->ID != $post_id ||
601
+		 '_thumbnail_id' != $meta_key ||
602
+		 'revision' == $post->post_type ||
603
+		 $post_id != $_REQUEST['preview_id']
604 604
 	) {
605 605
 		return $value;
606 606
 	}
Please login to merge, or discard this patch.
Spacing   +152 added lines, -152 removed lines patch added patch discarded remove patch
@@ -21,19 +21,19 @@  discard block
 block discarded – undo
21 21
  * @param bool          $deprecated Not used.
22 22
  * @return array Array of fields that can be versioned.
23 23
  */
24
-function _wp_post_revision_fields( $post = array(), $deprecated = false ) {
24
+function _wp_post_revision_fields($post = array(), $deprecated = false) {
25 25
 	static $fields = null;
26 26
 
27
-	if ( ! is_array( $post ) ) {
28
-		$post = get_post( $post, ARRAY_A );
27
+	if ( ! is_array($post)) {
28
+		$post = get_post($post, ARRAY_A);
29 29
 	}
30 30
 
31
-	if ( is_null( $fields ) ) {
31
+	if (is_null($fields)) {
32 32
 		// Allow these to be versioned
33 33
 		$fields = array(
34
-			'post_title' => __( 'Title' ),
35
-			'post_content' => __( 'Content' ),
36
-			'post_excerpt' => __( 'Excerpt' ),
34
+			'post_title' => __('Title'),
35
+			'post_content' => __('Content'),
36
+			'post_excerpt' => __('Excerpt'),
37 37
 		);
38 38
 	}
39 39
 
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
 	 *                      'post_content', and 'post_excerpt' by default.
54 54
 	 * @param array $post   A post array being processed for insertion as a post revision.
55 55
 	 */
56
-	$fields = apply_filters( '_wp_post_revision_fields', $fields, $post );
56
+	$fields = apply_filters('_wp_post_revision_fields', $fields, $post);
57 57
 
58 58
 	// WP uses these internally either in versioning or elsewhere - they cannot be versioned
59
-	foreach ( array( 'ID', 'post_name', 'post_parent', 'post_date', 'post_date_gmt', 'post_status', 'post_type', 'comment_count', 'post_author' ) as $protect ) {
60
-		unset( $fields[ $protect ] );
59
+	foreach (array('ID', 'post_name', 'post_parent', 'post_date', 'post_date_gmt', 'post_status', 'post_type', 'comment_count', 'post_author') as $protect) {
60
+		unset($fields[$protect]);
61 61
 	}
62 62
 
63 63
 
@@ -75,25 +75,25 @@  discard block
 block discarded – undo
75 75
  * @param bool          $autosave Optional. Is the revision an autosave? Default false.
76 76
  * @return array Post array ready to be inserted as a post revision.
77 77
  */
78
-function _wp_post_revision_data( $post = array(), $autosave = false ) {
79
-	if ( ! is_array( $post ) ) {
80
-		$post = get_post( $post, ARRAY_A );
78
+function _wp_post_revision_data($post = array(), $autosave = false) {
79
+	if ( ! is_array($post)) {
80
+		$post = get_post($post, ARRAY_A);
81 81
 	}
82 82
 
83
-	$fields = _wp_post_revision_fields( $post );
83
+	$fields = _wp_post_revision_fields($post);
84 84
 
85 85
 	$revision_data = array();
86 86
 
87
-	foreach ( array_intersect( array_keys( $post ), array_keys( $fields ) ) as $field ) {
88
-		$revision_data[ $field ] = $post[ $field ];
87
+	foreach (array_intersect(array_keys($post), array_keys($fields)) as $field) {
88
+		$revision_data[$field] = $post[$field];
89 89
 	}
90 90
 
91 91
 	$revision_data['post_parent']   = $post['ID'];
92 92
 	$revision_data['post_status']   = 'inherit';
93 93
 	$revision_data['post_type']     = 'revision';
94 94
 	$revision_data['post_name']     = $autosave ? "$post[ID]-autosave-v1" : "$post[ID]-revision-v1"; // "1" is the revisioning system version
95
-	$revision_data['post_date']     = isset( $post['post_modified'] ) ? $post['post_modified'] : '';
96
-	$revision_data['post_date_gmt'] = isset( $post['post_modified_gmt'] ) ? $post['post_modified_gmt'] : '';
95
+	$revision_data['post_date']     = isset($post['post_modified']) ? $post['post_modified'] : '';
96
+	$revision_data['post_date_gmt'] = isset($post['post_modified_gmt']) ? $post['post_modified_gmt'] : '';
97 97
 
98 98
 	return $revision_data;
99 99
 }
@@ -109,29 +109,29 @@  discard block
 block discarded – undo
109 109
  * @param int $post_id The ID of the post to save as a revision.
110 110
  * @return int|WP_Error|void Void or 0 if error, new revision ID, if success.
111 111
  */
112
-function wp_save_post_revision( $post_id ) {
113
-	if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
112
+function wp_save_post_revision($post_id) {
113
+	if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
114 114
 		return;
115 115
 
116
-	if ( ! $post = get_post( $post_id ) )
116
+	if ( ! $post = get_post($post_id))
117 117
 		return;
118 118
 
119
-	if ( ! post_type_supports( $post->post_type, 'revisions' ) )
119
+	if ( ! post_type_supports($post->post_type, 'revisions'))
120 120
 		return;
121 121
 
122
-	if ( 'auto-draft' == $post->post_status )
122
+	if ('auto-draft' == $post->post_status)
123 123
 		return;
124 124
 
125
-	if ( ! wp_revisions_enabled( $post ) )
125
+	if ( ! wp_revisions_enabled($post))
126 126
 		return;
127 127
 
128 128
 	// Compare the proposed update with the last stored revision verifying that
129 129
 	// they are different, unless a plugin tells us to always save regardless.
130 130
 	// If no previous revisions, save one
131
-	if ( $revisions = wp_get_post_revisions( $post_id ) ) {
131
+	if ($revisions = wp_get_post_revisions($post_id)) {
132 132
 		// grab the last revision, but not an autosave
133
-		foreach ( $revisions as $revision ) {
134
-			if ( false !== strpos( $revision->post_name, "{$revision->post_parent}-revision" ) ) {
133
+		foreach ($revisions as $revision) {
134
+			if (false !== strpos($revision->post_name, "{$revision->post_parent}-revision")) {
135 135
 				$last_revision = $revision;
136 136
 				break;
137 137
 			}
@@ -151,11 +151,11 @@  discard block
 block discarded – undo
151 151
 		 * @param WP_Post $post              The post object.
152 152
 		 *
153 153
 		 */
154
-		if ( isset( $last_revision ) && apply_filters( 'wp_save_post_revision_check_for_changes', $check_for_changes = true, $last_revision, $post ) ) {
154
+		if (isset($last_revision) && apply_filters('wp_save_post_revision_check_for_changes', $check_for_changes = true, $last_revision, $post)) {
155 155
 			$post_has_changed = false;
156 156
 
157
-			foreach ( array_keys( _wp_post_revision_fields( $post ) ) as $field ) {
158
-				if ( normalize_whitespace( $post->$field ) != normalize_whitespace( $last_revision->$field ) ) {
157
+			foreach (array_keys(_wp_post_revision_fields($post)) as $field) {
158
+				if (normalize_whitespace($post->$field) != normalize_whitespace($last_revision->$field)) {
159 159
 					$post_has_changed = true;
160 160
 					break;
161 161
 				}
@@ -174,38 +174,38 @@  discard block
 block discarded – undo
174 174
 			 * @param WP_Post $post             The post object.
175 175
 			 *
176 176
 			 */
177
-			$post_has_changed = (bool) apply_filters( 'wp_save_post_revision_post_has_changed', $post_has_changed, $last_revision, $post );
177
+			$post_has_changed = (bool) apply_filters('wp_save_post_revision_post_has_changed', $post_has_changed, $last_revision, $post);
178 178
 
179 179
 			//don't save revision if post unchanged
180
-			if ( ! $post_has_changed ) {
180
+			if ( ! $post_has_changed) {
181 181
 				return;
182 182
 			}
183 183
 		}
184 184
 	}
185 185
 
186
-	$return = _wp_put_post_revision( $post );
186
+	$return = _wp_put_post_revision($post);
187 187
 
188 188
 	// If a limit for the number of revisions to keep has been set,
189 189
 	// delete the oldest ones.
190
-	$revisions_to_keep = wp_revisions_to_keep( $post );
190
+	$revisions_to_keep = wp_revisions_to_keep($post);
191 191
 
192
-	if ( $revisions_to_keep < 0 )
192
+	if ($revisions_to_keep < 0)
193 193
 		return $return;
194 194
 
195
-	$revisions = wp_get_post_revisions( $post_id, array( 'order' => 'ASC' ) );
195
+	$revisions = wp_get_post_revisions($post_id, array('order' => 'ASC'));
196 196
 
197 197
 	$delete = count($revisions) - $revisions_to_keep;
198 198
 
199
-	if ( $delete < 1 )
199
+	if ($delete < 1)
200 200
 		return $return;
201 201
 
202
-	$revisions = array_slice( $revisions, 0, $delete );
202
+	$revisions = array_slice($revisions, 0, $delete);
203 203
 
204
-	for ( $i = 0; isset( $revisions[$i] ); $i++ ) {
205
-		if ( false !== strpos( $revisions[ $i ]->post_name, 'autosave' ) )
204
+	for ($i = 0; isset($revisions[$i]); $i++) {
205
+		if (false !== strpos($revisions[$i]->post_name, 'autosave'))
206 206
 			continue;
207 207
 
208
-		wp_delete_post_revision( $revisions[ $i ]->ID );
208
+		wp_delete_post_revision($revisions[$i]->ID);
209 209
 	}
210 210
 
211 211
 	return $return;
@@ -224,12 +224,12 @@  discard block
 block discarded – undo
224 224
  * @param int $user_id Optional The post author ID.
225 225
  * @return WP_Post|false The autosaved data or false on failure or when no autosave exists.
226 226
  */
227
-function wp_get_post_autosave( $post_id, $user_id = 0 ) {
228
-	$revisions = wp_get_post_revisions( $post_id, array( 'check_enabled' => false ) );
227
+function wp_get_post_autosave($post_id, $user_id = 0) {
228
+	$revisions = wp_get_post_revisions($post_id, array('check_enabled' => false));
229 229
 
230
-	foreach ( $revisions as $revision ) {
231
-		if ( false !== strpos( $revision->post_name, "{$post_id}-autosave" ) ) {
232
-			if ( $user_id && $user_id != $revision->post_author )
230
+	foreach ($revisions as $revision) {
231
+		if (false !== strpos($revision->post_name, "{$post_id}-autosave")) {
232
+			if ($user_id && $user_id != $revision->post_author)
233 233
 				continue;
234 234
 
235 235
 			return $revision;
@@ -247,8 +247,8 @@  discard block
 block discarded – undo
247 247
  * @param int|WP_Post $post Post ID or post object.
248 248
  * @return false|int False if not a revision, ID of revision's parent otherwise.
249 249
  */
250
-function wp_is_post_revision( $post ) {
251
-	if ( !$post = wp_get_post_revision( $post ) )
250
+function wp_is_post_revision($post) {
251
+	if ( ! $post = wp_get_post_revision($post))
252 252
 		return false;
253 253
 
254 254
 	return (int) $post->post_parent;
@@ -262,11 +262,11 @@  discard block
 block discarded – undo
262 262
  * @param int|WP_Post $post Post ID or post object.
263 263
  * @return false|int False if not a revision, ID of autosave's parent otherwise
264 264
  */
265
-function wp_is_post_autosave( $post ) {
266
-	if ( !$post = wp_get_post_revision( $post ) )
265
+function wp_is_post_autosave($post) {
266
+	if ( ! $post = wp_get_post_revision($post))
267 267
 		return false;
268 268
 
269
-	if ( false !== strpos( $post->post_name, "{$post->post_parent}-autosave" ) )
269
+	if (false !== strpos($post->post_name, "{$post->post_parent}-autosave"))
270 270
 		return (int) $post->post_parent;
271 271
 
272 272
 	return false;
@@ -282,26 +282,26 @@  discard block
 block discarded – undo
282 282
  * @param bool                   $autosave Optional. Is the revision an autosave?
283 283
  * @return int|WP_Error WP_Error or 0 if error, new revision ID if success.
284 284
  */
285
-function _wp_put_post_revision( $post = null, $autosave = false ) {
286
-	if ( is_object($post) )
287
-		$post = get_object_vars( $post );
288
-	elseif ( !is_array($post) )
285
+function _wp_put_post_revision($post = null, $autosave = false) {
286
+	if (is_object($post))
287
+		$post = get_object_vars($post);
288
+	elseif ( ! is_array($post))
289 289
 		$post = get_post($post, ARRAY_A);
290 290
 
291
-	if ( ! $post || empty($post['ID']) )
292
-		return new WP_Error( 'invalid_post', __( 'Invalid post ID.' ) );
291
+	if ( ! $post || empty($post['ID']))
292
+		return new WP_Error('invalid_post', __('Invalid post ID.'));
293 293
 
294
-	if ( isset($post['post_type']) && 'revision' == $post['post_type'] )
295
-		return new WP_Error( 'post_type', __( 'Cannot create a revision of a revision' ) );
294
+	if (isset($post['post_type']) && 'revision' == $post['post_type'])
295
+		return new WP_Error('post_type', __('Cannot create a revision of a revision'));
296 296
 
297
-	$post = _wp_post_revision_data( $post, $autosave );
297
+	$post = _wp_post_revision_data($post, $autosave);
298 298
 	$post = wp_slash($post); //since data is from db
299 299
 
300
-	$revision_id = wp_insert_post( $post );
301
-	if ( is_wp_error($revision_id) )
300
+	$revision_id = wp_insert_post($post);
301
+	if (is_wp_error($revision_id))
302 302
 		return $revision_id;
303 303
 
304
-	if ( $revision_id ) {
304
+	if ($revision_id) {
305 305
 		/**
306 306
 		 * Fires once a revision has been saved.
307 307
 		 *
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 		 *
310 310
 		 * @param int $revision_id Post revision ID.
311 311
 		 */
312
-		do_action( '_wp_put_post_revision', $revision_id );
312
+		do_action('_wp_put_post_revision', $revision_id);
313 313
 	}
314 314
 
315 315
 	return $revision_id;
@@ -327,17 +327,17 @@  discard block
 block discarded – undo
327 327
  * @return WP_Post|array|null WP_Post (or array) on success, or null on failure.
328 328
  */
329 329
 function wp_get_post_revision(&$post, $output = OBJECT, $filter = 'raw') {
330
-	if ( !$revision = get_post( $post, OBJECT, $filter ) )
330
+	if ( ! $revision = get_post($post, OBJECT, $filter))
331 331
 		return $revision;
332
-	if ( 'revision' !== $revision->post_type )
332
+	if ('revision' !== $revision->post_type)
333 333
 		return null;
334 334
 
335
-	if ( $output == OBJECT ) {
335
+	if ($output == OBJECT) {
336 336
 		return $revision;
337
-	} elseif ( $output == ARRAY_A ) {
337
+	} elseif ($output == ARRAY_A) {
338 338
 		$_revision = get_object_vars($revision);
339 339
 		return $_revision;
340
-	} elseif ( $output == ARRAY_N ) {
340
+	} elseif ($output == ARRAY_N) {
341 341
 		$_revision = array_values(get_object_vars($revision));
342 342
 		return $_revision;
343 343
 	}
@@ -356,31 +356,31 @@  discard block
 block discarded – undo
356 356
  * @param array       $fields      Optional. What fields to restore from. Defaults to all.
357 357
  * @return int|false|null Null if error, false if no fields to restore, (int) post ID if success.
358 358
  */
359
-function wp_restore_post_revision( $revision_id, $fields = null ) {
360
-	if ( !$revision = wp_get_post_revision( $revision_id, ARRAY_A ) )
359
+function wp_restore_post_revision($revision_id, $fields = null) {
360
+	if ( ! $revision = wp_get_post_revision($revision_id, ARRAY_A))
361 361
 		return $revision;
362 362
 
363
-	if ( !is_array( $fields ) )
364
-		$fields = array_keys( _wp_post_revision_fields( $revision ) );
363
+	if ( ! is_array($fields))
364
+		$fields = array_keys(_wp_post_revision_fields($revision));
365 365
 
366 366
 	$update = array();
367
-	foreach ( array_intersect( array_keys( $revision ), $fields ) as $field ) {
367
+	foreach (array_intersect(array_keys($revision), $fields) as $field) {
368 368
 		$update[$field] = $revision[$field];
369 369
 	}
370 370
 
371
-	if ( !$update )
371
+	if ( ! $update)
372 372
 		return false;
373 373
 
374 374
 	$update['ID'] = $revision['post_parent'];
375 375
 
376
-	$update = wp_slash( $update ); //since data is from db
376
+	$update = wp_slash($update); //since data is from db
377 377
 
378
-	$post_id = wp_update_post( $update );
379
-	if ( ! $post_id || is_wp_error( $post_id ) )
378
+	$post_id = wp_update_post($update);
379
+	if ( ! $post_id || is_wp_error($post_id))
380 380
 		return $post_id;
381 381
 
382 382
 	// Update last edit user
383
-	update_post_meta( $post_id, '_edit_last', get_current_user_id() );
383
+	update_post_meta($post_id, '_edit_last', get_current_user_id());
384 384
 
385 385
 	/**
386 386
 	 * Fires after a post revision has been restored.
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
 	 * @param int $post_id     Post ID.
391 391
 	 * @param int $revision_id Post revision ID.
392 392
 	 */
393
-	do_action( 'wp_restore_post_revision', $post_id, $revision['ID'] );
393
+	do_action('wp_restore_post_revision', $post_id, $revision['ID']);
394 394
 
395 395
 	return $post_id;
396 396
 }
@@ -405,13 +405,13 @@  discard block
 block discarded – undo
405 405
  * @param int|WP_Post $revision_id Revision ID or revision object.
406 406
  * @return array|false|WP_Post|WP_Error|null Null or WP_Error if error, deleted post if success.
407 407
  */
408
-function wp_delete_post_revision( $revision_id ) {
409
-	if ( ! $revision = wp_get_post_revision( $revision_id ) ) {
408
+function wp_delete_post_revision($revision_id) {
409
+	if ( ! $revision = wp_get_post_revision($revision_id)) {
410 410
 		return $revision;
411 411
 	}
412 412
 
413
-	$delete = wp_delete_post( $revision->ID );
414
-	if ( $delete ) {
413
+	$delete = wp_delete_post($revision->ID);
414
+	if ($delete) {
415 415
 		/**
416 416
 		 * Fires once a post revision has been deleted.
417 417
 		 *
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
 		 * @param int          $revision_id Post revision ID.
421 421
 		 * @param object|array $revision    Post revision object or array.
422 422
 		 */
423
-		do_action( 'wp_delete_post_revision', $revision->ID, $revision );
423
+		do_action('wp_delete_post_revision', $revision->ID, $revision);
424 424
 	}
425 425
 
426 426
 	return $delete;
@@ -437,20 +437,20 @@  discard block
 block discarded – undo
437 437
  * @param array|null  $args    Optional. Arguments for retrieving post revisions. Default null.
438 438
  * @return array An array of revisions, or an empty array if none.
439 439
  */
440
-function wp_get_post_revisions( $post_id = 0, $args = null ) {
441
-	$post = get_post( $post_id );
442
-	if ( ! $post || empty( $post->ID ) )
440
+function wp_get_post_revisions($post_id = 0, $args = null) {
441
+	$post = get_post($post_id);
442
+	if ( ! $post || empty($post->ID))
443 443
 		return array();
444 444
 
445
-	$defaults = array( 'order' => 'DESC', 'orderby' => 'date ID', 'check_enabled' => true );
446
-	$args = wp_parse_args( $args, $defaults );
445
+	$defaults = array('order' => 'DESC', 'orderby' => 'date ID', 'check_enabled' => true);
446
+	$args = wp_parse_args($args, $defaults);
447 447
 
448
-	if ( $args['check_enabled'] && ! wp_revisions_enabled( $post ) )
448
+	if ($args['check_enabled'] && ! wp_revisions_enabled($post))
449 449
 		return array();
450 450
 
451
-	$args = array_merge( $args, array( 'post_parent' => $post->ID, 'post_type' => 'revision', 'post_status' => 'inherit' ) );
451
+	$args = array_merge($args, array('post_parent' => $post->ID, 'post_type' => 'revision', 'post_status' => 'inherit'));
452 452
 
453
-	if ( ! $revisions = get_children( $args ) )
453
+	if ( ! $revisions = get_children($args))
454 454
 		return array();
455 455
 
456 456
 	return $revisions;
@@ -464,8 +464,8 @@  discard block
 block discarded – undo
464 464
  * @param WP_Post $post The post object.
465 465
  * @return bool True if number of revisions to keep isn't zero, false otherwise.
466 466
  */
467
-function wp_revisions_enabled( $post ) {
468
-	return wp_revisions_to_keep( $post ) !== 0;
467
+function wp_revisions_enabled($post) {
468
+	return wp_revisions_to_keep($post) !== 0;
469 469
 }
470 470
 
471 471
 /**
@@ -481,15 +481,15 @@  discard block
 block discarded – undo
481 481
  * @param WP_Post $post The post object.
482 482
  * @return int The number of revisions to keep.
483 483
  */
484
-function wp_revisions_to_keep( $post ) {
484
+function wp_revisions_to_keep($post) {
485 485
 	$num = WP_POST_REVISIONS;
486 486
 
487
-	if ( true === $num )
487
+	if (true === $num)
488 488
 		$num = -1;
489 489
 	else
490
-		$num = intval( $num );
490
+		$num = intval($num);
491 491
 
492
-	if ( ! post_type_supports( $post->post_type, 'revisions' ) )
492
+	if ( ! post_type_supports($post->post_type, 'revisions'))
493 493
 		$num = 0;
494 494
 
495 495
 	/**
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
 	 * @param int     $num  Number of revisions to store.
503 503
 	 * @param WP_Post $post Post object.
504 504
 	 */
505
-	return (int) apply_filters( 'wp_revisions_to_keep', $num, $post );
505
+	return (int) apply_filters('wp_revisions_to_keep', $num, $post);
506 506
 }
507 507
 
508 508
 /**
@@ -514,24 +514,24 @@  discard block
 block discarded – undo
514 514
  * @param WP_Post $post
515 515
  * @return WP_Post|false
516 516
  */
517
-function _set_preview( $post ) {
518
-	if ( ! is_object( $post ) ) {
517
+function _set_preview($post) {
518
+	if ( ! is_object($post)) {
519 519
 		return $post;
520 520
 	}
521 521
 
522
-	$preview = wp_get_post_autosave( $post->ID );
523
-	if ( ! is_object( $preview ) ) {
522
+	$preview = wp_get_post_autosave($post->ID);
523
+	if ( ! is_object($preview)) {
524 524
 		return $post;
525 525
 	}
526 526
 
527
-	$preview = sanitize_post( $preview );
527
+	$preview = sanitize_post($preview);
528 528
 
529 529
 	$post->post_content = $preview->post_content;
530 530
 	$post->post_title = $preview->post_title;
531 531
 	$post->post_excerpt = $preview->post_excerpt;
532 532
 
533
-	add_filter( 'get_the_terms', '_wp_preview_terms_filter', 10, 3 );
534
-	add_filter( 'get_post_metadata', '_wp_preview_post_thumbnail_filter', 10, 3 );
533
+	add_filter('get_the_terms', '_wp_preview_terms_filter', 10, 3);
534
+	add_filter('get_post_metadata', '_wp_preview_post_thumbnail_filter', 10, 3);
535 535
 
536 536
 	return $post;
537 537
 }
@@ -543,11 +543,11 @@  discard block
 block discarded – undo
543 543
  * @access private
544 544
  */
545 545
 function _show_post_preview() {
546
-	if ( isset($_GET['preview_id']) && isset($_GET['preview_nonce']) ) {
546
+	if (isset($_GET['preview_id']) && isset($_GET['preview_nonce'])) {
547 547
 		$id = (int) $_GET['preview_id'];
548 548
 
549
-		if ( false === wp_verify_nonce( $_GET['preview_nonce'], 'post_preview_' . $id ) )
550
-			wp_die( __('Sorry, you are not allowed to preview drafts.') );
549
+		if (false === wp_verify_nonce($_GET['preview_nonce'], 'post_preview_'.$id))
550
+			wp_die(__('Sorry, you are not allowed to preview drafts.'));
551 551
 
552 552
 		add_filter('the_preview', '_set_preview');
553 553
 	}
@@ -564,17 +564,17 @@  discard block
 block discarded – undo
564 564
  * @param string $taxonomy
565 565
  * @return array
566 566
  */
567
-function _wp_preview_terms_filter( $terms, $post_id, $taxonomy ) {
568
-	if ( ! $post = get_post() )
567
+function _wp_preview_terms_filter($terms, $post_id, $taxonomy) {
568
+	if ( ! $post = get_post())
569 569
 		return $terms;
570 570
 
571
-	if ( empty( $_REQUEST['post_format'] ) || $post->ID != $post_id || 'post_format' != $taxonomy || 'revision' == $post->post_type )
571
+	if (empty($_REQUEST['post_format']) || $post->ID != $post_id || 'post_format' != $taxonomy || 'revision' == $post->post_type)
572 572
 		return $terms;
573 573
 
574
-	if ( 'standard' == $_REQUEST['post_format'] )
574
+	if ('standard' == $_REQUEST['post_format'])
575 575
 		$terms = array();
576
-	elseif ( $term = get_term_by( 'slug', 'post-format-' . sanitize_key( $_REQUEST['post_format'] ), 'post_format' ) )
577
-		$terms = array( $term ); // Can only have one post format
576
+	elseif ($term = get_term_by('slug', 'post-format-'.sanitize_key($_REQUEST['post_format']), 'post_format'))
577
+		$terms = array($term); // Can only have one post format
578 578
 
579 579
 	return $terms;
580 580
 }
@@ -590,13 +590,13 @@  discard block
 block discarded – undo
590 590
  * @param string            $meta_key Meta key.
591 591
  * @return null|array The default return value or the post thumbnail meta array.
592 592
  */
593
-function _wp_preview_post_thumbnail_filter( $value, $post_id, $meta_key ) {
594
-	if ( ! $post = get_post() ) {
593
+function _wp_preview_post_thumbnail_filter($value, $post_id, $meta_key) {
594
+	if ( ! $post = get_post()) {
595 595
 		return $value;
596 596
 	}
597 597
 
598
-	if ( empty( $_REQUEST['_thumbnail_id'] ) ||
599
-	     empty( $_REQUEST['preview_id'] ) ||
598
+	if (empty($_REQUEST['_thumbnail_id']) ||
599
+	     empty($_REQUEST['preview_id']) ||
600 600
 	     $post->ID != $post_id ||
601 601
 	     '_thumbnail_id' != $meta_key ||
602 602
 	     'revision' == $post->post_type ||
@@ -605,12 +605,12 @@  discard block
 block discarded – undo
605 605
 		return $value;
606 606
 	}
607 607
 
608
-	$thumbnail_id = intval( $_REQUEST['_thumbnail_id'] );
609
-	if ( $thumbnail_id <= 0 ) {
608
+	$thumbnail_id = intval($_REQUEST['_thumbnail_id']);
609
+	if ($thumbnail_id <= 0) {
610 610
 		return '';
611 611
 	}
612 612
 
613
-	return strval( $thumbnail_id );
613
+	return strval($thumbnail_id);
614 614
 }
615 615
 
616 616
 /**
@@ -622,13 +622,13 @@  discard block
 block discarded – undo
622 622
  * @param WP_Post $revision
623 623
  * @return int|false
624 624
  */
625
-function _wp_get_post_revision_version( $revision ) {
626
-	if ( is_object( $revision ) )
627
-		$revision = get_object_vars( $revision );
628
-	elseif ( !is_array( $revision ) )
625
+function _wp_get_post_revision_version($revision) {
626
+	if (is_object($revision))
627
+		$revision = get_object_vars($revision);
628
+	elseif ( ! is_array($revision))
629 629
 		return false;
630 630
 
631
-	if ( preg_match( '/^\d+-(?:autosave|revision)-v(\d+)$/', $revision['post_name'], $matches ) )
631
+	if (preg_match('/^\d+-(?:autosave|revision)-v(\d+)$/', $revision['post_name'], $matches))
632 632
 		return (int) $matches[1];
633 633
 
634 634
 	return 0;
@@ -646,23 +646,23 @@  discard block
 block discarded – undo
646 646
  * @param array   $revisions Current revisions of the post
647 647
  * @return bool true if the revisions were upgraded, false if problems
648 648
  */
649
-function _wp_upgrade_revisions_of_post( $post, $revisions ) {
649
+function _wp_upgrade_revisions_of_post($post, $revisions) {
650 650
 	global $wpdb;
651 651
 
652 652
 	// Add post option exclusively
653 653
 	$lock = "revision-upgrade-{$post->ID}";
654 654
 	$now = time();
655
-	$result = $wpdb->query( $wpdb->prepare( "INSERT IGNORE INTO `$wpdb->options` (`option_name`, `option_value`, `autoload`) VALUES (%s, %s, 'no') /* LOCK */", $lock, $now ) );
656
-	if ( ! $result ) {
655
+	$result = $wpdb->query($wpdb->prepare("INSERT IGNORE INTO `$wpdb->options` (`option_name`, `option_value`, `autoload`) VALUES (%s, %s, 'no') /* LOCK */", $lock, $now));
656
+	if ( ! $result) {
657 657
 		// If we couldn't get a lock, see how old the previous lock is
658
-		$locked = get_option( $lock );
659
-		if ( ! $locked ) {
658
+		$locked = get_option($lock);
659
+		if ( ! $locked) {
660 660
 			// Can't write to the lock, and can't read the lock.
661 661
 			// Something broken has happened
662 662
 			return false;
663 663
 		}
664 664
 
665
-		if ( $locked > $now - 3600 ) {
665
+		if ($locked > $now - 3600) {
666 666
 			// Lock is not too old: some other process may be upgrading this post.  Bail.
667 667
 			return false;
668 668
 		}
@@ -671,57 +671,57 @@  discard block
 block discarded – undo
671 671
 	}
672 672
 
673 673
 	// If we could get a lock, re-"add" the option to fire all the correct filters.
674
-	update_option( $lock, $now );
674
+	update_option($lock, $now);
675 675
 
676
-	reset( $revisions );
676
+	reset($revisions);
677 677
 	$add_last = true;
678 678
 
679 679
 	do {
680
-		$this_revision = current( $revisions );
681
-		$prev_revision = next( $revisions );
680
+		$this_revision = current($revisions);
681
+		$prev_revision = next($revisions);
682 682
 
683
-		$this_revision_version = _wp_get_post_revision_version( $this_revision );
683
+		$this_revision_version = _wp_get_post_revision_version($this_revision);
684 684
 
685 685
 		// Something terrible happened
686
-		if ( false === $this_revision_version )
686
+		if (false === $this_revision_version)
687 687
 			continue;
688 688
 
689 689
 		// 1 is the latest revision version, so we're already up to date.
690 690
 		// No need to add a copy of the post as latest revision.
691
-		if ( 0 < $this_revision_version ) {
691
+		if (0 < $this_revision_version) {
692 692
 			$add_last = false;
693 693
 			continue;
694 694
 		}
695 695
 
696 696
 		// Always update the revision version
697 697
 		$update = array(
698
-			'post_name' => preg_replace( '/^(\d+-(?:autosave|revision))[\d-]*$/', '$1-v1', $this_revision->post_name ),
698
+			'post_name' => preg_replace('/^(\d+-(?:autosave|revision))[\d-]*$/', '$1-v1', $this_revision->post_name),
699 699
 		);
700 700
 
701 701
 		// If this revision is the oldest revision of the post, i.e. no $prev_revision,
702 702
 		// the correct post_author is probably $post->post_author, but that's only a good guess.
703 703
 		// Update the revision version only and Leave the author as-is.
704
-		if ( $prev_revision ) {
705
-			$prev_revision_version = _wp_get_post_revision_version( $prev_revision );
704
+		if ($prev_revision) {
705
+			$prev_revision_version = _wp_get_post_revision_version($prev_revision);
706 706
 
707 707
 			// If the previous revision is already up to date, it no longer has the information we need :(
708
-			if ( $prev_revision_version < 1 )
708
+			if ($prev_revision_version < 1)
709 709
 				$update['post_author'] = $prev_revision->post_author;
710 710
 		}
711 711
 
712 712
 		// Upgrade this revision
713
-		$result = $wpdb->update( $wpdb->posts, $update, array( 'ID' => $this_revision->ID ) );
713
+		$result = $wpdb->update($wpdb->posts, $update, array('ID' => $this_revision->ID));
714 714
 
715
-		if ( $result )
716
-			wp_cache_delete( $this_revision->ID, 'posts' );
715
+		if ($result)
716
+			wp_cache_delete($this_revision->ID, 'posts');
717 717
 
718
-	} while ( $prev_revision );
718
+	} while ($prev_revision);
719 719
 
720
-	delete_option( $lock );
720
+	delete_option($lock);
721 721
 
722 722
 	// Add a copy of the post as latest revision.
723
-	if ( $add_last )
724
-		wp_save_post_revision( $post->ID );
723
+	if ($add_last)
724
+		wp_save_post_revision($post->ID);
725 725
 
726 726
 	return true;
727 727
 }
Please login to merge, or discard this patch.
Braces   +120 added lines, -82 removed lines patch added patch discarded remove patch
@@ -110,20 +110,25 @@  discard block
 block discarded – undo
110 110
  * @return int|WP_Error|void Void or 0 if error, new revision ID, if success.
111 111
  */
112 112
 function wp_save_post_revision( $post_id ) {
113
-	if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
114
-		return;
113
+	if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
114
+			return;
115
+	}
115 116
 
116
-	if ( ! $post = get_post( $post_id ) )
117
-		return;
117
+	if ( ! $post = get_post( $post_id ) ) {
118
+			return;
119
+	}
118 120
 
119
-	if ( ! post_type_supports( $post->post_type, 'revisions' ) )
120
-		return;
121
+	if ( ! post_type_supports( $post->post_type, 'revisions' ) ) {
122
+			return;
123
+	}
121 124
 
122
-	if ( 'auto-draft' == $post->post_status )
123
-		return;
125
+	if ( 'auto-draft' == $post->post_status ) {
126
+			return;
127
+	}
124 128
 
125
-	if ( ! wp_revisions_enabled( $post ) )
126
-		return;
129
+	if ( ! wp_revisions_enabled( $post ) ) {
130
+			return;
131
+	}
127 132
 
128 133
 	// Compare the proposed update with the last stored revision verifying that
129 134
 	// they are different, unless a plugin tells us to always save regardless.
@@ -189,21 +194,24 @@  discard block
 block discarded – undo
189 194
 	// delete the oldest ones.
190 195
 	$revisions_to_keep = wp_revisions_to_keep( $post );
191 196
 
192
-	if ( $revisions_to_keep < 0 )
193
-		return $return;
197
+	if ( $revisions_to_keep < 0 ) {
198
+			return $return;
199
+	}
194 200
 
195 201
 	$revisions = wp_get_post_revisions( $post_id, array( 'order' => 'ASC' ) );
196 202
 
197 203
 	$delete = count($revisions) - $revisions_to_keep;
198 204
 
199
-	if ( $delete < 1 )
200
-		return $return;
205
+	if ( $delete < 1 ) {
206
+			return $return;
207
+	}
201 208
 
202 209
 	$revisions = array_slice( $revisions, 0, $delete );
203 210
 
204 211
 	for ( $i = 0; isset( $revisions[$i] ); $i++ ) {
205
-		if ( false !== strpos( $revisions[ $i ]->post_name, 'autosave' ) )
206
-			continue;
212
+		if ( false !== strpos( $revisions[ $i ]->post_name, 'autosave' ) ) {
213
+					continue;
214
+		}
207 215
 
208 216
 		wp_delete_post_revision( $revisions[ $i ]->ID );
209 217
 	}
@@ -229,8 +237,9 @@  discard block
 block discarded – undo
229 237
 
230 238
 	foreach ( $revisions as $revision ) {
231 239
 		if ( false !== strpos( $revision->post_name, "{$post_id}-autosave" ) ) {
232
-			if ( $user_id && $user_id != $revision->post_author )
233
-				continue;
240
+			if ( $user_id && $user_id != $revision->post_author ) {
241
+							continue;
242
+			}
234 243
 
235 244
 			return $revision;
236 245
 		}
@@ -248,8 +257,9 @@  discard block
 block discarded – undo
248 257
  * @return false|int False if not a revision, ID of revision's parent otherwise.
249 258
  */
250 259
 function wp_is_post_revision( $post ) {
251
-	if ( !$post = wp_get_post_revision( $post ) )
252
-		return false;
260
+	if ( !$post = wp_get_post_revision( $post ) ) {
261
+			return false;
262
+	}
253 263
 
254 264
 	return (int) $post->post_parent;
255 265
 }
@@ -263,11 +273,13 @@  discard block
 block discarded – undo
263 273
  * @return false|int False if not a revision, ID of autosave's parent otherwise
264 274
  */
265 275
 function wp_is_post_autosave( $post ) {
266
-	if ( !$post = wp_get_post_revision( $post ) )
267
-		return false;
276
+	if ( !$post = wp_get_post_revision( $post ) ) {
277
+			return false;
278
+	}
268 279
 
269
-	if ( false !== strpos( $post->post_name, "{$post->post_parent}-autosave" ) )
270
-		return (int) $post->post_parent;
280
+	if ( false !== strpos( $post->post_name, "{$post->post_parent}-autosave" ) ) {
281
+			return (int) $post->post_parent;
282
+	}
271 283
 
272 284
 	return false;
273 285
 }
@@ -283,23 +295,27 @@  discard block
 block discarded – undo
283 295
  * @return int|WP_Error WP_Error or 0 if error, new revision ID if success.
284 296
  */
285 297
 function _wp_put_post_revision( $post = null, $autosave = false ) {
286
-	if ( is_object($post) )
287
-		$post = get_object_vars( $post );
288
-	elseif ( !is_array($post) )
289
-		$post = get_post($post, ARRAY_A);
298
+	if ( is_object($post) ) {
299
+			$post = get_object_vars( $post );
300
+	} elseif ( !is_array($post) ) {
301
+			$post = get_post($post, ARRAY_A);
302
+	}
290 303
 
291
-	if ( ! $post || empty($post['ID']) )
292
-		return new WP_Error( 'invalid_post', __( 'Invalid post ID.' ) );
304
+	if ( ! $post || empty($post['ID']) ) {
305
+			return new WP_Error( 'invalid_post', __( 'Invalid post ID.' ) );
306
+	}
293 307
 
294
-	if ( isset($post['post_type']) && 'revision' == $post['post_type'] )
295
-		return new WP_Error( 'post_type', __( 'Cannot create a revision of a revision' ) );
308
+	if ( isset($post['post_type']) && 'revision' == $post['post_type'] ) {
309
+			return new WP_Error( 'post_type', __( 'Cannot create a revision of a revision' ) );
310
+	}
296 311
 
297 312
 	$post = _wp_post_revision_data( $post, $autosave );
298 313
 	$post = wp_slash($post); //since data is from db
299 314
 
300 315
 	$revision_id = wp_insert_post( $post );
301
-	if ( is_wp_error($revision_id) )
302
-		return $revision_id;
316
+	if ( is_wp_error($revision_id) ) {
317
+			return $revision_id;
318
+	}
303 319
 
304 320
 	if ( $revision_id ) {
305 321
 		/**
@@ -327,10 +343,12 @@  discard block
 block discarded – undo
327 343
  * @return WP_Post|array|null WP_Post (or array) on success, or null on failure.
328 344
  */
329 345
 function wp_get_post_revision(&$post, $output = OBJECT, $filter = 'raw') {
330
-	if ( !$revision = get_post( $post, OBJECT, $filter ) )
331
-		return $revision;
332
-	if ( 'revision' !== $revision->post_type )
333
-		return null;
346
+	if ( !$revision = get_post( $post, OBJECT, $filter ) ) {
347
+			return $revision;
348
+	}
349
+	if ( 'revision' !== $revision->post_type ) {
350
+			return null;
351
+	}
334 352
 
335 353
 	if ( $output == OBJECT ) {
336 354
 		return $revision;
@@ -357,27 +375,31 @@  discard block
 block discarded – undo
357 375
  * @return int|false|null Null if error, false if no fields to restore, (int) post ID if success.
358 376
  */
359 377
 function wp_restore_post_revision( $revision_id, $fields = null ) {
360
-	if ( !$revision = wp_get_post_revision( $revision_id, ARRAY_A ) )
361
-		return $revision;
378
+	if ( !$revision = wp_get_post_revision( $revision_id, ARRAY_A ) ) {
379
+			return $revision;
380
+	}
362 381
 
363
-	if ( !is_array( $fields ) )
364
-		$fields = array_keys( _wp_post_revision_fields( $revision ) );
382
+	if ( !is_array( $fields ) ) {
383
+			$fields = array_keys( _wp_post_revision_fields( $revision ) );
384
+	}
365 385
 
366 386
 	$update = array();
367 387
 	foreach ( array_intersect( array_keys( $revision ), $fields ) as $field ) {
368 388
 		$update[$field] = $revision[$field];
369 389
 	}
370 390
 
371
-	if ( !$update )
372
-		return false;
391
+	if ( !$update ) {
392
+			return false;
393
+	}
373 394
 
374 395
 	$update['ID'] = $revision['post_parent'];
375 396
 
376 397
 	$update = wp_slash( $update ); //since data is from db
377 398
 
378 399
 	$post_id = wp_update_post( $update );
379
-	if ( ! $post_id || is_wp_error( $post_id ) )
380
-		return $post_id;
400
+	if ( ! $post_id || is_wp_error( $post_id ) ) {
401
+			return $post_id;
402
+	}
381 403
 
382 404
 	// Update last edit user
383 405
 	update_post_meta( $post_id, '_edit_last', get_current_user_id() );
@@ -439,19 +461,22 @@  discard block
 block discarded – undo
439 461
  */
440 462
 function wp_get_post_revisions( $post_id = 0, $args = null ) {
441 463
 	$post = get_post( $post_id );
442
-	if ( ! $post || empty( $post->ID ) )
443
-		return array();
464
+	if ( ! $post || empty( $post->ID ) ) {
465
+			return array();
466
+	}
444 467
 
445 468
 	$defaults = array( 'order' => 'DESC', 'orderby' => 'date ID', 'check_enabled' => true );
446 469
 	$args = wp_parse_args( $args, $defaults );
447 470
 
448
-	if ( $args['check_enabled'] && ! wp_revisions_enabled( $post ) )
449
-		return array();
471
+	if ( $args['check_enabled'] && ! wp_revisions_enabled( $post ) ) {
472
+			return array();
473
+	}
450 474
 
451 475
 	$args = array_merge( $args, array( 'post_parent' => $post->ID, 'post_type' => 'revision', 'post_status' => 'inherit' ) );
452 476
 
453
-	if ( ! $revisions = get_children( $args ) )
454
-		return array();
477
+	if ( ! $revisions = get_children( $args ) ) {
478
+			return array();
479
+	}
455 480
 
456 481
 	return $revisions;
457 482
 }
@@ -484,13 +509,15 @@  discard block
 block discarded – undo
484 509
 function wp_revisions_to_keep( $post ) {
485 510
 	$num = WP_POST_REVISIONS;
486 511
 
487
-	if ( true === $num )
488
-		$num = -1;
489
-	else
490
-		$num = intval( $num );
512
+	if ( true === $num ) {
513
+			$num = -1;
514
+	} else {
515
+			$num = intval( $num );
516
+	}
491 517
 
492
-	if ( ! post_type_supports( $post->post_type, 'revisions' ) )
493
-		$num = 0;
518
+	if ( ! post_type_supports( $post->post_type, 'revisions' ) ) {
519
+			$num = 0;
520
+	}
494 521
 
495 522
 	/**
496 523
 	 * Filters the number of revisions to save for the given post.
@@ -546,8 +573,9 @@  discard block
 block discarded – undo
546 573
 	if ( isset($_GET['preview_id']) && isset($_GET['preview_nonce']) ) {
547 574
 		$id = (int) $_GET['preview_id'];
548 575
 
549
-		if ( false === wp_verify_nonce( $_GET['preview_nonce'], 'post_preview_' . $id ) )
550
-			wp_die( __('Sorry, you are not allowed to preview drafts.') );
576
+		if ( false === wp_verify_nonce( $_GET['preview_nonce'], 'post_preview_' . $id ) ) {
577
+					wp_die( __('Sorry, you are not allowed to preview drafts.') );
578
+		}
551 579
 
552 580
 		add_filter('the_preview', '_set_preview');
553 581
 	}
@@ -565,16 +593,20 @@  discard block
 block discarded – undo
565 593
  * @return array
566 594
  */
567 595
 function _wp_preview_terms_filter( $terms, $post_id, $taxonomy ) {
568
-	if ( ! $post = get_post() )
569
-		return $terms;
596
+	if ( ! $post = get_post() ) {
597
+			return $terms;
598
+	}
570 599
 
571
-	if ( empty( $_REQUEST['post_format'] ) || $post->ID != $post_id || 'post_format' != $taxonomy || 'revision' == $post->post_type )
572
-		return $terms;
600
+	if ( empty( $_REQUEST['post_format'] ) || $post->ID != $post_id || 'post_format' != $taxonomy || 'revision' == $post->post_type ) {
601
+			return $terms;
602
+	}
573 603
 
574
-	if ( 'standard' == $_REQUEST['post_format'] )
575
-		$terms = array();
576
-	elseif ( $term = get_term_by( 'slug', 'post-format-' . sanitize_key( $_REQUEST['post_format'] ), 'post_format' ) )
577
-		$terms = array( $term ); // Can only have one post format
604
+	if ( 'standard' == $_REQUEST['post_format'] ) {
605
+			$terms = array();
606
+	} elseif ( $term = get_term_by( 'slug', 'post-format-' . sanitize_key( $_REQUEST['post_format'] ), 'post_format' ) ) {
607
+			$terms = array( $term );
608
+	}
609
+	// Can only have one post format
578 610
 
579 611
 	return $terms;
580 612
 }
@@ -623,13 +655,15 @@  discard block
 block discarded – undo
623 655
  * @return int|false
624 656
  */
625 657
 function _wp_get_post_revision_version( $revision ) {
626
-	if ( is_object( $revision ) )
627
-		$revision = get_object_vars( $revision );
628
-	elseif ( !is_array( $revision ) )
629
-		return false;
658
+	if ( is_object( $revision ) ) {
659
+			$revision = get_object_vars( $revision );
660
+	} elseif ( !is_array( $revision ) ) {
661
+			return false;
662
+	}
630 663
 
631
-	if ( preg_match( '/^\d+-(?:autosave|revision)-v(\d+)$/', $revision['post_name'], $matches ) )
632
-		return (int) $matches[1];
664
+	if ( preg_match( '/^\d+-(?:autosave|revision)-v(\d+)$/', $revision['post_name'], $matches ) ) {
665
+			return (int) $matches[1];
666
+	}
633 667
 
634 668
 	return 0;
635 669
 }
@@ -683,8 +717,9 @@  discard block
 block discarded – undo
683 717
 		$this_revision_version = _wp_get_post_revision_version( $this_revision );
684 718
 
685 719
 		// Something terrible happened
686
-		if ( false === $this_revision_version )
687
-			continue;
720
+		if ( false === $this_revision_version ) {
721
+					continue;
722
+		}
688 723
 
689 724
 		// 1 is the latest revision version, so we're already up to date.
690 725
 		// No need to add a copy of the post as latest revision.
@@ -705,23 +740,26 @@  discard block
 block discarded – undo
705 740
 			$prev_revision_version = _wp_get_post_revision_version( $prev_revision );
706 741
 
707 742
 			// If the previous revision is already up to date, it no longer has the information we need :(
708
-			if ( $prev_revision_version < 1 )
709
-				$update['post_author'] = $prev_revision->post_author;
743
+			if ( $prev_revision_version < 1 ) {
744
+							$update['post_author'] = $prev_revision->post_author;
745
+			}
710 746
 		}
711 747
 
712 748
 		// Upgrade this revision
713 749
 		$result = $wpdb->update( $wpdb->posts, $update, array( 'ID' => $this_revision->ID ) );
714 750
 
715
-		if ( $result )
716
-			wp_cache_delete( $this_revision->ID, 'posts' );
751
+		if ( $result ) {
752
+					wp_cache_delete( $this_revision->ID, 'posts' );
753
+		}
717 754
 
718 755
 	} while ( $prev_revision );
719 756
 
720 757
 	delete_option( $lock );
721 758
 
722 759
 	// Add a copy of the post as latest revision.
723
-	if ( $add_last )
724
-		wp_save_post_revision( $post->ID );
760
+	if ( $add_last ) {
761
+			wp_save_post_revision( $post->ID );
762
+	}
725 763
 
726 764
 	return true;
727 765
 }
Please login to merge, or discard this patch.
src/wp-admin/update.php 2 patches
Spacing   +112 added lines, -112 removed lines patch added patch discarded remove patch
@@ -6,99 +6,99 @@  discard block
 block discarded – undo
6 6
  * @subpackage Administration
7 7
  */
8 8
 
9
-if ( ! defined( 'IFRAME_REQUEST' ) && isset( $_GET['action'] ) && in_array( $_GET['action'], array( 'update-selected', 'activate-plugin', 'update-selected-themes' ) ) )
10
-	define( 'IFRAME_REQUEST', true );
9
+if ( ! defined('IFRAME_REQUEST') && isset($_GET['action']) && in_array($_GET['action'], array('update-selected', 'activate-plugin', 'update-selected-themes')))
10
+	define('IFRAME_REQUEST', true);
11 11
 
12 12
 /** WordPress Administration Bootstrap */
13
-require_once( dirname( __FILE__ ) . '/admin.php' );
13
+require_once(dirname(__FILE__).'/admin.php');
14 14
 
15
-include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
15
+include_once(ABSPATH.'wp-admin/includes/class-wp-upgrader.php');
16 16
 
17
-if ( isset($_GET['action']) ) {
17
+if (isset($_GET['action'])) {
18 18
 	$plugin = isset($_REQUEST['plugin']) ? trim($_REQUEST['plugin']) : '';
19 19
 	$theme = isset($_REQUEST['theme']) ? urldecode($_REQUEST['theme']) : '';
20 20
 	$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
21 21
 
22
-	if ( 'update-selected' == $action ) {
23
-		if ( ! current_user_can( 'update_plugins' ) )
24
-			wp_die( __( 'Sorry, you are not allowed to update plugins for this site.' ) );
22
+	if ('update-selected' == $action) {
23
+		if ( ! current_user_can('update_plugins'))
24
+			wp_die(__('Sorry, you are not allowed to update plugins for this site.'));
25 25
 
26
-		check_admin_referer( 'bulk-update-plugins' );
26
+		check_admin_referer('bulk-update-plugins');
27 27
 
28
-		if ( isset( $_GET['plugins'] ) )
29
-			$plugins = explode( ',', stripslashes($_GET['plugins']) );
30
-		elseif ( isset( $_POST['checked'] ) )
28
+		if (isset($_GET['plugins']))
29
+			$plugins = explode(',', stripslashes($_GET['plugins']));
30
+		elseif (isset($_POST['checked']))
31 31
 			$plugins = (array) $_POST['checked'];
32 32
 		else
33 33
 			$plugins = array();
34 34
 
35 35
 		$plugins = array_map('urldecode', $plugins);
36 36
 
37
-		$url = 'update.php?action=update-selected&amp;plugins=' . urlencode(implode(',', $plugins));
37
+		$url = 'update.php?action=update-selected&amp;plugins='.urlencode(implode(',', $plugins));
38 38
 		$nonce = 'bulk-update-plugins';
39 39
 
40
-		wp_enqueue_script( 'updates' );
40
+		wp_enqueue_script('updates');
41 41
 		iframe_header();
42 42
 
43
-		$upgrader = new Plugin_Upgrader( new Bulk_Plugin_Upgrader_Skin( compact( 'nonce', 'url' ) ) );
44
-		$upgrader->bulk_upgrade( $plugins );
43
+		$upgrader = new Plugin_Upgrader(new Bulk_Plugin_Upgrader_Skin(compact('nonce', 'url')));
44
+		$upgrader->bulk_upgrade($plugins);
45 45
 
46 46
 		iframe_footer();
47 47
 
48
-	} elseif ( 'upgrade-plugin' == $action ) {
49
-		if ( ! current_user_can('update_plugins') )
48
+	} elseif ('upgrade-plugin' == $action) {
49
+		if ( ! current_user_can('update_plugins'))
50 50
 			wp_die(__('Sorry, you are not allowed to update plugins for this site.'));
51 51
 
52
-		check_admin_referer('upgrade-plugin_' . $plugin);
52
+		check_admin_referer('upgrade-plugin_'.$plugin);
53 53
 
54 54
 		$title = __('Update Plugin');
55 55
 		$parent_file = 'plugins.php';
56 56
 		$submenu_file = 'plugins.php';
57 57
 
58
-		wp_enqueue_script( 'updates' );
59
-		require_once(ABSPATH . 'wp-admin/admin-header.php');
58
+		wp_enqueue_script('updates');
59
+		require_once(ABSPATH.'wp-admin/admin-header.php');
60 60
 
61
-		$nonce = 'upgrade-plugin_' . $plugin;
62
-		$url = 'update.php?action=upgrade-plugin&plugin=' . urlencode( $plugin );
61
+		$nonce = 'upgrade-plugin_'.$plugin;
62
+		$url = 'update.php?action=upgrade-plugin&plugin='.urlencode($plugin);
63 63
 
64
-		$upgrader = new Plugin_Upgrader( new Plugin_Upgrader_Skin( compact('title', 'nonce', 'url', 'plugin') ) );
64
+		$upgrader = new Plugin_Upgrader(new Plugin_Upgrader_Skin(compact('title', 'nonce', 'url', 'plugin')));
65 65
 		$upgrader->upgrade($plugin);
66 66
 
67
-		include(ABSPATH . 'wp-admin/admin-footer.php');
67
+		include(ABSPATH.'wp-admin/admin-footer.php');
68 68
 
69
-	} elseif ('activate-plugin' == $action ) {
70
-		if ( ! current_user_can('update_plugins') )
69
+	} elseif ('activate-plugin' == $action) {
70
+		if ( ! current_user_can('update_plugins'))
71 71
 			wp_die(__('Sorry, you are not allowed to update plugins for this site.'));
72 72
 
73
-		check_admin_referer('activate-plugin_' . $plugin);
74
-		if ( ! isset($_GET['failure']) && ! isset($_GET['success']) ) {
75
-			wp_redirect( admin_url('update.php?action=activate-plugin&failure=true&plugin=' . urlencode( $plugin ) . '&_wpnonce=' . $_GET['_wpnonce']) );
76
-			activate_plugin( $plugin, '', ! empty( $_GET['networkwide'] ), true );
77
-			wp_redirect( admin_url('update.php?action=activate-plugin&success=true&plugin=' . urlencode( $plugin ) . '&_wpnonce=' . $_GET['_wpnonce']) );
73
+		check_admin_referer('activate-plugin_'.$plugin);
74
+		if ( ! isset($_GET['failure']) && ! isset($_GET['success'])) {
75
+			wp_redirect(admin_url('update.php?action=activate-plugin&failure=true&plugin='.urlencode($plugin).'&_wpnonce='.$_GET['_wpnonce']));
76
+			activate_plugin($plugin, '', ! empty($_GET['networkwide']), true);
77
+			wp_redirect(admin_url('update.php?action=activate-plugin&success=true&plugin='.urlencode($plugin).'&_wpnonce='.$_GET['_wpnonce']));
78 78
 			die();
79 79
 		}
80
-		iframe_header( __('Plugin Reactivation'), true );
81
-		if ( isset($_GET['success']) )
82
-			echo '<p>' . __('Plugin reactivated successfully.') . '</p>';
80
+		iframe_header(__('Plugin Reactivation'), true);
81
+		if (isset($_GET['success']))
82
+			echo '<p>'.__('Plugin reactivated successfully.').'</p>';
83 83
 
84
-		if ( isset($_GET['failure']) ){
85
-			echo '<p>' . __('Plugin failed to reactivate due to a fatal error.') . '</p>';
84
+		if (isset($_GET['failure'])) {
85
+			echo '<p>'.__('Plugin failed to reactivate due to a fatal error.').'</p>';
86 86
 
87
-			error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR );
87
+			error_reporting(E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR);
88 88
 			@ini_set('display_errors', true); //Ensure that Fatal errors are displayed.
89
-			wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . $plugin );
90
-			include( WP_PLUGIN_DIR . '/' . $plugin );
89
+			wp_register_plugin_realpath(WP_PLUGIN_DIR.'/'.$plugin);
90
+			include(WP_PLUGIN_DIR.'/'.$plugin);
91 91
 		}
92 92
 		iframe_footer();
93
-	} elseif ( 'install-plugin' == $action ) {
93
+	} elseif ('install-plugin' == $action) {
94 94
 
95
-		if ( ! current_user_can('install_plugins') )
96
-			wp_die( __( 'Sorry, you are not allowed to install plugins on this site.' ) );
95
+		if ( ! current_user_can('install_plugins'))
96
+			wp_die(__('Sorry, you are not allowed to install plugins on this site.'));
97 97
 
98
-		include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api..
98
+		include_once(ABSPATH.'wp-admin/includes/plugin-install.php'); //for plugins_api..
99 99
 
100
-		check_admin_referer( 'install-plugin_' . $plugin );
101
-		$api = plugins_api( 'plugin_information', array(
100
+		check_admin_referer('install-plugin_'.$plugin);
101
+		$api = plugins_api('plugin_information', array(
102 102
 			'slug' => $plugin,
103 103
 			'fields' => array(
104 104
 				'short_description' => false,
@@ -114,34 +114,34 @@  discard block
 block discarded – undo
114 114
 				'homepage' => false,
115 115
 				'donate_link' => false,
116 116
 			),
117
-		) );
117
+		));
118 118
 
119
-		if ( is_wp_error( $api ) ) {
120
-	 		wp_die( $api );
119
+		if (is_wp_error($api)) {
120
+	 		wp_die($api);
121 121
 		}
122 122
 
123 123
 		$title = __('Plugin Install');
124 124
 		$parent_file = 'plugins.php';
125 125
 		$submenu_file = 'plugin-install.php';
126
-		require_once(ABSPATH . 'wp-admin/admin-header.php');
126
+		require_once(ABSPATH.'wp-admin/admin-header.php');
127 127
 
128
-		$title = sprintf( __('Installing Plugin: %s'), $api->name . ' ' . $api->version );
129
-		$nonce = 'install-plugin_' . $plugin;
130
-		$url = 'update.php?action=install-plugin&plugin=' . urlencode( $plugin );
131
-		if ( isset($_GET['from']) )
132
-			$url .= '&from=' . urlencode(stripslashes($_GET['from']));
128
+		$title = sprintf(__('Installing Plugin: %s'), $api->name.' '.$api->version);
129
+		$nonce = 'install-plugin_'.$plugin;
130
+		$url = 'update.php?action=install-plugin&plugin='.urlencode($plugin);
131
+		if (isset($_GET['from']))
132
+			$url .= '&from='.urlencode(stripslashes($_GET['from']));
133 133
 
134 134
 		$type = 'web'; //Install plugin type, From Web or an Upload.
135 135
 
136
-		$upgrader = new Plugin_Upgrader( new Plugin_Installer_Skin( compact('title', 'url', 'nonce', 'plugin', 'api') ) );
136
+		$upgrader = new Plugin_Upgrader(new Plugin_Installer_Skin(compact('title', 'url', 'nonce', 'plugin', 'api')));
137 137
 		$upgrader->install($api->download_link);
138 138
 
139
-		include(ABSPATH . 'wp-admin/admin-footer.php');
139
+		include(ABSPATH.'wp-admin/admin-footer.php');
140 140
 
141
-	} elseif ( 'upload-plugin' == $action ) {
141
+	} elseif ('upload-plugin' == $action) {
142 142
 
143
-		if ( ! current_user_can( 'upload_plugins' ) ) {
144
-			wp_die( __( 'Sorry, you are not allowed to install plugins on this site.' ) );
143
+		if ( ! current_user_can('upload_plugins')) {
144
+			wp_die(__('Sorry, you are not allowed to install plugins on this site.'));
145 145
 		}
146 146
 
147 147
 		check_admin_referer('plugin-upload');
@@ -151,128 +151,128 @@  discard block
 block discarded – undo
151 151
 		$title = __('Upload Plugin');
152 152
 		$parent_file = 'plugins.php';
153 153
 		$submenu_file = 'plugin-install.php';
154
-		require_once(ABSPATH . 'wp-admin/admin-header.php');
154
+		require_once(ABSPATH.'wp-admin/admin-header.php');
155 155
 
156
-		$title = sprintf( __('Installing Plugin from uploaded file: %s'), esc_html( basename( $file_upload->filename ) ) );
156
+		$title = sprintf(__('Installing Plugin from uploaded file: %s'), esc_html(basename($file_upload->filename)));
157 157
 		$nonce = 'plugin-upload';
158 158
 		$url = add_query_arg(array('package' => $file_upload->id), 'update.php?action=upload-plugin');
159 159
 		$type = 'upload'; //Install plugin type, From Web or an Upload.
160 160
 
161
-		$upgrader = new Plugin_Upgrader( new Plugin_Installer_Skin( compact('type', 'title', 'nonce', 'url') ) );
162
-		$result = $upgrader->install( $file_upload->package );
161
+		$upgrader = new Plugin_Upgrader(new Plugin_Installer_Skin(compact('type', 'title', 'nonce', 'url')));
162
+		$result = $upgrader->install($file_upload->package);
163 163
 
164
-		if ( $result || is_wp_error($result) )
164
+		if ($result || is_wp_error($result))
165 165
 			$file_upload->cleanup();
166 166
 
167
-		include(ABSPATH . 'wp-admin/admin-footer.php');
167
+		include(ABSPATH.'wp-admin/admin-footer.php');
168 168
 
169
-	} elseif ( 'upgrade-theme' == $action ) {
169
+	} elseif ('upgrade-theme' == $action) {
170 170
 
171
-		if ( ! current_user_can('update_themes') )
171
+		if ( ! current_user_can('update_themes'))
172 172
 			wp_die(__('Sorry, you are not allowed to update themes for this site.'));
173 173
 
174
-		check_admin_referer('upgrade-theme_' . $theme);
174
+		check_admin_referer('upgrade-theme_'.$theme);
175 175
 
176
-		wp_enqueue_script( 'customize-loader' );
177
-		wp_enqueue_script( 'updates' );
176
+		wp_enqueue_script('customize-loader');
177
+		wp_enqueue_script('updates');
178 178
 
179 179
 		$title = __('Update Theme');
180 180
 		$parent_file = 'themes.php';
181 181
 		$submenu_file = 'themes.php';
182
-		require_once(ABSPATH . 'wp-admin/admin-header.php');
182
+		require_once(ABSPATH.'wp-admin/admin-header.php');
183 183
 
184
-		$nonce = 'upgrade-theme_' . $theme;
185
-		$url = 'update.php?action=upgrade-theme&theme=' . urlencode( $theme );
184
+		$nonce = 'upgrade-theme_'.$theme;
185
+		$url = 'update.php?action=upgrade-theme&theme='.urlencode($theme);
186 186
 
187
-		$upgrader = new Theme_Upgrader( new Theme_Upgrader_Skin( compact('title', 'nonce', 'url', 'theme') ) );
187
+		$upgrader = new Theme_Upgrader(new Theme_Upgrader_Skin(compact('title', 'nonce', 'url', 'theme')));
188 188
 		$upgrader->upgrade($theme);
189 189
 
190
-		include(ABSPATH . 'wp-admin/admin-footer.php');
191
-	} elseif ( 'update-selected-themes' == $action ) {
192
-		if ( ! current_user_can( 'update_themes' ) )
193
-			wp_die( __( 'Sorry, you are not allowed to update themes for this site.' ) );
190
+		include(ABSPATH.'wp-admin/admin-footer.php');
191
+	} elseif ('update-selected-themes' == $action) {
192
+		if ( ! current_user_can('update_themes'))
193
+			wp_die(__('Sorry, you are not allowed to update themes for this site.'));
194 194
 
195
-		check_admin_referer( 'bulk-update-themes' );
195
+		check_admin_referer('bulk-update-themes');
196 196
 
197
-		if ( isset( $_GET['themes'] ) )
198
-			$themes = explode( ',', stripslashes($_GET['themes']) );
199
-		elseif ( isset( $_POST['checked'] ) )
197
+		if (isset($_GET['themes']))
198
+			$themes = explode(',', stripslashes($_GET['themes']));
199
+		elseif (isset($_POST['checked']))
200 200
 			$themes = (array) $_POST['checked'];
201 201
 		else
202 202
 			$themes = array();
203 203
 
204 204
 		$themes = array_map('urldecode', $themes);
205 205
 
206
-		$url = 'update.php?action=update-selected-themes&amp;themes=' . urlencode(implode(',', $themes));
206
+		$url = 'update.php?action=update-selected-themes&amp;themes='.urlencode(implode(',', $themes));
207 207
 		$nonce = 'bulk-update-themes';
208 208
 
209
-		wp_enqueue_script( 'updates' );
209
+		wp_enqueue_script('updates');
210 210
 		iframe_header();
211 211
 
212
-		$upgrader = new Theme_Upgrader( new Bulk_Theme_Upgrader_Skin( compact( 'nonce', 'url' ) ) );
213
-		$upgrader->bulk_upgrade( $themes );
212
+		$upgrader = new Theme_Upgrader(new Bulk_Theme_Upgrader_Skin(compact('nonce', 'url')));
213
+		$upgrader->bulk_upgrade($themes);
214 214
 
215 215
 		iframe_footer();
216
-	} elseif ( 'install-theme' == $action ) {
216
+	} elseif ('install-theme' == $action) {
217 217
 
218
-		if ( ! current_user_can('install_themes') )
219
-			wp_die( __( 'Sorry, you are not allowed to install themes on this site.' ) );
218
+		if ( ! current_user_can('install_themes'))
219
+			wp_die(__('Sorry, you are not allowed to install themes on this site.'));
220 220
 
221
-		include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ); //for themes_api..
221
+		include_once(ABSPATH.'wp-admin/includes/class-wp-upgrader.php'); //for themes_api..
222 222
 
223
-		check_admin_referer( 'install-theme_' . $theme );
224
-		$api = themes_api('theme_information', array('slug' => $theme, 'fields' => array('sections' => false, 'tags' => false) ) ); //Save on a bit of bandwidth.
223
+		check_admin_referer('install-theme_'.$theme);
224
+		$api = themes_api('theme_information', array('slug' => $theme, 'fields' => array('sections' => false, 'tags' => false))); //Save on a bit of bandwidth.
225 225
 
226
-		if ( is_wp_error($api) )
226
+		if (is_wp_error($api))
227 227
 	 		wp_die($api);
228 228
 
229
-		wp_enqueue_script( 'customize-loader' );
229
+		wp_enqueue_script('customize-loader');
230 230
 
231 231
 		$title = __('Install Themes');
232 232
 		$parent_file = 'themes.php';
233 233
 		$submenu_file = 'themes.php';
234
-		require_once(ABSPATH . 'wp-admin/admin-header.php');
234
+		require_once(ABSPATH.'wp-admin/admin-header.php');
235 235
 
236
-		$title = sprintf( __('Installing Theme: %s'), $api->name . ' ' . $api->version );
237
-		$nonce = 'install-theme_' . $theme;
238
-		$url = 'update.php?action=install-theme&theme=' . urlencode( $theme );
236
+		$title = sprintf(__('Installing Theme: %s'), $api->name.' '.$api->version);
237
+		$nonce = 'install-theme_'.$theme;
238
+		$url = 'update.php?action=install-theme&theme='.urlencode($theme);
239 239
 		$type = 'web'; //Install theme type, From Web or an Upload.
240 240
 
241
-		$upgrader = new Theme_Upgrader( new Theme_Installer_Skin( compact('title', 'url', 'nonce', 'plugin', 'api') ) );
241
+		$upgrader = new Theme_Upgrader(new Theme_Installer_Skin(compact('title', 'url', 'nonce', 'plugin', 'api')));
242 242
 		$upgrader->install($api->download_link);
243 243
 
244
-		include(ABSPATH . 'wp-admin/admin-footer.php');
244
+		include(ABSPATH.'wp-admin/admin-footer.php');
245 245
 
246
-	} elseif ( 'upload-theme' == $action ) {
246
+	} elseif ('upload-theme' == $action) {
247 247
 
248
-		if ( ! current_user_can( 'upload_themes' ) ) {
249
-			wp_die( __( 'Sorry, you are not allowed to install themes on this site.' ) );
248
+		if ( ! current_user_can('upload_themes')) {
249
+			wp_die(__('Sorry, you are not allowed to install themes on this site.'));
250 250
 		}
251 251
 
252 252
 		check_admin_referer('theme-upload');
253 253
 
254 254
 		$file_upload = new File_Upload_Upgrader('themezip', 'package');
255 255
 
256
-		wp_enqueue_script( 'customize-loader' );
256
+		wp_enqueue_script('customize-loader');
257 257
 
258 258
 		$title = __('Upload Theme');
259 259
 		$parent_file = 'themes.php';
260 260
 		$submenu_file = 'theme-install.php';
261 261
 
262
-		require_once(ABSPATH . 'wp-admin/admin-header.php');
262
+		require_once(ABSPATH.'wp-admin/admin-header.php');
263 263
 
264
-		$title = sprintf( __('Installing Theme from uploaded file: %s'), esc_html( basename( $file_upload->filename ) ) );
264
+		$title = sprintf(__('Installing Theme from uploaded file: %s'), esc_html(basename($file_upload->filename)));
265 265
 		$nonce = 'theme-upload';
266 266
 		$url = add_query_arg(array('package' => $file_upload->id), 'update.php?action=upload-theme');
267 267
 		$type = 'upload'; //Install plugin type, From Web or an Upload.
268 268
 
269
-		$upgrader = new Theme_Upgrader( new Theme_Installer_Skin( compact('type', 'title', 'nonce', 'url') ) );
270
-		$result = $upgrader->install( $file_upload->package );
269
+		$upgrader = new Theme_Upgrader(new Theme_Installer_Skin(compact('type', 'title', 'nonce', 'url')));
270
+		$result = $upgrader->install($file_upload->package);
271 271
 
272
-		if ( $result || is_wp_error($result) )
272
+		if ($result || is_wp_error($result))
273 273
 			$file_upload->cleanup();
274 274
 
275
-		include(ABSPATH . 'wp-admin/admin-footer.php');
275
+		include(ABSPATH.'wp-admin/admin-footer.php');
276 276
 
277 277
 	} else {
278 278
 		/**
@@ -284,6 +284,6 @@  discard block
 block discarded – undo
284 284
 		 *
285 285
 		 * @since 2.8.0
286 286
 		 */
287
-		do_action( "update-custom_{$action}" );
287
+		do_action("update-custom_{$action}");
288 288
 	}
289 289
 }
Please login to merge, or discard this patch.
Braces   +52 added lines, -37 removed lines patch added patch discarded remove patch
@@ -6,8 +6,9 @@  discard block
 block discarded – undo
6 6
  * @subpackage Administration
7 7
  */
8 8
 
9
-if ( ! defined( 'IFRAME_REQUEST' ) && isset( $_GET['action'] ) && in_array( $_GET['action'], array( 'update-selected', 'activate-plugin', 'update-selected-themes' ) ) )
9
+if ( ! defined( 'IFRAME_REQUEST' ) && isset( $_GET['action'] ) && in_array( $_GET['action'], array( 'update-selected', 'activate-plugin', 'update-selected-themes' ) ) ) {
10 10
 	define( 'IFRAME_REQUEST', true );
11
+}
11 12
 
12 13
 /** WordPress Administration Bootstrap */
13 14
 require_once( dirname( __FILE__ ) . '/admin.php' );
@@ -20,17 +21,19 @@  discard block
 block discarded – undo
20 21
 	$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
21 22
 
22 23
 	if ( 'update-selected' == $action ) {
23
-		if ( ! current_user_can( 'update_plugins' ) )
24
-			wp_die( __( 'Sorry, you are not allowed to update plugins for this site.' ) );
24
+		if ( ! current_user_can( 'update_plugins' ) ) {
25
+					wp_die( __( 'Sorry, you are not allowed to update plugins for this site.' ) );
26
+		}
25 27
 
26 28
 		check_admin_referer( 'bulk-update-plugins' );
27 29
 
28
-		if ( isset( $_GET['plugins'] ) )
29
-			$plugins = explode( ',', stripslashes($_GET['plugins']) );
30
-		elseif ( isset( $_POST['checked'] ) )
31
-			$plugins = (array) $_POST['checked'];
32
-		else
33
-			$plugins = array();
30
+		if ( isset( $_GET['plugins'] ) ) {
31
+					$plugins = explode( ',', stripslashes($_GET['plugins']) );
32
+		} elseif ( isset( $_POST['checked'] ) ) {
33
+					$plugins = (array) $_POST['checked'];
34
+		} else {
35
+					$plugins = array();
36
+		}
34 37
 
35 38
 		$plugins = array_map('urldecode', $plugins);
36 39
 
@@ -46,8 +49,9 @@  discard block
 block discarded – undo
46 49
 		iframe_footer();
47 50
 
48 51
 	} elseif ( 'upgrade-plugin' == $action ) {
49
-		if ( ! current_user_can('update_plugins') )
50
-			wp_die(__('Sorry, you are not allowed to update plugins for this site.'));
52
+		if ( ! current_user_can('update_plugins') ) {
53
+					wp_die(__('Sorry, you are not allowed to update plugins for this site.'));
54
+		}
51 55
 
52 56
 		check_admin_referer('upgrade-plugin_' . $plugin);
53 57
 
@@ -67,8 +71,9 @@  discard block
 block discarded – undo
67 71
 		include(ABSPATH . 'wp-admin/admin-footer.php');
68 72
 
69 73
 	} elseif ('activate-plugin' == $action ) {
70
-		if ( ! current_user_can('update_plugins') )
71
-			wp_die(__('Sorry, you are not allowed to update plugins for this site.'));
74
+		if ( ! current_user_can('update_plugins') ) {
75
+					wp_die(__('Sorry, you are not allowed to update plugins for this site.'));
76
+		}
72 77
 
73 78
 		check_admin_referer('activate-plugin_' . $plugin);
74 79
 		if ( ! isset($_GET['failure']) && ! isset($_GET['success']) ) {
@@ -78,8 +83,9 @@  discard block
 block discarded – undo
78 83
 			die();
79 84
 		}
80 85
 		iframe_header( __('Plugin Reactivation'), true );
81
-		if ( isset($_GET['success']) )
82
-			echo '<p>' . __('Plugin reactivated successfully.') . '</p>';
86
+		if ( isset($_GET['success']) ) {
87
+					echo '<p>' . __('Plugin reactivated successfully.') . '</p>';
88
+		}
83 89
 
84 90
 		if ( isset($_GET['failure']) ){
85 91
 			echo '<p>' . __('Plugin failed to reactivate due to a fatal error.') . '</p>';
@@ -92,8 +98,9 @@  discard block
 block discarded – undo
92 98
 		iframe_footer();
93 99
 	} elseif ( 'install-plugin' == $action ) {
94 100
 
95
-		if ( ! current_user_can('install_plugins') )
96
-			wp_die( __( 'Sorry, you are not allowed to install plugins on this site.' ) );
101
+		if ( ! current_user_can('install_plugins') ) {
102
+					wp_die( __( 'Sorry, you are not allowed to install plugins on this site.' ) );
103
+		}
97 104
 
98 105
 		include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api..
99 106
 
@@ -128,8 +135,9 @@  discard block
 block discarded – undo
128 135
 		$title = sprintf( __('Installing Plugin: %s'), $api->name . ' ' . $api->version );
129 136
 		$nonce = 'install-plugin_' . $plugin;
130 137
 		$url = 'update.php?action=install-plugin&plugin=' . urlencode( $plugin );
131
-		if ( isset($_GET['from']) )
132
-			$url .= '&from=' . urlencode(stripslashes($_GET['from']));
138
+		if ( isset($_GET['from']) ) {
139
+					$url .= '&from=' . urlencode(stripslashes($_GET['from']));
140
+		}
133 141
 
134 142
 		$type = 'web'; //Install plugin type, From Web or an Upload.
135 143
 
@@ -161,15 +169,17 @@  discard block
 block discarded – undo
161 169
 		$upgrader = new Plugin_Upgrader( new Plugin_Installer_Skin( compact('type', 'title', 'nonce', 'url') ) );
162 170
 		$result = $upgrader->install( $file_upload->package );
163 171
 
164
-		if ( $result || is_wp_error($result) )
165
-			$file_upload->cleanup();
172
+		if ( $result || is_wp_error($result) ) {
173
+					$file_upload->cleanup();
174
+		}
166 175
 
167 176
 		include(ABSPATH . 'wp-admin/admin-footer.php');
168 177
 
169 178
 	} elseif ( 'upgrade-theme' == $action ) {
170 179
 
171
-		if ( ! current_user_can('update_themes') )
172
-			wp_die(__('Sorry, you are not allowed to update themes for this site.'));
180
+		if ( ! current_user_can('update_themes') ) {
181
+					wp_die(__('Sorry, you are not allowed to update themes for this site.'));
182
+		}
173 183
 
174 184
 		check_admin_referer('upgrade-theme_' . $theme);
175 185
 
@@ -189,17 +199,19 @@  discard block
 block discarded – undo
189 199
 
190 200
 		include(ABSPATH . 'wp-admin/admin-footer.php');
191 201
 	} elseif ( 'update-selected-themes' == $action ) {
192
-		if ( ! current_user_can( 'update_themes' ) )
193
-			wp_die( __( 'Sorry, you are not allowed to update themes for this site.' ) );
202
+		if ( ! current_user_can( 'update_themes' ) ) {
203
+					wp_die( __( 'Sorry, you are not allowed to update themes for this site.' ) );
204
+		}
194 205
 
195 206
 		check_admin_referer( 'bulk-update-themes' );
196 207
 
197
-		if ( isset( $_GET['themes'] ) )
198
-			$themes = explode( ',', stripslashes($_GET['themes']) );
199
-		elseif ( isset( $_POST['checked'] ) )
200
-			$themes = (array) $_POST['checked'];
201
-		else
202
-			$themes = array();
208
+		if ( isset( $_GET['themes'] ) ) {
209
+					$themes = explode( ',', stripslashes($_GET['themes']) );
210
+		} elseif ( isset( $_POST['checked'] ) ) {
211
+					$themes = (array) $_POST['checked'];
212
+		} else {
213
+					$themes = array();
214
+		}
203 215
 
204 216
 		$themes = array_map('urldecode', $themes);
205 217
 
@@ -215,16 +227,18 @@  discard block
 block discarded – undo
215 227
 		iframe_footer();
216 228
 	} elseif ( 'install-theme' == $action ) {
217 229
 
218
-		if ( ! current_user_can('install_themes') )
219
-			wp_die( __( 'Sorry, you are not allowed to install themes on this site.' ) );
230
+		if ( ! current_user_can('install_themes') ) {
231
+					wp_die( __( 'Sorry, you are not allowed to install themes on this site.' ) );
232
+		}
220 233
 
221 234
 		include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ); //for themes_api..
222 235
 
223 236
 		check_admin_referer( 'install-theme_' . $theme );
224 237
 		$api = themes_api('theme_information', array('slug' => $theme, 'fields' => array('sections' => false, 'tags' => false) ) ); //Save on a bit of bandwidth.
225 238
 
226
-		if ( is_wp_error($api) )
227
-	 		wp_die($api);
239
+		if ( is_wp_error($api) ) {
240
+			 		wp_die($api);
241
+		}
228 242
 
229 243
 		wp_enqueue_script( 'customize-loader' );
230 244
 
@@ -269,8 +283,9 @@  discard block
 block discarded – undo
269 283
 		$upgrader = new Theme_Upgrader( new Theme_Installer_Skin( compact('type', 'title', 'nonce', 'url') ) );
270 284
 		$result = $upgrader->install( $file_upload->package );
271 285
 
272
-		if ( $result || is_wp_error($result) )
273
-			$file_upload->cleanup();
286
+		if ( $result || is_wp_error($result) ) {
287
+					$file_upload->cleanup();
288
+		}
274 289
 
275 290
 		include(ABSPATH . 'wp-admin/admin-footer.php');
276 291
 
Please login to merge, or discard this patch.
src/wp-admin/plugins.php 2 patches
Braces   +52 added lines, -36 removed lines patch added patch discarded remove patch
@@ -9,8 +9,9 @@  discard block
 block discarded – undo
9 9
 /** WordPress Administration Bootstrap */
10 10
 require_once( dirname( __FILE__ ) . '/admin.php' );
11 11
 
12
-if ( ! current_user_can('activate_plugins') )
12
+if ( ! current_user_can('activate_plugins') ) {
13 13
 	wp_die( __( 'Sorry, you are not allowed to manage plugins for this site.' ) );
14
+}
14 15
 
15 16
 $wp_list_table = _get_list_table('WP_Plugins_List_Table');
16 17
 $pagenum = $wp_list_table->get_pagenum();
@@ -29,8 +30,9 @@  discard block
 block discarded – undo
29 30
 
30 31
 	switch ( $action ) {
31 32
 		case 'activate':
32
-			if ( ! current_user_can('activate_plugins') )
33
-				wp_die(__('Sorry, you are not allowed to activate plugins for this site.'));
33
+			if ( ! current_user_can('activate_plugins') ) {
34
+							wp_die(__('Sorry, you are not allowed to activate plugins for this site.'));
35
+			}
34 36
 
35 37
 			if ( is_multisite() && ! is_network_admin() && is_network_only_plugin( $plugin ) ) {
36 38
 				wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") );
@@ -68,8 +70,9 @@  discard block
 block discarded – undo
68 70
 			exit;
69 71
 
70 72
 		case 'activate-selected':
71
-			if ( ! current_user_can('activate_plugins') )
72
-				wp_die(__('Sorry, you are not allowed to activate plugins for this site.'));
73
+			if ( ! current_user_can('activate_plugins') ) {
74
+							wp_die(__('Sorry, you are not allowed to activate plugins for this site.'));
75
+			}
73 76
 
74 77
 			check_admin_referer('bulk-plugins');
75 78
 
@@ -121,12 +124,13 @@  discard block
 block discarded – undo
121 124
 
122 125
 			check_admin_referer( 'bulk-plugins' );
123 126
 
124
-			if ( isset( $_GET['plugins'] ) )
125
-				$plugins = explode( ',', $_GET['plugins'] );
126
-			elseif ( isset( $_POST['checked'] ) )
127
-				$plugins = (array) $_POST['checked'];
128
-			else
129
-				$plugins = array();
127
+			if ( isset( $_GET['plugins'] ) ) {
128
+							$plugins = explode( ',', $_GET['plugins'] );
129
+			} elseif ( isset( $_POST['checked'] ) ) {
130
+							$plugins = (array) $_POST['checked'];
131
+			} else {
132
+							$plugins = array();
133
+			}
130 134
 
131 135
 			$title = __( 'Update Plugins' );
132 136
 			$parent_file = 'plugins.php';
@@ -146,14 +150,16 @@  discard block
 block discarded – undo
146 150
 			exit;
147 151
 
148 152
 		case 'error_scrape':
149
-			if ( ! current_user_can('activate_plugins') )
150
-				wp_die(__('Sorry, you are not allowed to activate plugins for this site.'));
153
+			if ( ! current_user_can('activate_plugins') ) {
154
+							wp_die(__('Sorry, you are not allowed to activate plugins for this site.'));
155
+			}
151 156
 
152 157
 			check_admin_referer('plugin-activation-error_' . $plugin);
153 158
 
154 159
 			$valid = validate_plugin($plugin);
155
-			if ( is_wp_error($valid) )
156
-				wp_die($valid);
160
+			if ( is_wp_error($valid) ) {
161
+							wp_die($valid);
162
+			}
157 163
 
158 164
 			if ( ! WP_DEBUG ) {
159 165
 				error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR );
@@ -167,8 +173,9 @@  discard block
 block discarded – undo
167 173
 			exit;
168 174
 
169 175
 		case 'deactivate':
170
-			if ( ! current_user_can('activate_plugins') )
171
-				wp_die(__('Sorry, you are not allowed to deactivate plugins for this site.'));
176
+			if ( ! current_user_can('activate_plugins') ) {
177
+							wp_die(__('Sorry, you are not allowed to deactivate plugins for this site.'));
178
+			}
172 179
 
173 180
 			check_admin_referer('deactivate-plugin_' . $plugin);
174 181
 
@@ -185,15 +192,17 @@  discard block
 block discarded – undo
185 192
 				update_site_option( 'recently_activated', array( $plugin => time() ) + (array) get_site_option( 'recently_activated' ) );
186 193
 			}
187 194
 
188
-			if ( headers_sent() )
189
-				echo "<meta http-equiv='refresh' content='" . esc_attr( "0;url=plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s" ) . "' />";
190
-			else
191
-				wp_redirect( self_admin_url("plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s") );
195
+			if ( headers_sent() ) {
196
+							echo "<meta http-equiv='refresh' content='" . esc_attr( "0;url=plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s" ) . "' />";
197
+			} else {
198
+							wp_redirect( self_admin_url("plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s") );
199
+			}
192 200
 			exit;
193 201
 
194 202
 		case 'deactivate-selected':
195
-			if ( ! current_user_can('activate_plugins') )
196
-				wp_die(__('Sorry, you are not allowed to deactivate plugins for this site.'));
203
+			if ( ! current_user_can('activate_plugins') ) {
204
+							wp_die(__('Sorry, you are not allowed to deactivate plugins for this site.'));
205
+			}
197 206
 
198 207
 			check_admin_referer('bulk-plugins');
199 208
 
@@ -290,8 +299,11 @@  discard block
 block discarded – undo
290 299
 						<div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'This plugin may be active on other sites in the network.' ); ?></p></div>
291 300
 					<?php endif; ?>
292 301
 					<p><?php _e( 'You are about to remove the following plugin:' ); ?></p>
293
-				<?php else: ?>
294
-					<h1><?php _e( 'Delete Plugins' ); ?></h1>
302
+				<?php else {
303
+	: ?>
304
+					<h1><?php _e( 'Delete Plugins' );
305
+}
306
+?></h1>
295 307
 					<?php if ( $have_non_network_plugins && is_network_admin() ) : ?>
296 308
 						<div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'These plugins may be active on other sites in the network.' ); ?></p></div>
297 309
 					<?php endif; ?>
@@ -313,10 +325,11 @@  discard block
 block discarded – undo
313 325
 						?>
314 326
 					</ul>
315 327
 				<p><?php
316
-				if ( $data_to_delete )
317
-					_e('Are you sure you wish to delete these files and data?');
318
-				else
319
-					_e('Are you sure you wish to delete these files?');
328
+				if ( $data_to_delete ) {
329
+									_e('Are you sure you wish to delete these files and data?');
330
+				} else {
331
+									_e('Are you sure you wish to delete these files?');
332
+				}
320 333
 				?></p>
321 334
 				<form method="post" action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>" style="display:inline;">
322 335
 					<input type="hidden" name="verify-delete" value="1" />
@@ -423,12 +436,13 @@  discard block
 block discarded – undo
423 436
 
424 437
 <?php if ( isset($_GET['error']) ) :
425 438
 
426
-	if ( isset( $_GET['main'] ) )
427
-		$errmsg = __( 'You cannot delete a plugin while it is active on the main site.' );
428
-	elseif ( isset($_GET['charsout']) )
429
-		$errmsg = sprintf(__('The plugin generated %d characters of <strong>unexpected output</strong> during activation. If you notice &#8220;headers already sent&#8221; messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.'), $_GET['charsout']);
430
-	else
431
-		$errmsg = __('Plugin could not be activated because it triggered a <strong>fatal error</strong>.');
439
+	if ( isset( $_GET['main'] ) ) {
440
+			$errmsg = __( 'You cannot delete a plugin while it is active on the main site.' );
441
+	} elseif ( isset($_GET['charsout']) ) {
442
+			$errmsg = sprintf(__('The plugin generated %d characters of <strong>unexpected output</strong> during activation. If you notice &#8220;headers already sent&#8221; messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.'), $_GET['charsout']);
443
+	} else {
444
+			$errmsg = __('Plugin could not be activated because it triggered a <strong>fatal error</strong>.');
445
+	}
432 446
 	?>
433 447
 	<div id="message" class="error"><p><?php echo $errmsg; ?></p>
434 448
 	<?php
@@ -451,12 +465,14 @@  discard block
 block discarded – undo
451 465
 
452 466
 		if ( is_wp_error($delete_result) ) : ?>
453 467
 		<div id="message" class="error notice is-dismissible"><p><?php printf( __('Plugin could not be deleted due to an error: %s'), $delete_result->get_error_message() ); ?></p></div>
454
-		<?php else : ?>
468
+		<?php else {
469
+	: ?>
455 470
 		<div id="message" class="updated notice is-dismissible">
456 471
 			<p>
457 472
 				<?php
458 473
 				if ( 1 == (int) $_GET['deleted'] ) {
459 474
 					_e( 'The selected plugin has been <strong>deleted</strong>.' );
475
+}
460 476
 				} else {
461 477
 					_e( 'The selected plugins have been <strong>deleted</strong>.' );
462 478
 				}
Please login to merge, or discard this patch.
Spacing   +205 added lines, -205 removed lines patch added patch discarded remove patch
@@ -7,10 +7,10 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 /** WordPress Administration Bootstrap */
10
-require_once( dirname( __FILE__ ) . '/admin.php' );
10
+require_once(dirname(__FILE__).'/admin.php');
11 11
 
12
-if ( ! current_user_can('activate_plugins') )
13
-	wp_die( __( 'Sorry, you are not allowed to manage plugins for this site.' ) );
12
+if ( ! current_user_can('activate_plugins'))
13
+	wp_die(__('Sorry, you are not allowed to manage plugins for this site.'));
14 14
 
15 15
 $wp_list_table = _get_list_table('WP_Plugins_List_Table');
16 16
 $pagenum = $wp_list_table->get_pagenum();
@@ -18,310 +18,310 @@  discard block
 block discarded – undo
18 18
 $action = $wp_list_table->current_action();
19 19
 
20 20
 $plugin = isset($_REQUEST['plugin']) ? $_REQUEST['plugin'] : '';
21
-$s = isset($_REQUEST['s']) ? urlencode( wp_unslash( $_REQUEST['s'] ) ) : '';
21
+$s = isset($_REQUEST['s']) ? urlencode(wp_unslash($_REQUEST['s'])) : '';
22 22
 
23 23
 // Clean up request URI from temporary args for screen options/paging uri's to work as expected.
24 24
 $_SERVER['REQUEST_URI'] = remove_query_arg(array('error', 'deleted', 'activate', 'activate-multi', 'deactivate', 'deactivate-multi', '_error_nonce'), $_SERVER['REQUEST_URI']);
25 25
 
26
-wp_enqueue_script( 'updates' );
26
+wp_enqueue_script('updates');
27 27
 
28
-if ( $action ) {
28
+if ($action) {
29 29
 
30
-	switch ( $action ) {
30
+	switch ($action) {
31 31
 		case 'activate':
32
-			if ( ! current_user_can('activate_plugins') )
32
+			if ( ! current_user_can('activate_plugins'))
33 33
 				wp_die(__('Sorry, you are not allowed to activate plugins for this site.'));
34 34
 
35
-			if ( is_multisite() && ! is_network_admin() && is_network_only_plugin( $plugin ) ) {
36
-				wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") );
35
+			if (is_multisite() && ! is_network_admin() && is_network_only_plugin($plugin)) {
36
+				wp_redirect(self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s"));
37 37
 				exit;
38 38
 			}
39 39
 
40
-			check_admin_referer('activate-plugin_' . $plugin);
40
+			check_admin_referer('activate-plugin_'.$plugin);
41 41
 
42
-			$result = activate_plugin($plugin, self_admin_url('plugins.php?error=true&plugin=' . $plugin), is_network_admin() );
43
-			if ( is_wp_error( $result ) ) {
44
-				if ( 'unexpected_output' == $result->get_error_code() ) {
45
-					$redirect = self_admin_url('plugins.php?error=true&charsout=' . strlen($result->get_error_data()) . '&plugin=' . $plugin . "&plugin_status=$status&paged=$page&s=$s");
46
-					wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect));
42
+			$result = activate_plugin($plugin, self_admin_url('plugins.php?error=true&plugin='.$plugin), is_network_admin());
43
+			if (is_wp_error($result)) {
44
+				if ('unexpected_output' == $result->get_error_code()) {
45
+					$redirect = self_admin_url('plugins.php?error=true&charsout='.strlen($result->get_error_data()).'&plugin='.$plugin."&plugin_status=$status&paged=$page&s=$s");
46
+					wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_'.$plugin), $redirect));
47 47
 					exit;
48 48
 				} else {
49 49
 					wp_die($result);
50 50
 				}
51 51
 			}
52 52
 
53
-			if ( ! is_network_admin() ) {
54
-				$recent = (array) get_option( 'recently_activated' );
55
-				unset( $recent[ $plugin ] );
56
-				update_option( 'recently_activated', $recent );
53
+			if ( ! is_network_admin()) {
54
+				$recent = (array) get_option('recently_activated');
55
+				unset($recent[$plugin]);
56
+				update_option('recently_activated', $recent);
57 57
 			} else {
58
-				$recent = (array) get_site_option( 'recently_activated' );
59
-				unset( $recent[ $plugin ] );
60
-				update_site_option( 'recently_activated', $recent );
58
+				$recent = (array) get_site_option('recently_activated');
59
+				unset($recent[$plugin]);
60
+				update_site_option('recently_activated', $recent);
61 61
 			}
62 62
 
63
-			if ( isset($_GET['from']) && 'import' == $_GET['from'] ) {
64
-				wp_redirect( self_admin_url("import.php?import=" . str_replace('-importer', '', dirname($plugin))) ); // overrides the ?error=true one above and redirects to the Imports page, stripping the -importer suffix
63
+			if (isset($_GET['from']) && 'import' == $_GET['from']) {
64
+				wp_redirect(self_admin_url("import.php?import=".str_replace('-importer', '', dirname($plugin)))); // overrides the ?error=true one above and redirects to the Imports page, stripping the -importer suffix
65 65
 			} else {
66
-				wp_redirect( self_admin_url("plugins.php?activate=true&plugin_status=$status&paged=$page&s=$s") ); // overrides the ?error=true one above
66
+				wp_redirect(self_admin_url("plugins.php?activate=true&plugin_status=$status&paged=$page&s=$s")); // overrides the ?error=true one above
67 67
 			}
68 68
 			exit;
69 69
 
70 70
 		case 'activate-selected':
71
-			if ( ! current_user_can('activate_plugins') )
71
+			if ( ! current_user_can('activate_plugins'))
72 72
 				wp_die(__('Sorry, you are not allowed to activate plugins for this site.'));
73 73
 
74 74
 			check_admin_referer('bulk-plugins');
75 75
 
76
-			$plugins = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array();
76
+			$plugins = isset($_POST['checked']) ? (array) $_POST['checked'] : array();
77 77
 
78
-			if ( is_network_admin() ) {
79
-				foreach ( $plugins as $i => $plugin ) {
78
+			if (is_network_admin()) {
79
+				foreach ($plugins as $i => $plugin) {
80 80
 					// Only activate plugins which are not already network activated.
81
-					if ( is_plugin_active_for_network( $plugin ) ) {
82
-						unset( $plugins[ $i ] );
81
+					if (is_plugin_active_for_network($plugin)) {
82
+						unset($plugins[$i]);
83 83
 					}
84 84
 				}
85 85
 			} else {
86
-				foreach ( $plugins as $i => $plugin ) {
86
+				foreach ($plugins as $i => $plugin) {
87 87
 					// Only activate plugins which are not already active and are not network-only when on Multisite.
88
-					if ( is_plugin_active( $plugin ) || ( is_multisite() && is_network_only_plugin( $plugin ) ) ) {
89
-						unset( $plugins[ $i ] );
88
+					if (is_plugin_active($plugin) || (is_multisite() && is_network_only_plugin($plugin))) {
89
+						unset($plugins[$i]);
90 90
 					}
91 91
 				}
92 92
 			}
93 93
 
94
-			if ( empty($plugins) ) {
95
-				wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") );
94
+			if (empty($plugins)) {
95
+				wp_redirect(self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s"));
96 96
 				exit;
97 97
 			}
98 98
 
99
-			activate_plugins($plugins, self_admin_url('plugins.php?error=true'), is_network_admin() );
99
+			activate_plugins($plugins, self_admin_url('plugins.php?error=true'), is_network_admin());
100 100
 
101
-			if ( ! is_network_admin() ) {
102
-				$recent = (array) get_option('recently_activated' );
101
+			if ( ! is_network_admin()) {
102
+				$recent = (array) get_option('recently_activated');
103 103
 			} else {
104
-				$recent = (array) get_site_option('recently_activated' );
104
+				$recent = (array) get_site_option('recently_activated');
105 105
 			}
106 106
 
107
-			foreach ( $plugins as $plugin ) {
108
-				unset( $recent[ $plugin ] );
107
+			foreach ($plugins as $plugin) {
108
+				unset($recent[$plugin]);
109 109
 			}
110 110
 
111
-			if ( ! is_network_admin() ) {
112
-				update_option( 'recently_activated', $recent );
111
+			if ( ! is_network_admin()) {
112
+				update_option('recently_activated', $recent);
113 113
 			} else {
114
-				update_site_option( 'recently_activated', $recent );
114
+				update_site_option('recently_activated', $recent);
115 115
 			}
116 116
 
117
-			wp_redirect( self_admin_url("plugins.php?activate-multi=true&plugin_status=$status&paged=$page&s=$s") );
117
+			wp_redirect(self_admin_url("plugins.php?activate-multi=true&plugin_status=$status&paged=$page&s=$s"));
118 118
 			exit;
119 119
 
120 120
 		case 'update-selected' :
121 121
 
122
-			check_admin_referer( 'bulk-plugins' );
122
+			check_admin_referer('bulk-plugins');
123 123
 
124
-			if ( isset( $_GET['plugins'] ) )
125
-				$plugins = explode( ',', $_GET['plugins'] );
126
-			elseif ( isset( $_POST['checked'] ) )
124
+			if (isset($_GET['plugins']))
125
+				$plugins = explode(',', $_GET['plugins']);
126
+			elseif (isset($_POST['checked']))
127 127
 				$plugins = (array) $_POST['checked'];
128 128
 			else
129 129
 				$plugins = array();
130 130
 
131
-			$title = __( 'Update Plugins' );
131
+			$title = __('Update Plugins');
132 132
 			$parent_file = 'plugins.php';
133 133
 
134
-			wp_enqueue_script( 'updates' );
135
-			require_once(ABSPATH . 'wp-admin/admin-header.php');
134
+			wp_enqueue_script('updates');
135
+			require_once(ABSPATH.'wp-admin/admin-header.php');
136 136
 
137 137
 			echo '<div class="wrap">';
138
-			echo '<h1>' . esc_html( $title ) . '</h1>';
138
+			echo '<h1>'.esc_html($title).'</h1>';
139 139
 
140
-			$url = self_admin_url('update.php?action=update-selected&amp;plugins=' . urlencode( join(',', $plugins) ));
140
+			$url = self_admin_url('update.php?action=update-selected&amp;plugins='.urlencode(join(',', $plugins)));
141 141
 			$url = wp_nonce_url($url, 'bulk-update-plugins');
142 142
 
143 143
 			echo "<iframe src='$url' style='width: 100%; height:100%; min-height:850px;'></iframe>";
144 144
 			echo '</div>';
145
-			require_once(ABSPATH . 'wp-admin/admin-footer.php');
145
+			require_once(ABSPATH.'wp-admin/admin-footer.php');
146 146
 			exit;
147 147
 
148 148
 		case 'error_scrape':
149
-			if ( ! current_user_can('activate_plugins') )
149
+			if ( ! current_user_can('activate_plugins'))
150 150
 				wp_die(__('Sorry, you are not allowed to activate plugins for this site.'));
151 151
 
152
-			check_admin_referer('plugin-activation-error_' . $plugin);
152
+			check_admin_referer('plugin-activation-error_'.$plugin);
153 153
 
154 154
 			$valid = validate_plugin($plugin);
155
-			if ( is_wp_error($valid) )
155
+			if (is_wp_error($valid))
156 156
 				wp_die($valid);
157 157
 
158
-			if ( ! WP_DEBUG ) {
159
-				error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR );
158
+			if ( ! WP_DEBUG) {
159
+				error_reporting(E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR);
160 160
 			}
161 161
 
162 162
 			@ini_set('display_errors', true); //Ensure that Fatal errors are displayed.
163 163
 			// Go back to "sandbox" scope so we get the same errors as before
164
-			plugin_sandbox_scrape( $plugin );
164
+			plugin_sandbox_scrape($plugin);
165 165
 			/** This action is documented in wp-admin/includes/plugin.php */
166
-			do_action( "activate_{$plugin}" );
166
+			do_action("activate_{$plugin}");
167 167
 			exit;
168 168
 
169 169
 		case 'deactivate':
170
-			if ( ! current_user_can('activate_plugins') )
170
+			if ( ! current_user_can('activate_plugins'))
171 171
 				wp_die(__('Sorry, you are not allowed to deactivate plugins for this site.'));
172 172
 
173
-			check_admin_referer('deactivate-plugin_' . $plugin);
173
+			check_admin_referer('deactivate-plugin_'.$plugin);
174 174
 
175
-			if ( ! is_network_admin() && is_plugin_active_for_network( $plugin ) ) {
176
-				wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") );
175
+			if ( ! is_network_admin() && is_plugin_active_for_network($plugin)) {
176
+				wp_redirect(self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s"));
177 177
 				exit;
178 178
 			}
179 179
 
180
-			deactivate_plugins( $plugin, false, is_network_admin() );
180
+			deactivate_plugins($plugin, false, is_network_admin());
181 181
 
182
-			if ( ! is_network_admin() ) {
183
-				update_option( 'recently_activated', array( $plugin => time() ) + (array) get_option( 'recently_activated' ) );
182
+			if ( ! is_network_admin()) {
183
+				update_option('recently_activated', array($plugin => time()) + (array) get_option('recently_activated'));
184 184
 			} else {
185
-				update_site_option( 'recently_activated', array( $plugin => time() ) + (array) get_site_option( 'recently_activated' ) );
185
+				update_site_option('recently_activated', array($plugin => time()) + (array) get_site_option('recently_activated'));
186 186
 			}
187 187
 
188
-			if ( headers_sent() )
189
-				echo "<meta http-equiv='refresh' content='" . esc_attr( "0;url=plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s" ) . "' />";
188
+			if (headers_sent())
189
+				echo "<meta http-equiv='refresh' content='".esc_attr("0;url=plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s")."' />";
190 190
 			else
191
-				wp_redirect( self_admin_url("plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s") );
191
+				wp_redirect(self_admin_url("plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s"));
192 192
 			exit;
193 193
 
194 194
 		case 'deactivate-selected':
195
-			if ( ! current_user_can('activate_plugins') )
195
+			if ( ! current_user_can('activate_plugins'))
196 196
 				wp_die(__('Sorry, you are not allowed to deactivate plugins for this site.'));
197 197
 
198 198
 			check_admin_referer('bulk-plugins');
199 199
 
200
-			$plugins = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array();
200
+			$plugins = isset($_POST['checked']) ? (array) $_POST['checked'] : array();
201 201
 			// Do not deactivate plugins which are already deactivated.
202
-			if ( is_network_admin() ) {
203
-				$plugins = array_filter( $plugins, 'is_plugin_active_for_network' );
202
+			if (is_network_admin()) {
203
+				$plugins = array_filter($plugins, 'is_plugin_active_for_network');
204 204
 			} else {
205
-				$plugins = array_filter( $plugins, 'is_plugin_active' );
206
-				$plugins = array_diff( $plugins, array_filter( $plugins, 'is_plugin_active_for_network' ) );
205
+				$plugins = array_filter($plugins, 'is_plugin_active');
206
+				$plugins = array_diff($plugins, array_filter($plugins, 'is_plugin_active_for_network'));
207 207
 			}
208
-			if ( empty($plugins) ) {
209
-				wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") );
208
+			if (empty($plugins)) {
209
+				wp_redirect(self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s"));
210 210
 				exit;
211 211
 			}
212 212
 
213
-			deactivate_plugins( $plugins, false, is_network_admin() );
213
+			deactivate_plugins($plugins, false, is_network_admin());
214 214
 
215 215
 			$deactivated = array();
216
-			foreach ( $plugins as $plugin ) {
217
-				$deactivated[ $plugin ] = time();
216
+			foreach ($plugins as $plugin) {
217
+				$deactivated[$plugin] = time();
218 218
 			}
219 219
 
220
-			if ( ! is_network_admin() ) {
221
-				update_option( 'recently_activated', $deactivated + (array) get_option( 'recently_activated' ) );
220
+			if ( ! is_network_admin()) {
221
+				update_option('recently_activated', $deactivated + (array) get_option('recently_activated'));
222 222
 			} else {
223
-				update_site_option( 'recently_activated', $deactivated + (array) get_site_option( 'recently_activated' ) );
223
+				update_site_option('recently_activated', $deactivated + (array) get_site_option('recently_activated'));
224 224
 			}
225 225
 
226
-			wp_redirect( self_admin_url("plugins.php?deactivate-multi=true&plugin_status=$status&paged=$page&s=$s") );
226
+			wp_redirect(self_admin_url("plugins.php?deactivate-multi=true&plugin_status=$status&paged=$page&s=$s"));
227 227
 			exit;
228 228
 
229 229
 		case 'delete-selected':
230
-			if ( ! current_user_can('delete_plugins') ) {
230
+			if ( ! current_user_can('delete_plugins')) {
231 231
 				wp_die(__('Sorry, you are not allowed to delete plugins for this site.'));
232 232
 			}
233 233
 
234 234
 			check_admin_referer('bulk-plugins');
235 235
 
236 236
 			//$_POST = from the plugin form; $_GET = from the FTP details screen.
237
-			$plugins = isset( $_REQUEST['checked'] ) ? (array) $_REQUEST['checked'] : array();
238
-			if ( empty( $plugins ) ) {
239
-				wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") );
237
+			$plugins = isset($_REQUEST['checked']) ? (array) $_REQUEST['checked'] : array();
238
+			if (empty($plugins)) {
239
+				wp_redirect(self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s"));
240 240
 				exit;
241 241
 			}
242 242
 
243 243
 			$plugins = array_filter($plugins, 'is_plugin_inactive'); // Do not allow to delete Activated plugins.
244
-			if ( empty( $plugins ) ) {
245
-				wp_redirect( self_admin_url( "plugins.php?error=true&main=true&plugin_status=$status&paged=$page&s=$s" ) );
244
+			if (empty($plugins)) {
245
+				wp_redirect(self_admin_url("plugins.php?error=true&main=true&plugin_status=$status&paged=$page&s=$s"));
246 246
 				exit;
247 247
 			}
248 248
 
249 249
 			// Bail on all if any paths are invalid.
250 250
 			// validate_file() returns truthy for invalid files
251
-			$invalid_plugin_files = array_filter( $plugins, 'validate_file' );
252
-			if ( $invalid_plugin_files ) {
253
-				wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") );
251
+			$invalid_plugin_files = array_filter($plugins, 'validate_file');
252
+			if ($invalid_plugin_files) {
253
+				wp_redirect(self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s"));
254 254
 				exit;
255 255
 			}
256 256
 
257
-			include(ABSPATH . 'wp-admin/update.php');
257
+			include(ABSPATH.'wp-admin/update.php');
258 258
 
259 259
 			$parent_file = 'plugins.php';
260 260
 
261
-			if ( ! isset($_REQUEST['verify-delete']) ) {
261
+			if ( ! isset($_REQUEST['verify-delete'])) {
262 262
 				wp_enqueue_script('jquery');
263
-				require_once(ABSPATH . 'wp-admin/admin-header.php');
263
+				require_once(ABSPATH.'wp-admin/admin-header.php');
264 264
 				?>
265 265
 			<div class="wrap">
266 266
 				<?php
267 267
 					$plugin_info = array();
268 268
 					$have_non_network_plugins = false;
269
-					foreach ( (array) $plugins as $plugin ) {
270
-						$plugin_slug = dirname( $plugin );
271
-
272
-						if ( '.' == $plugin_slug ) {
273
-							if ( $data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ) ) {
274
-								$plugin_info[ $plugin ] = $data;
275
-								$plugin_info[ $plugin ]['is_uninstallable'] = is_uninstallable_plugin( $plugin );
276
-								if ( ! $plugin_info[ $plugin ]['Network'] ) {
269
+					foreach ((array) $plugins as $plugin) {
270
+						$plugin_slug = dirname($plugin);
271
+
272
+						if ('.' == $plugin_slug) {
273
+							if ($data = get_plugin_data(WP_PLUGIN_DIR.'/'.$plugin)) {
274
+								$plugin_info[$plugin] = $data;
275
+								$plugin_info[$plugin]['is_uninstallable'] = is_uninstallable_plugin($plugin);
276
+								if ( ! $plugin_info[$plugin]['Network']) {
277 277
 									$have_non_network_plugins = true;
278 278
 								}
279 279
 							}
280 280
 						} else {
281 281
 							// Get plugins list from that folder.
282
-							if ( $folder_plugins = get_plugins( '/' . $plugin_slug ) ) {
283
-								foreach ( $folder_plugins as $plugin_file => $data ) {
284
-									$plugin_info[ $plugin_file ] = _get_plugin_data_markup_translate( $plugin_file, $data );
285
-									$plugin_info[ $plugin_file ]['is_uninstallable'] = is_uninstallable_plugin( $plugin );
286
-									if ( ! $plugin_info[ $plugin_file ]['Network'] ) {
282
+							if ($folder_plugins = get_plugins('/'.$plugin_slug)) {
283
+								foreach ($folder_plugins as $plugin_file => $data) {
284
+									$plugin_info[$plugin_file] = _get_plugin_data_markup_translate($plugin_file, $data);
285
+									$plugin_info[$plugin_file]['is_uninstallable'] = is_uninstallable_plugin($plugin);
286
+									if ( ! $plugin_info[$plugin_file]['Network']) {
287 287
 										$have_non_network_plugins = true;
288 288
 									}
289 289
 								}
290 290
 							}
291 291
 						}
292 292
 					}
293
-					$plugins_to_delete = count( $plugin_info );
293
+					$plugins_to_delete = count($plugin_info);
294 294
 				?>
295
-				<?php if ( 1 == $plugins_to_delete ) : ?>
296
-					<h1><?php _e( 'Delete Plugin' ); ?></h1>
297
-					<?php if ( $have_non_network_plugins && is_network_admin() ) : ?>
298
-						<div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'This plugin may be active on other sites in the network.' ); ?></p></div>
295
+				<?php if (1 == $plugins_to_delete) : ?>
296
+					<h1><?php _e('Delete Plugin'); ?></h1>
297
+					<?php if ($have_non_network_plugins && is_network_admin()) : ?>
298
+						<div class="error"><p><strong><?php _e('Caution:'); ?></strong> <?php _e('This plugin may be active on other sites in the network.'); ?></p></div>
299 299
 					<?php endif; ?>
300
-					<p><?php _e( 'You are about to remove the following plugin:' ); ?></p>
300
+					<p><?php _e('You are about to remove the following plugin:'); ?></p>
301 301
 				<?php else: ?>
302
-					<h1><?php _e( 'Delete Plugins' ); ?></h1>
303
-					<?php if ( $have_non_network_plugins && is_network_admin() ) : ?>
304
-						<div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'These plugins may be active on other sites in the network.' ); ?></p></div>
302
+					<h1><?php _e('Delete Plugins'); ?></h1>
303
+					<?php if ($have_non_network_plugins && is_network_admin()) : ?>
304
+						<div class="error"><p><strong><?php _e('Caution:'); ?></strong> <?php _e('These plugins may be active on other sites in the network.'); ?></p></div>
305 305
 					<?php endif; ?>
306
-					<p><?php _e( 'You are about to remove the following plugins:' ); ?></p>
306
+					<p><?php _e('You are about to remove the following plugins:'); ?></p>
307 307
 				<?php endif; ?>
308 308
 					<ul class="ul-disc">
309 309
 						<?php
310 310
 						$data_to_delete = false;
311
-						foreach ( $plugin_info as $plugin ) {
312
-							if ( $plugin['is_uninstallable'] ) {
311
+						foreach ($plugin_info as $plugin) {
312
+							if ($plugin['is_uninstallable']) {
313 313
 								/* translators: 1: plugin name, 2: plugin author */
314
-								echo '<li>', sprintf( __( '%1$s by %2$s (will also <strong>delete its data</strong>)' ), '<strong>' . $plugin['Name'] . '</strong>', '<em>' . $plugin['AuthorName'] . '</em>' ), '</li>';
314
+								echo '<li>', sprintf(__('%1$s by %2$s (will also <strong>delete its data</strong>)'), '<strong>'.$plugin['Name'].'</strong>', '<em>'.$plugin['AuthorName'].'</em>'), '</li>';
315 315
 								$data_to_delete = true;
316 316
 							} else {
317 317
 								/* translators: 1: plugin name, 2: plugin author */
318
-								echo '<li>', sprintf( _x('%1$s by %2$s', 'plugin' ), '<strong>' . $plugin['Name'] . '</strong>', '<em>' . $plugin['AuthorName'] ) . '</em>', '</li>';
318
+								echo '<li>', sprintf(_x('%1$s by %2$s', 'plugin'), '<strong>'.$plugin['Name'].'</strong>', '<em>'.$plugin['AuthorName']).'</em>', '</li>';
319 319
 							}
320 320
 						}
321 321
 						?>
322 322
 					</ul>
323 323
 				<p><?php
324
-				if ( $data_to_delete )
324
+				if ($data_to_delete)
325 325
 					_e('Are you sure you wish to delete these files and data?');
326 326
 				else
327 327
 					_e('Are you sure you wish to delete these files?');
@@ -330,50 +330,50 @@  discard block
 block discarded – undo
330 330
 					<input type="hidden" name="verify-delete" value="1" />
331 331
 					<input type="hidden" name="action" value="delete-selected" />
332 332
 					<?php
333
-						foreach ( (array) $plugins as $plugin ) {
334
-							echo '<input type="hidden" name="checked[]" value="' . esc_attr( $plugin ) . '" />';
333
+						foreach ((array) $plugins as $plugin) {
334
+							echo '<input type="hidden" name="checked[]" value="'.esc_attr($plugin).'" />';
335 335
 						}
336 336
 					?>
337 337
 					<?php wp_nonce_field('bulk-plugins') ?>
338
-					<?php submit_button( $data_to_delete ? __( 'Yes, delete these files and data' ) : __( 'Yes, delete these files' ), '', 'submit', false ); ?>
338
+					<?php submit_button($data_to_delete ? __('Yes, delete these files and data') : __('Yes, delete these files'), '', 'submit', false); ?>
339 339
 				</form>
340 340
 				<?php
341 341
 				$referer = wp_get_referer();
342 342
 				?>
343
-				<form method="post" action="<?php echo $referer ? esc_url( $referer ) : ''; ?>" style="display:inline;">
344
-					<?php submit_button( __( 'No, return me to the plugin list' ), '', 'submit', false ); ?>
343
+				<form method="post" action="<?php echo $referer ? esc_url($referer) : ''; ?>" style="display:inline;">
344
+					<?php submit_button(__('No, return me to the plugin list'), '', 'submit', false); ?>
345 345
 				</form>
346 346
 			</div>
347 347
 				<?php
348
-				require_once(ABSPATH . 'wp-admin/admin-footer.php');
348
+				require_once(ABSPATH.'wp-admin/admin-footer.php');
349 349
 				exit;
350 350
 			} else {
351
-				$plugins_to_delete = count( $plugins );
351
+				$plugins_to_delete = count($plugins);
352 352
 			} // endif verify-delete
353 353
 
354
-			$delete_result = delete_plugins( $plugins );
354
+			$delete_result = delete_plugins($plugins);
355 355
 
356
-			set_transient('plugins_delete_result_' . $user_ID, $delete_result); //Store the result in a cache rather than a URL param due to object type & length
357
-			wp_redirect( self_admin_url("plugins.php?deleted=$plugins_to_delete&plugin_status=$status&paged=$page&s=$s") );
356
+			set_transient('plugins_delete_result_'.$user_ID, $delete_result); //Store the result in a cache rather than a URL param due to object type & length
357
+			wp_redirect(self_admin_url("plugins.php?deleted=$plugins_to_delete&plugin_status=$status&paged=$page&s=$s"));
358 358
 			exit;
359 359
 
360 360
 		case 'clear-recent-list':
361
-			if ( ! is_network_admin() ) {
362
-				update_option( 'recently_activated', array() );
361
+			if ( ! is_network_admin()) {
362
+				update_option('recently_activated', array());
363 363
 			} else {
364
-				update_site_option( 'recently_activated', array() );
364
+				update_site_option('recently_activated', array());
365 365
 			}
366 366
 			break;
367 367
 
368 368
 		default:
369
-			if ( isset( $_POST['checked'] ) ) {
369
+			if (isset($_POST['checked'])) {
370 370
 				check_admin_referer('bulk-plugins');
371
-				$plugins = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array();
371
+				$plugins = isset($_POST['checked']) ? (array) $_POST['checked'] : array();
372 372
 				$sendback = wp_get_referer();
373 373
 
374 374
 				/** This action is documented in wp-admin/edit-comments.php */
375
-				$sendback = apply_filters( 'handle_bulk_actions-' . get_current_screen()->id, $sendback, $action, $plugins );
376
-				wp_safe_redirect( $sendback );
375
+				$sendback = apply_filters('handle_bulk_actions-'.get_current_screen()->id, $sendback, $action, $plugins);
376
+				wp_safe_redirect($sendback);
377 377
 				exit;
378 378
 			}
379 379
 			break;
@@ -386,132 +386,132 @@  discard block
 block discarded – undo
386 386
 wp_enqueue_script('plugin-install');
387 387
 add_thickbox();
388 388
 
389
-add_screen_option( 'per_page', array( 'default' => 999 ) );
389
+add_screen_option('per_page', array('default' => 999));
390 390
 
391
-get_current_screen()->add_help_tab( array(
391
+get_current_screen()->add_help_tab(array(
392 392
 'id'		=> 'overview',
393 393
 'title'		=> __('Overview'),
394 394
 'content'	=>
395
-	'<p>' . __('Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.') . '</p>' .
396
-	'<p>' . __( 'The search for installed plugins will search for terms in their name, description, or author.' ) . ' <span id="live-search-desc" class="hide-if-no-js">' . __( 'The search results will be updated as you type.' ) . '</span></p>' .
397
-	'<p>' . sprintf(
395
+	'<p>'.__('Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.').'</p>'.
396
+	'<p>'.__('The search for installed plugins will search for terms in their name, description, or author.').' <span id="live-search-desc" class="hide-if-no-js">'.__('The search results will be updated as you type.').'</span></p>'.
397
+	'<p>'.sprintf(
398 398
 		/* translators: %s: WordPress Plugin Directory URL */
399
-		__( 'If you would like to see more plugins to choose from, click on the &#8220;Add New&#8221; button and you will be able to browse or search for additional plugins from the <a href="%s">WordPress Plugin Directory</a>. Plugins in the WordPress Plugin Directory are designed and developed by third parties, and are compatible with the license WordPress uses. Oh, and they&#8217;re free!' ),
400
-		__( 'https://wordpress.org/plugins/' )
401
-	) . '</p>'
402
-) );
403
-get_current_screen()->add_help_tab( array(
399
+		__('If you would like to see more plugins to choose from, click on the &#8220;Add New&#8221; button and you will be able to browse or search for additional plugins from the <a href="%s">WordPress Plugin Directory</a>. Plugins in the WordPress Plugin Directory are designed and developed by third parties, and are compatible with the license WordPress uses. Oh, and they&#8217;re free!'),
400
+		__('https://wordpress.org/plugins/')
401
+	).'</p>'
402
+));
403
+get_current_screen()->add_help_tab(array(
404 404
 'id'		=> 'compatibility-problems',
405 405
 'title'		=> __('Troubleshooting'),
406 406
 'content'	=>
407
-	'<p>' . __('Most of the time, plugins play nicely with the core of WordPress and with other plugins. Sometimes, though, a plugin&#8217;s code will get in the way of another plugin, causing compatibility issues. If your site starts doing strange things, this may be the problem. Try deactivating all your plugins and re-activating them in various combinations until you isolate which one(s) caused the issue.') . '</p>' .
408
-	'<p>' . sprintf(
407
+	'<p>'.__('Most of the time, plugins play nicely with the core of WordPress and with other plugins. Sometimes, though, a plugin&#8217;s code will get in the way of another plugin, causing compatibility issues. If your site starts doing strange things, this may be the problem. Try deactivating all your plugins and re-activating them in various combinations until you isolate which one(s) caused the issue.').'</p>'.
408
+	'<p>'.sprintf(
409 409
 		/* translators: WP_PLUGIN_DIR constant value */
410
-		__( 'If something goes wrong with a plugin and you can&#8217;t use WordPress, delete or rename that file in the %s directory and it will be automatically deactivated.' ),
411
-		'<code>' . WP_PLUGIN_DIR . '</code>'
412
-	) . '</p>'
413
-) );
410
+		__('If something goes wrong with a plugin and you can&#8217;t use WordPress, delete or rename that file in the %s directory and it will be automatically deactivated.'),
411
+		'<code>'.WP_PLUGIN_DIR.'</code>'
412
+	).'</p>'
413
+));
414 414
 
415 415
 get_current_screen()->set_help_sidebar(
416
-	'<p><strong>' . __('For more information:') . '</strong></p>' .
417
-	'<p>' . __('<a href="https://codex.wordpress.org/Managing_Plugins#Plugin_Management">Documentation on Managing Plugins</a>') . '</p>' .
418
-	'<p>' . __('<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>'
416
+	'<p><strong>'.__('For more information:').'</strong></p>'.
417
+	'<p>'.__('<a href="https://codex.wordpress.org/Managing_Plugins#Plugin_Management">Documentation on Managing Plugins</a>').'</p>'.
418
+	'<p>'.__('<a href="https://wordpress.org/support/">Support Forums</a>').'</p>'
419 419
 );
420 420
 
421
-get_current_screen()->set_screen_reader_content( array(
422
-	'heading_views'      => __( 'Filter plugins list' ),
423
-	'heading_pagination' => __( 'Plugins list navigation' ),
424
-	'heading_list'       => __( 'Plugins list' ),
425
-) );
421
+get_current_screen()->set_screen_reader_content(array(
422
+	'heading_views'      => __('Filter plugins list'),
423
+	'heading_pagination' => __('Plugins list navigation'),
424
+	'heading_list'       => __('Plugins list'),
425
+));
426 426
 
427 427
 $title = __('Plugins');
428 428
 $parent_file = 'plugins.php';
429 429
 
430
-require_once(ABSPATH . 'wp-admin/admin-header.php');
430
+require_once(ABSPATH.'wp-admin/admin-header.php');
431 431
 
432 432
 $invalid = validate_active_plugins();
433
-if ( ! empty( $invalid ) ) {
434
-	foreach ( $invalid as $plugin_file => $error ) {
433
+if ( ! empty($invalid)) {
434
+	foreach ($invalid as $plugin_file => $error) {
435 435
 		echo '<div id="message" class="error"><p>';
436 436
 		printf(
437 437
 			/* translators: 1: plugin file 2: error message */
438
-			__( 'The plugin %1$s has been <strong>deactivated</strong> due to an error: %2$s' ),
439
-			'<code>' . esc_html( $plugin_file ) . '</code>',
438
+			__('The plugin %1$s has been <strong>deactivated</strong> due to an error: %2$s'),
439
+			'<code>'.esc_html($plugin_file).'</code>',
440 440
 			$error->get_error_message() );
441 441
 		echo '</p></div>';
442 442
 	}
443 443
 }
444 444
 ?>
445 445
 
446
-<?php if ( isset($_GET['error']) ) :
446
+<?php if (isset($_GET['error'])) :
447 447
 
448
-	if ( isset( $_GET['main'] ) )
449
-		$errmsg = __( 'You cannot delete a plugin while it is active on the main site.' );
450
-	elseif ( isset($_GET['charsout']) )
448
+	if (isset($_GET['main']))
449
+		$errmsg = __('You cannot delete a plugin while it is active on the main site.');
450
+	elseif (isset($_GET['charsout']))
451 451
 		$errmsg = sprintf(__('The plugin generated %d characters of <strong>unexpected output</strong> during activation. If you notice &#8220;headers already sent&#8221; messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.'), $_GET['charsout']);
452 452
 	else
453 453
 		$errmsg = __('Plugin could not be activated because it triggered a <strong>fatal error</strong>.');
454 454
 	?>
455 455
 	<div id="message" class="error"><p><?php echo $errmsg; ?></p>
456 456
 	<?php
457
-		if ( ! isset( $_GET['main'] ) && ! isset( $_GET['charsout'] ) && wp_verify_nonce( $_GET['_error_nonce'], 'plugin-activation-error_' . $plugin ) ) {
458
-			$iframe_url = add_query_arg( array(
457
+		if ( ! isset($_GET['main']) && ! isset($_GET['charsout']) && wp_verify_nonce($_GET['_error_nonce'], 'plugin-activation-error_'.$plugin)) {
458
+			$iframe_url = add_query_arg(array(
459 459
 				'action'   => 'error_scrape',
460
-				'plugin'   => urlencode( $plugin ),
461
-				'_wpnonce' => urlencode( $_GET['_error_nonce'] ),
462
-			), admin_url( 'plugins.php' ) );
460
+				'plugin'   => urlencode($plugin),
461
+				'_wpnonce' => urlencode($_GET['_error_nonce']),
462
+			), admin_url('plugins.php'));
463 463
 		?>
464
-		<iframe style="border:0" width="100%" height="70px" src="<?php echo esc_url( $iframe_url ); ?>"></iframe>
464
+		<iframe style="border:0" width="100%" height="70px" src="<?php echo esc_url($iframe_url); ?>"></iframe>
465 465
 	<?php
466 466
 		}
467 467
 	?>
468 468
 	</div>
469
-<?php elseif ( isset($_GET['deleted']) ) :
470
-		$delete_result = get_transient( 'plugins_delete_result_' . $user_ID );
469
+<?php elseif (isset($_GET['deleted'])) :
470
+		$delete_result = get_transient('plugins_delete_result_'.$user_ID);
471 471
 		// Delete it once we're done.
472
-		delete_transient( 'plugins_delete_result_' . $user_ID );
472
+		delete_transient('plugins_delete_result_'.$user_ID);
473 473
 
474
-		if ( is_wp_error($delete_result) ) : ?>
475
-		<div id="message" class="error notice is-dismissible"><p><?php printf( __('Plugin could not be deleted due to an error: %s'), $delete_result->get_error_message() ); ?></p></div>
474
+		if (is_wp_error($delete_result)) : ?>
475
+		<div id="message" class="error notice is-dismissible"><p><?php printf(__('Plugin could not be deleted due to an error: %s'), $delete_result->get_error_message()); ?></p></div>
476 476
 		<?php else : ?>
477 477
 		<div id="message" class="updated notice is-dismissible">
478 478
 			<p>
479 479
 				<?php
480
-				if ( 1 == (int) $_GET['deleted'] ) {
481
-					_e( 'The selected plugin has been <strong>deleted</strong>.' );
480
+				if (1 == (int) $_GET['deleted']) {
481
+					_e('The selected plugin has been <strong>deleted</strong>.');
482 482
 				} else {
483
-					_e( 'The selected plugins have been <strong>deleted</strong>.' );
483
+					_e('The selected plugins have been <strong>deleted</strong>.');
484 484
 				}
485 485
 				?>
486 486
 			</p>
487 487
 		</div>
488 488
 		<?php endif; ?>
489
-<?php elseif ( isset($_GET['activate']) ) : ?>
489
+<?php elseif (isset($_GET['activate'])) : ?>
490 490
 	<div id="message" class="updated notice is-dismissible"><p><?php _e('Plugin <strong>activated</strong>.') ?></p></div>
491 491
 <?php elseif (isset($_GET['activate-multi'])) : ?>
492 492
 	<div id="message" class="updated notice is-dismissible"><p><?php _e('Selected plugins <strong>activated</strong>.'); ?></p></div>
493
-<?php elseif ( isset($_GET['deactivate']) ) : ?>
493
+<?php elseif (isset($_GET['deactivate'])) : ?>
494 494
 	<div id="message" class="updated notice is-dismissible"><p><?php _e('Plugin <strong>deactivated</strong>.') ?></p></div>
495 495
 <?php elseif (isset($_GET['deactivate-multi'])) : ?>
496 496
 	<div id="message" class="updated notice is-dismissible"><p><?php _e('Selected plugins <strong>deactivated</strong>.'); ?></p></div>
497
-<?php elseif ( 'update-selected' == $action ) : ?>
497
+<?php elseif ('update-selected' == $action) : ?>
498 498
 	<div id="message" class="updated notice is-dismissible"><p><?php _e('All selected plugins are up to date.'); ?></p></div>
499 499
 <?php endif; ?>
500 500
 
501 501
 <div class="wrap">
502 502
 <h1 class="wp-heading-inline"><?php
503
-echo esc_html( $title );
503
+echo esc_html($title);
504 504
 ?></h1>
505 505
 
506 506
 <?php
507
-if ( ( ! is_multisite() || is_network_admin() ) && current_user_can('install_plugins') ) { ?>
508
-	<a href="<?php echo self_admin_url( 'plugin-install.php' ); ?>" class="page-title-action"><?php echo esc_html_x( 'Add New', 'plugin' ); ?></a>
507
+if (( ! is_multisite() || is_network_admin()) && current_user_can('install_plugins')) { ?>
508
+	<a href="<?php echo self_admin_url('plugin-install.php'); ?>" class="page-title-action"><?php echo esc_html_x('Add New', 'plugin'); ?></a>
509 509
 <?php
510 510
 }
511 511
 
512
-if ( strlen( $s ) ) {
512
+if (strlen($s)) {
513 513
 	/* translators: %s: search keywords */
514
-	printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', esc_html( urldecode( $s ) ) );
514
+	printf('<span class="subtitle">'.__('Search results for &#8220;%s&#8221;').'</span>', esc_html(urldecode($s)));
515 515
 }
516 516
 ?>
517 517
 
@@ -530,13 +530,13 @@  discard block
 block discarded – undo
530 530
  *
531 531
  * @param array $plugins_all An array containing all installed plugins.
532 532
  */
533
-do_action( 'pre_current_active_plugins', $plugins['all'] );
533
+do_action('pre_current_active_plugins', $plugins['all']);
534 534
 ?>
535 535
 
536 536
 <?php $wp_list_table->views(); ?>
537 537
 
538 538
 <form class="search-form search-plugins" method="get">
539
-<?php $wp_list_table->search_box( __( 'Search Installed Plugins' ), 'plugin' ); ?>
539
+<?php $wp_list_table->search_box(__('Search Installed Plugins'), 'plugin'); ?>
540 540
 </form>
541 541
 
542 542
 <form method="post" id="bulk-action-form">
@@ -555,4 +555,4 @@  discard block
 block discarded – undo
555 555
 wp_print_admin_notice_templates();
556 556
 wp_print_update_row_templates();
557 557
 
558
-include(ABSPATH . 'wp-admin/admin-footer.php');
558
+include(ABSPATH.'wp-admin/admin-footer.php');
Please login to merge, or discard this patch.
src/wp-admin/import.php 2 patches
Braces   +8 added lines, -5 removed lines patch added patch discarded remove patch
@@ -73,10 +73,12 @@  discard block
 block discarded – undo
73 73
 
74 74
 // If a popular importer is not registered, create a dummy registration that links to the plugin installer.
75 75
 foreach ( $popular_importers as $pop_importer => $pop_data ) {
76
-	if ( isset( $importers[ $pop_importer ] ) )
77
-		continue;
78
-	if ( isset( $importers[ $pop_data['importer-id'] ] ) )
79
-		continue;
76
+	if ( isset( $importers[ $pop_importer ] ) ) {
77
+			continue;
78
+	}
79
+	if ( isset( $importers[ $pop_data['importer-id'] ] ) ) {
80
+			continue;
81
+	}
80 82
 
81 83
 	// Fill the array of registered (already installed) importers with data of the popular importers from the WordPress.org API.
82 84
 	$importers[ $pop_data['importer-id'] ] = array( $pop_data['name'], $pop_data['description'], 'install' => $pop_data['plugin-slug'] );
@@ -193,8 +195,9 @@  discard block
 block discarded – undo
193 195
 <?php
194 196
 }
195 197
 
196
-if ( current_user_can('install_plugins') )
198
+if ( current_user_can('install_plugins') ) {
197 199
 	echo '<p>' . sprintf( __('If the importer you need is not listed, <a href="%s">search the plugin directory</a> to see if an importer is available.'), esc_url( network_admin_url( 'plugin-install.php?tab=search&type=tag&s=importer' ) ) ) . '</p>';
200
+}
198 201
 ?>
199 202
 
200 203
 </div>
Please login to merge, or discard this patch.
Spacing   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -9,28 +9,28 @@  discard block
 block discarded – undo
9 9
 define('WP_LOAD_IMPORTERS', true);
10 10
 
11 11
 /** Load WordPress Bootstrap */
12
-require_once( dirname( __FILE__ ) . '/admin.php' );
12
+require_once(dirname(__FILE__).'/admin.php');
13 13
 
14
-if ( ! current_user_can( 'import' ) ) {
15
-	wp_die( __( 'Sorry, you are not allowed to import content.' ) );
14
+if ( ! current_user_can('import')) {
15
+	wp_die(__('Sorry, you are not allowed to import content.'));
16 16
 }
17 17
 
18 18
 $title = __('Import');
19 19
 
20
-get_current_screen()->add_help_tab( array(
20
+get_current_screen()->add_help_tab(array(
21 21
 	'id'      => 'overview',
22 22
 	'title'   => __('Overview'),
23
-	'content' => '<p>' . __('This screen lists links to plugins to import data from blogging/content management platforms. Choose the platform you want to import from, and click Install Now when you are prompted in the popup window. If your platform is not listed, click the link to search the plugin directory for other importer plugins to see if there is one for your platform.') . '</p>' .
24
-		'<p>' . __('In previous versions of WordPress, all importers were built-in. They have been turned into plugins since most people only use them once or infrequently.') . '</p>',
25
-) );
23
+	'content' => '<p>'.__('This screen lists links to plugins to import data from blogging/content management platforms. Choose the platform you want to import from, and click Install Now when you are prompted in the popup window. If your platform is not listed, click the link to search the plugin directory for other importer plugins to see if there is one for your platform.').'</p>'.
24
+		'<p>'.__('In previous versions of WordPress, all importers were built-in. They have been turned into plugins since most people only use them once or infrequently.').'</p>',
25
+));
26 26
 
27 27
 get_current_screen()->set_help_sidebar(
28
-	'<p><strong>' . __('For more information:') . '</strong></p>' .
29
-	'<p>' . __('<a href="https://codex.wordpress.org/Tools_Import_Screen">Documentation on Import</a>') . '</p>' .
30
-	'<p>' . __('<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>'
28
+	'<p><strong>'.__('For more information:').'</strong></p>'.
29
+	'<p>'.__('<a href="https://codex.wordpress.org/Tools_Import_Screen">Documentation on Import</a>').'</p>'.
30
+	'<p>'.__('<a href="https://wordpress.org/support/">Support Forums</a>').'</p>'
31 31
 );
32 32
 
33
-if ( current_user_can( 'install_plugins' ) ) {
33
+if (current_user_can('install_plugins')) {
34 34
 	// List of popular importer plugins from the WordPress.org API.
35 35
 	$popular_importers = wp_get_popular_importers();
36 36
 } else {
@@ -38,30 +38,30 @@  discard block
 block discarded – undo
38 38
 }
39 39
 
40 40
 // Detect and redirect invalid importers like 'movabletype', which is registered as 'mt'
41
-if ( ! empty( $_GET['invalid'] ) && isset( $popular_importers[ $_GET['invalid'] ] ) ) {
42
-	$importer_id = $popular_importers[ $_GET['invalid'] ]['importer-id'];
43
-	if ( $importer_id != $_GET['invalid'] ) { // Prevent redirect loops.
44
-		wp_redirect( admin_url( 'admin.php?import=' . $importer_id ) );
41
+if ( ! empty($_GET['invalid']) && isset($popular_importers[$_GET['invalid']])) {
42
+	$importer_id = $popular_importers[$_GET['invalid']]['importer-id'];
43
+	if ($importer_id != $_GET['invalid']) { // Prevent redirect loops.
44
+		wp_redirect(admin_url('admin.php?import='.$importer_id));
45 45
 		exit;
46 46
 	}
47
-	unset( $importer_id );
47
+	unset($importer_id);
48 48
 }
49 49
 
50 50
 add_thickbox();
51
-wp_enqueue_script( 'plugin-install' );
52
-wp_enqueue_script( 'updates' );
51
+wp_enqueue_script('plugin-install');
52
+wp_enqueue_script('updates');
53 53
 
54
-require_once( ABSPATH . 'wp-admin/admin-header.php' );
54
+require_once(ABSPATH.'wp-admin/admin-header.php');
55 55
 $parent_file = 'tools.php';
56 56
 ?>
57 57
 
58 58
 <div class="wrap">
59
-<h1><?php echo esc_html( $title ); ?></h1>
60
-<?php if ( ! empty( $_GET['invalid'] ) ) : ?>
59
+<h1><?php echo esc_html($title); ?></h1>
60
+<?php if ( ! empty($_GET['invalid'])) : ?>
61 61
 	<div class="error">
62
-		<p><strong><?php _e( 'ERROR:' ); ?></strong> <?php
62
+		<p><strong><?php _e('ERROR:'); ?></strong> <?php
63 63
 			/* translators: %s: importer slug */
64
-			printf( __( 'The %s importer is invalid or is not installed.' ), '<strong>' . esc_html( $_GET['invalid'] ) . '</strong>' );
64
+			printf(__('The %s importer is invalid or is not installed.'), '<strong>'.esc_html($_GET['invalid']).'</strong>');
65 65
 		?></p>
66 66
 	</div>
67 67
 <?php endif; ?>
@@ -72,108 +72,108 @@  discard block
 block discarded – undo
72 72
 $importers = get_importers();
73 73
 
74 74
 // If a popular importer is not registered, create a dummy registration that links to the plugin installer.
75
-foreach ( $popular_importers as $pop_importer => $pop_data ) {
76
-	if ( isset( $importers[ $pop_importer ] ) )
75
+foreach ($popular_importers as $pop_importer => $pop_data) {
76
+	if (isset($importers[$pop_importer]))
77 77
 		continue;
78
-	if ( isset( $importers[ $pop_data['importer-id'] ] ) )
78
+	if (isset($importers[$pop_data['importer-id']]))
79 79
 		continue;
80 80
 
81 81
 	// Fill the array of registered (already installed) importers with data of the popular importers from the WordPress.org API.
82
-	$importers[ $pop_data['importer-id'] ] = array( $pop_data['name'], $pop_data['description'], 'install' => $pop_data['plugin-slug'] );
82
+	$importers[$pop_data['importer-id']] = array($pop_data['name'], $pop_data['description'], 'install' => $pop_data['plugin-slug']);
83 83
 }
84 84
 
85
-if ( empty( $importers ) ) {
86
-	echo '<p>' . __('No importers are available.') . '</p>'; // TODO: make more helpful
85
+if (empty($importers)) {
86
+	echo '<p>'.__('No importers are available.').'</p>'; // TODO: make more helpful
87 87
 } else {
88
-	uasort( $importers, '_usort_by_first_member' );
88
+	uasort($importers, '_usort_by_first_member');
89 89
 ?>
90 90
 <table class="widefat importers striped">
91 91
 
92 92
 	<?php
93
-	foreach ( $importers as $importer_id => $data ) {
93
+	foreach ($importers as $importer_id => $data) {
94 94
 		$plugin_slug = $action = '';
95 95
 		$is_plugin_installed = false;
96 96
 
97
-		if ( isset( $data['install'] ) ) {
97
+		if (isset($data['install'])) {
98 98
 			$plugin_slug = $data['install'];
99 99
 
100
-			if ( file_exists( WP_PLUGIN_DIR . '/' . $plugin_slug ) ) {
100
+			if (file_exists(WP_PLUGIN_DIR.'/'.$plugin_slug)) {
101 101
 				// Looks like an importer is installed, but not active.
102
-				$plugins = get_plugins( '/' . $plugin_slug );
103
-				if ( ! empty( $plugins ) ) {
104
-					$keys = array_keys( $plugins );
105
-					$plugin_file = $plugin_slug . '/' . $keys[0];
106
-					$url = wp_nonce_url( add_query_arg( array(
102
+				$plugins = get_plugins('/'.$plugin_slug);
103
+				if ( ! empty($plugins)) {
104
+					$keys = array_keys($plugins);
105
+					$plugin_file = $plugin_slug.'/'.$keys[0];
106
+					$url = wp_nonce_url(add_query_arg(array(
107 107
 						'action' => 'activate',
108 108
 						'plugin' => $plugin_file,
109 109
 						'from'   => 'import',
110
-					), admin_url( 'plugins.php' ) ), 'activate-plugin_' . $plugin_file );
110
+					), admin_url('plugins.php')), 'activate-plugin_'.$plugin_file);
111 111
 					$action = sprintf(
112 112
 						'<a href="%s" aria-label="%s">%s</a>',
113
-						esc_url( $url ),
113
+						esc_url($url),
114 114
 						/* translators: %s: Importer name */
115
-						esc_attr( sprintf( __( 'Run %s' ), $data[0] ) ),
116
-						__( 'Run Importer' )
115
+						esc_attr(sprintf(__('Run %s'), $data[0])),
116
+						__('Run Importer')
117 117
 					);
118 118
 
119 119
 					$is_plugin_installed = true;
120 120
 				}
121 121
 			}
122 122
 
123
-			if ( empty( $action ) ) {
124
-				if ( is_main_site() ) {
125
-					$url = wp_nonce_url( add_query_arg( array(
123
+			if (empty($action)) {
124
+				if (is_main_site()) {
125
+					$url = wp_nonce_url(add_query_arg(array(
126 126
 						'action' => 'install-plugin',
127 127
 						'plugin' => $plugin_slug,
128 128
 						'from'   => 'import',
129
-					), self_admin_url( 'update.php' ) ), 'install-plugin_' . $plugin_slug );
129
+					), self_admin_url('update.php')), 'install-plugin_'.$plugin_slug);
130 130
 					$action = sprintf(
131 131
 						'<a href="%1$s" class="install-now" data-slug="%2$s" data-name="%3$s" aria-label="%4$s">%5$s</a>',
132
-						esc_url( $url ),
133
-						esc_attr( $plugin_slug ),
134
-						esc_attr( $data[0] ),
132
+						esc_url($url),
133
+						esc_attr($plugin_slug),
134
+						esc_attr($data[0]),
135 135
 						/* translators: %s: Importer name */
136
-						esc_attr( sprintf( __( 'Install %s' ), $data[0] ) ),
137
-						__( 'Install Now' )
136
+						esc_attr(sprintf(__('Install %s'), $data[0])),
137
+						__('Install Now')
138 138
 					);
139 139
 				} else {
140 140
 					$action = sprintf(
141 141
 						/* translators: URL to wp-admin/import.php */
142
-						__( 'This importer is not installed. Please install importers from <a href="%s">the main site</a>.' ),
143
-						get_admin_url( get_current_network_id(), 'import.php' )
142
+						__('This importer is not installed. Please install importers from <a href="%s">the main site</a>.'),
143
+						get_admin_url(get_current_network_id(), 'import.php')
144 144
 					);
145 145
 				}
146 146
 			}
147 147
 		} else {
148
-			$url = add_query_arg( array(
148
+			$url = add_query_arg(array(
149 149
 				'import' => $importer_id,
150
-			), self_admin_url( 'admin.php' ) );
150
+			), self_admin_url('admin.php'));
151 151
 			$action = sprintf(
152 152
 				'<a href="%1$s" aria-label="%2$s">%3$s</a>',
153
-				esc_url( $url ),
153
+				esc_url($url),
154 154
 				/* translators: %s: Importer name */
155
-				esc_attr( sprintf( __( 'Run %s' ), $data[0] ) ),
156
-				__( 'Run Importer' )
155
+				esc_attr(sprintf(__('Run %s'), $data[0])),
156
+				__('Run Importer')
157 157
 			);
158 158
 
159 159
 			$is_plugin_installed = true;
160 160
 		}
161 161
 
162
-		if ( ! $is_plugin_installed && is_main_site() ) {
163
-			$url = add_query_arg( array(
162
+		if ( ! $is_plugin_installed && is_main_site()) {
163
+			$url = add_query_arg(array(
164 164
 				'tab'       => 'plugin-information',
165 165
 				'plugin'    => $plugin_slug,
166 166
 				'from'      => 'import',
167 167
 				'TB_iframe' => 'true',
168 168
 				'width'     => 600,
169 169
 				'height'    => 550,
170
-			), network_admin_url( 'plugin-install.php' ) );
170
+			), network_admin_url('plugin-install.php'));
171 171
 			$action .= sprintf(
172 172
 				' | <a href="%1$s" class="thickbox open-plugin-details-modal" aria-label="%2$s">%3$s</a>',
173
-				esc_url( $url ),
173
+				esc_url($url),
174 174
 				/* translators: %s: Importer name */
175
-				esc_attr( sprintf( __( 'More information about %s' ), $data[0] ) ),
176
-				__( 'Details' )
175
+				esc_attr(sprintf(__('More information about %s'), $data[0])),
176
+				__('Details')
177 177
 			);
178 178
 		}
179 179
 
@@ -193,8 +193,8 @@  discard block
 block discarded – undo
193 193
 <?php
194 194
 }
195 195
 
196
-if ( current_user_can('install_plugins') )
197
-	echo '<p>' . sprintf( __('If the importer you need is not listed, <a href="%s">search the plugin directory</a> to see if an importer is available.'), esc_url( network_admin_url( 'plugin-install.php?tab=search&type=tag&s=importer' ) ) ) . '</p>';
196
+if (current_user_can('install_plugins'))
197
+	echo '<p>'.sprintf(__('If the importer you need is not listed, <a href="%s">search the plugin directory</a> to see if an importer is available.'), esc_url(network_admin_url('plugin-install.php?tab=search&type=tag&s=importer'))).'</p>';
198 198
 ?>
199 199
 
200 200
 </div>
@@ -203,4 +203,4 @@  discard block
 block discarded – undo
203 203
 wp_print_request_filesystem_credentials_modal();
204 204
 wp_print_admin_notice_templates();
205 205
 
206
-include( ABSPATH . 'wp-admin/admin-footer.php' );
206
+include(ABSPATH.'wp-admin/admin-footer.php');
Please login to merge, or discard this patch.