Akismet Anti-Spam - Version 3.0.2

Version Description

  • Performance improvements.
  • Fixed a bug that could truncate the comment data being sent to Akismet for checking.
Download this release

Release Info

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

Code changes from version 3.0.1 to 3.0.2

Files changed (5) hide show
  1. akismet.php +2 -2
  2. class.akismet-admin.php +8 -7
  3. class.akismet.php +15 -5
  4. readme.txt +6 -2
  5. views/notice.php +7 -1
akismet.php CHANGED
@@ -6,7 +6,7 @@
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 comment and trackback spam</strong>. It keeps your site protected from spam 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 API key</a>, and 3) Go to your Akismet configuration page, and save your API key.
9
- Version: 3.0.1
10
  Author: Automattic
11
  Author URI: http://automattic.com/wordpress-plugins/
12
  License: GPLv2 or later
@@ -35,7 +35,7 @@ if ( !function_exists( 'add_action' ) ) {
35
  exit;
36
  }
37
 
38
- define( 'AKISMET_VERSION', '3.0.1' );
39
  define( 'AKISMET__MINIMUM_WP_VERSION', '3.1' );
40
  define( 'AKISMET__PLUGIN_URL', plugin_dir_url( __FILE__ ) );
41
  define( 'AKISMET__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
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 comment and trackback spam</strong>. It keeps your site protected from spam 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 API key</a>, and 3) Go to your Akismet configuration page, and save your API key.
9
+ Version: 3.0.2
10
  Author: Automattic
11
  Author URI: http://automattic.com/wordpress-plugins/
12
  License: GPLv2 or later
35
  exit;
36
  }
37
 
38
+ define( 'AKISMET_VERSION', '3.0.2' );
39
  define( 'AKISMET__MINIMUM_WP_VERSION', '3.1' );
40
  define( 'AKISMET__PLUGIN_URL', plugin_dir_url( __FILE__ ) );
41
  define( 'AKISMET__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
class.akismet-admin.php CHANGED
@@ -367,7 +367,8 @@ class Akismet_Admin {
367
 
368
  add_comment_meta( $c['comment_ID'], 'akismet_rechecking', true );
369
 
370
- $response = Akismet::http_post( build_query( $c ), 'comment-check' );
 
371
  if ( 'true' == $response[1] ) {
372
  wp_set_comment_status( $c['comment_ID'], 'spam' );
373
  update_comment_meta( $c['comment_ID'], 'akismet_result', 'true' );
@@ -625,7 +626,7 @@ class Akismet_Admin {
625
  }
626
 
627
  public static function get_akismet_user( $api_key ) {
628
- $akismet_user = Akismet::http_post( build_query( array( 'key' => $api_key ) ), 'get-subscription' );
629
 
630
  if ( ! empty( $akismet_user[1] ) )
631
  $akismet_user = json_decode( $akismet_user[1] );
@@ -639,7 +640,7 @@ class Akismet_Admin {
639
  $stat_totals = array();
640
 
641
  foreach( array( '6-months', 'all' ) as $interval ) {
642
- $response = Akismet::http_post( build_query( array( 'blog' => urlencode( get_bloginfo('url') ), 'key' => $api_key, 'from' => $interval ) ), 'get-stats' );
643
 
644
  if ( ! empty( $response[1] ) ) {
645
  $stat_totals[$interval] = json_decode( $response[1] );
@@ -649,7 +650,7 @@ class Akismet_Admin {
649
  }
650
 
651
  public static function verify_wpcom_key( $api_key, $user_id, $token = '' ) {
652
- $akismet_account = Akismet::http_post( build_query( array(
653
  'user_id' => $user_id,
654
  'api_key' => $api_key,
655
  'token' => $token,
@@ -674,11 +675,11 @@ class Akismet_Admin {
674
 
675
  public static function display_spam_check_warning() {
676
  Akismet::fix_scheduled_recheck();
677
-
678
- $link_text = apply_filters( 'akismet_spam_check_warning_link_text', sprintf( __( 'Please check your <a href="%s">Akismet configuration</a> and contact your web host if problems persist.', 'akismet'), esc_url( self::get_page_url() ) ) );
679
 
680
- if ( self::get_number_spam_waiting() > 0 && wp_next_scheduled('akismet_schedule_cron_recheck') > time() )
 
681
  Akismet::view( 'notice', array( 'type' => 'spam-check', 'link_text' => $link_text ) );
 
682
  }
683
 
684
  public static function display_invalid_version() {
367
 
368
  add_comment_meta( $c['comment_ID'], 'akismet_rechecking', true );
369
 
370
+ $response = Akismet::http_post( Akismet::build_query( $c ), 'comment-check' );
371
+
372
  if ( 'true' == $response[1] ) {
373
  wp_set_comment_status( $c['comment_ID'], 'spam' );
374
  update_comment_meta( $c['comment_ID'], 'akismet_result', 'true' );
626
  }
627
 
628
  public static function get_akismet_user( $api_key ) {
629
+ $akismet_user = Akismet::http_post( Akismet::build_query( array( 'key' => $api_key ) ), 'get-subscription' );
630
 
631
  if ( ! empty( $akismet_user[1] ) )
632
  $akismet_user = json_decode( $akismet_user[1] );
640
  $stat_totals = array();
641
 
642
  foreach( array( '6-months', 'all' ) as $interval ) {
643
+ $response = Akismet::http_post( Akismet::build_query( array( 'blog' => urlencode( get_bloginfo('url') ), 'key' => $api_key, 'from' => $interval ) ), 'get-stats' );
644
 
645
  if ( ! empty( $response[1] ) ) {
646
  $stat_totals[$interval] = json_decode( $response[1] );
650
  }
651
 
652
  public static function verify_wpcom_key( $api_key, $user_id, $token = '' ) {
653
+ $akismet_account = Akismet::http_post( Akismet::build_query( array(
654
  'user_id' => $user_id,
655
  'api_key' => $api_key,
656
  'token' => $token,
675
 
676
  public static function display_spam_check_warning() {
677
  Akismet::fix_scheduled_recheck();
 
 
678
 
679
+ if ( wp_next_scheduled('akismet_schedule_cron_recheck') > time() && self::get_number_spam_waiting() > 0 ) {
680
+ $link_text = apply_filters( 'akismet_spam_check_warning_link_text', sprintf( __( 'Please check your <a href="%s">Akismet configuration</a> and contact your web host if problems persist.', 'akismet'), esc_url( self::get_page_url() ) ) );
681
  Akismet::view( 'notice', array( 'type' => 'spam-check', 'link_text' => $link_text ) );
682
+ }
683
  }
684
 
685
  public static function display_invalid_version() {
class.akismet.php CHANGED
@@ -54,7 +54,7 @@ class Akismet {
54
  }
55
 
56
  public static function check_key_status( $key, $ip = null ) {
57
- return self::http_post( build_query( array( 'key' => $key, 'blog' => get_option('home') ) ), 'verify-key', $ip );
58
  }
59
 
60
  public static function verify_key( $key, $ip = null ) {
@@ -117,7 +117,7 @@ class Akismet {
117
  $post = get_post( $comment['comment_post_ID'] );
118
  $comment[ 'comment_post_modified_gmt' ] = $post->post_modified_gmt;
119
 
120
- $response = self::http_post( build_query( $comment ), 'comment-check' );
121
 
122
  do_action( 'akismet_comment_check_response', $response );
123
 
@@ -370,7 +370,7 @@ class Akismet {
370
  if ( self::is_test_mode() )
371
  $c['is_test'] = 'true';
372
 
373
- $response = self::http_post( build_query( $c ), 'comment-check' );
374
 
375
  return ( is_array( $response ) && ! empty( $response[1] ) ) ? $response[1] : false;
376
  }
@@ -464,7 +464,7 @@ class Akismet {
464
  $post = get_post( $comment->comment_post_ID );
465
  $comment->comment_post_modified_gmt = $post->post_modified_gmt;
466
 
467
- $response = Akismet::http_post( build_query( $comment ), 'submit-spam' );
468
  if ( $comment->reporter ) {
469
  self::update_comment_history( $comment_id, sprintf( __('%s reported this comment as spam', 'akismet'), $comment->reporter ), 'report-spam' );
470
  update_comment_meta( $comment_id, 'akismet_user_result', 'true' );
@@ -510,7 +510,7 @@ class Akismet {
510
  $post = get_post( $comment->comment_post_ID );
511
  $comment->comment_post_modified_gmt = $post->post_modified_gmt;
512
 
513
- $response = self::http_post( build_query( $comment ), 'submit-ham' );
514
  if ( $comment->reporter ) {
515
  self::update_comment_history( $comment_id, sprintf( __('%s reported this comment as not spam', 'akismet'), $comment->reporter ), 'report-ham' );
516
  update_comment_meta( $comment_id, 'akismet_user_result', 'false' );
@@ -915,6 +915,16 @@ p {
915
  public static function plugin_deactivation( ) {
916
  //tidy up
917
  }
 
 
 
 
 
 
 
 
 
 
918
 
919
  public static function log( $akismet_debug ) {
920
  if ( defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG )
54
  }
55
 
56
  public static function check_key_status( $key, $ip = null ) {
57
+ return self::http_post( Akismet::build_query( array( 'key' => $key, 'blog' => get_option('home') ) ), 'verify-key', $ip );
58
  }
59
 
60
  public static function verify_key( $key, $ip = null ) {
117
  $post = get_post( $comment['comment_post_ID'] );
118
  $comment[ 'comment_post_modified_gmt' ] = $post->post_modified_gmt;
119
 
120
+ $response = self::http_post( Akismet::build_query( $comment ), 'comment-check' );
121
 
122
  do_action( 'akismet_comment_check_response', $response );
123
 
370
  if ( self::is_test_mode() )
371
  $c['is_test'] = 'true';
372
 
373
+ $response = self::http_post( Akismet::build_query( $c ), 'comment-check' );
374
 
375
  return ( is_array( $response ) && ! empty( $response[1] ) ) ? $response[1] : false;
376
  }
464
  $post = get_post( $comment->comment_post_ID );
465
  $comment->comment_post_modified_gmt = $post->post_modified_gmt;
466
 
467
+ $response = Akismet::http_post( Akismet::build_query( $comment ), 'submit-spam' );
468
  if ( $comment->reporter ) {
469
  self::update_comment_history( $comment_id, sprintf( __('%s reported this comment as spam', 'akismet'), $comment->reporter ), 'report-spam' );
470
  update_comment_meta( $comment_id, 'akismet_user_result', 'true' );
510
  $post = get_post( $comment->comment_post_ID );
511
  $comment->comment_post_modified_gmt = $post->post_modified_gmt;
512
 
513
+ $response = self::http_post( Akismet::build_query( $comment ), 'submit-ham' );
514
  if ( $comment->reporter ) {
515
  self::update_comment_history( $comment_id, sprintf( __('%s reported this comment as not spam', 'akismet'), $comment->reporter ), 'report-ham' );
516
  update_comment_meta( $comment_id, 'akismet_user_result', 'false' );
915
  public static function plugin_deactivation( ) {
916
  //tidy up
917
  }
918
+
919
+ /**
920
+ * Essentially a copy of WP's build_query but one that doesn't expect pre-urlencoded values.
921
+ *
922
+ * @param array $args An array of key => value pairs
923
+ * @return string A string ready for use as a URL query string.
924
+ */
925
+ public static function build_query( $args ) {
926
+ return _http_build_query( $args, '', '&' );
927
+ }
928
 
929
  public static function log( $akismet_debug ) {
930
  if ( defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG )
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: matt, ryan, andy, mdawaffe, tellyworth, josephscott, lessbloat, eoigal, cfinke, automattic
3
  Tags: akismet, comments, spam
4
  Requires at least: 3.1
5
- Tested up to: 3.9.1
6
- Stable tag: 3.0.1
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.
@@ -30,6 +30,10 @@ Upload the Akismet plugin to your blog, Activate it, then enter your [Akismet.co
30
 
31
  == Changelog ==
32
 
 
 
 
 
33
  = 3.0.1 =
34
  * Removed dependency on PHP's fsockopen function
35
  * Fix spam/ham reports to work when reported outside of the WP dashboard, e.g., from Notifications or the WP app
2
  Contributors: matt, ryan, andy, mdawaffe, tellyworth, josephscott, lessbloat, eoigal, cfinke, automattic
3
  Tags: akismet, comments, spam
4
  Requires at least: 3.1
5
+ Tested up to: 4.0
6
+ Stable tag: 3.0.2
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.
30
 
31
  == Changelog ==
32
 
33
+ = 3.0.2 =
34
+ * Performance improvements.
35
+ * Fixed a bug that could truncate the comment data being sent to Akismet for checking.
36
+
37
  = 3.0.1 =
38
  * Removed dependency on PHP's fsockopen function
39
  * Fix spam/ham reports to work when reported outside of the WP dashboard, e.g., from Notifications or the WP app
views/notice.php CHANGED
@@ -16,7 +16,13 @@
16
  </form>
17
  </div>
18
  <?php elseif ( $type == 'spam-check' ) :?>
19
- <div id="akismet-warning" class="updated fade"><p><strong><?php esc_html_e('Akismet has detected a problem.', 'akismet');?></strong> <?php printf( __('Some comments have not yet been checked for spam by Akismet. They have been temporarily held for moderation. Please check your <a href="%s">Akismet configuration</a> and contact your web host if problems persist.', 'akismet'), esc_url( Akismet_Admin::get_page_url() ) );?></p></div>
 
 
 
 
 
 
20
  <?php elseif ( $type == 'version' ) :?>
21
  <div id="akismet-warning" class="updated fade"><p><strong><?php printf( esc_html__('Akismet %s requires WordPress 3.0 or higher.', 'akismet'), AKISMET_VERSION);?></strong> <?php printf(__('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/');?></p></div>
22
  <?php elseif ( $type == 'alert' ) :?>
16
  </form>
17
  </div>
18
  <?php elseif ( $type == 'spam-check' ) :?>
19
+ <div id="akismet-warning" class="updated fade">
20
+ <p><strong><?php esc_html_e( 'Akismet has detected a problem.', 'akismet' );?></strong></p>
21
+ <p><?php printf( __( 'Some comments have not yet been checked for spam by Akismet. They have been temporarily held for moderation and will automatically be rechecked later.', 'akismet' ) ); ?></p>
22
+ <?php if ( $link_text ) { ?>
23
+ <p><?php echo $link_text; ?></p>
24
+ <?php } ?>
25
+ </div>
26
  <?php elseif ( $type == 'version' ) :?>
27
  <div id="akismet-warning" class="updated fade"><p><strong><?php printf( esc_html__('Akismet %s requires WordPress 3.0 or higher.', 'akismet'), AKISMET_VERSION);?></strong> <?php printf(__('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/');?></p></div>
28
  <?php elseif ( $type == 'alert' ) :?>