From cef14337111244cc052cd723ffec9b83001ca94d Mon Sep 17 00:00:00 2001 From: Nikolai Kristiansen Date: Wed, 17 Jun 2015 19:08:35 +0200 Subject: [PATCH] Updates --- wp-content/languages/admin-nb_NO.mo | Bin 346809 -> 346805 bytes wp-content/languages/admin-nb_NO.po | 12 +- wp-content/plugins/akismet/akismet.php | 4 +- .../plugins/akismet/class.akismet-admin.php | 122 +++++++++++++++--- wp-content/plugins/akismet/class.akismet.php | 122 +++++++++++++----- wp-content/plugins/akismet/readme.txt | 14 +- wp-content/plugins/akismet/views/config.php | 2 +- wp-content/plugins/akismet/views/notice.php | 27 +++- wp-content/plugins/akismet/views/start.php | 8 +- 9 files changed, 238 insertions(+), 73 deletions(-) diff --git a/wp-content/languages/admin-nb_NO.mo b/wp-content/languages/admin-nb_NO.mo index 977027b2f9a70314dcbdd09fd4c2278d1f5d2cad..f29a2e1350efbe8f4f1383151bce9f2ed8c92f0b 100644 GIT binary patch delta 4063 zcmXZed6bXW9mnzSaIbZ2!&t_QeJ8>&mKodFNn%Szlh72gv>GC%;v9)5!pTT#>Cw^< zd*+Cwj%`jVAv6iKC+IMxjm#Kg8>tYLV9@vH_dI{S?)N_Tx%<7(^Xan0kC!EG8=W1L zF|*v=&JuAKHo+5^g#W_|SoJe!@mLqDVhc>iu2=7;#OgBwswk+k1gZA`=ZI0RqEsW<_z z<7FK24@MMcmVUrl2jb@rI!nVv7;6~S;o~@+az)rB&H@{G*x5rKEIHzA94-H7+&YT~#&XAak*Mw)}K@_Y-< zCT@0G`GMI65*pcN)LI`yEx}oAigEej^X91CJpi>Cr=j-BLeySZg<9J!n1=^&0j~TP zo0f(fpK&&dc*5CmQ-6WQv~Ml{?JOA+|Kn^Krs7~cggdeNH_p1^QPdvs=faL8V`Jie zr~&*2W4j-#6EDT{xDi|8f^VJO#2u(joKxT|&~E*bgx2UtWIpP+6rmctgbnclYUK3` zosGc^Y=x^Z6%S%-yoYVD*?DJ=P^YKICA8`tXo{4O3N z-tm*O>l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bO7|w|*}4@yf?_#H&y3heiMm=}&TyeW zqEAqptO_*~oiknN&**v7X?YDb@~7g7R1J3F6;iL!5_ExELGY8tjCBL3QL5s{Zrnsp2an z^k5aLfofDo!Unp~_qrkK#om~X0|MuvDk?^ect5JXqo|oV6_npb)%PHX?I6FMh(Vlx zRUAcz!x&UWv8WDpMom>3w!zVufU{8}T8sM0Jd9exYSh}c8SKmu9EexOU%=uT3)3W>y3_``(K|Bi8^BmO7+bK#vFc zWr62B5?Z?o)C^n;;#;T}@1aKAa){s15L88@Q14AZb#O9j=4J%W#cbk*sJ(Im^=fq z>JIli)D+c$I8=Sp&~+iOLq$b!baazJ0;protect your blog from comment and trackback spam. 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) Sign up for an Akismet API key, 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__ ) ); diff --git a/wp-content/plugins/akismet/class.akismet-admin.php b/wp-content/plugins/akismet/class.akismet-admin.php index 840b367..8f1a4d6 100644 --- a/wp-content/plugins/akismet/class.akismet-admin.php +++ b/wp-content/plugins/akismet/class.akismet-admin.php @@ -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( 'Akismet has protected your site from %2$s spam comment already. ', @@ -309,15 +300,16 @@ class Akismet_Admin { $intro = sprintf( __('Akismet 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 %1$s comment in your spam queue right now.', 'There are %1$s comments 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 spam queue at the moment." , 'akismet'), $link ); + $queue_text = sprintf( __( "There’s nothing in your spam queue at the moment." , 'akismet'), esc_url( $link ) ); } $text = $intro . '
' . $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 '
'; + foreach ( $history as $row ) { $time = date( 'D d M Y @ h:i:m a', $row['time'] ) . ' GMT'; - echo '
' . sprintf( esc_html__('%s ago', 'akismet'), human_time_diff( $row['time'] ) ) . ' - '; - echo esc_html( $row['message'] ) . '
'; + + $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 '
'; + echo '' . sprintf( esc_html__('%s ago', 'akismet'), human_time_diff( $row['time'] ) ) . ''; + echo ' - '; + echo esc_html( $message ); + echo '
'; } + echo '
'; } } @@ -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; } diff --git a/wp-content/plugins/akismet/class.akismet.php b/wp-content/plugins/akismet/class.akismet.php index 5c78652..7a63738 100644 --- a/wp-content/plugins/akismet/class.akismet.php +++ b/wp-content/plugins/akismet/class.akismet.php @@ -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; + } } \ No newline at end of file diff --git a/wp-content/plugins/akismet/readme.txt b/wp-content/plugins/akismet/readme.txt index 4efc81f..c1ed10a 100644 --- a/wp-content/plugins/akismet/readme.txt +++ b/wp-content/plugins/akismet/readme.txt @@ -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* diff --git a/wp-content/plugins/akismet/views/config.php b/wp-content/plugins/akismet/views/config.php index 232d107..74701c9 100644 --- a/wp-content/plugins/akismet/views/config.php +++ b/wp-content/plugins/akismet/views/config.php @@ -67,7 +67,7 @@ - + diff --git a/wp-content/plugins/akismet/views/notice.php b/wp-content/plugins/akismet/views/notice.php index c2fc45a..0a22c8c 100644 --- a/wp-content/plugins/akismet/views/notice.php +++ b/wp-content/plugins/akismet/views/notice.php @@ -75,7 +75,11 @@

-

sign into your account and choose one. Please contact our support team with any questions.', 'akismet'), 'https://akismet.com/account/upgrade/', 'https://akismet.com/contact/' ); ?>

+

+ sign into your account and choose one.', 'akismet'), 'https://akismet.com/account/upgrade/' ); ?> +

+ contact our support team with any questions.', 'akismet' ), 'https://akismet.com/contact/' ); ?> +

@@ -87,16 +91,25 @@
-

+

+

our guide about firewalls and check your server configuration.', 'akismet'), 'http://blog.akismet.com/akismet-hosting-faq/'); ?>

-

-

purchase additional Pro subscriptions or upgrade to an Enterprise subscription that allows the use of Akismet on unlimited sites.

If you have any questions, please get in touch with our support team.', 'akismet'), 'https://akismet.com/account/upgrade/', 'https://akismet.com/contact/'); ?>

+

+

+ purchase additional Pro subscriptions or upgrade to an Enterprise subscription that allows the use of Akismet on unlimited sites.', 'akismet' ), 'http://docs.akismet.com/billing/add-more-sites/' ); ?> +

+ contact our support team with any questions.', 'akismet' ), 'https://akismet.com/contact/'); ?> +

-

-

upgrade to an Enterprise subscription, which covers an unlimited number of sites. Please contact our support team with any questions.', 'akismet'), 'https://akismet.com/account/upgrade/', 'https://akismet.com/contact/'); ?>

+

+

+ upgrade to an Enterprise subscription, which covers an unlimited number of sites.', 'akismet'), 'https://akismet.com/account/upgrade/' ); ?>

+

+ contact our support team with any questions.', 'akismet' ), 'https://akismet.com/contact/'); ?>

+

- + \ No newline at end of file diff --git a/wp-content/plugins/akismet/views/start.php b/wp-content/plugins/akismet/views/start.php index 692b8af..1372b09 100644 --- a/wp-content/plugins/akismet/views/start.php +++ b/wp-content/plugins/akismet/views/start.php @@ -8,7 +8,7 @@ user_email ); ?>
- + @@ -22,7 +22,7 @@ user_email ); ?> - + @@ -64,7 +64,7 @@

- + @@ -85,7 +85,7 @@

- +