Anti-spam - Version 5.3

Version Description

  • Fixed the typo in the readme
  • Readme cleanup
  • Code cleanup
  • Added dismissible notice
Download this release

Release Info

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

Code changes from version 5.2 to 5.3

anti-spam-functions.php CHANGED
@@ -1,6 +1,8 @@
1
  <?php
2
 
3
- defined('ABSPATH') OR exit; // prevent full path disclosure
 
 
4
 
5
  function antispam_default_settings() {
6
  $settings = array(
1
  <?php
2
 
3
+ if ( ! defined( 'ABSPATH' ) ) { // Avoid direct calls to this file and prevent full path disclosure
4
+ exit;
5
+ }
6
 
7
  function antispam_default_settings() {
8
  $settings = array(
anti-spam-info.php CHANGED
@@ -1,6 +1,8 @@
1
  <?php
2
 
3
- defined('ABSPATH') OR exit; // prevent full path disclosure
 
 
4
 
5
  function antispam_admin_notice() {
6
  global $pagenow;
1
  <?php
2
 
3
+ if ( ! defined( 'ABSPATH' ) ) { // Avoid direct calls to this file and prevent full path disclosure
4
+ exit;
5
+ }
6
 
7
  function antispam_admin_notice() {
8
  global $pagenow;
anti-spam-notice.php ADDED
@@ -0,0 +1,214 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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-settings.php CHANGED
@@ -4,7 +4,7 @@ Anti-spam settings code
4
  used WordPress Settings API - http://codex.wordpress.org/Settings_API
5
  */
6
 
7
- if ( ! defined( 'ABSPATH' ) ) { // prevent full path disclosure
8
  exit;
9
  }
10
 
4
  used WordPress Settings API - http://codex.wordpress.org/Settings_API
5
  */
6
 
7
+ if ( ! defined( 'ABSPATH' ) ) { // Avoid direct calls to this file and prevent full path disclosure
8
  exit;
9
  }
10
 
anti-spam.php CHANGED
@@ -3,28 +3,31 @@
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.2
7
  Author: webvitaly
8
  Text Domain: anti-spam
9
  Author URI: http://web-profile.net/wordpress/plugins/
10
  License: GPLv3
11
  */
12
 
13
- if ( ! defined( 'ABSPATH' ) ) { // prevent full path disclosure
14
  exit;
15
  }
16
 
17
- define('ANTISPAM_PLUGIN_VERSION', '5.2');
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.2.js', __FILE__), null, null, true);
28
  }
29
  }
30
  add_action('wp_enqueue_scripts', 'antispam_enqueue_script');
@@ -80,19 +83,6 @@ if ( ! is_admin()) { // without this check it is not possible to add comment in
80
  }
81
 
82
 
83
- // This way still sends the email notifications
84
- /*function antispam_process_comments( $comment_ID, $comment_approved ) {
85
- global $antispam_settings;
86
- if ( $antispam_settings['save_spam_comments'] ) {
87
- if( antispam_check_for_spam() ) {
88
- wp_set_comment_status( $comment_ID, 'spam' );
89
- antispam_counter_stats();
90
- }
91
- }
92
- }*/
93
- //add_action( 'comment_post', 'antispam_process_comments', 10, 2 );
94
-
95
-
96
  function antispam_plugin_meta($links, $file) { // add some links to plugin meta row
97
  if ( $file == plugin_basename( __FILE__ ) ) {
98
  $row_meta = array(
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.3
7
  Author: webvitaly
8
  Text Domain: anti-spam
9
  Author URI: http://web-profile.net/wordpress/plugins/
10
  License: GPLv3
11
  */
12
 
13
+ if ( ! defined( 'ABSPATH' ) ) { // Avoid direct calls to this file and prevent full path disclosure
14
  exit;
15
  }
16
 
17
+ define('ANTISPAM_PLUGIN_VERSION', '5.3');
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
+ new AntiSpamNotice();
26
 
27
  function antispam_enqueue_script() {
28
  global $withcomments; // WP flag to show comments on all pages
29
  if ((is_singular() || $withcomments) && comments_open()) { // load script only for pages with comments form
30
+ wp_enqueue_script('anti-spam-script', plugins_url('/js/anti-spam-5.3.js', __FILE__), null, null, true);
31
  }
32
  }
33
  add_action('wp_enqueue_scripts', 'antispam_enqueue_script');
83
  }
84
 
85
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
  function antispam_plugin_meta($links, $file) { // add some links to plugin meta row
87
  if ( $file == plugin_basename( __FILE__ ) ) {
88
  $row_meta = array(
js/{anti-spam-5.2.js → anti-spam-5.3.js} RENAMED
File without changes
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.0
7
- Stable tag: 5.2
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl.html
10
 
@@ -12,10 +12,10 @@ 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
 
21
  Anti-spam plugin blocks automatic spam in comments section. No captcha.
@@ -34,10 +34,6 @@ After installing the Anti-spam plugin **try to submit a comment on your site bei
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
 
37
- = Useful: =
38
- * **[Anti-spam Pro - extended version with settings and manual spam protection](http://codecanyon.net/item/antispam-pro/6491169?ref=webvitalii "Upgrade to Pro")**
39
- * **[Silver Bullet Pro - Speedup and protect WordPress in a smart way](http://codecanyon.net/item/silver-bullet-pro/15171769?ref=webvitalii "Speedup and protect WordPress in a smart way")**
40
-
41
  == Installation ==
42
 
43
  1. Install and activate the plugin on the Plugins page
@@ -94,7 +90,7 @@ The visibility option for this info block is saved per user.
94
  = Does plugin block spam from Contact or other forms? =
95
 
96
  Plugin blocks spam only in comments form section and does not block spam from any other forms on site.
97
- 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).
98
 
99
  = What about trackback spam? =
100
 
@@ -126,6 +122,12 @@ The plugin is pretty small and easy to read.
126
 
127
  == Changelog ==
128
 
 
 
 
 
 
 
129
  = 5.2 =
130
  * Disable trackbacks
131
 
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.0
7
+ Stable tag: 5.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=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
 
21
  Anti-spam plugin blocks automatic spam in comments section. No captcha.
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
 
 
 
 
 
37
  == Installation ==
38
 
39
  1. Install and activate the plugin on the Plugins page
90
  = Does plugin block spam from Contact or other forms? =
91
 
92
  Plugin blocks spam only in comments form section and does not block spam from any other forms on site.
93
+ 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 feedback form).
94
 
95
  = What about trackback spam? =
96
 
122
 
123
  == Changelog ==
124
 
125
+ = 5.3 =
126
+ * Fixed the typo in the readme
127
+ * Readme cleanup
128
+ * Code cleanup
129
+ * Added dismissible notice
130
+
131
  = 5.2 =
132
  * Disable trackbacks
133