Akismet Anti-Spam - Version 3.1.11

Version Description

Release Date - 12 May 2016

  • Fixed a bug that could cause the "Check for Spam" button to skip some comments.
  • Fixed a bug that could prevent some spam submissions from being sent to Akismet.
  • Updated all links to use https:// when possible.
  • Disabled Akismet debug logging unless WP_DEBUG and WP_DEBUG_LOG are both enabled.
Download this release

Release Info

Developer cfinke
Plugin Icon 128x128 Akismet Anti-Spam
Version 3.1.11
Comparing to
See all releases

Code changes from version 3.1.10 to 3.1.11

.htaccess CHANGED
@@ -12,7 +12,7 @@
12
  </IfModule>
13
 
14
  # Akismet CSS and JS
15
- <FilesMatch "^(form|akismet)\.(css|js)$">
16
  <IfModule !mod_authz_core.c>
17
  Allow from all
18
  </IfModule>
@@ -23,7 +23,7 @@
23
  </FilesMatch>
24
 
25
  # Akismet images
26
- <FilesMatch "^(.+)\.(png|gif)$">
27
  <IfModule !mod_authz_core.c>
28
  Allow from all
29
  </IfModule>
12
  </IfModule>
13
 
14
  # Akismet CSS and JS
15
+ <FilesMatch "^(form\.js|akismet\.js|akismet\.css)$">
16
  <IfModule !mod_authz_core.c>
17
  Allow from all
18
  </IfModule>
23
  </FilesMatch>
24
 
25
  # Akismet images
26
+ <FilesMatch "^logo-full-2x\.png$">
27
  <IfModule !mod_authz_core.c>
28
  Allow from all
29
  </IfModule>
_inc/akismet.js CHANGED
@@ -181,7 +181,8 @@ jQuery( function ( $ ) {
181
  window.location.reload();
182
  }
183
  else {
184
- akismet_check_for_spam(offset + limit, limit);
 
185
  }
186
  }
187
  );
181
  window.location.reload();
182
  }
183
  else {
184
+ // Account for comments that were caught as spam and moved out of the queue.
185
+ akismet_check_for_spam(offset + limit - result.counts.spam, limit);
186
  }
187
  }
188
  );
akismet.php CHANGED
@@ -4,11 +4,11 @@
4
  */
5
  /*
6
  Plugin Name: Akismet
7
- Plugin URI: http://akismet.com/
8
- Description: Used by millions, Akismet is quite possibly the best way in the world to <strong>protect your blog from spam</strong>. It keeps your site protected even while you sleep. To get started: 1) Click the "Activate" link to the left of this description, 2) <a href="http://akismet.com/get/">Sign up for an Akismet plan</a> to get an API key, and 3) Go to your Akismet configuration page, and save your API key.
9
- Version: 3.1.10
10
  Author: Automattic
11
- Author URI: http://automattic.com/wordpress-plugins/
12
  License: GPLv2 or later
13
  Text Domain: akismet
14
  */
@@ -37,7 +37,7 @@ if ( !function_exists( 'add_action' ) ) {
37
  exit;
38
  }
39
 
40
- define( 'AKISMET_VERSION', '3.1.10' );
41
  define( 'AKISMET__MINIMUM_WP_VERSION', '3.2' );
42
  define( 'AKISMET__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
43
  define( 'AKISMET_DELETE_LIMIT', 100000 );
4
  */
5
  /*
6
  Plugin Name: Akismet
7
+ Plugin URI: https://akismet.com/
8
+ Description: Used by millions, Akismet is quite possibly the best way in the world to <strong>protect your blog from spam</strong>. It keeps your site protected even while you sleep. To get started: 1) Click the "Activate" link to the left of this description, 2) <a href="https://akismet.com/get/">Sign up for an Akismet plan</a> to get an API key, and 3) Go to your Akismet configuration page, and save your API key.
9
+ Version: 3.1.11
10
  Author: Automattic
11
+ Author URI: https://automattic.com/wordpress-plugins/
12
  License: GPLv2 or later
13
  Text Domain: akismet
14
  */
37
  exit;
38
  }
39
 
40
+ define( 'AKISMET_VERSION', '3.1.11' );
41
  define( 'AKISMET__MINIMUM_WP_VERSION', '3.2' );
42
  define( 'AKISMET__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
43
  define( 'AKISMET_DELETE_LIMIT', 100000 );
class.akismet-admin.php CHANGED
@@ -366,6 +366,12 @@ class Akismet_Admin {
366
  }
367
  $moderation = $wpdb->get_results( "SELECT * FROM {$wpdb->comments} WHERE comment_approved = '0'{$paginate}", ARRAY_A );
368
 
 
 
 
 
 
 
369
  foreach ( (array) $moderation as $c ) {
370
  $c['user_ip'] = $c['comment_author_IP'];
371
  $c['user_agent'] = $c['comment_agent'];
@@ -392,14 +398,15 @@ class Akismet_Admin {
392
  delete_comment_meta( $c['comment_ID'], 'akismet_error' );
393
  delete_comment_meta( $c['comment_ID'], 'akismet_delayed_moderation_email' );
394
  Akismet::update_comment_history( $c['comment_ID'], '', 'recheck-spam' );
395
-
396
  } elseif ( 'false' == $response[1] ) {
397
  update_comment_meta( $c['comment_ID'], 'akismet_result', 'false' );
398
  delete_comment_meta( $c['comment_ID'], 'akismet_error' );
399
  delete_comment_meta( $c['comment_ID'], 'akismet_delayed_moderation_email' );
400
  Akismet::update_comment_history( $c['comment_ID'], '', 'recheck-ham' );
401
- // abnormal result: error
402
  } else {
 
403
  update_comment_meta( $c['comment_ID'], 'akismet_result', 'error' );
404
  Akismet::update_comment_history(
405
  $c['comment_ID'],
@@ -407,6 +414,7 @@ class Akismet_Admin {
407
  'recheck-error',
408
  array( 'response' => substr( $response[1], 0, 50 ) )
409
  );
 
410
  }
411
 
412
  delete_comment_meta( $c['comment_ID'], 'akismet_rechecking' );
@@ -414,6 +422,7 @@ class Akismet_Admin {
414
  if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
415
  wp_send_json( array(
416
  'processed' => count((array) $moderation),
 
417
  ));
418
  }
419
  else {
366
  }
367
  $moderation = $wpdb->get_results( "SELECT * FROM {$wpdb->comments} WHERE comment_approved = '0'{$paginate}", ARRAY_A );
368
 
369
+ $result_counts = array(
370
+ 'spam' => 0,
371
+ 'ham' => 0,
372
+ 'error' => 0,
373
+ );
374
+
375
  foreach ( (array) $moderation as $c ) {
376
  $c['user_ip'] = $c['comment_author_IP'];
377
  $c['user_agent'] = $c['comment_agent'];
398
  delete_comment_meta( $c['comment_ID'], 'akismet_error' );
399
  delete_comment_meta( $c['comment_ID'], 'akismet_delayed_moderation_email' );
400
  Akismet::update_comment_history( $c['comment_ID'], '', 'recheck-spam' );
401
+ ++$result_counts['spam'];
402
  } elseif ( 'false' == $response[1] ) {
403
  update_comment_meta( $c['comment_ID'], 'akismet_result', 'false' );
404
  delete_comment_meta( $c['comment_ID'], 'akismet_error' );
405
  delete_comment_meta( $c['comment_ID'], 'akismet_delayed_moderation_email' );
406
  Akismet::update_comment_history( $c['comment_ID'], '', 'recheck-ham' );
407
+ ++$result_counts['ham'];
408
  } else {
409
+ // abnormal result: error
410
  update_comment_meta( $c['comment_ID'], 'akismet_result', 'error' );
411
  Akismet::update_comment_history(
412
  $c['comment_ID'],
414
  'recheck-error',
415
  array( 'response' => substr( $response[1], 0, 50 ) )
416
  );
417
+ ++$result_counts['error'];
418
  }
419
 
420
  delete_comment_meta( $c['comment_ID'], 'akismet_rechecking' );
422
  if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
423
  wp_send_json( array(
424
  'processed' => count((array) $moderation),
425
+ 'counts' => $result_counts,
426
  ));
427
  }
428
  else {
class.akismet-widget.php CHANGED
@@ -95,7 +95,7 @@ class Akismet_Widget extends WP_Widget {
95
  ?>
96
 
97
  <div class="a-stats">
98
- <a href="http://akismet.com" target="_blank" title=""><?php printf( _n( '<strong class="count">%1$s spam</strong> blocked by <strong>Akismet</strong>', '<strong class="count">%1$s spam</strong> blocked by <strong>Akismet</strong>', $count , 'akismet'), number_format_i18n( $count ) ); ?></a>
99
  </div>
100
 
101
  <?php
95
  ?>
96
 
97
  <div class="a-stats">
98
+ <a href="https://akismet.com" target="_blank" title=""><?php printf( _n( '<strong class="count">%1$s spam</strong> blocked by <strong>Akismet</strong>', '<strong class="count">%1$s spam</strong> blocked by <strong>Akismet</strong>', $count , 'akismet'), number_format_i18n( $count ) ); ?></a>
99
  </div>
100
 
101
  <?php
class.akismet.php CHANGED
@@ -505,8 +505,9 @@ class Akismet {
505
  ( isset( $_POST['spam'] ) && (int) $_POST['spam'] == 1 ) ||
506
  ( isset( $_POST['unspam'] ) && (int) $_POST['unspam'] == 1 ) ||
507
  ( isset( $_POST['comment_status'] ) && in_array( $_POST['comment_status'], array( 'spam', 'unspam' ) ) ) ||
508
- ( isset( $_GET['action'] ) && in_array( $_GET['action'], array( 'spam', 'unspam' ) ) ) ||
509
- ( isset( $_POST['action'] ) && in_array( $_POST['action'], array( 'editedcomment' ) ) )
 
510
  ) {
511
  if ( $new_status == 'spam' && ( $old_status == 'approved' || $old_status == 'unapproved' || !$old_status ) ) {
512
  return self::submit_spam_comment( $comment->comment_ID );
@@ -824,8 +825,13 @@ class Akismet {
824
 
825
  // filter handler used to return a spam result to pre_comment_approved
826
  public static function last_comment_status( $approved, $comment ) {
 
 
 
 
 
827
  // Only do this if it's the correct comment
828
- if ( is_null(self::$last_comment_result) || ! self::matches_last_comment( $comment ) ) {
829
  self::log( "comment_is_spam mismatched comment, returning unaltered $approved" );
830
  return $approved;
831
  }
@@ -1087,7 +1093,7 @@ p {
1087
  if ( version_compare( $GLOBALS['wp_version'], AKISMET__MINIMUM_WP_VERSION, '<' ) ) {
1088
  load_plugin_textdomain( 'akismet' );
1089
 
1090
- $message = '<strong>'.sprintf(esc_html__( 'Akismet %s requires WordPress %s or higher.' , 'akismet'), AKISMET_VERSION, AKISMET__MINIMUM_WP_VERSION ).'</strong> '.sprintf(__('Please <a href="%1$s">upgrade WordPress</a> to a current version, or <a href="%2$s">downgrade to version 2.4 of the Akismet plugin</a>.', 'akismet'), 'https://codex.wordpress.org/Upgrading_WordPress', 'http://wordpress.org/extend/plugins/akismet/download/');
1091
 
1092
  Akismet::bail_on_activation( $message );
1093
  }
@@ -1114,12 +1120,14 @@ p {
1114
  /**
1115
  * Log debugging info to the error log.
1116
  *
1117
- * Enabled when WP_DEBUG_LOG is enabled, but can be disabled via the akismet_debug_log filter.
 
 
1118
  *
1119
  * @param mixed $akismet_debug The data to log.
1120
  */
1121
  public static function log( $akismet_debug ) {
1122
- if ( apply_filters( 'akismet_debug_log', defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) ) {
1123
  error_log( print_r( compact( 'akismet_debug' ), true ) );
1124
  }
1125
  }
505
  ( isset( $_POST['spam'] ) && (int) $_POST['spam'] == 1 ) ||
506
  ( isset( $_POST['unspam'] ) && (int) $_POST['unspam'] == 1 ) ||
507
  ( isset( $_POST['comment_status'] ) && in_array( $_POST['comment_status'], array( 'spam', 'unspam' ) ) ) ||
508
+ ( isset( $_GET['action'] ) && in_array( $_GET['action'], array( 'spam', 'unspam', 'spamcomment', 'unspamcomment', ) ) ) ||
509
+ ( isset( $_POST['action'] ) && in_array( $_POST['action'], array( 'editedcomment' ) ) ) ||
510
+ ( isset( $_GET['for'] ) && ( 'jetpack' == $_GET['for'] ) ) // Moderation via WP.com notifications/WP app/etc.
511
  ) {
512
  if ( $new_status == 'spam' && ( $old_status == 'approved' || $old_status == 'unapproved' || !$old_status ) ) {
513
  return self::submit_spam_comment( $comment->comment_ID );
825
 
826
  // filter handler used to return a spam result to pre_comment_approved
827
  public static function last_comment_status( $approved, $comment ) {
828
+ if ( is_null( self::$last_comment_result ) ) {
829
+ // We didn't have reason to store the result of the last check.
830
+ return $approved;
831
+ }
832
+
833
  // Only do this if it's the correct comment
834
+ if ( ! self::matches_last_comment( $comment ) ) {
835
  self::log( "comment_is_spam mismatched comment, returning unaltered $approved" );
836
  return $approved;
837
  }
1093
  if ( version_compare( $GLOBALS['wp_version'], AKISMET__MINIMUM_WP_VERSION, '<' ) ) {
1094
  load_plugin_textdomain( 'akismet' );
1095
 
1096
+ $message = '<strong>'.sprintf(esc_html__( 'Akismet %s requires WordPress %s or higher.' , 'akismet'), AKISMET_VERSION, AKISMET__MINIMUM_WP_VERSION ).'</strong> '.sprintf(__('Please <a href="%1$s">upgrade WordPress</a> to a current version, or <a href="%2$s">downgrade to version 2.4 of the Akismet plugin</a>.', 'akismet'), 'https://codex.wordpress.org/Upgrading_WordPress', 'https://wordpress.org/extend/plugins/akismet/download/');
1097
 
1098
  Akismet::bail_on_activation( $message );
1099
  }
1120
  /**
1121
  * Log debugging info to the error log.
1122
  *
1123
+ * Enabled when WP_DEBUG_LOG is enabled (and WP_DEBUG, since according to
1124
+ * core, "WP_DEBUG_DISPLAY and WP_DEBUG_LOG perform no function unless
1125
+ * WP_DEBUG is true), but can be disabled via the akismet_debug_log filter.
1126
  *
1127
  * @param mixed $akismet_debug The data to log.
1128
  */
1129
  public static function log( $akismet_debug ) {
1130
+ if ( apply_filters( 'akismet_debug_log', defined( 'WP_DEBUG' ) && WP_DEBUG && defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) ) {
1131
  error_log( print_r( compact( 'akismet_debug' ), true ) );
1132
  }
1133
  }
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: matt, ryan, andy, mdawaffe, tellyworth, josephscott, lessbloat, eoigal, cfinke, automattic, jgs
3
  Tags: akismet, comments, spam, antispam, anti-spam, anti spam, comment moderation, comment spam, contact form spam, spam comments
4
  Requires at least: 3.2
5
- Tested up to: 4.5
6
- Stable tag: 3.1.10
7
  License: GPLv2 or later
8
 
9
  Akismet checks your comments against the Akismet Web service to see if they look like spam or not.
@@ -20,16 +20,24 @@ Major features in Akismet include:
20
  * Moderators can see the number of approved comments for each user.
21
  * A discard feature that outright blocks the worst spam, saving you disk space and speeding up your site.
22
 
23
- PS: You'll need an [Akismet.com API key](http://akismet.com/get/) to use it. Keys are free for personal blogs; paid subscriptions are available for businesses and commercial sites.
24
 
25
  == Installation ==
26
 
27
- Upload the Akismet plugin to your blog, Activate it, then enter your [Akismet.com API key](http://akismet.com/get/).
28
 
29
  1, 2, 3: You're done!
30
 
31
  == Changelog ==
32
 
 
 
 
 
 
 
 
 
33
  = 3.1.10 =
34
  *Release Date - 1 April 2016*
35
 
2
  Contributors: matt, ryan, andy, mdawaffe, tellyworth, josephscott, lessbloat, eoigal, cfinke, automattic, jgs
3
  Tags: akismet, comments, spam, antispam, anti-spam, anti spam, comment moderation, comment spam, contact form spam, spam comments
4
  Requires at least: 3.2
5
+ Tested up to: 4.5.2
6
+ Stable tag: 3.1.11
7
  License: GPLv2 or later
8
 
9
  Akismet checks your comments against the Akismet Web service to see if they look like spam or not.
20
  * Moderators can see the number of approved comments for each user.
21
  * A discard feature that outright blocks the worst spam, saving you disk space and speeding up your site.
22
 
23
+ PS: You'll need an [Akismet.com API key](https://akismet.com/get/) to use it. Keys are free for personal blogs; paid subscriptions are available for businesses and commercial sites.
24
 
25
  == Installation ==
26
 
27
+ Upload the Akismet plugin to your blog, Activate it, then enter your [Akismet.com API key](https://akismet.com/get/).
28
 
29
  1, 2, 3: You're done!
30
 
31
  == Changelog ==
32
 
33
+ = 3.1.11 =
34
+ *Release Date - 12 May 2016*
35
+
36
+ * Fixed a bug that could cause the "Check for Spam" button to skip some comments.
37
+ * Fixed a bug that could prevent some spam submissions from being sent to Akismet.
38
+ * Updated all links to use https:// when possible.
39
+ * Disabled Akismet debug logging unless WP_DEBUG and WP_DEBUG_LOG are both enabled.
40
+
41
  = 3.1.10 =
42
  *Release Date - 1 April 2016*
43
 
views/notice.php CHANGED
@@ -44,12 +44,12 @@
44
  <?php elseif ( $type == 'missing-functions' ) :?>
45
  <div class="wrap alert critical">
46
  <h3 class="key-status failed"><?php esc_html_e('Network functions are disabled.', 'akismet'); ?></h3>
47
- <p class="description"><?php printf( __('Your web host or server administrator has disabled PHP&#8217;s <code>gethostbynamel</code> function. <strong>Akismet cannot work correctly until this is fixed.</strong> Please contact your web host or firewall administrator and give them <a href="%s" target="_blank">this information about Akismet&#8217;s system requirements</a>.', 'akismet'), 'http://blog.akismet.com/akismet-hosting-faq/'); ?></p>
48
  </div>
49
  <?php elseif ( $type == 'servers-be-down' ) :?>
50
  <div class="wrap alert critical">
51
  <h3 class="key-status failed"><?php esc_html_e("Akismet can&#8217;t connect to your site.", 'akismet'); ?></h3>
52
- <p class="description"><?php printf( __('Your firewall may be blocking Akismet. Please contact your host and refer to <a href="%s" target="_blank">our guide about firewalls</a>.', 'akismet'), 'http://blog.akismet.com/akismet-hosting-faq/'); ?></p>
53
  </div>
54
  <?php elseif ( $type == 'active-dunning' ) :?>
55
  <div class="wrap alert critical">
@@ -100,14 +100,14 @@
100
  <?php elseif ( $type == 'new-key-failed' ) :?>
101
  <div class="wrap alert critical">
102
  <h3 class="key-status"><?php esc_html_e( 'The API key you entered could not be verified.' , 'akismet'); ?></h3>
103
- <p class="description"><?php printf( __('The connection to akismet.com could not be established. Please refer to <a href="%s" target="_blank">our guide about firewalls</a> and check your server configuration.', 'akismet'), 'http://blog.akismet.com/akismet-hosting-faq/'); ?></p>
104
  </div>
105
  <?php elseif ( $type == 'limit-reached' && in_array( $level, array( 'yellow', 'red' ) ) ) :?>
106
  <div class="wrap alert critical">
107
  <?php if ( $level == 'yellow' ): ?>
108
  <h3 class="key-status failed"><?php esc_html_e( 'You&#8217;re using your Akismet key on more sites than your Pro subscription allows.', 'akismet' ); ?></h3>
109
  <p class="description">
110
- <?php printf( __( 'Your Pro subscription allows the use of Akismet on only one site. Please <a href="%s" target="_blank">purchase additional Pro subscriptions</a> or upgrade to an Enterprise subscription that allows the use of Akismet on unlimited sites.', 'akismet' ), 'http://docs.akismet.com/billing/add-more-sites/' ); ?>
111
  <br /><br />
112
  <?php printf( __( 'Please <a href="%s" target="_blank">contact our support team</a> with any questions.', 'akismet' ), 'https://akismet.com/contact/'); ?>
113
  </p>
44
  <?php elseif ( $type == 'missing-functions' ) :?>
45
  <div class="wrap alert critical">
46
  <h3 class="key-status failed"><?php esc_html_e('Network functions are disabled.', 'akismet'); ?></h3>
47
+ <p class="description"><?php printf( __('Your web host or server administrator has disabled PHP&#8217;s <code>gethostbynamel</code> function. <strong>Akismet cannot work correctly until this is fixed.</strong> Please contact your web host or firewall administrator and give them <a href="%s" target="_blank">this information about Akismet&#8217;s system requirements</a>.', 'akismet'), 'https://blog.akismet.com/akismet-hosting-faq/'); ?></p>
48
  </div>
49
  <?php elseif ( $type == 'servers-be-down' ) :?>
50
  <div class="wrap alert critical">
51
  <h3 class="key-status failed"><?php esc_html_e("Akismet can&#8217;t connect to your site.", 'akismet'); ?></h3>
52
+ <p class="description"><?php printf( __('Your firewall may be blocking Akismet. Please contact your host and refer to <a href="%s" target="_blank">our guide about firewalls</a>.', 'akismet'), 'https://blog.akismet.com/akismet-hosting-faq/'); ?></p>
53
  </div>
54
  <?php elseif ( $type == 'active-dunning' ) :?>
55
  <div class="wrap alert critical">
100
  <?php elseif ( $type == 'new-key-failed' ) :?>
101
  <div class="wrap alert critical">
102
  <h3 class="key-status"><?php esc_html_e( 'The API key you entered could not be verified.' , 'akismet'); ?></h3>
103
+ <p class="description"><?php printf( __('The connection to akismet.com could not be established. Please refer to <a href="%s" target="_blank">our guide about firewalls</a> and check your server configuration.', 'akismet'), 'https://blog.akismet.com/akismet-hosting-faq/'); ?></p>
104
  </div>
105
  <?php elseif ( $type == 'limit-reached' && in_array( $level, array( 'yellow', 'red' ) ) ) :?>
106
  <div class="wrap alert critical">
107
  <?php if ( $level == 'yellow' ): ?>
108
  <h3 class="key-status failed"><?php esc_html_e( 'You&#8217;re using your Akismet key on more sites than your Pro subscription allows.', 'akismet' ); ?></h3>
109
  <p class="description">
110
+ <?php printf( __( 'Your Pro subscription allows the use of Akismet on only one site. Please <a href="%s" target="_blank">purchase additional Pro subscriptions</a> or upgrade to an Enterprise subscription that allows the use of Akismet on unlimited sites.', 'akismet' ), 'https://docs.akismet.com/billing/add-more-sites/' ); ?>
111
  <br /><br />
112
  <?php printf( __( 'Please <a href="%s" target="_blank">contact our support team</a> with any questions.', 'akismet' ), 'https://akismet.com/contact/'); ?>
113
  </p>