diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-19 04:51:22 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-19 04:51:22 +0000 |
commit | fc0a79914946dac00ccd51b1aacffe267de7210e (patch) | |
tree | 1403384efbfe8f8776ff60aaa40f7d535c02c822 /wp-content/plugins/akismet/class.akismet-admin.php | |
parent | Releasing progress-linux version 6.5.5+dfsg1-1~progress7.99u1. (diff) | |
download | wordpress-fc0a79914946dac00ccd51b1aacffe267de7210e.tar.xz wordpress-fc0a79914946dac00ccd51b1aacffe267de7210e.zip |
Merging upstream version 6.6.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'wp-content/plugins/akismet/class.akismet-admin.php')
-rw-r--r-- | wp-content/plugins/akismet/class.akismet-admin.php | 53 |
1 files changed, 41 insertions, 12 deletions
diff --git a/wp-content/plugins/akismet/class.akismet-admin.php b/wp-content/plugins/akismet/class.akismet-admin.php index dd39104..d1dabcf 100644 --- a/wp-content/plugins/akismet/class.akismet-admin.php +++ b/wp-content/plugins/akismet/class.akismet-admin.php @@ -533,9 +533,13 @@ class Akismet_Admin { } public static function comment_row_action( $a, $comment ) { - $akismet_result = get_comment_meta( $comment->comment_ID, 'akismet_result', true ); + $akismet_result = get_comment_meta( $comment->comment_ID, 'akismet_result', true ); + if ( ! $akismet_result && get_comment_meta( $comment->comment_ID, 'akismet_skipped', true ) ) { + $akismet_result = 'skipped'; // Akismet chose to skip the comment-check request. + } + $akismet_error = get_comment_meta( $comment->comment_ID, 'akismet_error', true ); - $user_result = get_comment_meta( $comment->comment_ID, 'akismet_user_result', true); + $user_result = get_comment_meta( $comment->comment_ID, 'akismet_user_result', true ); $comment_status = wp_get_comment_status( $comment->comment_ID ); $desc = null; if ( $akismet_error ) { @@ -679,6 +683,12 @@ class Akismet_Admin { case 'webhook-ham-noaction': $message = esc_html( __( 'Akismet cleared this comment during a recheck. It did not update the comment status because it had already been modified by another user or plugin.', 'akismet' ) ); break; + case 'akismet-skipped': + $message = esc_html( __( 'This comment was not sent to Akismet when it was submitted because it was caught by something else.', 'akismet' ) ); + break; + case 'akismet-skipped-disallowed': + $message = esc_html( __( 'This comment was not sent to Akismet when it was submitted because it was caught by the comment disallowed list.', 'akismet' ) ); + break; default: if ( preg_match( '/^status-changed/', $row['event'] ) ) { // Half of these used to be saved without the dash after 'status-changed'. @@ -897,7 +907,14 @@ class Akismet_Admin { $response = Akismet::http_post( Akismet::build_query( $request_args ), 'get-stats' ); if ( ! empty( $response[1] ) ) { - $stat_totals[$interval] = json_decode( $response[1] ); + $data = json_decode( $response[1] ); + /* + * The json decoded response should be an object. If it's not an object, something's wrong, and the data + * shouldn't be added to the stats_totals array. + */ + if ( is_object( $data ) ) { + $stat_totals[ $interval ] = $data; + } } } @@ -952,14 +969,15 @@ class Akismet_Admin { public static function get_usage_limit_alert_data() { return array( - 'type' => 'usage-limit', - 'code' => (int) get_option( 'akismet_alert_code' ), - 'msg' => get_option( 'akismet_alert_msg' ), - 'api_calls' => get_option( 'akismet_alert_api_calls' ), - 'usage_limit' => get_option( 'akismet_alert_usage_limit' ), - 'upgrade_plan' => get_option( 'akismet_alert_upgrade_plan' ), - 'upgrade_url' => get_option( 'akismet_alert_upgrade_url' ), - 'upgrade_type' => get_option( 'akismet_alert_upgrade_type' ), + 'type' => 'usage-limit', + 'code' => (int) get_option( 'akismet_alert_code' ), + 'msg' => get_option( 'akismet_alert_msg' ), + 'api_calls' => get_option( 'akismet_alert_api_calls' ), + 'usage_limit' => get_option( 'akismet_alert_usage_limit' ), + 'upgrade_plan' => get_option( 'akismet_alert_upgrade_plan' ), + 'upgrade_url' => get_option( 'akismet_alert_upgrade_url' ), + 'upgrade_type' => get_option( 'akismet_alert_upgrade_type' ), + 'upgrade_via_support' => get_option( 'akismet_alert_upgrade_via_support' ) === 'true', ); } @@ -1107,6 +1125,12 @@ class Akismet_Admin { $alert_code = get_option( 'akismet_alert_code' ); if ( isset( Akismet::$limit_notices[ $alert_code ] ) ) { $notices[] = self::get_usage_limit_alert_data(); + } elseif ( $alert_code > 0 ) { + $notices[] = array( + 'type' => 'alert', + 'code' => (int) get_option( 'akismet_alert_code' ), + 'msg' => get_option( 'akismet_alert_msg' ), + ); } /* @@ -1117,7 +1141,6 @@ class Akismet_Admin { */ // $notices[] = array( 'type' => 'active-notice', 'time_saved' => 'Cleaning up spam takes time. Akismet has saved you 1 minute!' ); // $notices[] = array( 'type' => 'plugin' ); - // $notices[] = array( 'type' => 'spam-check', 'link_text' => 'Link text.' ); // $notices[] = array( 'type' => 'notice', 'notice_header' => 'This is the notice header.', 'notice_text' => 'This is the notice text.' ); // $notices[] = array( 'type' => 'missing-functions' ); // $notices[] = array( 'type' => 'servers-be-down' ); @@ -1131,6 +1154,7 @@ class Akismet_Admin { // $notices[] = array( 'type' => 'existing-key-invalid' ); // $notices[] = array( 'type' => 'new-key-failed' ); // $notices[] = array( 'type' => 'usage-limit', 'api_calls' => '15000', 'usage_limit' => '10000', 'upgrade_plan' => 'Enterprise', 'upgrade_url' => 'https://akismet.com/account/', 'code' => 10502 ); + // $notices[] = array( 'type' => 'spam-check', 'link_text' => 'Link text.' ); // $notices[] = array( 'type' => 'spam-check-cron-disabled' ); // $notices[] = array( 'type' => 'alert', 'code' => 123 ); @@ -1146,6 +1170,11 @@ class Akismet_Admin { return; } + // To see notice variants while testing. + // Akismet::view( 'notice', array( 'type' => 'spam-check-cron-disabled' ) ); + // Akismet::view( 'notice', array( 'type' => 'spam-check' ) ); + // Akismet::view( 'notice', array( 'type' => 'alert', 'code' => 123, 'msg' => 'Message' ) ); + if ( in_array( $hook_suffix, array( 'edit-comments.php' ) ) && (int) get_option( 'akismet_alert_code' ) > 0 ) { Akismet::verify_key( Akismet::get_api_key() ); //verify that the key is still in alert state |