Anti-spam - Version 5.5

Version Description

  • Code cleanup
  • Removed dismissible notice
Download this release

Release Info

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

Code changes from version 5.4 to 5.5

anti-spam-functions.php CHANGED
@@ -52,17 +52,11 @@ function antispam_check_for_spam() {
52
  if ( $antspm_q != date('Y') ) { // year-answer is wrong - it is spam
53
  if ( $antspm_d != date('Y') ) { // extra js-only check: there is no js added input - it is spam
54
  $spam_flag = true;
55
- if (empty($antspm_q)) { // empty answer - it is spam
56
- //$antispam_error_message .= 'Error: empty answer. ['.esc_attr( $antspm_q ).']<br> '.$rn;
57
- } else {
58
- //$antispam_error_message .= 'Error: answer is wrong. ['.esc_attr( $antspm_q ).']<br> '.$rn;
59
- }
60
  }
61
  }
62
 
63
  if ( ! empty($antspm_e)) { // trap field is not empty - it is spam
64
  $spam_flag = true;
65
- //$antispam_error_message .= 'Error: field should be empty. ['.esc_attr( $antspm_e ).']<br> '.$rn;
66
  }
67
 
68
  return $spam_flag;
52
  if ( $antspm_q != date('Y') ) { // year-answer is wrong - it is spam
53
  if ( $antspm_d != date('Y') ) { // extra js-only check: there is no js added input - it is spam
54
  $spam_flag = true;
 
 
 
 
 
55
  }
56
  }
57
 
58
  if ( ! empty($antspm_e)) { // trap field is not empty - it is spam
59
  $spam_flag = true;
 
60
  }
61
 
62
  return $spam_flag;
anti-spam-notice.php DELETED
@@ -1,214 +0,0 @@
1
- <?php
2
-
3
- if ( ! defined( 'ABSPATH' ) ) { // Avoid direct calls to this file and prevent full path disclosure
4
- exit;
5
- }
6
-
7
-
8
- /**
9
- * Plugin Notice.
10
- *
11
- * @version 3.6.8
12
- */
13
- class AntiSpamNotice {
14
- /* Recommend plugins.
15
- *
16
- * @since 3.6.8
17
- */
18
- protected static $sponsors = array(
19
- 'mailoptin' => 'mailoptin/mailoptin.php',
20
- );
21
-
22
- /**
23
- * AntiSpamNotice constructor.
24
- *
25
- * @since 3.6.8
26
- */
27
- public function __construct() {
28
- // admin notices.
29
- add_action( 'admin_notices', array( $this, 'admin_notice' ) );
30
- add_action( 'network_admin_notices', array( $this, 'admin_notice' ) );
31
-
32
- add_action( 'admin_init', array( $this, 'dismiss_admin_notice' ) );
33
- }
34
-
35
- /**
36
- * Dismiss admin notice.
37
- *
38
- * @since 3.6.8
39
- * @access public
40
- *
41
- * @return void
42
- */
43
- public function dismiss_admin_notice() {
44
- if ( ! isset( $_GET['antispam_action'] ) || $_GET['antispam_action'] != 'antispam_dismiss_notice' ) {
45
- return;
46
- }
47
-
48
- $url = admin_url();
49
- update_option( 'antispam_dismiss_notice', 'true' );
50
-
51
- wp_redirect( $url );
52
- exit;
53
- }
54
-
55
- /**
56
- * Add admin notices.
57
- *
58
- * @since 3.6.8
59
- * @access public
60
- *
61
- * @return void
62
- */
63
- public function admin_notice() {
64
- if ( get_option( 'antispam_dismiss_notice', 'false' ) == 'true' ) {
65
- return;
66
- }
67
-
68
- if ( $this->is_plugin_installed( 'mailoptin' ) && $this->is_plugin_active( 'mailoptin' ) ) {
69
- return;
70
- }
71
-
72
- $dismiss_url = esc_url_raw(
73
- add_query_arg(
74
- array(
75
- 'antispam_action' => 'antispam_dismiss_notice',
76
- ),
77
- admin_url()
78
- )
79
- );
80
-
81
- $this->notice_css();
82
-
83
- $install_url = wp_nonce_url(
84
- admin_url( 'update.php?action=install-plugin&plugin=mailoptin' ),
85
- 'install-plugin_mailoptin'
86
- );
87
-
88
- $activate_url = wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=mailoptin%2Fmailoptin.php' ),
89
- 'activate-plugin_mailoptin/mailoptin.php' );
90
- ?>
91
- <div class="mo-admin-notice notice notice-success">
92
- <div class="mo-notice-row">
93
- <div class="mo-notice-first-half">
94
- <p>
95
- <?php
96
- printf(
97
- __( 'Free optin form plugin that will %1$sincrease your email list subscribers%2$s and keep them engaged with %1$sautomated and schedule newsletters%2$s.' ),
98
- '<strong>', '</strong>' );
99
- ?>
100
- </p>
101
- <p style="font-size: 11px;">Recommended by Anti-Spam plugin</p>
102
- </div>
103
- <div class="mo-notice-other-half">
104
- <?php if ( ! $this->is_plugin_installed( 'mailoptin' ) ) : ?>
105
- <a class="button button-primary button-hero" id="mo-install-mailoptin-plugin"
106
- href="<?php echo $install_url; ?>">
107
- <?php _e( 'Install MailOptin Now for Free!' ); ?>
108
- </a>
109
- <?php endif; ?>
110
- <?php if ( $this->is_plugin_installed( 'mailoptin' ) && ! $this->is_plugin_active( 'mailoptin' ) ) : ?>
111
- <a class="button button-primary button-hero" id="mo-activate-mailoptin-plugin"
112
- href="<?php echo $activate_url; ?>">
113
- <?php _e( 'Activate MailOptin Now!' ); ?>
114
- </a>
115
- <?php endif; ?>
116
- <p>
117
- <a target="_blank" href="https://mailoptin.io">Learn more</a>
118
- </p>
119
- </div>
120
- </div>
121
- <a class="notice-dismiss" href="<?php echo $dismiss_url; ?>">
122
-
123
- <span class="screen-reader-text"><?php _e( 'Dismiss this notice' ); ?>.</span>
124
- </a>
125
- </div>
126
- <?php
127
- }
128
-
129
- /**
130
- * Check if plugin is installed.
131
- *
132
- * @param $key
133
- *
134
- * @return bool
135
- */
136
- protected function is_plugin_installed( $key ) {
137
- $installed_plugins = get_plugins();
138
-
139
- return isset( $installed_plugins[ self::$sponsors[ $key ] ] );
140
- }
141
-
142
- /**
143
- * Check if plugin is active.
144
- *
145
- * @param $key
146
- *
147
- * @return bool
148
- */
149
- protected function is_plugin_active( $key ) {
150
- return is_plugin_active( self::$sponsors[ $key ] );
151
- }
152
-
153
- /**
154
- * Styles for notice.
155
- *
156
- * @return void
157
- */
158
- protected function notice_css() {
159
- ?>
160
- <style type="text/css">
161
- .mo-admin-notice {
162
- background: #fff;
163
- color: #000;
164
- border-left-color: #46b450;
165
- position: relative;
166
- }
167
-
168
- .mo-admin-notice .notice-dismiss {
169
- text-decoration: none;
170
- }
171
-
172
- .mo-admin-notice .notice-dismiss:before {
173
- color: #72777c;
174
- }
175
-
176
- .mo-notice-row {
177
- display: flex;
178
- flex-wrap: wrap;
179
- padding: 15px 0;
180
- }
181
-
182
- .mo-notice-first-half {
183
- flex-basis: 0;
184
- flex-grow: 1;
185
- flex: 0 0 66%;
186
- max-width: 66%;
187
- }
188
-
189
- .mo-notice-other-half {
190
- flex-basis: 0;
191
- flex-grow: 1;
192
- flex: 0 0 33%;
193
- max-width: 33%;
194
- text-align: center;
195
- padding-top: 20px;
196
- }
197
-
198
- .mo-notice-first-half p {
199
- font-size: 14px;
200
- line-height: 18px;
201
- }
202
-
203
- @media (max-width: 768px) {
204
- .mo-notice-first-half,
205
- .mo-notice-other-half {
206
- flex: 0 0 100%;
207
- max-width: 100%;
208
- }
209
- }
210
-
211
- </style>
212
- <?php
213
- }
214
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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: 5.4
7
  Author: webvitaly
8
  Text Domain: anti-spam
9
  Author URI: http://web-profile.net/wordpress/plugins/
@@ -14,24 +14,17 @@ if ( ! defined( 'ABSPATH' ) ) { // Avoid direct calls to this file and prevent f
14
  exit;
15
  }
16
 
17
- define('ANTISPAM_PLUGIN_VERSION', '5.4');
18
 
19
  include('anti-spam-functions.php');
20
  include('anti-spam-settings.php');
21
  include('anti-spam-info.php');
22
 
23
- include 'anti-spam-notice.php';
24
-
25
- global $pagenow;
26
- if ($pagenow == 'options-general.php' && $_GET['page'] == 'anti-spam'):
27
- new AntiSpamNotice();
28
- endif;
29
-
30
 
31
  function antispam_enqueue_script() {
32
  global $withcomments; // WP flag to show comments on all pages
33
  if ((is_singular() || $withcomments) && comments_open()) { // load script only for pages with comments form
34
- wp_enqueue_script('anti-spam-script', plugins_url('/js/anti-spam-5.4.js', __FILE__), null, null, true);
35
  }
36
  }
37
  add_action('wp_enqueue_scripts', 'antispam_enqueue_script');
3
  Plugin Name: Anti-spam
4
  Plugin URI: http://wordpress.org/plugins/anti-spam/
5
  Description: No spam in comments. No captcha.
6
+ Version: 5.5
7
  Author: webvitaly
8
  Text Domain: anti-spam
9
  Author URI: http://web-profile.net/wordpress/plugins/
14
  exit;
15
  }
16
 
17
+ define('ANTISPAM_PLUGIN_VERSION', '5.5');
18
 
19
  include('anti-spam-functions.php');
20
  include('anti-spam-settings.php');
21
  include('anti-spam-info.php');
22
 
 
 
 
 
 
 
 
23
 
24
  function antispam_enqueue_script() {
25
  global $withcomments; // WP flag to show comments on all pages
26
  if ((is_singular() || $withcomments) && comments_open()) { // load script only for pages with comments form
27
+ wp_enqueue_script('anti-spam-script', plugins_url('/js/anti-spam-5.5.js', __FILE__), null, null, true);
28
  }
29
  }
30
  add_action('wp_enqueue_scripts', 'antispam_enqueue_script');
js/{anti-spam-5.4.js → anti-spam-5.5.js} RENAMED
@@ -53,7 +53,6 @@ wordpress.org/plugins/anti-spam/
53
  if ( (elements[i].id === 'comments') || (elements[i].id === 'respond') || (elements[i].id === 'commentform') ) {
54
  var class_index = elements[i].className.indexOf('anti-spam-form-processed');
55
  if ( class_index == -1 ) { // form is not yet js processed
56
- //elements[i].innerHTML += dynamic_control; // not working
57
  elements[i].appendChild(dynamic_control);
58
  elements[i].className = elements[i].className + ' anti-spam-form-processed';
59
  }
53
  if ( (elements[i].id === 'comments') || (elements[i].id === 'respond') || (elements[i].id === 'commentform') ) {
54
  var class_index = elements[i].className.indexOf('anti-spam-form-processed');
55
  if ( class_index == -1 ) { // form is not yet js processed
 
56
  elements[i].appendChild(dynamic_control);
57
  elements[i].className = elements[i].className + ' anti-spam-form-processed';
58
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://web-profile.net/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: 5.2
7
- Stable tag: 5.4
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl.html
10
 
@@ -12,9 +12,9 @@ No spam in comments. No captcha.
12
 
13
  == Description ==
14
 
15
- * **[Anti-spam Pro](http://codecanyon.net/item/antispam-pro/6491169?ref=webvitalii "Upgrade to Pro")** |
16
- * **[Anti-spam](http://web-profile.net/wordpress/plugins/anti-spam/ "Plugin page")** |
17
- * **[Donate](http://web-profile.net/donate/ "Support the development")** |
18
  * **[GitHub](https://github.com/webvitalii/anti-spam "Fork")**
19
 
20
 
@@ -122,6 +122,10 @@ The plugin is pretty small and easy to read.
122
 
123
  == Changelog ==
124
 
 
 
 
 
125
  = 5.4 =
126
  * Updated dismissible notice
127
 
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: 5.2
7
+ Stable tag: 5.5
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=webvitalii "Upgrade to Pro")**
16
+ * **[Anti-spam](http://web-profile.net/wordpress/plugins/anti-spam/ "Plugin page")**
17
+ * **[Donate](http://web-profile.net/donate/ "Support the development")**
18
  * **[GitHub](https://github.com/webvitalii/anti-spam "Fork")**
19
 
20
 
122
 
123
  == Changelog ==
124
 
125
+ = 5.5 =
126
+ * Code cleanup
127
+ * Removed dismissible notice
128
+
129
  = 5.4 =
130
  * Updated dismissible notice
131