Anti-spam - Version 3.5

Version Description

  • 2015-01-17 =
  • removed function_exists check because each function has unique prefix
  • removed add_option()
  • added autocomplete="off" for inputs (thanks to Feriman)
Download this release

Release Info

Developer webvitaly
Plugin Icon 128x128 Anti-spam
Version 3.5
Comparing to
See all releases

Code changes from version 3.4 to 3.5

anti-spam-functions.php CHANGED
@@ -1,6 +1,5 @@
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)){
@@ -9,5 +8,4 @@ function antispam_log_stats() {
9
  $antispam_stats['blocked_total'] = 1;
10
  }
11
  update_option('antispam_stats', $antispam_stats);
12
- }
13
- endif; // end of antispam_log_stats()
1
  <?php
2
 
 
3
  function antispam_log_stats() {
4
  $antispam_stats = get_option('antispam_stats', array());
5
  if (array_key_exists('blocked_total', $antispam_stats)){
8
  $antispam_stats['blocked_total'] = 1;
9
  }
10
  update_option('antispam_stats', $antispam_stats);
11
+ }
 
anti-spam-info.php CHANGED
@@ -1,6 +1,5 @@
1
  <?php
2
 
3
- if ( ! function_exists('antispam_admin_notice')):
4
  function antispam_admin_notice() {
5
  global $pagenow;
6
  if ($pagenow == 'edit-comments.php'):
@@ -21,10 +20,8 @@ function antispam_admin_notice() {
21
  endif; // end of if($pagenow == 'edit-comments.php')
22
  }
23
  add_action('admin_notices', 'antispam_admin_notice');
24
- endif; // end of antispam_admin_notice()
25
 
26
 
27
- if ( ! function_exists('antispam_display_screen_option')):
28
  function antispam_display_screen_option() {
29
  global $pagenow;
30
  if ($pagenow == 'edit-comments.php'):
@@ -54,20 +51,14 @@ function antispam_display_screen_option() {
54
  <?php
55
  endif; // end of if($pagenow == 'edit-comments.php')
56
  }
57
- endif; // end of antispam_display_screen_option()
58
 
59
 
60
- if ( ! function_exists('antispam_register_screen_option')):
61
  function antispam_register_screen_option() {
62
- $screen = get_current_screen();
63
  add_filter('screen_layout_columns', 'antispam_display_screen_option');
64
- $screen->add_option('antispam_info', '');
65
  }
66
  add_action('admin_head', 'antispam_register_screen_option');
67
- endif; // end of antispam_register_screen_option()
68
 
69
 
70
- if ( ! function_exists('antispam_update_screen_option')):
71
  function antispam_update_screen_option() {
72
  if (isset($_POST['antispam_option_submit']) AND $_POST['antispam_option_submit'] == 1) {
73
  $user_id = get_current_user_id();
@@ -79,4 +70,3 @@ function antispam_update_screen_option() {
79
  }
80
  }
81
  add_action('admin_init', 'antispam_update_screen_option');
82
- endif; // end of antispam_update_screen_option()
1
  <?php
2
 
 
3
  function antispam_admin_notice() {
4
  global $pagenow;
5
  if ($pagenow == 'edit-comments.php'):
20
  endif; // end of if($pagenow == 'edit-comments.php')
21
  }
22
  add_action('admin_notices', 'antispam_admin_notice');
 
23
 
24
 
 
25
  function antispam_display_screen_option() {
26
  global $pagenow;
27
  if ($pagenow == 'edit-comments.php'):
51
  <?php
52
  endif; // end of if($pagenow == 'edit-comments.php')
53
  }
 
54
 
55
 
 
56
  function antispam_register_screen_option() {
 
57
  add_filter('screen_layout_columns', 'antispam_display_screen_option');
 
58
  }
59
  add_action('admin_head', 'antispam_register_screen_option');
 
60
 
61
 
 
62
  function antispam_update_screen_option() {
63
  if (isset($_POST['antispam_option_submit']) AND $_POST['antispam_option_submit'] == 1) {
64
  $user_id = get_current_user_id();
70
  }
71
  }
72
  add_action('admin_init', 'antispam_update_screen_option');
 
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.4
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.4');
19
 
20
  $antispam_settings = array(
21
  'send_spam_comment_to_admin' => $antispam_send_spam_comment_to_admin,
@@ -27,17 +27,15 @@ $antispam_settings = array(
27
  include('anti-spam-functions.php');
28
  include('anti-spam-info.php');
29
 
30
- if ( ! function_exists('antispam_enqueue_script')):
31
  function antispam_enqueue_script() {
32
  if (is_singular() && comments_open()) { // load script only for pages with comments form
33
- wp_enqueue_script('anti-spam-script', plugins_url('/js/anti-spam-3.4.js', __FILE__), array('jquery'), null, true);
34
  }
35
  }
36
  add_action('wp_enqueue_scripts', 'antispam_enqueue_script');
37
- endif; // end of antispam_enqueue_script()
38
 
39
 
40
- if ( ! function_exists('antispam_form_part')):
41
  function antispam_form_part() {
42
  global $antispam_settings;
43
  $rn = "\r\n"; // .chr(13).chr(10)
@@ -46,20 +44,18 @@ function antispam_form_part() {
46
  echo ' <p class="antispam-group antispam-group-q" style="clear: both;">
47
  <label>Current ye@r <span class="required">*</span></label>
48
  <input type="hidden" name="antspm-a" class="antispam-control antispam-control-a" value="'.date('Y').'" />
49
- <input type="text" name="antspm-q" class="antispam-control antispam-control-q" value="'.$antispam_settings['version'].'" />
50
  </p>'.$rn; // question (hidden with js)
51
 
52
  echo ' <p class="antispam-group antispam-group-e" style="display: none;">
53
  <label>Leave this field empty</label>
54
- <input type="text" name="antspm-e-email-url-website" class="antispam-control antispam-control-e" value="" />
55
  </p>'.$rn; // empty field (hidden with css); trap for spammers because many bots will try to put email or url here
56
  }
57
  }
58
- add_action('comment_form', 'antispam_form_part'); // add anti-spam input to the comment form
59
- endif; // end of antispam_form_part()
60
 
61
 
62
- if ( ! function_exists('antispam_check_comment')):
63
  function antispam_check_comment($commentdata) {
64
  global $antispam_settings;
65
  $rn = "\r\n"; // .chr(13).chr(10)
@@ -145,6 +141,7 @@ function antispam_check_comment($commentdata) {
145
  $antispam_message .= $antispam_message_append;
146
  @wp_mail($antispam_settings['admin_email'], $antispam_subject, $antispam_message); // send trackback comment to admin email
147
  }
 
148
  wp_die($antispam_pre_error_message . $antispam_error_message); // die - do not send trackback
149
  }
150
  }
@@ -155,10 +152,8 @@ function antispam_check_comment($commentdata) {
155
  if ( ! is_admin()) {
156
  add_filter('preprocess_comment', 'antispam_check_comment', 1);
157
  }
158
- endif; // end of antispam_check_comment()
159
 
160
 
161
- if ( ! function_exists('antispam_plugin_meta')):
162
  function antispam_plugin_meta($links, $file) { // add some 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>'));
@@ -167,5 +162,4 @@ function antispam_plugin_meta($links, $file) { // add some links to plugin meta
167
  }
168
  return $links;
169
  }
170
- add_filter('plugin_row_meta', 'antispam_plugin_meta', 10, 2);
171
- 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.5
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.5');
19
 
20
  $antispam_settings = array(
21
  'send_spam_comment_to_admin' => $antispam_send_spam_comment_to_admin,
27
  include('anti-spam-functions.php');
28
  include('anti-spam-info.php');
29
 
30
+
31
  function antispam_enqueue_script() {
32
  if (is_singular() && comments_open()) { // load script only for pages with comments form
33
+ wp_enqueue_script('anti-spam-script', plugins_url('/js/anti-spam-3.5.js', __FILE__), array('jquery'), null, true);
34
  }
35
  }
36
  add_action('wp_enqueue_scripts', 'antispam_enqueue_script');
 
37
 
38
 
 
39
  function antispam_form_part() {
40
  global $antispam_settings;
41
  $rn = "\r\n"; // .chr(13).chr(10)
44
  echo ' <p class="antispam-group antispam-group-q" style="clear: both;">
45
  <label>Current ye@r <span class="required">*</span></label>
46
  <input type="hidden" name="antspm-a" class="antispam-control antispam-control-a" value="'.date('Y').'" />
47
+ <input type="text" name="antspm-q" class="antispam-control antispam-control-q" value="'.$antispam_settings['version'].'" autocomplete="off" />
48
  </p>'.$rn; // question (hidden with js)
49
 
50
  echo ' <p class="antispam-group antispam-group-e" style="display: none;">
51
  <label>Leave this field empty</label>
52
+ <input type="text" name="antspm-e-email-url-website" class="antispam-control antispam-control-e" value="" autocomplete="off" />
53
  </p>'.$rn; // empty field (hidden with css); trap for spammers because many bots will try to put email or url here
54
  }
55
  }
56
+ add_action('comment_form', 'antispam_form_part'); // add anti-spam inputs to the comment form
 
57
 
58
 
 
59
  function antispam_check_comment($commentdata) {
60
  global $antispam_settings;
61
  $rn = "\r\n"; // .chr(13).chr(10)
141
  $antispam_message .= $antispam_message_append;
142
  @wp_mail($antispam_settings['admin_email'], $antispam_subject, $antispam_message); // send trackback comment to admin email
143
  }
144
+ antispam_log_stats();
145
  wp_die($antispam_pre_error_message . $antispam_error_message); // die - do not send trackback
146
  }
147
  }
152
  if ( ! is_admin()) {
153
  add_filter('preprocess_comment', 'antispam_check_comment', 1);
154
  }
 
155
 
156
 
 
157
  function antispam_plugin_meta($links, $file) { // add some links to plugin meta row
158
  if (strpos($file, 'anti-spam.php') !== false) {
159
  $links = array_merge($links, array('<a href="http://web-profile.com.ua/wordpress/plugins/anti-spam/" title="Plugin page">Anti-spam</a>'));
162
  }
163
  return $links;
164
  }
165
+ add_filter('plugin_row_meta', 'antispam_plugin_meta', 10, 2);
 
js/{anti-spam-3.4.js → anti-spam-3.5.js} RENAMED
File without changes
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Anti-spam ===
2
  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.3
6
- Tested up to: 4.1
7
- Stable tag: 3.4
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl.html
10
 
@@ -22,7 +22,7 @@ Anti-spam plugin blocks spam in comments automatically, invisibly for users and
22
 
23
  * **no captcha**, because spam is not users' problem
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
 
@@ -32,7 +32,7 @@ After installing the Anti-spam plugin **try to submit a comment on your site bei
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
 
@@ -43,6 +43,12 @@ If you get an error - you may check the solution in the [Support section](http:/
43
 
44
  == Frequently Asked Questions ==
45
 
 
 
 
 
 
 
46
  = Incompatible with: =
47
 
48
  * Disqus
@@ -82,11 +88,6 @@ You can hide or show this info block in the "Screen Options" section. The info b
82
  Plugin blocks spam only in comments form section and does not block spam from any other forms on site.
83
  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).
84
 
85
- = What is the percentage of spam blocked? =
86
-
87
- Plugin blocks about 99.9% of automatic spam messages (sent by spam-bots via post requests).
88
- Plugin will pass the messages which were submitted by spammers manually via browser. But such messages happens very rarely.
89
-
90
  = What about trackback spam? =
91
 
92
  Users rarely use trackbacks because it is manual and requires extra input. Spammers uses trackbacks because it is easy to cheat here.
@@ -112,6 +113,11 @@ The plugin is pretty small and easy to read.
112
 
113
 
114
  == Changelog ==
 
 
 
 
 
115
  = 3.4 - 2014-12-20 =
116
  * added the ability to hide or show info block in the "Screen Options" section
117
 
1
  === Anti-spam ===
2
  Contributors: webvitaly
3
  Donate link: http://web-profile.com.ua/donate/
4
+ Tags: spam, spammer, comment, comments, comment-spam, antispam, anti-spam, block-spam, spam-free, spambot, spam-bot, bot
5
  Requires at least: 3.3
6
+ Tested up to: 4.4
7
+ Stable tag: 3.5
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl.html
10
 
22
 
23
  * **no captcha**, because spam is not users' problem
24
  * **no moderation queues**, because spam is not administrators' problem
25
+ * **no settings page**, because it is great to forget about spam completely and keep admin section clean
26
 
27
  Plugin is easy to use: just install it and it just works.
28
 
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 - extended version with settings and manual spam protection](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
 
43
 
44
  == Frequently Asked Questions ==
45
 
46
+ = What is the percentage of spam blocked? =
47
+
48
+ Anti-spam plugin blocks 100% of automatic spam messages (sent by spam-bots via post requests).
49
+ Plugin does not block manual spam (submitted by spammers manually via browser).
50
+ You can use [Anti-spam Pro](http://codecanyon.net/item/antispam-pro/6491169?ref=webvitaly "Upgrade to Pro") plugin if you need to block manual spam.
51
+
52
  = Incompatible with: =
53
 
54
  * Disqus
88
  Plugin blocks spam only in comments form section and does not block spam from any other forms on site.
89
  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).
90
 
 
 
 
 
 
91
  = What about trackback spam? =
92
 
93
  Users rarely use trackbacks because it is manual and requires extra input. Spammers uses trackbacks because it is easy to cheat here.
113
 
114
 
115
  == Changelog ==
116
+ = 3.5 - 2015-01-17 =
117
+ * removed function_exists check because each function has unique prefix
118
+ * removed add_option()
119
+ * added autocomplete="off" for inputs (thanks to Feriman)
120
+
121
  = 3.4 - 2014-12-20 =
122
  * added the ability to hide or show info block in the "Screen Options" section
123