Updates
This commit is contained in:
1 parent
56345152ac
commit
cef1433711
9 files changed
+238
-73
No files matched your search
Binary file not shown.
@@ -2,7 +2,7 @@
|
||||
# This file is distributed under the same license as the Administration package.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"PO-Revision-Date: 2015-05-04 08:01:04+0000\n"
|
||||
"PO-Revision-Date: 2015-05-27 10:29:43+0000\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
@@ -694,6 +694,11 @@ msgstr "Bokmerkeskript"
|
||||
msgid "If you can’t drag the bookmarklet to your bookmarks, copy the following code and create a new bookmark. Paste the code into the new bookmark’s URL field."
|
||||
msgstr "Hvis du ikke kan dra bokmerkeskriptet til dine bokmerker, kopier følgende kode og lag et nytt bokmerke. Lim inn koden i det nye bokmerkets URL-felt."
|
||||
|
||||
#: wp-admin/includes/class-wp-press-this.php:1106
|
||||
msgctxt "Used in Press This to indicate where the content comes from."
|
||||
msgid "Source:"
|
||||
msgstr "Kilde:"
|
||||
|
||||
#: wp-admin/includes/class-wp-press-this.php:1342
|
||||
msgid "Suggested media"
|
||||
msgstr "Anbefalt medie"
|
||||
@@ -803,11 +808,6 @@ msgstr "Savner innleggs-ID."
|
||||
msgid "Press This!"
|
||||
msgstr "Skriv om dette!"
|
||||
|
||||
#: wp-admin/includes/class-wp-press-this.php:1106
|
||||
msgctxt "Used in Press This to indicate where the content comes from."
|
||||
msgid "Source:"
|
||||
msgstr "Kildekode:"
|
||||
|
||||
#: wp-admin/includes/class-wp-press-this.php:283
|
||||
#: wp-admin/includes/class-wp-press-this.php:285
|
||||
msgid "Error: %s"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
Plugin Name: Akismet
|
||||
Plugin URI: http://akismet.com/
|
||||
Description: Used by millions, Akismet is quite possibly the best way in the world to <strong>protect your blog from comment and trackback spam</strong>. It keeps your site protected from spam even while you sleep. To get started: 1) Click the "Activate" link to the left of this description, 2) <a href="http://akismet.com/get/">Sign up for an Akismet API key</a>, and 3) Go to your Akismet configuration page, and save your API key.
|
||||
Version: 3.1.1
|
||||
Version: 3.1.2
|
||||
Author: Automattic
|
||||
Author URI: http://automattic.com/wordpress-plugins/
|
||||
License: GPLv2 or later
|
||||
@@ -35,7 +35,7 @@ if ( !function_exists( 'add_action' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
define( 'AKISMET_VERSION', '3.1.1' );
|
||||
define( 'AKISMET_VERSION', '3.1.2' );
|
||||
define( 'AKISMET__MINIMUM_WP_VERSION', '3.2' );
|
||||
define( 'AKISMET__PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
||||
define( 'AKISMET__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
||||
|
||||
@@ -232,7 +232,7 @@ class Akismet_Admin {
|
||||
if ( defined( 'WPCOM_API_KEY' ) )
|
||||
return false; //shouldn't have option to save key if already defined
|
||||
|
||||
$new_key = preg_replace( '/[^a-h0-9]/i', '', $_POST['key'] );
|
||||
$new_key = preg_replace( '/[^a-f0-9]/i', '', $_POST['key'] );
|
||||
$old_key = Akismet::get_api_key();
|
||||
|
||||
if ( empty( $new_key ) ) {
|
||||
@@ -290,15 +290,6 @@ class Akismet_Admin {
|
||||
|
||||
// WP 2.5+
|
||||
public static function rightnow_stats() {
|
||||
global $submenu, $wp_db_version;
|
||||
|
||||
if ( 8645 < $wp_db_version ) // 2.7
|
||||
$link = add_query_arg( array( 'comment_status' => 'spam' ), admin_url( 'edit-comments.php' ) );
|
||||
elseif ( isset( $submenu['edit-comments.php'] ) )
|
||||
$link = add_query_arg( array( 'page' => 'akismet-admin' ), admin_url( 'edit-comments.php' ) );
|
||||
else
|
||||
$link = add_query_arg( array( 'page' => 'akismet-admin' ), admin_url( 'edit.php' ) );
|
||||
|
||||
if ( $count = get_option('akismet_spam_count') ) {
|
||||
$intro = sprintf( _n(
|
||||
'<a href="%1$s">Akismet</a> has protected your site from %2$s spam comment already. ',
|
||||
@@ -309,15 +300,16 @@ class Akismet_Admin {
|
||||
$intro = sprintf( __('<a href="%s">Akismet</a> blocks spam from getting to your blog. ', 'akismet'), 'https://akismet.com/wordpress/' );
|
||||
}
|
||||
|
||||
$link = function_exists( 'esc_url' ) ? esc_url( $link ) : clean_url( $link );
|
||||
$link = add_query_arg( array( 'comment_status' => 'spam' ), admin_url( 'edit-comments.php' ) );
|
||||
|
||||
if ( $queue_count = self::get_spam_count() ) {
|
||||
$queue_text = sprintf( _n(
|
||||
'There’s <a href="%2$s">%1$s comment</a> in your spam queue right now.',
|
||||
'There are <a href="%2$s">%1$s comments</a> in your spam queue right now.',
|
||||
$queue_count
|
||||
, 'akismet'), number_format_i18n( $queue_count ), $link );
|
||||
, 'akismet'), number_format_i18n( $queue_count ), esc_url( $link ) );
|
||||
} else {
|
||||
$queue_text = sprintf( __( "There’s nothing in your <a href='%s'>spam queue</a> at the moment." , 'akismet'), $link );
|
||||
$queue_text = sprintf( __( "There’s nothing in your <a href='%s'>spam queue</a> at the moment." , 'akismet'), esc_url( $link ) );
|
||||
}
|
||||
|
||||
$text = $intro . '<br />' . $queue_text;
|
||||
@@ -379,17 +371,22 @@ class Akismet_Admin {
|
||||
update_comment_meta( $c['comment_ID'], 'akismet_result', 'true' );
|
||||
delete_comment_meta( $c['comment_ID'], 'akismet_error' );
|
||||
delete_comment_meta( $c['comment_ID'], 'akismet_delayed_moderation_email' );
|
||||
Akismet::update_comment_history( $c['comment_ID'], __('Akismet re-checked and caught this comment as spam', 'akismet'), 'check-spam' );
|
||||
Akismet::update_comment_history( $c['comment_ID'], '', 'recheck-spam' );
|
||||
|
||||
} elseif ( 'false' == $response[1] ) {
|
||||
update_comment_meta( $c['comment_ID'], 'akismet_result', 'false' );
|
||||
delete_comment_meta( $c['comment_ID'], 'akismet_error' );
|
||||
delete_comment_meta( $c['comment_ID'], 'akismet_delayed_moderation_email' );
|
||||
Akismet::update_comment_history( $c['comment_ID'], __('Akismet re-checked and cleared this comment', 'akismet'), 'check-ham' );
|
||||
Akismet::update_comment_history( $c['comment_ID'], '', 'recheck-ham' );
|
||||
// abnormal result: error
|
||||
} else {
|
||||
update_comment_meta( $c['comment_ID'], 'akismet_result', 'error' );
|
||||
Akismet::update_comment_history( $c['comment_ID'], sprintf( __('Akismet was unable to re-check this comment (response: %s)', 'akismet'), substr($response[1], 0, 50)), 'check-error' );
|
||||
Akismet::update_comment_history(
|
||||
$c['comment_ID'],
|
||||
'',
|
||||
'recheck-error',
|
||||
array( 'response' => substr( $response[1], 0, 50 ) )
|
||||
);
|
||||
}
|
||||
|
||||
delete_comment_meta( $c['comment_ID'], 'akismet_rechecking' );
|
||||
@@ -494,11 +491,95 @@ class Akismet_Admin {
|
||||
|
||||
if ( $history ) {
|
||||
echo '<div class="akismet-history" style="margin: 13px;">';
|
||||
|
||||
foreach ( $history as $row ) {
|
||||
$time = date( 'D d M Y @ h:i:m a', $row['time'] ) . ' GMT';
|
||||
echo '<div style="margin-bottom: 13px;"><span style="color: #999;" alt="' . $time . '" title="' . $time . '">' . sprintf( esc_html__('%s ago', 'akismet'), human_time_diff( $row['time'] ) ) . '</span> - ';
|
||||
echo esc_html( $row['message'] ) . '</div>';
|
||||
|
||||
$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:
|
||||
// 1) Save space.
|
||||
// 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 = $row['message'];
|
||||
}
|
||||
|
||||
// If possible, use a current translation.
|
||||
switch ( $row['event'] ) {
|
||||
case 'recheck-spam';
|
||||
$message = __( 'Akismet re-checked and caught this comment as spam.', 'akismet' );
|
||||
break;
|
||||
case 'check-spam':
|
||||
$message = __( 'Akismet caught this comment as spam.', 'akismet' );
|
||||
break;
|
||||
case 'recheck-ham':
|
||||
$message = __( 'Akismet re-checked and cleared this comment.', 'akismet' );
|
||||
break;
|
||||
case 'check-ham':
|
||||
$message = __( 'Akismet cleared this comment.', 'akismet' );
|
||||
break;
|
||||
case 'wp-blacklisted':
|
||||
$message = __( 'Comment was caught by wp_blacklist_check.', 'akismet' );
|
||||
break;
|
||||
case 'report-spam':
|
||||
if ( isset( $row['user'] ) ) {
|
||||
$message = sprintf( __( '%s reported this comment as spam.', 'akismet' ), $row['user'] );
|
||||
}
|
||||
else if ( ! $message ) {
|
||||
$message = __( 'This comment was reported as spam.', 'akismet' );
|
||||
}
|
||||
break;
|
||||
case 'report-ham':
|
||||
if ( isset( $row['user'] ) ) {
|
||||
$message = sprintf( __( '%s reported this comment as not spam.', 'akismet' ), $row['user'] );
|
||||
}
|
||||
else if ( ! $message ) {
|
||||
$message = __( 'This comment was reported as not spam.', 'akismet' );
|
||||
}
|
||||
break;
|
||||
case 'cron-retry-spam':
|
||||
$message = __( 'Akismet caught this comment as spam during an automatic retry.' , 'akismet');
|
||||
break;
|
||||
case 'cron-retry-ham':
|
||||
$message = __( 'Akismet cleared this comment during an automatic retry.', 'akismet');
|
||||
break;
|
||||
case 'check-error':
|
||||
if ( isset( $row['meta'], $row['meta']['response'] ) ) {
|
||||
$message = sprintf( __( 'Akismet was unable to check this comment (response: %s) but will automatically retry later.', 'akismet'), $row['meta']['response'] );
|
||||
}
|
||||
break;
|
||||
case 'recheck-error':
|
||||
if ( isset( $row['meta'], $row['meta']['response'] ) ) {
|
||||
$message = sprintf( __( 'Akismet was unable to recheck this comment (response: %s).', 'akismet'), $row['meta']['response'] );
|
||||
}
|
||||
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( __( 'Comment status was changed to %s', 'akismet' ), $new_status );
|
||||
}
|
||||
else if ( preg_match( '/^status-/', $row['event'] ) ) {
|
||||
$new_status = preg_replace( '/^status-/', '', $row['event'] );
|
||||
|
||||
if ( isset( $row['user'] ) ) {
|
||||
$message = sprintf( __( '%1$s changed the comment status to %2$s.', 'akismet' ), $row['user'], $new_status );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
echo '<div style="margin-bottom: 13px;">';
|
||||
echo '<span style="color: #999;" alt="' . $time . '" title="' . $time . '">' . sprintf( esc_html__('%s ago', 'akismet'), human_time_diff( $row['time'] ) ) . '</span>';
|
||||
echo ' - ';
|
||||
echo esc_html( $message );
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
@@ -631,7 +712,7 @@ class Akismet_Admin {
|
||||
}
|
||||
|
||||
public static function get_akismet_user( $api_key ) {
|
||||
$akismet_user = Akismet::http_post( Akismet::build_query( array( 'key' => $api_key ) ), 'get-subscription' );
|
||||
$akismet_user = Akismet::http_post( Akismet::build_query( array( 'key' => $api_key, 'blog' => get_bloginfo( 'url' ) ) ), 'get-subscription' );
|
||||
|
||||
if ( ! empty( $akismet_user[1] ) )
|
||||
$akismet_user = json_decode( $akismet_user[1] );
|
||||
@@ -645,12 +726,13 @@ class Akismet_Admin {
|
||||
$stat_totals = array();
|
||||
|
||||
foreach( array( '6-months', 'all' ) as $interval ) {
|
||||
$response = Akismet::http_post( Akismet::build_query( array( 'blog' => urlencode( get_bloginfo('url') ), 'key' => $api_key, 'from' => $interval ) ), 'get-stats' );
|
||||
$response = Akismet::http_post( Akismet::build_query( array( 'blog' => get_bloginfo( 'url' ), 'key' => $api_key, 'from' => $interval ) ), 'get-stats' );
|
||||
|
||||
if ( ! empty( $response[1] ) ) {
|
||||
$stat_totals[$interval] = json_decode( $response[1] );
|
||||
}
|
||||
}
|
||||
|
||||
return $stat_totals;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,8 @@ class Akismet {
|
||||
private static $initiated = false;
|
||||
private static $prevent_moderation_email_for_these_comments = array();
|
||||
private static $last_comment_result = null;
|
||||
|
||||
private static $comment_as_submitted_allowed_keys = array( 'blog' => '', 'blog_charset' => '', 'blog_lang' => '', 'blog_ua' => '', 'comment_agent' => '', 'comment_author' => '', 'comment_author_IP' => '', 'comment_author_email' => '', 'comment_author_url' => '', 'comment_content' => '', 'comment_date_gmt' => '', 'comment_tags' => '', 'comment_type' => '', 'guid' => '', 'is_test' => '', 'permalink' => '', 'reporter' => '', 'site_domain' => '', 'submit_referer' => '', 'submit_uri' => '', 'user_ID' => '', 'user_agent' => '', 'user_id' => '', 'user_ip' => '' );
|
||||
|
||||
public static function init() {
|
||||
if ( ! self::$initiated ) {
|
||||
self::init_hooks();
|
||||
@@ -66,7 +67,14 @@ class Akismet {
|
||||
if ( $response[1] != 'valid' && $response[1] != 'invalid' )
|
||||
return 'failed';
|
||||
|
||||
self::update_alert( $response );
|
||||
return $response[1];
|
||||
}
|
||||
|
||||
public static function deactivate_key( $key ) {
|
||||
$response = self::http_post( Akismet::build_query( array( 'key' => $key, 'blog' => get_option('home') ) ), 'deactivate' );
|
||||
|
||||
if ( $response[1] != 'deactivated' )
|
||||
return 'failed';
|
||||
|
||||
return $response[1];
|
||||
}
|
||||
@@ -124,9 +132,7 @@ class Akismet {
|
||||
|
||||
do_action( 'akismet_comment_check_response', $response );
|
||||
|
||||
self::update_alert( $response );
|
||||
|
||||
$commentdata['comment_as_submitted'] = array_intersect_key( $comment, array( 'blog' => '', 'blog_charset' => '', 'blog_lang' => '', 'blog_ua' => '', 'comment_agent' => '', 'comment_author' => '', 'comment_author_IP' => '', 'comment_author_email' => '', 'comment_author_url' => '', 'comment_content' => '', 'comment_date_gmt' => '', 'comment_tags' => '', 'comment_type' => '', 'guid' => '', 'is_test' => '', 'permalink' => '', 'reporter' => '', 'site_domain' => '', 'submit_referer' => '', 'submit_uri' => '', 'user_ID' => '', 'user_agent' => '', 'user_id' => '', 'user_ip' => '' ) );
|
||||
$commentdata['comment_as_submitted'] = array_intersect_key( $comment, self::$comment_as_submitted_allowed_keys );
|
||||
$commentdata['akismet_result'] = $response[1];
|
||||
|
||||
if ( isset( $response[0]['x-akismet-pro-tip'] ) )
|
||||
@@ -228,23 +234,32 @@ class Akismet {
|
||||
// normal result: true or false
|
||||
if ( self::$last_comment['akismet_result'] == 'true' ) {
|
||||
update_comment_meta( $comment->comment_ID, 'akismet_result', 'true' );
|
||||
self::update_comment_history( $comment->comment_ID, __('Akismet caught this comment as spam', 'akismet'), 'check-spam' );
|
||||
self::update_comment_history( $comment->comment_ID, '', 'check-spam' );
|
||||
if ( $comment->comment_approved != 'spam' )
|
||||
self::update_comment_history( $comment->comment_ID, sprintf( __('Comment status was changed to %s', 'akismet'), $comment->comment_approved), 'status-changed'.$comment->comment_approved );
|
||||
self::update_comment_history(
|
||||
$comment->comment_ID,
|
||||
'',
|
||||
'status-changed-'.$comment->comment_approved
|
||||
);
|
||||
}
|
||||
elseif ( self::$last_comment['akismet_result'] == 'false' ) {
|
||||
update_comment_meta( $comment->comment_ID, 'akismet_result', 'false' );
|
||||
self::update_comment_history( $comment->comment_ID, __('Akismet cleared this comment', 'akismet'), 'check-ham' );
|
||||
self::update_comment_history( $comment->comment_ID, '', 'check-ham' );
|
||||
if ( $comment->comment_approved == 'spam' ) {
|
||||
if ( wp_blacklist_check($comment->comment_author, $comment->comment_author_email, $comment->comment_author_url, $comment->comment_content, $comment->comment_author_IP, $comment->comment_agent) )
|
||||
self::update_comment_history( $comment->comment_ID, __('Comment was caught by wp_blacklist_check', 'akismet'), 'wp-blacklisted' );
|
||||
self::update_comment_history( $comment->comment_ID, '', 'wp-blacklisted' );
|
||||
else
|
||||
self::update_comment_history( $comment->comment_ID, sprintf( __('Comment status was changed to %s', 'akismet'), $comment->comment_approved), 'status-changed-'.$comment->comment_approved );
|
||||
self::update_comment_history( $comment->comment_ID, '', 'status-changed-'.$comment->comment_approved );
|
||||
}
|
||||
} // abnormal result: error
|
||||
else {
|
||||
update_comment_meta( $comment->comment_ID, 'akismet_error', time() );
|
||||
self::update_comment_history( $comment->comment_ID, sprintf( __('Akismet was unable to check this comment (response: %s), will automatically retry again later.', 'akismet'), substr(self::$last_comment['akismet_result'], 0, 50)), 'check-error' );
|
||||
self::update_comment_history(
|
||||
$comment->comment_ID,
|
||||
'',
|
||||
'check-error',
|
||||
array( 'response' => substr( self::$last_comment['akismet_result'], 0, 50 ) )
|
||||
);
|
||||
}
|
||||
|
||||
// record the complete original data as submitted for checking
|
||||
@@ -350,8 +365,15 @@ class Akismet {
|
||||
return $history;
|
||||
}
|
||||
|
||||
// log an event for a given comment, storing it in comment_meta
|
||||
public static function update_comment_history( $comment_id, $message, $event=null ) {
|
||||
/**
|
||||
* Log an event for a given comment, storing it in comment_meta.
|
||||
*
|
||||
* @param int $comment_id The ID of the relevant comment.
|
||||
* @param string $message The string description of the event. No longer used.
|
||||
* @param string $event The event code.
|
||||
* @param array $meta Metadata about the history entry. e.g., the user that reported or changed the status of a given comment.
|
||||
*/
|
||||
public static function update_comment_history( $comment_id, $message, $event=null, $meta=null ) {
|
||||
global $current_user;
|
||||
|
||||
// failsafe for old WP versions
|
||||
@@ -359,15 +381,19 @@ class Akismet {
|
||||
return false;
|
||||
|
||||
$user = '';
|
||||
if ( is_object( $current_user ) && isset( $current_user->user_login ) )
|
||||
$user = $current_user->user_login;
|
||||
|
||||
$event = array(
|
||||
'time' => self::_get_microtime(),
|
||||
'message' => $message,
|
||||
'event' => $event,
|
||||
'user' => $user,
|
||||
);
|
||||
|
||||
if ( is_object( $current_user ) && isset( $current_user->user_login ) ) {
|
||||
$event['user'] = $current_user->user_login;
|
||||
}
|
||||
|
||||
if ( ! empty( $meta ) ) {
|
||||
$event['meta'] = $meta;
|
||||
}
|
||||
|
||||
// $unique = false so as to allow multiple values per comment
|
||||
$r = add_comment_meta( $comment_id, 'akismet_history', $event, false );
|
||||
@@ -443,7 +469,7 @@ class Akismet {
|
||||
}
|
||||
}
|
||||
|
||||
self::update_comment_history( $comment->comment_ID, sprintf( __('%1$s changed the comment status to %2$s', 'akismet'), $reporter, $new_status ), 'status-' . $new_status );
|
||||
self::update_comment_history( $comment->comment_ID, '', 'status-' . $new_status );
|
||||
}
|
||||
|
||||
public static function submit_spam_comment( $comment_id ) {
|
||||
@@ -460,7 +486,7 @@ class Akismet {
|
||||
return;
|
||||
|
||||
// use the original version stored in comment_meta if available
|
||||
$as_submitted = get_comment_meta( $comment_id, 'akismet_as_submitted', true);
|
||||
$as_submitted = self::sanitize_comment_as_submitted( get_comment_meta( $comment_id, 'akismet_as_submitted', true ) );
|
||||
|
||||
if ( $as_submitted && is_array( $as_submitted ) && isset( $as_submitted['comment_content'] ) )
|
||||
$comment = (object) array_merge( (array)$comment, $as_submitted );
|
||||
@@ -488,7 +514,7 @@ class Akismet {
|
||||
|
||||
$response = Akismet::http_post( Akismet::build_query( $comment ), 'submit-spam' );
|
||||
if ( $comment->reporter ) {
|
||||
self::update_comment_history( $comment_id, sprintf( __('%s reported this comment as spam', 'akismet'), $comment->reporter ), 'report-spam' );
|
||||
self::update_comment_history( $comment_id, '', 'report-spam' );
|
||||
update_comment_meta( $comment_id, 'akismet_user_result', 'true' );
|
||||
update_comment_meta( $comment_id, 'akismet_user', $comment->reporter );
|
||||
}
|
||||
@@ -506,7 +532,7 @@ class Akismet {
|
||||
return;
|
||||
|
||||
// use the original version stored in comment_meta if available
|
||||
$as_submitted = get_comment_meta( $comment_id, 'akismet_as_submitted', true);
|
||||
$as_submitted = self::sanitize_comment_as_submitted( get_comment_meta( $comment_id, 'akismet_as_submitted', true ) );
|
||||
|
||||
if ( $as_submitted && is_array($as_submitted) && isset($as_submitted['comment_content']) )
|
||||
$comment = (object) array_merge( (array)$comment, $as_submitted );
|
||||
@@ -534,7 +560,7 @@ class Akismet {
|
||||
|
||||
$response = self::http_post( Akismet::build_query( $comment ), 'submit-ham' );
|
||||
if ( $comment->reporter ) {
|
||||
self::update_comment_history( $comment_id, sprintf( __('%s reported this comment as not spam', 'akismet'), $comment->reporter ), 'report-ham' );
|
||||
self::update_comment_history( $comment_id, '', 'report-ham' );
|
||||
update_comment_meta( $comment_id, 'akismet_user_result', 'false' );
|
||||
update_comment_meta( $comment_id, 'akismet_user', $comment->reporter );
|
||||
}
|
||||
@@ -573,19 +599,19 @@ class Akismet {
|
||||
add_comment_meta( $comment_id, 'akismet_rechecking', true );
|
||||
$status = self::check_db_comment( $comment_id, 'retry' );
|
||||
|
||||
$msg = '';
|
||||
$event = '';
|
||||
if ( $status == 'true' ) {
|
||||
$msg = __( 'Akismet caught this comment as spam during an automatic retry.' , 'akismet');
|
||||
$event = 'cron-retry-spam';
|
||||
} elseif ( $status == 'false' ) {
|
||||
$msg = __( 'Akismet cleared this comment during an automatic retry.' , 'akismet');
|
||||
$event = 'cron-retry-ham';
|
||||
}
|
||||
|
||||
// If we got back a legit response then update the comment history
|
||||
// other wise just bail now and try again later. No point in
|
||||
// re-trying all the comments once we hit one failure.
|
||||
if ( !empty( $msg ) ) {
|
||||
if ( !empty( $event ) ) {
|
||||
delete_comment_meta( $comment_id, 'akismet_error' );
|
||||
self::update_comment_history( $comment_id, $msg, 'cron-retry' );
|
||||
self::update_comment_history( $comment_id, '', $event );
|
||||
update_comment_meta( $comment_id, 'akismet_result', $status );
|
||||
// make sure the comment status is still pending. if it isn't, that means the user has already moved it elsewhere.
|
||||
$comment = get_comment( $comment_id );
|
||||
@@ -681,8 +707,16 @@ class Akismet {
|
||||
return (
|
||||
isset( $comment1['comment_post_ID'], $comment2['comment_post_ID'] )
|
||||
&& intval( $comment1['comment_post_ID'] ) == intval( $comment2['comment_post_ID'] )
|
||||
&& $comment1['comment_author'] == $comment2['comment_author']
|
||||
&& $comment1['comment_author_email'] == $comment2['comment_author_email']
|
||||
&& (
|
||||
$comment1['comment_author'] == $comment2['comment_author']
|
||||
|| stripslashes( $comment1['comment_author'] ) == $comment2['comment_author']
|
||||
|| $comment1['comment_author'] == stripslashes( $comment2['comment_author'] )
|
||||
)
|
||||
&& (
|
||||
$comment1['comment_author_email'] == $comment2['comment_author_email']
|
||||
|| stripslashes( $comment1['comment_author_email'] ) == $comment2['comment_author_email']
|
||||
|| $comment1['comment_author_email'] == stripslashes( $comment2['comment_author_email'] )
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -882,8 +916,12 @@ class Akismet {
|
||||
|
||||
do_action( 'akismet_https_disabled' );
|
||||
}
|
||||
|
||||
$simplified_response = array( $response['headers'], $response['body'] );
|
||||
|
||||
self::update_alert( $simplified_response );
|
||||
|
||||
return array( $response['headers'], $response['body'] );
|
||||
return $simplified_response;
|
||||
}
|
||||
|
||||
// given a response from an API call like check_key_status(), update the alert code options if an alert is present.
|
||||
@@ -999,7 +1037,7 @@ p {
|
||||
* @static
|
||||
*/
|
||||
public static function plugin_deactivation( ) {
|
||||
//tidy up
|
||||
return self::deactivate_key( self::get_api_key() );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1085,4 +1123,26 @@ p {
|
||||
|
||||
return $r;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure that we are loading expected scalar values from akismet_as_submitted commentmeta.
|
||||
*
|
||||
* @param mixed $meta_value
|
||||
* @return mixed
|
||||
*/
|
||||
private static function sanitize_comment_as_submitted( $meta_value ) {
|
||||
if ( empty( $meta_value ) ) {
|
||||
return $meta_value;
|
||||
}
|
||||
|
||||
$meta_value = (array) $meta_value;
|
||||
|
||||
foreach ( $meta_value as $key => $value ) {
|
||||
if ( ! isset( self::$comment_as_submitted_allowed_keys[$key] ) || ! is_scalar( $value ) ) {
|
||||
unset( $meta_value[$key] );
|
||||
}
|
||||
}
|
||||
|
||||
return $meta_value;
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,8 @@
|
||||
Contributors: matt, ryan, andy, mdawaffe, tellyworth, josephscott, lessbloat, eoigal, cfinke, automattic, jgs
|
||||
Tags: akismet, comments, spam
|
||||
Requires at least: 3.2
|
||||
Tested up to: 4.1.1
|
||||
Stable tag: 3.1.1
|
||||
Tested up to: 4.2.2
|
||||
Stable tag: 3.1.2
|
||||
License: GPLv2 or later
|
||||
|
||||
Akismet checks your comments against the Akismet Web service to see if they look like spam or not.
|
||||
@@ -30,6 +30,16 @@ Upload the Akismet plugin to your blog, Activate it, then enter your [Akismet.co
|
||||
|
||||
== Changelog ==
|
||||
|
||||
= 3.1.2 =
|
||||
*Release Date - 7 June 2015*
|
||||
|
||||
* Reduced the amount of space Akismet uses in the commentmeta table.
|
||||
* Fixed a bug where some comments with quotes in the author name weren't getting history entries
|
||||
* Pre-emptive security improvements to ensure that the Akismet plugin can't be used by attackers to compromise a WordPress installation.
|
||||
* Better UI for the key entry field: allow whitespace to be included at the beginning or end of the key and strip it out automatically when the form is submitted.
|
||||
* When deactivating the plugin, notify the Akismet API so the site can be marked as inactive.
|
||||
* Clearer error messages.
|
||||
|
||||
= 3.1.1 =
|
||||
*Release Date - 17th March, 2015*
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
<th class="akismet-api-key" width="10%" align="left" scope="row"><?php esc_html_e('API Key', 'akismet');?></th>
|
||||
<td width="5%"/>
|
||||
<td align="left">
|
||||
<span class="api-key"><input id="key" name="key" type="text" size="15" maxlength="12" value="<?php echo esc_attr( get_option('wordpress_api_key') ); ?>" class="regular-text code <?php echo $akismet_user->status;?>"></span>
|
||||
<span class="api-key"><input id="key" name="key" type="text" size="15" value="<?php echo esc_attr( get_option('wordpress_api_key') ); ?>" class="regular-text code <?php echo $akismet_user->status;?>"></span>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
|
||||
@@ -75,7 +75,11 @@
|
||||
<?php elseif ( $type == 'no-sub' ) :?>
|
||||
<div class="wrap alert critical">
|
||||
<h3 class="key-status failed"><?php esc_html_e( 'Your subscription is missing.', 'akismet'); ?></h3>
|
||||
<p class="description"><?php printf( __('Since 2012, Akismet began using subscriptions for all accounts (even free ones). It looks like a subscription has not been assigned to your account, and we’d appreciate it if you’d <a href="%s" target="_blank">sign into your account</a> and choose one. Please <a href="%s" target="_blank">contact our support team</a> with any questions.', 'akismet'), 'https://akismet.com/account/upgrade/', 'https://akismet.com/contact/' ); ?></p>
|
||||
<p class="description">
|
||||
<?php printf( __( 'Since 2012, Akismet began using subscriptions for all accounts (even free ones). It looks like a subscription has not been assigned to your account, and we’d appreciate it if you’d <a href="%s" target="_blank">sign into your account</a> and choose one.', 'akismet'), 'https://akismet.com/account/upgrade/' ); ?>
|
||||
<br /><br />
|
||||
<?php printf( __( 'Please <a href="%s" target="_blank">contact our support team</a> with any questions.', 'akismet' ), 'https://akismet.com/contact/' ); ?>
|
||||
</p>
|
||||
</div>
|
||||
<?php elseif ( $type == 'new-key-valid' ) :?>
|
||||
<div class="wrap alert active">
|
||||
@@ -87,16 +91,25 @@
|
||||
</div>
|
||||
<?php elseif ( $type == 'new-key-failed' ) :?>
|
||||
<div class="wrap alert critical">
|
||||
<h3 class="key-status"><?php esc_html_e( 'The key you entered could not be verified because a connection to akismet.com could not be established. Please check your server configuration.' , 'akismet'); ?></h3>
|
||||
<h3 class="key-status"><?php esc_html_e( 'The key you entered could not be verified.' , 'akismet'); ?></h3>
|
||||
<p class="description"><?php printf( __('The connection to akismet.com cannot be established. Please refer to <a href="%s" target="_blank">our guide about firewalls</a> and check your server configuration.', 'akismet'), 'http://blog.akismet.com/akismet-hosting-faq/'); ?></p>
|
||||
</div>
|
||||
<?php elseif ( $type == 'limit-reached' && in_array( $level, array( 'yellow', 'red' ) ) ) :?>
|
||||
<div class="wrap alert critical">
|
||||
<?php if ( $level == 'yellow' ): ?>
|
||||
<h3 class="key-status failed"><?php esc_html_e("You're using your Akismet key on more sites than your Pro subscription allows.", 'akismet'); ?></h3>
|
||||
<p class="description"><?php printf( __('Your Pro subscription allows the use of Akismet on only one site. Please <a href="http://docs.akismet.com/billing/add-more-sites/">purchase additional Pro subscriptions</a> or upgrade to an Enterprise subscription that allows the use of Akismet on unlimited sites.<br /><br />If you have any questions, please get in touch with our support team.', 'akismet'), 'https://akismet.com/account/upgrade/', 'https://akismet.com/contact/'); ?></p>
|
||||
<h3 class="key-status failed"><?php esc_html_e( 'You’re using your Akismet key on more sites than your Pro subscription allows.', 'akismet' ); ?></h3>
|
||||
<p class="description">
|
||||
<?php printf( __( 'Your Pro subscription allows the use of Akismet on only one site. Please <a href="%s" target="_blank">purchase additional Pro subscriptions</a> or upgrade to an Enterprise subscription that allows the use of Akismet on unlimited sites.', 'akismet' ), 'http://docs.akismet.com/billing/add-more-sites/' ); ?>
|
||||
<br /><br />
|
||||
<?php printf( __( 'Please <a href="%s" target="_blank">contact our support team</a> with any questions.', 'akismet' ), 'https://akismet.com/contact/'); ?>
|
||||
</p>
|
||||
<?php elseif ( $level == 'red' ): ?>
|
||||
<h3 class="key-status failed"><?php esc_html_e("You're using Akismet on far too many sites for your Pro subscription.", 'akismet'); ?></h3>
|
||||
<p class="description"><?php printf( __('To continue your service, <a href="%s" target="_blank">upgrade to an Enterprise subscription</a>, which covers an unlimited number of sites. Please <a href="%s" target="_blank">contact our support team</a> with any questions.', 'akismet'), 'https://akismet.com/account/upgrade/', 'https://akismet.com/contact/'); ?></p>
|
||||
<h3 class="key-status failed"><?php esc_html_e( 'You’re using Akismet on far too many sites for your Pro subscription.', 'akismet' ); ?></h3>
|
||||
<p class="description">
|
||||
<?php printf( __( 'To continue your service, <a href="%s" target="_blank">upgrade to an Enterprise subscription</a>, which covers an unlimited number of sites.', 'akismet'), 'https://akismet.com/account/upgrade/' ); ?></p>
|
||||
<br /><br />
|
||||
<?php printf( __( 'Please <a href="%s" target="_blank">contact our support team</a> with any questions.', 'akismet' ), 'https://akismet.com/contact/'); ?></p>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
<?php endif;?>
|
||||
@@ -8,7 +8,7 @@
|
||||
<?php echo esc_attr( $akismet_user->user_email ); ?>
|
||||
</div>
|
||||
<form name="akismet_activate" id="akismet_activate" action="https://akismet.com/get/" method="post" class="right" target="_blank">
|
||||
<input type="hidden" name="passback_url" value="<?php echo esc_attr( Akismet_Admin::get_page_url() ); ?>"/>
|
||||
<input type="hidden" name="passback_url" value="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>"/>
|
||||
<input type="hidden" name="auto-connect" value="<?php echo $akismet_user->ID;?>"/>
|
||||
<input type="hidden" name="redirect" value="plugin-signup"/>
|
||||
<input type="submit" class="button button-primary" value="<?php esc_attr_e( 'Register Akismet' , 'akismet'); ?>"/>
|
||||
@@ -22,7 +22,7 @@
|
||||
<?php printf( esc_html__( 'Your subscription for %s is cancelled' , 'akismet'), $akismet_user->user_email ); ?>
|
||||
</div>
|
||||
<form name="akismet_activate" id="akismet_activate" action="https://akismet.com/get/" method="post" class="right" target="_blank">
|
||||
<input type="hidden" name="passback_url" value="<?php echo esc_attr( Akismet_Admin::get_page_url() ); ?>"/>
|
||||
<input type="hidden" name="passback_url" value="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>"/>
|
||||
<input type="hidden" name="user_id" value="<?php echo $akismet_user->ID;?>"/>
|
||||
<input type="hidden" name="redirect" value="upgrade"/>
|
||||
<input type="submit" class="button button-primary" value="<?php esc_attr_e( 'Reactivate Akismet' , 'akismet'); ?>"/>
|
||||
@@ -64,7 +64,7 @@
|
||||
<p><?php esc_html_e('If you already know your API key.', 'akismet'); ?></p>
|
||||
</div>
|
||||
<form action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="post" id="akismet-enter-api-key" class="right">
|
||||
<input id="key" name="key" type="text" size="15" maxlength="12" value="" class="regular-text code">
|
||||
<input id="key" name="key" type="text" size="15" value="" class="regular-text code">
|
||||
<input type="hidden" name="action" value="enter-key">
|
||||
<?php wp_nonce_field( Akismet_Admin::NONCE ) ?>
|
||||
<input type="submit" name="submit" id="submit" class="button button-secondary" value="<?php esc_attr_e('Use this key', 'akismet');?>">
|
||||
@@ -85,7 +85,7 @@
|
||||
<p><?php esc_html_e('If you already know your API key.', 'akismet'); ?></p>
|
||||
</div>
|
||||
<form action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="post" id="akismet-enter-api-key" class="right">
|
||||
<input id="key" name="key" type="text" size="15" maxlength="12" value="" class="regular-text code">
|
||||
<input id="key" name="key" type="text" size="15" value="" class="regular-text code">
|
||||
<input type="hidden" name="action" value="enter-key">
|
||||
<?php wp_nonce_field( Akismet_Admin::NONCE ); ?>
|
||||
<input type="submit" name="submit" id="submit" class="button button-secondary" value="<?php esc_attr_e('Use this key', 'akismet');?>">
|
||||
|
||||
Reference in new issue
Block a user