Commit d668b6dd authored by lucha's avatar lucha
Browse files

[auto] plugin: akismet 3.3.4

parent 9d4a0d31
...@@ -3,6 +3,8 @@ jQuery( function ( $ ) { ...@@ -3,6 +3,8 @@ jQuery( function ( $ ) {
var mshotSecondTryTimer = null var mshotSecondTryTimer = null
var mshotThirdTryTimer = null var mshotThirdTryTimer = null
var mshotEnabledLinkSelector = 'a[id^="author_comment_url"], tr.pingback td.column-author a:first-of-type, td.comment p a';
$('.akismet-status').each(function () { $('.akismet-status').each(function () {
var thisId = $(this).attr('commentid'); var thisId = $(this).attr('commentid');
$(this).prependTo('#comment-' + thisId + ' .column-comment'); $(this).prependTo('#comment-' + thisId + ' .column-comment');
...@@ -82,7 +84,7 @@ jQuery( function ( $ ) { ...@@ -82,7 +84,7 @@ jQuery( function ( $ ) {
}); });
// Show a preview image of the hovered URL. Applies to author URLs and URLs inside the comments. // Show a preview image of the hovered URL. Applies to author URLs and URLs inside the comments.
$( '#the-comment-list' ).on( 'mouseover', 'a[id^="author_comment_url"], tr.pingback td.column-author a:first-of-type, td.comment p a', function () { $( '#the-comment-list' ).on( 'mouseover', mshotEnabledLinkSelector, function () {
clearTimeout( mshotRemovalTimer ); clearTimeout( mshotRemovalTimer );
if ( $( '.akismet-mshot' ).length > 0 ) { if ( $( '.akismet-mshot' ).length > 0 ) {
...@@ -99,9 +101,9 @@ jQuery( function ( $ ) { ...@@ -99,9 +101,9 @@ jQuery( function ( $ ) {
clearTimeout( mshotSecondTryTimer ); clearTimeout( mshotSecondTryTimer );
clearTimeout( mshotThirdTryTimer ); clearTimeout( mshotThirdTryTimer );
var thisHref = encodeURIComponent( $( this ).attr( 'href' ) ); var thisHref = $( this ).attr( 'href' );
var mShot = $( '<div class="akismet-mshot mshot-container"><div class="mshot-arrow"></div><img src="//s0.wordpress.com/mshots/v1/' + thisHref + '?w=900" width="450" height="338" class="mshot-image" /></div>' ); var mShot = $( '<div class="akismet-mshot mshot-container"><div class="mshot-arrow"></div><img src="' + akismet_mshot_url( thisHref ) + '" width="450" height="338" class="mshot-image" /></div>' );
mShot.data( 'link', this ); mShot.data( 'link', this );
var offset = $( this ).offset(); var offset = $( this ).offset();
...@@ -115,11 +117,11 @@ jQuery( function ( $ ) { ...@@ -115,11 +117,11 @@ jQuery( function ( $ ) {
// can return a "Generating thumbnail..." image if it doesn't have a thumbnail ready, so we need // can return a "Generating thumbnail..." image if it doesn't have a thumbnail ready, so we need
// to retry to see if we can get the newly generated thumbnail. // to retry to see if we can get the newly generated thumbnail.
mshotSecondTryTimer = setTimeout( function () { mshotSecondTryTimer = setTimeout( function () {
mShot.find( '.mshot-image' ).attr( 'src', '//s0.wordpress.com/mshots/v1/'+thisHref+'?w=900&r=2' ); mShot.find( '.mshot-image' ).attr( 'src', akismet_mshot_url( thisHref, 2 ) );
}, 6000 ); }, 6000 );
mshotThirdTryTimer = setTimeout( function () { mshotThirdTryTimer = setTimeout( function () {
mShot.find( '.mshot-image' ).attr( 'src', '//s0.wordpress.com/mshots/v1/'+thisHref+'?w=900&r=3' ); mShot.find( '.mshot-image' ).attr( 'src', akismet_mshot_url( thisHref, 3 ) );
}, 12000 ); }, 12000 );
$( 'body' ).append( mShot ); $( 'body' ).append( mShot );
...@@ -130,6 +132,18 @@ jQuery( function ( $ ) { ...@@ -130,6 +132,18 @@ jQuery( function ( $ ) {
$( '.akismet-mshot' ).remove(); $( '.akismet-mshot' ).remove();
}, 200 ); }, 200 );
} ).on( 'mouseover', 'tr', function () {
// When the mouse hovers over a comment row, begin preloading mshots for any links in the comment or the comment author.
var linksToPreloadMshotsFor = $( this ).find( mshotEnabledLinkSelector );
linksToPreloadMshotsFor.each( function () {
// Don't attempt to preload an mshot for a single link twice. Browser caching should cover this, but in case of
// race conditions, save a flag locally when we've begun trying to preload one.
if ( ! $( this ).data( 'akismet-mshot-preloaded' ) ) {
akismet_preload_mshot( $( this ).attr( 'href' ) );
$( this ).data( 'akismet-mshot-preloaded', true );
}
} );
} ); } );
$('.checkforspam:not(.button-disabled)').click( function(e) { $('.checkforspam:not(.button-disabled)').click( function(e) {
...@@ -226,4 +240,31 @@ jQuery( function ( $ ) { ...@@ -226,4 +240,31 @@ jQuery( function ( $ ) {
} }
}); });
} }
/**
* Generate an mShot URL if given a link URL.
*
* @param string linkUrl
* @param int retry If retrying a request, the number of the retry.
* @return string The mShot URL;
*/
function akismet_mshot_url( linkUrl, retry ) {
var mshotUrl = '//s0.wordpress.com/mshots/v1/' + encodeURIComponent( linkUrl ) + '?w=900';
if ( retry ) {
mshotUrl += '&r=' + encodeURIComponent( retry );
}
return mshotUrl;
}
/**
* Begin loading an mShot preview of a link.
*
* @param string linkUrl
*/
function akismet_preload_mshot( linkUrl ) {
var img = new Image();
img.src = akismet_mshot_url( linkUrl );
}
}); });
\ No newline at end of file
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
Plugin Name: Akismet Anti-Spam Plugin Name: Akismet Anti-Spam
Plugin URI: https://akismet.com/ 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: activate the Akismet plugin and then go to your Akismet Settings page to set up your API key. 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: activate the Akismet plugin and then go to your Akismet Settings page to set up your API key.
Version: 3.3.3 Version: 3.3.4
Author: Automattic Author: Automattic
Author URI: https://automattic.com/wordpress-plugins/ Author URI: https://automattic.com/wordpress-plugins/
License: GPLv2 or later License: GPLv2 or later
...@@ -37,7 +37,7 @@ if ( !function_exists( 'add_action' ) ) { ...@@ -37,7 +37,7 @@ if ( !function_exists( 'add_action' ) ) {
exit; exit;
} }
define( 'AKISMET_VERSION', '3.3.3' ); define( 'AKISMET_VERSION', '3.3.4' );
define( 'AKISMET__MINIMUM_WP_VERSION', '3.7' ); define( 'AKISMET__MINIMUM_WP_VERSION', '3.7' );
define( 'AKISMET__PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); define( 'AKISMET__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'AKISMET_DELETE_LIMIT', 100000 ); define( 'AKISMET_DELETE_LIMIT', 100000 );
......
...@@ -1019,7 +1019,7 @@ class Akismet_Admin { ...@@ -1019,7 +1019,7 @@ class Akismet_Admin {
public static function display_status() { public static function display_status() {
if ( ! self::get_server_connectivity() ) { if ( ! self::get_server_connectivity() ) {
Akismet::view( 'notice', compact( 'servers-be-down' ) ); Akismet::view( 'notice', array( 'type' => 'servers-be-down' ) );
} }
else if ( ! empty( self::$notices ) ) { else if ( ! empty( self::$notices ) ) {
foreach ( self::$notices as $index => $type ) { foreach ( self::$notices as $index => $type ) {
......
...@@ -914,6 +914,15 @@ class Akismet { ...@@ -914,6 +914,15 @@ class Akismet {
return $approved; return $approved;
} }
if ( 'trash' === $approved ) {
// If the last comment we checked has had its approval set to 'trash',
// then it failed the comment blacklist check. Let that blacklist override
// the spam check, since users have the (valid) expectation that when
// they fill out their blacklists, comments that match it will always
// end up in the trash.
return $approved;
}
// bump the counter here instead of when the filter is added to reduce the possibility of overcounting // bump the counter here instead of when the filter is added to reduce the possibility of overcounting
if ( $incr = apply_filters('akismet_spam_count_incr', 1) ) if ( $incr = apply_filters('akismet_spam_count_incr', 1) )
update_option( 'akismet_spam_count', get_option('akismet_spam_count') + $incr ); update_option( 'akismet_spam_count', get_option('akismet_spam_count') + $incr );
...@@ -1198,7 +1207,7 @@ p { ...@@ -1198,7 +1207,7 @@ p {
* @param mixed $akismet_debug The data to log. * @param mixed $akismet_debug The data to log.
*/ */
public static function log( $akismet_debug ) { public static function log( $akismet_debug ) {
if ( apply_filters( 'akismet_debug_log', defined( 'WP_DEBUG' ) && WP_DEBUG && defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) ) { if ( apply_filters( 'akismet_debug_log', defined( 'WP_DEBUG' ) && WP_DEBUG && defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG && defined( 'AKISMET_DEBUG' ) && AKISMET_DEBUG ) ) {
error_log( print_r( compact( 'akismet_debug' ), true ) ); error_log( print_r( compact( 'akismet_debug' ), true ) );
} }
} }
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
Contributors: matt, ryan, andy, mdawaffe, tellyworth, josephscott, lessbloat, eoigal, cfinke, automattic, jgs 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 Tags: akismet, comments, spam, antispam, anti-spam, anti spam, comment moderation, comment spam, contact form spam, spam comments
Requires at least: 3.7 Requires at least: 3.7
Tested up to: 4.8 Tested up to: 4.8.1
Stable tag: 3.3.3 Stable tag: 3.3.4
License: GPLv2 or later License: GPLv2 or later
Akismet checks your comments and contact form submissions against our global database of spam to protect you and your site from malicious content. Akismet checks your comments and contact form submissions against our global database of spam to protect you and your site from malicious content.
...@@ -30,6 +30,13 @@ Upload the Akismet plugin to your blog, Activate it, then enter your [Akismet.co ...@@ -30,6 +30,13 @@ Upload the Akismet plugin to your blog, Activate it, then enter your [Akismet.co
== Changelog == == Changelog ==
= 3.3.4 =
* Disabled Akismet's debug log output by default unless AKISMET_DEBUG is defined.
* URL previews now begin preloading when the mouse moves near them in the comments section of wp-admin.
* When a comment is caught by the Comment Blacklist, Akismet will always allow it to stay in the trash even if it is spam as well.
* Fixed a bug that was preventing an error from being shown when a site can't reach Akismet's servers.
= 3.3.3 = = 3.3.3 =
*Release Date - 13 July 2017* *Release Date - 13 July 2017*
......
...@@ -46,8 +46,8 @@ ...@@ -46,8 +46,8 @@
</div> </div>
<?php elseif ( $type == 'servers-be-down' ) :?> <?php elseif ( $type == 'servers-be-down' ) :?>
<div class="akismet-alert akismet-critical"> <div class="akismet-alert akismet-critical">
<h3 class="akismet-key-status failed"><?php esc_html_e("Akismet can&#8217;t connect to your site.", 'akismet'); ?></h3> <h3 class="akismet-key-status failed"><?php esc_html_e("Your site can&#8217;t connect to the Akismet servers.", 'akismet'); ?></h3>
<p class="akismet-description"><?php printf( __('Your firewall may be blocking Akismet. Please contact your host and refer to <a href="%s" target="_blank">our guide about firewalls</a>.', 'akismet'), 'https://blog.akismet.com/akismet-hosting-faq/'); ?></p> <p class="akismet-description"><?php printf( __('Your firewall may be blocking Akismet from connecting to its API. Please contact your host and refer to <a href="%s" target="_blank">our guide about firewalls</a>.', 'akismet'), 'https://blog.akismet.com/akismet-hosting-faq/'); ?></p>
</div> </div>
<?php elseif ( $type == 'active-dunning' ) :?> <?php elseif ( $type == 'active-dunning' ) :?>
<div class="akismet-alert akismet-critical"> <div class="akismet-alert akismet-critical">
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment