Version Description
- 2014-12-05 =
- added ANTISPAM_VERSION constant (thanks to jumbo)
- removed 'spam points' algorithm because it is not needed
Download this release
Release Info
Developer | webvitaly |
Plugin | Anti-spam |
Version | 3.2 |
Comparing to | |
See all releases |
Code changes from version 3.1 to 3.2
- anti-spam.php +6 -51
- js/{anti-spam-3.0.js → anti-spam-3.2.js} +0 -0
- readme.txt +8 -17
anti-spam.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Anti-spam
|
4 |
Plugin URI: http://wordpress.org/plugins/anti-spam/
|
5 |
Description: No spam in comments. No captcha.
|
6 |
-
Version: 3.
|
7 |
Author: webvitaly
|
8 |
Author URI: http://web-profile.com.ua/wordpress/plugins/
|
9 |
License: GPLv3
|
@@ -15,23 +15,20 @@ $antispam_allow_trackbacks = false; // if true, than trackbacks will be allowed
|
|
15 |
// trackbacks almost not used by users, but mostly used by spammers; pingbacks are always enabled
|
16 |
// more about the difference between trackback and pingback - http://web-profile.com.ua/web/trackback-vs-pingback/
|
17 |
|
|
|
18 |
|
19 |
$antispam_settings = array(
|
20 |
'send_spam_comment_to_admin' => $antispam_send_spam_comment_to_admin,
|
21 |
'allow_trackbacks' => $antispam_allow_trackbacks,
|
22 |
-
'version' =>
|
23 |
-
'admin_email' => get_option('admin_email')
|
24 |
-
'max_spam_points' => 3, // if more - it is spam
|
25 |
-
'max_links_number' => 2, // if more - +1 spam point
|
26 |
-
'max_comment_length' => 2000 // if more - +1 spam point
|
27 |
);
|
28 |
|
29 |
|
30 |
if ( ! function_exists('antispam_enqueue_script')):
|
31 |
function antispam_enqueue_script() {
|
32 |
-
global $antispam_settings;
|
33 |
if (is_singular() && comments_open()) { // load script only for pages with comments form
|
34 |
-
wp_enqueue_script('anti-spam-script', plugins_url('/js/anti-spam-3.
|
35 |
}
|
36 |
}
|
37 |
add_action('wp_enqueue_scripts', 'antispam_enqueue_script');
|
@@ -118,49 +115,7 @@ if ( ! function_exists('antispam_check_comment')):
|
|
118 |
$antispam_error_message .= 'Error: field should be empty. ['.$_POST['antspm-e-email-url-website'].']<br> '.$rn;
|
119 |
}
|
120 |
|
121 |
-
|
122 |
-
if (empty($_COOKIE)) { // probably spam
|
123 |
-
$spam_points += 1;
|
124 |
-
$antispam_error_message .= 'Info: COOKIE array is empty. +1 spam point.<br> '.$rn;
|
125 |
-
}
|
126 |
-
|
127 |
-
if ( ! empty($commentdata['comment_author_url'])) { // probably spam
|
128 |
-
$spam_points += 1;
|
129 |
-
$antispam_error_message .= 'Info: URL field is not empty. +1 spam point.<br> '.$rn;
|
130 |
-
}
|
131 |
-
|
132 |
-
$links_count = substr_count($commentdata['comment_content'], 'http');
|
133 |
-
if ($links_count > $antispam_settings['max_links_number']) { // probably spam
|
134 |
-
$spam_points += 1;
|
135 |
-
$antispam_error_message .= 'Info: comment contains too many links ['.$links_count.' links; max = '.$antispam_settings['max_links_number'].']. +1 spam point.<br> '.$rn;
|
136 |
-
}
|
137 |
-
|
138 |
-
if (strpos($commentdata['comment_content'], '</') !== false) { // probably spam
|
139 |
-
$spam_points += 1;
|
140 |
-
$antispam_error_message .= 'Info: comment contains html. +1 spam point.<br> '.$rn;
|
141 |
-
}
|
142 |
-
|
143 |
-
$comment_length = strlen($commentdata['comment_content']);
|
144 |
-
if ($comment_length > $antispam_settings['max_comment_length']) { // probably spam
|
145 |
-
$spam_points += 1;
|
146 |
-
$antispam_error_message .= 'Info: comment is too long ['.$comment_length.' chars; max = '.$antispam_settings['max_comment_length'].']. +1 spam point.<br> '.$rn;
|
147 |
-
}
|
148 |
-
|
149 |
-
if (strpos($commentdata['comment_content'], 'rel="nofollow"') !== false) { // probably spam
|
150 |
-
$spam_points += 1;
|
151 |
-
$antispam_error_message .= 'Info: comment contains rel="nofollow" code. +1 spam point.<br> '.$rn;
|
152 |
-
}
|
153 |
-
|
154 |
-
if (strpos($commentdata['comment_content'], '[/url]') !== false) { // probably spam
|
155 |
-
$spam_points += 1;
|
156 |
-
$antispam_error_message .= 'Info: comment contains [/url] code. +1 spam point.<br> '.$rn;
|
157 |
-
}
|
158 |
-
|
159 |
-
if ($spam_points > 0) {
|
160 |
-
$antispam_error_message .= 'Total spam points = '.$spam_points.' [max = '.$antispam_settings['max_spam_points'].']<br> '.$rn;
|
161 |
-
}
|
162 |
-
|
163 |
-
if ($spam_flag || $spam_points > $antispam_settings['max_spam_points']) { // it is spam
|
164 |
$antispam_error_message .= '<strong>Comment was blocked because it is spam.</strong><br> ';
|
165 |
if ($antispam_settings['send_spam_comment_to_admin']) { // if sending email to admin is enabled
|
166 |
$antispam_subject = 'Spam comment on site ['.get_bloginfo('name').']'; // email subject
|
3 |
Plugin Name: Anti-spam
|
4 |
Plugin URI: http://wordpress.org/plugins/anti-spam/
|
5 |
Description: No spam in comments. No captcha.
|
6 |
+
Version: 3.2
|
7 |
Author: webvitaly
|
8 |
Author URI: http://web-profile.com.ua/wordpress/plugins/
|
9 |
License: GPLv3
|
15 |
// trackbacks almost not used by users, but mostly used by spammers; pingbacks are always enabled
|
16 |
// more about the difference between trackback and pingback - http://web-profile.com.ua/web/trackback-vs-pingback/
|
17 |
|
18 |
+
define('ANTISPAM_VERSION', '3.2');
|
19 |
|
20 |
$antispam_settings = array(
|
21 |
'send_spam_comment_to_admin' => $antispam_send_spam_comment_to_admin,
|
22 |
'allow_trackbacks' => $antispam_allow_trackbacks,
|
23 |
+
'version' => ANTISPAM_VERSION,
|
24 |
+
'admin_email' => get_option('admin_email')
|
|
|
|
|
|
|
25 |
);
|
26 |
|
27 |
|
28 |
if ( ! function_exists('antispam_enqueue_script')):
|
29 |
function antispam_enqueue_script() {
|
|
|
30 |
if (is_singular() && comments_open()) { // load script only for pages with comments form
|
31 |
+
wp_enqueue_script('anti-spam-script', plugins_url('/js/anti-spam-3.2.js', __FILE__), array('jquery'), null, true);
|
32 |
}
|
33 |
}
|
34 |
add_action('wp_enqueue_scripts', 'antispam_enqueue_script');
|
115 |
$antispam_error_message .= 'Error: field should be empty. ['.$_POST['antspm-e-email-url-website'].']<br> '.$rn;
|
116 |
}
|
117 |
|
118 |
+
if ($spam_flag) { // it is spam
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
$antispam_error_message .= '<strong>Comment was blocked because it is spam.</strong><br> ';
|
120 |
if ($antispam_settings['send_spam_comment_to_admin']) { // if sending email to admin is enabled
|
121 |
$antispam_subject = 'Spam comment on site ['.get_bloginfo('name').']'; // email subject
|
js/{anti-spam-3.0.js → anti-spam-3.2.js}
RENAMED
File without changes
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://web-profile.com.ua/donate/
|
|
4 |
Tags: spam, spammer, spammers, comment, comments, antispam, anti-spam, block-spam, spamfree, spam-free, spambot, spam-bot, bot
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 4.0
|
7 |
-
Stable tag: 3.
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl.html
|
10 |
|
@@ -47,7 +47,7 @@ If you get an error - you may check the solution in the [Support section](http:/
|
|
47 |
|
48 |
= How does Anti-spam plugin work? =
|
49 |
|
50 |
-
The blocking algorithm is based on
|
51 |
|
52 |
= How does 'invisible js-captcha' method work? =
|
53 |
|
@@ -65,20 +65,6 @@ This field is hidden for the user and user will not fill it.
|
|
65 |
But this field is visible for the spammer.
|
66 |
If the spammer will fill this trap-field with anything - the comment will be blocked because it is spam.
|
67 |
|
68 |
-
= How does 'spam points' method work? =
|
69 |
-
|
70 |
-
Every comment will have +1 spam point for each truthy statement below:
|
71 |
-
|
72 |
-
* empty COOKIE array
|
73 |
-
* URL field is not empty
|
74 |
-
* comment contains too many links (3 or more)
|
75 |
-
* comment contains html
|
76 |
-
* comment is too long (more than 2000 chars)
|
77 |
-
* comment contains rel="nofollow" code
|
78 |
-
* comment contains [/url] code
|
79 |
-
|
80 |
-
If the comment will have more than 3 spam points - the comment will be blocked because it is spam.
|
81 |
-
|
82 |
= How to test what spam comments are rejected? =
|
83 |
|
84 |
You may enable sending all rejected spam comments to admin email.
|
@@ -106,7 +92,8 @@ But if the script of the theme will not submit extra Anti-spam fields - so Anti-
|
|
106 |
|
107 |
= What is the percentage of spam blocked? =
|
108 |
|
109 |
-
Anti-spam plugin blocks
|
|
|
110 |
|
111 |
= What about trackback spam? =
|
112 |
|
@@ -134,6 +121,10 @@ Do not order products from spam. If spam will be less effective than spammers wi
|
|
134 |
|
135 |
|
136 |
== Changelog ==
|
|
|
|
|
|
|
|
|
137 |
= 3.1 - 2014-12-04 =
|
138 |
* remove log notices
|
139 |
|
4 |
Tags: spam, spammer, spammers, comment, comments, antispam, anti-spam, block-spam, spamfree, spam-free, spambot, spam-bot, bot
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 4.0
|
7 |
+
Stable tag: 3.2
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl.html
|
10 |
|
47 |
|
48 |
= How does Anti-spam plugin work? =
|
49 |
|
50 |
+
The blocking algorithm is based on 2 methods: 'invisible js-captcha' and 'invisible input trap'.
|
51 |
|
52 |
= How does 'invisible js-captcha' method work? =
|
53 |
|
65 |
But this field is visible for the spammer.
|
66 |
If the spammer will fill this trap-field with anything - the comment will be blocked because it is spam.
|
67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
= How to test what spam comments are rejected? =
|
69 |
|
70 |
You may enable sending all rejected spam comments to admin email.
|
92 |
|
93 |
= What is the percentage of spam blocked? =
|
94 |
|
95 |
+
Anti-spam plugin blocks about 99.9% of automatic spam messages (sent by spam-bots via post requests).
|
96 |
+
Anti-spam plugin will pass the messages which were submitted by spammers manually via browser. But such messages happens very rarely.
|
97 |
|
98 |
= What about trackback spam? =
|
99 |
|
121 |
|
122 |
|
123 |
== Changelog ==
|
124 |
+
= 3.2 - 2014-12-05 =
|
125 |
+
* added ANTISPAM_VERSION constant (thanks to jumbo)
|
126 |
+
* removed 'spam points' algorithm because it is not needed
|
127 |
+
|
128 |
= 3.1 - 2014-12-04 =
|
129 |
* remove log notices
|
130 |
|