Commit 87987b67 authored by lechuck's avatar lechuck Committed by lucha

Upgrade Wordpress to version 4.2.4

parent 678b5abf
......@@ -9,7 +9,7 @@
<body>
<h1 id="logo">
<a href="https://wordpress.org/"><img alt="WordPress" src="wp-admin/images/wordpress-logo.png" /></a>
<br /> Version 4.2.3
<br /> Version 4.2.4
</h1>
<p style="text-align: center">Semantic Personal Publishing Platform</p>
......
......@@ -41,7 +41,11 @@ include( ABSPATH . 'wp-admin/admin-header.php' );
</h2>
<div class="changelog point-releases">
<h3><?php echo _n( 'Maintenance and Security Release', 'Maintenance and Security Releases', 3 ); ?></h3>
<h3><?php echo _n( 'Maintenance and Security Release', 'Maintenance and Security Releases', 4 ); ?></h3>
<p><?php printf( _n( '<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bug.',
'<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bugs.', 4 ), '4.2.4', number_format_i18n( 4 ) ); ?>
<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'http://codex.wordpress.org/Version_4.2.4' ); ?>
</p>
<p><?php printf( _n( '<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bug.',
'<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bugs.', 20 ), '4.2.3', number_format_i18n( 20 ) ); ?>
<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'http://codex.wordpress.org/Version_4.2.3' ); ?>
......
......@@ -972,11 +972,14 @@ class Plugin_Upgrader extends WP_Upgrader {
// Check the folder contains at least 1 valid plugin.
$plugins_found = false;
foreach ( glob( $working_directory . '*.php' ) as $file ) {
$info = get_plugin_data($file, false, false);
if ( !empty( $info['Name'] ) ) {
$plugins_found = true;
break;
$files = glob( $working_directory . '*.php' );
if ( $files ) {
foreach ( $files as $file ) {
$info = get_plugin_data( $file, false, false );
if ( ! empty( $info['Name'] ) ) {
$plugins_found = true;
break;
}
}
}
......
......@@ -1542,7 +1542,7 @@ function _admin_notice_post_locked() {
// Allow plugins to prevent some users overriding the post lock
if ( $override ) {
?>
<a class="button button-primary wp-tab-last" href="<?php echo esc_url( add_query_arg( 'get-post-lock', '1', get_edit_post_link( $post->ID, 'url' ) ) ); ?>"><?php _e('Take over'); ?></a>
<a class="button button-primary wp-tab-last" href="<?php echo esc_url( add_query_arg( 'get-post-lock', '1', wp_nonce_url( get_edit_post_link( $post->ID, 'url' ), 'lock-post_' . $post->ID ) ) ); ?>"><?php _e('Take over'); ?></a>
<?php
}
......
......@@ -1249,8 +1249,11 @@ function _upgrade_422_find_genericons_files_in_folder( $directory ) {
$files[] = "{$directory}example.html";
}
foreach ( glob( $directory . '*', GLOB_ONLYDIR ) as $dir ) {
$files = array_merge( $files, _upgrade_422_find_genericons_files_in_folder( $dir ) );
$dirs = glob( $directory . '*', GLOB_ONLYDIR );
if ( $dirs ) {
foreach ( $dirs as $dir ) {
$files = array_merge( $files, _upgrade_422_find_genericons_files_in_folder( $dir ) );
}
}
return $files;
......
......@@ -492,7 +492,7 @@ var wpNavMenu;
title = menus.subMenuFocus.replace( '%1$s', itemName ).replace( '%2$d', itemPosition ).replace( '%3$s', parentItemName );
}
$this.prop('title', title).html( title );
$this.prop('title', title).text( title );
// Mark this item's accessibility as refreshed
$this.data( 'needs_accessibility_refresh', false );
......
This diff is collapsed.
......@@ -160,6 +160,7 @@ case 'edit':
wp_die( __( 'You can&#8217;t edit this item because it is in the Trash. Please restore it and try again.' ) );
if ( ! empty( $_GET['get-post-lock'] ) ) {
check_admin_referer( 'lock-post_' . $post_id );
wp_set_post_lock( $post_id );
wp_redirect( get_edit_post_link( $post_id, 'url' ) );
exit();
......
......@@ -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.3
Version: 3.1.1
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.3' );
define( 'AKISMET_VERSION', '3.1.1' );
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-f0-9]/i', '', $_POST['key'] );
$new_key = preg_replace( '/[^a-h0-9]/i', '', $_POST['key'] );
$old_key = Akismet::get_api_key();
if ( empty( $new_key ) ) {
......@@ -290,6 +290,15 @@ 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. ',
......@@ -300,16 +309,15 @@ class Akismet_Admin {
$intro = sprintf( __('<a href="%s">Akismet</a> blocks spam from getting to your blog. ', 'akismet'), 'https://akismet.com/wordpress/' );
}
$link = add_query_arg( array( 'comment_status' => 'spam' ), admin_url( 'edit-comments.php' ) );
$link = function_exists( 'esc_url' ) ? esc_url( $link ) : clean_url( $link );
if ( $queue_count = self::get_spam_count() ) {
$queue_text = sprintf( _n(
'There&#8217;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 ), esc_url( $link ) );
, 'akismet'), number_format_i18n( $queue_count ), $link );
} else {
$queue_text = sprintf( __( "There&#8217;s nothing in your <a href='%s'>spam queue</a> at the moment." , 'akismet'), esc_url( $link ) );
$queue_text = sprintf( __( "There&#8217;s nothing in your <a href='%s'>spam queue</a> at the moment." , 'akismet'), $link );
}
$text = $intro . '<br />' . $queue_text;
......@@ -371,22 +379,17 @@ 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'], '', 'recheck-spam' );
Akismet::update_comment_history( $c['comment_ID'], __('Akismet re-checked and caught this comment as spam', 'akismet'), 'check-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'], '', 'recheck-ham' );
Akismet::update_comment_history( $c['comment_ID'], __('Akismet re-checked and cleared this comment', 'akismet'), 'check-ham' );
// abnormal result: error
} else {
update_comment_meta( $c['comment_ID'], 'akismet_result', 'error' );
Akismet::update_comment_history(
$c['comment_ID'],
'',
'recheck-error',
array( 'response' => substr( $response[1], 0, 50 ) )
);
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' );
}
delete_comment_meta( $c['comment_ID'], 'akismet_rechecking' );
......@@ -491,95 +494,11 @@ 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';
$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 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>';
}
echo '</div>';
}
}
......@@ -712,16 +631,13 @@ class Akismet_Admin {
}
public static function get_akismet_user( $api_key ) {
$akismet_user = false;
$subscription_verification = Akismet::http_post( Akismet::build_query( array( 'key' => $api_key, 'blog' => get_bloginfo( 'url' ) ) ), 'get-subscription' );
if ( ! empty( $subscription_verification[1] ) ) {
if ( 'invalid' !== $subscription_verification[1] ) {
$akismet_user = json_decode( $subscription_verification[1] );
}
}
$akismet_user = Akismet::http_post( Akismet::build_query( array( 'key' => $api_key ) ), 'get-subscription' );
if ( ! empty( $akismet_user[1] ) )
$akismet_user = json_decode( $akismet_user[1] );
else
$akismet_user = false;
return $akismet_user;
}
......@@ -729,13 +645,12 @@ class Akismet_Admin {
$stat_totals = array();
foreach( array( '6-months', 'all' ) as $interval ) {
$response = Akismet::http_post( Akismet::build_query( array( 'blog' => get_bloginfo( 'url' ), 'key' => $api_key, 'from' => $interval ) ), 'get-stats' );
$response = Akismet::http_post( Akismet::build_query( array( 'blog' => urlencode( get_bloginfo('url') ), 'key' => $api_key, 'from' => $interval ) ), 'get-stats' );
if ( ! empty( $response[1] ) ) {
$stat_totals[$interval] = json_decode( $response[1] );
}
}
return $stat_totals;
}
......@@ -812,7 +727,7 @@ class Akismet_Admin {
}
}
if ( $api_key = Akismet::get_api_key() && ( empty( self::$notices['status'] ) || 'existing-key-invalid' != self::$notices['status'] ) ) {
if ( $api_key = Akismet::get_api_key() ) {
self::display_configuration_page();
return;
}
......@@ -853,16 +768,8 @@ class Akismet_Admin {
public static function display_configuration_page() {
$api_key = Akismet::get_api_key();
$akismet_user = self::get_akismet_user( $api_key );
if ( ! $akismet_user ) {
// This could happen if the user's key became invalid after it was previously valid and successfully set up.
self::$notices['status'] = 'existing-key-invalid';
self::display_start_page();
return;
}
$stat_totals = self::get_stats( $api_key );
// If unset, create the new strictness option using the old discard option to determine its default
if ( get_option( 'akismet_strictness' ) === false )
add_option( 'akismet_strictness', (get_option('akismet_discard_month') === 'true' ? '1' : '0') );
......
......@@ -9,8 +9,7 @@ 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();
......@@ -67,14 +66,7 @@ class Akismet {
if ( $response[1] != 'valid' && $response[1] != 'invalid' )
return 'failed';
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';
self::update_alert( $response );
return $response[1];
}
......@@ -132,7 +124,9 @@ class Akismet {
do_action( 'akismet_comment_check_response', $response );
$commentdata['comment_as_submitted'] = array_intersect_key( $comment, self::$comment_as_submitted_allowed_keys );
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['akismet_result'] = $response[1];
if ( isset( $response[0]['x-akismet-pro-tip'] ) )
......@@ -234,32 +228,23 @@ 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, '', 'check-spam' );
self::update_comment_history( $comment->comment_ID, __('Akismet caught this comment as spam', 'akismet'), 'check-spam' );
if ( $comment->comment_approved != 'spam' )
self::update_comment_history(
$comment->comment_ID,
'',
'status-changed-'.$comment->comment_approved
);
self::update_comment_history( $comment->comment_ID, sprintf( __('Comment status was changed to %s', 'akismet'), $comment->comment_approved), '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, '', 'check-ham' );
self::update_comment_history( $comment->comment_ID, __('Akismet cleared this comment', 'akismet'), '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, '', 'wp-blacklisted' );
self::update_comment_history( $comment->comment_ID, __('Comment was caught by wp_blacklist_check', 'akismet'), 'wp-blacklisted' );
else
self::update_comment_history( $comment->comment_ID, '', 'status-changed-'.$comment->comment_approved );
self::update_comment_history( $comment->comment_ID, sprintf( __('Comment status was changed to %s', 'akismet'), $comment->comment_approved), '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,
'',
'check-error',
array( 'response' => substr( self::$last_comment['akismet_result'], 0, 50 ) )
);
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' );
}
// record the complete original data as submitted for checking
......@@ -365,15 +350,8 @@ class Akismet {
return $history;
}
/**
* 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 ) {
// log an event for a given comment, storing it in comment_meta
public static function update_comment_history( $comment_id, $message, $event=null ) {
global $current_user;
// failsafe for old WP versions
......@@ -381,19 +359,15 @@ 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 );
......@@ -469,7 +443,7 @@ class Akismet {
}
}
self::update_comment_history( $comment->comment_ID, '', 'status-' . $new_status );
self::update_comment_history( $comment->comment_ID, sprintf( __('%1$s changed the comment status to %2$s', 'akismet'), $reporter, $new_status ), 'status-' . $new_status );
}
public static function submit_spam_comment( $comment_id ) {
......@@ -486,7 +460,7 @@ class Akismet {
return;
// use the original version stored in comment_meta if available
$as_submitted = self::sanitize_comment_as_submitted( get_comment_meta( $comment_id, 'akismet_as_submitted', true ) );
$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 );
......@@ -514,7 +488,7 @@ class Akismet {
$response = Akismet::http_post( Akismet::build_query( $comment ), 'submit-spam' );
if ( $comment->reporter ) {
self::update_comment_history( $comment_id, '', 'report-spam' );
self::update_comment_history( $comment_id, sprintf( __('%s reported this comment as spam', 'akismet'), $comment->reporter ), 'report-spam' );
update_comment_meta( $comment_id, 'akismet_user_result', 'true' );
update_comment_meta( $comment_id, 'akismet_user', $comment->reporter );
}
......@@ -532,7 +506,7 @@ class Akismet {
return;
// use the original version stored in comment_meta if available
$as_submitted = self::sanitize_comment_as_submitted( get_comment_meta( $comment_id, 'akismet_as_submitted', true ) );
$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 );
......@@ -560,7 +534,7 @@ class Akismet {
$response = self::http_post( Akismet::build_query( $comment ), 'submit-ham' );
if ( $comment->reporter ) {
self::update_comment_history( $comment_id, '', 'report-ham' );
self::update_comment_history( $comment_id, sprintf( __('%s reported this comment as not spam', 'akismet'), $comment->reporter ), 'report-ham' );
update_comment_meta( $comment_id, 'akismet_user_result', 'false' );
update_comment_meta( $comment_id, 'akismet_user', $comment->reporter );
}
......@@ -599,19 +573,19 @@ class Akismet {
add_comment_meta( $comment_id, 'akismet_rechecking', true );
$status = self::check_db_comment( $comment_id, 'retry' );
$event = '';
$msg = '';
if ( $status == 'true' ) {
$event = 'cron-retry-spam';
$msg = __( 'Akismet caught this comment as spam during an automatic retry.' , 'akismet');
} elseif ( $status == 'false' ) {
$event = 'cron-retry-ham';
$msg = __( 'Akismet cleared this comment during an automatic retry.' , 'akismet');
}
// 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( $event ) ) {
if ( !empty( $msg ) ) {
delete_comment_meta( $comment_id, 'akismet_error' );
self::update_comment_history( $comment_id, '', $event );
self::update_comment_history( $comment_id, $msg, 'cron-retry' );
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 );
......@@ -707,16 +681,8 @@ 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']
|| 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'] )
)
&& $comment1['comment_author'] == $comment2['comment_author']
&& $comment1['comment_author_email'] == $comment2['comment_author_email']
);
}
......@@ -916,12 +882,8 @@ class Akismet {
do_action( 'akismet_https_disabled' );
}
$simplified_response = array( $response['headers'], $response['body'] );
self::update_alert( $simplified_response );
return $simplified_response;
return array( $response['headers'], $response['body'] );
}
// given a response from an API call like check_key_status(), update the alert code options if an alert is present.
......@@ -1037,7 +999,7 @@ p {
* @static
*/
public static function plugin_deactivation( ) {
return self::deactivate_key( self::get_api_key() );
//tidy up
}
/**
......@@ -1123,26 +1085,4 @@ 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 ) {