Plugin Directory

Changeset 776563


Ignore:
Timestamp:
09/22/2013 01:47:10 AM (13 years ago)
Author:
codebykat
Message:

Code style fixes and using human_time_diff instead of hardcoding timeout in log message. Fixes GSOC Trac #377
http://gsoc.trac.wordpress.org/ticket/377

Location:
post-by-email/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • post-by-email/trunk/22942_updated_for_3.7.diff

    r773660 r776563  
    423423-
    424424-$pop3->quit();
    425 +do_action('wp-mail.php');
     425+do_action( 'wp-mail.php' );
    426426\ No newline at end of file
  • post-by-email/trunk/class-post-by-email-admin.php

    r773662 r776563  
    139139        }
    140140
    141         if( strpos( $options['pin'], ']' ) ) {
     141        if ( strpos( $options['pin'], ']' ) ) {
    142142            $error_message = __( 'Error: PIN cannot contain shortcode delimiters.', 'post-by-email' );
    143143            add_settings_error( 'post_by_email_options',
     
    199199        );
    200200        WP_Screen::get($this->plugin_screen_hook_suffix)->add_help_tab( array(
    201             'id'      => 'options-postemail',
    202             'title'   => __( 'Post Via Email' ),
    203             'content' => '<p>' . __( 'Post via email settings allow you to send your WordPress install an email with the content of your post. You must set up a secret e-mail account with POP3 access to use this, and any mail received at this address will be posted, so it&#8217;s a good idea to keep this address very secret.', 'post-by-email' ) . '</p>',
    204         ) );
     201                'id'      => 'options-postemail',
     202                'title'   => __( 'Post Via Email' ),
     203                'content' => '<p>' . __( 'Post via email settings allow you to send your WordPress install an email with the content of your post. You must set up a secret e-mail account with POP3 access to use this, and any mail received at this address will be posted, so it&#8217;s a good idea to keep this address very secret.', 'post-by-email' ) . '</p>',
     204            )
     205        );
    205206    }
    206207
     
    226227
    227228        wp_enqueue_script( 'post-by-email-admin-js', plugins_url( 'js/admin.js', __FILE__ ), 'jquery', '', true );
     229
     230        // add nonces
     231        $nonces = array(
     232            'logNonce' => wp_create_nonce( 'post-by-email-clear-log' ),
     233            'pinNonce' => wp_create_nonce( 'post-by-email-generate-pin' ),
     234        );
     235        wp_localize_script( 'post-by-email-admin-js', 'PostByEmailNonces', $nonces );
    228236    }
    229237
  • post-by-email/trunk/class-post-by-email.php

    r776219 r776563  
    226226
    227227        if ( $last_checked && ! WP_DEBUG ) {
    228             $log_message = __( 'Please wait at least five minutes to check mail again!', 'post-by-email' );
     228            $time_diff = __( human_time_diff( time(), time() + WP_MAIL_INTERVAL ), 'post-by-email' );
     229            $log_message = sprintf( __( 'Please wait %s to check mail again!', 'post-by-email' ), $time_diff );
    229230            $this->save_log_message( $log_message );
    230231            return;
     
    331332                $pin = implode( $pin );
    332333
    333                 if( $pin != $options['pin'] ) {
     334                if ( $pin != $options['pin'] ) {
    334335                    // security check failed - move on to the next message
    335336                    $log_message .= '<br />"' . $post_title . '" ' . __( 'failed PIN authentication; discarding.', 'post-by-email' );
     
    354355                } else {  // create new category
    355356                    $new_category = wp_insert_term( $cat, 'category' );
    356                     if( $new_category ) {
     357                    if ( $new_category ) {
    357358                        $post_category[] = $new_category['term_id'];
    358359                    }
     
    392393            $args = array(
    393394                'public'   => true,
    394                 '_builtin' => false
     395                '_builtin' => false,
    395396            );
    396397            $registered_taxonomies = get_taxonomies( $args, 'names', 'and' );
     
    413414                $post_info = array(
    414415                    'ID' => $post_ID,
    415                     'post_content' => $post_content . '[gallery]'
     416                    'post_content' => $post_content . '[gallery]',
    416417                );
    417418                wp_update_post( $post_info );
     
    535536        $headerquery->headerText( array() );
    536537        $headerlist = $this->connection->fetch( 'INBOX', $headerquery, array(
    537             'ids' => $uid
    538         ));
     538                'ids' => $uid,
     539            )
     540        );
    539541
    540542        $headers = $headerlist->first()->getHeaderText( 0, Horde_Imap_Client_Data_Fetch::HEADER_PARSE );
     
    627629
    628630        $list = $this->connection->fetch( 'INBOX', $query, array(
    629             'ids' => $uid
    630         ));
     631                'ids' => $uid,
     632            )
     633        );
    631634
    632635        $part = $list->first()->getStructure();
     
    639642        $query2 = new Horde_Imap_Client_Fetch_Query();
    640643        $query2->bodyPart( $body_id, array(
    641             'decode' => true,
    642             'peek' => true
    643         ));
     644                'decode' => true,
     645                'peek' => true,
     646            )
     647        );
    644648
    645649        $list2 = $this->connection->fetch( 'INBOX', $query2, array(
    646             'ids' => $uid
    647         ));
     650                'ids' => $uid,
     651            )
     652        );
    648653
    649654        $message2 = $list2->first();
     
    676681
    677682        $list = $this->connection->fetch( 'INBOX', $query, array(
    678             'ids' => $uid
    679         ));
     683                'ids' => $uid,
     684            )
     685        );
    680686
    681687        $part = $list->first()->getStructure();
     
    695701                $query2 = new Horde_Imap_Client_Fetch_Query();
    696702                $query2->bodyPart( $mime_id, array(
    697                     'decode' => true,
    698                     'peek' => true
    699                 ));
     703                        'decode' => true,
     704                        'peek' => true,
     705                    )
     706                );
    700707
    701708                $list2 = $this->connection->fetch( 'INBOX', $query2, array(
    702                     'ids' => $uid
    703                 ));
     709                        'ids' => $uid,
     710                    )
     711                );
    704712
    705713                $message = $list2->first();
     
    757765        try {
    758766            $this->connection->store( 'INBOX', array(
    759                 'add' => array( $flag ),
    760                 'ids' => $uids
    761             ) );
     767                    'add' => array( $flag ),
     768                    'ids' => $uids,
     769                )
     770            );
    762771        }
    763772        catch ( Horde_Imap_Client_Exception $e ) {
     
    799808        $args = array(
    800809            'public'   => true,
    801             '_builtin' => false
     810            '_builtin' => false,
    802811        );
    803812        $registered_taxonomies = get_taxonomies( $args, 'names', 'and' );
     
    836845        $log = get_option( 'post_by_email_log', array() );
    837846
    838         array_unshift( $log, array( 'timestamp'=>current_time( 'timestamp' ), 'message'=>$message ) );
     847        array_unshift( $log, array(
     848                'timestamp' => current_time( 'timestamp' ),
     849                'message' => $message,
     850            )
     851        );
    839852
    840853        update_option( 'post_by_email_log', $log );
  • post-by-email/trunk/js/admin.js

    r771317 r776563  
    77        var data = {
    88            action: 'post_by_email_clear_log',
    9             security: logNonce
     9            security: PostByEmailNonces['logNonce']
    1010        };
    1111
     
    1313            jQuery(' table#logTable' ).hide();
    1414            jQuery( 'a#clearLog' ).hide();
    15         });
    16     });
     15        } );
     16    } );
    1717
    1818    // AJAX request for a new PIN
     
    2222        var data = {
    2323            action: 'post_by_email_generate_pin',
    24             security: pinNonce
     24            security: PostByEmailNonces['pinNonce']
    2525        };
    2626
    2727        jQuery.post( ajaxurl, data, function( response ) {
    2828            jQuery( 'input#post_by_email_options\\\[pin\\\]' ).val( response );
    29         });
    30     });
     29        } );
     30    } );
    3131
    3232    // tab switching
     
    3838        jQuery( 'a.nav-tab-active' ).removeClass( 'nav-tab-active' );
    3939        jQuery( e.target ).addClass( 'nav-tab-active' );
    40     });
     40    } );
    4141
    4242    // reset advanced options to default (SSL+IMAP)
     
    4747        jQuery( 'input#post_by_email_options\\[delete_messages\\]' ).attr( 'checked', 'checked' );
    4848        jQuery( 'input#post_by_email_options\\[delete_messages\\]' ).attr( 'disabled', false );
    49     });
     49    } );
    5050
    5151    if ( 'POP3' == jQuery( 'select#post_by_email_options\\[mailserver_protocol\\]' ).val() ) {
     
    6161            jQuery( 'input#post_by_email_options\\[delete_messages\\]' ).attr( 'disabled', false );
    6262        }
    63     });
     63    } );
    6464
    6565    // PIN tab
     
    7070            jQuery( 'tr.post-by-email-pin-settings' ).hide();
    7171        }
    72     });
     72    } );
    7373
    74 });
     74} );
  • post-by-email/trunk/views/admin.php

    r776219 r776563  
    288288    </div>
    289289</div>
    290 
    291 <script type="text/javascript">
    292     var logNonce = "<?php echo wp_create_nonce( 'post-by-email-clear-log' ); ?>";
    293     var pinNonce = "<?php echo wp_create_nonce( 'post-by-email-generate-pin' ); ?>";
    294 </script>
Note: See TracChangeset for help on using the changeset viewer.