Akismet Anti-Spam - Version 3.3.3

Version Description

Release Date - 13 July 2017

  • Reduced amount of bandwidth used by the URL Preview feature.
  • Improved the admin UI when the API key is manually pre-defined for the site.
  • Removed a workaround for WordPress installations older than 3.3 that will improve Akismet's compatibility with other plugins.
  • The number of spam blocked that is displayed on the WordPress dashboard will now be more accurate and updated more frequently.
  • Fixed a bug in the Akismet widget that could cause PHP warnings.
Download this release

Release Info

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

Code changes from version 3.3.2 to 3.3.3

_inc/akismet.js CHANGED
@@ -101,7 +101,7 @@ jQuery( function ( $ ) {
101
 
102
  var thisHref = encodeURIComponent( $( this ).attr( 'href' ) );
103
 
104
- var mShot = $( '<div class="akismet-mshot mshot-container"><div class="mshot-arrow"></div><img src="//s0.wordpress.com/mshots/v1/' + thisHref + '?w=450" width="450" height="338" class="mshot-image" /></div>' );
105
  mShot.data( 'link', this );
106
 
107
  var offset = $( this ).offset();
@@ -111,12 +111,15 @@ jQuery( function ( $ ) {
111
  top: offset.top + ( $( this ).height() / 2 ) - 101 // 101 = top offset of the arrow plus the top border thickness
112
  } );
113
 
 
 
 
114
  mshotSecondTryTimer = setTimeout( function () {
115
- mShot.find( '.mshot-image' ).attr( 'src', '//s0.wordpress.com/mshots/v1/'+thisHref+'?w=450&r=2' );
116
  }, 6000 );
117
 
118
  mshotThirdTryTimer = setTimeout( function () {
119
- mShot.find( '.mshot-image' ).attr( 'src', '//s0.wordpress.com/mshots/v1/'+thisHref+'?w=450&r=3' );
120
  }, 12000 );
121
 
122
  $( 'body' ).append( mShot );
101
 
102
  var thisHref = encodeURIComponent( $( this ).attr( 'href' ) );
103
 
104
+ var mShot = $( '<div class="akismet-mshot mshot-container"><div class="mshot-arrow"></div><img src="//s0.wordpress.com/mshots/v1/' + thisHref + '?w=900" width="450" height="338" class="mshot-image" /></div>' );
105
  mShot.data( 'link', this );
106
 
107
  var offset = $( this ).offset();
111
  top: offset.top + ( $( this ).height() / 2 ) - 101 // 101 = top offset of the arrow plus the top border thickness
112
  } );
113
 
114
+ // These retries appear to be superfluous if .mshot-image has already loaded, but it's because mShots
115
+ // can return a "Generating thumbnail..." image if it doesn't have a thumbnail ready, so we need
116
+ // to retry to see if we can get the newly generated thumbnail.
117
  mshotSecondTryTimer = setTimeout( function () {
118
+ mShot.find( '.mshot-image' ).attr( 'src', '//s0.wordpress.com/mshots/v1/'+thisHref+'?w=900&r=2' );
119
  }, 6000 );
120
 
121
  mshotThirdTryTimer = setTimeout( function () {
122
+ mShot.find( '.mshot-image' ).attr( 'src', '//s0.wordpress.com/mshots/v1/'+thisHref+'?w=900&r=3' );
123
  }, 12000 );
124
 
125
  $( 'body' ).append( mShot );
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: 3.3.2
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', '3.3.2' );
41
  define( 'AKISMET__MINIMUM_WP_VERSION', '3.7' );
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: 3.3.3
10
  Author: Automattic
11
  Author URI: https://automattic.com/wordpress-plugins/
12
  License: GPLv2 or later
37
  exit;
38
  }
39
 
40
+ define( 'AKISMET_VERSION', '3.3.3' );
41
  define( 'AKISMET__MINIMUM_WP_VERSION', '3.7' );
42
  define( 'AKISMET__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
43
  define( 'AKISMET_DELETE_LIMIT', 100000 );
class.akismet-admin.php CHANGED
@@ -208,7 +208,7 @@ class Akismet_Admin {
208
  'content' =>
209
  '<p><strong>' . esc_html__( 'Akismet Configuration' , 'akismet') . '</strong></p>' .
210
  '<p>' . esc_html__( 'Akismet filters out spam, so you can focus on more important things.' , 'akismet') . '</p>' .
211
- '<p>' . esc_html__( 'On this page, you are able to enter/remove an API key, view account information and view spam stats.' , 'akismet') . '</p>',
212
  )
213
  );
214
 
@@ -218,22 +218,24 @@ class Akismet_Admin {
218
  'title' => __( 'Settings' , 'akismet'),
219
  'content' =>
220
  '<p><strong>' . esc_html__( 'Akismet Configuration' , 'akismet') . '</strong></p>' .
221
- '<p><strong>' . esc_html__( 'API Key' , 'akismet') . '</strong> - ' . esc_html__( 'Enter/remove an API key.' , 'akismet') . '</p>' .
222
  '<p><strong>' . esc_html__( 'Comments' , 'akismet') . '</strong> - ' . esc_html__( 'Show the number of approved comments beside each comment author in the comments list page.' , 'akismet') . '</p>' .
223
  '<p><strong>' . esc_html__( 'Strictness' , 'akismet') . '</strong> - ' . esc_html__( 'Choose to either discard the worst spam automatically or to always put all spam in spam folder.' , 'akismet') . '</p>',
224
  )
225
  );
226
 
227
- $current_screen->add_help_tab(
228
- array(
229
- 'id' => 'account',
230
- 'title' => __( 'Account' , 'akismet'),
231
- 'content' =>
232
- '<p><strong>' . esc_html__( 'Akismet Configuration' , 'akismet') . '</strong></p>' .
233
- '<p><strong>' . esc_html__( 'Subscription Type' , 'akismet') . '</strong> - ' . esc_html__( 'The Akismet subscription plan' , 'akismet') . '</p>' .
234
- '<p><strong>' . esc_html__( 'Status' , 'akismet') . '</strong> - ' . esc_html__( 'The subscription status - active, cancelled or suspended' , 'akismet') . '</p>',
235
- )
236
- );
 
 
237
  }
238
  }
239
 
@@ -255,10 +257,11 @@ class Akismet_Admin {
255
  foreach( array( 'akismet_strictness', 'akismet_show_user_comments_approved' ) as $option ) {
256
  update_option( $option, isset( $_POST[$option] ) && (int) $_POST[$option] == 1 ? '1' : '0' );
257
  }
258
-
259
- if ( defined( 'WPCOM_API_KEY' ) )
260
  return false; //shouldn't have option to save key if already defined
261
-
 
262
  $new_key = preg_replace( '/[^a-f0-9]/i', '', $_POST['key'] );
263
  $old_key = Akismet::get_api_key();
264
 
@@ -907,6 +910,11 @@ class Akismet_Admin {
907
  if ( get_option( 'akismet_strictness' ) === false ) {
908
  add_option( 'akismet_strictness', ( get_option( 'akismet_discard_month' ) === 'false' ? '0' : '1' ) );
909
  }
 
 
 
 
 
910
 
911
  $notices = array();
912
 
208
  'content' =>
209
  '<p><strong>' . esc_html__( 'Akismet Configuration' , 'akismet') . '</strong></p>' .
210
  '<p>' . esc_html__( 'Akismet filters out spam, so you can focus on more important things.' , 'akismet') . '</p>' .
211
+ '<p>' . esc_html__( 'On this page, you are able to update your Akismet settings and view spam stats.' , 'akismet') . '</p>',
212
  )
213
  );
214
 
218
  'title' => __( 'Settings' , 'akismet'),
219
  'content' =>
220
  '<p><strong>' . esc_html__( 'Akismet Configuration' , 'akismet') . '</strong></p>' .
221
+ ( Akismet::predefined_api_key() ? '' : '<p><strong>' . esc_html__( 'API Key' , 'akismet') . '</strong> - ' . esc_html__( 'Enter/remove an API key.' , 'akismet') . '</p>' ) .
222
  '<p><strong>' . esc_html__( 'Comments' , 'akismet') . '</strong> - ' . esc_html__( 'Show the number of approved comments beside each comment author in the comments list page.' , 'akismet') . '</p>' .
223
  '<p><strong>' . esc_html__( 'Strictness' , 'akismet') . '</strong> - ' . esc_html__( 'Choose to either discard the worst spam automatically or to always put all spam in spam folder.' , 'akismet') . '</p>',
224
  )
225
  );
226
 
227
+ if ( ! Akismet::predefined_api_key() ) {
228
+ $current_screen->add_help_tab(
229
+ array(
230
+ 'id' => 'account',
231
+ 'title' => __( 'Account' , 'akismet'),
232
+ 'content' =>
233
+ '<p><strong>' . esc_html__( 'Akismet Configuration' , 'akismet') . '</strong></p>' .
234
+ '<p><strong>' . esc_html__( 'Subscription Type' , 'akismet') . '</strong> - ' . esc_html__( 'The Akismet subscription plan' , 'akismet') . '</p>' .
235
+ '<p><strong>' . esc_html__( 'Status' , 'akismet') . '</strong> - ' . esc_html__( 'The subscription status - active, cancelled or suspended' , 'akismet') . '</p>',
236
+ )
237
+ );
238
+ }
239
  }
240
  }
241
 
257
  foreach( array( 'akismet_strictness', 'akismet_show_user_comments_approved' ) as $option ) {
258
  update_option( $option, isset( $_POST[$option] ) && (int) $_POST[$option] == 1 ? '1' : '0' );
259
  }
260
+
261
+ if ( Akismet::predefined_api_key() ) {
262
  return false; //shouldn't have option to save key if already defined
263
+ }
264
+
265
  $new_key = preg_replace( '/[^a-f0-9]/i', '', $_POST['key'] );
266
  $old_key = Akismet::get_api_key();
267
 
910
  if ( get_option( 'akismet_strictness' ) === false ) {
911
  add_option( 'akismet_strictness', ( get_option( 'akismet_discard_month' ) === 'false' ? '0' : '1' ) );
912
  }
913
+
914
+ // Sync the local "Total spam blocked" count with the authoritative count from the server.
915
+ if ( isset( $stat_totals['all'], $stat_totals['all']->spam ) ) {
916
+ update_option( 'akismet_spam_count', $stat_totals['all']->spam );
917
+ }
918
 
919
  $notices = array();
920
 
class.akismet-widget.php CHANGED
@@ -62,7 +62,7 @@ class Akismet_Widget extends WP_Widget {
62
  }
63
 
64
  function form( $instance ) {
65
- if ( $instance ) {
66
  $title = $instance['title'];
67
  }
68
  else {
62
  }
63
 
64
  function form( $instance ) {
65
+ if ( $instance && isset( $instance['title'] ) ) {
66
  $title = $instance['title'];
67
  }
68
  else {
class.akismet.php CHANGED
@@ -1091,17 +1091,10 @@ class Akismet {
1091
  }
1092
 
1093
  public static function load_form_js() {
1094
- // WP < 3.3 can't enqueue a script this late in the game and still have it appear in the footer.
1095
- // Once we drop support for everything pre-3.3, this can change back to a single enqueue call.
1096
  wp_register_script( 'akismet-form', plugin_dir_url( __FILE__ ) . '_inc/form.js', array(), AKISMET_VERSION, true );
1097
- add_action( 'wp_footer', array( 'Akismet', 'print_form_js' ) );
1098
- add_action( 'admin_footer', array( 'Akismet', 'print_form_js' ) );
1099
  }
1100
 
1101
- public static function print_form_js() {
1102
- wp_print_scripts( 'akismet-form' );
1103
- }
1104
-
1105
  public static function inject_ak_js( $fields ) {
1106
  echo '<p style="display: none;">';
1107
  echo '<input type="hidden" id="ak_js" name="ak_js" value="' . mt_rand( 0, 250 ) . '"/>';
@@ -1292,4 +1285,12 @@ p {
1292
 
1293
  return $meta_value;
1294
  }
 
 
 
 
 
 
 
 
1295
  }
1091
  }
1092
 
1093
  public static function load_form_js() {
 
 
1094
  wp_register_script( 'akismet-form', plugin_dir_url( __FILE__ ) . '_inc/form.js', array(), AKISMET_VERSION, true );
1095
+ wp_enqueue_script( 'akismet-form' );
 
1096
  }
1097
 
 
 
 
 
1098
  public static function inject_ak_js( $fields ) {
1099
  echo '<p style="display: none;">';
1100
  echo '<input type="hidden" id="ak_js" name="ak_js" value="' . mt_rand( 0, 250 ) . '"/>';
1285
 
1286
  return $meta_value;
1287
  }
1288
+
1289
+ public static function predefined_api_key() {
1290
+ if ( defined( 'WPCOM_API_KEY' ) ) {
1291
+ return true;
1292
+ }
1293
+
1294
+ return apply_filters( 'akismet_predefined_api_key', false );
1295
+ }
1296
  }
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: matt, ryan, andy, mdawaffe, tellyworth, josephscott, lessbloat, eo
3
  Tags: akismet, comments, spam, antispam, anti-spam, anti spam, comment moderation, comment spam, contact form spam, spam comments
4
  Requires at least: 3.7
5
  Tested up to: 4.8
6
- Stable tag: 3.3.2
7
  License: GPLv2 or later
8
 
9
  Akismet checks your comments and contact form submissions against our global database of spam to protect you and your site from malicious content.
@@ -30,6 +30,15 @@ Upload the Akismet plugin to your blog, Activate it, then enter your [Akismet.co
30
 
31
  == Changelog ==
32
 
 
 
 
 
 
 
 
 
 
33
  = 3.3.2 =
34
  *Release Date - 10 May 2017*
35
 
3
  Tags: akismet, comments, spam, antispam, anti-spam, anti spam, comment moderation, comment spam, contact form spam, spam comments
4
  Requires at least: 3.7
5
  Tested up to: 4.8
6
+ Stable tag: 3.3.3
7
  License: GPLv2 or later
8
 
9
  Akismet checks your comments and contact form submissions against our global database of spam to protect you and your site from malicious content.
30
 
31
  == Changelog ==
32
 
33
+ = 3.3.3 =
34
+ *Release Date - 13 July 2017*
35
+
36
+ * Reduced amount of bandwidth used by the URL Preview feature.
37
+ * Improved the admin UI when the API key is manually pre-defined for the site.
38
+ * Removed a workaround for WordPress installations older than 3.3 that will improve Akismet's compatibility with other plugins.
39
+ * The number of spam blocked that is displayed on the WordPress dashboard will now be more accurate and updated more frequently.
40
+ * Fixed a bug in the Akismet widget that could cause PHP warnings.
41
+
42
  = 3.3.2 =
43
  *Release Date - 10 May 2017*
44
 
views/config.php CHANGED
@@ -65,7 +65,7 @@
65
  <form action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="POST">
66
  <table cellspacing="0" class="akismet-settings">
67
  <tbody>
68
- <?php if ( !defined( 'WPCOM_API_KEY' ) ):?>
69
  <tr>
70
  <th class="akismet-api-key" width="10%" align="left" scope="row"><?php esc_html_e('API Key', 'akismet');?></th>
71
  <td width="5%"/>
@@ -73,7 +73,7 @@
73
  <span class="api-key"><input id="key" name="key" type="text" size="15" value="<?php echo esc_attr( get_option('wordpress_api_key') ); ?>" class="<?php echo esc_attr( 'regular-text code ' . $akismet_user->status ); ?>"></span>
74
  </td>
75
  </tr>
76
- <?php endif; ?>
77
  <?php if ( isset( $_GET['ssl_status'] ) ) { ?>
78
  <tr>
79
  <th align="left" scope="row"><?php esc_html_e( 'SSL Status', 'akismet' ); ?></th>
@@ -157,11 +157,11 @@
157
  </tbody>
158
  </table>
159
  <div class="akismet-card-actions">
160
- <?php if ( !defined( 'WPCOM_API_KEY' ) ):?>
161
  <div id="delete-action">
162
  <a class="submitdelete deletion" href="<?php echo esc_url( Akismet_Admin::get_page_url( 'delete_key' ) ); ?>"><?php esc_html_e('Disconnect this account', 'akismet'); ?></a>
163
  </div>
164
- <?php endif; ?>
165
  <?php wp_nonce_field(Akismet_Admin::NONCE) ?>
166
  <div id="publishing-action">
167
  <input type="hidden" name="action" value="enter-key">
@@ -172,61 +172,63 @@
172
  </form>
173
  </div>
174
  </div>
175
-
176
- <div class="akismet-card">
177
- <div class="akismet-section-header">
178
- <div class="akismet-section-header__label">
179
- <span><?php esc_html_e( 'Account' , 'akismet'); ?></span>
 
 
180
  </div>
181
- </div>
182
 
183
- <div class="inside">
184
- <table cellspacing="0" border="0" class="akismet-settings">
185
- <tbody>
186
- <tr>
187
- <th scope="row" align="left"><?php esc_html_e( 'Subscription Type' , 'akismet');?></th>
188
- <td width="5%"/>
189
- <td align="left">
190
- <p><?php echo esc_html( $akismet_user->account_name ); ?></p>
191
- </td>
192
- </tr>
193
- <tr>
194
- <th scope="row" align="left"><?php esc_html_e( 'Status' , 'akismet');?></th>
195
- <td width="5%"/>
196
- <td align="left">
197
- <p><?php
198
- if ( 'cancelled' == $akismet_user->status ) :
199
- esc_html_e( 'Cancelled', 'akismet' );
200
- elseif ( 'suspended' == $akismet_user->status ) :
201
- esc_html_e( 'Suspended', 'akismet' );
202
- elseif ( 'missing' == $akismet_user->status ) :
203
- esc_html_e( 'Missing', 'akismet' );
204
- elseif ( 'no-sub' == $akismet_user->status ) :
205
- esc_html_e( 'No Subscription Found', 'akismet' );
206
- else :
207
- esc_html_e( 'Active', 'akismet' );
208
- endif; ?></p>
209
- </td>
210
- </tr>
211
- <?php if ( $akismet_user->next_billing_date ) : ?>
212
- <tr>
213
- <th scope="row" align="left"><?php esc_html_e( 'Next Billing Date' , 'akismet');?></th>
214
- <td width="5%"/>
215
- <td align="left">
216
- <p><?php echo date( 'F j, Y', $akismet_user->next_billing_date ); ?></p>
217
- </td>
218
- </tr>
219
- <?php endif; ?>
220
- </tbody>
221
- </table>
222
- <div class="akismet-card-actions">
223
- <div id="publishing-action">
224
- <?php Akismet::view( 'get', array( 'text' => ( $akismet_user->account_type == 'free-api-key' && $akismet_user->status == 'active' ? __( 'Upgrade' , 'akismet') : __( 'Change' , 'akismet') ), 'redirect' => 'upgrade' ) ); ?>
 
 
225
  </div>
226
- <div class="clear"></div>
227
  </div>
228
  </div>
229
- </div>
230
  <?php endif;?>
231
  </div>
232
  </div>
65
  <form action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="POST">
66
  <table cellspacing="0" class="akismet-settings">
67
  <tbody>
68
+ <?php if ( ! Akismet::predefined_api_key() ) { ?>
69
  <tr>
70
  <th class="akismet-api-key" width="10%" align="left" scope="row"><?php esc_html_e('API Key', 'akismet');?></th>
71
  <td width="5%"/>
73
  <span class="api-key"><input id="key" name="key" type="text" size="15" value="<?php echo esc_attr( get_option('wordpress_api_key') ); ?>" class="<?php echo esc_attr( 'regular-text code ' . $akismet_user->status ); ?>"></span>
74
  </td>
75
  </tr>
76
+ <?php } ?>
77
  <?php if ( isset( $_GET['ssl_status'] ) ) { ?>
78
  <tr>
79
  <th align="left" scope="row"><?php esc_html_e( 'SSL Status', 'akismet' ); ?></th>
157
  </tbody>
158
  </table>
159
  <div class="akismet-card-actions">
160
+ <?php if ( ! Akismet::predefined_api_key() ) { ?>
161
  <div id="delete-action">
162
  <a class="submitdelete deletion" href="<?php echo esc_url( Akismet_Admin::get_page_url( 'delete_key' ) ); ?>"><?php esc_html_e('Disconnect this account', 'akismet'); ?></a>
163
  </div>
164
+ <?php } ?>
165
  <?php wp_nonce_field(Akismet_Admin::NONCE) ?>
166
  <div id="publishing-action">
167
  <input type="hidden" name="action" value="enter-key">
172
  </form>
173
  </div>
174
  </div>
175
+
176
+ <?php if ( ! Akismet::predefined_api_key() ) { ?>
177
+ <div class="akismet-card">
178
+ <div class="akismet-section-header">
179
+ <div class="akismet-section-header__label">
180
+ <span><?php esc_html_e( 'Account' , 'akismet'); ?></span>
181
+ </div>
182
  </div>
 
183
 
184
+ <div class="inside">
185
+ <table cellspacing="0" border="0" class="akismet-settings">
186
+ <tbody>
187
+ <tr>
188
+ <th scope="row" align="left"><?php esc_html_e( 'Subscription Type' , 'akismet');?></th>
189
+ <td width="5%"/>
190
+ <td align="left">
191
+ <p><?php echo esc_html( $akismet_user->account_name ); ?></p>
192
+ </td>
193
+ </tr>
194
+ <tr>
195
+ <th scope="row" align="left"><?php esc_html_e( 'Status' , 'akismet');?></th>
196
+ <td width="5%"/>
197
+ <td align="left">
198
+ <p><?php
199
+ if ( 'cancelled' == $akismet_user->status ) :
200
+ esc_html_e( 'Cancelled', 'akismet' );
201
+ elseif ( 'suspended' == $akismet_user->status ) :
202
+ esc_html_e( 'Suspended', 'akismet' );
203
+ elseif ( 'missing' == $akismet_user->status ) :
204
+ esc_html_e( 'Missing', 'akismet' );
205
+ elseif ( 'no-sub' == $akismet_user->status ) :
206
+ esc_html_e( 'No Subscription Found', 'akismet' );
207
+ else :
208
+ esc_html_e( 'Active', 'akismet' );
209
+ endif; ?></p>
210
+ </td>
211
+ </tr>
212
+ <?php if ( $akismet_user->next_billing_date ) : ?>
213
+ <tr>
214
+ <th scope="row" align="left"><?php esc_html_e( 'Next Billing Date' , 'akismet');?></th>
215
+ <td width="5%"/>
216
+ <td align="left">
217
+ <p><?php echo date( 'F j, Y', $akismet_user->next_billing_date ); ?></p>
218
+ </td>
219
+ </tr>
220
+ <?php endif; ?>
221
+ </tbody>
222
+ </table>
223
+ <div class="akismet-card-actions">
224
+ <div id="publishing-action">
225
+ <?php Akismet::view( 'get', array( 'text' => ( $akismet_user->account_type == 'free-api-key' && $akismet_user->status == 'active' ? __( 'Upgrade' , 'akismet') : __( 'Change' , 'akismet') ), 'redirect' => 'upgrade' ) ); ?>
226
+ </div>
227
+ <div class="clear"></div>
228
  </div>
 
229
  </div>
230
  </div>
231
+ <?php } ?>
232
  <?php endif;?>
233
  </div>
234
  </div>
views/start.php CHANGED
@@ -8,86 +8,95 @@
8
  </div>
9
  <div class="akismet-lower">
10
  <?php Akismet_Admin::display_status(); ?>
 
11
  <div class="akismet-box">
12
  <h2><?php esc_html_e( 'Eliminate spam from your site', 'akismet' ); ?></h2>
13
  <p><?php esc_html_e( 'Select one of the options below to get started.', 'akismet' ); ?></p>
14
  </div>
15
  <div class="akismet-boxes">
16
- <?php if ( $akismet_user && in_array( $akismet_user->status, array( 'active', 'active-dunning', 'no-sub', 'missing', 'cancelled', 'suspended' ) ) ) { ?>
17
- <?php if ( in_array( $akismet_user->status, array( 'no-sub', 'missing' ) ) ) { ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  <div class="akismet-box">
19
- <h3><?php esc_html_e( 'Connect via Jetpack', 'akismet' ); ?></h3>
20
- <p><?php esc_html_e( 'Use your Jetpack connection to activate Akismet.', 'akismet' ); ?></p>
21
- <form name="akismet_activate" id="akismet_activate" action="https://akismet.com/get/" method="post" class="akismet-right" target="_blank">
22
- <input type="hidden" name="passback_url" value="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>"/>
23
- <input type="hidden" name="blog" value="<?php echo esc_url( get_option( 'home' ) ); ?>"/>
24
- <input type="hidden" name="auto-connect" value="<?php echo esc_attr( $akismet_user->ID ); ?>"/>
25
- <input type="hidden" name="redirect" value="plugin-signup"/>
26
- <input type="submit" class="akismet-button akismet-is-primary" value="<?php esc_attr_e( 'Connect with Jetpack' , 'akismet' ); ?>"/>
27
- </form>
28
- <?php echo get_avatar( $akismet_user->user_email, null, null, null, array( 'class' => 'akismet-jetpack-gravatar' ) ); ?>
29
- <p><?php echo sprintf( esc_html( __( 'You are connected as %s.', 'akismet' ) ), '<b>' . esc_html( $akismet_user->user_login ) . '</b>' ); ?><br /><span class="akismet-jetpack-email"><?php echo esc_html( $akismet_user->user_email ); ?></span></p>
30
- </div>
31
- <?php } elseif ( $akismet_user->status == 'cancelled' ) { ?>
32
- <div class="akismet-box">
33
- <h3><?php esc_html_e( 'Connect via Jetpack', 'akismet' ); ?></h3>
34
- <form name="akismet_activate" id="akismet_activate" action="https://akismet.com/get/" method="post" class="akismet-right" target="_blank">
35
- <input type="hidden" name="passback_url" value="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>"/>
36
- <input type="hidden" name="blog" value="<?php echo esc_url( get_option( 'home' ) ); ?>"/>
37
- <input type="hidden" name="user_id" value="<?php echo esc_attr( $akismet_user->ID ); ?>"/>
38
- <input type="hidden" name="redirect" value="upgrade"/>
39
- <input type="submit" class="akismet-button akismet-is-primary" value="<?php esc_attr_e( 'Reactivate Akismet' , 'akismet' ); ?>"/>
40
  </form>
41
- <p><?php echo esc_html( sprintf( __( 'Your subscription for %s is cancelled.' , 'akismet' ), $akismet_user->user_email ) ); ?></p>
42
- </div>
43
- <?php } elseif ( $akismet_user->status == 'suspended' ) { ?>
44
- <div class="centered akismet-box">
45
- <h3><?php esc_html_e( 'Connected via Jetpack' , 'akismet' ); ?></h3>
46
- <p class="akismet-alert-text"><?php echo esc_html( sprintf( __( 'Your subscription for %s is suspended.' , 'akismet' ), $akismet_user->user_email ) ); ?></p>
47
- <p><?php esc_html_e( 'No worries! Get in touch and we&#8217;ll sort this out.', 'akismet' ); ?></p>
48
- <p><a href="https://akismet.com/contact" class="akismet-button akismet-is-primary"><?php esc_html_e( 'Contact Akismet support' , 'akismet' ); ?></a></p>
49
  </div>
50
- <?php } else { // ask do they want to use akismet account found using jetpack wpcom connection ?>
51
  <div class="akismet-box">
52
- <h3><?php esc_html_e( 'Connect via Jetpack', 'akismet' ); ?></h3>
53
- <p><?php esc_html_e( 'Use your Jetpack connection to activate Akismet.', 'akismet' ); ?></p>
54
- <form name="akismet_use_wpcom_key" action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="post" id="akismet-activate" class="akismet-right">
55
- <input type="hidden" name="key" value="<?php echo esc_attr( $akismet_user->api_key );?>"/>
56
- <input type="hidden" name="action" value="enter-key">
57
- <?php wp_nonce_field( Akismet_Admin::NONCE ) ?>
58
- <input type="submit" class="akismet-button akismet-is-primary" value="<?php esc_attr_e( 'Connect with Jetpack' , 'akismet' ); ?>"/>
59
- </form>
60
- <?php echo get_avatar( $akismet_user->user_email, null, null, null, array( 'class' => 'akismet-jetpack-gravatar' ) ); ?>
61
- <p><?php echo sprintf( esc_html( __( 'You are connected as %s.', 'akismet' ) ), '<b>' . esc_html( $akismet_user->user_login ) . '</b>' ); ?><br /><span class="akismet-jetpack-email"><?php echo esc_html( $akismet_user->user_email ); ?></span></p>
62
  </div>
63
  <?php } ?>
64
- <div class="akismet-box">
65
- <h3><?php esc_html_e( 'Or sign up with a different email address', 'akismet' ); ?></h3>
66
- <div class="akismet-right">
67
- <?php Akismet::view( 'get', array( 'text' => __( 'Sign up with a different email address' , 'akismet' ), 'classes' => array( 'akismet-button' ) ) ); ?>
68
- </div>
69
- <p><?php esc_html_e( 'Choose this option to use Akismet independently of your Jetpack connection.', 'akismet' ); ?></p>
70
- </div>
71
- <?php } else { ?>
72
- <div class="akismet-box">
73
- <h3><?php esc_html_e( 'Activate Akismet' , 'akismet' );?></h3>
74
- <div class="akismet-right">
75
- <?php Akismet::view( 'get', array( 'text' => __( 'Get your API key' , 'akismet' ), 'classes' => array( 'akismet-button', 'akismet-is-primary' ) ) ); ?>
76
- </div>
77
- <p><?php esc_html_e( 'Log in or sign up now.', 'akismet' ); ?></p>
78
- </div>
79
- <?php } ?>
80
- <div class="akismet-box">
81
- <h3><?php esc_html_e( 'Or enter an API key', 'akismet' ); ?></h3>
82
- <p><?php esc_html_e( 'Already have your key? Enter it here.', 'akismet' ); ?> <a href="https://docs.akismet.com/getting-started/api-key/" target="_blank"><?php esc_html_e( '(What is an API key?)', 'akismet' ); ?></a></p>
83
- <form action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="post">
84
- <?php wp_nonce_field( Akismet_Admin::NONCE ) ?>
85
- <input type="hidden" name="action" value="enter-key">
86
- <p style="width: 100%; display: flex; flex-wrap: nowrap; box-sizing: border-box;">
87
- <input id="key" name="key" type="text" size="15" value="" class="regular-text code" style="flex-grow: 1; margin-right: 1rem;">
88
- <input type="submit" name="submit" id="submit" class="akismet-button" value="<?php esc_attr_e( 'Connect with API key', 'akismet' );?>">
89
- </p>
90
- </form>
91
  </div>
92
  </div>
93
  </div>
8
  </div>
9
  <div class="akismet-lower">
10
  <?php Akismet_Admin::display_status(); ?>
11
+
12
  <div class="akismet-box">
13
  <h2><?php esc_html_e( 'Eliminate spam from your site', 'akismet' ); ?></h2>
14
  <p><?php esc_html_e( 'Select one of the options below to get started.', 'akismet' ); ?></p>
15
  </div>
16
  <div class="akismet-boxes">
17
+ <?php if ( ! Akismet::predefined_api_key() ) { ?>
18
+ <?php if ( $akismet_user && in_array( $akismet_user->status, array( 'active', 'active-dunning', 'no-sub', 'missing', 'cancelled', 'suspended' ) ) ) { ?>
19
+ <?php if ( in_array( $akismet_user->status, array( 'no-sub', 'missing' ) ) ) { ?>
20
+ <div class="akismet-box">
21
+ <h3><?php esc_html_e( 'Connect via Jetpack', 'akismet' ); ?></h3>
22
+ <p><?php esc_html_e( 'Use your Jetpack connection to activate Akismet.', 'akismet' ); ?></p>
23
+ <form name="akismet_activate" id="akismet_activate" action="https://akismet.com/get/" method="post" class="akismet-right" target="_blank">
24
+ <input type="hidden" name="passback_url" value="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>"/>
25
+ <input type="hidden" name="blog" value="<?php echo esc_url( get_option( 'home' ) ); ?>"/>
26
+ <input type="hidden" name="auto-connect" value="<?php echo esc_attr( $akismet_user->ID ); ?>"/>
27
+ <input type="hidden" name="redirect" value="plugin-signup"/>
28
+ <input type="submit" class="akismet-button akismet-is-primary" value="<?php esc_attr_e( 'Connect with Jetpack' , 'akismet' ); ?>"/>
29
+ </form>
30
+ <?php echo get_avatar( $akismet_user->user_email, null, null, null, array( 'class' => 'akismet-jetpack-gravatar' ) ); ?>
31
+ <p><?php echo sprintf( esc_html( __( 'You are connected as %s.', 'akismet' ) ), '<b>' . esc_html( $akismet_user->user_login ) . '</b>' ); ?><br /><span class="akismet-jetpack-email"><?php echo esc_html( $akismet_user->user_email ); ?></span></p>
32
+ </div>
33
+ <?php } elseif ( $akismet_user->status == 'cancelled' ) { ?>
34
+ <div class="akismet-box">
35
+ <h3><?php esc_html_e( 'Connect via Jetpack', 'akismet' ); ?></h3>
36
+ <form name="akismet_activate" id="akismet_activate" action="https://akismet.com/get/" method="post" class="akismet-right" target="_blank">
37
+ <input type="hidden" name="passback_url" value="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>"/>
38
+ <input type="hidden" name="blog" value="<?php echo esc_url( get_option( 'home' ) ); ?>"/>
39
+ <input type="hidden" name="user_id" value="<?php echo esc_attr( $akismet_user->ID ); ?>"/>
40
+ <input type="hidden" name="redirect" value="upgrade"/>
41
+ <input type="submit" class="akismet-button akismet-is-primary" value="<?php esc_attr_e( 'Reactivate Akismet' , 'akismet' ); ?>"/>
42
+ </form>
43
+ <p><?php echo esc_html( sprintf( __( 'Your subscription for %s is cancelled.' , 'akismet' ), $akismet_user->user_email ) ); ?></p>
44
+ </div>
45
+ <?php } elseif ( $akismet_user->status == 'suspended' ) { ?>
46
+ <div class="centered akismet-box">
47
+ <h3><?php esc_html_e( 'Connected via Jetpack' , 'akismet' ); ?></h3>
48
+ <p class="akismet-alert-text"><?php echo esc_html( sprintf( __( 'Your subscription for %s is suspended.' , 'akismet' ), $akismet_user->user_email ) ); ?></p>
49
+ <p><?php esc_html_e( 'No worries! Get in touch and we&#8217;ll sort this out.', 'akismet' ); ?></p>
50
+ <p><a href="https://akismet.com/contact" class="akismet-button akismet-is-primary"><?php esc_html_e( 'Contact Akismet support' , 'akismet' ); ?></a></p>
51
+ </div>
52
+ <?php } else { // ask do they want to use akismet account found using jetpack wpcom connection ?>
53
+ <div class="akismet-box">
54
+ <h3><?php esc_html_e( 'Connect via Jetpack', 'akismet' ); ?></h3>
55
+ <p><?php esc_html_e( 'Use your Jetpack connection to activate Akismet.', 'akismet' ); ?></p>
56
+ <form name="akismet_use_wpcom_key" action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="post" id="akismet-activate" class="akismet-right">
57
+ <input type="hidden" name="key" value="<?php echo esc_attr( $akismet_user->api_key );?>"/>
58
+ <input type="hidden" name="action" value="enter-key">
59
+ <?php wp_nonce_field( Akismet_Admin::NONCE ) ?>
60
+ <input type="submit" class="akismet-button akismet-is-primary" value="<?php esc_attr_e( 'Connect with Jetpack' , 'akismet' ); ?>"/>
61
+ </form>
62
+ <?php echo get_avatar( $akismet_user->user_email, null, null, null, array( 'class' => 'akismet-jetpack-gravatar' ) ); ?>
63
+ <p><?php echo sprintf( esc_html( __( 'You are connected as %s.', 'akismet' ) ), '<b>' . esc_html( $akismet_user->user_login ) . '</b>' ); ?><br /><span class="akismet-jetpack-email"><?php echo esc_html( $akismet_user->user_email ); ?></span></p>
64
+ </div>
65
+ <?php } ?>
66
+ <div class="akismet-box">
67
+ <h3><?php esc_html_e( 'Or sign up with a different email address', 'akismet' ); ?></h3>
68
+ <div class="akismet-right">
69
+ <?php Akismet::view( 'get', array( 'text' => __( 'Sign up with a different email address' , 'akismet' ), 'classes' => array( 'akismet-button' ) ) ); ?>
70
+ </div>
71
+ <p><?php esc_html_e( 'Choose this option to use Akismet independently of your Jetpack connection.', 'akismet' ); ?></p>
72
+ </div>
73
+ <?php } else { ?>
74
+ <div class="akismet-box">
75
+ <h3><?php esc_html_e( 'Activate Akismet' , 'akismet' );?></h3>
76
+ <div class="akismet-right">
77
+ <?php Akismet::view( 'get', array( 'text' => __( 'Get your API key' , 'akismet' ), 'classes' => array( 'akismet-button', 'akismet-is-primary' ) ) ); ?>
78
+ </div>
79
+ <p><?php esc_html_e( 'Log in or sign up now.', 'akismet' ); ?></p>
80
+ </div>
81
+ <?php } ?>
82
  <div class="akismet-box">
83
+ <h3><?php esc_html_e( 'Or enter an API key', 'akismet' ); ?></h3>
84
+ <p><?php esc_html_e( 'Already have your key? Enter it here.', 'akismet' ); ?> <a href="https://docs.akismet.com/getting-started/api-key/" target="_blank"><?php esc_html_e( '(What is an API key?)', 'akismet' ); ?></a></p>
85
+ <form action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="post">
86
+ <?php wp_nonce_field( Akismet_Admin::NONCE ) ?>
87
+ <input type="hidden" name="action" value="enter-key">
88
+ <p style="width: 100%; display: flex; flex-wrap: nowrap; box-sizing: border-box;">
89
+ <input id="key" name="key" type="text" size="15" value="" class="regular-text code" style="flex-grow: 1; margin-right: 1rem;">
90
+ <input type="submit" name="submit" id="submit" class="akismet-button" value="<?php esc_attr_e( 'Connect with API key', 'akismet' );?>">
91
+ </p>
 
 
 
 
 
 
 
 
 
 
 
 
92
  </form>
 
 
 
 
 
 
 
 
93
  </div>
94
+ <?php } else { ?>
95
  <div class="akismet-box">
96
+ <h2><?php esc_html_e( 'Manual Configuration', 'akismet' ); ?></h2>
97
+ <p><?php echo sprintf( esc_html__( 'An Akismet API key has been defined in the %s file for this site.', 'akismet' ), '<code>wp-config.php</code>' ); ?></p>
 
 
 
 
 
 
 
 
98
  </div>
99
  <?php } ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
  </div>
101
  </div>
102
  </div>