<!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'); ?>
</span><span class="cx"> </head>
</span><span class="cx"> <body class="login">
</span><del>-<?php if( !is_multisite() ) { ?>
</del><ins>+<?php if ( !is_multisite() ) { ?>
</ins><span class="cx"> <div id="login"><h1><a href="<?php echo apply_filters('login_headerurl', 'http://wordpress.org/'); ?>" title="<?php echo apply_filters('login_headertitle', __('Powered by WordPress')); ?>"><?php bloginfo('name'); ?></a></h1>
</span><span class="cx"> <?php } else { ?>
</span><span class="cx"> <div id="login"><h1><a href="<?php echo apply_filters('login_headerurl', 'http://' . $current_site->domain . $current_site->path ); ?>" title="<?php echo apply_filters('login_headertitle', $current_site->site_name ); ?>"><span class="hide"><?php bloginfo('name'); ?></span></a></h1>
</span><span class="lines">@@ -165,18 +165,16 @@
</span><span class="cx">                 $wpdb->update($wpdb->users, array('user_activation_key' => $key), array('user_login' => $user_login));
</span><span class="cx">         }
</span><span class="cx">         $message = __('Someone has asked to reset the password for the following site and username.') . "\r\n\r\n";
</span><del>- if( !is_multisite() ) {
</del><ins>+ if ( !is_multisite() )
</ins><span class="cx">         $message .= get_option('siteurl') . "\r\n\r\n";
</span><del>- } else {
</del><ins>+ else
</ins><span class="cx">         $message .= 'http://' . trailingslashit( $current_site->domain . $current_site->path ) . "\r\n\r\n";
</span><del>- }
</del><span class="cx">         $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
</span><span class="cx">         $message .= __('To reset your password visit the following address, otherwise just ignore this email and nothing will happen.') . "\r\n\r\n";
</span><del>- if( !is_multisite() ) {
</del><ins>+ if ( !is_multisite() )
</ins><span class="cx">         $message .= site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login') . "\r\n";
</span><del>- } else {
</del><ins>+ else
</ins><span class="cx">         $message .= 'http://' . trailingslashit( $current_site->domain . $current_site->path ) . "wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login) . "\r\n";
</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' )) && $_GET[ 'new' ] != '' && in_array( $_GET[ 'new' ], get_site_option( 'illegal_names' ) ) == true ) {
</del><ins>+if ( is_array( get_site_option( 'illegal_names' )) && $_GET[ 'new' ] != '' && in_array( $_GET[ 'new' ], get_site_option( 'illegal_names' ) ) == true ) {
</ins><span class="cx">         wp_redirect( "http://{$current_site->domain}{$current_site->path}" );
</span><span class="cx">         die();
</span><span class="cx"> }
</span><span class="lines">@@ -22,7 +22,7 @@
</span><span class="cx">         echo "<meta name='robots' content='noindex,nofollow' />\n";
</span><span class="cx"> }
</span><span class="cx">
</span><del>-if( $current_blog->domain . $current_blog->path != $current_site->domain . $current_site->path ) {
</del><ins>+if ( $current_blog->domain . $current_blog->path != $current_site->domain . $current_site->path ) {
</ins><span class="cx">         wp_redirect( "http://" . $current_site->domain . $current_site->path . "wp-signup.php" );
</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 '<label for="blogname">' . __('Blog Name:') . '</label>';
</span><span class="cx">         else
</span><span class="cx">                 echo '<label for="blogname">' . __('Blog Domain:') . '</label>';
</span><span class="lines">@@ -65,18 +65,17 @@
</span><span class="cx">                 <p class="error"><?php echo $errmsg ?></p>
</span><span class="cx">         <?php }
</span><span class="cx">
</span><del>-        if( !is_subdomain_install() ) {
</del><ins>+        if ( !is_subdomain_install() )
</ins><span class="cx">                 echo '<span class="prefix_address">' . $current_site->domain . $current_site->path . '</span><input name="blogname" type="text" id="blogname" value="'. esc_attr($blogname) .'" maxlength="50" /><br />';
</span><del>-        } else {
</del><ins>+        else
</ins><span class="cx">                 echo '<input name="blogname" type="text" id="blogname" value="'.esc_attr($blogname).'" maxlength="50" /><span class="suffix_address">.' . $current_site->domain . $current_site->path . '</span><br />';
</span><del>-        }
</del><ins>+
</ins><span class="cx">         if ( !is_user_logged_in() ) {
</span><span class="cx">                 print '(<strong>' . __( 'Your address will be ' );
</span><del>-                if( !is_subdomain_install() ) {
</del><ins>+                if ( !is_subdomain_install() )
</ins><span class="cx">                         print $current_site->domain . $current_site->path . __( 'blogname' );
</span><del>-                } else {
</del><ins>+                else
</ins><span class="cx">                         print __( 'domain.' ) . $current_site->domain . $current_site->path;
</span><del>-                }
</del><span class="cx">                 echo '.</strong> ' . __( 'Must be at least 4 characters, letters and numbers only. It cannot be changed so choose carefully!)' ) . '</p>';
</span><span class="cx">         }
</span><span class="cx">
</span><span class="lines">@@ -95,11 +94,11 @@
</span><span class="cx"> <?php _e('I would like my blog to appear in search engines like Google and Technorati, and in public listings around this site.'); ?>
</span><span class="cx"> <div style="clear:both;"></div>
</span><span class="cx"> <label class="checkbox" for="blog_public_on">
</span><del>- <input type="radio" id="blog_public_on" name="blog_public" value="1" <?php if( !isset( $_POST['blog_public'] ) || $_POST['blog_public'] == '1' ) { ?>checked="checked"<?php } ?> />
</del><ins>+ <input type="radio" id="blog_public_on" name="blog_public" value="1" <?php if ( !isset( $_POST['blog_public'] ) || $_POST['blog_public'] == '1' ) { ?>checked="checked"<?php } ?> />
</ins><span class="cx"> <strong><?php _e( 'Yes' ); ?></strong>
</span><span class="cx"> </label>
</span><span class="cx"> <label class="checkbox" for="blog_public_off">
</span><del>- <input type="radio" id="blog_public_off" name="blog_public" value="0" <?php if( isset( $_POST['blog_public'] ) && $_POST['blog_public'] == '0' ) { ?>checked="checked"<?php } ?> />
</del><ins>+ <input type="radio" id="blog_public_off" name="blog_public" value="0" <?php if ( isset( $_POST['blog_public'] ) && $_POST['blog_public'] == '0' ) { ?>checked="checked"<?php } ?> />
</ins><span class="cx"> <strong><?php _e( 'No' ); ?></strong>
</span><span class="cx"> </label>
</span><span class="cx"> </p>
</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="checked"';
</span><del>-        } else {
</del><ins>+        else
</ins><span class="cx">                 $signup[ 'blog' ] = 'checked="checked"';
</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' => $user_name, 'user_email' => $user_email, 'errors' => $errors ));
</span><span class="lines">@@ -246,9 +244,9 @@
</span><span class="cx">                 <?php show_user_form($user_name, $user_email, $errors); ?>
</span><span class="cx">
</span><span class="cx">                 <p>
</span><del>-                <?php if( $active_signup == 'blog' ) { ?>
</del><ins>+                <?php if ( $active_signup == 'blog' ) { ?>
</ins><span class="cx">                         <input id="signupblog" type="hidden" name="signup_for" value="blog" />
</span><del>-                <?php } elseif( $active_signup == 'user' ) { ?>
</del><ins>+                <?php } elseif ( $active_signup == 'user' ) { ?>
</ins><span class="cx">                         <input id="signupblog" type="hidden" name="signup_for" value="user" />
</span><span class="cx">                 <?php } else { ?>
</span><span class="cx">                         <input id="signupblog" type="radio" name="signup_for" value="blog" <?php echo $signup['blog'] ?> />
</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 "all", "none", "blog" or "user"
</span><span class="cx">
</span><del>-if( is_super_admin() )
</del><ins>+if ( is_super_admin() )
</ins><span class="cx">         echo '<div class="mu_alert">' . sprintf( __( "Greetings Site Administrator! You are currently allowing '%s' registrations. To change or disable registration go to your <a href='wp-admin/ms-options.php'>Options page</a>." ), $active_signup ) . '</div>';
</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 == "none" ) {
</del><ins>+if ( $active_signup == "none" ) {
</ins><span class="cx">         _e( "Registration has been disabled." );
</span><del>-} elseif( $active_signup == 'blog' && !is_user_logged_in() ){
-        if( is_ssl() ) {
</del><ins>+} elseif ( $active_signup == 'blog' && !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( __( "You must first <a href=\"%s\">login</a>, and then you can create a new blog."), $login_url );
</span><span class="cx"> } else {
</span><span class="lines">@@ -399,7 +396,7 @@
</span><span class="cx">                                 _e( "User registration has been disabled." );
</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( "Blog registration has been disabled." );
</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( "preprocess_signup_form" ); // populate the form from invites, elsewhere?
</span><del>-                        if ( is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'blog' ) ) {
</del><ins>+                        if ( is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'blog' ) )
</ins><span class="cx">                                 signup_another_blog($newblogname);
</span><del>-                        } elseif( is_user_logged_in() == false && ( $active_signup == 'all' || $active_signup == 'user' ) ) {
</del><ins>+                        elseif( is_user_logged_in() == false && ( $active_signup == 'all' || $active_signup == 'user' ) )
</ins><span class="cx">                                 signup_user( $newblogname, $user_email );
</span><del>-                        } elseif( is_user_logged_in() == false && ( $active_signup == 'blog' ) ) {
</del><ins>+                        elseif( is_user_logged_in() == false && ( $active_signup == 'blog' ) )
</ins><span class="cx">                                 _e( "I'm sorry. We're not accepting new registrations at this time." );
</span><del>-                        } else {
</del><ins>+                        else
</ins><span class="cx">                                 _e( "You're logged in already. No need to register again!" );
</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->domain . $current_site->path . $newblogname . '/';
</span><span class="cx">                                 else
</span><span class="cx">                                         $newblog = 'http://' . $newblogname . '.' . $current_site->domain . $current_site->path;
</span><del>-                                if ($active_signup == 'blog' || $active_signup == 'all')
</del><ins>+                                if ( $active_signup == 'blog' || $active_signup == 'all' )
</ins><span class="cx">                                         printf(__("<p><em>The blog you were looking for, <strong>%s</strong> doesn't exist but you can create it now!</em></p>"), $newblog );
</span><span class="cx">                                 else
</span><span class="cx">                                         printf(__("<p><em>The blog you were looking for, <strong>%s</strong> doesn't exist.</em></p>"), $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(&$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->escape($array));
</span><del>-                }
-                else {
</del><ins>+                } else {
</ins><span class="cx">                         foreach ( (array) $array as $k => $v ) {
</span><del>-                                if (is_array($v)) {
</del><ins>+                                if ( is_array($v) ) {
</ins><span class="cx">                                         $this->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->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->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->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->site_id != $current_site->id )
</del><ins>+                        if ( $blog->site_id != $current_site->id )
</ins><span class="cx">                                 continue;
</span><span class="cx">
</span><span class="cx">                         $blog_id = $blog->userblog_id;
</span><span class="lines">@@ -505,7 +504,7 @@
</span><span class="cx">                         return $this->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->ID && ($page->post_type == "page")) {
</del><ins>+                if ( $page->ID && ($page->post_type == "page") ) {
</ins><span class="cx">                         // Get all of the page content and link.
</span><span class="cx">                         $full_page = get_extended($page->post_content);
</span><span class="cx">                         $link = post_permalink($page->ID);
</span><span class="cx">
</span><span class="cx">                         // Get info the page parent if there is one.
</span><span class="cx">                         $parent_title = "";
</span><del>-                        if(!empty($page->post_parent)) {
</del><ins>+                        if ( !empty($page->post_parent) ) {
</ins><span class="cx">                                 $parent = get_page($page->post_parent);
</span><span class="cx">                                 $parent_title = $parent->post_title;
</span><span class="cx">                         }
</span><span class="lines">@@ -535,13 +534,12 @@
</span><span class="cx">                         $page_date_gmt = mysql2date("Ymd\TH:i:s", $page->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->post_status == 'draft' ) {
</del><ins>+                        if ( $page->post_status == 'draft' )
</ins><span class="cx">                                 $page_date_gmt = get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $page->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->ID) as $cat_id) {
</del><ins>+                        foreach ( wp_get_post_categories($page->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->post_author);
</span><span class="cx">
</span><span class="cx">                         $page_template = get_post_meta( $page->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->login($username, $password) ) {
</del><ins>+                if ( !$user = $this->login($username, $password) )
</ins><span class="cx">                         return $this->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 >= 1) {
</del><ins>+                if ( $num_pages >= 1 ) {
</ins><span class="cx">                         $pages_struct = array();
</span><span class="cx">
</span><del>-                        for($i = 0; $i < $num_pages; $i++) {
</del><ins>+                        for ( $i = 0; $i < $num_pages; $i++ ) {
</ins><span class="cx">                                 $page = wp_xmlrpc_server::wp_getPage(array(
</span><span class="cx">                                         $blog_id, $pages[$i]->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->login($username, $password) ) {
</del><ins>+                if ( !$user = $this->login($username, $password) )
</ins><span class="cx">                         return $this->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("publish_pages")) {
</del><ins>+                if ( !current_user_can("publish_pages") )
</ins><span class="cx">                         return(new IXR_Error(401, __("Sorry, you cannot add new pages.")));
</span><del>-                }
</del><span class="cx">
</span><span class="cx">                 // Mark this as content for a page.
</span><span class="cx">                 $args[3]["post_type"] = "page";
</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->login($username, $password) ) {
</del><ins>+                if ( !$user = $this->login($username, $password) )
</ins><span class="cx">                         return $this->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["post_type"] != "page")
-                ) {
</del><ins>+                if ( !$actual_page || ($actual_page["post_type"] != "page") )
</ins><span class="cx">                         return(new IXR_Error(404, __("Sorry, no such page.")));
</span><del>-                }
</del><span class="cx">
</span><span class="cx">                 // Make sure the user can delete pages.
</span><del>-                if(!current_user_can("delete_page", $page_id)) {
</del><ins>+                if ( !current_user_can("delete_page", $page_id) )
</ins><span class="cx">                         return(new IXR_Error(401, __("Sorry, you do not have the right to delete this page.")));
</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, __("Failed to delete the page.")));
</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->login($username, $password) ) {
</del><ins>+                if ( !$user = $this->login($username, $password) )
</ins><span class="cx">                         return $this->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["post_type"] != "page")
-                ) {
</del><ins>+                if ( !$actual_page || ($actual_page["post_type"] != "page") )
</ins><span class="cx">                         return(new IXR_Error(404, __("Sorry, no such page.")));
</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("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 do not have the right to edit this page.")));
</span><del>-                }
</del><span class="cx">
</span><span class="cx">                 // Mark this as content for a page.
</span><span class="cx">                 $content["post_type"] = "page";
</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->login($username, $password) ) {
</del><ins>+                if ( !$user = $this->login($username, $password) )
</ins><span class="cx">                         return $this->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 < $num_pages; $i++) {
</del><ins>+                for ( $i = 0; $i < $num_pages; $i++ ) {
</ins><span class="cx">                         $post_date = mysql2date("Ymd\TH:i:s", $page_list[$i]->post_date, false);
</span><span class="cx">                         $post_date_gmt = mysql2date("Ymd\TH:i:s", $page_list[$i]->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->login($username, $password) ) {
</del><ins>+                if ( !$user = $this->login($username, $password) )
</ins><span class="cx">                         return $this->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 cannot edit posts on this blog.")));
</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">                                 "user_id" => $row->user_id,
</span><span class="cx">                                 "user_login" => $row->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->login($username, $password) ) {
</del><ins>+                if ( !$user = $this->login($username, $password) )
</ins><span class="cx">                         return $this->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->term_id;
</span><span class="cx">                                 $struct['name']                                = $tag->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->login($username, $password) ) {
</del><ins>+                if ( !$user = $this->login($username, $password) )
</ins><span class="cx">                         return $this->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("manage_categories")) {
</del><ins>+                if ( !current_user_can("manage_categories") )
</ins><span class="cx">                         return(new IXR_Error(401, __("Sorry, you do not have the right to add a category.")));
</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["slug"])) {
</del><ins>+                if ( empty($category["slug"]) )
</ins><span class="cx">                         $category["slug"] = "";
</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["parent_id"] = "";
</span><span class="cx">
</span><span class="cx">                 // If no description was provided make it empty.
</span><del>-                if(empty($category["description"])) {
</del><ins>+                if ( empty($category["description"]) )
</ins><span class="cx">                         $category["description"] = "";
</span><del>-                }
</del><span class="cx">
</span><span class="cx">                 $new_category = array(
</span><span class="cx">                         "cat_name"                                => $category["name"],
</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, __("Sorry, the new category failed.")));
</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->login($username, $password) ) {
</del><ins>+                if ( !$user = $this->login($username, $password) )
</ins><span class="cx">                         return $this->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("manage_categories") ) {
</del><ins>+                if ( !current_user_can("manage_categories") )
</ins><span class="cx">                         return new IXR_Error( 401, __( "Sorry, you do not have the right to delete a category." ) );
</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->login($username, $password) ) {
</del><ins>+                if ( !$user = $this->login($username, $password) )
</ins><span class="cx">                         return $this->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->login($username, $password) ) {
</del><ins>+                if ( !$user = $this->login($username, $password) )
</ins><span class="cx">                         return $this->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->login($username, $password) ) {
</del><ins>+                if ( !$user = $this->login($username, $password) )
</ins><span class="cx">                         return $this->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->login($username, $password) ) {
</del><ins>+                if ( !$user = $this->login($username, $password) )
</ins><span class="cx">                         return $this->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->login($username, $password) ) {
</del><ins>+                if ( !$user = $this->login($username, $password) )
</ins><span class="cx">                         return $this->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->login($username, $password) ) {
</del><ins>+                if ( !$user = $this->login($username, $password) )
</ins><span class="cx">                         return $this->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->login($username, $password) ) {
</del><ins>+                if ( !$user = $this->login($username, $password) )
</ins><span class="cx">                         return $this->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->login($username, $password) ) {
</del><ins>+                if ( !$user = $this->login($username, $password) )
</ins><span class="cx">                         return $this->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->login($username, $password) ) {
</del><ins>+                if ( !$user = $this->login($username, $password) )
</ins><span class="cx">                         return $this->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->login($username, $password) ) {
</del><ins>+                if ( !$user = $this->login($username, $password) )
</ins><span class="cx">                         return $this->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->login($username, $password) ) {
</del><ins>+                if ( !$user = $this->login($username, $password) )
</ins><span class="cx">                         return $this->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->blog_options);
</span><del>-                }
</del><span class="cx">
</span><span class="cx">                 return $this->_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->blog_options ) )
-                        {
</del><ins>+                foreach ( $options as $option ) {
+                        if ( array_key_exists( $option, $this->blog_options ) ) {
</ins><span class="cx">                                 $data[$option] = $this->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->login($username, $password) ) {
</del><ins>+                if ( !$user = $this->login($username, $password) )
</ins><span class="cx">                         return $this->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 => $o_value ) {
</del><ins>+                foreach ( $options as $o_name => $o_value ) {
</ins><span class="cx">                         $option_names[] = $o_name;
</span><del>-                        if( !array_key_exists( $o_name, $this->blog_options ) )
</del><ins>+                        if ( !array_key_exists( $o_name, $this->blog_options ) )
</ins><span class="cx">                                 continue;
</span><span class="cx">
</span><del>-                        if( $this->blog_options[$o_name]['readonly'] == true )
</del><ins>+                        if ( $this->blog_options[$o_name]['readonly'] == true )
</ins><span class="cx">                                 continue;
</span><span class="cx">
</span><span class="cx">                         update_option( $this->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->login($username, $password) ) {
</del><ins>+                if ( !$user = $this->login($username, $password) )
</ins><span class="cx">                         return $this->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->login($username, $password) ) {
</del><ins>+                if ( !$user = $this->login($username, $password) )
</ins><span class="cx">                         return $this->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->login($username, $password) ) {
</del><ins>+                if ( !$user = $this->login($username, $password) )
</ins><span class="cx">                         return $this->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->login($username, $password) ) {
</del><ins>+                if ( !$user = $this->login($username, $password) )
</ins><span class="cx">                         return $this->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->error = new IXR_Error(500, __('Either there are no posts, or something went wrong.'));
</span><span class="cx">                         return $this->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<count($struct); $j++) {
</del><ins>+                for ( $j=0; $j<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->login($username, $password) ) {
</del><ins>+                if ( !$user = $this->login($username, $password) )
</ins><span class="cx">                         return $this->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->login($username, $password) ) {
</del><ins>+                if ( !$user = $this->login($username, $password) )
</ins><span class="cx">                         return $this->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->login($username, $password) ) {
</del><ins>+                if ( !$user = $this->login($username, $password) )
</ins><span class="cx">                         return $this->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->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->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->login($username, $password) ) {
</del><ins>+                if ( !$user = $this->login($username, $password) )
</ins><span class="cx">                         return $this->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->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->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->login($username, $password) ) {
</del><ins>+                if ( !$user = $this->login($username, $password) )
</ins><span class="cx">                         return $this->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->login($username, $password) ) {
</del><ins>+                if ( !$user = $this->login($username, $password) )
</ins><span class="cx">                         return $this->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 = "";
</span><del>-                if(isset($content_struct["wp_slug"])) {
</del><ins>+                if ( isset($content_struct["wp_slug"]) )
</ins><span class="cx">                         $post_name = $content_struct["wp_slug"];
</span><del>-                }
</del><span class="cx">
</span><span class="cx">                 // Only use a password if one was given.
</span><del>-                if(isset($content_struct["wp_password"])) {
</del><ins>+                if ( isset($content_struct["wp_password"]) )
</ins><span class="cx">                         $post_password = $content_struct["wp_password"];
</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["wp_page_parent_id"])) {
</del><ins>+                if ( isset($content_struct["wp_page_parent_id"]) )
</ins><span class="cx">                         $post_parent = $content_struct["wp_page_parent_id"];
</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["wp_page_order"])) {
</del><ins>+                if ( isset($content_struct["wp_page_order"]) )
</ins><span class="cx">                         $menu_order = $content_struct["wp_page_order"];
</span><del>-                }
</del><span class="cx">
</span><span class="cx">                 $post_author = $user->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["wp_author_id"])
-                        && ($user->ID != $content_struct["wp_author_id"])
-                ) {
-                        switch($post_type) {
</del><ins>+                if ( isset($content_struct["wp_author_id"]) && ($user->ID != $content_struct["wp_author_id"]) ) {
+                        switch ( $post_type ) {
</ins><span class="cx">                                 case "post":
</span><del>-                                        if(!current_user_can("edit_others_posts")) {
</del><ins>+                                        if ( !current_user_can("edit_others_posts") )
</ins><span class="cx">                                                 return(new IXR_Error(401, __("You are not allowed to post as this user")));
</span><del>-                                        }
</del><span class="cx">                                         break;
</span><span class="cx">                                 case "page":
</span><del>-                                        if(!current_user_can("edit_others_pages")) {
</del><ins>+                                        if ( !current_user_can("edit_others_pages") )
</ins><span class="cx">                                                 return(new IXR_Error(401, __("You are not allowed to create pages as this user")));
</span><del>-                                        }
</del><span class="cx">                                         break;
</span><span class="cx">                                 default:
</span><span class="cx">                                         return(new IXR_Error(401, __("Invalid post type.")));
</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["{$post_type}_status"] ) ) {
-                        switch( $content_struct["{$post_type}_status"] ) {
</del><ins>+                if ( isset( $content_struct["{$post_type}_status"] ) ) {
+                        switch ( $content_struct["{$post_type}_status"] ) {
</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["{$post_type}_status"];
</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["mt_allow_comments"])) {
-                        if(!is_numeric($content_struct["mt_allow_comments"])) {
-                                switch($content_struct["mt_allow_comments"]) {
</del><ins>+                if ( isset($content_struct["mt_allow_comments"]) ) {
+                        if ( !is_numeric($content_struct["mt_allow_comments"]) ) {
+                                switch ( $content_struct["mt_allow_comments"] ) {
</ins><span class="cx">                                         case "closed":
</span><span class="cx">                                                 $comment_status = "closed";
</span><span class="cx">                                                 break;
</span><span class="lines">@@ -2133,9 +2056,8 @@
</span><span class="cx">                                                 $comment_status = get_option("default_comment_status");
</span><span class="cx">                                                 break;
</span><span class="cx">                                 }
</span><del>-                        }
-                        else {
-                                switch((int) $content_struct["mt_allow_comments"]) {
</del><ins>+                        } else {
+                                switch ( (int) $content_struct["mt_allow_comments"] ) {
</ins><span class="cx">                                         case 0:
</span><span class="cx">                                         case 2:
</span><span class="cx">                                                 $comment_status = "closed";
</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("default_comment_status");
</span><span class="cx">                 }
</span><span class="cx">
</span><del>-                if(isset($content_struct["mt_allow_pings"])) {
-                        if(!is_numeric($content_struct["mt_allow_pings"])) {
-                                switch($content_struct['mt_allow_pings']) {
</del><ins>+                if ( isset($content_struct["mt_allow_pings"]) ) {
+                        if ( !is_numeric($content_struct["mt_allow_pings"]) ) {
+                                switch ( $content_struct['mt_allow_pings'] ) {
</ins><span class="cx">                                         case "closed":
</span><span class="cx">                                                 $ping_status = "closed";
</span><span class="cx">                                                 break;
</span><span class="lines">@@ -2166,9 +2087,8 @@
</span><span class="cx">                                                 $ping_status = get_option("default_ping_status");
</span><span class="cx">                                                 break;
</span><span class="cx">                                 }
</span><del>-                        }
-                        else {
-                                switch((int) $content_struct["mt_allow_pings"]) {
</del><ins>+                        } else {
+                                switch ( (int) $content_struct["mt_allow_pings"] ) {
</ins><span class="cx">                                         case 0:
</span><span class="cx">                                                 $ping_status = "closed";
</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("default_ping_status");
</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 . "<!--more-->" . $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->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' && isset( $content_struct['sticky'] ) )
</del><ins>+                if ( $post_type == 'post' && 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->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->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 ) && isset( $enclosure['url'] ) && isset( $enclosure['length'] ) && isset( $enclosure['type'] ) ) {
</del><ins>+                if ( is_array( $enclosure ) && isset( $enclosure['url'] ) && isset( $enclosure['length'] ) && isset( $enclosure['type'] ) ) {
</ins><span class="cx">
</span><span class="cx">                         $encstring = $enclosure['url'] . "\n" . $enclosure['length'] . "\n" . $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->get_results( "SELECT ID, guid FROM {$wpdb->posts} WHERE post_parent = '0' AND post_type = 'attachment'" );
</span><del>-                if( is_array( $attachments ) ) {
-                        foreach( $attachments as $file ) {
-                                if( strpos( $post_content, $file->guid ) !== false ) {
</del><ins>+                if ( is_array( $attachments ) ) {
+                        foreach ( $attachments as $file ) {
+                                if ( strpos( $post_content, $file->guid ) !== false )
</ins><span class="cx">                                         $wpdb->update($wpdb->posts, array('post_parent' => $post_ID), array('ID' => $file->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->login($username, $password) ) {
</del><ins>+                if ( !$user = $this->login($username, $password) )
</ins><span class="cx">                         return $this->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["ID"])) {
</del><ins>+                if ( empty($postdata["ID"]) )
</ins><span class="cx">                         return(new IXR_Error(404, __("Invalid post ID.")));
</span><del>-                }
</del><span class="cx">
</span><span class="cx">                 $this->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 = "";
</span><del>-                if(isset($content_struct["wp_slug"])) {
</del><ins>+                if ( isset($content_struct["wp_slug"]) )
</ins><span class="cx">                         $post_name = $content_struct["wp_slug"];
</span><del>-                }
</del><span class="cx">
</span><span class="cx">                 // Only use a password if one was given.
</span><del>-                if(isset($content_struct["wp_password"])) {
</del><ins>+                if ( isset($content_struct["wp_password"]) )
</ins><span class="cx">                         $post_password = $content_struct["wp_password"];
</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["wp_page_parent_id"])) {
</del><ins>+                if ( isset($content_struct["wp_page_parent_id"]) )
</ins><span class="cx">                         $post_parent = $content_struct["wp_page_parent_id"];
</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["wp_page_order"])) {
</del><ins>+                if ( isset($content_struct["wp_page_order"]) )
</ins><span class="cx">                         $menu_order = $content_struct["wp_page_order"];
</span><del>-                }
</del><span class="cx">
</span><span class="cx">                 $post_author = $postdata["post_author"];
</span><span class="cx">
</span><span class="cx">                 // Only set the post_author if one is set.
</span><del>-                if(
-                        isset($content_struct["wp_author_id"])
-                        && ($user->ID != $content_struct["wp_author_id"])
-                ) {
-                        switch($post_type) {
</del><ins>+                if ( isset($content_struct["wp_author_id"]) && ($user->ID != $content_struct["wp_author_id"]) ) {
+                        switch ( $post_type ) {
</ins><span class="cx">                                 case "post":
</span><del>-                                        if(!current_user_can("edit_others_posts")) {
</del><ins>+                                        if ( !current_user_can("edit_others_posts") )
</ins><span class="cx">                                                 return(new IXR_Error(401, __("You are not allowed to change the post author as this user.")));
</span><del>-                                        }
</del><span class="cx">                                         break;
</span><span class="cx">                                 case "page":
</span><del>-                                        if(!current_user_can("edit_others_pages")) {
</del><ins>+                                        if ( !current_user_can("edit_others_pages") )
</ins><span class="cx">                                                 return(new IXR_Error(401, __("You are not allowed to change the page author as this user.")));
</span><del>-                                        }
</del><span class="cx">                                         break;
</span><span class="cx">                                 default:
</span><span class="cx">                                         return(new IXR_Error(401, __("Invalid post type.")));
</span><span class="lines">@@ -2399,9 +2300,9 @@
</span><span class="cx">                         $post_author = $content_struct["wp_author_id"];
</span><span class="cx">                 }
</span><span class="cx">
</span><del>-                if(isset($content_struct["mt_allow_comments"])) {
-                        if(!is_numeric($content_struct["mt_allow_comments"])) {
-                                switch($content_struct["mt_allow_comments"]) {
</del><ins>+                if ( isset($content_struct["mt_allow_comments"]) ) {
+                        if ( !is_numeric($content_struct["mt_allow_comments"]) ) {
+                                switch ( $content_struct["mt_allow_comments"] ) {
</ins><span class="cx">                                         case "closed":
</span><span class="cx">                                                 $comment_status = "closed";
</span><span class="cx">                                                 break;
</span><span class="lines">@@ -2412,9 +2313,8 @@
</span><span class="cx">                                                 $comment_status = get_option("default_comment_status");
</span><span class="cx">                                                 break;
</span><span class="cx">                                 }
</span><del>-                        }
-                        else {
-                                switch((int) $content_struct["mt_allow_comments"]) {
</del><ins>+                        } else {
+                                switch ( (int) $content_struct["mt_allow_comments"] ) {
</ins><span class="cx">                                         case 0:
</span><span class="cx">                                         case 2:
</span><span class="cx">                                                 $comment_status = "closed";
</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["mt_allow_pings"])) {
-                        if(!is_numeric($content_struct["mt_allow_pings"])) {
-                                switch($content_struct["mt_allow_pings"]) {
</del><ins>+                if ( isset($content_struct["mt_allow_pings"]) ) {
+                        if ( !is_numeric($content_struct["mt_allow_pings"]) ) {
+                                switch ( $content_struct["mt_allow_pings"] ) {
</ins><span class="cx">                                         case "closed":
</span><span class="cx">                                                 $ping_status = "closed";
</span><span class="cx">                                                 break;
</span><span class="lines">@@ -2442,9 +2342,8 @@
</span><span class="cx">                                                 $ping_status = get_option("default_ping_status");
</span><span class="cx">                                                 break;
</span><span class="cx">                                 }
</span><del>-                        }
-                        else {
-                                switch((int) $content_struct["mt_allow_pings"]) {
</del><ins>+                        } else {
+                                switch ( (int) $content_struct["mt_allow_pings"] ) {
</ins><span class="cx">                                         case 0:
</span><span class="cx">                                                 $ping_status = "closed";
</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["{$post_type}_status"] ) ) {
</del><ins>+                if ( isset( $content_struct["{$post_type}_status"] ) ) {
</ins><span class="cx">                         switch( $content_struct["{$post_type}_status"] ) {
</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["{$post_type}_status"];
</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 . "<!--more-->" . $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->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' && isset( $content_struct['sticky'] ) )
</del><ins>+                if ( $post_type == 'post' && 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->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->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->login($username, $password) ) {
</del><ins>+                if ( !$user = $this->login($username, $password) )
</ins><span class="cx">                         return $this->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' => $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->login($username, $password) ) {
</del><ins>+                if ( !$user = $this->login($username, $password) )
</ins><span class="cx">                         return $this->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' => 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<count($struct); $j++) {
</del><ins>+                for ( $j=0; $j<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->login($username, $password) ) {
</del><ins>+                if ( !$user = $this->login($username, $password) )
</ins><span class="cx">                         return $this->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->login($username, $password) ) {
</del><ins>+                if ( !$user = $this->login($username, $password) )
</ins><span class="cx">                         return $this->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( "pre_upload_error", false ) )
</span><span class="cx">                         return new IXR_Error(500, $upload_err);
</span><span class="cx">
</span><del>-                if(!empty($data["overwrite"]) && ($data["overwrite"] == true)) {
</del><ins>+                if ( !empty($data["overwrite"]) && ($data["overwrite"] == true) ) {
</ins><span class="cx">                         // Get postmeta info on the object.
</span><span class="cx">                         $old_file = $wpdb->get_row("
</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->login($username, $password) ) {
</del><ins>+                if ( !$user = $this->login($username, $password) )
</ins><span class="cx">                         return $this->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->error = new IXR_Error(500, __('Either there are no posts, or something went wrong.'));
</span><span class="cx">                         return $this->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' => 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<count($struct); $j++) {
</del><ins>+                for ( $j=0; $j<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->login($username, $password) ) {
</del><ins>+                if ( !$user = $this->login($username, $password) )
</ins><span class="cx">                         return $this->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' => 0, 'hierarchical' => 0)) ) {
</span><del>-                        foreach ($cats as $cat) {
</del><ins>+                        foreach ( $cats as $cat ) {
</ins><span class="cx">                                 $struct['categoryId'] = $cat->term_id;
</span><span class="cx">                                 $struct['categoryName'] = $cat->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->login($username, $password) ) {
</del><ins>+                if ( !$user = $this->login($username, $password) )
</ins><span class="cx">                         return $this->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' => get_cat_name($catid),
</span><span class="cx">                                 'categoryId' => (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->login($username, $password) ) {
</del><ins>+                if ( !$user = $this->login($username, $password) )
</ins><span class="cx">                         return $this->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->methods as $key=>$value) {
</del><ins>+                foreach ( $this->methods as $key => $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->get_results( $wpdb->prepare("SELECT comment_author_url, comment_content, comment_author_IP, comment_type FROM $wpdb->comments WHERE comment_post_ID = %d", $post_ID) );
</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->comment_type ) {
</span><span class="cx">                                 $content = $comment->comment_content;
</span><span class="cx">                                 $title = substr($content, 8, (strpos($content, '</strong>') - 8));
</span><span class="lines">@@ -3156,8 +3035,8 @@
</span><span class="cx">                                         'pingURL' => $comment->comment_author_url,
</span><span class="cx">                                         'pingIP' => $comment->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->login($username, $password) ) {
</del><ins>+                if ( !$user = $this->login($username, $password) )
</ins><span class="cx">                         return $this->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->prepare("SELECT ID FROM $wpdb->posts WHERE post_title RLIKE %s", $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&#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->get_results( $wpdb->prepare("SELECT comment_author_url, comment_content, comment_author_IP, comment_type FROM $wpdb->comments WHERE comment_post_ID = %d", $post_ID) );
</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->comment_type )
</span><span class="cx">                                 $pingbacks[] = $comment->comment_author_url;
</span><span class="cx">                 }
</span></span></pre>
</div>
</div>
</body>
</html>