Akismet Anti-Spam - Version 4.2.4

Version Description

Release Date - 20 May 2022

  • Improved translator instructions for comment history.
  • Bumped the "Tested up to" tag to WP 6.0.
Download this release

Release Info

Developer stephdau
Plugin Icon 128x128 Akismet Anti-Spam
Version 4.2.4
Comparing to
See all releases

Code changes from version 4.2.3 to 4.2.4

Files changed (3) hide show
  1. akismet.php +2 -2
  2. class.akismet-admin.php +98 -84
  3. readme.txt +8 -2
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.2.3
10
  Author: Automattic
11
  Author URI: https://automattic.com/wordpress-plugins/
12
  License: GPLv2 or later
@@ -37,7 +37,7 @@ if ( !function_exists( 'add_action' ) ) {
37
  exit;
38
  }
39
 
40
- define( 'AKISMET_VERSION', '4.2.3' );
41
  define( 'AKISMET__MINIMUM_WP_VERSION', '5.0' );
42
  define( 'AKISMET__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
43
  define( 'AKISMET_DELETE_LIMIT', 10000 );
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.4
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.4' );
41
  define( 'AKISMET__MINIMUM_WP_VERSION', '5.0' );
42
  define( 'AKISMET__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
43
  define( 'AKISMET_DELETE_LIMIT', 10000 );
class.akismet-admin.php CHANGED
@@ -584,10 +584,8 @@ class Akismet_Admin {
584
 
585
  if ( $history ) {
586
  foreach ( $history as $row ) {
587
- $time = date( 'D d M Y @ h:i:s a', $row['time'] ) . ' GMT';
588
-
589
  $message = '';
590
-
591
  if ( ! empty( $row['message'] ) ) {
592
  // Old versions of Akismet stored the message as a literal string in the commentmeta.
593
  // New versions don't do that for two reasons:
@@ -595,96 +593,112 @@ class Akismet_Admin {
595
  // 2) The message can be translated into the current language of the blog, not stuck
596
  // in the language of the blog when the comment was made.
597
  $message = esc_html( $row['message'] );
598
- }
599
-
600
- // If possible, use a current translation.
601
- switch ( $row['event'] ) {
602
- case 'recheck-spam';
603
- $message = esc_html( __( 'Akismet re-checked and caught this comment as spam.', 'akismet' ) );
604
- break;
605
- case 'check-spam':
606
- $message = esc_html( __( 'Akismet caught this comment as spam.', 'akismet' ) );
607
- break;
608
- case 'recheck-ham':
609
- $message = esc_html( __( 'Akismet re-checked and cleared this comment.', 'akismet' ) );
610
- break;
611
- case 'check-ham':
612
- $message = esc_html( __( 'Akismet cleared this comment.', 'akismet' ) );
613
- break;
614
- case 'wp-blacklisted':
615
- case 'wp-disallowed':
616
- $message = sprintf(
617
- /* translators: The placeholder is a WordPress PHP function name. */
618
- esc_html( __( 'Comment was caught by %s.', 'akismet' ) ),
619
- function_exists( 'wp_check_comment_disallowed_list' ) ? '<code>wp_check_comment_disallowed_list</code>' : '<code>wp_blacklist_check</code>'
620
- );
621
- break;
622
- case 'report-spam':
623
- if ( isset( $row['user'] ) ) {
624
- $message = esc_html( sprintf( __( '%s reported this comment as spam.', 'akismet' ), $row['user'] ) );
625
- }
626
- else if ( ! $message ) {
627
- $message = esc_html( __( 'This comment was reported as spam.', 'akismet' ) );
628
- }
629
- break;
630
- case 'report-ham':
631
- if ( isset( $row['user'] ) ) {
632
- $message = esc_html( sprintf( __( '%s reported this comment as not spam.', 'akismet' ), $row['user'] ) );
633
- }
634
- else if ( ! $message ) {
635
- $message = esc_html( __( 'This comment was reported as not spam.', 'akismet' ) );
636
- }
637
- break;
638
- case 'cron-retry-spam':
639
- $message = esc_html( __( 'Akismet caught this comment as spam during an automatic retry.' , 'akismet') );
640
- break;
641
- case 'cron-retry-ham':
642
- $message = esc_html( __( 'Akismet cleared this comment during an automatic retry.', 'akismet') );
643
- break;
644
- case 'check-error':
645
- if ( isset( $row['meta'], $row['meta']['response'] ) ) {
646
- $message = sprintf( esc_html( __( 'Akismet was unable to check this comment (response: %s) but will automatically retry later.', 'akismet') ), '<code>' . esc_html( $row['meta']['response'] ) . '</code>' );
647
- }
648
- else {
649
- $message = esc_html( __( 'Akismet was unable to check this comment but will automatically retry later.', 'akismet' ) );
650
- }
651
- break;
652
- case 'recheck-error':
653
- if ( isset( $row['meta'], $row['meta']['response'] ) ) {
654
- $message = sprintf( esc_html( __( 'Akismet was unable to recheck this comment (response: %s).', 'akismet') ), '<code>' . esc_html( $row['meta']['response'] ) . '</code>' );
655
- }
656
- else {
657
- $message = esc_html( __( 'Akismet was unable to recheck this comment.', 'akismet' ) );
658
- }
659
- break;
660
- default:
661
- if ( preg_match( '/^status-changed/', $row['event'] ) ) {
662
- // Half of these used to be saved without the dash after 'status-changed'.
663
- // See https://plugins.trac.wordpress.org/changeset/1150658/akismet/trunk
664
- $new_status = preg_replace( '/^status-changed-?/', '', $row['event'] );
665
- $message = sprintf( esc_html( __( 'Comment status was changed to %s', 'akismet' ) ), '<code>' . esc_html( $new_status ) . '</code>' );
666
- }
667
- else if ( preg_match( '/^status-/', $row['event'] ) ) {
668
- $new_status = preg_replace( '/^status-/', '', $row['event'] );
669
-
670
  if ( isset( $row['user'] ) ) {
671
- $message = sprintf( esc_html( __( '%1$s changed the comment status to %2$s.', 'akismet' ) ), $row['user'], '<code>' . esc_html( $new_status ) . '</code>' );
 
 
 
672
  }
673
- }
674
- break;
675
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
676
  }
677
 
678
  if ( ! empty( $message ) ) {
679
  echo '<p>';
680
- echo '<span style="color: #999;" alt="' . $time . '" title="' . $time . '">' . sprintf( esc_html__('%s ago', 'akismet'), human_time_diff( $row['time'] ) ) . '</span>';
681
- echo ' - ';
682
- echo $message; // esc_html() is done above so that we can use HTML in some messages.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
683
  echo '</p>';
684
  }
685
  }
686
- }
687
- else {
688
  echo '<p>';
689
  echo esc_html( __( 'No comment history.', 'akismet' ) );
690
  echo '</p>';
584
 
585
  if ( $history ) {
586
  foreach ( $history as $row ) {
 
 
587
  $message = '';
588
+
589
  if ( ! empty( $row['message'] ) ) {
590
  // Old versions of Akismet stored the message as a literal string in the commentmeta.
591
  // New versions don't do that for two reasons:
593
  // 2) The message can be translated into the current language of the blog, not stuck
594
  // in the language of the blog when the comment was made.
595
  $message = esc_html( $row['message'] );
596
+ } else if ( ! empty( $row['event'] ) ) {
597
+ // If possible, use a current translation.
598
+ switch ( $row['event'] ) {
599
+ case 'recheck-spam':
600
+ $message = esc_html( __( 'Akismet re-checked and caught this comment as spam.', 'akismet' ) );
601
+ break;
602
+ case 'check-spam':
603
+ $message = esc_html( __( 'Akismet caught this comment as spam.', 'akismet' ) );
604
+ break;
605
+ case 'recheck-ham':
606
+ $message = esc_html( __( 'Akismet re-checked and cleared this comment.', 'akismet' ) );
607
+ break;
608
+ case 'check-ham':
609
+ $message = esc_html( __( 'Akismet cleared this comment.', 'akismet' ) );
610
+ break;
611
+ case 'wp-blacklisted':
612
+ case 'wp-disallowed':
613
+ $message = sprintf(
614
+ /* translators: The placeholder is a WordPress PHP function name. */
615
+ esc_html( __( 'Comment was caught by %s.', 'akismet' ) ),
616
+ function_exists( 'wp_check_comment_disallowed_list' ) ? '<code>wp_check_comment_disallowed_list</code>' : '<code>wp_blacklist_check</code>'
617
+ );
618
+ break;
619
+ case 'report-spam':
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
620
  if ( isset( $row['user'] ) ) {
621
+ /* translators: The placeholder is a username. */
622
+ $message = esc_html( sprintf( __( '%s reported this comment as spam.', 'akismet' ), $row['user'] ) );
623
+ } else if ( ! $message ) {
624
+ $message = esc_html( __( 'This comment was reported as spam.', 'akismet' ) );
625
  }
626
+ break;
627
+ case 'report-ham':
628
+ if ( isset( $row['user'] ) ) {
629
+ /* translators: The placeholder is a username. */
630
+ $message = esc_html( sprintf( __( '%s reported this comment as not spam.', 'akismet' ), $row['user'] ) );
631
+ } else if ( ! $message ) {
632
+ $message = esc_html( __( 'This comment was reported as not spam.', 'akismet' ) );
633
+ }
634
+ break;
635
+ case 'cron-retry-spam':
636
+ $message = esc_html( __( 'Akismet caught this comment as spam during an automatic retry.', 'akismet' ) );
637
+ break;
638
+ case 'cron-retry-ham':
639
+ $message = esc_html( __( 'Akismet cleared this comment during an automatic retry.', 'akismet' ) );
640
+ break;
641
+ case 'check-error':
642
+ if ( isset( $row['meta'], $row['meta']['response'] ) ) {
643
+ /* translators: The placeholder is an error response returned by the API server. */
644
+ $message = sprintf( esc_html( __( 'Akismet was unable to check this comment (response: %s) but will automatically retry later.', 'akismet' ) ), '<code>' . esc_html( $row['meta']['response'] ) . '</code>' );
645
+ } else {
646
+ $message = esc_html( __( 'Akismet was unable to check this comment but will automatically retry later.', 'akismet' ) );
647
+ }
648
+ break;
649
+ case 'recheck-error':
650
+ if ( isset( $row['meta'], $row['meta']['response'] ) ) {
651
+ /* translators: The placeholder is an error response returned by the API server. */
652
+ $message = sprintf( esc_html( __( 'Akismet was unable to recheck this comment (response: %s).', 'akismet' ) ), '<code>' . esc_html( $row['meta']['response'] ) . '</code>' );
653
+ } else {
654
+ $message = esc_html( __( 'Akismet was unable to recheck this comment.', 'akismet' ) );
655
+ }
656
+ break;
657
+ default:
658
+ if ( preg_match( '/^status-changed/', $row['event'] ) ) {
659
+ // Half of these used to be saved without the dash after 'status-changed'.
660
+ // See https://plugins.trac.wordpress.org/changeset/1150658/akismet/trunk
661
+ $new_status = preg_replace( '/^status-changed-?/', '', $row['event'] );
662
+ /* translators: The placeholder is a short string (like 'spam' or 'approved') denoting the new comment status. */
663
+ $message = sprintf( esc_html( __( 'Comment status was changed to %s', 'akismet' ) ), '<code>' . esc_html( $new_status ) . '</code>' );
664
+ } else if ( preg_match( '/^status-/', $row['event'] ) ) {
665
+ $new_status = preg_replace( '/^status-/', '', $row['event'] );
666
+
667
+ if ( isset( $row['user'] ) ) {
668
+ /* translators: %1$s is a username; %2$s is a short string (like 'spam' or 'approved') denoting the new comment status. */
669
+ $message = sprintf( esc_html( __( '%1$s changed the comment status to %2$s.', 'akismet' ) ), $row['user'], '<code>' . esc_html( $new_status ) . '</code>' );
670
+ }
671
+ }
672
+ break;
673
+ }
674
  }
675
 
676
  if ( ! empty( $message ) ) {
677
  echo '<p>';
678
+
679
+ if ( isset( $row['time'] ) ) {
680
+ $time = gmdate( 'D d M Y @ h:i:s a', $row['time'] ) . ' GMT';
681
+
682
+ /* translators: The placeholder is an amount of time, like "7 seconds" or "3 days" returned by the function human_time_diff(). */
683
+ $time_html = '<span style="color: #999;" alt="' . esc_attr( $time ) . '" title="' . esc_attr( $time ) . '">' . sprintf( esc_html__( '%s ago', 'akismet' ), human_time_diff( $row['time'] ) ) . '</span>';
684
+
685
+ echo sprintf(
686
+ /* translators: %1$s is a human-readable time difference, like "3 hours ago", and %2$s is an already-translated phrase describing how a comment's status changed, like "This comment was reported as spam." */
687
+ esc_html( __( '%1$s - %2$s', 'akismet' ) ),
688
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
689
+ $time_html,
690
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
691
+ $message
692
+ ); // esc_html() is done above so that we can use HTML in $message.
693
+ } else {
694
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
695
+ echo $message; // esc_html() is done above so that we can use HTML in $message.
696
+ }
697
+
698
  echo '</p>';
699
  }
700
  }
701
+ } else {
 
702
  echo '<p>';
703
  echo esc_html( __( 'No comment history.', 'akismet' ) );
704
  echo '</p>';
readme.txt CHANGED
@@ -2,8 +2,8 @@
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.9
6
- Stable tag: 4.2.3
7
  License: GPLv2 or later
8
 
9
  The best anti-spam protection to block spam comments and spam in a contact form. The most trusted antispam solution for WordPress and WooCommerce.
@@ -30,6 +30,12 @@ Upload the Akismet plugin to your blog, activate it, and then enter your Akismet
30
 
31
  == Changelog ==
32
 
 
 
 
 
 
 
33
  = 4.2.3 =
34
  *Release Date - 25 April 2022*
35
 
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: 6.0
6
+ Stable tag: 4.2.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
 
31
  == Changelog ==
32
 
33
+ = 4.2.4 =
34
+ *Release Date - 20 May 2022*
35
+
36
+ * Improved translator instructions for comment history.
37
+ * Bumped the "Tested up to" tag to WP 6.0.
38
+
39
  = 4.2.3 =
40
  *Release Date - 25 April 2022*
41