Completed
Push — master ( d488ab...6453e7 )
by Stephen
53:31
created
src/wp-admin/network.php 3 patches
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -1,14 +1,14 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Network installation administration panel.
4
- *
5
- * A multi-step process allowing the user to enable a network of WordPress sites.
6
- *
7
- * @since 3.0.0
8
- *
9
- * @package WordPress
10
- * @subpackage Administration
11
- */
3
+	 * Network installation administration panel.
4
+	 *
5
+	 * A multi-step process allowing the user to enable a network of WordPress sites.
6
+	 *
7
+	 * @since 3.0.0
8
+	 *
9
+	 * @package WordPress
10
+	 * @subpackage Administration
11
+	 */
12 12
 
13 13
 define( 'WP_INSTALLING_NETWORK', true );
14 14
 
@@ -64,23 +64,23 @@  discard block
 block discarded – undo
64 64
 	return true;
65 65
 }
66 66
 /**
67
- * Allow subdirectory install.
68
- *
69
- * @since 3.0.0
70
- *
71
- * @global wpdb $wpdb
72
- *
73
- * @return bool Whether subdirectory install is allowed
74
- */
67
+	 * Allow subdirectory install.
68
+	 *
69
+	 * @since 3.0.0
70
+	 *
71
+	 * @global wpdb $wpdb
72
+	 *
73
+	 * @return bool Whether subdirectory install is allowed
74
+	 */
75 75
 function allow_subdirectory_install() {
76 76
 	global $wpdb;
77
-        /**
78
-         * Filter whether to enable the subdirectory install feature in Multisite.
79
-         *
80
-         * @since 3.0.0
81
-         *
82
-         * @param bool true Whether to enable the subdirectory install feature in Multisite. Default is false.
83
-         */
77
+		/**
78
+		 * Filter whether to enable the subdirectory install feature in Multisite.
79
+		 *
80
+		 * @since 3.0.0
81
+		 *
82
+		 * @param bool true Whether to enable the subdirectory install feature in Multisite. Default is false.
83
+		 */
84 84
 	if ( apply_filters( 'allow_subdirectory_install', false ) )
85 85
 		return true;
86 86
 
@@ -94,11 +94,11 @@  discard block
 block discarded – undo
94 94
 	return false;
95 95
 }
96 96
 /**
97
- * Get base domain of network.
98
- *
99
- * @since 3.0.0
100
- * @return string Base domain.
101
- */
97
+	 * Get base domain of network.
98
+	 *
99
+	 * @since 3.0.0
100
+	 * @return string Base domain.
101
+	 */
102 102
 function get_clean_basedomain() {
103 103
 	if ( $existing_domain = network_domain_check() )
104 104
 		return $existing_domain;
@@ -472,8 +472,8 @@  discard block
 block discarded – undo
472 472
                     <match url="^' . $iis_subdir_match . 'files/(.+)" ignoreCase="false" />
473 473
                     <action type="Rewrite" url="' . $iis_rewrite_base . WPINC . '/ms-files.php?file={R:1}" appendQueryString="false" />
474 474
                 </rule>';
475
-                }
476
-                $web_config_file .= '
475
+				}
476
+				$web_config_file .= '
477 477
                 <rule name="WordPress Rule 2" stopProcessing="true">
478 478
                     <match url="^' . $iis_subdir_match . 'wp-admin$" ignoreCase="false" />
479 479
                     <action type="Redirect" url="' . $iis_subdir_replacement . 'wp-admin/" redirectType="Permanent" />
Please login to merge, or discard this patch.
Spacing   +206 added lines, -206 removed lines patch added patch discarded remove patch
@@ -10,25 +10,25 @@  discard block
 block discarded – undo
10 10
  * @subpackage Administration
11 11
  */
12 12
 
13
-define( 'WP_INSTALLING_NETWORK', true );
13
+define('WP_INSTALLING_NETWORK', true);
14 14
 
15 15
 /** WordPress Administration Bootstrap */
16
-require_once( dirname( __FILE__ ) . '/admin.php' );
16
+require_once(dirname(__FILE__).'/admin.php');
17 17
 
18
-if ( ! is_super_admin() )
19
-	wp_die( __( 'You do not have sufficient permissions to manage options for this site.' ) );
18
+if ( ! is_super_admin())
19
+	wp_die(__('You do not have sufficient permissions to manage options for this site.'));
20 20
 
21
-if ( is_multisite() ) {
22
-	if ( ! is_network_admin() ) {
23
-		wp_redirect( network_admin_url( 'setup.php' ) );
21
+if (is_multisite()) {
22
+	if ( ! is_network_admin()) {
23
+		wp_redirect(network_admin_url('setup.php'));
24 24
 		exit;
25 25
 	}
26
-	if ( ! defined( 'MULTISITE' ) )
27
-		wp_die( __( 'The Network creation panel is not for WordPress MU networks.' ) );
26
+	if ( ! defined('MULTISITE'))
27
+		wp_die(__('The Network creation panel is not for WordPress MU networks.'));
28 28
 }
29 29
 
30 30
 // We need to create references to ms global tables to enable Network.
31
-foreach ( $wpdb->tables( 'ms_global' ) as $table => $prefixed_table )
31
+foreach ($wpdb->tables('ms_global') as $table => $prefixed_table)
32 32
 	$wpdb->$table = $prefixed_table;
33 33
 
34 34
 /**
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
 function network_domain_check() {
44 44
 	global $wpdb;
45 45
 
46
-	$sql = $wpdb->prepare( "SHOW TABLES LIKE %s", $wpdb->esc_like( $wpdb->site ) );
47
-	if ( $wpdb->get_var( $sql ) ) {
48
-		return $wpdb->get_var( "SELECT domain FROM $wpdb->site ORDER BY id ASC LIMIT 1" );
46
+	$sql = $wpdb->prepare("SHOW TABLES LIKE %s", $wpdb->esc_like($wpdb->site));
47
+	if ($wpdb->get_var($sql)) {
48
+		return $wpdb->get_var("SELECT domain FROM $wpdb->site ORDER BY id ASC LIMIT 1");
49 49
 	}
50 50
 	return false;
51 51
 }
@@ -57,8 +57,8 @@  discard block
 block discarded – undo
57 57
  * @return bool Whether subdomain install is allowed
58 58
  */
59 59
 function allow_subdomain_install() {
60
-	$domain = preg_replace( '|https?://([^/]+)|', '$1', get_option( 'home' ) );
61
-	if ( parse_url( get_option( 'home' ), PHP_URL_PATH ) || 'localhost' == $domain || preg_match( '|^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$|', $domain ) )
60
+	$domain = preg_replace('|https?://([^/]+)|', '$1', get_option('home'));
61
+	if (parse_url(get_option('home'), PHP_URL_PATH) || 'localhost' == $domain || preg_match('|^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$|', $domain))
62 62
 		return false;
63 63
 
64 64
 	return true;
@@ -81,14 +81,14 @@  discard block
 block discarded – undo
81 81
          *
82 82
          * @param bool true Whether to enable the subdirectory install feature in Multisite. Default is false.
83 83
          */
84
-	if ( apply_filters( 'allow_subdirectory_install', false ) )
84
+	if (apply_filters('allow_subdirectory_install', false))
85 85
 		return true;
86 86
 
87
-	if ( defined( 'ALLOW_SUBDIRECTORY_INSTALL' ) && ALLOW_SUBDIRECTORY_INSTALL )
87
+	if (defined('ALLOW_SUBDIRECTORY_INSTALL') && ALLOW_SUBDIRECTORY_INSTALL)
88 88
 		return true;
89 89
 
90
-	$post = $wpdb->get_row( "SELECT ID FROM $wpdb->posts WHERE post_date < DATE_SUB(NOW(), INTERVAL 1 MONTH) AND post_status = 'publish'" );
91
-	if ( empty( $post ) )
90
+	$post = $wpdb->get_row("SELECT ID FROM $wpdb->posts WHERE post_date < DATE_SUB(NOW(), INTERVAL 1 MONTH) AND post_status = 'publish'");
91
+	if (empty($post))
92 92
 		return true;
93 93
 
94 94
 	return false;
@@ -100,52 +100,52 @@  discard block
 block discarded – undo
100 100
  * @return string Base domain.
101 101
  */
102 102
 function get_clean_basedomain() {
103
-	if ( $existing_domain = network_domain_check() )
103
+	if ($existing_domain = network_domain_check())
104 104
 		return $existing_domain;
105
-	$domain = preg_replace( '|https?://|', '', get_option( 'siteurl' ) );
106
-	if ( $slash = strpos( $domain, '/' ) )
107
-		$domain = substr( $domain, 0, $slash );
105
+	$domain = preg_replace('|https?://|', '', get_option('siteurl'));
106
+	if ($slash = strpos($domain, '/'))
107
+		$domain = substr($domain, 0, $slash);
108 108
 	return $domain;
109 109
 }
110 110
 
111
-if ( ! network_domain_check() && ( ! defined( 'WP_ALLOW_MULTISITE' ) || ! WP_ALLOW_MULTISITE ) )
112
-	wp_die( __( 'You must define the <code>WP_ALLOW_MULTISITE</code> constant as true in your wp-config.php file to allow creation of a Network.' ) );
111
+if ( ! network_domain_check() && ( ! defined('WP_ALLOW_MULTISITE') || ! WP_ALLOW_MULTISITE))
112
+	wp_die(__('You must define the <code>WP_ALLOW_MULTISITE</code> constant as true in your wp-config.php file to allow creation of a Network.'));
113 113
 
114
-if ( is_network_admin() ) {
115
-	$title = __( 'Network Setup' );
114
+if (is_network_admin()) {
115
+	$title = __('Network Setup');
116 116
 	$parent_file = 'settings.php';
117 117
 } else {
118
-	$title = __( 'Create a Network of WordPress Sites' );
118
+	$title = __('Create a Network of WordPress Sites');
119 119
 	$parent_file = 'tools.php';
120 120
 }
121 121
 
122
-$network_help = '<p>' . __('This screen allows you to configure a network as having subdomains (<code>site1.example.com</code>) or subdirectories (<code>example.com/site1</code>). Subdomains require wildcard subdomains to be enabled in Apache and DNS records, if your host allows it.') . '</p>' .
123
-	'<p>' . __('Choose subdomains or subdirectories; this can only be switched afterwards by reconfiguring your install. Fill out the network details, and click install. If this does not work, you may have to add a wildcard DNS record (for subdomains) or change to another setting in Permalinks (for subdirectories).') . '</p>' .
124
-	'<p>' . __('The next screen for Network Setup will give you individually-generated lines of code to add to your wp-config.php and .htaccess files. Make sure the settings of your FTP client make files starting with a dot visible, so that you can find .htaccess; you may have to create this file if it really is not there. Make backup copies of those two files.') . '</p>' .
125
-	'<p>' . __('Add the designated lines of code to wp-config.php (just before <code>/*...stop editing...*/</code>) and <code>.htaccess</code> (replacing the existing WordPress rules).') . '</p>' .
126
-	'<p>' . __('Once you add this code and refresh your browser, multisite should be enabled. This screen, now in the Network Admin navigation menu, will keep an archive of the added code. You can toggle between Network Admin and Site Admin by clicking on the Network Admin or an individual site name under the My Sites dropdown in the Toolbar.') . '</p>' .
127
-	'<p>' . __('The choice of subdirectory sites is disabled if this setup is more than a month old because of permalink problems with &#8220;/blog/&#8221; from the main site. This disabling will be addressed in a future version.') . '</p>' .
128
-	'<p><strong>' . __('For more information:') . '</strong></p>' .
129
-	'<p>' . __('<a href="https://codex.wordpress.org/Create_A_Network" target="_blank">Documentation on Creating a Network</a>') . '</p>' .
130
-	'<p>' . __('<a href="https://codex.wordpress.org/Tools_Network_Screen" target="_blank">Documentation on the Network Screen</a>') . '</p>';
131
-
132
-get_current_screen()->add_help_tab( array(
122
+$network_help = '<p>'.__('This screen allows you to configure a network as having subdomains (<code>site1.example.com</code>) or subdirectories (<code>example.com/site1</code>). Subdomains require wildcard subdomains to be enabled in Apache and DNS records, if your host allows it.').'</p>'.
123
+	'<p>'.__('Choose subdomains or subdirectories; this can only be switched afterwards by reconfiguring your install. Fill out the network details, and click install. If this does not work, you may have to add a wildcard DNS record (for subdomains) or change to another setting in Permalinks (for subdirectories).').'</p>'.
124
+	'<p>'.__('The next screen for Network Setup will give you individually-generated lines of code to add to your wp-config.php and .htaccess files. Make sure the settings of your FTP client make files starting with a dot visible, so that you can find .htaccess; you may have to create this file if it really is not there. Make backup copies of those two files.').'</p>'.
125
+	'<p>'.__('Add the designated lines of code to wp-config.php (just before <code>/*...stop editing...*/</code>) and <code>.htaccess</code> (replacing the existing WordPress rules).').'</p>'.
126
+	'<p>'.__('Once you add this code and refresh your browser, multisite should be enabled. This screen, now in the Network Admin navigation menu, will keep an archive of the added code. You can toggle between Network Admin and Site Admin by clicking on the Network Admin or an individual site name under the My Sites dropdown in the Toolbar.').'</p>'.
127
+	'<p>'.__('The choice of subdirectory sites is disabled if this setup is more than a month old because of permalink problems with &#8220;/blog/&#8221; from the main site. This disabling will be addressed in a future version.').'</p>'.
128
+	'<p><strong>'.__('For more information:').'</strong></p>'.
129
+	'<p>'.__('<a href="https://codex.wordpress.org/Create_A_Network" target="_blank">Documentation on Creating a Network</a>').'</p>'.
130
+	'<p>'.__('<a href="https://codex.wordpress.org/Tools_Network_Screen" target="_blank">Documentation on the Network Screen</a>').'</p>';
131
+
132
+get_current_screen()->add_help_tab(array(
133 133
 	'id'      => 'network',
134 134
 	'title'   => __('Network'),
135 135
 	'content' => $network_help,
136
-) );
136
+));
137 137
 
138 138
 get_current_screen()->set_help_sidebar(
139
-	'<p><strong>' . __('For more information:') . '</strong></p>' .
140
-	'<p>' . __('<a href="https://codex.wordpress.org/Create_A_Network" target="_blank">Documentation on Creating a Network</a>') . '</p>' .
141
-	'<p>' . __('<a href="https://codex.wordpress.org/Tools_Network_Screen" target="_blank">Documentation on the Network Screen</a>') . '</p>' .
142
-	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
139
+	'<p><strong>'.__('For more information:').'</strong></p>'.
140
+	'<p>'.__('<a href="https://codex.wordpress.org/Create_A_Network" target="_blank">Documentation on Creating a Network</a>').'</p>'.
141
+	'<p>'.__('<a href="https://codex.wordpress.org/Tools_Network_Screen" target="_blank">Documentation on the Network Screen</a>').'</p>'.
142
+	'<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>'
143 143
 );
144 144
 
145
-include( ABSPATH . 'wp-admin/admin-header.php' );
145
+include(ABSPATH.'wp-admin/admin-header.php');
146 146
 ?>
147 147
 <div class="wrap">
148
-<h1><?php echo esc_html( $title ); ?></h1>
148
+<h1><?php echo esc_html($title); ?></h1>
149 149
 
150 150
 <?php
151 151
 /**
@@ -160,90 +160,90 @@  discard block
 block discarded – undo
160 160
  *
161 161
  * @param WP_Error $errors
162 162
  */
163
-function network_step1( $errors = false ) {
163
+function network_step1($errors = false) {
164 164
 	global $is_apache;
165 165
 
166
-	if ( defined('DO_NOT_UPGRADE_GLOBAL_TABLES') ) {
167
-		echo '<div class="error"><p><strong>' . __('ERROR:') . '</strong> ' . __( 'The constant DO_NOT_UPGRADE_GLOBAL_TABLES cannot be defined when creating a network.' ) . '</p></div>';
166
+	if (defined('DO_NOT_UPGRADE_GLOBAL_TABLES')) {
167
+		echo '<div class="error"><p><strong>'.__('ERROR:').'</strong> '.__('The constant DO_NOT_UPGRADE_GLOBAL_TABLES cannot be defined when creating a network.').'</p></div>';
168 168
 		echo '</div>';
169
-		include( ABSPATH . 'wp-admin/admin-footer.php' );
169
+		include(ABSPATH.'wp-admin/admin-footer.php');
170 170
 		die();
171 171
 	}
172 172
 
173
-	$active_plugins = get_option( 'active_plugins' );
174
-	if ( ! empty( $active_plugins ) ) {
175
-		echo '<div class="updated"><p><strong>' . __('Warning:') . '</strong> ' . sprintf( __( 'Please <a href="%s">deactivate your plugins</a> before enabling the Network feature.' ), admin_url( 'plugins.php?plugin_status=active' ) ) . '</p></div><p>' . __( 'Once the network is created, you may reactivate your plugins.' ) . '</p>';
173
+	$active_plugins = get_option('active_plugins');
174
+	if ( ! empty($active_plugins)) {
175
+		echo '<div class="updated"><p><strong>'.__('Warning:').'</strong> '.sprintf(__('Please <a href="%s">deactivate your plugins</a> before enabling the Network feature.'), admin_url('plugins.php?plugin_status=active')).'</p></div><p>'.__('Once the network is created, you may reactivate your plugins.').'</p>';
176 176
 		echo '</div>';
177
-		include( ABSPATH . 'wp-admin/admin-footer.php' );
177
+		include(ABSPATH.'wp-admin/admin-footer.php');
178 178
 		die();
179 179
 	}
180 180
 
181 181
 	$hostname = get_clean_basedomain();
182
-	$has_ports = strstr( $hostname, ':' );
183
-	if ( ( false !== $has_ports && ! in_array( $has_ports, array( ':80', ':443' ) ) ) ) {
184
-		echo '<div class="error"><p><strong>' . __( 'ERROR:') . '</strong> ' . __( 'You cannot install a network of sites with your server address.' ) . '</p></div>';
185
-		echo '<p>' . sprintf( __( 'You cannot use port numbers such as <code>%s</code>.' ), $has_ports ) . '</p>';
186
-		echo '<a href="' . esc_url( admin_url() ) . '">' . __( 'Return to Dashboard' ) . '</a>';
182
+	$has_ports = strstr($hostname, ':');
183
+	if ((false !== $has_ports && ! in_array($has_ports, array(':80', ':443')))) {
184
+		echo '<div class="error"><p><strong>'.__('ERROR:').'</strong> '.__('You cannot install a network of sites with your server address.').'</p></div>';
185
+		echo '<p>'.sprintf(__('You cannot use port numbers such as <code>%s</code>.'), $has_ports).'</p>';
186
+		echo '<a href="'.esc_url(admin_url()).'">'.__('Return to Dashboard').'</a>';
187 187
 		echo '</div>';
188
-		include( ABSPATH . 'wp-admin/admin-footer.php' );
188
+		include(ABSPATH.'wp-admin/admin-footer.php');
189 189
 		die();
190 190
 	}
191 191
 
192 192
 	echo '<form method="post">';
193 193
 
194
-	wp_nonce_field( 'install-network-1' );
194
+	wp_nonce_field('install-network-1');
195 195
 
196 196
 	$error_codes = array();
197
-	if ( is_wp_error( $errors ) ) {
198
-		echo '<div class="error"><p><strong>' . __( 'ERROR: The network could not be created.' ) . '</strong></p>';
199
-		foreach ( $errors->get_error_messages() as $error )
197
+	if (is_wp_error($errors)) {
198
+		echo '<div class="error"><p><strong>'.__('ERROR: The network could not be created.').'</strong></p>';
199
+		foreach ($errors->get_error_messages() as $error)
200 200
 			echo "<p>$error</p>";
201 201
 		echo '</div>';
202 202
 		$error_codes = $errors->get_error_codes();
203 203
 	}
204 204
 
205
-	$site_name = ( ! empty( $_POST['sitename'] ) && ! in_array( 'empty_sitename', $error_codes ) ) ? $_POST['sitename'] : sprintf( _x('%s Sites', 'Default network name' ), get_option( 'blogname' ) );
206
-	$admin_email = ( ! empty( $_POST['email'] ) && ! in_array( 'invalid_email', $error_codes ) ) ? $_POST['email'] : get_option( 'admin_email' );
205
+	$site_name = ( ! empty($_POST['sitename']) && ! in_array('empty_sitename', $error_codes)) ? $_POST['sitename'] : sprintf(_x('%s Sites', 'Default network name'), get_option('blogname'));
206
+	$admin_email = ( ! empty($_POST['email']) && ! in_array('invalid_email', $error_codes)) ? $_POST['email'] : get_option('admin_email');
207 207
 	?>
208
-	<p><?php _e( 'Welcome to the Network installation process!' ); ?></p>
209
-	<p><?php _e( 'Fill in the information below and you&#8217;ll be on your way to creating a network of WordPress sites. We will create configuration files in the next step.' ); ?></p>
208
+	<p><?php _e('Welcome to the Network installation process!'); ?></p>
209
+	<p><?php _e('Fill in the information below and you&#8217;ll be on your way to creating a network of WordPress sites. We will create configuration files in the next step.'); ?></p>
210 210
 	<?php
211 211
 
212
-	if ( isset( $_POST['subdomain_install'] ) ) {
212
+	if (isset($_POST['subdomain_install'])) {
213 213
 		$subdomain_install = (bool) $_POST['subdomain_install'];
214
-	} elseif ( apache_mod_loaded('mod_rewrite') ) { // assume nothing
214
+	} elseif (apache_mod_loaded('mod_rewrite')) { // assume nothing
215 215
 		$subdomain_install = true;
216
-	} elseif ( !allow_subdirectory_install() ) {
216
+	} elseif ( ! allow_subdirectory_install()) {
217 217
 		$subdomain_install = true;
218 218
 	} else {
219 219
 		$subdomain_install = false;
220
-		if ( $got_mod_rewrite = got_mod_rewrite() ) // dangerous assumptions
221
-			echo '<div class="updated inline"><p><strong>' . __( 'Note:' ) . '</strong> ' . __( 'Please make sure the Apache <code>mod_rewrite</code> module is installed as it will be used at the end of this installation.' ) . '</p>';
222
-		elseif ( $is_apache )
223
-			echo '<div class="error inline"><p><strong>' . __( 'Warning!' ) . '</strong> ' . __( 'It looks like the Apache <code>mod_rewrite</code> module is not installed.' ) . '</p>';
224
-		if ( $got_mod_rewrite || $is_apache ) // Protect against mod_rewrite mimicry (but ! Apache)
225
-			echo '<p>' . __( 'If <code>mod_rewrite</code> is disabled, ask your administrator to enable that module, or look at the <a href="http://httpd.apache.org/docs/mod/mod_rewrite.html">Apache documentation</a> or <a href="http://www.google.com/search?q=apache+mod_rewrite">elsewhere</a> for help setting it up.' ) . '</p></div>';
220
+		if ($got_mod_rewrite = got_mod_rewrite()) // dangerous assumptions
221
+			echo '<div class="updated inline"><p><strong>'.__('Note:').'</strong> '.__('Please make sure the Apache <code>mod_rewrite</code> module is installed as it will be used at the end of this installation.').'</p>';
222
+		elseif ($is_apache)
223
+			echo '<div class="error inline"><p><strong>'.__('Warning!').'</strong> '.__('It looks like the Apache <code>mod_rewrite</code> module is not installed.').'</p>';
224
+		if ($got_mod_rewrite || $is_apache) // Protect against mod_rewrite mimicry (but ! Apache)
225
+			echo '<p>'.__('If <code>mod_rewrite</code> is disabled, ask your administrator to enable that module, or look at the <a href="http://httpd.apache.org/docs/mod/mod_rewrite.html">Apache documentation</a> or <a href="http://www.google.com/search?q=apache+mod_rewrite">elsewhere</a> for help setting it up.').'</p></div>';
226 226
 	}
227 227
 
228
-	if ( allow_subdomain_install() && allow_subdirectory_install() ) : ?>
229
-		<h3><?php esc_html_e( 'Addresses of Sites in your Network' ); ?></h3>
230
-		<p><?php _e( 'Please choose whether you would like sites in your WordPress network to use sub-domains or sub-directories. <strong>You cannot change this later.</strong>' ); ?></p>
231
-		<p><?php _e( 'You will need a wildcard DNS record if you are going to use the virtual host (sub-domain) functionality.' ); ?></p>
228
+	if (allow_subdomain_install() && allow_subdirectory_install()) : ?>
229
+		<h3><?php esc_html_e('Addresses of Sites in your Network'); ?></h3>
230
+		<p><?php _e('Please choose whether you would like sites in your WordPress network to use sub-domains or sub-directories. <strong>You cannot change this later.</strong>'); ?></p>
231
+		<p><?php _e('You will need a wildcard DNS record if you are going to use the virtual host (sub-domain) functionality.'); ?></p>
232 232
 		<?php // @todo: Link to an MS readme? ?>
233 233
 		<table class="form-table">
234 234
 			<tr>
235
-				<th><label><input type="radio" name="subdomain_install" value="1"<?php checked( $subdomain_install ); ?> /> <?php _e( 'Sub-domains' ); ?></label></th>
235
+				<th><label><input type="radio" name="subdomain_install" value="1"<?php checked($subdomain_install); ?> /> <?php _e('Sub-domains'); ?></label></th>
236 236
 				<td><?php printf(
237 237
 					/* translators: 1: hostname */
238
-					_x( 'like <code>site1.%1$s</code> and <code>site2.%1$s</code>', 'subdomain examples' ),
238
+					_x('like <code>site1.%1$s</code> and <code>site2.%1$s</code>', 'subdomain examples'),
239 239
 					$hostname
240 240
 				); ?></td>
241 241
 			</tr>
242 242
 			<tr>
243
-				<th><label><input type="radio" name="subdomain_install" value="0"<?php checked( ! $subdomain_install ); ?> /> <?php _e( 'Sub-directories' ); ?></label></th>
243
+				<th><label><input type="radio" name="subdomain_install" value="0"<?php checked( ! $subdomain_install); ?> /> <?php _e('Sub-directories'); ?></label></th>
244 244
 				<td><?php printf(
245 245
 					/* translators: 1: hostname */
246
-					_x( 'like <code>%1$s/site1</code> and <code>%1$s/site2</code>', 'subdirectory examples' ),
246
+					_x('like <code>%1$s/site1</code> and <code>%1$s/site2</code>', 'subdirectory examples'),
247 247
 					$hostname
248 248
 				); ?></td>
249 249
 			</tr>
@@ -252,82 +252,82 @@  discard block
 block discarded – undo
252 252
 <?php
253 253
 	endif;
254 254
 
255
-		if ( WP_CONTENT_DIR != ABSPATH . 'wp-content' && ( allow_subdirectory_install() || ! allow_subdomain_install() ) )
256
-			echo '<div class="error inline"><p><strong>' . __('Warning!') . '</strong> ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</p></div>';
255
+		if (WP_CONTENT_DIR != ABSPATH.'wp-content' && (allow_subdirectory_install() || ! allow_subdomain_install()))
256
+			echo '<div class="error inline"><p><strong>'.__('Warning!').'</strong> '.__('Subdirectory networks may not be fully compatible with custom wp-content directories.').'</p></div>';
257 257
 
258
-		$is_www = ( 0 === strpos( $hostname, 'www.' ) );
259
-		if ( $is_www ) :
258
+		$is_www = (0 === strpos($hostname, 'www.'));
259
+		if ($is_www) :
260 260
 		?>
261
-		<h3><?php esc_html_e( 'Server Address' ); ?></h3>
262
-		<p><?php printf( __( 'We recommend you change your siteurl to <code>%1$s</code> before enabling the network feature. It will still be possible to visit your site using the <code>www</code> prefix with an address like <code>%2$s</code> but any links will not have the <code>www</code> prefix.' ), substr( $hostname, 4 ), $hostname ); ?></p>
261
+		<h3><?php esc_html_e('Server Address'); ?></h3>
262
+		<p><?php printf(__('We recommend you change your siteurl to <code>%1$s</code> before enabling the network feature. It will still be possible to visit your site using the <code>www</code> prefix with an address like <code>%2$s</code> but any links will not have the <code>www</code> prefix.'), substr($hostname, 4), $hostname); ?></p>
263 263
 		<table class="form-table">
264 264
 			<tr>
265
-				<th scope='row'><?php esc_html_e( 'Server Address' ); ?></th>
265
+				<th scope='row'><?php esc_html_e('Server Address'); ?></th>
266 266
 				<td>
267
-					<?php printf( __( 'The internet address of your network will be <code>%s</code>.' ), $hostname ); ?>
267
+					<?php printf(__('The internet address of your network will be <code>%s</code>.'), $hostname); ?>
268 268
 				</td>
269 269
 			</tr>
270 270
 		</table>
271 271
 		<?php endif; ?>
272 272
 
273
-		<h3><?php esc_html_e( 'Network Details' ); ?></h3>
273
+		<h3><?php esc_html_e('Network Details'); ?></h3>
274 274
 		<table class="form-table">
275
-		<?php if ( 'localhost' == $hostname ) : ?>
275
+		<?php if ('localhost' == $hostname) : ?>
276 276
 			<tr>
277
-				<th scope="row"><?php esc_html_e( 'Sub-directory Install' ); ?></th>
277
+				<th scope="row"><?php esc_html_e('Sub-directory Install'); ?></th>
278 278
 				<td><?php
279
-					_e( 'Because you are using <code>localhost</code>, the sites in your WordPress network must use sub-directories. Consider using <code>localhost.localdomain</code> if you wish to use sub-domains.' );
279
+					_e('Because you are using <code>localhost</code>, the sites in your WordPress network must use sub-directories. Consider using <code>localhost.localdomain</code> if you wish to use sub-domains.');
280 280
 					// Uh oh:
281
-					if ( !allow_subdirectory_install() )
282
-						echo ' <strong>' . __( 'Warning!' ) . ' ' . __( 'The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.' ) . '</strong>';
281
+					if ( ! allow_subdirectory_install())
282
+						echo ' <strong>'.__('Warning!').' '.__('The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.').'</strong>';
283 283
 				?></td>
284 284
 			</tr>
285
-		<?php elseif ( !allow_subdomain_install() ) : ?>
285
+		<?php elseif ( ! allow_subdomain_install()) : ?>
286 286
 			<tr>
287
-				<th scope="row"><?php esc_html_e( 'Sub-directory Install' ); ?></th>
287
+				<th scope="row"><?php esc_html_e('Sub-directory Install'); ?></th>
288 288
 				<td><?php
289
-					_e( 'Because your install is in a directory, the sites in your WordPress network must use sub-directories.' );
289
+					_e('Because your install is in a directory, the sites in your WordPress network must use sub-directories.');
290 290
 					// Uh oh:
291
-					if ( !allow_subdirectory_install() )
292
-						echo ' <strong>' . __( 'Warning!' ) . ' ' . __( 'The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.' ) . '</strong>';
291
+					if ( ! allow_subdirectory_install())
292
+						echo ' <strong>'.__('Warning!').' '.__('The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.').'</strong>';
293 293
 				?></td>
294 294
 			</tr>
295
-		<?php elseif ( !allow_subdirectory_install() ) : ?>
295
+		<?php elseif ( ! allow_subdirectory_install()) : ?>
296 296
 			<tr>
297
-				<th scope="row"><?php esc_html_e( 'Sub-domain Install' ); ?></th>
298
-				<td><?php _e( 'Because your install is not new, the sites in your WordPress network must use sub-domains.' );
299
-					echo ' <strong>' . __( 'The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.' ) . '</strong>';
297
+				<th scope="row"><?php esc_html_e('Sub-domain Install'); ?></th>
298
+				<td><?php _e('Because your install is not new, the sites in your WordPress network must use sub-domains.');
299
+					echo ' <strong>'.__('The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.').'</strong>';
300 300
 				?></td>
301 301
 			</tr>
302 302
 		<?php endif; ?>
303
-		<?php if ( ! $is_www ) : ?>
303
+		<?php if ( ! $is_www) : ?>
304 304
 			<tr>
305
-				<th scope='row'><?php esc_html_e( 'Server Address' ); ?></th>
305
+				<th scope='row'><?php esc_html_e('Server Address'); ?></th>
306 306
 				<td>
307
-					<?php printf( __( 'The internet address of your network will be <code>%s</code>.' ), $hostname ); ?>
307
+					<?php printf(__('The internet address of your network will be <code>%s</code>.'), $hostname); ?>
308 308
 				</td>
309 309
 			</tr>
310 310
 		<?php endif; ?>
311 311
 			<tr>
312
-				<th scope='row'><?php esc_html_e( 'Network Title' ); ?></th>
312
+				<th scope='row'><?php esc_html_e('Network Title'); ?></th>
313 313
 				<td>
314
-					<input name='sitename' type='text' size='45' value='<?php echo esc_attr( $site_name ); ?>' />
314
+					<input name='sitename' type='text' size='45' value='<?php echo esc_attr($site_name); ?>' />
315 315
 					<p class="description">
316
-						<?php _e( 'What would you like to call your network?' ); ?>
316
+						<?php _e('What would you like to call your network?'); ?>
317 317
 					</p>
318 318
 				</td>
319 319
 			</tr>
320 320
 			<tr>
321
-				<th scope='row'><?php esc_html_e( 'Network Admin Email' ); ?></th>
321
+				<th scope='row'><?php esc_html_e('Network Admin Email'); ?></th>
322 322
 				<td>
323
-					<input name='email' type='text' size='45' value='<?php echo esc_attr( $admin_email ); ?>' />
323
+					<input name='email' type='text' size='45' value='<?php echo esc_attr($admin_email); ?>' />
324 324
 					<p class="description">
325
-						<?php _e( 'Your email address.' ); ?>
325
+						<?php _e('Your email address.'); ?>
326 326
 					</p>
327 327
 				</td>
328 328
 			</tr>
329 329
 		</table>
330
-		<?php submit_button( __( 'Install' ), 'primary', 'submit' ); ?>
330
+		<?php submit_button(__('Install'), 'primary', 'submit'); ?>
331 331
 	</form>
332 332
 	<?php
333 333
 }
@@ -341,45 +341,45 @@  discard block
 block discarded – undo
341 341
  *
342 342
  * @param WP_Error $errors
343 343
  */
344
-function network_step2( $errors = false ) {
344
+function network_step2($errors = false) {
345 345
 	global $wpdb;
346 346
 
347 347
 	$hostname          = get_clean_basedomain();
348
-	$slashed_home      = trailingslashit( get_option( 'home' ) );
349
-	$base              = parse_url( $slashed_home, PHP_URL_PATH );
350
-	$document_root_fix = str_replace( '\\', '/', realpath( $_SERVER['DOCUMENT_ROOT'] ) );
351
-	$abspath_fix       = str_replace( '\\', '/', ABSPATH );
352
-	$home_path         = 0 === strpos( $abspath_fix, $document_root_fix ) ? $document_root_fix . $base : get_home_path();
353
-	$wp_siteurl_subdir = preg_replace( '#^' . preg_quote( $home_path, '#' ) . '#', '', $abspath_fix );
354
-	$rewrite_base      = ! empty( $wp_siteurl_subdir ) ? ltrim( trailingslashit( $wp_siteurl_subdir ), '/' ) : '';
348
+	$slashed_home      = trailingslashit(get_option('home'));
349
+	$base              = parse_url($slashed_home, PHP_URL_PATH);
350
+	$document_root_fix = str_replace('\\', '/', realpath($_SERVER['DOCUMENT_ROOT']));
351
+	$abspath_fix       = str_replace('\\', '/', ABSPATH);
352
+	$home_path         = 0 === strpos($abspath_fix, $document_root_fix) ? $document_root_fix.$base : get_home_path();
353
+	$wp_siteurl_subdir = preg_replace('#^'.preg_quote($home_path, '#').'#', '', $abspath_fix);
354
+	$rewrite_base      = ! empty($wp_siteurl_subdir) ? ltrim(trailingslashit($wp_siteurl_subdir), '/') : '';
355 355
 
356 356
 
357 357
 	$location_of_wp_config = $abspath_fix;
358
-	if ( ! file_exists( ABSPATH . 'wp-config.php' ) && file_exists( dirname( ABSPATH ) . '/wp-config.php' ) ) {
359
-		$location_of_wp_config = dirname( $abspath_fix );
358
+	if ( ! file_exists(ABSPATH.'wp-config.php') && file_exists(dirname(ABSPATH).'/wp-config.php')) {
359
+		$location_of_wp_config = dirname($abspath_fix);
360 360
 	}
361
-	$location_of_wp_config = trailingslashit( $location_of_wp_config );
361
+	$location_of_wp_config = trailingslashit($location_of_wp_config);
362 362
 
363 363
 	// Wildcard DNS message.
364
-	if ( is_wp_error( $errors ) )
365
-		echo '<div class="error">' . $errors->get_error_message() . '</div>';
364
+	if (is_wp_error($errors))
365
+		echo '<div class="error">'.$errors->get_error_message().'</div>';
366 366
 
367
-	if ( $_POST ) {
368
-		if ( allow_subdomain_install() )
369
-			$subdomain_install = allow_subdirectory_install() ? ! empty( $_POST['subdomain_install'] ) : true;
367
+	if ($_POST) {
368
+		if (allow_subdomain_install())
369
+			$subdomain_install = allow_subdirectory_install() ? ! empty($_POST['subdomain_install']) : true;
370 370
 		else
371 371
 			$subdomain_install = false;
372 372
 	} else {
373
-		if ( is_multisite() ) {
373
+		if (is_multisite()) {
374 374
 			$subdomain_install = is_subdomain_install();
375 375
 ?>
376
-	<p><?php _e( 'The original configuration steps are shown here for reference.' ); ?></p>
376
+	<p><?php _e('The original configuration steps are shown here for reference.'); ?></p>
377 377
 <?php
378 378
 		} else {
379
-			$subdomain_install = (bool) $wpdb->get_var( "SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = 1 AND meta_key = 'subdomain_install'" );
379
+			$subdomain_install = (bool) $wpdb->get_var("SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = 1 AND meta_key = 'subdomain_install'");
380 380
 ?>
381
-	<div class="error"><p><strong><?php _e('Warning:'); ?></strong> <?php _e( 'An existing WordPress network was detected.' ); ?></p></div>
382
-	<p><?php _e( 'Please complete the configuration steps. To create a new network, you will need to empty or remove the network database tables.' ); ?></p>
381
+	<div class="error"><p><strong><?php _e('Warning:'); ?></strong> <?php _e('An existing WordPress network was detected.'); ?></p></div>
382
+	<p><?php _e('Please complete the configuration steps. To create a new network, you will need to empty or remove the network database tables.'); ?></p>
383 383
 <?php
384 384
 		}
385 385
 	}
@@ -388,23 +388,23 @@  discard block
 block discarded – undo
388 388
 	$subdir_replacement_01 = $subdomain_install ? '' : '$1';
389 389
 	$subdir_replacement_12 = $subdomain_install ? '$1' : '$2';
390 390
 
391
-	if ( $_POST || ! is_multisite() ) {
391
+	if ($_POST || ! is_multisite()) {
392 392
 ?>
393
-		<h3><?php esc_html_e( 'Enabling the Network' ); ?></h3>
394
-		<p><?php _e( 'Complete the following steps to enable the features for creating a network of sites.' ); ?></p>
393
+		<h3><?php esc_html_e('Enabling the Network'); ?></h3>
394
+		<p><?php _e('Complete the following steps to enable the features for creating a network of sites.'); ?></p>
395 395
 		<div class="updated inline"><p><?php
396
-			if ( file_exists( $home_path . '.htaccess' ) )
397
-				printf( __( '<strong>Caution:</strong> We recommend you back up your existing <code>wp-config.php</code> and <code>%s</code> files.' ), '.htaccess' );
398
-			elseif ( file_exists( $home_path . 'web.config' ) )
399
-				printf( __( '<strong>Caution:</strong> We recommend you back up your existing <code>wp-config.php</code> and <code>%s</code> files.' ), 'web.config' );
396
+			if (file_exists($home_path.'.htaccess'))
397
+				printf(__('<strong>Caution:</strong> We recommend you back up your existing <code>wp-config.php</code> and <code>%s</code> files.'), '.htaccess');
398
+			elseif (file_exists($home_path.'web.config'))
399
+				printf(__('<strong>Caution:</strong> We recommend you back up your existing <code>wp-config.php</code> and <code>%s</code> files.'), 'web.config');
400 400
 			else
401
-				_e( '<strong>Caution:</strong> We recommend you back up your existing <code>wp-config.php</code> file.' );
401
+				_e('<strong>Caution:</strong> We recommend you back up your existing <code>wp-config.php</code> file.');
402 402
 		?></p></div>
403 403
 <?php
404 404
 	}
405 405
 ?>
406 406
 		<ol>
407
-			<li><p><?php printf( __( 'Add the following to your <code>wp-config.php</code> file in <code>%s</code> <strong>above</strong> the line reading <code>/* That&#8217;s all, stop editing! Happy blogging. */</code>:' ), $location_of_wp_config ); ?></p>
407
+			<li><p><?php printf(__('Add the following to your <code>wp-config.php</code> file in <code>%s</code> <strong>above</strong> the line reading <code>/* That&#8217;s all, stop editing! Happy blogging. */</code>:'), $location_of_wp_config); ?></p>
408 408
 				<textarea class="code" readonly="readonly" cols="100" rows="7">
409 409
 define('MULTISITE', true);
410 410
 define('SUBDOMAIN_INSTALL', <?php echo $subdomain_install ? 'true' : 'false'; ?>);
@@ -414,47 +414,47 @@  discard block
 block discarded – undo
414 414
 define('BLOG_ID_CURRENT_SITE', 1);
415 415
 </textarea>
416 416
 <?php
417
-	$keys_salts = array( 'AUTH_KEY' => '', 'SECURE_AUTH_KEY' => '', 'LOGGED_IN_KEY' => '', 'NONCE_KEY' => '', 'AUTH_SALT' => '', 'SECURE_AUTH_SALT' => '', 'LOGGED_IN_SALT' => '', 'NONCE_SALT' => '' );
418
-	foreach ( $keys_salts as $c => $v ) {
419
-		if ( defined( $c ) )
420
-			unset( $keys_salts[ $c ] );
417
+	$keys_salts = array('AUTH_KEY' => '', 'SECURE_AUTH_KEY' => '', 'LOGGED_IN_KEY' => '', 'NONCE_KEY' => '', 'AUTH_SALT' => '', 'SECURE_AUTH_SALT' => '', 'LOGGED_IN_SALT' => '', 'NONCE_SALT' => '');
418
+	foreach ($keys_salts as $c => $v) {
419
+		if (defined($c))
420
+			unset($keys_salts[$c]);
421 421
 	}
422 422
 
423
-	if ( ! empty( $keys_salts ) ) {
423
+	if ( ! empty($keys_salts)) {
424 424
 		$keys_salts_str = '';
425
-		$from_api = wp_remote_get( 'https://api.wordpress.org/secret-key/1.1/salt/' );
426
-		if ( is_wp_error( $from_api ) ) {
427
-			foreach ( $keys_salts as $c => $v ) {
428
-				$keys_salts_str .= "\ndefine( '$c', '" . wp_generate_password( 64, true, true ) . "' );";
425
+		$from_api = wp_remote_get('https://api.wordpress.org/secret-key/1.1/salt/');
426
+		if (is_wp_error($from_api)) {
427
+			foreach ($keys_salts as $c => $v) {
428
+				$keys_salts_str .= "\ndefine( '$c', '".wp_generate_password(64, true, true)."' );";
429 429
 			}
430 430
 		} else {
431
-			$from_api = explode( "\n", wp_remote_retrieve_body( $from_api ) );
432
-			foreach ( $keys_salts as $c => $v ) {
433
-				$keys_salts_str .= "\ndefine( '$c', '" . substr( array_shift( $from_api ), 28, 64 ) . "' );";
431
+			$from_api = explode("\n", wp_remote_retrieve_body($from_api));
432
+			foreach ($keys_salts as $c => $v) {
433
+				$keys_salts_str .= "\ndefine( '$c', '".substr(array_shift($from_api), 28, 64)."' );";
434 434
 			}
435 435
 		}
436
-		$num_keys_salts = count( $keys_salts );
436
+		$num_keys_salts = count($keys_salts);
437 437
 ?>
438 438
 	<p>
439 439
 		<?php
440
-			if ( 1 == $num_keys_salts ) {
441
-				_e( 'This unique authentication key is also missing from your <code>wp-config.php</code> file.' );
440
+			if (1 == $num_keys_salts) {
441
+				_e('This unique authentication key is also missing from your <code>wp-config.php</code> file.');
442 442
 			} else {
443
-				_e( 'These unique authentication keys are also missing from your <code>wp-config.php</code> file.' );
443
+				_e('These unique authentication keys are also missing from your <code>wp-config.php</code> file.');
444 444
 			}
445 445
 		?>
446
-		<?php _e( 'To make your installation more secure, you should also add:' ); ?>
446
+		<?php _e('To make your installation more secure, you should also add:'); ?>
447 447
 	</p>
448
-	<textarea class="code" readonly="readonly" cols="100" rows="<?php echo $num_keys_salts; ?>"><?php echo esc_textarea( $keys_salts_str ); ?></textarea>
448
+	<textarea class="code" readonly="readonly" cols="100" rows="<?php echo $num_keys_salts; ?>"><?php echo esc_textarea($keys_salts_str); ?></textarea>
449 449
 <?php
450 450
 	}
451 451
 ?>
452 452
 </li>
453 453
 <?php
454
-	if ( iis7_supports_permalinks() ) :
454
+	if (iis7_supports_permalinks()) :
455 455
 		// IIS doesn't support RewriteBase, all your RewriteBase are belong to us
456
-		$iis_subdir_match = ltrim( $base, '/' ) . $subdir_match;
457
-		$iis_rewrite_base = ltrim( $base, '/' ) . $rewrite_base;
456
+		$iis_subdir_match = ltrim($base, '/').$subdir_match;
457
+		$iis_rewrite_base = ltrim($base, '/').$rewrite_base;
458 458
 		$iis_subdir_replacement = $subdomain_install ? '' : '{R:1}';
459 459
 
460 460
 		$web_config_file = '<?xml version="1.0" encoding="UTF-8"?>
@@ -466,17 +466,17 @@  discard block
 block discarded – undo
466 466
                     <match url="^index\.php$" ignoreCase="false" />
467 467
                     <action type="None" />
468 468
                 </rule>';
469
-				if ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) {
469
+				if (is_multisite() && get_site_option('ms_files_rewriting')) {
470 470
 					$web_config_file .= '
471 471
                 <rule name="WordPress Rule for Files" stopProcessing="true">
472
-                    <match url="^' . $iis_subdir_match . 'files/(.+)" ignoreCase="false" />
473
-                    <action type="Rewrite" url="' . $iis_rewrite_base . WPINC . '/ms-files.php?file={R:1}" appendQueryString="false" />
472
+                    <match url="^' . $iis_subdir_match.'files/(.+)" ignoreCase="false" />
473
+                    <action type="Rewrite" url="' . $iis_rewrite_base.WPINC.'/ms-files.php?file={R:1}" appendQueryString="false" />
474 474
                 </rule>';
475 475
                 }
476 476
                 $web_config_file .= '
477 477
                 <rule name="WordPress Rule 2" stopProcessing="true">
478
-                    <match url="^' . $iis_subdir_match . 'wp-admin$" ignoreCase="false" />
479
-                    <action type="Redirect" url="' . $iis_subdir_replacement . 'wp-admin/" redirectType="Permanent" />
478
+                    <match url="^' . $iis_subdir_match.'wp-admin$" ignoreCase="false" />
479
+                    <action type="Redirect" url="' . $iis_subdir_replacement.'wp-admin/" redirectType="Permanent" />
480 480
                 </rule>
481 481
                 <rule name="WordPress Rule 3" stopProcessing="true">
482 482
                     <match url="^" ignoreCase="false" />
@@ -487,12 +487,12 @@  discard block
 block discarded – undo
487 487
                     <action type="None" />
488 488
                 </rule>
489 489
                 <rule name="WordPress Rule 4" stopProcessing="true">
490
-                    <match url="^' . $iis_subdir_match . '(wp-(content|admin|includes).*)" ignoreCase="false" />
491
-                    <action type="Rewrite" url="' . $iis_rewrite_base . '{R:1}" />
490
+                    <match url="^' . $iis_subdir_match.'(wp-(content|admin|includes).*)" ignoreCase="false" />
491
+                    <action type="Rewrite" url="' . $iis_rewrite_base.'{R:1}" />
492 492
                 </rule>
493 493
                 <rule name="WordPress Rule 5" stopProcessing="true">
494
-                    <match url="^' . $iis_subdir_match . '([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" />
495
-                    <action type="Rewrite" url="' . $iis_rewrite_base . '{R:2}" />
494
+                    <match url="^' . $iis_subdir_match.'([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" />
495
+                    <action type="Rewrite" url="' . $iis_rewrite_base.'{R:2}" />
496 496
                 </rule>
497 497
                 <rule name="WordPress Rule 6" stopProcessing="true">
498 498
                     <match url="." ignoreCase="false" />
@@ -506,22 +506,22 @@  discard block
 block discarded – undo
506 506
 
507 507
 		echo '<li><p>';
508 508
 		/* translators: 1: a filename like .htaccess. 2: a file path. */
509
-		printf( __( 'Add the following to your %1$s file in %2$s, <strong>replacing</strong> other WordPress rules:' ),
510
-			'<code>web.config</code>', '<code>' . $home_path . '</code>' );
509
+		printf(__('Add the following to your %1$s file in %2$s, <strong>replacing</strong> other WordPress rules:'),
510
+			'<code>web.config</code>', '<code>'.$home_path.'</code>');
511 511
 		echo '</p>';
512
-		if ( ! $subdomain_install && WP_CONTENT_DIR != ABSPATH . 'wp-content' )
513
-			echo '<p><strong>' . __('Warning:') . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</strong></p>';
512
+		if ( ! $subdomain_install && WP_CONTENT_DIR != ABSPATH.'wp-content')
513
+			echo '<p><strong>'.__('Warning:').' '.__('Subdirectory networks may not be fully compatible with custom wp-content directories.').'</strong></p>';
514 514
 		?>
515
-		<textarea class="code" readonly="readonly" cols="100" rows="20"><?php echo esc_textarea( $web_config_file ); ?>
515
+		<textarea class="code" readonly="readonly" cols="100" rows="20"><?php echo esc_textarea($web_config_file); ?>
516 516
 		</textarea></li>
517 517
 		</ol>
518 518
 
519 519
 	<?php else : // end iis7_supports_permalinks(). construct an htaccess file instead:
520 520
 
521 521
 		$ms_files_rewriting = '';
522
-		if ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) {
522
+		if (is_multisite() && get_site_option('ms_files_rewriting')) {
523 523
 			$ms_files_rewriting = "\n# uploaded files\nRewriteRule ^";
524
-			$ms_files_rewriting .= $subdir_match . "files/(.+) {$rewrite_base}" . WPINC . "/ms-files.php?file={$subdir_replacement_12} [L]" . "\n";
524
+			$ms_files_rewriting .= $subdir_match."files/(.+) {$rewrite_base}".WPINC."/ms-files.php?file={$subdir_replacement_12} [L]"."\n";
525 525
 		}
526 526
 
527 527
 		$htaccess_file = <<<EOF
@@ -543,47 +543,47 @@  discard block
 block discarded – undo
543 543
 
544 544
 		echo '<li><p>';
545 545
 		/* translators: 1: a filename like .htaccess. 2: a file path. */
546
-		printf( __( 'Add the following to your %1$s file in %2$s, <strong>replacing</strong> other WordPress rules:' ),
547
-			'<code>.htaccess</code>', '<code>' . $home_path . '</code>' );
546
+		printf(__('Add the following to your %1$s file in %2$s, <strong>replacing</strong> other WordPress rules:'),
547
+			'<code>.htaccess</code>', '<code>'.$home_path.'</code>');
548 548
 		echo '</p>';
549
-		if ( ! $subdomain_install && WP_CONTENT_DIR != ABSPATH . 'wp-content' )
550
-			echo '<p><strong>' . __('Warning:') . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</strong></p>';
549
+		if ( ! $subdomain_install && WP_CONTENT_DIR != ABSPATH.'wp-content')
550
+			echo '<p><strong>'.__('Warning:').' '.__('Subdirectory networks may not be fully compatible with custom wp-content directories.').'</strong></p>';
551 551
 		?>
552
-		<textarea class="code" readonly="readonly" cols="100" rows="<?php echo substr_count( $htaccess_file, "\n" ) + 1; ?>">
553
-<?php echo esc_textarea( $htaccess_file ); ?></textarea></li>
552
+		<textarea class="code" readonly="readonly" cols="100" rows="<?php echo substr_count($htaccess_file, "\n") + 1; ?>">
553
+<?php echo esc_textarea($htaccess_file); ?></textarea></li>
554 554
 		</ol>
555 555
 
556 556
 	<?php endif; // end IIS/Apache code branches.
557 557
 
558
-	if ( !is_multisite() ) { ?>
559
-		<p><?php _e( 'Once you complete these steps, your network is enabled and configured. You will have to log in again.' ); ?> <a href="<?php echo esc_url( site_url( 'wp-login.php' ) ); ?>"><?php _e( 'Log In' ); ?></a></p>
558
+	if ( ! is_multisite()) { ?>
559
+		<p><?php _e('Once you complete these steps, your network is enabled and configured. You will have to log in again.'); ?> <a href="<?php echo esc_url(site_url('wp-login.php')); ?>"><?php _e('Log In'); ?></a></p>
560 560
 <?php
561 561
 	}
562 562
 }
563 563
 
564
-if ( $_POST ) {
564
+if ($_POST) {
565 565
 
566
-	check_admin_referer( 'install-network-1' );
566
+	check_admin_referer('install-network-1');
567 567
 
568
-	require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
568
+	require_once(ABSPATH.'wp-admin/includes/upgrade.php');
569 569
 	// Create network tables.
570 570
 	install_network();
571
-	$base              = parse_url( trailingslashit( get_option( 'home' ) ), PHP_URL_PATH );
572
-	$subdomain_install = allow_subdomain_install() ? !empty( $_POST['subdomain_install'] ) : false;
573
-	if ( ! network_domain_check() ) {
574
-		$result = populate_network( 1, get_clean_basedomain(), sanitize_email( $_POST['email'] ), wp_unslash( $_POST['sitename'] ), $base, $subdomain_install );
575
-		if ( is_wp_error( $result ) ) {
576
-			if ( 1 == count( $result->get_error_codes() ) && 'no_wildcard_dns' == $result->get_error_code() )
577
-				network_step2( $result );
571
+	$base              = parse_url(trailingslashit(get_option('home')), PHP_URL_PATH);
572
+	$subdomain_install = allow_subdomain_install() ? ! empty($_POST['subdomain_install']) : false;
573
+	if ( ! network_domain_check()) {
574
+		$result = populate_network(1, get_clean_basedomain(), sanitize_email($_POST['email']), wp_unslash($_POST['sitename']), $base, $subdomain_install);
575
+		if (is_wp_error($result)) {
576
+			if (1 == count($result->get_error_codes()) && 'no_wildcard_dns' == $result->get_error_code())
577
+				network_step2($result);
578 578
 			else
579
-				network_step1( $result );
579
+				network_step1($result);
580 580
 		} else {
581 581
 			network_step2();
582 582
 		}
583 583
 	} else {
584 584
 		network_step2();
585 585
 	}
586
-} elseif ( is_multisite() || network_domain_check() ) {
586
+} elseif (is_multisite() || network_domain_check()) {
587 587
 	network_step2();
588 588
 } else {
589 589
 	network_step1();
@@ -591,4 +591,4 @@  discard block
 block discarded – undo
591 591
 ?>
592 592
 </div>
593 593
 
594
-<?php include( ABSPATH . 'wp-admin/admin-footer.php' ); ?>
594
+<?php include(ABSPATH.'wp-admin/admin-footer.php'); ?>
Please login to merge, or discard this patch.
Braces   +80 added lines, -53 removed lines patch added patch discarded remove patch
@@ -15,21 +15,24 @@  discard block
 block discarded – undo
15 15
 /** WordPress Administration Bootstrap */
16 16
 require_once( dirname( __FILE__ ) . '/admin.php' );
17 17
 
18
-if ( ! is_super_admin() )
18
+if ( ! is_super_admin() ) {
19 19
 	wp_die( __( 'You do not have sufficient permissions to manage options for this site.' ) );
20
+}
20 21
 
21 22
 if ( is_multisite() ) {
22 23
 	if ( ! is_network_admin() ) {
23 24
 		wp_redirect( network_admin_url( 'setup.php' ) );
24 25
 		exit;
25 26
 	}
26
-	if ( ! defined( 'MULTISITE' ) )
27
-		wp_die( __( 'The Network creation panel is not for WordPress MU networks.' ) );
28
-}
27
+	if ( ! defined( 'MULTISITE' ) ) {
28
+			wp_die( __( 'The Network creation panel is not for WordPress MU networks.' ) );
29
+	}
30
+	}
29 31
 
30 32
 // We need to create references to ms global tables to enable Network.
31
-foreach ( $wpdb->tables( 'ms_global' ) as $table => $prefixed_table )
33
+foreach ( $wpdb->tables( 'ms_global' ) as $table => $prefixed_table ) {
32 34
 	$wpdb->$table = $prefixed_table;
35
+}
33 36
 
34 37
 /**
35 38
  * Check for an existing network.
@@ -58,8 +61,9 @@  discard block
 block discarded – undo
58 61
  */
59 62
 function allow_subdomain_install() {
60 63
 	$domain = preg_replace( '|https?://([^/]+)|', '$1', get_option( 'home' ) );
61
-	if ( parse_url( get_option( 'home' ), PHP_URL_PATH ) || 'localhost' == $domain || preg_match( '|^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$|', $domain ) )
62
-		return false;
64
+	if ( parse_url( get_option( 'home' ), PHP_URL_PATH ) || 'localhost' == $domain || preg_match( '|^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$|', $domain ) ) {
65
+			return false;
66
+	}
63 67
 
64 68
 	return true;
65 69
 }
@@ -81,15 +85,18 @@  discard block
 block discarded – undo
81 85
          *
82 86
          * @param bool true Whether to enable the subdirectory install feature in Multisite. Default is false.
83 87
          */
84
-	if ( apply_filters( 'allow_subdirectory_install', false ) )
85
-		return true;
88
+	if ( apply_filters( 'allow_subdirectory_install', false ) ) {
89
+			return true;
90
+	}
86 91
 
87
-	if ( defined( 'ALLOW_SUBDIRECTORY_INSTALL' ) && ALLOW_SUBDIRECTORY_INSTALL )
88
-		return true;
92
+	if ( defined( 'ALLOW_SUBDIRECTORY_INSTALL' ) && ALLOW_SUBDIRECTORY_INSTALL ) {
93
+			return true;
94
+	}
89 95
 
90 96
 	$post = $wpdb->get_row( "SELECT ID FROM $wpdb->posts WHERE post_date < DATE_SUB(NOW(), INTERVAL 1 MONTH) AND post_status = 'publish'" );
91
-	if ( empty( $post ) )
92
-		return true;
97
+	if ( empty( $post ) ) {
98
+			return true;
99
+	}
93 100
 
94 101
 	return false;
95 102
 }
@@ -100,16 +107,19 @@  discard block
 block discarded – undo
100 107
  * @return string Base domain.
101 108
  */
102 109
 function get_clean_basedomain() {
103
-	if ( $existing_domain = network_domain_check() )
104
-		return $existing_domain;
110
+	if ( $existing_domain = network_domain_check() ) {
111
+			return $existing_domain;
112
+	}
105 113
 	$domain = preg_replace( '|https?://|', '', get_option( 'siteurl' ) );
106
-	if ( $slash = strpos( $domain, '/' ) )
107
-		$domain = substr( $domain, 0, $slash );
114
+	if ( $slash = strpos( $domain, '/' ) ) {
115
+			$domain = substr( $domain, 0, $slash );
116
+	}
108 117
 	return $domain;
109 118
 }
110 119
 
111
-if ( ! network_domain_check() && ( ! defined( 'WP_ALLOW_MULTISITE' ) || ! WP_ALLOW_MULTISITE ) )
120
+if ( ! network_domain_check() && ( ! defined( 'WP_ALLOW_MULTISITE' ) || ! WP_ALLOW_MULTISITE ) ) {
112 121
 	wp_die( __( 'You must define the <code>WP_ALLOW_MULTISITE</code> constant as true in your wp-config.php file to allow creation of a Network.' ) );
122
+}
113 123
 
114 124
 if ( is_network_admin() ) {
115 125
 	$title = __( 'Network Setup' );
@@ -196,8 +206,9 @@  discard block
 block discarded – undo
196 206
 	$error_codes = array();
197 207
 	if ( is_wp_error( $errors ) ) {
198 208
 		echo '<div class="error"><p><strong>' . __( 'ERROR: The network could not be created.' ) . '</strong></p>';
199
-		foreach ( $errors->get_error_messages() as $error )
200
-			echo "<p>$error</p>";
209
+		foreach ( $errors->get_error_messages() as $error ) {
210
+					echo "<p>$error</p>";
211
+		}
201 212
 		echo '</div>';
202 213
 		$error_codes = $errors->get_error_codes();
203 214
 	}
@@ -217,12 +228,16 @@  discard block
 block discarded – undo
217 228
 		$subdomain_install = true;
218 229
 	} else {
219 230
 		$subdomain_install = false;
220
-		if ( $got_mod_rewrite = got_mod_rewrite() ) // dangerous assumptions
231
+		if ( $got_mod_rewrite = got_mod_rewrite() ) {
232
+			// dangerous assumptions
221 233
 			echo '<div class="updated inline"><p><strong>' . __( 'Note:' ) . '</strong> ' . __( 'Please make sure the Apache <code>mod_rewrite</code> module is installed as it will be used at the end of this installation.' ) . '</p>';
222
-		elseif ( $is_apache )
223
-			echo '<div class="error inline"><p><strong>' . __( 'Warning!' ) . '</strong> ' . __( 'It looks like the Apache <code>mod_rewrite</code> module is not installed.' ) . '</p>';
224
-		if ( $got_mod_rewrite || $is_apache ) // Protect against mod_rewrite mimicry (but ! Apache)
234
+		} elseif ( $is_apache ) {
235
+					echo '<div class="error inline"><p><strong>' . __( 'Warning!' ) . '</strong> ' . __( 'It looks like the Apache <code>mod_rewrite</code> module is not installed.' ) . '</p>';
236
+		}
237
+		if ( $got_mod_rewrite || $is_apache ) {
238
+			// Protect against mod_rewrite mimicry (but ! Apache)
225 239
 			echo '<p>' . __( 'If <code>mod_rewrite</code> is disabled, ask your administrator to enable that module, or look at the <a href="http://httpd.apache.org/docs/mod/mod_rewrite.html">Apache documentation</a> or <a href="http://www.google.com/search?q=apache+mod_rewrite">elsewhere</a> for help setting it up.' ) . '</p></div>';
240
+		}
226 241
 	}
227 242
 
228 243
 	if ( allow_subdomain_install() && allow_subdirectory_install() ) : ?>
@@ -252,8 +267,9 @@  discard block
 block discarded – undo
252 267
 <?php
253 268
 	endif;
254 269
 
255
-		if ( WP_CONTENT_DIR != ABSPATH . 'wp-content' && ( allow_subdirectory_install() || ! allow_subdomain_install() ) )
256
-			echo '<div class="error inline"><p><strong>' . __('Warning!') . '</strong> ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</p></div>';
270
+		if ( WP_CONTENT_DIR != ABSPATH . 'wp-content' && ( allow_subdirectory_install() || ! allow_subdomain_install() ) ) {
271
+					echo '<div class="error inline"><p><strong>' . __('Warning!') . '</strong> ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</p></div>';
272
+		}
257 273
 
258 274
 		$is_www = ( 0 === strpos( $hostname, 'www.' ) );
259 275
 		if ( $is_www ) :
@@ -278,8 +294,9 @@  discard block
 block discarded – undo
278 294
 				<td><?php
279 295
 					_e( 'Because you are using <code>localhost</code>, the sites in your WordPress network must use sub-directories. Consider using <code>localhost.localdomain</code> if you wish to use sub-domains.' );
280 296
 					// Uh oh:
281
-					if ( !allow_subdirectory_install() )
282
-						echo ' <strong>' . __( 'Warning!' ) . ' ' . __( 'The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.' ) . '</strong>';
297
+					if ( !allow_subdirectory_install() ) {
298
+											echo ' <strong>' . __( 'Warning!' ) . ' ' . __( 'The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.' ) . '</strong>';
299
+					}
283 300
 				?></td>
284 301
 			</tr>
285 302
 		<?php elseif ( !allow_subdomain_install() ) : ?>
@@ -288,8 +305,9 @@  discard block
 block discarded – undo
288 305
 				<td><?php
289 306
 					_e( 'Because your install is in a directory, the sites in your WordPress network must use sub-directories.' );
290 307
 					// Uh oh:
291
-					if ( !allow_subdirectory_install() )
292
-						echo ' <strong>' . __( 'Warning!' ) . ' ' . __( 'The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.' ) . '</strong>';
308
+					if ( !allow_subdirectory_install() ) {
309
+											echo ' <strong>' . __( 'Warning!' ) . ' ' . __( 'The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.' ) . '</strong>';
310
+					}
293 311
 				?></td>
294 312
 			</tr>
295 313
 		<?php elseif ( !allow_subdirectory_install() ) : ?>
@@ -361,14 +379,16 @@  discard block
 block discarded – undo
361 379
 	$location_of_wp_config = trailingslashit( $location_of_wp_config );
362 380
 
363 381
 	// Wildcard DNS message.
364
-	if ( is_wp_error( $errors ) )
365
-		echo '<div class="error">' . $errors->get_error_message() . '</div>';
382
+	if ( is_wp_error( $errors ) ) {
383
+			echo '<div class="error">' . $errors->get_error_message() . '</div>';
384
+	}
366 385
 
367 386
 	if ( $_POST ) {
368
-		if ( allow_subdomain_install() )
369
-			$subdomain_install = allow_subdirectory_install() ? ! empty( $_POST['subdomain_install'] ) : true;
370
-		else
371
-			$subdomain_install = false;
387
+		if ( allow_subdomain_install() ) {
388
+					$subdomain_install = allow_subdirectory_install() ? ! empty( $_POST['subdomain_install'] ) : true;
389
+		} else {
390
+					$subdomain_install = false;
391
+		}
372 392
 	} else {
373 393
 		if ( is_multisite() ) {
374 394
 			$subdomain_install = is_subdomain_install();
@@ -393,12 +413,13 @@  discard block
 block discarded – undo
393 413
 		<h3><?php esc_html_e( 'Enabling the Network' ); ?></h3>
394 414
 		<p><?php _e( 'Complete the following steps to enable the features for creating a network of sites.' ); ?></p>
395 415
 		<div class="updated inline"><p><?php
396
-			if ( file_exists( $home_path . '.htaccess' ) )
397
-				printf( __( '<strong>Caution:</strong> We recommend you back up your existing <code>wp-config.php</code> and <code>%s</code> files.' ), '.htaccess' );
398
-			elseif ( file_exists( $home_path . 'web.config' ) )
399
-				printf( __( '<strong>Caution:</strong> We recommend you back up your existing <code>wp-config.php</code> and <code>%s</code> files.' ), 'web.config' );
400
-			else
401
-				_e( '<strong>Caution:</strong> We recommend you back up your existing <code>wp-config.php</code> file.' );
416
+			if ( file_exists( $home_path . '.htaccess' ) ) {
417
+							printf( __( '<strong>Caution:</strong> We recommend you back up your existing <code>wp-config.php</code> and <code>%s</code> files.' ), '.htaccess' );
418
+			} elseif ( file_exists( $home_path . 'web.config' ) ) {
419
+							printf( __( '<strong>Caution:</strong> We recommend you back up your existing <code>wp-config.php</code> and <code>%s</code> files.' ), 'web.config' );
420
+			} else {
421
+							_e( '<strong>Caution:</strong> We recommend you back up your existing <code>wp-config.php</code> file.' );
422
+			}
402 423
 		?></p></div>
403 424
 <?php
404 425
 	}
@@ -416,8 +437,9 @@  discard block
 block discarded – undo
416 437
 <?php
417 438
 	$keys_salts = array( 'AUTH_KEY' => '', 'SECURE_AUTH_KEY' => '', 'LOGGED_IN_KEY' => '', 'NONCE_KEY' => '', 'AUTH_SALT' => '', 'SECURE_AUTH_SALT' => '', 'LOGGED_IN_SALT' => '', 'NONCE_SALT' => '' );
418 439
 	foreach ( $keys_salts as $c => $v ) {
419
-		if ( defined( $c ) )
420
-			unset( $keys_salts[ $c ] );
440
+		if ( defined( $c ) ) {
441
+					unset( $keys_salts[ $c ] );
442
+		}
421 443
 	}
422 444
 
423 445
 	if ( ! empty( $keys_salts ) ) {
@@ -509,16 +531,19 @@  discard block
 block discarded – undo
509 531
 		printf( __( 'Add the following to your %1$s file in %2$s, <strong>replacing</strong> other WordPress rules:' ),
510 532
 			'<code>web.config</code>', '<code>' . $home_path . '</code>' );
511 533
 		echo '</p>';
512
-		if ( ! $subdomain_install && WP_CONTENT_DIR != ABSPATH . 'wp-content' )
513
-			echo '<p><strong>' . __('Warning:') . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</strong></p>';
534
+		if ( ! $subdomain_install && WP_CONTENT_DIR != ABSPATH . 'wp-content' ) {
535
+					echo '<p><strong>' . __('Warning:') . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</strong></p>';
536
+		}
514 537
 		?>
515 538
 		<textarea class="code" readonly="readonly" cols="100" rows="20"><?php echo esc_textarea( $web_config_file ); ?>
516 539
 		</textarea></li>
517 540
 		</ol>
518 541
 
519
-	<?php else : // end iis7_supports_permalinks(). construct an htaccess file instead:
542
+	<?php else {
543
+	: // end iis7_supports_permalinks(). construct an htaccess file instead:
520 544
 
521 545
 		$ms_files_rewriting = '';
546
+}
522 547
 		if ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) {
523 548
 			$ms_files_rewriting = "\n# uploaded files\nRewriteRule ^";
524 549
 			$ms_files_rewriting .= $subdir_match . "files/(.+) {$rewrite_base}" . WPINC . "/ms-files.php?file={$subdir_replacement_12} [L]" . "\n";
@@ -546,8 +571,9 @@  discard block
 block discarded – undo
546 571
 		printf( __( 'Add the following to your %1$s file in %2$s, <strong>replacing</strong> other WordPress rules:' ),
547 572
 			'<code>.htaccess</code>', '<code>' . $home_path . '</code>' );
548 573
 		echo '</p>';
549
-		if ( ! $subdomain_install && WP_CONTENT_DIR != ABSPATH . 'wp-content' )
550
-			echo '<p><strong>' . __('Warning:') . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</strong></p>';
574
+		if ( ! $subdomain_install && WP_CONTENT_DIR != ABSPATH . 'wp-content' ) {
575
+					echo '<p><strong>' . __('Warning:') . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</strong></p>';
576
+		}
551 577
 		?>
552 578
 		<textarea class="code" readonly="readonly" cols="100" rows="<?php echo substr_count( $htaccess_file, "\n" ) + 1; ?>">
553 579
 <?php echo esc_textarea( $htaccess_file ); ?></textarea></li>
@@ -573,10 +599,11 @@  discard block
 block discarded – undo
573 599
 	if ( ! network_domain_check() ) {
574 600
 		$result = populate_network( 1, get_clean_basedomain(), sanitize_email( $_POST['email'] ), wp_unslash( $_POST['sitename'] ), $base, $subdomain_install );
575 601
 		if ( is_wp_error( $result ) ) {
576
-			if ( 1 == count( $result->get_error_codes() ) && 'no_wildcard_dns' == $result->get_error_code() )
577
-				network_step2( $result );
578
-			else
579
-				network_step1( $result );
602
+			if ( 1 == count( $result->get_error_codes() ) && 'no_wildcard_dns' == $result->get_error_code() ) {
603
+							network_step2( $result );
604
+			} else {
605
+							network_step1( $result );
606
+			}
580 607
 		} else {
581 608
 			network_step2();
582 609
 		}
Please login to merge, or discard this patch.
src/wp-admin/ms-users.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Multisite users administration panel.
4
- *
5
- * @package WordPress
6
- * @subpackage Multisite
7
- * @since 3.0.0
8
- */
3
+	 * Multisite users administration panel.
4
+	 *
5
+	 * @package WordPress
6
+	 * @subpackage Multisite
7
+	 * @since 3.0.0
8
+	 */
9 9
 
10 10
 require_once( dirname( __FILE__ ) . '/admin.php' );
11 11
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
  * @since 3.0.0
8 8
  */
9 9
 
10
-require_once( dirname( __FILE__ ) . '/admin.php' );
10
+require_once(dirname(__FILE__).'/admin.php');
11 11
 
12
-wp_redirect( network_admin_url('users.php') );
12
+wp_redirect(network_admin_url('users.php'));
13 13
 exit;
Please login to merge, or discard this patch.
src/wp-includes/post-thumbnail-template.php 3 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * WordPress Post Thumbnail Template Functions.
4
- *
5
- * Support for post thumbnails.
6
- * Theme's functions.php must call add_theme_support( 'post-thumbnails' ) to use these.
7
- *
8
- * @package WordPress
9
- * @subpackage Template
10
- */
3
+	 * WordPress Post Thumbnail Template Functions.
4
+	 *
5
+	 * Support for post thumbnails.
6
+	 * Theme's functions.php must call add_theme_support( 'post-thumbnails' ) to use these.
7
+	 *
8
+	 * @package WordPress
9
+	 * @subpackage Template
10
+	 */
11 11
 
12 12
 /**
13 13
  * Check if post has an image attached.
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -17,8 +17,8 @@  discard block
 block discarded – undo
17 17
  * @param int $post_id Optional. Post ID.
18 18
  * @return bool Whether post has an image attached.
19 19
  */
20
-function has_post_thumbnail( $post_id = null ) {
21
-	return (bool) get_post_thumbnail_id( $post_id );
20
+function has_post_thumbnail($post_id = null) {
21
+	return (bool) get_post_thumbnail_id($post_id);
22 22
 }
23 23
 
24 24
 /**
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
  * @param int|null $post_id Optional. Post ID.
30 30
  * @return mixed
31 31
  */
32
-function get_post_thumbnail_id( $post_id = null ) {
33
-	$post_id = ( null === $post_id ) ? get_the_ID() : $post_id;
34
-	return get_post_meta( $post_id, '_thumbnail_id', true );
32
+function get_post_thumbnail_id($post_id = null) {
33
+	$post_id = (null === $post_id) ? get_the_ID() : $post_id;
34
+	return get_post_meta($post_id, '_thumbnail_id', true);
35 35
 }
36 36
 
37 37
 /**
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
  *                           and width values. Default 'post-thumbnail'.
53 53
  * @param string|array $attr Optional. Query string or array of attributes. Default empty.
54 54
  */
55
-function the_post_thumbnail( $size = 'post-thumbnail', $attr = '' ) {
56
-	echo get_the_post_thumbnail( null, $size, $attr );
55
+function the_post_thumbnail($size = 'post-thumbnail', $attr = '') {
56
+	echo get_the_post_thumbnail(null, $size, $attr);
57 57
 }
58 58
 
59 59
 /**
@@ -65,21 +65,21 @@  discard block
 block discarded – undo
65 65
  *
66 66
  * @param WP_Query $wp_query Optional. A WP_Query instance. Defaults to the $wp_query global.
67 67
  */
68
-function update_post_thumbnail_cache( $wp_query = null ) {
69
-	if ( ! $wp_query )
68
+function update_post_thumbnail_cache($wp_query = null) {
69
+	if ( ! $wp_query)
70 70
 		$wp_query = $GLOBALS['wp_query'];
71 71
 
72
-	if ( $wp_query->thumbnails_cached )
72
+	if ($wp_query->thumbnails_cached)
73 73
 		return;
74 74
 
75 75
 	$thumb_ids = array();
76
-	foreach ( $wp_query->posts as $post ) {
77
-		if ( $id = get_post_thumbnail_id( $post->ID ) )
76
+	foreach ($wp_query->posts as $post) {
77
+		if ($id = get_post_thumbnail_id($post->ID))
78 78
 			$thumb_ids[] = $id;
79 79
 	}
80 80
 
81
-	if ( ! empty ( $thumb_ids ) ) {
82
-		_prime_post_caches( $thumb_ids, false, true );
81
+	if ( ! empty ($thumb_ids)) {
82
+		_prime_post_caches($thumb_ids, false, true);
83 83
 	}
84 84
 
85 85
 	$wp_query->thumbnails_cached = true;
@@ -103,9 +103,9 @@  discard block
 block discarded – undo
103 103
  * @param string|array $attr Optional. Query string or array of attributes. Default empty.
104 104
  * @return string
105 105
  */
106
-function get_the_post_thumbnail( $post_id = null, $size = 'post-thumbnail', $attr = '' ) {
107
-	$post_id = ( null === $post_id ) ? get_the_ID() : $post_id;
108
-	$post_thumbnail_id = get_post_thumbnail_id( $post_id );
106
+function get_the_post_thumbnail($post_id = null, $size = 'post-thumbnail', $attr = '') {
107
+	$post_id = (null === $post_id) ? get_the_ID() : $post_id;
108
+	$post_thumbnail_id = get_post_thumbnail_id($post_id);
109 109
 
110 110
 	/**
111 111
 	 * Filter the post thumbnail size.
@@ -114,9 +114,9 @@  discard block
 block discarded – undo
114 114
 	 *
115 115
 	 * @param string $size The post thumbnail size.
116 116
 	 */
117
-	$size = apply_filters( 'post_thumbnail_size', $size );
117
+	$size = apply_filters('post_thumbnail_size', $size);
118 118
 
119
-	if ( $post_thumbnail_id ) {
119
+	if ($post_thumbnail_id) {
120 120
 
121 121
 		/**
122 122
 		 * Fires before fetching the post thumbnail HTML.
@@ -129,10 +129,10 @@  discard block
 block discarded – undo
129 129
 		 * @param string $post_thumbnail_id The post thumbnail ID.
130 130
 		 * @param string $size              The post thumbnail size.
131 131
 		 */
132
-		do_action( 'begin_fetch_post_thumbnail_html', $post_id, $post_thumbnail_id, $size );
133
-		if ( in_the_loop() )
132
+		do_action('begin_fetch_post_thumbnail_html', $post_id, $post_thumbnail_id, $size);
133
+		if (in_the_loop())
134 134
 			update_post_thumbnail_cache();
135
-		$html = wp_get_attachment_image( $post_thumbnail_id, $size, false, $attr );
135
+		$html = wp_get_attachment_image($post_thumbnail_id, $size, false, $attr);
136 136
 
137 137
 		/**
138 138
 		 * Fires after fetching the post thumbnail HTML.
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 		 * @param string $post_thumbnail_id The post thumbnail ID.
144 144
 		 * @param string $size              The post thumbnail size.
145 145
 		 */
146
-		do_action( 'end_fetch_post_thumbnail_html', $post_id, $post_thumbnail_id, $size );
146
+		do_action('end_fetch_post_thumbnail_html', $post_id, $post_thumbnail_id, $size);
147 147
 
148 148
 	} else {
149 149
 		$html = '';
@@ -159,5 +159,5 @@  discard block
 block discarded – undo
159 159
 	 * @param string $size              The post thumbnail size.
160 160
 	 * @param string $attr              Query string of attributes.
161 161
 	 */
162
-	return apply_filters( 'post_thumbnail_html', $html, $post_id, $post_thumbnail_id, $size, $attr );
162
+	return apply_filters('post_thumbnail_html', $html, $post_id, $post_thumbnail_id, $size, $attr);
163 163
 }
Please login to merge, or discard this patch.
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -66,16 +66,19 @@  discard block
 block discarded – undo
66 66
  * @param WP_Query $wp_query Optional. A WP_Query instance. Defaults to the $wp_query global.
67 67
  */
68 68
 function update_post_thumbnail_cache( $wp_query = null ) {
69
-	if ( ! $wp_query )
70
-		$wp_query = $GLOBALS['wp_query'];
69
+	if ( ! $wp_query ) {
70
+			$wp_query = $GLOBALS['wp_query'];
71
+	}
71 72
 
72
-	if ( $wp_query->thumbnails_cached )
73
-		return;
73
+	if ( $wp_query->thumbnails_cached ) {
74
+			return;
75
+	}
74 76
 
75 77
 	$thumb_ids = array();
76 78
 	foreach ( $wp_query->posts as $post ) {
77
-		if ( $id = get_post_thumbnail_id( $post->ID ) )
78
-			$thumb_ids[] = $id;
79
+		if ( $id = get_post_thumbnail_id( $post->ID ) ) {
80
+					$thumb_ids[] = $id;
81
+		}
79 82
 	}
80 83
 
81 84
 	if ( ! empty ( $thumb_ids ) ) {
@@ -130,8 +133,9 @@  discard block
 block discarded – undo
130 133
 		 * @param string $size              The post thumbnail size.
131 134
 		 */
132 135
 		do_action( 'begin_fetch_post_thumbnail_html', $post_id, $post_thumbnail_id, $size );
133
-		if ( in_the_loop() )
134
-			update_post_thumbnail_cache();
136
+		if ( in_the_loop() ) {
137
+					update_post_thumbnail_cache();
138
+		}
135 139
 		$html = wp_get_attachment_image( $post_thumbnail_id, $size, false, $attr );
136 140
 
137 141
 		/**
Please login to merge, or discard this patch.
src/wp-includes/version.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * The WordPress version string
4
- *
5
- * @global string $wp_version
6
- */
3
+	 * The WordPress version string
4
+	 *
5
+	 * @global string $wp_version
6
+	 */
7 7
 $wp_version = '4.4-alpha-33636-src';
8 8
 
9 9
 /**
Please login to merge, or discard this patch.
src/wp-includes/vars.php 2 patches
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -20,27 +20,27 @@  discard block
 block discarded – undo
20 20
 	$is_apache, $is_IIS, $is_iis7, $is_nginx;
21 21
 
22 22
 // On which page are we ?
23
-if ( is_admin() ) {
23
+if (is_admin()) {
24 24
 	// wp-admin pages are checked more carefully
25
-	if ( is_network_admin() )
25
+	if (is_network_admin())
26 26
 		preg_match('#/wp-admin/network/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches);
27
-	elseif ( is_user_admin() )
27
+	elseif (is_user_admin())
28 28
 		preg_match('#/wp-admin/user/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches);
29 29
 	else
30 30
 		preg_match('#/wp-admin/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches);
31 31
 	$pagenow = $self_matches[1];
32 32
 	$pagenow = trim($pagenow, '/');
33 33
 	$pagenow = preg_replace('#\?.*?$#', '', $pagenow);
34
-	if ( '' === $pagenow || 'index' === $pagenow || 'index.php' === $pagenow ) {
34
+	if ('' === $pagenow || 'index' === $pagenow || 'index.php' === $pagenow) {
35 35
 		$pagenow = 'index.php';
36 36
 	} else {
37 37
 		preg_match('#(.*?)(/|$)#', $pagenow, $self_matches);
38 38
 		$pagenow = strtolower($self_matches[1]);
39
-		if ( '.php' !== substr($pagenow, -4, 4) )
39
+		if ('.php' !== substr($pagenow, -4, 4))
40 40
 			$pagenow .= '.php'; // for Options +Multiviews: /wp-admin/themes/index.php (themes.php is queried)
41 41
 	}
42 42
 } else {
43
-	if ( preg_match('#([^/]+\.php)([?/].*?)?$#i', $_SERVER['PHP_SELF'], $self_matches) )
43
+	if (preg_match('#([^/]+\.php)([?/].*?)?$#i', $_SERVER['PHP_SELF'], $self_matches))
44 44
 		$pagenow = strtolower($self_matches[1]);
45 45
 	else
46 46
 		$pagenow = 'index.php';
@@ -50,11 +50,11 @@  discard block
 block discarded – undo
50 50
 // Simple browser detection
51 51
 $is_lynx = $is_gecko = $is_winIE = $is_macIE = $is_opera = $is_NS4 = $is_safari = $is_chrome = $is_iphone = false;
52 52
 
53
-if ( isset($_SERVER['HTTP_USER_AGENT']) ) {
54
-	if ( strpos($_SERVER['HTTP_USER_AGENT'], 'Lynx') !== false ) {
53
+if (isset($_SERVER['HTTP_USER_AGENT'])) {
54
+	if (strpos($_SERVER['HTTP_USER_AGENT'], 'Lynx') !== false) {
55 55
 		$is_lynx = true;
56
-	} elseif ( stripos($_SERVER['HTTP_USER_AGENT'], 'chrome') !== false ) {
57
-		if ( stripos( $_SERVER['HTTP_USER_AGENT'], 'chromeframe' ) !== false ) {
56
+	} elseif (stripos($_SERVER['HTTP_USER_AGENT'], 'chrome') !== false) {
57
+		if (stripos($_SERVER['HTTP_USER_AGENT'], 'chromeframe') !== false) {
58 58
 			$is_admin = is_admin();
59 59
 			/**
60 60
 			 * Filter whether Google Chrome Frame should be used, if available.
@@ -63,31 +63,31 @@  discard block
 block discarded – undo
63 63
 			 *
64 64
 			 * @param bool $is_admin Whether to use the Google Chrome Frame. Default is the value of is_admin().
65 65
 			 */
66
-			if ( $is_chrome = apply_filters( 'use_google_chrome_frame', $is_admin ) )
67
-				header( 'X-UA-Compatible: chrome=1' );
66
+			if ($is_chrome = apply_filters('use_google_chrome_frame', $is_admin))
67
+				header('X-UA-Compatible: chrome=1');
68 68
 			$is_winIE = ! $is_chrome;
69 69
 		} else {
70 70
 			$is_chrome = true;
71 71
 		}
72
-	} elseif ( stripos($_SERVER['HTTP_USER_AGENT'], 'safari') !== false ) {
72
+	} elseif (stripos($_SERVER['HTTP_USER_AGENT'], 'safari') !== false) {
73 73
 		$is_safari = true;
74
-	} elseif ( ( strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'Trident') !== false ) && strpos($_SERVER['HTTP_USER_AGENT'], 'Win') !== false ) {
74
+	} elseif ((strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'Trident') !== false) && strpos($_SERVER['HTTP_USER_AGENT'], 'Win') !== false) {
75 75
 		$is_winIE = true;
76
-	} elseif ( strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false && strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false ) {
76
+	} elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false && strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) {
77 77
 		$is_macIE = true;
78
-	} elseif ( strpos($_SERVER['HTTP_USER_AGENT'], 'Gecko') !== false ) {
78
+	} elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'Gecko') !== false) {
79 79
 		$is_gecko = true;
80
-	} elseif ( strpos($_SERVER['HTTP_USER_AGENT'], 'Opera') !== false ) {
80
+	} elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'Opera') !== false) {
81 81
 		$is_opera = true;
82
-	} elseif ( strpos($_SERVER['HTTP_USER_AGENT'], 'Nav') !== false && strpos($_SERVER['HTTP_USER_AGENT'], 'Mozilla/4.') !== false ) {
82
+	} elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'Nav') !== false && strpos($_SERVER['HTTP_USER_AGENT'], 'Mozilla/4.') !== false) {
83 83
 		$is_NS4 = true;
84 84
 	}
85 85
 }
86 86
 
87
-if ( $is_safari && stripos($_SERVER['HTTP_USER_AGENT'], 'mobile') !== false )
87
+if ($is_safari && stripos($_SERVER['HTTP_USER_AGENT'], 'mobile') !== false)
88 88
 	$is_iphone = true;
89 89
 
90
-$is_IE = ( $is_macIE || $is_winIE );
90
+$is_IE = ($is_macIE || $is_winIE);
91 91
 
92 92
 // Server detection
93 93
 
@@ -107,13 +107,13 @@  discard block
 block discarded – undo
107 107
  * Whether the server software is IIS or something else
108 108
  * @global bool $is_IIS
109 109
  */
110
-$is_IIS = !$is_apache && (strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== false || strpos($_SERVER['SERVER_SOFTWARE'], 'ExpressionDevServer') !== false);
110
+$is_IIS = ! $is_apache && (strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== false || strpos($_SERVER['SERVER_SOFTWARE'], 'ExpressionDevServer') !== false);
111 111
 
112 112
 /**
113 113
  * Whether the server software is IIS 7.X or greater
114 114
  * @global bool $is_iis7
115 115
  */
116
-$is_iis7 = $is_IIS && intval( substr( $_SERVER['SERVER_SOFTWARE'], strpos( $_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS/' ) + 14 ) ) >= 7;
116
+$is_iis7 = $is_IIS && intval(substr($_SERVER['SERVER_SOFTWARE'], strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS/') + 14)) >= 7;
117 117
 
118 118
 /**
119 119
  * Test if the current browser runs on a mobile device (smart phone, tablet, etc.)
@@ -125,19 +125,19 @@  discard block
 block discarded – undo
125 125
 function wp_is_mobile() {
126 126
 	static $is_mobile = null;
127 127
 
128
-	if ( isset( $is_mobile ) ) {
128
+	if (isset($is_mobile)) {
129 129
 		return $is_mobile;
130 130
 	}
131 131
 
132
-	if ( empty($_SERVER['HTTP_USER_AGENT']) ) {
132
+	if (empty($_SERVER['HTTP_USER_AGENT'])) {
133 133
 		$is_mobile = false;
134
-	} elseif ( strpos($_SERVER['HTTP_USER_AGENT'], 'Mobile') !== false // many mobile devices (all iPhone, iPad, etc.)
134
+	} elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'Mobile') !== false // many mobile devices (all iPhone, iPad, etc.)
135 135
 		|| strpos($_SERVER['HTTP_USER_AGENT'], 'Android') !== false
136 136
 		|| strpos($_SERVER['HTTP_USER_AGENT'], 'Silk/') !== false
137 137
 		|| strpos($_SERVER['HTTP_USER_AGENT'], 'Kindle') !== false
138 138
 		|| strpos($_SERVER['HTTP_USER_AGENT'], 'BlackBerry') !== false
139 139
 		|| strpos($_SERVER['HTTP_USER_AGENT'], 'Opera Mini') !== false
140
-		|| strpos($_SERVER['HTTP_USER_AGENT'], 'Opera Mobi') !== false ) {
140
+		|| strpos($_SERVER['HTTP_USER_AGENT'], 'Opera Mobi') !== false) {
141 141
 			$is_mobile = true;
142 142
 	} else {
143 143
 		$is_mobile = false;
Please login to merge, or discard this patch.
Braces   +22 added lines, -16 removed lines patch added patch discarded remove patch
@@ -22,12 +22,13 @@  discard block
 block discarded – undo
22 22
 // On which page are we ?
23 23
 if ( is_admin() ) {
24 24
 	// wp-admin pages are checked more carefully
25
-	if ( is_network_admin() )
26
-		preg_match('#/wp-admin/network/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches);
27
-	elseif ( is_user_admin() )
28
-		preg_match('#/wp-admin/user/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches);
29
-	else
30
-		preg_match('#/wp-admin/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches);
25
+	if ( is_network_admin() ) {
26
+			preg_match('#/wp-admin/network/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches);
27
+	} elseif ( is_user_admin() ) {
28
+			preg_match('#/wp-admin/user/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches);
29
+	} else {
30
+			preg_match('#/wp-admin/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches);
31
+	}
31 32
 	$pagenow = $self_matches[1];
32 33
 	$pagenow = trim($pagenow, '/');
33 34
 	$pagenow = preg_replace('#\?.*?$#', '', $pagenow);
@@ -36,15 +37,18 @@  discard block
 block discarded – undo
36 37
 	} else {
37 38
 		preg_match('#(.*?)(/|$)#', $pagenow, $self_matches);
38 39
 		$pagenow = strtolower($self_matches[1]);
39
-		if ( '.php' !== substr($pagenow, -4, 4) )
40
-			$pagenow .= '.php'; // for Options +Multiviews: /wp-admin/themes/index.php (themes.php is queried)
40
+		if ( '.php' !== substr($pagenow, -4, 4) ) {
41
+					$pagenow .= '.php';
42
+		}
43
+		// for Options +Multiviews: /wp-admin/themes/index.php (themes.php is queried)
41 44
 	}
42 45
 } else {
43
-	if ( preg_match('#([^/]+\.php)([?/].*?)?$#i', $_SERVER['PHP_SELF'], $self_matches) )
44
-		$pagenow = strtolower($self_matches[1]);
45
-	else
46
-		$pagenow = 'index.php';
47
-}
46
+	if ( preg_match('#([^/]+\.php)([?/].*?)?$#i', $_SERVER['PHP_SELF'], $self_matches) ) {
47
+			$pagenow = strtolower($self_matches[1]);
48
+	} else {
49
+			$pagenow = 'index.php';
50
+	}
51
+	}
48 52
 unset($self_matches);
49 53
 
50 54
 // Simple browser detection
@@ -63,8 +67,9 @@  discard block
 block discarded – undo
63 67
 			 *
64 68
 			 * @param bool $is_admin Whether to use the Google Chrome Frame. Default is the value of is_admin().
65 69
 			 */
66
-			if ( $is_chrome = apply_filters( 'use_google_chrome_frame', $is_admin ) )
67
-				header( 'X-UA-Compatible: chrome=1' );
70
+			if ( $is_chrome = apply_filters( 'use_google_chrome_frame', $is_admin ) ) {
71
+							header( 'X-UA-Compatible: chrome=1' );
72
+			}
68 73
 			$is_winIE = ! $is_chrome;
69 74
 		} else {
70 75
 			$is_chrome = true;
@@ -84,8 +89,9 @@  discard block
 block discarded – undo
84 89
 	}
85 90
 }
86 91
 
87
-if ( $is_safari && stripos($_SERVER['HTTP_USER_AGENT'], 'mobile') !== false )
92
+if ( $is_safari && stripos($_SERVER['HTTP_USER_AGENT'], 'mobile') !== false ) {
88 93
 	$is_iphone = true;
94
+}
89 95
 
90 96
 $is_IE = ( $is_macIE || $is_winIE );
91 97
 
Please login to merge, or discard this patch.
src/wp-includes/class-wp-xmlrpc-server.php 3 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * XML-RPC protocol support for WordPress
4
- *
5
- * @package WordPress
6
- * @subpackage Publishing
7
- */
3
+	 * XML-RPC protocol support for WordPress
4
+	 *
5
+	 * @package WordPress
6
+	 * @subpackage Publishing
7
+	 */
8 8
 
9 9
 /**
10 10
  * WordPress XMLRPC server implementation.
Please login to merge, or discard this patch.
Spacing   +1408 added lines, -1408 removed lines patch added patch discarded remove patch
@@ -81,13 +81,13 @@  discard block
 block discarded – undo
81 81
 			'wp.editPage'			=> 'this:wp_editPage',
82 82
 			'wp.getPageList'		=> 'this:wp_getPageList',
83 83
 			'wp.getAuthors'			=> 'this:wp_getAuthors',
84
-			'wp.getCategories'		=> 'this:mw_getCategories',		// Alias
84
+			'wp.getCategories'		=> 'this:mw_getCategories', // Alias
85 85
 			'wp.getTags'			=> 'this:wp_getTags',
86 86
 			'wp.newCategory'		=> 'this:wp_newCategory',
87 87
 			'wp.deleteCategory'		=> 'this:wp_deleteCategory',
88 88
 			'wp.suggestCategories'	=> 'this:wp_suggestCategories',
89
-			'wp.uploadFile'			=> 'this:mw_newMediaObject',	// Alias
90
-			'wp.deleteFile'			=> 'this:wp_deletePost',		// Alias
89
+			'wp.uploadFile'			=> 'this:mw_newMediaObject', // Alias
90
+			'wp.deleteFile'			=> 'this:wp_deletePost', // Alias
91 91
 			'wp.getCommentCount'	=> 'this:wp_getCommentCount',
92 92
 			'wp.getPostStatusList'	=> 'this:wp_getPostStatusList',
93 93
 			'wp.getPageStatusList'	=> 'this:wp_getPageStatusList',
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 		 *
160 160
 		 * @param array $methods An array of XML-RPC methods.
161 161
 		 */
162
-		$this->methods = apply_filters( 'xmlrpc_methods', $this->methods );
162
+		$this->methods = apply_filters('xmlrpc_methods', $this->methods);
163 163
 	}
164 164
 
165 165
 	/**
@@ -172,9 +172,9 @@  discard block
 block discarded – undo
172 172
 	 * @param array    $arguments Arguments to pass when calling.
173 173
 	 * @return array|IXR_Error|false Return value of the callback, false otherwise.
174 174
 	 */
175
-	public function __call( $name, $arguments ) {
176
-		if ( '_multisite_getUsersBlogs' === $name ) {
177
-			return call_user_func_array( array( $this, $name ), $arguments );
175
+	public function __call($name, $arguments) {
176
+		if ('_multisite_getUsersBlogs' === $name) {
177
+			return call_user_func_array(array($this, $name), $arguments);
178 178
 		}
179 179
 		return false;
180 180
 	}
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 	 * }
211 211
 	 * @return int Sum of the two given numbers.
212 212
 	 */
213
-	public function addTwoNumbers( $args ) {
213
+	public function addTwoNumbers($args) {
214 214
 		$number1 = $args[0];
215 215
 		$number2 = $args[1];
216 216
 		return $number1 + $number2;
@@ -225,14 +225,14 @@  discard block
 block discarded – undo
225 225
 	 * @param string $password User's password.
226 226
 	 * @return WP_User|bool WP_User object if authentication passed, false otherwise
227 227
 	 */
228
-	public function login( $username, $password ) {
228
+	public function login($username, $password) {
229 229
 		/*
230 230
 		 * Respect old get_option() filters left for back-compat when the 'enable_xmlrpc'
231 231
 		 * option was deprecated in 3.5.0. Use the 'xmlrpc_enabled' hook instead.
232 232
 		 */
233
-		$enabled = apply_filters( 'pre_option_enable_xmlrpc', false );
234
-		if ( false === $enabled ) {
235
-			$enabled = apply_filters( 'option_enable_xmlrpc', true );
233
+		$enabled = apply_filters('pre_option_enable_xmlrpc', false);
234
+		if (false === $enabled) {
235
+			$enabled = apply_filters('option_enable_xmlrpc', true);
236 236
 		}
237 237
 
238 238
 		/**
@@ -244,17 +244,17 @@  discard block
 block discarded – undo
244 244
 		 *
245 245
 		 * @param bool $enabled Whether XML-RPC is enabled. Default true.
246 246
 		 */
247
-		$enabled = apply_filters( 'xmlrpc_enabled', $enabled );
247
+		$enabled = apply_filters('xmlrpc_enabled', $enabled);
248 248
 
249
-		if ( ! $enabled ) {
250
-			$this->error = new IXR_Error( 405, sprintf( __( 'XML-RPC services are disabled on this site.' ) ) );
249
+		if ( ! $enabled) {
250
+			$this->error = new IXR_Error(405, sprintf(__('XML-RPC services are disabled on this site.')));
251 251
 			return false;
252 252
 		}
253 253
 
254 254
 		$user = wp_authenticate($username, $password);
255 255
 
256 256
 		if (is_wp_error($user)) {
257
-			$this->error = new IXR_Error( 403, __( 'Incorrect username or password.' ) );
257
+			$this->error = new IXR_Error(403, __('Incorrect username or password.'));
258 258
 
259 259
 			/**
260 260
 			 * Filter the XML-RPC user login error message.
@@ -264,11 +264,11 @@  discard block
 block discarded – undo
264 264
 			 * @param string  $error The XML-RPC error message.
265 265
 			 * @param WP_User $user  WP_User object.
266 266
 			 */
267
-			$this->error = apply_filters( 'xmlrpc_login_error', $this->error, $user );
267
+			$this->error = apply_filters('xmlrpc_login_error', $this->error, $user);
268 268
 			return false;
269 269
 		}
270 270
 
271
-		wp_set_current_user( $user->ID );
271
+		wp_set_current_user($user->ID);
272 272
 		return $user;
273 273
 	}
274 274
 
@@ -283,8 +283,8 @@  discard block
 block discarded – undo
283 283
 	 * @param string $password User's password.
284 284
 	 * @return bool Whether authentication passed.
285 285
 	 */
286
-	public function login_pass_ok( $username, $password ) {
287
-		return (bool) $this->login( $username, $password );
286
+	public function login_pass_ok($username, $password) {
287
+		return (bool) $this->login($username, $password);
288 288
 	}
289 289
 
290 290
 	/**
@@ -296,15 +296,15 @@  discard block
 block discarded – undo
296 296
 	 * @return string|void Returns with string is passed, alters by-reference
297 297
 	 *                     when array is passed.
298 298
 	 */
299
-	public function escape( &$data ) {
300
-		if ( ! is_array( $data ) )
301
-			return wp_slash( $data );
299
+	public function escape(&$data) {
300
+		if ( ! is_array($data))
301
+			return wp_slash($data);
302 302
 
303
-		foreach ( $data as &$v ) {
304
-			if ( is_array( $v ) )
305
-				$this->escape( $v );
306
-			elseif ( ! is_object( $v ) )
307
-				$v = wp_slash( $v );
303
+		foreach ($data as &$v) {
304
+			if (is_array($v))
305
+				$this->escape($v);
306
+			elseif ( ! is_object($v))
307
+				$v = wp_slash($v);
308 308
 		}
309 309
 	}
310 310
 
@@ -321,9 +321,9 @@  discard block
 block discarded – undo
321 321
 
322 322
 		$custom_fields = array();
323 323
 
324
-		foreach ( (array) has_meta($post_id) as $meta ) {
324
+		foreach ((array) has_meta($post_id) as $meta) {
325 325
 			// Don't expose protected fields.
326
-			if ( ! current_user_can( 'edit_post_meta', $post_id , $meta['meta_key'] ) )
326
+			if ( ! current_user_can('edit_post_meta', $post_id, $meta['meta_key']))
327 327
 				continue;
328 328
 
329 329
 			$custom_fields[] = array(
@@ -347,22 +347,22 @@  discard block
 block discarded – undo
347 347
 	public function set_custom_fields($post_id, $fields) {
348 348
 		$post_id = (int) $post_id;
349 349
 
350
-		foreach ( (array) $fields as $meta ) {
351
-			if ( isset($meta['id']) ) {
350
+		foreach ((array) $fields as $meta) {
351
+			if (isset($meta['id'])) {
352 352
 				$meta['id'] = (int) $meta['id'];
353
-				$pmeta = get_metadata_by_mid( 'post', $meta['id'] );
354
-				if ( isset($meta['key']) ) {
355
-					$meta['key'] = wp_unslash( $meta['key'] );
356
-					if ( $meta['key'] !== $pmeta->meta_key )
353
+				$pmeta = get_metadata_by_mid('post', $meta['id']);
354
+				if (isset($meta['key'])) {
355
+					$meta['key'] = wp_unslash($meta['key']);
356
+					if ($meta['key'] !== $pmeta->meta_key)
357 357
 						continue;
358
-					$meta['value'] = wp_unslash( $meta['value'] );
359
-					if ( current_user_can( 'edit_post_meta', $post_id, $meta['key'] ) )
360
-						update_metadata_by_mid( 'post', $meta['id'], $meta['value'] );
361
-				} elseif ( current_user_can( 'delete_post_meta', $post_id, $pmeta->meta_key ) ) {
362
-					delete_metadata_by_mid( 'post', $meta['id'] );
358
+					$meta['value'] = wp_unslash($meta['value']);
359
+					if (current_user_can('edit_post_meta', $post_id, $meta['key']))
360
+						update_metadata_by_mid('post', $meta['id'], $meta['value']);
361
+				} elseif (current_user_can('delete_post_meta', $post_id, $pmeta->meta_key)) {
362
+					delete_metadata_by_mid('post', $meta['id']);
363 363
 				}
364
-			} elseif ( current_user_can( 'add_post_meta', $post_id, wp_unslash( $meta['key'] ) ) ) {
365
-				add_post_meta( $post_id, $meta['key'], $meta['value'] );
364
+			} elseif (current_user_can('add_post_meta', $post_id, wp_unslash($meta['key']))) {
365
+				add_post_meta($post_id, $meta['key'], $meta['value']);
366 366
 			}
367 367
 		}
368 368
 	}
@@ -382,139 +382,139 @@  discard block
 block discarded – undo
382 382
 		$this->blog_options = array(
383 383
 			// Read only options
384 384
 			'software_name'     => array(
385
-				'desc'          => __( 'Software Name' ),
385
+				'desc'          => __('Software Name'),
386 386
 				'readonly'      => true,
387 387
 				'value'         => 'WordPress'
388 388
 			),
389 389
 			'software_version'  => array(
390
-				'desc'          => __( 'Software Version' ),
390
+				'desc'          => __('Software Version'),
391 391
 				'readonly'      => true,
392 392
 				'value'         => $wp_version
393 393
 			),
394 394
 			'blog_url'          => array(
395
-				'desc'          => __( 'WordPress Address (URL)' ),
395
+				'desc'          => __('WordPress Address (URL)'),
396 396
 				'readonly'      => true,
397 397
 				'option'        => 'siteurl'
398 398
 			),
399 399
 			'home_url'          => array(
400
-				'desc'          => __( 'Site Address (URL)' ),
400
+				'desc'          => __('Site Address (URL)'),
401 401
 				'readonly'      => true,
402 402
 				'option'        => 'home'
403 403
 			),
404 404
 			'login_url'          => array(
405
-				'desc'          => __( 'Login Address (URL)' ),
405
+				'desc'          => __('Login Address (URL)'),
406 406
 				'readonly'      => true,
407 407
 				'value'         => wp_login_url( )
408 408
 			),
409 409
 			'admin_url'          => array(
410
-				'desc'          => __( 'The URL to the admin area' ),
410
+				'desc'          => __('The URL to the admin area'),
411 411
 				'readonly'      => true,
412 412
 				'value'         => get_admin_url( )
413 413
 			),
414 414
 			'image_default_link_type' => array(
415
-				'desc'          => __( 'Image default link type' ),
415
+				'desc'          => __('Image default link type'),
416 416
 				'readonly'      => true,
417 417
 				'option'        => 'image_default_link_type'
418 418
 			),
419 419
 			'image_default_size' => array(
420
-				'desc'          => __( 'Image default size' ),
420
+				'desc'          => __('Image default size'),
421 421
 				'readonly'      => true,
422 422
 				'option'        => 'image_default_size'
423 423
 			),
424 424
 			'image_default_align' => array(
425
-				'desc'          => __( 'Image default align' ),
425
+				'desc'          => __('Image default align'),
426 426
 				'readonly'      => true,
427 427
 				'option'        => 'image_default_align'
428 428
 			),
429 429
 			'template'          => array(
430
-				'desc'          => __( 'Template' ),
430
+				'desc'          => __('Template'),
431 431
 				'readonly'      => true,
432 432
 				'option'        => 'template'
433 433
 			),
434 434
 			'stylesheet'        => array(
435
-				'desc'          => __( 'Stylesheet' ),
435
+				'desc'          => __('Stylesheet'),
436 436
 				'readonly'      => true,
437 437
 				'option'        => 'stylesheet'
438 438
 			),
439 439
 			'post_thumbnail'    => array(
440 440
 				'desc'          => __('Post Thumbnail'),
441 441
 				'readonly'      => true,
442
-				'value'         => current_theme_supports( 'post-thumbnails' )
442
+				'value'         => current_theme_supports('post-thumbnails')
443 443
 			),
444 444
 
445 445
 			// Updatable options
446 446
 			'time_zone'         => array(
447
-				'desc'          => __( 'Time Zone' ),
447
+				'desc'          => __('Time Zone'),
448 448
 				'readonly'      => false,
449 449
 				'option'        => 'gmt_offset'
450 450
 			),
451 451
 			'blog_title'        => array(
452
-				'desc'          => __( 'Site Title' ),
452
+				'desc'          => __('Site Title'),
453 453
 				'readonly'      => false,
454 454
 				'option'        => 'blogname'
455 455
 			),
456 456
 			'blog_tagline'      => array(
457
-				'desc'          => __( 'Site Tagline' ),
457
+				'desc'          => __('Site Tagline'),
458 458
 				'readonly'      => false,
459 459
 				'option'        => 'blogdescription'
460 460
 			),
461 461
 			'date_format'       => array(
462
-				'desc'          => __( 'Date Format' ),
462
+				'desc'          => __('Date Format'),
463 463
 				'readonly'      => false,
464 464
 				'option'        => 'date_format'
465 465
 			),
466 466
 			'time_format'       => array(
467
-				'desc'          => __( 'Time Format' ),
467
+				'desc'          => __('Time Format'),
468 468
 				'readonly'      => false,
469 469
 				'option'        => 'time_format'
470 470
 			),
471 471
 			'users_can_register' => array(
472
-				'desc'          => __( 'Allow new users to sign up' ),
472
+				'desc'          => __('Allow new users to sign up'),
473 473
 				'readonly'      => false,
474 474
 				'option'        => 'users_can_register'
475 475
 			),
476 476
 			'thumbnail_size_w'  => array(
477
-				'desc'          => __( 'Thumbnail Width' ),
477
+				'desc'          => __('Thumbnail Width'),
478 478
 				'readonly'      => false,
479 479
 				'option'        => 'thumbnail_size_w'
480 480
 			),
481 481
 			'thumbnail_size_h'  => array(
482
-				'desc'          => __( 'Thumbnail Height' ),
482
+				'desc'          => __('Thumbnail Height'),
483 483
 				'readonly'      => false,
484 484
 				'option'        => 'thumbnail_size_h'
485 485
 			),
486 486
 			'thumbnail_crop'    => array(
487
-				'desc'          => __( 'Crop thumbnail to exact dimensions' ),
487
+				'desc'          => __('Crop thumbnail to exact dimensions'),
488 488
 				'readonly'      => false,
489 489
 				'option'        => 'thumbnail_crop'
490 490
 			),
491 491
 			'medium_size_w'     => array(
492
-				'desc'          => __( 'Medium size image width' ),
492
+				'desc'          => __('Medium size image width'),
493 493
 				'readonly'      => false,
494 494
 				'option'        => 'medium_size_w'
495 495
 			),
496 496
 			'medium_size_h'     => array(
497
-				'desc'          => __( 'Medium size image height' ),
497
+				'desc'          => __('Medium size image height'),
498 498
 				'readonly'      => false,
499 499
 				'option'        => 'medium_size_h'
500 500
 			),
501 501
 			'large_size_w'      => array(
502
-				'desc'          => __( 'Large size image width' ),
502
+				'desc'          => __('Large size image width'),
503 503
 				'readonly'      => false,
504 504
 				'option'        => 'large_size_w'
505 505
 			),
506 506
 			'large_size_h'      => array(
507
-				'desc'          => __( 'Large size image height' ),
507
+				'desc'          => __('Large size image height'),
508 508
 				'readonly'      => false,
509 509
 				'option'        => 'large_size_h'
510 510
 			),
511 511
 			'default_comment_status' => array(
512
-				'desc'          => __( 'Allow people to post comments on new articles' ),
512
+				'desc'          => __('Allow people to post comments on new articles'),
513 513
 				'readonly'      => false,
514 514
 				'option'        => 'default_comment_status'
515 515
 			),
516 516
 			'default_ping_status' => array(
517
-				'desc'          => __( 'Allow link notifications from other blogs (pingbacks and trackbacks) on new articles' ),
517
+				'desc'          => __('Allow link notifications from other blogs (pingbacks and trackbacks) on new articles'),
518 518
 				'readonly'      => false,
519 519
 				'option'        => 'default_ping_status'
520 520
 			)
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 		 *
528 528
 		 * @param array $blog_options An array of XML-RPC blog options.
529 529
 		 */
530
-		$this->blog_options = apply_filters( 'xmlrpc_blog_options', $this->blog_options );
530
+		$this->blog_options = apply_filters('xmlrpc_blog_options', $this->blog_options);
531 531
 	}
532 532
 
533 533
 	/**
@@ -548,19 +548,19 @@  discard block
 block discarded – undo
548 548
 	 *  - 'blogName'
549 549
 	 *  - 'xmlrpc' - url of xmlrpc endpoint
550 550
 	 */
551
-	public function wp_getUsersBlogs( $args ) {
551
+	public function wp_getUsersBlogs($args) {
552 552
 		// If this isn't on WPMU then just use blogger_getUsersBlogs
553
-		if ( !is_multisite() ) {
554
-			array_unshift( $args, 1 );
555
-			return $this->blogger_getUsersBlogs( $args );
553
+		if ( ! is_multisite()) {
554
+			array_unshift($args, 1);
555
+			return $this->blogger_getUsersBlogs($args);
556 556
 		}
557 557
 
558
-		$this->escape( $args );
558
+		$this->escape($args);
559 559
 
560 560
 		$username = $args[0];
561 561
 		$password = $args[1];
562 562
 
563
-		if ( !$user = $this->login($username, $password) )
563
+		if ( ! $user = $this->login($username, $password))
564 564
 			return $this->error;
565 565
 
566 566
 		/**
@@ -574,28 +574,28 @@  discard block
 block discarded – undo
574 574
 		 *
575 575
 		 * @param string $name The method name.
576 576
 		 */
577
-		do_action( 'xmlrpc_call', 'wp.getUsersBlogs' );
577
+		do_action('xmlrpc_call', 'wp.getUsersBlogs');
578 578
 
579
-		$blogs = (array) get_blogs_of_user( $user->ID );
579
+		$blogs = (array) get_blogs_of_user($user->ID);
580 580
 		$struct = array();
581 581
 
582
-		foreach ( $blogs as $blog ) {
582
+		foreach ($blogs as $blog) {
583 583
 			// Don't include blogs that aren't hosted at this site.
584
-			if ( $blog->site_id != get_current_site()->id )
584
+			if ($blog->site_id != get_current_site()->id)
585 585
 				continue;
586 586
 
587 587
 			$blog_id = $blog->userblog_id;
588 588
 
589
-			switch_to_blog( $blog_id );
589
+			switch_to_blog($blog_id);
590 590
 
591
-			$is_admin = current_user_can( 'manage_options' );
591
+			$is_admin = current_user_can('manage_options');
592 592
 
593 593
 			$struct[] = array(
594 594
 				'isAdmin'		=> $is_admin,
595
-				'url'			=> home_url( '/' ),
595
+				'url'			=> home_url('/'),
596 596
 				'blogid'		=> (string) $blog_id,
597
-				'blogName'		=> get_option( 'blogname' ),
598
-				'xmlrpc'		=> site_url( 'xmlrpc.php', 'rpc' ),
597
+				'blogName'		=> get_option('blogname'),
598
+				'xmlrpc'		=> site_url('xmlrpc.php', 'rpc'),
599 599
 			);
600 600
 
601 601
 			restore_current_blog();
@@ -614,9 +614,9 @@  discard block
 block discarded – undo
614 614
 	 * @param int $count         Minimum number of arguments.
615 615
 	 * @return bool if `$args` contains at least $count arguments.
616 616
 	 */
617
-	protected function minimum_args( $args, $count ) {
618
-		if ( count( $args ) < $count ) {
619
-			$this->error = new IXR_Error( 400, __( 'Insufficient arguments passed to this XML-RPC method.' ) );
617
+	protected function minimum_args($args, $count) {
618
+		if (count($args) < $count) {
619
+			$this->error = new IXR_Error(400, __('Insufficient arguments passed to this XML-RPC method.'));
620 620
 			return false;
621 621
 		}
622 622
 
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
 	 * @param array $fields    The subset of taxonomy fields to return.
633 633
 	 * @return array The prepared taxonomy data.
634 634
 	 */
635
-	protected function _prepare_taxonomy( $taxonomy, $fields ) {
635
+	protected function _prepare_taxonomy($taxonomy, $fields) {
636 636
 		$_taxonomy = array(
637 637
 			'name' => $taxonomy->name,
638 638
 			'label' => $taxonomy->label,
@@ -642,17 +642,17 @@  discard block
 block discarded – undo
642 642
 			'_builtin' => (bool) $taxonomy->_builtin,
643 643
 		);
644 644
 
645
-		if ( in_array( 'labels', $fields ) )
645
+		if (in_array('labels', $fields))
646 646
 			$_taxonomy['labels'] = (array) $taxonomy->labels;
647 647
 
648
-		if ( in_array( 'cap', $fields ) )
648
+		if (in_array('cap', $fields))
649 649
 			$_taxonomy['cap'] = (array) $taxonomy->cap;
650 650
 
651
-		if ( in_array( 'menu', $fields ) )
651
+		if (in_array('menu', $fields))
652 652
 			$_taxonomy['show_in_menu'] = (bool) $_taxonomy->show_in_menu;
653 653
 
654
-		if ( in_array( 'object_type', $fields ) )
655
-			$_taxonomy['object_type'] = array_unique( (array) $taxonomy->object_type );
654
+		if (in_array('object_type', $fields))
655
+			$_taxonomy['object_type'] = array_unique((array) $taxonomy->object_type);
656 656
 
657 657
 		/**
658 658
 		 * Filter XML-RPC-prepared data for the given taxonomy.
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
 		 * @param object $taxonomy  Taxonomy object.
664 664
 		 * @param array  $fields    The subset of taxonomy fields to return.
665 665
 		 */
666
-		return apply_filters( 'xmlrpc_prepare_taxonomy', $_taxonomy, $taxonomy, $fields );
666
+		return apply_filters('xmlrpc_prepare_taxonomy', $_taxonomy, $taxonomy, $fields);
667 667
 	}
668 668
 
669 669
 	/**
@@ -674,19 +674,19 @@  discard block
 block discarded – undo
674 674
 	 * @param array|object $term The unprepared term data.
675 675
 	 * @return array The prepared term data.
676 676
 	 */
677
-	protected function _prepare_term( $term ) {
677
+	protected function _prepare_term($term) {
678 678
 		$_term = $term;
679
-		if ( ! is_array( $_term ) )
680
-			$_term = get_object_vars( $_term );
679
+		if ( ! is_array($_term))
680
+			$_term = get_object_vars($_term);
681 681
 
682 682
 		// For integers which may be larger than XML-RPC supports ensure we return strings.
683
-		$_term['term_id'] = strval( $_term['term_id'] );
684
-		$_term['term_group'] = strval( $_term['term_group'] );
685
-		$_term['term_taxonomy_id'] = strval( $_term['term_taxonomy_id'] );
686
-		$_term['parent'] = strval( $_term['parent'] );
683
+		$_term['term_id'] = strval($_term['term_id']);
684
+		$_term['term_group'] = strval($_term['term_group']);
685
+		$_term['term_taxonomy_id'] = strval($_term['term_taxonomy_id']);
686
+		$_term['parent'] = strval($_term['parent']);
687 687
 
688 688
 		// Count we are happy to return as an integer because people really shouldn't use terms that much.
689
-		$_term['count'] = intval( $_term['count'] );
689
+		$_term['count'] = intval($_term['count']);
690 690
 
691 691
 		/**
692 692
 		 * Filter XML-RPC-prepared data for the given term.
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
 		 * @param array        $_term An array of term data.
697 697
 		 * @param array|object $term  Term object or array.
698 698
 		 */
699
-		return apply_filters( 'xmlrpc_prepare_term', $_term, $term );
699
+		return apply_filters('xmlrpc_prepare_term', $_term, $term);
700 700
 	}
701 701
 
702 702
 	/**
@@ -707,11 +707,11 @@  discard block
 block discarded – undo
707 707
 	 * @param string $date Date string to convert.
708 708
 	 * @return IXR_Date IXR_Date object.
709 709
 	 */
710
-	protected function _convert_date( $date ) {
711
-		if ( $date === '0000-00-00 00:00:00' ) {
712
-			return new IXR_Date( '00000000T00:00:00Z' );
710
+	protected function _convert_date($date) {
711
+		if ($date === '0000-00-00 00:00:00') {
712
+			return new IXR_Date('00000000T00:00:00Z');
713 713
 		}
714
-		return new IXR_Date( mysql2date( 'Ymd\TH:i:s', $date, false ) );
714
+		return new IXR_Date(mysql2date('Ymd\TH:i:s', $date, false));
715 715
 	}
716 716
 
717 717
 	/**
@@ -723,11 +723,11 @@  discard block
 block discarded – undo
723 723
 	 * @param string $date     Date string.
724 724
 	 * @return IXR_Date IXR_Date object.
725 725
 	 */
726
-	protected function _convert_date_gmt( $date_gmt, $date ) {
727
-		if ( $date !== '0000-00-00 00:00:00' && $date_gmt === '0000-00-00 00:00:00' ) {
728
-			return new IXR_Date( get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $date, false ), 'Ymd\TH:i:s' ) );
726
+	protected function _convert_date_gmt($date_gmt, $date) {
727
+		if ($date !== '0000-00-00 00:00:00' && $date_gmt === '0000-00-00 00:00:00') {
728
+			return new IXR_Date(get_gmt_from_date(mysql2date('Y-m-d H:i:s', $date, false), 'Ymd\TH:i:s'));
729 729
 		}
730
-		return $this->_convert_date( $date_gmt );
730
+		return $this->_convert_date($date_gmt);
731 731
 	}
732 732
 
733 733
 	/**
@@ -739,17 +739,17 @@  discard block
 block discarded – undo
739 739
 	 * @param array $fields The subset of post type fields to return.
740 740
 	 * @return array The prepared post data.
741 741
 	 */
742
-	protected function _prepare_post( $post, $fields ) {
742
+	protected function _prepare_post($post, $fields) {
743 743
 		// Holds the data for this post. built up based on $fields.
744
-		$_post = array( 'post_id' => strval( $post['ID'] ) );
744
+		$_post = array('post_id' => strval($post['ID']));
745 745
 
746 746
 		// Prepare common post fields.
747 747
 		$post_fields = array(
748 748
 			'post_title'        => $post['post_title'],
749
-			'post_date'         => $this->_convert_date( $post['post_date'] ),
750
-			'post_date_gmt'     => $this->_convert_date_gmt( $post['post_date_gmt'], $post['post_date'] ),
751
-			'post_modified'     => $this->_convert_date( $post['post_modified'] ),
752
-			'post_modified_gmt' => $this->_convert_date_gmt( $post['post_modified_gmt'], $post['post_modified'] ),
749
+			'post_date'         => $this->_convert_date($post['post_date']),
750
+			'post_date_gmt'     => $this->_convert_date_gmt($post['post_date_gmt'], $post['post_date']),
751
+			'post_modified'     => $this->_convert_date($post['post_modified']),
752
+			'post_modified_gmt' => $this->_convert_date_gmt($post['post_modified_gmt'], $post['post_modified']),
753 753
 			'post_status'       => $post['post_status'],
754 754
 			'post_type'         => $post['post_type'],
755 755
 			'post_name'         => $post['post_name'],
@@ -757,63 +757,63 @@  discard block
 block discarded – undo
757 757
 			'post_password'     => $post['post_password'],
758 758
 			'post_excerpt'      => $post['post_excerpt'],
759 759
 			'post_content'      => $post['post_content'],
760
-			'post_parent'       => strval( $post['post_parent'] ),
760
+			'post_parent'       => strval($post['post_parent']),
761 761
 			'post_mime_type'    => $post['post_mime_type'],
762
-			'link'              => get_permalink( $post['ID'] ),
762
+			'link'              => get_permalink($post['ID']),
763 763
 			'guid'              => $post['guid'],
764
-			'menu_order'        => intval( $post['menu_order'] ),
764
+			'menu_order'        => intval($post['menu_order']),
765 765
 			'comment_status'    => $post['comment_status'],
766 766
 			'ping_status'       => $post['ping_status'],
767
-			'sticky'            => ( $post['post_type'] === 'post' && is_sticky( $post['ID'] ) ),
767
+			'sticky'            => ($post['post_type'] === 'post' && is_sticky($post['ID'])),
768 768
 		);
769 769
 
770 770
 		// Thumbnail.
771 771
 		$post_fields['post_thumbnail'] = array();
772
-		$thumbnail_id = get_post_thumbnail_id( $post['ID'] );
773
-		if ( $thumbnail_id ) {
772
+		$thumbnail_id = get_post_thumbnail_id($post['ID']);
773
+		if ($thumbnail_id) {
774 774
 			$thumbnail_size = current_theme_supports('post-thumbnail') ? 'post-thumbnail' : 'thumbnail';
775
-			$post_fields['post_thumbnail'] = $this->_prepare_media_item( get_post( $thumbnail_id ), $thumbnail_size );
775
+			$post_fields['post_thumbnail'] = $this->_prepare_media_item(get_post($thumbnail_id), $thumbnail_size);
776 776
 		}
777 777
 
778 778
 		// Consider future posts as published.
779
-		if ( $post_fields['post_status'] === 'future' )
779
+		if ($post_fields['post_status'] === 'future')
780 780
 			$post_fields['post_status'] = 'publish';
781 781
 
782 782
 		// Fill in blank post format.
783
-		$post_fields['post_format'] = get_post_format( $post['ID'] );
784
-		if ( empty( $post_fields['post_format'] ) )
783
+		$post_fields['post_format'] = get_post_format($post['ID']);
784
+		if (empty($post_fields['post_format']))
785 785
 			$post_fields['post_format'] = 'standard';
786 786
 
787 787
 		// Merge requested $post_fields fields into $_post.
788
-		if ( in_array( 'post', $fields ) ) {
789
-			$_post = array_merge( $_post, $post_fields );
788
+		if (in_array('post', $fields)) {
789
+			$_post = array_merge($_post, $post_fields);
790 790
 		} else {
791
-			$requested_fields = array_intersect_key( $post_fields, array_flip( $fields ) );
792
-			$_post = array_merge( $_post, $requested_fields );
791
+			$requested_fields = array_intersect_key($post_fields, array_flip($fields));
792
+			$_post = array_merge($_post, $requested_fields);
793 793
 		}
794 794
 
795
-		$all_taxonomy_fields = in_array( 'taxonomies', $fields );
795
+		$all_taxonomy_fields = in_array('taxonomies', $fields);
796 796
 
797
-		if ( $all_taxonomy_fields || in_array( 'terms', $fields ) ) {
798
-			$post_type_taxonomies = get_object_taxonomies( $post['post_type'], 'names' );
799
-			$terms = wp_get_object_terms( $post['ID'], $post_type_taxonomies );
797
+		if ($all_taxonomy_fields || in_array('terms', $fields)) {
798
+			$post_type_taxonomies = get_object_taxonomies($post['post_type'], 'names');
799
+			$terms = wp_get_object_terms($post['ID'], $post_type_taxonomies);
800 800
 			$_post['terms'] = array();
801
-			foreach ( $terms as $term ) {
802
-				$_post['terms'][] = $this->_prepare_term( $term );
801
+			foreach ($terms as $term) {
802
+				$_post['terms'][] = $this->_prepare_term($term);
803 803
 			}
804 804
 		}
805 805
 
806
-		if ( in_array( 'custom_fields', $fields ) )
807
-			$_post['custom_fields'] = $this->get_custom_fields( $post['ID'] );
806
+		if (in_array('custom_fields', $fields))
807
+			$_post['custom_fields'] = $this->get_custom_fields($post['ID']);
808 808
 
809
-		if ( in_array( 'enclosure', $fields ) ) {
809
+		if (in_array('enclosure', $fields)) {
810 810
 			$_post['enclosure'] = array();
811
-			$enclosures = (array) get_post_meta( $post['ID'], 'enclosure' );
812
-			if ( ! empty( $enclosures ) ) {
813
-				$encdata = explode( "\n", $enclosures[0] );
814
-				$_post['enclosure']['url'] = trim( htmlspecialchars( $encdata[0] ) );
815
-				$_post['enclosure']['length'] = (int) trim( $encdata[1] );
816
-				$_post['enclosure']['type'] = trim( $encdata[2] );
811
+			$enclosures = (array) get_post_meta($post['ID'], 'enclosure');
812
+			if ( ! empty($enclosures)) {
813
+				$encdata = explode("\n", $enclosures[0]);
814
+				$_post['enclosure']['url'] = trim(htmlspecialchars($encdata[0]));
815
+				$_post['enclosure']['length'] = (int) trim($encdata[1]);
816
+				$_post['enclosure']['type'] = trim($encdata[2]);
817 817
 			}
818 818
 		}
819 819
 
@@ -826,7 +826,7 @@  discard block
 block discarded – undo
826 826
 		 * @param array $post   An array of post data.
827 827
 		 * @param array $fields An array of post fields.
828 828
 		 */
829
-		return apply_filters( 'xmlrpc_prepare_post', $_post, $post, $fields );
829
+		return apply_filters('xmlrpc_prepare_post', $_post, $post, $fields);
830 830
 	}
831 831
 
832 832
 	/**
@@ -838,7 +838,7 @@  discard block
 block discarded – undo
838 838
 	 * @param array  $fields    The subset of post fields to return.
839 839
 	 * @return array The prepared post type data.
840 840
 	 */
841
-	protected function _prepare_post_type( $post_type, $fields ) {
841
+	protected function _prepare_post_type($post_type, $fields) {
842 842
 		$_post_type = array(
843 843
 			'name' => $post_type->name,
844 844
 			'label' => $post_type->label,
@@ -847,26 +847,26 @@  discard block
 block discarded – undo
847 847
 			'show_ui' => (bool) $post_type->show_ui,
848 848
 			'_builtin' => (bool) $post_type->_builtin,
849 849
 			'has_archive' => (bool) $post_type->has_archive,
850
-			'supports' => get_all_post_type_supports( $post_type->name ),
850
+			'supports' => get_all_post_type_supports($post_type->name),
851 851
 		);
852 852
 
853
-		if ( in_array( 'labels', $fields ) ) {
853
+		if (in_array('labels', $fields)) {
854 854
 			$_post_type['labels'] = (array) $post_type->labels;
855 855
 		}
856 856
 
857
-		if ( in_array( 'cap', $fields ) ) {
857
+		if (in_array('cap', $fields)) {
858 858
 			$_post_type['cap'] = (array) $post_type->cap;
859 859
 			$_post_type['map_meta_cap'] = (bool) $post_type->map_meta_cap;
860 860
 		}
861 861
 
862
-		if ( in_array( 'menu', $fields ) ) {
862
+		if (in_array('menu', $fields)) {
863 863
 			$_post_type['menu_position'] = (int) $post_type->menu_position;
864 864
 			$_post_type['menu_icon'] = $post_type->menu_icon;
865 865
 			$_post_type['show_in_menu'] = (bool) $post_type->show_in_menu;
866 866
 		}
867 867
 
868
-		if ( in_array( 'taxonomies', $fields ) )
869
-			$_post_type['taxonomies'] = get_object_taxonomies( $post_type->name, 'names' );
868
+		if (in_array('taxonomies', $fields))
869
+			$_post_type['taxonomies'] = get_object_taxonomies($post_type->name, 'names');
870 870
 
871 871
 		/**
872 872
 		 * Filter XML-RPC-prepared date for the given post type.
@@ -876,7 +876,7 @@  discard block
 block discarded – undo
876 876
 		 * @param array  $_post_type An array of post type data.
877 877
 		 * @param object $post_type  Post type object.
878 878
 		 */
879
-		return apply_filters( 'xmlrpc_prepare_post_type', $_post_type, $post_type );
879
+		return apply_filters('xmlrpc_prepare_post_type', $_post_type, $post_type);
880 880
 	}
881 881
 
882 882
 	/**
@@ -888,20 +888,20 @@  discard block
 block discarded – undo
888 888
 	 * @param string $thumbnail_size The image size to use for the thumbnail URL.
889 889
 	 * @return array The prepared media item data.
890 890
 	 */
891
-	protected function _prepare_media_item( $media_item, $thumbnail_size = 'thumbnail' ) {
891
+	protected function _prepare_media_item($media_item, $thumbnail_size = 'thumbnail') {
892 892
 		$_media_item = array(
893
-			'attachment_id'    => strval( $media_item->ID ),
894
-			'date_created_gmt' => $this->_convert_date_gmt( $media_item->post_date_gmt, $media_item->post_date ),
893
+			'attachment_id'    => strval($media_item->ID),
894
+			'date_created_gmt' => $this->_convert_date_gmt($media_item->post_date_gmt, $media_item->post_date),
895 895
 			'parent'           => $media_item->post_parent,
896
-			'link'             => wp_get_attachment_url( $media_item->ID ),
896
+			'link'             => wp_get_attachment_url($media_item->ID),
897 897
 			'title'            => $media_item->post_title,
898 898
 			'caption'          => $media_item->post_excerpt,
899 899
 			'description'      => $media_item->post_content,
900
-			'metadata'         => wp_get_attachment_metadata( $media_item->ID ),
900
+			'metadata'         => wp_get_attachment_metadata($media_item->ID),
901 901
 		);
902 902
 
903
-		$thumbnail_src = image_downsize( $media_item->ID, $thumbnail_size );
904
-		if ( $thumbnail_src )
903
+		$thumbnail_src = image_downsize($media_item->ID, $thumbnail_size);
904
+		if ($thumbnail_src)
905 905
 			$_media_item['thumbnail'] = $thumbnail_src[0];
906 906
 		else
907 907
 			$_media_item['thumbnail'] = $_media_item['link'];
@@ -915,7 +915,7 @@  discard block
 block discarded – undo
915 915
 		 * @param object $media_item     Media item object.
916 916
 		 * @param string $thumbnail_size Image size.
917 917
 		 */
918
-		return apply_filters( 'xmlrpc_prepare_media_item', $_media_item, $media_item, $thumbnail_size );
918
+		return apply_filters('xmlrpc_prepare_media_item', $_media_item, $media_item, $thumbnail_size);
919 919
 	}
920 920
 
921 921
 	/**
@@ -926,39 +926,39 @@  discard block
 block discarded – undo
926 926
 	 * @param object $page The unprepared page data.
927 927
 	 * @return array The prepared page data.
928 928
 	 */
929
-	protected function _prepare_page( $page ) {
929
+	protected function _prepare_page($page) {
930 930
 		// Get all of the page content and link.
931
-		$full_page = get_extended( $page->post_content );
932
-		$link = get_permalink( $page->ID );
931
+		$full_page = get_extended($page->post_content);
932
+		$link = get_permalink($page->ID);
933 933
 
934 934
 		// Get info the page parent if there is one.
935 935
 		$parent_title = "";
936
-		if ( ! empty( $page->post_parent ) ) {
937
-			$parent = get_post( $page->post_parent );
936
+		if ( ! empty($page->post_parent)) {
937
+			$parent = get_post($page->post_parent);
938 938
 			$parent_title = $parent->post_title;
939 939
 		}
940 940
 
941 941
 		// Determine comment and ping settings.
942
-		$allow_comments = comments_open( $page->ID ) ? 1 : 0;
943
-		$allow_pings = pings_open( $page->ID ) ? 1 : 0;
942
+		$allow_comments = comments_open($page->ID) ? 1 : 0;
943
+		$allow_pings = pings_open($page->ID) ? 1 : 0;
944 944
 
945 945
 		// Format page date.
946
-		$page_date = $this->_convert_date( $page->post_date );
947
-		$page_date_gmt = $this->_convert_date_gmt( $page->post_date_gmt, $page->post_date );
946
+		$page_date = $this->_convert_date($page->post_date);
947
+		$page_date_gmt = $this->_convert_date_gmt($page->post_date_gmt, $page->post_date);
948 948
 
949 949
 		// Pull the categories info together.
950 950
 		$categories = array();
951
-		if ( is_object_in_taxonomy( 'page', 'category' ) ) {
952
-			foreach ( wp_get_post_categories( $page->ID ) as $cat_id ) {
953
-				$categories[] = get_cat_name( $cat_id );
951
+		if (is_object_in_taxonomy('page', 'category')) {
952
+			foreach (wp_get_post_categories($page->ID) as $cat_id) {
953
+				$categories[] = get_cat_name($cat_id);
954 954
 			}
955 955
 		}
956 956
 
957 957
 		// Get the author info.
958
-		$author = get_userdata( $page->post_author );
958
+		$author = get_userdata($page->post_author);
959 959
 
960
-		$page_template = get_page_template_slug( $page->ID );
961
-		if ( empty( $page_template ) )
960
+		$page_template = get_page_template_slug($page->ID);
961
+		if (empty($page_template))
962 962
 			$page_template = 'default';
963 963
 
964 964
 		$_page = array(
@@ -984,7 +984,7 @@  discard block
 block discarded – undo
984 984
 			'wp_author_id'           => (string) $author->ID,
985 985
 			'wp_author_display_name' => $author->display_name,
986 986
 			'date_created_gmt'       => $page_date_gmt,
987
-			'custom_fields'          => $this->get_custom_fields( $page->ID ),
987
+			'custom_fields'          => $this->get_custom_fields($page->ID),
988 988
 			'wp_page_template'       => $page_template
989 989
 		);
990 990
 
@@ -996,7 +996,7 @@  discard block
 block discarded – undo
996 996
 		 * @param array   $_page An array of page data.
997 997
 		 * @param WP_Post $page  Page object.
998 998
 		 */
999
-		return apply_filters( 'xmlrpc_prepare_page', $_page, $page );
999
+		return apply_filters('xmlrpc_prepare_page', $_page, $page);
1000 1000
 	}
1001 1001
 
1002 1002
 	/**
@@ -1007,15 +1007,15 @@  discard block
 block discarded – undo
1007 1007
 	 * @param object $comment The unprepared comment data.
1008 1008
 	 * @return array The prepared comment data.
1009 1009
 	 */
1010
-	protected function _prepare_comment( $comment ) {
1010
+	protected function _prepare_comment($comment) {
1011 1011
 		// Format page date.
1012
-		$comment_date_gmt = $this->_convert_date_gmt( $comment->comment_date_gmt, $comment->comment_date );
1012
+		$comment_date_gmt = $this->_convert_date_gmt($comment->comment_date_gmt, $comment->comment_date);
1013 1013
 
1014
-		if ( '0' == $comment->comment_approved ) {
1014
+		if ('0' == $comment->comment_approved) {
1015 1015
 			$comment_status = 'hold';
1016
-		} elseif ( 'spam' == $comment->comment_approved ) {
1016
+		} elseif ('spam' == $comment->comment_approved) {
1017 1017
 			$comment_status = 'spam';
1018
-		} elseif ( '1' == $comment->comment_approved ) {
1018
+		} elseif ('1' == $comment->comment_approved) {
1019 1019
 			$comment_status = 'approve';
1020 1020
 		} else {
1021 1021
 			$comment_status = $comment->comment_approved;
@@ -1045,7 +1045,7 @@  discard block
 block discarded – undo
1045 1045
 		 * @param array  $_comment An array of prepared comment data.
1046 1046
 		 * @param object $comment  Comment object.
1047 1047
 		 */
1048
-		return apply_filters( 'xmlrpc_prepare_comment', $_comment, $comment );
1048
+		return apply_filters('xmlrpc_prepare_comment', $_comment, $comment);
1049 1049
 	}
1050 1050
 
1051 1051
 	/**
@@ -1057,14 +1057,14 @@  discard block
 block discarded – undo
1057 1057
 	 * @param array   $fields The subset of user fields to return.
1058 1058
 	 * @return array The prepared user data.
1059 1059
 	 */
1060
-	protected function _prepare_user( $user, $fields ) {
1061
-		$_user = array( 'user_id' => strval( $user->ID ) );
1060
+	protected function _prepare_user($user, $fields) {
1061
+		$_user = array('user_id' => strval($user->ID));
1062 1062
 
1063 1063
 		$user_fields = array(
1064 1064
 			'username'          => $user->user_login,
1065 1065
 			'first_name'        => $user->user_firstname,
1066 1066
 			'last_name'         => $user->user_lastname,
1067
-			'registered'        => $this->_convert_date( $user->user_registered ),
1067
+			'registered'        => $this->_convert_date($user->user_registered),
1068 1068
 			'bio'               => $user->user_description,
1069 1069
 			'email'             => $user->user_email,
1070 1070
 			'nickname'          => $user->nickname,
@@ -1074,15 +1074,15 @@  discard block
 block discarded – undo
1074 1074
 			'roles'             => $user->roles,
1075 1075
 		);
1076 1076
 
1077
-		if ( in_array( 'all', $fields ) ) {
1078
-			$_user = array_merge( $_user, $user_fields );
1077
+		if (in_array('all', $fields)) {
1078
+			$_user = array_merge($_user, $user_fields);
1079 1079
 		} else {
1080
-			if ( in_array( 'basic', $fields ) ) {
1081
-				$basic_fields = array( 'username', 'email', 'registered', 'display_name', 'nicename' );
1082
-				$fields = array_merge( $fields, $basic_fields );
1080
+			if (in_array('basic', $fields)) {
1081
+				$basic_fields = array('username', 'email', 'registered', 'display_name', 'nicename');
1082
+				$fields = array_merge($fields, $basic_fields);
1083 1083
 			}
1084
-			$requested_fields = array_intersect_key( $user_fields, array_flip( $fields ) );
1085
-			$_user = array_merge( $_user, $requested_fields );
1084
+			$requested_fields = array_intersect_key($user_fields, array_flip($fields));
1085
+			$_user = array_merge($_user, $requested_fields);
1086 1086
 		}
1087 1087
 
1088 1088
 		/**
@@ -1094,7 +1094,7 @@  discard block
 block discarded – undo
1094 1094
 		 * @param WP_User $user   User object.
1095 1095
 		 * @param array   $fields An array of user fields.
1096 1096
 		 */
1097
-		return apply_filters( 'xmlrpc_prepare_user', $_user, $user, $fields );
1097
+		return apply_filters('xmlrpc_prepare_user', $_user, $user, $fields);
1098 1098
 	}
1099 1099
 
1100 1100
 	/**
@@ -1144,40 +1144,40 @@  discard block
 block discarded – undo
1144 1144
 	 * }
1145 1145
 	 * @return int|IXR_Error Post ID on success, IXR_Error instance otherwise.
1146 1146
 	 */
1147
-	public function wp_newPost( $args ) {
1148
-		if ( ! $this->minimum_args( $args, 4 ) )
1147
+	public function wp_newPost($args) {
1148
+		if ( ! $this->minimum_args($args, 4))
1149 1149
 			return $this->error;
1150 1150
 
1151
-		$this->escape( $args );
1151
+		$this->escape($args);
1152 1152
 
1153 1153
 		$username       = $args[1];
1154 1154
 		$password       = $args[2];
1155 1155
 		$content_struct = $args[3];
1156 1156
 
1157
-		if ( ! $user = $this->login( $username, $password ) )
1157
+		if ( ! $user = $this->login($username, $password))
1158 1158
 			return $this->error;
1159 1159
 
1160 1160
 		// convert the date field back to IXR form
1161
-		if ( isset( $content_struct['post_date'] ) && ! ( $content_struct['post_date'] instanceof IXR_Date ) ) {
1162
-			$content_struct['post_date'] = $this->_convert_date( $content_struct['post_date'] );
1161
+		if (isset($content_struct['post_date']) && ! ($content_struct['post_date'] instanceof IXR_Date)) {
1162
+			$content_struct['post_date'] = $this->_convert_date($content_struct['post_date']);
1163 1163
 		}
1164 1164
 
1165 1165
 		// ignore the existing GMT date if it is empty or a non-GMT date was supplied in $content_struct,
1166 1166
 		// since _insert_post will ignore the non-GMT date if the GMT date is set
1167
-		if ( isset( $content_struct['post_date_gmt'] ) && ! ( $content_struct['post_date_gmt'] instanceof IXR_Date ) ) {
1168
-			if ( $content_struct['post_date_gmt'] == '0000-00-00 00:00:00' || isset( $content_struct['post_date'] ) ) {
1169
-				unset( $content_struct['post_date_gmt'] );
1167
+		if (isset($content_struct['post_date_gmt']) && ! ($content_struct['post_date_gmt'] instanceof IXR_Date)) {
1168
+			if ($content_struct['post_date_gmt'] == '0000-00-00 00:00:00' || isset($content_struct['post_date'])) {
1169
+				unset($content_struct['post_date_gmt']);
1170 1170
 			} else {
1171
-				$content_struct['post_date_gmt'] = $this->_convert_date( $content_struct['post_date_gmt'] );
1171
+				$content_struct['post_date_gmt'] = $this->_convert_date($content_struct['post_date_gmt']);
1172 1172
 			}
1173 1173
 		}
1174 1174
 
1175 1175
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
1176
-		do_action( 'xmlrpc_call', 'wp.newPost' );
1176
+		do_action('xmlrpc_call', 'wp.newPost');
1177 1177
 
1178
-		unset( $content_struct['ID'] );
1178
+		unset($content_struct['ID']);
1179 1179
 
1180
-		return $this->_insert_post( $user, $content_struct );
1180
+		return $this->_insert_post($user, $content_struct);
1181 1181
 	}
1182 1182
 
1183 1183
 	/**
@@ -1187,7 +1187,7 @@  discard block
 block discarded – undo
1187 1187
 	 *
1188 1188
 	 * @param int $count Number to compare to one.
1189 1189
 	 */
1190
-	private function _is_greater_than_one( $count ) {
1190
+	private function _is_greater_than_one($count) {
1191 1191
 		return $count > 1;
1192 1192
 	}
1193 1193
 
@@ -1202,29 +1202,29 @@  discard block
 block discarded – undo
1202 1202
 	 * @param bool  $update
1203 1203
 	 * @return void|IXR_Error
1204 1204
 	 */
1205
-	private function _toggle_sticky( $post_data, $update = false ) {
1206
-		$post_type = get_post_type_object( $post_data['post_type'] );
1205
+	private function _toggle_sticky($post_data, $update = false) {
1206
+		$post_type = get_post_type_object($post_data['post_type']);
1207 1207
 
1208 1208
 		// Private and password-protected posts cannot be stickied.
1209
-		if ( 'private' === $post_data['post_status'] || ! empty( $post_data['post_password'] ) ) {
1209
+		if ('private' === $post_data['post_status'] || ! empty($post_data['post_password'])) {
1210 1210
 			// Error if the client tried to stick the post, otherwise, silently unstick.
1211
-			if ( ! empty( $post_data['sticky'] ) ) {
1212
-				return new IXR_Error( 401, __( 'Sorry, you cannot stick a private post.' ) );
1211
+			if ( ! empty($post_data['sticky'])) {
1212
+				return new IXR_Error(401, __('Sorry, you cannot stick a private post.'));
1213 1213
 			}
1214 1214
 
1215
-			if ( $update ) {
1216
-				unstick_post( $post_data['ID'] );
1215
+			if ($update) {
1216
+				unstick_post($post_data['ID']);
1217 1217
 			}
1218
-		} elseif ( isset( $post_data['sticky'] ) )  {
1219
-			if ( ! current_user_can( $post_type->cap->edit_others_posts ) ) {
1220
-				return new IXR_Error( 401, __( 'Sorry, you are not allowed to stick this post.' ) );
1218
+		} elseif (isset($post_data['sticky'])) {
1219
+			if ( ! current_user_can($post_type->cap->edit_others_posts)) {
1220
+				return new IXR_Error(401, __('Sorry, you are not allowed to stick this post.'));
1221 1221
 			}
1222 1222
 
1223
-			$sticky = wp_validate_boolean( $post_data['sticky'] );
1224
-			if ( $sticky ) {
1225
-				stick_post( $post_data['ID'] );
1223
+			$sticky = wp_validate_boolean($post_data['sticky']);
1224
+			if ($sticky) {
1225
+				stick_post($post_data['ID']);
1226 1226
 			} else {
1227
-				unstick_post( $post_data['ID'] );
1227
+				unstick_post($post_data['ID']);
1228 1228
 			}
1229 1229
 		}
1230 1230
 	}
@@ -1241,133 +1241,133 @@  discard block
 block discarded – undo
1241 1241
 	 * @param array|IXR_Error $content_struct Post data to insert.
1242 1242
 	 * @return IXR_Error|string
1243 1243
 	 */
1244
-	protected function _insert_post( $user, $content_struct ) {
1245
-		$defaults = array( 'post_status' => 'draft', 'post_type' => 'post', 'post_author' => 0,
1246
-			'post_password' => '', 'post_excerpt' => '', 'post_content' => '', 'post_title' => '' );
1244
+	protected function _insert_post($user, $content_struct) {
1245
+		$defaults = array('post_status' => 'draft', 'post_type' => 'post', 'post_author' => 0,
1246
+			'post_password' => '', 'post_excerpt' => '', 'post_content' => '', 'post_title' => '');
1247 1247
 
1248
-		$post_data = wp_parse_args( $content_struct, $defaults );
1248
+		$post_data = wp_parse_args($content_struct, $defaults);
1249 1249
 
1250
-		$post_type = get_post_type_object( $post_data['post_type'] );
1251
-		if ( ! $post_type )
1252
-			return new IXR_Error( 403, __( 'Invalid post type' ) );
1250
+		$post_type = get_post_type_object($post_data['post_type']);
1251
+		if ( ! $post_type)
1252
+			return new IXR_Error(403, __('Invalid post type'));
1253 1253
 
1254
-		$update = ! empty( $post_data['ID'] );
1254
+		$update = ! empty($post_data['ID']);
1255 1255
 
1256
-		if ( $update ) {
1257
-			if ( ! get_post( $post_data['ID'] ) )
1258
-				return new IXR_Error( 401, __( 'Invalid post ID.' ) );
1259
-			if ( ! current_user_can( 'edit_post', $post_data['ID'] ) )
1260
-				return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post.' ) );
1261
-			if ( $post_data['post_type'] != get_post_type( $post_data['ID'] ) )
1262
-				return new IXR_Error( 401, __( 'The post type may not be changed.' ) );
1256
+		if ($update) {
1257
+			if ( ! get_post($post_data['ID']))
1258
+				return new IXR_Error(401, __('Invalid post ID.'));
1259
+			if ( ! current_user_can('edit_post', $post_data['ID']))
1260
+				return new IXR_Error(401, __('Sorry, you are not allowed to edit this post.'));
1261
+			if ($post_data['post_type'] != get_post_type($post_data['ID']))
1262
+				return new IXR_Error(401, __('The post type may not be changed.'));
1263 1263
 		} else {
1264
-			if ( ! current_user_can( $post_type->cap->create_posts ) || ! current_user_can( $post_type->cap->edit_posts ) )
1265
-				return new IXR_Error( 401, __( 'Sorry, you are not allowed to post on this site.' ) );
1264
+			if ( ! current_user_can($post_type->cap->create_posts) || ! current_user_can($post_type->cap->edit_posts))
1265
+				return new IXR_Error(401, __('Sorry, you are not allowed to post on this site.'));
1266 1266
 		}
1267 1267
 
1268
-		switch ( $post_data['post_status'] ) {
1268
+		switch ($post_data['post_status']) {
1269 1269
 			case 'draft':
1270 1270
 			case 'pending':
1271 1271
 				break;
1272 1272
 			case 'private':
1273
-				if ( ! current_user_can( $post_type->cap->publish_posts ) )
1274
-					return new IXR_Error( 401, __( 'Sorry, you are not allowed to create private posts in this post type' ) );
1273
+				if ( ! current_user_can($post_type->cap->publish_posts))
1274
+					return new IXR_Error(401, __('Sorry, you are not allowed to create private posts in this post type'));
1275 1275
 				break;
1276 1276
 			case 'publish':
1277 1277
 			case 'future':
1278
-				if ( ! current_user_can( $post_type->cap->publish_posts ) )
1279
-					return new IXR_Error( 401, __( 'Sorry, you are not allowed to publish posts in this post type' ) );
1278
+				if ( ! current_user_can($post_type->cap->publish_posts))
1279
+					return new IXR_Error(401, __('Sorry, you are not allowed to publish posts in this post type'));
1280 1280
 				break;
1281 1281
 			default:
1282
-				if ( ! get_post_status_object( $post_data['post_status'] ) )
1282
+				if ( ! get_post_status_object($post_data['post_status']))
1283 1283
 					$post_data['post_status'] = 'draft';
1284 1284
 			break;
1285 1285
 		}
1286 1286
 
1287
-		if ( ! empty( $post_data['post_password'] ) && ! current_user_can( $post_type->cap->publish_posts ) )
1288
-			return new IXR_Error( 401, __( 'Sorry, you are not allowed to create password protected posts in this post type' ) );
1287
+		if ( ! empty($post_data['post_password']) && ! current_user_can($post_type->cap->publish_posts))
1288
+			return new IXR_Error(401, __('Sorry, you are not allowed to create password protected posts in this post type'));
1289 1289
 
1290
-		$post_data['post_author'] = absint( $post_data['post_author'] );
1291
-		if ( ! empty( $post_data['post_author'] ) && $post_data['post_author'] != $user->ID ) {
1292
-			if ( ! current_user_can( $post_type->cap->edit_others_posts ) )
1293
-				return new IXR_Error( 401, __( 'You are not allowed to create posts as this user.' ) );
1290
+		$post_data['post_author'] = absint($post_data['post_author']);
1291
+		if ( ! empty($post_data['post_author']) && $post_data['post_author'] != $user->ID) {
1292
+			if ( ! current_user_can($post_type->cap->edit_others_posts))
1293
+				return new IXR_Error(401, __('You are not allowed to create posts as this user.'));
1294 1294
 
1295
-			$author = get_userdata( $post_data['post_author'] );
1295
+			$author = get_userdata($post_data['post_author']);
1296 1296
 
1297
-			if ( ! $author )
1298
-				return new IXR_Error( 404, __( 'Invalid author ID.' ) );
1297
+			if ( ! $author)
1298
+				return new IXR_Error(404, __('Invalid author ID.'));
1299 1299
 		} else {
1300 1300
 			$post_data['post_author'] = $user->ID;
1301 1301
 		}
1302 1302
 
1303
-		if ( isset( $post_data['comment_status'] ) && $post_data['comment_status'] != 'open' && $post_data['comment_status'] != 'closed' )
1304
-			unset( $post_data['comment_status'] );
1303
+		if (isset($post_data['comment_status']) && $post_data['comment_status'] != 'open' && $post_data['comment_status'] != 'closed')
1304
+			unset($post_data['comment_status']);
1305 1305
 
1306
-		if ( isset( $post_data['ping_status'] ) && $post_data['ping_status'] != 'open' && $post_data['ping_status'] != 'closed' )
1307
-			unset( $post_data['ping_status'] );
1306
+		if (isset($post_data['ping_status']) && $post_data['ping_status'] != 'open' && $post_data['ping_status'] != 'closed')
1307
+			unset($post_data['ping_status']);
1308 1308
 
1309 1309
 		// Do some timestamp voodoo.
1310
-		if ( ! empty( $post_data['post_date_gmt'] ) ) {
1310
+		if ( ! empty($post_data['post_date_gmt'])) {
1311 1311
 			// We know this is supposed to be GMT, so we're going to slap that Z on there by force.
1312
-			$dateCreated = rtrim( $post_data['post_date_gmt']->getIso(), 'Z' ) . 'Z';
1313
-		} elseif ( ! empty( $post_data['post_date'] ) ) {
1312
+			$dateCreated = rtrim($post_data['post_date_gmt']->getIso(), 'Z').'Z';
1313
+		} elseif ( ! empty($post_data['post_date'])) {
1314 1314
 			$dateCreated = $post_data['post_date']->getIso();
1315 1315
 		}
1316 1316
 
1317
-		if ( ! empty( $dateCreated ) ) {
1318
-			$post_data['post_date'] = get_date_from_gmt( iso8601_to_datetime( $dateCreated ) );
1319
-			$post_data['post_date_gmt'] = iso8601_to_datetime( $dateCreated, 'GMT' );
1317
+		if ( ! empty($dateCreated)) {
1318
+			$post_data['post_date'] = get_date_from_gmt(iso8601_to_datetime($dateCreated));
1319
+			$post_data['post_date_gmt'] = iso8601_to_datetime($dateCreated, 'GMT');
1320 1320
 		}
1321 1321
 
1322
-		if ( ! isset( $post_data['ID'] ) )
1323
-			$post_data['ID'] = get_default_post_to_edit( $post_data['post_type'], true )->ID;
1322
+		if ( ! isset($post_data['ID']))
1323
+			$post_data['ID'] = get_default_post_to_edit($post_data['post_type'], true)->ID;
1324 1324
 		$post_ID = $post_data['ID'];
1325 1325
 
1326
-		if ( $post_data['post_type'] == 'post' ) {
1327
-			$error = $this->_toggle_sticky( $post_data, $update );
1328
-			if ( $error ) {
1326
+		if ($post_data['post_type'] == 'post') {
1327
+			$error = $this->_toggle_sticky($post_data, $update);
1328
+			if ($error) {
1329 1329
 				return $error;
1330 1330
 			}
1331 1331
 		}
1332 1332
 
1333
-		if ( isset( $post_data['post_thumbnail'] ) ) {
1333
+		if (isset($post_data['post_thumbnail'])) {
1334 1334
 			// empty value deletes, non-empty value adds/updates.
1335
-			if ( ! $post_data['post_thumbnail'] )
1336
-				delete_post_thumbnail( $post_ID );
1337
-			elseif ( ! get_post( absint( $post_data['post_thumbnail'] ) ) )
1338
-				return new IXR_Error( 404, __( 'Invalid attachment ID.' ) );
1339
-			set_post_thumbnail( $post_ID, $post_data['post_thumbnail'] );
1340
-			unset( $content_struct['post_thumbnail'] );
1335
+			if ( ! $post_data['post_thumbnail'])
1336
+				delete_post_thumbnail($post_ID);
1337
+			elseif ( ! get_post(absint($post_data['post_thumbnail'])))
1338
+				return new IXR_Error(404, __('Invalid attachment ID.'));
1339
+			set_post_thumbnail($post_ID, $post_data['post_thumbnail']);
1340
+			unset($content_struct['post_thumbnail']);
1341 1341
 		}
1342 1342
 
1343
-		if ( isset( $post_data['custom_fields'] ) )
1344
-			$this->set_custom_fields( $post_ID, $post_data['custom_fields'] );
1343
+		if (isset($post_data['custom_fields']))
1344
+			$this->set_custom_fields($post_ID, $post_data['custom_fields']);
1345 1345
 
1346
-		if ( isset( $post_data['terms'] ) || isset( $post_data['terms_names'] ) ) {
1347
-			$post_type_taxonomies = get_object_taxonomies( $post_data['post_type'], 'objects' );
1346
+		if (isset($post_data['terms']) || isset($post_data['terms_names'])) {
1347
+			$post_type_taxonomies = get_object_taxonomies($post_data['post_type'], 'objects');
1348 1348
 
1349 1349
 			// Accumulate term IDs from terms and terms_names.
1350 1350
 			$terms = array();
1351 1351
 
1352 1352
 			// First validate the terms specified by ID.
1353
-			if ( isset( $post_data['terms'] ) && is_array( $post_data['terms'] ) ) {
1354
-				$taxonomies = array_keys( $post_data['terms'] );
1353
+			if (isset($post_data['terms']) && is_array($post_data['terms'])) {
1354
+				$taxonomies = array_keys($post_data['terms']);
1355 1355
 
1356 1356
 				// Validating term ids.
1357
-				foreach ( $taxonomies as $taxonomy ) {
1358
-					if ( ! array_key_exists( $taxonomy , $post_type_taxonomies ) )
1359
-						return new IXR_Error( 401, __( 'Sorry, one of the given taxonomies is not supported by the post type.' ) );
1357
+				foreach ($taxonomies as $taxonomy) {
1358
+					if ( ! array_key_exists($taxonomy, $post_type_taxonomies))
1359
+						return new IXR_Error(401, __('Sorry, one of the given taxonomies is not supported by the post type.'));
1360 1360
 
1361
-					if ( ! current_user_can( $post_type_taxonomies[$taxonomy]->cap->assign_terms ) )
1362
-						return new IXR_Error( 401, __( 'Sorry, you are not allowed to assign a term to one of the given taxonomies.' ) );
1361
+					if ( ! current_user_can($post_type_taxonomies[$taxonomy]->cap->assign_terms))
1362
+						return new IXR_Error(401, __('Sorry, you are not allowed to assign a term to one of the given taxonomies.'));
1363 1363
 
1364 1364
 					$term_ids = $post_data['terms'][$taxonomy];
1365
-					$terms[ $taxonomy ] = array();
1366
-					foreach ( $term_ids as $term_id ) {
1367
-						$term = get_term_by( 'id', $term_id, $taxonomy );
1365
+					$terms[$taxonomy] = array();
1366
+					foreach ($term_ids as $term_id) {
1367
+						$term = get_term_by('id', $term_id, $taxonomy);
1368 1368
 
1369
-						if ( ! $term )
1370
-							return new IXR_Error( 403, __( 'Invalid term ID' ) );
1369
+						if ( ! $term)
1370
+							return new IXR_Error(403, __('Invalid term ID'));
1371 1371
 
1372 1372
 						$terms[$taxonomy][] = (int) $term_id;
1373 1373
 					}
@@ -1375,49 +1375,49 @@  discard block
 block discarded – undo
1375 1375
 			}
1376 1376
 
1377 1377
 			// Now validate terms specified by name.
1378
-			if ( isset( $post_data['terms_names'] ) && is_array( $post_data['terms_names'] ) ) {
1379
-				$taxonomies = array_keys( $post_data['terms_names'] );
1378
+			if (isset($post_data['terms_names']) && is_array($post_data['terms_names'])) {
1379
+				$taxonomies = array_keys($post_data['terms_names']);
1380 1380
 
1381
-				foreach ( $taxonomies as $taxonomy ) {
1382
-					if ( ! array_key_exists( $taxonomy , $post_type_taxonomies ) )
1383
-						return new IXR_Error( 401, __( 'Sorry, one of the given taxonomies is not supported by the post type.' ) );
1381
+				foreach ($taxonomies as $taxonomy) {
1382
+					if ( ! array_key_exists($taxonomy, $post_type_taxonomies))
1383
+						return new IXR_Error(401, __('Sorry, one of the given taxonomies is not supported by the post type.'));
1384 1384
 
1385
-					if ( ! current_user_can( $post_type_taxonomies[$taxonomy]->cap->assign_terms ) )
1386
-						return new IXR_Error( 401, __( 'Sorry, you are not allowed to assign a term to one of the given taxonomies.' ) );
1385
+					if ( ! current_user_can($post_type_taxonomies[$taxonomy]->cap->assign_terms))
1386
+						return new IXR_Error(401, __('Sorry, you are not allowed to assign a term to one of the given taxonomies.'));
1387 1387
 
1388 1388
 					/*
1389 1389
 					 * For hierarchical taxonomies, we can't assign a term when multiple terms
1390 1390
 					 * in the hierarchy share the same name.
1391 1391
 					 */
1392 1392
 					$ambiguous_terms = array();
1393
-					if ( is_taxonomy_hierarchical( $taxonomy ) ) {
1394
-						$tax_term_names = get_terms( $taxonomy, array( 'fields' => 'names', 'hide_empty' => false ) );
1393
+					if (is_taxonomy_hierarchical($taxonomy)) {
1394
+						$tax_term_names = get_terms($taxonomy, array('fields' => 'names', 'hide_empty' => false));
1395 1395
 
1396 1396
 						// Count the number of terms with the same name.
1397
-						$tax_term_names_count = array_count_values( $tax_term_names );
1397
+						$tax_term_names_count = array_count_values($tax_term_names);
1398 1398
 
1399 1399
 						// Filter out non-ambiguous term names.
1400
-						$ambiguous_tax_term_counts = array_filter( $tax_term_names_count, array( $this, '_is_greater_than_one') );
1400
+						$ambiguous_tax_term_counts = array_filter($tax_term_names_count, array($this, '_is_greater_than_one'));
1401 1401
 
1402
-						$ambiguous_terms = array_keys( $ambiguous_tax_term_counts );
1402
+						$ambiguous_terms = array_keys($ambiguous_tax_term_counts);
1403 1403
 					}
1404 1404
 
1405 1405
 					$term_names = $post_data['terms_names'][$taxonomy];
1406
-					foreach ( $term_names as $term_name ) {
1407
-						if ( in_array( $term_name, $ambiguous_terms ) )
1408
-							return new IXR_Error( 401, __( 'Ambiguous term name used in a hierarchical taxonomy. Please use term ID instead.' ) );
1406
+					foreach ($term_names as $term_name) {
1407
+						if (in_array($term_name, $ambiguous_terms))
1408
+							return new IXR_Error(401, __('Ambiguous term name used in a hierarchical taxonomy. Please use term ID instead.'));
1409 1409
 
1410
-						$term = get_term_by( 'name', $term_name, $taxonomy );
1410
+						$term = get_term_by('name', $term_name, $taxonomy);
1411 1411
 
1412
-						if ( ! $term ) {
1412
+						if ( ! $term) {
1413 1413
 							// Term doesn't exist, so check that the user is allowed to create new terms.
1414
-							if ( ! current_user_can( $post_type_taxonomies[$taxonomy]->cap->edit_terms ) )
1415
-								return new IXR_Error( 401, __( 'Sorry, you are not allowed to add a term to one of the given taxonomies.' ) );
1414
+							if ( ! current_user_can($post_type_taxonomies[$taxonomy]->cap->edit_terms))
1415
+								return new IXR_Error(401, __('Sorry, you are not allowed to add a term to one of the given taxonomies.'));
1416 1416
 
1417 1417
 							// Create the new term.
1418
-							$term_info = wp_insert_term( $term_name, $taxonomy );
1419
-							if ( is_wp_error( $term_info ) )
1420
-								return new IXR_Error( 500, $term_info->get_error_message() );
1418
+							$term_info = wp_insert_term($term_name, $taxonomy);
1419
+							if (is_wp_error($term_info))
1420
+								return new IXR_Error(500, $term_info->get_error_message());
1421 1421
 
1422 1422
 							$terms[$taxonomy][] = (int) $term_info['term_id'];
1423 1423
 						} else {
@@ -1428,26 +1428,26 @@  discard block
 block discarded – undo
1428 1428
 			}
1429 1429
 
1430 1430
 			$post_data['tax_input'] = $terms;
1431
-			unset( $post_data['terms'], $post_data['terms_names'] );
1431
+			unset($post_data['terms'], $post_data['terms_names']);
1432 1432
 		} else {
1433 1433
 			// Do not allow direct submission of 'tax_input', clients must use 'terms' and/or 'terms_names'.
1434
-			unset( $post_data['tax_input'], $post_data['post_category'], $post_data['tags_input'] );
1434
+			unset($post_data['tax_input'], $post_data['post_category'], $post_data['tags_input']);
1435 1435
 		}
1436 1436
 
1437
-		if ( isset( $post_data['post_format'] ) ) {
1438
-			$format = set_post_format( $post_ID, $post_data['post_format'] );
1437
+		if (isset($post_data['post_format'])) {
1438
+			$format = set_post_format($post_ID, $post_data['post_format']);
1439 1439
 
1440
-			if ( is_wp_error( $format ) )
1441
-				return new IXR_Error( 500, $format->get_error_message() );
1440
+			if (is_wp_error($format))
1441
+				return new IXR_Error(500, $format->get_error_message());
1442 1442
 
1443
-			unset( $post_data['post_format'] );
1443
+			unset($post_data['post_format']);
1444 1444
 		}
1445 1445
 
1446 1446
 		// Handle enclosures.
1447
-		$enclosure = isset( $post_data['enclosure'] ) ? $post_data['enclosure'] : null;
1448
-		$this->add_enclosure_if_new( $post_ID, $enclosure );
1447
+		$enclosure = isset($post_data['enclosure']) ? $post_data['enclosure'] : null;
1448
+		$this->add_enclosure_if_new($post_ID, $enclosure);
1449 1449
 
1450
-		$this->attach_uploads( $post_ID, $post_data['post_content'] );
1450
+		$this->attach_uploads($post_ID, $post_data['post_content']);
1451 1451
 
1452 1452
 		/**
1453 1453
 		 * Filter post data array to be inserted via XML-RPC.
@@ -1457,16 +1457,16 @@  discard block
 block discarded – undo
1457 1457
 		 * @param array $post_data      Parsed array of post data.
1458 1458
 		 * @param array $content_struct Post data array.
1459 1459
 		 */
1460
-		$post_data = apply_filters( 'xmlrpc_wp_insert_post_data', $post_data, $content_struct );
1460
+		$post_data = apply_filters('xmlrpc_wp_insert_post_data', $post_data, $content_struct);
1461 1461
 
1462
-		$post_ID = $update ? wp_update_post( $post_data, true ) : wp_insert_post( $post_data, true );
1463
-		if ( is_wp_error( $post_ID ) )
1464
-			return new IXR_Error( 500, $post_ID->get_error_message() );
1462
+		$post_ID = $update ? wp_update_post($post_data, true) : wp_insert_post($post_data, true);
1463
+		if (is_wp_error($post_ID))
1464
+			return new IXR_Error(500, $post_ID->get_error_message());
1465 1465
 
1466
-		if ( ! $post_ID )
1467
-			return new IXR_Error( 401, __( 'Sorry, your entry could not be posted. Something wrong happened.' ) );
1466
+		if ( ! $post_ID)
1467
+			return new IXR_Error(401, __('Sorry, your entry could not be posted. Something wrong happened.'));
1468 1468
 
1469
-		return strval( $post_ID );
1469
+		return strval($post_ID);
1470 1470
 	}
1471 1471
 
1472 1472
 	/**
@@ -1488,52 +1488,52 @@  discard block
 block discarded – undo
1488 1488
 	 * }
1489 1489
 	 * @return true|IXR_Error True on success, IXR_Error on failure.
1490 1490
 	 */
1491
-	public function wp_editPost( $args ) {
1492
-		if ( ! $this->minimum_args( $args, 5 ) )
1491
+	public function wp_editPost($args) {
1492
+		if ( ! $this->minimum_args($args, 5))
1493 1493
 			return $this->error;
1494 1494
 
1495
-		$this->escape( $args );
1495
+		$this->escape($args);
1496 1496
 
1497 1497
 		$username       = $args[1];
1498 1498
 		$password       = $args[2];
1499 1499
 		$post_id        = (int) $args[3];
1500 1500
 		$content_struct = $args[4];
1501 1501
 
1502
-		if ( ! $user = $this->login( $username, $password ) )
1502
+		if ( ! $user = $this->login($username, $password))
1503 1503
 			return $this->error;
1504 1504
 
1505 1505
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
1506
-		do_action( 'xmlrpc_call', 'wp.editPost' );
1506
+		do_action('xmlrpc_call', 'wp.editPost');
1507 1507
 
1508
-		$post = get_post( $post_id, ARRAY_A );
1508
+		$post = get_post($post_id, ARRAY_A);
1509 1509
 
1510
-		if ( empty( $post['ID'] ) )
1511
-			return new IXR_Error( 404, __( 'Invalid post ID.' ) );
1510
+		if (empty($post['ID']))
1511
+			return new IXR_Error(404, __('Invalid post ID.'));
1512 1512
 
1513
-		if ( isset( $content_struct['if_not_modified_since'] ) ) {
1513
+		if (isset($content_struct['if_not_modified_since'])) {
1514 1514
 			// If the post has been modified since the date provided, return an error.
1515
-			if ( mysql2date( 'U', $post['post_modified_gmt'] ) > $content_struct['if_not_modified_since']->getTimestamp() ) {
1516
-				return new IXR_Error( 409, __( 'There is a revision of this post that is more recent.' ) );
1515
+			if (mysql2date('U', $post['post_modified_gmt']) > $content_struct['if_not_modified_since']->getTimestamp()) {
1516
+				return new IXR_Error(409, __('There is a revision of this post that is more recent.'));
1517 1517
 			}
1518 1518
 		}
1519 1519
 
1520 1520
 		// Convert the date field back to IXR form.
1521
-		$post['post_date'] = $this->_convert_date( $post['post_date'] );
1521
+		$post['post_date'] = $this->_convert_date($post['post_date']);
1522 1522
 
1523 1523
 		/*
1524 1524
 		 * Ignore the existing GMT date if it is empty or a non-GMT date was supplied in $content_struct,
1525 1525
 		 * since _insert_post() will ignore the non-GMT date if the GMT date is set.
1526 1526
 		 */
1527
-		if ( $post['post_date_gmt'] == '0000-00-00 00:00:00' || isset( $content_struct['post_date'] ) )
1528
-			unset( $post['post_date_gmt'] );
1527
+		if ($post['post_date_gmt'] == '0000-00-00 00:00:00' || isset($content_struct['post_date']))
1528
+			unset($post['post_date_gmt']);
1529 1529
 		else
1530
-			$post['post_date_gmt'] = $this->_convert_date( $post['post_date_gmt'] );
1530
+			$post['post_date_gmt'] = $this->_convert_date($post['post_date_gmt']);
1531 1531
 
1532
-		$this->escape( $post );
1533
-		$merged_content_struct = array_merge( $post, $content_struct );
1532
+		$this->escape($post);
1533
+		$merged_content_struct = array_merge($post, $content_struct);
1534 1534
 
1535
-		$retval = $this->_insert_post( $user, $merged_content_struct );
1536
-		if ( $retval instanceof IXR_Error )
1535
+		$retval = $this->_insert_post($user, $merged_content_struct);
1536
+		if ($retval instanceof IXR_Error)
1537 1537
 			return $retval;
1538 1538
 
1539 1539
 		return true;
@@ -1556,33 +1556,33 @@  discard block
 block discarded – undo
1556 1556
 	 * }
1557 1557
 	 * @return true|IXR_Error True on success, IXR_Error instance on failure.
1558 1558
 	 */
1559
-	public function wp_deletePost( $args ) {
1560
-		if ( ! $this->minimum_args( $args, 4 ) )
1559
+	public function wp_deletePost($args) {
1560
+		if ( ! $this->minimum_args($args, 4))
1561 1561
 			return $this->error;
1562 1562
 
1563
-		$this->escape( $args );
1563
+		$this->escape($args);
1564 1564
 
1565 1565
 		$username   = $args[1];
1566 1566
 		$password   = $args[2];
1567 1567
 		$post_id    = (int) $args[3];
1568 1568
 
1569
-		if ( ! $user = $this->login( $username, $password ) )
1569
+		if ( ! $user = $this->login($username, $password))
1570 1570
 			return $this->error;
1571 1571
 
1572 1572
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
1573
-		do_action( 'xmlrpc_call', 'wp.deletePost' );
1573
+		do_action('xmlrpc_call', 'wp.deletePost');
1574 1574
 
1575
-		$post = get_post( $post_id, ARRAY_A );
1576
-		if ( empty( $post['ID'] ) )
1577
-			return new IXR_Error( 404, __( 'Invalid post ID.' ) );
1575
+		$post = get_post($post_id, ARRAY_A);
1576
+		if (empty($post['ID']))
1577
+			return new IXR_Error(404, __('Invalid post ID.'));
1578 1578
 
1579
-		if ( ! current_user_can( 'delete_post', $post_id ) )
1580
-			return new IXR_Error( 401, __( 'Sorry, you are not allowed to delete this post.' ) );
1579
+		if ( ! current_user_can('delete_post', $post_id))
1580
+			return new IXR_Error(401, __('Sorry, you are not allowed to delete this post.'));
1581 1581
 
1582
-		$result = wp_delete_post( $post_id );
1582
+		$result = wp_delete_post($post_id);
1583 1583
 
1584
-		if ( ! $result )
1585
-			return new IXR_Error( 500, __( 'The post cannot be deleted.' ) );
1584
+		if ( ! $result)
1585
+			return new IXR_Error(500, __('The post cannot be deleted.'));
1586 1586
 
1587 1587
 		return true;
1588 1588
 	}
@@ -1636,17 +1636,17 @@  discard block
 block discarded – undo
1636 1636
 	 *  - 'tags'
1637 1637
 	 *  - 'enclosure'
1638 1638
 	 */
1639
-	public function wp_getPost( $args ) {
1640
-		if ( ! $this->minimum_args( $args, 4 ) )
1639
+	public function wp_getPost($args) {
1640
+		if ( ! $this->minimum_args($args, 4))
1641 1641
 			return $this->error;
1642 1642
 
1643
-		$this->escape( $args );
1643
+		$this->escape($args);
1644 1644
 
1645 1645
 		$username = $args[1];
1646 1646
 		$password = $args[2];
1647 1647
 		$post_id  = (int) $args[3];
1648 1648
 
1649
-		if ( isset( $args[4] ) ) {
1649
+		if (isset($args[4])) {
1650 1650
 			$fields = $args[4];
1651 1651
 		} else {
1652 1652
 			/**
@@ -1657,24 +1657,24 @@  discard block
 block discarded – undo
1657 1657
 			 * @param array  $fields Array of post fields. Default array contains 'post', 'terms', and 'custom_fields'.
1658 1658
 			 * @param string $method Method name.
1659 1659
 			 */
1660
-			$fields = apply_filters( 'xmlrpc_default_post_fields', array( 'post', 'terms', 'custom_fields' ), 'wp.getPost' );
1660
+			$fields = apply_filters('xmlrpc_default_post_fields', array('post', 'terms', 'custom_fields'), 'wp.getPost');
1661 1661
 		}
1662 1662
 
1663
-		if ( ! $user = $this->login( $username, $password ) )
1663
+		if ( ! $user = $this->login($username, $password))
1664 1664
 			return $this->error;
1665 1665
 
1666 1666
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
1667
-		do_action( 'xmlrpc_call', 'wp.getPost' );
1667
+		do_action('xmlrpc_call', 'wp.getPost');
1668 1668
 
1669
-		$post = get_post( $post_id, ARRAY_A );
1669
+		$post = get_post($post_id, ARRAY_A);
1670 1670
 
1671
-		if ( empty( $post['ID'] ) )
1672
-			return new IXR_Error( 404, __( 'Invalid post ID.' ) );
1671
+		if (empty($post['ID']))
1672
+			return new IXR_Error(404, __('Invalid post ID.'));
1673 1673
 
1674
-		if ( ! current_user_can( 'edit_post', $post_id ) )
1675
-			return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) );
1674
+		if ( ! current_user_can('edit_post', $post_id))
1675
+			return new IXR_Error(401, __('Sorry, you cannot edit this post.'));
1676 1676
 
1677
-		return $this->_prepare_post( $post, $fields );
1677
+		return $this->_prepare_post($post, $fields);
1678 1678
 	}
1679 1679
 
1680 1680
 	/**
@@ -1699,77 +1699,77 @@  discard block
 block discarded – undo
1699 1699
 	 * }
1700 1700
 	 * @return array|IXR_Error Array contains a collection of posts.
1701 1701
 	 */
1702
-	public function wp_getPosts( $args ) {
1703
-		if ( ! $this->minimum_args( $args, 3 ) )
1702
+	public function wp_getPosts($args) {
1703
+		if ( ! $this->minimum_args($args, 3))
1704 1704
 			return $this->error;
1705 1705
 
1706
-		$this->escape( $args );
1706
+		$this->escape($args);
1707 1707
 
1708 1708
 		$username = $args[1];
1709 1709
 		$password = $args[2];
1710
-		$filter   = isset( $args[3] ) ? $args[3] : array();
1710
+		$filter   = isset($args[3]) ? $args[3] : array();
1711 1711
 
1712
-		if ( isset( $args[4] ) ) {
1712
+		if (isset($args[4])) {
1713 1713
 			$fields = $args[4];
1714 1714
 		} else {
1715 1715
 			/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
1716
-			$fields = apply_filters( 'xmlrpc_default_post_fields', array( 'post', 'terms', 'custom_fields' ), 'wp.getPosts' );
1716
+			$fields = apply_filters('xmlrpc_default_post_fields', array('post', 'terms', 'custom_fields'), 'wp.getPosts');
1717 1717
 		}
1718 1718
 
1719
-		if ( ! $user = $this->login( $username, $password ) )
1719
+		if ( ! $user = $this->login($username, $password))
1720 1720
 			return $this->error;
1721 1721
 
1722 1722
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
1723
-		do_action( 'xmlrpc_call', 'wp.getPosts' );
1723
+		do_action('xmlrpc_call', 'wp.getPosts');
1724 1724
 
1725 1725
 		$query = array();
1726 1726
 
1727
-		if ( isset( $filter['post_type'] ) ) {
1728
-			$post_type = get_post_type_object( $filter['post_type'] );
1729
-			if ( ! ( (bool) $post_type ) )
1730
-				return new IXR_Error( 403, __( 'The post type specified is not valid' ) );
1727
+		if (isset($filter['post_type'])) {
1728
+			$post_type = get_post_type_object($filter['post_type']);
1729
+			if ( ! ((bool) $post_type))
1730
+				return new IXR_Error(403, __('The post type specified is not valid'));
1731 1731
 		} else {
1732
-			$post_type = get_post_type_object( 'post' );
1732
+			$post_type = get_post_type_object('post');
1733 1733
 		}
1734 1734
 
1735
-		if ( ! current_user_can( $post_type->cap->edit_posts ) )
1736
-			return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit posts in this post type' ));
1735
+		if ( ! current_user_can($post_type->cap->edit_posts))
1736
+			return new IXR_Error(401, __('Sorry, you are not allowed to edit posts in this post type'));
1737 1737
 
1738 1738
 		$query['post_type'] = $post_type->name;
1739 1739
 
1740
-		if ( isset( $filter['post_status'] ) )
1740
+		if (isset($filter['post_status']))
1741 1741
 			$query['post_status'] = $filter['post_status'];
1742 1742
 
1743
-		if ( isset( $filter['number'] ) )
1744
-			$query['numberposts'] = absint( $filter['number'] );
1743
+		if (isset($filter['number']))
1744
+			$query['numberposts'] = absint($filter['number']);
1745 1745
 
1746
-		if ( isset( $filter['offset'] ) )
1747
-			$query['offset'] = absint( $filter['offset'] );
1746
+		if (isset($filter['offset']))
1747
+			$query['offset'] = absint($filter['offset']);
1748 1748
 
1749
-		if ( isset( $filter['orderby'] ) ) {
1749
+		if (isset($filter['orderby'])) {
1750 1750
 			$query['orderby'] = $filter['orderby'];
1751 1751
 
1752
-			if ( isset( $filter['order'] ) )
1752
+			if (isset($filter['order']))
1753 1753
 				$query['order'] = $filter['order'];
1754 1754
 		}
1755 1755
 
1756
-		if ( isset( $filter['s'] ) ) {
1756
+		if (isset($filter['s'])) {
1757 1757
 			$query['s'] = $filter['s'];
1758 1758
 		}
1759 1759
 
1760
-		$posts_list = wp_get_recent_posts( $query );
1760
+		$posts_list = wp_get_recent_posts($query);
1761 1761
 
1762
-		if ( ! $posts_list )
1762
+		if ( ! $posts_list)
1763 1763
 			return array();
1764 1764
 
1765 1765
 		// Holds all the posts data.
1766 1766
 		$struct = array();
1767 1767
 
1768
-		foreach ( $posts_list as $post ) {
1769
-			if ( ! current_user_can( 'edit_post', $post['ID'] ) )
1768
+		foreach ($posts_list as $post) {
1769
+			if ( ! current_user_can('edit_post', $post['ID']))
1770 1770
 				continue;
1771 1771
 
1772
-			$struct[] = $this->_prepare_post( $post, $fields );
1772
+			$struct[] = $this->_prepare_post($post, $fields);
1773 1773
 		}
1774 1774
 
1775 1775
 		return $struct;
@@ -1794,70 +1794,70 @@  discard block
 block discarded – undo
1794 1794
 	 * }
1795 1795
 	 * @return int|IXR_Error The term ID on success, or an IXR_Error object on failure.
1796 1796
 	 */
1797
-	public function wp_newTerm( $args ) {
1798
-		if ( ! $this->minimum_args( $args, 4 ) )
1797
+	public function wp_newTerm($args) {
1798
+		if ( ! $this->minimum_args($args, 4))
1799 1799
 			return $this->error;
1800 1800
 
1801
-		$this->escape( $args );
1801
+		$this->escape($args);
1802 1802
 
1803 1803
 		$username       = $args[1];
1804 1804
 		$password       = $args[2];
1805 1805
 		$content_struct = $args[3];
1806 1806
 
1807
-		if ( ! $user = $this->login( $username, $password ) )
1807
+		if ( ! $user = $this->login($username, $password))
1808 1808
 			return $this->error;
1809 1809
 
1810 1810
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
1811
-		do_action( 'xmlrpc_call', 'wp.newTerm' );
1811
+		do_action('xmlrpc_call', 'wp.newTerm');
1812 1812
 
1813
-		if ( ! taxonomy_exists( $content_struct['taxonomy'] ) )
1814
-			return new IXR_Error( 403, __( 'Invalid taxonomy' ) );
1813
+		if ( ! taxonomy_exists($content_struct['taxonomy']))
1814
+			return new IXR_Error(403, __('Invalid taxonomy'));
1815 1815
 
1816
-		$taxonomy = get_taxonomy( $content_struct['taxonomy'] );
1816
+		$taxonomy = get_taxonomy($content_struct['taxonomy']);
1817 1817
 
1818
-		if ( ! current_user_can( $taxonomy->cap->manage_terms ) )
1819
-			return new IXR_Error( 401, __( 'You are not allowed to create terms in this taxonomy.' ) );
1818
+		if ( ! current_user_can($taxonomy->cap->manage_terms))
1819
+			return new IXR_Error(401, __('You are not allowed to create terms in this taxonomy.'));
1820 1820
 
1821 1821
 		$taxonomy = (array) $taxonomy;
1822 1822
 
1823 1823
 		// hold the data of the term
1824 1824
 		$term_data = array();
1825 1825
 
1826
-		$term_data['name'] = trim( $content_struct['name'] );
1827
-		if ( empty( $term_data['name'] ) )
1828
-			return new IXR_Error( 403, __( 'The term name cannot be empty.' ) );
1826
+		$term_data['name'] = trim($content_struct['name']);
1827
+		if (empty($term_data['name']))
1828
+			return new IXR_Error(403, __('The term name cannot be empty.'));
1829 1829
 
1830
-		if ( isset( $content_struct['parent'] ) ) {
1831
-			if ( ! $taxonomy['hierarchical'] )
1832
-				return new IXR_Error( 403, __( 'This taxonomy is not hierarchical.' ) );
1830
+		if (isset($content_struct['parent'])) {
1831
+			if ( ! $taxonomy['hierarchical'])
1832
+				return new IXR_Error(403, __('This taxonomy is not hierarchical.'));
1833 1833
 
1834 1834
 			$parent_term_id = (int) $content_struct['parent'];
1835
-			$parent_term = get_term( $parent_term_id , $taxonomy['name'] );
1835
+			$parent_term = get_term($parent_term_id, $taxonomy['name']);
1836 1836
 
1837
-			if ( is_wp_error( $parent_term ) )
1838
-				return new IXR_Error( 500, $parent_term->get_error_message() );
1837
+			if (is_wp_error($parent_term))
1838
+				return new IXR_Error(500, $parent_term->get_error_message());
1839 1839
 
1840
-			if ( ! $parent_term )
1841
-				return new IXR_Error( 403, __( 'Parent term does not exist.' ) );
1840
+			if ( ! $parent_term)
1841
+				return new IXR_Error(403, __('Parent term does not exist.'));
1842 1842
 
1843 1843
 			$term_data['parent'] = $content_struct['parent'];
1844 1844
 		}
1845 1845
 
1846
-		if ( isset( $content_struct['description'] ) )
1846
+		if (isset($content_struct['description']))
1847 1847
 			$term_data['description'] = $content_struct['description'];
1848 1848
 
1849
-		if ( isset( $content_struct['slug'] ) )
1849
+		if (isset($content_struct['slug']))
1850 1850
 			$term_data['slug'] = $content_struct['slug'];
1851 1851
 
1852
-		$term = wp_insert_term( $term_data['name'] , $taxonomy['name'] , $term_data );
1852
+		$term = wp_insert_term($term_data['name'], $taxonomy['name'], $term_data);
1853 1853
 
1854
-		if ( is_wp_error( $term ) )
1855
-			return new IXR_Error( 500, $term->get_error_message() );
1854
+		if (is_wp_error($term))
1855
+			return new IXR_Error(500, $term->get_error_message());
1856 1856
 
1857
-		if ( ! $term )
1858
-			return new IXR_Error( 500, __( 'Sorry, your term could not be created. Something wrong happened.' ) );
1857
+		if ( ! $term)
1858
+			return new IXR_Error(500, __('Sorry, your term could not be created. Something wrong happened.'));
1859 1859
 
1860
-		return strval( $term['term_id'] );
1860
+		return strval($term['term_id']);
1861 1861
 	}
1862 1862
 
1863 1863
 	/**
@@ -1880,80 +1880,80 @@  discard block
 block discarded – undo
1880 1880
 	 * }
1881 1881
 	 * @return true|IXR_Error True on success, IXR_Error instance on failure.
1882 1882
 	 */
1883
-	public function wp_editTerm( $args ) {
1884
-		if ( ! $this->minimum_args( $args, 5 ) )
1883
+	public function wp_editTerm($args) {
1884
+		if ( ! $this->minimum_args($args, 5))
1885 1885
 			return $this->error;
1886 1886
 
1887
-		$this->escape( $args );
1887
+		$this->escape($args);
1888 1888
 
1889 1889
 		$username       = $args[1];
1890 1890
 		$password       = $args[2];
1891 1891
 		$term_id        = (int) $args[3];
1892 1892
 		$content_struct = $args[4];
1893 1893
 
1894
-		if ( ! $user = $this->login( $username, $password ) )
1894
+		if ( ! $user = $this->login($username, $password))
1895 1895
 			return $this->error;
1896 1896
 
1897 1897
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
1898
-		do_action( 'xmlrpc_call', 'wp.editTerm' );
1898
+		do_action('xmlrpc_call', 'wp.editTerm');
1899 1899
 
1900
-		if ( ! taxonomy_exists( $content_struct['taxonomy'] ) )
1901
-			return new IXR_Error( 403, __( 'Invalid taxonomy' ) );
1900
+		if ( ! taxonomy_exists($content_struct['taxonomy']))
1901
+			return new IXR_Error(403, __('Invalid taxonomy'));
1902 1902
 
1903
-		$taxonomy = get_taxonomy( $content_struct['taxonomy'] );
1903
+		$taxonomy = get_taxonomy($content_struct['taxonomy']);
1904 1904
 
1905
-		if ( ! current_user_can( $taxonomy->cap->edit_terms ) )
1906
-			return new IXR_Error( 401, __( 'You are not allowed to edit terms in this taxonomy.' ) );
1905
+		if ( ! current_user_can($taxonomy->cap->edit_terms))
1906
+			return new IXR_Error(401, __('You are not allowed to edit terms in this taxonomy.'));
1907 1907
 
1908 1908
 		$taxonomy = (array) $taxonomy;
1909 1909
 
1910 1910
 		// hold the data of the term
1911 1911
 		$term_data = array();
1912 1912
 
1913
-		$term = get_term( $term_id , $content_struct['taxonomy'] );
1913
+		$term = get_term($term_id, $content_struct['taxonomy']);
1914 1914
 
1915
-		if ( is_wp_error( $term ) )
1916
-			return new IXR_Error( 500, $term->get_error_message() );
1915
+		if (is_wp_error($term))
1916
+			return new IXR_Error(500, $term->get_error_message());
1917 1917
 
1918
-		if ( ! $term )
1919
-			return new IXR_Error( 404, __( 'Invalid term ID' ) );
1918
+		if ( ! $term)
1919
+			return new IXR_Error(404, __('Invalid term ID'));
1920 1920
 
1921
-		if ( isset( $content_struct['name'] ) ) {
1922
-			$term_data['name'] = trim( $content_struct['name'] );
1921
+		if (isset($content_struct['name'])) {
1922
+			$term_data['name'] = trim($content_struct['name']);
1923 1923
 
1924
-			if ( empty( $term_data['name'] ) )
1925
-				return new IXR_Error( 403, __( 'The term name cannot be empty.' ) );
1924
+			if (empty($term_data['name']))
1925
+				return new IXR_Error(403, __('The term name cannot be empty.'));
1926 1926
 		}
1927 1927
 
1928
-		if ( isset( $content_struct['parent'] ) ) {
1929
-			if ( ! $taxonomy['hierarchical'] )
1930
-				return new IXR_Error( 403, __( "This taxonomy is not hierarchical so you can't set a parent." ) );
1928
+		if (isset($content_struct['parent'])) {
1929
+			if ( ! $taxonomy['hierarchical'])
1930
+				return new IXR_Error(403, __("This taxonomy is not hierarchical so you can't set a parent."));
1931 1931
 
1932 1932
 			$parent_term_id = (int) $content_struct['parent'];
1933
-			$parent_term = get_term( $parent_term_id , $taxonomy['name'] );
1933
+			$parent_term = get_term($parent_term_id, $taxonomy['name']);
1934 1934
 
1935
-			if ( is_wp_error( $parent_term ) )
1936
-				return new IXR_Error( 500, $parent_term->get_error_message() );
1935
+			if (is_wp_error($parent_term))
1936
+				return new IXR_Error(500, $parent_term->get_error_message());
1937 1937
 
1938
-			if ( ! $parent_term )
1939
-				return new IXR_Error( 403, __( 'Parent term does not exist.' ) );
1938
+			if ( ! $parent_term)
1939
+				return new IXR_Error(403, __('Parent term does not exist.'));
1940 1940
 
1941 1941
 			$term_data['parent'] = $content_struct['parent'];
1942 1942
 		}
1943 1943
 
1944
-		if ( isset( $content_struct['description'] ) )
1944
+		if (isset($content_struct['description']))
1945 1945
 			$term_data['description'] = $content_struct['description'];
1946 1946
 
1947
-		if ( isset( $content_struct['slug'] ) )
1947
+		if (isset($content_struct['slug']))
1948 1948
 			$term_data['slug'] = $content_struct['slug'];
1949 1949
 
1950
-		$term = wp_update_term( $term_id , $taxonomy['name'] , $term_data );
1950
+		$term = wp_update_term($term_id, $taxonomy['name'], $term_data);
1951 1951
 
1952
-		if ( is_wp_error( $term ) )
1953
-			return new IXR_Error( 500, $term->get_error_message() );
1952
+		if (is_wp_error($term))
1953
+			return new IXR_Error(500, $term->get_error_message());
1954 1954
 
1955
-		if ( ! $term )
1956
-			return new IXR_Error( 500, __( 'Sorry, editing the term failed.' ) );
1955
+		if ( ! $term)
1956
+			return new IXR_Error(500, __('Sorry, editing the term failed.'));
1957 1957
 
1958 1958
 		return true;
1959 1959
 	}
@@ -1976,46 +1976,46 @@  discard block
 block discarded – undo
1976 1976
 	 * }
1977 1977
 	 * @return bool|IXR_Error True on success, IXR_Error instance on failure.
1978 1978
 	 */
1979
-	public function wp_deleteTerm( $args ) {
1980
-		if ( ! $this->minimum_args( $args, 5 ) )
1979
+	public function wp_deleteTerm($args) {
1980
+		if ( ! $this->minimum_args($args, 5))
1981 1981
 			return $this->error;
1982 1982
 
1983
-		$this->escape( $args );
1983
+		$this->escape($args);
1984 1984
 
1985 1985
 		$username           = $args[1];
1986 1986
 		$password           = $args[2];
1987 1987
 		$taxonomy           = $args[3];
1988 1988
 		$term_id            = (int) $args[4];
1989 1989
 
1990
-		if ( ! $user = $this->login( $username, $password ) )
1990
+		if ( ! $user = $this->login($username, $password))
1991 1991
 			return $this->error;
1992 1992
 
1993 1993
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
1994
-		do_action( 'xmlrpc_call', 'wp.deleteTerm' );
1994
+		do_action('xmlrpc_call', 'wp.deleteTerm');
1995 1995
 
1996
-		if ( ! taxonomy_exists( $taxonomy ) )
1997
-			return new IXR_Error( 403, __( 'Invalid taxonomy' ) );
1996
+		if ( ! taxonomy_exists($taxonomy))
1997
+			return new IXR_Error(403, __('Invalid taxonomy'));
1998 1998
 
1999
-		$taxonomy = get_taxonomy( $taxonomy );
1999
+		$taxonomy = get_taxonomy($taxonomy);
2000 2000
 
2001
-		if ( ! current_user_can( $taxonomy->cap->delete_terms ) )
2002
-			return new IXR_Error( 401, __( 'You are not allowed to delete terms in this taxonomy.' ) );
2001
+		if ( ! current_user_can($taxonomy->cap->delete_terms))
2002
+			return new IXR_Error(401, __('You are not allowed to delete terms in this taxonomy.'));
2003 2003
 
2004
-		$term = get_term( $term_id, $taxonomy->name );
2004
+		$term = get_term($term_id, $taxonomy->name);
2005 2005
 
2006
-		if ( is_wp_error( $term ) )
2007
-			return new IXR_Error( 500, $term->get_error_message() );
2006
+		if (is_wp_error($term))
2007
+			return new IXR_Error(500, $term->get_error_message());
2008 2008
 
2009
-		if ( ! $term )
2010
-			return new IXR_Error( 404, __( 'Invalid term ID' ) );
2009
+		if ( ! $term)
2010
+			return new IXR_Error(404, __('Invalid term ID'));
2011 2011
 
2012
-		$result = wp_delete_term( $term_id, $taxonomy->name );
2012
+		$result = wp_delete_term($term_id, $taxonomy->name);
2013 2013
 
2014
-		if ( is_wp_error( $result ) )
2015
-			return new IXR_Error( 500, $term->get_error_message() );
2014
+		if (is_wp_error($result))
2015
+			return new IXR_Error(500, $term->get_error_message());
2016 2016
 
2017
-		if ( ! $result )
2018
-			return new IXR_Error( 500, __( 'Sorry, deleting the term failed.' ) );
2017
+		if ( ! $result)
2018
+			return new IXR_Error(500, __('Sorry, deleting the term failed.'));
2019 2019
 
2020 2020
 		return $result;
2021 2021
 	}
@@ -2047,40 +2047,40 @@  discard block
 block discarded – undo
2047 2047
 	 *  - 'parent'
2048 2048
 	 *  - 'count'
2049 2049
 	 */
2050
-	public function wp_getTerm( $args ) {
2051
-		if ( ! $this->minimum_args( $args, 5 ) )
2050
+	public function wp_getTerm($args) {
2051
+		if ( ! $this->minimum_args($args, 5))
2052 2052
 			return $this->error;
2053 2053
 
2054
-		$this->escape( $args );
2054
+		$this->escape($args);
2055 2055
 
2056 2056
 		$username           = $args[1];
2057 2057
 		$password           = $args[2];
2058 2058
 		$taxonomy           = $args[3];
2059 2059
 		$term_id            = (int) $args[4];
2060 2060
 
2061
-		if ( ! $user = $this->login( $username, $password ) )
2061
+		if ( ! $user = $this->login($username, $password))
2062 2062
 			return $this->error;
2063 2063
 
2064 2064
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
2065
-		do_action( 'xmlrpc_call', 'wp.getTerm' );
2065
+		do_action('xmlrpc_call', 'wp.getTerm');
2066 2066
 
2067
-		if ( ! taxonomy_exists( $taxonomy ) )
2068
-			return new IXR_Error( 403, __( 'Invalid taxonomy' ) );
2067
+		if ( ! taxonomy_exists($taxonomy))
2068
+			return new IXR_Error(403, __('Invalid taxonomy'));
2069 2069
 
2070
-		$taxonomy = get_taxonomy( $taxonomy );
2070
+		$taxonomy = get_taxonomy($taxonomy);
2071 2071
 
2072
-		if ( ! current_user_can( $taxonomy->cap->assign_terms ) )
2073
-			return new IXR_Error( 401, __( 'You are not allowed to assign terms in this taxonomy.' ) );
2072
+		if ( ! current_user_can($taxonomy->cap->assign_terms))
2073
+			return new IXR_Error(401, __('You are not allowed to assign terms in this taxonomy.'));
2074 2074
 
2075
-		$term = get_term( $term_id , $taxonomy->name, ARRAY_A );
2075
+		$term = get_term($term_id, $taxonomy->name, ARRAY_A);
2076 2076
 
2077
-		if ( is_wp_error( $term ) )
2078
-			return new IXR_Error( 500, $term->get_error_message() );
2077
+		if (is_wp_error($term))
2078
+			return new IXR_Error(500, $term->get_error_message());
2079 2079
 
2080
-		if ( ! $term )
2081
-			return new IXR_Error( 404, __( 'Invalid term ID' ) );
2080
+		if ( ! $term)
2081
+			return new IXR_Error(404, __('Invalid term ID'));
2082 2082
 
2083
-		return $this->_prepare_term( $term );
2083
+		return $this->_prepare_term($term);
2084 2084
 	}
2085 2085
 
2086 2086
 	/**
@@ -2105,63 +2105,63 @@  discard block
 block discarded – undo
2105 2105
 	 * }
2106 2106
 	 * @return array|IXR_Error An associative array of terms data on success, IXR_Error instance otherwise.
2107 2107
 	 */
2108
-	public function wp_getTerms( $args ) {
2109
-		if ( ! $this->minimum_args( $args, 4 ) )
2108
+	public function wp_getTerms($args) {
2109
+		if ( ! $this->minimum_args($args, 4))
2110 2110
 			return $this->error;
2111 2111
 
2112
-		$this->escape( $args );
2112
+		$this->escape($args);
2113 2113
 
2114 2114
 		$username       = $args[1];
2115 2115
 		$password       = $args[2];
2116 2116
 		$taxonomy       = $args[3];
2117
-		$filter         = isset( $args[4] ) ? $args[4] : array();
2117
+		$filter         = isset($args[4]) ? $args[4] : array();
2118 2118
 
2119
-		if ( ! $user = $this->login( $username, $password ) )
2119
+		if ( ! $user = $this->login($username, $password))
2120 2120
 			return $this->error;
2121 2121
 
2122 2122
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
2123
-		do_action( 'xmlrpc_call', 'wp.getTerms' );
2123
+		do_action('xmlrpc_call', 'wp.getTerms');
2124 2124
 
2125
-		if ( ! taxonomy_exists( $taxonomy ) )
2126
-			return new IXR_Error( 403, __( 'Invalid taxonomy' ) );
2125
+		if ( ! taxonomy_exists($taxonomy))
2126
+			return new IXR_Error(403, __('Invalid taxonomy'));
2127 2127
 
2128
-		$taxonomy = get_taxonomy( $taxonomy );
2128
+		$taxonomy = get_taxonomy($taxonomy);
2129 2129
 
2130
-		if ( ! current_user_can( $taxonomy->cap->assign_terms ) )
2131
-			return new IXR_Error( 401, __( 'You are not allowed to assign terms in this taxonomy.' ) );
2130
+		if ( ! current_user_can($taxonomy->cap->assign_terms))
2131
+			return new IXR_Error(401, __('You are not allowed to assign terms in this taxonomy.'));
2132 2132
 
2133 2133
 		$query = array();
2134 2134
 
2135
-		if ( isset( $filter['number'] ) )
2136
-			$query['number'] = absint( $filter['number'] );
2135
+		if (isset($filter['number']))
2136
+			$query['number'] = absint($filter['number']);
2137 2137
 
2138
-		if ( isset( $filter['offset'] ) )
2139
-			$query['offset'] = absint( $filter['offset'] );
2138
+		if (isset($filter['offset']))
2139
+			$query['offset'] = absint($filter['offset']);
2140 2140
 
2141
-		if ( isset( $filter['orderby'] ) ) {
2141
+		if (isset($filter['orderby'])) {
2142 2142
 			$query['orderby'] = $filter['orderby'];
2143 2143
 
2144
-			if ( isset( $filter['order'] ) )
2144
+			if (isset($filter['order']))
2145 2145
 				$query['order'] = $filter['order'];
2146 2146
 		}
2147 2147
 
2148
-		if ( isset( $filter['hide_empty'] ) )
2148
+		if (isset($filter['hide_empty']))
2149 2149
 			$query['hide_empty'] = $filter['hide_empty'];
2150 2150
 		else
2151 2151
 			$query['get'] = 'all';
2152 2152
 
2153
-		if ( isset( $filter['search'] ) )
2153
+		if (isset($filter['search']))
2154 2154
 			$query['search'] = $filter['search'];
2155 2155
 
2156
-		$terms = get_terms( $taxonomy->name, $query );
2156
+		$terms = get_terms($taxonomy->name, $query);
2157 2157
 
2158
-		if ( is_wp_error( $terms ) )
2159
-			return new IXR_Error( 500, $terms->get_error_message() );
2158
+		if (is_wp_error($terms))
2159
+			return new IXR_Error(500, $terms->get_error_message());
2160 2160
 
2161 2161
 		$struct = array();
2162 2162
 
2163
-		foreach ( $terms as $term ) {
2164
-			$struct[] = $this->_prepare_term( $term );
2163
+		foreach ($terms as $term) {
2164
+			$struct[] = $this->_prepare_term($term);
2165 2165
 		}
2166 2166
 
2167 2167
 		return $struct;
@@ -2187,17 +2187,17 @@  discard block
 block discarded – undo
2187 2187
 	 * }
2188 2188
 	 * @return array|IXR_Error An array of taxonomy data on success, IXR_Error instance otherwise.
2189 2189
 	 */
2190
-	public function wp_getTaxonomy( $args ) {
2191
-		if ( ! $this->minimum_args( $args, 4 ) )
2190
+	public function wp_getTaxonomy($args) {
2191
+		if ( ! $this->minimum_args($args, 4))
2192 2192
 			return $this->error;
2193 2193
 
2194
-		$this->escape( $args );
2194
+		$this->escape($args);
2195 2195
 
2196 2196
 		$username = $args[1];
2197 2197
 		$password = $args[2];
2198 2198
 		$taxonomy = $args[3];
2199 2199
 
2200
-		if ( isset( $args[4] ) ) {
2200
+		if (isset($args[4])) {
2201 2201
 			$fields = $args[4];
2202 2202
 		} else {
2203 2203
 			/**
@@ -2208,24 +2208,24 @@  discard block
 block discarded – undo
2208 2208
 			 * @param array  $fields An array of taxonomy fields to retrieve.
2209 2209
 			 * @param string $method The method name.
2210 2210
 			 */
2211
-			$fields = apply_filters( 'xmlrpc_default_taxonomy_fields', array( 'labels', 'cap', 'object_type' ), 'wp.getTaxonomy' );
2211
+			$fields = apply_filters('xmlrpc_default_taxonomy_fields', array('labels', 'cap', 'object_type'), 'wp.getTaxonomy');
2212 2212
 		}
2213 2213
 
2214
-		if ( ! $user = $this->login( $username, $password ) )
2214
+		if ( ! $user = $this->login($username, $password))
2215 2215
 			return $this->error;
2216 2216
 
2217 2217
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
2218
-		do_action( 'xmlrpc_call', 'wp.getTaxonomy' );
2218
+		do_action('xmlrpc_call', 'wp.getTaxonomy');
2219 2219
 
2220
-		if ( ! taxonomy_exists( $taxonomy ) )
2221
-			return new IXR_Error( 403, __( 'Invalid taxonomy' ) );
2220
+		if ( ! taxonomy_exists($taxonomy))
2221
+			return new IXR_Error(403, __('Invalid taxonomy'));
2222 2222
 
2223
-		$taxonomy = get_taxonomy( $taxonomy );
2223
+		$taxonomy = get_taxonomy($taxonomy);
2224 2224
 
2225
-		if ( ! current_user_can( $taxonomy->cap->assign_terms ) )
2226
-			return new IXR_Error( 401, __( 'You are not allowed to assign terms in this taxonomy.' ) );
2225
+		if ( ! current_user_can($taxonomy->cap->assign_terms))
2226
+			return new IXR_Error(401, __('You are not allowed to assign terms in this taxonomy.'));
2227 2227
 
2228
-		return $this->_prepare_taxonomy( $taxonomy, $fields );
2228
+		return $this->_prepare_taxonomy($taxonomy, $fields);
2229 2229
 	}
2230 2230
 
2231 2231
 	/**
@@ -2247,40 +2247,40 @@  discard block
 block discarded – undo
2247 2247
 	 * @return array|IXR_Error An associative array of taxonomy data with returned fields determined
2248 2248
 	 *                         by `$fields`, or an IXR_Error instance on failure.
2249 2249
 	 */
2250
-	public function wp_getTaxonomies( $args ) {
2251
-		if ( ! $this->minimum_args( $args, 3 ) )
2250
+	public function wp_getTaxonomies($args) {
2251
+		if ( ! $this->minimum_args($args, 3))
2252 2252
 			return $this->error;
2253 2253
 
2254
-		$this->escape( $args );
2254
+		$this->escape($args);
2255 2255
 
2256 2256
 		$username = $args[1];
2257 2257
 		$password = $args[2];
2258
-		$filter   = isset( $args[3] ) ? $args[3] : array( 'public' => true );
2258
+		$filter   = isset($args[3]) ? $args[3] : array('public' => true);
2259 2259
 
2260
-		if ( isset( $args[4] ) ) {
2260
+		if (isset($args[4])) {
2261 2261
 			$fields = $args[4];
2262 2262
 		} else {
2263 2263
 			/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
2264
-			$fields = apply_filters( 'xmlrpc_default_taxonomy_fields', array( 'labels', 'cap', 'object_type' ), 'wp.getTaxonomies' );
2264
+			$fields = apply_filters('xmlrpc_default_taxonomy_fields', array('labels', 'cap', 'object_type'), 'wp.getTaxonomies');
2265 2265
 		}
2266 2266
 
2267
-		if ( ! $user = $this->login( $username, $password ) )
2267
+		if ( ! $user = $this->login($username, $password))
2268 2268
 			return $this->error;
2269 2269
 
2270 2270
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
2271
-		do_action( 'xmlrpc_call', 'wp.getTaxonomies' );
2271
+		do_action('xmlrpc_call', 'wp.getTaxonomies');
2272 2272
 
2273
-		$taxonomies = get_taxonomies( $filter, 'objects' );
2273
+		$taxonomies = get_taxonomies($filter, 'objects');
2274 2274
 
2275 2275
 		// holds all the taxonomy data
2276 2276
 		$struct = array();
2277 2277
 
2278
-		foreach ( $taxonomies as $taxonomy ) {
2278
+		foreach ($taxonomies as $taxonomy) {
2279 2279
 			// capability check for post_types
2280
-			if ( ! current_user_can( $taxonomy->cap->assign_terms ) )
2280
+			if ( ! current_user_can($taxonomy->cap->assign_terms))
2281 2281
 				continue;
2282 2282
 
2283
-			$struct[] = $this->_prepare_taxonomy( $taxonomy, $fields );
2283
+			$struct[] = $this->_prepare_taxonomy($taxonomy, $fields);
2284 2284
 		}
2285 2285
 
2286 2286
 		return $struct;
@@ -2322,17 +2322,17 @@  discard block
 block discarded – undo
2322 2322
 	 *  - 'display_name'
2323 2323
 	 *  - 'roles'
2324 2324
 	 */
2325
-	public function wp_getUser( $args ) {
2326
-		if ( ! $this->minimum_args( $args, 4 ) )
2325
+	public function wp_getUser($args) {
2326
+		if ( ! $this->minimum_args($args, 4))
2327 2327
 			return $this->error;
2328 2328
 
2329
-		$this->escape( $args );
2329
+		$this->escape($args);
2330 2330
 
2331 2331
 		$username = $args[1];
2332 2332
 		$password = $args[2];
2333 2333
 		$user_id  = (int) $args[3];
2334 2334
 
2335
-		if ( isset( $args[4] ) ) {
2335
+		if (isset($args[4])) {
2336 2336
 			$fields = $args[4];
2337 2337
 		} else {
2338 2338
 			/**
@@ -2343,24 +2343,24 @@  discard block
 block discarded – undo
2343 2343
 			 * @param array  $fields User query fields for given method. Default 'all'.
2344 2344
 			 * @param string $method The method name.
2345 2345
 			 */
2346
-			$fields = apply_filters( 'xmlrpc_default_user_fields', array( 'all' ), 'wp.getUser' );
2346
+			$fields = apply_filters('xmlrpc_default_user_fields', array('all'), 'wp.getUser');
2347 2347
 		}
2348 2348
 
2349
-		if ( ! $user = $this->login( $username, $password ) )
2349
+		if ( ! $user = $this->login($username, $password))
2350 2350
 			return $this->error;
2351 2351
 
2352 2352
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
2353
-		do_action( 'xmlrpc_call', 'wp.getUser' );
2353
+		do_action('xmlrpc_call', 'wp.getUser');
2354 2354
 
2355
-		if ( ! current_user_can( 'edit_user', $user_id ) )
2356
-			return new IXR_Error( 401, __( 'Sorry, you cannot edit users.' ) );
2355
+		if ( ! current_user_can('edit_user', $user_id))
2356
+			return new IXR_Error(401, __('Sorry, you cannot edit users.'));
2357 2357
 
2358
-		$user_data = get_userdata( $user_id );
2358
+		$user_data = get_userdata($user_id);
2359 2359
 
2360
-		if ( ! $user_data )
2361
-			return new IXR_Error( 404, __( 'Invalid user ID.' ) );
2360
+		if ( ! $user_data)
2361
+			return new IXR_Error(404, __('Invalid user ID.'));
2362 2362
 
2363
-		return $this->_prepare_user( $user_data, $fields );
2363
+		return $this->_prepare_user($user_data, $fields);
2364 2364
 	}
2365 2365
 
2366 2366
 	/**
@@ -2387,61 +2387,61 @@  discard block
 block discarded – undo
2387 2387
 	 * }
2388 2388
 	 * @return array|IXR_Error users data
2389 2389
 	 */
2390
-	public function wp_getUsers( $args ) {
2391
-		if ( ! $this->minimum_args( $args, 3 ) )
2390
+	public function wp_getUsers($args) {
2391
+		if ( ! $this->minimum_args($args, 3))
2392 2392
 			return $this->error;
2393 2393
 
2394
-		$this->escape( $args );
2394
+		$this->escape($args);
2395 2395
 
2396 2396
 		$username = $args[1];
2397 2397
 		$password = $args[2];
2398
-		$filter   = isset( $args[3] ) ? $args[3] : array();
2398
+		$filter   = isset($args[3]) ? $args[3] : array();
2399 2399
 
2400
-		if ( isset( $args[4] ) ) {
2400
+		if (isset($args[4])) {
2401 2401
 			$fields = $args[4];
2402 2402
 		} else {
2403 2403
 			/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
2404
-			$fields = apply_filters( 'xmlrpc_default_user_fields', array( 'all' ), 'wp.getUsers' );
2404
+			$fields = apply_filters('xmlrpc_default_user_fields', array('all'), 'wp.getUsers');
2405 2405
 		}
2406 2406
 
2407
-		if ( ! $user = $this->login( $username, $password ) )
2407
+		if ( ! $user = $this->login($username, $password))
2408 2408
 			return $this->error;
2409 2409
 
2410 2410
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
2411
-		do_action( 'xmlrpc_call', 'wp.getUsers' );
2411
+		do_action('xmlrpc_call', 'wp.getUsers');
2412 2412
 
2413
-		if ( ! current_user_can( 'list_users' ) )
2414
-			return new IXR_Error( 401, __( 'Sorry, you cannot list users.' ) );
2413
+		if ( ! current_user_can('list_users'))
2414
+			return new IXR_Error(401, __('Sorry, you cannot list users.'));
2415 2415
 
2416
-		$query = array( 'fields' => 'all_with_meta' );
2416
+		$query = array('fields' => 'all_with_meta');
2417 2417
 
2418
-		$query['number'] = ( isset( $filter['number'] ) ) ? absint( $filter['number'] ) : 50;
2419
-		$query['offset'] = ( isset( $filter['offset'] ) ) ? absint( $filter['offset'] ) : 0;
2418
+		$query['number'] = (isset($filter['number'])) ? absint($filter['number']) : 50;
2419
+		$query['offset'] = (isset($filter['offset'])) ? absint($filter['offset']) : 0;
2420 2420
 
2421
-		if ( isset( $filter['orderby'] ) ) {
2421
+		if (isset($filter['orderby'])) {
2422 2422
 			$query['orderby'] = $filter['orderby'];
2423 2423
 
2424
-			if ( isset( $filter['order'] ) )
2424
+			if (isset($filter['order']))
2425 2425
 				$query['order'] = $filter['order'];
2426 2426
 		}
2427 2427
 
2428
-		if ( isset( $filter['role'] ) ) {
2429
-			if ( get_role( $filter['role'] ) === null )
2430
-				return new IXR_Error( 403, __( 'The role specified is not valid' ) );
2428
+		if (isset($filter['role'])) {
2429
+			if (get_role($filter['role']) === null)
2430
+				return new IXR_Error(403, __('The role specified is not valid'));
2431 2431
 
2432 2432
 			$query['role'] = $filter['role'];
2433 2433
 		}
2434 2434
 
2435
-		if ( isset( $filter['who'] ) ) {
2435
+		if (isset($filter['who'])) {
2436 2436
 			$query['who'] = $filter['who'];
2437 2437
 		}
2438 2438
 
2439
-		$users = get_users( $query );
2439
+		$users = get_users($query);
2440 2440
 
2441 2441
 		$_users = array();
2442
-		foreach ( $users as $user_data ) {
2443
-			if ( current_user_can( 'edit_user', $user_data->ID ) )
2444
-				$_users[] = $this->_prepare_user( $user_data, $fields );
2442
+		foreach ($users as $user_data) {
2443
+			if (current_user_can('edit_user', $user_data->ID))
2444
+				$_users[] = $this->_prepare_user($user_data, $fields);
2445 2445
 		}
2446 2446
 		return $_users;
2447 2447
 	}
@@ -2461,34 +2461,34 @@  discard block
 block discarded – undo
2461 2461
 	 * }
2462 2462
 	 * @return array|IXR_Error (@see wp_getUser)
2463 2463
 	 */
2464
-	public function wp_getProfile( $args ) {
2465
-		if ( ! $this->minimum_args( $args, 3 ) )
2464
+	public function wp_getProfile($args) {
2465
+		if ( ! $this->minimum_args($args, 3))
2466 2466
 			return $this->error;
2467 2467
 
2468
-		$this->escape( $args );
2468
+		$this->escape($args);
2469 2469
 
2470 2470
 		$username = $args[1];
2471 2471
 		$password = $args[2];
2472 2472
 
2473
-		if ( isset( $args[3] ) ) {
2473
+		if (isset($args[3])) {
2474 2474
 			$fields = $args[3];
2475 2475
 		} else {
2476 2476
 			/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
2477
-			$fields = apply_filters( 'xmlrpc_default_user_fields', array( 'all' ), 'wp.getProfile' );
2477
+			$fields = apply_filters('xmlrpc_default_user_fields', array('all'), 'wp.getProfile');
2478 2478
 		}
2479 2479
 
2480
-		if ( ! $user = $this->login( $username, $password ) )
2480
+		if ( ! $user = $this->login($username, $password))
2481 2481
 			return $this->error;
2482 2482
 
2483 2483
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
2484
-		do_action( 'xmlrpc_call', 'wp.getProfile' );
2484
+		do_action('xmlrpc_call', 'wp.getProfile');
2485 2485
 
2486
-		if ( ! current_user_can( 'edit_user', $user->ID ) )
2487
-			return new IXR_Error( 401, __( 'Sorry, you cannot edit your profile.' ) );
2486
+		if ( ! current_user_can('edit_user', $user->ID))
2487
+			return new IXR_Error(401, __('Sorry, you cannot edit your profile.'));
2488 2488
 
2489
-		$user_data = get_userdata( $user->ID );
2489
+		$user_data = get_userdata($user->ID);
2490 2490
 
2491
-		return $this->_prepare_user( $user_data, $fields );
2491
+		return $this->_prepare_user($user_data, $fields);
2492 2492
 	}
2493 2493
 
2494 2494
 	/**
@@ -2513,58 +2513,58 @@  discard block
 block discarded – undo
2513 2513
 	 * }
2514 2514
 	 * @return true|IXR_Error True, on success.
2515 2515
 	 */
2516
-	public function wp_editProfile( $args ) {
2517
-		if ( ! $this->minimum_args( $args, 4 ) )
2516
+	public function wp_editProfile($args) {
2517
+		if ( ! $this->minimum_args($args, 4))
2518 2518
 			return $this->error;
2519 2519
 
2520
-		$this->escape( $args );
2520
+		$this->escape($args);
2521 2521
 
2522 2522
 		$username       = $args[1];
2523 2523
 		$password       = $args[2];
2524 2524
 		$content_struct = $args[3];
2525 2525
 
2526
-		if ( ! $user = $this->login( $username, $password ) )
2526
+		if ( ! $user = $this->login($username, $password))
2527 2527
 			return $this->error;
2528 2528
 
2529 2529
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
2530
-		do_action( 'xmlrpc_call', 'wp.editProfile' );
2530
+		do_action('xmlrpc_call', 'wp.editProfile');
2531 2531
 
2532
-		if ( ! current_user_can( 'edit_user', $user->ID ) )
2533
-			return new IXR_Error( 401, __( 'Sorry, you cannot edit your profile.' ) );
2532
+		if ( ! current_user_can('edit_user', $user->ID))
2533
+			return new IXR_Error(401, __('Sorry, you cannot edit your profile.'));
2534 2534
 
2535 2535
 		// holds data of the user
2536 2536
 		$user_data = array();
2537 2537
 		$user_data['ID'] = $user->ID;
2538 2538
 
2539 2539
 		// only set the user details if it was given
2540
-		if ( isset( $content_struct['first_name'] ) )
2540
+		if (isset($content_struct['first_name']))
2541 2541
 			$user_data['first_name'] = $content_struct['first_name'];
2542 2542
 
2543
-		if ( isset( $content_struct['last_name'] ) )
2543
+		if (isset($content_struct['last_name']))
2544 2544
 			$user_data['last_name'] = $content_struct['last_name'];
2545 2545
 
2546
-		if ( isset( $content_struct['url'] ) )
2546
+		if (isset($content_struct['url']))
2547 2547
 			$user_data['user_url'] = $content_struct['url'];
2548 2548
 
2549
-		if ( isset( $content_struct['display_name'] ) )
2549
+		if (isset($content_struct['display_name']))
2550 2550
 			$user_data['display_name'] = $content_struct['display_name'];
2551 2551
 
2552
-		if ( isset( $content_struct['nickname'] ) )
2552
+		if (isset($content_struct['nickname']))
2553 2553
 			$user_data['nickname'] = $content_struct['nickname'];
2554 2554
 
2555
-		if ( isset( $content_struct['nicename'] ) )
2555
+		if (isset($content_struct['nicename']))
2556 2556
 			$user_data['user_nicename'] = $content_struct['nicename'];
2557 2557
 
2558
-		if ( isset( $content_struct['bio'] ) )
2558
+		if (isset($content_struct['bio']))
2559 2559
 			$user_data['description'] = $content_struct['bio'];
2560 2560
 
2561
-		$result = wp_update_user( $user_data );
2561
+		$result = wp_update_user($user_data);
2562 2562
 
2563
-		if ( is_wp_error( $result ) )
2564
-			return new IXR_Error( 500, $result->get_error_message() );
2563
+		if (is_wp_error($result))
2564
+			return new IXR_Error(500, $result->get_error_message());
2565 2565
 
2566
-		if ( ! $result )
2567
-			return new IXR_Error( 500, __( 'Sorry, the user cannot be updated.' ) );
2566
+		if ( ! $result)
2567
+			return new IXR_Error(500, __('Sorry, the user cannot be updated.'));
2568 2568
 
2569 2569
 		return true;
2570 2570
 	}
@@ -2584,34 +2584,34 @@  discard block
 block discarded – undo
2584 2584
 	 * }
2585 2585
 	 * @return array|IXR_Error
2586 2586
 	 */
2587
-	public function wp_getPage( $args ) {
2588
-		$this->escape( $args );
2587
+	public function wp_getPage($args) {
2588
+		$this->escape($args);
2589 2589
 
2590 2590
 		$page_id  = (int) $args[1];
2591 2591
 		$username = $args[2];
2592 2592
 		$password = $args[3];
2593 2593
 
2594
-		if ( !$user = $this->login($username, $password) ) {
2594
+		if ( ! $user = $this->login($username, $password)) {
2595 2595
 			return $this->error;
2596 2596
 		}
2597 2597
 
2598 2598
 		$page = get_post($page_id);
2599
-		if ( ! $page )
2600
-			return new IXR_Error( 404, __( 'Invalid post ID.' ) );
2599
+		if ( ! $page)
2600
+			return new IXR_Error(404, __('Invalid post ID.'));
2601 2601
 
2602
-		if ( !current_user_can( 'edit_page', $page_id ) )
2603
-			return new IXR_Error( 401, __( 'Sorry, you cannot edit this page.' ) );
2602
+		if ( ! current_user_can('edit_page', $page_id))
2603
+			return new IXR_Error(401, __('Sorry, you cannot edit this page.'));
2604 2604
 
2605 2605
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
2606
-		do_action( 'xmlrpc_call', 'wp.getPage' );
2606
+		do_action('xmlrpc_call', 'wp.getPage');
2607 2607
 
2608 2608
 		// If we found the page then format the data.
2609
-		if ( $page->ID && ($page->post_type == 'page') ) {
2610
-			return $this->_prepare_page( $page );
2609
+		if ($page->ID && ($page->post_type == 'page')) {
2610
+			return $this->_prepare_page($page);
2611 2611
 		}
2612 2612
 		// If the page doesn't exist indicate that.
2613 2613
 		else {
2614
-			return new IXR_Error( 404, __( 'Sorry, no such page.' ) );
2614
+			return new IXR_Error(404, __('Sorry, no such page.'));
2615 2615
 		}
2616 2616
 	}
2617 2617
 
@@ -2630,32 +2630,32 @@  discard block
 block discarded – undo
2630 2630
 	 * }
2631 2631
 	 * @return array|IXR_Error
2632 2632
 	 */
2633
-	public function wp_getPages( $args ) {
2634
-		$this->escape( $args );
2633
+	public function wp_getPages($args) {
2634
+		$this->escape($args);
2635 2635
 
2636 2636
 		$username  = $args[1];
2637 2637
 		$password  = $args[2];
2638 2638
 		$num_pages = isset($args[3]) ? (int) $args[3] : 10;
2639 2639
 
2640
-		if ( !$user = $this->login($username, $password) )
2640
+		if ( ! $user = $this->login($username, $password))
2641 2641
 			return $this->error;
2642 2642
 
2643
-		if ( !current_user_can( 'edit_pages' ) )
2644
-			return new IXR_Error( 401, __( 'Sorry, you cannot edit pages.' ) );
2643
+		if ( ! current_user_can('edit_pages'))
2644
+			return new IXR_Error(401, __('Sorry, you cannot edit pages.'));
2645 2645
 
2646 2646
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
2647
-		do_action( 'xmlrpc_call', 'wp.getPages' );
2647
+		do_action('xmlrpc_call', 'wp.getPages');
2648 2648
 
2649
-		$pages = get_posts( array('post_type' => 'page', 'post_status' => 'any', 'numberposts' => $num_pages) );
2649
+		$pages = get_posts(array('post_type' => 'page', 'post_status' => 'any', 'numberposts' => $num_pages));
2650 2650
 		$num_pages = count($pages);
2651 2651
 
2652 2652
 		// If we have pages, put together their info.
2653
-		if ( $num_pages >= 1 ) {
2653
+		if ($num_pages >= 1) {
2654 2654
 			$pages_struct = array();
2655 2655
 
2656 2656
 			foreach ($pages as $page) {
2657
-				if ( current_user_can( 'edit_page', $page->ID ) )
2658
-					$pages_struct[] = $this->_prepare_page( $page );
2657
+				if (current_user_can('edit_page', $page->ID))
2658
+					$pages_struct[] = $this->_prepare_page($page);
2659 2659
 			}
2660 2660
 
2661 2661
 			return $pages_struct;
@@ -2681,22 +2681,22 @@  discard block
 block discarded – undo
2681 2681
 	 * }
2682 2682
 	 * @return int|IXR_Error
2683 2683
 	 */
2684
-	public function wp_newPage( $args ) {
2684
+	public function wp_newPage($args) {
2685 2685
 		// Items not escaped here will be escaped in newPost.
2686
-		$username = $this->escape( $args[1] );
2687
-		$password = $this->escape( $args[2] );
2686
+		$username = $this->escape($args[1]);
2687
+		$password = $this->escape($args[2]);
2688 2688
 
2689
-		if ( !$user = $this->login($username, $password) )
2689
+		if ( ! $user = $this->login($username, $password))
2690 2690
 			return $this->error;
2691 2691
 
2692 2692
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
2693
-		do_action( 'xmlrpc_call', 'wp.newPage' );
2693
+		do_action('xmlrpc_call', 'wp.newPage');
2694 2694
 
2695 2695
 		// Mark this as content for a page.
2696 2696
 		$args[3]["post_type"] = 'page';
2697 2697
 
2698 2698
 		// Let mw_newPost do all of the heavy lifting.
2699
-		return $this->mw_newPost( $args );
2699
+		return $this->mw_newPost($args);
2700 2700
 	}
2701 2701
 
2702 2702
 	/**
@@ -2714,33 +2714,33 @@  discard block
 block discarded – undo
2714 2714
 	 * }
2715 2715
 	 * @return true|IXR_Error True, if success.
2716 2716
 	 */
2717
-	public function wp_deletePage( $args ) {
2718
-		$this->escape( $args );
2717
+	public function wp_deletePage($args) {
2718
+		$this->escape($args);
2719 2719
 
2720 2720
 		$username = $args[1];
2721 2721
 		$password = $args[2];
2722 2722
 		$page_id  = (int) $args[3];
2723 2723
 
2724
-		if ( !$user = $this->login($username, $password) )
2724
+		if ( ! $user = $this->login($username, $password))
2725 2725
 			return $this->error;
2726 2726
 
2727 2727
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
2728
-		do_action( 'xmlrpc_call', 'wp.deletePage' );
2728
+		do_action('xmlrpc_call', 'wp.deletePage');
2729 2729
 
2730 2730
 		// Get the current page based on the page_id and
2731 2731
 		// make sure it is a page and not a post.
2732 2732
 		$actual_page = get_post($page_id, ARRAY_A);
2733
-		if ( !$actual_page || ($actual_page['post_type'] != 'page') )
2734
-			return new IXR_Error( 404, __( 'Sorry, no such page.' ) );
2733
+		if ( ! $actual_page || ($actual_page['post_type'] != 'page'))
2734
+			return new IXR_Error(404, __('Sorry, no such page.'));
2735 2735
 
2736 2736
 		// Make sure the user can delete pages.
2737
-		if ( !current_user_can('delete_page', $page_id) )
2738
-			return new IXR_Error( 401, __( 'Sorry, you do not have the right to delete this page.' ) );
2737
+		if ( ! current_user_can('delete_page', $page_id))
2738
+			return new IXR_Error(401, __('Sorry, you do not have the right to delete this page.'));
2739 2739
 
2740 2740
 		// Attempt to delete the page.
2741 2741
 		$result = wp_delete_post($page_id);
2742
-		if ( !$result )
2743
-			return new IXR_Error( 500, __( 'Failed to delete the page.' ) );
2742
+		if ( ! $result)
2743
+			return new IXR_Error(500, __('Failed to delete the page.'));
2744 2744
 
2745 2745
 		/**
2746 2746
 		 * Fires after a page has been successfully deleted via XML-RPC.
@@ -2750,7 +2750,7 @@  discard block
 block discarded – undo
2750 2750
 		 * @param int   $page_id ID of the deleted page.
2751 2751
 		 * @param array $args    An array of arguments to delete the page.
2752 2752
 		 */
2753
-		do_action( 'xmlrpc_call_success_wp_deletePage', $page_id, $args );
2753
+		do_action('xmlrpc_call_success_wp_deletePage', $page_id, $args);
2754 2754
 
2755 2755
 		return true;
2756 2756
 	}
@@ -2772,7 +2772,7 @@  discard block
 block discarded – undo
2772 2772
 	 * }
2773 2773
 	 * @return array|IXR_Error
2774 2774
 	 */
2775
-	public function wp_editPage( $args ) {
2775
+	public function wp_editPage($args) {
2776 2776
 		// Items will be escaped in mw_editPost.
2777 2777
 		$page_id  = (int) $args[1];
2778 2778
 		$username = $args[2];
@@ -2780,24 +2780,24 @@  discard block
 block discarded – undo
2780 2780
 		$content  = $args[4];
2781 2781
 		$publish  = $args[5];
2782 2782
 
2783
-		$escaped_username = $this->escape( $username );
2784
-		$escaped_password = $this->escape( $password );
2783
+		$escaped_username = $this->escape($username);
2784
+		$escaped_password = $this->escape($password);
2785 2785
 
2786
-		if ( !$user = $this->login( $escaped_username, $escaped_password ) ) {
2786
+		if ( ! $user = $this->login($escaped_username, $escaped_password)) {
2787 2787
 			return $this->error;
2788 2788
 		}
2789 2789
 
2790 2790
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
2791
-		do_action( 'xmlrpc_call', 'wp.editPage' );
2791
+		do_action('xmlrpc_call', 'wp.editPage');
2792 2792
 
2793 2793
 		// Get the page data and make sure it is a page.
2794 2794
 		$actual_page = get_post($page_id, ARRAY_A);
2795
-		if ( !$actual_page || ($actual_page['post_type'] != 'page') )
2796
-			return new IXR_Error( 404, __( 'Sorry, no such page.' ) );
2795
+		if ( ! $actual_page || ($actual_page['post_type'] != 'page'))
2796
+			return new IXR_Error(404, __('Sorry, no such page.'));
2797 2797
 
2798 2798
 		// Make sure the user is allowed to edit pages.
2799
-		if ( !current_user_can('edit_page', $page_id) )
2800
-			return new IXR_Error( 401, __( 'Sorry, you do not have the right to edit this page.' ) );
2799
+		if ( ! current_user_can('edit_page', $page_id))
2800
+			return new IXR_Error(401, __('Sorry, you do not have the right to edit this page.'));
2801 2801
 
2802 2802
 		// Mark this as content for a page.
2803 2803
 		$content['post_type'] = 'page';
@@ -2812,7 +2812,7 @@  discard block
 block discarded – undo
2812 2812
 		);
2813 2813
 
2814 2814
 		// Let mw_editPost do all of the heavy lifting.
2815
-		return $this->mw_editPost( $args );
2815
+		return $this->mw_editPost($args);
2816 2816
 	}
2817 2817
 
2818 2818
 	/**
@@ -2831,22 +2831,22 @@  discard block
 block discarded – undo
2831 2831
 	 * }
2832 2832
 	 * @return array|IXR_Error
2833 2833
 	 */
2834
-	public function wp_getPageList( $args ) {
2834
+	public function wp_getPageList($args) {
2835 2835
 		global $wpdb;
2836 2836
 
2837
-		$this->escape( $args );
2837
+		$this->escape($args);
2838 2838
 
2839 2839
 		$username = $args[1];
2840 2840
 		$password = $args[2];
2841 2841
 
2842
-		if ( !$user = $this->login($username, $password) )
2842
+		if ( ! $user = $this->login($username, $password))
2843 2843
 			return $this->error;
2844 2844
 
2845
-		if ( !current_user_can( 'edit_pages' ) )
2846
-			return new IXR_Error( 401, __( 'Sorry, you cannot edit pages.' ) );
2845
+		if ( ! current_user_can('edit_pages'))
2846
+			return new IXR_Error(401, __('Sorry, you cannot edit pages.'));
2847 2847
 
2848 2848
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
2849
-		do_action( 'xmlrpc_call', 'wp.getPageList' );
2849
+		do_action('xmlrpc_call', 'wp.getPageList');
2850 2850
 
2851 2851
 		// Get list of pages ids and titles
2852 2852
 		$page_list = $wpdb->get_results("
@@ -2863,9 +2863,9 @@  discard block
 block discarded – undo
2863 2863
 
2864 2864
 		// The date needs to be formatted properly.
2865 2865
 		$num_pages = count($page_list);
2866
-		for ( $i = 0; $i < $num_pages; $i++ ) {
2867
-			$page_list[$i]->dateCreated = $this->_convert_date(  $page_list[$i]->post_date );
2868
-			$page_list[$i]->date_created_gmt = $this->_convert_date_gmt( $page_list[$i]->post_date_gmt, $page_list[$i]->post_date );
2866
+		for ($i = 0; $i < $num_pages; $i++) {
2867
+			$page_list[$i]->dateCreated = $this->_convert_date($page_list[$i]->post_date);
2868
+			$page_list[$i]->date_created_gmt = $this->_convert_date_gmt($page_list[$i]->post_date_gmt, $page_list[$i]->post_date);
2869 2869
 
2870 2870
 			unset($page_list[$i]->post_date_gmt);
2871 2871
 			unset($page_list[$i]->post_date);
@@ -2889,23 +2889,23 @@  discard block
 block discarded – undo
2889 2889
 	 * }
2890 2890
 	 * @return array|IXR_Error
2891 2891
 	 */
2892
-	public function wp_getAuthors( $args ) {
2893
-		$this->escape( $args );
2892
+	public function wp_getAuthors($args) {
2893
+		$this->escape($args);
2894 2894
 
2895 2895
 		$username = $args[1];
2896 2896
 		$password = $args[2];
2897 2897
 
2898
-		if ( !$user = $this->login($username, $password) )
2898
+		if ( ! $user = $this->login($username, $password))
2899 2899
 			return $this->error;
2900 2900
 
2901
-		if ( !current_user_can('edit_posts') )
2902
-			return new IXR_Error( 401, __( 'Sorry, you cannot edit posts on this site.' ) );
2901
+		if ( ! current_user_can('edit_posts'))
2902
+			return new IXR_Error(401, __('Sorry, you cannot edit posts on this site.'));
2903 2903
 
2904 2904
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
2905
-		do_action( 'xmlrpc_call', 'wp.getAuthors' );
2905
+		do_action('xmlrpc_call', 'wp.getAuthors');
2906 2906
 
2907 2907
 		$authors = array();
2908
-		foreach ( get_users( array( 'fields' => array('ID','user_login','display_name') ) ) as $user ) {
2908
+		foreach (get_users(array('fields' => array('ID', 'user_login', 'display_name'))) as $user) {
2909 2909
 			$authors[] = array(
2910 2910
 				'user_id'       => $user->ID,
2911 2911
 				'user_login'    => $user->user_login,
@@ -2930,32 +2930,32 @@  discard block
 block discarded – undo
2930 2930
 	 * }
2931 2931
 	 * @return array|IXR_Error
2932 2932
 	 */
2933
-	public function wp_getTags( $args ) {
2934
-		$this->escape( $args );
2933
+	public function wp_getTags($args) {
2934
+		$this->escape($args);
2935 2935
 
2936 2936
 		$username = $args[1];
2937 2937
 		$password = $args[2];
2938 2938
 
2939
-		if ( !$user = $this->login($username, $password) )
2939
+		if ( ! $user = $this->login($username, $password))
2940 2940
 			return $this->error;
2941 2941
 
2942
-		if ( !current_user_can( 'edit_posts' ) )
2943
-			return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this site in order to view tags.' ) );
2942
+		if ( ! current_user_can('edit_posts'))
2943
+			return new IXR_Error(401, __('Sorry, you must be able to edit posts on this site in order to view tags.'));
2944 2944
 
2945 2945
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
2946
-		do_action( 'xmlrpc_call', 'wp.getKeywords' );
2946
+		do_action('xmlrpc_call', 'wp.getKeywords');
2947 2947
 
2948 2948
 		$tags = array();
2949 2949
 
2950
-		if ( $all_tags = get_tags() ) {
2951
-			foreach( (array) $all_tags as $tag ) {
2950
+		if ($all_tags = get_tags()) {
2951
+			foreach ((array) $all_tags as $tag) {
2952 2952
 				$struct = array();
2953
-				$struct['tag_id']			= $tag->term_id;
2953
+				$struct['tag_id'] = $tag->term_id;
2954 2954
 				$struct['name']				= $tag->name;
2955 2955
 				$struct['count']			= $tag->count;
2956 2956
 				$struct['slug']				= $tag->slug;
2957
-				$struct['html_url']			= esc_html( get_tag_link( $tag->term_id ) );
2958
-				$struct['rss_url']			= esc_html( get_tag_feed_link( $tag->term_id ) );
2957
+				$struct['html_url'] = esc_html(get_tag_link($tag->term_id));
2958
+				$struct['rss_url'] = esc_html(get_tag_feed_link($tag->term_id));
2959 2959
 
2960 2960
 				$tags[] = $struct;
2961 2961
 			}
@@ -2979,35 +2979,35 @@  discard block
 block discarded – undo
2979 2979
 	 * }
2980 2980
 	 * @return int|IXR_Error Category ID.
2981 2981
 	 */
2982
-	public function wp_newCategory( $args ) {
2983
-		$this->escape( $args );
2982
+	public function wp_newCategory($args) {
2983
+		$this->escape($args);
2984 2984
 
2985 2985
 		$username = $args[1];
2986 2986
 		$password = $args[2];
2987 2987
 		$category = $args[3];
2988 2988
 
2989
-		if ( !$user = $this->login($username, $password) )
2989
+		if ( ! $user = $this->login($username, $password))
2990 2990
 			return $this->error;
2991 2991
 
2992 2992
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
2993
-		do_action( 'xmlrpc_call', 'wp.newCategory' );
2993
+		do_action('xmlrpc_call', 'wp.newCategory');
2994 2994
 
2995 2995
 		// Make sure the user is allowed to add a category.
2996
-		if ( !current_user_can('manage_categories') )
2996
+		if ( ! current_user_can('manage_categories'))
2997 2997
 			return new IXR_Error(401, __('Sorry, you do not have the right to add a category.'));
2998 2998
 
2999 2999
 		// If no slug was provided make it empty so that
3000 3000
 		// WordPress will generate one.
3001
-		if ( empty($category['slug']) )
3001
+		if (empty($category['slug']))
3002 3002
 			$category['slug'] = '';
3003 3003
 
3004 3004
 		// If no parent_id was provided make it empty
3005 3005
 		// so that it will be a top level page (no parent).
3006
-		if ( !isset($category['parent_id']) )
3006
+		if ( ! isset($category['parent_id']))
3007 3007
 			$category['parent_id'] = '';
3008 3008
 
3009 3009
 		// If no description was provided make it empty.
3010
-		if ( empty($category["description"]) )
3010
+		if (empty($category["description"]))
3011 3011
 			$category["description"] = "";
3012 3012
 
3013 3013
 		$new_category = array(
@@ -3018,12 +3018,12 @@  discard block
 block discarded – undo
3018 3018
 		);
3019 3019
 
3020 3020
 		$cat_id = wp_insert_category($new_category, true);
3021
-		if ( is_wp_error( $cat_id ) ) {
3022
-			if ( 'term_exists' == $cat_id->get_error_code() )
3021
+		if (is_wp_error($cat_id)) {
3022
+			if ('term_exists' == $cat_id->get_error_code())
3023 3023
 				return (int) $cat_id->get_error_data();
3024 3024
 			else
3025 3025
 				return new IXR_Error(500, __('Sorry, the new category failed.'));
3026
-		} elseif ( ! $cat_id ) {
3026
+		} elseif ( ! $cat_id) {
3027 3027
 			return new IXR_Error(500, __('Sorry, the new category failed.'));
3028 3028
 		}
3029 3029
 
@@ -3035,7 +3035,7 @@  discard block
 block discarded – undo
3035 3035
 		 * @param int   $cat_id ID of the new category.
3036 3036
 		 * @param array $args   An array of new category arguments.
3037 3037
 		 */
3038
-		do_action( 'xmlrpc_call_success_wp_newCategory', $cat_id, $args );
3038
+		do_action('xmlrpc_call_success_wp_newCategory', $cat_id, $args);
3039 3039
 
3040 3040
 		return $cat_id;
3041 3041
 	}
@@ -3055,25 +3055,25 @@  discard block
 block discarded – undo
3055 3055
 	 * }
3056 3056
 	 * @return bool|IXR_Error See {@link wp_delete_term()} for return info.
3057 3057
 	 */
3058
-	public function wp_deleteCategory( $args ) {
3059
-		$this->escape( $args );
3058
+	public function wp_deleteCategory($args) {
3059
+		$this->escape($args);
3060 3060
 
3061 3061
 		$username    = $args[1];
3062 3062
 		$password    = $args[2];
3063 3063
 		$category_id = (int) $args[3];
3064 3064
 
3065
-		if ( !$user = $this->login($username, $password) )
3065
+		if ( ! $user = $this->login($username, $password))
3066 3066
 			return $this->error;
3067 3067
 
3068 3068
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
3069
-		do_action( 'xmlrpc_call', 'wp.deleteCategory' );
3069
+		do_action('xmlrpc_call', 'wp.deleteCategory');
3070 3070
 
3071
-		if ( !current_user_can('manage_categories') )
3072
-			return new IXR_Error( 401, __( 'Sorry, you do not have the right to delete a category.' ) );
3071
+		if ( ! current_user_can('manage_categories'))
3072
+			return new IXR_Error(401, __('Sorry, you do not have the right to delete a category.'));
3073 3073
 
3074
-		$status = wp_delete_term( $category_id, 'category' );
3074
+		$status = wp_delete_term($category_id, 'category');
3075 3075
 
3076
-		if ( true == $status ) {
3076
+		if (true == $status) {
3077 3077
 			/**
3078 3078
 			 * Fires after a category has been successfully deleted via XML-RPC.
3079 3079
 			 *
@@ -3082,7 +3082,7 @@  discard block
 block discarded – undo
3082 3082
 			 * @param int   $category_id ID of the deleted category.
3083 3083
 			 * @param array $args        An array of arguments to delete the category.
3084 3084
 			 */
3085
-			do_action( 'xmlrpc_call_success_wp_deleteCategory', $category_id, $args );
3085
+			do_action('xmlrpc_call_success_wp_deleteCategory', $category_id, $args);
3086 3086
 		}
3087 3087
 
3088 3088
 		return $status;
@@ -3104,26 +3104,26 @@  discard block
 block discarded – undo
3104 3104
 	 * }
3105 3105
 	 * @return array|IXR_Error
3106 3106
 	 */
3107
-	public function wp_suggestCategories( $args ) {
3108
-		$this->escape( $args );
3107
+	public function wp_suggestCategories($args) {
3108
+		$this->escape($args);
3109 3109
 
3110 3110
 		$username    = $args[1];
3111 3111
 		$password    = $args[2];
3112 3112
 		$category    = $args[3];
3113 3113
 		$max_results = (int) $args[4];
3114 3114
 
3115
-		if ( !$user = $this->login($username, $password) )
3115
+		if ( ! $user = $this->login($username, $password))
3116 3116
 			return $this->error;
3117 3117
 
3118
-		if ( !current_user_can( 'edit_posts' ) )
3119
-			return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this site in order to view categories.' ) );
3118
+		if ( ! current_user_can('edit_posts'))
3119
+			return new IXR_Error(401, __('Sorry, you must be able to edit posts on this site in order to view categories.'));
3120 3120
 
3121 3121
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
3122
-		do_action( 'xmlrpc_call', 'wp.suggestCategories' );
3122
+		do_action('xmlrpc_call', 'wp.suggestCategories');
3123 3123
 
3124 3124
 		$category_suggestions = array();
3125 3125
 		$args = array('get' => 'all', 'number' => $max_results, 'name__like' => $category);
3126
-		foreach ( (array) get_categories($args) as $cat ) {
3126
+		foreach ((array) get_categories($args) as $cat) {
3127 3127
 			$category_suggestions[] = array(
3128 3128
 				'category_id'	=> $cat->term_id,
3129 3129
 				'category_name'	=> $cat->name
@@ -3155,19 +3155,19 @@  discard block
 block discarded – undo
3155 3155
 		$password	= $args[2];
3156 3156
 		$comment_id	= (int) $args[3];
3157 3157
 
3158
-		if ( !$user = $this->login($username, $password) )
3158
+		if ( ! $user = $this->login($username, $password))
3159 3159
 			return $this->error;
3160 3160
 
3161
-		if ( !current_user_can( 'moderate_comments' ) )
3162
-			return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) );
3161
+		if ( ! current_user_can('moderate_comments'))
3162
+			return new IXR_Error(403, __('You are not allowed to moderate comments on this site.'));
3163 3163
 
3164 3164
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
3165
-		do_action( 'xmlrpc_call', 'wp.getComment' );
3165
+		do_action('xmlrpc_call', 'wp.getComment');
3166 3166
 
3167
-		if ( ! $comment = get_comment($comment_id) )
3168
-			return new IXR_Error( 404, __( 'Invalid comment ID.' ) );
3167
+		if ( ! $comment = get_comment($comment_id))
3168
+			return new IXR_Error(404, __('Invalid comment ID.'));
3169 3169
 
3170
-		return $this->_prepare_comment( $comment );
3170
+		return $this->_prepare_comment($comment);
3171 3171
 	}
3172 3172
 
3173 3173
 	/**
@@ -3196,45 +3196,45 @@  discard block
 block discarded – undo
3196 3196
 	 * }
3197 3197
 	 * @return array|IXR_Error Contains a collection of comments. See {@link wp_xmlrpc_server::wp_getComment()} for a description of each item contents
3198 3198
 	 */
3199
-	public function wp_getComments( $args ) {
3200
-		$this->escape( $args );
3199
+	public function wp_getComments($args) {
3200
+		$this->escape($args);
3201 3201
 
3202 3202
 		$username = $args[1];
3203 3203
 		$password = $args[2];
3204
-		$struct	  = isset( $args[3] ) ? $args[3] : array();
3204
+		$struct	  = isset($args[3]) ? $args[3] : array();
3205 3205
 
3206
-		if ( !$user = $this->login($username, $password) )
3206
+		if ( ! $user = $this->login($username, $password))
3207 3207
 			return $this->error;
3208 3208
 
3209
-		if ( !current_user_can( 'moderate_comments' ) )
3210
-			return new IXR_Error( 401, __( 'Sorry, you cannot edit comments.' ) );
3209
+		if ( ! current_user_can('moderate_comments'))
3210
+			return new IXR_Error(401, __('Sorry, you cannot edit comments.'));
3211 3211
 
3212 3212
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
3213
-		do_action( 'xmlrpc_call', 'wp.getComments' );
3213
+		do_action('xmlrpc_call', 'wp.getComments');
3214 3214
 
3215
-		if ( isset($struct['status']) )
3215
+		if (isset($struct['status']))
3216 3216
 			$status = $struct['status'];
3217 3217
 		else
3218 3218
 			$status = '';
3219 3219
 
3220 3220
 		$post_id = '';
3221
-		if ( isset($struct['post_id']) )
3221
+		if (isset($struct['post_id']))
3222 3222
 			$post_id = absint($struct['post_id']);
3223 3223
 
3224 3224
 		$offset = 0;
3225
-		if ( isset($struct['offset']) )
3225
+		if (isset($struct['offset']))
3226 3226
 			$offset = absint($struct['offset']);
3227 3227
 
3228 3228
 		$number = 10;
3229
-		if ( isset($struct['number']) )
3229
+		if (isset($struct['number']))
3230 3230
 			$number = absint($struct['number']);
3231 3231
 
3232
-		$comments = get_comments( array( 'status' => $status, 'post_id' => $post_id, 'offset' => $offset, 'number' => $number ) );
3232
+		$comments = get_comments(array('status' => $status, 'post_id' => $post_id, 'offset' => $offset, 'number' => $number));
3233 3233
 
3234 3234
 		$comments_struct = array();
3235
-		if ( is_array( $comments ) ) {
3236
-			foreach ( $comments as $comment ) {
3237
-				$comments_struct[] = $this->_prepare_comment( $comment );
3235
+		if (is_array($comments)) {
3236
+			foreach ($comments as $comment) {
3237
+				$comments_struct[] = $this->_prepare_comment($comment);
3238 3238
 			}
3239 3239
 		}
3240 3240
 
@@ -3267,24 +3267,24 @@  discard block
 block discarded – undo
3267 3267
 		$password	= $args[2];
3268 3268
 		$comment_ID	= (int) $args[3];
3269 3269
 
3270
-		if ( !$user = $this->login($username, $password) )
3270
+		if ( ! $user = $this->login($username, $password))
3271 3271
 			return $this->error;
3272 3272
 
3273
-		if ( !current_user_can( 'moderate_comments' ) )
3274
-			return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) );
3273
+		if ( ! current_user_can('moderate_comments'))
3274
+			return new IXR_Error(403, __('You are not allowed to moderate comments on this site.'));
3275 3275
 
3276
-		if ( ! get_comment($comment_ID) )
3277
-			return new IXR_Error( 404, __( 'Invalid comment ID.' ) );
3276
+		if ( ! get_comment($comment_ID))
3277
+			return new IXR_Error(404, __('Invalid comment ID.'));
3278 3278
 
3279
-		if ( !current_user_can( 'edit_comment', $comment_ID ) )
3280
-			return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) );
3279
+		if ( ! current_user_can('edit_comment', $comment_ID))
3280
+			return new IXR_Error(403, __('You are not allowed to moderate comments on this site.'));
3281 3281
 
3282 3282
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
3283
-		do_action( 'xmlrpc_call', 'wp.deleteComment' );
3283
+		do_action('xmlrpc_call', 'wp.deleteComment');
3284 3284
 
3285
-		$status = wp_delete_comment( $comment_ID );
3285
+		$status = wp_delete_comment($comment_ID);
3286 3286
 
3287
-		if ( $status ) {
3287
+		if ($status) {
3288 3288
 			/**
3289 3289
 			 * Fires after a comment has been successfully deleted via XML-RPC.
3290 3290
 			 *
@@ -3293,7 +3293,7 @@  discard block
 block discarded – undo
3293 3293
 			 * @param int   $comment_ID ID of the deleted comment.
3294 3294
 			 * @param array $args       An array of arguments to delete the comment.
3295 3295
 			 */
3296
-			do_action( 'xmlrpc_call_success_wp_deleteComment', $comment_ID, $args );
3296
+			do_action('xmlrpc_call_success_wp_deleteComment', $comment_ID, $args);
3297 3297
 		}
3298 3298
 
3299 3299
 		return $status;
@@ -3326,66 +3326,66 @@  discard block
 block discarded – undo
3326 3326
 	 * }
3327 3327
 	 * @return true|IXR_Error True, on success.
3328 3328
 	 */
3329
-	public function wp_editComment( $args ) {
3330
-		$this->escape( $args );
3329
+	public function wp_editComment($args) {
3330
+		$this->escape($args);
3331 3331
 
3332 3332
 		$username	= $args[1];
3333 3333
 		$password	= $args[2];
3334 3334
 		$comment_ID	= (int) $args[3];
3335 3335
 		$content_struct = $args[4];
3336 3336
 
3337
-		if ( !$user = $this->login($username, $password) )
3337
+		if ( ! $user = $this->login($username, $password))
3338 3338
 			return $this->error;
3339 3339
 
3340
-		if ( !current_user_can( 'moderate_comments' ) )
3341
-			return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) );
3340
+		if ( ! current_user_can('moderate_comments'))
3341
+			return new IXR_Error(403, __('You are not allowed to moderate comments on this site.'));
3342 3342
 
3343
-		if ( ! get_comment($comment_ID) )
3344
-			return new IXR_Error( 404, __( 'Invalid comment ID.' ) );
3343
+		if ( ! get_comment($comment_ID))
3344
+			return new IXR_Error(404, __('Invalid comment ID.'));
3345 3345
 
3346
-		if ( !current_user_can( 'edit_comment', $comment_ID ) )
3347
-			return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) );
3346
+		if ( ! current_user_can('edit_comment', $comment_ID))
3347
+			return new IXR_Error(403, __('You are not allowed to moderate comments on this site.'));
3348 3348
 
3349 3349
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
3350
-		do_action( 'xmlrpc_call', 'wp.editComment' );
3350
+		do_action('xmlrpc_call', 'wp.editComment');
3351 3351
 
3352
-		if ( isset($content_struct['status']) ) {
3352
+		if (isset($content_struct['status'])) {
3353 3353
 			$statuses = get_comment_statuses();
3354 3354
 			$statuses = array_keys($statuses);
3355 3355
 
3356
-			if ( ! in_array($content_struct['status'], $statuses) )
3357
-				return new IXR_Error( 401, __( 'Invalid comment status.' ) );
3356
+			if ( ! in_array($content_struct['status'], $statuses))
3357
+				return new IXR_Error(401, __('Invalid comment status.'));
3358 3358
 			$comment_approved = $content_struct['status'];
3359 3359
 		}
3360 3360
 
3361 3361
 		// Do some timestamp voodoo
3362
-		if ( !empty( $content_struct['date_created_gmt'] ) ) {
3362
+		if ( ! empty($content_struct['date_created_gmt'])) {
3363 3363
 			// We know this is supposed to be GMT, so we're going to slap that Z on there by force
3364
-			$dateCreated = rtrim( $content_struct['date_created_gmt']->getIso(), 'Z' ) . 'Z';
3364
+			$dateCreated = rtrim($content_struct['date_created_gmt']->getIso(), 'Z').'Z';
3365 3365
 			$comment_date = get_date_from_gmt(iso8601_to_datetime($dateCreated));
3366 3366
 			$comment_date_gmt = iso8601_to_datetime($dateCreated, 'GMT');
3367 3367
 		}
3368 3368
 
3369
-		if ( isset($content_struct['content']) )
3369
+		if (isset($content_struct['content']))
3370 3370
 			$comment_content = $content_struct['content'];
3371 3371
 
3372
-		if ( isset($content_struct['author']) )
3372
+		if (isset($content_struct['author']))
3373 3373
 			$comment_author = $content_struct['author'];
3374 3374
 
3375
-		if ( isset($content_struct['author_url']) )
3375
+		if (isset($content_struct['author_url']))
3376 3376
 			$comment_author_url = $content_struct['author_url'];
3377 3377
 
3378
-		if ( isset($content_struct['author_email']) )
3378
+		if (isset($content_struct['author_email']))
3379 3379
 			$comment_author_email = $content_struct['author_email'];
3380 3380
 
3381 3381
 		// We've got all the data -- post it:
3382 3382
 		$comment = compact('comment_ID', 'comment_content', 'comment_approved', 'comment_date', 'comment_date_gmt', 'comment_author', 'comment_author_email', 'comment_author_url');
3383 3383
 
3384 3384
 		$result = wp_update_comment($comment);
3385
-		if ( is_wp_error( $result ) )
3385
+		if (is_wp_error($result))
3386 3386
 			return new IXR_Error(500, $result->get_error_message());
3387 3387
 
3388
-		if ( !$result )
3388
+		if ( ! $result)
3389 3389
 			return new IXR_Error(500, __('Sorry, the comment could not be edited. Something wrong happened.'));
3390 3390
 
3391 3391
 		/**
@@ -3396,7 +3396,7 @@  discard block
 block discarded – undo
3396 3396
 		 * @param int   $comment_ID ID of the updated comment.
3397 3397
 		 * @param array $args       An array of arguments to update the comment.
3398 3398
 		 */
3399
-		do_action( 'xmlrpc_call_success_wp_editComment', $comment_ID, $args );
3399
+		do_action('xmlrpc_call_success_wp_editComment', $comment_ID, $args);
3400 3400
 
3401 3401
 		return true;
3402 3402
 	}
@@ -3433,71 +3433,71 @@  discard block
 block discarded – undo
3433 3433
 		 * @param bool $allow Whether to allow anonymous commenting via XML-RPC.
3434 3434
 		 *                    Default false.
3435 3435
 		 */
3436
-		$allow_anon = apply_filters( 'xmlrpc_allow_anonymous_comments', false );
3436
+		$allow_anon = apply_filters('xmlrpc_allow_anonymous_comments', false);
3437 3437
 
3438 3438
 		$user = $this->login($username, $password);
3439 3439
 
3440
-		if ( !$user ) {
3440
+		if ( ! $user) {
3441 3441
 			$logged_in = false;
3442
-			if ( $allow_anon && get_option('comment_registration') ) {
3443
-				return new IXR_Error( 403, __( 'You must be registered to comment' ) );
3444
-			} elseif ( ! $allow_anon ) {
3442
+			if ($allow_anon && get_option('comment_registration')) {
3443
+				return new IXR_Error(403, __('You must be registered to comment'));
3444
+			} elseif ( ! $allow_anon) {
3445 3445
 				return $this->error;
3446 3446
 			}
3447 3447
 		} else {
3448 3448
 			$logged_in = true;
3449 3449
 		}
3450 3450
 
3451
-		if ( is_numeric($post) )
3451
+		if (is_numeric($post))
3452 3452
 			$post_id = absint($post);
3453 3453
 		else
3454 3454
 			$post_id = url_to_postid($post);
3455 3455
 
3456
-		if ( ! $post_id )
3457
-			return new IXR_Error( 404, __( 'Invalid post ID.' ) );
3456
+		if ( ! $post_id)
3457
+			return new IXR_Error(404, __('Invalid post ID.'));
3458 3458
 
3459
-		if ( ! get_post($post_id) )
3460
-			return new IXR_Error( 404, __( 'Invalid post ID.' ) );
3459
+		if ( ! get_post($post_id))
3460
+			return new IXR_Error(404, __('Invalid post ID.'));
3461 3461
 
3462 3462
 		$comment = array();
3463 3463
 		$comment['comment_post_ID'] = $post_id;
3464 3464
 
3465
-		if ( $logged_in ) {
3466
-			$comment['comment_author'] = $this->escape( $user->display_name );
3467
-			$comment['comment_author_email'] = $this->escape( $user->user_email );
3468
-			$comment['comment_author_url'] = $this->escape( $user->user_url );
3465
+		if ($logged_in) {
3466
+			$comment['comment_author'] = $this->escape($user->display_name);
3467
+			$comment['comment_author_email'] = $this->escape($user->user_email);
3468
+			$comment['comment_author_url'] = $this->escape($user->user_url);
3469 3469
 			$comment['user_ID'] = $user->ID;
3470 3470
 		} else {
3471 3471
 			$comment['comment_author'] = '';
3472
-			if ( isset($content_struct['author']) )
3472
+			if (isset($content_struct['author']))
3473 3473
 				$comment['comment_author'] = $content_struct['author'];
3474 3474
 
3475 3475
 			$comment['comment_author_email'] = '';
3476
-			if ( isset($content_struct['author_email']) )
3476
+			if (isset($content_struct['author_email']))
3477 3477
 				$comment['comment_author_email'] = $content_struct['author_email'];
3478 3478
 
3479 3479
 			$comment['comment_author_url'] = '';
3480
-			if ( isset($content_struct['author_url']) )
3480
+			if (isset($content_struct['author_url']))
3481 3481
 				$comment['comment_author_url'] = $content_struct['author_url'];
3482 3482
 
3483 3483
 			$comment['user_ID'] = 0;
3484 3484
 
3485
-			if ( get_option('require_name_email') ) {
3486
-				if ( 6 > strlen($comment['comment_author_email']) || '' == $comment['comment_author'] )
3487
-					return new IXR_Error( 403, __( 'Comment author name and email are required' ) );
3488
-				elseif ( !is_email($comment['comment_author_email']) )
3489
-					return new IXR_Error( 403, __( 'A valid email address is required' ) );
3485
+			if (get_option('require_name_email')) {
3486
+				if (6 > strlen($comment['comment_author_email']) || '' == $comment['comment_author'])
3487
+					return new IXR_Error(403, __('Comment author name and email are required'));
3488
+				elseif ( ! is_email($comment['comment_author_email']))
3489
+					return new IXR_Error(403, __('A valid email address is required'));
3490 3490
 			}
3491 3491
 		}
3492 3492
 
3493 3493
 		$comment['comment_parent'] = isset($content_struct['comment_parent']) ? absint($content_struct['comment_parent']) : 0;
3494 3494
 
3495
-		$comment['comment_content'] =  isset($content_struct['content']) ? $content_struct['content'] : null;
3495
+		$comment['comment_content'] = isset($content_struct['content']) ? $content_struct['content'] : null;
3496 3496
 
3497 3497
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
3498
-		do_action( 'xmlrpc_call', 'wp.newComment' );
3498
+		do_action('xmlrpc_call', 'wp.newComment');
3499 3499
 
3500
-		$comment_ID = wp_new_comment( $comment );
3500
+		$comment_ID = wp_new_comment($comment);
3501 3501
 
3502 3502
 		/**
3503 3503
 		 * Fires after a new comment has been successfully created via XML-RPC.
@@ -3507,7 +3507,7 @@  discard block
 block discarded – undo
3507 3507
 		 * @param int   $comment_ID ID of the new comment.
3508 3508
 		 * @param array $args       An array of new comment arguments.
3509 3509
 		 */
3510
-		do_action( 'xmlrpc_call_success_wp_newComment', $comment_ID, $args );
3510
+		do_action('xmlrpc_call_success_wp_newComment', $comment_ID, $args);
3511 3511
 
3512 3512
 		return $comment_ID;
3513 3513
 	}
@@ -3527,19 +3527,19 @@  discard block
 block discarded – undo
3527 3527
 	 * @return array|IXR_Error
3528 3528
 	 */
3529 3529
 	public function wp_getCommentStatusList($args) {
3530
-		$this->escape( $args );
3530
+		$this->escape($args);
3531 3531
 
3532 3532
 		$username = $args[1];
3533 3533
 		$password = $args[2];
3534 3534
 
3535
-		if ( !$user = $this->login($username, $password) )
3535
+		if ( ! $user = $this->login($username, $password))
3536 3536
 			return $this->error;
3537 3537
 
3538
-		if ( !current_user_can( 'moderate_comments' ) )
3539
-			return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) );
3538
+		if ( ! current_user_can('moderate_comments'))
3539
+			return new IXR_Error(403, __('You are not allowed access to details about this site.'));
3540 3540
 
3541 3541
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
3542
-		do_action( 'xmlrpc_call', 'wp.getCommentStatusList' );
3542
+		do_action('xmlrpc_call', 'wp.getCommentStatusList');
3543 3543
 
3544 3544
 		return get_comment_statuses();
3545 3545
 	}
@@ -3559,23 +3559,23 @@  discard block
 block discarded – undo
3559 3559
 	 * }
3560 3560
 	 * @return array|IXR_Error
3561 3561
 	 */
3562
-	public function wp_getCommentCount( $args ) {
3563
-		$this->escape( $args );
3562
+	public function wp_getCommentCount($args) {
3563
+		$this->escape($args);
3564 3564
 
3565 3565
 		$username	= $args[1];
3566 3566
 		$password	= $args[2];
3567
-		$post_id	= (int) $args[3];
3567
+		$post_id = (int) $args[3];
3568 3568
 
3569
-		if ( !$user = $this->login($username, $password) )
3569
+		if ( ! $user = $this->login($username, $password))
3570 3570
 			return $this->error;
3571 3571
 
3572
-		if ( !current_user_can( 'edit_posts' ) )
3573
-			return new IXR_Error( 403, __( 'You are not allowed access to details about comments.' ) );
3572
+		if ( ! current_user_can('edit_posts'))
3573
+			return new IXR_Error(403, __('You are not allowed access to details about comments.'));
3574 3574
 
3575 3575
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
3576
-		do_action( 'xmlrpc_call', 'wp.getCommentCount' );
3576
+		do_action('xmlrpc_call', 'wp.getCommentCount');
3577 3577
 
3578
-		$count = wp_count_comments( $post_id );
3578
+		$count = wp_count_comments($post_id);
3579 3579
 		return array(
3580 3580
 			'approved' => $count->approved,
3581 3581
 			'awaiting_moderation' => $count->moderated,
@@ -3598,20 +3598,20 @@  discard block
 block discarded – undo
3598 3598
 	 * }
3599 3599
 	 * @return array|IXR_Error
3600 3600
 	 */
3601
-	public function wp_getPostStatusList( $args ) {
3602
-		$this->escape( $args );
3601
+	public function wp_getPostStatusList($args) {
3602
+		$this->escape($args);
3603 3603
 
3604 3604
 		$username = $args[1];
3605 3605
 		$password = $args[2];
3606 3606
 
3607
-		if ( !$user = $this->login($username, $password) )
3607
+		if ( ! $user = $this->login($username, $password))
3608 3608
 			return $this->error;
3609 3609
 
3610
-		if ( !current_user_can( 'edit_posts' ) )
3611
-			return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) );
3610
+		if ( ! current_user_can('edit_posts'))
3611
+			return new IXR_Error(403, __('You are not allowed access to details about this site.'));
3612 3612
 
3613 3613
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
3614
-		do_action( 'xmlrpc_call', 'wp.getPostStatusList' );
3614
+		do_action('xmlrpc_call', 'wp.getPostStatusList');
3615 3615
 
3616 3616
 		return get_post_statuses();
3617 3617
 	}
@@ -3630,20 +3630,20 @@  discard block
 block discarded – undo
3630 3630
 	 * }
3631 3631
 	 * @return array|IXR_Error
3632 3632
 	 */
3633
-	public function wp_getPageStatusList( $args ) {
3634
-		$this->escape( $args );
3633
+	public function wp_getPageStatusList($args) {
3634
+		$this->escape($args);
3635 3635
 
3636 3636
 		$username = $args[1];
3637 3637
 		$password = $args[2];
3638 3638
 
3639
-		if ( !$user = $this->login($username, $password) )
3639
+		if ( ! $user = $this->login($username, $password))
3640 3640
 			return $this->error;
3641 3641
 
3642
-		if ( !current_user_can( 'edit_pages' ) )
3643
-			return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) );
3642
+		if ( ! current_user_can('edit_pages'))
3643
+			return new IXR_Error(403, __('You are not allowed access to details about this site.'));
3644 3644
 
3645 3645
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
3646
-		do_action( 'xmlrpc_call', 'wp.getPageStatusList' );
3646
+		do_action('xmlrpc_call', 'wp.getPageStatusList');
3647 3647
 
3648 3648
 		return get_page_statuses();
3649 3649
 	}
@@ -3662,17 +3662,17 @@  discard block
 block discarded – undo
3662 3662
 	 * }
3663 3663
 	 * @return array|IXR_Error
3664 3664
 	 */
3665
-	public function wp_getPageTemplates( $args ) {
3666
-		$this->escape( $args );
3665
+	public function wp_getPageTemplates($args) {
3666
+		$this->escape($args);
3667 3667
 
3668 3668
 		$username = $args[1];
3669 3669
 		$password = $args[2];
3670 3670
 
3671
-		if ( !$user = $this->login($username, $password) )
3671
+		if ( ! $user = $this->login($username, $password))
3672 3672
 			return $this->error;
3673 3673
 
3674
-		if ( !current_user_can( 'edit_pages' ) )
3675
-			return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) );
3674
+		if ( ! current_user_can('edit_pages'))
3675
+			return new IXR_Error(403, __('You are not allowed access to details about this site.'));
3676 3676
 
3677 3677
 		$templates = get_page_templates();
3678 3678
 		$templates['Default'] = 'default';
@@ -3695,18 +3695,18 @@  discard block
 block discarded – undo
3695 3695
 	 * }
3696 3696
 	 * @return array|IXR_Error
3697 3697
 	 */
3698
-	public function wp_getOptions( $args ) {
3699
-		$this->escape( $args );
3698
+	public function wp_getOptions($args) {
3699
+		$this->escape($args);
3700 3700
 
3701 3701
 		$username	= $args[1];
3702 3702
 		$password	= $args[2];
3703
-		$options	= isset( $args[3] ) ? (array) $args[3] : array();
3703
+		$options = isset($args[3]) ? (array) $args[3] : array();
3704 3704
 
3705
-		if ( !$user = $this->login($username, $password) )
3705
+		if ( ! $user = $this->login($username, $password))
3706 3706
 			return $this->error;
3707 3707
 
3708 3708
 		// If no specific options where asked for, return all of them
3709
-		if ( count( $options ) == 0 )
3709
+		if (count($options) == 0)
3710 3710
 			$options = array_keys($this->blog_options);
3711 3711
 
3712 3712
 		return $this->_getOptions($options);
@@ -3722,17 +3722,17 @@  discard block
 block discarded – undo
3722 3722
 	 */
3723 3723
 	public function _getOptions($options) {
3724 3724
 		$data = array();
3725
-		$can_manage = current_user_can( 'manage_options' );
3726
-		foreach ( $options as $option ) {
3727
-			if ( array_key_exists( $option, $this->blog_options ) ) {
3725
+		$can_manage = current_user_can('manage_options');
3726
+		foreach ($options as $option) {
3727
+			if (array_key_exists($option, $this->blog_options)) {
3728 3728
 				$data[$option] = $this->blog_options[$option];
3729 3729
 				//Is the value static or dynamic?
3730
-				if ( isset( $data[$option]['option'] ) ) {
3731
-					$data[$option]['value'] = get_option( $data[$option]['option'] );
3730
+				if (isset($data[$option]['option'])) {
3731
+					$data[$option]['value'] = get_option($data[$option]['option']);
3732 3732
 					unset($data[$option]['option']);
3733 3733
 				}
3734 3734
 
3735
-				if ( ! $can_manage )
3735
+				if ( ! $can_manage)
3736 3736
 					$data[$option]['readonly'] = true;
3737 3737
 			}
3738 3738
 		}
@@ -3755,29 +3755,29 @@  discard block
 block discarded – undo
3755 3755
 	 * }
3756 3756
 	 * @return array|IXR_Error
3757 3757
 	 */
3758
-	public function wp_setOptions( $args ) {
3759
-		$this->escape( $args );
3758
+	public function wp_setOptions($args) {
3759
+		$this->escape($args);
3760 3760
 
3761 3761
 		$username	= $args[1];
3762 3762
 		$password	= $args[2];
3763
-		$options	= (array) $args[3];
3763
+		$options = (array) $args[3];
3764 3764
 
3765
-		if ( !$user = $this->login($username, $password) )
3765
+		if ( ! $user = $this->login($username, $password))
3766 3766
 			return $this->error;
3767 3767
 
3768
-		if ( !current_user_can( 'manage_options' ) )
3769
-			return new IXR_Error( 403, __( 'You are not allowed to update options.' ) );
3768
+		if ( ! current_user_can('manage_options'))
3769
+			return new IXR_Error(403, __('You are not allowed to update options.'));
3770 3770
 
3771 3771
 		$option_names = array();
3772
-		foreach ( $options as $o_name => $o_value ) {
3772
+		foreach ($options as $o_name => $o_value) {
3773 3773
 			$option_names[] = $o_name;
3774
-			if ( !array_key_exists( $o_name, $this->blog_options ) )
3774
+			if ( ! array_key_exists($o_name, $this->blog_options))
3775 3775
 				continue;
3776 3776
 
3777
-			if ( $this->blog_options[$o_name]['readonly'] == true )
3777
+			if ($this->blog_options[$o_name]['readonly'] == true)
3778 3778
 				continue;
3779 3779
 
3780
-			update_option( $this->blog_options[$o_name]['option'], wp_unslash( $o_value ) );
3780
+			update_option($this->blog_options[$o_name]['option'], wp_unslash($o_value));
3781 3781
 		}
3782 3782
 
3783 3783
 		//Now return the updated values
@@ -3807,26 +3807,26 @@  discard block
 block discarded – undo
3807 3807
 	 *  - 'description'
3808 3808
 	 *  - 'metadata'
3809 3809
 	 */
3810
-	public function wp_getMediaItem( $args ) {
3811
-		$this->escape( $args );
3810
+	public function wp_getMediaItem($args) {
3811
+		$this->escape($args);
3812 3812
 
3813 3813
 		$username		= $args[1];
3814 3814
 		$password		= $args[2];
3815
-		$attachment_id	= (int) $args[3];
3815
+		$attachment_id = (int) $args[3];
3816 3816
 
3817
-		if ( !$user = $this->login($username, $password) )
3817
+		if ( ! $user = $this->login($username, $password))
3818 3818
 			return $this->error;
3819 3819
 
3820
-		if ( !current_user_can( 'upload_files' ) )
3821
-			return new IXR_Error( 403, __( 'You do not have permission to upload files.' ) );
3820
+		if ( ! current_user_can('upload_files'))
3821
+			return new IXR_Error(403, __('You do not have permission to upload files.'));
3822 3822
 
3823 3823
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
3824
-		do_action( 'xmlrpc_call', 'wp.getMediaItem' );
3824
+		do_action('xmlrpc_call', 'wp.getMediaItem');
3825 3825
 
3826
-		if ( ! $attachment = get_post($attachment_id) )
3827
-			return new IXR_Error( 404, __( 'Invalid attachment ID.' ) );
3826
+		if ( ! $attachment = get_post($attachment_id))
3827
+			return new IXR_Error(404, __('Invalid attachment ID.'));
3828 3828
 
3829
-		return $this->_prepare_media_item( $attachment );
3829
+		return $this->_prepare_media_item($attachment);
3830 3830
 	}
3831 3831
 
3832 3832
 	/**
@@ -3860,28 +3860,28 @@  discard block
 block discarded – undo
3860 3860
 
3861 3861
 		$username	= $args[1];
3862 3862
 		$password	= $args[2];
3863
-		$struct		= isset( $args[3] ) ? $args[3] : array() ;
3863
+		$struct = isset($args[3]) ? $args[3] : array();
3864 3864
 
3865
-		if ( !$user = $this->login($username, $password) )
3865
+		if ( ! $user = $this->login($username, $password))
3866 3866
 			return $this->error;
3867 3867
 
3868
-		if ( !current_user_can( 'upload_files' ) )
3869
-			return new IXR_Error( 401, __( 'You do not have permission to upload files.' ) );
3868
+		if ( ! current_user_can('upload_files'))
3869
+			return new IXR_Error(401, __('You do not have permission to upload files.'));
3870 3870
 
3871 3871
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
3872
-		do_action( 'xmlrpc_call', 'wp.getMediaLibrary' );
3872
+		do_action('xmlrpc_call', 'wp.getMediaLibrary');
3873 3873
 
3874
-		$parent_id = ( isset($struct['parent_id']) ) ? absint($struct['parent_id']) : '' ;
3875
-		$mime_type = ( isset($struct['mime_type']) ) ? $struct['mime_type'] : '' ;
3876
-		$offset = ( isset($struct['offset']) ) ? absint($struct['offset']) : 0 ;
3877
-		$number = ( isset($struct['number']) ) ? absint($struct['number']) : -1 ;
3874
+		$parent_id = (isset($struct['parent_id'])) ? absint($struct['parent_id']) : '';
3875
+		$mime_type = (isset($struct['mime_type'])) ? $struct['mime_type'] : '';
3876
+		$offset = (isset($struct['offset'])) ? absint($struct['offset']) : 0;
3877
+		$number = (isset($struct['number'])) ? absint($struct['number']) : -1;
3878 3878
 
3879
-		$attachments = get_posts( array('post_type' => 'attachment', 'post_parent' => $parent_id, 'offset' => $offset, 'numberposts' => $number, 'post_mime_type' => $mime_type ) );
3879
+		$attachments = get_posts(array('post_type' => 'attachment', 'post_parent' => $parent_id, 'offset' => $offset, 'numberposts' => $number, 'post_mime_type' => $mime_type));
3880 3880
 
3881 3881
 		$attachments_struct = array();
3882 3882
 
3883
-		foreach ($attachments as $attachment )
3884
-			$attachments_struct[] = $this->_prepare_media_item( $attachment );
3883
+		foreach ($attachments as $attachment)
3884
+			$attachments_struct[] = $this->_prepare_media_item($attachment);
3885 3885
 
3886 3886
 		return $attachments_struct;
3887 3887
 	}
@@ -3900,28 +3900,28 @@  discard block
 block discarded – undo
3900 3900
 	 * }
3901 3901
 	 * @return array|IXR_Error List of post formats, otherwise IXR_Error object.
3902 3902
 	 */
3903
-	public function wp_getPostFormats( $args ) {
3904
-		$this->escape( $args );
3903
+	public function wp_getPostFormats($args) {
3904
+		$this->escape($args);
3905 3905
 
3906 3906
 		$username = $args[1];
3907 3907
 		$password = $args[2];
3908 3908
 
3909
-		if ( !$user = $this->login( $username, $password ) )
3909
+		if ( ! $user = $this->login($username, $password))
3910 3910
 			return $this->error;
3911 3911
 
3912
-		if ( !current_user_can( 'edit_posts' ) )
3913
-			return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) );
3912
+		if ( ! current_user_can('edit_posts'))
3913
+			return new IXR_Error(403, __('You are not allowed access to details about this site.'));
3914 3914
 
3915 3915
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
3916
-		do_action( 'xmlrpc_call', 'wp.getPostFormats' );
3916
+		do_action('xmlrpc_call', 'wp.getPostFormats');
3917 3917
 
3918 3918
 		$formats = get_post_format_strings();
3919 3919
 
3920 3920
 		// find out if they want a list of currently supports formats
3921
-		if ( isset( $args[3] ) && is_array( $args[3] ) ) {
3922
-			if ( $args[3]['show-supported'] ) {
3923
-				if ( current_theme_supports( 'post-formats' ) ) {
3924
-					$supported = get_theme_support( 'post-formats' );
3921
+		if (isset($args[3]) && is_array($args[3])) {
3922
+			if ($args[3]['show-supported']) {
3923
+				if (current_theme_supports('post-formats')) {
3924
+					$supported = get_theme_support('post-formats');
3925 3925
 
3926 3926
 					$data = array();
3927 3927
 					$data['all'] = $formats;
@@ -3962,17 +3962,17 @@  discard block
 block discarded – undo
3962 3962
 	 *  - 'taxonomies'
3963 3963
 	 *  - 'supports'
3964 3964
 	 */
3965
-	public function wp_getPostType( $args ) {
3966
-		if ( ! $this->minimum_args( $args, 4 ) )
3965
+	public function wp_getPostType($args) {
3966
+		if ( ! $this->minimum_args($args, 4))
3967 3967
 			return $this->error;
3968 3968
 
3969
-		$this->escape( $args );
3969
+		$this->escape($args);
3970 3970
 
3971 3971
 		$username       = $args[1];
3972 3972
 		$password       = $args[2];
3973 3973
 		$post_type_name = $args[3];
3974 3974
 
3975
-		if ( isset( $args[4] ) ) {
3975
+		if (isset($args[4])) {
3976 3976
 			$fields = $args[4];
3977 3977
 		} else {
3978 3978
 			/**
@@ -3983,24 +3983,24 @@  discard block
 block discarded – undo
3983 3983
 			 * @param array  $fields An array of post type query fields for the given method.
3984 3984
 			 * @param string $method The method name.
3985 3985
 			 */
3986
-			$fields = apply_filters( 'xmlrpc_default_posttype_fields', array( 'labels', 'cap', 'taxonomies' ), 'wp.getPostType' );
3986
+			$fields = apply_filters('xmlrpc_default_posttype_fields', array('labels', 'cap', 'taxonomies'), 'wp.getPostType');
3987 3987
 		}
3988 3988
 
3989
-		if ( !$user = $this->login( $username, $password ) )
3989
+		if ( ! $user = $this->login($username, $password))
3990 3990
 			return $this->error;
3991 3991
 
3992 3992
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
3993
-		do_action( 'xmlrpc_call', 'wp.getPostType' );
3993
+		do_action('xmlrpc_call', 'wp.getPostType');
3994 3994
 
3995
-		if ( ! post_type_exists( $post_type_name ) )
3996
-			return new IXR_Error( 403, __( 'Invalid post type' ) );
3995
+		if ( ! post_type_exists($post_type_name))
3996
+			return new IXR_Error(403, __('Invalid post type'));
3997 3997
 
3998
-		$post_type = get_post_type_object( $post_type_name );
3998
+		$post_type = get_post_type_object($post_type_name);
3999 3999
 
4000
-		if ( ! current_user_can( $post_type->cap->edit_posts ) )
4001
-			return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post type.' ) );
4000
+		if ( ! current_user_can($post_type->cap->edit_posts))
4001
+			return new IXR_Error(401, __('Sorry, you are not allowed to edit this post type.'));
4002 4002
 
4003
-		return $this->_prepare_post_type( $post_type, $fields );
4003
+		return $this->_prepare_post_type($post_type, $fields);
4004 4004
 	}
4005 4005
 
4006 4006
 	/**
@@ -4021,38 +4021,38 @@  discard block
 block discarded – undo
4021 4021
 	 * }
4022 4022
 	 * @return array|IXR_Error
4023 4023
 	 */
4024
-	public function wp_getPostTypes( $args ) {
4025
-		if ( ! $this->minimum_args( $args, 3 ) )
4024
+	public function wp_getPostTypes($args) {
4025
+		if ( ! $this->minimum_args($args, 3))
4026 4026
 			return $this->error;
4027 4027
 
4028
-		$this->escape( $args );
4028
+		$this->escape($args);
4029 4029
 
4030 4030
 		$username = $args[1];
4031 4031
 		$password = $args[2];
4032
-		$filter   = isset( $args[3] ) ? $args[3] : array( 'public' => true );
4032
+		$filter   = isset($args[3]) ? $args[3] : array('public' => true);
4033 4033
 
4034
-		if ( isset( $args[4] ) ) {
4034
+		if (isset($args[4])) {
4035 4035
 			$fields = $args[4];
4036 4036
 		} else {
4037 4037
 			/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
4038
-			$fields = apply_filters( 'xmlrpc_default_posttype_fields', array( 'labels', 'cap', 'taxonomies' ), 'wp.getPostTypes' );
4038
+			$fields = apply_filters('xmlrpc_default_posttype_fields', array('labels', 'cap', 'taxonomies'), 'wp.getPostTypes');
4039 4039
 		}
4040 4040
 
4041
-		if ( ! $user = $this->login( $username, $password ) )
4041
+		if ( ! $user = $this->login($username, $password))
4042 4042
 			return $this->error;
4043 4043
 
4044 4044
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
4045
-		do_action( 'xmlrpc_call', 'wp.getPostTypes' );
4045
+		do_action('xmlrpc_call', 'wp.getPostTypes');
4046 4046
 
4047
-		$post_types = get_post_types( $filter, 'objects' );
4047
+		$post_types = get_post_types($filter, 'objects');
4048 4048
 
4049 4049
 		$struct = array();
4050 4050
 
4051
-		foreach( $post_types as $post_type ) {
4052
-			if ( ! current_user_can( $post_type->cap->edit_posts ) )
4051
+		foreach ($post_types as $post_type) {
4052
+			if ( ! current_user_can($post_type->cap->edit_posts))
4053 4053
 				continue;
4054 4054
 
4055
-			$struct[$post_type->name] = $this->_prepare_post_type( $post_type, $fields );
4055
+			$struct[$post_type->name] = $this->_prepare_post_type($post_type, $fields);
4056 4056
 		}
4057 4057
 
4058 4058
 		return $struct;
@@ -4080,17 +4080,17 @@  discard block
 block discarded – undo
4080 4080
 	 * }
4081 4081
 	 * @return array|IXR_Error contains a collection of posts.
4082 4082
 	 */
4083
-	public function wp_getRevisions( $args ) {
4084
-		if ( ! $this->minimum_args( $args, 4 ) )
4083
+	public function wp_getRevisions($args) {
4084
+		if ( ! $this->minimum_args($args, 4))
4085 4085
 			return $this->error;
4086 4086
 
4087
-		$this->escape( $args );
4087
+		$this->escape($args);
4088 4088
 
4089 4089
 		$username = $args[1];
4090 4090
 		$password = $args[2];
4091 4091
 		$post_id  = (int) $args[3];
4092 4092
 
4093
-		if ( isset( $args[4] ) ) {
4093
+		if (isset($args[4])) {
4094 4094
 			$fields = $args[4];
4095 4095
 		} else {
4096 4096
 			/**
@@ -4101,41 +4101,41 @@  discard block
 block discarded – undo
4101 4101
 			 * @param array  $field  An array of revision query fields.
4102 4102
 			 * @param string $method The method name.
4103 4103
 			 */
4104
-			$fields = apply_filters( 'xmlrpc_default_revision_fields', array( 'post_date', 'post_date_gmt' ), 'wp.getRevisions' );
4104
+			$fields = apply_filters('xmlrpc_default_revision_fields', array('post_date', 'post_date_gmt'), 'wp.getRevisions');
4105 4105
 		}
4106 4106
 
4107
-		if ( ! $user = $this->login( $username, $password ) )
4107
+		if ( ! $user = $this->login($username, $password))
4108 4108
 			return $this->error;
4109 4109
 
4110 4110
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
4111
-		do_action( 'xmlrpc_call', 'wp.getRevisions' );
4111
+		do_action('xmlrpc_call', 'wp.getRevisions');
4112 4112
 
4113
-		if ( ! $post = get_post( $post_id ) )
4114
-			return new IXR_Error( 404, __( 'Invalid post ID.' ) );
4113
+		if ( ! $post = get_post($post_id))
4114
+			return new IXR_Error(404, __('Invalid post ID.'));
4115 4115
 
4116
-		if ( ! current_user_can( 'edit_post', $post_id ) )
4117
-			return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit posts.' ) );
4116
+		if ( ! current_user_can('edit_post', $post_id))
4117
+			return new IXR_Error(401, __('Sorry, you are not allowed to edit posts.'));
4118 4118
 
4119 4119
 		// Check if revisions are enabled.
4120
-		if ( ! wp_revisions_enabled( $post ) )
4121
-			return new IXR_Error( 401, __( 'Sorry, revisions are disabled.' ) );
4120
+		if ( ! wp_revisions_enabled($post))
4121
+			return new IXR_Error(401, __('Sorry, revisions are disabled.'));
4122 4122
 
4123
-		$revisions = wp_get_post_revisions( $post_id );
4123
+		$revisions = wp_get_post_revisions($post_id);
4124 4124
 
4125
-		if ( ! $revisions )
4125
+		if ( ! $revisions)
4126 4126
 			return array();
4127 4127
 
4128 4128
 		$struct = array();
4129 4129
 
4130
-		foreach ( $revisions as $revision ) {
4131
-			if ( ! current_user_can( 'read_post', $revision->ID ) )
4130
+		foreach ($revisions as $revision) {
4131
+			if ( ! current_user_can('read_post', $revision->ID))
4132 4132
 				continue;
4133 4133
 
4134 4134
 			// Skip autosaves
4135
-			if ( wp_is_post_autosave( $revision ) )
4135
+			if (wp_is_post_autosave($revision))
4136 4136
 				continue;
4137 4137
 
4138
-			$struct[] = $this->_prepare_post( get_object_vars( $revision ), $fields );
4138
+			$struct[] = $this->_prepare_post(get_object_vars($revision), $fields);
4139 4139
 		}
4140 4140
 
4141 4141
 		return $struct;
@@ -4158,39 +4158,39 @@  discard block
 block discarded – undo
4158 4158
 	 * }
4159 4159
 	 * @return bool|IXR_Error false if there was an error restoring, true if success.
4160 4160
 	 */
4161
-	public function wp_restoreRevision( $args ) {
4162
-		if ( ! $this->minimum_args( $args, 3 ) )
4161
+	public function wp_restoreRevision($args) {
4162
+		if ( ! $this->minimum_args($args, 3))
4163 4163
 			return $this->error;
4164 4164
 
4165
-		$this->escape( $args );
4165
+		$this->escape($args);
4166 4166
 
4167 4167
 		$username    = $args[1];
4168 4168
 		$password    = $args[2];
4169 4169
 		$revision_id = (int) $args[3];
4170 4170
 
4171
-		if ( ! $user = $this->login( $username, $password ) )
4171
+		if ( ! $user = $this->login($username, $password))
4172 4172
 			return $this->error;
4173 4173
 
4174 4174
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
4175
-		do_action( 'xmlrpc_call', 'wp.restoreRevision' );
4175
+		do_action('xmlrpc_call', 'wp.restoreRevision');
4176 4176
 
4177
-		if ( ! $revision = wp_get_post_revision( $revision_id ) )
4178
-			return new IXR_Error( 404, __( 'Invalid post ID.' ) );
4177
+		if ( ! $revision = wp_get_post_revision($revision_id))
4178
+			return new IXR_Error(404, __('Invalid post ID.'));
4179 4179
 
4180
-		if ( wp_is_post_autosave( $revision ) )
4181
-			return new IXR_Error( 404, __( 'Invalid post ID.' ) );
4180
+		if (wp_is_post_autosave($revision))
4181
+			return new IXR_Error(404, __('Invalid post ID.'));
4182 4182
 
4183
-		if ( ! $post = get_post( $revision->post_parent ) )
4184
-			return new IXR_Error( 404, __( 'Invalid post ID.' ) );
4183
+		if ( ! $post = get_post($revision->post_parent))
4184
+			return new IXR_Error(404, __('Invalid post ID.'));
4185 4185
 
4186
-		if ( ! current_user_can( 'edit_post', $revision->post_parent ) )
4187
-			return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) );
4186
+		if ( ! current_user_can('edit_post', $revision->post_parent))
4187
+			return new IXR_Error(401, __('Sorry, you cannot edit this post.'));
4188 4188
 
4189 4189
 		// Check if revisions are disabled.
4190
-		if ( ! wp_revisions_enabled( $post ) )
4191
-			return new IXR_Error( 401, __( 'Sorry, revisions are disabled.' ) );
4190
+		if ( ! wp_revisions_enabled($post))
4191
+			return new IXR_Error(401, __('Sorry, revisions are disabled.'));
4192 4192
 
4193
-		$post = wp_restore_post_revision( $revision_id );
4193
+		$post = wp_restore_post_revision($revision_id);
4194 4194
 
4195 4195
 		return (bool) $post;
4196 4196
 	}
@@ -4216,7 +4216,7 @@  discard block
 block discarded – undo
4216 4216
 	 * @return array|IXR_Error
4217 4217
 	 */
4218 4218
 	public function blogger_getUsersBlogs($args) {
4219
-		if ( is_multisite() )
4219
+		if (is_multisite())
4220 4220
 			return $this->_multisite_getUsersBlogs($args);
4221 4221
 
4222 4222
 		$this->escape($args);
@@ -4224,20 +4224,20 @@  discard block
 block discarded – undo
4224 4224
 		$username = $args[1];
4225 4225
 		$password = $args[2];
4226 4226
 
4227
-		if ( !$user = $this->login($username, $password) )
4227
+		if ( ! $user = $this->login($username, $password))
4228 4228
 			return $this->error;
4229 4229
 
4230 4230
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
4231
-		do_action( 'xmlrpc_call', 'blogger.getUsersBlogs' );
4231
+		do_action('xmlrpc_call', 'blogger.getUsersBlogs');
4232 4232
 
4233 4233
 		$is_admin = current_user_can('manage_options');
4234 4234
 
4235 4235
 		$struct = array(
4236 4236
 			'isAdmin'  => $is_admin,
4237
-			'url'      => get_option('home') . '/',
4237
+			'url'      => get_option('home').'/',
4238 4238
 			'blogid'   => '1',
4239 4239
 			'blogName' => get_option('blogname'),
4240
-			'xmlrpc'   => site_url( 'xmlrpc.php', 'rpc' ),
4240
+			'xmlrpc'   => site_url('xmlrpc.php', 'rpc'),
4241 4241
 		);
4242 4242
 
4243 4243
 		return array($struct);
@@ -4254,20 +4254,20 @@  discard block
 block discarded – undo
4254 4254
 		$current_blog = get_blog_details();
4255 4255
 
4256 4256
 		$domain = $current_blog->domain;
4257
-		$path = $current_blog->path . 'xmlrpc.php';
4257
+		$path = $current_blog->path.'xmlrpc.php';
4258 4258
 
4259
-		$rpc = new IXR_Client( set_url_scheme( "http://{$domain}{$path}" ) );
4259
+		$rpc = new IXR_Client(set_url_scheme("http://{$domain}{$path}"));
4260 4260
 		$rpc->query('wp.getUsersBlogs', $args[1], $args[2]);
4261 4261
 		$blogs = $rpc->getResponse();
4262 4262
 
4263
-		if ( isset($blogs['faultCode']) )
4263
+		if (isset($blogs['faultCode']))
4264 4264
 			return new IXR_Error($blogs['faultCode'], $blogs['faultString']);
4265 4265
 
4266
-		if ( $_SERVER['HTTP_HOST'] == $domain && $_SERVER['REQUEST_URI'] == $path ) {
4266
+		if ($_SERVER['HTTP_HOST'] == $domain && $_SERVER['REQUEST_URI'] == $path) {
4267 4267
 			return $blogs;
4268 4268
 		} else {
4269
-			foreach ( (array) $blogs as $blog ) {
4270
-				if ( strpos($blog['url'], $_SERVER['HTTP_HOST']) )
4269
+			foreach ((array) $blogs as $blog) {
4270
+				if (strpos($blog['url'], $_SERVER['HTTP_HOST']))
4271 4271
 					return array($blog);
4272 4272
 			}
4273 4273
 			return array();
@@ -4290,20 +4290,20 @@  discard block
 block discarded – undo
4290 4290
 	 * }
4291 4291
 	 * @return array|IXR_Error
4292 4292
 	 */
4293
-	public function blogger_getUserInfo( $args ) {
4294
-		$this->escape( $args );
4293
+	public function blogger_getUserInfo($args) {
4294
+		$this->escape($args);
4295 4295
 
4296 4296
 		$username = $args[1];
4297 4297
 		$password = $args[2];
4298 4298
 
4299
-		if ( !$user = $this->login($username, $password) )
4299
+		if ( ! $user = $this->login($username, $password))
4300 4300
 			return $this->error;
4301 4301
 
4302
-		if ( !current_user_can( 'edit_posts' ) )
4303
-			return new IXR_Error( 401, __( 'Sorry, you do not have access to user data on this site.' ) );
4302
+		if ( ! current_user_can('edit_posts'))
4303
+			return new IXR_Error(401, __('Sorry, you do not have access to user data on this site.'));
4304 4304
 
4305 4305
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
4306
-		do_action( 'xmlrpc_call', 'blogger.getUserInfo' );
4306
+		do_action('xmlrpc_call', 'blogger.getUserInfo');
4307 4307
 
4308 4308
 		$struct = array(
4309 4309
 			'nickname'  => $user->nickname,
@@ -4331,25 +4331,25 @@  discard block
 block discarded – undo
4331 4331
 	 * }
4332 4332
 	 * @return array|IXR_Error
4333 4333
 	 */
4334
-	public function blogger_getPost( $args ) {
4335
-		$this->escape( $args );
4334
+	public function blogger_getPost($args) {
4335
+		$this->escape($args);
4336 4336
 
4337 4337
 		$post_ID  = (int) $args[1];
4338 4338
 		$username = $args[2];
4339 4339
 		$password = $args[3];
4340 4340
 
4341
-		if ( !$user = $this->login($username, $password) )
4341
+		if ( ! $user = $this->login($username, $password))
4342 4342
 			return $this->error;
4343 4343
 
4344 4344
 		$post_data = get_post($post_ID, ARRAY_A);
4345
-		if ( ! $post_data )
4346
-			return new IXR_Error( 404, __( 'Invalid post ID.' ) );
4345
+		if ( ! $post_data)
4346
+			return new IXR_Error(404, __('Invalid post ID.'));
4347 4347
 
4348
-		if ( !current_user_can( 'edit_post', $post_ID ) )
4349
-			return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) );
4348
+		if ( ! current_user_can('edit_post', $post_ID))
4349
+			return new IXR_Error(401, __('Sorry, you cannot edit this post.'));
4350 4350
 
4351 4351
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
4352
-		do_action( 'xmlrpc_call', 'blogger.getPost' );
4352
+		do_action('xmlrpc_call', 'blogger.getPost');
4353 4353
 
4354 4354
 		$categories = implode(',', wp_get_post_categories($post_ID));
4355 4355
 
@@ -4359,7 +4359,7 @@  discard block
 block discarded – undo
4359 4359
 
4360 4360
 		$struct = array(
4361 4361
 			'userid'    => $post_data['post_author'],
4362
-			'dateCreated' => $this->_convert_date( $post_data['post_date'] ),
4362
+			'dateCreated' => $this->_convert_date($post_data['post_date']),
4363 4363
 			'content'     => $content,
4364 4364
 			'postid'  => (string) $post_data['ID']
4365 4365
 		);
@@ -4383,40 +4383,40 @@  discard block
 block discarded – undo
4383 4383
 	 * }
4384 4384
 	 * @return array|IXR_Error
4385 4385
 	 */
4386
-	public function blogger_getRecentPosts( $args ) {
4386
+	public function blogger_getRecentPosts($args) {
4387 4387
 
4388 4388
 		$this->escape($args);
4389 4389
 
4390 4390
 		// $args[0] = appkey - ignored
4391 4391
 		$username = $args[2];
4392 4392
 		$password = $args[3];
4393
-		if ( isset( $args[4] ) )
4394
-			$query = array( 'numberposts' => absint( $args[4] ) );
4393
+		if (isset($args[4]))
4394
+			$query = array('numberposts' => absint($args[4]));
4395 4395
 		else
4396 4396
 			$query = array();
4397 4397
 
4398
-		if ( !$user = $this->login($username, $password) )
4398
+		if ( ! $user = $this->login($username, $password))
4399 4399
 			return $this->error;
4400 4400
 
4401
-		if ( ! current_user_can( 'edit_posts' ) )
4402
-			return new IXR_Error( 401, __( 'Sorry, you cannot edit posts on this site.' ) );
4401
+		if ( ! current_user_can('edit_posts'))
4402
+			return new IXR_Error(401, __('Sorry, you cannot edit posts on this site.'));
4403 4403
 
4404 4404
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
4405
-		do_action( 'xmlrpc_call', 'blogger.getRecentPosts' );
4405
+		do_action('xmlrpc_call', 'blogger.getRecentPosts');
4406 4406
 
4407
-		$posts_list = wp_get_recent_posts( $query );
4407
+		$posts_list = wp_get_recent_posts($query);
4408 4408
 
4409
-		if ( !$posts_list ) {
4409
+		if ( ! $posts_list) {
4410 4410
 			$this->error = new IXR_Error(500, __('Either there are no posts, or something went wrong.'));
4411 4411
 			return $this->error;
4412 4412
 		}
4413 4413
 
4414 4414
 		$recent_posts = array();
4415 4415
 		foreach ($posts_list as $entry) {
4416
-			if ( !current_user_can( 'edit_post', $entry['ID'] ) )
4416
+			if ( ! current_user_can('edit_post', $entry['ID']))
4417 4417
 				continue;
4418 4418
 
4419
-			$post_date  = $this->_convert_date( $entry['post_date'] );
4419
+			$post_date  = $this->_convert_date($entry['post_date']);
4420 4420
 			$categories = implode(',', wp_get_post_categories($entry['ID']));
4421 4421
 
4422 4422
 			$content  = '<title>'.wp_unslash($entry['post_title']).'</title>';
@@ -4442,7 +4442,7 @@  discard block
 block discarded – undo
4442 4442
 	 * @return IXR_Error
4443 4443
 	 */
4444 4444
 	public function blogger_getTemplate($args) {
4445
-		return new IXR_Error( 403, __('Sorry, that file cannot be edited.' ) );
4445
+		return new IXR_Error(403, __('Sorry, that file cannot be edited.'));
4446 4446
 	}
4447 4447
 
4448 4448
 	/**
@@ -4453,7 +4453,7 @@  discard block
 block discarded – undo
4453 4453
 	 * @return IXR_Error
4454 4454
 	 */
4455 4455
 	public function blogger_setTemplate($args) {
4456
-		return new IXR_Error( 403, __('Sorry, that file cannot be edited.' ) );
4456
+		return new IXR_Error(403, __('Sorry, that file cannot be edited.'));
4457 4457
 	}
4458 4458
 
4459 4459
 	/**
@@ -4473,22 +4473,22 @@  discard block
 block discarded – undo
4473 4473
 	 * }
4474 4474
 	 * @return int|IXR_Error
4475 4475
 	 */
4476
-	public function blogger_newPost( $args ) {
4477
-		$this->escape( $args );
4476
+	public function blogger_newPost($args) {
4477
+		$this->escape($args);
4478 4478
 
4479 4479
 		$username = $args[2];
4480 4480
 		$password = $args[3];
4481 4481
 		$content  = $args[4];
4482 4482
 		$publish  = $args[5];
4483 4483
 
4484
-		if ( !$user = $this->login($username, $password) )
4484
+		if ( ! $user = $this->login($username, $password))
4485 4485
 			return $this->error;
4486 4486
 
4487 4487
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
4488
-		do_action( 'xmlrpc_call', 'blogger.newPost' );
4488
+		do_action('xmlrpc_call', 'blogger.newPost');
4489 4489
 
4490 4490
 		$cap = ($publish) ? 'publish_posts' : 'edit_posts';
4491
-		if ( ! current_user_can( get_post_type_object( 'post' )->cap->create_posts ) || !current_user_can($cap) )
4491
+		if ( ! current_user_can(get_post_type_object('post')->cap->create_posts) || ! current_user_can($cap))
4492 4492
 			return new IXR_Error(401, __('Sorry, you are not allowed to post on this site.'));
4493 4493
 
4494 4494
 		$post_status = ($publish) ? 'publish' : 'draft';
@@ -4505,13 +4505,13 @@  discard block
 block discarded – undo
4505 4505
 		$post_data = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status');
4506 4506
 
4507 4507
 		$post_ID = wp_insert_post($post_data);
4508
-		if ( is_wp_error( $post_ID ) )
4508
+		if (is_wp_error($post_ID))
4509 4509
 			return new IXR_Error(500, $post_ID->get_error_message());
4510 4510
 
4511
-		if ( !$post_ID )
4511
+		if ( ! $post_ID)
4512 4512
 			return new IXR_Error(500, __('Sorry, your entry could not be posted. Something wrong happened.'));
4513 4513
 
4514
-		$this->attach_uploads( $post_ID, $post_content );
4514
+		$this->attach_uploads($post_ID, $post_content);
4515 4515
 
4516 4516
 		/**
4517 4517
 		 * Fires after a new post has been successfully created via the XML-RPC Blogger API.
@@ -4521,7 +4521,7 @@  discard block
 block discarded – undo
4521 4521
 		 * @param int   $post_ID ID of the new post.
4522 4522
 		 * @param array $args    An array of new post arguments.
4523 4523
 		 */
4524
-		do_action( 'xmlrpc_call_success_blogger_newPost', $post_ID, $args );
4524
+		do_action('xmlrpc_call_success_blogger_newPost', $post_ID, $args);
4525 4525
 
4526 4526
 		return $post_ID;
4527 4527
 	}
@@ -4542,7 +4542,7 @@  discard block
 block discarded – undo
4542 4542
 	 * }
4543 4543
 	 * @return true|IXR_Error true when done.
4544 4544
 	 */
4545
-	public function blogger_editPost( $args ) {
4545
+	public function blogger_editPost($args) {
4546 4546
 
4547 4547
 		$this->escape($args);
4548 4548
 
@@ -4551,42 +4551,42 @@  discard block
 block discarded – undo
4551 4551
 		$password = $args[3];
4552 4552
 		$content  = $args[4];
4553 4553
 
4554
-		if ( ! $user = $this->login( $username, $password ) ) {
4554
+		if ( ! $user = $this->login($username, $password)) {
4555 4555
 			return $this->error;
4556 4556
 		}
4557 4557
 
4558 4558
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
4559
-		do_action( 'xmlrpc_call', 'blogger.editPost' );
4559
+		do_action('xmlrpc_call', 'blogger.editPost');
4560 4560
 
4561
-		$actual_post = get_post( $post_ID, ARRAY_A );
4561
+		$actual_post = get_post($post_ID, ARRAY_A);
4562 4562
 
4563
-		if ( ! $actual_post || $actual_post['post_type'] != 'post' ) {
4564
-			return new IXR_Error( 404, __( 'Sorry, no such post.' ) );
4563
+		if ( ! $actual_post || $actual_post['post_type'] != 'post') {
4564
+			return new IXR_Error(404, __('Sorry, no such post.'));
4565 4565
 		}
4566 4566
 
4567 4567
 		$this->escape($actual_post);
4568 4568
 
4569
-		if ( ! current_user_can( 'edit_post', $post_ID ) ) {
4569
+		if ( ! current_user_can('edit_post', $post_ID)) {
4570 4570
 			return new IXR_Error(401, __('Sorry, you do not have the right to edit this post.'));
4571 4571
 		}
4572
-		if ( 'publish' == $actual_post['post_status'] && ! current_user_can( 'publish_posts' ) ) {
4573
-			return new IXR_Error( 401, __( 'Sorry, you do not have the right to publish this post.' ) );
4572
+		if ('publish' == $actual_post['post_status'] && ! current_user_can('publish_posts')) {
4573
+			return new IXR_Error(401, __('Sorry, you do not have the right to publish this post.'));
4574 4574
 		}
4575 4575
 
4576 4576
 		$postdata = array();
4577 4577
 		$postdata['ID'] = $actual_post['ID'];
4578
-		$postdata['post_content'] = xmlrpc_removepostdata( $content );
4579
-		$postdata['post_title'] = xmlrpc_getposttitle( $content );
4580
-		$postdata['post_category'] = xmlrpc_getpostcategory( $content );
4578
+		$postdata['post_content'] = xmlrpc_removepostdata($content);
4579
+		$postdata['post_title'] = xmlrpc_getposttitle($content);
4580
+		$postdata['post_category'] = xmlrpc_getpostcategory($content);
4581 4581
 		$postdata['post_status'] = $actual_post['post_status'];
4582 4582
 		$postdata['post_excerpt'] = $actual_post['post_excerpt'];
4583 4583
 
4584
-		$result = wp_update_post( $postdata );
4584
+		$result = wp_update_post($postdata);
4585 4585
 
4586
-		if ( ! $result ) {
4586
+		if ( ! $result) {
4587 4587
 			return new IXR_Error(500, __('For some strange yet very annoying reason, this post could not be edited.'));
4588 4588
 		}
4589
-		$this->attach_uploads( $actual_post['ID'], $postdata['post_content'] );
4589
+		$this->attach_uploads($actual_post['ID'], $postdata['post_content']);
4590 4590
 
4591 4591
 		/**
4592 4592
 		 * Fires after a post has been successfully updated via the XML-RPC Blogger API.
@@ -4596,7 +4596,7 @@  discard block
 block discarded – undo
4596 4596
 		 * @param int   $post_ID ID of the updated post.
4597 4597
 		 * @param array $args    An array of arguments for the post to edit.
4598 4598
 		 */
4599
-		do_action( 'xmlrpc_call_success_blogger_editPost', $post_ID, $args );
4599
+		do_action('xmlrpc_call_success_blogger_editPost', $post_ID, $args);
4600 4600
 
4601 4601
 		return true;
4602 4602
 	}
@@ -4616,30 +4616,30 @@  discard block
 block discarded – undo
4616 4616
 	 * }
4617 4617
 	 * @return true|IXR_Error True when post is deleted.
4618 4618
 	 */
4619
-	public function blogger_deletePost( $args ) {
4620
-		$this->escape( $args );
4619
+	public function blogger_deletePost($args) {
4620
+		$this->escape($args);
4621 4621
 
4622 4622
 		$post_ID  = (int) $args[1];
4623 4623
 		$username = $args[2];
4624 4624
 		$password = $args[3];
4625 4625
 
4626
-		if ( !$user = $this->login($username, $password) )
4626
+		if ( ! $user = $this->login($username, $password))
4627 4627
 			return $this->error;
4628 4628
 
4629 4629
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
4630
-		do_action( 'xmlrpc_call', 'blogger.deletePost' );
4630
+		do_action('xmlrpc_call', 'blogger.deletePost');
4631 4631
 
4632
-		$actual_post = get_post($post_ID,ARRAY_A);
4632
+		$actual_post = get_post($post_ID, ARRAY_A);
4633 4633
 
4634
-		if ( !$actual_post || $actual_post['post_type'] != 'post' )
4634
+		if ( ! $actual_post || $actual_post['post_type'] != 'post')
4635 4635
 			return new IXR_Error(404, __('Sorry, no such post.'));
4636 4636
 
4637
-		if ( !current_user_can('delete_post', $post_ID) )
4637
+		if ( ! current_user_can('delete_post', $post_ID))
4638 4638
 			return new IXR_Error(401, __('Sorry, you do not have the right to delete this post.'));
4639 4639
 
4640 4640
 		$result = wp_delete_post($post_ID);
4641 4641
 
4642
-		if ( !$result )
4642
+		if ( ! $result)
4643 4643
 			return new IXR_Error(500, __('For some strange yet very annoying reason, this post could not be deleted.'));
4644 4644
 
4645 4645
 		/**
@@ -4650,7 +4650,7 @@  discard block
 block discarded – undo
4650 4650
 		 * @param int   $post_ID ID of the deleted post.
4651 4651
 		 * @param array $args    An array of arguments to delete the post.
4652 4652
 		 */
4653
-		do_action( 'xmlrpc_call_success_blogger_deletePost', $post_ID, $args );
4653
+		do_action('xmlrpc_call_success_blogger_deletePost', $post_ID, $args);
4654 4654
 
4655 4655
 		return true;
4656 4656
 	}
@@ -4703,111 +4703,111 @@  discard block
 block discarded – undo
4703 4703
 		$username       = $args[1];
4704 4704
 		$password       = $args[2];
4705 4705
 		$content_struct = $args[3];
4706
-		$publish        = isset( $args[4] ) ? $args[4] : 0;
4706
+		$publish        = isset($args[4]) ? $args[4] : 0;
4707 4707
 
4708
-		if ( !$user = $this->login($username, $password) )
4708
+		if ( ! $user = $this->login($username, $password))
4709 4709
 			return $this->error;
4710 4710
 
4711 4711
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
4712
-		do_action( 'xmlrpc_call', 'metaWeblog.newPost' );
4712
+		do_action('xmlrpc_call', 'metaWeblog.newPost');
4713 4713
 
4714 4714
 		$page_template = '';
4715
-		if ( !empty( $content_struct['post_type'] ) ) {
4716
-			if ( $content_struct['post_type'] == 'page' ) {
4717
-				if ( $publish )
4715
+		if ( ! empty($content_struct['post_type'])) {
4716
+			if ($content_struct['post_type'] == 'page') {
4717
+				if ($publish)
4718 4718
 					$cap  = 'publish_pages';
4719
-				elseif ( isset( $content_struct['page_status'] ) && 'publish' == $content_struct['page_status'] )
4719
+				elseif (isset($content_struct['page_status']) && 'publish' == $content_struct['page_status'])
4720 4720
 					$cap  = 'publish_pages';
4721 4721
 				else
4722 4722
 					$cap = 'edit_pages';
4723
-				$error_message = __( 'Sorry, you are not allowed to publish pages on this site.' );
4723
+				$error_message = __('Sorry, you are not allowed to publish pages on this site.');
4724 4724
 				$post_type = 'page';
4725
-				if ( !empty( $content_struct['wp_page_template'] ) )
4725
+				if ( ! empty($content_struct['wp_page_template']))
4726 4726
 					$page_template = $content_struct['wp_page_template'];
4727
-			} elseif ( $content_struct['post_type'] == 'post' ) {
4728
-				if ( $publish )
4727
+			} elseif ($content_struct['post_type'] == 'post') {
4728
+				if ($publish)
4729 4729
 					$cap  = 'publish_posts';
4730
-				elseif ( isset( $content_struct['post_status'] ) && 'publish' == $content_struct['post_status'] )
4730
+				elseif (isset($content_struct['post_status']) && 'publish' == $content_struct['post_status'])
4731 4731
 					$cap  = 'publish_posts';
4732 4732
 				else
4733 4733
 					$cap = 'edit_posts';
4734
-				$error_message = __( 'Sorry, you are not allowed to publish posts on this site.' );
4734
+				$error_message = __('Sorry, you are not allowed to publish posts on this site.');
4735 4735
 				$post_type = 'post';
4736 4736
 			} else {
4737 4737
 				// No other post_type values are allowed here
4738
-				return new IXR_Error( 401, __( 'Invalid post type' ) );
4738
+				return new IXR_Error(401, __('Invalid post type'));
4739 4739
 			}
4740 4740
 		} else {
4741
-			if ( $publish )
4741
+			if ($publish)
4742 4742
 				$cap  = 'publish_posts';
4743
-			elseif ( isset( $content_struct['post_status'] ) && 'publish' == $content_struct['post_status'])
4743
+			elseif (isset($content_struct['post_status']) && 'publish' == $content_struct['post_status'])
4744 4744
 				$cap  = 'publish_posts';
4745 4745
 			else
4746 4746
 				$cap = 'edit_posts';
4747
-			$error_message = __( 'Sorry, you are not allowed to publish posts on this site.' );
4747
+			$error_message = __('Sorry, you are not allowed to publish posts on this site.');
4748 4748
 			$post_type = 'post';
4749 4749
 		}
4750 4750
 
4751
-		if ( ! current_user_can( get_post_type_object( $post_type )->cap->create_posts ) )
4752
-			return new IXR_Error( 401, __( 'Sorry, you are not allowed to publish posts on this site.' ) );
4753
-		if ( !current_user_can( $cap ) )
4754
-			return new IXR_Error( 401, $error_message );
4751
+		if ( ! current_user_can(get_post_type_object($post_type)->cap->create_posts))
4752
+			return new IXR_Error(401, __('Sorry, you are not allowed to publish posts on this site.'));
4753
+		if ( ! current_user_can($cap))
4754
+			return new IXR_Error(401, $error_message);
4755 4755
 
4756 4756
 		// Check for a valid post format if one was given
4757
-		if ( isset( $content_struct['wp_post_format'] ) ) {
4758
-			$content_struct['wp_post_format'] = sanitize_key( $content_struct['wp_post_format'] );
4759
-			if ( !array_key_exists( $content_struct['wp_post_format'], get_post_format_strings() ) ) {
4760
-				return new IXR_Error( 404, __( 'Invalid post format' ) );
4757
+		if (isset($content_struct['wp_post_format'])) {
4758
+			$content_struct['wp_post_format'] = sanitize_key($content_struct['wp_post_format']);
4759
+			if ( ! array_key_exists($content_struct['wp_post_format'], get_post_format_strings())) {
4760
+				return new IXR_Error(404, __('Invalid post format'));
4761 4761
 			}
4762 4762
 		}
4763 4763
 
4764 4764
 		// Let WordPress generate the post_name (slug) unless
4765 4765
 		// one has been provided.
4766 4766
 		$post_name = "";
4767
-		if ( isset($content_struct['wp_slug']) )
4767
+		if (isset($content_struct['wp_slug']))
4768 4768
 			$post_name = $content_struct['wp_slug'];
4769 4769
 
4770 4770
 		// Only use a password if one was given.
4771
-		if ( isset($content_struct['wp_password']) )
4771
+		if (isset($content_struct['wp_password']))
4772 4772
 			$post_password = $content_struct['wp_password'];
4773 4773
 
4774 4774
 		// Only set a post parent if one was provided.
4775
-		if ( isset($content_struct['wp_page_parent_id']) )
4775
+		if (isset($content_struct['wp_page_parent_id']))
4776 4776
 			$post_parent = $content_struct['wp_page_parent_id'];
4777 4777
 
4778 4778
 		// Only set the menu_order if it was provided.
4779
-		if ( isset($content_struct['wp_page_order']) )
4779
+		if (isset($content_struct['wp_page_order']))
4780 4780
 			$menu_order = $content_struct['wp_page_order'];
4781 4781
 
4782 4782
 		$post_author = $user->ID;
4783 4783
 
4784 4784
 		// If an author id was provided then use it instead.
4785
-		if ( isset( $content_struct['wp_author_id'] ) && ( $user->ID != $content_struct['wp_author_id'] ) ) {
4786
-			switch ( $post_type ) {
4785
+		if (isset($content_struct['wp_author_id']) && ($user->ID != $content_struct['wp_author_id'])) {
4786
+			switch ($post_type) {
4787 4787
 				case "post":
4788
-					if ( !current_user_can( 'edit_others_posts' ) )
4789
-						return new IXR_Error( 401, __( 'You are not allowed to create posts as this user.' ) );
4788
+					if ( ! current_user_can('edit_others_posts'))
4789
+						return new IXR_Error(401, __('You are not allowed to create posts as this user.'));
4790 4790
 					break;
4791 4791
 				case "page":
4792
-					if ( !current_user_can( 'edit_others_pages' ) )
4793
-						return new IXR_Error( 401, __( 'You are not allowed to create pages as this user.' ) );
4792
+					if ( ! current_user_can('edit_others_pages'))
4793
+						return new IXR_Error(401, __('You are not allowed to create pages as this user.'));
4794 4794
 					break;
4795 4795
 				default:
4796
-					return new IXR_Error( 401, __( 'Invalid post type' ) );
4796
+					return new IXR_Error(401, __('Invalid post type'));
4797 4797
 			}
4798
-			$author = get_userdata( $content_struct['wp_author_id'] );
4799
-			if ( ! $author )
4800
-				return new IXR_Error( 404, __( 'Invalid author ID.' ) );
4798
+			$author = get_userdata($content_struct['wp_author_id']);
4799
+			if ( ! $author)
4800
+				return new IXR_Error(404, __('Invalid author ID.'));
4801 4801
 			$post_author = $content_struct['wp_author_id'];
4802 4802
 		}
4803 4803
 
4804
-		$post_title = isset( $content_struct['title'] ) ? $content_struct['title'] : null;
4805
-		$post_content = isset( $content_struct['description'] ) ? $content_struct['description'] : null;
4804
+		$post_title = isset($content_struct['title']) ? $content_struct['title'] : null;
4805
+		$post_content = isset($content_struct['description']) ? $content_struct['description'] : null;
4806 4806
 
4807 4807
 		$post_status = $publish ? 'publish' : 'draft';
4808 4808
 
4809
-		if ( isset( $content_struct["{$post_type}_status"] ) ) {
4810
-			switch ( $content_struct["{$post_type}_status"] ) {
4809
+		if (isset($content_struct["{$post_type}_status"])) {
4810
+			switch ($content_struct["{$post_type}_status"]) {
4811 4811
 				case 'draft':
4812 4812
 				case 'pending':
4813 4813
 				case 'private':
@@ -4825,9 +4825,9 @@  discard block
 block discarded – undo
4825 4825
 
4826 4826
 		$tags_input = isset($content_struct['mt_keywords']) ? $content_struct['mt_keywords'] : null;
4827 4827
 
4828
-		if ( isset($content_struct['mt_allow_comments']) ) {
4829
-			if ( !is_numeric($content_struct['mt_allow_comments']) ) {
4830
-				switch ( $content_struct['mt_allow_comments'] ) {
4828
+		if (isset($content_struct['mt_allow_comments'])) {
4829
+			if ( ! is_numeric($content_struct['mt_allow_comments'])) {
4830
+				switch ($content_struct['mt_allow_comments']) {
4831 4831
 					case 'closed':
4832 4832
 						$comment_status = 'closed';
4833 4833
 						break;
@@ -4835,11 +4835,11 @@  discard block
 block discarded – undo
4835 4835
 						$comment_status = 'open';
4836 4836
 						break;
4837 4837
 					default:
4838
-						$comment_status = get_default_comment_status( $post_type );
4838
+						$comment_status = get_default_comment_status($post_type);
4839 4839
 						break;
4840 4840
 				}
4841 4841
 			} else {
4842
-				switch ( (int) $content_struct['mt_allow_comments'] ) {
4842
+				switch ((int) $content_struct['mt_allow_comments']) {
4843 4843
 					case 0:
4844 4844
 					case 2:
4845 4845
 						$comment_status = 'closed';
@@ -4848,17 +4848,17 @@  discard block
 block discarded – undo
4848 4848
 						$comment_status = 'open';
4849 4849
 						break;
4850 4850
 					default:
4851
-						$comment_status = get_default_comment_status( $post_type );
4851
+						$comment_status = get_default_comment_status($post_type);
4852 4852
 						break;
4853 4853
 				}
4854 4854
 			}
4855 4855
 		} else {
4856
-			$comment_status = get_default_comment_status( $post_type );
4856
+			$comment_status = get_default_comment_status($post_type);
4857 4857
 		}
4858 4858
 
4859
-		if ( isset($content_struct['mt_allow_pings']) ) {
4860
-			if ( !is_numeric($content_struct['mt_allow_pings']) ) {
4861
-				switch ( $content_struct['mt_allow_pings'] ) {
4859
+		if (isset($content_struct['mt_allow_pings'])) {
4860
+			if ( ! is_numeric($content_struct['mt_allow_pings'])) {
4861
+				switch ($content_struct['mt_allow_pings']) {
4862 4862
 					case 'closed':
4863 4863
 						$ping_status = 'closed';
4864 4864
 						break;
@@ -4866,11 +4866,11 @@  discard block
 block discarded – undo
4866 4866
 						$ping_status = 'open';
4867 4867
 						break;
4868 4868
 					default:
4869
-						$ping_status = get_default_comment_status( $post_type, 'pingback' );
4869
+						$ping_status = get_default_comment_status($post_type, 'pingback');
4870 4870
 						break;
4871 4871
 				}
4872 4872
 			} else {
4873
-				switch ( (int) $content_struct['mt_allow_pings'] ) {
4873
+				switch ((int) $content_struct['mt_allow_pings']) {
4874 4874
 					case 0:
4875 4875
 						$ping_status = 'closed';
4876 4876
 						break;
@@ -4878,32 +4878,32 @@  discard block
 block discarded – undo
4878 4878
 						$ping_status = 'open';
4879 4879
 						break;
4880 4880
 					default:
4881
-						$ping_status = get_default_comment_status( $post_type, 'pingback' );
4881
+						$ping_status = get_default_comment_status($post_type, 'pingback');
4882 4882
 						break;
4883 4883
 				}
4884 4884
 			}
4885 4885
 		} else {
4886
-			$ping_status = get_default_comment_status( $post_type, 'pingback' );
4886
+			$ping_status = get_default_comment_status($post_type, 'pingback');
4887 4887
 		}
4888 4888
 
4889
-		if ( $post_more )
4890
-			$post_content = $post_content . '<!--more-->' . $post_more;
4889
+		if ($post_more)
4890
+			$post_content = $post_content.'<!--more-->'.$post_more;
4891 4891
 
4892 4892
 		$to_ping = null;
4893
-		if ( isset( $content_struct['mt_tb_ping_urls'] ) ) {
4893
+		if (isset($content_struct['mt_tb_ping_urls'])) {
4894 4894
 			$to_ping = $content_struct['mt_tb_ping_urls'];
4895
-			if ( is_array($to_ping) )
4895
+			if (is_array($to_ping))
4896 4896
 				$to_ping = implode(' ', $to_ping);
4897 4897
 		}
4898 4898
 
4899 4899
 		// Do some timestamp voodoo
4900
-		if ( !empty( $content_struct['date_created_gmt'] ) )
4900
+		if ( ! empty($content_struct['date_created_gmt']))
4901 4901
 			// We know this is supposed to be GMT, so we're going to slap that Z on there by force
4902
-			$dateCreated = rtrim( $content_struct['date_created_gmt']->getIso(), 'Z' ) . 'Z';
4903
-		elseif ( !empty( $content_struct['dateCreated']) )
4902
+			$dateCreated = rtrim($content_struct['date_created_gmt']->getIso(), 'Z').'Z';
4903
+		elseif ( ! empty($content_struct['dateCreated']))
4904 4904
 			$dateCreated = $content_struct['dateCreated']->getIso();
4905 4905
 
4906
-		if ( !empty( $dateCreated ) ) {
4906
+		if ( ! empty($dateCreated)) {
4907 4907
 			$post_date = get_date_from_gmt(iso8601_to_datetime($dateCreated));
4908 4908
 			$post_date_gmt = iso8601_to_datetime($dateCreated, 'GMT');
4909 4909
 		} else {
@@ -4912,10 +4912,10 @@  discard block
 block discarded – undo
4912 4912
 		}
4913 4913
 
4914 4914
 		$post_category = array();
4915
-		if ( isset( $content_struct['categories'] ) ) {
4915
+		if (isset($content_struct['categories'])) {
4916 4916
 			$catnames = $content_struct['categories'];
4917 4917
 
4918
-			if ( is_array($catnames) ) {
4918
+			if (is_array($catnames)) {
4919 4919
 				foreach ($catnames as $cat) {
4920 4920
 					$post_category[] = get_cat_ID($cat);
4921 4921
 				}
@@ -4924,44 +4924,44 @@  discard block
 block discarded – undo
4924 4924
 
4925 4925
 		$postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'to_ping', 'post_type', 'post_name', 'post_password', 'post_parent', 'menu_order', 'tags_input', 'page_template');
4926 4926
 
4927
-		$post_ID = $postdata['ID'] = get_default_post_to_edit( $post_type, true )->ID;
4927
+		$post_ID = $postdata['ID'] = get_default_post_to_edit($post_type, true)->ID;
4928 4928
 
4929 4929
 		// Only posts can be sticky
4930
-		if ( $post_type == 'post' && isset( $content_struct['sticky'] ) ) {
4930
+		if ($post_type == 'post' && isset($content_struct['sticky'])) {
4931 4931
 			$data = $postdata;
4932 4932
 			$data['sticky'] = $content_struct['sticky'];
4933
-			$error = $this->_toggle_sticky( $data );
4934
-			if ( $error ) {
4933
+			$error = $this->_toggle_sticky($data);
4934
+			if ($error) {
4935 4935
 				return $error;
4936 4936
 			}
4937 4937
 		}
4938 4938
 
4939
-		if ( isset($content_struct['custom_fields']) )
4939
+		if (isset($content_struct['custom_fields']))
4940 4940
 			$this->set_custom_fields($post_ID, $content_struct['custom_fields']);
4941 4941
 
4942
-		if ( isset ( $content_struct['wp_post_thumbnail'] ) ) {
4943
-			if ( set_post_thumbnail( $post_ID, $content_struct['wp_post_thumbnail'] ) === false )
4944
-				return new IXR_Error( 404, __( 'Invalid attachment ID.' ) );
4942
+		if (isset ($content_struct['wp_post_thumbnail'])) {
4943
+			if (set_post_thumbnail($post_ID, $content_struct['wp_post_thumbnail']) === false)
4944
+				return new IXR_Error(404, __('Invalid attachment ID.'));
4945 4945
 
4946
-			unset( $content_struct['wp_post_thumbnail'] );
4946
+			unset($content_struct['wp_post_thumbnail']);
4947 4947
 		}
4948 4948
 
4949 4949
 		// Handle enclosures
4950 4950
 		$thisEnclosure = isset($content_struct['enclosure']) ? $content_struct['enclosure'] : null;
4951 4951
 		$this->add_enclosure_if_new($post_ID, $thisEnclosure);
4952 4952
 
4953
-		$this->attach_uploads( $post_ID, $post_content );
4953
+		$this->attach_uploads($post_ID, $post_content);
4954 4954
 
4955 4955
 		// Handle post formats if assigned, value is validated earlier
4956 4956
 		// in this function
4957
-		if ( isset( $content_struct['wp_post_format'] ) )
4958
-			set_post_format( $post_ID, $content_struct['wp_post_format'] );
4957
+		if (isset($content_struct['wp_post_format']))
4958
+			set_post_format($post_ID, $content_struct['wp_post_format']);
4959 4959
 
4960
-		$post_ID = wp_insert_post( $postdata, true );
4961
-		if ( is_wp_error( $post_ID ) )
4960
+		$post_ID = wp_insert_post($postdata, true);
4961
+		if (is_wp_error($post_ID))
4962 4962
 			return new IXR_Error(500, $post_ID->get_error_message());
4963 4963
 
4964
-		if ( !$post_ID )
4964
+		if ( ! $post_ID)
4965 4965
 			return new IXR_Error(500, __('Sorry, your entry could not be posted. Something wrong happened.'));
4966 4966
 
4967 4967
 		/**
@@ -4972,7 +4972,7 @@  discard block
 block discarded – undo
4972 4972
 		 * @param int   $post_ID ID of the new post.
4973 4973
 		 * @param array $args    An array of arguments to create the new post.
4974 4974
 		 */
4975
-		do_action( 'xmlrpc_call_success_mw_newPost', $post_ID, $args );
4975
+		do_action('xmlrpc_call_success_mw_newPost', $post_ID, $args);
4976 4976
 
4977 4977
 		return strval($post_ID);
4978 4978
 	}
@@ -4981,21 +4981,21 @@  discard block
 block discarded – undo
4981 4981
 	 * @param integer $post_ID
4982 4982
 	 * @param array   $enclosure
4983 4983
 	 */
4984
-	public function add_enclosure_if_new( $post_ID, $enclosure ) {
4985
-		if ( is_array( $enclosure ) && isset( $enclosure['url'] ) && isset( $enclosure['length'] ) && isset( $enclosure['type'] ) ) {
4986
-			$encstring = $enclosure['url'] . "\n" . $enclosure['length'] . "\n" . $enclosure['type'] . "\n";
4984
+	public function add_enclosure_if_new($post_ID, $enclosure) {
4985
+		if (is_array($enclosure) && isset($enclosure['url']) && isset($enclosure['length']) && isset($enclosure['type'])) {
4986
+			$encstring = $enclosure['url']."\n".$enclosure['length']."\n".$enclosure['type']."\n";
4987 4987
 			$found = false;
4988
-			if ( $enclosures = get_post_meta( $post_ID, 'enclosure' ) ) {
4989
-				foreach ( $enclosures as $enc ) {
4988
+			if ($enclosures = get_post_meta($post_ID, 'enclosure')) {
4989
+				foreach ($enclosures as $enc) {
4990 4990
 					// This method used to omit the trailing new line. #23219
4991
-					if ( rtrim( $enc, "\n" ) == rtrim( $encstring, "\n" ) ) {
4991
+					if (rtrim($enc, "\n") == rtrim($encstring, "\n")) {
4992 4992
 						$found = true;
4993 4993
 						break;
4994 4994
 					}
4995 4995
 				}
4996 4996
 			}
4997
-			if ( ! $found )
4998
-				add_post_meta( $post_ID, 'enclosure', $encstring );
4997
+			if ( ! $found)
4998
+				add_post_meta($post_ID, 'enclosure', $encstring);
4999 4999
 		}
5000 5000
 	}
5001 5001
 
@@ -5009,15 +5009,15 @@  discard block
 block discarded – undo
5009 5009
 	 * @param int $post_ID Post ID.
5010 5010
 	 * @param string $post_content Post Content for attachment.
5011 5011
 	 */
5012
-	public function attach_uploads( $post_ID, $post_content ) {
5012
+	public function attach_uploads($post_ID, $post_content) {
5013 5013
 		global $wpdb;
5014 5014
 
5015 5015
 		// find any unattached files
5016
-		$attachments = $wpdb->get_results( "SELECT ID, guid FROM {$wpdb->posts} WHERE post_parent = '0' AND post_type = 'attachment'" );
5017
-		if ( is_array( $attachments ) ) {
5018
-			foreach ( $attachments as $file ) {
5019
-				if ( ! empty( $file->guid ) && strpos( $post_content, $file->guid ) !== false )
5020
-					$wpdb->update($wpdb->posts, array('post_parent' => $post_ID), array('ID' => $file->ID) );
5016
+		$attachments = $wpdb->get_results("SELECT ID, guid FROM {$wpdb->posts} WHERE post_parent = '0' AND post_type = 'attachment'");
5017
+		if (is_array($attachments)) {
5018
+			foreach ($attachments as $file) {
5019
+				if ( ! empty($file->guid) && strpos($post_content, $file->guid) !== false)
5020
+					$wpdb->update($wpdb->posts, array('post_parent' => $post_ID), array('ID' => $file->ID));
5021 5021
 			}
5022 5022
 		}
5023 5023
 	}
@@ -5038,46 +5038,46 @@  discard block
 block discarded – undo
5038 5038
 	 * }
5039 5039
 	 * @return bool|IXR_Error True on success.
5040 5040
 	 */
5041
-	public function mw_editPost( $args ) {
5042
-		$this->escape( $args );
5041
+	public function mw_editPost($args) {
5042
+		$this->escape($args);
5043 5043
 
5044 5044
 		$post_ID        = (int) $args[0];
5045 5045
 		$username       = $args[1];
5046 5046
 		$password       = $args[2];
5047 5047
 		$content_struct = $args[3];
5048
-		$publish        = isset( $args[4] ) ? $args[4] : 0;
5048
+		$publish        = isset($args[4]) ? $args[4] : 0;
5049 5049
 
5050
-		if ( ! $user = $this->login($username, $password) )
5050
+		if ( ! $user = $this->login($username, $password))
5051 5051
 			return $this->error;
5052 5052
 
5053 5053
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
5054
-		do_action( 'xmlrpc_call', 'metaWeblog.editPost' );
5054
+		do_action('xmlrpc_call', 'metaWeblog.editPost');
5055 5055
 
5056
-		$postdata = get_post( $post_ID, ARRAY_A );
5056
+		$postdata = get_post($post_ID, ARRAY_A);
5057 5057
 
5058 5058
 		/*
5059 5059
 		 * If there is no post data for the give post id, stop now and return an error.
5060 5060
 		 * Otherwise a new post will be created (which was the old behavior).
5061 5061
 		 */
5062
-		if ( ! $postdata || empty( $postdata[ 'ID' ] ) )
5063
-			return new IXR_Error( 404, __( 'Invalid post ID.' ) );
5062
+		if ( ! $postdata || empty($postdata['ID']))
5063
+			return new IXR_Error(404, __('Invalid post ID.'));
5064 5064
 
5065
-		if ( ! current_user_can( 'edit_post', $post_ID ) )
5066
-			return new IXR_Error( 401, __( 'Sorry, you do not have the right to edit this post.' ) );
5065
+		if ( ! current_user_can('edit_post', $post_ID))
5066
+			return new IXR_Error(401, __('Sorry, you do not have the right to edit this post.'));
5067 5067
 
5068 5068
 		// Use wp.editPost to edit post types other than post and page.
5069
-		if ( ! in_array( $postdata[ 'post_type' ], array( 'post', 'page' ) ) )
5070
-			return new IXR_Error( 401, __( 'Invalid post type' ) );
5069
+		if ( ! in_array($postdata['post_type'], array('post', 'page')))
5070
+			return new IXR_Error(401, __('Invalid post type'));
5071 5071
 
5072 5072
 		// Thwart attempt to change the post type.
5073
-		if ( ! empty( $content_struct[ 'post_type' ] ) && ( $content_struct['post_type'] != $postdata[ 'post_type' ] ) )
5074
-			return new IXR_Error( 401, __( 'The post type may not be changed.' ) );
5073
+		if ( ! empty($content_struct['post_type']) && ($content_struct['post_type'] != $postdata['post_type']))
5074
+			return new IXR_Error(401, __('The post type may not be changed.'));
5075 5075
 
5076 5076
 		// Check for a valid post format if one was given
5077
-		if ( isset( $content_struct['wp_post_format'] ) ) {
5078
-			$content_struct['wp_post_format'] = sanitize_key( $content_struct['wp_post_format'] );
5079
-			if ( !array_key_exists( $content_struct['wp_post_format'], get_post_format_strings() ) ) {
5080
-				return new IXR_Error( 404, __( 'Invalid post format' ) );
5077
+		if (isset($content_struct['wp_post_format'])) {
5078
+			$content_struct['wp_post_format'] = sanitize_key($content_struct['wp_post_format']);
5079
+			if ( ! array_key_exists($content_struct['wp_post_format'], get_post_format_strings())) {
5080
+				return new IXR_Error(404, __('Invalid post format'));
5081 5081
 			}
5082 5082
 		}
5083 5083
 
@@ -5094,53 +5094,53 @@  discard block
 block discarded – undo
5094 5094
 
5095 5095
 		// Let WordPress manage slug if none was provided.
5096 5096
 		$post_name = $postdata['post_name'];
5097
-		if ( isset($content_struct['wp_slug']) )
5097
+		if (isset($content_struct['wp_slug']))
5098 5098
 			$post_name = $content_struct['wp_slug'];
5099 5099
 
5100 5100
 		// Only use a password if one was given.
5101
-		if ( isset($content_struct['wp_password']) )
5101
+		if (isset($content_struct['wp_password']))
5102 5102
 			$post_password = $content_struct['wp_password'];
5103 5103
 
5104 5104
 		// Only set a post parent if one was given.
5105
-		if ( isset($content_struct['wp_page_parent_id']) )
5105
+		if (isset($content_struct['wp_page_parent_id']))
5106 5106
 			$post_parent = $content_struct['wp_page_parent_id'];
5107 5107
 
5108 5108
 		// Only set the menu_order if it was given.
5109
-		if ( isset($content_struct['wp_page_order']) )
5109
+		if (isset($content_struct['wp_page_order']))
5110 5110
 			$menu_order = $content_struct['wp_page_order'];
5111 5111
 
5112 5112
 		$page_template = null;
5113
-		if ( ! empty( $content_struct['wp_page_template'] ) && 'page' == $post_type )
5113
+		if ( ! empty($content_struct['wp_page_template']) && 'page' == $post_type)
5114 5114
 			$page_template = $content_struct['wp_page_template'];
5115 5115
 
5116 5116
 		$post_author = $postdata['post_author'];
5117 5117
 
5118 5118
 		// Only set the post_author if one is set.
5119
-		if ( isset( $content_struct['wp_author_id'] ) ) {
5119
+		if (isset($content_struct['wp_author_id'])) {
5120 5120
 			// Check permissions if attempting to switch author to or from another user.
5121
-			if ( $user->ID != $content_struct['wp_author_id'] || $user->ID != $post_author ) {
5122
-				switch ( $post_type ) {
5121
+			if ($user->ID != $content_struct['wp_author_id'] || $user->ID != $post_author) {
5122
+				switch ($post_type) {
5123 5123
 					case 'post':
5124
-						if ( ! current_user_can( 'edit_others_posts' ) ) {
5125
-							return new IXR_Error( 401, __( 'You are not allowed to change the post author as this user.' ) );
5124
+						if ( ! current_user_can('edit_others_posts')) {
5125
+							return new IXR_Error(401, __('You are not allowed to change the post author as this user.'));
5126 5126
 						}
5127 5127
 						break;
5128 5128
 					case 'page':
5129
-						if ( ! current_user_can( 'edit_others_pages' ) ) {
5130
-							return new IXR_Error( 401, __( 'You are not allowed to change the page author as this user.' ) );
5129
+						if ( ! current_user_can('edit_others_pages')) {
5130
+							return new IXR_Error(401, __('You are not allowed to change the page author as this user.'));
5131 5131
 						}
5132 5132
 						break;
5133 5133
 					default:
5134
-						return new IXR_Error( 401, __( 'Invalid post type' ) );
5134
+						return new IXR_Error(401, __('Invalid post type'));
5135 5135
 						break;
5136 5136
 				}
5137 5137
 				$post_author = $content_struct['wp_author_id'];
5138 5138
 			}
5139 5139
 		}
5140 5140
 
5141
-		if ( isset($content_struct['mt_allow_comments']) ) {
5142
-			if ( !is_numeric($content_struct['mt_allow_comments']) ) {
5143
-				switch ( $content_struct['mt_allow_comments'] ) {
5141
+		if (isset($content_struct['mt_allow_comments'])) {
5142
+			if ( ! is_numeric($content_struct['mt_allow_comments'])) {
5143
+				switch ($content_struct['mt_allow_comments']) {
5144 5144
 					case 'closed':
5145 5145
 						$comment_status = 'closed';
5146 5146
 						break;
@@ -5148,11 +5148,11 @@  discard block
 block discarded – undo
5148 5148
 						$comment_status = 'open';
5149 5149
 						break;
5150 5150
 					default:
5151
-						$comment_status = get_default_comment_status( $post_type );
5151
+						$comment_status = get_default_comment_status($post_type);
5152 5152
 						break;
5153 5153
 				}
5154 5154
 			} else {
5155
-				switch ( (int) $content_struct['mt_allow_comments'] ) {
5155
+				switch ((int) $content_struct['mt_allow_comments']) {
5156 5156
 					case 0:
5157 5157
 					case 2:
5158 5158
 						$comment_status = 'closed';
@@ -5161,15 +5161,15 @@  discard block
 block discarded – undo
5161 5161
 						$comment_status = 'open';
5162 5162
 						break;
5163 5163
 					default:
5164
-						$comment_status = get_default_comment_status( $post_type );
5164
+						$comment_status = get_default_comment_status($post_type);
5165 5165
 						break;
5166 5166
 				}
5167 5167
 			}
5168 5168
 		}
5169 5169
 
5170
-		if ( isset($content_struct['mt_allow_pings']) ) {
5171
-			if ( !is_numeric($content_struct['mt_allow_pings']) ) {
5172
-				switch ( $content_struct['mt_allow_pings'] ) {
5170
+		if (isset($content_struct['mt_allow_pings'])) {
5171
+			if ( ! is_numeric($content_struct['mt_allow_pings'])) {
5172
+				switch ($content_struct['mt_allow_pings']) {
5173 5173
 					case 'closed':
5174 5174
 						$ping_status = 'closed';
5175 5175
 						break;
@@ -5177,11 +5177,11 @@  discard block
 block discarded – undo
5177 5177
 						$ping_status = 'open';
5178 5178
 						break;
5179 5179
 					default:
5180
-						$ping_status = get_default_comment_status( $post_type, 'pingback' );
5180
+						$ping_status = get_default_comment_status($post_type, 'pingback');
5181 5181
 						break;
5182 5182
 				}
5183 5183
 			} else {
5184
-				switch ( (int) $content_struct["mt_allow_pings"] ) {
5184
+				switch ((int) $content_struct["mt_allow_pings"]) {
5185 5185
 					case 0:
5186 5186
 						$ping_status = 'closed';
5187 5187
 						break;
@@ -5189,36 +5189,36 @@  discard block
 block discarded – undo
5189 5189
 						$ping_status = 'open';
5190 5190
 						break;
5191 5191
 					default:
5192
-						$ping_status = get_default_comment_status( $post_type, 'pingback' );
5192
+						$ping_status = get_default_comment_status($post_type, 'pingback');
5193 5193
 						break;
5194 5194
 				}
5195 5195
 			}
5196 5196
 		}
5197 5197
 
5198
-		if ( isset( $content_struct['title'] ) )
5199
-			$post_title =  $content_struct['title'];
5198
+		if (isset($content_struct['title']))
5199
+			$post_title = $content_struct['title'];
5200 5200
 
5201
-		if ( isset( $content_struct['description'] ) )
5201
+		if (isset($content_struct['description']))
5202 5202
 			$post_content = $content_struct['description'];
5203 5203
 
5204 5204
 		$post_category = array();
5205
-		if ( isset( $content_struct['categories'] ) ) {
5205
+		if (isset($content_struct['categories'])) {
5206 5206
 			$catnames = $content_struct['categories'];
5207
-			if ( is_array($catnames) ) {
5207
+			if (is_array($catnames)) {
5208 5208
 				foreach ($catnames as $cat) {
5209 5209
 					$post_category[] = get_cat_ID($cat);
5210 5210
 				}
5211 5211
 			}
5212 5212
 		}
5213 5213
 
5214
-		if ( isset( $content_struct['mt_excerpt'] ) )
5215
-			$post_excerpt =  $content_struct['mt_excerpt'];
5214
+		if (isset($content_struct['mt_excerpt']))
5215
+			$post_excerpt = $content_struct['mt_excerpt'];
5216 5216
 
5217
-		$post_more = isset( $content_struct['mt_text_more'] ) ? $content_struct['mt_text_more'] : null;
5217
+		$post_more = isset($content_struct['mt_text_more']) ? $content_struct['mt_text_more'] : null;
5218 5218
 
5219 5219
 		$post_status = $publish ? 'publish' : 'draft';
5220
-		if ( isset( $content_struct["{$post_type}_status"] ) ) {
5221
-			switch( $content_struct["{$post_type}_status"] ) {
5220
+		if (isset($content_struct["{$post_type}_status"])) {
5221
+			switch ($content_struct["{$post_type}_status"]) {
5222 5222
 				case 'draft':
5223 5223
 				case 'pending':
5224 5224
 				case 'private':
@@ -5231,34 +5231,34 @@  discard block
 block discarded – undo
5231 5231
 			}
5232 5232
 		}
5233 5233
 
5234
-		$tags_input = isset( $content_struct['mt_keywords'] ) ? $content_struct['mt_keywords'] : null;
5234
+		$tags_input = isset($content_struct['mt_keywords']) ? $content_struct['mt_keywords'] : null;
5235 5235
 
5236
-		if ( ('publish' == $post_status) ) {
5237
-			if ( ( 'page' == $post_type ) && ! current_user_can( 'publish_pages' ) ) {
5238
-				return new IXR_Error( 401, __( 'Sorry, you do not have the right to publish this page.' ) );
5239
-			} elseif ( ! current_user_can( 'publish_posts' ) ) {
5240
-				return new IXR_Error( 401, __( 'Sorry, you do not have the right to publish this post.' ) );
5236
+		if (('publish' == $post_status)) {
5237
+			if (('page' == $post_type) && ! current_user_can('publish_pages')) {
5238
+				return new IXR_Error(401, __('Sorry, you do not have the right to publish this page.'));
5239
+			} elseif ( ! current_user_can('publish_posts')) {
5240
+				return new IXR_Error(401, __('Sorry, you do not have the right to publish this post.'));
5241 5241
 			}
5242 5242
 		}
5243 5243
 
5244
-		if ( $post_more )
5245
-			$post_content = $post_content . "<!--more-->" . $post_more;
5244
+		if ($post_more)
5245
+			$post_content = $post_content."<!--more-->".$post_more;
5246 5246
 
5247 5247
 		$to_ping = null;
5248
-		if ( isset( $content_struct['mt_tb_ping_urls'] ) ) {
5248
+		if (isset($content_struct['mt_tb_ping_urls'])) {
5249 5249
 			$to_ping = $content_struct['mt_tb_ping_urls'];
5250
-			if ( is_array($to_ping) )
5250
+			if (is_array($to_ping))
5251 5251
 				$to_ping = implode(' ', $to_ping);
5252 5252
 		}
5253 5253
 
5254 5254
 		// Do some timestamp voodoo.
5255
-		if ( !empty( $content_struct['date_created_gmt'] ) )
5255
+		if ( ! empty($content_struct['date_created_gmt']))
5256 5256
 			// We know this is supposed to be GMT, so we're going to slap that Z on there by force.
5257
-			$dateCreated = rtrim( $content_struct['date_created_gmt']->getIso(), 'Z' ) . 'Z';
5258
-		elseif ( !empty( $content_struct['dateCreated']) )
5257
+			$dateCreated = rtrim($content_struct['date_created_gmt']->getIso(), 'Z').'Z';
5258
+		elseif ( ! empty($content_struct['dateCreated']))
5259 5259
 			$dateCreated = $content_struct['dateCreated']->getIso();
5260 5260
 
5261
-		if ( !empty( $dateCreated ) ) {
5261
+		if ( ! empty($dateCreated)) {
5262 5262
 			$post_date = get_date_from_gmt(iso8601_to_datetime($dateCreated));
5263 5263
 			$post_date_gmt = iso8601_to_datetime($dateCreated, 'GMT');
5264 5264
 		} else {
@@ -5270,47 +5270,47 @@  discard block
 block discarded – undo
5270 5270
 		$newpost = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'post_date', 'post_date_gmt', 'to_ping', 'post_name', 'post_password', 'post_parent', 'menu_order', 'post_author', 'tags_input', 'page_template');
5271 5271
 
5272 5272
 		$result = wp_update_post($newpost, true);
5273
-		if ( is_wp_error( $result ) )
5273
+		if (is_wp_error($result))
5274 5274
 			return new IXR_Error(500, $result->get_error_message());
5275 5275
 
5276
-		if ( !$result )
5276
+		if ( ! $result)
5277 5277
 			return new IXR_Error(500, __('Sorry, your entry could not be edited. Something wrong happened.'));
5278 5278
 
5279 5279
 		// Only posts can be sticky
5280
-		if ( $post_type == 'post' && isset( $content_struct['sticky'] ) ) {
5280
+		if ($post_type == 'post' && isset($content_struct['sticky'])) {
5281 5281
 			$data = $newpost;
5282 5282
 			$data['sticky'] = $content_struct['sticky'];
5283 5283
 			$data['post_type'] = 'post';
5284
-			$error = $this->_toggle_sticky( $data, true );
5285
-			if ( $error ) {
5284
+			$error = $this->_toggle_sticky($data, true);
5285
+			if ($error) {
5286 5286
 				return $error;
5287 5287
 			}
5288 5288
 		}
5289 5289
 
5290
-		if ( isset($content_struct['custom_fields']) )
5290
+		if (isset($content_struct['custom_fields']))
5291 5291
 			$this->set_custom_fields($post_ID, $content_struct['custom_fields']);
5292 5292
 
5293
-		if ( isset ( $content_struct['wp_post_thumbnail'] ) ) {
5293
+		if (isset ($content_struct['wp_post_thumbnail'])) {
5294 5294
 
5295 5295
 			// Empty value deletes, non-empty value adds/updates.
5296
-			if ( empty( $content_struct['wp_post_thumbnail'] ) ) {
5297
-				delete_post_thumbnail( $post_ID );
5296
+			if (empty($content_struct['wp_post_thumbnail'])) {
5297
+				delete_post_thumbnail($post_ID);
5298 5298
 			} else {
5299
-				if ( set_post_thumbnail( $post_ID, $content_struct['wp_post_thumbnail'] ) === false )
5300
-					return new IXR_Error( 404, __( 'Invalid attachment ID.' ) );
5299
+				if (set_post_thumbnail($post_ID, $content_struct['wp_post_thumbnail']) === false)
5300
+					return new IXR_Error(404, __('Invalid attachment ID.'));
5301 5301
 			}
5302
-			unset( $content_struct['wp_post_thumbnail'] );
5302
+			unset($content_struct['wp_post_thumbnail']);
5303 5303
 		}
5304 5304
 
5305 5305
 		// Handle enclosures.
5306 5306
 		$thisEnclosure = isset($content_struct['enclosure']) ? $content_struct['enclosure'] : null;
5307 5307
 		$this->add_enclosure_if_new($post_ID, $thisEnclosure);
5308 5308
 
5309
-		$this->attach_uploads( $ID, $post_content );
5309
+		$this->attach_uploads($ID, $post_content);
5310 5310
 
5311 5311
 		// Handle post formats if assigned, validation is handled earlier in this function.
5312
-		if ( isset( $content_struct['wp_post_format'] ) )
5313
-			set_post_format( $post_ID, $content_struct['wp_post_format'] );
5312
+		if (isset($content_struct['wp_post_format']))
5313
+			set_post_format($post_ID, $content_struct['wp_post_format']);
5314 5314
 
5315 5315
 		/**
5316 5316
 		 * Fires after a post has been successfully updated via the XML-RPC MovableType API.
@@ -5320,7 +5320,7 @@  discard block
 block discarded – undo
5320 5320
 		 * @param int   $post_ID ID of the updated post.
5321 5321
 		 * @param array $args    An array of arguments to update the post.
5322 5322
 		 */
5323
-		do_action( 'xmlrpc_call_success_mw_editPost', $post_ID, $args );
5323
+		do_action('xmlrpc_call_success_mw_editPost', $post_ID, $args);
5324 5324
 
5325 5325
 		return true;
5326 5326
 	}
@@ -5340,43 +5340,43 @@  discard block
 block discarded – undo
5340 5340
 	 * }
5341 5341
 	 * @return array|IXR_Error
5342 5342
 	 */
5343
-	public function mw_getPost( $args ) {
5344
-		$this->escape( $args );
5343
+	public function mw_getPost($args) {
5344
+		$this->escape($args);
5345 5345
 
5346 5346
 		$post_ID  = (int) $args[0];
5347 5347
 		$username = $args[1];
5348 5348
 		$password = $args[2];
5349 5349
 
5350
-		if ( !$user = $this->login($username, $password) )
5350
+		if ( ! $user = $this->login($username, $password))
5351 5351
 			return $this->error;
5352 5352
 
5353 5353
 		$postdata = get_post($post_ID, ARRAY_A);
5354
-		if ( ! $postdata )
5355
-			return new IXR_Error( 404, __( 'Invalid post ID.' ) );
5354
+		if ( ! $postdata)
5355
+			return new IXR_Error(404, __('Invalid post ID.'));
5356 5356
 
5357
-		if ( !current_user_can( 'edit_post', $post_ID ) )
5358
-			return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) );
5357
+		if ( ! current_user_can('edit_post', $post_ID))
5358
+			return new IXR_Error(401, __('Sorry, you cannot edit this post.'));
5359 5359
 
5360 5360
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
5361
-		do_action( 'xmlrpc_call', 'metaWeblog.getPost' );
5361
+		do_action('xmlrpc_call', 'metaWeblog.getPost');
5362 5362
 
5363 5363
 		if ($postdata['post_date'] != '') {
5364
-			$post_date = $this->_convert_date( $postdata['post_date'] );
5365
-			$post_date_gmt = $this->_convert_date_gmt( $postdata['post_date_gmt'],  $postdata['post_date'] );
5366
-			$post_modified = $this->_convert_date( $postdata['post_modified'] );
5367
-			$post_modified_gmt = $this->_convert_date_gmt( $postdata['post_modified_gmt'], $postdata['post_modified'] );
5364
+			$post_date = $this->_convert_date($postdata['post_date']);
5365
+			$post_date_gmt = $this->_convert_date_gmt($postdata['post_date_gmt'], $postdata['post_date']);
5366
+			$post_modified = $this->_convert_date($postdata['post_modified']);
5367
+			$post_modified_gmt = $this->_convert_date_gmt($postdata['post_modified_gmt'], $postdata['post_modified']);
5368 5368
 
5369 5369
 			$categories = array();
5370 5370
 			$catids = wp_get_post_categories($post_ID);
5371
-			foreach($catids as $catid)
5371
+			foreach ($catids as $catid)
5372 5372
 				$categories[] = get_cat_name($catid);
5373 5373
 
5374 5374
 			$tagnames = array();
5375
-			$tags = wp_get_post_tags( $post_ID );
5376
-			if ( !empty( $tags ) ) {
5377
-				foreach ( $tags as $tag )
5375
+			$tags = wp_get_post_tags($post_ID);
5376
+			if ( ! empty($tags)) {
5377
+				foreach ($tags as $tag)
5378 5378
 					$tagnames[] = $tag->name;
5379
-				$tagnames = implode( ', ', $tagnames );
5379
+				$tagnames = implode(', ', $tagnames);
5380 5380
 			} else {
5381 5381
 				$tagnames = '';
5382 5382
 			}
@@ -5391,22 +5391,22 @@  discard block
 block discarded – undo
5391 5391
 			$allow_pings = ('open' == $postdata['ping_status']) ? 1 : 0;
5392 5392
 
5393 5393
 			// Consider future posts as published
5394
-			if ( $postdata['post_status'] === 'future' )
5394
+			if ($postdata['post_status'] === 'future')
5395 5395
 				$postdata['post_status'] = 'publish';
5396 5396
 
5397 5397
 			// Get post format
5398
-			$post_format = get_post_format( $post_ID );
5399
-			if ( empty( $post_format ) )
5398
+			$post_format = get_post_format($post_ID);
5399
+			if (empty($post_format))
5400 5400
 				$post_format = 'standard';
5401 5401
 
5402 5402
 			$sticky = false;
5403
-			if ( is_sticky( $post_ID ) )
5403
+			if (is_sticky($post_ID))
5404 5404
 				$sticky = true;
5405 5405
 
5406 5406
 			$enclosure = array();
5407
-			foreach ( (array) get_post_custom($post_ID) as $key => $val) {
5407
+			foreach ((array) get_post_custom($post_ID) as $key => $val) {
5408 5408
 				if ($key == 'enclosure') {
5409
-					foreach ( (array) $val as $enc ) {
5409
+					foreach ((array) $val as $enc) {
5410 5410
 						$encdata = explode("\n", $enc);
5411 5411
 						$enclosure['url'] = trim(htmlspecialchars($encdata[0]));
5412 5412
 						$enclosure['length'] = (int) trim($encdata[1]);
@@ -5446,9 +5446,9 @@  discard block
 block discarded – undo
5446 5446
 				'date_modified_gmt' => $post_modified_gmt
5447 5447
 			);
5448 5448
 
5449
-			if ( !empty($enclosure) ) $resp['enclosure'] = $enclosure;
5449
+			if ( ! empty($enclosure)) $resp['enclosure'] = $enclosure;
5450 5450
 
5451
-			$resp['wp_post_thumbnail'] = get_post_thumbnail_id( $postdata['ID'] );
5451
+			$resp['wp_post_thumbnail'] = get_post_thumbnail_id($postdata['ID']);
5452 5452
 
5453 5453
 			return $resp;
5454 5454
 		} else {
@@ -5471,52 +5471,52 @@  discard block
 block discarded – undo
5471 5471
 	 * }
5472 5472
 	 * @return array|IXR_Error
5473 5473
 	 */
5474
-	public function mw_getRecentPosts( $args ) {
5475
-		$this->escape( $args );
5474
+	public function mw_getRecentPosts($args) {
5475
+		$this->escape($args);
5476 5476
 
5477 5477
 		$username = $args[1];
5478 5478
 		$password = $args[2];
5479
-		if ( isset( $args[3] ) )
5480
-			$query = array( 'numberposts' => absint( $args[3] ) );
5479
+		if (isset($args[3]))
5480
+			$query = array('numberposts' => absint($args[3]));
5481 5481
 		else
5482 5482
 			$query = array();
5483 5483
 
5484
-		if ( !$user = $this->login($username, $password) )
5484
+		if ( ! $user = $this->login($username, $password))
5485 5485
 			return $this->error;
5486 5486
 
5487
-		if ( ! current_user_can( 'edit_posts' ) )
5488
-			return new IXR_Error( 401, __( 'Sorry, you cannot edit posts on this site.' ) );
5487
+		if ( ! current_user_can('edit_posts'))
5488
+			return new IXR_Error(401, __('Sorry, you cannot edit posts on this site.'));
5489 5489
 
5490 5490
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
5491
-		do_action( 'xmlrpc_call', 'metaWeblog.getRecentPosts' );
5491
+		do_action('xmlrpc_call', 'metaWeblog.getRecentPosts');
5492 5492
 
5493
-		$posts_list = wp_get_recent_posts( $query );
5493
+		$posts_list = wp_get_recent_posts($query);
5494 5494
 
5495
-		if ( !$posts_list )
5495
+		if ( ! $posts_list)
5496 5496
 			return array();
5497 5497
 
5498 5498
 		$recent_posts = array();
5499 5499
 		foreach ($posts_list as $entry) {
5500
-			if ( !current_user_can( 'edit_post', $entry['ID'] ) )
5500
+			if ( ! current_user_can('edit_post', $entry['ID']))
5501 5501
 				continue;
5502 5502
 
5503
-			$post_date = $this->_convert_date( $entry['post_date'] );
5504
-			$post_date_gmt = $this->_convert_date_gmt( $entry['post_date_gmt'], $entry['post_date'] );
5505
-			$post_modified = $this->_convert_date( $entry['post_modified'] );
5506
-			$post_modified_gmt = $this->_convert_date_gmt( $entry['post_modified_gmt'], $entry['post_modified'] );
5503
+			$post_date = $this->_convert_date($entry['post_date']);
5504
+			$post_date_gmt = $this->_convert_date_gmt($entry['post_date_gmt'], $entry['post_date']);
5505
+			$post_modified = $this->_convert_date($entry['post_modified']);
5506
+			$post_modified_gmt = $this->_convert_date_gmt($entry['post_modified_gmt'], $entry['post_modified']);
5507 5507
 
5508 5508
 			$categories = array();
5509 5509
 			$catids = wp_get_post_categories($entry['ID']);
5510
-			foreach( $catids as $catid )
5510
+			foreach ($catids as $catid)
5511 5511
 				$categories[] = get_cat_name($catid);
5512 5512
 
5513 5513
 			$tagnames = array();
5514
-			$tags = wp_get_post_tags( $entry['ID'] );
5515
-			if ( !empty( $tags ) ) {
5516
-				foreach ( $tags as $tag ) {
5514
+			$tags = wp_get_post_tags($entry['ID']);
5515
+			if ( ! empty($tags)) {
5516
+				foreach ($tags as $tag) {
5517 5517
 					$tagnames[] = $tag->name;
5518 5518
 				}
5519
-				$tagnames = implode( ', ', $tagnames );
5519
+				$tagnames = implode(', ', $tagnames);
5520 5520
 			} else {
5521 5521
 				$tagnames = '';
5522 5522
 			}
@@ -5531,12 +5531,12 @@  discard block
 block discarded – undo
5531 5531
 			$allow_pings = ('open' == $entry['ping_status']) ? 1 : 0;
5532 5532
 
5533 5533
 			// Consider future posts as published
5534
-			if ( $entry['post_status'] === 'future' )
5534
+			if ($entry['post_status'] === 'future')
5535 5535
 				$entry['post_status'] = 'publish';
5536 5536
 
5537 5537
 			// Get post format
5538
-			$post_format = get_post_format( $entry['ID'] );
5539
-			if ( empty( $post_format ) )
5538
+			$post_format = get_post_format($entry['ID']);
5539
+			if (empty($post_format))
5540 5540
 				$post_format = 'standard';
5541 5541
 
5542 5542
 			$recent_posts[] = array(
@@ -5566,8 +5566,8 @@  discard block
 block discarded – undo
5566 5566
 				'wp_post_format' => $post_format,
5567 5567
 				'date_modified' => $post_modified,
5568 5568
 				'date_modified_gmt' => $post_modified_gmt,
5569
-				'sticky' => ( $entry['post_type'] === 'post' && is_sticky( $entry['ID'] ) ),
5570
-				'wp_post_thumbnail' => get_post_thumbnail_id( $entry['ID'] )
5569
+				'sticky' => ($entry['post_type'] === 'post' && is_sticky($entry['ID'])),
5570
+				'wp_post_thumbnail' => get_post_thumbnail_id($entry['ID'])
5571 5571
 			);
5572 5572
 		}
5573 5573
 
@@ -5588,25 +5588,25 @@  discard block
 block discarded – undo
5588 5588
 	 * }
5589 5589
 	 * @return array|IXR_Error
5590 5590
 	 */
5591
-	public function mw_getCategories( $args ) {
5592
-		$this->escape( $args );
5591
+	public function mw_getCategories($args) {
5592
+		$this->escape($args);
5593 5593
 
5594 5594
 		$username = $args[1];
5595 5595
 		$password = $args[2];
5596 5596
 
5597
-		if ( !$user = $this->login($username, $password) )
5597
+		if ( ! $user = $this->login($username, $password))
5598 5598
 			return $this->error;
5599 5599
 
5600
-		if ( !current_user_can( 'edit_posts' ) )
5601
-			return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this site in order to view categories.' ) );
5600
+		if ( ! current_user_can('edit_posts'))
5601
+			return new IXR_Error(401, __('Sorry, you must be able to edit posts on this site in order to view categories.'));
5602 5602
 
5603 5603
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
5604
-		do_action( 'xmlrpc_call', 'metaWeblog.getCategories' );
5604
+		do_action('xmlrpc_call', 'metaWeblog.getCategories');
5605 5605
 
5606 5606
 		$categories_struct = array();
5607 5607
 
5608
-		if ( $cats = get_categories(array('get' => 'all')) ) {
5609
-			foreach ( $cats as $cat ) {
5608
+		if ($cats = get_categories(array('get' => 'all'))) {
5609
+			foreach ($cats as $cat) {
5610 5610
 				$struct = array();
5611 5611
 				$struct['categoryId'] = $cat->term_id;
5612 5612
 				$struct['parentId'] = $cat->parent;
@@ -5644,25 +5644,25 @@  discard block
 block discarded – undo
5644 5644
 	 * }
5645 5645
 	 * @return array|IXR_Error
5646 5646
 	 */
5647
-	public function mw_newMediaObject( $args ) {
5647
+	public function mw_newMediaObject($args) {
5648 5648
 		global $wpdb;
5649 5649
 
5650
-		$username = $this->escape( $args[1] );
5651
-		$password = $this->escape( $args[2] );
5650
+		$username = $this->escape($args[1]);
5651
+		$password = $this->escape($args[2]);
5652 5652
 		$data     = $args[3];
5653 5653
 
5654
-		$name = sanitize_file_name( $data['name'] );
5654
+		$name = sanitize_file_name($data['name']);
5655 5655
 		$type = $data['type'];
5656 5656
 		$bits = $data['bits'];
5657 5657
 
5658
-		if ( !$user = $this->login($username, $password) )
5658
+		if ( ! $user = $this->login($username, $password))
5659 5659
 			return $this->error;
5660 5660
 
5661 5661
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
5662
-		do_action( 'xmlrpc_call', 'metaWeblog.newMediaObject' );
5662
+		do_action('xmlrpc_call', 'metaWeblog.newMediaObject');
5663 5663
 
5664
-		if ( !current_user_can('upload_files') ) {
5665
-			$this->error = new IXR_Error( 401, __( 'You do not have permission to upload files.' ) );
5664
+		if ( ! current_user_can('upload_files')) {
5665
+			$this->error = new IXR_Error(401, __('You do not have permission to upload files.'));
5666 5666
 			return $this->error;
5667 5667
 		}
5668 5668
 
@@ -5676,11 +5676,11 @@  discard block
 block discarded – undo
5676 5676
 		 *
5677 5677
 		 * @param bool $error Whether to pre-empt the media upload. Default false.
5678 5678
 		 */
5679
-		if ( $upload_err = apply_filters( 'pre_upload_error', false ) ) {
5680
-			return new IXR_Error( 500, $upload_err );
5679
+		if ($upload_err = apply_filters('pre_upload_error', false)) {
5680
+			return new IXR_Error(500, $upload_err);
5681 5681
 		}
5682 5682
 
5683
-		if ( !empty($data['overwrite']) && ($data['overwrite'] == true) ) {
5683
+		if ( ! empty($data['overwrite']) && ($data['overwrite'] == true)) {
5684 5684
 			// Get postmeta info on the object.
5685 5685
 			$old_file = $wpdb->get_row("
5686 5686
 				SELECT ID
@@ -5699,17 +5699,17 @@  discard block
 block discarded – undo
5699 5699
 		}
5700 5700
 
5701 5701
 		$upload = wp_upload_bits($name, null, $bits);
5702
-		if ( ! empty($upload['error']) ) {
5702
+		if ( ! empty($upload['error'])) {
5703 5703
 			$errorString = sprintf(__('Could not write file %1$s (%2$s)'), $name, $upload['error']);
5704 5704
 			return new IXR_Error(500, $errorString);
5705 5705
 		}
5706 5706
 		// Construct the attachment array
5707 5707
 		$post_id = 0;
5708
-		if ( ! empty( $data['post_id'] ) ) {
5708
+		if ( ! empty($data['post_id'])) {
5709 5709
 			$post_id = (int) $data['post_id'];
5710 5710
 
5711
-			if ( ! current_user_can( 'edit_post', $post_id ) )
5712
-				return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) );
5711
+			if ( ! current_user_can('edit_post', $post_id))
5712
+				return new IXR_Error(401, __('Sorry, you cannot edit this post.'));
5713 5713
 		}
5714 5714
 		$attachment = array(
5715 5715
 			'post_title' => $name,
@@ -5717,12 +5717,12 @@  discard block
 block discarded – undo
5717 5717
 			'post_type' => 'attachment',
5718 5718
 			'post_parent' => $post_id,
5719 5719
 			'post_mime_type' => $type,
5720
-			'guid' => $upload[ 'url' ]
5720
+			'guid' => $upload['url']
5721 5721
 		);
5722 5722
 
5723 5723
 		// Save the data
5724
-		$id = wp_insert_attachment( $attachment, $upload[ 'file' ], $post_id );
5725
-		wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $upload['file'] ) );
5724
+		$id = wp_insert_attachment($attachment, $upload['file'], $post_id);
5725
+		wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $upload['file']));
5726 5726
 
5727 5727
 		/**
5728 5728
 		 * Fires after a new attachment has been added via the XML-RPC MovableType API.
@@ -5732,17 +5732,17 @@  discard block
 block discarded – undo
5732 5732
 		 * @param int   $id   ID of the new attachment.
5733 5733
 		 * @param array $args An array of arguments to add the attachment.
5734 5734
 		 */
5735
-		do_action( 'xmlrpc_call_success_mw_newMediaObject', $id, $args );
5735
+		do_action('xmlrpc_call_success_mw_newMediaObject', $id, $args);
5736 5736
 
5737 5737
 		$struct = array(
5738
-			'id'   => strval( $id ),
5738
+			'id'   => strval($id),
5739 5739
 			'file' => $name,
5740
-			'url'  => $upload[ 'url' ],
5740
+			'url'  => $upload['url'],
5741 5741
 			'type' => $type
5742 5742
 		);
5743 5743
 
5744 5744
 		/** This filter is documented in wp-admin/includes/file.php */
5745
-		return apply_filters( 'wp_handle_upload', $struct, 'upload' );
5745
+		return apply_filters('wp_handle_upload', $struct, 'upload');
5746 5746
 	}
5747 5747
 
5748 5748
 	/* MovableType API functions
@@ -5764,25 +5764,25 @@  discard block
 block discarded – undo
5764 5764
 	 * }
5765 5765
 	 * @return array|IXR_Error
5766 5766
 	 */
5767
-	public function mt_getRecentPostTitles( $args ) {
5768
-		$this->escape( $args );
5767
+	public function mt_getRecentPostTitles($args) {
5768
+		$this->escape($args);
5769 5769
 
5770 5770
 		$username = $args[1];
5771 5771
 		$password = $args[2];
5772
-		if ( isset( $args[3] ) )
5773
-			$query = array( 'numberposts' => absint( $args[3] ) );
5772
+		if (isset($args[3]))
5773
+			$query = array('numberposts' => absint($args[3]));
5774 5774
 		else
5775 5775
 			$query = array();
5776 5776
 
5777
-		if ( !$user = $this->login($username, $password) )
5777
+		if ( ! $user = $this->login($username, $password))
5778 5778
 			return $this->error;
5779 5779
 
5780 5780
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
5781
-		do_action( 'xmlrpc_call', 'mt.getRecentPostTitles' );
5781
+		do_action('xmlrpc_call', 'mt.getRecentPostTitles');
5782 5782
 
5783
-		$posts_list = wp_get_recent_posts( $query );
5783
+		$posts_list = wp_get_recent_posts($query);
5784 5784
 
5785
-		if ( !$posts_list ) {
5785
+		if ( ! $posts_list) {
5786 5786
 			$this->error = new IXR_Error(500, __('Either there are no posts, or something went wrong.'));
5787 5787
 			return $this->error;
5788 5788
 		}
@@ -5790,11 +5790,11 @@  discard block
 block discarded – undo
5790 5790
 		$recent_posts = array();
5791 5791
 
5792 5792
 		foreach ($posts_list as $entry) {
5793
-			if ( !current_user_can( 'edit_post', $entry['ID'] ) )
5793
+			if ( ! current_user_can('edit_post', $entry['ID']))
5794 5794
 				continue;
5795 5795
 
5796
-			$post_date = $this->_convert_date( $entry['post_date'] );
5797
-			$post_date_gmt = $this->_convert_date_gmt( $entry['post_date_gmt'], $entry['post_date'] );
5796
+			$post_date = $this->_convert_date($entry['post_date']);
5797
+			$post_date_gmt = $this->_convert_date_gmt($entry['post_date_gmt'], $entry['post_date']);
5798 5798
 
5799 5799
 			$recent_posts[] = array(
5800 5800
 				'dateCreated' => $post_date,
@@ -5823,25 +5823,25 @@  discard block
 block discarded – undo
5823 5823
 	 * }
5824 5824
 	 * @return array|IXR_Error
5825 5825
 	 */
5826
-	public function mt_getCategoryList( $args ) {
5827
-		$this->escape( $args );
5826
+	public function mt_getCategoryList($args) {
5827
+		$this->escape($args);
5828 5828
 
5829 5829
 		$username = $args[1];
5830 5830
 		$password = $args[2];
5831 5831
 
5832
-		if ( !$user = $this->login($username, $password) )
5832
+		if ( ! $user = $this->login($username, $password))
5833 5833
 			return $this->error;
5834 5834
 
5835
-		if ( !current_user_can( 'edit_posts' ) )
5836
-			return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this site in order to view categories.' ) );
5835
+		if ( ! current_user_can('edit_posts'))
5836
+			return new IXR_Error(401, __('Sorry, you must be able to edit posts on this site in order to view categories.'));
5837 5837
 
5838 5838
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
5839
-		do_action( 'xmlrpc_call', 'mt.getCategoryList' );
5839
+		do_action('xmlrpc_call', 'mt.getCategoryList');
5840 5840
 
5841 5841
 		$categories_struct = array();
5842 5842
 
5843
-		if ( $cats = get_categories(array('hide_empty' => 0, 'hierarchical' => 0)) ) {
5844
-			foreach ( $cats as $cat ) {
5843
+		if ($cats = get_categories(array('hide_empty' => 0, 'hierarchical' => 0))) {
5844
+			foreach ($cats as $cat) {
5845 5845
 				$struct = array();
5846 5846
 				$struct['categoryId'] = $cat->term_id;
5847 5847
 				$struct['categoryName'] = $cat->name;
@@ -5867,30 +5867,30 @@  discard block
 block discarded – undo
5867 5867
 	 * }
5868 5868
 	 * @return array|IXR_Error
5869 5869
 	 */
5870
-	public function mt_getPostCategories( $args ) {
5871
-		$this->escape( $args );
5870
+	public function mt_getPostCategories($args) {
5871
+		$this->escape($args);
5872 5872
 
5873 5873
 		$post_ID  = (int) $args[0];
5874 5874
 		$username = $args[1];
5875 5875
 		$password = $args[2];
5876 5876
 
5877
-		if ( !$user = $this->login($username, $password) )
5877
+		if ( ! $user = $this->login($username, $password))
5878 5878
 			return $this->error;
5879 5879
 
5880
-		if ( ! get_post( $post_ID ) )
5881
-			return new IXR_Error( 404, __( 'Invalid post ID.' ) );
5880
+		if ( ! get_post($post_ID))
5881
+			return new IXR_Error(404, __('Invalid post ID.'));
5882 5882
 
5883
-		if ( !current_user_can( 'edit_post', $post_ID ) )
5884
-			return new IXR_Error( 401, __( 'Sorry, you can not edit this post.' ) );
5883
+		if ( ! current_user_can('edit_post', $post_ID))
5884
+			return new IXR_Error(401, __('Sorry, you can not edit this post.'));
5885 5885
 
5886 5886
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
5887
-		do_action( 'xmlrpc_call', 'mt.getPostCategories' );
5887
+		do_action('xmlrpc_call', 'mt.getPostCategories');
5888 5888
 
5889 5889
 		$categories = array();
5890 5890
 		$catids = wp_get_post_categories(intval($post_ID));
5891 5891
 		// first listed category will be the primary category
5892 5892
 		$isPrimary = true;
5893
-		foreach ( $catids as $catid ) {
5893
+		foreach ($catids as $catid) {
5894 5894
 			$categories[] = array(
5895 5895
 				'categoryName' => get_cat_name($catid),
5896 5896
 				'categoryId' => (string) $catid,
@@ -5917,28 +5917,28 @@  discard block
 block discarded – undo
5917 5917
 	 * }
5918 5918
 	 * @return true|IXR_Error True on success.
5919 5919
 	 */
5920
-	public function mt_setPostCategories( $args ) {
5921
-		$this->escape( $args );
5920
+	public function mt_setPostCategories($args) {
5921
+		$this->escape($args);
5922 5922
 
5923 5923
 		$post_ID    = (int) $args[0];
5924 5924
 		$username   = $args[1];
5925 5925
 		$password   = $args[2];
5926 5926
 		$categories = $args[3];
5927 5927
 
5928
-		if ( !$user = $this->login($username, $password) )
5928
+		if ( ! $user = $this->login($username, $password))
5929 5929
 			return $this->error;
5930 5930
 
5931 5931
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
5932
-		do_action( 'xmlrpc_call', 'mt.setPostCategories' );
5932
+		do_action('xmlrpc_call', 'mt.setPostCategories');
5933 5933
 
5934
-		if ( ! get_post( $post_ID ) )
5935
-			return new IXR_Error( 404, __( 'Invalid post ID.' ) );
5934
+		if ( ! get_post($post_ID))
5935
+			return new IXR_Error(404, __('Invalid post ID.'));
5936 5936
 
5937
-		if ( !current_user_can('edit_post', $post_ID) )
5937
+		if ( ! current_user_can('edit_post', $post_ID))
5938 5938
 			return new IXR_Error(401, __('Sorry, you cannot edit this post.'));
5939 5939
 
5940 5940
 		$catids = array();
5941
-		foreach ( $categories as $cat ) {
5941
+		foreach ($categories as $cat) {
5942 5942
 			$catids[] = $cat['categoryId'];
5943 5943
 		}
5944 5944
 
@@ -5956,9 +5956,9 @@  discard block
 block discarded – undo
5956 5956
 	 */
5957 5957
 	public function mt_supportedMethods() {
5958 5958
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
5959
-		do_action( 'xmlrpc_call', 'mt.supportedMethods' );
5959
+		do_action('xmlrpc_call', 'mt.supportedMethods');
5960 5960
 
5961
-		return array_keys( $this->methods );
5961
+		return array_keys($this->methods);
5962 5962
 	}
5963 5963
 
5964 5964
 	/**
@@ -5968,7 +5968,7 @@  discard block
 block discarded – undo
5968 5968
 	 */
5969 5969
 	public function mt_supportedTextFilters() {
5970 5970
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
5971
-		do_action( 'xmlrpc_call', 'mt.supportedTextFilters' );
5971
+		do_action('xmlrpc_call', 'mt.supportedTextFilters');
5972 5972
 
5973 5973
 		/**
5974 5974
 		 * Filter the MoveableType text filters list for XML-RPC.
@@ -5977,7 +5977,7 @@  discard block
 block discarded – undo
5977 5977
 		 *
5978 5978
 		 * @param array $filters An array of text filters.
5979 5979
 		 */
5980
-		return apply_filters( 'xmlrpc_text_filters', array() );
5980
+		return apply_filters('xmlrpc_text_filters', array());
5981 5981
 	}
5982 5982
 
5983 5983
 	/**
@@ -5990,25 +5990,25 @@  discard block
 block discarded – undo
5990 5990
 	 * @param int $post_ID
5991 5991
 	 * @return array|IXR_Error
5992 5992
 	 */
5993
-	public function mt_getTrackbackPings( $post_ID ) {
5993
+	public function mt_getTrackbackPings($post_ID) {
5994 5994
 		global $wpdb;
5995 5995
 
5996 5996
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
5997
-		do_action( 'xmlrpc_call', 'mt.getTrackbackPings' );
5997
+		do_action('xmlrpc_call', 'mt.getTrackbackPings');
5998 5998
 
5999 5999
 		$actual_post = get_post($post_ID, ARRAY_A);
6000 6000
 
6001
-		if ( !$actual_post )
6001
+		if ( ! $actual_post)
6002 6002
 			return new IXR_Error(404, __('Sorry, no such post.'));
6003 6003
 
6004
-		$comments = $wpdb->get_results( $wpdb->prepare("SELECT comment_author_url, comment_content, comment_author_IP, comment_type FROM $wpdb->comments WHERE comment_post_ID = %d", $post_ID) );
6004
+		$comments = $wpdb->get_results($wpdb->prepare("SELECT comment_author_url, comment_content, comment_author_IP, comment_type FROM $wpdb->comments WHERE comment_post_ID = %d", $post_ID));
6005 6005
 
6006
-		if ( !$comments )
6006
+		if ( ! $comments)
6007 6007
 			return array();
6008 6008
 
6009 6009
 		$trackback_pings = array();
6010
-		foreach ( $comments as $comment ) {
6011
-			if ( 'trackback' == $comment->comment_type ) {
6010
+		foreach ($comments as $comment) {
6011
+			if ('trackback' == $comment->comment_type) {
6012 6012
 				$content = $comment->comment_content;
6013 6013
 				$title = substr($content, 8, (strpos($content, '</strong>') - 8));
6014 6014
 				$trackback_pings[] = array(
@@ -6036,24 +6036,24 @@  discard block
 block discarded – undo
6036 6036
 	 * }
6037 6037
 	 * @return int|IXR_Error
6038 6038
 	 */
6039
-	public function mt_publishPost( $args ) {
6040
-		$this->escape( $args );
6039
+	public function mt_publishPost($args) {
6040
+		$this->escape($args);
6041 6041
 
6042 6042
 		$post_ID  = (int) $args[0];
6043 6043
 		$username = $args[1];
6044 6044
 		$password = $args[2];
6045 6045
 
6046
-		if ( !$user = $this->login($username, $password) )
6046
+		if ( ! $user = $this->login($username, $password))
6047 6047
 			return $this->error;
6048 6048
 
6049 6049
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
6050
-		do_action( 'xmlrpc_call', 'mt.publishPost' );
6050
+		do_action('xmlrpc_call', 'mt.publishPost');
6051 6051
 
6052 6052
 		$postdata = get_post($post_ID, ARRAY_A);
6053
-		if ( ! $postdata )
6054
-			return new IXR_Error( 404, __( 'Invalid post ID.' ) );
6053
+		if ( ! $postdata)
6054
+			return new IXR_Error(404, __('Invalid post ID.'));
6055 6055
 
6056
-		if ( !current_user_can('publish_posts') || !current_user_can('edit_post', $post_ID) )
6056
+		if ( ! current_user_can('publish_posts') || ! current_user_can('edit_post', $post_ID))
6057 6057
 			return new IXR_Error(401, __('Sorry, you cannot publish this post.'));
6058 6058
 
6059 6059
 		$postdata['post_status'] = 'publish';
@@ -6063,7 +6063,7 @@  discard block
 block discarded – undo
6063 6063
 		$postdata['post_category'] = $cats;
6064 6064
 		$this->escape($postdata);
6065 6065
 
6066
-		return wp_update_post( $postdata );
6066
+		return wp_update_post($postdata);
6067 6067
 	}
6068 6068
 
6069 6069
 	/* PingBack functions
@@ -6086,17 +6086,17 @@  discard block
 block discarded – undo
6086 6086
 	 * }
6087 6087
 	 * @return string|IXR_Error
6088 6088
 	 */
6089
-	public function pingback_ping( $args ) {
6089
+	public function pingback_ping($args) {
6090 6090
 		global $wpdb, $wp_version;
6091 6091
 
6092 6092
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
6093
-		do_action( 'xmlrpc_call', 'pingback.ping' );
6093
+		do_action('xmlrpc_call', 'pingback.ping');
6094 6094
 
6095
-		$this->escape( $args );
6095
+		$this->escape($args);
6096 6096
 
6097
-		$pagelinkedfrom = str_replace( '&amp;', '&', $args[0] );
6098
-		$pagelinkedto = str_replace( '&amp;', '&', $args[1] );
6099
-		$pagelinkedto = str_replace( '&', '&amp;', $pagelinkedto );
6097
+		$pagelinkedfrom = str_replace('&amp;', '&', $args[0]);
6098
+		$pagelinkedto = str_replace('&amp;', '&', $args[1]);
6099
+		$pagelinkedto = str_replace('&', '&amp;', $pagelinkedto);
6100 6100
 
6101 6101
 		/**
6102 6102
 		 * Filter the pingback source URI.
@@ -6106,76 +6106,76 @@  discard block
 block discarded – undo
6106 6106
 		 * @param string $pagelinkedfrom URI of the page linked from.
6107 6107
 		 * @param string $pagelinkedto   URI of the page linked to.
6108 6108
 		 */
6109
-		$pagelinkedfrom = apply_filters( 'pingback_ping_source_uri', $pagelinkedfrom, $pagelinkedto );
6109
+		$pagelinkedfrom = apply_filters('pingback_ping_source_uri', $pagelinkedfrom, $pagelinkedto);
6110 6110
 
6111
-		if ( ! $pagelinkedfrom )
6112
-			return $this->pingback_error( 0, __( 'A valid URL was not provided.' ) );
6111
+		if ( ! $pagelinkedfrom)
6112
+			return $this->pingback_error(0, __('A valid URL was not provided.'));
6113 6113
 
6114 6114
 		// Check if the page linked to is in our site
6115
-		$pos1 = strpos($pagelinkedto, str_replace(array('http://www.','http://','https://www.','https://'), '', get_option('home')));
6116
-		if ( !$pos1 )
6117
-			return $this->pingback_error( 0, __( 'Is there no link to us?' ) );
6115
+		$pos1 = strpos($pagelinkedto, str_replace(array('http://www.', 'http://', 'https://www.', 'https://'), '', get_option('home')));
6116
+		if ( ! $pos1)
6117
+			return $this->pingback_error(0, __('Is there no link to us?'));
6118 6118
 
6119 6119
 		// let's find which post is linked to
6120 6120
 		// FIXME: does url_to_postid() cover all these cases already?
6121 6121
 		//        if so, then let's use it and drop the old code.
6122 6122
 		$urltest = parse_url($pagelinkedto);
6123
-		if ( $post_ID = url_to_postid($pagelinkedto) ) {
6123
+		if ($post_ID = url_to_postid($pagelinkedto)) {
6124 6124
 			// $way
6125
-		} elseif ( isset( $urltest['path'] ) && preg_match('#p/[0-9]{1,}#', $urltest['path'], $match) ) {
6125
+		} elseif (isset($urltest['path']) && preg_match('#p/[0-9]{1,}#', $urltest['path'], $match)) {
6126 6126
 			// the path defines the post_ID (archives/p/XXXX)
6127 6127
 			$blah = explode('/', $match[0]);
6128 6128
 			$post_ID = (int) $blah[1];
6129
-		} elseif ( isset( $urltest['query'] ) && preg_match('#p=[0-9]{1,}#', $urltest['query'], $match) ) {
6129
+		} elseif (isset($urltest['query']) && preg_match('#p=[0-9]{1,}#', $urltest['query'], $match)) {
6130 6130
 			// the querystring defines the post_ID (?p=XXXX)
6131 6131
 			$blah = explode('=', $match[0]);
6132 6132
 			$post_ID = (int) $blah[1];
6133
-		} elseif ( isset($urltest['fragment']) ) {
6133
+		} elseif (isset($urltest['fragment'])) {
6134 6134
 			// an #anchor is there, it's either...
6135
-			if ( intval($urltest['fragment']) ) {
6135
+			if (intval($urltest['fragment'])) {
6136 6136
 				// ...an integer #XXXX (simplest case)
6137 6137
 				$post_ID = (int) $urltest['fragment'];
6138
-			} elseif ( preg_match('/post-[0-9]+/',$urltest['fragment']) ) {
6138
+			} elseif (preg_match('/post-[0-9]+/', $urltest['fragment'])) {
6139 6139
 				// ...a post id in the form 'post-###'
6140 6140
 				$post_ID = preg_replace('/[^0-9]+/', '', $urltest['fragment']);
6141
-			} elseif ( is_string($urltest['fragment']) ) {
6141
+			} elseif (is_string($urltest['fragment'])) {
6142 6142
 				// ...or a string #title, a little more complicated
6143 6143
 				$title = preg_replace('/[^a-z0-9]/i', '.', $urltest['fragment']);
6144
-				$sql = $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_title RLIKE %s", $title );
6145
-				if (! ($post_ID = $wpdb->get_var($sql)) ) {
6144
+				$sql = $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_title RLIKE %s", $title);
6145
+				if ( ! ($post_ID = $wpdb->get_var($sql))) {
6146 6146
 					// returning unknown error '0' is better than die()ing
6147
-			  		return $this->pingback_error( 0, '' );
6147
+			  		return $this->pingback_error(0, '');
6148 6148
 				}
6149 6149
 			}
6150 6150
 		} else {
6151 6151
 			// TODO: Attempt to extract a post ID from the given URL
6152
-	  		return $this->pingback_error( 33, __('The specified target URL cannot be used as a target. It either doesn&#8217;t exist, or it is not a pingback-enabled resource.' ) );
6152
+	  		return $this->pingback_error(33, __('The specified target URL cannot be used as a target. It either doesn&#8217;t exist, or it is not a pingback-enabled resource.'));
6153 6153
 		}
6154 6154
 		$post_ID = (int) $post_ID;
6155 6155
 
6156 6156
 		$post = get_post($post_ID);
6157 6157
 
6158
-		if ( !$post ) // Post_ID not found
6159
-	  		return $this->pingback_error( 33, __( 'The specified target URL cannot be used as a target. It either doesn&#8217;t exist, or it is not a pingback-enabled resource.' ) );
6158
+		if ( ! $post) // Post_ID not found
6159
+	  		return $this->pingback_error(33, __('The specified target URL cannot be used as a target. It either doesn&#8217;t exist, or it is not a pingback-enabled resource.'));
6160 6160
 
6161
-		if ( $post_ID == url_to_postid($pagelinkedfrom) )
6162
-			return $this->pingback_error( 0, __( 'The source URL and the target URL cannot both point to the same resource.' ) );
6161
+		if ($post_ID == url_to_postid($pagelinkedfrom))
6162
+			return $this->pingback_error(0, __('The source URL and the target URL cannot both point to the same resource.'));
6163 6163
 
6164 6164
 		// Check if pings are on
6165
-		if ( !pings_open($post) )
6166
-	  		return $this->pingback_error( 33, __( 'The specified target URL cannot be used as a target. It either doesn&#8217;t exist, or it is not a pingback-enabled resource.' ) );
6165
+		if ( ! pings_open($post))
6166
+	  		return $this->pingback_error(33, __('The specified target URL cannot be used as a target. It either doesn&#8217;t exist, or it is not a pingback-enabled resource.'));
6167 6167
 
6168 6168
 		// Let's check that the remote site didn't already pingback this entry
6169
-		if ( $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_author_url = %s", $post_ID, $pagelinkedfrom) ) )
6170
-			return $this->pingback_error( 48, __( 'The pingback has already been registered.' ) );
6169
+		if ($wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_author_url = %s", $post_ID, $pagelinkedfrom)))
6170
+			return $this->pingback_error(48, __('The pingback has already been registered.'));
6171 6171
 
6172 6172
 		// very stupid, but gives time to the 'from' server to publish !
6173 6173
 		sleep(1);
6174 6174
 
6175
-		$remote_ip = preg_replace( '/[^0-9a-fA-F:., ]/', '', $_SERVER['REMOTE_ADDR'] );
6175
+		$remote_ip = preg_replace('/[^0-9a-fA-F:., ]/', '', $_SERVER['REMOTE_ADDR']);
6176 6176
 
6177 6177
 		/** This filter is documented in wp-includes/class-http.php */
6178
-		$user_agent = apply_filters( 'http_headers_useragent', 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' ) );
6178
+		$user_agent = apply_filters('http_headers_useragent', 'WordPress/'.$wp_version.'; '.get_bloginfo('url'));
6179 6179
 
6180 6180
 		// Let's check the remote site
6181 6181
 		$http_api_args = array(
@@ -6187,11 +6187,11 @@  discard block
 block discarded – undo
6187 6187
 				'X-Pingback-Forwarded-For' => $remote_ip,
6188 6188
 			),
6189 6189
 		);
6190
-		$request = wp_safe_remote_get( $pagelinkedfrom, $http_api_args );
6191
-		$linea = wp_remote_retrieve_body( $request );
6190
+		$request = wp_safe_remote_get($pagelinkedfrom, $http_api_args);
6191
+		$linea = wp_remote_retrieve_body($request);
6192 6192
 
6193
-		if ( !$linea )
6194
-			return $this->pingback_error( 16, __( 'The source URL does not exist.' ) );
6193
+		if ( ! $linea)
6194
+			return $this->pingback_error(16, __('The source URL does not exist.'));
6195 6195
 
6196 6196
 		/**
6197 6197
 		 * Filter the pingback remote source.
@@ -6201,30 +6201,30 @@  discard block
 block discarded – undo
6201 6201
 		 * @param string $linea        Response object for the page linked from.
6202 6202
 		 * @param string $pagelinkedto URL of the page linked to.
6203 6203
 		 */
6204
-		$linea = apply_filters( 'pre_remote_source', $linea, $pagelinkedto );
6204
+		$linea = apply_filters('pre_remote_source', $linea, $pagelinkedto);
6205 6205
 
6206 6206
 		// Work around bug in strip_tags():
6207 6207
 		$linea = str_replace('<!DOC', '<DOC', $linea);
6208
-		$linea = preg_replace( '/[\r\n\t ]+/', ' ', $linea ); // normalize spaces
6209
-		$linea = preg_replace( "/<\/*(h1|h2|h3|h4|h5|h6|p|th|td|li|dt|dd|pre|caption|input|textarea|button|body)[^>]*>/", "\n\n", $linea );
6208
+		$linea = preg_replace('/[\r\n\t ]+/', ' ', $linea); // normalize spaces
6209
+		$linea = preg_replace("/<\/*(h1|h2|h3|h4|h5|h6|p|th|td|li|dt|dd|pre|caption|input|textarea|button|body)[^>]*>/", "\n\n", $linea);
6210 6210
 
6211 6211
 		preg_match('|<title>([^<]*?)</title>|is', $linea, $matchtitle);
6212 6212
 		$title = $matchtitle[1];
6213
-		if ( empty( $title ) )
6214
-			return $this->pingback_error( 32, __('We cannot find a title on that page.' ) );
6213
+		if (empty($title))
6214
+			return $this->pingback_error(32, __('We cannot find a title on that page.'));
6215 6215
 
6216
-		$linea = strip_tags( $linea, '<a>' ); // just keep the tag we need
6216
+		$linea = strip_tags($linea, '<a>'); // just keep the tag we need
6217 6217
 
6218
-		$p = explode( "\n\n", $linea );
6218
+		$p = explode("\n\n", $linea);
6219 6219
 
6220 6220
 		$preg_target = preg_quote($pagelinkedto, '|');
6221 6221
 
6222
-		foreach ( $p as $para ) {
6223
-			if ( strpos($para, $pagelinkedto) !== false ) { // it exists, but is it a link?
6222
+		foreach ($p as $para) {
6223
+			if (strpos($para, $pagelinkedto) !== false) { // it exists, but is it a link?
6224 6224
 				preg_match("|<a[^>]+?".$preg_target."[^>]*>([^>]+?)</a>|", $para, $context);
6225 6225
 
6226 6226
 				// If the URL isn't in a link context, keep looking
6227
-				if ( empty($context) )
6227
+				if (empty($context))
6228 6228
 					continue;
6229 6229
 
6230 6230
 				// We're going to use this fake tag to mark the context in a bit
@@ -6232,12 +6232,12 @@  discard block
 block discarded – undo
6232 6232
 				$excerpt = preg_replace('|\</?wpcontext\>|', '', $para);
6233 6233
 
6234 6234
 				// prevent really long link text
6235
-				if ( strlen($context[1]) > 100 )
6236
-					$context[1] = substr($context[1], 0, 100) . '&#8230;';
6235
+				if (strlen($context[1]) > 100)
6236
+					$context[1] = substr($context[1], 0, 100).'&#8230;';
6237 6237
 
6238
-				$marker = '<wpcontext>'.$context[1].'</wpcontext>';    // set up our marker
6239
-				$excerpt= str_replace($context[0], $marker, $excerpt); // swap out the link for our marker
6240
-				$excerpt = strip_tags($excerpt, '<wpcontext>');        // strip all tags but our context marker
6238
+				$marker = '<wpcontext>'.$context[1].'</wpcontext>'; // set up our marker
6239
+				$excerpt = str_replace($context[0], $marker, $excerpt); // swap out the link for our marker
6240
+				$excerpt = strip_tags($excerpt, '<wpcontext>'); // strip all tags but our context marker
6241 6241
 				$excerpt = trim($excerpt);
6242 6242
 				$preg_marker = preg_quote($marker, '|');
6243 6243
 				$excerpt = preg_replace("|.*?\s(.{0,100}$preg_marker.{0,100})\s.*|s", '$1', $excerpt);
@@ -6246,13 +6246,13 @@  discard block
 block discarded – undo
6246 6246
 			}
6247 6247
 		}
6248 6248
 
6249
-		if ( empty($context) ) // Link to target not found
6250
-			return $this->pingback_error( 17, __( 'The source URL does not contain a link to the target URL, and so cannot be used as a source.' ) );
6249
+		if (empty($context)) // Link to target not found
6250
+			return $this->pingback_error(17, __('The source URL does not contain a link to the target URL, and so cannot be used as a source.'));
6251 6251
 
6252 6252
 		$pagelinkedfrom = str_replace('&', '&amp;', $pagelinkedfrom);
6253 6253
 
6254
-		$context = '[&#8230;] ' . esc_html( $excerpt ) . ' [&#8230;]';
6255
-		$pagelinkedfrom = $this->escape( $pagelinkedfrom );
6254
+		$context = '[&#8230;] '.esc_html($excerpt).' [&#8230;]';
6255
+		$pagelinkedfrom = $this->escape($pagelinkedfrom);
6256 6256
 
6257 6257
 		$comment_post_ID = (int) $post_ID;
6258 6258
 		$comment_author = $title;
@@ -6274,7 +6274,7 @@  discard block
 block discarded – undo
6274 6274
 		 *
6275 6275
 		 * @param int $comment_ID Comment ID.
6276 6276
 		 */
6277
-		do_action( 'pingback_post', $comment_ID );
6277
+		do_action('pingback_post', $comment_ID);
6278 6278
 
6279 6279
 		return sprintf(__('Pingback from %1$s to %2$s registered. Keep the web talking! :-)'), $pagelinkedfrom, $pagelinkedto);
6280 6280
 	}
@@ -6291,35 +6291,35 @@  discard block
 block discarded – undo
6291 6291
 	 * @param string $url
6292 6292
 	 * @return array|IXR_Error
6293 6293
 	 */
6294
-	public function pingback_extensions_getPingbacks( $url ) {
6294
+	public function pingback_extensions_getPingbacks($url) {
6295 6295
 		global $wpdb;
6296 6296
 
6297 6297
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
6298
-		do_action( 'xmlrpc_call', 'pingback.extensions.getPingbacks' );
6298
+		do_action('xmlrpc_call', 'pingback.extensions.getPingbacks');
6299 6299
 
6300
-		$url = $this->escape( $url );
6300
+		$url = $this->escape($url);
6301 6301
 
6302 6302
 		$post_ID = url_to_postid($url);
6303
-		if ( !$post_ID ) {
6303
+		if ( ! $post_ID) {
6304 6304
 			// We aren't sure that the resource is available and/or pingback enabled
6305
-	  		return $this->pingback_error( 33, __( 'The specified target URL cannot be used as a target. It either doesn&#8217;t exist, or it is not a pingback-enabled resource.' ) );
6305
+	  		return $this->pingback_error(33, __('The specified target URL cannot be used as a target. It either doesn&#8217;t exist, or it is not a pingback-enabled resource.'));
6306 6306
 		}
6307 6307
 
6308 6308
 		$actual_post = get_post($post_ID, ARRAY_A);
6309 6309
 
6310
-		if ( !$actual_post ) {
6310
+		if ( ! $actual_post) {
6311 6311
 			// No such post = resource not found
6312
-	  		return $this->pingback_error( 32, __('The specified target URL does not exist.' ) );
6312
+	  		return $this->pingback_error(32, __('The specified target URL does not exist.'));
6313 6313
 		}
6314 6314
 
6315
-		$comments = $wpdb->get_results( $wpdb->prepare("SELECT comment_author_url, comment_content, comment_author_IP, comment_type FROM $wpdb->comments WHERE comment_post_ID = %d", $post_ID) );
6315
+		$comments = $wpdb->get_results($wpdb->prepare("SELECT comment_author_url, comment_content, comment_author_IP, comment_type FROM $wpdb->comments WHERE comment_post_ID = %d", $post_ID));
6316 6316
 
6317
-		if ( !$comments )
6317
+		if ( ! $comments)
6318 6318
 			return array();
6319 6319
 
6320 6320
 		$pingbacks = array();
6321
-		foreach ( $comments as $comment ) {
6322
-			if ( 'pingback' == $comment->comment_type )
6321
+		foreach ($comments as $comment) {
6322
+			if ('pingback' == $comment->comment_type)
6323 6323
 				$pingbacks[] = $comment->comment_author_url;
6324 6324
 		}
6325 6325
 
@@ -6331,7 +6331,7 @@  discard block
 block discarded – undo
6331 6331
 	 * @param string $message
6332 6332
 	 * @return IXR_Error
6333 6333
 	 */
6334
-	protected function pingback_error( $code, $message ) {
6334
+	protected function pingback_error($code, $message) {
6335 6335
 		/**
6336 6336
 		 * Filter the XML-RPC pingback error return.
6337 6337
 		 *
@@ -6339,6 +6339,6 @@  discard block
 block discarded – undo
6339 6339
 		 *
6340 6340
 		 * @param IXR_Error $error An IXR_Error object containing the error code and message.
6341 6341
 		 */
6342
-		return apply_filters( 'xmlrpc_pingback_error', new IXR_Error( $code, $message ) );
6342
+		return apply_filters('xmlrpc_pingback_error', new IXR_Error($code, $message));
6343 6343
 	}
6344 6344
 }
Please login to merge, or discard this patch.
Braces   +1165 added lines, -787 removed lines patch added patch discarded remove patch
@@ -297,14 +297,16 @@  discard block
 block discarded – undo
297 297
 	 *                     when array is passed.
298 298
 	 */
299 299
 	public function escape( &$data ) {
300
-		if ( ! is_array( $data ) )
301
-			return wp_slash( $data );
300
+		if ( ! is_array( $data ) ) {
301
+					return wp_slash( $data );
302
+		}
302 303
 
303 304
 		foreach ( $data as &$v ) {
304
-			if ( is_array( $v ) )
305
-				$this->escape( $v );
306
-			elseif ( ! is_object( $v ) )
307
-				$v = wp_slash( $v );
305
+			if ( is_array( $v ) ) {
306
+							$this->escape( $v );
307
+			} elseif ( ! is_object( $v ) ) {
308
+							$v = wp_slash( $v );
309
+			}
308 310
 		}
309 311
 	}
310 312
 
@@ -323,8 +325,9 @@  discard block
 block discarded – undo
323 325
 
324 326
 		foreach ( (array) has_meta($post_id) as $meta ) {
325 327
 			// Don't expose protected fields.
326
-			if ( ! current_user_can( 'edit_post_meta', $post_id , $meta['meta_key'] ) )
327
-				continue;
328
+			if ( ! current_user_can( 'edit_post_meta', $post_id , $meta['meta_key'] ) ) {
329
+							continue;
330
+			}
328 331
 
329 332
 			$custom_fields[] = array(
330 333
 				"id"    => $meta['meta_id'],
@@ -353,11 +356,13 @@  discard block
 block discarded – undo
353 356
 				$pmeta = get_metadata_by_mid( 'post', $meta['id'] );
354 357
 				if ( isset($meta['key']) ) {
355 358
 					$meta['key'] = wp_unslash( $meta['key'] );
356
-					if ( $meta['key'] !== $pmeta->meta_key )
357
-						continue;
359
+					if ( $meta['key'] !== $pmeta->meta_key ) {
360
+											continue;
361
+					}
358 362
 					$meta['value'] = wp_unslash( $meta['value'] );
359
-					if ( current_user_can( 'edit_post_meta', $post_id, $meta['key'] ) )
360
-						update_metadata_by_mid( 'post', $meta['id'], $meta['value'] );
363
+					if ( current_user_can( 'edit_post_meta', $post_id, $meta['key'] ) ) {
364
+											update_metadata_by_mid( 'post', $meta['id'], $meta['value'] );
365
+					}
361 366
 				} elseif ( current_user_can( 'delete_post_meta', $post_id, $pmeta->meta_key ) ) {
362 367
 					delete_metadata_by_mid( 'post', $meta['id'] );
363 368
 				}
@@ -560,8 +565,9 @@  discard block
 block discarded – undo
560 565
 		$username = $args[0];
561 566
 		$password = $args[1];
562 567
 
563
-		if ( !$user = $this->login($username, $password) )
564
-			return $this->error;
568
+		if ( !$user = $this->login($username, $password) ) {
569
+					return $this->error;
570
+		}
565 571
 
566 572
 		/**
567 573
 		 * Fires after the XML-RPC user has been authenticated but before the rest of
@@ -581,8 +587,9 @@  discard block
 block discarded – undo
581 587
 
582 588
 		foreach ( $blogs as $blog ) {
583 589
 			// Don't include blogs that aren't hosted at this site.
584
-			if ( $blog->site_id != get_current_site()->id )
585
-				continue;
590
+			if ( $blog->site_id != get_current_site()->id ) {
591
+							continue;
592
+			}
586 593
 
587 594
 			$blog_id = $blog->userblog_id;
588 595
 
@@ -642,17 +649,21 @@  discard block
 block discarded – undo
642 649
 			'_builtin' => (bool) $taxonomy->_builtin,
643 650
 		);
644 651
 
645
-		if ( in_array( 'labels', $fields ) )
646
-			$_taxonomy['labels'] = (array) $taxonomy->labels;
652
+		if ( in_array( 'labels', $fields ) ) {
653
+					$_taxonomy['labels'] = (array) $taxonomy->labels;
654
+		}
647 655
 
648
-		if ( in_array( 'cap', $fields ) )
649
-			$_taxonomy['cap'] = (array) $taxonomy->cap;
656
+		if ( in_array( 'cap', $fields ) ) {
657
+					$_taxonomy['cap'] = (array) $taxonomy->cap;
658
+		}
650 659
 
651
-		if ( in_array( 'menu', $fields ) )
652
-			$_taxonomy['show_in_menu'] = (bool) $_taxonomy->show_in_menu;
660
+		if ( in_array( 'menu', $fields ) ) {
661
+					$_taxonomy['show_in_menu'] = (bool) $_taxonomy->show_in_menu;
662
+		}
653 663
 
654
-		if ( in_array( 'object_type', $fields ) )
655
-			$_taxonomy['object_type'] = array_unique( (array) $taxonomy->object_type );
664
+		if ( in_array( 'object_type', $fields ) ) {
665
+					$_taxonomy['object_type'] = array_unique( (array) $taxonomy->object_type );
666
+		}
656 667
 
657 668
 		/**
658 669
 		 * Filter XML-RPC-prepared data for the given taxonomy.
@@ -676,8 +687,9 @@  discard block
 block discarded – undo
676 687
 	 */
677 688
 	protected function _prepare_term( $term ) {
678 689
 		$_term = $term;
679
-		if ( ! is_array( $_term ) )
680
-			$_term = get_object_vars( $_term );
690
+		if ( ! is_array( $_term ) ) {
691
+					$_term = get_object_vars( $_term );
692
+		}
681 693
 
682 694
 		// For integers which may be larger than XML-RPC supports ensure we return strings.
683 695
 		$_term['term_id'] = strval( $_term['term_id'] );
@@ -776,13 +788,15 @@  discard block
 block discarded – undo
776 788
 		}
777 789
 
778 790
 		// Consider future posts as published.
779
-		if ( $post_fields['post_status'] === 'future' )
780
-			$post_fields['post_status'] = 'publish';
791
+		if ( $post_fields['post_status'] === 'future' ) {
792
+					$post_fields['post_status'] = 'publish';
793
+		}
781 794
 
782 795
 		// Fill in blank post format.
783 796
 		$post_fields['post_format'] = get_post_format( $post['ID'] );
784
-		if ( empty( $post_fields['post_format'] ) )
785
-			$post_fields['post_format'] = 'standard';
797
+		if ( empty( $post_fields['post_format'] ) ) {
798
+					$post_fields['post_format'] = 'standard';
799
+		}
786 800
 
787 801
 		// Merge requested $post_fields fields into $_post.
788 802
 		if ( in_array( 'post', $fields ) ) {
@@ -803,8 +817,9 @@  discard block
 block discarded – undo
803 817
 			}
804 818
 		}
805 819
 
806
-		if ( in_array( 'custom_fields', $fields ) )
807
-			$_post['custom_fields'] = $this->get_custom_fields( $post['ID'] );
820
+		if ( in_array( 'custom_fields', $fields ) ) {
821
+					$_post['custom_fields'] = $this->get_custom_fields( $post['ID'] );
822
+		}
808 823
 
809 824
 		if ( in_array( 'enclosure', $fields ) ) {
810 825
 			$_post['enclosure'] = array();
@@ -865,8 +880,9 @@  discard block
 block discarded – undo
865 880
 			$_post_type['show_in_menu'] = (bool) $post_type->show_in_menu;
866 881
 		}
867 882
 
868
-		if ( in_array( 'taxonomies', $fields ) )
869
-			$_post_type['taxonomies'] = get_object_taxonomies( $post_type->name, 'names' );
883
+		if ( in_array( 'taxonomies', $fields ) ) {
884
+					$_post_type['taxonomies'] = get_object_taxonomies( $post_type->name, 'names' );
885
+		}
870 886
 
871 887
 		/**
872 888
 		 * Filter XML-RPC-prepared date for the given post type.
@@ -901,10 +917,11 @@  discard block
 block discarded – undo
901 917
 		);
902 918
 
903 919
 		$thumbnail_src = image_downsize( $media_item->ID, $thumbnail_size );
904
-		if ( $thumbnail_src )
905
-			$_media_item['thumbnail'] = $thumbnail_src[0];
906
-		else
907
-			$_media_item['thumbnail'] = $_media_item['link'];
920
+		if ( $thumbnail_src ) {
921
+					$_media_item['thumbnail'] = $thumbnail_src[0];
922
+		} else {
923
+					$_media_item['thumbnail'] = $_media_item['link'];
924
+		}
908 925
 
909 926
 		/**
910 927
 		 * Filter XML-RPC-prepared data for the given media item.
@@ -958,8 +975,9 @@  discard block
 block discarded – undo
958 975
 		$author = get_userdata( $page->post_author );
959 976
 
960 977
 		$page_template = get_page_template_slug( $page->ID );
961
-		if ( empty( $page_template ) )
962
-			$page_template = 'default';
978
+		if ( empty( $page_template ) ) {
979
+					$page_template = 'default';
980
+		}
963 981
 
964 982
 		$_page = array(
965 983
 			'dateCreated'            => $page_date,
@@ -1145,8 +1163,9 @@  discard block
 block discarded – undo
1145 1163
 	 * @return int|IXR_Error Post ID on success, IXR_Error instance otherwise.
1146 1164
 	 */
1147 1165
 	public function wp_newPost( $args ) {
1148
-		if ( ! $this->minimum_args( $args, 4 ) )
1149
-			return $this->error;
1166
+		if ( ! $this->minimum_args( $args, 4 ) ) {
1167
+					return $this->error;
1168
+		}
1150 1169
 
1151 1170
 		$this->escape( $args );
1152 1171
 
@@ -1154,8 +1173,9 @@  discard block
 block discarded – undo
1154 1173
 		$password       = $args[2];
1155 1174
 		$content_struct = $args[3];
1156 1175
 
1157
-		if ( ! $user = $this->login( $username, $password ) )
1158
-			return $this->error;
1176
+		if ( ! $user = $this->login( $username, $password ) ) {
1177
+					return $this->error;
1178
+		}
1159 1179
 
1160 1180
 		// convert the date field back to IXR form
1161 1181
 		if ( isset( $content_struct['post_date'] ) && ! ( $content_struct['post_date'] instanceof IXR_Date ) ) {
@@ -1248,21 +1268,26 @@  discard block
 block discarded – undo
1248 1268
 		$post_data = wp_parse_args( $content_struct, $defaults );
1249 1269
 
1250 1270
 		$post_type = get_post_type_object( $post_data['post_type'] );
1251
-		if ( ! $post_type )
1252
-			return new IXR_Error( 403, __( 'Invalid post type' ) );
1271
+		if ( ! $post_type ) {
1272
+					return new IXR_Error( 403, __( 'Invalid post type' ) );
1273
+		}
1253 1274
 
1254 1275
 		$update = ! empty( $post_data['ID'] );
1255 1276
 
1256 1277
 		if ( $update ) {
1257
-			if ( ! get_post( $post_data['ID'] ) )
1258
-				return new IXR_Error( 401, __( 'Invalid post ID.' ) );
1259
-			if ( ! current_user_can( 'edit_post', $post_data['ID'] ) )
1260
-				return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post.' ) );
1261
-			if ( $post_data['post_type'] != get_post_type( $post_data['ID'] ) )
1262
-				return new IXR_Error( 401, __( 'The post type may not be changed.' ) );
1278
+			if ( ! get_post( $post_data['ID'] ) ) {
1279
+							return new IXR_Error( 401, __( 'Invalid post ID.' ) );
1280
+			}
1281
+			if ( ! current_user_can( 'edit_post', $post_data['ID'] ) ) {
1282
+							return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post.' ) );
1283
+			}
1284
+			if ( $post_data['post_type'] != get_post_type( $post_data['ID'] ) ) {
1285
+							return new IXR_Error( 401, __( 'The post type may not be changed.' ) );
1286
+			}
1263 1287
 		} else {
1264
-			if ( ! current_user_can( $post_type->cap->create_posts ) || ! current_user_can( $post_type->cap->edit_posts ) )
1265
-				return new IXR_Error( 401, __( 'Sorry, you are not allowed to post on this site.' ) );
1288
+			if ( ! current_user_can( $post_type->cap->create_posts ) || ! current_user_can( $post_type->cap->edit_posts ) ) {
1289
+							return new IXR_Error( 401, __( 'Sorry, you are not allowed to post on this site.' ) );
1290
+			}
1266 1291
 		}
1267 1292
 
1268 1293
 		switch ( $post_data['post_status'] ) {
@@ -1270,41 +1295,49 @@  discard block
 block discarded – undo
1270 1295
 			case 'pending':
1271 1296
 				break;
1272 1297
 			case 'private':
1273
-				if ( ! current_user_can( $post_type->cap->publish_posts ) )
1274
-					return new IXR_Error( 401, __( 'Sorry, you are not allowed to create private posts in this post type' ) );
1298
+				if ( ! current_user_can( $post_type->cap->publish_posts ) ) {
1299
+									return new IXR_Error( 401, __( 'Sorry, you are not allowed to create private posts in this post type' ) );
1300
+				}
1275 1301
 				break;
1276 1302
 			case 'publish':
1277 1303
 			case 'future':
1278
-				if ( ! current_user_can( $post_type->cap->publish_posts ) )
1279
-					return new IXR_Error( 401, __( 'Sorry, you are not allowed to publish posts in this post type' ) );
1304
+				if ( ! current_user_can( $post_type->cap->publish_posts ) ) {
1305
+									return new IXR_Error( 401, __( 'Sorry, you are not allowed to publish posts in this post type' ) );
1306
+				}
1280 1307
 				break;
1281 1308
 			default:
1282
-				if ( ! get_post_status_object( $post_data['post_status'] ) )
1283
-					$post_data['post_status'] = 'draft';
1309
+				if ( ! get_post_status_object( $post_data['post_status'] ) ) {
1310
+									$post_data['post_status'] = 'draft';
1311
+				}
1284 1312
 			break;
1285 1313
 		}
1286 1314
 
1287
-		if ( ! empty( $post_data['post_password'] ) && ! current_user_can( $post_type->cap->publish_posts ) )
1288
-			return new IXR_Error( 401, __( 'Sorry, you are not allowed to create password protected posts in this post type' ) );
1315
+		if ( ! empty( $post_data['post_password'] ) && ! current_user_can( $post_type->cap->publish_posts ) ) {
1316
+					return new IXR_Error( 401, __( 'Sorry, you are not allowed to create password protected posts in this post type' ) );
1317
+		}
1289 1318
 
1290 1319
 		$post_data['post_author'] = absint( $post_data['post_author'] );
1291 1320
 		if ( ! empty( $post_data['post_author'] ) && $post_data['post_author'] != $user->ID ) {
1292
-			if ( ! current_user_can( $post_type->cap->edit_others_posts ) )
1293
-				return new IXR_Error( 401, __( 'You are not allowed to create posts as this user.' ) );
1321
+			if ( ! current_user_can( $post_type->cap->edit_others_posts ) ) {
1322
+							return new IXR_Error( 401, __( 'You are not allowed to create posts as this user.' ) );
1323
+			}
1294 1324
 
1295 1325
 			$author = get_userdata( $post_data['post_author'] );
1296 1326
 
1297
-			if ( ! $author )
1298
-				return new IXR_Error( 404, __( 'Invalid author ID.' ) );
1327
+			if ( ! $author ) {
1328
+							return new IXR_Error( 404, __( 'Invalid author ID.' ) );
1329
+			}
1299 1330
 		} else {
1300 1331
 			$post_data['post_author'] = $user->ID;
1301 1332
 		}
1302 1333
 
1303
-		if ( isset( $post_data['comment_status'] ) && $post_data['comment_status'] != 'open' && $post_data['comment_status'] != 'closed' )
1304
-			unset( $post_data['comment_status'] );
1334
+		if ( isset( $post_data['comment_status'] ) && $post_data['comment_status'] != 'open' && $post_data['comment_status'] != 'closed' ) {
1335
+					unset( $post_data['comment_status'] );
1336
+		}
1305 1337
 
1306
-		if ( isset( $post_data['ping_status'] ) && $post_data['ping_status'] != 'open' && $post_data['ping_status'] != 'closed' )
1307
-			unset( $post_data['ping_status'] );
1338
+		if ( isset( $post_data['ping_status'] ) && $post_data['ping_status'] != 'open' && $post_data['ping_status'] != 'closed' ) {
1339
+					unset( $post_data['ping_status'] );
1340
+		}
1308 1341
 
1309 1342
 		// Do some timestamp voodoo.
1310 1343
 		if ( ! empty( $post_data['post_date_gmt'] ) ) {
@@ -1319,8 +1352,9 @@  discard block
 block discarded – undo
1319 1352
 			$post_data['post_date_gmt'] = iso8601_to_datetime( $dateCreated, 'GMT' );
1320 1353
 		}
1321 1354
 
1322
-		if ( ! isset( $post_data['ID'] ) )
1323
-			$post_data['ID'] = get_default_post_to_edit( $post_data['post_type'], true )->ID;
1355
+		if ( ! isset( $post_data['ID'] ) ) {
1356
+					$post_data['ID'] = get_default_post_to_edit( $post_data['post_type'], true )->ID;
1357
+		}
1324 1358
 		$post_ID = $post_data['ID'];
1325 1359
 
1326 1360
 		if ( $post_data['post_type'] == 'post' ) {
@@ -1332,16 +1366,18 @@  discard block
 block discarded – undo
1332 1366
 
1333 1367
 		if ( isset( $post_data['post_thumbnail'] ) ) {
1334 1368
 			// empty value deletes, non-empty value adds/updates.
1335
-			if ( ! $post_data['post_thumbnail'] )
1336
-				delete_post_thumbnail( $post_ID );
1337
-			elseif ( ! get_post( absint( $post_data['post_thumbnail'] ) ) )
1338
-				return new IXR_Error( 404, __( 'Invalid attachment ID.' ) );
1369
+			if ( ! $post_data['post_thumbnail'] ) {
1370
+							delete_post_thumbnail( $post_ID );
1371
+			} elseif ( ! get_post( absint( $post_data['post_thumbnail'] ) ) ) {
1372
+							return new IXR_Error( 404, __( 'Invalid attachment ID.' ) );
1373
+			}
1339 1374
 			set_post_thumbnail( $post_ID, $post_data['post_thumbnail'] );
1340 1375
 			unset( $content_struct['post_thumbnail'] );
1341 1376
 		}
1342 1377
 
1343
-		if ( isset( $post_data['custom_fields'] ) )
1344
-			$this->set_custom_fields( $post_ID, $post_data['custom_fields'] );
1378
+		if ( isset( $post_data['custom_fields'] ) ) {
1379
+					$this->set_custom_fields( $post_ID, $post_data['custom_fields'] );
1380
+		}
1345 1381
 
1346 1382
 		if ( isset( $post_data['terms'] ) || isset( $post_data['terms_names'] ) ) {
1347 1383
 			$post_type_taxonomies = get_object_taxonomies( $post_data['post_type'], 'objects' );
@@ -1355,19 +1391,22 @@  discard block
 block discarded – undo
1355 1391
 
1356 1392
 				// Validating term ids.
1357 1393
 				foreach ( $taxonomies as $taxonomy ) {
1358
-					if ( ! array_key_exists( $taxonomy , $post_type_taxonomies ) )
1359
-						return new IXR_Error( 401, __( 'Sorry, one of the given taxonomies is not supported by the post type.' ) );
1394
+					if ( ! array_key_exists( $taxonomy , $post_type_taxonomies ) ) {
1395
+											return new IXR_Error( 401, __( 'Sorry, one of the given taxonomies is not supported by the post type.' ) );
1396
+					}
1360 1397
 
1361
-					if ( ! current_user_can( $post_type_taxonomies[$taxonomy]->cap->assign_terms ) )
1362
-						return new IXR_Error( 401, __( 'Sorry, you are not allowed to assign a term to one of the given taxonomies.' ) );
1398
+					if ( ! current_user_can( $post_type_taxonomies[$taxonomy]->cap->assign_terms ) ) {
1399
+											return new IXR_Error( 401, __( 'Sorry, you are not allowed to assign a term to one of the given taxonomies.' ) );
1400
+					}
1363 1401
 
1364 1402
 					$term_ids = $post_data['terms'][$taxonomy];
1365 1403
 					$terms[ $taxonomy ] = array();
1366 1404
 					foreach ( $term_ids as $term_id ) {
1367 1405
 						$term = get_term_by( 'id', $term_id, $taxonomy );
1368 1406
 
1369
-						if ( ! $term )
1370
-							return new IXR_Error( 403, __( 'Invalid term ID' ) );
1407
+						if ( ! $term ) {
1408
+													return new IXR_Error( 403, __( 'Invalid term ID' ) );
1409
+						}
1371 1410
 
1372 1411
 						$terms[$taxonomy][] = (int) $term_id;
1373 1412
 					}
@@ -1379,11 +1418,13 @@  discard block
 block discarded – undo
1379 1418
 				$taxonomies = array_keys( $post_data['terms_names'] );
1380 1419
 
1381 1420
 				foreach ( $taxonomies as $taxonomy ) {
1382
-					if ( ! array_key_exists( $taxonomy , $post_type_taxonomies ) )
1383
-						return new IXR_Error( 401, __( 'Sorry, one of the given taxonomies is not supported by the post type.' ) );
1421
+					if ( ! array_key_exists( $taxonomy , $post_type_taxonomies ) ) {
1422
+											return new IXR_Error( 401, __( 'Sorry, one of the given taxonomies is not supported by the post type.' ) );
1423
+					}
1384 1424
 
1385
-					if ( ! current_user_can( $post_type_taxonomies[$taxonomy]->cap->assign_terms ) )
1386
-						return new IXR_Error( 401, __( 'Sorry, you are not allowed to assign a term to one of the given taxonomies.' ) );
1425
+					if ( ! current_user_can( $post_type_taxonomies[$taxonomy]->cap->assign_terms ) ) {
1426
+											return new IXR_Error( 401, __( 'Sorry, you are not allowed to assign a term to one of the given taxonomies.' ) );
1427
+					}
1387 1428
 
1388 1429
 					/*
1389 1430
 					 * For hierarchical taxonomies, we can't assign a term when multiple terms
@@ -1404,20 +1445,23 @@  discard block
 block discarded – undo
1404 1445
 
1405 1446
 					$term_names = $post_data['terms_names'][$taxonomy];
1406 1447
 					foreach ( $term_names as $term_name ) {
1407
-						if ( in_array( $term_name, $ambiguous_terms ) )
1408
-							return new IXR_Error( 401, __( 'Ambiguous term name used in a hierarchical taxonomy. Please use term ID instead.' ) );
1448
+						if ( in_array( $term_name, $ambiguous_terms ) ) {
1449
+													return new IXR_Error( 401, __( 'Ambiguous term name used in a hierarchical taxonomy. Please use term ID instead.' ) );
1450
+						}
1409 1451
 
1410 1452
 						$term = get_term_by( 'name', $term_name, $taxonomy );
1411 1453
 
1412 1454
 						if ( ! $term ) {
1413 1455
 							// Term doesn't exist, so check that the user is allowed to create new terms.
1414
-							if ( ! current_user_can( $post_type_taxonomies[$taxonomy]->cap->edit_terms ) )
1415
-								return new IXR_Error( 401, __( 'Sorry, you are not allowed to add a term to one of the given taxonomies.' ) );
1456
+							if ( ! current_user_can( $post_type_taxonomies[$taxonomy]->cap->edit_terms ) ) {
1457
+															return new IXR_Error( 401, __( 'Sorry, you are not allowed to add a term to one of the given taxonomies.' ) );
1458
+							}
1416 1459
 
1417 1460
 							// Create the new term.
1418 1461
 							$term_info = wp_insert_term( $term_name, $taxonomy );
1419
-							if ( is_wp_error( $term_info ) )
1420
-								return new IXR_Error( 500, $term_info->get_error_message() );
1462
+							if ( is_wp_error( $term_info ) ) {
1463
+															return new IXR_Error( 500, $term_info->get_error_message() );
1464
+							}
1421 1465
 
1422 1466
 							$terms[$taxonomy][] = (int) $term_info['term_id'];
1423 1467
 						} else {
@@ -1437,8 +1481,9 @@  discard block
 block discarded – undo
1437 1481
 		if ( isset( $post_data['post_format'] ) ) {
1438 1482
 			$format = set_post_format( $post_ID, $post_data['post_format'] );
1439 1483
 
1440
-			if ( is_wp_error( $format ) )
1441
-				return new IXR_Error( 500, $format->get_error_message() );
1484
+			if ( is_wp_error( $format ) ) {
1485
+							return new IXR_Error( 500, $format->get_error_message() );
1486
+			}
1442 1487
 
1443 1488
 			unset( $post_data['post_format'] );
1444 1489
 		}
@@ -1460,11 +1505,13 @@  discard block
 block discarded – undo
1460 1505
 		$post_data = apply_filters( 'xmlrpc_wp_insert_post_data', $post_data, $content_struct );
1461 1506
 
1462 1507
 		$post_ID = $update ? wp_update_post( $post_data, true ) : wp_insert_post( $post_data, true );
1463
-		if ( is_wp_error( $post_ID ) )
1464
-			return new IXR_Error( 500, $post_ID->get_error_message() );
1508
+		if ( is_wp_error( $post_ID ) ) {
1509
+					return new IXR_Error( 500, $post_ID->get_error_message() );
1510
+		}
1465 1511
 
1466
-		if ( ! $post_ID )
1467
-			return new IXR_Error( 401, __( 'Sorry, your entry could not be posted. Something wrong happened.' ) );
1512
+		if ( ! $post_ID ) {
1513
+					return new IXR_Error( 401, __( 'Sorry, your entry could not be posted. Something wrong happened.' ) );
1514
+		}
1468 1515
 
1469 1516
 		return strval( $post_ID );
1470 1517
 	}
@@ -1489,8 +1536,9 @@  discard block
 block discarded – undo
1489 1536
 	 * @return true|IXR_Error True on success, IXR_Error on failure.
1490 1537
 	 */
1491 1538
 	public function wp_editPost( $args ) {
1492
-		if ( ! $this->minimum_args( $args, 5 ) )
1493
-			return $this->error;
1539
+		if ( ! $this->minimum_args( $args, 5 ) ) {
1540
+					return $this->error;
1541
+		}
1494 1542
 
1495 1543
 		$this->escape( $args );
1496 1544
 
@@ -1499,16 +1547,18 @@  discard block
 block discarded – undo
1499 1547
 		$post_id        = (int) $args[3];
1500 1548
 		$content_struct = $args[4];
1501 1549
 
1502
-		if ( ! $user = $this->login( $username, $password ) )
1503
-			return $this->error;
1550
+		if ( ! $user = $this->login( $username, $password ) ) {
1551
+					return $this->error;
1552
+		}
1504 1553
 
1505 1554
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
1506 1555
 		do_action( 'xmlrpc_call', 'wp.editPost' );
1507 1556
 
1508 1557
 		$post = get_post( $post_id, ARRAY_A );
1509 1558
 
1510
-		if ( empty( $post['ID'] ) )
1511
-			return new IXR_Error( 404, __( 'Invalid post ID.' ) );
1559
+		if ( empty( $post['ID'] ) ) {
1560
+					return new IXR_Error( 404, __( 'Invalid post ID.' ) );
1561
+		}
1512 1562
 
1513 1563
 		if ( isset( $content_struct['if_not_modified_since'] ) ) {
1514 1564
 			// If the post has been modified since the date provided, return an error.
@@ -1524,17 +1574,19 @@  discard block
 block discarded – undo
1524 1574
 		 * Ignore the existing GMT date if it is empty or a non-GMT date was supplied in $content_struct,
1525 1575
 		 * since _insert_post() will ignore the non-GMT date if the GMT date is set.
1526 1576
 		 */
1527
-		if ( $post['post_date_gmt'] == '0000-00-00 00:00:00' || isset( $content_struct['post_date'] ) )
1528
-			unset( $post['post_date_gmt'] );
1529
-		else
1530
-			$post['post_date_gmt'] = $this->_convert_date( $post['post_date_gmt'] );
1577
+		if ( $post['post_date_gmt'] == '0000-00-00 00:00:00' || isset( $content_struct['post_date'] ) ) {
1578
+					unset( $post['post_date_gmt'] );
1579
+		} else {
1580
+					$post['post_date_gmt'] = $this->_convert_date( $post['post_date_gmt'] );
1581
+		}
1531 1582
 
1532 1583
 		$this->escape( $post );
1533 1584
 		$merged_content_struct = array_merge( $post, $content_struct );
1534 1585
 
1535 1586
 		$retval = $this->_insert_post( $user, $merged_content_struct );
1536
-		if ( $retval instanceof IXR_Error )
1537
-			return $retval;
1587
+		if ( $retval instanceof IXR_Error ) {
1588
+					return $retval;
1589
+		}
1538 1590
 
1539 1591
 		return true;
1540 1592
 	}
@@ -1557,8 +1609,9 @@  discard block
 block discarded – undo
1557 1609
 	 * @return true|IXR_Error True on success, IXR_Error instance on failure.
1558 1610
 	 */
1559 1611
 	public function wp_deletePost( $args ) {
1560
-		if ( ! $this->minimum_args( $args, 4 ) )
1561
-			return $this->error;
1612
+		if ( ! $this->minimum_args( $args, 4 ) ) {
1613
+					return $this->error;
1614
+		}
1562 1615
 
1563 1616
 		$this->escape( $args );
1564 1617
 
@@ -1566,23 +1619,27 @@  discard block
 block discarded – undo
1566 1619
 		$password   = $args[2];
1567 1620
 		$post_id    = (int) $args[3];
1568 1621
 
1569
-		if ( ! $user = $this->login( $username, $password ) )
1570
-			return $this->error;
1622
+		if ( ! $user = $this->login( $username, $password ) ) {
1623
+					return $this->error;
1624
+		}
1571 1625
 
1572 1626
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
1573 1627
 		do_action( 'xmlrpc_call', 'wp.deletePost' );
1574 1628
 
1575 1629
 		$post = get_post( $post_id, ARRAY_A );
1576
-		if ( empty( $post['ID'] ) )
1577
-			return new IXR_Error( 404, __( 'Invalid post ID.' ) );
1630
+		if ( empty( $post['ID'] ) ) {
1631
+					return new IXR_Error( 404, __( 'Invalid post ID.' ) );
1632
+		}
1578 1633
 
1579
-		if ( ! current_user_can( 'delete_post', $post_id ) )
1580
-			return new IXR_Error( 401, __( 'Sorry, you are not allowed to delete this post.' ) );
1634
+		if ( ! current_user_can( 'delete_post', $post_id ) ) {
1635
+					return new IXR_Error( 401, __( 'Sorry, you are not allowed to delete this post.' ) );
1636
+		}
1581 1637
 
1582 1638
 		$result = wp_delete_post( $post_id );
1583 1639
 
1584
-		if ( ! $result )
1585
-			return new IXR_Error( 500, __( 'The post cannot be deleted.' ) );
1640
+		if ( ! $result ) {
1641
+					return new IXR_Error( 500, __( 'The post cannot be deleted.' ) );
1642
+		}
1586 1643
 
1587 1644
 		return true;
1588 1645
 	}
@@ -1637,8 +1694,9 @@  discard block
 block discarded – undo
1637 1694
 	 *  - 'enclosure'
1638 1695
 	 */
1639 1696
 	public function wp_getPost( $args ) {
1640
-		if ( ! $this->minimum_args( $args, 4 ) )
1641
-			return $this->error;
1697
+		if ( ! $this->minimum_args( $args, 4 ) ) {
1698
+					return $this->error;
1699
+		}
1642 1700
 
1643 1701
 		$this->escape( $args );
1644 1702
 
@@ -1660,19 +1718,22 @@  discard block
 block discarded – undo
1660 1718
 			$fields = apply_filters( 'xmlrpc_default_post_fields', array( 'post', 'terms', 'custom_fields' ), 'wp.getPost' );
1661 1719
 		}
1662 1720
 
1663
-		if ( ! $user = $this->login( $username, $password ) )
1664
-			return $this->error;
1721
+		if ( ! $user = $this->login( $username, $password ) ) {
1722
+					return $this->error;
1723
+		}
1665 1724
 
1666 1725
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
1667 1726
 		do_action( 'xmlrpc_call', 'wp.getPost' );
1668 1727
 
1669 1728
 		$post = get_post( $post_id, ARRAY_A );
1670 1729
 
1671
-		if ( empty( $post['ID'] ) )
1672
-			return new IXR_Error( 404, __( 'Invalid post ID.' ) );
1730
+		if ( empty( $post['ID'] ) ) {
1731
+					return new IXR_Error( 404, __( 'Invalid post ID.' ) );
1732
+		}
1673 1733
 
1674
-		if ( ! current_user_can( 'edit_post', $post_id ) )
1675
-			return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) );
1734
+		if ( ! current_user_can( 'edit_post', $post_id ) ) {
1735
+					return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) );
1736
+		}
1676 1737
 
1677 1738
 		return $this->_prepare_post( $post, $fields );
1678 1739
 	}
@@ -1700,8 +1761,9 @@  discard block
 block discarded – undo
1700 1761
 	 * @return array|IXR_Error Array contains a collection of posts.
1701 1762
 	 */
1702 1763
 	public function wp_getPosts( $args ) {
1703
-		if ( ! $this->minimum_args( $args, 3 ) )
1704
-			return $this->error;
1764
+		if ( ! $this->minimum_args( $args, 3 ) ) {
1765
+					return $this->error;
1766
+		}
1705 1767
 
1706 1768
 		$this->escape( $args );
1707 1769
 
@@ -1716,8 +1778,9 @@  discard block
 block discarded – undo
1716 1778
 			$fields = apply_filters( 'xmlrpc_default_post_fields', array( 'post', 'terms', 'custom_fields' ), 'wp.getPosts' );
1717 1779
 		}
1718 1780
 
1719
-		if ( ! $user = $this->login( $username, $password ) )
1720
-			return $this->error;
1781
+		if ( ! $user = $this->login( $username, $password ) ) {
1782
+					return $this->error;
1783
+		}
1721 1784
 
1722 1785
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
1723 1786
 		do_action( 'xmlrpc_call', 'wp.getPosts' );
@@ -1726,31 +1789,37 @@  discard block
 block discarded – undo
1726 1789
 
1727 1790
 		if ( isset( $filter['post_type'] ) ) {
1728 1791
 			$post_type = get_post_type_object( $filter['post_type'] );
1729
-			if ( ! ( (bool) $post_type ) )
1730
-				return new IXR_Error( 403, __( 'The post type specified is not valid' ) );
1792
+			if ( ! ( (bool) $post_type ) ) {
1793
+							return new IXR_Error( 403, __( 'The post type specified is not valid' ) );
1794
+			}
1731 1795
 		} else {
1732 1796
 			$post_type = get_post_type_object( 'post' );
1733 1797
 		}
1734 1798
 
1735
-		if ( ! current_user_can( $post_type->cap->edit_posts ) )
1736
-			return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit posts in this post type' ));
1799
+		if ( ! current_user_can( $post_type->cap->edit_posts ) ) {
1800
+					return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit posts in this post type' ));
1801
+		}
1737 1802
 
1738 1803
 		$query['post_type'] = $post_type->name;
1739 1804
 
1740
-		if ( isset( $filter['post_status'] ) )
1741
-			$query['post_status'] = $filter['post_status'];
1805
+		if ( isset( $filter['post_status'] ) ) {
1806
+					$query['post_status'] = $filter['post_status'];
1807
+		}
1742 1808
 
1743
-		if ( isset( $filter['number'] ) )
1744
-			$query['numberposts'] = absint( $filter['number'] );
1809
+		if ( isset( $filter['number'] ) ) {
1810
+					$query['numberposts'] = absint( $filter['number'] );
1811
+		}
1745 1812
 
1746
-		if ( isset( $filter['offset'] ) )
1747
-			$query['offset'] = absint( $filter['offset'] );
1813
+		if ( isset( $filter['offset'] ) ) {
1814
+					$query['offset'] = absint( $filter['offset'] );
1815
+		}
1748 1816
 
1749 1817
 		if ( isset( $filter['orderby'] ) ) {
1750 1818
 			$query['orderby'] = $filter['orderby'];
1751 1819
 
1752
-			if ( isset( $filter['order'] ) )
1753
-				$query['order'] = $filter['order'];
1820
+			if ( isset( $filter['order'] ) ) {
1821
+							$query['order'] = $filter['order'];
1822
+			}
1754 1823
 		}
1755 1824
 
1756 1825
 		if ( isset( $filter['s'] ) ) {
@@ -1759,15 +1828,17 @@  discard block
 block discarded – undo
1759 1828
 
1760 1829
 		$posts_list = wp_get_recent_posts( $query );
1761 1830
 
1762
-		if ( ! $posts_list )
1763
-			return array();
1831
+		if ( ! $posts_list ) {
1832
+					return array();
1833
+		}
1764 1834
 
1765 1835
 		// Holds all the posts data.
1766 1836
 		$struct = array();
1767 1837
 
1768 1838
 		foreach ( $posts_list as $post ) {
1769
-			if ( ! current_user_can( 'edit_post', $post['ID'] ) )
1770
-				continue;
1839
+			if ( ! current_user_can( 'edit_post', $post['ID'] ) ) {
1840
+							continue;
1841
+			}
1771 1842
 
1772 1843
 			$struct[] = $this->_prepare_post( $post, $fields );
1773 1844
 		}
@@ -1795,8 +1866,9 @@  discard block
 block discarded – undo
1795 1866
 	 * @return int|IXR_Error The term ID on success, or an IXR_Error object on failure.
1796 1867
 	 */
1797 1868
 	public function wp_newTerm( $args ) {
1798
-		if ( ! $this->minimum_args( $args, 4 ) )
1799
-			return $this->error;
1869
+		if ( ! $this->minimum_args( $args, 4 ) ) {
1870
+					return $this->error;
1871
+		}
1800 1872
 
1801 1873
 		$this->escape( $args );
1802 1874
 
@@ -1804,19 +1876,22 @@  discard block
 block discarded – undo
1804 1876
 		$password       = $args[2];
1805 1877
 		$content_struct = $args[3];
1806 1878
 
1807
-		if ( ! $user = $this->login( $username, $password ) )
1808
-			return $this->error;
1879
+		if ( ! $user = $this->login( $username, $password ) ) {
1880
+					return $this->error;
1881
+		}
1809 1882
 
1810 1883
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
1811 1884
 		do_action( 'xmlrpc_call', 'wp.newTerm' );
1812 1885
 
1813
-		if ( ! taxonomy_exists( $content_struct['taxonomy'] ) )
1814
-			return new IXR_Error( 403, __( 'Invalid taxonomy' ) );
1886
+		if ( ! taxonomy_exists( $content_struct['taxonomy'] ) ) {
1887
+					return new IXR_Error( 403, __( 'Invalid taxonomy' ) );
1888
+		}
1815 1889
 
1816 1890
 		$taxonomy = get_taxonomy( $content_struct['taxonomy'] );
1817 1891
 
1818
-		if ( ! current_user_can( $taxonomy->cap->manage_terms ) )
1819
-			return new IXR_Error( 401, __( 'You are not allowed to create terms in this taxonomy.' ) );
1892
+		if ( ! current_user_can( $taxonomy->cap->manage_terms ) ) {
1893
+					return new IXR_Error( 401, __( 'You are not allowed to create terms in this taxonomy.' ) );
1894
+		}
1820 1895
 
1821 1896
 		$taxonomy = (array) $taxonomy;
1822 1897
 
@@ -1824,38 +1899,46 @@  discard block
 block discarded – undo
1824 1899
 		$term_data = array();
1825 1900
 
1826 1901
 		$term_data['name'] = trim( $content_struct['name'] );
1827
-		if ( empty( $term_data['name'] ) )
1828
-			return new IXR_Error( 403, __( 'The term name cannot be empty.' ) );
1902
+		if ( empty( $term_data['name'] ) ) {
1903
+					return new IXR_Error( 403, __( 'The term name cannot be empty.' ) );
1904
+		}
1829 1905
 
1830 1906
 		if ( isset( $content_struct['parent'] ) ) {
1831
-			if ( ! $taxonomy['hierarchical'] )
1832
-				return new IXR_Error( 403, __( 'This taxonomy is not hierarchical.' ) );
1907
+			if ( ! $taxonomy['hierarchical'] ) {
1908
+							return new IXR_Error( 403, __( 'This taxonomy is not hierarchical.' ) );
1909
+			}
1833 1910
 
1834 1911
 			$parent_term_id = (int) $content_struct['parent'];
1835 1912
 			$parent_term = get_term( $parent_term_id , $taxonomy['name'] );
1836 1913
 
1837
-			if ( is_wp_error( $parent_term ) )
1838
-				return new IXR_Error( 500, $parent_term->get_error_message() );
1914
+			if ( is_wp_error( $parent_term ) ) {
1915
+							return new IXR_Error( 500, $parent_term->get_error_message() );
1916
+			}
1839 1917
 
1840
-			if ( ! $parent_term )
1841
-				return new IXR_Error( 403, __( 'Parent term does not exist.' ) );
1918
+			if ( ! $parent_term ) {
1919
+							return new IXR_Error( 403, __( 'Parent term does not exist.' ) );
1920
+			}
1842 1921
 
1843 1922
 			$term_data['parent'] = $content_struct['parent'];
1844 1923
 		}
1845 1924
 
1846
-		if ( isset( $content_struct['description'] ) )
1847
-			$term_data['description'] = $content_struct['description'];
1925
+		if ( isset( $content_struct['description'] ) ) {
1926
+					$term_data['description'] = $content_struct['description'];
1927
+		}
1848 1928
 
1849
-		if ( isset( $content_struct['slug'] ) )
1850
-			$term_data['slug'] = $content_struct['slug'];
1929
+		if ( isset( $content_struct['slug'] ) ) {
1930
+					$term_data['slug'] = $content_struct['slug'];
1931
+		}
1851 1932
 
1852 1933
 		$term = wp_insert_term( $term_data['name'] , $taxonomy['name'] , $term_data );
1853 1934
 
1854
-		if ( is_wp_error( $term ) )
1855
-			return new IXR_Error( 500, $term->get_error_message() );
1935
+		if ( is_wp_error( $term ) ) {
1936
+					return new IXR_Error( 500, $term->get_error_message() );
1937
+		}
1856 1938
 
1857
-		if ( ! $term )
1858
-			return new IXR_Error( 500, __( 'Sorry, your term could not be created. Something wrong happened.' ) );
1939
+		if ( ! $term ) {
1940
+					return new IXR_Error( 500, __( 'Sorry, your term could not be created. Something wrong happened.' ) );
1941
+		}
1859 1942
 
1860 1943
 		return strval( $term['term_id'] );
1861 1944
 	}
@@ -1881,8 +1964,9 @@  discard block
 block discarded – undo
1881 1964
 	 * @return true|IXR_Error True on success, IXR_Error instance on failure.
1882 1965
 	 */
1883 1966
 	public function wp_editTerm( $args ) {
1884
-		if ( ! $this->minimum_args( $args, 5 ) )
1885
-			return $this->error;
1967
+		if ( ! $this->minimum_args( $args, 5 ) ) {
1968
+					return $this->error;
1969
+		}
1886 1970
 
1887 1971
 		$this->escape( $args );
1888 1972
 
@@ -1891,19 +1975,22 @@  discard block
 block discarded – undo
1891 1975
 		$term_id        = (int) $args[3];
1892 1976
 		$content_struct = $args[4];
1893 1977
 
1894
-		if ( ! $user = $this->login( $username, $password ) )
1895
-			return $this->error;
1978
+		if ( ! $user = $this->login( $username, $password ) ) {
1979
+					return $this->error;
1980
+		}
1896 1981
 
1897 1982
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
1898 1983
 		do_action( 'xmlrpc_call', 'wp.editTerm' );
1899 1984
 
1900
-		if ( ! taxonomy_exists( $content_struct['taxonomy'] ) )
1901
-			return new IXR_Error( 403, __( 'Invalid taxonomy' ) );
1985
+		if ( ! taxonomy_exists( $content_struct['taxonomy'] ) ) {
1986
+					return new IXR_Error( 403, __( 'Invalid taxonomy' ) );
1987
+		}
1902 1988
 
1903 1989
 		$taxonomy = get_taxonomy( $content_struct['taxonomy'] );
1904 1990
 
1905
-		if ( ! current_user_can( $taxonomy->cap->edit_terms ) )
1906
-			return new IXR_Error( 401, __( 'You are not allowed to edit terms in this taxonomy.' ) );
1991
+		if ( ! current_user_can( $taxonomy->cap->edit_terms ) ) {
1992
+					return new IXR_Error( 401, __( 'You are not allowed to edit terms in this taxonomy.' ) );
1993
+		}
1907 1994
 
1908 1995
 		$taxonomy = (array) $taxonomy;
1909 1996
 
@@ -1912,48 +1999,58 @@  discard block
 block discarded – undo
1912 1999
 
1913 2000
 		$term = get_term( $term_id , $content_struct['taxonomy'] );
1914 2001
 
1915
-		if ( is_wp_error( $term ) )
1916
-			return new IXR_Error( 500, $term->get_error_message() );
2002
+		if ( is_wp_error( $term ) ) {
2003
+					return new IXR_Error( 500, $term->get_error_message() );
2004
+		}
1917 2005
 
1918
-		if ( ! $term )
1919
-			return new IXR_Error( 404, __( 'Invalid term ID' ) );
2006
+		if ( ! $term ) {
2007
+					return new IXR_Error( 404, __( 'Invalid term ID' ) );
2008
+		}
1920 2009
 
1921 2010
 		if ( isset( $content_struct['name'] ) ) {
1922 2011
 			$term_data['name'] = trim( $content_struct['name'] );
1923 2012
 
1924
-			if ( empty( $term_data['name'] ) )
1925
-				return new IXR_Error( 403, __( 'The term name cannot be empty.' ) );
2013
+			if ( empty( $term_data['name'] ) ) {
2014
+							return new IXR_Error( 403, __( 'The term name cannot be empty.' ) );
2015
+			}
1926 2016
 		}
1927 2017
 
1928 2018
 		if ( isset( $content_struct['parent'] ) ) {
1929
-			if ( ! $taxonomy['hierarchical'] )
1930
-				return new IXR_Error( 403, __( "This taxonomy is not hierarchical so you can't set a parent." ) );
2019
+			if ( ! $taxonomy['hierarchical'] ) {
2020
+							return new IXR_Error( 403, __( "This taxonomy is not hierarchical so you can't set a parent." ) );
2021
+			}
1931 2022
 
1932 2023
 			$parent_term_id = (int) $content_struct['parent'];
1933 2024
 			$parent_term = get_term( $parent_term_id , $taxonomy['name'] );
1934 2025
 
1935
-			if ( is_wp_error( $parent_term ) )
1936
-				return new IXR_Error( 500, $parent_term->get_error_message() );
2026
+			if ( is_wp_error( $parent_term ) ) {
2027
+							return new IXR_Error( 500, $parent_term->get_error_message() );
2028
+			}
1937 2029
 
1938
-			if ( ! $parent_term )
1939
-				return new IXR_Error( 403, __( 'Parent term does not exist.' ) );
2030
+			if ( ! $parent_term ) {
2031
+							return new IXR_Error( 403, __( 'Parent term does not exist.' ) );
2032
+			}
1940 2033
 
1941 2034
 			$term_data['parent'] = $content_struct['parent'];
1942 2035
 		}
1943 2036
 
1944
-		if ( isset( $content_struct['description'] ) )
1945
-			$term_data['description'] = $content_struct['description'];
2037
+		if ( isset( $content_struct['description'] ) ) {
2038
+					$term_data['description'] = $content_struct['description'];
2039
+		}
1946 2040
 
1947
-		if ( isset( $content_struct['slug'] ) )
1948
-			$term_data['slug'] = $content_struct['slug'];
2041
+		if ( isset( $content_struct['slug'] ) ) {
2042
+					$term_data['slug'] = $content_struct['slug'];
2043
+		}
1949 2044
 
1950 2045
 		$term = wp_update_term( $term_id , $taxonomy['name'] , $term_data );
1951 2046
 
1952
-		if ( is_wp_error( $term ) )
1953
-			return new IXR_Error( 500, $term->get_error_message() );
2047
+		if ( is_wp_error( $term ) ) {
2048
+					return new IXR_Error( 500, $term->get_error_message() );
2049
+		}
1954 2050
 
1955
-		if ( ! $term )
1956
-			return new IXR_Error( 500, __( 'Sorry, editing the term failed.' ) );
2051
+		if ( ! $term ) {
2052
+					return new IXR_Error( 500, __( 'Sorry, editing the term failed.' ) );
2053
+		}
1957 2054
 
1958 2055
 		return true;
1959 2056
 	}
@@ -1977,8 +2074,9 @@  discard block
 block discarded – undo
1977 2074
 	 * @return bool|IXR_Error True on success, IXR_Error instance on failure.
1978 2075
 	 */
1979 2076
 	public function wp_deleteTerm( $args ) {
1980
-		if ( ! $this->minimum_args( $args, 5 ) )
1981
-			return $this->error;
2077
+		if ( ! $this->minimum_args( $args, 5 ) ) {
2078
+					return $this->error;
2079
+		}
1982 2080
 
1983 2081
 		$this->escape( $args );
1984 2082
 
@@ -1987,35 +2085,42 @@  discard block
 block discarded – undo
1987 2085
 		$taxonomy           = $args[3];
1988 2086
 		$term_id            = (int) $args[4];
1989 2087
 
1990
-		if ( ! $user = $this->login( $username, $password ) )
1991
-			return $this->error;
2088
+		if ( ! $user = $this->login( $username, $password ) ) {
2089
+					return $this->error;
2090
+		}
1992 2091
 
1993 2092
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
1994 2093
 		do_action( 'xmlrpc_call', 'wp.deleteTerm' );
1995 2094
 
1996
-		if ( ! taxonomy_exists( $taxonomy ) )
1997
-			return new IXR_Error( 403, __( 'Invalid taxonomy' ) );
2095
+		if ( ! taxonomy_exists( $taxonomy ) ) {
2096
+					return new IXR_Error( 403, __( 'Invalid taxonomy' ) );
2097
+		}
1998 2098
 
1999 2099
 		$taxonomy = get_taxonomy( $taxonomy );
2000 2100
 
2001
-		if ( ! current_user_can( $taxonomy->cap->delete_terms ) )
2002
-			return new IXR_Error( 401, __( 'You are not allowed to delete terms in this taxonomy.' ) );
2101
+		if ( ! current_user_can( $taxonomy->cap->delete_terms ) ) {
2102
+					return new IXR_Error( 401, __( 'You are not allowed to delete terms in this taxonomy.' ) );
2103
+		}
2003 2104
 
2004 2105
 		$term = get_term( $term_id, $taxonomy->name );
2005 2106
 
2006
-		if ( is_wp_error( $term ) )
2007
-			return new IXR_Error( 500, $term->get_error_message() );
2107
+		if ( is_wp_error( $term ) ) {
2108
+					return new IXR_Error( 500, $term->get_error_message() );
2109
+		}
2008 2110
 
2009
-		if ( ! $term )
2010
-			return new IXR_Error( 404, __( 'Invalid term ID' ) );
2111
+		if ( ! $term ) {
2112
+					return new IXR_Error( 404, __( 'Invalid term ID' ) );
2113
+		}
2011 2114
 
2012 2115
 		$result = wp_delete_term( $term_id, $taxonomy->name );
2013 2116
 
2014
-		if ( is_wp_error( $result ) )
2015
-			return new IXR_Error( 500, $term->get_error_message() );
2117
+		if ( is_wp_error( $result ) ) {
2118
+					return new IXR_Error( 500, $term->get_error_message() );
2119
+		}
2016 2120
 
2017
-		if ( ! $result )
2018
-			return new IXR_Error( 500, __( 'Sorry, deleting the term failed.' ) );
2121
+		if ( ! $result ) {
2122
+					return new IXR_Error( 500, __( 'Sorry, deleting the term failed.' ) );
2123
+		}
2019 2124
 
2020 2125
 		return $result;
2021 2126
 	}
@@ -2048,8 +2153,9 @@  discard block
 block discarded – undo
2048 2153
 	 *  - 'count'
2049 2154
 	 */
2050 2155
 	public function wp_getTerm( $args ) {
2051
-		if ( ! $this->minimum_args( $args, 5 ) )
2052
-			return $this->error;
2156
+		if ( ! $this->minimum_args( $args, 5 ) ) {
2157
+					return $this->error;
2158
+		}
2053 2159
 
2054 2160
 		$this->escape( $args );
2055 2161
 
@@ -2058,27 +2164,32 @@  discard block
 block discarded – undo
2058 2164
 		$taxonomy           = $args[3];
2059 2165
 		$term_id            = (int) $args[4];
2060 2166
 
2061
-		if ( ! $user = $this->login( $username, $password ) )
2062
-			return $this->error;
2167
+		if ( ! $user = $this->login( $username, $password ) ) {
2168
+					return $this->error;
2169
+		}
2063 2170
 
2064 2171
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
2065 2172
 		do_action( 'xmlrpc_call', 'wp.getTerm' );
2066 2173
 
2067
-		if ( ! taxonomy_exists( $taxonomy ) )
2068
-			return new IXR_Error( 403, __( 'Invalid taxonomy' ) );
2174
+		if ( ! taxonomy_exists( $taxonomy ) ) {
2175
+					return new IXR_Error( 403, __( 'Invalid taxonomy' ) );
2176
+		}
2069 2177
 
2070 2178
 		$taxonomy = get_taxonomy( $taxonomy );
2071 2179
 
2072
-		if ( ! current_user_can( $taxonomy->cap->assign_terms ) )
2073
-			return new IXR_Error( 401, __( 'You are not allowed to assign terms in this taxonomy.' ) );
2180
+		if ( ! current_user_can( $taxonomy->cap->assign_terms ) ) {
2181
+					return new IXR_Error( 401, __( 'You are not allowed to assign terms in this taxonomy.' ) );
2182
+		}
2074 2183
 
2075 2184
 		$term = get_term( $term_id , $taxonomy->name, ARRAY_A );
2076 2185
 
2077
-		if ( is_wp_error( $term ) )
2078
-			return new IXR_Error( 500, $term->get_error_message() );
2186
+		if ( is_wp_error( $term ) ) {
2187
+					return new IXR_Error( 500, $term->get_error_message() );
2188
+		}
2079 2189
 
2080
-		if ( ! $term )
2081
-			return new IXR_Error( 404, __( 'Invalid term ID' ) );
2190
+		if ( ! $term ) {
2191
+					return new IXR_Error( 404, __( 'Invalid term ID' ) );
2192
+		}
2082 2193
 
2083 2194
 		return $this->_prepare_term( $term );
2084 2195
 	}
@@ -2106,8 +2217,9 @@  discard block
 block discarded – undo
2106 2217
 	 * @return array|IXR_Error An associative array of terms data on success, IXR_Error instance otherwise.
2107 2218
 	 */
2108 2219
 	public function wp_getTerms( $args ) {
2109
-		if ( ! $this->minimum_args( $args, 4 ) )
2110
-			return $this->error;
2220
+		if ( ! $this->minimum_args( $args, 4 ) ) {
2221
+					return $this->error;
2222
+		}
2111 2223
 
2112 2224
 		$this->escape( $args );
2113 2225
 
@@ -2116,47 +2228,56 @@  discard block
 block discarded – undo
2116 2228
 		$taxonomy       = $args[3];
2117 2229
 		$filter         = isset( $args[4] ) ? $args[4] : array();
2118 2230
 
2119
-		if ( ! $user = $this->login( $username, $password ) )
2120
-			return $this->error;
2231
+		if ( ! $user = $this->login( $username, $password ) ) {
2232
+					return $this->error;
2233
+		}
2121 2234
 
2122 2235
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
2123 2236
 		do_action( 'xmlrpc_call', 'wp.getTerms' );
2124 2237
 
2125
-		if ( ! taxonomy_exists( $taxonomy ) )
2126
-			return new IXR_Error( 403, __( 'Invalid taxonomy' ) );
2238
+		if ( ! taxonomy_exists( $taxonomy ) ) {
2239
+					return new IXR_Error( 403, __( 'Invalid taxonomy' ) );
2240
+		}
2127 2241
 
2128 2242
 		$taxonomy = get_taxonomy( $taxonomy );
2129 2243
 
2130
-		if ( ! current_user_can( $taxonomy->cap->assign_terms ) )
2131
-			return new IXR_Error( 401, __( 'You are not allowed to assign terms in this taxonomy.' ) );
2244
+		if ( ! current_user_can( $taxonomy->cap->assign_terms ) ) {
2245
+					return new IXR_Error( 401, __( 'You are not allowed to assign terms in this taxonomy.' ) );
2246
+		}
2132 2247
 
2133 2248
 		$query = array();
2134 2249
 
2135
-		if ( isset( $filter['number'] ) )
2136
-			$query['number'] = absint( $filter['number'] );
2250
+		if ( isset( $filter['number'] ) ) {
2251
+					$query['number'] = absint( $filter['number'] );
2252
+		}
2137 2253
 
2138
-		if ( isset( $filter['offset'] ) )
2139
-			$query['offset'] = absint( $filter['offset'] );
2254
+		if ( isset( $filter['offset'] ) ) {
2255
+					$query['offset'] = absint( $filter['offset'] );
2256
+		}
2140 2257
 
2141 2258
 		if ( isset( $filter['orderby'] ) ) {
2142 2259
 			$query['orderby'] = $filter['orderby'];
2143 2260
 
2144
-			if ( isset( $filter['order'] ) )
2145
-				$query['order'] = $filter['order'];
2261
+			if ( isset( $filter['order'] ) ) {
2262
+							$query['order'] = $filter['order'];
2263
+			}
2146 2264
 		}
2147 2265
 
2148
-		if ( isset( $filter['hide_empty'] ) )
2149
-			$query['hide_empty'] = $filter['hide_empty'];
2150
-		else
2151
-			$query['get'] = 'all';
2266
+		if ( isset( $filter['hide_empty'] ) ) {
2267
+					$query['hide_empty'] = $filter['hide_empty'];
2268
+		} else {
2269
+					$query['get'] = 'all';
2270
+		}
2152 2271
 
2153
-		if ( isset( $filter['search'] ) )
2154
-			$query['search'] = $filter['search'];
2272
+		if ( isset( $filter['search'] ) ) {
2273
+					$query['search'] = $filter['search'];
2274
+		}
2155 2275
 
2156 2276
 		$terms = get_terms( $taxonomy->name, $query );
2157 2277
 
2158
-		if ( is_wp_error( $terms ) )
2159
-			return new IXR_Error( 500, $terms->get_error_message() );
2278
+		if ( is_wp_error( $terms ) ) {
2279
+					return new IXR_Error( 500, $terms->get_error_message() );
2280
+		}
2160 2281
 
2161 2282
 		$struct = array();
2162 2283
 
@@ -2188,8 +2309,9 @@  discard block
 block discarded – undo
2188 2309
 	 * @return array|IXR_Error An array of taxonomy data on success, IXR_Error instance otherwise.
2189 2310
 	 */
2190 2311
 	public function wp_getTaxonomy( $args ) {
2191
-		if ( ! $this->minimum_args( $args, 4 ) )
2192
-			return $this->error;
2312
+		if ( ! $this->minimum_args( $args, 4 ) ) {
2313
+					return $this->error;
2314
+		}
2193 2315
 
2194 2316
 		$this->escape( $args );
2195 2317
 
@@ -2211,19 +2333,22 @@  discard block
 block discarded – undo
2211 2333
 			$fields = apply_filters( 'xmlrpc_default_taxonomy_fields', array( 'labels', 'cap', 'object_type' ), 'wp.getTaxonomy' );
2212 2334
 		}
2213 2335
 
2214
-		if ( ! $user = $this->login( $username, $password ) )
2215
-			return $this->error;
2336
+		if ( ! $user = $this->login( $username, $password ) ) {
2337
+					return $this->error;
2338
+		}
2216 2339
 
2217 2340
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
2218 2341
 		do_action( 'xmlrpc_call', 'wp.getTaxonomy' );
2219 2342
 
2220
-		if ( ! taxonomy_exists( $taxonomy ) )
2221
-			return new IXR_Error( 403, __( 'Invalid taxonomy' ) );
2343
+		if ( ! taxonomy_exists( $taxonomy ) ) {
2344
+					return new IXR_Error( 403, __( 'Invalid taxonomy' ) );
2345
+		}
2222 2346
 
2223 2347
 		$taxonomy = get_taxonomy( $taxonomy );
2224 2348
 
2225
-		if ( ! current_user_can( $taxonomy->cap->assign_terms ) )
2226
-			return new IXR_Error( 401, __( 'You are not allowed to assign terms in this taxonomy.' ) );
2349
+		if ( ! current_user_can( $taxonomy->cap->assign_terms ) ) {
2350
+					return new IXR_Error( 401, __( 'You are not allowed to assign terms in this taxonomy.' ) );
2351
+		}
2227 2352
 
2228 2353
 		return $this->_prepare_taxonomy( $taxonomy, $fields );
2229 2354
 	}
@@ -2248,8 +2373,9 @@  discard block
 block discarded – undo
2248 2373
 	 *                         by `$fields`, or an IXR_Error instance on failure.
2249 2374
 	 */
2250 2375
 	public function wp_getTaxonomies( $args ) {
2251
-		if ( ! $this->minimum_args( $args, 3 ) )
2252
-			return $this->error;
2376
+		if ( ! $this->minimum_args( $args, 3 ) ) {
2377
+					return $this->error;
2378
+		}
2253 2379
 
2254 2380
 		$this->escape( $args );
2255 2381
 
@@ -2264,8 +2390,9 @@  discard block
 block discarded – undo
2264 2390
 			$fields = apply_filters( 'xmlrpc_default_taxonomy_fields', array( 'labels', 'cap', 'object_type' ), 'wp.getTaxonomies' );
2265 2391
 		}
2266 2392
 
2267
-		if ( ! $user = $this->login( $username, $password ) )
2268
-			return $this->error;
2393
+		if ( ! $user = $this->login( $username, $password ) ) {
2394
+					return $this->error;
2395
+		}
2269 2396
 
2270 2397
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
2271 2398
 		do_action( 'xmlrpc_call', 'wp.getTaxonomies' );
@@ -2277,8 +2404,9 @@  discard block
 block discarded – undo
2277 2404
 
2278 2405
 		foreach ( $taxonomies as $taxonomy ) {
2279 2406
 			// capability check for post_types
2280
-			if ( ! current_user_can( $taxonomy->cap->assign_terms ) )
2281
-				continue;
2407
+			if ( ! current_user_can( $taxonomy->cap->assign_terms ) ) {
2408
+							continue;
2409
+			}
2282 2410
 
2283 2411
 			$struct[] = $this->_prepare_taxonomy( $taxonomy, $fields );
2284 2412
 		}
@@ -2323,8 +2451,9 @@  discard block
 block discarded – undo
2323 2451
 	 *  - 'roles'
2324 2452
 	 */
2325 2453
 	public function wp_getUser( $args ) {
2326
-		if ( ! $this->minimum_args( $args, 4 ) )
2327
-			return $this->error;
2454
+		if ( ! $this->minimum_args( $args, 4 ) ) {
2455
+					return $this->error;
2456
+		}
2328 2457
 
2329 2458
 		$this->escape( $args );
2330 2459
 
@@ -2346,19 +2475,22 @@  discard block
 block discarded – undo
2346 2475
 			$fields = apply_filters( 'xmlrpc_default_user_fields', array( 'all' ), 'wp.getUser' );
2347 2476
 		}
2348 2477
 
2349
-		if ( ! $user = $this->login( $username, $password ) )
2350
-			return $this->error;
2478
+		if ( ! $user = $this->login( $username, $password ) ) {
2479
+					return $this->error;
2480
+		}
2351 2481
 
2352 2482
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
2353 2483
 		do_action( 'xmlrpc_call', 'wp.getUser' );
2354 2484
 
2355
-		if ( ! current_user_can( 'edit_user', $user_id ) )
2356
-			return new IXR_Error( 401, __( 'Sorry, you cannot edit users.' ) );
2485
+		if ( ! current_user_can( 'edit_user', $user_id ) ) {
2486
+					return new IXR_Error( 401, __( 'Sorry, you cannot edit users.' ) );
2487
+		}
2357 2488
 
2358 2489
 		$user_data = get_userdata( $user_id );
2359 2490
 
2360
-		if ( ! $user_data )
2361
-			return new IXR_Error( 404, __( 'Invalid user ID.' ) );
2491
+		if ( ! $user_data ) {
2492
+					return new IXR_Error( 404, __( 'Invalid user ID.' ) );
2493
+		}
2362 2494
 
2363 2495
 		return $this->_prepare_user( $user_data, $fields );
2364 2496
 	}
@@ -2388,8 +2520,9 @@  discard block
 block discarded – undo
2388 2520
 	 * @return array|IXR_Error users data
2389 2521
 	 */
2390 2522
 	public function wp_getUsers( $args ) {
2391
-		if ( ! $this->minimum_args( $args, 3 ) )
2392
-			return $this->error;
2523
+		if ( ! $this->minimum_args( $args, 3 ) ) {
2524
+					return $this->error;
2525
+		}
2393 2526
 
2394 2527
 		$this->escape( $args );
2395 2528
 
@@ -2404,14 +2537,16 @@  discard block
 block discarded – undo
2404 2537
 			$fields = apply_filters( 'xmlrpc_default_user_fields', array( 'all' ), 'wp.getUsers' );
2405 2538
 		}
2406 2539
 
2407
-		if ( ! $user = $this->login( $username, $password ) )
2408
-			return $this->error;
2540
+		if ( ! $user = $this->login( $username, $password ) ) {
2541
+					return $this->error;
2542
+		}
2409 2543
 
2410 2544
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
2411 2545
 		do_action( 'xmlrpc_call', 'wp.getUsers' );
2412 2546
 
2413
-		if ( ! current_user_can( 'list_users' ) )
2414
-			return new IXR_Error( 401, __( 'Sorry, you cannot list users.' ) );
2547
+		if ( ! current_user_can( 'list_users' ) ) {
2548
+					return new IXR_Error( 401, __( 'Sorry, you cannot list users.' ) );
2549
+		}
2415 2550
 
2416 2551
 		$query = array( 'fields' => 'all_with_meta' );
2417 2552
 
@@ -2421,13 +2556,15 @@  discard block
 block discarded – undo
2421 2556
 		if ( isset( $filter['orderby'] ) ) {
2422 2557
 			$query['orderby'] = $filter['orderby'];
2423 2558
 
2424
-			if ( isset( $filter['order'] ) )
2425
-				$query['order'] = $filter['order'];
2559
+			if ( isset( $filter['order'] ) ) {
2560
+							$query['order'] = $filter['order'];
2561
+			}
2426 2562
 		}
2427 2563
 
2428 2564
 		if ( isset( $filter['role'] ) ) {
2429
-			if ( get_role( $filter['role'] ) === null )
2430
-				return new IXR_Error( 403, __( 'The role specified is not valid' ) );
2565
+			if ( get_role( $filter['role'] ) === null ) {
2566
+							return new IXR_Error( 403, __( 'The role specified is not valid' ) );
2567
+			}
2431 2568
 
2432 2569
 			$query['role'] = $filter['role'];
2433 2570
 		}
@@ -2440,8 +2577,9 @@  discard block
 block discarded – undo
2440 2577
 
2441 2578
 		$_users = array();
2442 2579
 		foreach ( $users as $user_data ) {
2443
-			if ( current_user_can( 'edit_user', $user_data->ID ) )
2444
-				$_users[] = $this->_prepare_user( $user_data, $fields );
2580
+			if ( current_user_can( 'edit_user', $user_data->ID ) ) {
2581
+							$_users[] = $this->_prepare_user( $user_data, $fields );
2582
+			}
2445 2583
 		}
2446 2584
 		return $_users;
2447 2585
 	}
@@ -2462,8 +2600,9 @@  discard block
 block discarded – undo
2462 2600
 	 * @return array|IXR_Error (@see wp_getUser)
2463 2601
 	 */
2464 2602
 	public function wp_getProfile( $args ) {
2465
-		if ( ! $this->minimum_args( $args, 3 ) )
2466
-			return $this->error;
2603
+		if ( ! $this->minimum_args( $args, 3 ) ) {
2604
+					return $this->error;
2605
+		}
2467 2606
 
2468 2607
 		$this->escape( $args );
2469 2608
 
@@ -2477,14 +2616,16 @@  discard block
 block discarded – undo
2477 2616
 			$fields = apply_filters( 'xmlrpc_default_user_fields', array( 'all' ), 'wp.getProfile' );
2478 2617
 		}
2479 2618
 
2480
-		if ( ! $user = $this->login( $username, $password ) )
2481
-			return $this->error;
2619
+		if ( ! $user = $this->login( $username, $password ) ) {
2620
+					return $this->error;
2621
+		}
2482 2622
 
2483 2623
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
2484 2624
 		do_action( 'xmlrpc_call', 'wp.getProfile' );
2485 2625
 
2486
-		if ( ! current_user_can( 'edit_user', $user->ID ) )
2487
-			return new IXR_Error( 401, __( 'Sorry, you cannot edit your profile.' ) );
2626
+		if ( ! current_user_can( 'edit_user', $user->ID ) ) {
2627
+					return new IXR_Error( 401, __( 'Sorry, you cannot edit your profile.' ) );
2628
+		}
2488 2629
 
2489 2630
 		$user_data = get_userdata( $user->ID );
2490 2631
 
@@ -2514,8 +2655,9 @@  discard block
 block discarded – undo
2514 2655
 	 * @return true|IXR_Error True, on success.
2515 2656
 	 */
2516 2657
 	public function wp_editProfile( $args ) {
2517
-		if ( ! $this->minimum_args( $args, 4 ) )
2518
-			return $this->error;
2658
+		if ( ! $this->minimum_args( $args, 4 ) ) {
2659
+					return $this->error;
2660
+		}
2519 2661
 
2520 2662
 		$this->escape( $args );
2521 2663
 
@@ -2523,48 +2665,59 @@  discard block
 block discarded – undo
2523 2665
 		$password       = $args[2];
2524 2666
 		$content_struct = $args[3];
2525 2667
 
2526
-		if ( ! $user = $this->login( $username, $password ) )
2527
-			return $this->error;
2668
+		if ( ! $user = $this->login( $username, $password ) ) {
2669
+					return $this->error;
2670
+		}
2528 2671
 
2529 2672
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
2530 2673
 		do_action( 'xmlrpc_call', 'wp.editProfile' );
2531 2674
 
2532
-		if ( ! current_user_can( 'edit_user', $user->ID ) )
2533
-			return new IXR_Error( 401, __( 'Sorry, you cannot edit your profile.' ) );
2675
+		if ( ! current_user_can( 'edit_user', $user->ID ) ) {
2676
+					return new IXR_Error( 401, __( 'Sorry, you cannot edit your profile.' ) );
2677
+		}
2534 2678
 
2535 2679
 		// holds data of the user
2536 2680
 		$user_data = array();
2537 2681
 		$user_data['ID'] = $user->ID;
2538 2682
 
2539 2683
 		// only set the user details if it was given
2540
-		if ( isset( $content_struct['first_name'] ) )
2541
-			$user_data['first_name'] = $content_struct['first_name'];
2684
+		if ( isset( $content_struct['first_name'] ) ) {
2685
+					$user_data['first_name'] = $content_struct['first_name'];
2686
+		}
2542 2687
 
2543
-		if ( isset( $content_struct['last_name'] ) )
2544
-			$user_data['last_name'] = $content_struct['last_name'];
2688
+		if ( isset( $content_struct['last_name'] ) ) {
2689
+					$user_data['last_name'] = $content_struct['last_name'];
2690
+		}
2545 2691
 
2546
-		if ( isset( $content_struct['url'] ) )
2547
-			$user_data['user_url'] = $content_struct['url'];
2692
+		if ( isset( $content_struct['url'] ) ) {
2693
+					$user_data['user_url'] = $content_struct['url'];
2694
+		}
2548 2695
 
2549
-		if ( isset( $content_struct['display_name'] ) )
2550
-			$user_data['display_name'] = $content_struct['display_name'];
2696
+		if ( isset( $content_struct['display_name'] ) ) {
2697
+					$user_data['display_name'] = $content_struct['display_name'];
2698
+		}
2551 2699
 
2552
-		if ( isset( $content_struct['nickname'] ) )
2553
-			$user_data['nickname'] = $content_struct['nickname'];
2700
+		if ( isset( $content_struct['nickname'] ) ) {
2701
+					$user_data['nickname'] = $content_struct['nickname'];
2702
+		}
2554 2703
 
2555
-		if ( isset( $content_struct['nicename'] ) )
2556
-			$user_data['user_nicename'] = $content_struct['nicename'];
2704
+		if ( isset( $content_struct['nicename'] ) ) {
2705
+					$user_data['user_nicename'] = $content_struct['nicename'];
2706
+		}
2557 2707
 
2558
-		if ( isset( $content_struct['bio'] ) )
2559
-			$user_data['description'] = $content_struct['bio'];
2708
+		if ( isset( $content_struct['bio'] ) ) {
2709
+					$user_data['description'] = $content_struct['bio'];
2710
+		}
2560 2711
 
2561 2712
 		$result = wp_update_user( $user_data );
2562 2713
 
2563
-		if ( is_wp_error( $result ) )
2564
-			return new IXR_Error( 500, $result->get_error_message() );
2714
+		if ( is_wp_error( $result ) ) {
2715
+					return new IXR_Error( 500, $result->get_error_message() );
2716
+		}
2565 2717
 
2566
-		if ( ! $result )
2567
-			return new IXR_Error( 500, __( 'Sorry, the user cannot be updated.' ) );
2718
+		if ( ! $result ) {
2719
+					return new IXR_Error( 500, __( 'Sorry, the user cannot be updated.' ) );
2720
+		}
2568 2721
 
2569 2722
 		return true;
2570 2723
 	}
@@ -2596,11 +2749,13 @@  discard block
 block discarded – undo
2596 2749
 		}
2597 2750
 
2598 2751
 		$page = get_post($page_id);
2599
-		if ( ! $page )
2600
-			return new IXR_Error( 404, __( 'Invalid post ID.' ) );
2752
+		if ( ! $page ) {
2753
+					return new IXR_Error( 404, __( 'Invalid post ID.' ) );
2754
+		}
2601 2755
 
2602
-		if ( !current_user_can( 'edit_page', $page_id ) )
2603
-			return new IXR_Error( 401, __( 'Sorry, you cannot edit this page.' ) );
2756
+		if ( !current_user_can( 'edit_page', $page_id ) ) {
2757
+					return new IXR_Error( 401, __( 'Sorry, you cannot edit this page.' ) );
2758
+		}
2604 2759
 
2605 2760
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
2606 2761
 		do_action( 'xmlrpc_call', 'wp.getPage' );
@@ -2637,11 +2792,13 @@  discard block
 block discarded – undo
2637 2792
 		$password  = $args[2];
2638 2793
 		$num_pages = isset($args[3]) ? (int) $args[3] : 10;
2639 2794
 
2640
-		if ( !$user = $this->login($username, $password) )
2641
-			return $this->error;
2795
+		if ( !$user = $this->login($username, $password) ) {
2796
+					return $this->error;
2797
+		}
2642 2798
 
2643
-		if ( !current_user_can( 'edit_pages' ) )
2644
-			return new IXR_Error( 401, __( 'Sorry, you cannot edit pages.' ) );
2799
+		if ( !current_user_can( 'edit_pages' ) ) {
2800
+					return new IXR_Error( 401, __( 'Sorry, you cannot edit pages.' ) );
2801
+		}
2645 2802
 
2646 2803
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
2647 2804
 		do_action( 'xmlrpc_call', 'wp.getPages' );
@@ -2654,8 +2811,9 @@  discard block
 block discarded – undo
2654 2811
 			$pages_struct = array();
2655 2812
 
2656 2813
 			foreach ($pages as $page) {
2657
-				if ( current_user_can( 'edit_page', $page->ID ) )
2658
-					$pages_struct[] = $this->_prepare_page( $page );
2814
+				if ( current_user_can( 'edit_page', $page->ID ) ) {
2815
+									$pages_struct[] = $this->_prepare_page( $page );
2816
+				}
2659 2817
 			}
2660 2818
 
2661 2819
 			return $pages_struct;
@@ -2686,8 +2844,9 @@  discard block
 block discarded – undo
2686 2844
 		$username = $this->escape( $args[1] );
2687 2845
 		$password = $this->escape( $args[2] );
2688 2846
 
2689
-		if ( !$user = $this->login($username, $password) )
2690
-			return $this->error;
2847
+		if ( !$user = $this->login($username, $password) ) {
2848
+					return $this->error;
2849
+		}
2691 2850
 
2692 2851
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
2693 2852
 		do_action( 'xmlrpc_call', 'wp.newPage' );
@@ -2721,8 +2880,9 @@  discard block
 block discarded – undo
2721 2880
 		$password = $args[2];
2722 2881
 		$page_id  = (int) $args[3];
2723 2882
 
2724
-		if ( !$user = $this->login($username, $password) )
2725
-			return $this->error;
2883
+		if ( !$user = $this->login($username, $password) ) {
2884
+					return $this->error;
2885
+		}
2726 2886
 
2727 2887
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
2728 2888
 		do_action( 'xmlrpc_call', 'wp.deletePage' );
@@ -2730,17 +2890,20 @@  discard block
 block discarded – undo
2730 2890
 		// Get the current page based on the page_id and
2731 2891
 		// make sure it is a page and not a post.
2732 2892
 		$actual_page = get_post($page_id, ARRAY_A);
2733
-		if ( !$actual_page || ($actual_page['post_type'] != 'page') )
2734
-			return new IXR_Error( 404, __( 'Sorry, no such page.' ) );
2893
+		if ( !$actual_page || ($actual_page['post_type'] != 'page') ) {
2894
+					return new IXR_Error( 404, __( 'Sorry, no such page.' ) );
2895
+		}
2735 2896
 
2736 2897
 		// Make sure the user can delete pages.
2737
-		if ( !current_user_can('delete_page', $page_id) )
2738
-			return new IXR_Error( 401, __( 'Sorry, you do not have the right to delete this page.' ) );
2898
+		if ( !current_user_can('delete_page', $page_id) ) {
2899
+					return new IXR_Error( 401, __( 'Sorry, you do not have the right to delete this page.' ) );
2900
+		}
2739 2901
 
2740 2902
 		// Attempt to delete the page.
2741 2903
 		$result = wp_delete_post($page_id);
2742
-		if ( !$result )
2743
-			return new IXR_Error( 500, __( 'Failed to delete the page.' ) );
2904
+		if ( !$result ) {
2905
+					return new IXR_Error( 500, __( 'Failed to delete the page.' ) );
2906
+		}
2744 2907
 
2745 2908
 		/**
2746 2909
 		 * Fires after a page has been successfully deleted via XML-RPC.
@@ -2792,12 +2955,14 @@  discard block
 block discarded – undo
2792 2955
 
2793 2956
 		// Get the page data and make sure it is a page.
2794 2957
 		$actual_page = get_post($page_id, ARRAY_A);
2795
-		if ( !$actual_page || ($actual_page['post_type'] != 'page') )
2796
-			return new IXR_Error( 404, __( 'Sorry, no such page.' ) );
2958
+		if ( !$actual_page || ($actual_page['post_type'] != 'page') ) {
2959
+					return new IXR_Error( 404, __( 'Sorry, no such page.' ) );
2960
+		}
2797 2961
 
2798 2962
 		// Make sure the user is allowed to edit pages.
2799
-		if ( !current_user_can('edit_page', $page_id) )
2800
-			return new IXR_Error( 401, __( 'Sorry, you do not have the right to edit this page.' ) );
2963
+		if ( !current_user_can('edit_page', $page_id) ) {
2964
+					return new IXR_Error( 401, __( 'Sorry, you do not have the right to edit this page.' ) );
2965
+		}
2801 2966
 
2802 2967
 		// Mark this as content for a page.
2803 2968
 		$content['post_type'] = 'page';
@@ -2839,11 +3004,13 @@  discard block
 block discarded – undo
2839 3004
 		$username = $args[1];
2840 3005
 		$password = $args[2];
2841 3006
 
2842
-		if ( !$user = $this->login($username, $password) )
2843
-			return $this->error;
3007
+		if ( !$user = $this->login($username, $password) ) {
3008
+					return $this->error;
3009
+		}
2844 3010
 
2845
-		if ( !current_user_can( 'edit_pages' ) )
2846
-			return new IXR_Error( 401, __( 'Sorry, you cannot edit pages.' ) );
3011
+		if ( !current_user_can( 'edit_pages' ) ) {
3012
+					return new IXR_Error( 401, __( 'Sorry, you cannot edit pages.' ) );
3013
+		}
2847 3014
 
2848 3015
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
2849 3016
 		do_action( 'xmlrpc_call', 'wp.getPageList' );
@@ -2895,11 +3062,13 @@  discard block
 block discarded – undo
2895 3062
 		$username = $args[1];
2896 3063
 		$password = $args[2];
2897 3064
 
2898
-		if ( !$user = $this->login($username, $password) )
2899
-			return $this->error;
3065
+		if ( !$user = $this->login($username, $password) ) {
3066
+					return $this->error;
3067
+		}
2900 3068
 
2901
-		if ( !current_user_can('edit_posts') )
2902
-			return new IXR_Error( 401, __( 'Sorry, you cannot edit posts on this site.' ) );
3069
+		if ( !current_user_can('edit_posts') ) {
3070
+					return new IXR_Error( 401, __( 'Sorry, you cannot edit posts on this site.' ) );
3071
+		}
2903 3072
 
2904 3073
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
2905 3074
 		do_action( 'xmlrpc_call', 'wp.getAuthors' );
@@ -2936,11 +3105,13 @@  discard block
 block discarded – undo
2936 3105
 		$username = $args[1];
2937 3106
 		$password = $args[2];
2938 3107
 
2939
-		if ( !$user = $this->login($username, $password) )
2940
-			return $this->error;
3108
+		if ( !$user = $this->login($username, $password) ) {
3109
+					return $this->error;
3110
+		}
2941 3111
 
2942
-		if ( !current_user_can( 'edit_posts' ) )
2943
-			return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this site in order to view tags.' ) );
3112
+		if ( !current_user_can( 'edit_posts' ) ) {
3113
+					return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this site in order to view tags.' ) );
3114
+		}
2944 3115
 
2945 3116
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
2946 3117
 		do_action( 'xmlrpc_call', 'wp.getKeywords' );
@@ -2986,29 +3157,34 @@  discard block
 block discarded – undo
2986 3157
 		$password = $args[2];
2987 3158
 		$category = $args[3];
2988 3159
 
2989
-		if ( !$user = $this->login($username, $password) )
2990
-			return $this->error;
3160
+		if ( !$user = $this->login($username, $password) ) {
3161
+					return $this->error;
3162
+		}
2991 3163
 
2992 3164
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
2993 3165
 		do_action( 'xmlrpc_call', 'wp.newCategory' );
2994 3166
 
2995 3167
 		// Make sure the user is allowed to add a category.
2996
-		if ( !current_user_can('manage_categories') )
2997
-			return new IXR_Error(401, __('Sorry, you do not have the right to add a category.'));
3168
+		if ( !current_user_can('manage_categories') ) {
3169
+					return new IXR_Error(401, __('Sorry, you do not have the right to add a category.'));
3170
+		}
2998 3171
 
2999 3172
 		// If no slug was provided make it empty so that
3000 3173
 		// WordPress will generate one.
3001
-		if ( empty($category['slug']) )
3002
-			$category['slug'] = '';
3174
+		if ( empty($category['slug']) ) {
3175
+					$category['slug'] = '';
3176
+		}
3003 3177
 
3004 3178
 		// If no parent_id was provided make it empty
3005 3179
 		// so that it will be a top level page (no parent).
3006
-		if ( !isset($category['parent_id']) )
3007
-			$category['parent_id'] = '';
3180
+		if ( !isset($category['parent_id']) ) {
3181
+					$category['parent_id'] = '';
3182
+		}
3008 3183
 
3009 3184
 		// If no description was provided make it empty.
3010
-		if ( empty($category["description"]) )
3011
-			$category["description"] = "";
3185
+		if ( empty($category["description"]) ) {
3186
+					$category["description"] = "";
3187
+		}
3012 3188
 
3013 3189
 		$new_category = array(
3014 3190
 			'cat_name'				=> $category['name'],
@@ -3019,10 +3195,11 @@  discard block
 block discarded – undo
3019 3195
 
3020 3196
 		$cat_id = wp_insert_category($new_category, true);
3021 3197
 		if ( is_wp_error( $cat_id ) ) {
3022
-			if ( 'term_exists' == $cat_id->get_error_code() )
3023
-				return (int) $cat_id->get_error_data();
3024
-			else
3025
-				return new IXR_Error(500, __('Sorry, the new category failed.'));
3198
+			if ( 'term_exists' == $cat_id->get_error_code() ) {
3199
+							return (int) $cat_id->get_error_data();
3200
+			} else {
3201
+							return new IXR_Error(500, __('Sorry, the new category failed.'));
3202
+			}
3026 3203
 		} elseif ( ! $cat_id ) {
3027 3204
 			return new IXR_Error(500, __('Sorry, the new category failed.'));
3028 3205
 		}
@@ -3062,14 +3239,16 @@  discard block
 block discarded – undo
3062 3239
 		$password    = $args[2];
3063 3240
 		$category_id = (int) $args[3];
3064 3241
 
3065
-		if ( !$user = $this->login($username, $password) )
3066
-			return $this->error;
3242
+		if ( !$user = $this->login($username, $password) ) {
3243
+					return $this->error;
3244
+		}
3067 3245
 
3068 3246
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
3069 3247
 		do_action( 'xmlrpc_call', 'wp.deleteCategory' );
3070 3248
 
3071
-		if ( !current_user_can('manage_categories') )
3072
-			return new IXR_Error( 401, __( 'Sorry, you do not have the right to delete a category.' ) );
3249
+		if ( !current_user_can('manage_categories') ) {
3250
+					return new IXR_Error( 401, __( 'Sorry, you do not have the right to delete a category.' ) );
3251
+		}
3073 3252
 
3074 3253
 		$status = wp_delete_term( $category_id, 'category' );
3075 3254
 
@@ -3112,11 +3291,13 @@  discard block
 block discarded – undo
3112 3291
 		$category    = $args[3];
3113 3292
 		$max_results = (int) $args[4];
3114 3293
 
3115
-		if ( !$user = $this->login($username, $password) )
3116
-			return $this->error;
3294
+		if ( !$user = $this->login($username, $password) ) {
3295
+					return $this->error;
3296
+		}
3117 3297
 
3118
-		if ( !current_user_can( 'edit_posts' ) )
3119
-			return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this site in order to view categories.' ) );
3298
+		if ( !current_user_can( 'edit_posts' ) ) {
3299
+					return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this site in order to view categories.' ) );
3300
+		}
3120 3301
 
3121 3302
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
3122 3303
 		do_action( 'xmlrpc_call', 'wp.suggestCategories' );
@@ -3155,17 +3336,20 @@  discard block
 block discarded – undo
3155 3336
 		$password	= $args[2];
3156 3337
 		$comment_id	= (int) $args[3];
3157 3338
 
3158
-		if ( !$user = $this->login($username, $password) )
3159
-			return $this->error;
3339
+		if ( !$user = $this->login($username, $password) ) {
3340
+					return $this->error;
3341
+		}
3160 3342
 
3161
-		if ( !current_user_can( 'moderate_comments' ) )
3162
-			return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) );
3343
+		if ( !current_user_can( 'moderate_comments' ) ) {
3344
+					return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) );
3345
+		}
3163 3346
 
3164 3347
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
3165 3348
 		do_action( 'xmlrpc_call', 'wp.getComment' );
3166 3349
 
3167
-		if ( ! $comment = get_comment($comment_id) )
3168
-			return new IXR_Error( 404, __( 'Invalid comment ID.' ) );
3350
+		if ( ! $comment = get_comment($comment_id) ) {
3351
+					return new IXR_Error( 404, __( 'Invalid comment ID.' ) );
3352
+		}
3169 3353
 
3170 3354
 		return $this->_prepare_comment( $comment );
3171 3355
 	}
@@ -3203,31 +3387,37 @@  discard block
 block discarded – undo
3203 3387
 		$password = $args[2];
3204 3388
 		$struct	  = isset( $args[3] ) ? $args[3] : array();
3205 3389
 
3206
-		if ( !$user = $this->login($username, $password) )
3207
-			return $this->error;
3390
+		if ( !$user = $this->login($username, $password) ) {
3391
+					return $this->error;
3392
+		}
3208 3393
 
3209
-		if ( !current_user_can( 'moderate_comments' ) )
3210
-			return new IXR_Error( 401, __( 'Sorry, you cannot edit comments.' ) );
3394
+		if ( !current_user_can( 'moderate_comments' ) ) {
3395
+					return new IXR_Error( 401, __( 'Sorry, you cannot edit comments.' ) );
3396
+		}
3211 3397
 
3212 3398
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
3213 3399
 		do_action( 'xmlrpc_call', 'wp.getComments' );
3214 3400
 
3215
-		if ( isset($struct['status']) )
3216
-			$status = $struct['status'];
3217
-		else
3218
-			$status = '';
3401
+		if ( isset($struct['status']) ) {
3402
+					$status = $struct['status'];
3403
+		} else {
3404
+					$status = '';
3405
+		}
3219 3406
 
3220 3407
 		$post_id = '';
3221
-		if ( isset($struct['post_id']) )
3222
-			$post_id = absint($struct['post_id']);
3408
+		if ( isset($struct['post_id']) ) {
3409
+					$post_id = absint($struct['post_id']);
3410
+		}
3223 3411
 
3224 3412
 		$offset = 0;
3225
-		if ( isset($struct['offset']) )
3226
-			$offset = absint($struct['offset']);
3413
+		if ( isset($struct['offset']) ) {
3414
+					$offset = absint($struct['offset']);
3415
+		}
3227 3416
 
3228 3417
 		$number = 10;
3229
-		if ( isset($struct['number']) )
3230
-			$number = absint($struct['number']);
3418
+		if ( isset($struct['number']) ) {
3419
+					$number = absint($struct['number']);
3420
+		}
3231 3421
 
3232 3422
 		$comments = get_comments( array( 'status' => $status, 'post_id' => $post_id, 'offset' => $offset, 'number' => $number ) );
3233 3423
 
@@ -3267,17 +3457,21 @@  discard block
 block discarded – undo
3267 3457
 		$password	= $args[2];
3268 3458
 		$comment_ID	= (int) $args[3];
3269 3459
 
3270
-		if ( !$user = $this->login($username, $password) )
3271
-			return $this->error;
3460
+		if ( !$user = $this->login($username, $password) ) {
3461
+					return $this->error;
3462
+		}
3272 3463
 
3273
-		if ( !current_user_can( 'moderate_comments' ) )
3274
-			return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) );
3464
+		if ( !current_user_can( 'moderate_comments' ) ) {
3465
+					return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) );
3466
+		}
3275 3467
 
3276
-		if ( ! get_comment($comment_ID) )
3277
-			return new IXR_Error( 404, __( 'Invalid comment ID.' ) );
3468
+		if ( ! get_comment($comment_ID) ) {
3469
+					return new IXR_Error( 404, __( 'Invalid comment ID.' ) );
3470
+		}
3278 3471
 
3279
-		if ( !current_user_can( 'edit_comment', $comment_ID ) )
3280
-			return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) );
3472
+		if ( !current_user_can( 'edit_comment', $comment_ID ) ) {
3473
+					return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) );
3474
+		}
3281 3475
 
3282 3476
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
3283 3477
 		do_action( 'xmlrpc_call', 'wp.deleteComment' );
@@ -3334,17 +3528,21 @@  discard block
 block discarded – undo
3334 3528
 		$comment_ID	= (int) $args[3];
3335 3529
 		$content_struct = $args[4];
3336 3530
 
3337
-		if ( !$user = $this->login($username, $password) )
3338
-			return $this->error;
3531
+		if ( !$user = $this->login($username, $password) ) {
3532
+					return $this->error;
3533
+		}
3339 3534
 
3340
-		if ( !current_user_can( 'moderate_comments' ) )
3341
-			return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) );
3535
+		if ( !current_user_can( 'moderate_comments' ) ) {
3536
+					return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) );
3537
+		}
3342 3538
 
3343
-		if ( ! get_comment($comment_ID) )
3344
-			return new IXR_Error( 404, __( 'Invalid comment ID.' ) );
3539
+		if ( ! get_comment($comment_ID) ) {
3540
+					return new IXR_Error( 404, __( 'Invalid comment ID.' ) );
3541
+		}
3345 3542
 
3346
-		if ( !current_user_can( 'edit_comment', $comment_ID ) )
3347
-			return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) );
3543
+		if ( !current_user_can( 'edit_comment', $comment_ID ) ) {
3544
+					return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) );
3545
+		}
3348 3546
 
3349 3547
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
3350 3548
 		do_action( 'xmlrpc_call', 'wp.editComment' );
@@ -3353,8 +3551,9 @@  discard block
 block discarded – undo
3353 3551
 			$statuses = get_comment_statuses();
3354 3552
 			$statuses = array_keys($statuses);
3355 3553
 
3356
-			if ( ! in_array($content_struct['status'], $statuses) )
3357
-				return new IXR_Error( 401, __( 'Invalid comment status.' ) );
3554
+			if ( ! in_array($content_struct['status'], $statuses) ) {
3555
+							return new IXR_Error( 401, __( 'Invalid comment status.' ) );
3556
+			}
3358 3557
 			$comment_approved = $content_struct['status'];
3359 3558
 		}
3360 3559
 
@@ -3366,27 +3565,33 @@  discard block
 block discarded – undo
3366 3565
 			$comment_date_gmt = iso8601_to_datetime($dateCreated, 'GMT');
3367 3566
 		}
3368 3567
 
3369
-		if ( isset($content_struct['content']) )
3370
-			$comment_content = $content_struct['content'];
3568
+		if ( isset($content_struct['content']) ) {
3569
+					$comment_content = $content_struct['content'];
3570
+		}
3371 3571
 
3372
-		if ( isset($content_struct['author']) )
3373
-			$comment_author = $content_struct['author'];
3572
+		if ( isset($content_struct['author']) ) {
3573
+					$comment_author = $content_struct['author'];
3574
+		}
3374 3575
 
3375
-		if ( isset($content_struct['author_url']) )
3376
-			$comment_author_url = $content_struct['author_url'];
3576
+		if ( isset($content_struct['author_url']) ) {
3577
+					$comment_author_url = $content_struct['author_url'];
3578
+		}
3377 3579
 
3378
-		if ( isset($content_struct['author_email']) )
3379
-			$comment_author_email = $content_struct['author_email'];
3580
+		if ( isset($content_struct['author_email']) ) {
3581
+					$comment_author_email = $content_struct['author_email'];
3582
+		}
3380 3583
 
3381 3584
 		// We've got all the data -- post it:
3382 3585
 		$comment = compact('comment_ID', 'comment_content', 'comment_approved', 'comment_date', 'comment_date_gmt', 'comment_author', 'comment_author_email', 'comment_author_url');
3383 3586
 
3384 3587
 		$result = wp_update_comment($comment);
3385
-		if ( is_wp_error( $result ) )
3386
-			return new IXR_Error(500, $result->get_error_message());
3588
+		if ( is_wp_error( $result ) ) {
3589
+					return new IXR_Error(500, $result->get_error_message());
3590
+		}
3387 3591
 
3388
-		if ( !$result )
3389
-			return new IXR_Error(500, __('Sorry, the comment could not be edited. Something wrong happened.'));
3592
+		if ( !$result ) {
3593
+					return new IXR_Error(500, __('Sorry, the comment could not be edited. Something wrong happened.'));
3594
+		}
3390 3595
 
3391 3596
 		/**
3392 3597
 		 * Fires after a comment has been successfully updated via XML-RPC.
@@ -3448,16 +3653,19 @@  discard block
 block discarded – undo
3448 3653
 			$logged_in = true;
3449 3654
 		}
3450 3655
 
3451
-		if ( is_numeric($post) )
3452
-			$post_id = absint($post);
3453
-		else
3454
-			$post_id = url_to_postid($post);
3656
+		if ( is_numeric($post) ) {
3657
+					$post_id = absint($post);
3658
+		} else {
3659
+					$post_id = url_to_postid($post);
3660
+		}
3455 3661
 
3456
-		if ( ! $post_id )
3457
-			return new IXR_Error( 404, __( 'Invalid post ID.' ) );
3662
+		if ( ! $post_id ) {
3663
+					return new IXR_Error( 404, __( 'Invalid post ID.' ) );
3664
+		}
3458 3665
 
3459
-		if ( ! get_post($post_id) )
3460
-			return new IXR_Error( 404, __( 'Invalid post ID.' ) );
3666
+		if ( ! get_post($post_id) ) {
3667
+					return new IXR_Error( 404, __( 'Invalid post ID.' ) );
3668
+		}
3461 3669
 
3462 3670
 		$comment = array();
3463 3671
 		$comment['comment_post_ID'] = $post_id;
@@ -3469,24 +3677,28 @@  discard block
 block discarded – undo
3469 3677
 			$comment['user_ID'] = $user->ID;
3470 3678
 		} else {
3471 3679
 			$comment['comment_author'] = '';
3472
-			if ( isset($content_struct['author']) )
3473
-				$comment['comment_author'] = $content_struct['author'];
3680
+			if ( isset($content_struct['author']) ) {
3681
+							$comment['comment_author'] = $content_struct['author'];
3682
+			}
3474 3683
 
3475 3684
 			$comment['comment_author_email'] = '';
3476
-			if ( isset($content_struct['author_email']) )
3477
-				$comment['comment_author_email'] = $content_struct['author_email'];
3685
+			if ( isset($content_struct['author_email']) ) {
3686
+							$comment['comment_author_email'] = $content_struct['author_email'];
3687
+			}
3478 3688
 
3479 3689
 			$comment['comment_author_url'] = '';
3480
-			if ( isset($content_struct['author_url']) )
3481
-				$comment['comment_author_url'] = $content_struct['author_url'];
3690
+			if ( isset($content_struct['author_url']) ) {
3691
+							$comment['comment_author_url'] = $content_struct['author_url'];
3692
+			}
3482 3693
 
3483 3694
 			$comment['user_ID'] = 0;
3484 3695
 
3485 3696
 			if ( get_option('require_name_email') ) {
3486
-				if ( 6 > strlen($comment['comment_author_email']) || '' == $comment['comment_author'] )
3487
-					return new IXR_Error( 403, __( 'Comment author name and email are required' ) );
3488
-				elseif ( !is_email($comment['comment_author_email']) )
3489
-					return new IXR_Error( 403, __( 'A valid email address is required' ) );
3697
+				if ( 6 > strlen($comment['comment_author_email']) || '' == $comment['comment_author'] ) {
3698
+									return new IXR_Error( 403, __( 'Comment author name and email are required' ) );
3699
+				} elseif ( !is_email($comment['comment_author_email']) ) {
3700
+									return new IXR_Error( 403, __( 'A valid email address is required' ) );
3701
+				}
3490 3702
 			}
3491 3703
 		}
3492 3704
 
@@ -3532,11 +3744,13 @@  discard block
 block discarded – undo
3532 3744
 		$username = $args[1];
3533 3745
 		$password = $args[2];
3534 3746
 
3535
-		if ( !$user = $this->login($username, $password) )
3536
-			return $this->error;
3747
+		if ( !$user = $this->login($username, $password) ) {
3748
+					return $this->error;
3749
+		}
3537 3750
 
3538
-		if ( !current_user_can( 'moderate_comments' ) )
3539
-			return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) );
3751
+		if ( !current_user_can( 'moderate_comments' ) ) {
3752
+					return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) );
3753
+		}
3540 3754
 
3541 3755
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
3542 3756
 		do_action( 'xmlrpc_call', 'wp.getCommentStatusList' );
@@ -3566,11 +3780,13 @@  discard block
 block discarded – undo
3566 3780
 		$password	= $args[2];
3567 3781
 		$post_id	= (int) $args[3];
3568 3782
 
3569
-		if ( !$user = $this->login($username, $password) )
3570
-			return $this->error;
3783
+		if ( !$user = $this->login($username, $password) ) {
3784
+					return $this->error;
3785
+		}
3571 3786
 
3572
-		if ( !current_user_can( 'edit_posts' ) )
3573
-			return new IXR_Error( 403, __( 'You are not allowed access to details about comments.' ) );
3787
+		if ( !current_user_can( 'edit_posts' ) ) {
3788
+					return new IXR_Error( 403, __( 'You are not allowed access to details about comments.' ) );
3789
+		}
3574 3790
 
3575 3791
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
3576 3792
 		do_action( 'xmlrpc_call', 'wp.getCommentCount' );
@@ -3604,11 +3820,13 @@  discard block
 block discarded – undo
3604 3820
 		$username = $args[1];
3605 3821
 		$password = $args[2];
3606 3822
 
3607
-		if ( !$user = $this->login($username, $password) )
3608
-			return $this->error;
3823
+		if ( !$user = $this->login($username, $password) ) {
3824
+					return $this->error;
3825
+		}
3609 3826
 
3610
-		if ( !current_user_can( 'edit_posts' ) )
3611
-			return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) );
3827
+		if ( !current_user_can( 'edit_posts' ) ) {
3828
+					return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) );
3829
+		}
3612 3830
 
3613 3831
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
3614 3832
 		do_action( 'xmlrpc_call', 'wp.getPostStatusList' );
@@ -3636,11 +3854,13 @@  discard block
 block discarded – undo
3636 3854
 		$username = $args[1];
3637 3855
 		$password = $args[2];
3638 3856
 
3639
-		if ( !$user = $this->login($username, $password) )
3640
-			return $this->error;
3857
+		if ( !$user = $this->login($username, $password) ) {
3858
+					return $this->error;
3859
+		}
3641 3860
 
3642
-		if ( !current_user_can( 'edit_pages' ) )
3643
-			return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) );
3861
+		if ( !current_user_can( 'edit_pages' ) ) {
3862
+					return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) );
3863
+		}
3644 3864
 
3645 3865
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
3646 3866
 		do_action( 'xmlrpc_call', 'wp.getPageStatusList' );
@@ -3668,11 +3888,13 @@  discard block
 block discarded – undo
3668 3888
 		$username = $args[1];
3669 3889
 		$password = $args[2];
3670 3890
 
3671
-		if ( !$user = $this->login($username, $password) )
3672
-			return $this->error;
3891
+		if ( !$user = $this->login($username, $password) ) {
3892
+					return $this->error;
3893
+		}
3673 3894
 
3674
-		if ( !current_user_can( 'edit_pages' ) )
3675
-			return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) );
3895
+		if ( !current_user_can( 'edit_pages' ) ) {
3896
+					return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) );
3897
+		}
3676 3898
 
3677 3899
 		$templates = get_page_templates();
3678 3900
 		$templates['Default'] = 'default';
@@ -3702,12 +3924,14 @@  discard block
 block discarded – undo
3702 3924
 		$password	= $args[2];
3703 3925
 		$options	= isset( $args[3] ) ? (array) $args[3] : array();
3704 3926
 
3705
-		if ( !$user = $this->login($username, $password) )
3706
-			return $this->error;
3927
+		if ( !$user = $this->login($username, $password) ) {
3928
+					return $this->error;
3929
+		}
3707 3930
 
3708 3931
 		// If no specific options where asked for, return all of them
3709
-		if ( count( $options ) == 0 )
3710
-			$options = array_keys($this->blog_options);
3932
+		if ( count( $options ) == 0 ) {
3933
+					$options = array_keys($this->blog_options);
3934
+		}
3711 3935
 
3712 3936
 		return $this->_getOptions($options);
3713 3937
 	}
@@ -3732,8 +3956,9 @@  discard block
 block discarded – undo
3732 3956
 					unset($data[$option]['option']);
3733 3957
 				}
3734 3958
 
3735
-				if ( ! $can_manage )
3736
-					$data[$option]['readonly'] = true;
3959
+				if ( ! $can_manage ) {
3960
+									$data[$option]['readonly'] = true;
3961
+				}
3737 3962
 			}
3738 3963
 		}
3739 3964
 
@@ -3762,20 +3987,24 @@  discard block
 block discarded – undo
3762 3987
 		$password	= $args[2];
3763 3988
 		$options	= (array) $args[3];
3764 3989
 
3765
-		if ( !$user = $this->login($username, $password) )
3766
-			return $this->error;
3990
+		if ( !$user = $this->login($username, $password) ) {
3991
+					return $this->error;
3992
+		}
3767 3993
 
3768
-		if ( !current_user_can( 'manage_options' ) )
3769
-			return new IXR_Error( 403, __( 'You are not allowed to update options.' ) );
3994
+		if ( !current_user_can( 'manage_options' ) ) {
3995
+					return new IXR_Error( 403, __( 'You are not allowed to update options.' ) );
3996
+		}
3770 3997
 
3771 3998
 		$option_names = array();
3772 3999
 		foreach ( $options as $o_name => $o_value ) {
3773 4000
 			$option_names[] = $o_name;
3774
-			if ( !array_key_exists( $o_name, $this->blog_options ) )
3775
-				continue;
4001
+			if ( !array_key_exists( $o_name, $this->blog_options ) ) {
4002
+							continue;
4003
+			}
3776 4004
 
3777
-			if ( $this->blog_options[$o_name]['readonly'] == true )
3778
-				continue;
4005
+			if ( $this->blog_options[$o_name]['readonly'] == true ) {
4006
+							continue;
4007
+			}
3779 4008
 
3780 4009
 			update_option( $this->blog_options[$o_name]['option'], wp_unslash( $o_value ) );
3781 4010
 		}
@@ -3814,17 +4043,20 @@  discard block
 block discarded – undo
3814 4043
 		$password		= $args[2];
3815 4044
 		$attachment_id	= (int) $args[3];
3816 4045
 
3817
-		if ( !$user = $this->login($username, $password) )
3818
-			return $this->error;
4046
+		if ( !$user = $this->login($username, $password) ) {
4047
+					return $this->error;
4048
+		}
3819 4049
 
3820
-		if ( !current_user_can( 'upload_files' ) )
3821
-			return new IXR_Error( 403, __( 'You do not have permission to upload files.' ) );
4050
+		if ( !current_user_can( 'upload_files' ) ) {
4051
+					return new IXR_Error( 403, __( 'You do not have permission to upload files.' ) );
4052
+		}
3822 4053
 
3823 4054
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
3824 4055
 		do_action( 'xmlrpc_call', 'wp.getMediaItem' );
3825 4056
 
3826
-		if ( ! $attachment = get_post($attachment_id) )
3827
-			return new IXR_Error( 404, __( 'Invalid attachment ID.' ) );
4057
+		if ( ! $attachment = get_post($attachment_id) ) {
4058
+					return new IXR_Error( 404, __( 'Invalid attachment ID.' ) );
4059
+		}
3828 4060
 
3829 4061
 		return $this->_prepare_media_item( $attachment );
3830 4062
 	}
@@ -3862,11 +4094,13 @@  discard block
 block discarded – undo
3862 4094
 		$password	= $args[2];
3863 4095
 		$struct		= isset( $args[3] ) ? $args[3] : array() ;
3864 4096
 
3865
-		if ( !$user = $this->login($username, $password) )
3866
-			return $this->error;
4097
+		if ( !$user = $this->login($username, $password) ) {
4098
+					return $this->error;
4099
+		}
3867 4100
 
3868
-		if ( !current_user_can( 'upload_files' ) )
3869
-			return new IXR_Error( 401, __( 'You do not have permission to upload files.' ) );
4101
+		if ( !current_user_can( 'upload_files' ) ) {
4102
+					return new IXR_Error( 401, __( 'You do not have permission to upload files.' ) );
4103
+		}
3870 4104
 
3871 4105
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
3872 4106
 		do_action( 'xmlrpc_call', 'wp.getMediaLibrary' );
@@ -3880,8 +4114,9 @@  discard block
 block discarded – undo
3880 4114
 
3881 4115
 		$attachments_struct = array();
3882 4116
 
3883
-		foreach ($attachments as $attachment )
3884
-			$attachments_struct[] = $this->_prepare_media_item( $attachment );
4117
+		foreach ($attachments as $attachment ) {
4118
+					$attachments_struct[] = $this->_prepare_media_item( $attachment );
4119
+		}
3885 4120
 
3886 4121
 		return $attachments_struct;
3887 4122
 	}
@@ -3906,11 +4141,13 @@  discard block
 block discarded – undo
3906 4141
 		$username = $args[1];
3907 4142
 		$password = $args[2];
3908 4143
 
3909
-		if ( !$user = $this->login( $username, $password ) )
3910
-			return $this->error;
4144
+		if ( !$user = $this->login( $username, $password ) ) {
4145
+					return $this->error;
4146
+		}
3911 4147
 
3912
-		if ( !current_user_can( 'edit_posts' ) )
3913
-			return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) );
4148
+		if ( !current_user_can( 'edit_posts' ) ) {
4149
+					return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) );
4150
+		}
3914 4151
 
3915 4152
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
3916 4153
 		do_action( 'xmlrpc_call', 'wp.getPostFormats' );
@@ -3963,8 +4200,9 @@  discard block
 block discarded – undo
3963 4200
 	 *  - 'supports'
3964 4201
 	 */
3965 4202
 	public function wp_getPostType( $args ) {
3966
-		if ( ! $this->minimum_args( $args, 4 ) )
3967
-			return $this->error;
4203
+		if ( ! $this->minimum_args( $args, 4 ) ) {
4204
+					return $this->error;
4205
+		}
3968 4206
 
3969 4207
 		$this->escape( $args );
3970 4208
 
@@ -3986,19 +4224,22 @@  discard block
 block discarded – undo
3986 4224
 			$fields = apply_filters( 'xmlrpc_default_posttype_fields', array( 'labels', 'cap', 'taxonomies' ), 'wp.getPostType' );
3987 4225
 		}
3988 4226
 
3989
-		if ( !$user = $this->login( $username, $password ) )
3990
-			return $this->error;
4227
+		if ( !$user = $this->login( $username, $password ) ) {
4228
+					return $this->error;
4229
+		}
3991 4230
 
3992 4231
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
3993 4232
 		do_action( 'xmlrpc_call', 'wp.getPostType' );
3994 4233
 
3995
-		if ( ! post_type_exists( $post_type_name ) )
3996
-			return new IXR_Error( 403, __( 'Invalid post type' ) );
4234
+		if ( ! post_type_exists( $post_type_name ) ) {
4235
+					return new IXR_Error( 403, __( 'Invalid post type' ) );
4236
+		}
3997 4237
 
3998 4238
 		$post_type = get_post_type_object( $post_type_name );
3999 4239
 
4000
-		if ( ! current_user_can( $post_type->cap->edit_posts ) )
4001
-			return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post type.' ) );
4240
+		if ( ! current_user_can( $post_type->cap->edit_posts ) ) {
4241
+					return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post type.' ) );
4242
+		}
4002 4243
 
4003 4244
 		return $this->_prepare_post_type( $post_type, $fields );
4004 4245
 	}
@@ -4022,8 +4263,9 @@  discard block
 block discarded – undo
4022 4263
 	 * @return array|IXR_Error
4023 4264
 	 */
4024 4265
 	public function wp_getPostTypes( $args ) {
4025
-		if ( ! $this->minimum_args( $args, 3 ) )
4026
-			return $this->error;
4266
+		if ( ! $this->minimum_args( $args, 3 ) ) {
4267
+					return $this->error;
4268
+		}
4027 4269
 
4028 4270
 		$this->escape( $args );
4029 4271
 
@@ -4038,8 +4280,9 @@  discard block
 block discarded – undo
4038 4280
 			$fields = apply_filters( 'xmlrpc_default_posttype_fields', array( 'labels', 'cap', 'taxonomies' ), 'wp.getPostTypes' );
4039 4281
 		}
4040 4282
 
4041
-		if ( ! $user = $this->login( $username, $password ) )
4042
-			return $this->error;
4283
+		if ( ! $user = $this->login( $username, $password ) ) {
4284
+					return $this->error;
4285
+		}
4043 4286
 
4044 4287
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
4045 4288
 		do_action( 'xmlrpc_call', 'wp.getPostTypes' );
@@ -4049,8 +4292,9 @@  discard block
 block discarded – undo
4049 4292
 		$struct = array();
4050 4293
 
4051 4294
 		foreach( $post_types as $post_type ) {
4052
-			if ( ! current_user_can( $post_type->cap->edit_posts ) )
4053
-				continue;
4295
+			if ( ! current_user_can( $post_type->cap->edit_posts ) ) {
4296
+							continue;
4297
+			}
4054 4298
 
4055 4299
 			$struct[$post_type->name] = $this->_prepare_post_type( $post_type, $fields );
4056 4300
 		}
@@ -4081,8 +4325,9 @@  discard block
 block discarded – undo
4081 4325
 	 * @return array|IXR_Error contains a collection of posts.
4082 4326
 	 */
4083 4327
 	public function wp_getRevisions( $args ) {
4084
-		if ( ! $this->minimum_args( $args, 4 ) )
4085
-			return $this->error;
4328
+		if ( ! $this->minimum_args( $args, 4 ) ) {
4329
+					return $this->error;
4330
+		}
4086 4331
 
4087 4332
 		$this->escape( $args );
4088 4333
 
@@ -4104,36 +4349,43 @@  discard block
 block discarded – undo
4104 4349
 			$fields = apply_filters( 'xmlrpc_default_revision_fields', array( 'post_date', 'post_date_gmt' ), 'wp.getRevisions' );
4105 4350
 		}
4106 4351
 
4107
-		if ( ! $user = $this->login( $username, $password ) )
4108
-			return $this->error;
4352
+		if ( ! $user = $this->login( $username, $password ) ) {
4353
+					return $this->error;
4354
+		}
4109 4355
 
4110 4356
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
4111 4357
 		do_action( 'xmlrpc_call', 'wp.getRevisions' );
4112 4358
 
4113
-		if ( ! $post = get_post( $post_id ) )
4114
-			return new IXR_Error( 404, __( 'Invalid post ID.' ) );
4359
+		if ( ! $post = get_post( $post_id ) ) {
4360
+					return new IXR_Error( 404, __( 'Invalid post ID.' ) );
4361
+		}
4115 4362
 
4116
-		if ( ! current_user_can( 'edit_post', $post_id ) )
4117
-			return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit posts.' ) );
4363
+		if ( ! current_user_can( 'edit_post', $post_id ) ) {
4364
+					return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit posts.' ) );
4365
+		}
4118 4366
 
4119 4367
 		// Check if revisions are enabled.
4120
-		if ( ! wp_revisions_enabled( $post ) )
4121
-			return new IXR_Error( 401, __( 'Sorry, revisions are disabled.' ) );
4368
+		if ( ! wp_revisions_enabled( $post ) ) {
4369
+					return new IXR_Error( 401, __( 'Sorry, revisions are disabled.' ) );
4370
+		}
4122 4371
 
4123 4372
 		$revisions = wp_get_post_revisions( $post_id );
4124 4373
 
4125
-		if ( ! $revisions )
4126
-			return array();
4374
+		if ( ! $revisions ) {
4375
+					return array();
4376
+		}
4127 4377
 
4128 4378
 		$struct = array();
4129 4379
 
4130 4380
 		foreach ( $revisions as $revision ) {
4131
-			if ( ! current_user_can( 'read_post', $revision->ID ) )
4132
-				continue;
4381
+			if ( ! current_user_can( 'read_post', $revision->ID ) ) {
4382
+							continue;
4383
+			}
4133 4384
 
4134 4385
 			// Skip autosaves
4135
-			if ( wp_is_post_autosave( $revision ) )
4136
-				continue;
4386
+			if ( wp_is_post_autosave( $revision ) ) {
4387
+							continue;
4388
+			}
4137 4389
 
4138 4390
 			$struct[] = $this->_prepare_post( get_object_vars( $revision ), $fields );
4139 4391
 		}
@@ -4159,8 +4411,9 @@  discard block
 block discarded – undo
4159 4411
 	 * @return bool|IXR_Error false if there was an error restoring, true if success.
4160 4412
 	 */
4161 4413
 	public function wp_restoreRevision( $args ) {
4162
-		if ( ! $this->minimum_args( $args, 3 ) )
4163
-			return $this->error;
4414
+		if ( ! $this->minimum_args( $args, 3 ) ) {
4415
+					return $this->error;
4416
+		}
4164 4417
 
4165 4418
 		$this->escape( $args );
4166 4419
 
@@ -4168,27 +4421,33 @@  discard block
 block discarded – undo
4168 4421
 		$password    = $args[2];
4169 4422
 		$revision_id = (int) $args[3];
4170 4423
 
4171
-		if ( ! $user = $this->login( $username, $password ) )
4172
-			return $this->error;
4424
+		if ( ! $user = $this->login( $username, $password ) ) {
4425
+					return $this->error;
4426
+		}
4173 4427
 
4174 4428
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
4175 4429
 		do_action( 'xmlrpc_call', 'wp.restoreRevision' );
4176 4430
 
4177
-		if ( ! $revision = wp_get_post_revision( $revision_id ) )
4178
-			return new IXR_Error( 404, __( 'Invalid post ID.' ) );
4431
+		if ( ! $revision = wp_get_post_revision( $revision_id ) ) {
4432
+					return new IXR_Error( 404, __( 'Invalid post ID.' ) );
4433
+		}
4179 4434
 
4180
-		if ( wp_is_post_autosave( $revision ) )
4181
-			return new IXR_Error( 404, __( 'Invalid post ID.' ) );
4435
+		if ( wp_is_post_autosave( $revision ) ) {
4436
+					return new IXR_Error( 404, __( 'Invalid post ID.' ) );
4437
+		}
4182 4438
 
4183
-		if ( ! $post = get_post( $revision->post_parent ) )
4184
-			return new IXR_Error( 404, __( 'Invalid post ID.' ) );
4439
+		if ( ! $post = get_post( $revision->post_parent ) ) {
4440
+					return new IXR_Error( 404, __( 'Invalid post ID.' ) );
4441
+		}
4185 4442
 
4186
-		if ( ! current_user_can( 'edit_post', $revision->post_parent ) )
4187
-			return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) );
4443
+		if ( ! current_user_can( 'edit_post', $revision->post_parent ) ) {
4444
+					return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) );
4445
+		}
4188 4446
 
4189 4447
 		// Check if revisions are disabled.
4190
-		if ( ! wp_revisions_enabled( $post ) )
4191
-			return new IXR_Error( 401, __( 'Sorry, revisions are disabled.' ) );
4448
+		if ( ! wp_revisions_enabled( $post ) ) {
4449
+					return new IXR_Error( 401, __( 'Sorry, revisions are disabled.' ) );
4450
+		}
4192 4451
 
4193 4452
 		$post = wp_restore_post_revision( $revision_id );
4194 4453
 
@@ -4216,16 +4475,18 @@  discard block
 block discarded – undo
4216 4475
 	 * @return array|IXR_Error
4217 4476
 	 */
4218 4477
 	public function blogger_getUsersBlogs($args) {
4219
-		if ( is_multisite() )
4220
-			return $this->_multisite_getUsersBlogs($args);
4478
+		if ( is_multisite() ) {
4479
+					return $this->_multisite_getUsersBlogs($args);
4480
+		}
4221 4481
 
4222 4482
 		$this->escape($args);
4223 4483
 
4224 4484
 		$username = $args[1];
4225 4485
 		$password = $args[2];
4226 4486
 
4227
-		if ( !$user = $this->login($username, $password) )
4228
-			return $this->error;
4487
+		if ( !$user = $this->login($username, $password) ) {
4488
+					return $this->error;
4489
+		}
4229 4490
 
4230 4491
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
4231 4492
 		do_action( 'xmlrpc_call', 'blogger.getUsersBlogs' );
@@ -4260,15 +4521,17 @@  discard block
 block discarded – undo
4260 4521
 		$rpc->query('wp.getUsersBlogs', $args[1], $args[2]);
4261 4522
 		$blogs = $rpc->getResponse();
4262 4523
 
4263
-		if ( isset($blogs['faultCode']) )
4264
-			return new IXR_Error($blogs['faultCode'], $blogs['faultString']);
4524
+		if ( isset($blogs['faultCode']) ) {
4525
+					return new IXR_Error($blogs['faultCode'], $blogs['faultString']);
4526
+		}
4265 4527
 
4266 4528
 		if ( $_SERVER['HTTP_HOST'] == $domain && $_SERVER['REQUEST_URI'] == $path ) {
4267 4529
 			return $blogs;
4268 4530
 		} else {
4269 4531
 			foreach ( (array) $blogs as $blog ) {
4270
-				if ( strpos($blog['url'], $_SERVER['HTTP_HOST']) )
4271
-					return array($blog);
4532
+				if ( strpos($blog['url'], $_SERVER['HTTP_HOST']) ) {
4533
+									return array($blog);
4534
+				}
4272 4535
 			}
4273 4536
 			return array();
4274 4537
 		}
@@ -4296,11 +4559,13 @@  discard block
 block discarded – undo
4296 4559
 		$username = $args[1];
4297 4560
 		$password = $args[2];
4298 4561
 
4299
-		if ( !$user = $this->login($username, $password) )
4300
-			return $this->error;
4562
+		if ( !$user = $this->login($username, $password) ) {
4563
+					return $this->error;
4564
+		}
4301 4565
 
4302
-		if ( !current_user_can( 'edit_posts' ) )
4303
-			return new IXR_Error( 401, __( 'Sorry, you do not have access to user data on this site.' ) );
4566
+		if ( !current_user_can( 'edit_posts' ) ) {
4567
+					return new IXR_Error( 401, __( 'Sorry, you do not have access to user data on this site.' ) );
4568
+		}
4304 4569
 
4305 4570
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
4306 4571
 		do_action( 'xmlrpc_call', 'blogger.getUserInfo' );
@@ -4338,15 +4603,18 @@  discard block
 block discarded – undo
4338 4603
 		$username = $args[2];
4339 4604
 		$password = $args[3];
4340 4605
 
4341
-		if ( !$user = $this->login($username, $password) )
4342
-			return $this->error;
4606
+		if ( !$user = $this->login($username, $password) ) {
4607
+					return $this->error;
4608
+		}
4343 4609
 
4344 4610
 		$post_data = get_post($post_ID, ARRAY_A);
4345
-		if ( ! $post_data )
4346
-			return new IXR_Error( 404, __( 'Invalid post ID.' ) );
4611
+		if ( ! $post_data ) {
4612
+					return new IXR_Error( 404, __( 'Invalid post ID.' ) );
4613
+		}
4347 4614
 
4348
-		if ( !current_user_can( 'edit_post', $post_ID ) )
4349
-			return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) );
4615
+		if ( !current_user_can( 'edit_post', $post_ID ) ) {
4616
+					return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) );
4617
+		}
4350 4618
 
4351 4619
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
4352 4620
 		do_action( 'xmlrpc_call', 'blogger.getPost' );
@@ -4390,16 +4658,19 @@  discard block
 block discarded – undo
4390 4658
 		// $args[0] = appkey - ignored
4391 4659
 		$username = $args[2];
4392 4660
 		$password = $args[3];
4393
-		if ( isset( $args[4] ) )
4394
-			$query = array( 'numberposts' => absint( $args[4] ) );
4395
-		else
4396
-			$query = array();
4661
+		if ( isset( $args[4] ) ) {
4662
+					$query = array( 'numberposts' => absint( $args[4] ) );
4663
+		} else {
4664
+					$query = array();
4665
+		}
4397 4666
 
4398
-		if ( !$user = $this->login($username, $password) )
4399
-			return $this->error;
4667
+		if ( !$user = $this->login($username, $password) ) {
4668
+					return $this->error;
4669
+		}
4400 4670
 
4401
-		if ( ! current_user_can( 'edit_posts' ) )
4402
-			return new IXR_Error( 401, __( 'Sorry, you cannot edit posts on this site.' ) );
4671
+		if ( ! current_user_can( 'edit_posts' ) ) {
4672
+					return new IXR_Error( 401, __( 'Sorry, you cannot edit posts on this site.' ) );
4673
+		}
4403 4674
 
4404 4675
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
4405 4676
 		do_action( 'xmlrpc_call', 'blogger.getRecentPosts' );
@@ -4413,8 +4684,9 @@  discard block
 block discarded – undo
4413 4684
 
4414 4685
 		$recent_posts = array();
4415 4686
 		foreach ($posts_list as $entry) {
4416
-			if ( !current_user_can( 'edit_post', $entry['ID'] ) )
4417
-				continue;
4687
+			if ( !current_user_can( 'edit_post', $entry['ID'] ) ) {
4688
+							continue;
4689
+			}
4418 4690
 
4419 4691
 			$post_date  = $this->_convert_date( $entry['post_date'] );
4420 4692
 			$categories = implode(',', wp_get_post_categories($entry['ID']));
@@ -4481,15 +4753,17 @@  discard block
 block discarded – undo
4481 4753
 		$content  = $args[4];
4482 4754
 		$publish  = $args[5];
4483 4755
 
4484
-		if ( !$user = $this->login($username, $password) )
4485
-			return $this->error;
4756
+		if ( !$user = $this->login($username, $password) ) {
4757
+					return $this->error;
4758
+		}
4486 4759
 
4487 4760
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
4488 4761
 		do_action( 'xmlrpc_call', 'blogger.newPost' );
4489 4762
 
4490 4763
 		$cap = ($publish) ? 'publish_posts' : 'edit_posts';
4491
-		if ( ! current_user_can( get_post_type_object( 'post' )->cap->create_posts ) || !current_user_can($cap) )
4492
-			return new IXR_Error(401, __('Sorry, you are not allowed to post on this site.'));
4764
+		if ( ! current_user_can( get_post_type_object( 'post' )->cap->create_posts ) || !current_user_can($cap) ) {
4765
+					return new IXR_Error(401, __('Sorry, you are not allowed to post on this site.'));
4766
+		}
4493 4767
 
4494 4768
 		$post_status = ($publish) ? 'publish' : 'draft';
4495 4769
 
@@ -4505,11 +4779,13 @@  discard block
 block discarded – undo
4505 4779
 		$post_data = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status');
4506 4780
 
4507 4781
 		$post_ID = wp_insert_post($post_data);
4508
-		if ( is_wp_error( $post_ID ) )
4509
-			return new IXR_Error(500, $post_ID->get_error_message());
4782
+		if ( is_wp_error( $post_ID ) ) {
4783
+					return new IXR_Error(500, $post_ID->get_error_message());
4784
+		}
4510 4785
 
4511
-		if ( !$post_ID )
4512
-			return new IXR_Error(500, __('Sorry, your entry could not be posted. Something wrong happened.'));
4786
+		if ( !$post_ID ) {
4787
+					return new IXR_Error(500, __('Sorry, your entry could not be posted. Something wrong happened.'));
4788
+		}
4513 4789
 
4514 4790
 		$this->attach_uploads( $post_ID, $post_content );
4515 4791
 
@@ -4623,24 +4899,28 @@  discard block
 block discarded – undo
4623 4899
 		$username = $args[2];
4624 4900
 		$password = $args[3];
4625 4901
 
4626
-		if ( !$user = $this->login($username, $password) )
4627
-			return $this->error;
4902
+		if ( !$user = $this->login($username, $password) ) {
4903
+					return $this->error;
4904
+		}
4628 4905
 
4629 4906
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
4630 4907
 		do_action( 'xmlrpc_call', 'blogger.deletePost' );
4631 4908
 
4632 4909
 		$actual_post = get_post($post_ID,ARRAY_A);
4633 4910
 
4634
-		if ( !$actual_post || $actual_post['post_type'] != 'post' )
4635
-			return new IXR_Error(404, __('Sorry, no such post.'));
4911
+		if ( !$actual_post || $actual_post['post_type'] != 'post' ) {
4912
+					return new IXR_Error(404, __('Sorry, no such post.'));
4913
+		}
4636 4914
 
4637
-		if ( !current_user_can('delete_post', $post_ID) )
4638
-			return new IXR_Error(401, __('Sorry, you do not have the right to delete this post.'));
4915
+		if ( !current_user_can('delete_post', $post_ID) ) {
4916
+					return new IXR_Error(401, __('Sorry, you do not have the right to delete this post.'));
4917
+		}
4639 4918
 
4640 4919
 		$result = wp_delete_post($post_ID);
4641 4920
 
4642
-		if ( !$result )
4643
-			return new IXR_Error(500, __('For some strange yet very annoying reason, this post could not be deleted.'));
4921
+		if ( !$result ) {
4922
+					return new IXR_Error(500, __('For some strange yet very annoying reason, this post could not be deleted.'));
4923
+		}
4644 4924
 
4645 4925
 		/**
4646 4926
 		 * Fires after a post has been successfully deleted via the XML-RPC Blogger API.
@@ -4705,8 +4985,9 @@  discard block
 block discarded – undo
4705 4985
 		$content_struct = $args[3];
4706 4986
 		$publish        = isset( $args[4] ) ? $args[4] : 0;
4707 4987
 
4708
-		if ( !$user = $this->login($username, $password) )
4709
-			return $this->error;
4988
+		if ( !$user = $this->login($username, $password) ) {
4989
+					return $this->error;
4990
+		}
4710 4991
 
4711 4992
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
4712 4993
 		do_action( 'xmlrpc_call', 'metaWeblog.newPost' );
@@ -4714,23 +4995,26 @@  discard block
 block discarded – undo
4714 4995
 		$page_template = '';
4715 4996
 		if ( !empty( $content_struct['post_type'] ) ) {
4716 4997
 			if ( $content_struct['post_type'] == 'page' ) {
4717
-				if ( $publish )
4718
-					$cap  = 'publish_pages';
4719
-				elseif ( isset( $content_struct['page_status'] ) && 'publish' == $content_struct['page_status'] )
4720
-					$cap  = 'publish_pages';
4721
-				else
4722
-					$cap = 'edit_pages';
4998
+				if ( $publish ) {
4999
+									$cap  = 'publish_pages';
5000
+				} elseif ( isset( $content_struct['page_status'] ) && 'publish' == $content_struct['page_status'] ) {
5001
+									$cap  = 'publish_pages';
5002
+				} else {
5003
+									$cap = 'edit_pages';
5004
+				}
4723 5005
 				$error_message = __( 'Sorry, you are not allowed to publish pages on this site.' );
4724 5006
 				$post_type = 'page';
4725
-				if ( !empty( $content_struct['wp_page_template'] ) )
4726
-					$page_template = $content_struct['wp_page_template'];
5007
+				if ( !empty( $content_struct['wp_page_template'] ) ) {
5008
+									$page_template = $content_struct['wp_page_template'];
5009
+				}
4727 5010
 			} elseif ( $content_struct['post_type'] == 'post' ) {
4728
-				if ( $publish )
4729
-					$cap  = 'publish_posts';
4730
-				elseif ( isset( $content_struct['post_status'] ) && 'publish' == $content_struct['post_status'] )
4731
-					$cap  = 'publish_posts';
4732
-				else
4733
-					$cap = 'edit_posts';
5011
+				if ( $publish ) {
5012
+									$cap  = 'publish_posts';
5013
+				} elseif ( isset( $content_struct['post_status'] ) && 'publish' == $content_struct['post_status'] ) {
5014
+									$cap  = 'publish_posts';
5015
+				} else {
5016
+									$cap = 'edit_posts';
5017
+				}
4734 5018
 				$error_message = __( 'Sorry, you are not allowed to publish posts on this site.' );
4735 5019
 				$post_type = 'post';
4736 5020
 			} else {
@@ -4738,20 +5022,23 @@  discard block
 block discarded – undo
4738 5022
 				return new IXR_Error( 401, __( 'Invalid post type' ) );
4739 5023
 			}
4740 5024
 		} else {
4741
-			if ( $publish )
4742
-				$cap  = 'publish_posts';
4743
-			elseif ( isset( $content_struct['post_status'] ) && 'publish' == $content_struct['post_status'])
4744
-				$cap  = 'publish_posts';
4745
-			else
4746
-				$cap = 'edit_posts';
5025
+			if ( $publish ) {
5026
+							$cap  = 'publish_posts';
5027
+			} elseif ( isset( $content_struct['post_status'] ) && 'publish' == $content_struct['post_status']) {
5028
+							$cap  = 'publish_posts';
5029
+			} else {
5030
+							$cap = 'edit_posts';
5031
+			}
4747 5032
 			$error_message = __( 'Sorry, you are not allowed to publish posts on this site.' );
4748 5033
 			$post_type = 'post';
4749 5034
 		}
4750 5035
 
4751
-		if ( ! current_user_can( get_post_type_object( $post_type )->cap->create_posts ) )
4752
-			return new IXR_Error( 401, __( 'Sorry, you are not allowed to publish posts on this site.' ) );
4753
-		if ( !current_user_can( $cap ) )
4754
-			return new IXR_Error( 401, $error_message );
5036
+		if ( ! current_user_can( get_post_type_object( $post_type )->cap->create_posts ) ) {
5037
+					return new IXR_Error( 401, __( 'Sorry, you are not allowed to publish posts on this site.' ) );
5038
+		}
5039
+		if ( !current_user_can( $cap ) ) {
5040
+					return new IXR_Error( 401, $error_message );
5041
+		}
4755 5042
 
4756 5043
 		// Check for a valid post format if one was given
4757 5044
 		if ( isset( $content_struct['wp_post_format'] ) ) {
@@ -4764,20 +5051,24 @@  discard block
 block discarded – undo
4764 5051
 		// Let WordPress generate the post_name (slug) unless
4765 5052
 		// one has been provided.
4766 5053
 		$post_name = "";
4767
-		if ( isset($content_struct['wp_slug']) )
4768
-			$post_name = $content_struct['wp_slug'];
5054
+		if ( isset($content_struct['wp_slug']) ) {
5055
+					$post_name = $content_struct['wp_slug'];
5056
+		}
4769 5057
 
4770 5058
 		// Only use a password if one was given.
4771
-		if ( isset($content_struct['wp_password']) )
4772
-			$post_password = $content_struct['wp_password'];
5059
+		if ( isset($content_struct['wp_password']) ) {
5060
+					$post_password = $content_struct['wp_password'];
5061
+		}
4773 5062
 
4774 5063
 		// Only set a post parent if one was provided.
4775
-		if ( isset($content_struct['wp_page_parent_id']) )
4776
-			$post_parent = $content_struct['wp_page_parent_id'];
5064
+		if ( isset($content_struct['wp_page_parent_id']) ) {
5065
+					$post_parent = $content_struct['wp_page_parent_id'];
5066
+		}
4777 5067
 
4778 5068
 		// Only set the menu_order if it was provided.
4779
-		if ( isset($content_struct['wp_page_order']) )
4780
-			$menu_order = $content_struct['wp_page_order'];
5069
+		if ( isset($content_struct['wp_page_order']) ) {
5070
+					$menu_order = $content_struct['wp_page_order'];
5071
+		}
4781 5072
 
4782 5073
 		$post_author = $user->ID;
4783 5074
 
@@ -4785,19 +5076,22 @@  discard block
 block discarded – undo
4785 5076
 		if ( isset( $content_struct['wp_author_id'] ) && ( $user->ID != $content_struct['wp_author_id'] ) ) {
4786 5077
 			switch ( $post_type ) {
4787 5078
 				case "post":
4788
-					if ( !current_user_can( 'edit_others_posts' ) )
4789
-						return new IXR_Error( 401, __( 'You are not allowed to create posts as this user.' ) );
5079
+					if ( !current_user_can( 'edit_others_posts' ) ) {
5080
+											return new IXR_Error( 401, __( 'You are not allowed to create posts as this user.' ) );
5081
+					}
4790 5082
 					break;
4791 5083
 				case "page":
4792
-					if ( !current_user_can( 'edit_others_pages' ) )
4793
-						return new IXR_Error( 401, __( 'You are not allowed to create pages as this user.' ) );
5084
+					if ( !current_user_can( 'edit_others_pages' ) ) {
5085
+											return new IXR_Error( 401, __( 'You are not allowed to create pages as this user.' ) );
5086
+					}
4794 5087
 					break;
4795 5088
 				default:
4796 5089
 					return new IXR_Error( 401, __( 'Invalid post type' ) );
4797 5090
 			}
4798 5091
 			$author = get_userdata( $content_struct['wp_author_id'] );
4799
-			if ( ! $author )
4800
-				return new IXR_Error( 404, __( 'Invalid author ID.' ) );
5092
+			if ( ! $author ) {
5093
+							return new IXR_Error( 404, __( 'Invalid author ID.' ) );
5094
+			}
4801 5095
 			$post_author = $content_struct['wp_author_id'];
4802 5096
 		}
4803 5097
 
@@ -4886,22 +5180,25 @@  discard block
 block discarded – undo
4886 5180
 			$ping_status = get_default_comment_status( $post_type, 'pingback' );
4887 5181
 		}
4888 5182
 
4889
-		if ( $post_more )
4890
-			$post_content = $post_content . '<!--more-->' . $post_more;
5183
+		if ( $post_more ) {
5184
+					$post_content = $post_content . '<!--more-->' . $post_more;
5185
+		}
4891 5186
 
4892 5187
 		$to_ping = null;
4893 5188
 		if ( isset( $content_struct['mt_tb_ping_urls'] ) ) {
4894 5189
 			$to_ping = $content_struct['mt_tb_ping_urls'];
4895
-			if ( is_array($to_ping) )
4896
-				$to_ping = implode(' ', $to_ping);
5190
+			if ( is_array($to_ping) ) {
5191
+							$to_ping = implode(' ', $to_ping);
5192
+			}
4897 5193
 		}
4898 5194
 
4899 5195
 		// Do some timestamp voodoo
4900
-		if ( !empty( $content_struct['date_created_gmt'] ) )
4901
-			// We know this is supposed to be GMT, so we're going to slap that Z on there by force
5196
+		if ( !empty( $content_struct['date_created_gmt'] ) ) {
5197
+					// We know this is supposed to be GMT, so we're going to slap that Z on there by force
4902 5198
 			$dateCreated = rtrim( $content_struct['date_created_gmt']->getIso(), 'Z' ) . 'Z';
4903
-		elseif ( !empty( $content_struct['dateCreated']) )
4904
-			$dateCreated = $content_struct['dateCreated']->getIso();
5199
+		} elseif ( !empty( $content_struct['dateCreated']) ) {
5200
+					$dateCreated = $content_struct['dateCreated']->getIso();
5201
+		}
4905 5202
 
4906 5203
 		if ( !empty( $dateCreated ) ) {
4907 5204
 			$post_date = get_date_from_gmt(iso8601_to_datetime($dateCreated));
@@ -4936,12 +5233,14 @@  discard block
 block discarded – undo
4936 5233
 			}
4937 5234
 		}
4938 5235
 
4939
-		if ( isset($content_struct['custom_fields']) )
4940
-			$this->set_custom_fields($post_ID, $content_struct['custom_fields']);
5236
+		if ( isset($content_struct['custom_fields']) ) {
5237
+					$this->set_custom_fields($post_ID, $content_struct['custom_fields']);
5238
+		}
4941 5239
 
4942 5240
 		if ( isset ( $content_struct['wp_post_thumbnail'] ) ) {
4943
-			if ( set_post_thumbnail( $post_ID, $content_struct['wp_post_thumbnail'] ) === false )
4944
-				return new IXR_Error( 404, __( 'Invalid attachment ID.' ) );
5241
+			if ( set_post_thumbnail( $post_ID, $content_struct['wp_post_thumbnail'] ) === false ) {
5242
+							return new IXR_Error( 404, __( 'Invalid attachment ID.' ) );
5243
+			}
4945 5244
 
4946 5245
 			unset( $content_struct['wp_post_thumbnail'] );
4947 5246
 		}
@@ -4954,15 +5253,18 @@  discard block
 block discarded – undo
4954 5253
 
4955 5254
 		// Handle post formats if assigned, value is validated earlier
4956 5255
 		// in this function
4957
-		if ( isset( $content_struct['wp_post_format'] ) )
4958
-			set_post_format( $post_ID, $content_struct['wp_post_format'] );
5256
+		if ( isset( $content_struct['wp_post_format'] ) ) {
5257
+					set_post_format( $post_ID, $content_struct['wp_post_format'] );
5258
+		}
4959 5259
 
4960 5260
 		$post_ID = wp_insert_post( $postdata, true );
4961
-		if ( is_wp_error( $post_ID ) )
4962
-			return new IXR_Error(500, $post_ID->get_error_message());
5261
+		if ( is_wp_error( $post_ID ) ) {
5262
+					return new IXR_Error(500, $post_ID->get_error_message());
5263
+		}
4963 5264
 
4964
-		if ( !$post_ID )
4965
-			return new IXR_Error(500, __('Sorry, your entry could not be posted. Something wrong happened.'));
5265
+		if ( !$post_ID ) {
5266
+					return new IXR_Error(500, __('Sorry, your entry could not be posted. Something wrong happened.'));
5267
+		}
4966 5268
 
4967 5269
 		/**
4968 5270
 		 * Fires after a new post has been successfully created via the XML-RPC MovableType API.
@@ -4994,8 +5296,9 @@  discard block
 block discarded – undo
4994 5296
 					}
4995 5297
 				}
4996 5298
 			}
4997
-			if ( ! $found )
4998
-				add_post_meta( $post_ID, 'enclosure', $encstring );
5299
+			if ( ! $found ) {
5300
+							add_post_meta( $post_ID, 'enclosure', $encstring );
5301
+			}
4999 5302
 		}
5000 5303
 	}
5001 5304
 
@@ -5016,8 +5319,9 @@  discard block
 block discarded – undo
5016 5319
 		$attachments = $wpdb->get_results( "SELECT ID, guid FROM {$wpdb->posts} WHERE post_parent = '0' AND post_type = 'attachment'" );
5017 5320
 		if ( is_array( $attachments ) ) {
5018 5321
 			foreach ( $attachments as $file ) {
5019
-				if ( ! empty( $file->guid ) && strpos( $post_content, $file->guid ) !== false )
5020
-					$wpdb->update($wpdb->posts, array('post_parent' => $post_ID), array('ID' => $file->ID) );
5322
+				if ( ! empty( $file->guid ) && strpos( $post_content, $file->guid ) !== false ) {
5323
+									$wpdb->update($wpdb->posts, array('post_parent' => $post_ID), array('ID' => $file->ID) );
5324
+				}
5021 5325
 			}
5022 5326
 		}
5023 5327
 	}
@@ -5047,8 +5351,9 @@  discard block
 block discarded – undo
5047 5351
 		$content_struct = $args[3];
5048 5352
 		$publish        = isset( $args[4] ) ? $args[4] : 0;
5049 5353
 
5050
-		if ( ! $user = $this->login($username, $password) )
5051
-			return $this->error;
5354
+		if ( ! $user = $this->login($username, $password) ) {
5355
+					return $this->error;
5356
+		}
5052 5357
 
5053 5358
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
5054 5359
 		do_action( 'xmlrpc_call', 'metaWeblog.editPost' );
@@ -5059,19 +5364,23 @@  discard block
 block discarded – undo
5059 5364
 		 * If there is no post data for the give post id, stop now and return an error.
5060 5365
 		 * Otherwise a new post will be created (which was the old behavior).
5061 5366
 		 */
5062
-		if ( ! $postdata || empty( $postdata[ 'ID' ] ) )
5063
-			return new IXR_Error( 404, __( 'Invalid post ID.' ) );
5367
+		if ( ! $postdata || empty( $postdata[ 'ID' ] ) ) {
5368
+					return new IXR_Error( 404, __( 'Invalid post ID.' ) );
5369
+		}
5064 5370
 
5065
-		if ( ! current_user_can( 'edit_post', $post_ID ) )
5066
-			return new IXR_Error( 401, __( 'Sorry, you do not have the right to edit this post.' ) );
5371
+		if ( ! current_user_can( 'edit_post', $post_ID ) ) {
5372
+					return new IXR_Error( 401, __( 'Sorry, you do not have the right to edit this post.' ) );
5373
+		}
5067 5374
 
5068 5375
 		// Use wp.editPost to edit post types other than post and page.
5069
-		if ( ! in_array( $postdata[ 'post_type' ], array( 'post', 'page' ) ) )
5070
-			return new IXR_Error( 401, __( 'Invalid post type' ) );
5376
+		if ( ! in_array( $postdata[ 'post_type' ], array( 'post', 'page' ) ) ) {
5377
+					return new IXR_Error( 401, __( 'Invalid post type' ) );
5378
+		}
5071 5379
 
5072 5380
 		// Thwart attempt to change the post type.
5073
-		if ( ! empty( $content_struct[ 'post_type' ] ) && ( $content_struct['post_type'] != $postdata[ 'post_type' ] ) )
5074
-			return new IXR_Error( 401, __( 'The post type may not be changed.' ) );
5381
+		if ( ! empty( $content_struct[ 'post_type' ] ) && ( $content_struct['post_type'] != $postdata[ 'post_type' ] ) ) {
5382
+					return new IXR_Error( 401, __( 'The post type may not be changed.' ) );
5383
+		}
5075 5384
 
5076 5385
 		// Check for a valid post format if one was given
5077 5386
 		if ( isset( $content_struct['wp_post_format'] ) ) {
@@ -5094,24 +5403,29 @@  discard block
 block discarded – undo
5094 5403
 
5095 5404
 		// Let WordPress manage slug if none was provided.
5096 5405
 		$post_name = $postdata['post_name'];
5097
-		if ( isset($content_struct['wp_slug']) )
5098
-			$post_name = $content_struct['wp_slug'];
5406
+		if ( isset($content_struct['wp_slug']) ) {
5407
+					$post_name = $content_struct['wp_slug'];
5408
+		}
5099 5409
 
5100 5410
 		// Only use a password if one was given.
5101
-		if ( isset($content_struct['wp_password']) )
5102
-			$post_password = $content_struct['wp_password'];
5411
+		if ( isset($content_struct['wp_password']) ) {
5412
+					$post_password = $content_struct['wp_password'];
5413
+		}
5103 5414
 
5104 5415
 		// Only set a post parent if one was given.
5105
-		if ( isset($content_struct['wp_page_parent_id']) )
5106
-			$post_parent = $content_struct['wp_page_parent_id'];
5416
+		if ( isset($content_struct['wp_page_parent_id']) ) {
5417
+					$post_parent = $content_struct['wp_page_parent_id'];
5418
+		}
5107 5419
 
5108 5420
 		// Only set the menu_order if it was given.
5109
-		if ( isset($content_struct['wp_page_order']) )
5110
-			$menu_order = $content_struct['wp_page_order'];
5421
+		if ( isset($content_struct['wp_page_order']) ) {
5422
+					$menu_order = $content_struct['wp_page_order'];
5423
+		}
5111 5424
 
5112 5425
 		$page_template = null;
5113
-		if ( ! empty( $content_struct['wp_page_template'] ) && 'page' == $post_type )
5114
-			$page_template = $content_struct['wp_page_template'];
5426
+		if ( ! empty( $content_struct['wp_page_template'] ) && 'page' == $post_type ) {
5427
+					$page_template = $content_struct['wp_page_template'];
5428
+		}
5115 5429
 
5116 5430
 		$post_author = $postdata['post_author'];
5117 5431
 
@@ -5195,11 +5509,13 @@  discard block
 block discarded – undo
5195 5509
 			}
5196 5510
 		}
5197 5511
 
5198
-		if ( isset( $content_struct['title'] ) )
5199
-			$post_title =  $content_struct['title'];
5512
+		if ( isset( $content_struct['title'] ) ) {
5513
+					$post_title =  $content_struct['title'];
5514
+		}
5200 5515
 
5201
-		if ( isset( $content_struct['description'] ) )
5202
-			$post_content = $content_struct['description'];
5516
+		if ( isset( $content_struct['description'] ) ) {
5517
+					$post_content = $content_struct['description'];
5518
+		}
5203 5519
 
5204 5520
 		$post_category = array();
5205 5521
 		if ( isset( $content_struct['categories'] ) ) {
@@ -5211,8 +5527,9 @@  discard block
 block discarded – undo
5211 5527
 			}
5212 5528
 		}
5213 5529
 
5214
-		if ( isset( $content_struct['mt_excerpt'] ) )
5215
-			$post_excerpt =  $content_struct['mt_excerpt'];
5530
+		if ( isset( $content_struct['mt_excerpt'] ) ) {
5531
+					$post_excerpt =  $content_struct['mt_excerpt'];
5532
+		}
5216 5533
 
5217 5534
 		$post_more = isset( $content_struct['mt_text_more'] ) ? $content_struct['mt_text_more'] : null;
5218 5535
 
@@ -5241,22 +5558,25 @@  discard block
 block discarded – undo
5241 5558
 			}
5242 5559
 		}
5243 5560
 
5244
-		if ( $post_more )
5245
-			$post_content = $post_content . "<!--more-->" . $post_more;
5561
+		if ( $post_more ) {
5562
+					$post_content = $post_content . "<!--more-->" . $post_more;
5563
+		}
5246 5564
 
5247 5565
 		$to_ping = null;
5248 5566
 		if ( isset( $content_struct['mt_tb_ping_urls'] ) ) {
5249 5567
 			$to_ping = $content_struct['mt_tb_ping_urls'];
5250
-			if ( is_array($to_ping) )
5251
-				$to_ping = implode(' ', $to_ping);
5568
+			if ( is_array($to_ping) ) {
5569
+							$to_ping = implode(' ', $to_ping);
5570
+			}
5252 5571
 		}
5253 5572
 
5254 5573
 		// Do some timestamp voodoo.
5255
-		if ( !empty( $content_struct['date_created_gmt'] ) )
5256
-			// We know this is supposed to be GMT, so we're going to slap that Z on there by force.
5574
+		if ( !empty( $content_struct['date_created_gmt'] ) ) {
5575
+					// We know this is supposed to be GMT, so we're going to slap that Z on there by force.
5257 5576
 			$dateCreated = rtrim( $content_struct['date_created_gmt']->getIso(), 'Z' ) . 'Z';
5258
-		elseif ( !empty( $content_struct['dateCreated']) )
5259
-			$dateCreated = $content_struct['dateCreated']->getIso();
5577
+		} elseif ( !empty( $content_struct['dateCreated']) ) {
5578
+					$dateCreated = $content_struct['dateCreated']->getIso();
5579
+		}
5260 5580
 
5261 5581
 		if ( !empty( $dateCreated ) ) {
5262 5582
 			$post_date = get_date_from_gmt(iso8601_to_datetime($dateCreated));
@@ -5270,11 +5590,13 @@  discard block
 block discarded – undo
5270 5590
 		$newpost = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'post_date', 'post_date_gmt', 'to_ping', 'post_name', 'post_password', 'post_parent', 'menu_order', 'post_author', 'tags_input', 'page_template');
5271 5591
 
5272 5592
 		$result = wp_update_post($newpost, true);
5273
-		if ( is_wp_error( $result ) )
5274
-			return new IXR_Error(500, $result->get_error_message());
5593
+		if ( is_wp_error( $result ) ) {
5594
+					return new IXR_Error(500, $result->get_error_message());
5595
+		}
5275 5596
 
5276
-		if ( !$result )
5277
-			return new IXR_Error(500, __('Sorry, your entry could not be edited. Something wrong happened.'));
5597
+		if ( !$result ) {
5598
+					return new IXR_Error(500, __('Sorry, your entry could not be edited. Something wrong happened.'));
5599
+		}
5278 5600
 
5279 5601
 		// Only posts can be sticky
5280 5602
 		if ( $post_type == 'post' && isset( $content_struct['sticky'] ) ) {
@@ -5287,8 +5609,9 @@  discard block
 block discarded – undo
5287 5609
 			}
5288 5610
 		}
5289 5611
 
5290
-		if ( isset($content_struct['custom_fields']) )
5291
-			$this->set_custom_fields($post_ID, $content_struct['custom_fields']);
5612
+		if ( isset($content_struct['custom_fields']) ) {
5613
+					$this->set_custom_fields($post_ID, $content_struct['custom_fields']);
5614
+		}
5292 5615
 
5293 5616
 		if ( isset ( $content_struct['wp_post_thumbnail'] ) ) {
5294 5617
 
@@ -5296,8 +5619,9 @@  discard block
 block discarded – undo
5296 5619
 			if ( empty( $content_struct['wp_post_thumbnail'] ) ) {
5297 5620
 				delete_post_thumbnail( $post_ID );
5298 5621
 			} else {
5299
-				if ( set_post_thumbnail( $post_ID, $content_struct['wp_post_thumbnail'] ) === false )
5300
-					return new IXR_Error( 404, __( 'Invalid attachment ID.' ) );
5622
+				if ( set_post_thumbnail( $post_ID, $content_struct['wp_post_thumbnail'] ) === false ) {
5623
+									return new IXR_Error( 404, __( 'Invalid attachment ID.' ) );
5624
+				}
5301 5625
 			}
5302 5626
 			unset( $content_struct['wp_post_thumbnail'] );
5303 5627
 		}
@@ -5309,8 +5633,9 @@  discard block
 block discarded – undo
5309 5633
 		$this->attach_uploads( $ID, $post_content );
5310 5634
 
5311 5635
 		// Handle post formats if assigned, validation is handled earlier in this function.
5312
-		if ( isset( $content_struct['wp_post_format'] ) )
5313
-			set_post_format( $post_ID, $content_struct['wp_post_format'] );
5636
+		if ( isset( $content_struct['wp_post_format'] ) ) {
5637
+					set_post_format( $post_ID, $content_struct['wp_post_format'] );
5638
+		}
5314 5639
 
5315 5640
 		/**
5316 5641
 		 * Fires after a post has been successfully updated via the XML-RPC MovableType API.
@@ -5347,15 +5672,18 @@  discard block
 block discarded – undo
5347 5672
 		$username = $args[1];
5348 5673
 		$password = $args[2];
5349 5674
 
5350
-		if ( !$user = $this->login($username, $password) )
5351
-			return $this->error;
5675
+		if ( !$user = $this->login($username, $password) ) {
5676
+					return $this->error;
5677
+		}
5352 5678
 
5353 5679
 		$postdata = get_post($post_ID, ARRAY_A);
5354
-		if ( ! $postdata )
5355
-			return new IXR_Error( 404, __( 'Invalid post ID.' ) );
5680
+		if ( ! $postdata ) {
5681
+					return new IXR_Error( 404, __( 'Invalid post ID.' ) );
5682
+		}
5356 5683
 
5357
-		if ( !current_user_can( 'edit_post', $post_ID ) )
5358
-			return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) );
5684
+		if ( !current_user_can( 'edit_post', $post_ID ) ) {
5685
+					return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) );
5686
+		}
5359 5687
 
5360 5688
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
5361 5689
 		do_action( 'xmlrpc_call', 'metaWeblog.getPost' );
@@ -5368,14 +5696,16 @@  discard block
 block discarded – undo
5368 5696
 
5369 5697
 			$categories = array();
5370 5698
 			$catids = wp_get_post_categories($post_ID);
5371
-			foreach($catids as $catid)
5372
-				$categories[] = get_cat_name($catid);
5699
+			foreach($catids as $catid) {
5700
+							$categories[] = get_cat_name($catid);
5701
+			}
5373 5702
 
5374 5703
 			$tagnames = array();
5375 5704
 			$tags = wp_get_post_tags( $post_ID );
5376 5705
 			if ( !empty( $tags ) ) {
5377
-				foreach ( $tags as $tag )
5378
-					$tagnames[] = $tag->name;
5706
+				foreach ( $tags as $tag ) {
5707
+									$tagnames[] = $tag->name;
5708
+				}
5379 5709
 				$tagnames = implode( ', ', $tagnames );
5380 5710
 			} else {
5381 5711
 				$tagnames = '';
@@ -5391,17 +5721,20 @@  discard block
 block discarded – undo
5391 5721
 			$allow_pings = ('open' == $postdata['ping_status']) ? 1 : 0;
5392 5722
 
5393 5723
 			// Consider future posts as published
5394
-			if ( $postdata['post_status'] === 'future' )
5395
-				$postdata['post_status'] = 'publish';
5724
+			if ( $postdata['post_status'] === 'future' ) {
5725
+							$postdata['post_status'] = 'publish';
5726
+			}
5396 5727
 
5397 5728
 			// Get post format
5398 5729
 			$post_format = get_post_format( $post_ID );
5399
-			if ( empty( $post_format ) )
5400
-				$post_format = 'standard';
5730
+			if ( empty( $post_format ) ) {
5731
+							$post_format = 'standard';
5732
+			}
5401 5733
 
5402 5734
 			$sticky = false;
5403
-			if ( is_sticky( $post_ID ) )
5404
-				$sticky = true;
5735
+			if ( is_sticky( $post_ID ) ) {
5736
+							$sticky = true;
5737
+			}
5405 5738
 
5406 5739
 			$enclosure = array();
5407 5740
 			foreach ( (array) get_post_custom($post_ID) as $key => $val) {
@@ -5446,7 +5779,9 @@  discard block
 block discarded – undo
5446 5779
 				'date_modified_gmt' => $post_modified_gmt
5447 5780
 			);
5448 5781
 
5449
-			if ( !empty($enclosure) ) $resp['enclosure'] = $enclosure;
5782
+			if ( !empty($enclosure) ) {
5783
+				$resp['enclosure'] = $enclosure;
5784
+			}
5450 5785
 
5451 5786
 			$resp['wp_post_thumbnail'] = get_post_thumbnail_id( $postdata['ID'] );
5452 5787
 
@@ -5476,29 +5811,34 @@  discard block
 block discarded – undo
5476 5811
 
5477 5812
 		$username = $args[1];
5478 5813
 		$password = $args[2];
5479
-		if ( isset( $args[3] ) )
5480
-			$query = array( 'numberposts' => absint( $args[3] ) );
5481
-		else
5482
-			$query = array();
5814
+		if ( isset( $args[3] ) ) {
5815
+					$query = array( 'numberposts' => absint( $args[3] ) );
5816
+		} else {
5817
+					$query = array();
5818
+		}
5483 5819
 
5484
-		if ( !$user = $this->login($username, $password) )
5485
-			return $this->error;
5820
+		if ( !$user = $this->login($username, $password) ) {
5821
+					return $this->error;
5822
+		}
5486 5823
 
5487
-		if ( ! current_user_can( 'edit_posts' ) )
5488
-			return new IXR_Error( 401, __( 'Sorry, you cannot edit posts on this site.' ) );
5824
+		if ( ! current_user_can( 'edit_posts' ) ) {
5825
+					return new IXR_Error( 401, __( 'Sorry, you cannot edit posts on this site.' ) );
5826
+		}
5489 5827
 
5490 5828
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
5491 5829
 		do_action( 'xmlrpc_call', 'metaWeblog.getRecentPosts' );
5492 5830
 
5493 5831
 		$posts_list = wp_get_recent_posts( $query );
5494 5832
 
5495
-		if ( !$posts_list )
5496
-			return array();
5833
+		if ( !$posts_list ) {
5834
+					return array();
5835
+		}
5497 5836
 
5498 5837
 		$recent_posts = array();
5499 5838
 		foreach ($posts_list as $entry) {
5500
-			if ( !current_user_can( 'edit_post', $entry['ID'] ) )
5501
-				continue;
5839
+			if ( !current_user_can( 'edit_post', $entry['ID'] ) ) {
5840
+							continue;
5841
+			}
5502 5842
 
5503 5843
 			$post_date = $this->_convert_date( $entry['post_date'] );
5504 5844
 			$post_date_gmt = $this->_convert_date_gmt( $entry['post_date_gmt'], $entry['post_date'] );
@@ -5507,8 +5847,9 @@  discard block
 block discarded – undo
5507 5847
 
5508 5848
 			$categories = array();
5509 5849
 			$catids = wp_get_post_categories($entry['ID']);
5510
-			foreach( $catids as $catid )
5511
-				$categories[] = get_cat_name($catid);
5850
+			foreach( $catids as $catid ) {
5851
+							$categories[] = get_cat_name($catid);
5852
+			}
5512 5853
 
5513 5854
 			$tagnames = array();
5514 5855
 			$tags = wp_get_post_tags( $entry['ID'] );
@@ -5531,13 +5872,15 @@  discard block
 block discarded – undo
5531 5872
 			$allow_pings = ('open' == $entry['ping_status']) ? 1 : 0;
5532 5873
 
5533 5874
 			// Consider future posts as published
5534
-			if ( $entry['post_status'] === 'future' )
5535
-				$entry['post_status'] = 'publish';
5875
+			if ( $entry['post_status'] === 'future' ) {
5876
+							$entry['post_status'] = 'publish';
5877
+			}
5536 5878
 
5537 5879
 			// Get post format
5538 5880
 			$post_format = get_post_format( $entry['ID'] );
5539
-			if ( empty( $post_format ) )
5540
-				$post_format = 'standard';
5881
+			if ( empty( $post_format ) ) {
5882
+							$post_format = 'standard';
5883
+			}
5541 5884
 
5542 5885
 			$recent_posts[] = array(
5543 5886
 				'dateCreated' => $post_date,
@@ -5594,11 +5937,13 @@  discard block
 block discarded – undo
5594 5937
 		$username = $args[1];
5595 5938
 		$password = $args[2];
5596 5939
 
5597
-		if ( !$user = $this->login($username, $password) )
5598
-			return $this->error;
5940
+		if ( !$user = $this->login($username, $password) ) {
5941
+					return $this->error;
5942
+		}
5599 5943
 
5600
-		if ( !current_user_can( 'edit_posts' ) )
5601
-			return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this site in order to view categories.' ) );
5944
+		if ( !current_user_can( 'edit_posts' ) ) {
5945
+					return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this site in order to view categories.' ) );
5946
+		}
5602 5947
 
5603 5948
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
5604 5949
 		do_action( 'xmlrpc_call', 'metaWeblog.getCategories' );
@@ -5655,8 +6000,9 @@  discard block
 block discarded – undo
5655 6000
 		$type = $data['type'];
5656 6001
 		$bits = $data['bits'];
5657 6002
 
5658
-		if ( !$user = $this->login($username, $password) )
5659
-			return $this->error;
6003
+		if ( !$user = $this->login($username, $password) ) {
6004
+					return $this->error;
6005
+		}
5660 6006
 
5661 6007
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
5662 6008
 		do_action( 'xmlrpc_call', 'metaWeblog.newMediaObject' );
@@ -5708,8 +6054,9 @@  discard block
 block discarded – undo
5708 6054
 		if ( ! empty( $data['post_id'] ) ) {
5709 6055
 			$post_id = (int) $data['post_id'];
5710 6056
 
5711
-			if ( ! current_user_can( 'edit_post', $post_id ) )
5712
-				return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) );
6057
+			if ( ! current_user_can( 'edit_post', $post_id ) ) {
6058
+							return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) );
6059
+			}
5713 6060
 		}
5714 6061
 		$attachment = array(
5715 6062
 			'post_title' => $name,
@@ -5769,13 +6116,15 @@  discard block
 block discarded – undo
5769 6116
 
5770 6117
 		$username = $args[1];
5771 6118
 		$password = $args[2];
5772
-		if ( isset( $args[3] ) )
5773
-			$query = array( 'numberposts' => absint( $args[3] ) );
5774
-		else
5775
-			$query = array();
6119
+		if ( isset( $args[3] ) ) {
6120
+					$query = array( 'numberposts' => absint( $args[3] ) );
6121
+		} else {
6122
+					$query = array();
6123
+		}
5776 6124
 
5777
-		if ( !$user = $this->login($username, $password) )
5778
-			return $this->error;
6125
+		if ( !$user = $this->login($username, $password) ) {
6126
+					return $this->error;
6127
+		}
5779 6128
 
5780 6129
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
5781 6130
 		do_action( 'xmlrpc_call', 'mt.getRecentPostTitles' );
@@ -5790,8 +6139,9 @@  discard block
 block discarded – undo
5790 6139
 		$recent_posts = array();
5791 6140
 
5792 6141
 		foreach ($posts_list as $entry) {
5793
-			if ( !current_user_can( 'edit_post', $entry['ID'] ) )
5794
-				continue;
6142
+			if ( !current_user_can( 'edit_post', $entry['ID'] ) ) {
6143
+							continue;
6144
+			}
5795 6145
 
5796 6146
 			$post_date = $this->_convert_date( $entry['post_date'] );
5797 6147
 			$post_date_gmt = $this->_convert_date_gmt( $entry['post_date_gmt'], $entry['post_date'] );
@@ -5829,11 +6179,13 @@  discard block
 block discarded – undo
5829 6179
 		$username = $args[1];
5830 6180
 		$password = $args[2];
5831 6181
 
5832
-		if ( !$user = $this->login($username, $password) )
5833
-			return $this->error;
6182
+		if ( !$user = $this->login($username, $password) ) {
6183
+					return $this->error;
6184
+		}
5834 6185
 
5835
-		if ( !current_user_can( 'edit_posts' ) )
5836
-			return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this site in order to view categories.' ) );
6186
+		if ( !current_user_can( 'edit_posts' ) ) {
6187
+					return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this site in order to view categories.' ) );
6188
+		}
5837 6189
 
5838 6190
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
5839 6191
 		do_action( 'xmlrpc_call', 'mt.getCategoryList' );
@@ -5874,14 +6226,17 @@  discard block
 block discarded – undo
5874 6226
 		$username = $args[1];
5875 6227
 		$password = $args[2];
5876 6228
 
5877
-		if ( !$user = $this->login($username, $password) )
5878
-			return $this->error;
6229
+		if ( !$user = $this->login($username, $password) ) {
6230
+					return $this->error;
6231
+		}
5879 6232
 
5880
-		if ( ! get_post( $post_ID ) )
5881
-			return new IXR_Error( 404, __( 'Invalid post ID.' ) );
6233
+		if ( ! get_post( $post_ID ) ) {
6234
+					return new IXR_Error( 404, __( 'Invalid post ID.' ) );
6235
+		}
5882 6236
 
5883
-		if ( !current_user_can( 'edit_post', $post_ID ) )
5884
-			return new IXR_Error( 401, __( 'Sorry, you can not edit this post.' ) );
6237
+		if ( !current_user_can( 'edit_post', $post_ID ) ) {
6238
+					return new IXR_Error( 401, __( 'Sorry, you can not edit this post.' ) );
6239
+		}
5885 6240
 
5886 6241
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
5887 6242
 		do_action( 'xmlrpc_call', 'mt.getPostCategories' );
@@ -5925,17 +6280,20 @@  discard block
 block discarded – undo
5925 6280
 		$password   = $args[2];
5926 6281
 		$categories = $args[3];
5927 6282
 
5928
-		if ( !$user = $this->login($username, $password) )
5929
-			return $this->error;
6283
+		if ( !$user = $this->login($username, $password) ) {
6284
+					return $this->error;
6285
+		}
5930 6286
 
5931 6287
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
5932 6288
 		do_action( 'xmlrpc_call', 'mt.setPostCategories' );
5933 6289
 
5934
-		if ( ! get_post( $post_ID ) )
5935
-			return new IXR_Error( 404, __( 'Invalid post ID.' ) );
6290
+		if ( ! get_post( $post_ID ) ) {
6291
+					return new IXR_Error( 404, __( 'Invalid post ID.' ) );
6292
+		}
5936 6293
 
5937
-		if ( !current_user_can('edit_post', $post_ID) )
5938
-			return new IXR_Error(401, __('Sorry, you cannot edit this post.'));
6294
+		if ( !current_user_can('edit_post', $post_ID) ) {
6295
+					return new IXR_Error(401, __('Sorry, you cannot edit this post.'));
6296
+		}
5939 6297
 
5940 6298
 		$catids = array();
5941 6299
 		foreach ( $categories as $cat ) {
@@ -5998,13 +6356,15 @@  discard block
 block discarded – undo
5998 6356
 
5999 6357
 		$actual_post = get_post($post_ID, ARRAY_A);
6000 6358
 
6001
-		if ( !$actual_post )
6002
-			return new IXR_Error(404, __('Sorry, no such post.'));
6359
+		if ( !$actual_post ) {
6360
+					return new IXR_Error(404, __('Sorry, no such post.'));
6361
+		}
6003 6362
 
6004 6363
 		$comments = $wpdb->get_results( $wpdb->prepare("SELECT comment_author_url, comment_content, comment_author_IP, comment_type FROM $wpdb->comments WHERE comment_post_ID = %d", $post_ID) );
6005 6364
 
6006
-		if ( !$comments )
6007
-			return array();
6365
+		if ( !$comments ) {
6366
+					return array();
6367
+		}
6008 6368
 
6009 6369
 		$trackback_pings = array();
6010 6370
 		foreach ( $comments as $comment ) {
@@ -6043,18 +6403,21 @@  discard block
 block discarded – undo
6043 6403
 		$username = $args[1];
6044 6404
 		$password = $args[2];
6045 6405
 
6046
-		if ( !$user = $this->login($username, $password) )
6047
-			return $this->error;
6406
+		if ( !$user = $this->login($username, $password) ) {
6407
+					return $this->error;
6408
+		}
6048 6409
 
6049 6410
 		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
6050 6411
 		do_action( 'xmlrpc_call', 'mt.publishPost' );
6051 6412
 
6052 6413
 		$postdata = get_post($post_ID, ARRAY_A);
6053
-		if ( ! $postdata )
6054
-			return new IXR_Error( 404, __( 'Invalid post ID.' ) );
6414
+		if ( ! $postdata ) {
6415
+					return new IXR_Error( 404, __( 'Invalid post ID.' ) );
6416
+		}
6055 6417
 
6056
-		if ( !current_user_can('publish_posts') || !current_user_can('edit_post', $post_ID) )
6057
-			return new IXR_Error(401, __('Sorry, you cannot publish this post.'));
6418
+		if ( !current_user_can('publish_posts') || !current_user_can('edit_post', $post_ID) ) {
6419
+					return new IXR_Error(401, __('Sorry, you cannot publish this post.'));
6420
+		}
6058 6421
 
6059 6422
 		$postdata['post_status'] = 'publish';
6060 6423
 
@@ -6108,13 +6471,15 @@  discard block
 block discarded – undo
6108 6471
 		 */
6109 6472
 		$pagelinkedfrom = apply_filters( 'pingback_ping_source_uri', $pagelinkedfrom, $pagelinkedto );
6110 6473
 
6111
-		if ( ! $pagelinkedfrom )
6112
-			return $this->pingback_error( 0, __( 'A valid URL was not provided.' ) );
6474
+		if ( ! $pagelinkedfrom ) {
6475
+					return $this->pingback_error( 0, __( 'A valid URL was not provided.' ) );
6476
+		}
6113 6477
 
6114 6478
 		// Check if the page linked to is in our site
6115 6479
 		$pos1 = strpos($pagelinkedto, str_replace(array('http://www.','http://','https://www.','https://'), '', get_option('home')));
6116
-		if ( !$pos1 )
6117
-			return $this->pingback_error( 0, __( 'Is there no link to us?' ) );
6480
+		if ( !$pos1 ) {
6481
+					return $this->pingback_error( 0, __( 'Is there no link to us?' ) );
6482
+		}
6118 6483
 
6119 6484
 		// let's find which post is linked to
6120 6485
 		// FIXME: does url_to_postid() cover all these cases already?
@@ -6155,19 +6520,24 @@  discard block
 block discarded – undo
6155 6520
 
6156 6521
 		$post = get_post($post_ID);
6157 6522
 
6158
-		if ( !$post ) // Post_ID not found
6523
+		if ( !$post ) {
6524
+			// Post_ID not found
6159 6525
 	  		return $this->pingback_error( 33, __( 'The specified target URL cannot be used as a target. It either doesn&#8217;t exist, or it is not a pingback-enabled resource.' ) );
6526
+		}
6160 6527
 
6161
-		if ( $post_ID == url_to_postid($pagelinkedfrom) )
6162
-			return $this->pingback_error( 0, __( 'The source URL and the target URL cannot both point to the same resource.' ) );
6528
+		if ( $post_ID == url_to_postid($pagelinkedfrom) ) {
6529
+					return $this->pingback_error( 0, __( 'The source URL and the target URL cannot both point to the same resource.' ) );
6530
+		}
6163 6531
 
6164 6532
 		// Check if pings are on
6165
-		if ( !pings_open($post) )
6166
-	  		return $this->pingback_error( 33, __( 'The specified target URL cannot be used as a target. It either doesn&#8217;t exist, or it is not a pingback-enabled resource.' ) );
6533
+		if ( !pings_open($post) ) {
6534
+			  		return $this->pingback_error( 33, __( 'The specified target URL cannot be used as a target. It either doesn&#8217;t exist, or it is not a pingback-enabled resource.' ) );
6535
+		}
6167 6536
 
6168 6537
 		// Let's check that the remote site didn't already pingback this entry
6169
-		if ( $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_author_url = %s", $post_ID, $pagelinkedfrom) ) )
6170
-			return $this->pingback_error( 48, __( 'The pingback has already been registered.' ) );
6538
+		if ( $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_author_url = %s", $post_ID, $pagelinkedfrom) ) ) {
6539
+					return $this->pingback_error( 48, __( 'The pingback has already been registered.' ) );
6540
+		}
6171 6541
 
6172 6542
 		// very stupid, but gives time to the 'from' server to publish !
6173 6543
 		sleep(1);
@@ -6190,8 +6560,9 @@  discard block
 block discarded – undo
6190 6560
 		$request = wp_safe_remote_get( $pagelinkedfrom, $http_api_args );
6191 6561
 		$linea = wp_remote_retrieve_body( $request );
6192 6562
 
6193
-		if ( !$linea )
6194
-			return $this->pingback_error( 16, __( 'The source URL does not exist.' ) );
6563
+		if ( !$linea ) {
6564
+					return $this->pingback_error( 16, __( 'The source URL does not exist.' ) );
6565
+		}
6195 6566
 
6196 6567
 		/**
6197 6568
 		 * Filter the pingback remote source.
@@ -6210,8 +6581,9 @@  discard block
 block discarded – undo
6210 6581
 
6211 6582
 		preg_match('|<title>([^<]*?)</title>|is', $linea, $matchtitle);
6212 6583
 		$title = $matchtitle[1];
6213
-		if ( empty( $title ) )
6214
-			return $this->pingback_error( 32, __('We cannot find a title on that page.' ) );
6584
+		if ( empty( $title ) ) {
6585
+					return $this->pingback_error( 32, __('We cannot find a title on that page.' ) );
6586
+		}
6215 6587
 
6216 6588
 		$linea = strip_tags( $linea, '<a>' ); // just keep the tag we need
6217 6589
 
@@ -6224,16 +6596,18 @@  discard block
 block discarded – undo
6224 6596
 				preg_match("|<a[^>]+?".$preg_target."[^>]*>([^>]+?)</a>|", $para, $context);
6225 6597
 
6226 6598
 				// If the URL isn't in a link context, keep looking
6227
-				if ( empty($context) )
6228
-					continue;
6599
+				if ( empty($context) ) {
6600
+									continue;
6601
+				}
6229 6602
 
6230 6603
 				// We're going to use this fake tag to mark the context in a bit
6231 6604
 				// the marker is needed in case the link text appears more than once in the paragraph
6232 6605
 				$excerpt = preg_replace('|\</?wpcontext\>|', '', $para);
6233 6606
 
6234 6607
 				// prevent really long link text
6235
-				if ( strlen($context[1]) > 100 )
6236
-					$context[1] = substr($context[1], 0, 100) . '&#8230;';
6608
+				if ( strlen($context[1]) > 100 ) {
6609
+									$context[1] = substr($context[1], 0, 100) . '&#8230;';
6610
+				}
6237 6611
 
6238 6612
 				$marker = '<wpcontext>'.$context[1].'</wpcontext>';    // set up our marker
6239 6613
 				$excerpt= str_replace($context[0], $marker, $excerpt); // swap out the link for our marker
@@ -6246,8 +6620,10 @@  discard block
 block discarded – undo
6246 6620
 			}
6247 6621
 		}
6248 6622
 
6249
-		if ( empty($context) ) // Link to target not found
6623
+		if ( empty($context) ) {
6624
+			// Link to target not found
6250 6625
 			return $this->pingback_error( 17, __( 'The source URL does not contain a link to the target URL, and so cannot be used as a source.' ) );
6626
+		}
6251 6627
 
6252 6628
 		$pagelinkedfrom = str_replace('&', '&amp;', $pagelinkedfrom);
6253 6629
 
@@ -6314,13 +6690,15 @@  discard block
 block discarded – undo
6314 6690
 
6315 6691
 		$comments = $wpdb->get_results( $wpdb->prepare("SELECT comment_author_url, comment_content, comment_author_IP, comment_type FROM $wpdb->comments WHERE comment_post_ID = %d", $post_ID) );
6316 6692
 
6317
-		if ( !$comments )
6318
-			return array();
6693
+		if ( !$comments ) {
6694
+					return array();
6695
+		}
6319 6696
 
6320 6697
 		$pingbacks = array();
6321 6698
 		foreach ( $comments as $comment ) {
6322
-			if ( 'pingback' == $comment->comment_type )
6323
-				$pingbacks[] = $comment->comment_author_url;
6699
+			if ( 'pingback' == $comment->comment_type ) {
6700
+							$pingbacks[] = $comment->comment_author_url;
6701
+			}
6324 6702
 		}
6325 6703
 
6326 6704
 		return $pingbacks;
Please login to merge, or discard this patch.
src/wp-includes/option.php 3 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Option API
4
- *
5
- * @package WordPress
6
- * @subpackage Option
7
- */
3
+	 * Option API
4
+	 *
5
+	 * @package WordPress
6
+	 * @subpackage Option
7
+	 */
8 8
 
9 9
 /**
10 10
  * Retrieve option value based on name of option.
@@ -596,19 +596,19 @@  discard block
 block discarded – undo
596 596
 function get_transient( $transient ) {
597 597
 
598 598
  	/**
599
-	 * Filter the value of an existing transient.
600
-	 *
601
-	 * The dynamic portion of the hook name, `$transient`, refers to the transient name.
602
-	 *
603
-	 * Passing a truthy value to the filter will effectively short-circuit retrieval
604
-	 * of the transient, returning the passed value instead.
605
-	 *
606
-	 * @since 2.8.0
607
-	 *
608
-	 * @param mixed $pre_transient The default value to return if the transient does not exist.
609
-	 *                             Any value other than false will short-circuit the retrieval
610
-	 *                             of the transient, and return the returned value.
611
-	 */
599
+ 	 * Filter the value of an existing transient.
600
+ 	 *
601
+ 	 * The dynamic portion of the hook name, `$transient`, refers to the transient name.
602
+ 	 *
603
+ 	 * Passing a truthy value to the filter will effectively short-circuit retrieval
604
+ 	 * of the transient, returning the passed value instead.
605
+ 	 *
606
+ 	 * @since 2.8.0
607
+ 	 *
608
+ 	 * @param mixed $pre_transient The default value to return if the transient does not exist.
609
+ 	 *                             Any value other than false will short-circuit the retrieval
610
+ 	 *                             of the transient, and return the returned value.
611
+ 	 */
612 612
 	$pre = apply_filters( 'pre_transient_' . $transient, false );
613 613
 	if ( false !== $pre )
614 614
 		return $pre;
Please login to merge, or discard this patch.
Spacing   +334 added lines, -334 removed lines patch added patch discarded remove patch
@@ -24,11 +24,11 @@  discard block
 block discarded – undo
24 24
  * @param mixed  $default Optional. Default value to return if the option does not exist.
25 25
  * @return mixed Value set for the option.
26 26
  */
27
-function get_option( $option, $default = false ) {
27
+function get_option($option, $default = false) {
28 28
 	global $wpdb;
29 29
 
30
-	$option = trim( $option );
31
-	if ( empty( $option ) )
30
+	$option = trim($option);
31
+	if (empty($option))
32 32
 		return false;
33 33
 
34 34
 	/**
@@ -44,17 +44,17 @@  discard block
 block discarded – undo
44 44
 	 * @param bool|mixed $pre_option Value to return instead of the option value.
45 45
 	 *                               Default false to skip it.
46 46
 	 */
47
-	$pre = apply_filters( 'pre_option_' . $option, false );
48
-	if ( false !== $pre )
47
+	$pre = apply_filters('pre_option_'.$option, false);
48
+	if (false !== $pre)
49 49
 		return $pre;
50 50
 
51
-	if ( defined( 'WP_SETUP_CONFIG' ) )
51
+	if (defined('WP_SETUP_CONFIG'))
52 52
 		return false;
53 53
 
54
-	if ( ! defined( 'WP_INSTALLING' ) ) {
54
+	if ( ! defined('WP_INSTALLING')) {
55 55
 		// prevent non-existent options from triggering multiple queries
56
-		$notoptions = wp_cache_get( 'notoptions', 'options' );
57
-		if ( isset( $notoptions[ $option ] ) ) {
56
+		$notoptions = wp_cache_get('notoptions', 'options');
57
+		if (isset($notoptions[$option])) {
58 58
 			/**
59 59
 			 * Filter the default value for an option.
60 60
 			 *
@@ -65,53 +65,53 @@  discard block
 block discarded – undo
65 65
 			 * @param mixed $default The default value to return if the option does not exist
66 66
 			 *                       in the database.
67 67
 			 */
68
-			return apply_filters( 'default_option_' . $option, $default );
68
+			return apply_filters('default_option_'.$option, $default);
69 69
 		}
70 70
 
71 71
 		$alloptions = wp_load_alloptions();
72 72
 
73
-		if ( isset( $alloptions[$option] ) ) {
73
+		if (isset($alloptions[$option])) {
74 74
 			$value = $alloptions[$option];
75 75
 		} else {
76
-			$value = wp_cache_get( $option, 'options' );
76
+			$value = wp_cache_get($option, 'options');
77 77
 
78
-			if ( false === $value ) {
79
-				$row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", $option ) );
78
+			if (false === $value) {
79
+				$row = $wpdb->get_row($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", $option));
80 80
 
81 81
 				// Has to be get_row instead of get_var because of funkiness with 0, false, null values
82
-				if ( is_object( $row ) ) {
82
+				if (is_object($row)) {
83 83
 					$value = $row->option_value;
84
-					wp_cache_add( $option, $value, 'options' );
84
+					wp_cache_add($option, $value, 'options');
85 85
 				} else { // option does not exist, so we must cache its non-existence
86
-					if ( ! is_array( $notoptions ) ) {
86
+					if ( ! is_array($notoptions)) {
87 87
 						 $notoptions = array();
88 88
 					}
89 89
 					$notoptions[$option] = true;
90
-					wp_cache_set( 'notoptions', $notoptions, 'options' );
90
+					wp_cache_set('notoptions', $notoptions, 'options');
91 91
 
92 92
 					/** This filter is documented in wp-includes/option.php */
93
-					return apply_filters( 'default_option_' . $option, $default );
93
+					return apply_filters('default_option_'.$option, $default);
94 94
 				}
95 95
 			}
96 96
 		}
97 97
 	} else {
98 98
 		$suppress = $wpdb->suppress_errors();
99
-		$row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", $option ) );
100
-		$wpdb->suppress_errors( $suppress );
101
-		if ( is_object( $row ) ) {
99
+		$row = $wpdb->get_row($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", $option));
100
+		$wpdb->suppress_errors($suppress);
101
+		if (is_object($row)) {
102 102
 			$value = $row->option_value;
103 103
 		} else {
104 104
 			/** This filter is documented in wp-includes/option.php */
105
-			return apply_filters( 'default_option_' . $option, $default );
105
+			return apply_filters('default_option_'.$option, $default);
106 106
 		}
107 107
 	}
108 108
 
109 109
 	// If home is not set use siteurl.
110
-	if ( 'home' == $option && '' == $value )
111
-		return get_option( 'siteurl' );
110
+	if ('home' == $option && '' == $value)
111
+		return get_option('siteurl');
112 112
 
113
-	if ( in_array( $option, array('siteurl', 'home', 'category_base', 'tag_base') ) )
114
-		$value = untrailingslashit( $value );
113
+	if (in_array($option, array('siteurl', 'home', 'category_base', 'tag_base')))
114
+		$value = untrailingslashit($value);
115 115
 
116 116
 	/**
117 117
 	 * Filter the value of an existing option.
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 	 * @param mixed $value Value of the option. If stored serialized, it will be
125 125
 	 *                     unserialized prior to being returned.
126 126
 	 */
127
-	return apply_filters( 'option_' . $option, maybe_unserialize( $value ) );
127
+	return apply_filters('option_'.$option, maybe_unserialize($value));
128 128
 }
129 129
 
130 130
 /**
@@ -137,9 +137,9 @@  discard block
 block discarded – undo
137 137
  *
138 138
  * @param string $option Option name.
139 139
  */
140
-function wp_protect_special_option( $option ) {
141
-	if ( 'alloptions' === $option || 'notoptions' === $option )
142
-		wp_die( sprintf( __( '%s is a protected WP option and may not be modified' ), esc_html( $option ) ) );
140
+function wp_protect_special_option($option) {
141
+	if ('alloptions' === $option || 'notoptions' === $option)
142
+		wp_die(sprintf(__('%s is a protected WP option and may not be modified'), esc_html($option)));
143 143
 }
144 144
 
145 145
 /**
@@ -149,8 +149,8 @@  discard block
 block discarded – undo
149 149
  *
150 150
  * @param string $option Option name.
151 151
  */
152
-function form_option( $option ) {
153
-	echo esc_attr( get_option( $option ) );
152
+function form_option($option) {
153
+	echo esc_attr(get_option($option));
154 154
 }
155 155
 
156 156
 /**
@@ -165,22 +165,22 @@  discard block
 block discarded – undo
165 165
 function wp_load_alloptions() {
166 166
 	global $wpdb;
167 167
 
168
-	if ( !defined( 'WP_INSTALLING' ) || !is_multisite() )
169
-		$alloptions = wp_cache_get( 'alloptions', 'options' );
168
+	if ( ! defined('WP_INSTALLING') || ! is_multisite())
169
+		$alloptions = wp_cache_get('alloptions', 'options');
170 170
 	else
171 171
 		$alloptions = false;
172 172
 
173
-	if ( !$alloptions ) {
173
+	if ( ! $alloptions) {
174 174
 		$suppress = $wpdb->suppress_errors();
175
-		if ( !$alloptions_db = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options WHERE autoload = 'yes'" ) )
176
-			$alloptions_db = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options" );
175
+		if ( ! $alloptions_db = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options WHERE autoload = 'yes'"))
176
+			$alloptions_db = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options");
177 177
 		$wpdb->suppress_errors($suppress);
178 178
 		$alloptions = array();
179
-		foreach ( (array) $alloptions_db as $o ) {
179
+		foreach ((array) $alloptions_db as $o) {
180 180
 			$alloptions[$o->option_name] = $o->option_value;
181 181
 		}
182
-		if ( !defined( 'WP_INSTALLING' ) || !is_multisite() )
183
-			wp_cache_add( 'alloptions', $alloptions, 'options' );
182
+		if ( ! defined('WP_INSTALLING') || ! is_multisite())
183
+			wp_cache_add('alloptions', $alloptions, 'options');
184 184
 	}
185 185
 
186 186
 	return $alloptions;
@@ -195,26 +195,26 @@  discard block
 block discarded – undo
195 195
  *
196 196
  * @param int $site_id Optional site ID for which to query the options. Defaults to the current site.
197 197
  */
198
-function wp_load_core_site_options( $site_id = null ) {
198
+function wp_load_core_site_options($site_id = null) {
199 199
 	global $wpdb;
200 200
 
201
-	if ( !is_multisite() || wp_using_ext_object_cache() || defined( 'WP_INSTALLING' ) )
201
+	if ( ! is_multisite() || wp_using_ext_object_cache() || defined('WP_INSTALLING'))
202 202
 		return;
203 203
 
204
-	if ( empty($site_id) )
204
+	if (empty($site_id))
205 205
 		$site_id = $wpdb->siteid;
206 206
 
207
-	$core_options = array('site_name', 'siteurl', 'active_sitewide_plugins', '_site_transient_timeout_theme_roots', '_site_transient_theme_roots', 'site_admins', 'can_compress_scripts', 'global_terms_enabled', 'ms_files_rewriting' );
207
+	$core_options = array('site_name', 'siteurl', 'active_sitewide_plugins', '_site_transient_timeout_theme_roots', '_site_transient_theme_roots', 'site_admins', 'can_compress_scripts', 'global_terms_enabled', 'ms_files_rewriting');
208 208
 
209
-	$core_options_in = "'" . implode("', '", $core_options) . "'";
210
-	$options = $wpdb->get_results( $wpdb->prepare("SELECT meta_key, meta_value FROM $wpdb->sitemeta WHERE meta_key IN ($core_options_in) AND site_id = %d", $site_id) );
209
+	$core_options_in = "'".implode("', '", $core_options)."'";
210
+	$options = $wpdb->get_results($wpdb->prepare("SELECT meta_key, meta_value FROM $wpdb->sitemeta WHERE meta_key IN ($core_options_in) AND site_id = %d", $site_id));
211 211
 
212
-	foreach ( $options as $option ) {
212
+	foreach ($options as $option) {
213 213
 		$key = $option->meta_key;
214 214
 		$cache_key = "{$site_id}:$key";
215
-		$option->meta_value = maybe_unserialize( $option->meta_value );
215
+		$option->meta_value = maybe_unserialize($option->meta_value);
216 216
 
217
-		wp_cache_set( $cache_key, $option->meta_value, 'site-options' );
217
+		wp_cache_set($cache_key, $option->meta_value, 'site-options');
218 218
 	}
219 219
 }
220 220
 
@@ -241,20 +241,20 @@  discard block
 block discarded – undo
241 241
  *                              the default value is 'yes'. Default null.
242 242
  * @return bool False if value was not updated and true if value was updated.
243 243
  */
244
-function update_option( $option, $value, $autoload = null ) {
244
+function update_option($option, $value, $autoload = null) {
245 245
 	global $wpdb;
246 246
 
247 247
 	$option = trim($option);
248
-	if ( empty($option) )
248
+	if (empty($option))
249 249
 		return false;
250 250
 
251
-	wp_protect_special_option( $option );
251
+	wp_protect_special_option($option);
252 252
 
253
-	if ( is_object( $value ) )
253
+	if (is_object($value))
254 254
 		$value = clone $value;
255 255
 
256
-	$value = sanitize_option( $option, $value );
257
-	$old_value = get_option( $option );
256
+	$value = sanitize_option($option, $value);
257
+	$old_value = get_option($option);
258 258
 
259 259
 	/**
260 260
 	 * Filter a specific option before its value is (maybe) serialized and updated.
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 	 * @param mixed $value     The new, unserialized option value.
267 267
 	 * @param mixed $old_value The old option value.
268 268
 	 */
269
-	$value = apply_filters( 'pre_update_option_' . $option, $value, $old_value );
269
+	$value = apply_filters('pre_update_option_'.$option, $value, $old_value);
270 270
 
271 271
 	/**
272 272
 	 * Filter an option before its value is (maybe) serialized and updated.
@@ -277,23 +277,23 @@  discard block
 block discarded – undo
277 277
 	 * @param string $option    Name of the option.
278 278
 	 * @param mixed  $old_value The old option value.
279 279
 	 */
280
-	$value = apply_filters( 'pre_update_option', $value, $option, $old_value );
280
+	$value = apply_filters('pre_update_option', $value, $option, $old_value);
281 281
 
282 282
 	// If the new and old values are the same, no need to update.
283
-	if ( $value === $old_value )
283
+	if ($value === $old_value)
284 284
 		return false;
285 285
 
286 286
 	/** This filter is documented in wp-includes/option.php */
287
-	if ( apply_filters( 'default_option_' . $option, false ) === $old_value ) {
287
+	if (apply_filters('default_option_'.$option, false) === $old_value) {
288 288
 		// Default setting for new options is 'yes'.
289
-		if ( null === $autoload ) {
289
+		if (null === $autoload) {
290 290
 			$autoload = 'yes';
291 291
 		}
292 292
 
293
-		return add_option( $option, $value, '', $autoload );
293
+		return add_option($option, $value, '', $autoload);
294 294
 	}
295 295
 
296
-	$serialized_value = maybe_serialize( $value );
296
+	$serialized_value = maybe_serialize($value);
297 297
 
298 298
 	/**
299 299
 	 * Fires immediately before an option value is updated.
@@ -304,33 +304,33 @@  discard block
 block discarded – undo
304 304
 	 * @param mixed  $old_value The old option value.
305 305
 	 * @param mixed  $value     The new option value.
306 306
 	 */
307
-	do_action( 'update_option', $option, $old_value, $value );
307
+	do_action('update_option', $option, $old_value, $value);
308 308
 
309 309
 	$update_args = array(
310 310
 		'option_value' => $serialized_value,
311 311
 	);
312 312
 
313
-	if ( null !== $autoload ) {
314
-		$update_args['autoload'] = ( 'no' === $autoload || false === $autoload ) ? 'no' : 'yes';
313
+	if (null !== $autoload) {
314
+		$update_args['autoload'] = ('no' === $autoload || false === $autoload) ? 'no' : 'yes';
315 315
 	}
316 316
 
317
-	$result = $wpdb->update( $wpdb->options, $update_args, array( 'option_name' => $option ) );
318
-	if ( ! $result )
317
+	$result = $wpdb->update($wpdb->options, $update_args, array('option_name' => $option));
318
+	if ( ! $result)
319 319
 		return false;
320 320
 
321
-	$notoptions = wp_cache_get( 'notoptions', 'options' );
322
-	if ( is_array( $notoptions ) && isset( $notoptions[$option] ) ) {
323
-		unset( $notoptions[$option] );
324
-		wp_cache_set( 'notoptions', $notoptions, 'options' );
321
+	$notoptions = wp_cache_get('notoptions', 'options');
322
+	if (is_array($notoptions) && isset($notoptions[$option])) {
323
+		unset($notoptions[$option]);
324
+		wp_cache_set('notoptions', $notoptions, 'options');
325 325
 	}
326 326
 
327
-	if ( ! defined( 'WP_INSTALLING' ) ) {
327
+	if ( ! defined('WP_INSTALLING')) {
328 328
 		$alloptions = wp_load_alloptions();
329
-		if ( isset( $alloptions[$option] ) ) {
330
-			$alloptions[ $option ] = $serialized_value;
331
-			wp_cache_set( 'alloptions', $alloptions, 'options' );
329
+		if (isset($alloptions[$option])) {
330
+			$alloptions[$option] = $serialized_value;
331
+			wp_cache_set('alloptions', $alloptions, 'options');
332 332
 		} else {
333
-			wp_cache_set( $option, $serialized_value, 'options' );
333
+			wp_cache_set($option, $serialized_value, 'options');
334 334
 		}
335 335
 	}
336 336
 
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 	 * @param mixed $old_value The old option value.
345 345
 	 * @param mixed $value     The new option value.
346 346
 	 */
347
-	do_action( "update_option_{$option}", $old_value, $value );
347
+	do_action("update_option_{$option}", $old_value, $value);
348 348
 
349 349
 	/**
350 350
 	 * Fires after the value of an option has been successfully updated.
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 	 * @param mixed  $old_value The old option value.
356 356
 	 * @param mixed  $value     The new option value.
357 357
 	 */
358
-	do_action( 'updated_option', $option, $old_value, $value );
358
+	do_action('updated_option', $option, $old_value, $value);
359 359
 	return true;
360 360
 }
361 361
 
@@ -382,32 +382,32 @@  discard block
 block discarded – undo
382 382
  *                                    Default is enabled. Accepts 'no' to disable for legacy reasons.
383 383
  * @return bool False if option was not added and true if option was added.
384 384
  */
385
-function add_option( $option, $value = '', $deprecated = '', $autoload = 'yes' ) {
385
+function add_option($option, $value = '', $deprecated = '', $autoload = 'yes') {
386 386
 	global $wpdb;
387 387
 
388
-	if ( !empty( $deprecated ) )
389
-		_deprecated_argument( __FUNCTION__, '2.3' );
388
+	if ( ! empty($deprecated))
389
+		_deprecated_argument(__FUNCTION__, '2.3');
390 390
 
391 391
 	$option = trim($option);
392
-	if ( empty($option) )
392
+	if (empty($option))
393 393
 		return false;
394 394
 
395
-	wp_protect_special_option( $option );
395
+	wp_protect_special_option($option);
396 396
 
397
-	if ( is_object($value) )
397
+	if (is_object($value))
398 398
 		$value = clone $value;
399 399
 
400
-	$value = sanitize_option( $option, $value );
400
+	$value = sanitize_option($option, $value);
401 401
 
402 402
 	// Make sure the option doesn't already exist. We can check the 'notoptions' cache before we ask for a db query
403
-	$notoptions = wp_cache_get( 'notoptions', 'options' );
404
-	if ( !is_array( $notoptions ) || !isset( $notoptions[$option] ) )
403
+	$notoptions = wp_cache_get('notoptions', 'options');
404
+	if ( ! is_array($notoptions) || ! isset($notoptions[$option]))
405 405
 		/** This filter is documented in wp-includes/option.php */
406
-		if ( apply_filters( 'default_option_' . $option, false ) !== get_option( $option ) )
406
+		if (apply_filters('default_option_'.$option, false) !== get_option($option))
407 407
 			return false;
408 408
 
409
-	$serialized_value = maybe_serialize( $value );
410
-	$autoload = ( 'no' === $autoload || false === $autoload ) ? 'no' : 'yes';
409
+	$serialized_value = maybe_serialize($value);
410
+	$autoload = ('no' === $autoload || false === $autoload) ? 'no' : 'yes';
411 411
 
412 412
 	/**
413 413
 	 * Fires before an option is added.
@@ -417,27 +417,27 @@  discard block
 block discarded – undo
417 417
 	 * @param string $option Name of the option to add.
418 418
 	 * @param mixed  $value  Value of the option.
419 419
 	 */
420
-	do_action( 'add_option', $option, $value );
420
+	do_action('add_option', $option, $value);
421 421
 
422
-	$result = $wpdb->query( $wpdb->prepare( "INSERT INTO `$wpdb->options` (`option_name`, `option_value`, `autoload`) VALUES (%s, %s, %s) ON DUPLICATE KEY UPDATE `option_name` = VALUES(`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES(`autoload`)", $option, $serialized_value, $autoload ) );
423
-	if ( ! $result )
422
+	$result = $wpdb->query($wpdb->prepare("INSERT INTO `$wpdb->options` (`option_name`, `option_value`, `autoload`) VALUES (%s, %s, %s) ON DUPLICATE KEY UPDATE `option_name` = VALUES(`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES(`autoload`)", $option, $serialized_value, $autoload));
423
+	if ( ! $result)
424 424
 		return false;
425 425
 
426
-	if ( ! defined( 'WP_INSTALLING' ) ) {
427
-		if ( 'yes' == $autoload ) {
426
+	if ( ! defined('WP_INSTALLING')) {
427
+		if ('yes' == $autoload) {
428 428
 			$alloptions = wp_load_alloptions();
429
-			$alloptions[ $option ] = $serialized_value;
430
-			wp_cache_set( 'alloptions', $alloptions, 'options' );
429
+			$alloptions[$option] = $serialized_value;
430
+			wp_cache_set('alloptions', $alloptions, 'options');
431 431
 		} else {
432
-			wp_cache_set( $option, $serialized_value, 'options' );
432
+			wp_cache_set($option, $serialized_value, 'options');
433 433
 		}
434 434
 	}
435 435
 
436 436
 	// This option exists now
437
-	$notoptions = wp_cache_get( 'notoptions', 'options' ); // yes, again... we need it to be fresh
438
-	if ( is_array( $notoptions ) && isset( $notoptions[$option] ) ) {
439
-		unset( $notoptions[$option] );
440
-		wp_cache_set( 'notoptions', $notoptions, 'options' );
437
+	$notoptions = wp_cache_get('notoptions', 'options'); // yes, again... we need it to be fresh
438
+	if (is_array($notoptions) && isset($notoptions[$option])) {
439
+		unset($notoptions[$option]);
440
+		wp_cache_set('notoptions', $notoptions, 'options');
441 441
 	}
442 442
 
443 443
 	/**
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
 	 * @param string $option Name of the option to add.
452 452
 	 * @param mixed  $value  Value of the option.
453 453
 	 */
454
-	do_action( "add_option_{$option}", $option, $value );
454
+	do_action("add_option_{$option}", $option, $value);
455 455
 
456 456
 	/**
457 457
 	 * Fires after an option has been added.
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
 	 * @param string $option Name of the added option.
462 462
 	 * @param mixed  $value  Value of the option.
463 463
 	 */
464
-	do_action( 'added_option', $option, $value );
464
+	do_action('added_option', $option, $value);
465 465
 	return true;
466 466
 }
467 467
 
@@ -475,18 +475,18 @@  discard block
 block discarded – undo
475 475
  * @param string $option Name of option to remove. Expected to not be SQL-escaped.
476 476
  * @return bool True, if option is successfully deleted. False on failure.
477 477
  */
478
-function delete_option( $option ) {
478
+function delete_option($option) {
479 479
 	global $wpdb;
480 480
 
481
-	$option = trim( $option );
482
-	if ( empty( $option ) )
481
+	$option = trim($option);
482
+	if (empty($option))
483 483
 		return false;
484 484
 
485
-	wp_protect_special_option( $option );
485
+	wp_protect_special_option($option);
486 486
 
487 487
 	// Get the ID, if no ID then return
488
-	$row = $wpdb->get_row( $wpdb->prepare( "SELECT autoload FROM $wpdb->options WHERE option_name = %s", $option ) );
489
-	if ( is_null( $row ) )
488
+	$row = $wpdb->get_row($wpdb->prepare("SELECT autoload FROM $wpdb->options WHERE option_name = %s", $option));
489
+	if (is_null($row))
490 490
 		return false;
491 491
 
492 492
 	/**
@@ -496,21 +496,21 @@  discard block
 block discarded – undo
496 496
 	 *
497 497
 	 * @param string $option Name of the option to delete.
498 498
 	 */
499
-	do_action( 'delete_option', $option );
499
+	do_action('delete_option', $option);
500 500
 
501
-	$result = $wpdb->delete( $wpdb->options, array( 'option_name' => $option ) );
502
-	if ( ! defined( 'WP_INSTALLING' ) ) {
503
-		if ( 'yes' == $row->autoload ) {
501
+	$result = $wpdb->delete($wpdb->options, array('option_name' => $option));
502
+	if ( ! defined('WP_INSTALLING')) {
503
+		if ('yes' == $row->autoload) {
504 504
 			$alloptions = wp_load_alloptions();
505
-			if ( is_array( $alloptions ) && isset( $alloptions[$option] ) ) {
506
-				unset( $alloptions[$option] );
507
-				wp_cache_set( 'alloptions', $alloptions, 'options' );
505
+			if (is_array($alloptions) && isset($alloptions[$option])) {
506
+				unset($alloptions[$option]);
507
+				wp_cache_set('alloptions', $alloptions, 'options');
508 508
 			}
509 509
 		} else {
510
-			wp_cache_delete( $option, 'options' );
510
+			wp_cache_delete($option, 'options');
511 511
 		}
512 512
 	}
513
-	if ( $result ) {
513
+	if ($result) {
514 514
 
515 515
 		/**
516 516
 		 * Fires after a specific option has been deleted.
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
 		 *
522 522
 		 * @param string $option Name of the deleted option.
523 523
 		 */
524
-		do_action( "delete_option_$option", $option );
524
+		do_action("delete_option_$option", $option);
525 525
 
526 526
 		/**
527 527
 		 * Fires after an option has been deleted.
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
 		 *
531 531
 		 * @param string $option Name of the deleted option.
532 532
 		 */
533
-		do_action( 'deleted_option', $option );
533
+		do_action('deleted_option', $option);
534 534
 		return true;
535 535
 	}
536 536
 	return false;
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
  * @param string $transient Transient name. Expected to not be SQL-escaped.
545 545
  * @return bool true if successful, false otherwise
546 546
  */
547
-function delete_transient( $transient ) {
547
+function delete_transient($transient) {
548 548
 
549 549
 	/**
550 550
 	 * Fires immediately before a specific transient is deleted.
@@ -555,19 +555,19 @@  discard block
 block discarded – undo
555 555
 	 *
556 556
 	 * @param string $transient Transient name.
557 557
 	 */
558
-	do_action( 'delete_transient_' . $transient, $transient );
558
+	do_action('delete_transient_'.$transient, $transient);
559 559
 
560
-	if ( wp_using_ext_object_cache() ) {
561
-		$result = wp_cache_delete( $transient, 'transient' );
560
+	if (wp_using_ext_object_cache()) {
561
+		$result = wp_cache_delete($transient, 'transient');
562 562
 	} else {
563
-		$option_timeout = '_transient_timeout_' . $transient;
564
-		$option = '_transient_' . $transient;
565
-		$result = delete_option( $option );
566
-		if ( $result )
567
-			delete_option( $option_timeout );
563
+		$option_timeout = '_transient_timeout_'.$transient;
564
+		$option = '_transient_'.$transient;
565
+		$result = delete_option($option);
566
+		if ($result)
567
+			delete_option($option_timeout);
568 568
 	}
569 569
 
570
-	if ( $result ) {
570
+	if ($result) {
571 571
 
572 572
 		/**
573 573
 		 * Fires after a transient is deleted.
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
 		 *
577 577
 		 * @param string $transient Deleted transient name.
578 578
 		 */
579
-		do_action( 'deleted_transient', $transient );
579
+		do_action('deleted_transient', $transient);
580 580
 	}
581 581
 
582 582
 	return $result;
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
  * @param string $transient Transient name. Expected to not be SQL-escaped.
594 594
  * @return mixed Value of transient.
595 595
  */
596
-function get_transient( $transient ) {
596
+function get_transient($transient) {
597 597
 
598 598
  	/**
599 599
 	 * Filter the value of an existing transient.
@@ -609,30 +609,30 @@  discard block
 block discarded – undo
609 609
 	 *                             Any value other than false will short-circuit the retrieval
610 610
 	 *                             of the transient, and return the returned value.
611 611
 	 */
612
-	$pre = apply_filters( 'pre_transient_' . $transient, false );
613
-	if ( false !== $pre )
612
+	$pre = apply_filters('pre_transient_'.$transient, false);
613
+	if (false !== $pre)
614 614
 		return $pre;
615 615
 
616
-	if ( wp_using_ext_object_cache() ) {
617
-		$value = wp_cache_get( $transient, 'transient' );
616
+	if (wp_using_ext_object_cache()) {
617
+		$value = wp_cache_get($transient, 'transient');
618 618
 	} else {
619
-		$transient_option = '_transient_' . $transient;
620
-		if ( ! defined( 'WP_INSTALLING' ) ) {
619
+		$transient_option = '_transient_'.$transient;
620
+		if ( ! defined('WP_INSTALLING')) {
621 621
 			// If option is not in alloptions, it is not autoloaded and thus has a timeout
622 622
 			$alloptions = wp_load_alloptions();
623
-			if ( !isset( $alloptions[$transient_option] ) ) {
624
-				$transient_timeout = '_transient_timeout_' . $transient;
625
-				$timeout = get_option( $transient_timeout );
626
-				if ( false !== $timeout && $timeout < time() ) {
627
-					delete_option( $transient_option  );
628
-					delete_option( $transient_timeout );
623
+			if ( ! isset($alloptions[$transient_option])) {
624
+				$transient_timeout = '_transient_timeout_'.$transient;
625
+				$timeout = get_option($transient_timeout);
626
+				if (false !== $timeout && $timeout < time()) {
627
+					delete_option($transient_option);
628
+					delete_option($transient_timeout);
629 629
 					$value = false;
630 630
 				}
631 631
 			}
632 632
 		}
633 633
 
634
-		if ( ! isset( $value ) )
635
-			$value = get_option( $transient_option );
634
+		if ( ! isset($value))
635
+			$value = get_option($transient_option);
636 636
 	}
637 637
 
638 638
 	/**
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
 	 *
645 645
 	 * @param mixed $value Value of transient.
646 646
 	 */
647
-	return apply_filters( 'transient_' . $transient, $value );
647
+	return apply_filters('transient_'.$transient, $value);
648 648
 }
649 649
 
650 650
 /**
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
  * @param int    $expiration Optional. Time until expiration in seconds. Default 0.
663 663
  * @return bool False if value was not set and true if value was set.
664 664
  */
665
-function set_transient( $transient, $value, $expiration = 0 ) {
665
+function set_transient($transient, $value, $expiration = 0) {
666 666
 
667 667
 	$expiration = (int) $expiration;
668 668
 
@@ -677,41 +677,41 @@  discard block
 block discarded – undo
677 677
 	 * @param mixed $value      New value of transient.
678 678
 	 * @param int   $expiration Time until expiration in seconds.
679 679
 	 */
680
-	$value = apply_filters( 'pre_set_transient_' . $transient, $value, $expiration );
680
+	$value = apply_filters('pre_set_transient_'.$transient, $value, $expiration);
681 681
 
682
-	if ( wp_using_ext_object_cache() ) {
683
-		$result = wp_cache_set( $transient, $value, 'transient', $expiration );
682
+	if (wp_using_ext_object_cache()) {
683
+		$result = wp_cache_set($transient, $value, 'transient', $expiration);
684 684
 	} else {
685
-		$transient_timeout = '_transient_timeout_' . $transient;
686
-		$transient = '_transient_' . $transient;
687
-		if ( false === get_option( $transient ) ) {
685
+		$transient_timeout = '_transient_timeout_'.$transient;
686
+		$transient = '_transient_'.$transient;
687
+		if (false === get_option($transient)) {
688 688
 			$autoload = 'yes';
689
-			if ( $expiration ) {
689
+			if ($expiration) {
690 690
 				$autoload = 'no';
691
-				add_option( $transient_timeout, time() + $expiration, '', 'no' );
691
+				add_option($transient_timeout, time() + $expiration, '', 'no');
692 692
 			}
693
-			$result = add_option( $transient, $value, '', $autoload );
693
+			$result = add_option($transient, $value, '', $autoload);
694 694
 		} else {
695 695
 			// If expiration is requested, but the transient has no timeout option,
696 696
 			// delete, then re-create transient rather than update.
697 697
 			$update = true;
698
-			if ( $expiration ) {
699
-				if ( false === get_option( $transient_timeout ) ) {
700
-					delete_option( $transient );
701
-					add_option( $transient_timeout, time() + $expiration, '', 'no' );
702
-					$result = add_option( $transient, $value, '', 'no' );
698
+			if ($expiration) {
699
+				if (false === get_option($transient_timeout)) {
700
+					delete_option($transient);
701
+					add_option($transient_timeout, time() + $expiration, '', 'no');
702
+					$result = add_option($transient, $value, '', 'no');
703 703
 					$update = false;
704 704
 				} else {
705
-					update_option( $transient_timeout, time() + $expiration );
705
+					update_option($transient_timeout, time() + $expiration);
706 706
 				}
707 707
 			}
708
-			if ( $update ) {
709
-				$result = update_option( $transient, $value );
708
+			if ($update) {
709
+				$result = update_option($transient, $value);
710 710
 			}
711 711
 		}
712 712
 	}
713 713
 
714
-	if ( $result ) {
714
+	if ($result) {
715 715
 
716 716
 		/**
717 717
 		 * Fires after the value for a specific transient has been set.
@@ -723,7 +723,7 @@  discard block
 block discarded – undo
723 723
 		 * @param mixed $value      Transient value.
724 724
 		 * @param int   $expiration Time until expiration in seconds. Default 0.
725 725
 		 */
726
-		do_action( 'set_transient_' . $transient, $value, $expiration );
726
+		do_action('set_transient_'.$transient, $value, $expiration);
727 727
 
728 728
 		/**
729 729
 		 * Fires after the value for a transient has been set.
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
 		 * @param mixed  $value      Transient value.
735 735
 		 * @param int    $expiration Time until expiration in seconds. Default 0.
736 736
 		 */
737
-		do_action( 'setted_transient', $transient, $value, $expiration );
737
+		do_action('setted_transient', $transient, $value, $expiration);
738 738
 	}
739 739
 	return $result;
740 740
 }
@@ -750,43 +750,43 @@  discard block
 block discarded – undo
750 750
  */
751 751
 function wp_user_settings() {
752 752
 
753
-	if ( ! is_admin() || defined( 'DOING_AJAX' ) ) {
753
+	if ( ! is_admin() || defined('DOING_AJAX')) {
754 754
 		return;
755 755
 	}
756 756
 
757
-	if ( ! $user_id = get_current_user_id() ) {
757
+	if ( ! $user_id = get_current_user_id()) {
758 758
 		return;
759 759
 	}
760 760
 
761
-	if ( is_super_admin() && ! is_user_member_of_blog() ) {
761
+	if (is_super_admin() && ! is_user_member_of_blog()) {
762 762
 		return;
763 763
 	}
764 764
 
765
-	$settings = (string) get_user_option( 'user-settings', $user_id );
765
+	$settings = (string) get_user_option('user-settings', $user_id);
766 766
 
767
-	if ( isset( $_COOKIE['wp-settings-' . $user_id] ) ) {
768
-		$cookie = preg_replace( '/[^A-Za-z0-9=&_]/', '', $_COOKIE['wp-settings-' . $user_id] );
767
+	if (isset($_COOKIE['wp-settings-'.$user_id])) {
768
+		$cookie = preg_replace('/[^A-Za-z0-9=&_]/', '', $_COOKIE['wp-settings-'.$user_id]);
769 769
 
770 770
 		// No change or both empty
771
-		if ( $cookie == $settings )
771
+		if ($cookie == $settings)
772 772
 			return;
773 773
 
774
-		$last_saved = (int) get_user_option( 'user-settings-time', $user_id );
775
-		$current = isset( $_COOKIE['wp-settings-time-' . $user_id]) ? preg_replace( '/[^0-9]/', '', $_COOKIE['wp-settings-time-' . $user_id] ) : 0;
774
+		$last_saved = (int) get_user_option('user-settings-time', $user_id);
775
+		$current = isset($_COOKIE['wp-settings-time-'.$user_id]) ? preg_replace('/[^0-9]/', '', $_COOKIE['wp-settings-time-'.$user_id]) : 0;
776 776
 
777 777
 		// The cookie is newer than the saved value. Update the user_option and leave the cookie as-is
778
-		if ( $current > $last_saved ) {
779
-			update_user_option( $user_id, 'user-settings', $cookie, false );
780
-			update_user_option( $user_id, 'user-settings-time', time() - 5, false );
778
+		if ($current > $last_saved) {
779
+			update_user_option($user_id, 'user-settings', $cookie, false);
780
+			update_user_option($user_id, 'user-settings-time', time() - 5, false);
781 781
 			return;
782 782
 		}
783 783
 	}
784 784
 
785 785
 	// The cookie is not set in the current browser or the saved value is newer.
786
-	$secure = ( 'https' === parse_url( site_url(), PHP_URL_SCHEME ) );
787
-	setcookie( 'wp-settings-' . $user_id, $settings, time() + YEAR_IN_SECONDS, SITECOOKIEPATH, null, $secure );
788
-	setcookie( 'wp-settings-time-' . $user_id, time(), time() + YEAR_IN_SECONDS, SITECOOKIEPATH, null, $secure );
789
-	$_COOKIE['wp-settings-' . $user_id] = $settings;
786
+	$secure = ('https' === parse_url(site_url(), PHP_URL_SCHEME));
787
+	setcookie('wp-settings-'.$user_id, $settings, time() + YEAR_IN_SECONDS, SITECOOKIEPATH, null, $secure);
788
+	setcookie('wp-settings-time-'.$user_id, time(), time() + YEAR_IN_SECONDS, SITECOOKIEPATH, null, $secure);
789
+	$_COOKIE['wp-settings-'.$user_id] = $settings;
790 790
 }
791 791
 
792 792
 /**
@@ -798,10 +798,10 @@  discard block
 block discarded – undo
798 798
  * @param string $default Optional default value to return when $name is not set.
799 799
  * @return mixed the last saved user setting or the default value/false if it doesn't exist.
800 800
  */
801
-function get_user_setting( $name, $default = false ) {
801
+function get_user_setting($name, $default = false) {
802 802
 	$all_user_settings = get_all_user_settings();
803 803
 
804
-	return isset( $all_user_settings[$name] ) ? $all_user_settings[$name] : $default;
804
+	return isset($all_user_settings[$name]) ? $all_user_settings[$name] : $default;
805 805
 }
806 806
 
807 807
 /**
@@ -816,15 +816,15 @@  discard block
 block discarded – undo
816 816
  * @param string $value The value for the setting.
817 817
  * @return bool|void true if set successfully/false if not.
818 818
  */
819
-function set_user_setting( $name, $value ) {
820
-	if ( headers_sent() ) {
819
+function set_user_setting($name, $value) {
820
+	if (headers_sent()) {
821 821
 		return false;
822 822
 	}
823 823
 
824 824
 	$all_user_settings = get_all_user_settings();
825 825
 	$all_user_settings[$name] = $value;
826 826
 
827
-	return wp_set_all_user_settings( $all_user_settings );
827
+	return wp_set_all_user_settings($all_user_settings);
828 828
 }
829 829
 
830 830
 /**
@@ -838,8 +838,8 @@  discard block
 block discarded – undo
838 838
  * @param string $names The name or array of names of the setting to be deleted.
839 839
  * @return bool|void true if deleted successfully/false if not.
840 840
  */
841
-function delete_user_setting( $names ) {
842
-	if ( headers_sent() ) {
841
+function delete_user_setting($names) {
842
+	if (headers_sent()) {
843 843
 		return false;
844 844
 	}
845 845
 
@@ -847,15 +847,15 @@  discard block
 block discarded – undo
847 847
 	$names = (array) $names;
848 848
 	$deleted = false;
849 849
 
850
-	foreach ( $names as $name ) {
851
-		if ( isset( $all_user_settings[$name] ) ) {
852
-			unset( $all_user_settings[$name] );
850
+	foreach ($names as $name) {
851
+		if (isset($all_user_settings[$name])) {
852
+			unset($all_user_settings[$name]);
853 853
 			$deleted = true;
854 854
 		}
855 855
 	}
856 856
 
857
-	if ( $deleted ) {
858
-		return wp_set_all_user_settings( $all_user_settings );
857
+	if ($deleted) {
858
+		return wp_set_all_user_settings($all_user_settings);
859 859
 	}
860 860
 
861 861
 	return false;
@@ -873,27 +873,27 @@  discard block
 block discarded – undo
873 873
 function get_all_user_settings() {
874 874
 	global $_updated_user_settings;
875 875
 
876
-	if ( ! $user_id = get_current_user_id() ) {
876
+	if ( ! $user_id = get_current_user_id()) {
877 877
 		return array();
878 878
 	}
879 879
 
880
-	if ( isset( $_updated_user_settings ) && is_array( $_updated_user_settings ) ) {
880
+	if (isset($_updated_user_settings) && is_array($_updated_user_settings)) {
881 881
 		return $_updated_user_settings;
882 882
 	}
883 883
 
884 884
 	$user_settings = array();
885 885
 
886
-	if ( isset( $_COOKIE['wp-settings-' . $user_id] ) ) {
887
-		$cookie = preg_replace( '/[^A-Za-z0-9=&_]/', '', $_COOKIE['wp-settings-' . $user_id] );
886
+	if (isset($_COOKIE['wp-settings-'.$user_id])) {
887
+		$cookie = preg_replace('/[^A-Za-z0-9=&_]/', '', $_COOKIE['wp-settings-'.$user_id]);
888 888
 
889
-		if ( strpos( $cookie, '=' ) ) { // '=' cannot be 1st char
890
-			parse_str( $cookie, $user_settings );
889
+		if (strpos($cookie, '=')) { // '=' cannot be 1st char
890
+			parse_str($cookie, $user_settings);
891 891
 		}
892 892
 	} else {
893
-		$option = get_user_option( 'user-settings', $user_id );
893
+		$option = get_user_option('user-settings', $user_id);
894 894
 
895
-		if ( $option && is_string( $option ) ) {
896
-			parse_str( $option, $user_settings );
895
+		if ($option && is_string($option)) {
896
+			parse_str($option, $user_settings);
897 897
 		}
898 898
 	}
899 899
 
@@ -911,32 +911,32 @@  discard block
 block discarded – undo
911 911
  * @param array $user_settings
912 912
  * @return bool|void
913 913
  */
914
-function wp_set_all_user_settings( $user_settings ) {
914
+function wp_set_all_user_settings($user_settings) {
915 915
 	global $_updated_user_settings;
916 916
 
917
-	if ( ! $user_id = get_current_user_id() ) {
917
+	if ( ! $user_id = get_current_user_id()) {
918 918
 		return false;
919 919
 	}
920 920
 
921
-	if ( is_super_admin() && ! is_user_member_of_blog() ) {
921
+	if (is_super_admin() && ! is_user_member_of_blog()) {
922 922
 		return;
923 923
 	}
924 924
 
925 925
 	$settings = '';
926
-	foreach ( $user_settings as $name => $value ) {
927
-		$_name = preg_replace( '/[^A-Za-z0-9_]+/', '', $name );
928
-		$_value = preg_replace( '/[^A-Za-z0-9_]+/', '', $value );
926
+	foreach ($user_settings as $name => $value) {
927
+		$_name = preg_replace('/[^A-Za-z0-9_]+/', '', $name);
928
+		$_value = preg_replace('/[^A-Za-z0-9_]+/', '', $value);
929 929
 
930
-		if ( ! empty( $_name ) ) {
931
-			$settings .= $_name . '=' . $_value . '&';
930
+		if ( ! empty($_name)) {
931
+			$settings .= $_name.'='.$_value.'&';
932 932
 		}
933 933
 	}
934 934
 
935
-	$settings = rtrim( $settings, '&' );
936
-	parse_str( $settings, $_updated_user_settings );
935
+	$settings = rtrim($settings, '&');
936
+	parse_str($settings, $_updated_user_settings);
937 937
 
938
-	update_user_option( $user_id, 'user-settings', $settings, false );
939
-	update_user_option( $user_id, 'user-settings-time', time(), false );
938
+	update_user_option($user_id, 'user-settings', $settings, false);
939
+	update_user_option($user_id, 'user-settings-time', time(), false);
940 940
 
941 941
 	return true;
942 942
 }
@@ -947,12 +947,12 @@  discard block
 block discarded – undo
947 947
  * @since 2.7.0
948 948
  */
949 949
 function delete_all_user_settings() {
950
-	if ( ! $user_id = get_current_user_id() ) {
950
+	if ( ! $user_id = get_current_user_id()) {
951 951
 		return;
952 952
 	}
953 953
 
954
-	update_user_option( $user_id, 'user-settings', '', false );
955
-	setcookie( 'wp-settings-' . $user_id, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH );
954
+	update_user_option($user_id, 'user-settings', '', false);
955
+	setcookie('wp-settings-'.$user_id, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH);
956 956
 }
957 957
 
958 958
 /**
@@ -969,7 +969,7 @@  discard block
 block discarded – undo
969 969
  * @param bool   $use_cache Whether to use cache. Multisite only. Default true.
970 970
  * @return mixed Value set for the option.
971 971
  */
972
-function get_site_option( $option, $default = false, $use_cache = true ) {
972
+function get_site_option($option, $default = false, $use_cache = true) {
973 973
 	global $wpdb;
974 974
 
975 975
 	/**
@@ -985,16 +985,16 @@  discard block
 block discarded – undo
985 985
 	 *
986 986
 	 * @param mixed $pre_option The default value to return if the option does not exist.
987 987
 	 */
988
- 	$pre = apply_filters( 'pre_site_option_' . $option, false );
988
+ 	$pre = apply_filters('pre_site_option_'.$option, false);
989 989
 
990
- 	if ( false !== $pre )
990
+ 	if (false !== $pre)
991 991
  		return $pre;
992 992
 
993 993
 	// prevent non-existent options from triggering multiple queries
994 994
 	$notoptions_key = "{$wpdb->siteid}:notoptions";
995
-	$notoptions = wp_cache_get( $notoptions_key, 'site-options' );
995
+	$notoptions = wp_cache_get($notoptions_key, 'site-options');
996 996
 
997
-	if ( isset( $notoptions[$option] ) ) {
997
+	if (isset($notoptions[$option])) {
998 998
 
999 999
 		/**
1000 1000
 		 * Filter a specific default site option.
@@ -1006,36 +1006,36 @@  discard block
 block discarded – undo
1006 1006
 		 * @param mixed $default The value to return if the site option does not exist
1007 1007
 		 *                       in the database.
1008 1008
 		 */
1009
-		return apply_filters( 'default_site_option_' . $option, $default );
1009
+		return apply_filters('default_site_option_'.$option, $default);
1010 1010
 	}
1011 1011
 
1012
-	if ( ! is_multisite() ) {
1012
+	if ( ! is_multisite()) {
1013 1013
 
1014 1014
 		/** This filter is documented in wp-includes/option.php */
1015
-		$default = apply_filters( 'default_site_option_' . $option, $default );
1015
+		$default = apply_filters('default_site_option_'.$option, $default);
1016 1016
 		$value = get_option($option, $default);
1017 1017
 	} else {
1018 1018
 		$cache_key = "{$wpdb->siteid}:$option";
1019
-		if ( $use_cache )
1019
+		if ($use_cache)
1020 1020
 			$value = wp_cache_get($cache_key, 'site-options');
1021 1021
 
1022
-		if ( !isset($value) || (false === $value) ) {
1023
-			$row = $wpdb->get_row( $wpdb->prepare("SELECT meta_value FROM $wpdb->sitemeta WHERE meta_key = %s AND site_id = %d", $option, $wpdb->siteid ) );
1022
+		if ( ! isset($value) || (false === $value)) {
1023
+			$row = $wpdb->get_row($wpdb->prepare("SELECT meta_value FROM $wpdb->sitemeta WHERE meta_key = %s AND site_id = %d", $option, $wpdb->siteid));
1024 1024
 
1025 1025
 			// Has to be get_row instead of get_var because of funkiness with 0, false, null values
1026
-			if ( is_object( $row ) ) {
1026
+			if (is_object($row)) {
1027 1027
 				$value = $row->meta_value;
1028
-				$value = maybe_unserialize( $value );
1029
-				wp_cache_set( $cache_key, $value, 'site-options' );
1028
+				$value = maybe_unserialize($value);
1029
+				wp_cache_set($cache_key, $value, 'site-options');
1030 1030
 			} else {
1031
-				if ( ! is_array( $notoptions ) ) {
1031
+				if ( ! is_array($notoptions)) {
1032 1032
 					 $notoptions = array();
1033 1033
 				}
1034 1034
 				$notoptions[$option] = true;
1035
-				wp_cache_set( $notoptions_key, $notoptions, 'site-options' );
1035
+				wp_cache_set($notoptions_key, $notoptions, 'site-options');
1036 1036
 
1037 1037
 				/** This filter is documented in wp-includes/option.php */
1038
-				$value = apply_filters( 'default_site_option_' . $option, $default );
1038
+				$value = apply_filters('default_site_option_'.$option, $default);
1039 1039
 			}
1040 1040
 		}
1041 1041
 	}
@@ -1050,7 +1050,7 @@  discard block
 block discarded – undo
1050 1050
 	 *
1051 1051
 	 * @param mixed $value Value of site option.
1052 1052
 	 */
1053
- 	return apply_filters( 'site_option_' . $option, $value );
1053
+ 	return apply_filters('site_option_'.$option, $value);
1054 1054
 }
1055 1055
 
1056 1056
 /**
@@ -1068,10 +1068,10 @@  discard block
 block discarded – undo
1068 1068
  * @param mixed  $value  Optional. Option value, can be anything. Expected to not be SQL-escaped.
1069 1069
  * @return bool False if option was not added and true if option was added.
1070 1070
  */
1071
-function add_site_option( $option, $value ) {
1071
+function add_site_option($option, $value) {
1072 1072
 	global $wpdb;
1073 1073
 
1074
-	wp_protect_special_option( $option );
1074
+	wp_protect_special_option($option);
1075 1075
 
1076 1076
 	/**
1077 1077
 	 * Filter the value of a specific site option before it is added.
@@ -1083,40 +1083,40 @@  discard block
 block discarded – undo
1083 1083
 	 *
1084 1084
 	 * @param mixed $value Value of site option.
1085 1085
 	 */
1086
-	$value = apply_filters( 'pre_add_site_option_' . $option, $value );
1086
+	$value = apply_filters('pre_add_site_option_'.$option, $value);
1087 1087
 
1088 1088
 	$notoptions_key = "{$wpdb->siteid}:notoptions";
1089 1089
 
1090
-	if ( !is_multisite() ) {
1091
-		$result = add_option( $option, $value );
1090
+	if ( ! is_multisite()) {
1091
+		$result = add_option($option, $value);
1092 1092
 	} else {
1093 1093
 		$cache_key = "{$wpdb->siteid}:$option";
1094 1094
 
1095 1095
 		// Make sure the option doesn't already exist. We can check the 'notoptions' cache before we ask for a db query
1096
-		$notoptions = wp_cache_get( $notoptions_key, 'site-options' );
1097
-		if ( ! is_array( $notoptions ) || ! isset( $notoptions[$option] ) )
1098
-			if ( false !== get_site_option( $option ) )
1096
+		$notoptions = wp_cache_get($notoptions_key, 'site-options');
1097
+		if ( ! is_array($notoptions) || ! isset($notoptions[$option]))
1098
+			if (false !== get_site_option($option))
1099 1099
 				return false;
1100 1100
 
1101
-		$value = sanitize_option( $option, $value );
1101
+		$value = sanitize_option($option, $value);
1102 1102
 
1103
-		$serialized_value = maybe_serialize( $value );
1104
-		$result = $wpdb->insert( $wpdb->sitemeta, array('site_id' => $wpdb->siteid, 'meta_key' => $option, 'meta_value' => $serialized_value ) );
1103
+		$serialized_value = maybe_serialize($value);
1104
+		$result = $wpdb->insert($wpdb->sitemeta, array('site_id' => $wpdb->siteid, 'meta_key' => $option, 'meta_value' => $serialized_value));
1105 1105
 
1106
-		if ( ! $result )
1106
+		if ( ! $result)
1107 1107
 			return false;
1108 1108
 
1109
-		wp_cache_set( $cache_key, $value, 'site-options' );
1109
+		wp_cache_set($cache_key, $value, 'site-options');
1110 1110
 
1111 1111
 		// This option exists now
1112
-		$notoptions = wp_cache_get( $notoptions_key, 'site-options' ); // yes, again... we need it to be fresh
1113
-		if ( is_array( $notoptions ) && isset( $notoptions[$option] ) ) {
1114
-			unset( $notoptions[$option] );
1115
-			wp_cache_set( $notoptions_key, $notoptions, 'site-options' );
1112
+		$notoptions = wp_cache_get($notoptions_key, 'site-options'); // yes, again... we need it to be fresh
1113
+		if (is_array($notoptions) && isset($notoptions[$option])) {
1114
+			unset($notoptions[$option]);
1115
+			wp_cache_set($notoptions_key, $notoptions, 'site-options');
1116 1116
 		}
1117 1117
 	}
1118 1118
 
1119
-	if ( $result ) {
1119
+	if ($result) {
1120 1120
 
1121 1121
 		/**
1122 1122
 		 * Fires after a specific site option has been successfully added.
@@ -1129,7 +1129,7 @@  discard block
 block discarded – undo
1129 1129
 		 * @param string $option Name of site option.
1130 1130
 		 * @param mixed  $value  Value of site option.
1131 1131
 		 */
1132
-		do_action( "add_site_option_{$option}", $option, $value );
1132
+		do_action("add_site_option_{$option}", $option, $value);
1133 1133
 
1134 1134
 		/**
1135 1135
 		 * Fires after a site option has been successfully added.
@@ -1139,7 +1139,7 @@  discard block
 block discarded – undo
1139 1139
 		 * @param string $option Name of site option.
1140 1140
 		 * @param mixed  $value  Value of site option.
1141 1141
 		 */
1142
-		do_action( "add_site_option", $option, $value );
1142
+		do_action("add_site_option", $option, $value);
1143 1143
 
1144 1144
 		return true;
1145 1145
 	}
@@ -1158,7 +1158,7 @@  discard block
 block discarded – undo
1158 1158
  * @param string $option Name of option to remove. Expected to not be SQL-escaped.
1159 1159
  * @return bool True, if succeed. False, if failure.
1160 1160
  */
1161
-function delete_site_option( $option ) {
1161
+function delete_site_option($option) {
1162 1162
 	global $wpdb;
1163 1163
 
1164 1164
 	// ms_protect_special_option( $option ); @todo
@@ -1170,21 +1170,21 @@  discard block
 block discarded – undo
1170 1170
 	 *
1171 1171
 	 * @since 3.0.0
1172 1172
 	 */
1173
-	do_action( 'pre_delete_site_option_' . $option );
1173
+	do_action('pre_delete_site_option_'.$option);
1174 1174
 
1175
-	if ( !is_multisite() ) {
1176
-		$result = delete_option( $option );
1175
+	if ( ! is_multisite()) {
1176
+		$result = delete_option($option);
1177 1177
 	} else {
1178
-		$row = $wpdb->get_row( $wpdb->prepare( "SELECT meta_id FROM {$wpdb->sitemeta} WHERE meta_key = %s AND site_id = %d", $option, $wpdb->siteid ) );
1179
-		if ( is_null( $row ) || !$row->meta_id )
1178
+		$row = $wpdb->get_row($wpdb->prepare("SELECT meta_id FROM {$wpdb->sitemeta} WHERE meta_key = %s AND site_id = %d", $option, $wpdb->siteid));
1179
+		if (is_null($row) || ! $row->meta_id)
1180 1180
 			return false;
1181 1181
 		$cache_key = "{$wpdb->siteid}:$option";
1182
-		wp_cache_delete( $cache_key, 'site-options' );
1182
+		wp_cache_delete($cache_key, 'site-options');
1183 1183
 
1184
-		$result = $wpdb->delete( $wpdb->sitemeta, array( 'meta_key' => $option, 'site_id' => $wpdb->siteid ) );
1184
+		$result = $wpdb->delete($wpdb->sitemeta, array('meta_key' => $option, 'site_id' => $wpdb->siteid));
1185 1185
 	}
1186 1186
 
1187
-	if ( $result ) {
1187
+	if ($result) {
1188 1188
 
1189 1189
 		/**
1190 1190
 		 * Fires after a specific site option has been deleted.
@@ -1196,7 +1196,7 @@  discard block
 block discarded – undo
1196 1196
 		 *
1197 1197
 		 * @param string $option Name of the site option.
1198 1198
 		 */
1199
-		do_action( "delete_site_option_{$option}", $option );
1199
+		do_action("delete_site_option_{$option}", $option);
1200 1200
 
1201 1201
 		/**
1202 1202
 		 * Fires after a site option has been deleted.
@@ -1205,7 +1205,7 @@  discard block
 block discarded – undo
1205 1205
 		 *
1206 1206
 		 * @param string $option Name of the site option.
1207 1207
 		 */
1208
-		do_action( "delete_site_option", $option );
1208
+		do_action("delete_site_option", $option);
1209 1209
 
1210 1210
 		return true;
1211 1211
 	}
@@ -1225,12 +1225,12 @@  discard block
 block discarded – undo
1225 1225
  * @param mixed  $value  Option value. Expected to not be SQL-escaped.
1226 1226
  * @return bool False if value was not updated and true if value was updated.
1227 1227
  */
1228
-function update_site_option( $option, $value ) {
1228
+function update_site_option($option, $value) {
1229 1229
 	global $wpdb;
1230 1230
 
1231
-	wp_protect_special_option( $option );
1231
+	wp_protect_special_option($option);
1232 1232
 
1233
-	$old_value = get_site_option( $option );
1233
+	$old_value = get_site_option($option);
1234 1234
 
1235 1235
 	/**
1236 1236
 	 * Filter a specific site option before its value is updated.
@@ -1243,36 +1243,36 @@  discard block
 block discarded – undo
1243 1243
 	 * @param mixed $value     New value of site option.
1244 1244
 	 * @param mixed $old_value Old value of site option.
1245 1245
 	 */
1246
-	$value = apply_filters( 'pre_update_site_option_' . $option, $value, $old_value );
1246
+	$value = apply_filters('pre_update_site_option_'.$option, $value, $old_value);
1247 1247
 
1248
-	if ( $value === $old_value )
1248
+	if ($value === $old_value)
1249 1249
 		return false;
1250 1250
 
1251
-	if ( false === $old_value )
1252
-		return add_site_option( $option, $value );
1251
+	if (false === $old_value)
1252
+		return add_site_option($option, $value);
1253 1253
 
1254 1254
 	$notoptions_key = "{$wpdb->siteid}:notoptions";
1255
-	$notoptions = wp_cache_get( $notoptions_key, 'site-options' );
1256
-	if ( is_array( $notoptions ) && isset( $notoptions[$option] ) ) {
1257
-		unset( $notoptions[$option] );
1258
-		wp_cache_set( $notoptions_key, $notoptions, 'site-options' );
1255
+	$notoptions = wp_cache_get($notoptions_key, 'site-options');
1256
+	if (is_array($notoptions) && isset($notoptions[$option])) {
1257
+		unset($notoptions[$option]);
1258
+		wp_cache_set($notoptions_key, $notoptions, 'site-options');
1259 1259
 	}
1260 1260
 
1261
-	if ( !is_multisite() ) {
1262
-		$result = update_option( $option, $value );
1261
+	if ( ! is_multisite()) {
1262
+		$result = update_option($option, $value);
1263 1263
 	} else {
1264
-		$value = sanitize_option( $option, $value );
1264
+		$value = sanitize_option($option, $value);
1265 1265
 
1266
-		$serialized_value = maybe_serialize( $value );
1267
-		$result = $wpdb->update( $wpdb->sitemeta, array( 'meta_value' => $serialized_value ), array( 'site_id' => $wpdb->siteid, 'meta_key' => $option ) );
1266
+		$serialized_value = maybe_serialize($value);
1267
+		$result = $wpdb->update($wpdb->sitemeta, array('meta_value' => $serialized_value), array('site_id' => $wpdb->siteid, 'meta_key' => $option));
1268 1268
 
1269
-		if ( $result ) {
1269
+		if ($result) {
1270 1270
 			$cache_key = "{$wpdb->siteid}:$option";
1271
-			wp_cache_set( $cache_key, $value, 'site-options' );
1271
+			wp_cache_set($cache_key, $value, 'site-options');
1272 1272
 		}
1273 1273
 	}
1274 1274
 
1275
-	if ( $result ) {
1275
+	if ($result) {
1276 1276
 
1277 1277
 		/**
1278 1278
 		 * Fires after the value of a specific site option has been successfully updated.
@@ -1286,7 +1286,7 @@  discard block
 block discarded – undo
1286 1286
 		 * @param mixed  $value     Current value of site option.
1287 1287
 		 * @param mixed  $old_value Old value of site option.
1288 1288
 		 */
1289
-		do_action( "update_site_option_{$option}", $option, $value, $old_value );
1289
+		do_action("update_site_option_{$option}", $option, $value, $old_value);
1290 1290
 
1291 1291
 		/**
1292 1292
 		 * Fires after the value of a site option has been successfully updated.
@@ -1297,7 +1297,7 @@  discard block
 block discarded – undo
1297 1297
 		 * @param mixed  $value     Current value of site option.
1298 1298
 		 * @param mixed  $old_value Old value of site option.
1299 1299
 		 */
1300
-		do_action( "update_site_option", $option, $value, $old_value );
1300
+		do_action("update_site_option", $option, $value, $old_value);
1301 1301
 
1302 1302
 		return true;
1303 1303
 	}
@@ -1312,7 +1312,7 @@  discard block
 block discarded – undo
1312 1312
  * @param string $transient Transient name. Expected to not be SQL-escaped.
1313 1313
  * @return bool True if successful, false otherwise
1314 1314
  */
1315
-function delete_site_transient( $transient ) {
1315
+function delete_site_transient($transient) {
1316 1316
 
1317 1317
 	/**
1318 1318
 	 * Fires immediately before a specific site transient is deleted.
@@ -1323,18 +1323,18 @@  discard block
 block discarded – undo
1323 1323
 	 *
1324 1324
 	 * @param string $transient Transient name.
1325 1325
 	 */
1326
-	do_action( 'delete_site_transient_' . $transient, $transient );
1326
+	do_action('delete_site_transient_'.$transient, $transient);
1327 1327
 
1328
-	if ( wp_using_ext_object_cache() ) {
1329
-		$result = wp_cache_delete( $transient, 'site-transient' );
1328
+	if (wp_using_ext_object_cache()) {
1329
+		$result = wp_cache_delete($transient, 'site-transient');
1330 1330
 	} else {
1331
-		$option_timeout = '_site_transient_timeout_' . $transient;
1332
-		$option = '_site_transient_' . $transient;
1333
-		$result = delete_site_option( $option );
1334
-		if ( $result )
1335
-			delete_site_option( $option_timeout );
1331
+		$option_timeout = '_site_transient_timeout_'.$transient;
1332
+		$option = '_site_transient_'.$transient;
1333
+		$result = delete_site_option($option);
1334
+		if ($result)
1335
+			delete_site_option($option_timeout);
1336 1336
 	}
1337
-	if ( $result ) {
1337
+	if ($result) {
1338 1338
 
1339 1339
 		/**
1340 1340
 		 * Fires after a transient is deleted.
@@ -1343,7 +1343,7 @@  discard block
 block discarded – undo
1343 1343
 		 *
1344 1344
 		 * @param string $transient Deleted transient name.
1345 1345
 		 */
1346
-		do_action( 'deleted_site_transient', $transient );
1346
+		do_action('deleted_site_transient', $transient);
1347 1347
 	}
1348 1348
 
1349 1349
 	return $result;
@@ -1362,7 +1362,7 @@  discard block
 block discarded – undo
1362 1362
  * @param string $transient Transient name. Expected to not be SQL-escaped.
1363 1363
  * @return mixed Value of transient.
1364 1364
  */
1365
-function get_site_transient( $transient ) {
1365
+function get_site_transient($transient) {
1366 1366
 
1367 1367
 	/**
1368 1368
 	 * Filter the value of an existing site transient.
@@ -1378,29 +1378,29 @@  discard block
 block discarded – undo
1378 1378
 	 *                                  Any value other than false will short-circuit the retrieval
1379 1379
 	 *                                  of the transient, and return the returned value.
1380 1380
 	 */
1381
-	$pre = apply_filters( 'pre_site_transient_' . $transient, false );
1381
+	$pre = apply_filters('pre_site_transient_'.$transient, false);
1382 1382
 
1383
-	if ( false !== $pre )
1383
+	if (false !== $pre)
1384 1384
 		return $pre;
1385 1385
 
1386
-	if ( wp_using_ext_object_cache() ) {
1387
-		$value = wp_cache_get( $transient, 'site-transient' );
1386
+	if (wp_using_ext_object_cache()) {
1387
+		$value = wp_cache_get($transient, 'site-transient');
1388 1388
 	} else {
1389 1389
 		// Core transients that do not have a timeout. Listed here so querying timeouts can be avoided.
1390 1390
 		$no_timeout = array('update_core', 'update_plugins', 'update_themes');
1391
-		$transient_option = '_site_transient_' . $transient;
1392
-		if ( ! in_array( $transient, $no_timeout ) ) {
1393
-			$transient_timeout = '_site_transient_timeout_' . $transient;
1394
-			$timeout = get_site_option( $transient_timeout );
1395
-			if ( false !== $timeout && $timeout < time() ) {
1396
-				delete_site_option( $transient_option  );
1397
-				delete_site_option( $transient_timeout );
1391
+		$transient_option = '_site_transient_'.$transient;
1392
+		if ( ! in_array($transient, $no_timeout)) {
1393
+			$transient_timeout = '_site_transient_timeout_'.$transient;
1394
+			$timeout = get_site_option($transient_timeout);
1395
+			if (false !== $timeout && $timeout < time()) {
1396
+				delete_site_option($transient_option);
1397
+				delete_site_option($transient_timeout);
1398 1398
 				$value = false;
1399 1399
 			}
1400 1400
 		}
1401 1401
 
1402
-		if ( ! isset( $value ) )
1403
-			$value = get_site_option( $transient_option );
1402
+		if ( ! isset($value))
1403
+			$value = get_site_option($transient_option);
1404 1404
 	}
1405 1405
 
1406 1406
 	/**
@@ -1412,7 +1412,7 @@  discard block
 block discarded – undo
1412 1412
 	 *
1413 1413
 	 * @param mixed $value Value of site transient.
1414 1414
 	 */
1415
-	return apply_filters( 'site_transient_' . $transient, $value );
1415
+	return apply_filters('site_transient_'.$transient, $value);
1416 1416
 }
1417 1417
 
1418 1418
 /**
@@ -1431,7 +1431,7 @@  discard block
 block discarded – undo
1431 1431
  * @param int    $expiration Optional. Time until expiration in seconds. Default 0.
1432 1432
  * @return bool False if value was not set and true if value was set.
1433 1433
  */
1434
-function set_site_transient( $transient, $value, $expiration = 0 ) {
1434
+function set_site_transient($transient, $value, $expiration = 0) {
1435 1435
 
1436 1436
 	/**
1437 1437
 	 * Filter the value of a specific site transient before it is set.
@@ -1442,26 +1442,26 @@  discard block
 block discarded – undo
1442 1442
 	 *
1443 1443
 	 * @param mixed $value Value of site transient.
1444 1444
 	 */
1445
-	$value = apply_filters( 'pre_set_site_transient_' . $transient, $value );
1445
+	$value = apply_filters('pre_set_site_transient_'.$transient, $value);
1446 1446
 
1447 1447
 	$expiration = (int) $expiration;
1448 1448
 
1449
-	if ( wp_using_ext_object_cache() ) {
1450
-		$result = wp_cache_set( $transient, $value, 'site-transient', $expiration );
1449
+	if (wp_using_ext_object_cache()) {
1450
+		$result = wp_cache_set($transient, $value, 'site-transient', $expiration);
1451 1451
 	} else {
1452
-		$transient_timeout = '_site_transient_timeout_' . $transient;
1453
-		$option = '_site_transient_' . $transient;
1454
-		if ( false === get_site_option( $option ) ) {
1455
-			if ( $expiration )
1456
-				add_site_option( $transient_timeout, time() + $expiration );
1457
-			$result = add_site_option( $option, $value );
1452
+		$transient_timeout = '_site_transient_timeout_'.$transient;
1453
+		$option = '_site_transient_'.$transient;
1454
+		if (false === get_site_option($option)) {
1455
+			if ($expiration)
1456
+				add_site_option($transient_timeout, time() + $expiration);
1457
+			$result = add_site_option($option, $value);
1458 1458
 		} else {
1459
-			if ( $expiration )
1460
-				update_site_option( $transient_timeout, time() + $expiration );
1461
-			$result = update_site_option( $option, $value );
1459
+			if ($expiration)
1460
+				update_site_option($transient_timeout, time() + $expiration);
1461
+			$result = update_site_option($option, $value);
1462 1462
 		}
1463 1463
 	}
1464
-	if ( $result ) {
1464
+	if ($result) {
1465 1465
 
1466 1466
 		/**
1467 1467
 		 * Fires after the value for a specific site transient has been set.
@@ -1473,7 +1473,7 @@  discard block
 block discarded – undo
1473 1473
 		 * @param mixed $value      Site transient value.
1474 1474
 		 * @param int   $expiration Time until expiration in seconds. Default 0.
1475 1475
 		 */
1476
-		do_action( 'set_site_transient_' . $transient, $value, $expiration );
1476
+		do_action('set_site_transient_'.$transient, $value, $expiration);
1477 1477
 
1478 1478
 		/**
1479 1479
 		 * Fires after the value for a site transient has been set.
@@ -1484,7 +1484,7 @@  discard block
 block discarded – undo
1484 1484
 		 * @param mixed  $value      Site transient value.
1485 1485
 		 * @param int    $expiration Time until expiration in seconds. Default 0.
1486 1486
 		 */
1487
-		do_action( 'setted_site_transient', $transient, $value, $expiration );
1487
+		do_action('setted_site_transient', $transient, $value, $expiration);
1488 1488
 	}
1489 1489
 	return $result;
1490 1490
 }
Please login to merge, or discard this patch.
Braces   +117 added lines, -79 removed lines patch added patch discarded remove patch
@@ -28,8 +28,9 @@  discard block
 block discarded – undo
28 28
 	global $wpdb;
29 29
 
30 30
 	$option = trim( $option );
31
-	if ( empty( $option ) )
32
-		return false;
31
+	if ( empty( $option ) ) {
32
+			return false;
33
+	}
33 34
 
34 35
 	/**
35 36
 	 * Filter the value of an existing option before it is retrieved.
@@ -45,11 +46,13 @@  discard block
 block discarded – undo
45 46
 	 *                               Default false to skip it.
46 47
 	 */
47 48
 	$pre = apply_filters( 'pre_option_' . $option, false );
48
-	if ( false !== $pre )
49
-		return $pre;
49
+	if ( false !== $pre ) {
50
+			return $pre;
51
+	}
50 52
 
51
-	if ( defined( 'WP_SETUP_CONFIG' ) )
52
-		return false;
53
+	if ( defined( 'WP_SETUP_CONFIG' ) ) {
54
+			return false;
55
+	}
53 56
 
54 57
 	if ( ! defined( 'WP_INSTALLING' ) ) {
55 58
 		// prevent non-existent options from triggering multiple queries
@@ -107,11 +110,13 @@  discard block
 block discarded – undo
107 110
 	}
108 111
 
109 112
 	// If home is not set use siteurl.
110
-	if ( 'home' == $option && '' == $value )
111
-		return get_option( 'siteurl' );
113
+	if ( 'home' == $option && '' == $value ) {
114
+			return get_option( 'siteurl' );
115
+	}
112 116
 
113
-	if ( in_array( $option, array('siteurl', 'home', 'category_base', 'tag_base') ) )
114
-		$value = untrailingslashit( $value );
117
+	if ( in_array( $option, array('siteurl', 'home', 'category_base', 'tag_base') ) ) {
118
+			$value = untrailingslashit( $value );
119
+	}
115 120
 
116 121
 	/**
117 122
 	 * Filter the value of an existing option.
@@ -138,9 +143,10 @@  discard block
 block discarded – undo
138 143
  * @param string $option Option name.
139 144
  */
140 145
 function wp_protect_special_option( $option ) {
141
-	if ( 'alloptions' === $option || 'notoptions' === $option )
142
-		wp_die( sprintf( __( '%s is a protected WP option and may not be modified' ), esc_html( $option ) ) );
143
-}
146
+	if ( 'alloptions' === $option || 'notoptions' === $option ) {
147
+			wp_die( sprintf( __( '%s is a protected WP option and may not be modified' ), esc_html( $option ) ) );
148
+	}
149
+	}
144 150
 
145 151
 /**
146 152
  * Print option value after sanitizing for forms.
@@ -165,22 +171,25 @@  discard block
 block discarded – undo
165 171
 function wp_load_alloptions() {
166 172
 	global $wpdb;
167 173
 
168
-	if ( !defined( 'WP_INSTALLING' ) || !is_multisite() )
169
-		$alloptions = wp_cache_get( 'alloptions', 'options' );
170
-	else
171
-		$alloptions = false;
174
+	if ( !defined( 'WP_INSTALLING' ) || !is_multisite() ) {
175
+			$alloptions = wp_cache_get( 'alloptions', 'options' );
176
+	} else {
177
+			$alloptions = false;
178
+	}
172 179
 
173 180
 	if ( !$alloptions ) {
174 181
 		$suppress = $wpdb->suppress_errors();
175
-		if ( !$alloptions_db = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options WHERE autoload = 'yes'" ) )
176
-			$alloptions_db = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options" );
182
+		if ( !$alloptions_db = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options WHERE autoload = 'yes'" ) ) {
183
+					$alloptions_db = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options" );
184
+		}
177 185
 		$wpdb->suppress_errors($suppress);
178 186
 		$alloptions = array();
179 187
 		foreach ( (array) $alloptions_db as $o ) {
180 188
 			$alloptions[$o->option_name] = $o->option_value;
181 189
 		}
182
-		if ( !defined( 'WP_INSTALLING' ) || !is_multisite() )
183
-			wp_cache_add( 'alloptions', $alloptions, 'options' );
190
+		if ( !defined( 'WP_INSTALLING' ) || !is_multisite() ) {
191
+					wp_cache_add( 'alloptions', $alloptions, 'options' );
192
+		}
184 193
 	}
185 194
 
186 195
 	return $alloptions;
@@ -198,11 +207,13 @@  discard block
 block discarded – undo
198 207
 function wp_load_core_site_options( $site_id = null ) {
199 208
 	global $wpdb;
200 209
 
201
-	if ( !is_multisite() || wp_using_ext_object_cache() || defined( 'WP_INSTALLING' ) )
202
-		return;
210
+	if ( !is_multisite() || wp_using_ext_object_cache() || defined( 'WP_INSTALLING' ) ) {
211
+			return;
212
+	}
203 213
 
204
-	if ( empty($site_id) )
205
-		$site_id = $wpdb->siteid;
214
+	if ( empty($site_id) ) {
215
+			$site_id = $wpdb->siteid;
216
+	}
206 217
 
207 218
 	$core_options = array('site_name', 'siteurl', 'active_sitewide_plugins', '_site_transient_timeout_theme_roots', '_site_transient_theme_roots', 'site_admins', 'can_compress_scripts', 'global_terms_enabled', 'ms_files_rewriting' );
208 219
 
@@ -245,13 +256,15 @@  discard block
 block discarded – undo
245 256
 	global $wpdb;
246 257
 
247 258
 	$option = trim($option);
248
-	if ( empty($option) )
249
-		return false;
259
+	if ( empty($option) ) {
260
+			return false;
261
+	}
250 262
 
251 263
 	wp_protect_special_option( $option );
252 264
 
253
-	if ( is_object( $value ) )
254
-		$value = clone $value;
265
+	if ( is_object( $value ) ) {
266
+			$value = clone $value;
267
+	}
255 268
 
256 269
 	$value = sanitize_option( $option, $value );
257 270
 	$old_value = get_option( $option );
@@ -280,8 +293,9 @@  discard block
 block discarded – undo
280 293
 	$value = apply_filters( 'pre_update_option', $value, $option, $old_value );
281 294
 
282 295
 	// If the new and old values are the same, no need to update.
283
-	if ( $value === $old_value )
284
-		return false;
296
+	if ( $value === $old_value ) {
297
+			return false;
298
+	}
285 299
 
286 300
 	/** This filter is documented in wp-includes/option.php */
287 301
 	if ( apply_filters( 'default_option_' . $option, false ) === $old_value ) {
@@ -315,8 +329,9 @@  discard block
 block discarded – undo
315 329
 	}
316 330
 
317 331
 	$result = $wpdb->update( $wpdb->options, $update_args, array( 'option_name' => $option ) );
318
-	if ( ! $result )
319
-		return false;
332
+	if ( ! $result ) {
333
+			return false;
334
+	}
320 335
 
321 336
 	$notoptions = wp_cache_get( 'notoptions', 'options' );
322 337
 	if ( is_array( $notoptions ) && isset( $notoptions[$option] ) ) {
@@ -385,26 +400,30 @@  discard block
 block discarded – undo
385 400
 function add_option( $option, $value = '', $deprecated = '', $autoload = 'yes' ) {
386 401
 	global $wpdb;
387 402
 
388
-	if ( !empty( $deprecated ) )
389
-		_deprecated_argument( __FUNCTION__, '2.3' );
403
+	if ( !empty( $deprecated ) ) {
404
+			_deprecated_argument( __FUNCTION__, '2.3' );
405
+	}
390 406
 
391 407
 	$option = trim($option);
392
-	if ( empty($option) )
393
-		return false;
408
+	if ( empty($option) ) {
409
+			return false;
410
+	}
394 411
 
395 412
 	wp_protect_special_option( $option );
396 413
 
397
-	if ( is_object($value) )
398
-		$value = clone $value;
414
+	if ( is_object($value) ) {
415
+			$value = clone $value;
416
+	}
399 417
 
400 418
 	$value = sanitize_option( $option, $value );
401 419
 
402 420
 	// Make sure the option doesn't already exist. We can check the 'notoptions' cache before we ask for a db query
403 421
 	$notoptions = wp_cache_get( 'notoptions', 'options' );
404
-	if ( !is_array( $notoptions ) || !isset( $notoptions[$option] ) )
405
-		/** This filter is documented in wp-includes/option.php */
422
+	if ( !is_array( $notoptions ) || !isset( $notoptions[$option] ) ) {
423
+			/** This filter is documented in wp-includes/option.php */
406 424
 		if ( apply_filters( 'default_option_' . $option, false ) !== get_option( $option ) )
407 425
 			return false;
426
+	}
408 427
 
409 428
 	$serialized_value = maybe_serialize( $value );
410 429
 	$autoload = ( 'no' === $autoload || false === $autoload ) ? 'no' : 'yes';
@@ -420,8 +439,9 @@  discard block
 block discarded – undo
420 439
 	do_action( 'add_option', $option, $value );
421 440
 
422 441
 	$result = $wpdb->query( $wpdb->prepare( "INSERT INTO `$wpdb->options` (`option_name`, `option_value`, `autoload`) VALUES (%s, %s, %s) ON DUPLICATE KEY UPDATE `option_name` = VALUES(`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES(`autoload`)", $option, $serialized_value, $autoload ) );
423
-	if ( ! $result )
424
-		return false;
442
+	if ( ! $result ) {
443
+			return false;
444
+	}
425 445
 
426 446
 	if ( ! defined( 'WP_INSTALLING' ) ) {
427 447
 		if ( 'yes' == $autoload ) {
@@ -479,15 +499,17 @@  discard block
 block discarded – undo
479 499
 	global $wpdb;
480 500
 
481 501
 	$option = trim( $option );
482
-	if ( empty( $option ) )
483
-		return false;
502
+	if ( empty( $option ) ) {
503
+			return false;
504
+	}
484 505
 
485 506
 	wp_protect_special_option( $option );
486 507
 
487 508
 	// Get the ID, if no ID then return
488 509
 	$row = $wpdb->get_row( $wpdb->prepare( "SELECT autoload FROM $wpdb->options WHERE option_name = %s", $option ) );
489
-	if ( is_null( $row ) )
490
-		return false;
510
+	if ( is_null( $row ) ) {
511
+			return false;
512
+	}
491 513
 
492 514
 	/**
493 515
 	 * Fires immediately before an option is deleted.
@@ -563,8 +585,9 @@  discard block
 block discarded – undo
563 585
 		$option_timeout = '_transient_timeout_' . $transient;
564 586
 		$option = '_transient_' . $transient;
565 587
 		$result = delete_option( $option );
566
-		if ( $result )
567
-			delete_option( $option_timeout );
588
+		if ( $result ) {
589
+					delete_option( $option_timeout );
590
+		}
568 591
 	}
569 592
 
570 593
 	if ( $result ) {
@@ -610,8 +633,9 @@  discard block
 block discarded – undo
610 633
 	 *                             of the transient, and return the returned value.
611 634
 	 */
612 635
 	$pre = apply_filters( 'pre_transient_' . $transient, false );
613
-	if ( false !== $pre )
614
-		return $pre;
636
+	if ( false !== $pre ) {
637
+			return $pre;
638
+	}
615 639
 
616 640
 	if ( wp_using_ext_object_cache() ) {
617 641
 		$value = wp_cache_get( $transient, 'transient' );
@@ -631,8 +655,9 @@  discard block
 block discarded – undo
631 655
 			}
632 656
 		}
633 657
 
634
-		if ( ! isset( $value ) )
635
-			$value = get_option( $transient_option );
658
+		if ( ! isset( $value ) ) {
659
+					$value = get_option( $transient_option );
660
+		}
636 661
 	}
637 662
 
638 663
 	/**
@@ -768,8 +793,9 @@  discard block
 block discarded – undo
768 793
 		$cookie = preg_replace( '/[^A-Za-z0-9=&_]/', '', $_COOKIE['wp-settings-' . $user_id] );
769 794
 
770 795
 		// No change or both empty
771
-		if ( $cookie == $settings )
772
-			return;
796
+		if ( $cookie == $settings ) {
797
+					return;
798
+		}
773 799
 
774 800
 		$last_saved = (int) get_user_option( 'user-settings-time', $user_id );
775 801
 		$current = isset( $_COOKIE['wp-settings-time-' . $user_id]) ? preg_replace( '/[^0-9]/', '', $_COOKIE['wp-settings-time-' . $user_id] ) : 0;
@@ -987,8 +1013,9 @@  discard block
 block discarded – undo
987 1013
 	 */
988 1014
  	$pre = apply_filters( 'pre_site_option_' . $option, false );
989 1015
 
990
- 	if ( false !== $pre )
991
- 		return $pre;
1016
+ 	if ( false !== $pre ) {
1017
+ 	 		return $pre;
1018
+ 	}
992 1019
 
993 1020
 	// prevent non-existent options from triggering multiple queries
994 1021
 	$notoptions_key = "{$wpdb->siteid}:notoptions";
@@ -1016,8 +1043,9 @@  discard block
 block discarded – undo
1016 1043
 		$value = get_option($option, $default);
1017 1044
 	} else {
1018 1045
 		$cache_key = "{$wpdb->siteid}:$option";
1019
-		if ( $use_cache )
1020
-			$value = wp_cache_get($cache_key, 'site-options');
1046
+		if ( $use_cache ) {
1047
+					$value = wp_cache_get($cache_key, 'site-options');
1048
+		}
1021 1049
 
1022 1050
 		if ( !isset($value) || (false === $value) ) {
1023 1051
 			$row = $wpdb->get_row( $wpdb->prepare("SELECT meta_value FROM $wpdb->sitemeta WHERE meta_key = %s AND site_id = %d", $option, $wpdb->siteid ) );
@@ -1094,17 +1122,19 @@  discard block
 block discarded – undo
1094 1122
 
1095 1123
 		// Make sure the option doesn't already exist. We can check the 'notoptions' cache before we ask for a db query
1096 1124
 		$notoptions = wp_cache_get( $notoptions_key, 'site-options' );
1097
-		if ( ! is_array( $notoptions ) || ! isset( $notoptions[$option] ) )
1098
-			if ( false !== get_site_option( $option ) )
1125
+		if ( ! is_array( $notoptions ) || ! isset( $notoptions[$option] ) ) {
1126
+					if ( false !== get_site_option( $option ) )
1099 1127
 				return false;
1128
+		}
1100 1129
 
1101 1130
 		$value = sanitize_option( $option, $value );
1102 1131
 
1103 1132
 		$serialized_value = maybe_serialize( $value );
1104 1133
 		$result = $wpdb->insert( $wpdb->sitemeta, array('site_id' => $wpdb->siteid, 'meta_key' => $option, 'meta_value' => $serialized_value ) );
1105 1134
 
1106
-		if ( ! $result )
1107
-			return false;
1135
+		if ( ! $result ) {
1136
+					return false;
1137
+		}
1108 1138
 
1109 1139
 		wp_cache_set( $cache_key, $value, 'site-options' );
1110 1140
 
@@ -1176,8 +1206,9 @@  discard block
 block discarded – undo
1176 1206
 		$result = delete_option( $option );
1177 1207
 	} else {
1178 1208
 		$row = $wpdb->get_row( $wpdb->prepare( "SELECT meta_id FROM {$wpdb->sitemeta} WHERE meta_key = %s AND site_id = %d", $option, $wpdb->siteid ) );
1179
-		if ( is_null( $row ) || !$row->meta_id )
1180
-			return false;
1209
+		if ( is_null( $row ) || !$row->meta_id ) {
1210
+					return false;
1211
+		}
1181 1212
 		$cache_key = "{$wpdb->siteid}:$option";
1182 1213
 		wp_cache_delete( $cache_key, 'site-options' );
1183 1214
 
@@ -1245,11 +1276,13 @@  discard block
 block discarded – undo
1245 1276
 	 */
1246 1277
 	$value = apply_filters( 'pre_update_site_option_' . $option, $value, $old_value );
1247 1278
 
1248
-	if ( $value === $old_value )
1249
-		return false;
1279
+	if ( $value === $old_value ) {
1280
+			return false;
1281
+	}
1250 1282
 
1251
-	if ( false === $old_value )
1252
-		return add_site_option( $option, $value );
1283
+	if ( false === $old_value ) {
1284
+			return add_site_option( $option, $value );
1285
+	}
1253 1286
 
1254 1287
 	$notoptions_key = "{$wpdb->siteid}:notoptions";
1255 1288
 	$notoptions = wp_cache_get( $notoptions_key, 'site-options' );
@@ -1331,8 +1364,9 @@  discard block
 block discarded – undo
1331 1364
 		$option_timeout = '_site_transient_timeout_' . $transient;
1332 1365
 		$option = '_site_transient_' . $transient;
1333 1366
 		$result = delete_site_option( $option );
1334
-		if ( $result )
1335
-			delete_site_option( $option_timeout );
1367
+		if ( $result ) {
1368
+					delete_site_option( $option_timeout );
1369
+		}
1336 1370
 	}
1337 1371
 	if ( $result ) {
1338 1372
 
@@ -1380,8 +1414,9 @@  discard block
 block discarded – undo
1380 1414
 	 */
1381 1415
 	$pre = apply_filters( 'pre_site_transient_' . $transient, false );
1382 1416
 
1383
-	if ( false !== $pre )
1384
-		return $pre;
1417
+	if ( false !== $pre ) {
1418
+			return $pre;
1419
+	}
1385 1420
 
1386 1421
 	if ( wp_using_ext_object_cache() ) {
1387 1422
 		$value = wp_cache_get( $transient, 'site-transient' );
@@ -1399,8 +1434,9 @@  discard block
 block discarded – undo
1399 1434
 			}
1400 1435
 		}
1401 1436
 
1402
-		if ( ! isset( $value ) )
1403
-			$value = get_site_option( $transient_option );
1437
+		if ( ! isset( $value ) ) {
1438
+					$value = get_site_option( $transient_option );
1439
+		}
1404 1440
 	}
1405 1441
 
1406 1442
 	/**
@@ -1452,12 +1488,14 @@  discard block
 block discarded – undo
1452 1488
 		$transient_timeout = '_site_transient_timeout_' . $transient;
1453 1489
 		$option = '_site_transient_' . $transient;
1454 1490
 		if ( false === get_site_option( $option ) ) {
1455
-			if ( $expiration )
1456
-				add_site_option( $transient_timeout, time() + $expiration );
1491
+			if ( $expiration ) {
1492
+							add_site_option( $transient_timeout, time() + $expiration );
1493
+			}
1457 1494
 			$result = add_site_option( $option, $value );
1458 1495
 		} else {
1459
-			if ( $expiration )
1460
-				update_site_option( $transient_timeout, time() + $expiration );
1496
+			if ( $expiration ) {
1497
+							update_site_option( $transient_timeout, time() + $expiration );
1498
+			}
1461 1499
 			$result = update_site_option( $option, $value );
1462 1500
 		}
1463 1501
 	}
Please login to merge, or discard this patch.
src/wp-includes/class-wp-http-ixr-client.php 3 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * WP_HTTP_IXR_Client
4
- *
5
- * @package WordPress
6
- * @since 3.1.0
7
- *
8
- */
3
+	 * WP_HTTP_IXR_Client
4
+	 *
5
+	 * @package WordPress
6
+	 * @since 3.1.0
7
+	 *
8
+	 */
9 9
 class WP_HTTP_IXR_Client extends IXR_Client {
10 10
 	public $scheme;
11 11
 	/**
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -20,21 +20,21 @@  discard block
 block discarded – undo
20 20
 	 * @param int $timeout
21 21
 	 */
22 22
 	public function __construct($server, $path = false, $port = false, $timeout = 15) {
23
-		if ( ! $path ) {
23
+		if ( ! $path) {
24 24
 			// Assume we have been given a URL instead
25 25
 			$bits = parse_url($server);
26 26
 			$this->scheme = $bits['scheme'];
27 27
 			$this->server = $bits['host'];
28 28
 			$this->port = isset($bits['port']) ? $bits['port'] : $port;
29
-			$this->path = !empty($bits['path']) ? $bits['path'] : '/';
29
+			$this->path = ! empty($bits['path']) ? $bits['path'] : '/';
30 30
 
31 31
 			// Make absolutely sure we have a path
32
-			if ( ! $this->path ) {
32
+			if ( ! $this->path) {
33 33
 				$this->path = '/';
34 34
 			}
35 35
 
36
-			if ( ! empty( $bits['query'] ) ) {
37
-				$this->path .= '?' . $bits['query'];
36
+			if ( ! empty($bits['query'])) {
37
+				$this->path .= '?'.$bits['query'];
38 38
 			}
39 39
 		} else {
40 40
 			$this->scheme = 'http';
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 		$xml = $request->getXml();
57 57
 
58 58
 		$port = $this->port ? ":$this->port" : '';
59
-		$url = $this->scheme . '://' . $this->server . $port . $this->path;
59
+		$url = $this->scheme.'://'.$this->server.$port.$this->path;
60 60
 		$args = array(
61 61
 			'headers'    => array('Content-Type' => 'text/xml'),
62 62
 			'user-agent' => $this->useragent,
@@ -64,43 +64,43 @@  discard block
 block discarded – undo
64 64
 		);
65 65
 
66 66
 		// Merge Custom headers ala #8145
67
-		foreach ( $this->headers as $header => $value )
67
+		foreach ($this->headers as $header => $value)
68 68
 			$args['headers'][$header] = $value;
69 69
 
70
-		if ( $this->timeout !== false )
70
+		if ($this->timeout !== false)
71 71
 			$args['timeout'] = $this->timeout;
72 72
 
73 73
 		// Now send the request
74
-		if ( $this->debug )
75
-			echo '<pre class="ixr_request">' . htmlspecialchars($xml) . "\n</pre>\n\n";
74
+		if ($this->debug)
75
+			echo '<pre class="ixr_request">'.htmlspecialchars($xml)."\n</pre>\n\n";
76 76
 
77 77
 		$response = wp_remote_post($url, $args);
78 78
 
79
-		if ( is_wp_error($response) ) {
79
+		if (is_wp_error($response)) {
80 80
 			$errno    = $response->get_error_code();
81 81
 			$errorstr = $response->get_error_message();
82 82
 			$this->error = new IXR_Error(-32300, "transport error: $errno $errorstr");
83 83
 			return false;
84 84
 		}
85 85
 
86
-		if ( 200 != wp_remote_retrieve_response_code( $response ) ) {
87
-			$this->error = new IXR_Error(-32301, 'transport error - HTTP status code was not 200 (' . wp_remote_retrieve_response_code( $response ) . ')');
86
+		if (200 != wp_remote_retrieve_response_code($response)) {
87
+			$this->error = new IXR_Error(-32301, 'transport error - HTTP status code was not 200 ('.wp_remote_retrieve_response_code($response).')');
88 88
 			return false;
89 89
 		}
90 90
 
91
-		if ( $this->debug )
92
-			echo '<pre class="ixr_response">' . htmlspecialchars( wp_remote_retrieve_body( $response ) ) . "\n</pre>\n\n";
91
+		if ($this->debug)
92
+			echo '<pre class="ixr_response">'.htmlspecialchars(wp_remote_retrieve_body($response))."\n</pre>\n\n";
93 93
 
94 94
 		// Now parse what we've got back
95
-		$this->message = new IXR_Message( wp_remote_retrieve_body( $response ) );
96
-		if ( ! $this->message->parse() ) {
95
+		$this->message = new IXR_Message(wp_remote_retrieve_body($response));
96
+		if ( ! $this->message->parse()) {
97 97
 			// XML error
98 98
 			$this->error = new IXR_Error(-32700, 'parse error. not well formed');
99 99
 			return false;
100 100
 		}
101 101
 
102 102
 		// Is the message a fault?
103
-		if ( $this->message->messageType == 'fault' ) {
103
+		if ($this->message->messageType == 'fault') {
104 104
 			$this->error = new IXR_Error($this->message->faultCode, $this->message->faultString);
105 105
 			return false;
106 106
 		}
Please login to merge, or discard this patch.
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -64,15 +64,18 @@  discard block
 block discarded – undo
64 64
 		);
65 65
 
66 66
 		// Merge Custom headers ala #8145
67
-		foreach ( $this->headers as $header => $value )
68
-			$args['headers'][$header] = $value;
67
+		foreach ( $this->headers as $header => $value ) {
68
+					$args['headers'][$header] = $value;
69
+		}
69 70
 
70
-		if ( $this->timeout !== false )
71
-			$args['timeout'] = $this->timeout;
71
+		if ( $this->timeout !== false ) {
72
+					$args['timeout'] = $this->timeout;
73
+		}
72 74
 
73 75
 		// Now send the request
74
-		if ( $this->debug )
75
-			echo '<pre class="ixr_request">' . htmlspecialchars($xml) . "\n</pre>\n\n";
76
+		if ( $this->debug ) {
77
+					echo '<pre class="ixr_request">' . htmlspecialchars($xml) . "\n</pre>\n\n";
78
+		}
76 79
 
77 80
 		$response = wp_remote_post($url, $args);
78 81
 
@@ -88,8 +91,9 @@  discard block
 block discarded – undo
88 91
 			return false;
89 92
 		}
90 93
 
91
-		if ( $this->debug )
92
-			echo '<pre class="ixr_response">' . htmlspecialchars( wp_remote_retrieve_body( $response ) ) . "\n</pre>\n\n";
94
+		if ( $this->debug ) {
95
+					echo '<pre class="ixr_response">' . htmlspecialchars( wp_remote_retrieve_body( $response ) ) . "\n</pre>\n\n";
96
+		}
93 97
 
94 98
 		// Now parse what we've got back
95 99
 		$this->message = new IXR_Message( wp_remote_retrieve_body( $response ) );
Please login to merge, or discard this patch.
src/wp-includes/js/tinymce/wp-tinymce.php 3 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Disable error reporting
4
- *
5
- * Set this to error_reporting( -1 ) for debugging.
6
- */
3
+	 * Disable error reporting
4
+	 *
5
+	 * Set this to error_reporting( -1 ) for debugging.
6
+	 */
7 7
 error_reporting(0);
8 8
 
9 9
 $basepath = dirname(__FILE__);
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -10,10 +10,10 @@  discard block
 block discarded – undo
10 10
 
11 11
 function get_file($path) {
12 12
 
13
-	if ( function_exists('realpath') )
13
+	if (function_exists('realpath'))
14 14
 		$path = realpath($path);
15 15
 
16
-	if ( ! $path || ! @is_file($path) )
16
+	if ( ! $path || ! @is_file($path))
17 17
 		return false;
18 18
 
19 19
 	return @file_get_contents($path);
@@ -23,17 +23,17 @@  discard block
 block discarded – undo
23 23
 
24 24
 header('Content-Type: application/javascript; charset=UTF-8');
25 25
 header('Vary: Accept-Encoding'); // Handle proxies
26
-header('Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expires_offset ) . ' GMT');
26
+header('Expires: '.gmdate("D, d M Y H:i:s", time() + $expires_offset).' GMT');
27 27
 header("Cache-Control: public, max-age=$expires_offset");
28 28
 
29
-if ( isset($_GET['c']) && 1 == $_GET['c'] && isset($_SERVER['HTTP_ACCEPT_ENCODING'])
30
-	&& false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') && ( $file = get_file($basepath . '/wp-tinymce.js.gz') ) ) {
29
+if (isset($_GET['c']) && 1 == $_GET['c'] && isset($_SERVER['HTTP_ACCEPT_ENCODING'])
30
+	&& false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') && ($file = get_file($basepath.'/wp-tinymce.js.gz'))) {
31 31
 
32 32
 	header('Content-Encoding: gzip');
33 33
 	echo $file;
34 34
 } else {
35 35
 	// Back compat. This file shouldn't be used if this condition can occur (as in, if gzip isn't accepted).
36
-	echo get_file( $basepath . '/tinymce.min.js' );
37
-	echo get_file( $basepath . '/plugins/compat3x/plugin.min.js' );
36
+	echo get_file($basepath.'/tinymce.min.js');
37
+	echo get_file($basepath.'/plugins/compat3x/plugin.min.js');
38 38
 }
39 39
 exit;
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -10,11 +10,13 @@
 block discarded – undo
10 10
 
11 11
 function get_file($path) {
12 12
 
13
-	if ( function_exists('realpath') )
14
-		$path = realpath($path);
13
+	if ( function_exists('realpath') ) {
14
+			$path = realpath($path);
15
+	}
15 16
 
16
-	if ( ! $path || ! @is_file($path) )
17
-		return false;
17
+	if ( ! $path || ! @is_file($path) ) {
18
+			return false;
19
+	}
18 20
 
19 21
 	return @file_get_contents($path);
20 22
 }
Please login to merge, or discard this patch.