Version Description
Release Date - 30 September 2021
- Added links to additional information on API usage notifications.
- Reduced the number of network requests required for a comment page when running Akismet.
- Improved compatibility with the most popular contact form plugins.
- Improved API usage buttons for clarity on what upgrade is needed.
Download this release
Release Info
Developer | cfinke |
Plugin | Akismet Anti-Spam |
Version | 4.2 |
Comparing to | |
See all releases |
Code changes from version 4.1.12 to 4.2
- _inc/form.js +0 -30
- akismet.php +3 -3
- class.akismet-admin.php +6 -6
- class.akismet-widget.php +23 -1
- class.akismet.php +86 -39
- readme.txt +10 -2
- views/config.php +7 -1
- views/notice.php +125 -36
_inc/form.js
DELETED
@@ -1,30 +0,0 @@
|
|
1 |
-
var ak_js = document.getElementById( "ak_js" );
|
2 |
-
|
3 |
-
if ( ! ak_js ) {
|
4 |
-
ak_js = document.createElement( 'input' );
|
5 |
-
ak_js.setAttribute( 'id', 'ak_js' );
|
6 |
-
ak_js.setAttribute( 'name', 'ak_js' );
|
7 |
-
ak_js.setAttribute( 'type', 'hidden' );
|
8 |
-
}
|
9 |
-
else {
|
10 |
-
ak_js.parentNode.removeChild( ak_js );
|
11 |
-
}
|
12 |
-
|
13 |
-
ak_js.setAttribute( 'value', ( new Date() ).getTime() );
|
14 |
-
|
15 |
-
var commentForm = document.getElementById( 'commentform' );
|
16 |
-
|
17 |
-
if ( commentForm ) {
|
18 |
-
commentForm.appendChild( ak_js );
|
19 |
-
}
|
20 |
-
else {
|
21 |
-
var replyRowContainer = document.getElementById( 'replyrow' );
|
22 |
-
|
23 |
-
if ( replyRowContainer ) {
|
24 |
-
var children = replyRowContainer.getElementsByTagName( 'td' );
|
25 |
-
|
26 |
-
if ( children.length > 0 ) {
|
27 |
-
children[0].appendChild( ak_js );
|
28 |
-
}
|
29 |
-
}
|
30 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.
|
10 |
Author: Automattic
|
11 |
Author URI: https://automattic.com/wordpress-plugins/
|
12 |
License: GPLv2 or later
|
@@ -37,8 +37,8 @@ if ( !function_exists( 'add_action' ) ) {
|
|
37 |
exit;
|
38 |
}
|
39 |
|
40 |
-
define( 'AKISMET_VERSION', '4.
|
41 |
-
define( 'AKISMET__MINIMUM_WP_VERSION', '
|
42 |
define( 'AKISMET__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
43 |
define( 'AKISMET_DELETE_LIMIT', 100000 );
|
44 |
|
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.2
|
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.2' );
|
41 |
+
define( 'AKISMET__MINIMUM_WP_VERSION', '5.0' );
|
42 |
define( 'AKISMET__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
43 |
define( 'AKISMET_DELETE_LIMIT', 100000 );
|
44 |
|
class.akismet-admin.php
CHANGED
@@ -897,6 +897,7 @@ class Akismet_Admin {
|
|
897 |
'usage_limit' => get_option( 'akismet_alert_usage_limit' ),
|
898 |
'upgrade_plan' => get_option( 'akismet_alert_upgrade_plan' ),
|
899 |
'upgrade_url' => get_option( 'akismet_alert_upgrade_url' ),
|
|
|
900 |
);
|
901 |
}
|
902 |
|
@@ -1038,7 +1039,7 @@ class Akismet_Admin {
|
|
1038 |
}
|
1039 |
|
1040 |
$alert_code = get_option( 'akismet_alert_code' );
|
1041 |
-
if ( isset( Akismet::$
|
1042 |
$notices[] = self::get_usage_limit_alert_data();
|
1043 |
}
|
1044 |
|
@@ -1078,12 +1079,11 @@ class Akismet_Admin {
|
|
1078 |
|
1079 |
if ( in_array( $hook_suffix, array( 'edit-comments.php' ) ) && (int) get_option( 'akismet_alert_code' ) > 0 ) {
|
1080 |
Akismet::verify_key( Akismet::get_api_key() ); //verify that the key is still in alert state
|
1081 |
-
|
1082 |
$alert_code = get_option( 'akismet_alert_code' );
|
1083 |
-
if ( isset( Akismet::$
|
1084 |
self::display_usage_limit_alert();
|
1085 |
-
}
|
1086 |
-
elseif ( $alert_code > 0 ) {
|
1087 |
self::display_alert();
|
1088 |
}
|
1089 |
}
|
@@ -1158,7 +1158,7 @@ class Akismet_Admin {
|
|
1158 |
if ( !class_exists('Jetpack') )
|
1159 |
return false;
|
1160 |
|
1161 |
-
if ( defined( 'JETPACK__VERSION' ) && version_compare( JETPACK__VERSION, '7.7', '<' )
|
1162 |
// For version of Jetpack prior to 7.7.
|
1163 |
Jetpack::load_xml_rpc_client();
|
1164 |
}
|
897 |
'usage_limit' => get_option( 'akismet_alert_usage_limit' ),
|
898 |
'upgrade_plan' => get_option( 'akismet_alert_upgrade_plan' ),
|
899 |
'upgrade_url' => get_option( 'akismet_alert_upgrade_url' ),
|
900 |
+
'upgrade_type' => get_option( 'akismet_alert_upgrade_type' ),
|
901 |
);
|
902 |
}
|
903 |
|
1039 |
}
|
1040 |
|
1041 |
$alert_code = get_option( 'akismet_alert_code' );
|
1042 |
+
if ( isset( Akismet::$limit_notices[ $alert_code ] ) ) {
|
1043 |
$notices[] = self::get_usage_limit_alert_data();
|
1044 |
}
|
1045 |
|
1079 |
|
1080 |
if ( in_array( $hook_suffix, array( 'edit-comments.php' ) ) && (int) get_option( 'akismet_alert_code' ) > 0 ) {
|
1081 |
Akismet::verify_key( Akismet::get_api_key() ); //verify that the key is still in alert state
|
1082 |
+
|
1083 |
$alert_code = get_option( 'akismet_alert_code' );
|
1084 |
+
if ( isset( Akismet::$limit_notices[ $alert_code ] ) ) {
|
1085 |
self::display_usage_limit_alert();
|
1086 |
+
} elseif ( $alert_code > 0 ) {
|
|
|
1087 |
self::display_alert();
|
1088 |
}
|
1089 |
}
|
1158 |
if ( !class_exists('Jetpack') )
|
1159 |
return false;
|
1160 |
|
1161 |
+
if ( defined( 'JETPACK__VERSION' ) && version_compare( JETPACK__VERSION, '7.7', '<' ) ) {
|
1162 |
// For version of Jetpack prior to 7.7.
|
1163 |
Jetpack::load_xml_rpc_client();
|
1164 |
}
|
class.akismet-widget.php
CHANGED
@@ -99,7 +99,29 @@ class Akismet_Widget extends WP_Widget {
|
|
99 |
?>
|
100 |
|
101 |
<div class="a-stats">
|
102 |
-
<a href="https://akismet.com" target="_blank" rel="noopener" title=""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
</div>
|
104 |
|
105 |
<?php
|
99 |
?>
|
100 |
|
101 |
<div class="a-stats">
|
102 |
+
<a href="https://akismet.com" target="_blank" rel="noopener" title="">
|
103 |
+
<?php
|
104 |
+
|
105 |
+
echo wp_kses(
|
106 |
+
sprintf(
|
107 |
+
/* translators: The placeholder is the number of pieces of spam blocked by Akismet. */
|
108 |
+
_n(
|
109 |
+
'<strong class="count">%1$s spam</strong> blocked by <strong>Akismet</strong>',
|
110 |
+
'<strong class="count">%1$s spam</strong> blocked by <strong>Akismet</strong>',
|
111 |
+
$count,
|
112 |
+
'akismet'
|
113 |
+
),
|
114 |
+
number_format_i18n( $count )
|
115 |
+
),
|
116 |
+
array(
|
117 |
+
'strong' => array(
|
118 |
+
'class' => true,
|
119 |
+
),
|
120 |
+
)
|
121 |
+
);
|
122 |
+
|
123 |
+
?>
|
124 |
+
</a>
|
125 |
</div>
|
126 |
|
127 |
<?php
|
class.akismet.php
CHANGED
@@ -5,7 +5,7 @@ class Akismet {
|
|
5 |
const API_PORT = 80;
|
6 |
const MAX_DELAY_BEFORE_MODERATION_EMAIL = 86400; // One day in seconds
|
7 |
|
8 |
-
public static $
|
9 |
10501 => 'FIRST_MONTH_OVER_LIMIT',
|
10 |
10502 => 'SECOND_MONTH_OVER_LIMIT',
|
11 |
10504 => 'THIRD_MONTH_APPROACHING_LIMIT',
|
@@ -41,11 +41,7 @@ class Akismet {
|
|
41 |
add_action( 'akismet_schedule_cron_recheck', array( 'Akismet', 'cron_recheck' ) );
|
42 |
|
43 |
add_action( 'comment_form', array( 'Akismet', 'add_comment_nonce' ), 1 );
|
44 |
-
|
45 |
-
add_action( 'admin_head-edit-comments.php', array( 'Akismet', 'load_form_js' ) );
|
46 |
-
add_action( 'comment_form', array( 'Akismet', 'load_form_js' ) );
|
47 |
-
add_action( 'comment_form', array( 'Akismet', 'inject_ak_js' ) );
|
48 |
-
add_filter( 'script_loader_tag', array( 'Akismet', 'set_form_js_async' ), 10, 3 );
|
49 |
|
50 |
add_filter( 'comment_moderation_recipients', array( 'Akismet', 'disable_moderation_emails_if_unreachable' ), 1000, 2 );
|
51 |
add_filter( 'pre_comment_approved', array( 'Akismet', 'last_comment_status' ), 10, 2 );
|
@@ -54,9 +50,20 @@ class Akismet {
|
|
54 |
|
55 |
// Run this early in the pingback call, before doing a remote fetch of the source uri
|
56 |
add_action( 'xmlrpc_call', array( 'Akismet', 'pre_check_pingback' ) );
|
57 |
-
|
58 |
// Jetpack compatibility
|
59 |
add_filter( 'jetpack_options_whitelist', array( 'Akismet', 'add_to_jetpack_options_whitelist' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
add_action( 'update_option_wordpress_api_key', array( 'Akismet', 'updated_option' ), 10, 2 );
|
61 |
add_action( 'add_option_wordpress_api_key', array( 'Akismet', 'added_option' ), 10, 2 );
|
62 |
|
@@ -416,7 +423,7 @@ class Akismet {
|
|
416 |
|
417 |
clean_comment_cache( $comment_ids );
|
418 |
do_action( 'akismet_delete_comment_batch', count( $comment_ids ) );
|
419 |
-
|
420 |
foreach ( $comment_ids as $comment_id ) {
|
421 |
do_action( 'deleted_comment', $comment_id );
|
422 |
}
|
@@ -982,7 +989,7 @@ class Akismet {
|
|
982 |
if ( is_user_logged_in() )
|
983 |
return false;
|
984 |
|
985 |
-
return ( get_option( 'akismet_strictness' ) === '1'
|
986 |
}
|
987 |
|
988 |
public static function get_ip_address() {
|
@@ -1132,10 +1139,12 @@ class Akismet {
|
|
1132 |
if ( ! empty( self::$prevent_moderation_email_for_these_comments ) && ! empty( $emails ) ) {
|
1133 |
$comment = get_comment( $comment_id );
|
1134 |
|
1135 |
-
|
1136 |
-
|
1137 |
-
|
1138 |
-
|
|
|
|
|
1139 |
}
|
1140 |
}
|
1141 |
}
|
@@ -1275,20 +1284,20 @@ class Akismet {
|
|
1275 |
'usage-limit',
|
1276 |
'upgrade-plan',
|
1277 |
'upgrade-url',
|
|
|
1278 |
);
|
1279 |
|
1280 |
-
foreach( $alert_header_names as $alert_header_name ) {
|
1281 |
$value = null;
|
1282 |
-
if ( isset( $response[0][$alert_header_prefix . $alert_header_name] ) ) {
|
1283 |
-
$value = $response[0][$alert_header_prefix . $alert_header_name];
|
1284 |
}
|
1285 |
|
1286 |
$option_name = $alert_option_prefix . str_replace( '-', '_', $alert_header_name );
|
1287 |
if ( $value != get_option( $option_name ) ) {
|
1288 |
if ( ! $value ) {
|
1289 |
delete_option( $option_name );
|
1290 |
-
}
|
1291 |
-
else {
|
1292 |
update_option( $option_name, $value );
|
1293 |
}
|
1294 |
}
|
@@ -1296,34 +1305,72 @@ class Akismet {
|
|
1296 |
}
|
1297 |
|
1298 |
public static function load_form_js() {
|
1299 |
-
|
1300 |
-
|
1301 |
-
}
|
1302 |
|
1303 |
-
|
1304 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1305 |
}
|
1306 |
|
1307 |
-
|
1308 |
-
|
|
|
|
|
|
|
|
|
|
|
1309 |
}
|
1310 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1311 |
/**
|
1312 |
-
*
|
1313 |
-
*
|
1314 |
-
*
|
|
|
1315 |
*/
|
1316 |
-
public static function
|
1317 |
-
|
1318 |
-
|
|
|
|
|
|
|
1319 |
}
|
1320 |
-
|
1321 |
-
|
1322 |
-
|
1323 |
-
|
1324 |
-
|
1325 |
-
|
1326 |
-
|
|
|
|
|
1327 |
}
|
1328 |
|
1329 |
private static function bail_on_activation( $message, $deactivate = true ) {
|
5 |
const API_PORT = 80;
|
6 |
const MAX_DELAY_BEFORE_MODERATION_EMAIL = 86400; // One day in seconds
|
7 |
|
8 |
+
public static $limit_notices = array(
|
9 |
10501 => 'FIRST_MONTH_OVER_LIMIT',
|
10 |
10502 => 'SECOND_MONTH_OVER_LIMIT',
|
11 |
10504 => 'THIRD_MONTH_APPROACHING_LIMIT',
|
41 |
add_action( 'akismet_schedule_cron_recheck', array( 'Akismet', 'cron_recheck' ) );
|
42 |
|
43 |
add_action( 'comment_form', array( 'Akismet', 'add_comment_nonce' ), 1 );
|
44 |
+
add_action( 'comment_form', array( 'Akismet', 'output_custom_form_fields' ) );
|
|
|
|
|
|
|
|
|
45 |
|
46 |
add_filter( 'comment_moderation_recipients', array( 'Akismet', 'disable_moderation_emails_if_unreachable' ), 1000, 2 );
|
47 |
add_filter( 'pre_comment_approved', array( 'Akismet', 'last_comment_status' ), 10, 2 );
|
50 |
|
51 |
// Run this early in the pingback call, before doing a remote fetch of the source uri
|
52 |
add_action( 'xmlrpc_call', array( 'Akismet', 'pre_check_pingback' ) );
|
53 |
+
|
54 |
// Jetpack compatibility
|
55 |
add_filter( 'jetpack_options_whitelist', array( 'Akismet', 'add_to_jetpack_options_whitelist' ) );
|
56 |
+
add_filter( 'jetpack_contact_form_html', array( 'Akismet', 'inject_custom_form_fields' ) );
|
57 |
+
add_filter( 'jetpack_contact_form_akismet_values', array( 'Akismet', 'prepare_custom_form_values' ) );
|
58 |
+
|
59 |
+
// Gravity Forms
|
60 |
+
add_filter( 'gform_get_form_filter', array( 'Akismet', 'inject_custom_form_fields' ) );
|
61 |
+
add_filter( 'gform_akismet_fields', array( 'Akismet', 'prepare_custom_form_values' ) );
|
62 |
+
|
63 |
+
// Contact Form 7
|
64 |
+
add_filter( 'wpcf7_form_elements', array( 'Akismet', 'append_custom_form_fields' ) );
|
65 |
+
add_filter( 'wpcf7_akismet_parameters', array( 'Akismet', 'prepare_custom_form_values' ) );
|
66 |
+
|
67 |
add_action( 'update_option_wordpress_api_key', array( 'Akismet', 'updated_option' ), 10, 2 );
|
68 |
add_action( 'add_option_wordpress_api_key', array( 'Akismet', 'added_option' ), 10, 2 );
|
69 |
|
423 |
|
424 |
clean_comment_cache( $comment_ids );
|
425 |
do_action( 'akismet_delete_comment_batch', count( $comment_ids ) );
|
426 |
+
|
427 |
foreach ( $comment_ids as $comment_id ) {
|
428 |
do_action( 'deleted_comment', $comment_id );
|
429 |
}
|
989 |
if ( is_user_logged_in() )
|
990 |
return false;
|
991 |
|
992 |
+
return ( get_option( 'akismet_strictness' ) === '1' );
|
993 |
}
|
994 |
|
995 |
public static function get_ip_address() {
|
1139 |
if ( ! empty( self::$prevent_moderation_email_for_these_comments ) && ! empty( $emails ) ) {
|
1140 |
$comment = get_comment( $comment_id );
|
1141 |
|
1142 |
+
if ( $comment ) {
|
1143 |
+
foreach ( self::$prevent_moderation_email_for_these_comments as $possible_match ) {
|
1144 |
+
if ( self::comments_match( $possible_match, $comment ) ) {
|
1145 |
+
update_comment_meta( $comment_id, 'akismet_delayed_moderation_email', true );
|
1146 |
+
return array();
|
1147 |
+
}
|
1148 |
}
|
1149 |
}
|
1150 |
}
|
1284 |
'usage-limit',
|
1285 |
'upgrade-plan',
|
1286 |
'upgrade-url',
|
1287 |
+
'upgrade-type',
|
1288 |
);
|
1289 |
|
1290 |
+
foreach ( $alert_header_names as $alert_header_name ) {
|
1291 |
$value = null;
|
1292 |
+
if ( isset( $response[0][ $alert_header_prefix . $alert_header_name ] ) ) {
|
1293 |
+
$value = $response[0][ $alert_header_prefix . $alert_header_name ];
|
1294 |
}
|
1295 |
|
1296 |
$option_name = $alert_option_prefix . str_replace( '-', '_', $alert_header_name );
|
1297 |
if ( $value != get_option( $option_name ) ) {
|
1298 |
if ( ! $value ) {
|
1299 |
delete_option( $option_name );
|
1300 |
+
} else {
|
|
|
1301 |
update_option( $option_name, $value );
|
1302 |
}
|
1303 |
}
|
1305 |
}
|
1306 |
|
1307 |
public static function load_form_js() {
|
1308 |
+
/* deprecated */
|
1309 |
+
}
|
|
|
1310 |
|
1311 |
+
public static function set_form_js_async( $tag, $handle, $src ) {
|
1312 |
+
/* deprecated */
|
1313 |
+
return $tag;
|
1314 |
+
}
|
1315 |
+
|
1316 |
+
public static function get_akismet_form_fields() {
|
1317 |
+
$fields = '';
|
1318 |
+
|
1319 |
+
$prefix = 'ak_';
|
1320 |
+
|
1321 |
+
// Contact Form 7 uses _wpcf7 as a prefix to know which fields to exclude from comment_content.
|
1322 |
+
if ( 'wpcf7_form_elements' === current_filter() ) {
|
1323 |
+
$prefix = '_wpcf7_ak_';
|
1324 |
}
|
1325 |
|
1326 |
+
$fields .= '<p style="display: none !important;">';
|
1327 |
+
$fields .= '<input type="hidden" id="ak_js" name="' . $prefix . 'js" value="' . mt_rand( 0, 250 ) . '"/>';
|
1328 |
+
$fields .= '<label>Δ<textarea name="' . $prefix . 'hp_textarea" cols="45" rows="8" maxlength="100"></textarea></label>';
|
1329 |
+
$fields .= '<script>document.getElementById( "ak_js" ).setAttribute( "value", ( new Date() ).getTime() );</script>';
|
1330 |
+
$fields .= '</p>';
|
1331 |
+
|
1332 |
+
return $fields;
|
1333 |
}
|
1334 |
+
|
1335 |
+
public static function output_custom_form_fields( $post_id ) {
|
1336 |
+
// phpcs:ignore WordPress.Security.EscapeOutput
|
1337 |
+
echo self::get_akismet_form_fields();
|
1338 |
+
}
|
1339 |
+
|
1340 |
+
public static function inject_custom_form_fields( $html ) {
|
1341 |
+
$html = str_replace( '</form>', self::get_akismet_form_fields() . '</form>', $html );
|
1342 |
+
|
1343 |
+
return $html;
|
1344 |
+
}
|
1345 |
+
|
1346 |
+
public static function append_custom_form_fields( $html ) {
|
1347 |
+
$html .= self::get_akismet_form_fields();
|
1348 |
+
|
1349 |
+
return $html;
|
1350 |
+
}
|
1351 |
+
|
1352 |
/**
|
1353 |
+
* Ensure that any Akismet-added form fields are included in the comment-check call.
|
1354 |
+
*
|
1355 |
+
* @param array $form
|
1356 |
+
* @return array $form
|
1357 |
*/
|
1358 |
+
public static function prepare_custom_form_values( $form ) {
|
1359 |
+
$prefix = 'ak_';
|
1360 |
+
|
1361 |
+
// Contact Form 7 uses _wpcf7 as a prefix to know which fields to exclude from comment_content.
|
1362 |
+
if ( 'wpcf7_akismet_parameters' === current_filter() ) {
|
1363 |
+
$prefix = '_wpcf7_ak_';
|
1364 |
}
|
1365 |
+
|
1366 |
+
// phpcs:ignore WordPress.Security.NonceVerification.Missing
|
1367 |
+
foreach ( $_POST as $key => $val ) {
|
1368 |
+
if ( 0 === strpos( $key, $prefix ) ) {
|
1369 |
+
$form[ 'POST_ak_' . substr( $key, strlen( $prefix ) ) ] = $val;
|
1370 |
+
}
|
1371 |
+
}
|
1372 |
+
|
1373 |
+
return $form;
|
1374 |
}
|
1375 |
|
1376 |
private static function bail_on_activation( $message, $deactivate = true ) {
|
readme.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
=== Akismet Spam Protection ===
|
2 |
Contributors: matt, ryan, andy, mdawaffe, tellyworth, josephscott, lessbloat, eoigal, cfinke, automattic, jgs, procifer, stephdau
|
3 |
Tags: comments, spam, antispam, anti-spam, contact form, anti spam, comment moderation, comment spam, contact form spam, spam comments
|
4 |
-
Requires at least:
|
5 |
Tested up to: 5.8
|
6 |
-
Stable tag: 4.
|
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,14 @@ Upload the Akismet plugin to your blog, activate it, and then enter your Akismet
|
|
30 |
|
31 |
== Changelog ==
|
32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
= 4.1.12 =
|
34 |
*Release Date - 3 September 2021*
|
35 |
|
1 |
=== Akismet Spam Protection ===
|
2 |
Contributors: matt, ryan, andy, mdawaffe, tellyworth, josephscott, lessbloat, eoigal, cfinke, automattic, jgs, procifer, stephdau
|
3 |
Tags: comments, spam, antispam, anti-spam, contact form, anti spam, comment moderation, comment spam, contact form spam, spam comments
|
4 |
+
Requires at least: 5.0
|
5 |
Tested up to: 5.8
|
6 |
+
Stable tag: 4.2
|
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.2 =
|
34 |
+
*Release Date - 30 September 2021*
|
35 |
+
|
36 |
+
* Added links to additional information on API usage notifications.
|
37 |
+
* Reduced the number of network requests required for a comment page when running Akismet.
|
38 |
+
* Improved compatibility with the most popular contact form plugins.
|
39 |
+
* Improved API usage buttons for clarity on what upgrade is needed.
|
40 |
+
|
41 |
= 4.1.12 =
|
42 |
*Release Date - 3 September 2021*
|
43 |
|
views/config.php
CHANGED
@@ -1,3 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<div id="akismet-plugin-container">
|
2 |
<div class="akismet-masthead">
|
3 |
<div class="akismet-masthead__inside-container">
|
@@ -53,7 +59,7 @@
|
|
53 |
</div>
|
54 |
<?php endif;?>
|
55 |
|
56 |
-
<?php if ( $akismet_user )
|
57 |
<div class="akismet-card">
|
58 |
<div class="akismet-section-header">
|
59 |
<div class="akismet-section-header__label">
|
1 |
+
<?php
|
2 |
+
|
3 |
+
//phpcs:disable VariableAnalysis
|
4 |
+
// There are "undefined" variables here because they're defined in the code that includes this file as a template.
|
5 |
+
|
6 |
+
?>
|
7 |
<div id="akismet-plugin-container">
|
8 |
<div class="akismet-masthead">
|
9 |
<div class="akismet-masthead__inside-container">
|
59 |
</div>
|
60 |
<?php endif;?>
|
61 |
|
62 |
+
<?php if ( $akismet_user ) : ?>
|
63 |
<div class="akismet-card">
|
64 |
<div class="akismet-section-header">
|
65 |
<div class="akismet-section-header__label">
|
views/notice.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
// There are "undefined" variables here because they're defined in the code that includes this file as a template.
|
5 |
|
6 |
?>
|
7 |
-
<?php if ( $type == 'plugin' )
|
8 |
<div class="updated" id="akismet_setup_prompt">
|
9 |
<form name="akismet_activate" action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="POST">
|
10 |
<div class="akismet_activate">
|
@@ -18,7 +18,7 @@
|
|
18 |
</div>
|
19 |
</form>
|
20 |
</div>
|
21 |
-
<?php elseif ( $type == 'spam-check' )
|
22 |
<div class="notice notice-warning">
|
23 |
<p><strong><?php esc_html_e( 'Akismet has detected a problem.', 'akismet' );?></strong></p>
|
24 |
<p><?php esc_html_e( '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>
|
@@ -26,7 +26,7 @@
|
|
26 |
<p><?php echo $link_text; ?></p>
|
27 |
<?php } ?>
|
28 |
</div>
|
29 |
-
<?php elseif ( $type == 'alert' )
|
30 |
<div class='error'>
|
31 |
<p><strong><?php printf( esc_html__( 'Akismet Error Code: %s', 'akismet' ), $code ); ?></strong></p>
|
32 |
<p><?php echo esc_html( $msg ); ?></p>
|
@@ -38,49 +38,49 @@
|
|
38 |
?>
|
39 |
</p>
|
40 |
</div>
|
41 |
-
<?php elseif ( $type == 'notice' )
|
42 |
<div class="akismet-alert akismet-critical">
|
43 |
<h3 class="akismet-key-status failed"><?php echo $notice_header; ?></h3>
|
44 |
<p class="akismet-description">
|
45 |
<?php echo $notice_text; ?>
|
46 |
</p>
|
47 |
</div>
|
48 |
-
<?php elseif ( $type == 'missing-functions' )
|
49 |
<div class="akismet-alert akismet-critical">
|
50 |
<h3 class="akismet-key-status failed"><?php esc_html_e('Network functions are disabled.', 'akismet'); ?></h3>
|
51 |
<p class="akismet-description"><?php printf( __('Your web host or server administrator has disabled PHP’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’s system requirements</a>.', 'akismet'), 'https://blog.akismet.com/akismet-hosting-faq/'); ?></p>
|
52 |
</div>
|
53 |
-
<?php elseif ( $type == 'servers-be-down' )
|
54 |
<div class="akismet-alert akismet-critical">
|
55 |
<h3 class="akismet-key-status failed"><?php esc_html_e("Your site can’t connect to the Akismet servers.", 'akismet'); ?></h3>
|
56 |
<p class="akismet-description"><?php printf( __('Your firewall may be blocking Akismet from connecting to its API. 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>
|
57 |
</div>
|
58 |
-
<?php elseif ( $type == 'active-dunning' )
|
59 |
<div class="akismet-alert akismet-critical">
|
60 |
<h3 class="akismet-key-status"><?php esc_html_e("Please update your payment information.", 'akismet'); ?></h3>
|
61 |
<p class="akismet-description"><?php printf( __('We cannot process your payment. Please <a href="%s" target="_blank">update your payment details</a>.', 'akismet'), 'https://akismet.com/account/'); ?></p>
|
62 |
</div>
|
63 |
-
<?php elseif ( $type == 'cancelled' )
|
64 |
<div class="akismet-alert akismet-critical">
|
65 |
<h3 class="akismet-key-status"><?php esc_html_e("Your Akismet plan has been cancelled.", 'akismet'); ?></h3>
|
66 |
<p class="akismet-description"><?php printf( __('Please visit your <a href="%s" target="_blank">Akismet account page</a> to reactivate your subscription.', 'akismet'), 'https://akismet.com/account/'); ?></p>
|
67 |
</div>
|
68 |
-
<?php elseif ( $type == 'suspended' )
|
69 |
<div class="akismet-alert akismet-critical">
|
70 |
<h3 class="akismet-key-status failed"><?php esc_html_e("Your Akismet subscription is suspended.", 'akismet'); ?></h3>
|
71 |
<p class="akismet-description"><?php printf( __('Please contact <a href="%s" target="_blank">Akismet support</a> for assistance.', 'akismet'), 'https://akismet.com/contact/'); ?></p>
|
72 |
</div>
|
73 |
-
<?php elseif ( $type == 'active-notice' && $time_saved )
|
74 |
<div class="akismet-alert akismet-active">
|
75 |
<h3 class="akismet-key-status"><?php echo esc_html( $time_saved ); ?></h3>
|
76 |
<p class="akismet-description"><?php printf( __('You can help us fight spam and upgrade your account by <a href="%s" target="_blank">contributing a token amount</a>.', 'akismet'), 'https://akismet.com/account/upgrade/'); ?></p>
|
77 |
</div>
|
78 |
-
<?php elseif ( $type == 'missing' )
|
79 |
<div class="akismet-alert akismet-critical">
|
80 |
<h3 class="akismet-key-status failed"><?php esc_html_e( 'There is a problem with your API key.', 'akismet'); ?></h3>
|
81 |
<p class="akismet-description"><?php printf( __('Please contact <a href="%s" target="_blank">Akismet support</a> for assistance.', 'akismet'), 'https://akismet.com/contact/'); ?></p>
|
82 |
</div>
|
83 |
-
<?php elseif ( $type == 'no-sub' )
|
84 |
<div class="akismet-alert akismet-critical">
|
85 |
<h3 class="akismet-key-status failed"><?php esc_html_e( 'You don’t have an Akismet plan.', 'akismet'); ?></h3>
|
86 |
<p class="akismet-description">
|
@@ -107,26 +107,78 @@
|
|
107 |
<p class="akismet-description"><?php printf( __( 'Would you like to <a href="%s">check pending comments</a>?', 'akismet' ), esc_url( $check_pending_link ) ); ?></p>
|
108 |
<?php } ?>
|
109 |
</div>
|
110 |
-
<?php elseif ( $type == 'new-key-invalid' )
|
111 |
<div class="akismet-alert akismet-critical">
|
112 |
<h3 class="akismet-key-status"><?php esc_html_e( 'The key you entered is invalid. Please double-check it.' , 'akismet'); ?></h3>
|
113 |
</div>
|
114 |
-
<?php elseif ( $type == 'existing-key-invalid' )
|
115 |
<div class="akismet-alert akismet-critical">
|
116 |
-
<h3 class="akismet-key-status"><?php echo esc_html( __( 'Your API key is no longer valid.'
|
117 |
-
<p class="akismet-description"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
</div>
|
119 |
-
<?php elseif ( $type == 'new-key-failed' )
|
120 |
<div class="akismet-alert akismet-critical">
|
121 |
<h3 class="akismet-key-status"><?php esc_html_e( 'The API key you entered could not be verified.' , 'akismet'); ?></h3>
|
122 |
-
<p class="akismet-description"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
</div>
|
124 |
-
<?php elseif ( $type == 'limit-reached' && in_array( $level, array( 'yellow', 'red' ) ) )
|
125 |
<div class="akismet-alert akismet-critical">
|
126 |
<?php if ( $level == 'yellow' ): ?>
|
127 |
<h3 class="akismet-key-status failed"><?php esc_html_e( 'You’re using your Akismet key on more sites than your Plus subscription allows.', 'akismet' ); ?></h3>
|
128 |
<p class="akismet-description">
|
129 |
-
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
<br /><br />
|
131 |
<?php printf( __( 'Please <a href="%s" target="_blank">contact our support team</a> with any questions.', 'akismet' ), 'https://akismet.com/contact/'); ?>
|
132 |
</p>
|
@@ -139,7 +191,7 @@
|
|
139 |
</p>
|
140 |
<?php endif; ?>
|
141 |
</div>
|
142 |
-
<?php elseif ( $type == 'usage-limit' && isset( Akismet::$
|
143 |
<div class="error akismet-usage-limit-alert">
|
144 |
<div class="akismet-usage-limit-logo">
|
145 |
<img src="<?php echo esc_url( plugins_url( '../_inc/img/logo-a-2x.png', __FILE__ ) ); ?>" alt="Akismet" />
|
@@ -147,13 +199,13 @@
|
|
147 |
<div class="akismet-usage-limit-text">
|
148 |
<h3>
|
149 |
<?php
|
150 |
-
switch ( Akismet::$
|
151 |
case 'FIRST_MONTH_OVER_LIMIT':
|
152 |
case 'SECOND_MONTH_OVER_LIMIT':
|
153 |
-
esc_html_e( 'Your Akismet account usage is over your plan
|
154 |
break;
|
155 |
case 'THIRD_MONTH_APPROACHING_LIMIT':
|
156 |
-
esc_html_e( 'Your Akismet account usage is approaching your plan
|
157 |
break;
|
158 |
case 'THIRD_MONTH_OVER_LIMIT':
|
159 |
case 'FOUR_PLUS_MONTHS_OVER_LIMIT':
|
@@ -165,25 +217,47 @@
|
|
165 |
</h3>
|
166 |
<p>
|
167 |
<?php
|
168 |
-
switch ( Akismet::$
|
169 |
case 'FIRST_MONTH_OVER_LIMIT':
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
|
|
|
|
176 |
);
|
|
|
|
|
|
|
|
|
|
|
177 |
break;
|
178 |
case 'SECOND_MONTH_OVER_LIMIT':
|
179 |
-
|
|
|
|
|
|
|
|
|
|
|
180 |
break;
|
181 |
case 'THIRD_MONTH_APPROACHING_LIMIT':
|
182 |
-
|
|
|
|
|
|
|
|
|
|
|
183 |
break;
|
184 |
case 'THIRD_MONTH_OVER_LIMIT':
|
185 |
case 'FOUR_PLUS_MONTHS_OVER_LIMIT':
|
186 |
-
|
|
|
|
|
|
|
|
|
|
|
187 |
break;
|
188 |
default:
|
189 |
}
|
@@ -191,7 +265,22 @@
|
|
191 |
</p>
|
192 |
</div>
|
193 |
<div class="akismet-usage-limit-cta">
|
194 |
-
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
</div>
|
196 |
</div>
|
197 |
-
<?php endif
|
4 |
// There are "undefined" variables here because they're defined in the code that includes this file as a template.
|
5 |
|
6 |
?>
|
7 |
+
<?php if ( $type == 'plugin' ) : ?>
|
8 |
<div class="updated" id="akismet_setup_prompt">
|
9 |
<form name="akismet_activate" action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="POST">
|
10 |
<div class="akismet_activate">
|
18 |
</div>
|
19 |
</form>
|
20 |
</div>
|
21 |
+
<?php elseif ( $type == 'spam-check' ) : ?>
|
22 |
<div class="notice notice-warning">
|
23 |
<p><strong><?php esc_html_e( 'Akismet has detected a problem.', 'akismet' );?></strong></p>
|
24 |
<p><?php esc_html_e( '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>
|
26 |
<p><?php echo $link_text; ?></p>
|
27 |
<?php } ?>
|
28 |
</div>
|
29 |
+
<?php elseif ( $type == 'alert' ) : ?>
|
30 |
<div class='error'>
|
31 |
<p><strong><?php printf( esc_html__( 'Akismet Error Code: %s', 'akismet' ), $code ); ?></strong></p>
|
32 |
<p><?php echo esc_html( $msg ); ?></p>
|
38 |
?>
|
39 |
</p>
|
40 |
</div>
|
41 |
+
<?php elseif ( $type == 'notice' ) : ?>
|
42 |
<div class="akismet-alert akismet-critical">
|
43 |
<h3 class="akismet-key-status failed"><?php echo $notice_header; ?></h3>
|
44 |
<p class="akismet-description">
|
45 |
<?php echo $notice_text; ?>
|
46 |
</p>
|
47 |
</div>
|
48 |
+
<?php elseif ( $type == 'missing-functions' ) : ?>
|
49 |
<div class="akismet-alert akismet-critical">
|
50 |
<h3 class="akismet-key-status failed"><?php esc_html_e('Network functions are disabled.', 'akismet'); ?></h3>
|
51 |
<p class="akismet-description"><?php printf( __('Your web host or server administrator has disabled PHP’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’s system requirements</a>.', 'akismet'), 'https://blog.akismet.com/akismet-hosting-faq/'); ?></p>
|
52 |
</div>
|
53 |
+
<?php elseif ( $type == 'servers-be-down' ) : ?>
|
54 |
<div class="akismet-alert akismet-critical">
|
55 |
<h3 class="akismet-key-status failed"><?php esc_html_e("Your site can’t connect to the Akismet servers.", 'akismet'); ?></h3>
|
56 |
<p class="akismet-description"><?php printf( __('Your firewall may be blocking Akismet from connecting to its API. 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>
|
57 |
</div>
|
58 |
+
<?php elseif ( $type == 'active-dunning' ) : ?>
|
59 |
<div class="akismet-alert akismet-critical">
|
60 |
<h3 class="akismet-key-status"><?php esc_html_e("Please update your payment information.", 'akismet'); ?></h3>
|
61 |
<p class="akismet-description"><?php printf( __('We cannot process your payment. Please <a href="%s" target="_blank">update your payment details</a>.', 'akismet'), 'https://akismet.com/account/'); ?></p>
|
62 |
</div>
|
63 |
+
<?php elseif ( $type == 'cancelled' ) : ?>
|
64 |
<div class="akismet-alert akismet-critical">
|
65 |
<h3 class="akismet-key-status"><?php esc_html_e("Your Akismet plan has been cancelled.", 'akismet'); ?></h3>
|
66 |
<p class="akismet-description"><?php printf( __('Please visit your <a href="%s" target="_blank">Akismet account page</a> to reactivate your subscription.', 'akismet'), 'https://akismet.com/account/'); ?></p>
|
67 |
</div>
|
68 |
+
<?php elseif ( $type == 'suspended' ) : ?>
|
69 |
<div class="akismet-alert akismet-critical">
|
70 |
<h3 class="akismet-key-status failed"><?php esc_html_e("Your Akismet subscription is suspended.", 'akismet'); ?></h3>
|
71 |
<p class="akismet-description"><?php printf( __('Please contact <a href="%s" target="_blank">Akismet support</a> for assistance.', 'akismet'), 'https://akismet.com/contact/'); ?></p>
|
72 |
</div>
|
73 |
+
<?php elseif ( $type == 'active-notice' && $time_saved ) : ?>
|
74 |
<div class="akismet-alert akismet-active">
|
75 |
<h3 class="akismet-key-status"><?php echo esc_html( $time_saved ); ?></h3>
|
76 |
<p class="akismet-description"><?php printf( __('You can help us fight spam and upgrade your account by <a href="%s" target="_blank">contributing a token amount</a>.', 'akismet'), 'https://akismet.com/account/upgrade/'); ?></p>
|
77 |
</div>
|
78 |
+
<?php elseif ( $type == 'missing' ) : ?>
|
79 |
<div class="akismet-alert akismet-critical">
|
80 |
<h3 class="akismet-key-status failed"><?php esc_html_e( 'There is a problem with your API key.', 'akismet'); ?></h3>
|
81 |
<p class="akismet-description"><?php printf( __('Please contact <a href="%s" target="_blank">Akismet support</a> for assistance.', 'akismet'), 'https://akismet.com/contact/'); ?></p>
|
82 |
</div>
|
83 |
+
<?php elseif ( $type == 'no-sub' ) : ?>
|
84 |
<div class="akismet-alert akismet-critical">
|
85 |
<h3 class="akismet-key-status failed"><?php esc_html_e( 'You don’t have an Akismet plan.', 'akismet'); ?></h3>
|
86 |
<p class="akismet-description">
|
107 |
<p class="akismet-description"><?php printf( __( 'Would you like to <a href="%s">check pending comments</a>?', 'akismet' ), esc_url( $check_pending_link ) ); ?></p>
|
108 |
<?php } ?>
|
109 |
</div>
|
110 |
+
<?php elseif ( $type == 'new-key-invalid' ) : ?>
|
111 |
<div class="akismet-alert akismet-critical">
|
112 |
<h3 class="akismet-key-status"><?php esc_html_e( 'The key you entered is invalid. Please double-check it.' , 'akismet'); ?></h3>
|
113 |
</div>
|
114 |
+
<?php elseif ( $type == 'existing-key-invalid' ) : ?>
|
115 |
<div class="akismet-alert akismet-critical">
|
116 |
+
<h3 class="akismet-key-status"><?php echo esc_html( __( 'Your API key is no longer valid.', 'akismet' ) ); ?></h3>
|
117 |
+
<p class="akismet-description">
|
118 |
+
<?php
|
119 |
+
|
120 |
+
echo wp_kses(
|
121 |
+
sprintf(
|
122 |
+
/* translators: The placeholder is a URL. */
|
123 |
+
__( 'Please enter a new key or <a href="%s" target="_blank">contact Akismet support</a>.', 'akismet' ),
|
124 |
+
'https://akismet.com/contact/'
|
125 |
+
),
|
126 |
+
array(
|
127 |
+
'a' => array(
|
128 |
+
'href' => true,
|
129 |
+
'target' => true,
|
130 |
+
),
|
131 |
+
)
|
132 |
+
);
|
133 |
+
|
134 |
+
?>
|
135 |
+
</p>
|
136 |
</div>
|
137 |
+
<?php elseif ( $type == 'new-key-failed' ) : ?>
|
138 |
<div class="akismet-alert akismet-critical">
|
139 |
<h3 class="akismet-key-status"><?php esc_html_e( 'The API key you entered could not be verified.' , 'akismet'); ?></h3>
|
140 |
+
<p class="akismet-description">
|
141 |
+
<?php
|
142 |
+
|
143 |
+
echo wp_kses(
|
144 |
+
sprintf(
|
145 |
+
/* translators: The placeholder is a URL. */
|
146 |
+
__( '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' ),
|
147 |
+
'https://blog.akismet.com/akismet-hosting-faq/'
|
148 |
+
),
|
149 |
+
array(
|
150 |
+
'a' => array(
|
151 |
+
'href' => true,
|
152 |
+
'target' => true,
|
153 |
+
),
|
154 |
+
)
|
155 |
+
);
|
156 |
+
|
157 |
+
?>
|
158 |
+
</p>
|
159 |
</div>
|
160 |
+
<?php elseif ( $type == 'limit-reached' && in_array( $level, array( 'yellow', 'red' ) ) ) : ?>
|
161 |
<div class="akismet-alert akismet-critical">
|
162 |
<?php if ( $level == 'yellow' ): ?>
|
163 |
<h3 class="akismet-key-status failed"><?php esc_html_e( 'You’re using your Akismet key on more sites than your Plus subscription allows.', 'akismet' ); ?></h3>
|
164 |
<p class="akismet-description">
|
165 |
+
<?php
|
166 |
+
|
167 |
+
echo wp_kses(
|
168 |
+
sprintf(
|
169 |
+
/* translators: The placeholder is a URL. */
|
170 |
+
__( 'Your Plus subscription allows the use of Akismet on only one site. Please <a href="%s" target="_blank">purchase additional Plus subscriptions</a> or upgrade to an Enterprise subscription that allows the use of Akismet on unlimited sites.', 'akismet' ),
|
171 |
+
'https://docs.akismet.com/billing/add-more-sites/'
|
172 |
+
),
|
173 |
+
array(
|
174 |
+
'a' => array(
|
175 |
+
'href' => true,
|
176 |
+
'target' => true,
|
177 |
+
),
|
178 |
+
)
|
179 |
+
);
|
180 |
+
|
181 |
+
?>
|
182 |
<br /><br />
|
183 |
<?php printf( __( 'Please <a href="%s" target="_blank">contact our support team</a> with any questions.', 'akismet' ), 'https://akismet.com/contact/'); ?>
|
184 |
</p>
|
191 |
</p>
|
192 |
<?php endif; ?>
|
193 |
</div>
|
194 |
+
<?php elseif ( $type == 'usage-limit' && isset( Akismet::$limit_notices[ $code ] ) ) : ?>
|
195 |
<div class="error akismet-usage-limit-alert">
|
196 |
<div class="akismet-usage-limit-logo">
|
197 |
<img src="<?php echo esc_url( plugins_url( '../_inc/img/logo-a-2x.png', __FILE__ ) ); ?>" alt="Akismet" />
|
199 |
<div class="akismet-usage-limit-text">
|
200 |
<h3>
|
201 |
<?php
|
202 |
+
switch ( Akismet::$limit_notices[ $code ] ) {
|
203 |
case 'FIRST_MONTH_OVER_LIMIT':
|
204 |
case 'SECOND_MONTH_OVER_LIMIT':
|
205 |
+
esc_html_e( 'Your Akismet account usage is over your plan’s limit', 'akismet' );
|
206 |
break;
|
207 |
case 'THIRD_MONTH_APPROACHING_LIMIT':
|
208 |
+
esc_html_e( 'Your Akismet account usage is approaching your plan’s limit', 'akismet' );
|
209 |
break;
|
210 |
case 'THIRD_MONTH_OVER_LIMIT':
|
211 |
case 'FOUR_PLUS_MONTHS_OVER_LIMIT':
|
217 |
</h3>
|
218 |
<p>
|
219 |
<?php
|
220 |
+
switch ( Akismet::$limit_notices[ $code ] ) {
|
221 |
case 'FIRST_MONTH_OVER_LIMIT':
|
222 |
+
echo esc_html(
|
223 |
+
sprintf(
|
224 |
+
/* translators: The first placeholder is a date, the second is a (formatted) number, the third is another formatted number. */
|
225 |
+
__( 'Since %1$s, your account made %2$s API calls, compared to your plan’s limit of %3$s.', 'akismet' ),
|
226 |
+
esc_html( gmdate( 'F' ) . ' 1' ),
|
227 |
+
number_format( $api_calls ),
|
228 |
+
number_format( $usage_limit )
|
229 |
+
)
|
230 |
);
|
231 |
+
|
232 |
+
echo '<a href="https://docs.akismet.com/akismet-api-usage-limits/" target="_blank">';
|
233 |
+
echo esc_html( __( 'Learn more about usage limits.', 'akismet' ) );
|
234 |
+
echo '</a>';
|
235 |
+
|
236 |
break;
|
237 |
case 'SECOND_MONTH_OVER_LIMIT':
|
238 |
+
echo esc_html( __( 'Your Akismet usage has been over your plan’s limit for two consecutive months. Next month, we will restrict your account after you reach the limit. Please consider upgrading your plan.', 'akismet' ) );
|
239 |
+
|
240 |
+
echo '<a href="https://docs.akismet.com/akismet-api-usage-limits/" target="_blank">';
|
241 |
+
echo esc_html( __( 'Learn more about usage limits.', 'akismet' ) );
|
242 |
+
echo '</a>';
|
243 |
+
|
244 |
break;
|
245 |
case 'THIRD_MONTH_APPROACHING_LIMIT':
|
246 |
+
echo esc_html( __( 'Your Akismet usage is nearing your plan’s limit for the third consecutive month. We will restrict your account after you reach the limit. Upgrade your plan so Akismet can continue blocking spam.', 'akismet' ) );
|
247 |
+
|
248 |
+
echo '<a href="https://docs.akismet.com/akismet-api-usage-limits/" target="_blank">';
|
249 |
+
echo esc_html( __( 'Learn more about usage limits.', 'akismet' ) );
|
250 |
+
echo '</a>';
|
251 |
+
|
252 |
break;
|
253 |
case 'THIRD_MONTH_OVER_LIMIT':
|
254 |
case 'FOUR_PLUS_MONTHS_OVER_LIMIT':
|
255 |
+
echo esc_html( __( 'Your Akismet usage has been over your plan’s limit for three consecutive months. We have restricted your account for the rest of the month. Upgrade your plan so Akismet can continue blocking spam.', 'akismet' ) );
|
256 |
+
|
257 |
+
echo '<a href="https://docs.akismet.com/akismet-api-usage-limits/" target="_blank">';
|
258 |
+
echo esc_html( __( 'Learn more about usage limits.', 'akismet' ) );
|
259 |
+
echo '</a>';
|
260 |
+
|
261 |
break;
|
262 |
default:
|
263 |
}
|
265 |
</p>
|
266 |
</div>
|
267 |
<div class="akismet-usage-limit-cta">
|
268 |
+
<a href="<?php echo esc_attr( $upgrade_url ); ?>" class="button" target="_blank">
|
269 |
+
<?php
|
270 |
+
// If only a qty upgrade is required, show a more generic message.
|
271 |
+
if ( ! empty( $upgrade_type ) && 'qty' === $upgrade_type ) {
|
272 |
+
esc_html_e( 'Upgrade your Subscription Level', 'akismet' );
|
273 |
+
} else {
|
274 |
+
echo esc_html(
|
275 |
+
sprintf(
|
276 |
+
/* translators: The placeholder is the name of a subscription level, like "Plus" or "Enterprise" . */
|
277 |
+
__( 'Upgrade to %s', 'akismet' ),
|
278 |
+
$upgrade_plan
|
279 |
+
)
|
280 |
+
);
|
281 |
+
}
|
282 |
+
?>
|
283 |
+
</a>
|
284 |
</div>
|
285 |
</div>
|
286 |
+
<?php endif; ?>
|