diff options
author | 2016-09-11 08:05:14 -0400 | |
---|---|---|
committer | 2016-09-11 08:05:14 -0400 | |
commit | 061978f388440351592eab7cde0b81a5ec5be683 (patch) | |
tree | 1230eb6d73b924facc0d714637a079fac398d78d | |
parent | Update plugin wordpress-mobile-pack to 2.2.5 (diff) | |
download | blogs-gentoo-061978f388440351592eab7cde0b81a5ec5be683.tar.gz blogs-gentoo-061978f388440351592eab7cde0b81a5ec5be683.tar.bz2 blogs-gentoo-061978f388440351592eab7cde0b81a5ec5be683.zip |
Update plugin akismet to 3.2
-rw-r--r-- | plugins/akismet/_inc/akismet.js | 8 | ||||
-rw-r--r-- | plugins/akismet/akismet.php | 11 | ||||
-rw-r--r-- | plugins/akismet/class.akismet-admin.php | 115 | ||||
-rw-r--r-- | plugins/akismet/class.akismet-cli.php | 91 | ||||
-rw-r--r-- | plugins/akismet/class.akismet-widget.php | 6 | ||||
-rw-r--r-- | plugins/akismet/class.akismet.php | 72 | ||||
-rw-r--r-- | plugins/akismet/readme.txt | 15 | ||||
-rw-r--r-- | plugins/akismet/views/config.php | 8 | ||||
-rw-r--r-- | plugins/akismet/views/get.php | 2 | ||||
-rw-r--r-- | plugins/akismet/views/start.php | 12 | ||||
-rw-r--r-- | plugins/akismet/views/stats.php | 2 |
11 files changed, 242 insertions, 100 deletions
diff --git a/plugins/akismet/_inc/akismet.js b/plugins/akismet/_inc/akismet.js index 246c8581..ca4ebd2e 100644 --- a/plugins/akismet/_inc/akismet.js +++ b/plugins/akismet/_inc/akismet.js @@ -45,7 +45,8 @@ jQuery( function ( $ ) { ); } }); - $('.remove_url').live('click', function () { + + $( '#the-comment-list' ).on( 'click', '.remove_url', function () { var thisId = $(this).attr('commentid'); var data = { action: 'comment_author_deurl', @@ -82,8 +83,7 @@ jQuery( function ( $ ) { }); return false; - }); - $('.akismet_undo_link_removal').live('click', function () { + }).on( 'click', '.akismet_undo_link_removal', function () { var thisId = $(this).attr('cid'); var thisUrl = $(this).attr('href'); var data = { @@ -177,7 +177,7 @@ jQuery( function ( $ ) { 'limit': limit }, function(result) { - if (result.processed < limit) { + if (result.counts.processed < limit) { window.location.reload(); } else { diff --git a/plugins/akismet/akismet.php b/plugins/akismet/akismet.php index a65a0d65..61b41fa4 100644 --- a/plugins/akismet/akismet.php +++ b/plugins/akismet/akismet.php @@ -6,7 +6,7 @@ Plugin Name: Akismet Plugin URI: https://akismet.com/ Description: Used by millions, Akismet is quite possibly the best way in the world to <strong>protect your blog from spam</strong>. It keeps your site protected even while you sleep. To get started: 1) Click the "Activate" link to the left of this description, 2) <a href="https://akismet.com/get/">Sign up for an Akismet plan</a> to get an API key, and 3) Go to your Akismet configuration page, and save your API key. -Version: 3.1.11 +Version: 3.2 Author: Automattic Author URI: https://automattic.com/wordpress-plugins/ License: GPLv2 or later @@ -37,8 +37,8 @@ if ( !function_exists( 'add_action' ) ) { exit; } -define( 'AKISMET_VERSION', '3.1.11' ); -define( 'AKISMET__MINIMUM_WP_VERSION', '3.2' ); +define( 'AKISMET_VERSION', '3.2' ); +define( 'AKISMET__MINIMUM_WP_VERSION', '3.7' ); define( 'AKISMET__PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); define( 'AKISMET_DELETE_LIMIT', 100000 ); @@ -50,7 +50,7 @@ require_once( AKISMET__PLUGIN_DIR . 'class.akismet-widget.php' ); add_action( 'init', array( 'Akismet', 'init' ) ); -if ( is_admin() ) { +if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) { require_once( AKISMET__PLUGIN_DIR . 'class.akismet-admin.php' ); add_action( 'init', array( 'Akismet_Admin', 'init' ) ); } @@ -58,3 +58,6 @@ if ( is_admin() ) { //add wrapper class around deprecated akismet functions that are referenced elsewhere require_once( AKISMET__PLUGIN_DIR . 'wrapper.php' ); +if ( defined( 'WP_CLI' ) && WP_CLI ) { + require_once( AKISMET__PLUGIN_DIR . 'class.akismet-cli.php' ); +}
\ No newline at end of file diff --git a/plugins/akismet/class.akismet-admin.php b/plugins/akismet/class.akismet-admin.php index c9e82eb0..2d29cab2 100644 --- a/plugins/akismet/class.akismet-admin.php +++ b/plugins/akismet/class.akismet-admin.php @@ -357,85 +357,68 @@ class Akismet_Admin { Akismet::fix_scheduled_recheck(); - if ( ! ( isset( $_GET['recheckqueue'] ) || ( isset( $_REQUEST['action'] ) && 'akismet_recheck_queue' == $_REQUEST['action'] ) ) ) + if ( ! ( isset( $_GET['recheckqueue'] ) || ( isset( $_REQUEST['action'] ) && 'akismet_recheck_queue' == $_REQUEST['action'] ) ) ) { return; + } + + $result_counts = self::recheck_queue_portion( empty( $_POST['offset'] ) ? 0 : $_POST['offset'], empty( $_POST['limit'] ) ? 100 : $_POST['limit'] ); + if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { + wp_send_json( array( + 'counts' => $result_counts, + )); + } + else { + $redirect_to = isset( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] : admin_url( 'edit-comments.php' ); + wp_safe_redirect( $redirect_to ); + exit; + } + } + + public static function recheck_queue_portion( $start = 0, $limit = 100 ) { + global $wpdb; + $paginate = ''; - if ( isset( $_POST['limit'] ) && isset( $_POST['offset'] ) ) { - $paginate = $wpdb->prepare( " LIMIT %d OFFSET %d", array( $_POST['limit'], $_POST['offset'] ) ); + + if ( $limit <= 0 ) { + $limit = 100; + } + + if ( $start < 0 ) { + $start = 0; } - $moderation = $wpdb->get_results( "SELECT * FROM {$wpdb->comments} WHERE comment_approved = '0'{$paginate}", ARRAY_A ); + + $moderation = $wpdb->get_col( $wpdb->prepare( "SELECT * FROM {$wpdb->comments} WHERE comment_approved = '0' LIMIT %d OFFSET %d", $limit, $start ) ); $result_counts = array( + 'processed' => count( $moderation ), 'spam' => 0, 'ham' => 0, 'error' => 0, ); - foreach ( (array) $moderation as $c ) { - $c['user_ip'] = $c['comment_author_IP']; - $c['user_agent'] = $c['comment_agent']; - $c['referrer'] = ''; - $c['blog'] = get_bloginfo('url'); - $c['blog_lang'] = get_locale(); - $c['blog_charset'] = get_option('blog_charset'); - $c['permalink'] = get_permalink($c['comment_post_ID']); - - $c['user_role'] = ''; - if ( isset( $c['user_ID'] ) ) - $c['user_role'] = Akismet::get_user_roles($c['user_ID']); + foreach ( $moderation as $comment_id ) { + $api_response = Akismet::recheck_comment( $comment_id, 'recheck_queue' ); - if ( Akismet::is_test_mode() ) - $c['is_test'] = 'true'; - - add_comment_meta( $c['comment_ID'], 'akismet_rechecking', true ); - - $response = Akismet::http_post( Akismet::build_query( $c ), 'comment-check' ); - - if ( 'true' == $response[1] ) { - wp_set_comment_status( $c['comment_ID'], 'spam' ); - 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' ); + if ( 'true' === $api_response ) { ++$result_counts['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' ); + } + elseif ( 'false' === $api_response ) { ++$result_counts['ham']; - } else { - // abnormal result: error - 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 ) ) - ); + } + else { ++$result_counts['error']; } - - delete_comment_meta( $c['comment_ID'], 'akismet_rechecking' ); - } - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { - wp_send_json( array( - 'processed' => count((array) $moderation), - 'counts' => $result_counts, - )); - } - else { - $redirect_to = isset( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] : admin_url( 'edit-comments.php' ); - wp_safe_redirect( $redirect_to ); - exit; } + + return $result_counts; } // Adds an 'x' link next to author URLs, clicking will remove the author URL and show an undo link public static function remove_comment_author_url() { if ( !empty( $_POST['id'] ) && check_admin_referer( 'comment_author_url_nonce' ) ) { - $comment = get_comment( intval( $_POST['id'] ), ARRAY_A ); + $comment_id = intval( $_POST['id'] ); + $comment = get_comment( $comment_id, ARRAY_A ); if ( $comment && current_user_can( 'edit_comment', $comment['comment_ID'] ) ) { $comment['comment_author_url'] = ''; do_action( 'comment_remove_author_url' ); @@ -447,7 +430,8 @@ class Akismet_Admin { public static function add_comment_author_url() { if ( !empty( $_POST['id'] ) && !empty( $_POST['url'] ) && check_admin_referer( 'comment_author_url_nonce' ) ) { - $comment = get_comment( intval( $_POST['id'] ), ARRAY_A ); + $comment_id = intval( $_POST['id'] ); + $comment = get_comment( $comment_id, ARRAY_A ); if ( $comment && current_user_can( 'edit_comment', $comment['comment_ID'] ) ) { $comment['comment_author_url'] = esc_url( $_POST['url'] ); do_action( 'comment_add_author_url' ); @@ -689,9 +673,14 @@ class Akismet_Admin { update_option('akismet_available_servers', $servers); update_option('akismet_connectivity_time', time()); } - - $response = wp_remote_get( 'http://rest.akismet.com/1.1/test' ); - + + if ( function_exists( 'wp_http_supports' ) && ( wp_http_supports( array( 'ssl' ) ) ) ) { + $response = wp_remote_get( 'https://rest.akismet.com/1.1/test' ); + } + else { + $response = wp_remote_get( 'http://rest.akismet.com/1.1/test' ); + } + $debug[ 'gethostbynamel' ] = function_exists('gethostbynamel') ? 'exists' : 'not here'; $debug[ 'Servers' ] = $servers; $debug[ 'Test Connection' ] = $response; @@ -731,7 +720,7 @@ 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' ); + $subscription_verification = Akismet::http_post( Akismet::build_query( array( 'key' => $api_key, 'blog' => get_option( 'home' ) ) ), 'get-subscription' ); if ( ! empty( $subscription_verification[1] ) ) { if ( 'invalid' !== $subscription_verification[1] ) { @@ -746,7 +735,7 @@ 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' => get_option( 'home' ), 'key' => $api_key, 'from' => $interval ) ), 'get-stats' ); if ( ! empty( $response[1] ) ) { $stat_totals[$interval] = json_decode( $response[1] ); diff --git a/plugins/akismet/class.akismet-cli.php b/plugins/akismet/class.akismet-cli.php new file mode 100644 index 00000000..b0b48367 --- /dev/null +++ b/plugins/akismet/class.akismet-cli.php @@ -0,0 +1,91 @@ +<?php + +WP_CLI::add_command( 'akismet', 'Akismet_CLI' ); + +/** + * Filter spam comments. + */ +class Akismet_CLI extends WP_CLI_Command { + /** + * Checks one or more comments against the Akismet API. + * + * ## OPTIONS + * <comment_id>... + * : The ID(s) of the comment(s) to check. + * + * [--noaction] + * : Don't change the status of the comment. Just report what Akismet thinks it is. + * + * ## EXAMPLES + * + * wp akismet check 12345 + * + * @alias comment-check + */ + public function check( $args, $assoc_args ) { + foreach ( $args as $comment_id ) { + if ( isset( $assoc_args['noaction'] ) ) { + // Check the comment, but don't reclassify it. + $api_response = Akismet::check_db_comment( $comment_id, 'wp-cli' ); + } + else { + $api_response = Akismet::recheck_comment( $comment_id, 'wp-cli' ); + } + + if ( 'true' === $api_response ) { + WP_CLI::line( sprintf( __( "Comment #%d is spam.", 'akismet' ), $comment_id ) ); + } + else if ( 'false' === $api_response ) { + WP_CLI::line( sprintf( __( "Comment #%d is not spam.", 'akismet' ), $comment_id ) ); + } + else { + if ( false === $api_response ) { + WP_CLI::error( __( "Failed to connect to Akismet.", 'akismet' ) ); + } + else if ( is_wp_error( $api_response ) ) { + WP_CLI::warning( sprintf( __( "Comment #%d could not be checked.", 'akismet' ), $comment_id ) ); + } + } + } + } + + /** + * Recheck all comments in the Pending queue. + * + * ## EXAMPLES + * + * wp akismet recheck_queue + * + * @alias recheck-queue + */ + public function recheck_queue() { + $batch_size = 100; + $start = 0; + + $total_counts = array(); + + do { + $result_counts = Akismet_Admin::recheck_queue_portion( $start, $batch_size ); + + if ( $result_counts['processed'] > 0 ) { + foreach ( $result_counts as $key => $count ) { + if ( ! isset( $total_counts[ $key ] ) ) { + $total_counts[ $key ] = $count; + } + else { + $total_counts[ $key ] += $count; + } + } + $start += $batch_size; + $start -= $result_counts['spam']; // These comments will have been removed from the queue. + } + } while ( $result_counts['processed'] > 0 ); + + WP_CLI::line( sprintf( _n( "Processed %d comment.", "Processed %d comments.", $total_counts['processed'], 'akismet' ), number_format( $total_counts['processed'] ) ) ); + WP_CLI::line( sprintf( _n( "%d comment moved to Spam.", "%d comments moved to Spam.", $total_counts['spam'], 'akismet' ), number_format( $total_counts['spam'] ) ) ); + + if ( $total_counts['error'] ) { + WP_CLI::line( sprintf( _n( "%d comment could not be checked.", "%d comments could not be checked.", $total_counts['error'], 'akismet' ), number_format( $total_counts['error'] ) ) ); + } + } +}
\ No newline at end of file diff --git a/plugins/akismet/class.akismet-widget.php b/plugins/akismet/class.akismet-widget.php index a2c4f303..474f7592 100644 --- a/plugins/akismet/class.akismet-widget.php +++ b/plugins/akismet/class.akismet-widget.php @@ -66,7 +66,7 @@ class Akismet_Widget extends WP_Widget { $title = $instance['title']; } else { - $title = __( 'Spam Blocked' , 'akismet'); + $title = __( 'Spam Blocked' , 'akismet' ); } ?> @@ -86,6 +86,10 @@ class Akismet_Widget extends WP_Widget { function widget( $args, $instance ) { $count = get_option( 'akismet_spam_count' ); + if ( ! isset( $instance['title'] ) ) { + $instance['title'] = __( 'Spam Blocked' , 'akismet' ); + } + echo $args['before_widget']; if ( ! empty( $instance['title'] ) ) { echo $args['before_title']; diff --git a/plugins/akismet/class.akismet.php b/plugins/akismet/class.akismet.php index 2e8a3493..0d312e98 100644 --- a/plugins/akismet/class.akismet.php +++ b/plugins/akismet/class.akismet.php @@ -64,7 +64,7 @@ class Akismet { } public static function check_key_status( $key, $ip = null ) { - return self::http_post( Akismet::build_query( array( 'key' => $key, 'blog' => get_option('home') ) ), 'verify-key', $ip ); + return self::http_post( Akismet::build_query( array( 'key' => $key, 'blog' => get_option( 'home' ) ) ), 'verify-key', $ip ); } public static function verify_key( $key, $ip = null ) { @@ -77,7 +77,7 @@ class Akismet { } public static function deactivate_key( $key ) { - $response = self::http_post( Akismet::build_query( array( 'key' => $key, 'blog' => get_option('home') ) ), 'deactivate' ); + $response = self::http_post( Akismet::build_query( array( 'key' => $key, 'blog' => get_option( 'home' ) ) ), 'deactivate' ); if ( $response[1] != 'deactivated' ) return 'failed'; @@ -124,7 +124,7 @@ class Akismet { $comment['user_ip'] = self::get_ip_address(); $comment['user_agent'] = self::get_user_agent(); $comment['referrer'] = self::get_referer(); - $comment['blog'] = get_option('home'); + $comment['blog'] = get_option( 'home' ); $comment['blog_lang'] = get_locale(); $comment['blog_charset'] = get_option('blog_charset'); $comment['permalink'] = get_permalink( $comment['comment_post_ID'] ); @@ -347,10 +347,11 @@ class Akismet { do_action( 'delete_comment', $comment_id ); } - $comma_comment_ids = implode( ', ', array_map('intval', $comment_ids) ); + // Prepared as strings since comment_id is an unsigned BIGINT, and using %d will constrain the value to the maximum signed BIGINT. + $format_string = implode( ", ", array_fill( 0, count( $comment_ids ), '%s' ) ); - $wpdb->query("DELETE FROM {$wpdb->comments} WHERE comment_id IN ( $comma_comment_ids )"); - $wpdb->query("DELETE FROM {$wpdb->commentmeta} WHERE comment_id IN ( $comma_comment_ids )"); + $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->comments} WHERE comment_id IN ( " . $format_string . " )", $comment_ids ) ); + $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->commentmeta} WHERE comment_id IN ( " . $format_string . " )", $comment_ids ) ); clean_comment_cache( $comment_ids ); } @@ -449,27 +450,72 @@ class Akismet { global $wpdb; $c = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->comments} WHERE comment_ID = %d", $id ), ARRAY_A ); - if ( !$c ) - return; + + if ( ! $c ) { + return new WP_Error( 'invalid-comment-id', __( 'Comment not found.', 'akismet' ) ); + } $c['user_ip'] = $c['comment_author_IP']; $c['user_agent'] = $c['comment_agent']; $c['referrer'] = ''; - $c['blog'] = get_option('home'); + $c['blog'] = get_option( 'home' ); $c['blog_lang'] = get_locale(); $c['blog_charset'] = get_option('blog_charset'); $c['permalink'] = get_permalink($c['comment_post_ID']); $c['recheck_reason'] = $recheck_reason; + $c['user_role'] = ''; + if ( isset( $c['user_ID'] ) ) + $c['user_role'] = Akismet::get_user_roles($c['user_ID']); + if ( self::is_test_mode() ) $c['is_test'] = 'true'; $response = self::http_post( Akismet::build_query( $c ), 'comment-check' ); - return ( is_array( $response ) && ! empty( $response[1] ) ) ? $response[1] : false; + if ( ! empty( $response[1] ) ) { + return $response[1]; + } + + return false; } - + public static function recheck_comment( $id, $recheck_reason = 'recheck_queue' ) { + add_comment_meta( $id, 'akismet_rechecking', true ); + + $api_response = self::check_db_comment( $id, $recheck_reason ); + + delete_comment_meta( $id, 'akismet_rechecking' ); + + if ( is_wp_error( $api_response ) ) { + // Invalid comment ID. + } + else if ( 'true' === $api_response ) { + wp_set_comment_status( $id, 'spam' ); + update_comment_meta( $id, 'akismet_result', 'true' ); + delete_comment_meta( $id, 'akismet_error' ); + delete_comment_meta( $id, 'akismet_delayed_moderation_email' ); + Akismet::update_comment_history( $id, '', 'recheck-spam' ); + } + elseif ( 'false' === $api_response ) { + update_comment_meta( $id, 'akismet_result', 'false' ); + delete_comment_meta( $id, 'akismet_error' ); + delete_comment_meta( $id, 'akismet_delayed_moderation_email' ); + Akismet::update_comment_history( $id, '', 'recheck-ham' ); + } + else { + // abnormal result: error + update_comment_meta( $id, 'akismet_result', 'error' ); + Akismet::update_comment_history( + $id, + '', + 'recheck-error', + array( 'response' => substr( $api_response, 0, 50 ) ) + ); + } + + return $api_response; + } public static function transition_comment_status( $new_status, $old_status, $comment ) { @@ -538,7 +584,7 @@ class Akismet { if ( $as_submitted && is_array( $as_submitted ) && isset( $as_submitted['comment_content'] ) ) $comment = (object) array_merge( (array)$comment, $as_submitted ); - $comment->blog = get_bloginfo('url'); + $comment->blog = get_option( 'home' ); $comment->blog_lang = get_locale(); $comment->blog_charset = get_option('blog_charset'); $comment->permalink = get_permalink($comment->comment_post_ID); @@ -584,7 +630,7 @@ class Akismet { if ( $as_submitted && is_array($as_submitted) && isset($as_submitted['comment_content']) ) $comment = (object) array_merge( (array)$comment, $as_submitted ); - $comment->blog = get_bloginfo('url'); + $comment->blog = get_option( 'home' ); $comment->blog_lang = get_locale(); $comment->blog_charset = get_option('blog_charset'); $comment->permalink = get_permalink( $comment->comment_post_ID ); diff --git a/plugins/akismet/readme.txt b/plugins/akismet/readme.txt index 9be516de..41c75408 100644 --- a/plugins/akismet/readme.txt +++ b/plugins/akismet/readme.txt @@ -1,9 +1,9 @@ === Akismet === Contributors: matt, ryan, andy, mdawaffe, tellyworth, josephscott, lessbloat, eoigal, cfinke, automattic, jgs Tags: akismet, comments, spam, antispam, anti-spam, anti spam, comment moderation, comment spam, contact form spam, spam comments -Requires at least: 3.2 -Tested up to: 4.5.2 -Stable tag: 3.1.11 +Requires at least: 3.7 +Tested up to: 4.6.1 +Stable tag: 3.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,15 @@ Upload the Akismet plugin to your blog, Activate it, then enter your [Akismet.co == Changelog == += 3.2 = +*Release Date - 6 September 2016* + +* Added a WP-CLI module. You can now check comments and recheck the moderation queue from the command line. +* Stopped using the deprecated jQuery function `.live()`. +* Fixed a bug in `remove_comment_author_url()` and `add_comment_author_url()` that could generate PHP notices. +* Fixed a bug that could cause an infinite loop for sites with very very very large comment IDs. +* Fixed a bug that could cause the Akismet widget title to be blank. + = 3.1.11 = *Release Date - 12 May 2016* diff --git a/plugins/akismet/views/config.php b/plugins/akismet/views/config.php index d84e21a8..bc8cb977 100644 --- a/plugins/akismet/views/config.php +++ b/plugins/akismet/views/config.php @@ -12,7 +12,7 @@ <a href="<?php echo esc_url( Akismet_Admin::get_page_url( 'stats' ) ); ?>" class=""><?php esc_html_e( 'Summaries' , 'akismet');?></a> </span> - <iframe allowtransparency="true" scrolling="no" frameborder="0" style="width: 100%; height: 215px; overflow: hidden;" src="<?php printf( '//akismet.com/web/1.0/snapshot.php?blog=%s&api_key=%s&height=180&locale=%s', urlencode( get_bloginfo('url') ), Akismet::get_api_key(), get_locale() );?>"></iframe> + <iframe allowtransparency="true" scrolling="no" frameborder="0" style="width: 100%; height: 215px; overflow: hidden;" src="<?php printf( '//akismet.com/web/1.0/snapshot.php?blog=%s&api_key=%s&height=180&locale=%s', urlencode( get_option( 'home' ) ), Akismet::get_api_key(), get_locale() );?>"></iframe> <ul> <li> <h3><?php esc_html_e( 'Past six months' , 'akismet');?></h3> @@ -26,7 +26,7 @@ </li> <li> <h3><?php esc_html_e( 'Accuracy' , 'akismet');?></h3> - <span><?php echo $stat_totals['all']->accuracy; ?>%</span> + <span><?php echo floatval( $stat_totals['all']->accuracy ); ?>%</span> <?php printf( _n( '%s missed spam', '%s missed spam', $stat_totals['all']->missed_spam, 'akismet' ), number_format( $stat_totals['all']->missed_spam ) ); ?> | <?php printf( _n( '%s false positive', '%s false positives', $stat_totals['all']->false_positives, 'akismet' ), number_format( $stat_totals['all']->false_positives ) ); ?> @@ -63,7 +63,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" 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="<?php echo esc_attr( 'regular-text code ' . $akismet_user->status ); ?>"></span> </td> </tr> <?php endif; ?> @@ -166,7 +166,7 @@ <th scope="row" align="left"><?php esc_html_e( 'Subscription Type' , 'akismet');?></th> <td width="5%"/> <td align="left"> - <span><?php echo $akismet_user->account_name; ?></span> + <span><?php echo esc_html( $akismet_user->account_name ); ?></span> </td> </tr> <tr> diff --git a/plugins/akismet/views/get.php b/plugins/akismet/views/get.php index 72a3b6ef..4bd6a9c5 100644 --- a/plugins/akismet/views/get.php +++ b/plugins/akismet/views/get.php @@ -1,6 +1,6 @@ <form name="akismet_activate" action="https://akismet.com/get/" method="POST" target="_blank"> <input type="hidden" name="passback_url" value="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>"/> - <input type="hidden" name="blog" value="<?php echo esc_url( get_bloginfo('url') ); ?>"/> + <input type="hidden" name="blog" value="<?php echo esc_url( get_option( 'home' ) ); ?>"/> <input type="hidden" name="redirect" value="<?php echo isset( $redirect ) ? $redirect : 'plugin-signup'; ?>"/> <input type="submit" class="<?php echo isset( $classes ) && count( $classes ) > 0 ? implode( ' ', $classes ) : 'button button-primary';?>" value="<?php echo esc_attr( $text ); ?>"/> </form>
\ No newline at end of file diff --git a/plugins/akismet/views/start.php b/plugins/akismet/views/start.php index 75eb0324..751da6e6 100644 --- a/plugins/akismet/views/start.php +++ b/plugins/akismet/views/start.php @@ -9,8 +9,8 @@ </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_url( Akismet_Admin::get_page_url() ); ?>"/> - <input type="hidden" name="blog" value="<?php echo esc_url( get_bloginfo('url') ); ?>"/> - <input type="hidden" name="auto-connect" value="<?php echo $akismet_user->ID;?>"/> + <input type="hidden" name="blog" value="<?php echo esc_url( get_option( 'home' ) ); ?>"/> + <input type="hidden" name="auto-connect" value="<?php echo esc_attr( $akismet_user->ID ); ?>"/> <input type="hidden" name="redirect" value="plugin-signup"/> <input type="submit" class="button button-primary" value="<?php esc_attr_e( 'Register for Akismet' , 'akismet'); ?>"/> </form> @@ -20,12 +20,12 @@ <div class="activate-highlight activate-option"> <div class="option-description" style="width:75%;"> <strong class="small-heading"><?php esc_html_e('Connected via Jetpack', 'akismet'); ?></strong> - <?php printf( esc_html__( 'Your subscription for %s is cancelled' , 'akismet'), $akismet_user->user_email ); ?> + <?php echo esc_html( sprintf( __( '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_url( Akismet_Admin::get_page_url() ); ?>"/> - <input type="hidden" name="blog" value="<?php echo esc_url( get_bloginfo('url') ); ?>"/> - <input type="hidden" name="user_id" value="<?php echo $akismet_user->ID;?>"/> + <input type="hidden" name="blog" value="<?php echo esc_url( get_option( 'home' ) ); ?>"/> + <input type="hidden" name="user_id" value="<?php echo esc_attr( $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'); ?>"/> </form> @@ -34,7 +34,7 @@ <p><?php esc_html_e('Akismet eliminates spam from your site.', 'akismet'); ?></p> <div class="activate-highlight centered activate-option"> <strong class="small-heading"><?php esc_html_e( 'Connected via Jetpack' , 'akismet'); ?></strong> - <h3 class="alert-text"><?php printf( esc_html__( 'Your subscription for %s is suspended' , 'akismet'), $akismet_user->user_email ); ?></h3> + <h3 class="alert-text"><?php echo esc_html( sprintf( __( 'Your subscription for %s is suspended' , 'akismet'), $akismet_user->user_email ) ); ?></h3> <p><?php esc_html_e('No worries! Get in touch and we’ll sort this out.', 'akismet'); ?></p> <a href="https://akismet.com/contact" class="button button-primary"><?php esc_html_e( 'Contact Akismet support' , 'akismet'); ?></a> </div> diff --git a/plugins/akismet/views/stats.php b/plugins/akismet/views/stats.php index 1ca76611..a536f3a0 100644 --- a/plugins/akismet/views/stats.php +++ b/plugins/akismet/views/stats.php @@ -1,4 +1,4 @@ <div class="wrap"> <h2><?php esc_html_e( 'Akismet Stats' , 'akismet');?><?php if ( !isset( $hide_settings_link ) ): ?> <a href="<?php echo esc_url( Akismet_Admin::get_page_url() );?>" class="add-new-h2"><?php esc_html_e( 'Settings' , 'akismet');?></a><?php endif;?></h2> - <iframe src="<?php echo esc_url( sprintf( '//akismet.com/web/1.0/user-stats.php?blog=%s&api_key=%s&locale=%s', urlencode( get_bloginfo('url') ), Akismet::get_api_key(), get_locale() ) ); ?>" width="100%" height="2500px" frameborder="0" id="akismet-stats-frame"></iframe> + <iframe src="<?php echo esc_url( sprintf( '//akismet.com/web/1.0/user-stats.php?blog=%s&api_key=%s&locale=%s', urlencode( get_option( 'home' ) ), Akismet::get_api_key(), get_locale() ) ); ?>" width="100%" height="2500px" frameborder="0" id="akismet-stats-frame"></iframe> </div>
\ No newline at end of file |