Changeset 890710
- Timestamp:
- 04/10/2014 05:32:22 PM (10 years ago)
- Location:
- akismet/trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
akismet/trunk/_inc/akismet.css
r873779 r890710 68 68 background: #7c9936 url('img/logo-full-2x.png') no-repeat 20px center; 69 69 background-size: 185px 33px; 70 margin: -10px -20px 14px -22px;71 70 height: 33px; 72 71 text-indent: -9999em; 72 73 73 } 74 74 .checkforspam { … … 112 112 background: #fff; 113 113 padding: 30px; 114 114 115 } 115 116 … … 126 127 } 127 128 .activate-highlight .button-primary { 128 padding: 0 20px;129 129 margin-top: 15px; 130 130 } … … 254 254 .new-snapspot ul { 255 255 font-size: 12px; 256 256 257 } 257 258 … … 263 264 text-transform: uppercase; 264 265 width: 33%; 265 white-space: nowrap;266 266 box-sizing: border-box; 267 267 -moz-box-sizing: border-box; … … 282 282 color: #52accc; 283 283 display: block; 284 font-size: 40px;284 font-size: px; 285 285 font-weight: lighter; 286 286 line-height: 1.5em; … … 341 341 } 342 342 343 344 345 346 347 348 349 350 351 343 352 .akismet-settings span.note{ 344 353 float: left; 345 354 padding-left: 23px; 346 355 font-size: 75%; 356 347 357 } 348 358 -
akismet/trunk/class.akismet-admin.php
r888811 r890710 183 183 '<p><strong>' . esc_html__( 'Akismet Configuration' , 'akismet') . '</strong></p>' . 184 184 '<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__( 'S how 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>', 187 187 ) 188 188 ); … … 216 216 return false; 217 217 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] ) ' ); 220 220 } 221 221 … … 507 507 echo '<span class="akismet-status" commentid="'.$comment->comment_ID.'"><a href="comment.php?action=editcomment&c='.$comment->comment_ID.'#akismet-status" title="' . esc_attr__( 'View comment history' , 'akismet') . '">'.esc_html( $desc ).'</a></span>'; 508 508 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') ) ) { 510 510 $comment_count = Akismet::get_user_comments_approved( $comment->user_id, $comment->comment_author_email, $comment->comment_author, $comment->comment_author_url ); 511 511 $comment_count = intval( $comment_count ); … … 841 841 $api_key = Akismet::get_api_key(); 842 842 $akismet_user = self::get_akismet_user( $api_key ); 843 844 845 846 843 847 844 848 $blog = parse_url( get_option('home'), PHP_URL_HOST ); -
akismet/trunk/class.akismet.php
r890287 r890710 9 9 private static $initiated = false; 10 10 private static $prevent_moderation_email_for_these_comments = array(); 11 private static $last_comment_ is_spam = false;11 private static $last_comment_; 12 12 13 13 public static function init() { … … 39 39 40 40 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 ); 42 42 43 43 if ( '3.0.5' == $GLOBALS['wp_version'] ) { … … 68 68 69 69 public static function auto_check_comment( $commentdata ) { 70 self::$last_comment_ is_spam = false;70 self::$last_comment_; 71 71 72 72 $comment = $commentdata; … … 125 125 $commentdata['akismet_result'] = $response[1]; 126 126 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 ; 129 129 130 130 if ( 'true' == $response[1] ) { 131 131 // akismet_spam_count will be incremented later by comment_is_spam() 132 self::$last_comment_ is_spam = true;132 self::$last_comment_; 133 133 134 134 $discard = ( isset( $commentdata['akismet_pro_tip'] ) && $commentdata['akismet_pro_tip'] === 'discard' && self::allow_discard() ); 135 135 136 136 do_action( 'akismet_spam_caught', $discard ); 137 138 if ( !$discard ) {139 //discard posts older than 30 days if option to do so is set140 $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 }143 137 144 138 if ( $discard ) { … … 155 149 if ( 'true' != $response[1] && 'false' != $response[1] ) { 156 150 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'; 158 153 } 159 154 if ( function_exists('wp_next_scheduled') && function_exists('wp_schedule_single_event') ) { … … 179 174 self::fix_scheduled_recheck(); 180 175 176 177 178 179 181 180 return self::$last_comment; 182 181 } … … 552 551 553 552 // 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 555 554 // 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 ) ) { 557 556 self::log( "comment_is_spam mismatched comment, returning unaltered $approved" ); 558 557 return $approved; … … 563 562 update_option( 'akismet_spam_count', get_option('akismet_spam_count') + $incr ); 564 563 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; 574 565 } 575 566 -
akismet/trunk/views/config.php
r878668 r890710 54 54 }); 55 55 </script> 56 <div class="postbox-container" style="width: 59%;">56 <div class="postbox-container" style="width:;"> 57 57 <div id="normal-sortables" class="meta-box-sortables ui-sortable"> 58 58 <div id="referrers" class="postbox "> … … 65 65 <?php if ( !defined( 'WPCOM_API_KEY' ) ):?> 66 66 <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> 68 68 <td width="5%"/> 69 69 <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> 71 71 </td> 72 72 </tr> 73 73 <?php endif; ?> 74 74 <tr> 75 <th width="10%"></th>75 <th ></th> 76 76 <td></td> 77 <td >77 <td> 78 78 <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> 80 80 </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> 84 92 </td> 85 93 </tr> … … 105 113 </div> 106 114 </div> 107 <div class="postbox-container" style="width: 39%;float: right;">115 <div class="postbox-container" style="width:;"> 108 116 <div id="normal-sortables" class="meta-box-sortables ui-sortable"> 109 117 <div id="referrers" class="postbox "> -
akismet/trunk/views/start.php
r885298 r890710 2 2 if ( $akismet_user ) : 3 3 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> 5 5 <div class="activate-highlight activate-option"> 6 6 <div class="option-description">
Note: See TracChangeset
for help on using the changeset viewer.