Version Description
- 2014-02-15 =
- add support for comments forms loaded via ajax
Download this release
Release Info
Developer | webvitaly |
Plugin | Anti-spam |
Version | 2.1 |
Comparing to | |
See all releases |
Code changes from version 2.0 to 2.1
- anti-spam.php +8 -8
- js/anti-spam.js +26 -16
- readme.txt +21 -8
anti-spam.php
CHANGED
@@ -3,10 +3,10 @@
|
|
3 |
Plugin Name: Anti-spam
|
4 |
Plugin URI: http://wordpress.org/plugins/anti-spam/
|
5 |
Description: No spam in comments. No captcha.
|
6 |
-
Version: 2.
|
7 |
Author: webvitaly
|
8 |
Author URI: http://web-profile.com.ua/wordpress/plugins/
|
9 |
-
License: GPLv3
|
10 |
*/
|
11 |
|
12 |
$antispam_send_spam_comment_to_admin = false; // if true, than rejected spam comments will be sent to admin email
|
@@ -15,7 +15,7 @@ $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 |
-
$antispam_version = '2.
|
19 |
|
20 |
|
21 |
if ( ! function_exists( 'antispam_scripts_styles_init' ) ) :
|
@@ -37,7 +37,7 @@ if ( ! function_exists( 'antispam_form_part' ) ) :
|
|
37 |
<p class="comment-form-ant-spm" style="clear:both;">
|
38 |
<strong>Current <span style="display:none;">day</span> <span style="display:none;">month</span> <span style="display:inline;">ye@r</span></strong> <span class="required">*</span>
|
39 |
<input type="hidden" name="ant-spm-a" id="ant-spm-a" value="'.date('Y').'" />
|
40 |
-
<input type="text" name="ant-spm-q" id="ant-spm-q" size="30" value="
|
41 |
</p>
|
42 |
'; // question (hidden with js) [aria-required="true" required="required"]
|
43 |
$antispam_form_part .= '
|
@@ -91,7 +91,7 @@ if ( ! function_exists( 'antispam_check_comment' ) ) :
|
|
91 |
$antispam_message_spam_info .= "\r\n\r\n";
|
92 |
|
93 |
$antispam_message_append = '-----------------------------'."\r\n";
|
94 |
-
$antispam_message_append .= 'This is spam comment rejected by Anti-spam plugin
|
95 |
$antispam_message_append .= 'You may edit "anti-spam.php" file and disable this notification.' . "\r\n";
|
96 |
$antispam_message_append .= 'You should find "$antispam_send_spam_comment_to_admin" and make it equal to "false".' . "\r\n";
|
97 |
}
|
@@ -161,9 +161,9 @@ endif; // end of antispam_check_comment()
|
|
161 |
if ( ! function_exists( 'antispam_plugin_meta' ) ) :
|
162 |
function antispam_plugin_meta( $links, $file ) { // add 'Plugin page' and 'Donate' links to plugin meta row
|
163 |
if ( strpos( $file, 'anti-spam.php' ) !== false ) {
|
164 |
-
$links = array_merge( $links, array( '<a href="http://web-profile.com.ua/wordpress/plugins/anti-spam/" title="Plugin page">
|
165 |
-
$links = array_merge( $links, array( '<a href="http://web-profile.com.ua/donate/" title="Support the development">
|
166 |
-
$links = array_merge( $links, array( '<a href="http://codecanyon.net/item/antispam-pro/6491169" title="
|
167 |
}
|
168 |
return $links;
|
169 |
}
|
3 |
Plugin Name: Anti-spam
|
4 |
Plugin URI: http://wordpress.org/plugins/anti-spam/
|
5 |
Description: No spam in comments. No captcha.
|
6 |
+
Version: 2.1
|
7 |
Author: webvitaly
|
8 |
Author URI: http://web-profile.com.ua/wordpress/plugins/
|
9 |
+
License: GPLv3
|
10 |
*/
|
11 |
|
12 |
$antispam_send_spam_comment_to_admin = false; // if true, than rejected spam comments will be sent to admin email
|
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 |
+
$antispam_version = '2.1';
|
19 |
|
20 |
|
21 |
if ( ! function_exists( 'antispam_scripts_styles_init' ) ) :
|
37 |
<p class="comment-form-ant-spm" style="clear:both;">
|
38 |
<strong>Current <span style="display:none;">day</span> <span style="display:none;">month</span> <span style="display:inline;">ye@r</span></strong> <span class="required">*</span>
|
39 |
<input type="hidden" name="ant-spm-a" id="ant-spm-a" value="'.date('Y').'" />
|
40 |
+
<input type="text" name="ant-spm-q" id="ant-spm-q" size="30" value="21" />
|
41 |
</p>
|
42 |
'; // question (hidden with js) [aria-required="true" required="required"]
|
43 |
$antispam_form_part .= '
|
91 |
$antispam_message_spam_info .= "\r\n\r\n";
|
92 |
|
93 |
$antispam_message_append = '-----------------------------'."\r\n";
|
94 |
+
$antispam_message_append .= 'This is spam comment rejected by Anti-spam plugin - wordpress.org/plugins/anti-spam/' . "\r\n";
|
95 |
$antispam_message_append .= 'You may edit "anti-spam.php" file and disable this notification.' . "\r\n";
|
96 |
$antispam_message_append .= 'You should find "$antispam_send_spam_comment_to_admin" and make it equal to "false".' . "\r\n";
|
97 |
}
|
161 |
if ( ! function_exists( 'antispam_plugin_meta' ) ) :
|
162 |
function antispam_plugin_meta( $links, $file ) { // add 'Plugin page' and 'Donate' links to plugin meta row
|
163 |
if ( strpos( $file, 'anti-spam.php' ) !== false ) {
|
164 |
+
$links = array_merge( $links, array( '<a href="http://web-profile.com.ua/wordpress/plugins/anti-spam/" title="Plugin page">Anti-spam</a>' ) );
|
165 |
+
$links = array_merge( $links, array( '<a href="http://web-profile.com.ua/donate/" title="Support the development">Donate</a>' ) );
|
166 |
+
$links = array_merge( $links, array( '<a href="http://codecanyon.net/item/antispam-pro/6491169?ref=webvitaly" title="Upgrade to Pro">Anti-spam Pro</a>' ) );
|
167 |
}
|
168 |
return $links;
|
169 |
}
|
js/anti-spam.js
CHANGED
@@ -4,25 +4,35 @@ No spam in comments. No captcha.
|
|
4 |
wordpress.org/plugins/anti-spam/
|
5 |
*/
|
6 |
|
7 |
-
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
|
|
|
12 |
|
13 |
-
|
14 |
-
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
|
24 |
-
|
25 |
-
|
26 |
-
|
|
|
27 |
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
wordpress.org/plugins/anti-spam/
|
5 |
*/
|
6 |
|
7 |
+
(function($) {
|
8 |
|
9 |
+
function anti_spam_init() {
|
10 |
+
$('.comment-form-ant-spm, .comment-form-ant-spm-2').hide(); // hide inputs from users
|
11 |
+
var answer = $('.comment-form-ant-spm input#ant-spm-a').val(); // get answer
|
12 |
+
$('.comment-form-ant-spm input#ant-spm-q').val( answer ); // set answer into other input instead of user
|
13 |
|
14 |
+
var current_date = new Date();
|
15 |
+
var current_year = current_date.getFullYear();
|
16 |
|
17 |
+
if ( $('#comments form input#ant-spm-q').length == 0 ) { // anti-spam input does not exist (could be because of cache or because theme does not use 'comment_form' action)
|
18 |
+
$('#comments form').append('<input type="hidden" name="ant-spm-q" id="ant-spm-q" value="'+current_year+'" />'); // add whole input with answer via javascript to comment form
|
19 |
+
}
|
20 |
|
21 |
+
if ( $('#respond form input#ant-spm-q').length == 0 ) { // similar, just in case (used because user could bot have #comments)
|
22 |
+
$('#respond form').append('<input type="hidden" name="ant-spm-q" id="ant-spm-q" value="'+current_year+'" />'); // add whole input with answer via javascript to comment form
|
23 |
+
}
|
24 |
|
25 |
+
if ( $('form#commentform input#ant-spm-q').length == 0 ) { // similar, just in case (used because user could bot have #respond)
|
26 |
+
$('form#commentform').append('<input type="hidden" name="ant-spm-q" id="ant-spm-q" value="'+current_year+'" />'); // add whole input with answer via javascript to comment form
|
27 |
+
}
|
28 |
+
}
|
29 |
|
30 |
+
$(document).ready(function() {
|
31 |
+
anti_spam_init();
|
32 |
+
});
|
33 |
+
|
34 |
+
$(document).ajaxSuccess(function() { // add support for comments forms loaded via ajax
|
35 |
+
anti_spam_init();
|
36 |
+
});
|
37 |
+
|
38 |
+
})(jQuery);
|
readme.txt
CHANGED
@@ -3,18 +3,20 @@ Contributors: webvitaly
|
|
3 |
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: 3.
|
7 |
-
Stable tag: 2.
|
8 |
-
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl.html
|
10 |
|
11 |
No spam in comments. No captcha.
|
12 |
|
13 |
== Description ==
|
14 |
|
|
|
15 |
[Anti-spam](http://web-profile.com.ua/wordpress/plugins/anti-spam/ "Plugin page") |
|
16 |
-
[Donate](http://web-profile.com.ua/donate/ "Support the development")
|
17 |
-
|
|
|
18 |
|
19 |
Anti-spam plugin blocks spam in comments automatically, invisibly for users and for admins.
|
20 |
|
@@ -22,6 +24,8 @@ Anti-spam plugin blocks spam in comments automatically, invisibly for users and
|
|
22 |
* **no moderation queues**, because spam is not administrators' problem
|
23 |
* **no options**, because it is great to forget about spam completely
|
24 |
|
|
|
|
|
25 |
Plugin is easy to use: just install it and it just works.
|
26 |
Need [more info about the plugin](http://wordpress.org/plugins/anti-spam/faq/)?
|
27 |
|
@@ -29,9 +33,9 @@ After installing the Anti-spam plugin **try to submit a comment on your site bei
|
|
29 |
If you get an error - you may check the solution in the [Support section](http://wordpress.org/support/plugin/anti-spam) or submit a new topic with detailed description of your problem.
|
30 |
|
31 |
= Useful: =
|
32 |
-
* ["
|
33 |
* ["Page-list" - show list of pages with shortcodes](http://wordpress.org/plugins/page-list/ "list of pages with shortcodes")
|
34 |
-
* ["
|
35 |
|
36 |
== Installation ==
|
37 |
|
@@ -40,7 +44,13 @@ If you get an error - you may check the solution in the [Support section](http:/
|
|
40 |
|
41 |
== Frequently Asked Questions ==
|
42 |
|
43 |
-
= How does Anti-spam plugin work? =
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
Two extra hidden fields are added to comments form. First field is the question about the current year. Second field should be empty.
|
46 |
If the user visits site, than first field is answered automatically with javascript, second field left blank and both fields are hidden by javascript and css and invisible for the user.
|
@@ -94,6 +104,9 @@ Do not order products from spam. If spam will be less effective than spammers wi
|
|
94 |
|
95 |
== Changelog ==
|
96 |
|
|
|
|
|
|
|
97 |
= 2.0 - 2014-01-04 =
|
98 |
* bug fixing
|
99 |
* updating info
|
3 |
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: 3.9
|
7 |
+
Stable tag: 2.1
|
8 |
+
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl.html
|
10 |
|
11 |
No spam in comments. No captcha.
|
12 |
|
13 |
== Description ==
|
14 |
|
15 |
+
[Anti-spam Pro](http://codecanyon.net/item/antispam-pro/6491169?ref=webvitaly "Upgrade to Pro") |
|
16 |
[Anti-spam](http://web-profile.com.ua/wordpress/plugins/anti-spam/ "Plugin page") |
|
17 |
+
[Donate](http://web-profile.com.ua/donate/ "Support the development")
|
18 |
+
|
19 |
+
**Why humans should prove that they are humans by filling captchas? Lets bots prove that they are not bots with adding javascript to their user-agents!**
|
20 |
|
21 |
Anti-spam plugin blocks spam in comments automatically, invisibly for users and for admins.
|
22 |
|
24 |
* **no moderation queues**, because spam is not administrators' problem
|
25 |
* **no options**, because it is great to forget about spam completely
|
26 |
|
27 |
+
If you need more powerful and extended version with options you may try [Anti-spam Pro](http://codecanyon.net/item/antispam-pro/6491169?ref=webvitaly "Upgrade to Pro").
|
28 |
+
|
29 |
Plugin is easy to use: just install it and it just works.
|
30 |
Need [more info about the plugin](http://wordpress.org/plugins/anti-spam/faq/)?
|
31 |
|
33 |
If you get an error - you may check the solution in the [Support section](http://wordpress.org/support/plugin/anti-spam) or submit a new topic with detailed description of your problem.
|
34 |
|
35 |
= Useful: =
|
36 |
+
* ["Security-protection" - blocks brute-force attacks](http://wordpress.org/plugins/security-protection/ "stops brute-force attacks")
|
37 |
* ["Page-list" - show list of pages with shortcodes](http://wordpress.org/plugins/page-list/ "list of pages with shortcodes")
|
38 |
+
* ["activetab" - responsive clean theme](http://wordpress.org/themes/activetab "responsive clean and light theme")
|
39 |
|
40 |
== Installation ==
|
41 |
|
44 |
|
45 |
== Frequently Asked Questions ==
|
46 |
|
47 |
+
= How does Anti-spam plugin work ? =
|
48 |
+
|
49 |
+
The blocking algorithm is based on 2 methods: 'invisible js-captcha' and 'invisible input trap'.
|
50 |
+
The 'invisible js-captcha' method is based on fact that bots does not have javascript on their user-agents.
|
51 |
+
The 'invisible input trap' method is based on fact that almost all the bots will fill inputs with name 'email' or 'url'.
|
52 |
+
|
53 |
+
= How does Anti-spam plugin work in details? =
|
54 |
|
55 |
Two extra hidden fields are added to comments form. First field is the question about the current year. Second field should be empty.
|
56 |
If the user visits site, than first field is answered automatically with javascript, second field left blank and both fields are hidden by javascript and css and invisible for the user.
|
104 |
|
105 |
== Changelog ==
|
106 |
|
107 |
+
= 2.1 - 2014-02-15 =
|
108 |
+
* add support for comments forms loaded via ajax
|
109 |
+
|
110 |
= 2.0 - 2014-01-04 =
|
111 |
* bug fixing
|
112 |
* updating info
|