Akismet Anti-Spam - Version 3.1.3

Version Description

Release Date - 6 July 2015

  • Notify users when their account status changes after previously being successfully set up. This should help any users who are seeing blank Akismet settings screens.
Download this release

Release Info

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

Code changes from version 3.1.2 to 3.1.3

Files changed (5) hide show
  1. akismet.php +2 -2
  2. class.akismet-admin.php +19 -8
  3. readme.txt +7 -2
  4. views/notice.php +4 -0
  5. views/start.php +1 -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.1.2
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.1.2' );
39
  define( 'AKISMET__MINIMUM_WP_VERSION', '3.2' );
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.1.3
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.1.3' );
39
  define( 'AKISMET__MINIMUM_WP_VERSION', '3.2' );
40
  define( 'AKISMET__PLUGIN_URL', plugin_dir_url( __FILE__ ) );
41
  define( 'AKISMET__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
class.akismet-admin.php CHANGED
@@ -712,13 +712,16 @@ class Akismet_Admin {
712
  }
713
 
714
  public static function get_akismet_user( $api_key ) {
715
- $akismet_user = Akismet::http_post( Akismet::build_query( array( 'key' => $api_key, 'blog' => get_bloginfo( 'url' ) ) ), 'get-subscription' );
 
 
 
 
 
 
 
 
716
 
717
- if ( ! empty( $akismet_user[1] ) )
718
- $akismet_user = json_decode( $akismet_user[1] );
719
- else
720
- $akismet_user = false;
721
-
722
  return $akismet_user;
723
  }
724
 
@@ -809,7 +812,7 @@ class Akismet_Admin {
809
  }
810
  }
811
 
812
- if ( $api_key = Akismet::get_api_key() ) {
813
  self::display_configuration_page();
814
  return;
815
  }
@@ -850,8 +853,16 @@ class Akismet_Admin {
850
  public static function display_configuration_page() {
851
  $api_key = Akismet::get_api_key();
852
  $akismet_user = self::get_akismet_user( $api_key );
853
- $stat_totals = self::get_stats( $api_key );
854
 
 
 
 
 
 
 
 
 
 
855
  // If unset, create the new strictness option using the old discard option to determine its default
856
  if ( get_option( 'akismet_strictness' ) === false )
857
  add_option( 'akismet_strictness', (get_option('akismet_discard_month') === 'true' ? '1' : '0') );
712
  }
713
 
714
  public static function get_akismet_user( $api_key ) {
715
+ $akismet_user = false;
716
+
717
+ $subscription_verification = Akismet::http_post( Akismet::build_query( array( 'key' => $api_key, 'blog' => get_bloginfo( 'url' ) ) ), 'get-subscription' );
718
+
719
+ if ( ! empty( $subscription_verification[1] ) ) {
720
+ if ( 'invalid' !== $subscription_verification[1] ) {
721
+ $akismet_user = json_decode( $subscription_verification[1] );
722
+ }
723
+ }
724
 
 
 
 
 
 
725
  return $akismet_user;
726
  }
727
 
812
  }
813
  }
814
 
815
+ if ( $api_key = Akismet::get_api_key() && ( empty( self::$notices['status'] ) || 'existing-key-invalid' != self::$notices['status'] ) ) {
816
  self::display_configuration_page();
817
  return;
818
  }
853
  public static function display_configuration_page() {
854
  $api_key = Akismet::get_api_key();
855
  $akismet_user = self::get_akismet_user( $api_key );
 
856
 
857
+ if ( ! $akismet_user ) {
858
+ // This could happen if the user's key became invalid after it was previously valid and successfully set up.
859
+ self::$notices['status'] = 'existing-key-invalid';
860
+ self::display_start_page();
861
+ return;
862
+ }
863
+
864
+ $stat_totals = self::get_stats( $api_key );
865
+
866
  // If unset, create the new strictness option using the old discard option to determine its default
867
  if ( get_option( 'akismet_strictness' ) === false )
868
  add_option( 'akismet_strictness', (get_option('akismet_discard_month') === 'true' ? '1' : '0') );
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.2.2
6
- Stable tag: 3.1.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,6 +30,11 @@ Upload the Akismet plugin to your blog, Activate it, then enter your [Akismet.co
30
 
31
  == Changelog ==
32
 
 
 
 
 
 
33
  = 3.1.2 =
34
  *Release Date - 7 June 2015*
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.3
6
+ Stable tag: 3.1.3
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.1.3 =
34
+ *Release Date - 6 July 2015*
35
+
36
+ * Notify users when their account status changes after previously being successfully set up. This should help any users who are seeing blank Akismet settings screens.
37
+
38
  = 3.1.2 =
39
  *Release Date - 7 June 2015*
40
 
views/notice.php CHANGED
@@ -89,6 +89,10 @@
89
  <div class="wrap alert critical">
90
  <h3 class="key-status"><?php esc_html_e( 'The key you entered is invalid. Please double-check it.' , 'akismet'); ?></h3>
91
  </div>
 
 
 
 
92
  <?php elseif ( $type == 'new-key-failed' ) :?>
93
  <div class="wrap alert critical">
94
  <h3 class="key-status"><?php esc_html_e( 'The key you entered could not be verified.' , 'akismet'); ?></h3>
89
  <div class="wrap alert critical">
90
  <h3 class="key-status"><?php esc_html_e( 'The key you entered is invalid. Please double-check it.' , 'akismet'); ?></h3>
91
  </div>
92
+ <?php elseif ( $type == 'existing-key-invalid' ) :?>
93
+ <div class="wrap alert critical">
94
+ <h3 class="key-status"><?php esc_html_e( 'Your API key is no longer valid. Please enter a new key or contact support@akismet.com.' , 'akismet'); ?></h3>
95
+ </div>
96
  <?php elseif ( $type == 'new-key-failed' ) :?>
97
  <div class="wrap alert critical">
98
  <h3 class="key-status"><?php esc_html_e( 'The key you entered could not be verified.' , 'akismet'); ?></h3>
views/start.php CHANGED
@@ -85,7 +85,7 @@
85
  <p><?php esc_html_e('If you already know your API key.', 'akismet'); ?></p>
86
  </div>
87
  <form action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="post" id="akismet-enter-api-key" class="right">
88
- <input id="key" name="key" type="text" size="15" value="" class="regular-text code">
89
  <input type="hidden" name="action" value="enter-key">
90
  <?php wp_nonce_field( Akismet_Admin::NONCE ); ?>
91
  <input type="submit" name="submit" id="submit" class="button button-secondary" value="<?php esc_attr_e('Use this key', 'akismet');?>">
85
  <p><?php esc_html_e('If you already know your API key.', 'akismet'); ?></p>
86
  </div>
87
  <form action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="post" id="akismet-enter-api-key" class="right">
88
+ <input id="key" name="key" type="text" size="15" value="<?php echo esc_attr( Akismet::get_api_key() ); ?>" class="regular-text code">
89
  <input type="hidden" name="action" value="enter-key">
90
  <?php wp_nonce_field( Akismet_Admin::NONCE ); ?>
91
  <input type="submit" name="submit" id="submit" class="button button-secondary" value="<?php esc_attr_e('Use this key', 'akismet');?>">