* [gentoo-commits] proj/blogs-gentoo:master commit in: plugins/akismet/views/, plugins/akismet/
@ 2017-12-26 9:12 Anthony G. Basile
0 siblings, 0 replies; 3+ messages in thread
From: Anthony G. Basile @ 2017-12-26 9:12 UTC (permalink / raw
To: gentoo-commits
commit: 818606f5cc969538a23e2029312685b36f79eac7
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 26 09:12:07 2017 +0000
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Tue Dec 26 09:12:07 2017 +0000
URL: https://gitweb.gentoo.org/proj/blogs-gentoo.git/commit/?id=818606f5
Update akismet 4.0.2
plugins/akismet/akismet.php | 4 ++--
plugins/akismet/class.akismet-admin.php | 22 ++++++++++++++++++----
plugins/akismet/class.akismet.php | 8 +++++++-
plugins/akismet/readme.txt | 10 ++++++++--
plugins/akismet/views/notice.php | 2 +-
5 files changed, 36 insertions(+), 10 deletions(-)
diff --git a/plugins/akismet/akismet.php b/plugins/akismet/akismet.php
index c29057e..9e24901 100644
--- a/plugins/akismet/akismet.php
+++ b/plugins/akismet/akismet.php
@@ -6,7 +6,7 @@
Plugin Name: Akismet Anti-Spam
Plugin URI: https://akismet.com/
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.
-Version: 4.0.1
+Version: 4.0.2
Author: Automattic
Author URI: https://automattic.com/wordpress-plugins/
License: GPLv2 or later
@@ -37,7 +37,7 @@ if ( !function_exists( 'add_action' ) ) {
exit;
}
-define( 'AKISMET_VERSION', '4.0.1' );
+define( 'AKISMET_VERSION', '4.0.2' );
define( 'AKISMET__MINIMUM_WP_VERSION', '4.0' );
define( 'AKISMET__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'AKISMET_DELETE_LIMIT', 100000 );
diff --git a/plugins/akismet/class.akismet-admin.php b/plugins/akismet/class.akismet-admin.php
index 926b3c7..42e884f 100644
--- a/plugins/akismet/class.akismet-admin.php
+++ b/plugins/akismet/class.akismet-admin.php
@@ -725,9 +725,23 @@ class Akismet_Admin {
return self::check_server_connectivity( $cache_timeout );
}
- public static function get_number_spam_waiting() {
- global $wpdb;
- return (int) $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->commentmeta} WHERE meta_key = 'akismet_error'" );
+ /**
+ * Find out whether any comments in the Pending queue have not yet been checked by Akismet.
+ *
+ * @return bool
+ */
+ public static function are_any_comments_waiting_to_be_checked() {
+ return !! get_comments( array(
+ // Exclude comments that are not pending. This would happen if someone manually approved or spammed a comment
+ // that was waiting to be checked. The akismet_error meta entry will eventually be removed by the cron recheck job.
+ 'status' => 'hold',
+
+ // This is the commentmeta that is saved when a comment couldn't be checked.
+ 'meta_key' => 'akismet_error',
+
+ // We only need to know whether at least one comment is waiting for a check.
+ 'number' => 1,
+ ) );
}
public static function get_page_url( $page = 'config' ) {
@@ -814,7 +828,7 @@ class Akismet_Admin {
public static function display_spam_check_warning() {
Akismet::fix_scheduled_recheck();
- if ( wp_next_scheduled('akismet_schedule_cron_recheck') > time() && self::get_number_spam_waiting() > 0 ) {
+ if ( wp_next_scheduled('akismet_schedule_cron_recheck') > time() && self::are_any_comments_waiting_to_be_checked() ) {
$link_text = apply_filters( 'akismet_spam_check_warning_link_text', sprintf( __( 'Please check your <a href="%s">Akismet configuration</a> and contact your web host if problems persist.', 'akismet'), esc_url( self::get_page_url() ) ) );
Akismet::view( 'notice', array( 'type' => 'spam-check', 'link_text' => $link_text ) );
}
diff --git a/plugins/akismet/class.akismet.php b/plugins/akismet/class.akismet.php
index 32b23ea..867430f 100644
--- a/plugins/akismet/class.akismet.php
+++ b/plugins/akismet/class.akismet.php
@@ -701,7 +701,13 @@ class Akismet {
foreach ( (array) $comment_errors as $comment_id ) {
// if the comment no longer exists, or is too old, remove the meta entry from the queue to avoid getting stuck
$comment = get_comment( $comment_id );
- if ( !$comment || strtotime( $comment->comment_date_gmt ) < strtotime( "-15 days" ) ) {
+
+ if (
+ ! $comment // Comment has been deleted
+ || strtotime( $comment->comment_date_gmt ) < strtotime( "-15 days" ) // Comment is too old.
+ || $comment->comment_approved !== "0" // Comment is no longer in the Pending queue
+ ) {
+ echo "Deleting";
delete_comment_meta( $comment_id, 'akismet_error' );
delete_comment_meta( $comment_id, 'akismet_delayed_moderation_email' );
continue;
diff --git a/plugins/akismet/readme.txt b/plugins/akismet/readme.txt
index 0280880..40ca6ae 100644
--- a/plugins/akismet/readme.txt
+++ b/plugins/akismet/readme.txt
@@ -2,8 +2,8 @@
Contributors: matt, ryan, andy, mdawaffe, tellyworth, josephscott, lessbloat, eoigal, cfinke, automattic, jgs, procifer
Tags: akismet, comments, spam, antispam, anti-spam, anti spam, comment moderation, comment spam, contact form spam, spam comments
Requires at least: 4.0
-Tested up to: 4.9
-Stable tag: 4.0.1
+Tested up to: 4.9.1
+Stable tag: 4.0.2
License: GPLv2 or later
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,12 @@ Upload the Akismet plugin to your blog, Activate it, then enter your [Akismet.co
== Changelog ==
+= 4.0.2 =
+*Release Date - 18 December 2017*
+
+* Fixed a bug that could cause Akismet to recheck a comment that has already been manually approved or marked as spam.
+* Fixed a bug that could cause Akismet to claim that some comments are still waiting to be checked when no comments are waiting to be checked.
+
= 4.0.1 =
*Release Date - 6 November 2017*
diff --git a/plugins/akismet/views/notice.php b/plugins/akismet/views/notice.php
index 3b6236d..4f65b84 100644
--- a/plugins/akismet/views/notice.php
+++ b/plugins/akismet/views/notice.php
@@ -13,7 +13,7 @@
</form>
</div>
<?php elseif ( $type == 'spam-check' ) :?>
-<div id="akismet-warning" class="updated fade">
+<div class="notice notice-warning">
<p><strong><?php esc_html_e( 'Akismet has detected a problem.', 'akismet' );?></strong></p>
<p><?php printf( __( 'Some comments have not yet been checked for spam by Akismet. They have been temporarily held for moderation and will automatically be rechecked later.', 'akismet' ) ); ?></p>
<?php if ( $link_text ) { ?>
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [gentoo-commits] proj/blogs-gentoo:master commit in: plugins/akismet/views/, plugins/akismet/
@ 2018-07-12 14:39 Anthony G. Basile
0 siblings, 0 replies; 3+ messages in thread
From: Anthony G. Basile @ 2018-07-12 14:39 UTC (permalink / raw
To: gentoo-commits
commit: 0d8f300774678bf305af12410615c43fd751aaee
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 12 14:39:14 2018 +0000
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Thu Jul 12 14:39:14 2018 +0000
URL: https://gitweb.gentoo.org/proj/blogs-gentoo.git/commit/?id=0d8f3007
Update akismet 4.0.8
Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>
plugins/akismet/akismet.php | 4 ++--
plugins/akismet/class.akismet.php | 2 +-
plugins/akismet/readme.txt | 9 ++++++++-
plugins/akismet/views/config.php | 2 +-
plugins/akismet/views/notice.php | 2 +-
5 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/plugins/akismet/akismet.php b/plugins/akismet/akismet.php
index e16f888..d4f2135 100644
--- a/plugins/akismet/akismet.php
+++ b/plugins/akismet/akismet.php
@@ -6,7 +6,7 @@
Plugin Name: Akismet Anti-Spam
Plugin URI: https://akismet.com/
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.
-Version: 4.0.7
+Version: 4.0.8
Author: Automattic
Author URI: https://automattic.com/wordpress-plugins/
License: GPLv2 or later
@@ -37,7 +37,7 @@ if ( !function_exists( 'add_action' ) ) {
exit;
}
-define( 'AKISMET_VERSION', '4.0.7' );
+define( 'AKISMET_VERSION', '4.0.8' );
define( 'AKISMET__MINIMUM_WP_VERSION', '4.0' );
define( 'AKISMET__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'AKISMET_DELETE_LIMIT', 100000 );
diff --git a/plugins/akismet/class.akismet.php b/plugins/akismet/class.akismet.php
index 146c13c..3a1307f 100644
--- a/plugins/akismet/class.akismet.php
+++ b/plugins/akismet/class.akismet.php
@@ -1416,7 +1416,7 @@ p {
echo apply_filters(
'akismet_comment_form_privacy_notice_markup',
'<p class="akismet_comment_form_privacy_notice">' . sprintf(
- __( 'This site uses Akismet to reduce spam. <a href="%s" target="_blank">Learn how your comment data is processed</a>.', 'akismet' ),
+ __( 'This site uses Akismet to reduce spam. <a href="%s" target="_blank" rel="nofollow noopener">Learn how your comment data is processed</a>.', 'akismet' ),
'https://akismet.com/privacy/'
) . '</p>'
);
diff --git a/plugins/akismet/readme.txt b/plugins/akismet/readme.txt
index f6d67c1..4853f6f 100644
--- a/plugins/akismet/readme.txt
+++ b/plugins/akismet/readme.txt
@@ -3,7 +3,7 @@ Contributors: matt, ryan, andy, mdawaffe, tellyworth, josephscott, lessbloat, eo
Tags: akismet, comments, spam, antispam, anti-spam, anti spam, comment moderation, comment spam, contact form spam, spam comments
Requires at least: 4.0
Tested up to: 4.9.6
-Stable tag: 4.0.7
+Stable tag: 4.0.8
License: GPLv2 or later
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,13 @@ Upload the Akismet plugin to your blog, Activate it, then enter your [Akismet.co
== Changelog ==
+= 4.0.8 =
+*Release Date - 19 June 2018*
+
+* Improved the grammar and consistency of the in-admin privacy related notes (notice and config).
+* Revised in-admin explanation of the comment form privacy notice to make its usage clearer.
+* Added `rel="nofollow noopener"` to the comment form privacy notice to improve SEO and security.
+
= 4.0.7 =
*Release Date - 28 May 2018*
diff --git a/plugins/akismet/views/config.php b/plugins/akismet/views/config.php
index 53d9fa8..cc6fdd2 100644
--- a/plugins/akismet/views/config.php
+++ b/plugins/akismet/views/config.php
@@ -159,7 +159,7 @@
<p><label for="akismet_comment_form_privacy_notice_display"><input type="radio" name="akismet_comment_form_privacy_notice" id="akismet_comment_form_privacy_notice_display" value="display" <?php checked('display', get_option('akismet_comment_form_privacy_notice')); ?> /> <?php esc_html_e('Display a privacy notice under your comment forms.', 'akismet'); ?></label></p>
<p><label for="akismet_comment_form_privacy_notice_hide"><input type="radio" name="akismet_comment_form_privacy_notice" id="akismet_comment_form_privacy_notice_hide" value="hide" <?php echo in_array( get_option('akismet_comment_form_privacy_notice'), array('display', 'hide') ) ? checked('hide', get_option('akismet_comment_form_privacy_notice'), false) : 'checked="checked"'; ?> /> <?php esc_html_e('Do not display privacy notice.', 'akismet'); ?></label></p>
</fieldset>
- <span class="akismet-note"><?php esc_html_e( 'To help your site be compliant with GDPR and other laws requiring notification of tracking, Akismet can display a notice to your users on your contact form. This feature is disabled by default, however, if you or your audience is located in Europe, you need to turn it on.', 'akismet' );?></span>
+ <span class="akismet-note"><?php esc_html_e( 'To help your site with transparency under privacy laws like the GDPR, Akismet can display a notice to your users under your comment forms. This feature is disabled by default, however, you can turn it on above.', 'akismet' );?></span>
</td>
</tr>
</tbody>
diff --git a/plugins/akismet/views/notice.php b/plugins/akismet/views/notice.php
index 9f482b2..62476bd 100644
--- a/plugins/akismet/views/notice.php
+++ b/plugins/akismet/views/notice.php
@@ -135,7 +135,7 @@
<?php elseif ( $type == 'privacy' ) :?>
<div class="notice notice-warning is-dismissible" id="akismet-privacy-notice-admin-notice">
<p><strong><?php esc_html_e( 'Akismet & Privacy.', 'akismet' );?></strong></p>
- <p><?php esc_html_e( 'To help your site be compliant with GDPR and other laws requiring notification of tracking, Akismet can display a notice to your users under your comment forms. This feature is disabled by default, however, if you or your audience is located in Europe, you need to turn it on.', 'akismet' ); ?></p>
+ <p><?php esc_html_e( 'To help your site with transparency under privacy laws like the GDPR, Akismet can display a notice to your users under your comment forms. This feature is disabled by default, however, you can turn it on below.', 'akismet' ); ?></p>
<p><?php printf( __(' Please <a href="%s">enable</a> or <a href="%s">disable</a> this feature. <a href="%s" id="akismet-privacy-notice-control-notice-info-link" target="_blank">More information</a>.', 'akismet' ), admin_url( apply_filters( 'akismet_comment_form_privacy_notice_url_display', 'options-general.php?page=akismet-key-config&akismet_comment_form_privacy_notice=display' ) ), admin_url( apply_filters( 'akismet_comment_form_privacy_notice_url_hide', 'options-general.php?page=akismet-key-config&akismet_comment_form_privacy_notice=hide' ) ), 'https://akismet.com/privacy/' ); ?></p>
</div>
<?php endif;?>
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [gentoo-commits] proj/blogs-gentoo:master commit in: plugins/akismet/views/, plugins/akismet/
@ 2022-06-15 16:24 Yury German
0 siblings, 0 replies; 3+ messages in thread
From: Yury German @ 2022-06-15 16:24 UTC (permalink / raw
To: gentoo-commits
commit: d70aabe9576a2aa12d55e8649f04c3a853de902a
Author: Yury German <blueknight <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 15 16:23:54 2022 +0000
Commit: Yury German <blueknight <AT> gentoo <DOT> org>
CommitDate: Wed Jun 15 16:23:54 2022 +0000
URL: https://gitweb.gentoo.org/proj/blogs-gentoo.git/commit/?id=d70aabe9
update akismet 4.2.4
Signed-off-by: Yury German <blueknight <AT> gentoo.org>
plugins/akismet/akismet.php | 6 +-
plugins/akismet/class.akismet-admin.php | 184 +++++++++++++++++---------------
plugins/akismet/class.akismet.php | 80 +++++++++++---
plugins/akismet/readme.txt | 28 ++++-
plugins/akismet/views/config.php | 6 +-
plugins/akismet/views/connect-jp.php | 4 +-
plugins/akismet/views/get.php | 6 +-
plugins/akismet/views/stats.php | 2 +-
8 files changed, 203 insertions(+), 113 deletions(-)
diff --git a/plugins/akismet/akismet.php b/plugins/akismet/akismet.php
index 2175a913..e6b45ba7 100644
--- a/plugins/akismet/akismet.php
+++ b/plugins/akismet/akismet.php
@@ -6,7 +6,7 @@
Plugin Name: Akismet Anti-Spam
Plugin URI: https://akismet.com/
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.
-Version: 4.2.1
+Version: 4.2.4
Author: Automattic
Author URI: https://automattic.com/wordpress-plugins/
License: GPLv2 or later
@@ -37,10 +37,10 @@ if ( !function_exists( 'add_action' ) ) {
exit;
}
-define( 'AKISMET_VERSION', '4.2.1' );
+define( 'AKISMET_VERSION', '4.2.4' );
define( 'AKISMET__MINIMUM_WP_VERSION', '5.0' );
define( 'AKISMET__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
-define( 'AKISMET_DELETE_LIMIT', 100000 );
+define( 'AKISMET_DELETE_LIMIT', 10000 );
register_activation_hook( __FILE__, array( 'Akismet', 'plugin_activation' ) );
register_deactivation_hook( __FILE__, array( 'Akismet', 'plugin_deactivation' ) );
diff --git a/plugins/akismet/class.akismet-admin.php b/plugins/akismet/class.akismet-admin.php
index c6cb1355..3b6badfc 100644
--- a/plugins/akismet/class.akismet-admin.php
+++ b/plugins/akismet/class.akismet-admin.php
@@ -434,7 +434,7 @@ class Akismet_Admin {
if ( ! wp_verify_nonce( $_POST['nonce'], 'akismet_check_for_spam' ) ) {
wp_send_json( array(
- 'error' => __( "You don't have permission to do that."),
+ 'error' => __( 'You don’t have permission to do that.', 'akismet' ),
));
return;
}
@@ -584,10 +584,8 @@ class Akismet_Admin {
if ( $history ) {
foreach ( $history as $row ) {
- $time = date( 'D d M Y @ h:i:s a', $row['time'] ) . ' GMT';
-
$message = '';
-
+
if ( ! empty( $row['message'] ) ) {
// Old versions of Akismet stored the message as a literal string in the commentmeta.
// New versions don't do that for two reasons:
@@ -595,96 +593,112 @@ class Akismet_Admin {
// 2) The message can be translated into the current language of the blog, not stuck
// in the language of the blog when the comment was made.
$message = esc_html( $row['message'] );
- }
-
- // If possible, use a current translation.
- switch ( $row['event'] ) {
- case 'recheck-spam';
- $message = esc_html( __( 'Akismet re-checked and caught this comment as spam.', 'akismet' ) );
- break;
- case 'check-spam':
- $message = esc_html( __( 'Akismet caught this comment as spam.', 'akismet' ) );
- break;
- case 'recheck-ham':
- $message = esc_html( __( 'Akismet re-checked and cleared this comment.', 'akismet' ) );
- break;
- case 'check-ham':
- $message = esc_html( __( 'Akismet cleared this comment.', 'akismet' ) );
- break;
- case 'wp-blacklisted':
- case 'wp-disallowed':
- $message = sprintf(
- /* translators: The placeholder is a WordPress PHP function name. */
- esc_html( __( 'Comment was caught by %s.', 'akismet' ) ),
- function_exists( 'wp_check_comment_disallowed_list' ) ? '<code>wp_check_comment_disallowed_list</code>' : '<code>wp_blacklist_check</code>'
- );
- break;
- case 'report-spam':
- if ( isset( $row['user'] ) ) {
- $message = esc_html( sprintf( __( '%s reported this comment as spam.', 'akismet' ), $row['user'] ) );
- }
- else if ( ! $message ) {
- $message = esc_html( __( 'This comment was reported as spam.', 'akismet' ) );
- }
- break;
- case 'report-ham':
- if ( isset( $row['user'] ) ) {
- $message = esc_html( sprintf( __( '%s reported this comment as not spam.', 'akismet' ), $row['user'] ) );
- }
- else if ( ! $message ) {
- $message = esc_html( __( 'This comment was reported as not spam.', 'akismet' ) );
- }
- break;
- case 'cron-retry-spam':
- $message = esc_html( __( 'Akismet caught this comment as spam during an automatic retry.' , 'akismet') );
- break;
- case 'cron-retry-ham':
- $message = esc_html( __( 'Akismet cleared this comment during an automatic retry.', 'akismet') );
- break;
- case 'check-error':
- if ( isset( $row['meta'], $row['meta']['response'] ) ) {
- $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>' );
- }
- else {
- $message = esc_html( __( 'Akismet was unable to check this comment but will automatically retry later.', 'akismet' ) );
- }
- break;
- case 'recheck-error':
- if ( isset( $row['meta'], $row['meta']['response'] ) ) {
- $message = sprintf( esc_html( __( 'Akismet was unable to recheck this comment (response: %s).', 'akismet') ), '<code>' . esc_html( $row['meta']['response'] ) . '</code>' );
- }
- else {
- $message = esc_html( __( 'Akismet was unable to recheck this comment.', 'akismet' ) );
- }
- break;
- default:
- if ( preg_match( '/^status-changed/', $row['event'] ) ) {
- // Half of these used to be saved without the dash after 'status-changed'.
- // See https://plugins.trac.wordpress.org/changeset/1150658/akismet/trunk
- $new_status = preg_replace( '/^status-changed-?/', '', $row['event'] );
- $message = sprintf( esc_html( __( 'Comment status was changed to %s', 'akismet' ) ), '<code>' . esc_html( $new_status ) . '</code>' );
- }
- else if ( preg_match( '/^status-/', $row['event'] ) ) {
- $new_status = preg_replace( '/^status-/', '', $row['event'] );
-
+ } else if ( ! empty( $row['event'] ) ) {
+ // If possible, use a current translation.
+ switch ( $row['event'] ) {
+ case 'recheck-spam':
+ $message = esc_html( __( 'Akismet re-checked and caught this comment as spam.', 'akismet' ) );
+ break;
+ case 'check-spam':
+ $message = esc_html( __( 'Akismet caught this comment as spam.', 'akismet' ) );
+ break;
+ case 'recheck-ham':
+ $message = esc_html( __( 'Akismet re-checked and cleared this comment.', 'akismet' ) );
+ break;
+ case 'check-ham':
+ $message = esc_html( __( 'Akismet cleared this comment.', 'akismet' ) );
+ break;
+ case 'wp-blacklisted':
+ case 'wp-disallowed':
+ $message = sprintf(
+ /* translators: The placeholder is a WordPress PHP function name. */
+ esc_html( __( 'Comment was caught by %s.', 'akismet' ) ),
+ function_exists( 'wp_check_comment_disallowed_list' ) ? '<code>wp_check_comment_disallowed_list</code>' : '<code>wp_blacklist_check</code>'
+ );
+ break;
+ case 'report-spam':
if ( isset( $row['user'] ) ) {
- $message = sprintf( esc_html( __( '%1$s changed the comment status to %2$s.', 'akismet' ) ), $row['user'], '<code>' . esc_html( $new_status ) . '</code>' );
+ /* translators: The placeholder is a username. */
+ $message = esc_html( sprintf( __( '%s reported this comment as spam.', 'akismet' ), $row['user'] ) );
+ } else if ( ! $message ) {
+ $message = esc_html( __( 'This comment was reported as spam.', 'akismet' ) );
}
- }
- break;
-
+ break;
+ case 'report-ham':
+ if ( isset( $row['user'] ) ) {
+ /* translators: The placeholder is a username. */
+ $message = esc_html( sprintf( __( '%s reported this comment as not spam.', 'akismet' ), $row['user'] ) );
+ } else if ( ! $message ) {
+ $message = esc_html( __( 'This comment was reported as not spam.', 'akismet' ) );
+ }
+ break;
+ case 'cron-retry-spam':
+ $message = esc_html( __( 'Akismet caught this comment as spam during an automatic retry.', 'akismet' ) );
+ break;
+ case 'cron-retry-ham':
+ $message = esc_html( __( 'Akismet cleared this comment during an automatic retry.', 'akismet' ) );
+ break;
+ case 'check-error':
+ if ( isset( $row['meta'], $row['meta']['response'] ) ) {
+ /* translators: The placeholder is an error response returned by the API server. */
+ $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>' );
+ } else {
+ $message = esc_html( __( 'Akismet was unable to check this comment but will automatically retry later.', 'akismet' ) );
+ }
+ break;
+ case 'recheck-error':
+ if ( isset( $row['meta'], $row['meta']['response'] ) ) {
+ /* translators: The placeholder is an error response returned by the API server. */
+ $message = sprintf( esc_html( __( 'Akismet was unable to recheck this comment (response: %s).', 'akismet' ) ), '<code>' . esc_html( $row['meta']['response'] ) . '</code>' );
+ } else {
+ $message = esc_html( __( 'Akismet was unable to recheck this comment.', 'akismet' ) );
+ }
+ break;
+ default:
+ if ( preg_match( '/^status-changed/', $row['event'] ) ) {
+ // Half of these used to be saved without the dash after 'status-changed'.
+ // See https://plugins.trac.wordpress.org/changeset/1150658/akismet/trunk
+ $new_status = preg_replace( '/^status-changed-?/', '', $row['event'] );
+ /* translators: The placeholder is a short string (like 'spam' or 'approved') denoting the new comment status. */
+ $message = sprintf( esc_html( __( 'Comment status was changed to %s', 'akismet' ) ), '<code>' . esc_html( $new_status ) . '</code>' );
+ } else if ( preg_match( '/^status-/', $row['event'] ) ) {
+ $new_status = preg_replace( '/^status-/', '', $row['event'] );
+
+ if ( isset( $row['user'] ) ) {
+ /* translators: %1$s is a username; %2$s is a short string (like 'spam' or 'approved') denoting the new comment status. */
+ $message = sprintf( esc_html( __( '%1$s changed the comment status to %2$s.', 'akismet' ) ), $row['user'], '<code>' . esc_html( $new_status ) . '</code>' );
+ }
+ }
+ break;
+ }
}
if ( ! empty( $message ) ) {
echo '<p>';
- echo '<span style="color: #999;" alt="' . $time . '" title="' . $time . '">' . sprintf( esc_html__('%s ago', 'akismet'), human_time_diff( $row['time'] ) ) . '</span>';
- echo ' - ';
- echo $message; // esc_html() is done above so that we can use HTML in some messages.
+
+ if ( isset( $row['time'] ) ) {
+ $time = gmdate( 'D d M Y @ h:i:s a', $row['time'] ) . ' GMT';
+
+ /* translators: The placeholder is an amount of time, like "7 seconds" or "3 days" returned by the function human_time_diff(). */
+ $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>';
+
+ echo sprintf(
+ /* 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." */
+ esc_html( __( '%1$s - %2$s', 'akismet' ) ),
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
+ $time_html,
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
+ $message
+ ); // esc_html() is done above so that we can use HTML in $message.
+ } else {
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
+ echo $message; // esc_html() is done above so that we can use HTML in $message.
+ }
+
echo '</p>';
}
}
- }
- else {
+ } else {
echo '<p>';
echo esc_html( __( 'No comment history.', 'akismet' ) );
echo '</p>';
diff --git a/plugins/akismet/class.akismet.php b/plugins/akismet/class.akismet.php
index 1681d0e1..3ca53391 100644
--- a/plugins/akismet/class.akismet.php
+++ b/plugins/akismet/class.akismet.php
@@ -64,6 +64,14 @@ class Akismet {
add_filter( 'wpcf7_form_elements', array( 'Akismet', 'append_custom_form_fields' ) );
add_filter( 'wpcf7_akismet_parameters', array( 'Akismet', 'prepare_custom_form_values' ) );
+ // Formidable Forms
+ add_filter( 'frm_filter_final_form', array( 'Akismet', 'inject_custom_form_fields' ) );
+ add_filter( 'frm_akismet_values', array( 'Akismet', 'prepare_custom_form_values' ) );
+
+ // Fluent Forms
+ add_filter( 'fluentform_form_element_start', array( 'Akismet', 'output_custom_form_fields' ) );
+ add_filter( 'fluentform_akismet_fields', array( 'Akismet', 'prepare_custom_form_values' ), 10, 2 );
+
add_action( 'update_option_wordpress_api_key', array( 'Akismet', 'updated_option' ), 10, 2 );
add_action( 'add_option_wordpress_api_key', array( 'Akismet', 'added_option' ), 10, 2 );
@@ -410,8 +418,12 @@ class Akismet {
$wpdb->queries = array();
+ $comments = array();
+
foreach ( $comment_ids as $comment_id ) {
- do_action( 'delete_comment', $comment_id );
+ $comments[ $comment_id ] = get_comment( $comment_id );
+
+ do_action( 'delete_comment', $comment_id, $comments[ $comment_id ] );
do_action( 'akismet_batch_delete_count', __FUNCTION__ );
}
@@ -421,12 +433,13 @@ class Akismet {
$wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->comments} WHERE comment_id IN ( " . $format_string . " )", $comment_ids ) );
$wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->commentmeta} WHERE comment_id IN ( " . $format_string . " )", $comment_ids ) );
- clean_comment_cache( $comment_ids );
- do_action( 'akismet_delete_comment_batch', count( $comment_ids ) );
-
foreach ( $comment_ids as $comment_id ) {
- do_action( 'deleted_comment', $comment_id );
+ do_action( 'deleted_comment', $comment_id, $comments[ $comment_id ] );
+ unset( $comments[ $comment_id ] );
}
+
+ clean_comment_cache( $comment_ids );
+ do_action( 'akismet_delete_comment_batch', count( $comment_ids ) );
}
if ( apply_filters( 'akismet_optimize_table', ( mt_rand(1, 5000) == 11), $wpdb->comments ) ) // lucky number
@@ -504,11 +517,38 @@ class Akismet {
public static function get_user_comments_approved( $user_id, $comment_author_email, $comment_author, $comment_author_url ) {
global $wpdb;
- if ( !empty( $user_id ) )
- return (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->comments} WHERE user_id = %d AND comment_approved = 1", $user_id ) );
+ /**
+ * Which comment types should be ignored when counting a user's approved comments?
+ *
+ * Some plugins add entries to the comments table that are not actual
+ * comments that could have been checked by Akismet. Allow these comments
+ * to be excluded from the "approved comment count" query in order to
+ * avoid artificially inflating the approved comment count.
+ *
+ * @param array $comment_types An array of comment types that won't be considered
+ * when counting a user's approved comments.
+ *
+ * @since 4.2.2
+ */
+ $excluded_comment_types = apply_filters( 'akismet_excluded_comment_types', array() );
+
+ $comment_type_where = '';
- if ( !empty( $comment_author_email ) )
- return (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->comments} WHERE comment_author_email = %s AND comment_author = %s AND comment_author_url = %s AND comment_approved = 1", $comment_author_email, $comment_author, $comment_author_url ) );
+ if ( is_array( $excluded_comment_types ) && ! empty( $excluded_comment_types ) ) {
+ $excluded_comment_types = array_unique( $excluded_comment_types );
+
+ foreach ( $excluded_comment_types as $excluded_comment_type ) {
+ $comment_type_where .= $wpdb->prepare( ' AND comment_type <> %s ', $excluded_comment_type );
+ }
+ }
+
+ if ( ! empty( $user_id ) ) {
+ return (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->comments} WHERE user_id = %d AND comment_approved = 1" . $comment_type_where, $user_id ) );
+ }
+
+ if ( ! empty( $comment_author_email ) ) {
+ return (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->comments} WHERE comment_author_email = %s AND comment_author = %s AND comment_author_url = %s AND comment_approved = 1" . $comment_type_where, $comment_author_email, $comment_author, $comment_author_url ) );
+ }
return 0;
}
@@ -1327,8 +1367,14 @@ class Akismet {
$fields .= '<label>Δ<textarea name="' . $prefix . 'hp_textarea" cols="45" rows="8" maxlength="100"></textarea></label>';
if ( ! function_exists( 'amp_is_request' ) || ! amp_is_request() ) {
- $fields .= '<input type="hidden" id="ak_js" name="' . $prefix . 'js" value="' . mt_rand( 0, 250 ) . '"/>';
- $fields .= '<script>document.getElementById( "ak_js" ).setAttribute( "value", ( new Date() ).getTime() );</script>';
+ // Keep track of how many ak_js fields are in this page so that we don't re-use
+ // the same ID.
+ static $field_count = 0;
+
+ $field_count++;
+
+ $fields .= '<input type="hidden" id="ak_js_' . $field_count . '" name="' . $prefix . 'js" value="' . mt_rand( 0, 250 ) . '"/>';
+ $fields .= '<script>document.getElementById( "ak_js_' . $field_count . '" ).setAttribute( "value", ( new Date() ).getTime() );</script>';
}
$fields .= '</p>';
@@ -1357,9 +1403,16 @@ class Akismet {
* Ensure that any Akismet-added form fields are included in the comment-check call.
*
* @param array $form
+ * @param array $data Some plugins will supply the POST data via the filter, since they don't
+ * read it directly from $_POST.
* @return array $form
*/
- public static function prepare_custom_form_values( $form ) {
+ public static function prepare_custom_form_values( $form, $data = null ) {
+ if ( is_null( $data ) ) {
+ // phpcs:ignore WordPress.Security.NonceVerification.Missing
+ $data = $_POST;
+ }
+
$prefix = 'ak_';
// Contact Form 7 uses _wpcf7 as a prefix to know which fields to exclude from comment_content.
@@ -1367,8 +1420,7 @@ class Akismet {
$prefix = '_wpcf7_ak_';
}
- // phpcs:ignore WordPress.Security.NonceVerification.Missing
- foreach ( $_POST as $key => $val ) {
+ foreach ( $data as $key => $val ) {
if ( 0 === strpos( $key, $prefix ) ) {
$form[ 'POST_ak_' . substr( $key, strlen( $prefix ) ) ] = $val;
}
diff --git a/plugins/akismet/readme.txt b/plugins/akismet/readme.txt
index 0058c338..198e7933 100644
--- a/plugins/akismet/readme.txt
+++ b/plugins/akismet/readme.txt
@@ -2,8 +2,8 @@
Contributors: matt, ryan, andy, mdawaffe, tellyworth, josephscott, lessbloat, eoigal, cfinke, automattic, jgs, procifer, stephdau
Tags: comments, spam, antispam, anti-spam, contact form, anti spam, comment moderation, comment spam, contact form spam, spam comments
Requires at least: 5.0
-Tested up to: 5.8
-Stable tag: 4.2.1
+Tested up to: 6.0
+Stable tag: 4.2.4
License: GPLv2 or later
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,28 @@ Upload the Akismet plugin to your blog, activate it, and then enter your Akismet
== Changelog ==
+= 4.2.4 =
+*Release Date - 20 May 2022*
+
+* Improved translator instructions for comment history.
+* Bumped the "Tested up to" tag to WP 6.0.
+
+= 4.2.3 =
+*Release Date - 25 April 2022*
+
+* Improved compatibility with Fluent Forms
+* Fixed missing translation domains
+* Updated stats URL.
+* Improved accessibility of elements on the config page.
+
+= 4.2.2 =
+*Release Date - 24 January 2022*
+
+* Improved compatibility with Formidable Forms
+* Fixed a bug that could cause issues when multiple contact forms appear on one page.
+* Updated delete_comment and deleted_comment actions to pass two arguments to match WordPress core since 4.9.0.
+* Added a filter that allows comment types to be excluded when counting users' approved comments.
+
= 4.2.1 =
*Release Date - 1 October 2021*
@@ -85,6 +107,6 @@ Upload the Akismet plugin to your blog, activate it, and then enter your Akismet
*Release Date - 4 June 2020*
* Disable "Check for Spam" button until the page is loaded to avoid errors with clicking through to queue recheck endpoint directly.
-* Add filter "akismet_enable_mshots" to allow disabling screenshot popups on the edit comments admin page.
+* Added filter "akismet_enable_mshots" to allow disabling screenshot popups on the edit comments admin page.
For older changelog entries, please see the [additional changelog.txt file](https://plugins.svn.wordpress.org/akismet/trunk/changelog.txt) delivered with the plugin.
diff --git a/plugins/akismet/views/config.php b/plugins/akismet/views/config.php
index df24b91d..0aa1ac93 100644
--- a/plugins/akismet/views/config.php
+++ b/plugins/akismet/views/config.php
@@ -35,7 +35,7 @@
</div>
<div class="akismet-new-snapshot">
- <iframe allowtransparency="true" scrolling="no" frameborder="0" style="width: 100%; height: 220px; overflow: hidden;" src="<?php printf( '//akismet.com/web/1.0/snapshot.php?blog=%s&api_key=%s&height=200&locale=%s', urlencode( get_option( 'home' ) ), Akismet::get_api_key(), get_locale() );?>"></iframe>
+ <iframe allowtransparency="true" scrolling="no" frameborder="0" style="width: 100%; height: 220px; overflow: hidden;" src="<?php echo esc_url( sprintf( 'https://tools.akismet.com/1.0/snapshot.php?blog=%s&api_key=%s&height=200&locale=%s', urlencode( get_option( 'home' ) ), Akismet::get_api_key(), get_locale() ) ); ?>"></iframe>
<ul>
<li>
<h3><?php esc_html_e( 'Past six months' , 'akismet');?></h3>
@@ -73,7 +73,9 @@
<tbody>
<?php if ( ! Akismet::predefined_api_key() ) { ?>
<tr>
- <th class="akismet-api-key" width="10%" align="left" scope="row"><?php esc_html_e('API Key', 'akismet');?></th>
+ <th class="akismet-api-key" width="10%" align="left" scope="row">
+ <label for="key"><?php esc_html_e( 'API Key', 'akismet' ); ?></label>
+ </th>
<td width="5%"/>
<td align="left">
<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>
diff --git a/plugins/akismet/views/connect-jp.php b/plugins/akismet/views/connect-jp.php
index 5b33999a..401cc754 100644
--- a/plugins/akismet/views/connect-jp.php
+++ b/plugins/akismet/views/connect-jp.php
@@ -62,8 +62,8 @@
<?php Akismet::view( 'setup' );?>
</div>
<div class="centered akismet-toggles">
- <a href="#" class="toggle-jp-connect"><?php esc_html_e( 'Connect with Jetpack' ); ?></a>
- <a href="#" class="toggle-ak-connect"><?php esc_html_e( 'Set up a different account' ); ?></a>
+ <a href="#" class="toggle-jp-connect"><?php esc_html_e( 'Connect with Jetpack', 'akismet' ); ?></a>
+ <a href="#" class="toggle-ak-connect"><?php esc_html_e( 'Set up a different account', 'akismet' ); ?></a>
</div>
</div>
<br/>
diff --git a/plugins/akismet/views/get.php b/plugins/akismet/views/get.php
index b1abe0eb..e9fa3f9a 100644
--- a/plugins/akismet/views/get.php
+++ b/plugins/akismet/views/get.php
@@ -2,11 +2,11 @@
//phpcs:disable VariableAnalysis
// There are "undefined" variables here because they're defined in the code that includes this file as a template.
-
?>
+
<form name="akismet_activate" action="https://akismet.com/get/" method="POST" target="_blank">
<input type="hidden" name="passback_url" value="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>"/>
<input type="hidden" name="blog" value="<?php echo esc_url( get_option( 'home' ) ); ?>"/>
<input type="hidden" name="redirect" value="<?php echo isset( $redirect ) ? $redirect : 'plugin-signup'; ?>"/>
- <input type="submit" class="<?php echo isset( $classes ) && count( $classes ) > 0 ? implode( ' ', $classes ) : 'akismet-button';?>" value="<?php echo esc_attr( $text ); ?>"/>
-</form>
\ No newline at end of file
+ <button type="submit" class="<?php echo isset( $classes ) && count( $classes ) > 0 ? esc_attr( implode( ' ', $classes ) ) : 'akismet-button'; ?>" value="<?php echo esc_attr( $text ); ?>"><?php echo esc_attr( $text ) . '<span class="screen-reader-text">' . esc_html__( '(opens in a new tab)', 'akismet' ) . '</span>'; ?></button>
+</form>
diff --git a/plugins/akismet/views/stats.php b/plugins/akismet/views/stats.php
index 81d82ce4..4e982a26 100644
--- a/plugins/akismet/views/stats.php
+++ b/plugins/akismet/views/stats.php
@@ -7,5 +7,5 @@
</div>
</div>
</div>
- <iframe src="<?php echo esc_url( sprintf( '//akismet.com/web/1.0/user-stats.php?blog=%s&api_key=%s&locale=%s', urlencode( get_option( 'home' ) ), Akismet::get_api_key(), get_locale() ) ); ?>" width="100%" height="2500px" frameborder="0"></iframe>
+ <iframe src="<?php echo esc_url( sprintf( 'https://tools.akismet.com/1.0/user-stats.php?blog=%s&api_key=%s&locale=%s', urlencode( get_option( 'home' ) ), esc_attr( Akismet::get_api_key() ), esc_attr( get_locale() ) ) ); ?>" width="100%" height="2500px" frameborder="0"></iframe>
</div>
\ No newline at end of file
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-06-15 16:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-15 16:24 [gentoo-commits] proj/blogs-gentoo:master commit in: plugins/akismet/views/, plugins/akismet/ Yury German
-- strict thread matches above, loose matches on Subject: below --
2018-07-12 14:39 Anthony G. Basile
2017-12-26 9:12 Anthony G. Basile
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox