Version Description
- 2013-10-23 =
- change the html structure
Download this release
Release Info
Developer | webvitaly |
Plugin | Anti-spam |
Version | 1.9 |
Comparing to | |
See all releases |
Code changes from version 1.8 to 1.9
- anti-spam.php +13 -13
- js/anti-spam.js +9 -9
- readme.txt +5 -2
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: 1.
|
7 |
Author: webvitaly
|
8 |
Author URI: http://web-profile.com.ua/wordpress/plugins/
|
9 |
License: GPLv2 or later
|
@@ -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 = '1.
|
19 |
|
20 |
|
21 |
if ( ! function_exists( 'antispam_scripts_styles_init' ) ) :
|
@@ -34,16 +34,16 @@ if ( ! function_exists( 'antispam_form_part' ) ) :
|
|
34 |
function antispam_form_part() {
|
35 |
if ( ! is_user_logged_in() ) { // add anti-spam fields only for not logged in users
|
36 |
$antispam_form_part = '
|
37 |
-
<p class="comment-form-
|
38 |
<strong>Current <span style="display:none;">month</span> <span style="display:inline;">ye@r</span> <span style="display:none;">day</span></strong> <span class="required">*</span>
|
39 |
-
<input type="hidden" name="
|
40 |
-
<input type="text" name="
|
41 |
</p>
|
42 |
'; // question (hidden with js) [aria-required="true" required="required"]
|
43 |
$antispam_form_part .= '
|
44 |
-
<p class="comment-form-
|
45 |
<strong>Leave this field empty</strong> <span class="required">*</span>
|
46 |
-
<input type="text" name="
|
47 |
</p>
|
48 |
'; // empty field (hidden with css)
|
49 |
echo $antispam_form_part;
|
@@ -99,17 +99,17 @@ if ( ! function_exists( 'antispam_check_comment' ) ) :
|
|
99 |
if ( ! is_user_logged_in() && $comment_type != 'pingback' && $comment_type != 'trackback' ) { // logged in user is not a spammer
|
100 |
$spam_flag = false;
|
101 |
|
102 |
-
if ( trim( $_POST['
|
103 |
$spam_flag = true;
|
104 |
-
if ( empty( $_POST['
|
105 |
-
$antispam_error_message .= 'Error: empty answer. ['.$_POST['
|
106 |
} else {
|
107 |
-
$antispam_error_message .= 'Error: answer is wrong. ['.$_POST['
|
108 |
}
|
109 |
}
|
110 |
-
if ( ! empty( $_POST['
|
111 |
$spam_flag = true;
|
112 |
-
$antispam_error_message .= 'Error: field should be empty. ['.$_POST['
|
113 |
}
|
114 |
if ( $spam_flag ) { // if we have spam
|
115 |
if ( $antispam_send_spam_comment_to_admin ) { // if sending email to admin is enabled
|
3 |
Plugin Name: Anti-spam
|
4 |
Plugin URI: http://wordpress.org/plugins/anti-spam/
|
5 |
Description: No spam in comments. No captcha.
|
6 |
+
Version: 1.9
|
7 |
Author: webvitaly
|
8 |
Author URI: http://web-profile.com.ua/wordpress/plugins/
|
9 |
License: GPLv2 or later
|
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 = '1.9';
|
19 |
|
20 |
|
21 |
if ( ! function_exists( 'antispam_scripts_styles_init' ) ) :
|
34 |
function antispam_form_part() {
|
35 |
if ( ! is_user_logged_in() ) { // add anti-spam fields only for not logged in users
|
36 |
$antispam_form_part = '
|
37 |
+
<p class="comment-form-ant-spm" style="clear:both;">
|
38 |
<strong>Current <span style="display:none;">month</span> <span style="display:inline;">ye@r</span> <span style="display:none;">day</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="19" />
|
41 |
</p>
|
42 |
'; // question (hidden with js) [aria-required="true" required="required"]
|
43 |
$antispam_form_part .= '
|
44 |
+
<p class="comment-form-ant-spm-2" style="display:none;">
|
45 |
<strong>Leave this field empty</strong> <span class="required">*</span>
|
46 |
+
<input type="text" name="ant-spm-e-email-url" id="ant-spm-e-email-url" size="30" value=""/>
|
47 |
</p>
|
48 |
'; // empty field (hidden with css)
|
49 |
echo $antispam_form_part;
|
99 |
if ( ! is_user_logged_in() && $comment_type != 'pingback' && $comment_type != 'trackback' ) { // logged in user is not a spammer
|
100 |
$spam_flag = false;
|
101 |
|
102 |
+
if ( trim( $_POST['ant-spm-q'] ) != date('Y') ) { // answer is wrong - maybe spam
|
103 |
$spam_flag = true;
|
104 |
+
if ( empty( $_POST['ant-spm-q'] ) ) { // empty answer - maybe spam
|
105 |
+
$antispam_error_message .= 'Error: empty answer. ['.$_POST['ant-spm-q'].']<br> ';
|
106 |
} else {
|
107 |
+
$antispam_error_message .= 'Error: answer is wrong. ['.$_POST['ant-spm-q'].']<br> ';
|
108 |
}
|
109 |
}
|
110 |
+
if ( ! empty( $_POST['ant-spm-e-email-url'] ) ) { // field is not empty - maybe spam
|
111 |
$spam_flag = true;
|
112 |
+
$antispam_error_message .= 'Error: field should be empty. ['.$_POST['ant-spm-e-email-url'].']<br> ';
|
113 |
}
|
114 |
if ( $spam_flag ) { // if we have spam
|
115 |
if ( $antispam_send_spam_comment_to_admin ) { // if sending email to admin is enabled
|
js/anti-spam.js
CHANGED
@@ -6,26 +6,26 @@ wordpress.org/plugins/anti-spam/
|
|
6 |
|
7 |
jQuery(function($){
|
8 |
|
9 |
-
$('.comment-form-
|
10 |
-
var answer = $('.comment-form-
|
11 |
-
$('.comment-form-
|
12 |
|
13 |
-
if ( $('#comments form input#
|
14 |
var current_date = new Date();
|
15 |
var current_year = current_date.getFullYear();
|
16 |
-
$('#comments form').append('<input type="hidden" name="
|
17 |
}
|
18 |
|
19 |
-
if ( $('#respond form input#
|
20 |
var current_date = new Date();
|
21 |
var current_year = current_date.getFullYear();
|
22 |
-
$('#respond form').append('<input type="hidden" name="
|
23 |
}
|
24 |
|
25 |
-
if ( $('form#commentform input#
|
26 |
var current_date = new Date();
|
27 |
var current_year = current_date.getFullYear();
|
28 |
-
$('form#commentform').append('<input type="hidden" name="
|
29 |
}
|
30 |
|
31 |
});
|
6 |
|
7 |
jQuery(function($){
|
8 |
|
9 |
+
$('.comment-form-ant-spm, .comment-form-ant-spm-2').hide(); // hide inputs from users
|
10 |
+
var answer = $('.comment-form-ant-spm input#ant-spm-a').val(); // get answer
|
11 |
+
$('.comment-form-ant-spm input#ant-spm-q').val( answer ); // set answer into other input
|
12 |
|
13 |
+
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)
|
14 |
var current_date = new Date();
|
15 |
var current_year = current_date.getFullYear();
|
16 |
+
$('#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
|
17 |
}
|
18 |
|
19 |
+
if ( $('#respond form input#ant-spm-q').length == 0 ) { // similar, just in case (used because user could bot have #comments)
|
20 |
var current_date = new Date();
|
21 |
var current_year = current_date.getFullYear();
|
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 |
var current_date = new Date();
|
27 |
var current_year = current_date.getFullYear();
|
28 |
+
$('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
|
29 |
}
|
30 |
|
31 |
});
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ 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: 1.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -93,6 +93,9 @@ Do not order products from spam. If spam will be less effective than spammers wi
|
|
93 |
|
94 |
== Changelog ==
|
95 |
|
|
|
|
|
|
|
96 |
= 1.8 - 2013-07-19 =
|
97 |
* removed labels from plugin markup because some themes try to get text from labels and insert it into inputs like placeholders (what cause an error)
|
98 |
* added info to FAQ section that Anti-spam plugin does not work with Jetpack Comments
|
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.6.1
|
7 |
+
Stable tag: 1.9
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
93 |
|
94 |
== Changelog ==
|
95 |
|
96 |
+
= 1.9 - 2013-10-23 =
|
97 |
+
* change the html structure
|
98 |
+
|
99 |
= 1.8 - 2013-07-19 =
|
100 |
* removed labels from plugin markup because some themes try to get text from labels and insert it into inputs like placeholders (what cause an error)
|
101 |
* added info to FAQ section that Anti-spam plugin does not work with Jetpack Comments
|