Akismet Anti-Spam - Version 4.1.8

Version Description

Release Date - 6 January 2021

  • Fixed missing fields in submit-spam and submit-ham calls that could lead to reduced accuracy.
  • Fixed usage of deprecated jQuery function.
Download this release

Release Info

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

Code changes from version 4.1.7 to 4.1.8

Files changed (4) hide show
  1. _inc/akismet.js +2 -3
  2. akismet.php +2 -2
  3. class.akismet.php +22 -6
  4. readme.txt +7 -1
_inc/akismet.js CHANGED
@@ -148,7 +148,7 @@ jQuery( function ( $ ) {
148
  } );
149
  }
150
 
151
- $( '.checkforspam.enable-on-load' ).click( function( e ) {
152
  if ( $( this ).hasClass( 'ajax-disabled' ) ) {
153
  // Akismet hasn't been configured yet. Allow the user to proceed to the button's link.
154
  return;
@@ -165,8 +165,7 @@ jQuery( function ( $ ) {
165
  $('.checkforspam-spinner').addClass( 'spinner' ).addClass( 'is-active' );
166
 
167
  akismet_check_for_spam(0, 100);
168
- });
169
- $( '.checkforspam.enable-on-load' ).removeClass( 'button-disabled' );
170
 
171
  var spam_count = 0;
172
  var recheck_count = 0;
148
  } );
149
  }
150
 
151
+ $( '.checkforspam.enable-on-load' ).on( 'click', function( e ) {
152
  if ( $( this ).hasClass( 'ajax-disabled' ) ) {
153
  // Akismet hasn't been configured yet. Allow the user to proceed to the button's link.
154
  return;
165
  $('.checkforspam-spinner').addClass( 'spinner' ).addClass( 'is-active' );
166
 
167
  akismet_check_for_spam(0, 100);
168
+ }).removeClass( 'button-disabled' );
 
169
 
170
  var spam_count = 0;
171
  var recheck_count = 0;
akismet.php CHANGED
@@ -6,7 +6,7 @@
6
  Plugin Name: Akismet Anti-Spam
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: activate the Akismet plugin and then go to your Akismet Settings page to set up your API key.
9
- Version: 4.1.7
10
  Author: Automattic
11
  Author URI: https://automattic.com/wordpress-plugins/
12
  License: GPLv2 or later
@@ -37,7 +37,7 @@ if ( !function_exists( 'add_action' ) ) {
37
  exit;
38
  }
39
 
40
- define( 'AKISMET_VERSION', '4.1.7' );
41
  define( 'AKISMET__MINIMUM_WP_VERSION', '4.0' );
42
  define( 'AKISMET__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
43
  define( 'AKISMET_DELETE_LIMIT', 100000 );
6
  Plugin Name: Akismet Anti-Spam
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: activate the Akismet plugin and then go to your Akismet Settings page to set up your API key.
9
+ Version: 4.1.8
10
  Author: Automattic
11
  Author URI: https://automattic.com/wordpress-plugins/
12
  License: GPLv2 or later
37
  exit;
38
  }
39
 
40
+ define( 'AKISMET_VERSION', '4.1.8' );
41
  define( 'AKISMET__MINIMUM_WP_VERSION', '4.0' );
42
  define( 'AKISMET__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
43
  define( 'AKISMET_DELETE_LIMIT', 100000 );
class.akismet.php CHANGED
@@ -207,7 +207,15 @@ class Akismet {
207
  do_action( 'akismet_comment_check_response', $response );
208
 
209
  $commentdata['comment_as_submitted'] = array_intersect_key( $comment, self::$comment_as_submitted_allowed_keys );
210
- $commentdata['akismet_result'] = $response[1];
 
 
 
 
 
 
 
 
211
 
212
  if ( isset( $response[0]['x-akismet-pro-tip'] ) )
213
  $commentdata['akismet_pro_tip'] = $response[0]['x-akismet-pro-tip'];
@@ -1284,10 +1292,9 @@ class Akismet {
1284
  return preg_replace( '/^<script /i', '<script async="async" ', $tag );
1285
  }
1286
 
1287
- public static function inject_ak_js( $fields ) {
1288
- echo '<p style="display: none;">';
1289
  echo '<input type="hidden" id="ak_js" name="ak_js" value="' . mt_rand( 0, 250 ) . '"/>';
1290
- echo '</p>';
1291
  }
1292
 
1293
  private static function bail_on_activation( $message, $deactivate = true ) {
@@ -1470,8 +1477,17 @@ p {
1470
  $meta_value = (array) $meta_value;
1471
 
1472
  foreach ( $meta_value as $key => $value ) {
1473
- if ( ! isset( self::$comment_as_submitted_allowed_keys[$key] ) || ! is_scalar( $value ) ) {
1474
- unset( $meta_value[$key] );
 
 
 
 
 
 
 
 
 
1475
  }
1476
  }
1477
 
207
  do_action( 'akismet_comment_check_response', $response );
208
 
209
  $commentdata['comment_as_submitted'] = array_intersect_key( $comment, self::$comment_as_submitted_allowed_keys );
210
+
211
+ // Also include any form fields we inject into the comment form, like ak_js
212
+ foreach ( $_POST as $key => $value ) {
213
+ if ( is_string( $value ) && strpos( $key, 'ak_' ) === 0 ) {
214
+ $commentdata['comment_as_submitted'][ 'POST_' . $key ] = $value;
215
+ }
216
+ }
217
+
218
+ $commentdata['akismet_result'] = $response[1];
219
 
220
  if ( isset( $response[0]['x-akismet-pro-tip'] ) )
221
  $commentdata['akismet_pro_tip'] = $response[0]['x-akismet-pro-tip'];
1292
  return preg_replace( '/^<script /i', '<script async="async" ', $tag );
1293
  }
1294
 
1295
+ public static function inject_ak_js( $post_id ) {
 
1296
  echo '<input type="hidden" id="ak_js" name="ak_js" value="' . mt_rand( 0, 250 ) . '"/>';
1297
+ echo '<textarea name="ak_hp_textarea" cols="45" rows="8" maxlength="100" style="display: none !important;"></textarea>';
1298
  }
1299
 
1300
  private static function bail_on_activation( $message, $deactivate = true ) {
1477
  $meta_value = (array) $meta_value;
1478
 
1479
  foreach ( $meta_value as $key => $value ) {
1480
+ if ( ! is_scalar( $value ) ) {
1481
+ unset( $meta_value[ $key ] );
1482
+ } else {
1483
+ // These can change, so they're not explicitly listed in comment_as_submitted_allowed_keys.
1484
+ if ( strpos( $key, 'POST_ak_' ) === 0 ) {
1485
+ continue;
1486
+ }
1487
+
1488
+ if ( ! isset( self::$comment_as_submitted_allowed_keys[ $key ] ) ) {
1489
+ unset( $meta_value[ $key ] );
1490
+ }
1491
  }
1492
  }
1493
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: matt, ryan, andy, mdawaffe, tellyworth, josephscott, lessbloat, eo
3
  Tags: comments, spam, antispam, anti-spam, contact form, anti spam, comment moderation, comment spam, contact form spam, spam comments
4
  Requires at least: 4.6
5
  Tested up to: 5.6
6
- Stable tag: 4.1.7
7
  License: GPLv2 or later
8
 
9
  The best anti-spam protection to block spam comments and spam in a contact form. The most trusted antispam solution for WordPress and WooCommerce.
@@ -30,6 +30,12 @@ Upload the Akismet plugin to your blog, activate it, and then enter your Akismet
30
 
31
  == Changelog ==
32
 
 
 
 
 
 
 
33
  = 4.1.7 =
34
  *Release Date - 22 October 2020*
35
 
3
  Tags: comments, spam, antispam, anti-spam, contact form, anti spam, comment moderation, comment spam, contact form spam, spam comments
4
  Requires at least: 4.6
5
  Tested up to: 5.6
6
+ Stable tag: 4.1.8
7
  License: GPLv2 or later
8
 
9
  The best anti-spam protection to block spam comments and spam in a contact form. The most trusted antispam solution for WordPress and WooCommerce.
30
 
31
  == Changelog ==
32
 
33
+ = 4.1.8 =
34
+ *Release Date - 6 January 2021*
35
+
36
+ * Fixed missing fields in submit-spam and submit-ham calls that could lead to reduced accuracy.
37
+ * Fixed usage of deprecated jQuery function.
38
+
39
  = 4.1.7 =
40
  *Release Date - 22 October 2020*
41