<!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>[2219] 2013/codebykat/post-by-email/trunk: a slew of tiny changes and fixes as per 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/2219">2219</a></dd>
<dt>Author</dt> <dd>codebykat</dd>
<dt>Date</dt> <dd>2013-08-16 04:16:29 +0000 (Fri, 16 Aug 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>a slew of tiny changes and fixes as per code review</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#2013codebykatpostbyemailtrunkclasspostbyemailphp">2013/codebykat/post-by-email/trunk/class-post-by-email.php</a></li>
<li><a href="#2013codebykatpostbyemailtrunkincludehordewrapperphp">2013/codebykat/post-by-email/trunk/include/horde-wrapper.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>

<h3>Removed Paths</h3>
<ul>
<li><a href="#2013codebykatpostbyemailtrunkindexphp">2013/codebykat/post-by-email/trunk/index.php</a></li>
<li><a href="#2013codebykatpostbyemailtrunklangindexphp">2013/codebykat/post-by-email/trunk/lang/index.php</a></li>
<li><a href="#2013codebykatpostbyemailtrunkviewsindexphp">2013/codebykat/post-by-email/trunk/views/index.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="2013codebykatpostbyemailtrunkclasspostbyemailphp"></a>
<div class="modfile"><h4>Modified: 2013/codebykat/post-by-email/trunk/class-post-by-email.php (2218 => 2219)</h4>
<pre class="diff"><span>
<span class="info">--- 2013/codebykat/post-by-email/trunk/class-post-by-email.php       2013-08-13 22:28:04 UTC (rev 2218)
+++ 2013/codebykat/post-by-email/trunk/class-post-by-email.php  2013-08-16 04:16:29 UTC (rev 2219)
</span><span class="lines">@@ -54,7 +54,7 @@
</span><span class="cx">   */
</span><span class="cx">  private function __construct() {
</span><span class="cx">          // Load plugin text domain
</span><del>-               add_action( 'init', array( $this, 'load_plugin_textdomain' ) );
</del><ins>+                add_action( 'plugins_loaded', array( $this, 'load_plugin_textdomain' ) );
</ins><span class="cx"> 
</span><span class="cx">          // Add the options page and menu item.
</span><span class="cx">          add_action( 'admin_init', array( $this, 'add_plugin_settings' ) );
</span><span class="lines">@@ -97,12 +97,12 @@
</span><span class="cx">          $options = get_option( 'post_by_email_options' );
</span><span class="cx"> 
</span><span class="cx">          if( ! $options ) {
</span><del>-                       $options = Array();
</del><ins>+                        $options = array();
</ins><span class="cx"> 
</span><span class="cx">                  // if old global options exist, copy them into plugin options
</span><span class="cx">                  // WP_MAIL_INTERVAL - interval to check new messages
</span><span class="cx"> 
</span><del>-                       $plugin_options = Array(
</del><ins>+                        $plugin_options = array(
</ins><span class="cx">                           'mailserver_url',
</span><span class="cx">                          'mailserver_port',
</span><span class="cx">                          'mailserver_login',
</span><span class="lines">@@ -120,17 +120,6 @@
</span><span class="cx">  }
</span><span class="cx"> 
</span><span class="cx">  /**
</span><del>-        * Fired when the plugin is deactivated.
-        *
-        * @since    0.9.0
-        *
-        * @param    boolean    $network_wide    True if WPMU superadmin uses "Network Deactivate" action, false if WPMU is disabled or plugin is deactivated on an individual blog.
-        */
-       public static function deactivate( $network_wide ) {
-               remove_filter( 'enable_post_by_email_configuration', '__return_false' );
-       }
-
-       /**
</del><span class="cx">    * Load the plugin text domain for translation.
</span><span class="cx">   *
</span><span class="cx">   * @since    0.9.0
</span><span class="lines">@@ -164,9 +153,9 @@
</span><span class="cx">   * @since    0.9.0
</span><span class="cx">   */
</span><span class="cx">  public function add_plugin_admin_menu() {
</span><del>-               $this->plugin_screen_hook_suffix = add_plugins_page(
-                       __( 'Post By Email', $this->plugin_slug ),
-                       __( 'Post By Email', $this->plugin_slug ),
</del><ins>+                $this->plugin_screen_hook_suffix = add_management_page(
+                       __( 'Post By Email', 'post-by-email' ),
+                       __( 'Post By Email', 'post-by-email' ),
</ins><span class="cx">                   'read',
</span><span class="cx">                  $this->plugin_slug,
</span><span class="cx">                  array( $this, 'display_plugin_admin_page' )
</span><span class="lines">@@ -179,7 +168,7 @@
</span><span class="cx">   * @since    0.9.0
</span><span class="cx">   */
</span><span class="cx">  public function display_plugin_admin_page() {
</span><del>-               include_once( 'views/admin.php' );
</del><ins>+                include_once( plugin_dir_path( __FILE__ ) . 'views/admin.php' );
</ins><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx">  /**
</span><span class="lines">@@ -194,12 +183,12 @@
</span><span class="cx"> 
</span><span class="cx">          /** Only check at this interval for new messages. */
</span><span class="cx">          if ( ! defined( 'WP_MAIL_INTERVAL' ) )
</span><del>-                       define( 'WP_MAIL_INTERVAL', 300 ); // 5 minutes
</del><ins>+                        define( 'WP_MAIL_INTERVAL', 5 * MINUTE_IN_SECONDS );
</ins><span class="cx"> 
</span><span class="cx">          $last_checked = get_transient( 'mailserver_last_checked' );
</span><span class="cx"> 
</span><span class="cx">          if ( $last_checked )
</span><del>-                       wp_die( __( 'Slow down cowboy, no need to check for new mails so often!' ) );
</del><ins>+                        wp_die( __( 'Slow down cowboy, no need to check for new mails so often!', 'post-by-email' ) );
</ins><span class="cx"> 
</span><span class="cx">          set_transient( 'mailserver_last_checked', true, WP_MAIL_INTERVAL );
</span><span class="cx"> 
</span><span class="lines">@@ -214,11 +203,11 @@
</span><span class="cx"> 
</span><span class="cx">          $phone_delim = '::';
</span><span class="cx"> 
</span><del>-               $pop3 = new Horde_Imap_Client_Socket_Pop3( array('username' => $options['mailserver_login'],
-                                                                                                                'password' => $options['mailserver_pass'],
-                                                                                                                'hostspec' => $options['mailserver_url'],
-                                                                                                                'port' => $options['mailserver_port'] ) );
-               $pop3->_setInit('authmethod', 'USER');
</del><ins>+                $pop3 = new Horde_Imap_Client_Socket_Pop3( array( 'username' => $options['mailserver_login'],
+                                                                                                                       'password' => $options['mailserver_pass'],
+                                                                                                                       'hostspec' => $options['mailserver_url'],
+                                                                                                                       'port' => $options['mailserver_port'] ) );
+               $pop3->_setInit( 'authmethod', 'USER' );
</ins><span class="cx"> 
</span><span class="cx">          try {
</span><span class="cx">                  $pop3->login();
</span><span class="lines">@@ -226,30 +215,30 @@
</span><span class="cx">                  $uids = $test['match'];
</span><span class="cx">          }
</span><span class="cx">          catch( Horde_Imap_Client_Exception $e ) {
</span><del>-                       self::save_log_and_die( __( 'An error occurred: ') . $e->getMessage(), $log );
</del><ins>+                        self::save_log_and_die( __( 'An error occurred: ', 'post-by-email') . $e->getMessage(), $log );
</ins><span class="cx">           }
</span><span class="cx"> 
</span><span class="cx">          if( 0 === sizeof( $uids ) ) {
</span><span class="cx">                  $pop3->shutdown();
</span><del>-                       self::save_log_and_die( __( 'There doesn&#8217;t seem to be any new mail.' ), $log );
</del><ins>+                        self::save_log_and_die( __( 'There doesn&#8217;t seem to be any new mail.', 'post-by-email' ), $log );
</ins><span class="cx">           }
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">          foreach( $uids as $id ) {
</span><del>-                       $uid = new Horde_Imap_Client_Ids($id);
</del><ins>+                        $uid = new Horde_Imap_Client_Ids( $id );
</ins><span class="cx"> 
</span><span class="cx">                  // get headers
</span><span class="cx">                  $headerquery = new Horde_Imap_Client_Fetch_Query();
</span><del>-                       $headerquery->headerText(array());
-                       $headerlist = $pop3->fetch('INBOX', $headerquery, array(
</del><ins>+                        $headerquery->headerText( array() );
+                       $headerlist = $pop3->fetch( 'INBOX', $headerquery, array(
</ins><span class="cx">                           'ids' => $uid
</span><span class="cx">                  ));
</span><span class="cx"> 
</span><del>-                       $headers = $headerlist->first()->getHeaderText(0, Horde_Imap_Client_Data_Fetch::HEADER_PARSE);
</del><ins>+                        $headers = $headerlist->first()->getHeaderText( 0, Horde_Imap_Client_Data_Fetch::HEADER_PARSE );
</ins><span class="cx"> 
</span><span class="cx">                  /* Subject */
</span><span class="cx">                  // Captures any text in the subject before $phone_delim as the subject
</span><del>-                       $subject = $headers->getValue('Subject');
</del><ins>+                        $subject = $headers->getValue( 'Subject' );
</ins><span class="cx">                   $subject = explode( $phone_delim, $subject );
</span><span class="cx">                  $subject = $subject[0];
</span><span class="cx"> 
</span><span class="lines">@@ -259,8 +248,8 @@
</span><span class="cx"> 
</span><span class="cx">                  // Set the author using the email address (From or Reply-To, the last used)
</span><span class="cx">                  // otherwise use the site admin
</span><del>-                       $author = $headers->getValue('From');
-                       $replyto = $headers->getValue('Reply-To');
</del><ins>+                        $author = $headers->getValue( 'From' );
+                       $replyto = $headers->getValue( 'Reply-To' );
</ins><span class="cx"> 
</span><span class="cx">                  if ( ! $author_found ) {
</span><span class="cx">                          if ( preg_match( '|[a-z0-9_.-]+@[a-z0-9_.-]+(?!.*<)|i', $author, $matches ) )
</span><span class="lines">@@ -269,7 +258,7 @@
</span><span class="cx">                                  $author = trim( $author );
</span><span class="cx">                          $author = sanitize_email( $author );
</span><span class="cx">                          if ( is_email( $author ) ) {
</span><del>-                                       $log['messages'][] = '<p>' . sprintf( __( 'Author is %s' ), $author ) . '</p>';
</del><ins>+                                        $log['messages'][] = '<p>' . sprintf( __( 'Author is %s', 'post-by-email' ), $author ) . '</p>';
</ins><span class="cx">                                   $userdata = get_user_by( 'email', $author );
</span><span class="cx">                                  if ( ! empty( $userdata ) ) {
</span><span class="cx">                                          $post_author = $userdata->ID;
</span><span class="lines">@@ -280,7 +269,7 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">                  /* Date */
</span><del>-                       $date = $headers->getValue('Date');
</del><ins>+                        $date = $headers->getValue( 'Date' );
</ins><span class="cx">                   $dmonths = array( 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' );
</span><span class="cx"> 
</span><span class="cx">                  // of the form '20 Mar 2002 20:32:37'
</span><span class="lines">@@ -289,7 +278,7 @@
</span><span class="cx">                          $ddate = trim( substr( $ddate, strpos( $ddate, ',' ) + 1, strlen( $ddate ) ) );
</span><span class="cx">                  }
</span><span class="cx"> 
</span><del>-                       $date_arr = explode(' ', $ddate);
</del><ins>+                        $date_arr = explode( ' ', $ddate );
</ins><span class="cx">                   $date_time = explode( ':', $date_arr[3] );
</span><span class="cx"> 
</span><span class="cx">                  $ddate_H = $date_time[0];
</span><span class="lines">@@ -318,29 +307,29 @@
</span><span class="cx">                  $query = new Horde_Imap_Client_Fetch_Query();
</span><span class="cx">                  $query->structure();
</span><span class="cx"> 
</span><del>-                       $list = $pop3->fetch('INBOX', $query, array(
</del><ins>+                        $list = $pop3->fetch( 'INBOX', $query, array(
</ins><span class="cx">                   'ids' => $uid
</span><span class="cx">                  ));
</span><span class="cx"> 
</span><span class="cx">                  $part = $list->first()->getStructure();
</span><span class="cx">                  $id = $part->findBody();
</span><del>-                       $body = $part->getPart($id);
</del><ins>+                        $body = $part->getPart( $id );
</ins><span class="cx"> 
</span><span class="cx">                  $query2 = new Horde_Imap_Client_Fetch_Query();
</span><del>-                       $query2->bodyPart($id, array(
</del><ins>+                        $query2->bodyPart( $id, array(
</ins><span class="cx">                       'decode' => true,
</span><span class="cx">                      'peek' => true
</span><span class="cx">                  ));
</span><span class="cx"> 
</span><del>-                       $list2 = $pop3->fetch('INBOX', $query2, array(
</del><ins>+                        $list2 = $pop3->fetch( 'INBOX', $query2, array(
</ins><span class="cx">                       'ids' => $uid
</span><span class="cx">                  ));     
</span><span class="cx"> 
</span><span class="cx">                  $message2 = $list2->first();
</span><del>-                       $content = $message2->getBodyPart($id);
-                       if (!$message2->getBodyPartDecode($id)) {
</del><ins>+                        $content = $message2->getBodyPart( $id );
+                       if ( ! $message2->getBodyPartDecode( $id ) ) {
</ins><span class="cx">                       // Quick way to transfer decode contents
</span><del>-                           $body->setContents($content);
</del><ins>+                            $body->setContents( $content );
</ins><span class="cx">                       $content = $body->getContents();
</span><span class="cx">                  }
</span><span class="cx"> 
</span><span class="lines">@@ -391,8 +380,8 @@
</span><span class="cx"> 
</span><span class="cx">                  do_action( 'publish_phone', $post_ID );
</span><span class="cx"> 
</span><del>-                       $log['messages'][] = "\n<p>" . sprintf( __( '<strong>Author:</strong> %s' ), esc_html( $post_author ) ) . '</p>';
-                       $log['messages'][] = "\n<p>" . sprintf( __( '<strong>Posted title:</strong> %s' ), esc_html( $post_title ) ) . '</p>';
</del><ins>+                        $log['messages'][] = "\n<p>" . sprintf( __( 'Author: %s', 'post-by-email' ), esc_html( $post_author ) ) . '</p>';
+                       $log['messages'][] = "\n<p>" . sprintf( __( 'Posted title: %s', 'post-by-email' ), esc_html( $post_title ) ) . '</p>';
</ins><span class="cx"> 
</span><span class="cx">          } // end foreach
</span><span class="cx"> 
</span><span class="lines">@@ -404,19 +393,23 @@
</span><span class="cx">                  ) );                    
</span><span class="cx">          }
</span><span class="cx">          catch ( Horde_Imap_Client_Exception $e ) {
</span><del>-                       self::save_log_and_die( __( 'An error occurred: ') . $e->getMessage(), $log );
</del><ins>+                        self::save_log_and_die( __( 'An error occurred: ', 'post-by-email') . $e->getMessage(), $log );
</ins><span class="cx">           }
</span><span class="cx"> 
</span><span class="cx">          $pop3->shutdown();
</span><span class="cx"> 
</span><span class="cx">          foreach( $log['messages'] as $message ) { echo $message; }
</span><del>-               update_option( 'post_by_email_log', $log );
</del><ins>+                $options['log'] = $log;
+               update_option( 'post_by_email_options', $options );
</ins><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx">  protected function save_log_and_die( $error, $log ) {
</span><del>-               $messages[] = $error;
-               $log['messages'] = $messages;
-               update_option( 'post_by_email_log', $log );
-               wp_die( $status );
</del><ins>+                $log['messages'][] = $error;
+
+               $options = get_option( 'post_by_email_options' );
+               $options['log'] = $log;
+               update_option( 'post_by_email_options', $options );
+
+               wp_die( $error );
</ins><span class="cx">   }
</span><span class="cx"> }
</span><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="2013codebykatpostbyemailtrunkincludehordewrapperphp"></a>
<div class="modfile"><h4>Modified: 2013/codebykat/post-by-email/trunk/include/horde-wrapper.php (2218 => 2219)</h4>
<pre class="diff"><span>
<span class="info">--- 2013/codebykat/post-by-email/trunk/include/horde-wrapper.php     2013-08-13 22:28:04 UTC (rev 2218)
+++ 2013/codebykat/post-by-email/trunk/include/horde-wrapper.php        2013-08-16 04:16:29 UTC (rev 2219)
</span><span class="lines">@@ -25,7 +25,7 @@
</span><span class="cx"> 
</span><span class="cx"> require_once('Horde/String.php');
</span><span class="cx"> 
</span><del>-require_once('Horde-Translation-Wrapper.php');
</del><ins>+require_once('class-horde-imap-client-translation.php');
</ins><span class="cx"> 
</span><span class="cx"> require_once('Horde/Client.php');
</span><span class="cx"> 
</span></span></pre></div>
<a id="2013codebykatpostbyemailtrunkindexphp"></a>
<div class="delfile"><h4>Deleted: 2013/codebykat/post-by-email/trunk/index.php (2218 => 2219)</h4>
<pre class="diff"><span>
<span class="info">--- 2013/codebykat/post-by-email/trunk/index.php     2013-08-13 22:28:04 UTC (rev 2218)
+++ 2013/codebykat/post-by-email/trunk/index.php        2013-08-16 04:16:29 UTC (rev 2219)
</span><span class="lines">@@ -1 +0,0 @@
</span><del>-<?php // Silence is golden ?>
</del><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="2013codebykatpostbyemailtrunklangindexphp"></a>
<div class="delfile"><h4>Deleted: 2013/codebykat/post-by-email/trunk/lang/index.php (2218 => 2219)</h4>
<pre class="diff"><span>
<span class="info">--- 2013/codebykat/post-by-email/trunk/lang/index.php        2013-08-13 22:28:04 UTC (rev 2218)
+++ 2013/codebykat/post-by-email/trunk/lang/index.php   2013-08-16 04:16:29 UTC (rev 2219)
</span><span class="lines">@@ -1 +0,0 @@
</span><del>-<?php // Silence is golden ?>
</del><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="2013codebykatpostbyemailtrunkpostbyemailphp"></a>
<div class="modfile"><h4>Modified: 2013/codebykat/post-by-email/trunk/post-by-email.php (2218 => 2219)</h4>
<pre class="diff"><span>
<span class="info">--- 2013/codebykat/post-by-email/trunk/post-by-email.php     2013-08-13 22:28:04 UTC (rev 2218)
+++ 2013/codebykat/post-by-email/trunk/post-by-email.php        2013-08-16 04:16:29 UTC (rev 2219)
</span><span class="lines">@@ -15,7 +15,7 @@
</span><span class="cx">  * Version:     0.9.5
</span><span class="cx">  * Author:      Kat Hagan
</span><span class="cx">  * Author URI:  http://profiles.wordpress.org/codebykat
</span><del>- * Text Domain: post-by-email-locale
</del><ins>+ * Text Domain: post-by-email
</ins><span class="cx">  * License:     GPL-2.0+
</span><span class="cx">  * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
</span><span class="cx">  * Domain Path: /lang
</span><span class="lines">@@ -37,15 +37,8 @@
</span><span class="cx">     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
</span><span class="cx"> */
</span><span class="cx"> 
</span><del>-// If this file is called directly, abort.
-if ( ! defined( 'WPINC' ) ) {
-       die;
-}
-
</del><span class="cx"> require_once( plugin_dir_path( __FILE__ ) . 'class-post-by-email.php' );
</span><span class="cx"> 
</span><del>-// Register hooks that are fired when the plugin is activated and deactivated.
</del><span class="cx"> register_activation_hook( __FILE__, array( 'Post_By_Email', 'activate' ) );
</span><del>-register_deactivation_hook( __FILE__, array( 'Post_By_Email', 'deactivate' ) );
</del><span class="cx"> 
</span><span class="cx"> Post_By_Email::get_instance();
</span><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="2013codebykatpostbyemailtrunkviewsadminphp"></a>
<div class="modfile"><h4>Modified: 2013/codebykat/post-by-email/trunk/views/admin.php (2218 => 2219)</h4>
<pre class="diff"><span>
<span class="info">--- 2013/codebykat/post-by-email/trunk/views/admin.php       2013-08-13 22:28:04 UTC (rev 2218)
+++ 2013/codebykat/post-by-email/trunk/views/admin.php  2013-08-16 04:16:29 UTC (rev 2219)
</span><span class="lines">@@ -22,11 +22,12 @@
</span><span class="cx">                  printf( __( 'To post to WordPress by e-mail you must set up a secret e-mail account
</span><span class="cx">                                           with POP3 access. Any mail received at this address will be posted, so
</span><span class="cx">                                           it&#8217;s a good idea to keep this address very secret. Here are three
</span><del>-                                                random strings you could use: <kbd>%s</kbd>, <kbd>%s</kbd>, <kbd>%s</kbd>.' ),
-                        wp_generate_password( 8, false ),
-                        wp_generate_password( 8, false ),
-                        wp_generate_password( 8, false ) )
-           ?>
</del><ins>+                                                 random strings you could use: <kbd>%s</kbd>, <kbd>%s</kbd>, <kbd>%s</kbd>.',
+                                                'post-by-email' ),
+                                       wp_generate_password( 8, false ),
+                                       wp_generate_password( 8, false ),
+                                       wp_generate_password( 8, false ) )
+               ?>
</ins><span class="cx">   </p>
</span><span class="cx"> 
</span><span class="cx">  <form method="post" action="options.php">
</span><span class="lines">@@ -38,51 +39,51 @@
</span><span class="cx">                  <tr valign="top">
</span><span class="cx">                          <th scope="row">
</span><span class="cx">                                  <label for="post_by_email_options[mailserver_url]">
</span><del>-                                               <?php _e( 'Mail Server' ) ?>
</del><ins>+                                                <?php _e( 'Mail Server', 'post-by-email' ) ?>
</ins><span class="cx">                                   </label>
</span><span class="cx">                          </th>
</span><span class="cx">                          <td>
</span><del>-                                       <input name="post_by_email_options[mailserver_url]" type="text" id="mailserver_url" value="<?php echo esc_attr( $options[mailserver_url] ); ?>" class="regular-text ltr" />
</del><ins>+                                        <input name="post_by_email_options[mailserver_url]" type="text" id="mailserver_url" value="<?php echo esc_attr( $options['mailserver_url'] ); ?>" class="regular-text ltr" />
</ins><span class="cx">                                   <label for="post_by_email_options[mailserver_port]">
</span><del>-                                               <?php _e( 'Port' ) ?>
</del><ins>+                                                <?php _e( 'Port', 'post-by-email' ) ?>
</ins><span class="cx">                                   </label>
</span><del>-                                       <input name="post_by_email_options[mailserver_port]" type="text" id="mailserver_port" value="<?php echo esc_attr( $options[mailserver_port] ); ?>" class="small-text" />
</del><ins>+                                        <input name="post_by_email_options[mailserver_port]" type="text" id="mailserver_port" value="<?php echo esc_attr( $options['mailserver_port'] ); ?>" class="small-text" />
</ins><span class="cx">                           </td>
</span><span class="cx">                  </tr>
</span><span class="cx">                  <tr valign="top">
</span><span class="cx">                          <th scope="row">
</span><span class="cx">                                  <label for="post_by_email_options[mailserver_login]">
</span><del>-                                               <?php _e( 'Login Name' ) ?>
</del><ins>+                                                <?php _e( 'Login Name', 'post-by-email' ) ?>
</ins><span class="cx">                                   </label>
</span><span class="cx">                          </th>
</span><span class="cx">                          <td>
</span><del>-                                       <input name="post_by_email_options[mailserver_login]" type="text" id="mailserver_login" value="<?php echo esc_attr( $options[mailserver_login] ); ?>" class="regular-text ltr" />
</del><ins>+                                        <input name="post_by_email_options[mailserver_login]" type="text" id="mailserver_login" value="<?php echo esc_attr( $options['mailserver_login'] ); ?>" class="regular-text ltr" />
</ins><span class="cx">                           </td>
</span><span class="cx">                  </tr>
</span><span class="cx">                  <tr valign="top">
</span><span class="cx">                          <th scope="row">
</span><span class="cx">                                  <label for="post_by_email_options[mailserver_pass]">
</span><del>-                                               <?php _e( 'Password' ) ?>
</del><ins>+                                                <?php _e( 'Password', 'post-by-email' ) ?>
</ins><span class="cx">                                   </label>
</span><span class="cx">                          </th>
</span><span class="cx">                          <td>
</span><del>-                                       <input name="post_by_email_options[mailserver_pass]" type="password" id="mailserver_pass" value="<?php echo esc_attr( $options[mailserver_pass] ); ?>" class="regular-text ltr" />
</del><ins>+                                        <input name="post_by_email_options[mailserver_pass]" type="password" id="mailserver_pass" value="<?php echo esc_attr( $options['mailserver_pass'] ); ?>" class="regular-text ltr" />
</ins><span class="cx">                           </td>
</span><span class="cx">                  </tr>
</span><span class="cx">                  <tr valign="top">
</span><span class="cx">                          <th scope="row">
</span><span class="cx">                                  <label for="post_by_email_options[default_email_category]">
</span><del>-                                               <?php _e( 'Default Mail Category' ) ?>
</del><ins>+                                                <?php _e( 'Default Mail Category', 'post-by-email' ) ?>
</ins><span class="cx">                                   </label>
</span><span class="cx">                          </th>
</span><span class="cx">                          <td>
</span><span class="cx">                                  <?php
</span><del>-                                               wp_dropdown_categories( array( 'hide_empty' => 0,
-                                                                                                          'name' => 'default_email_category',
-                                                                                                          'orderby' => 'name',
-                                                                                                          'selected' => $options['default_email_category'],
-                                                                                                          'hierarchical' => true
-                                                                                                ) );
</del><ins>+                                                wp_dropdown_categories( array(  'hide_empty' => 0,
+                                                                                                               'name' => 'post_by_email_options[default_email_category]',
+                                                                                                               'orderby' => 'name',
+                                                                                                               'selected' => $options['default_email_category'],
+                                                                                                               'hierarchical' => true
+                                                                                                       ) );
</ins><span class="cx">                                   ?>
</span><span class="cx">                          </td>
</span><span class="cx">                  </tr>
</span><span class="lines">@@ -92,14 +93,20 @@
</span><span class="cx">          <?php submit_button(); ?>
</span><span class="cx">  </form>
</span><span class="cx"> 
</span><del>-       <h2>Activity Log</h2>
-       <?php $log = get_option( 'post_by_email_log' ); ?>
-       <p>Last checked: <?php echo $log ? $log['last_checked'] : "Never"; ?></p>
-       <p><a href="<?php echo site_url('wp-mail.php'); ?>">Check now</a></p>
</del><ins>+        <h2><?php _e( 'Activity Log', 'post-by-email' ) ?></h2>
+       <?php
+               $options = get_option( 'post_by_email_options' );
+               $log = $options['log'];
+       ?>
+       <p>
+               <?php _e( 'Last checked:', 'post-by-email' ) ?>
+               <?php echo $log ? $log['last_checked'] : __( 'Never', 'post-by-email' ); ?>
+       </p>
</ins><span class="cx">   <?php if( $log['messages'] ) : ?>
</span><del>-               And the plugin had this to say about it:
</del><ins>+                <?php _e( 'And the plugin had this to say about it:', 'post-by-email' ); ?>
</ins><span class="cx">           <?php foreach($log['messages'] as $message) : ?>
</span><span class="cx">                  <li><?php echo $message; ?></li>
</span><span class="cx">          <?php endforeach; ?>
</span><span class="cx">  <?php endif; ?>
</span><ins>+       <p><a href="<?php echo site_url('wp-mail.php'); ?>"><?php _e( 'Check now', 'post-by-email' ) ?></a></p>
</ins><span class="cx"> </div>
</span><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="2013codebykatpostbyemailtrunkviewsindexphp"></a>
<div class="delfile"><h4>Deleted: 2013/codebykat/post-by-email/trunk/views/index.php (2218 => 2219)</h4>
<pre class="diff"><span>
<span class="info">--- 2013/codebykat/post-by-email/trunk/views/index.php       2013-08-13 22:28:04 UTC (rev 2218)
+++ 2013/codebykat/post-by-email/trunk/views/index.php  2013-08-16 04:16:29 UTC (rev 2219)
</span><span class="lines">@@ -1 +0,0 @@
</span><del>-<?php // Silence is golden ?>
</del><span class="cx">\ No newline at end of file
</span></span></pre>
</div>
</div>

</body>
</html>