Version Description
- 2014-12-15 =
- refactor code structure
- added blocked spam counter in the comments section
- clean up the docs
Download this release
Release Info
Developer | webvitaly |
Plugin | Anti-spam |
Version | 3.3 |
Comparing to | |
See all releases |
Code changes from version 3.2 to 3.3
- anti-spam-functions.php +13 -0
- anti-spam.php +128 -104
- js/anti-spam-3.2.js +0 -41
- js/anti-spam-3.3.js +47 -0
- readme.txt +35 -40
anti-spam-functions.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if ( ! function_exists('antispam_log_stats')):
|
4 |
+
function antispam_log_stats() {
|
5 |
+
$antispam_stats = get_option('antispam_stats', array());
|
6 |
+
if (array_key_exists('blocked_total', $antispam_stats)){
|
7 |
+
$antispam_stats['blocked_total']++;
|
8 |
+
} else {
|
9 |
+
$antispam_stats['blocked_total'] = 1;
|
10 |
+
}
|
11 |
+
update_option('antispam_stats', $antispam_stats);
|
12 |
+
}
|
13 |
+
endif; // end of antispam_log_stats()
|
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,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 |
-
define('ANTISPAM_VERSION', '3.
|
19 |
|
20 |
$antispam_settings = array(
|
21 |
'send_spam_comment_to_admin' => $antispam_send_spam_comment_to_admin,
|
@@ -24,143 +24,167 @@ $antispam_settings = array(
|
|
24 |
'admin_email' => get_option('admin_email')
|
25 |
);
|
26 |
|
|
|
27 |
|
28 |
if ( ! function_exists('antispam_enqueue_script')):
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
}
|
33 |
}
|
34 |
-
|
|
|
35 |
endif; // end of antispam_enqueue_script()
|
36 |
|
37 |
|
38 |
if ( ! function_exists('antispam_form_part')):
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
|
|
53 |
}
|
54 |
-
|
|
|
55 |
endif; // end of antispam_form_part()
|
56 |
|
57 |
|
58 |
if ( ! function_exists('antispam_check_comment')):
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
|
63 |
-
|
64 |
|
65 |
-
|
66 |
-
|
67 |
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
$antispam_message_spam_info .= 'Post vars:'.$rn; // lets see what post vars spammers try to submit
|
84 |
-
foreach ($_POST as $key => $value) {
|
85 |
-
$antispam_message_spam_info .= '$_POST['.$key. '] = '.$value.$rn;
|
86 |
-
}
|
87 |
-
$antispam_message_spam_info .= $rn.$rn;
|
88 |
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
|
95 |
-
|
96 |
-
|
97 |
-
$
|
98 |
-
$antispam_message_append .= 'You should find "$antispam_send_spam_comment_to_admin" and make it equal to "false".' . $rn;
|
99 |
}
|
|
|
100 |
|
101 |
-
|
102 |
-
|
|
|
|
|
|
|
103 |
|
104 |
-
|
105 |
-
|
106 |
-
if (empty($_POST['antspm-q'])) { // empty answer - it is spam
|
107 |
-
$antispam_error_message .= 'Error: empty answer. ['.$_POST['antspm-q'].']<br> '.$rn;
|
108 |
-
} else {
|
109 |
-
$antispam_error_message .= 'Error: answer is wrong. ['.$_POST['antspm-q'].']<br> '.$rn;
|
110 |
-
}
|
111 |
-
}
|
112 |
|
113 |
-
|
114 |
-
|
115 |
-
|
|
|
|
|
|
|
116 |
}
|
|
|
117 |
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
$antispam_subject = 'Spam comment on site ['.get_bloginfo('name').']'; // email subject
|
122 |
-
$antispam_message = '';
|
123 |
-
$antispam_message .= $antispam_error_message . $rn.$rn;
|
124 |
-
$antispam_message .= $antispam_message_spam_info; // spam comment, post, cookie and other data
|
125 |
-
$antispam_message .= $antispam_message_append;
|
126 |
-
@wp_mail($antispam_settings['admin_email'], $antispam_subject, $antispam_message); // send spam comment to admin email
|
127 |
-
}
|
128 |
-
wp_die( $antispam_pre_error_message . $antispam_error_message ); // die - do not send comment and show errors
|
129 |
-
}
|
130 |
}
|
131 |
|
132 |
-
if (
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
@wp_mail($antispam_settings['admin_email'], $antispam_subject, $antispam_message); // send trackback comment to admin email
|
142 |
-
}
|
143 |
-
wp_die($antispam_pre_error_message . $antispam_error_message); // die - do not send trackback
|
144 |
}
|
|
|
|
|
145 |
}
|
146 |
-
|
147 |
-
return $commentdata; // if comment does not looks like spam
|
148 |
}
|
149 |
|
150 |
-
if ( !
|
151 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
153 |
endif; // end of antispam_check_comment()
|
154 |
|
155 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
if ( ! function_exists('antispam_plugin_meta')):
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
}
|
163 |
-
return $links;
|
164 |
}
|
165 |
-
|
|
|
|
|
166 |
endif; // end of antispam_plugin_meta()
|
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.3
|
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.3');
|
19 |
|
20 |
$antispam_settings = array(
|
21 |
'send_spam_comment_to_admin' => $antispam_send_spam_comment_to_admin,
|
24 |
'admin_email' => get_option('admin_email')
|
25 |
);
|
26 |
|
27 |
+
include('anti-spam-functions.php');
|
28 |
|
29 |
if ( ! function_exists('antispam_enqueue_script')):
|
30 |
+
function antispam_enqueue_script() {
|
31 |
+
if (is_singular() && comments_open()) { // load script only for pages with comments form
|
32 |
+
wp_enqueue_script('anti-spam-script', plugins_url('/js/anti-spam-3.3.js', __FILE__), array('jquery'), null, true);
|
|
|
33 |
}
|
34 |
+
}
|
35 |
+
add_action('wp_enqueue_scripts', 'antispam_enqueue_script');
|
36 |
endif; // end of antispam_enqueue_script()
|
37 |
|
38 |
|
39 |
if ( ! function_exists('antispam_form_part')):
|
40 |
+
function antispam_form_part() {
|
41 |
+
global $antispam_settings;
|
42 |
+
$rn = "\r\n"; // .chr(13).chr(10)
|
43 |
+
|
44 |
+
if ( ! is_user_logged_in()) { // add anti-spam fields only for not logged in users
|
45 |
+
echo ' <p class="antispam-group antispam-group-q" style="clear: both;">
|
46 |
+
<label>Current ye@r <span class="required">*</span></label>
|
47 |
+
<input type="hidden" name="antspm-a" class="antispam-control antispam-control-a" value="'.date('Y').'" />
|
48 |
+
<input type="text" name="antspm-q" class="antispam-control antispam-control-q" value="'.$antispam_settings['version'].'" />
|
49 |
+
</p>'.$rn; // question (hidden with js)
|
50 |
+
|
51 |
+
echo ' <p class="antispam-group antispam-group-e" style="display: none;">
|
52 |
+
<label>Leave this field empty</label>
|
53 |
+
<input type="text" name="antspm-e-email-url-website" class="antispam-control antispam-control-e" value="" />
|
54 |
+
</p>'.$rn; // empty field (hidden with css); trap for spammers because many bots will try to put email or url here
|
55 |
}
|
56 |
+
}
|
57 |
+
add_action('comment_form', 'antispam_form_part'); // add anti-spam input to the comment form
|
58 |
endif; // end of antispam_form_part()
|
59 |
|
60 |
|
61 |
if ( ! function_exists('antispam_check_comment')):
|
62 |
+
function antispam_check_comment($commentdata) {
|
63 |
+
global $antispam_settings;
|
64 |
+
$rn = "\r\n"; // .chr(13).chr(10)
|
65 |
|
66 |
+
extract($commentdata);
|
67 |
|
68 |
+
$antispam_pre_error_message = '<p><strong><a href="javascript:window.history.back()">Go back</a></strong> and try again.</p>';
|
69 |
+
$antispam_error_message = '';
|
70 |
|
71 |
+
if ($antispam_settings['send_spam_comment_to_admin']) { // if sending email to admin is enabled
|
72 |
+
$post = get_post($comment->comment_post_ID);
|
73 |
+
$antispam_message_spam_info = 'Spam for post: "'.$post->post_title.'"' . $rn;
|
74 |
+
$antispam_message_spam_info .= get_permalink($comment->comment_post_ID) . $rn.$rn;
|
75 |
|
76 |
+
$antispam_message_spam_info .= 'IP: ' . $_SERVER['REMOTE_ADDR'] . $rn;
|
77 |
+
$antispam_message_spam_info .= 'User agent: ' . $_SERVER['HTTP_USER_AGENT'] . $rn;
|
78 |
+
$antispam_message_spam_info .= 'Referer: ' . $_SERVER['HTTP_REFERER'] . $rn.$rn;
|
79 |
|
80 |
+
$antispam_message_spam_info .= 'Comment data:'.$rn; // lets see what comment data spammers try to submit
|
81 |
+
foreach ($commentdata as $key => $value) {
|
82 |
+
$antispam_message_spam_info .= '$commentdata['.$key. '] = '.$value.$rn;
|
83 |
+
}
|
84 |
+
$antispam_message_spam_info .= $rn.$rn;
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
|
86 |
+
$antispam_message_spam_info .= 'Post vars:'.$rn; // lets see what post vars spammers try to submit
|
87 |
+
foreach ($_POST as $key => $value) {
|
88 |
+
$antispam_message_spam_info .= '$_POST['.$key. '] = '.$value.$rn;
|
89 |
+
}
|
90 |
+
$antispam_message_spam_info .= $rn.$rn;
|
91 |
|
92 |
+
$antispam_message_spam_info .= 'Cookie vars:'.$rn; // lets see what cookie vars spammers try to submit
|
93 |
+
foreach ($_COOKIE as $key => $value) {
|
94 |
+
$antispam_message_spam_info .= '$_COOKIE['.$key. '] = '.$value.$rn;
|
|
|
95 |
}
|
96 |
+
$antispam_message_spam_info .= $rn.$rn;
|
97 |
|
98 |
+
$antispam_message_append = '-----------------------------'.$rn;
|
99 |
+
$antispam_message_append .= 'This is spam comment rejected by Anti-spam plugin - wordpress.org/plugins/anti-spam/' . $rn;
|
100 |
+
$antispam_message_append .= 'You may edit "anti-spam.php" file and disable this notification.' . $rn;
|
101 |
+
$antispam_message_append .= 'You should find "$antispam_send_spam_comment_to_admin" and make it equal to "false".' . $rn;
|
102 |
+
}
|
103 |
|
104 |
+
if ( ! is_user_logged_in() && $comment_type != 'pingback' && $comment_type != 'trackback') { // logged in user is not a spammer
|
105 |
+
$spam_flag = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
|
107 |
+
if (trim($_POST['antspm-q']) != date('Y')) { // year-answer is wrong - it is spam
|
108 |
+
$spam_flag = true;
|
109 |
+
if (empty($_POST['antspm-q'])) { // empty answer - it is spam
|
110 |
+
$antispam_error_message .= 'Error: empty answer. ['.$_POST['antspm-q'].']<br> '.$rn;
|
111 |
+
} else {
|
112 |
+
$antispam_error_message .= 'Error: answer is wrong. ['.$_POST['antspm-q'].']<br> '.$rn;
|
113 |
}
|
114 |
+
}
|
115 |
|
116 |
+
if ( ! empty($_POST['antspm-e-email-url-website'])) { // trap field is not empty - it is spam
|
117 |
+
$spam_flag = true;
|
118 |
+
$antispam_error_message .= 'Error: field should be empty. ['.$_POST['antspm-e-email-url-website'].']<br> '.$rn;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
}
|
120 |
|
121 |
+
if ($spam_flag) { // it is spam
|
122 |
+
$antispam_error_message .= '<strong>Comment was blocked because it is spam.</strong><br> ';
|
123 |
+
if ($antispam_settings['send_spam_comment_to_admin']) {
|
124 |
+
$antispam_subject = 'Spam comment on site ['.get_bloginfo('name').']'; // email subject
|
125 |
+
$antispam_message = '';
|
126 |
+
$antispam_message .= $antispam_error_message . $rn.$rn;
|
127 |
+
$antispam_message .= $antispam_message_spam_info; // spam comment, post, cookie and other data
|
128 |
+
$antispam_message .= $antispam_message_append;
|
129 |
+
@wp_mail($antispam_settings['admin_email'], $antispam_subject, $antispam_message); // send spam comment to admin email
|
|
|
|
|
|
|
130 |
}
|
131 |
+
antispam_log_stats();
|
132 |
+
wp_die( $antispam_pre_error_message . $antispam_error_message ); // die - do not send comment and show errors
|
133 |
}
|
|
|
|
|
134 |
}
|
135 |
|
136 |
+
if ( ! $antispam_settings['allow_trackbacks']) { // if trackbacks are blocked (pingbacks are alowed)
|
137 |
+
if ($comment_type == 'trackback') { // if trackbacks ( || $comment_type == 'pingback')
|
138 |
+
$antispam_error_message .= 'Error: trackbacks are disabled.<br> ';
|
139 |
+
if ($antispam_settings['send_spam_comment_to_admin']) { // if sending email to admin is enabled
|
140 |
+
$antispam_subject = 'Spam trackback on site ['.get_bloginfo('name').']'; // email subject
|
141 |
+
$antispam_message = '';
|
142 |
+
$antispam_message .= $antispam_error_message . $rn.$rn;
|
143 |
+
$antispam_message .= $antispam_message_spam_info; // spam comment, post, cookie and other data
|
144 |
+
$antispam_message .= $antispam_message_append;
|
145 |
+
@wp_mail($antispam_settings['admin_email'], $antispam_subject, $antispam_message); // send trackback comment to admin email
|
146 |
+
}
|
147 |
+
wp_die($antispam_pre_error_message . $antispam_error_message); // die - do not send trackback
|
148 |
+
}
|
149 |
}
|
150 |
+
|
151 |
+
return $commentdata; // if comment does not looks like spam
|
152 |
+
}
|
153 |
+
|
154 |
+
if ( ! is_admin()) {
|
155 |
+
add_filter('preprocess_comment', 'antispam_check_comment', 1);
|
156 |
+
}
|
157 |
endif; // end of antispam_check_comment()
|
158 |
|
159 |
|
160 |
+
if ( ! function_exists('antispam_admin_notice')):
|
161 |
+
function antispam_admin_notice() {
|
162 |
+
global $pagenow;
|
163 |
+
if ($pagenow == 'edit-comments.php'):
|
164 |
+
$antispam_stats = get_option('antispam_stats', array());
|
165 |
+
$blocked_total = $antispam_stats['blocked_total'];
|
166 |
+
?>
|
167 |
+
<div class="update-nag">
|
168 |
+
<p style="margin: 0;">
|
169 |
+
<?php echo $blocked_total; ?> spam comments were blocked by <a href="http://wordpress.org/plugins/anti-spam/">Anti-spam</a> plugin so far.
|
170 |
+
<a href="http://codecanyon.net/item/antispam-pro/6491169?ref=webvitaly" title="Anti-spam Pro">Upgrade to Pro</a>.
|
171 |
+
</p>
|
172 |
+
</div>
|
173 |
+
<?php
|
174 |
+
endif; // end of if($pagenow == 'edit-comments.php')
|
175 |
+
}
|
176 |
+
add_action('admin_notices', 'antispam_admin_notice');
|
177 |
+
endif; // end of antispam_admin_notice()
|
178 |
+
|
179 |
+
|
180 |
if ( ! function_exists('antispam_plugin_meta')):
|
181 |
+
function antispam_plugin_meta($links, $file) { // add some links to plugin meta row
|
182 |
+
if (strpos($file, 'anti-spam.php') !== false) {
|
183 |
+
$links = array_merge($links, array('<a href="http://web-profile.com.ua/wordpress/plugins/anti-spam/" title="Plugin page">Anti-spam</a>'));
|
184 |
+
$links = array_merge($links, array('<a href="http://web-profile.com.ua/donate/" title="Support the development">Donate</a>'));
|
185 |
+
$links = array_merge($links, array('<a href="http://codecanyon.net/item/antispam-pro/6491169?ref=webvitaly" title="Upgrade to Pro">Anti-spam Pro</a>'));
|
|
|
|
|
186 |
}
|
187 |
+
return $links;
|
188 |
+
}
|
189 |
+
add_filter('plugin_row_meta', 'antispam_plugin_meta', 10, 2);
|
190 |
endif; // end of antispam_plugin_meta()
|
js/anti-spam-3.2.js
DELETED
@@ -1,41 +0,0 @@
|
|
1 |
-
/*
|
2 |
-
Anti-spam plugin
|
3 |
-
No spam in comments. No captcha.
|
4 |
-
wordpress.org/plugins/anti-spam/
|
5 |
-
*/
|
6 |
-
|
7 |
-
(function($) {
|
8 |
-
|
9 |
-
function anti_spam_init() {
|
10 |
-
$('.antispam-group').hide(); // hide inputs from users
|
11 |
-
|
12 |
-
var answer = $('.antispam-group .antispam-control-a').val(); // get answer
|
13 |
-
$('.antispam-group-q .antispam-control-q').val(answer); // set answer into other input instead of user
|
14 |
-
$('.antispam-group-e .antispam-control-e').val(''); // clear value of the empty input because some themes are adding some value for all inputs
|
15 |
-
|
16 |
-
var current_date = new Date();
|
17 |
-
var current_year = current_date.getFullYear();
|
18 |
-
var dynamic_control = '<input type="hidden" name="antspm-q" class="antispam-control-q" value="'+current_year+'" />';
|
19 |
-
|
20 |
-
if ($('#comments form .antispam-control-q').length == 0) { // anti-spam input does not exist (could be because of cache or because theme does not use 'comment_form' action)
|
21 |
-
$('#comments form').append(dynamic_control); // add whole input with answer via js to comment form
|
22 |
-
}
|
23 |
-
|
24 |
-
if ($('#respond form .antispam-control-q').length == 0) { // similar, just in case (used because user could bot have #comments)
|
25 |
-
$('#respond form').append(dynamic_control); // add whole input with answer via js to comment form
|
26 |
-
}
|
27 |
-
|
28 |
-
if ($('form#commentform .antispam-control-q').length == 0) { // similar, just in case (used because user could bot have #respond)
|
29 |
-
$('form#commentform').append(dynamic_control); // add whole input with answer via js to comment form
|
30 |
-
}
|
31 |
-
}
|
32 |
-
|
33 |
-
$(document).ready(function() {
|
34 |
-
anti_spam_init();
|
35 |
-
});
|
36 |
-
|
37 |
-
$(document).ajaxSuccess(function() { // add support for comments forms loaded via ajax
|
38 |
-
anti_spam_init();
|
39 |
-
});
|
40 |
-
|
41 |
-
})(jQuery);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/anti-spam-3.3.js
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
Anti-spam plugin
|
3 |
+
No spam in comments. No captcha.
|
4 |
+
wordpress.org/plugins/anti-spam/
|
5 |
+
*/
|
6 |
+
|
7 |
+
(function($) {
|
8 |
+
|
9 |
+
function anti_spam_init() {
|
10 |
+
$('.antispam-group').hide(); // hide inputs from users
|
11 |
+
|
12 |
+
var answer = $('.antispam-group .antispam-control-a').val(); // get answer
|
13 |
+
$('.antispam-group-q .antispam-control-q').val(answer); // set answer into other input instead of user
|
14 |
+
$('.antispam-group-e .antispam-control-e').val(''); // clear value of the empty input because some themes are adding some value for all inputs
|
15 |
+
|
16 |
+
var current_date = new Date();
|
17 |
+
var current_year = current_date.getFullYear();
|
18 |
+
var dynamic_control = '<input type="hidden" name="antspm-q" class="antispam-control antispam-control-q" value="'+current_year+'" />';
|
19 |
+
|
20 |
+
$.each($('#comments form'), function(index, commentForm) { // add input for every comment form if there are more than 1 form
|
21 |
+
if ($(commentForm).find('.antispam-control-q').length == 0) {
|
22 |
+
$(commentForm).append(dynamic_control);
|
23 |
+
}
|
24 |
+
});
|
25 |
+
|
26 |
+
$.each($('#respond form'), function(index, commentForm) { // add input for every comment form if there are more than 1 form
|
27 |
+
if ($(commentForm).find('.antispam-control-q').length == 0) {
|
28 |
+
$(commentForm).append(dynamic_control);
|
29 |
+
}
|
30 |
+
});
|
31 |
+
|
32 |
+
$.each($('form#commentform'), function(index, commentForm) { // add input for every comment form if there are more than 1 form
|
33 |
+
if ($(commentForm).find('.antispam-control-q').length == 0) {
|
34 |
+
$(commentForm).append(dynamic_control);
|
35 |
+
}
|
36 |
+
});
|
37 |
+
}
|
38 |
+
|
39 |
+
$(document).ready(function() {
|
40 |
+
anti_spam_init();
|
41 |
+
});
|
42 |
+
|
43 |
+
$(document).ajaxSuccess(function() { // add support for comments forms loaded via ajax
|
44 |
+
anti_spam_init();
|
45 |
+
});
|
46 |
+
|
47 |
+
})(jQuery);
|
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: 4.
|
7 |
-
Stable tag: 3.
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl.html
|
10 |
|
@@ -12,10 +12,9 @@ No spam in comments. No captcha.
|
|
12 |
|
13 |
== Description ==
|
14 |
|
15 |
-
**[
|
16 |
-
**[Anti-spam
|
17 |
-
**[
|
18 |
-
**[Donate](http://web-profile.com.ua/donate/ "Support the development")**
|
19 |
|
20 |
**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!**
|
21 |
|
@@ -25,17 +24,16 @@ Anti-spam plugin blocks spam in comments automatically, invisibly for users and
|
|
25 |
* **no moderation queues**, because spam is not administrators' problem
|
26 |
* **no options**, because it is great to forget about spam completely
|
27 |
|
28 |
-
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").
|
29 |
-
|
30 |
Plugin is easy to use: just install it and it just works.
|
31 |
-
|
|
|
32 |
|
33 |
After installing the Anti-spam plugin **try to submit a comment on your site being logged out**.
|
34 |
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.
|
35 |
|
36 |
= Useful: =
|
37 |
-
* [Anti-spam Pro](http://codecanyon.net/item/antispam-pro/6491169?ref=webvitaly "Upgrade to Pro")
|
38 |
-
* [
|
39 |
* [WordPress Pro plugins](http://codecanyon.net/popular_item/by_category?category=wordpress&ref=webvitaly)
|
40 |
|
41 |
== Installation ==
|
@@ -45,6 +43,13 @@ If you get an error - you may check the solution in the [Support section](http:/
|
|
45 |
|
46 |
== Frequently Asked Questions ==
|
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'.
|
@@ -69,31 +74,17 @@ If the spammer will fill this trap-field with anything - the comment will be blo
|
|
69 |
|
70 |
You may enable sending all rejected spam comments to admin email.
|
71 |
Edit [anti-spam.php](http://plugins.trac.wordpress.org/browser/anti-spam/trunk/anti-spam.php) file and find "$antispam_send_spam_comment_to_admin" and make it "true".
|
|
|
72 |
|
73 |
-
= Does
|
74 |
-
|
75 |
-
Anti-spam plugin does not work with [Jetpack Comments](http://jetpack.me/support/comments/).
|
76 |
-
Jetpack Comments use iframe to insert comment form and it is impossible to access it via javascript because of security reasons.
|
77 |
-
If you use Jetpack Comments - you should find some other plugin to block spam.
|
78 |
-
You could try [Akismet](http://wordpress.org/plugins/akismet/), it is compatible with Jetpack Comments.
|
79 |
-
|
80 |
-
= Does Anti-spam plugin block spam from Contact or other forms? =
|
81 |
-
|
82 |
-
Anti-spam plugin blocks spam only in comments form section and does not block spam from any other forms on site.
|
83 |
-
|
84 |
-
= Does Anti-spam plugin work with bbPress? =
|
85 |
|
86 |
-
|
87 |
-
|
88 |
-
= Does Anti-spam plugin work with ajax comments forms? =
|
89 |
-
|
90 |
-
Some themes, for example [p2](http://wordpress.org/themes/p2), use ajax to submit comment.
|
91 |
-
But if the script of the theme will not submit extra Anti-spam fields - so Anti-spam plugin will not work.
|
92 |
|
93 |
= What is the percentage of spam blocked? =
|
94 |
|
95 |
-
|
96 |
-
|
97 |
|
98 |
= What about trackback spam? =
|
99 |
|
@@ -103,24 +94,28 @@ So trackbacks are blocked by default but pingbacks are enabled. You may enable t
|
|
103 |
Edit [anti-spam.php](http://plugins.trac.wordpress.org/browser/anti-spam/trunk/anti-spam.php) file and find "$antispam_allow_trackbacks" and make it "true".
|
104 |
You may read more about the [difference between trackbacks and pingbacks](http://web-profile.com.ua/web/trackback-vs-pingback/).
|
105 |
|
|
|
|
|
|
|
|
|
|
|
106 |
= And one more extra note... =
|
107 |
|
108 |
-
If site has caching plugin enabled and cache is not cleared or if theme does not use 'comment_form' action
|
109 |
-
|
110 |
|
111 |
= Not enough information about the plugin? =
|
112 |
|
113 |
You may check out the [source code of the plugin](http://plugins.trac.wordpress.org/browser/anti-spam/trunk/anti-spam.php).
|
114 |
-
The plugin is pretty small and easy to read.
|
115 |
-
Plugin is lightweight but it makes all the dirty work against spam pretty good. You may give it a try.
|
116 |
-
|
117 |
-
= How to reduce the amount of spam? =
|
118 |
-
|
119 |
-
Do not order spam-newsletters because people hate spam and people will not like products received from spam.
|
120 |
-
Do not order products from spam. If spam will be less effective than spammers will stop sending it.
|
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
|
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: 4.1
|
7 |
+
Stable tag: 3.3
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl.html
|
10 |
|
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 |
|
24 |
* **no moderation queues**, because spam is not administrators' problem
|
25 |
* **no options**, because it is great to forget about spam completely
|
26 |
|
|
|
|
|
27 |
Plugin is easy to use: just install it and it just works.
|
28 |
+
|
29 |
+
**Plugin blocks spam only in comments section**.
|
30 |
|
31 |
After installing the Anti-spam plugin **try to submit a comment on your site being logged out**.
|
32 |
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.
|
33 |
|
34 |
= Useful: =
|
35 |
+
* [Anti-spam Pro - more powerful and extended version with settings page](http://codecanyon.net/item/antispam-pro/6491169?ref=webvitaly "Upgrade to Pro")
|
36 |
+
* [Security-protection - blocks brute-force attacks](http://wordpress.org/plugins/security-protection/ "stops brute-force attacks")
|
37 |
* [WordPress Pro plugins](http://codecanyon.net/popular_item/by_category?category=wordpress&ref=webvitaly)
|
38 |
|
39 |
== Installation ==
|
43 |
|
44 |
== Frequently Asked Questions ==
|
45 |
|
46 |
+
= Incompatible with: =
|
47 |
+
|
48 |
+
* Disqus
|
49 |
+
* Jetpack Comments
|
50 |
+
* AJAX Comment Form
|
51 |
+
* bbPress
|
52 |
+
|
53 |
= How does Anti-spam plugin work? =
|
54 |
|
55 |
The blocking algorithm is based on 2 methods: 'invisible js-captcha' and 'invisible input trap'.
|
74 |
|
75 |
You may enable sending all rejected spam comments to admin email.
|
76 |
Edit [anti-spam.php](http://plugins.trac.wordpress.org/browser/anti-spam/trunk/anti-spam.php) file and find "$antispam_send_spam_comment_to_admin" and make it "true".
|
77 |
+
And also plugin adds total blocked spam counter to admin comments section.
|
78 |
|
79 |
+
= Does plugin block spam from Contact or other forms? =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
|
81 |
+
Plugin blocks spam only in comments form section and does not block spam from any other forms on site.
|
82 |
+
If you installed and activated the plugin and you still receiving spam - probably this could be because of some other forms on your site (for example comments forms).
|
|
|
|
|
|
|
|
|
83 |
|
84 |
= What is the percentage of spam blocked? =
|
85 |
|
86 |
+
Plugin blocks about 99.9% of automatic spam messages (sent by spam-bots via post requests).
|
87 |
+
Plugin will pass the messages which were submitted by spammers manually via browser. But such messages happens very rarely.
|
88 |
|
89 |
= What about trackback spam? =
|
90 |
|
94 |
Edit [anti-spam.php](http://plugins.trac.wordpress.org/browser/anti-spam/trunk/anti-spam.php) file and find "$antispam_allow_trackbacks" and make it "true".
|
95 |
You may read more about the [difference between trackbacks and pingbacks](http://web-profile.com.ua/web/trackback-vs-pingback/).
|
96 |
|
97 |
+
= Unobtrusive JavaScript =
|
98 |
+
|
99 |
+
Anti-spam plugin works with disabled JavaScript. JavaScript is disabled on less than 1% of devices.
|
100 |
+
Users with disabled JavaScript should manually fill catcha-like input before submitting the comment.
|
101 |
+
|
102 |
= And one more extra note... =
|
103 |
|
104 |
+
If site has caching plugin enabled and cache is not cleared or if theme does not use 'comment_form' action
|
105 |
+
and there is no plugin inputs in comments form - plugin tries to add hidden fields automatically using JavaScript.
|
106 |
|
107 |
= Not enough information about the plugin? =
|
108 |
|
109 |
You may check out the [source code of the plugin](http://plugins.trac.wordpress.org/browser/anti-spam/trunk/anti-spam.php).
|
110 |
+
The plugin is pretty small and easy to read.
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
|
112 |
|
113 |
== Changelog ==
|
114 |
+
= 3.3 - 2014-12-15 =
|
115 |
+
* refactor code structure
|
116 |
+
* added blocked spam counter in the comments section
|
117 |
+
* clean up the docs
|
118 |
+
|
119 |
= 3.2 - 2014-12-05 =
|
120 |
* added ANTISPAM_VERSION constant (thanks to jumbo)
|
121 |
* removed 'spam points' algorithm because it is not needed
|