<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[12735] trunk: Coding style</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/12735">12735</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2010-01-15 23:40:29 +0000 (Fri, 15 Jan 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Coding style</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwploginphp">trunk/wp-login.php</a></li>
<li><a href="#trunkwpsettingsphp">trunk/wp-settings.php</a></li>
<li><a href="#trunkwpsignupphp">trunk/wp-signup.php</a></li>
<li><a href="#trunkxmlrpcphp">trunk/xmlrpc.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwploginphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-login.php (12734 => 12735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-login.php        2010-01-15 22:25:40 UTC (rev 12734)
+++ trunk/wp-login.php        2010-01-15 23:40:29 UTC (rev 12735)
</span><span class="lines">@@ -74,7 +74,7 @@
</span><span class="cx">         do_action('login_head'); ?&gt;
</span><span class="cx"> &lt;/head&gt;
</span><span class="cx"> &lt;body class=&quot;login&quot;&gt;
</span><del>-&lt;?php   if( !is_multisite() ) { ?&gt;
</del><ins>+&lt;?php   if ( !is_multisite() ) { ?&gt;
</ins><span class="cx"> &lt;div id=&quot;login&quot;&gt;&lt;h1&gt;&lt;a href=&quot;&lt;?php echo apply_filters('login_headerurl', 'http://wordpress.org/'); ?&gt;&quot; title=&quot;&lt;?php echo apply_filters('login_headertitle', __('Powered by WordPress')); ?&gt;&quot;&gt;&lt;?php bloginfo('name'); ?&gt;&lt;/a&gt;&lt;/h1&gt;
</span><span class="cx"> &lt;?php   } else { ?&gt;
</span><span class="cx"> &lt;div id=&quot;login&quot;&gt;&lt;h1&gt;&lt;a href=&quot;&lt;?php echo apply_filters('login_headerurl', 'http://' . $current_site-&gt;domain . $current_site-&gt;path ); ?&gt;&quot; title=&quot;&lt;?php echo apply_filters('login_headertitle', $current_site-&gt;site_name ); ?&gt;&quot;&gt;&lt;span class=&quot;hide&quot;&gt;&lt;?php bloginfo('name'); ?&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h1&gt;
</span><span class="lines">@@ -165,18 +165,16 @@
</span><span class="cx">                 $wpdb-&gt;update($wpdb-&gt;users, array('user_activation_key' =&gt; $key), array('user_login' =&gt; $user_login));
</span><span class="cx">         }
</span><span class="cx">         $message = __('Someone has asked to reset the password for the following site and username.') . &quot;\r\n\r\n&quot;;
</span><del>-        if( !is_multisite() ) {
</del><ins>+        if ( !is_multisite() )
</ins><span class="cx">                 $message .= get_option('siteurl') . &quot;\r\n\r\n&quot;;
</span><del>-        } else {
</del><ins>+        else
</ins><span class="cx">                     $message .= 'http://' . trailingslashit( $current_site-&gt;domain . $current_site-&gt;path ) . &quot;\r\n\r\n&quot;;
</span><del>-        }
</del><span class="cx">         $message .= sprintf(__('Username: %s'), $user_login) . &quot;\r\n\r\n&quot;;
</span><span class="cx">         $message .= __('To reset your password visit the following address, otherwise just ignore this email and nothing will happen.') . &quot;\r\n\r\n&quot;;
</span><del>-        if( !is_multisite() ) {
</del><ins>+        if ( !is_multisite() )
</ins><span class="cx">                 $message .= site_url(&quot;wp-login.php?action=rp&amp;key=$key&amp;login=&quot; . rawurlencode($user_login), 'login') . &quot;\r\n&quot;;
</span><del>-        } else {
</del><ins>+        else
</ins><span class="cx">                 $message .= 'http://' . trailingslashit( $current_site-&gt;domain . $current_site-&gt;path ) . &quot;wp-login.php?action=rp&amp;key=$key&amp;login=&quot; . rawurlencode($user_login) . &quot;\r\n&quot;;
</span><del>-        }
</del><span class="cx"> 
</span><span class="cx">         // The blogname option is escaped with esc_html on the way into the database in sanitize_option
</span><span class="cx">         // we want to reverse this for the plain text arena of emails.
</span><span class="lines">@@ -409,11 +407,12 @@
</span><span class="cx"> break;
</span><span class="cx"> 
</span><span class="cx"> case 'register' :
</span><del>-        if( is_multisite() ) {
-                    // WPMU doesn't use this
-                wp_redirect( apply_filters( 'wp_signup_location', get_bloginfo('wpurl') . '/wp-signup.php' ) );
-                exit;
-        }
</del><ins>+        if ( is_multixsite() ) {
+                // WPMU doesn't use this
+                wp_redirect( apply_filters( 'wp_signup_location', get_bloginfo('wpurl') . '/wp-signup.php' ) );
+                exit;
+        }
+
</ins><span class="cx">         if ( !get_option('users_can_register') ) {
</span><span class="cx">                 wp_redirect('wp-login.php?registration=disabled');
</span><span class="cx">                 exit();
</span></span></pre></div>
<a id="trunkwpsettingsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-settings.php (12734 => 12735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-settings.php        2010-01-15 22:25:40 UTC (rev 12734)
+++ trunk/wp-settings.php        2010-01-15 23:40:29 UTC (rev 12735)
</span><span class="lines">@@ -57,7 +57,7 @@
</span><span class="cx"> 
</span><span class="cx"> wp_start_object_cache();
</span><span class="cx"> 
</span><del>-if( is_multisite() )
</del><ins>+if ( is_multisite() )
</ins><span class="cx">     require (ABSPATH . WPINC . '/ms-load.php');
</span><span class="cx"> 
</span><span class="cx"> require (ABSPATH . WPINC . '/plugin.php');
</span></span></pre></div>
<a id="trunkwpsignupphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-signup.php (12734 => 12735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-signup.php        2010-01-15 22:25:40 UTC (rev 12734)
+++ trunk/wp-signup.php        2010-01-15 23:40:29 UTC (rev 12735)
</span><span class="lines">@@ -8,7 +8,7 @@
</span><span class="cx"> require( 'wp-blog-header.php' );
</span><span class="cx"> require_once( ABSPATH . WPINC . '/registration.php' );
</span><span class="cx"> 
</span><del>-if( is_array( get_site_option( 'illegal_names' )) &amp;&amp; $_GET[ 'new' ] != '' &amp;&amp; in_array( $_GET[ 'new' ], get_site_option( 'illegal_names' ) ) == true ) {
</del><ins>+if ( is_array( get_site_option( 'illegal_names' )) &amp;&amp; $_GET[ 'new' ] != '' &amp;&amp; in_array( $_GET[ 'new' ], get_site_option( 'illegal_names' ) ) == true ) {
</ins><span class="cx">         wp_redirect( &quot;http://{$current_site-&gt;domain}{$current_site-&gt;path}&quot; );
</span><span class="cx">         die();
</span><span class="cx"> }
</span><span class="lines">@@ -22,7 +22,7 @@
</span><span class="cx">         echo &quot;&lt;meta name='robots' content='noindex,nofollow' /&gt;\n&quot;;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-if( $current_blog-&gt;domain . $current_blog-&gt;path != $current_site-&gt;domain . $current_site-&gt;path ) {
</del><ins>+if ( $current_blog-&gt;domain . $current_blog-&gt;path != $current_site-&gt;domain . $current_site-&gt;path ) {
</ins><span class="cx">         wp_redirect( &quot;http://&quot; . $current_site-&gt;domain . $current_site-&gt;path . &quot;wp-signup.php&quot; );
</span><span class="cx">         die();
</span><span class="cx"> }
</span><span class="lines">@@ -56,7 +56,7 @@
</span><span class="cx"> function show_blog_form($blogname = '', $blog_title = '', $errors = '') {
</span><span class="cx">         global $current_site;
</span><span class="cx">         // Blog name
</span><del>-        if( !is_subdomain_install() )
</del><ins>+        if ( !is_subdomain_install() )
</ins><span class="cx">                 echo '&lt;label for=&quot;blogname&quot;&gt;' . __('Blog Name:') . '&lt;/label&gt;';
</span><span class="cx">         else
</span><span class="cx">                 echo '&lt;label for=&quot;blogname&quot;&gt;' . __('Blog Domain:') . '&lt;/label&gt;';
</span><span class="lines">@@ -65,18 +65,17 @@
</span><span class="cx">                 &lt;p class=&quot;error&quot;&gt;&lt;?php echo $errmsg ?&gt;&lt;/p&gt;
</span><span class="cx">         &lt;?php }
</span><span class="cx"> 
</span><del>-        if( !is_subdomain_install() ) {
</del><ins>+        if ( !is_subdomain_install() )
</ins><span class="cx">                 echo '&lt;span class=&quot;prefix_address&quot;&gt;' . $current_site-&gt;domain . $current_site-&gt;path . '&lt;/span&gt;&lt;input name=&quot;blogname&quot; type=&quot;text&quot; id=&quot;blogname&quot; value=&quot;'. esc_attr($blogname) .'&quot; maxlength=&quot;50&quot; /&gt;&lt;br /&gt;';
</span><del>-        } else {
</del><ins>+        else
</ins><span class="cx">                 echo '&lt;input name=&quot;blogname&quot; type=&quot;text&quot; id=&quot;blogname&quot; value=&quot;'.esc_attr($blogname).'&quot; maxlength=&quot;50&quot; /&gt;&lt;span class=&quot;suffix_address&quot;&gt;.' . $current_site-&gt;domain . $current_site-&gt;path . '&lt;/span&gt;&lt;br /&gt;';
</span><del>-        }
</del><ins>+
</ins><span class="cx">         if ( !is_user_logged_in() ) {
</span><span class="cx">                 print '(&lt;strong&gt;' . __( 'Your address will be ' );
</span><del>-                if( !is_subdomain_install() ) {
</del><ins>+                if ( !is_subdomain_install() )
</ins><span class="cx">                         print $current_site-&gt;domain . $current_site-&gt;path . __( 'blogname' );
</span><del>-                } else {
</del><ins>+                else
</ins><span class="cx">                         print __( 'domain.' ) . $current_site-&gt;domain . $current_site-&gt;path;
</span><del>-                }
</del><span class="cx">                 echo '.&lt;/strong&gt; ' . __( 'Must be at least 4 characters, letters and numbers only. It cannot be changed so choose carefully!)' ) . '&lt;/p&gt;';
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -95,11 +94,11 @@
</span><span class="cx">             &lt;?php _e('I would like my blog to appear in search engines like Google and Technorati, and in public listings around this site.'); ?&gt;
</span><span class="cx">             &lt;div style=&quot;clear:both;&quot;&gt;&lt;/div&gt;
</span><span class="cx">             &lt;label class=&quot;checkbox&quot; for=&quot;blog_public_on&quot;&gt;
</span><del>-                &lt;input type=&quot;radio&quot; id=&quot;blog_public_on&quot; name=&quot;blog_public&quot; value=&quot;1&quot; &lt;?php if( !isset( $_POST['blog_public'] ) || $_POST['blog_public'] == '1' ) { ?&gt;checked=&quot;checked&quot;&lt;?php } ?&gt; /&gt;
</del><ins>+                &lt;input type=&quot;radio&quot; id=&quot;blog_public_on&quot; name=&quot;blog_public&quot; value=&quot;1&quot; &lt;?php if ( !isset( $_POST['blog_public'] ) || $_POST['blog_public'] == '1' ) { ?&gt;checked=&quot;checked&quot;&lt;?php } ?&gt; /&gt;
</ins><span class="cx">                 &lt;strong&gt;&lt;?php _e( 'Yes' ); ?&gt;&lt;/strong&gt;
</span><span class="cx">             &lt;/label&gt;
</span><span class="cx">             &lt;label class=&quot;checkbox&quot; for=&quot;blog_public_off&quot;&gt;
</span><del>-                &lt;input type=&quot;radio&quot; id=&quot;blog_public_off&quot; name=&quot;blog_public&quot; value=&quot;0&quot; &lt;?php if( isset( $_POST['blog_public'] ) &amp;&amp; $_POST['blog_public'] == '0' ) { ?&gt;checked=&quot;checked&quot;&lt;?php } ?&gt; /&gt;
</del><ins>+                &lt;input type=&quot;radio&quot; id=&quot;blog_public_off&quot; name=&quot;blog_public&quot; value=&quot;0&quot; &lt;?php if ( isset( $_POST['blog_public'] ) &amp;&amp; $_POST['blog_public'] == '0' ) { ?&gt;checked=&quot;checked&quot;&lt;?php } ?&gt; /&gt;
</ins><span class="cx">                 &lt;strong&gt;&lt;?php _e( 'No' ); ?&gt;&lt;/strong&gt;
</span><span class="cx">             &lt;/label&gt;
</span><span class="cx">         &lt;/p&gt;
</span><span class="lines">@@ -190,7 +189,7 @@
</span><span class="cx"> function validate_another_blog_signup() {
</span><span class="cx">         global $wpdb, $current_user, $blogname, $blog_title, $errors, $domain, $path;
</span><span class="cx">         $current_user = wp_get_current_user();
</span><del>-        if( !is_user_logged_in() )
</del><ins>+        if ( !is_user_logged_in() )
</ins><span class="cx">                 die();
</span><span class="cx"> 
</span><span class="cx">         $result = validate_blog_form();
</span><span class="lines">@@ -225,11 +224,10 @@
</span><span class="cx"> 
</span><span class="cx">         if ( !is_wp_error($errors) )
</span><span class="cx">                 $errors = new WP_Error();
</span><del>-        if( isset( $_POST[ 'signup_for' ] ) ) {
</del><ins>+        if ( isset( $_POST[ 'signup_for' ] ) )
</ins><span class="cx">                 $signup[ wp_specialchars( $_POST[ 'signup_for' ] ) ] = 'checked=&quot;checked&quot;';
</span><del>-        } else {
</del><ins>+        else
</ins><span class="cx">                 $signup[ 'blog' ] = 'checked=&quot;checked&quot;';
</span><del>-        }
</del><span class="cx"> 
</span><span class="cx">         // allow definition of default variables
</span><span class="cx">         $filtered_results = apply_filters('signup_user_init', array('user_name' =&gt; $user_name, 'user_email' =&gt; $user_email, 'errors' =&gt; $errors ));
</span><span class="lines">@@ -246,9 +244,9 @@
</span><span class="cx">                 &lt;?php show_user_form($user_name, $user_email, $errors); ?&gt;
</span><span class="cx"> 
</span><span class="cx">                 &lt;p&gt;
</span><del>-                &lt;?php if( $active_signup == 'blog' ) { ?&gt;
</del><ins>+                &lt;?php if ( $active_signup == 'blog' ) { ?&gt;
</ins><span class="cx">                         &lt;input id=&quot;signupblog&quot; type=&quot;hidden&quot; name=&quot;signup_for&quot; value=&quot;blog&quot; /&gt;
</span><del>-                &lt;?php } elseif( $active_signup == 'user' ) { ?&gt;
</del><ins>+                &lt;?php } elseif ( $active_signup == 'user' ) { ?&gt;
</ins><span class="cx">                         &lt;input id=&quot;signupblog&quot; type=&quot;hidden&quot; name=&quot;signup_for&quot; value=&quot;user&quot; /&gt;
</span><span class="cx">                 &lt;?php } else { ?&gt;
</span><span class="cx">                         &lt;input id=&quot;signupblog&quot; type=&quot;radio&quot; name=&quot;signup_for&quot; value=&quot;blog&quot; &lt;?php echo $signup['blog'] ?&gt; /&gt;
</span><span class="lines">@@ -369,25 +367,24 @@
</span><span class="cx"> 
</span><span class="cx"> // Main
</span><span class="cx"> $active_signup = get_site_option( 'registration' );
</span><del>-if( !$active_signup )
</del><ins>+if ( !$active_signup )
</ins><span class="cx">         $active_signup = 'all';
</span><span class="cx"> 
</span><span class="cx"> $active_signup = apply_filters( 'wpmu_active_signup', $active_signup ); // return &quot;all&quot;, &quot;none&quot;, &quot;blog&quot; or &quot;user&quot;
</span><span class="cx"> 
</span><del>-if( is_super_admin() )
</del><ins>+if ( is_super_admin() )
</ins><span class="cx">         echo '&lt;div class=&quot;mu_alert&quot;&gt;' . sprintf( __( &quot;Greetings Site Administrator! You are currently allowing '%s' registrations. To change or disable registration go to your &lt;a href='wp-admin/ms-options.php'&gt;Options page&lt;/a&gt;.&quot; ), $active_signup ) . '&lt;/div&gt;';
</span><span class="cx"> 
</span><span class="cx"> $newblogname = isset($_GET['new']) ? strtolower(preg_replace('/^-|-$|[^-a-zA-Z0-9]/', '', $_GET['new'])) : null;
</span><span class="cx"> 
</span><span class="cx"> $current_user = wp_get_current_user();
</span><del>-if( $active_signup == &quot;none&quot; ) {
</del><ins>+if ( $active_signup == &quot;none&quot; ) {
</ins><span class="cx">         _e( &quot;Registration has been disabled.&quot; );
</span><del>-} elseif( $active_signup == 'blog' &amp;&amp; !is_user_logged_in() ){
-        if( is_ssl() ) {
</del><ins>+} elseif ( $active_signup == 'blog' &amp;&amp; !is_user_logged_in() ) {
+        if ( is_ssl() )
</ins><span class="cx">                 $proto = 'https://';
</span><del>-        } else {
</del><ins>+        else
</ins><span class="cx">                 $proto = 'http://';
</span><del>-        }
</del><span class="cx">         $login_url = site_url( 'wp-login.php?redirect_to=' . urlencode($proto . $_SERVER['HTTP_HOST'] . '/wp-signup.php' ));
</span><span class="cx">         echo sprintf( __( &quot;You must first &lt;a href=\&quot;%s\&quot;&gt;login&lt;/a&gt;, and then you can create a new blog.&quot;), $login_url );
</span><span class="cx"> } else {
</span><span class="lines">@@ -399,7 +396,7 @@
</span><span class="cx">                                 _e( &quot;User registration has been disabled.&quot; );
</span><span class="cx">                 break;
</span><span class="cx">                 case 'validate-blog-signup':
</span><del>-                        if( $active_signup == 'all' || $active_signup == 'blog' )
</del><ins>+                        if ( $active_signup == 'all' || $active_signup == 'blog' )
</ins><span class="cx">                                 validate_blog_signup();
</span><span class="cx">                         else
</span><span class="cx">                                 _e( &quot;Blog registration has been disabled.&quot; );
</span><span class="lines">@@ -410,21 +407,21 @@
</span><span class="cx">                 default :
</span><span class="cx">                         $user_email = $_POST[ 'user_email' ];
</span><span class="cx">                         do_action( &quot;preprocess_signup_form&quot; ); // populate the form from invites, elsewhere?
</span><del>-                        if ( is_user_logged_in() &amp;&amp; ( $active_signup == 'all' || $active_signup == 'blog' ) ) {
</del><ins>+                        if ( is_user_logged_in() &amp;&amp; ( $active_signup == 'all' || $active_signup == 'blog' ) )
</ins><span class="cx">                                 signup_another_blog($newblogname);
</span><del>-                        } elseif( is_user_logged_in() == false &amp;&amp; ( $active_signup == 'all' || $active_signup == 'user' ) ) {
</del><ins>+                        elseif( is_user_logged_in() == false &amp;&amp; ( $active_signup == 'all' || $active_signup == 'user' ) )
</ins><span class="cx">                                 signup_user( $newblogname, $user_email );
</span><del>-                        } elseif( is_user_logged_in() == false &amp;&amp; ( $active_signup == 'blog' ) ) {
</del><ins>+                        elseif( is_user_logged_in() == false &amp;&amp; ( $active_signup == 'blog' ) )
</ins><span class="cx">                                 _e( &quot;I'm sorry. We're not accepting new registrations at this time.&quot; );
</span><del>-                        } else {
</del><ins>+                        else
</ins><span class="cx">                                 _e( &quot;You're logged in already. No need to register again!&quot; );
</span><del>-                        }
</del><ins>+
</ins><span class="cx">                         if ($newblogname) {
</span><del>-                                if( !is_subdomain_install() )
</del><ins>+                                if ( !is_subdomain_install() )
</ins><span class="cx">                                         $newblog = 'http://' . $current_site-&gt;domain . $current_site-&gt;path . $newblogname . '/';
</span><span class="cx">                                 else
</span><span class="cx">                                         $newblog = 'http://' . $newblogname . '.' . $current_site-&gt;domain . $current_site-&gt;path;
</span><del>-                                if ($active_signup == 'blog' || $active_signup == 'all')
</del><ins>+                                if ( $active_signup == 'blog' || $active_signup == 'all' )
</ins><span class="cx">                                         printf(__(&quot;&lt;p&gt;&lt;em&gt;The blog you were looking for, &lt;strong&gt;%s&lt;/strong&gt; doesn't exist but you can create it now!&lt;/em&gt;&lt;/p&gt;&quot;), $newblog );
</span><span class="cx">                                 else
</span><span class="cx">                                         printf(__(&quot;&lt;p&gt;&lt;em&gt;The blog you were looking for, &lt;strong&gt;%s&lt;/strong&gt; doesn't exist.&lt;/em&gt;&lt;/p&gt;&quot;), $newblog );
</span></span></pre></div>
<a id="trunkxmlrpcphp"></a>
<div class="modfile"><h4>Modified: trunk/xmlrpc.php (12734 => 12735)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/xmlrpc.php        2010-01-15 22:25:40 UTC (rev 12734)
+++ trunk/xmlrpc.php        2010-01-15 23:40:29 UTC (rev 12735)
</span><span class="lines">@@ -294,14 +294,13 @@
</span><span class="cx">         function escape(&amp;$array) {
</span><span class="cx">                 global $wpdb;
</span><span class="cx"> 
</span><del>-                if(!is_array($array)) {
</del><ins>+                if (!is_array($array)) {
</ins><span class="cx">                         return($wpdb-&gt;escape($array));
</span><del>-                }
-                else {
</del><ins>+                } else {
</ins><span class="cx">                         foreach ( (array) $array as $k =&gt; $v ) {
</span><del>-                                if (is_array($v)) {
</del><ins>+                                if ( is_array($v) ) {
</ins><span class="cx">                                         $this-&gt;escape($array[$k]);
</span><del>-                                } else if (is_object($v)) {
</del><ins>+                                } else if ( is_object($v) ) {
</ins><span class="cx">                                         //skip
</span><span class="cx">                                 } else {
</span><span class="cx">                                         $array[$k] = $wpdb-&gt;escape($v);
</span><span class="lines">@@ -443,7 +442,7 @@
</span><span class="cx">          */
</span><span class="cx">         function wp_getUsersBlogs( $args ) {
</span><span class="cx">                 // If this isn't on WPMU then just use blogger_getUsersBlogs
</span><del>-                if( !is_multisite() ) {
</del><ins>+                if ( !is_multisite() ) {
</ins><span class="cx">                         array_unshift( $args, 1 );
</span><span class="cx">                         return $this-&gt;blogger_getUsersBlogs( $args );
</span><span class="cx">                 }
</span><span class="lines">@@ -462,9 +461,9 @@
</span><span class="cx">                 $blogs = (array) get_blogs_of_user( $user-&gt;ID );
</span><span class="cx">                 $struct = array( );
</span><span class="cx"> 
</span><del>-                foreach( $blogs as $blog ) {
</del><ins>+                foreach ( $blogs as $blog ) {
</ins><span class="cx">                         // Don't include blogs that aren't hosted at this site
</span><del>-                        if( $blog-&gt;site_id != $current_site-&gt;id )
</del><ins>+                        if ( $blog-&gt;site_id != $current_site-&gt;id )
</ins><span class="cx">                                 continue;
</span><span class="cx"> 
</span><span class="cx">                         $blog_id = $blog-&gt;userblog_id;
</span><span class="lines">@@ -505,7 +504,7 @@
</span><span class="cx">                         return $this-&gt;error;
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                if( !current_user_can( 'edit_page', $page_id ) )
</del><ins>+                if ( !current_user_can( 'edit_page', $page_id ) )
</ins><span class="cx">                         return new IXR_Error( 401, __( 'Sorry, you cannot edit this page.' ) );
</span><span class="cx"> 
</span><span class="cx">                 do_action('xmlrpc_call', 'wp.getPage');
</span><span class="lines">@@ -514,14 +513,14 @@
</span><span class="cx">                 $page = get_page($page_id);
</span><span class="cx"> 
</span><span class="cx">                 // If we found the page then format the data.
</span><del>-                if($page-&gt;ID &amp;&amp; ($page-&gt;post_type == &quot;page&quot;)) {
</del><ins>+                if ( $page-&gt;ID &amp;&amp; ($page-&gt;post_type == &quot;page&quot;) ) {
</ins><span class="cx">                         // Get all of the page content and link.
</span><span class="cx">                         $full_page = get_extended($page-&gt;post_content);
</span><span class="cx">                         $link = post_permalink($page-&gt;ID);
</span><span class="cx"> 
</span><span class="cx">                         // Get info the page parent if there is one.
</span><span class="cx">                         $parent_title = &quot;&quot;;
</span><del>-                        if(!empty($page-&gt;post_parent)) {
</del><ins>+                        if ( !empty($page-&gt;post_parent) ) {
</ins><span class="cx">                                 $parent = get_page($page-&gt;post_parent);
</span><span class="cx">                                 $parent_title = $parent-&gt;post_title;
</span><span class="cx">                         }
</span><span class="lines">@@ -535,13 +534,12 @@
</span><span class="cx">                         $page_date_gmt = mysql2date(&quot;Ymd\TH:i:s&quot;, $page-&gt;post_date_gmt, false);
</span><span class="cx"> 
</span><span class="cx">                         // For drafts use the GMT version of the date
</span><del>-                        if ( $page-&gt;post_status == 'draft' ) {
</del><ins>+                        if ( $page-&gt;post_status == 'draft' )
</ins><span class="cx">                                 $page_date_gmt = get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $page-&gt;post_date ), 'Ymd\TH:i:s' );
</span><del>-                        }
</del><span class="cx"> 
</span><span class="cx">                         // Pull the categories info together.
</span><span class="cx">                         $categories = array();
</span><del>-                        foreach(wp_get_post_categories($page-&gt;ID) as $cat_id) {
</del><ins>+                        foreach ( wp_get_post_categories($page-&gt;ID) as $cat_id ) {
</ins><span class="cx">                                 $categories[] = get_cat_name($cat_id);
</span><span class="cx">                         }
</span><span class="cx"> 
</span><span class="lines">@@ -549,7 +547,7 @@
</span><span class="cx">                         $author = get_userdata($page-&gt;post_author);
</span><span class="cx"> 
</span><span class="cx">                         $page_template = get_post_meta( $page-&gt;ID, '_wp_page_template', true );
</span><del>-                        if( empty( $page_template ) )
</del><ins>+                        if ( empty( $page_template ) )
</ins><span class="cx">                                 $page_template = 'default';
</span><span class="cx"> 
</span><span class="cx">                         $page_struct = array(
</span><span class="lines">@@ -603,11 +601,10 @@
</span><span class="cx">                 $password        = $args[2];
</span><span class="cx">                 $num_pages        = isset($args[3]) ? (int) $args[3] : 10;
</span><span class="cx"> 
</span><del>-                if ( !$user = $this-&gt;login($username, $password) ) {
</del><ins>+                if ( !$user = $this-&gt;login($username, $password) )
</ins><span class="cx">                         return $this-&gt;error;
</span><del>-                }
</del><span class="cx"> 
</span><del>-                if( !current_user_can( 'edit_pages' ) )
</del><ins>+                if ( !current_user_can( 'edit_pages' ) )
</ins><span class="cx">                         return new IXR_Error( 401, __( 'Sorry, you cannot edit pages.' ) );
</span><span class="cx"> 
</span><span class="cx">                 do_action('xmlrpc_call', 'wp.getPages');
</span><span class="lines">@@ -616,10 +613,10 @@
</span><span class="cx">                 $num_pages = count($pages);
</span><span class="cx"> 
</span><span class="cx">                 // If we have pages, put together their info.
</span><del>-                if($num_pages &gt;= 1) {
</del><ins>+                if ( $num_pages &gt;= 1 ) {
</ins><span class="cx">                         $pages_struct = array();
</span><span class="cx"> 
</span><del>-                        for($i = 0; $i &lt; $num_pages; $i++) {
</del><ins>+                        for ( $i = 0; $i &lt; $num_pages; $i++ ) {
</ins><span class="cx">                                 $page = wp_xmlrpc_server::wp_getPage(array(
</span><span class="cx">                                         $blog_id, $pages[$i]-&gt;ID, $username, $password
</span><span class="cx">                                 ));
</span><span class="lines">@@ -649,16 +646,14 @@
</span><span class="cx">                 $page                = $args[3];
</span><span class="cx">                 $publish        = $args[4];
</span><span class="cx"> 
</span><del>-                if ( !$user = $this-&gt;login($username, $password) ) {
</del><ins>+                if ( !$user = $this-&gt;login($username, $password) )
</ins><span class="cx">                         return $this-&gt;error;
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 do_action('xmlrpc_call', 'wp.newPage');
</span><span class="cx"> 
</span><span class="cx">                 // Make sure the user is allowed to add new pages.
</span><del>-                if(!current_user_can(&quot;publish_pages&quot;)) {
</del><ins>+                if ( !current_user_can(&quot;publish_pages&quot;) )
</ins><span class="cx">                         return(new IXR_Error(401, __(&quot;Sorry, you cannot add new pages.&quot;)));
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 // Mark this as content for a page.
</span><span class="cx">                 $args[3][&quot;post_type&quot;] = &quot;page&quot;;
</span><span class="lines">@@ -683,32 +678,25 @@
</span><span class="cx">                 $password        = $args[2];
</span><span class="cx">                 $page_id        = (int) $args[3];
</span><span class="cx"> 
</span><del>-                if ( !$user = $this-&gt;login($username, $password) ) {
</del><ins>+                if ( !$user = $this-&gt;login($username, $password) )
</ins><span class="cx">                         return $this-&gt;error;
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 do_action('xmlrpc_call', 'wp.deletePage');
</span><span class="cx"> 
</span><span class="cx">                 // Get the current page based on the page_id and
</span><span class="cx">                 // make sure it is a page and not a post.
</span><span class="cx">                 $actual_page = wp_get_single_post($page_id, ARRAY_A);
</span><del>-                if(
-                        !$actual_page
-                        || ($actual_page[&quot;post_type&quot;] != &quot;page&quot;)
-                ) {
</del><ins>+                if ( !$actual_page || ($actual_page[&quot;post_type&quot;] != &quot;page&quot;) )
</ins><span class="cx">                         return(new IXR_Error(404, __(&quot;Sorry, no such page.&quot;)));
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 // Make sure the user can delete pages.
</span><del>-                if(!current_user_can(&quot;delete_page&quot;, $page_id)) {
</del><ins>+                if ( !current_user_can(&quot;delete_page&quot;, $page_id) )
</ins><span class="cx">                         return(new IXR_Error(401, __(&quot;Sorry, you do not have the right to delete this page.&quot;)));
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 // Attempt to delete the page.
</span><span class="cx">                 $result = wp_delete_post($page_id);
</span><del>-                if(!$result) {
</del><ins>+                if ( !$result )
</ins><span class="cx">                         return(new IXR_Error(500, __(&quot;Failed to delete the page.&quot;)));
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 return(true);
</span><span class="cx">         }
</span><span class="lines">@@ -730,25 +718,19 @@
</span><span class="cx">                 $content        = $args[4];
</span><span class="cx">                 $publish        = $args[5];
</span><span class="cx"> 
</span><del>-                if ( !$user = $this-&gt;login($username, $password) ) {
</del><ins>+                if ( !$user = $this-&gt;login($username, $password) )
</ins><span class="cx">                         return $this-&gt;error;
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 do_action('xmlrpc_call', 'wp.editPage');
</span><span class="cx"> 
</span><span class="cx">                 // Get the page data and make sure it is a page.
</span><span class="cx">                 $actual_page = wp_get_single_post($page_id, ARRAY_A);
</span><del>-                if(
-                        !$actual_page
-                        || ($actual_page[&quot;post_type&quot;] != &quot;page&quot;)
-                ) {
</del><ins>+                if ( !$actual_page || ($actual_page[&quot;post_type&quot;] != &quot;page&quot;) )
</ins><span class="cx">                         return(new IXR_Error(404, __(&quot;Sorry, no such page.&quot;)));
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 // Make sure the user is allowed to edit pages.
</span><del>-                if(!current_user_can(&quot;edit_page&quot;, $page_id)) {
</del><ins>+                if ( !current_user_can(&quot;edit_page&quot;, $page_id) )
</ins><span class="cx">                         return(new IXR_Error(401, __(&quot;Sorry, you do not have the right to edit this page.&quot;)));
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 // Mark this as content for a page.
</span><span class="cx">                 $content[&quot;post_type&quot;] = &quot;page&quot;;
</span><span class="lines">@@ -783,11 +765,10 @@
</span><span class="cx">                 $username                                = $args[1];
</span><span class="cx">                 $password                                = $args[2];
</span><span class="cx"> 
</span><del>-                if ( !$user = $this-&gt;login($username, $password) ) {
</del><ins>+                if ( !$user = $this-&gt;login($username, $password) )
</ins><span class="cx">                         return $this-&gt;error;
</span><del>-                }
</del><span class="cx"> 
</span><del>-                if( !current_user_can( 'edit_pages' ) )
</del><ins>+                if ( !current_user_can( 'edit_pages' ) )
</ins><span class="cx">                         return new IXR_Error( 401, __( 'Sorry, you cannot edit pages.' ) );
</span><span class="cx"> 
</span><span class="cx">                 do_action('xmlrpc_call', 'wp.getPageList');
</span><span class="lines">@@ -807,7 +788,7 @@
</span><span class="cx"> 
</span><span class="cx">                 // The date needs to be formated properly.
</span><span class="cx">                 $num_pages = count($page_list);
</span><del>-                for($i = 0; $i &lt; $num_pages; $i++) {
</del><ins>+                for ( $i = 0; $i &lt; $num_pages; $i++ ) {
</ins><span class="cx">                         $post_date = mysql2date(&quot;Ymd\TH:i:s&quot;, $page_list[$i]-&gt;post_date, false);
</span><span class="cx">                         $post_date_gmt = mysql2date(&quot;Ymd\TH:i:s&quot;, $page_list[$i]-&gt;post_date_gmt, false);
</span><span class="cx"> 
</span><span class="lines">@@ -844,18 +825,16 @@
</span><span class="cx">                 $username        = $args[1];
</span><span class="cx">                 $password        = $args[2];
</span><span class="cx"> 
</span><del>-                if ( !$user = $this-&gt;login($username, $password) ) {
</del><ins>+                if ( !$user = $this-&gt;login($username, $password) )
</ins><span class="cx">                         return $this-&gt;error;
</span><del>-                }
</del><span class="cx"> 
</span><del>-                if(!current_user_can(&quot;edit_posts&quot;)) {
</del><ins>+                if ( !current_user_can(&quot;edit_posts&quot;) )
</ins><span class="cx">                         return(new IXR_Error(401, __(&quot;Sorry, you cannot edit posts on this blog.&quot;)));
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 do_action('xmlrpc_call', 'wp.getAuthors');
</span><span class="cx"> 
</span><span class="cx">                 $authors = array();
</span><del>-                foreach( (array) get_users_of_blog() as $row ) {
</del><ins>+                foreach ( (array) get_users_of_blog() as $row ) {
</ins><span class="cx">                         $authors[] = array(
</span><span class="cx">                                 &quot;user_id&quot;       =&gt; $row-&gt;user_id,
</span><span class="cx">                                 &quot;user_login&quot;    =&gt; $row-&gt;user_login,
</span><span class="lines">@@ -881,19 +860,17 @@
</span><span class="cx">                 $username                = $args[1];
</span><span class="cx">                 $password                = $args[2];
</span><span class="cx"> 
</span><del>-                if ( !$user = $this-&gt;login($username, $password) ) {
</del><ins>+                if ( !$user = $this-&gt;login($username, $password) )
</ins><span class="cx">                         return $this-&gt;error;
</span><del>-                }
</del><span class="cx"> 
</span><del>-                if( !current_user_can( 'edit_posts' ) ) {
</del><ins>+                if ( !current_user_can( 'edit_posts' ) )
</ins><span class="cx">                         return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this blog in order to view tags.' ) );
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 do_action( 'xmlrpc_call', 'wp.getKeywords' );
</span><span class="cx"> 
</span><span class="cx">                 $tags = array( );
</span><span class="cx"> 
</span><del>-                if( $all_tags = get_tags( ) ) {
</del><ins>+                if ( $all_tags = get_tags() ) {
</ins><span class="cx">                         foreach( (array) $all_tags as $tag ) {
</span><span class="cx">                                 $struct['tag_id']                        = $tag-&gt;term_id;
</span><span class="cx">                                 $struct['name']                                = $tag-&gt;name;
</span><span class="lines">@@ -925,22 +902,19 @@
</span><span class="cx">                 $password                                = $args[2];
</span><span class="cx">                 $category                                = $args[3];
</span><span class="cx"> 
</span><del>-                if ( !$user = $this-&gt;login($username, $password) ) {
</del><ins>+                if ( !$user = $this-&gt;login($username, $password) )
</ins><span class="cx">                         return $this-&gt;error;
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 do_action('xmlrpc_call', 'wp.newCategory');
</span><span class="cx"> 
</span><span class="cx">                 // Make sure the user is allowed to add a category.
</span><del>-                if(!current_user_can(&quot;manage_categories&quot;)) {
</del><ins>+                if ( !current_user_can(&quot;manage_categories&quot;) )
</ins><span class="cx">                         return(new IXR_Error(401, __(&quot;Sorry, you do not have the right to add a category.&quot;)));
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 // If no slug was provided make it empty so that
</span><span class="cx">                 // WordPress will generate one.
</span><del>-                if(empty($category[&quot;slug&quot;])) {
</del><ins>+                if ( empty($category[&quot;slug&quot;]) )
</ins><span class="cx">                         $category[&quot;slug&quot;] = &quot;&quot;;
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 // If no parent_id was provided make it empty
</span><span class="cx">                 // so that it will be a top level page (no parent).
</span><span class="lines">@@ -948,9 +922,8 @@
</span><span class="cx">                         $category[&quot;parent_id&quot;] = &quot;&quot;;
</span><span class="cx"> 
</span><span class="cx">                 // If no description was provided make it empty.
</span><del>-                if(empty($category[&quot;description&quot;])) {
</del><ins>+                if ( empty($category[&quot;description&quot;]) )
</ins><span class="cx">                         $category[&quot;description&quot;] = &quot;&quot;;
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 $new_category = array(
</span><span class="cx">                         &quot;cat_name&quot;                                =&gt; $category[&quot;name&quot;],
</span><span class="lines">@@ -960,9 +933,8 @@
</span><span class="cx">                 );
</span><span class="cx"> 
</span><span class="cx">                 $cat_id = wp_insert_category($new_category);
</span><del>-                if(!$cat_id) {
</del><ins>+                if ( !$cat_id )
</ins><span class="cx">                         return(new IXR_Error(500, __(&quot;Sorry, the new category failed.&quot;)));
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 return($cat_id);
</span><span class="cx">         }
</span><span class="lines">@@ -983,15 +955,13 @@
</span><span class="cx">                 $password                = $args[2];
</span><span class="cx">                 $category_id        = (int) $args[3];
</span><span class="cx"> 
</span><del>-                if ( !$user = $this-&gt;login($username, $password) ) {
</del><ins>+                if ( !$user = $this-&gt;login($username, $password) )
</ins><span class="cx">                         return $this-&gt;error;
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 do_action('xmlrpc_call', 'wp.deleteCategory');
</span><span class="cx"> 
</span><del>-                if( !current_user_can(&quot;manage_categories&quot;) ) {
</del><ins>+                if ( !current_user_can(&quot;manage_categories&quot;) )
</ins><span class="cx">                         return new IXR_Error( 401, __( &quot;Sorry, you do not have the right to delete a category.&quot; ) );
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 return wp_delete_category( $category_id );
</span><span class="cx">         }
</span><span class="lines">@@ -1013,11 +983,10 @@
</span><span class="cx">                 $category                                = $args[3];
</span><span class="cx">                 $max_results                        = (int) $args[4];
</span><span class="cx"> 
</span><del>-                if ( !$user = $this-&gt;login($username, $password) ) {
</del><ins>+                if ( !$user = $this-&gt;login($username, $password) )
</ins><span class="cx">                         return $this-&gt;error;
</span><del>-                }
</del><span class="cx"> 
</span><del>-                if( !current_user_can( 'edit_posts' ) )
</del><ins>+                if ( !current_user_can( 'edit_posts' ) )
</ins><span class="cx">                         return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts to this blog in order to view categories.' ) );
</span><span class="cx"> 
</span><span class="cx">                 do_action('xmlrpc_call', 'wp.suggestCategories');
</span><span class="lines">@@ -1050,9 +1019,8 @@
</span><span class="cx">                 $password        = $args[2];
</span><span class="cx">                 $comment_id        = (int) $args[3];
</span><span class="cx"> 
</span><del>-                if ( !$user = $this-&gt;login($username, $password) ) {
</del><ins>+                if ( !$user = $this-&gt;login($username, $password) )
</ins><span class="cx">                         return $this-&gt;error;
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 if ( !current_user_can( 'moderate_comments' ) )
</span><span class="cx">                         return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this blog.' ) );
</span><span class="lines">@@ -1113,9 +1081,8 @@
</span><span class="cx">                 $password        = $args[2];
</span><span class="cx">                 $struct                = $args[3];
</span><span class="cx"> 
</span><del>-                if ( !$user = $this-&gt;login($username, $password) ) {
</del><ins>+                if ( !$user = $this-&gt;login($username, $password) )
</ins><span class="cx">                         return $this-&gt;error;
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 if ( !current_user_can( 'moderate_comments' ) )
</span><span class="cx">                         return new IXR_Error( 401, __( 'Sorry, you cannot edit comments.' ) );
</span><span class="lines">@@ -1173,9 +1140,8 @@
</span><span class="cx">                 $password        = $args[2];
</span><span class="cx">                 $comment_ID        = (int) $args[3];
</span><span class="cx"> 
</span><del>-                if ( !$user = $this-&gt;login($username, $password) ) {
</del><ins>+                if ( !$user = $this-&gt;login($username, $password) )
</ins><span class="cx">                         return $this-&gt;error;
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 if ( !current_user_can( 'moderate_comments' ) )
</span><span class="cx">                         return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this blog.' ) );
</span><span class="lines">@@ -1205,9 +1171,8 @@
</span><span class="cx">                 $comment_ID        = (int) $args[3];
</span><span class="cx">                 $content_struct = $args[4];
</span><span class="cx"> 
</span><del>-                if ( !$user = $this-&gt;login($username, $password) ) {
</del><ins>+                if ( !$user = $this-&gt;login($username, $password) )
</ins><span class="cx">                         return $this-&gt;error;
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 if ( !current_user_can( 'moderate_comments' ) )
</span><span class="cx">                         return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this blog.' ) );
</span><span class="lines">@@ -1356,9 +1321,8 @@
</span><span class="cx">                 $username        = $args[1];
</span><span class="cx">                 $password        = $args[2];
</span><span class="cx"> 
</span><del>-                if ( !$user = $this-&gt;login($username, $password) ) {
</del><ins>+                if ( !$user = $this-&gt;login($username, $password) )
</ins><span class="cx">                         return $this-&gt;error;
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 if ( !current_user_can( 'moderate_comments' ) )
</span><span class="cx">                         return new IXR_Error( 403, __( 'You are not allowed access to details about this blog.' ) );
</span><span class="lines">@@ -1384,13 +1348,11 @@
</span><span class="cx">                 $password        = $args[2];
</span><span class="cx">                 $post_id        = (int) $args[3];
</span><span class="cx"> 
</span><del>-                if ( !$user = $this-&gt;login($username, $password) ) {
</del><ins>+                if ( !$user = $this-&gt;login($username, $password) )
</ins><span class="cx">                         return $this-&gt;error;
</span><del>-                }
</del><span class="cx"> 
</span><del>-                if( !current_user_can( 'edit_posts' ) ) {
</del><ins>+                if ( !current_user_can( 'edit_posts' ) )
</ins><span class="cx">                         return new IXR_Error( 403, __( 'You are not allowed access to details about comments.' ) );
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 do_action('xmlrpc_call', 'wp.getCommentCount');
</span><span class="cx"> 
</span><span class="lines">@@ -1418,13 +1380,11 @@
</span><span class="cx">                 $username        = $args[1];
</span><span class="cx">                 $password        = $args[2];
</span><span class="cx"> 
</span><del>-                if ( !$user = $this-&gt;login($username, $password) ) {
</del><ins>+                if ( !$user = $this-&gt;login($username, $password) )
</ins><span class="cx">                         return $this-&gt;error;
</span><del>-                }
</del><span class="cx"> 
</span><del>-                if( !current_user_can( 'edit_posts' ) ) {
</del><ins>+                if ( !current_user_can( 'edit_posts' ) )
</ins><span class="cx">                         return new IXR_Error( 403, __( 'You are not allowed access to details about this blog.' ) );
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 do_action('xmlrpc_call', 'wp.getPostStatusList');
</span><span class="cx"> 
</span><span class="lines">@@ -1446,13 +1406,11 @@
</span><span class="cx">                 $username        = $args[1];
</span><span class="cx">                 $password        = $args[2];
</span><span class="cx"> 
</span><del>-                if ( !$user = $this-&gt;login($username, $password) ) {
</del><ins>+                if ( !$user = $this-&gt;login($username, $password) )
</ins><span class="cx">                         return $this-&gt;error;
</span><del>-                }
</del><span class="cx"> 
</span><del>-                if( !current_user_can( 'edit_posts' ) ) {
</del><ins>+                if ( !current_user_can( 'edit_posts' ) )
</ins><span class="cx">                         return new IXR_Error( 403, __( 'You are not allowed access to details about this blog.' ) );
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 do_action('xmlrpc_call', 'wp.getPageStatusList');
</span><span class="cx"> 
</span><span class="lines">@@ -1474,13 +1432,11 @@
</span><span class="cx">                 $username        = $args[1];
</span><span class="cx">                 $password        = $args[2];
</span><span class="cx"> 
</span><del>-                if ( !$user = $this-&gt;login($username, $password) ) {
</del><ins>+                if ( !$user = $this-&gt;login($username, $password) )
</ins><span class="cx">                         return $this-&gt;error;
</span><del>-                }
</del><span class="cx"> 
</span><del>-                if( !current_user_can( 'edit_pages' ) ) {
</del><ins>+                if ( !current_user_can( 'edit_pages' ) )
</ins><span class="cx">                         return new IXR_Error( 403, __( 'You are not allowed access to details about this blog.' ) );
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 $templates = get_page_templates( );
</span><span class="cx">                 $templates['Default'] = 'default';
</span><span class="lines">@@ -1504,14 +1460,12 @@
</span><span class="cx">                 $password        = $args[2];
</span><span class="cx">                 $options        = (array) $args[3];
</span><span class="cx"> 
</span><del>-                if ( !$user = $this-&gt;login($username, $password) ) {
</del><ins>+                if ( !$user = $this-&gt;login($username, $password) )
</ins><span class="cx">                         return $this-&gt;error;
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 // If no specific options where asked for, return all of them
</span><del>-                if (count( $options ) == 0 ) {
</del><ins>+                if ( count( $options ) == 0 )
</ins><span class="cx">                         $options = array_keys($this-&gt;blog_options);
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 return $this-&gt;_getOptions($options);
</span><span class="cx">         }
</span><span class="lines">@@ -1524,15 +1478,13 @@
</span><span class="cx">          * @param array $options Options to retrieve.
</span><span class="cx">          * @return array
</span><span class="cx">          */
</span><del>-        function _getOptions($options)
-        {
</del><ins>+        function _getOptions($options) {
</ins><span class="cx">                 $data = array( );
</span><del>-                foreach( $options as $option ) {
-                        if( array_key_exists( $option, $this-&gt;blog_options ) )
-                        {
</del><ins>+                foreach ( $options as $option ) {
+                        if ( array_key_exists( $option, $this-&gt;blog_options ) ) {
</ins><span class="cx">                                 $data[$option] = $this-&gt;blog_options[$option];
</span><span class="cx">                                 //Is the value static or dynamic?
</span><del>-                                if( isset( $data[$option]['option'] ) ) {
</del><ins>+                                if ( isset( $data[$option]['option'] ) ) {
</ins><span class="cx">                                         $data[$option]['value'] = get_option( $data[$option]['option'] );
</span><span class="cx">                                         unset($data[$option]['option']);
</span><span class="cx">                                 }
</span><span class="lines">@@ -1558,19 +1510,18 @@
</span><span class="cx">                 $password        = $args[2];
</span><span class="cx">                 $options        = (array) $args[3];
</span><span class="cx"> 
</span><del>-                if ( !$user = $this-&gt;login($username, $password) ) {
</del><ins>+                if ( !$user = $this-&gt;login($username, $password) )
</ins><span class="cx">                         return $this-&gt;error;
</span><del>-                }
</del><span class="cx"> 
</span><del>-                if( !current_user_can( 'manage_options' ) )
</del><ins>+                if ( !current_user_can( 'manage_options' ) )
</ins><span class="cx">                         return new IXR_Error( 403, __( 'You are not allowed to update options.' ) );
</span><span class="cx"> 
</span><del>-                foreach( $options as $o_name =&gt; $o_value ) {
</del><ins>+                foreach ( $options as $o_name =&gt; $o_value ) {
</ins><span class="cx">                         $option_names[] = $o_name;
</span><del>-                        if( !array_key_exists( $o_name, $this-&gt;blog_options ) )
</del><ins>+                        if ( !array_key_exists( $o_name, $this-&gt;blog_options ) )
</ins><span class="cx">                                 continue;
</span><span class="cx"> 
</span><del>-                        if( $this-&gt;blog_options[$o_name]['readonly'] == true )
</del><ins>+                        if ( $this-&gt;blog_options[$o_name]['readonly'] == true )
</ins><span class="cx">                                 continue;
</span><span class="cx"> 
</span><span class="cx">                         update_option( $this-&gt;blog_options[$o_name]['option'], $o_value );
</span><span class="lines">@@ -1601,9 +1552,8 @@
</span><span class="cx">                 $username = $args[1];
</span><span class="cx">                 $password  = $args[2];
</span><span class="cx"> 
</span><del>-                if ( !$user = $this-&gt;login($username, $password) ) {
</del><ins>+                if ( !$user = $this-&gt;login($username, $password) )
</ins><span class="cx">                         return $this-&gt;error;
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 do_action('xmlrpc_call', 'blogger.getUsersBlogs');
</span><span class="cx"> 
</span><span class="lines">@@ -1637,11 +1587,10 @@
</span><span class="cx">                 $username = $args[1];
</span><span class="cx">                 $password  = $args[2];
</span><span class="cx"> 
</span><del>-                if ( !$user = $this-&gt;login($username, $password) ) {
</del><ins>+                if ( !$user = $this-&gt;login($username, $password) )
</ins><span class="cx">                         return $this-&gt;error;
</span><del>-                }
</del><span class="cx"> 
</span><del>-                if( !current_user_can( 'edit_posts' ) )
</del><ins>+                if ( !current_user_can( 'edit_posts' ) )
</ins><span class="cx">                         return new IXR_Error( 401, __( 'Sorry, you do not have access to user data on this blog.' ) );
</span><span class="cx"> 
</span><span class="cx">                 do_action('xmlrpc_call', 'blogger.getUserInfo');
</span><span class="lines">@@ -1673,11 +1622,10 @@
</span><span class="cx">                 $username = $args[2];
</span><span class="cx">                 $password  = $args[3];
</span><span class="cx"> 
</span><del>-                if ( !$user = $this-&gt;login($username, $password) ) {
</del><ins>+                if ( !$user = $this-&gt;login($username, $password) )
</ins><span class="cx">                         return $this-&gt;error;
</span><del>-                }
</del><span class="cx"> 
</span><del>-                if( !current_user_can( 'edit_post', $post_ID ) )
</del><ins>+                if ( !current_user_can( 'edit_post', $post_ID ) )
</ins><span class="cx">                         return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) );
</span><span class="cx"> 
</span><span class="cx">                 do_action('xmlrpc_call', 'blogger.getPost');
</span><span class="lines">@@ -1717,21 +1665,20 @@
</span><span class="cx">                 $password  = $args[3];
</span><span class="cx">                 $num_posts  = $args[4];
</span><span class="cx"> 
</span><del>-                if ( !$user = $this-&gt;login($username, $password) ) {
</del><ins>+                if ( !$user = $this-&gt;login($username, $password) )
</ins><span class="cx">                         return $this-&gt;error;
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 do_action('xmlrpc_call', 'blogger.getRecentPosts');
</span><span class="cx"> 
</span><span class="cx">                 $posts_list = wp_get_recent_posts($num_posts);
</span><span class="cx"> 
</span><del>-                if (!$posts_list) {
</del><ins>+                if ( !$posts_list ) {
</ins><span class="cx">                         $this-&gt;error = new IXR_Error(500, __('Either there are no posts, or something went wrong.'));
</span><span class="cx">                         return $this-&gt;error;
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 foreach ($posts_list as $entry) {
</span><del>-                        if( !current_user_can( 'edit_post', $entry['ID'] ) )
</del><ins>+                        if ( !current_user_can( 'edit_post', $entry['ID'] ) )
</ins><span class="cx">                                 continue;
</span><span class="cx"> 
</span><span class="cx">                         $post_date = mysql2date('Ymd\TH:i:s', $entry['post_date'], false);
</span><span class="lines">@@ -1751,7 +1698,7 @@
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 $recent_posts = array();
</span><del>-                for ($j=0; $j&lt;count($struct); $j++) {
</del><ins>+                for ( $j=0; $j&lt;count($struct); $j++ ) {
</ins><span class="cx">                         array_push($recent_posts, $struct[$j]);
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="lines">@@ -1775,15 +1722,13 @@
</span><span class="cx">                 $password  = $args[3];
</span><span class="cx">                 $template   = $args[4]; /* could be 'main' or 'archiveIndex', but we don't use it */
</span><span class="cx"> 
</span><del>-                if ( !$user = $this-&gt;login($username, $password) ) {
</del><ins>+                if ( !$user = $this-&gt;login($username, $password) )
</ins><span class="cx">                         return $this-&gt;error;
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 do_action('xmlrpc_call', 'blogger.getTemplate');
</span><span class="cx"> 
</span><del>-                if ( !current_user_can('edit_themes') ) {
</del><ins>+                if ( !current_user_can('edit_themes') )
</ins><span class="cx">                         return new IXR_Error(401, __('Sorry, this user can not edit the template.'));
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 /* warning: here we make the assumption that the blog's URL is on the same server */
</span><span class="cx">                 $filename = get_option('home') . '/';
</span><span class="lines">@@ -1817,15 +1762,13 @@
</span><span class="cx">                 $content    = $args[4];
</span><span class="cx">                 $template   = $args[5]; /* could be 'main' or 'archiveIndex', but we don't use it */
</span><span class="cx"> 
</span><del>-                if ( !$user = $this-&gt;login($username, $password) ) {
</del><ins>+                if ( !$user = $this-&gt;login($username, $password) )
</ins><span class="cx">                         return $this-&gt;error;
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 do_action('xmlrpc_call', 'blogger.setTemplate');
</span><span class="cx"> 
</span><del>-                if ( !current_user_can('edit_themes') ) {
</del><ins>+                if ( !current_user_can('edit_themes') )
</ins><span class="cx">                         return new IXR_Error(401, __('Sorry, this user cannot edit the template.'));
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 /* warning: here we make the assumption that the blog's URL is on the same server */
</span><span class="cx">                 $filename = get_option('home') . '/';
</span><span class="lines">@@ -1859,9 +1802,8 @@
</span><span class="cx">                 $content    = $args[4];
</span><span class="cx">                 $publish    = $args[5];
</span><span class="cx"> 
</span><del>-                if ( !$user = $this-&gt;login($username, $password) ) {
</del><ins>+                if ( !$user = $this-&gt;login($username, $password) )
</ins><span class="cx">                         return $this-&gt;error;
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 do_action('xmlrpc_call', 'blogger.newPost');
</span><span class="cx"> 
</span><span class="lines">@@ -1886,7 +1828,7 @@
</span><span class="cx">                 if ( is_wp_error( $post_ID ) )
</span><span class="cx">                         return new IXR_Error(500, $post_ID-&gt;get_error_message());
</span><span class="cx"> 
</span><del>-                if (!$post_ID)
</del><ins>+                if ( !$post_ID )
</ins><span class="cx">                         return new IXR_Error(500, __('Sorry, your entry could not be posted. Something wrong happened.'));
</span><span class="cx"> 
</span><span class="cx">                 $this-&gt;attach_uploads( $post_ID, $post_content );
</span><span class="lines">@@ -1914,17 +1856,15 @@
</span><span class="cx">                 $content     = $args[4];
</span><span class="cx">                 $publish     = $args[5];
</span><span class="cx"> 
</span><del>-                if ( !$user = $this-&gt;login($username, $password) ) {
</del><ins>+                if ( !$user = $this-&gt;login($username, $password) )
</ins><span class="cx">                         return $this-&gt;error;
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 do_action('xmlrpc_call', 'blogger.editPost');
</span><span class="cx"> 
</span><span class="cx">                 $actual_post = wp_get_single_post($post_ID,ARRAY_A);
</span><span class="cx"> 
</span><del>-                if (!$actual_post || $actual_post['post_type'] != 'post') {
</del><ins>+                if ( !$actual_post || $actual_post['post_type'] != 'post' )
</ins><span class="cx">                         return new IXR_Error(404, __('Sorry, no such post.'));
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 $this-&gt;escape($actual_post);
</span><span class="cx"> 
</span><span class="lines">@@ -1944,9 +1884,9 @@
</span><span class="cx"> 
</span><span class="cx">                 $result = wp_update_post($postdata);
</span><span class="cx"> 
</span><del>-                if (!$result) {
</del><ins>+                if ( !$result )
</ins><span class="cx">                         return new IXR_Error(500, __('For some strange yet very annoying reason, this post could not be edited.'));
</span><del>-                }
</del><ins>+
</ins><span class="cx">                 $this-&gt;attach_uploads( $ID, $post_content );
</span><span class="cx"> 
</span><span class="cx">                 return true;
</span><span class="lines">@@ -1968,26 +1908,23 @@
</span><span class="cx">                 $password   = $args[3];
</span><span class="cx">                 $publish     = $args[4];
</span><span class="cx"> 
</span><del>-                if ( !$user = $this-&gt;login($username, $password) ) {
</del><ins>+                if ( !$user = $this-&gt;login($username, $password) )
</ins><span class="cx">                         return $this-&gt;error;
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 do_action('xmlrpc_call', 'blogger.deletePost');
</span><span class="cx"> 
</span><span class="cx">                 $actual_post = wp_get_single_post($post_ID,ARRAY_A);
</span><span class="cx"> 
</span><del>-                if (!$actual_post || $actual_post['post_type'] != 'post') {
</del><ins>+                if ( !$actual_post || $actual_post['post_type'] != 'post' )
</ins><span class="cx">                         return new IXR_Error(404, __('Sorry, no such post.'));
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 if ( !current_user_can('edit_post', $post_ID) )
</span><span class="cx">                         return new IXR_Error(401, __('Sorry, you do not have the right to delete this post.'));
</span><span class="cx"> 
</span><span class="cx">                 $result = wp_delete_post($post_ID);
</span><span class="cx"> 
</span><del>-                if (!$result) {
</del><ins>+                if ( !$result )
</ins><span class="cx">                         return new IXR_Error(500, __('For some strange yet very annoying reason, this post could not be deleted.'));
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 return true;
</span><span class="cx">         }
</span><span class="lines">@@ -2013,9 +1950,8 @@
</span><span class="cx">                 $content_struct = $args[3];
</span><span class="cx">                 $publish     = $args[4];
</span><span class="cx"> 
</span><del>-                if ( !$user = $this-&gt;login($username, $password) ) {
</del><ins>+                if ( !$user = $this-&gt;login($username, $password) )
</ins><span class="cx">                         return $this-&gt;error;
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 do_action('xmlrpc_call', 'metaWeblog.newPost');
</span><span class="cx"> 
</span><span class="lines">@@ -2023,66 +1959,54 @@
</span><span class="cx">                 $error_message = __( 'Sorry, you are not allowed to publish posts on this blog.' );
</span><span class="cx">                 $post_type = 'post';
</span><span class="cx">                 $page_template = '';
</span><del>-                if( !empty( $content_struct['post_type'] ) ) {
-                        if( $content_struct['post_type'] == 'page' ) {
</del><ins>+                if ( !empty( $content_struct['post_type'] ) ) {
+                        if ( $content_struct['post_type'] == 'page' ) {
</ins><span class="cx">                                 $cap = ( $publish ) ? 'publish_pages' : 'edit_pages';
</span><span class="cx">                                 $error_message = __( 'Sorry, you are not allowed to publish pages on this blog.' );
</span><span class="cx">                                 $post_type = 'page';
</span><del>-                                if( !empty( $content_struct['wp_page_template'] ) )
</del><ins>+                                if ( !empty( $content_struct['wp_page_template'] ) )
</ins><span class="cx">                                         $page_template = $content_struct['wp_page_template'];
</span><del>-                        }
-                        elseif( $content_struct['post_type'] == 'post' ) {
</del><ins>+                        } elseif ( $content_struct['post_type'] == 'post' ) {
</ins><span class="cx">                                 // This is the default, no changes needed
</span><del>-                        }
-                        else {
</del><ins>+                        } else {
</ins><span class="cx">                                 // No other post_type values are allowed here
</span><span class="cx">                                 return new IXR_Error( 401, __( 'Invalid post type.' ) );
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                if( !current_user_can( $cap ) ) {
</del><ins>+                if ( !current_user_can( $cap ) )
</ins><span class="cx">                         return new IXR_Error( 401, $error_message );
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 // Let WordPress generate the post_name (slug) unless
</span><span class="cx">                 // one has been provided.
</span><span class="cx">                 $post_name = &quot;&quot;;
</span><del>-                if(isset($content_struct[&quot;wp_slug&quot;])) {
</del><ins>+                if ( isset($content_struct[&quot;wp_slug&quot;]) )
</ins><span class="cx">                         $post_name = $content_struct[&quot;wp_slug&quot;];
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 // Only use a password if one was given.
</span><del>-                if(isset($content_struct[&quot;wp_password&quot;])) {
</del><ins>+                if ( isset($content_struct[&quot;wp_password&quot;]) )
</ins><span class="cx">                         $post_password = $content_struct[&quot;wp_password&quot;];
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 // Only set a post parent if one was provided.
</span><del>-                if(isset($content_struct[&quot;wp_page_parent_id&quot;])) {
</del><ins>+                if ( isset($content_struct[&quot;wp_page_parent_id&quot;]) )
</ins><span class="cx">                         $post_parent = $content_struct[&quot;wp_page_parent_id&quot;];
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 // Only set the menu_order if it was provided.
</span><del>-                if(isset($content_struct[&quot;wp_page_order&quot;])) {
</del><ins>+                if ( isset($content_struct[&quot;wp_page_order&quot;]) )
</ins><span class="cx">                         $menu_order = $content_struct[&quot;wp_page_order&quot;];
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 $post_author = $user-&gt;ID;
</span><span class="cx"> 
</span><span class="cx">                 // If an author id was provided then use it instead.
</span><del>-                if(
-                        isset($content_struct[&quot;wp_author_id&quot;])
-                        &amp;&amp; ($user-&gt;ID != $content_struct[&quot;wp_author_id&quot;])
-                ) {
-                        switch($post_type) {
</del><ins>+                if ( isset($content_struct[&quot;wp_author_id&quot;]) &amp;&amp; ($user-&gt;ID != $content_struct[&quot;wp_author_id&quot;]) ) {
+                        switch ( $post_type ) {
</ins><span class="cx">                                 case &quot;post&quot;:
</span><del>-                                        if(!current_user_can(&quot;edit_others_posts&quot;)) {
</del><ins>+                                        if ( !current_user_can(&quot;edit_others_posts&quot;) )
</ins><span class="cx">                                                 return(new IXR_Error(401, __(&quot;You are not allowed to post as this user&quot;)));
</span><del>-                                        }
</del><span class="cx">                                         break;
</span><span class="cx">                                 case &quot;page&quot;:
</span><del>-                                        if(!current_user_can(&quot;edit_others_pages&quot;)) {
</del><ins>+                                        if ( !current_user_can(&quot;edit_others_pages&quot;) )
</ins><span class="cx">                                                 return(new IXR_Error(401, __(&quot;You are not allowed to create pages as this user&quot;)));
</span><del>-                                        }
</del><span class="cx">                                         break;
</span><span class="cx">                                 default:
</span><span class="cx">                                         return(new IXR_Error(401, __(&quot;Invalid post type.&quot;)));
</span><span class="lines">@@ -2096,8 +2020,8 @@
</span><span class="cx"> 
</span><span class="cx">                 $post_status = $publish ? 'publish' : 'draft';
</span><span class="cx"> 
</span><del>-                if( isset( $content_struct[&quot;{$post_type}_status&quot;] ) ) {
-                        switch( $content_struct[&quot;{$post_type}_status&quot;] ) {
</del><ins>+                if ( isset( $content_struct[&quot;{$post_type}_status&quot;] ) ) {
+                        switch ( $content_struct[&quot;{$post_type}_status&quot;] ) {
</ins><span class="cx">                                 case 'draft':
</span><span class="cx">                                 case 'private':
</span><span class="cx">                                 case 'publish':
</span><span class="lines">@@ -2105,9 +2029,8 @@
</span><span class="cx">                                         break;
</span><span class="cx">                                 case 'pending':
</span><span class="cx">                                         // Pending is only valid for posts, not pages.
</span><del>-                                        if( $post_type === 'post' ) {
</del><ins>+                                        if ( $post_type === 'post' )
</ins><span class="cx">                                                 $post_status = $content_struct[&quot;{$post_type}_status&quot;];
</span><del>-                                        }
</del><span class="cx">                                         break;
</span><span class="cx">                                 default:
</span><span class="cx">                                         $post_status = $publish ? 'publish' : 'draft';
</span><span class="lines">@@ -2120,9 +2043,9 @@
</span><span class="cx"> 
</span><span class="cx">                 $tags_input = $content_struct['mt_keywords'];
</span><span class="cx"> 
</span><del>-                if(isset($content_struct[&quot;mt_allow_comments&quot;])) {
-                        if(!is_numeric($content_struct[&quot;mt_allow_comments&quot;])) {
-                                switch($content_struct[&quot;mt_allow_comments&quot;]) {
</del><ins>+                if ( isset($content_struct[&quot;mt_allow_comments&quot;]) ) {
+                        if ( !is_numeric($content_struct[&quot;mt_allow_comments&quot;]) ) {
+                                switch ( $content_struct[&quot;mt_allow_comments&quot;] ) {
</ins><span class="cx">                                         case &quot;closed&quot;:
</span><span class="cx">                                                 $comment_status = &quot;closed&quot;;
</span><span class="cx">                                                 break;
</span><span class="lines">@@ -2133,9 +2056,8 @@
</span><span class="cx">                                                 $comment_status = get_option(&quot;default_comment_status&quot;);
</span><span class="cx">                                                 break;
</span><span class="cx">                                 }
</span><del>-                        }
-                        else {
-                                switch((int) $content_struct[&quot;mt_allow_comments&quot;]) {
</del><ins>+                        } else {
+                                switch ( (int) $content_struct[&quot;mt_allow_comments&quot;] ) {
</ins><span class="cx">                                         case 0:
</span><span class="cx">                                         case 2:
</span><span class="cx">                                                 $comment_status = &quot;closed&quot;;
</span><span class="lines">@@ -2148,14 +2070,13 @@
</span><span class="cx">                                                 break;
</span><span class="cx">                                 }
</span><span class="cx">                         }
</span><del>-                }
-                else {
</del><ins>+                } else {
</ins><span class="cx">                         $comment_status = get_option(&quot;default_comment_status&quot;);
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                if(isset($content_struct[&quot;mt_allow_pings&quot;])) {
-                        if(!is_numeric($content_struct[&quot;mt_allow_pings&quot;])) {
-                                switch($content_struct['mt_allow_pings']) {
</del><ins>+                if ( isset($content_struct[&quot;mt_allow_pings&quot;]) ) {
+                        if ( !is_numeric($content_struct[&quot;mt_allow_pings&quot;]) ) {
+                                switch ( $content_struct['mt_allow_pings'] ) {
</ins><span class="cx">                                         case &quot;closed&quot;:
</span><span class="cx">                                                 $ping_status = &quot;closed&quot;;
</span><span class="cx">                                                 break;
</span><span class="lines">@@ -2166,9 +2087,8 @@
</span><span class="cx">                                                 $ping_status = get_option(&quot;default_ping_status&quot;);
</span><span class="cx">                                                 break;
</span><span class="cx">                                 }
</span><del>-                        }
-                        else {
-                                switch((int) $content_struct[&quot;mt_allow_pings&quot;]) {
</del><ins>+                        } else {
+                                switch ( (int) $content_struct[&quot;mt_allow_pings&quot;] ) {
</ins><span class="cx">                                         case 0:
</span><span class="cx">                                                 $ping_status = &quot;closed&quot;;
</span><span class="cx">                                                 break;
</span><span class="lines">@@ -2180,15 +2100,13 @@
</span><span class="cx">                                                 break;
</span><span class="cx">                                 }
</span><span class="cx">                         }
</span><del>-                }
-                else {
</del><ins>+                } else {
</ins><span class="cx">                         $ping_status = get_option(&quot;default_ping_status&quot;);
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                if ($post_more) {
</del><ins>+                if ( $post_more )
</ins><span class="cx">                         $post_content = $post_content . &quot;&lt;!--more--&gt;&quot; . $post_more;
</span><del>-                }
-
</del><ins>+ 
</ins><span class="cx">                 $to_ping = $content_struct['mt_tb_ping_urls'];
</span><span class="cx">                 if ( is_array($to_ping) )
</span><span class="cx">                         $to_ping = implode(' ', $to_ping);
</span><span class="lines">@@ -2211,7 +2129,7 @@
</span><span class="cx">                 logIO('O', 'Post cats: ' . var_export($catnames,true));
</span><span class="cx">                 $post_category = array();
</span><span class="cx"> 
</span><del>-                if (is_array($catnames)) {
</del><ins>+                if ( is_array($catnames) ) {
</ins><span class="cx">                         foreach ($catnames as $cat) {
</span><span class="cx">                                 $post_category[] = get_cat_ID($cat);
</span><span class="cx">                         }
</span><span class="lines">@@ -2224,20 +2142,19 @@
</span><span class="cx">                 if ( is_wp_error( $post_ID ) )
</span><span class="cx">                         return new IXR_Error(500, $post_ID-&gt;get_error_message());
</span><span class="cx"> 
</span><del>-                if (!$post_ID) {
</del><ins>+                if ( !$post_ID )
</ins><span class="cx">                         return new IXR_Error(500, __('Sorry, your entry could not be posted. Something wrong happened.'));
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 // Only posts can be sticky
</span><del>-                if ( $post_type == 'post' &amp;&amp; isset( $content_struct['sticky'] ) )
</del><ins>+                if ( $post_type == 'post' &amp;&amp; isset( $content_struct['sticky'] ) ) {
</ins><span class="cx">                         if ( $content_struct['sticky'] == true )
</span><span class="cx">                                 stick_post( $post_ID );
</span><span class="cx">                         elseif ( $content_struct['sticky'] == false )
</span><span class="cx">                                 unstick_post( $post_ID );
</span><ins>+                }
</ins><span class="cx"> 
</span><del>-                if ( isset($content_struct['custom_fields']) ) {
</del><ins>+                if ( isset($content_struct['custom_fields']) )
</ins><span class="cx">                         $this-&gt;set_custom_fields($post_ID, $content_struct['custom_fields']);
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 // Handle enclosures
</span><span class="cx">                 $this-&gt;add_enclosure_if_new($post_ID, $content_struct['enclosure']);
</span><span class="lines">@@ -2250,7 +2167,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function add_enclosure_if_new($post_ID, $enclosure) {
</span><del>-                if( is_array( $enclosure ) &amp;&amp; isset( $enclosure['url'] ) &amp;&amp; isset( $enclosure['length'] ) &amp;&amp; isset( $enclosure['type'] ) ) {
</del><ins>+                if ( is_array( $enclosure ) &amp;&amp; isset( $enclosure['url'] ) &amp;&amp; isset( $enclosure['length'] ) &amp;&amp; isset( $enclosure['type'] ) ) {
</ins><span class="cx"> 
</span><span class="cx">                         $encstring = $enclosure['url'] . &quot;\n&quot; . $enclosure['length'] . &quot;\n&quot; . $enclosure['type'];
</span><span class="cx">                         $found = false;
</span><span class="lines">@@ -2264,9 +2181,8 @@
</span><span class="cx">                                         }
</span><span class="cx">                                 }
</span><span class="cx">                         }
</span><del>-                        if (!$found) {
</del><ins>+                        if (!$found)
</ins><span class="cx">                                 add_post_meta( $post_ID, 'enclosure', $encstring );
</span><del>-                        }
</del><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -2283,11 +2199,10 @@
</span><span class="cx"> 
</span><span class="cx">                 // find any unattached files
</span><span class="cx">                 $attachments = $wpdb-&gt;get_results( &quot;SELECT ID, guid FROM {$wpdb-&gt;posts} WHERE post_parent = '0' AND post_type = 'attachment'&quot; );
</span><del>-                if( is_array( $attachments ) ) {
-                        foreach( $attachments as $file ) {
-                                if( strpos( $post_content, $file-&gt;guid ) !== false ) {
</del><ins>+                if ( is_array( $attachments ) ) {
+                        foreach ( $attachments as $file ) {
+                                if ( strpos( $post_content, $file-&gt;guid ) !== false )
</ins><span class="cx">                                         $wpdb-&gt;update($wpdb-&gt;posts, array('post_parent' =&gt; $post_ID), array('ID' =&gt; $file-&gt;ID) );
</span><del>-                                }
</del><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="lines">@@ -2310,9 +2225,8 @@
</span><span class="cx">                 $content_struct = $args[3];
</span><span class="cx">                 $publish     = $args[4];
</span><span class="cx"> 
</span><del>-                if ( !$user = $this-&gt;login($username, $password) ) {
</del><ins>+                if ( !$user = $this-&gt;login($username, $password) )
</ins><span class="cx">                         return $this-&gt;error;
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 do_action('xmlrpc_call', 'metaWeblog.editPost');
</span><span class="cx"> 
</span><span class="lines">@@ -2320,77 +2234,64 @@
</span><span class="cx">                 $error_message = __( 'Sorry, you are not allowed to publish posts on this blog.' );
</span><span class="cx">                 $post_type = 'post';
</span><span class="cx">                 $page_template = '';
</span><del>-                if( !empty( $content_struct['post_type'] ) ) {
-                        if( $content_struct['post_type'] == 'page' ) {
</del><ins>+                if ( !empty( $content_struct['post_type'] ) ) {
+                        if ( $content_struct['post_type'] == 'page' ) {
</ins><span class="cx">                                 $cap = ( $publish ) ? 'publish_pages' : 'edit_pages';
</span><span class="cx">                                 $error_message = __( 'Sorry, you are not allowed to publish pages on this blog.' );
</span><span class="cx">                                 $post_type = 'page';
</span><del>-                                if( !empty( $content_struct['wp_page_template'] ) )
</del><ins>+                                if ( !empty( $content_struct['wp_page_template'] ) )
</ins><span class="cx">                                         $page_template = $content_struct['wp_page_template'];
</span><del>-                        }
-                        elseif( $content_struct['post_type'] == 'post' ) {
</del><ins>+                        } elseif( $content_struct['post_type'] == 'post' ) {
</ins><span class="cx">                                 // This is the default, no changes needed
</span><del>-                        }
-                        else {
</del><ins>+                        } else {
</ins><span class="cx">                                 // No other post_type values are allowed here
</span><span class="cx">                                 return new IXR_Error( 401, __( 'Invalid post type.' ) );
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                if( !current_user_can( $cap ) ) {
</del><ins>+                if ( !current_user_can( $cap ) )
</ins><span class="cx">                         return new IXR_Error( 401, $error_message );
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 $postdata = wp_get_single_post($post_ID, ARRAY_A);
</span><span class="cx"> 
</span><span class="cx">                 // If there is no post data for the give post id, stop
</span><span class="cx">                 // now and return an error.  Other wise a new post will be
</span><span class="cx">                 // created (which was the old behavior).
</span><del>-                if(empty($postdata[&quot;ID&quot;])) {
</del><ins>+                if ( empty($postdata[&quot;ID&quot;]) )
</ins><span class="cx">                         return(new IXR_Error(404, __(&quot;Invalid post ID.&quot;)));
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 $this-&gt;escape($postdata);
</span><span class="cx">                 extract($postdata, EXTR_SKIP);
</span><span class="cx"> 
</span><span class="cx">                 // Let WordPress manage slug if none was provided.
</span><span class="cx">                 $post_name = &quot;&quot;;
</span><del>-                if(isset($content_struct[&quot;wp_slug&quot;])) {
</del><ins>+                if ( isset($content_struct[&quot;wp_slug&quot;]) )
</ins><span class="cx">                         $post_name = $content_struct[&quot;wp_slug&quot;];
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 // Only use a password if one was given.
</span><del>-                if(isset($content_struct[&quot;wp_password&quot;])) {
</del><ins>+                if ( isset($content_struct[&quot;wp_password&quot;]) )
</ins><span class="cx">                         $post_password = $content_struct[&quot;wp_password&quot;];
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 // Only set a post parent if one was given.
</span><del>-                if(isset($content_struct[&quot;wp_page_parent_id&quot;])) {
</del><ins>+                if ( isset($content_struct[&quot;wp_page_parent_id&quot;]) )
</ins><span class="cx">                         $post_parent = $content_struct[&quot;wp_page_parent_id&quot;];
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 // Only set the menu_order if it was given.
</span><del>-                if(isset($content_struct[&quot;wp_page_order&quot;])) {
</del><ins>+                if ( isset($content_struct[&quot;wp_page_order&quot;]) )
</ins><span class="cx">                         $menu_order = $content_struct[&quot;wp_page_order&quot;];
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 $post_author = $postdata[&quot;post_author&quot;];
</span><span class="cx"> 
</span><span class="cx">                 // Only set the post_author if one is set.
</span><del>-                if(
-                        isset($content_struct[&quot;wp_author_id&quot;])
-                        &amp;&amp; ($user-&gt;ID != $content_struct[&quot;wp_author_id&quot;])
-                ) {
-                        switch($post_type) {
</del><ins>+                if ( isset($content_struct[&quot;wp_author_id&quot;]) &amp;&amp; ($user-&gt;ID != $content_struct[&quot;wp_author_id&quot;]) ) {
+                        switch ( $post_type ) {
</ins><span class="cx">                                 case &quot;post&quot;:
</span><del>-                                        if(!current_user_can(&quot;edit_others_posts&quot;)) {
</del><ins>+                                        if ( !current_user_can(&quot;edit_others_posts&quot;) )
</ins><span class="cx">                                                 return(new IXR_Error(401, __(&quot;You are not allowed to change the post author as this user.&quot;)));
</span><del>-                                        }
</del><span class="cx">                                         break;
</span><span class="cx">                                 case &quot;page&quot;:
</span><del>-                                        if(!current_user_can(&quot;edit_others_pages&quot;)) {
</del><ins>+                                        if ( !current_user_can(&quot;edit_others_pages&quot;) )
</ins><span class="cx">                                                 return(new IXR_Error(401, __(&quot;You are not allowed to change the page author as this user.&quot;)));
</span><del>-                                        }
</del><span class="cx">                                         break;
</span><span class="cx">                                 default:
</span><span class="cx">                                         return(new IXR_Error(401, __(&quot;Invalid post type.&quot;)));
</span><span class="lines">@@ -2399,9 +2300,9 @@
</span><span class="cx">                         $post_author = $content_struct[&quot;wp_author_id&quot;];
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                if(isset($content_struct[&quot;mt_allow_comments&quot;])) {
-                        if(!is_numeric($content_struct[&quot;mt_allow_comments&quot;])) {
-                                switch($content_struct[&quot;mt_allow_comments&quot;]) {
</del><ins>+                if ( isset($content_struct[&quot;mt_allow_comments&quot;]) ) {
+                        if ( !is_numeric($content_struct[&quot;mt_allow_comments&quot;]) ) {
+                                switch ( $content_struct[&quot;mt_allow_comments&quot;] ) {
</ins><span class="cx">                                         case &quot;closed&quot;:
</span><span class="cx">                                                 $comment_status = &quot;closed&quot;;
</span><span class="cx">                                                 break;
</span><span class="lines">@@ -2412,9 +2313,8 @@
</span><span class="cx">                                                 $comment_status = get_option(&quot;default_comment_status&quot;);
</span><span class="cx">                                                 break;
</span><span class="cx">                                 }
</span><del>-                        }
-                        else {
-                                switch((int) $content_struct[&quot;mt_allow_comments&quot;]) {
</del><ins>+                        } else {
+                                switch ( (int) $content_struct[&quot;mt_allow_comments&quot;] ) {
</ins><span class="cx">                                         case 0:
</span><span class="cx">                                         case 2:
</span><span class="cx">                                                 $comment_status = &quot;closed&quot;;
</span><span class="lines">@@ -2429,9 +2329,9 @@
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                if(isset($content_struct[&quot;mt_allow_pings&quot;])) {
-                        if(!is_numeric($content_struct[&quot;mt_allow_pings&quot;])) {
-                                switch($content_struct[&quot;mt_allow_pings&quot;]) {
</del><ins>+                if ( isset($content_struct[&quot;mt_allow_pings&quot;]) ) {
+                        if ( !is_numeric($content_struct[&quot;mt_allow_pings&quot;]) ) {
+                                switch ( $content_struct[&quot;mt_allow_pings&quot;] ) {
</ins><span class="cx">                                         case &quot;closed&quot;:
</span><span class="cx">                                                 $ping_status = &quot;closed&quot;;
</span><span class="cx">                                                 break;
</span><span class="lines">@@ -2442,9 +2342,8 @@
</span><span class="cx">                                                 $ping_status = get_option(&quot;default_ping_status&quot;);
</span><span class="cx">                                                 break;
</span><span class="cx">                                 }
</span><del>-                        }
-                        else {
-                                switch((int) $content_struct[&quot;mt_allow_pings&quot;]) {
</del><ins>+                        } else {
+                                switch ( (int) $content_struct[&quot;mt_allow_pings&quot;] ) {
</ins><span class="cx">                                         case 0:
</span><span class="cx">                                                 $ping_status = &quot;closed&quot;;
</span><span class="cx">                                                 break;
</span><span class="lines">@@ -2464,7 +2363,7 @@
</span><span class="cx"> 
</span><span class="cx">                 $post_category = array();
</span><span class="cx"> 
</span><del>-                if (is_array($catnames)) {
</del><ins>+                if ( is_array($catnames) ) {
</ins><span class="cx">                         foreach ($catnames as $cat) {
</span><span class="cx">                                  $post_category[] = get_cat_ID($cat);
</span><span class="cx">                         }
</span><span class="lines">@@ -2474,7 +2373,7 @@
</span><span class="cx">                 $post_more = $content_struct['mt_text_more'];
</span><span class="cx"> 
</span><span class="cx">                 $post_status = $publish ? 'publish' : 'draft';
</span><del>-                if( isset( $content_struct[&quot;{$post_type}_status&quot;] ) ) {
</del><ins>+                if ( isset( $content_struct[&quot;{$post_type}_status&quot;] ) ) {
</ins><span class="cx">                         switch( $content_struct[&quot;{$post_type}_status&quot;] ) {
</span><span class="cx">                                 case 'draft':
</span><span class="cx">                                 case 'private':
</span><span class="lines">@@ -2483,9 +2382,8 @@
</span><span class="cx">                                         break;
</span><span class="cx">                                 case 'pending':
</span><span class="cx">                                         // Pending is only valid for posts, not pages.
</span><del>-                                        if( $post_type === 'post' ) {
</del><ins>+                                        if ( $post_type === 'post' )
</ins><span class="cx">                                                 $post_status = $content_struct[&quot;{$post_type}_status&quot;];
</span><del>-                                        }
</del><span class="cx">                                         break;
</span><span class="cx">                                 default:
</span><span class="cx">                                         $post_status = $publish ? 'publish' : 'draft';
</span><span class="lines">@@ -2502,9 +2400,8 @@
</span><span class="cx">                                 return new IXR_Error(401, __('Sorry, you do not have the right to publish this post.'));
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                if ($post_more) {
</del><ins>+                if ( $post_more )
</ins><span class="cx">                         $post_content = $post_content . &quot;&lt;!--more--&gt;&quot; . $post_more;
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 $to_ping = $content_struct['mt_tb_ping_urls'];
</span><span class="cx">                 if ( is_array($to_ping) )
</span><span class="lines">@@ -2531,20 +2428,19 @@
</span><span class="cx">                 if ( is_wp_error( $result ) )
</span><span class="cx">                         return new IXR_Error(500, $result-&gt;get_error_message());
</span><span class="cx"> 
</span><del>-                if (!$result) {
</del><ins>+                if ( !$result )
</ins><span class="cx">                         return new IXR_Error(500, __('Sorry, your entry could not be edited. Something wrong happened.'));
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 // Only posts can be sticky
</span><del>-                if ( $post_type == 'post' &amp;&amp; isset( $content_struct['sticky'] ) )
</del><ins>+                if ( $post_type == 'post' &amp;&amp; isset( $content_struct['sticky'] ) ) {
</ins><span class="cx">                         if ( $content_struct['sticky'] == true )
</span><span class="cx">                                 stick_post( $post_ID );
</span><span class="cx">                         elseif ( $content_struct['sticky'] == false )
</span><span class="cx">                                 unstick_post( $post_ID );
</span><ins>+                }
</ins><span class="cx"> 
</span><del>-                if ( isset($content_struct['custom_fields']) ) {
</del><ins>+                if ( isset($content_struct['custom_fields']) )
</ins><span class="cx">                         $this-&gt;set_custom_fields($post_ID, $content_struct['custom_fields']);
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 // Handle enclosures
</span><span class="cx">                 $this-&gt;add_enclosure_if_new($post_ID, $content_struct['enclosure']);
</span><span class="lines">@@ -2572,11 +2468,10 @@
</span><span class="cx">                 $username  = $args[1];
</span><span class="cx">                 $password   = $args[2];
</span><span class="cx"> 
</span><del>-                if ( !$user = $this-&gt;login($username, $password) ) {
</del><ins>+                if ( !$user = $this-&gt;login($username, $password) )
</ins><span class="cx">                         return $this-&gt;error;
</span><del>-                }
</del><span class="cx"> 
</span><del>-                if( !current_user_can( 'edit_post', $post_ID ) )
</del><ins>+                if ( !current_user_can( 'edit_post', $post_ID ) )
</ins><span class="cx">                         return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) );
</span><span class="cx"> 
</span><span class="cx">                 do_action('xmlrpc_call', 'metaWeblog.getPost');
</span><span class="lines">@@ -2588,9 +2483,8 @@
</span><span class="cx">                         $post_date_gmt = mysql2date('Ymd\TH:i:s', $postdata['post_date_gmt'], false);
</span><span class="cx"> 
</span><span class="cx">                         // For drafts use the GMT version of the post date
</span><del>-                        if ( $postdata['post_status'] == 'draft' ) {
</del><ins>+                        if ( $postdata['post_status'] == 'draft' )
</ins><span class="cx">                                 $post_date_gmt = get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $postdata['post_date'] ), 'Ymd\TH:i:s' );
</span><del>-                        }
</del><span class="cx"> 
</span><span class="cx">                         $categories = array();
</span><span class="cx">                         $catids = wp_get_post_categories($post_ID);
</span><span class="lines">@@ -2617,9 +2511,8 @@
</span><span class="cx">                         $allow_pings = ('open' == $postdata['ping_status']) ? 1 : 0;
</span><span class="cx"> 
</span><span class="cx">                         // Consider future posts as published
</span><del>-                        if( $postdata['post_status'] === 'future' ) {
</del><ins>+                        if ( $postdata['post_status'] === 'future' )
</ins><span class="cx">                                 $postdata['post_status'] = 'publish';
</span><del>-                        }
</del><span class="cx"> 
</span><span class="cx">                         $sticky = false;
</span><span class="cx">                         if ( is_sticky( $post_ID ) )
</span><span class="lines">@@ -2664,7 +2557,7 @@
</span><span class="cx">                                 'sticky' =&gt; $sticky
</span><span class="cx">                         );
</span><span class="cx"> 
</span><del>-                        if (!empty($enclosure)) $resp['enclosure'] = $enclosure;
</del><ins>+                        if ( !empty($enclosure) ) $resp['enclosure'] = $enclosure;
</ins><span class="cx"> 
</span><span class="cx">                         return $resp;
</span><span class="cx">                 } else {
</span><span class="lines">@@ -2689,35 +2582,31 @@
</span><span class="cx">                 $password   = $args[2];
</span><span class="cx">                 $num_posts   = (int) $args[3];
</span><span class="cx"> 
</span><del>-                if ( !$user = $this-&gt;login($username, $password) ) {
</del><ins>+                if ( !$user = $this-&gt;login($username, $password) )
</ins><span class="cx">                         return $this-&gt;error;
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 do_action('xmlrpc_call', 'metaWeblog.getRecentPosts');
</span><span class="cx"> 
</span><span class="cx">                 $posts_list = wp_get_recent_posts($num_posts);
</span><span class="cx"> 
</span><del>-                if (!$posts_list) {
</del><ins>+                if ( !$posts_list )
</ins><span class="cx">                         return array( );
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 foreach ($posts_list as $entry) {
</span><del>-                        if( !current_user_can( 'edit_post', $entry['ID'] ) )
</del><ins>+                        if ( !current_user_can( 'edit_post', $entry['ID'] ) )
</ins><span class="cx">                                 continue;
</span><span class="cx"> 
</span><span class="cx">                         $post_date = mysql2date('Ymd\TH:i:s', $entry['post_date'], false);
</span><span class="cx">                         $post_date_gmt = mysql2date('Ymd\TH:i:s', $entry['post_date_gmt'], false);
</span><span class="cx"> 
</span><span class="cx">                         // For drafts use the GMT version of the date
</span><del>-                        if ( $entry['post_status'] == 'draft' ) {
</del><ins>+                        if ( $entry['post_status'] == 'draft' )
</ins><span class="cx">                                 $post_date_gmt = get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $entry['post_date'] ), 'Ymd\TH:i:s' );
</span><del>-                        }
</del><span class="cx"> 
</span><span class="cx">                         $categories = array();
</span><span class="cx">                         $catids = wp_get_post_categories($entry['ID']);
</span><del>-                        foreach($catids as $catid) {
</del><ins>+                        foreach( $catids as $catid )
</ins><span class="cx">                                 $categories[] = get_cat_name($catid);
</span><del>-                        }
</del><span class="cx"> 
</span><span class="cx">                         $tagnames = array();
</span><span class="cx">                         $tags = wp_get_post_tags( $entry['ID'] );
</span><span class="lines">@@ -2740,9 +2629,8 @@
</span><span class="cx">                         $allow_pings = ('open' == $entry['ping_status']) ? 1 : 0;
</span><span class="cx"> 
</span><span class="cx">                         // Consider future posts as published
</span><del>-                        if( $entry['post_status'] === 'future' ) {
</del><ins>+                        if ( $entry['post_status'] === 'future' )
</ins><span class="cx">                                 $entry['post_status'] = 'publish';
</span><del>-                        }
</del><span class="cx"> 
</span><span class="cx">                         $struct[] = array(
</span><span class="cx">                                 'dateCreated' =&gt; new IXR_Date($post_date),
</span><span class="lines">@@ -2772,7 +2660,7 @@
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 $recent_posts = array();
</span><del>-                for ($j=0; $j&lt;count($struct); $j++) {
</del><ins>+                for ( $j=0; $j&lt;count($struct); $j++ ) {
</ins><span class="cx">                         array_push($recent_posts, $struct[$j]);
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="lines">@@ -2795,11 +2683,10 @@
</span><span class="cx">                 $username  = $args[1];
</span><span class="cx">                 $password   = $args[2];
</span><span class="cx"> 
</span><del>-                if ( !$user = $this-&gt;login($username, $password) ) {
</del><ins>+                if ( !$user = $this-&gt;login($username, $password) )
</ins><span class="cx">                         return $this-&gt;error;
</span><del>-                }
</del><span class="cx"> 
</span><del>-                if( !current_user_can( 'edit_posts' ) )
</del><ins>+                if ( !current_user_can( 'edit_posts' ) )
</ins><span class="cx">                         return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this blog in order to view categories.' ) );
</span><span class="cx"> 
</span><span class="cx">                 do_action('xmlrpc_call', 'metaWeblog.getCategories');
</span><span class="lines">@@ -2849,9 +2736,8 @@
</span><span class="cx"> 
</span><span class="cx">                 logIO('O', '(MW) Received '.strlen($bits).' bytes');
</span><span class="cx"> 
</span><del>-                if ( !$user = $this-&gt;login($username, $password) ) {
</del><ins>+                if ( !$user = $this-&gt;login($username, $password) )
</ins><span class="cx">                         return $this-&gt;error;
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 do_action('xmlrpc_call', 'metaWeblog.newMediaObject');
</span><span class="cx"> 
</span><span class="lines">@@ -2864,7 +2750,7 @@
</span><span class="cx">                 if ( $upload_err = apply_filters( &quot;pre_upload_error&quot;, false ) )
</span><span class="cx">                         return new IXR_Error(500, $upload_err);
</span><span class="cx"> 
</span><del>-                if(!empty($data[&quot;overwrite&quot;]) &amp;&amp; ($data[&quot;overwrite&quot;] == true)) {
</del><ins>+                if ( !empty($data[&quot;overwrite&quot;]) &amp;&amp; ($data[&quot;overwrite&quot;] == true) ) {
</ins><span class="cx">                         // Get postmeta info on the object.
</span><span class="cx">                         $old_file = $wpdb-&gt;get_row(&quot;
</span><span class="cx">                                 SELECT ID
</span><span class="lines">@@ -2928,15 +2814,14 @@
</span><span class="cx">                 $password   = $args[2];
</span><span class="cx">                 $num_posts   = (int) $args[3];
</span><span class="cx"> 
</span><del>-                if ( !$user = $this-&gt;login($username, $password) ) {
</del><ins>+                if ( !$user = $this-&gt;login($username, $password) )
</ins><span class="cx">                         return $this-&gt;error;
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 do_action('xmlrpc_call', 'mt.getRecentPostTitles');
</span><span class="cx"> 
</span><span class="cx">                 $posts_list = wp_get_recent_posts($num_posts);
</span><span class="cx"> 
</span><del>-                if (!$posts_list) {
</del><ins>+                if ( !$posts_list ) {
</ins><span class="cx">                         $this-&gt;error = new IXR_Error(500, __('Either there are no posts, or something went wrong.'));
</span><span class="cx">                         return $this-&gt;error;
</span><span class="cx">                 }
</span><span class="lines">@@ -2949,9 +2834,8 @@
</span><span class="cx">                         $post_date_gmt = mysql2date('Ymd\TH:i:s', $entry['post_date_gmt'], false);
</span><span class="cx"> 
</span><span class="cx">                         // For drafts use the GMT version of the date
</span><del>-                        if ( $entry['post_status'] == 'draft' ) {
</del><ins>+                        if ( $entry['post_status'] == 'draft' )
</ins><span class="cx">                                 $post_date_gmt = get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $entry['post_date'] ), 'Ymd\TH:i:s' );
</span><del>-                        }
</del><span class="cx"> 
</span><span class="cx">                         $struct[] = array(
</span><span class="cx">                                 'dateCreated' =&gt; new IXR_Date($post_date),
</span><span class="lines">@@ -2964,7 +2848,7 @@
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 $recent_posts = array();
</span><del>-                for ($j=0; $j&lt;count($struct); $j++) {
</del><ins>+                for ( $j=0; $j&lt;count($struct); $j++ ) {
</ins><span class="cx">                         array_push($recent_posts, $struct[$j]);
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="lines">@@ -2987,11 +2871,10 @@
</span><span class="cx">                 $username  = $args[1];
</span><span class="cx">                 $password   = $args[2];
</span><span class="cx"> 
</span><del>-                if ( !$user = $this-&gt;login($username, $password) ) {
</del><ins>+                if ( !$user = $this-&gt;login($username, $password) )
</ins><span class="cx">                         return $this-&gt;error;
</span><del>-                }
</del><span class="cx"> 
</span><del>-                if( !current_user_can( 'edit_posts' ) )
</del><ins>+                if ( !current_user_can( 'edit_posts' ) )
</ins><span class="cx">                         return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this blog in order to view categories.' ) );
</span><span class="cx"> 
</span><span class="cx">                 do_action('xmlrpc_call', 'mt.getCategoryList');
</span><span class="lines">@@ -2999,7 +2882,7 @@
</span><span class="cx">                 $categories_struct = array();
</span><span class="cx"> 
</span><span class="cx">                 if ( $cats = get_categories(array('hide_empty' =&gt; 0, 'hierarchical' =&gt; 0)) ) {
</span><del>-                        foreach ($cats as $cat) {
</del><ins>+                        foreach ( $cats as $cat ) {
</ins><span class="cx">                                 $struct['categoryId'] = $cat-&gt;term_id;
</span><span class="cx">                                 $struct['categoryName'] = $cat-&gt;name;
</span><span class="cx"> 
</span><span class="lines">@@ -3026,11 +2909,10 @@
</span><span class="cx">                 $username  = $args[1];
</span><span class="cx">                 $password   = $args[2];
</span><span class="cx"> 
</span><del>-                if ( !$user = $this-&gt;login($username, $password) ) {
</del><ins>+                if ( !$user = $this-&gt;login($username, $password) )
</ins><span class="cx">                         return $this-&gt;error;
</span><del>-                }
</del><span class="cx"> 
</span><del>-                if( !current_user_can( 'edit_post', $post_ID ) )
</del><ins>+                if ( !current_user_can( 'edit_post', $post_ID ) )
</ins><span class="cx">                         return new IXR_Error( 401, __( 'Sorry, you can not edit this post.' ) );
</span><span class="cx"> 
</span><span class="cx">                 do_action('xmlrpc_call', 'mt.getPostCategories');
</span><span class="lines">@@ -3039,7 +2921,7 @@
</span><span class="cx">                 $catids = wp_get_post_categories(intval($post_ID));
</span><span class="cx">                 // first listed category will be the primary category
</span><span class="cx">                 $isPrimary = true;
</span><del>-                foreach($catids as $catid) {
</del><ins>+                foreach ( $catids as $catid ) {
</ins><span class="cx">                         $categories[] = array(
</span><span class="cx">                                 'categoryName' =&gt; get_cat_name($catid),
</span><span class="cx">                                 'categoryId' =&gt; (string) $catid,
</span><span class="lines">@@ -3068,16 +2950,15 @@
</span><span class="cx">                 $password   = $args[2];
</span><span class="cx">                 $categories  = $args[3];
</span><span class="cx"> 
</span><del>-                if ( !$user = $this-&gt;login($username, $password) ) {
</del><ins>+                if ( !$user = $this-&gt;login($username, $password) )
</ins><span class="cx">                         return $this-&gt;error;
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 do_action('xmlrpc_call', 'mt.setPostCategories');
</span><span class="cx"> 
</span><span class="cx">                 if ( !current_user_can('edit_post', $post_ID) )
</span><span class="cx">                         return new IXR_Error(401, __('Sorry, you cannot edit this post.'));
</span><span class="cx"> 
</span><del>-                foreach($categories as $cat) {
</del><ins>+                foreach ( $categories as $cat ) {
</ins><span class="cx">                         $catids[] = $cat['categoryId'];
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="lines">@@ -3099,7 +2980,7 @@
</span><span class="cx">                 do_action('xmlrpc_call', 'mt.supportedMethods');
</span><span class="cx"> 
</span><span class="cx">                 $supported_methods = array();
</span><del>-                foreach($this-&gt;methods as $key=&gt;$value) {
</del><ins>+                foreach ( $this-&gt;methods as $key =&gt; $value ) {
</ins><span class="cx">                         $supported_methods[] = $key;
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="lines">@@ -3136,18 +3017,16 @@
</span><span class="cx"> 
</span><span class="cx">                 $actual_post = wp_get_single_post($post_ID, ARRAY_A);
</span><span class="cx"> 
</span><del>-                if (!$actual_post) {
</del><ins>+                if ( !$actual_post )
</ins><span class="cx">                         return new IXR_Error(404, __('Sorry, no such post.'));
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 $comments = $wpdb-&gt;get_results( $wpdb-&gt;prepare(&quot;SELECT comment_author_url, comment_content, comment_author_IP, comment_type FROM $wpdb-&gt;comments WHERE comment_post_ID = %d&quot;, $post_ID) );
</span><span class="cx"> 
</span><del>-                if (!$comments) {
</del><ins>+                if ( !$comments )
</ins><span class="cx">                         return array();
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 $trackback_pings = array();
</span><del>-                foreach($comments as $comment) {
</del><ins>+                foreach ( $comments as $comment ) {
</ins><span class="cx">                         if ( 'trackback' == $comment-&gt;comment_type ) {
</span><span class="cx">                                 $content = $comment-&gt;comment_content;
</span><span class="cx">                                 $title = substr($content, 8, (strpos($content, '&lt;/strong&gt;') - 8));
</span><span class="lines">@@ -3156,8 +3035,8 @@
</span><span class="cx">                                         'pingURL'   =&gt; $comment-&gt;comment_author_url,
</span><span class="cx">                                         'pingIP'    =&gt; $comment-&gt;comment_author_IP
</span><span class="cx">                                 );
</span><ins>+                        }
</ins><span class="cx">                 }
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 return $trackback_pings;
</span><span class="cx">         }
</span><span class="lines">@@ -3178,9 +3057,8 @@
</span><span class="cx">                 $username  = $args[1];
</span><span class="cx">                 $password   = $args[2];
</span><span class="cx"> 
</span><del>-                if ( !$user = $this-&gt;login($username, $password) ) {
</del><ins>+                if ( !$user = $this-&gt;login($username, $password) )
</ins><span class="cx">                         return $this-&gt;error;
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 do_action('xmlrpc_call', 'mt.publishPost');
</span><span class="cx"> 
</span><span class="lines">@@ -3231,36 +3109,36 @@
</span><span class="cx"> 
</span><span class="cx">                 // Check if the page linked to is in our site
</span><span class="cx">                 $pos1 = strpos($pagelinkedto, str_replace(array('http://www.','http://','https://www.','https://'), '', get_option('home')));
</span><del>-                if( !$pos1 )
</del><ins>+                if ( !$pos1 )
</ins><span class="cx">                         return new IXR_Error(0, __('Is there no link to us?'));
</span><span class="cx"> 
</span><span class="cx">                 // let's find which post is linked to
</span><span class="cx">                 // FIXME: does url_to_postid() cover all these cases already?
</span><span class="cx">                 //        if so, then let's use it and drop the old code.
</span><span class="cx">                 $urltest = parse_url($pagelinkedto);
</span><del>-                if ($post_ID = url_to_postid($pagelinkedto)) {
</del><ins>+                if ( $post_ID = url_to_postid($pagelinkedto) ) {
</ins><span class="cx">                         $way = 'url_to_postid()';
</span><del>-                } elseif (preg_match('#p/[0-9]{1,}#', $urltest['path'], $match)) {
</del><ins>+                } elseif ( preg_match('#p/[0-9]{1,}#', $urltest['path'], $match) ) {
</ins><span class="cx">                         // the path defines the post_ID (archives/p/XXXX)
</span><span class="cx">                         $blah = explode('/', $match[0]);
</span><span class="cx">                         $post_ID = (int) $blah[1];
</span><span class="cx">                         $way = 'from the path';
</span><del>-                } elseif (preg_match('#p=[0-9]{1,}#', $urltest['query'], $match)) {
</del><ins>+                } elseif ( preg_match('#p=[0-9]{1,}#', $urltest['query'], $match) ) {
</ins><span class="cx">                         // the querystring defines the post_ID (?p=XXXX)
</span><span class="cx">                         $blah = explode('=', $match[0]);
</span><span class="cx">                         $post_ID = (int) $blah[1];
</span><span class="cx">                         $way = 'from the querystring';
</span><del>-                } elseif (isset($urltest['fragment'])) {
</del><ins>+                } elseif ( isset($urltest['fragment']) ) {
</ins><span class="cx">                         // an #anchor is there, it's either...
</span><del>-                        if (intval($urltest['fragment'])) {
</del><ins>+                        if ( intval($urltest['fragment']) ) {
</ins><span class="cx">                                 // ...an integer #XXXX (simpliest case)
</span><span class="cx">                                 $post_ID = (int) $urltest['fragment'];
</span><span class="cx">                                 $way = 'from the fragment (numeric)';
</span><del>-                        } elseif (preg_match('/post-[0-9]+/',$urltest['fragment'])) {
</del><ins>+                        } elseif ( preg_match('/post-[0-9]+/',$urltest['fragment']) ) {
</ins><span class="cx">                                 // ...a post id in the form 'post-###'
</span><span class="cx">                                 $post_ID = preg_replace('/[^0-9]+/', '', $urltest['fragment']);
</span><span class="cx">                                 $way = 'from the fragment (post-###)';
</span><del>-                        } elseif (is_string($urltest['fragment'])) {
</del><ins>+                        } elseif ( is_string($urltest['fragment']) ) {
</ins><span class="cx">                                 // ...or a string #title, a little more complicated
</span><span class="cx">                                 $title = preg_replace('/[^a-z0-9]/i', '.', $urltest['fragment']);
</span><span class="cx">                                 $sql = $wpdb-&gt;prepare(&quot;SELECT ID FROM $wpdb-&gt;posts WHERE post_title RLIKE %s&quot;, $title);
</span><span class="lines">@@ -3395,26 +3273,25 @@
</span><span class="cx">                 $url = $args;
</span><span class="cx"> 
</span><span class="cx">                 $post_ID = url_to_postid($url);
</span><del>-                if (!$post_ID) {
</del><ins>+                if ( !$post_ID ) {
</ins><span class="cx">                         // We aren't sure that the resource is available and/or pingback enabled
</span><span class="cx">                           return new IXR_Error(33, __('The specified target URL cannot be used as a target. It either doesn&amp;#8217;t exist, or it is not a pingback-enabled resource.'));
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 $actual_post = wp_get_single_post($post_ID, ARRAY_A);
</span><span class="cx"> 
</span><del>-                if (!$actual_post) {
</del><ins>+                if ( !$actual_post ) {
</ins><span class="cx">                         // No such post = resource not found
</span><span class="cx">                           return new IXR_Error(32, __('The specified target URL does not exist.'));
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 $comments = $wpdb-&gt;get_results( $wpdb-&gt;prepare(&quot;SELECT comment_author_url, comment_content, comment_author_IP, comment_type FROM $wpdb-&gt;comments WHERE comment_post_ID = %d&quot;, $post_ID) );
</span><span class="cx"> 
</span><del>-                if (!$comments) {
</del><ins>+                if ( !$comments )
</ins><span class="cx">                         return array();
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 $pingbacks = array();
</span><del>-                foreach($comments as $comment) {
</del><ins>+                foreach ( $comments as $comment ) {
</ins><span class="cx">                         if ( 'pingback' == $comment-&gt;comment_type )
</span><span class="cx">                                 $pingbacks[] = $comment-&gt;comment_author_url;
</span><span class="cx">                 }
</span></span></pre>
</div>
</div>

</body>
</html>