Version Description
Release Date - 17th March, 2015
- Improvements to the "Remove comment author URL" JavaScript
- Include the pingback pre-check from the 2.6 branch.
Download this release
Release Info
Developer | jgs |
Plugin | Akismet Anti-Spam |
Version | 3.1.1 |
Comparing to | |
See all releases |
Code changes from version 3.1 to 3.1.1
- _inc/akismet.js +4 -2
- akismet.php +2 -2
- class.akismet.php +64 -0
- readme.txt +8 -2
- wrapper.php +6 -0
_inc/akismet.js
CHANGED
@@ -18,9 +18,11 @@ jQuery( function ( $ ) {
|
|
18 |
var thisId = $(this).attr('commentid');
|
19 |
$(this).insertAfter('#comment-' + thisId + ' .author strong:first').show();
|
20 |
});
|
21 |
-
$('#the-comment-list').find('tr.comment, tr[id ^= "comment-"]').find('.column-author a[title
|
|
|
22 |
var thisTitle = $(this).attr('title');
|
23 |
-
|
|
|
24 |
|
25 |
$(this).attr("id", "author_comment_url_"+ thisCommentId[1]);
|
26 |
|
18 |
var thisId = $(this).attr('commentid');
|
19 |
$(this).insertAfter('#comment-' + thisId + ' .author strong:first').show();
|
20 |
});
|
21 |
+
$('#the-comment-list').find('tr.comment, tr[id ^= "comment-"]').find('.column-author a[title]').each(function () {
|
22 |
+
// Comment author URLs are the only URL with a title attribute in the author column.
|
23 |
var thisTitle = $(this).attr('title');
|
24 |
+
|
25 |
+
var thisCommentId = $(this).parents('tr:first').attr('id').split("-");
|
26 |
|
27 |
$(this).attr("id", "author_comment_url_"+ thisCommentId[1]);
|
28 |
|
akismet.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
Plugin Name: Akismet
|
7 |
Plugin URI: http://akismet.com/
|
8 |
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.
|
9 |
-
Version: 3.1
|
10 |
Author: Automattic
|
11 |
Author URI: http://automattic.com/wordpress-plugins/
|
12 |
License: GPLv2 or later
|
@@ -35,7 +35,7 @@ if ( !function_exists( 'add_action' ) ) {
|
|
35 |
exit;
|
36 |
}
|
37 |
|
38 |
-
define( 'AKISMET_VERSION', '3.1' );
|
39 |
define( 'AKISMET__MINIMUM_WP_VERSION', '3.2' );
|
40 |
define( 'AKISMET__PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
41 |
define( 'AKISMET__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
6 |
Plugin Name: Akismet
|
7 |
Plugin URI: http://akismet.com/
|
8 |
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.
|
9 |
+
Version: 3.1.1
|
10 |
Author: Automattic
|
11 |
Author URI: http://automattic.com/wordpress-plugins/
|
12 |
License: GPLv2 or later
|
35 |
exit;
|
36 |
}
|
37 |
|
38 |
+
define( 'AKISMET_VERSION', '3.1.1' );
|
39 |
define( 'AKISMET__MINIMUM_WP_VERSION', '3.2' );
|
40 |
define( 'AKISMET__PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
41 |
define( 'AKISMET__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
class.akismet.php
CHANGED
@@ -42,6 +42,9 @@ class Akismet {
|
|
42 |
|
43 |
add_action( 'transition_comment_status', array( 'Akismet', 'transition_comment_status' ), 10, 3 );
|
44 |
|
|
|
|
|
|
|
45 |
if ( '3.0.5' == $GLOBALS['wp_version'] ) {
|
46 |
remove_filter( 'comment_text', 'wp_kses_data' );
|
47 |
if ( is_admin() )
|
@@ -1021,4 +1024,65 @@ p {
|
|
1021 |
error_log( print_r( compact( 'akismet_debug' ), true ) );
|
1022 |
}
|
1023 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1024 |
}
|
42 |
|
43 |
add_action( 'transition_comment_status', array( 'Akismet', 'transition_comment_status' ), 10, 3 );
|
44 |
|
45 |
+
// Run this early in the pingback call, before doing a remote fetch of the source uri
|
46 |
+
add_action( 'xmlrpc_call', array( 'Akismet', 'pre_check_pingback' ) );
|
47 |
+
|
48 |
if ( '3.0.5' == $GLOBALS['wp_version'] ) {
|
49 |
remove_filter( 'comment_text', 'wp_kses_data' );
|
50 |
if ( is_admin() )
|
1024 |
error_log( print_r( compact( 'akismet_debug' ), true ) );
|
1025 |
}
|
1026 |
}
|
1027 |
+
|
1028 |
+
public static function pre_check_pingback( $method ) {
|
1029 |
+
if ( $method !== 'pingback.ping' )
|
1030 |
+
return;
|
1031 |
+
|
1032 |
+
global $wp_xmlrpc_server;
|
1033 |
+
|
1034 |
+
if ( !is_object( $wp_xmlrpc_server ) )
|
1035 |
+
return false;
|
1036 |
+
|
1037 |
+
// Lame: tightly coupled with the IXR class.
|
1038 |
+
$args = $wp_xmlrpc_server->message->params;
|
1039 |
+
|
1040 |
+
if ( !empty( $args[1] ) ) {
|
1041 |
+
$post_id = url_to_postid( $args[1] );
|
1042 |
+
|
1043 |
+
// If this gets through the pre-check, make sure we properly identify the outbound request as a pingback verification
|
1044 |
+
Akismet::pingback_forwarded_for( null, $args[0] );
|
1045 |
+
add_filter( 'http_request_args', array( 'Akismet', 'pingback_forwarded_for' ), 10, 2 );
|
1046 |
+
|
1047 |
+
$comment = array(
|
1048 |
+
'comment_author_url' => $args[0],
|
1049 |
+
'comment_post_ID' => $post_id,
|
1050 |
+
'comment_author' => '',
|
1051 |
+
'comment_author_email' => '',
|
1052 |
+
'comment_content' => '',
|
1053 |
+
'comment_type' => 'pingback',
|
1054 |
+
'akismet_pre_check' => '1',
|
1055 |
+
'comment_pingback_target' => $args[1],
|
1056 |
+
);
|
1057 |
+
|
1058 |
+
$comment = Akismet::auto_check_comment( $comment );
|
1059 |
+
|
1060 |
+
if ( isset( $comment['akismet_result'] ) && 'true' == $comment['akismet_result'] ) {
|
1061 |
+
// Lame: tightly coupled with the IXR classes. Unfortunately the action provides no context and no way to return anything.
|
1062 |
+
$wp_xmlrpc_server->error( new IXR_Error( 0, 'Invalid discovery target' ) );
|
1063 |
+
}
|
1064 |
+
}
|
1065 |
+
}
|
1066 |
+
|
1067 |
+
public static function pingback_forwarded_for( $r, $url ) {
|
1068 |
+
static $urls = array();
|
1069 |
+
|
1070 |
+
// Call this with $r == null to prime the callback to add headers on a specific URL
|
1071 |
+
if ( is_null( $r ) && !in_array( $url, $urls ) ) {
|
1072 |
+
$urls[] = $url;
|
1073 |
+
}
|
1074 |
+
|
1075 |
+
// Add X-Pingback-Forwarded-For header, but only for requests to a specific URL (the apparent pingback source)
|
1076 |
+
if ( is_array( $r ) && is_array( $r['headers'] ) && !isset( $r['headers']['X-Pingback-Forwarded-For'] ) && in_array( $url, $urls ) ) {
|
1077 |
+
$remote_ip = preg_replace( '/[^a-fx0-9:.,]/i', '', $_SERVER['REMOTE_ADDR'] );
|
1078 |
+
|
1079 |
+
// Note: this assumes REMOTE_ADDR is correct, and it may not be if a reverse proxy or CDN is in use
|
1080 |
+
$r['headers']['X-Pingback-Forwarded-For'] = $remote_ip;
|
1081 |
+
|
1082 |
+
// Also identify the request as a pingback verification in the UA string so it appears in logs
|
1083 |
+
$r['user-agent'] .= '; verifying pingback from ' . $remote_ip;
|
1084 |
+
}
|
1085 |
+
|
1086 |
+
return $r;
|
1087 |
+
}
|
1088 |
}
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: matt, ryan, andy, mdawaffe, tellyworth, josephscott, lessbloat, eoigal, cfinke, automattic, jgs
|
3 |
Tags: akismet, comments, spam
|
4 |
Requires at least: 3.2
|
5 |
-
Tested up to: 4.
|
6 |
-
Stable tag: 3.1
|
7 |
License: GPLv2 or later
|
8 |
|
9 |
Akismet checks your comments against the Akismet Web service to see if they look like spam or not.
|
@@ -30,6 +30,12 @@ Upload the Akismet plugin to your blog, Activate it, then enter your [Akismet.co
|
|
30 |
|
31 |
== Changelog ==
|
32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
= 3.1 =
|
34 |
*Release Date - 11th March, 2015*
|
35 |
|
2 |
Contributors: matt, ryan, andy, mdawaffe, tellyworth, josephscott, lessbloat, eoigal, cfinke, automattic, jgs
|
3 |
Tags: akismet, comments, spam
|
4 |
Requires at least: 3.2
|
5 |
+
Tested up to: 4.2.1
|
6 |
+
Stable tag: 3.1.1
|
7 |
License: GPLv2 or later
|
8 |
|
9 |
Akismet checks your comments against the Akismet Web service to see if they look like spam or not.
|
30 |
|
31 |
== Changelog ==
|
32 |
|
33 |
+
= 3.1.1 =
|
34 |
+
*Release Date - 17th March, 2015*
|
35 |
+
|
36 |
+
* Improvements to the "Remove comment author URL" JavaScript
|
37 |
+
* Include the pingback pre-check from the 2.6 branch.
|
38 |
+
|
39 |
= 3.1 =
|
40 |
*Release Date - 11th March, 2015*
|
41 |
|
wrapper.php
CHANGED
@@ -204,4 +204,10 @@ function akismet_kill_proxy_check( $option ) {
|
|
204 |
_deprecated_function( __FUNCTION__, '3.0' );
|
205 |
|
206 |
return 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
207 |
}
|
204 |
_deprecated_function( __FUNCTION__, '3.0' );
|
205 |
|
206 |
return 0;
|
207 |
+
}
|
208 |
+
function akismet_pingback_forwarded_for( $r, $url ) {
|
209 |
+
return Akismet::pingback_forwarded_for( $r, $url );
|
210 |
+
}
|
211 |
+
function akismet_pre_check_pingback( $method ) {
|
212 |
+
return Akismet::pre_check_pingback( $method );
|
213 |
}
|