Plugin Directory

Changeset 890710

Timestamp:
04/10/2014 05:32:22 PM (10 years ago)
Author:
eoigal
Message:
  • CSS bug fixes - improve responsiveness
  • Replace 30 day discard option with new discard option that removes the worst spam automatically
  • Merge the pre_comment_approved filters
Location:
akismet/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • akismet/trunk/_inc/akismet.css

    r873779 r890710  
    6868    background: #7c9936 url('img/logo-full-2x.png') no-repeat 20px center;
    6969    background-size: 185px 33px;
    70     margin: -10px -20px 14px -22px;
    7170    height: 33px;
    7271    text-indent: -9999em;
     72
    7373}
    7474.checkforspam {
     
    112112    background: #fff;
    113113    padding: 30px;
     114
    114115}
    115116
     
    126127}
    127128.activate-highlight .button-primary {
    128     padding: 0 20px;
    129129    margin-top: 15px;
    130130}
     
    254254.new-snapspot ul {
    255255    font-size: 12px;
     256
    256257}
    257258
     
    263264    text-transform: uppercase;
    264265    width: 33%;
    265     white-space: nowrap;
    266266    box-sizing: border-box;
    267267    -moz-box-sizing: border-box;
     
    282282    color: #52accc;
    283283    display: block;
    284     font-size: 40px;
     284    font-size: px;
    285285    font-weight: lighter;
    286286    line-height: 1.5em;
     
    341341}
    342342
     343
     344
     345
     346
     347
     348
     349
     350
     351
    343352.akismet-settings span.note{
    344353    float: left;
    345354    padding-left: 23px;
    346355    font-size: 75%;
     356
    347357}
    348358
  • akismet/trunk/class.akismet-admin.php

    r888811 r890710  
    183183                            '<p><strong>' . esc_html__( 'Akismet Configuration' , 'akismet') . '</strong></p>' .
    184184                            '<p><strong>' . esc_html__( 'API Key' , 'akismet') . '</strong> - ' . esc_html__( 'Enter/remove an API key.' , 'akismet') . '</p>' .
    185                             '<p><strong>' . esc_html__( 'Automatically delete spam from posts older than 30 days' , 'akismet') . '</strong> - ' . esc_html__( 'Automatically delete spam comments on posts that are older than 30 days old.' , 'akismet') . '</p>' .
    186                             '<p><strong>' . esc_html__( 'Show the number of approved comments beside each comment author' , 'akismet') . '</strong> - ' . esc_html__( 'Show the number of approved comments beside each comment author in the comments list page.' , 'akismet') . '</p>',
     185                            '<p><strong>' . esc_html__( '.' , 'akismet') . '</p>' .
     186                            '<p><strong>' . esc_html__( 'S.' , 'akismet') . '</p>',
    187187                    )
    188188                );
     
    216216            return false;
    217217
    218         foreach( array( 'akismet_discard_month', 'akismet_show_user_comments_approved' ) as $option ) {
    219             update_option( $option, isset( $_POST[$option] ) ? 'true' : 'false' );
     218        foreach( array( 'akismet_', 'akismet_show_user_comments_approved' ) as $option ) {
     219            update_option( $option, isset( $_POST[$option] ) ' );
    220220        }
    221221
     
    507507            echo '<span class="akismet-status" commentid="'.$comment->comment_ID.'"><a href="comment.php?action=editcomment&amp;c='.$comment->comment_ID.'#akismet-status" title="' . esc_attr__( 'View comment history' , 'akismet') . '">'.esc_html( $desc ).'</a></span>';
    508508
    509         if ( apply_filters( 'akismet_show_user_comments_approved', get_option('akismet_show_user_comments_approved') ) == 'true' ) {
     509        if ( apply_filters( 'akismet_show_user_comments_approved', get_option('akismet_show_user_comments_approved') ) ) {
    510510            $comment_count = Akismet::get_user_comments_approved( $comment->user_id, $comment->comment_author_email, $comment->comment_author, $comment->comment_author_url );
    511511            $comment_count = intval( $comment_count );
     
    841841        $api_key      = Akismet::get_api_key();
    842842        $akismet_user = self::get_akismet_user( $api_key );
     843
     844
     845
     846
    843847
    844848        $blog = parse_url( get_option('home'), PHP_URL_HOST );
  • akismet/trunk/class.akismet.php

    r890287 r890710  
    99    private static $initiated = false;
    1010    private static $prevent_moderation_email_for_these_comments = array();
    11     private static $last_comment_is_spam = false;
     11    private static $last_comment_;
    1212   
    1313    public static function init() {
     
    3939
    4040        add_filter( 'comment_moderation_recipients', array( 'Akismet', 'disable_moderation_emails_if_unreachable' ), 1000, 2 );
    41         add_filter( 'pre_comment_approved', array( 'Akismet', 'comment_is_spam' ), 10, 2 );
     41        add_filter( 'pre_comment_approved', array( 'Akismet', '' ), 10, 2 );
    4242
    4343        if ( '3.0.5' == $GLOBALS['wp_version'] ) {
     
    6868
    6969    public static function auto_check_comment( $commentdata ) {
    70         self::$last_comment_is_spam = false;
     70        self::$last_comment_;
    7171
    7272        $comment = $commentdata;
     
    125125        $commentdata['akismet_result']       = $response[1];
    126126
    127         if ( isset( $response[0]['x-akismet-pro-tip'] ) && $response[0]['x-akismet-pro-tip'] === 'discard' )
    128             $commentdata['akismet_pro_tip'] = 'discard';
     127        if ( isset( $response[0]['x-akismet-pro-tip'] ) )
     128    ;
    129129
    130130        if ( 'true' == $response[1] ) {
    131131            // akismet_spam_count will be incremented later by comment_is_spam()
    132             self::$last_comment_is_spam = true;
     132            self::$last_comment_;
    133133
    134134            $discard = ( isset( $commentdata['akismet_pro_tip'] ) && $commentdata['akismet_pro_tip'] === 'discard' && self::allow_discard() );
    135135
    136136            do_action( 'akismet_spam_caught', $discard );
    137 
    138             if ( !$discard ) {
    139                 //discard posts older than 30 days if option to do so is set
    140                 $diff = time() - strtotime( $post->post_modified_gmt ) / 86400;
    141                 $discard = ( $post->post_type == 'post' && $diff > 30 && get_option( 'akismet_discard_month' ) == 'true' && empty( $comment['user_ID'] ) );
    142             }
    143137
    144138            if ( $discard ) {
     
    155149        if ( 'true' != $response[1] && 'false' != $response[1] ) {
    156150            if ( !current_user_can('moderate_comments') ) {
    157                 add_filter('pre_comment_approved', array( 'Akismet',  'comment_needs_moderation' ), 10, 2 );
     151                // Comment status should be moderated
     152                self::$last_comment_result = '0';
    158153            }
    159154            if ( function_exists('wp_next_scheduled') && function_exists('wp_schedule_single_event') ) {
     
    179174        self::fix_scheduled_recheck();
    180175
     176
     177
     178
     179
    181180        return self::$last_comment;
    182181    }
     
    552551
    553552    // filter handler used to return a spam result to pre_comment_approved
    554     public static function comment_is_spam( $approved, $comment ) {
     553    public static function
    555554        // Only do this if it's the correct comment
    556         if ( ! self::$last_comment_is_spam || ! self::matches_last_comment( $comment ) ) {
     555        if ( || ! self::matches_last_comment( $comment ) ) {
    557556            self::log( "comment_is_spam mismatched comment, returning unaltered $approved" );
    558557            return $approved;
     
    563562            update_option( 'akismet_spam_count', get_option('akismet_spam_count') + $incr );
    564563
    565         return 'spam';
    566     }
    567 
    568     public static function comment_needs_moderation( $approved, $comment ) {
    569         // Only do this if it's the correct comment
    570         if ( !self::matches_last_comment( $comment ) ) {
    571             return $approved;
    572         }   
    573         return '0';
     564        return self::$last_comment_result;
    574565    }
    575566   
  • akismet/trunk/views/config.php

    r878668 r890710  
    5454                });
    5555                </script>
    56                 <div class="postbox-container" style="width:59%;">
     56                <div class="postbox-container" style="width:;">
    5757                    <div id="normal-sortables" class="meta-box-sortables ui-sortable">
    5858                        <div id="referrers" class="postbox ">
     
    6565                                            <?php if ( !defined( 'WPCOM_API_KEY' ) ):?>
    6666                                            <tr>
    67                                                 <th scope="row" align="left" width="10%"><?php esc_html_e('API Key', 'akismet');?></th>
     67                                                <th "><?php esc_html_e('API Key', 'akismet');?></th>
    6868                                                <td width="5%"/>
    6969                                                <td align="left">
    70                                                     <span><input id="key" name="key" type="text" size="15" maxlength="12" value="<?php echo esc_attr( get_option('wordpress_api_key') ); ?>" class="regular-text code <?php echo $akismet_user->status;?>"></span>
     70                                                    <span><input id="key" name="key" type="text" size="15" maxlength="12" value="<?php echo esc_attr( get_option('wordpress_api_key') ); ?>" class="regular-text code <?php echo $akismet_user->status;?>"></span>
    7171                                                </td>
    7272                                            </tr>
    7373                                            <?php endif; ?>
    7474                                            <tr>
    75                                                 <th width="10%"></th>
     75                                                <th ></th>
    7676                                                <td></td>
    77                                                 <td>
     77                                                <td>
    7878                                                    <p>
    79                                                         <label for="akismet_show_user_comments_approved" title="<?php esc_attr_e( 'Show approved comments' , 'akismet'); ?>"><input name="akismet_show_user_comments_approved" id="akismet_show_user_comments_approved" value="true" type="checkbox" <?php echo get_option('akismet_show_user_comments_approved') == 'true' ? 'checked="checked"':''; ?>> <?php esc_html_e('Show the number of approved comments beside each comment author', 'akismet'); ?></label>
     79                                                        <label for="akismet_show_user_comments_approved" title="<?php esc_attr_e( 'Show approved comments' , 'akismet'); ?>"><input name="akismet_show_user_comments_approved" id="akismet_show_user_comments_approved" value="; ?>> <?php esc_html_e('Show the number of approved comments beside each comment author', 'akismet'); ?></label>
    8080                                                    </p>
    81                                                     <p>
    82                                                         <label for="akismet_discard_month" title="<?php esc_attr_e( 'Auto-detete spam from old posts' , 'akismet'); ?>"><input name="akismet_discard_month" id="akismet_discard_month" value="true" type="checkbox" <?php echo get_option('akismet_discard_month') == 'true' ? 'checked="checked"':''; ?>> <?php esc_html_e('Automatically delete spam from posts older than 30 days', 'akismet'); ?></label><span class="note"><strong><?php esc_html_e('Note:', 'akismet');?></strong> <?php printf( __( 'Spam in the <a href="%s">spam folder</a> older than 15 days is deleted automatically.' , 'akismet'), admin_url( 'edit-comments.php?type=spam' ) );?></span><div class="clear"></div>
    83                                                     </p>
     81                                                </td>
     82                                            </tr>
     83                                            <tr>
     84                                                <th class="strictness" align="left" scope="row"><?php esc_html_e('Strictness', 'akismet'); ?></th>
     85                                                <td></td>
     86                                                <td align="left">
     87                                                    <fieldset><legend class="screen-reader-text"><span><?php esc_html_e('Akismet anti-spam strictness', 'akismet'); ?></span></legend>
     88                                                    <p><label for="akismet_strictness_1"><input type="radio" name="akismet_strictness" id="akismet_strictness_1" value="1" <?php checked('1', get_option('akismet_strictness')); ?> /> <?php esc_html_e('Silently discard the worst and most pervasive spam so I never see it.', 'akismet'); ?></label></p>
     89                                                    <p><label for="akismet_strictness_0"><input type="radio" name="akismet_strictness" id="akismet_strictness_0" value="0" <?php checked('0', get_option('akismet_strictness')); ?> /> <?php esc_html_e('Always put spam in the Spam folder for review.', 'akismet'); ?></label></p>
     90                                                    </fieldset>
     91                                                    <span class="note"><strong><?php esc_html_e('Note:', 'akismet');?></strong> <?php printf( __( 'Spam in the <a href="%s">spam folder</a> older than 15 days is deleted automatically.' , 'akismet'), admin_url( 'edit-comments.php?type=spam' ) );?></span>
    8492                                                </td>
    8593                                            </tr>
     
    105113                    </div>
    106114                </div>
    107                 <div class="postbox-container" style="width:39%;float: right;">
     115                <div class="postbox-container" style="width:;">
    108116                    <div id="normal-sortables" class="meta-box-sortables ui-sortable">
    109117                        <div id="referrers" class="postbox ">
  • akismet/trunk/views/start.php

    r885298 r890710  
    22    if ( $akismet_user ) :
    33        if ( $akismet_user->status == 'active' ) : // ask do they want to use akismet account found using jetpack wpcom connection ?>
    4 <p><?php esc_html_e('Akismet eliminates the comment and trackback spam you get on your site. To setup Akismet, select one of the options below.', 'akismet'); ?></p>
     4<p><?php esc_html_e('Akismet eliminates the comment and trackback spam you get on your site. To setup Akismet, select one of the options below.', 'akismet'); ?></p>
    55<div class="activate-highlight activate-option">
    66    <div class="option-description">
Note: See TracChangeset for help on using the changeset viewer.