<!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" />
<title>[2301] 2013/codebykat/post-by-email/trunk: code style updates and fixes from code review</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { 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 #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#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>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://gsoc.trac.wordpress.org/changeset/2301">2301</a></dd>
<dt>Author</dt> <dd>codebykat</dd>
<dt>Date</dt> <dd>2013-09-12 22:19:04 +0000 (Thu, 12 Sep 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>code style updates and fixes from code review</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#2013codebykatpostbyemailtrunkclasspostbyemailadminphp">2013/codebykat/post-by-email/trunk/class-post-by-email-admin.php</a></li>
<li><a href="#2013codebykatpostbyemailtrunkclasspostbyemailphp">2013/codebykat/post-by-email/trunk/class-post-by-email.php</a></li>
<li><a href="#2013codebykatpostbyemailtrunkpostbyemailphp">2013/codebykat/post-by-email/trunk/post-by-email.php</a></li>
<li><a href="#2013codebykatpostbyemailtrunkviewsadminphp">2013/codebykat/post-by-email/trunk/views/admin.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="2013codebykatpostbyemailtrunkclasspostbyemailadminphp"></a>
<div class="modfile"><h4>Modified: 2013/codebykat/post-by-email/trunk/class-post-by-email-admin.php (2300 => 2301)</h4>
<pre class="diff"><span>
<span class="info">--- 2013/codebykat/post-by-email/trunk/class-post-by-email-admin.php 2013-09-12 14:52:22 UTC (rev 2300)
+++ 2013/codebykat/post-by-email/trunk/class-post-by-email-admin.php    2013-09-12 22:19:04 UTC (rev 2301)
</span><span class="lines">@@ -68,41 +68,41 @@
</span><span class="cx">          $default_options = Post_By_Email::$default_options;
</span><span class="cx"> 
</span><span class="cx">          $mailserver_url = trim( $input['mailserver_url'] );
</span><del>-               if( $mailserver_url != $default_options['mailserver_url'] ) {
</del><ins>+                if ( $mailserver_url != $default_options['mailserver_url'] ) {
</ins><span class="cx">                   $options['mailserver_url'] = $mailserver_url;
</span><span class="cx">          }
</span><span class="cx"> 
</span><span class="cx">          $mailserver_protocol = trim( $input['mailserver_protocol'] );
</span><del>-               if( in_array( $options['mailserver_protocol'], array('POP3', 'IMAP') ) ) {
</del><ins>+                if ( in_array( $options['mailserver_protocol'], array( 'POP3', 'IMAP' ) ) ) {
</ins><span class="cx">                   $options['mailserver_protocol'] = $mailserver_protocol;
</span><span class="cx">          }
</span><span class="cx">  
</span><span class="cx">          // port must be numeric and 16 digits max
</span><span class="cx">          $mailserver_port = trim( $input['mailserver_port'] );
</span><del>-               if( preg_match('/^[1-9][0-9]{0,15}$/', $mailserver_port ) ) {
</del><ins>+                if ( preg_match('/^[1-9][0-9]{0,15}$/', $mailserver_port ) ) {
</ins><span class="cx">                   $options['mailserver_port'] = $mailserver_port;
</span><span class="cx">          }
</span><span class="cx"> 
</span><span class="cx">          $mailserver_login = trim( $input['mailserver_login'] );
</span><del>-               if( $mailserver_login != $default_options['mailserver_login'] ) {
</del><ins>+                if ( $mailserver_login != $default_options['mailserver_login'] ) {
</ins><span class="cx">                   $options['mailserver_login'] = $mailserver_login;
</span><span class="cx">          }
</span><span class="cx"> 
</span><span class="cx">          $mailserver_pass = trim( $input['mailserver_pass'] );
</span><del>-               if( '' != $mailserver_pass ) {
</del><ins>+                if ( '' != $mailserver_pass ) {
</ins><span class="cx">                   $options['mailserver_pass'] = $mailserver_pass;
</span><span class="cx">          }
</span><span class="cx"> 
</span><span class="cx">          // default email category must be the ID of a real category
</span><span class="cx">          $default_email_category = $input['default_email_category'];
</span><del>-               if( get_category( $default_email_category ) ) {
</del><ins>+                if ( get_category( $default_email_category ) ) {
</ins><span class="cx">                   $options['default_email_category'] = $default_email_category;
</span><span class="cx">          }
</span><span class="cx"> 
</span><span class="cx">          $options['ssl'] = isset( $input['ssl'] );
</span><span class="cx">          $options['delete_messages'] = isset( $input['delete_messages'] );
</span><span class="cx"> 
</span><del>-               if( $options['mailserver_url'] && $options['mailserver_port']
</del><ins>+                if ( $options['mailserver_url'] && $options['mailserver_port']
</ins><span class="cx">                   && $options['mailserver_login'] && $options['mailserver_pass'] ) {
</span><span class="cx"> 
</span><span class="cx">                  // clear the transient and any error conditions if options have been updated
</span><span class="lines">@@ -150,7 +150,7 @@
</span><span class="cx">  * @param    string    $hook    Name of the current admin page.
</span><span class="cx">  */
</span><span class="cx">  public function enqueue_scripts( $hook ) {
</span><del>-               if( $hook != $this->plugin_screen_hook_suffix )
</del><ins>+                if ( $hook != $this->plugin_screen_hook_suffix )
</ins><span class="cx">                   return;
</span><span class="cx"> 
</span><span class="cx">          wp_enqueue_script( 'post-by-email-admin-js', plugins_url( 'js/admin.js', __FILE__ ), 'jquery', '', true );
</span><span class="lines">@@ -164,12 +164,11 @@
</span><span class="cx">  public function admin_notices() {
</span><span class="cx">          $options = get_option( 'post_by_email_options' );
</span><span class="cx">          $settings_url = admin_url( 'tools.php?page=post-by-email' );
</span><del>-               if( ! $options || ! isset( $options['status'] ) || $options['status'] == 'unconfigured' ) {
</del><ins>+                if ( ! $options || ! isset( $options['status'] ) || $options['status'] == 'unconfigured' ) {
</ins><span class="cx">                   echo "<div class='error'><p>";
</span><span class="cx">                  _e( "Notice: Post By Email is currently disabled.  To post to your blog via email, please <a href='$settings_url'>configure your settings now</a>.", 'post-by-email' );
</span><span class="cx">                  echo "</p></div>";
</span><del>-               }
-               elseif( $options['status'] == 'error' ) {
</del><ins>+                } elseif ( $options['status'] == 'error' ) {
</ins><span class="cx">                   echo "<div class='error'><p>";
</span><span class="cx">                  _e( "Post By Email encountered an error.  <a href='$settings_url&tab=log'>View the log</a> for details.", 'post-by-email' );
</span><span class="cx">                  echo "</p></div>";
</span><span class="lines">@@ -183,7 +182,7 @@
</span><span class="cx">  */
</span><span class="cx">  public function clear_log() {
</span><span class="cx">          check_ajax_referer( 'post-by-email-clear-log', 'security' );
</span><del>-               if( current_user_can( 'manage_options' ) ) {
</del><ins>+                if ( current_user_can( 'manage_options' ) ) {
</ins><span class="cx">                   update_option( 'post_by_email_log', array() );
</span><span class="cx">          }
</span><span class="cx"> 
</span></span></pre></div>
<a id="2013codebykatpostbyemailtrunkclasspostbyemailphp"></a>
<div class="modfile"><h4>Modified: 2013/codebykat/post-by-email/trunk/class-post-by-email.php (2300 => 2301)</h4>
<pre class="diff"><span>
<span class="info">--- 2013/codebykat/post-by-email/trunk/class-post-by-email.php       2013-09-12 14:52:22 UTC (rev 2300)
+++ 2013/codebykat/post-by-email/trunk/class-post-by-email.php  2013-09-12 22:19:04 UTC (rev 2301)
</span><span class="lines">@@ -64,15 +64,15 @@
</span><span class="cx">   * @var      array
</span><span class="cx">   */
</span><span class="cx">  public static $default_options = array(
</span><del>-               'mailserver_url'                        => 'mail.example.com',
-               'mailserver_login'                      => 'login@example.com',
-               'mailserver_pass'                       => '',
-               'mailserver_protocol'           => 'IMAP',
-               'mailserver_port'                       => 993,
-               'ssl'                                           => true,
-               'default_email_category'        => '',
-               'delete_messages'                       => true,
-               'status'                                        => 'unconfigured'
</del><ins>+                'mailserver_url'            => 'mail.example.com',
+               'mailserver_login'          => 'login@example.com',
+               'mailserver_pass'           => '',
+               'mailserver_protocol'       => 'IMAP',
+               'mailserver_port'           => 993,
+               'ssl'                       => true,
+               'default_email_category'    => '',
+               'delete_messages'           => true,
+               'status'                    => 'unconfigured',
</ins><span class="cx">   );
</span><span class="cx"> 
</span><span class="cx">  /**
</span><span class="lines">@@ -141,22 +141,21 @@
</span><span class="cx">          $options = self::$default_options;
</span><span class="cx"> 
</span><span class="cx">          // if old global options exist, copy them into plugin options
</span><del>-               foreach( array_keys( self::$default_options ) as $optname ) {
-                       if( isset( $plugin_options[$optname] ) ) {
</del><ins>+                foreach ( array_keys( self::$default_options ) as $optname ) {
+                       if ( isset( $plugin_options[$optname] ) ) {
</ins><span class="cx">                           $options[$optname] = $plugin_options[$optname];
</span><del>-                       }
-                       elseif ( get_option( $optname ) ) {
</del><ins>+                        } elseif ( get_option( $optname ) ) {
</ins><span class="cx">                           $options[ $optname ] = get_option( $optname );
</span><span class="cx">                  }
</span><span class="cx">          }
</span><span class="cx"> 
</span><del>-               if( ! isset( $plugin_options['mailserver_protocol'] )
</del><ins>+                if ( ! isset( $plugin_options['mailserver_protocol'] )
</ins><span class="cx">                   && in_array( $options['mailserver_port'], array( 110, 995 ) ) ) {
</span><span class="cx">                  $options['mailserver_protocol'] = 'POP3';
</span><span class="cx">                  $options['delete_messages'] = false;
</span><span class="cx">          }
</span><span class="cx"> 
</span><del>-               if( ! isset( $plugin_options['ssl'] )
</del><ins>+                if ( ! isset( $plugin_options['ssl'] )
</ins><span class="cx">                   && in_array( $options['mailserver_port'], array( 110, 143 ) ) ) {
</span><span class="cx">                  $options['ssl'] = false;
</span><span class="cx">          }
</span><span class="lines">@@ -167,7 +166,7 @@
</span><span class="cx">          add_option( 'post_by_email_log', array(), '', 'no' );
</span><span class="cx"> 
</span><span class="cx">          // schedule hourly mail checks with wp_cron
</span><del>-               if( ! wp_next_scheduled( 'post-by-email-wp-mail.php' ) ) {
</del><ins>+                if ( ! wp_next_scheduled( 'post-by-email-wp-mail.php' ) ) {
</ins><span class="cx">                   wp_schedule_event( current_time( 'timestamp', 1 ), 'hourly', 'post-by-email-wp-mail.php' );
</span><span class="cx">          }
</span><span class="cx">  }
</span><span class="lines">@@ -216,12 +215,12 @@
</span><span class="cx">   */
</span><span class="cx">  public function check_email() {
</span><span class="cx">          // Only check at this interval for new messages.
</span><del>-               if( ! defined( 'WP_MAIL_INTERVAL' ) )
</del><ins>+                if ( ! defined( 'WP_MAIL_INTERVAL' ) )
</ins><span class="cx">                   define( 'WP_MAIL_INTERVAL', 5 * MINUTE_IN_SECONDS );
</span><span class="cx"> 
</span><span class="cx">          $last_checked = get_transient( 'mailserver_last_checked' );
</span><span class="cx"> 
</span><del>-               if( $last_checked && ! WP_DEBUG ) {
</del><ins>+                if ( $last_checked && ! WP_DEBUG ) {
</ins><span class="cx">                   $log_message = __( 'Slow down cowboy, no need to check for new mails so often!', 'post-by-email' );
</span><span class="cx">                  $this->save_log_message( $log_message );
</span><span class="cx">                  return;
</span><span class="lines">@@ -235,19 +234,19 @@
</span><span class="cx">          update_option( 'post_by_email_options', $options );
</span><span class="cx"> 
</span><span class="cx">          // if options aren't set, there's nothing to do, move along
</span><del>-               if( $options['status'] == 'unconfigured' ) {
</del><ins>+                if ( $options['status'] == 'unconfigured' ) {
</ins><span class="cx">                   return;
</span><span class="cx">          }
</span><span class="cx"> 
</span><span class="cx">          $this->connection = $this->open_mailbox_connection( $options );
</span><span class="cx"> 
</span><del>-               if(! $this->connection ) {
</del><ins>+                if (! $this->connection ) {
</ins><span class="cx">                   return;
</span><span class="cx">          }
</span><span class="cx"> 
</span><span class="cx">          $uids = $this->get_messages();
</span><span class="cx"> 
</span><del>-               if( 0 === sizeof( $uids ) ) {
</del><ins>+                if ( 0 === sizeof( $uids ) ) {
</ins><span class="cx">                   $this->save_log_message( __( 'There doesn&#8217;t seem to be any new mail.', 'post-by-email' ) );
</span><span class="cx">                  $this->connection->shutdown();
</span><span class="cx">                  return;
</span><span class="lines">@@ -258,7 +257,7 @@
</span><span class="cx">          $time_difference = get_option( 'gmt_offset' ) * HOUR_IN_SECONDS;
</span><span class="cx">          $phone_delim = '::';
</span><span class="cx"> 
</span><del>-               foreach( $uids as $id ) {
</del><ins>+                foreach ( $uids as $id ) {
</ins><span class="cx">                   $uid = new Horde_Imap_Client_Ids( $id );
</span><span class="cx"> 
</span><span class="cx">                  // get headers
</span><span class="lines">@@ -282,10 +281,9 @@
</span><span class="cx">                          // Set $post_status based on author's publish_posts capability
</span><span class="cx">                          $user = new WP_User( $post_author );
</span><span class="cx">                          $post_status = ( $user->has_cap( 'publish_posts' ) ) ? 'publish' : 'pending';
</span><del>-                       }
-                       else {
</del><ins>+                        } else {
</ins><span class="cx">                           // use admin if no author found
</span><del>-                               $post_author = 1;
</del><ins>+                                $post_author = $this->get_admin_id();
</ins><span class="cx">                           $post_status = 'pending';
</span><span class="cx">                  }
</span><span class="cx"> 
</span><span class="lines">@@ -337,12 +335,12 @@
</span><span class="cx"> 
</span><span class="cx">                  do_action( 'publish_phone', $post_ID );
</span><span class="cx"> 
</span><del>-                       if( '' == $post_title ) {
</del><ins>+                        if ( '' == $post_title ) {
</ins><span class="cx">                           $post_title = __( '(no title)', 'post-by-email' );
</span><span class="cx">                  }
</span><span class="cx"> 
</span><span class="cx">                  $pending = '';
</span><del>-                       if( 'pending' == $post_status ) {
</del><ins>+                        if ( 'pending' == $post_status ) {
</ins><span class="cx">                           $pending = __( ' (pending)', 'post-by-email' );
</span><span class="cx">                  }
</span><span class="cx"> 
</span><span class="lines">@@ -359,6 +357,20 @@
</span><span class="cx">  }
</span><span class="cx"> 
</span><span class="cx">  /**
</span><ins>+        * Returns the site administrator's ID (used to set the author of posts sent from unrecognized email addresses).
+        *
+        * @since    1.0.2
+        *
+        * @return   integer    $id
+        */
+       protected function get_admin_id() {
+               global $wpdb;
+
+               $id = $wpdb->get_var( "SELECT user_id FROM {$wpdb->usermeta} WHERE meta_key='wp_capabilities' AND meta_value LIKE '%administrator%' ORDER BY user_id LIMIT 1" );
+               return $id;
+       }
+
+       /**
</ins><span class="cx">    * Establishes the connection to the mailserver.
</span><span class="cx">   *
</span><span class="cx">   * @since    1.0.0
</span><span class="lines">@@ -368,18 +380,18 @@
</span><span class="cx">   * @return   object
</span><span class="cx">   */
</span><span class="cx">  protected function open_mailbox_connection( $options ) {
</span><del>-               $connection_options = array( 'username' => $options['mailserver_login'],
-                                                                               'password' => $options['mailserver_pass'],
-                                                                               'hostspec' => $options['mailserver_url'],
-                                                                               'port' => $options['mailserver_port'],
-                                                                               'secure' => $options['ssl'] ? 'ssl' : false
-                                                                       );
</del><ins>+                $connection_options = array(
+                       'username' => $options['mailserver_login'],
+                       'password' => $options['mailserver_pass'],
+                       'hostspec' => $options['mailserver_url'],
+                       'port' => $options['mailserver_port'],
+                       'secure' => $options['ssl'] ? 'ssl' : false,
+               );
</ins><span class="cx"> 
</span><del>-               if( 'POP3' == $options['mailserver_protocol'] ) {
</del><ins>+                if ( 'POP3' == $options['mailserver_protocol'] ) {
</ins><span class="cx">                   $connection = new Horde_Imap_Client_Socket_Pop3( $connection_options );
</span><span class="cx">                  $this->protocol = 'POP3';
</span><del>-               }
-               else {  // IMAP
</del><ins>+                } else {  // IMAP
</ins><span class="cx">                   $connection = new Horde_Imap_Client_Socket( $connection_options );
</span><span class="cx">                  $this->protocol = 'IMAP';
</span><span class="cx">          }
</span><span class="lines">@@ -404,15 +416,14 @@
</span><span class="cx">   * @return   array    Array of message UIDs
</span><span class="cx">   */
</span><span class="cx">  protected function get_messages() {
</span><del>-               if( ! $this->connection )
</del><ins>+                if ( ! $this->connection )
</ins><span class="cx">                   return;
</span><span class="cx"> 
</span><span class="cx">          try {
</span><span class="cx">                  // POP3 doesn't understand about read/unread messages
</span><del>-                       if( 'POP3' == $this->protocol ) {
</del><ins>+                        if ( 'POP3' == $this->protocol ) {
</ins><span class="cx">                           $test = $this->connection->search( 'INBOX' );
</span><del>-                       }
-                       else {
</del><ins>+                        } else {
</ins><span class="cx">                           $search_query = new Horde_Imap_Client_Search_Query();
</span><span class="cx">                          $search_query->flag( Horde_Imap_Client::FLAG_SEEN, false );
</span><span class="cx">                          $test = $this->connection->search( 'INBOX', $search_query );
</span><span class="lines">@@ -536,7 +547,7 @@
</span><span class="cx"> 
</span><span class="cx">          $part = $list->first()->getStructure();
</span><span class="cx">          $body_id = $part->findBody('html');
</span><del>-               if( is_null( $body_id ) ) {
</del><ins>+                if ( is_null( $body_id ) ) {
</ins><span class="cx">                   $body_id = $part->findBody();
</span><span class="cx">          }
</span><span class="cx">          $body = $part->getPart( $body_id );
</span><span class="lines">@@ -574,11 +585,11 @@
</span><span class="cx">   * @param    bool     $delete    Whether to delete read messages
</span><span class="cx">   */
</span><span class="cx">  protected function mark_as_read( $uids, $delete=false ) {
</span><del>-               if( ! $this->connection )
</del><ins>+                if ( ! $this->connection )
</ins><span class="cx">                   return;
</span><span class="cx"> 
</span><span class="cx">          $flag = Horde_Imap_Client::FLAG_SEEN;
</span><del>-               if( $delete || ( 'POP3' == $this->protocol ) )
</del><ins>+                if ( $delete || ( 'POP3' == $this->protocol ) )
</ins><span class="cx">                   $flag = Horde_Imap_Client::FLAG_DELETED;
</span><span class="cx"> 
</span><span class="cx">          try {
</span><span class="lines">@@ -617,7 +628,7 @@
</span><span class="cx"> 
</span><span class="cx">          update_option( 'post_by_email_log', $log );
</span><span class="cx"> 
</span><del>-               if( $error ) {
</del><ins>+                if ( $error ) {
</ins><span class="cx">                   $options = get_option( 'post_by_email_options' );
</span><span class="cx">                  $options['status'] = 'error';
</span><span class="cx">                  update_option( 'post_by_email_options', $options );
</span><span class="lines">@@ -643,7 +654,7 @@
</span><span class="cx">   */
</span><span class="cx">  public static function autoload( $class ) {
</span><span class="cx">          // We're only interested in autoloading Horde includes.
</span><del>-               if( 0 !== strpos( $class, 'Horde' ) ) {
</del><ins>+                if ( 0 !== strpos( $class, 'Horde' ) ) {
</ins><span class="cx">                   return;
</span><span class="cx">          }
</span><span class="cx"> 
</span><span class="lines">@@ -651,7 +662,7 @@
</span><span class="cx">          // ex: we expect the class Horde_Imap_Client to be defined in Horde/Imap/Client.php.
</span><span class="cx">          $filename = str_replace( array( '_', '\\' ), '/', $class );
</span><span class="cx">          $filename = self::$path . '/include/' . $filename . '.php';
</span><del>-               if( file_exists( $filename ) ) {
</del><ins>+                if ( file_exists( $filename ) ) {
</ins><span class="cx">                   require_once( $filename );
</span><span class="cx">          }
</span><span class="cx">  }
</span></span></pre></div>
<a id="2013codebykatpostbyemailtrunkpostbyemailphp"></a>
<div class="modfile"><h4>Modified: 2013/codebykat/post-by-email/trunk/post-by-email.php (2300 => 2301)</h4>
<pre class="diff"><span>
<span class="info">--- 2013/codebykat/post-by-email/trunk/post-by-email.php     2013-09-12 14:52:22 UTC (rev 2300)
+++ 2013/codebykat/post-by-email/trunk/post-by-email.php        2013-09-12 22:19:04 UTC (rev 2301)
</span><span class="lines">@@ -42,7 +42,7 @@
</span><span class="cx"> register_activation_hook( __FILE__, array( 'Post_By_Email', 'activate' ) );
</span><span class="cx"> register_deactivation_hook( __FILE__, array( 'Post_By_Email', 'deactivate' ) );
</span><span class="cx"> 
</span><del>-if( is_admin() ) {
</del><ins>+if ( is_admin() ) {
</ins><span class="cx">     require_once( plugin_dir_path( __FILE__ ) . 'class-post-by-email-admin.php' );
</span><span class="cx">     Post_By_Email_Admin::get_instance();
</span><span class="cx"> }
</span></span></pre></div>
<a id="2013codebykatpostbyemailtrunkviewsadminphp"></a>
<div class="modfile"><h4>Modified: 2013/codebykat/post-by-email/trunk/views/admin.php (2300 => 2301)</h4>
<pre class="diff"><span>
<span class="info">--- 2013/codebykat/post-by-email/trunk/views/admin.php       2013-09-12 14:52:22 UTC (rev 2300)
+++ 2013/codebykat/post-by-email/trunk/views/admin.php  2013-09-12 22:19:04 UTC (rev 2301)
</span><span class="lines">@@ -16,7 +16,7 @@
</span><span class="cx">  <?php screen_icon(); ?>
</span><span class="cx">  <h2><?php echo esc_html( get_admin_page_title() ); ?></h2>
</span><span class="cx"> 
</span><del>-       <?php if( isset( $_GET['settings-updated'] ) ) : ?>
</del><ins>+        <?php if ( isset( $_GET['settings-updated'] ) ) : ?>
</ins><span class="cx">           <div class='updated'>
</span><span class="cx">                  <p><?php _e( 'Your settings have been saved.', 'post-by-email' ); ?></p>
</span><span class="cx">          </div>
</span><span class="lines">@@ -25,13 +25,13 @@
</span><span class="cx">  <?php $tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'main'; ?>
</span><span class="cx"> 
</span><span class="cx">  <h2 class="nav-tab-wrapper">
</span><del>-               <a id="nav-main" href="<?php echo admin_url('tools.php?page='.$_GET['page']); ?>" class="nav-tab <?php if( 'main' == $tab ) { echo 'nav-tab-active'; } ?>">
</del><ins>+                <a id="nav-main" href="<?php echo admin_url('tools.php?page='.$_GET['page']); ?>" class="nav-tab <?php if ( 'main' == $tab ) { echo 'nav-tab-active'; } ?>">
</ins><span class="cx">                   <?php _e( 'Basic Settings', 'post-by-email' ); ?>
</span><span class="cx">          </a>
</span><del>-               <a id="nav-connection" href="<?php echo admin_url('tools.php?page='.$_GET['page'].'&tab=connection'); ?>" class="nav-tab <?php if( 'connection' == $tab ) { echo 'nav-tab-active'; } ?>">
</del><ins>+                <a id="nav-connection" href="<?php echo admin_url('tools.php?page='.$_GET['page'].'&tab=connection'); ?>" class="nav-tab <?php if ( 'connection' == $tab ) { echo 'nav-tab-active'; } ?>">
</ins><span class="cx">                   <?php _e( 'Mailbox Details', 'post-by-email' ); ?>
</span><span class="cx">          </a>
</span><del>-               <a id="nav-log" href="<?php echo admin_url('tools.php?page='.$_GET['page'].'&tab=log'); ?>" class="nav-tab <?php if( 'log' == $tab ) { echo 'nav-tab-active'; } ?>">
</del><ins>+                <a id="nav-log" href="<?php echo admin_url('tools.php?page='.$_GET['page'].'&tab=log'); ?>" class="nav-tab <?php if ( 'log' == $tab ) { echo 'nav-tab-active'; } ?>">
</ins><span class="cx">                   <?php _e( 'Activity Log', 'post-by-email' ); ?>
</span><span class="cx">          </a>
</span><span class="cx">  </h2>
</span><span class="lines">@@ -41,7 +41,7 @@
</span><span class="cx"> 
</span><span class="cx">          <?php $options = get_option( 'post_by_email_options' ); ?>
</span><span class="cx"> 
</span><del>-               <div class='tab-content' id='tab-main' <?php if( 'main' != $tab ) { echo 'style="display:none;"'; } ?>>
</del><ins>+                <div class='tab-content' id='tab-main' <?php if ( 'main' != $tab ) { echo 'style="display:none;"'; } ?>>
</ins><span class="cx">                   <p>
</span><span class="cx">                          <?php
</span><span class="cx">                                  printf( __( 'To post to WordPress by e-mail you must set up a secret e-mail account
</span><span class="lines">@@ -112,7 +112,7 @@
</span><span class="cx">                  <?php submit_button(); ?>
</span><span class="cx">          </div>
</span><span class="cx"> 
</span><del>-               <div class='tab-content' id='tab-connection' <?php if( 'connection' != $tab ) { echo 'style="display:none;"'; } ?>>
</del><ins>+                <div class='tab-content' id='tab-connection' <?php if ( 'connection' != $tab ) { echo 'style="display:none;"'; } ?>>
</ins><span class="cx"> 
</span><span class="cx">                  <p><?php _e( "Configure the details of your mailbox connection.  The default settings should work with most email accounts, but if your mail server differs, you can enter it here.", 'post-by-email' ); ?></p>
</span><span class="cx"> 
</span><span class="lines">@@ -125,8 +125,8 @@
</span><span class="cx">                                  </th>
</span><span class="cx">                                  <td>
</span><span class="cx">                                          <select name="post_by_email_options[mailserver_protocol]" id="post_by_email_options[mailserver_protocol]">
</span><del>-                                                       <option value="POP3" <?php if( 'POP3' == $options['mailserver_protocol'] ) { echo 'selected'; } ?>>POP3</option>
-                                                       <option value="IMAP" <?php if( 'IMAP' == $options['mailserver_protocol'] ) { echo 'selected'; } ?>>IMAP</option>
</del><ins>+                                                        <option value="POP3" <?php selected( 'POP3', $options['mailserver_protocol'] ); ?>>POP3</option>
+                                                       <option value="IMAP" <?php selected( 'IMAP', $options['mailserver_protocol'] ); ?>>IMAP</option>
</ins><span class="cx">                                           </select>
</span><span class="cx">                                  </td>
</span><span class="cx">                          </tr>
</span><span class="lines">@@ -150,7 +150,7 @@
</span><span class="cx">                                          </label>
</span><span class="cx">                                  </th>
</span><span class="cx">                                  <td>
</span><del>-                                               <input name="post_by_email_options[ssl]" id="post_by_email_options[ssl]" type="checkbox" id="ssl" <?php if( $options['ssl'] ) { echo 'checked="checked"'; } ?> />
</del><ins>+                                                <input name="post_by_email_options[ssl]" id="post_by_email_options[ssl]" type="checkbox" id="ssl" <?php checked( $options['ssl'] ); ?> />
</ins><span class="cx">                                   </td>
</span><span class="cx">                          </tr>
</span><span class="cx">                          <tr valign="top">
</span><span class="lines">@@ -160,19 +160,19 @@
</span><span class="cx">                                          </label>
</span><span class="cx">                                  </th>
</span><span class="cx">                                  <td>
</span><del>-                                               <input name="post_by_email_options[delete_messages]" id="post_by_email_options[delete_messages]" type="checkbox" id="delete_messages" <?php if( $options['delete_messages'] ) { echo 'checked="checked"'; } ?> />
</del><ins>+                                                <input name="post_by_email_options[delete_messages]" id="post_by_email_options[delete_messages]" type="checkbox" id="delete_messages" <?php checked( $options['delete_messages'] ); ?> />
</ins><span class="cx">                                           <p class="description"><?php _e( 'Uncheck this box to mark messages as read instead of deleting (requires IMAP).', 'post-by-email' ); ?></p>
</span><span class="cx">                                  </td>
</span><span class="cx">                          </tr>
</span><span class="cx">                  </table>
</span><span class="cx"> 
</span><span class="cx">                  <br />
</span><del>-                       <input type="button" id="resetButton" class="button-secondary" value="<?php _e( 'Reset to Defaults', 'post-by-email'); ?>" />
</del><ins>+                        <input type="button" id="resetButton" class="button-secondary" value="<?php esc_attr_e( 'Reset to Defaults', 'post-by-email'); ?>" />
</ins><span class="cx">                   <?php submit_button(); ?>
</span><span class="cx">          </div>
</span><span class="cx">  </form>
</span><span class="cx"> 
</span><del>-       <div class='tab-content' id='tab-log' <?php if( 'log' != $tab ) { echo 'style="display:none;"'; } ?>>
</del><ins>+        <div class='tab-content' id='tab-log' <?php if ( 'log' != $tab ) { echo 'style="display:none;"'; } ?>>
</ins><span class="cx"> 
</span><span class="cx">          <?php
</span><span class="cx">                  $log = get_option( 'post_by_email_log' );
</span><span class="lines">@@ -183,7 +183,7 @@
</span><span class="cx">                          $date_format = get_option( 'date_format' );
</span><span class="cx">                          $time_format = get_option( 'time_format' );
</span><span class="cx">                  ?>
</span><del>-                       <?php if( isset( $options['last_checked'] ) ) : ?>
</del><ins>+                        <?php if ( isset( $options['last_checked'] ) ) : ?>
</ins><span class="cx">                           <?php echo date_i18n( "$date_format, $time_format", $options['last_checked'] ); ?>
</span><span class="cx">                  <?php else: ?>
</span><span class="cx">                          <?php _e( 'Never', 'post-by-email' ); ?>
</span><span class="lines">@@ -200,7 +200,7 @@
</span><span class="cx">                          <?php _e( 'Check now', 'post-by-email' ); ?>
</span><span class="cx">                  </a>
</span><span class="cx">          </p>
</span><del>-               <?php if( $log && sizeof($log) > 0 ) : ?>
</del><ins>+                <?php if ( $log && sizeof($log) > 0 ) : ?>
</ins><span class="cx"> 
</span><span class="cx">                  <p>
</span><span class="cx">                          <a href="" id="clearLog" ><?php _e('Clear Log', 'post-by-email' ); ?></a>
</span><span class="lines">@@ -213,7 +213,7 @@
</span><span class="cx">                                  </tr>
</span><span class="cx">                          </thead>
</span><span class="cx">                          <tbody>
</span><del>-                                       <?php foreach( $log as $entry ) : ?>
</del><ins>+                                        <?php foreach ( $log as $entry ) : ?>
</ins><span class="cx">                                           <tr class="alternate">
</span><span class="cx">                                                  <td><?php echo date_i18n( "$date_format, $time_format", $entry['timestamp'] ); ?></td>
</span><span class="cx">                                                  <td><?php echo $entry['message']; ?></td>
</span></span></pre>
</div>
</div>

</body>
</html>