WordPress Zero Spam - Version 5.0.11

Version Description

Download this release

Release Info

Developer bmarshall511
Plugin Icon 128x128 WordPress Zero Spam
Version 5.0.11
Comparing to
See all releases

Code changes from version 5.0.10 to 5.0.11

core/admin/class-admin.php CHANGED
@@ -29,6 +29,8 @@ class Admin {
29
  add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ) );
30
  add_action( 'admin_enqueue_scripts', array( $this, 'scripts' ) );
31
 
 
 
32
  // Check first-time config.
33
  $configured = get_option( 'zerospam_configured' );
34
  if ( ! $configured ) {
29
  add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ) );
30
  add_action( 'admin_enqueue_scripts', array( $this, 'scripts' ) );
31
 
32
+ // Check if promotional message should be displayed.
33
+
34
  // Check first-time config.
35
  $configured = get_option( 'zerospam_configured' );
36
  if ( ! $configured ) {
core/admin/class-dashboard.php CHANGED
@@ -259,8 +259,6 @@ class Dashboard {
259
  esc_url( admin_url( 'options-general.php?page=wordpress-zero-spam-settings' ) )
260
  );
261
  ?>
262
-
263
- <?php esc_html_e( '', 'zerospam' ); ?>
264
  </div>
265
  <?php
266
  endif;
@@ -300,8 +298,6 @@ class Dashboard {
300
  esc_url( admin_url( 'options-general.php?page=wordpress-zero-spam-settings' ) )
301
  );
302
  ?>
303
-
304
- <?php esc_html_e( '', 'zerospam' ); ?>
305
  </div>
306
  <?php endif; ?>
307
  </div>
259
  esc_url( admin_url( 'options-general.php?page=wordpress-zero-spam-settings' ) )
260
  );
261
  ?>
 
 
262
  </div>
263
  <?php
264
  endif;
298
  esc_url( admin_url( 'options-general.php?page=wordpress-zero-spam-settings' ) )
299
  );
300
  ?>
 
 
301
  </div>
302
  <?php endif; ?>
303
  </div>
modules/contactform7/class-contactform7.php CHANGED
@@ -56,10 +56,19 @@ class ContactForm7 {
56
  $message = ZeroSpam\Core\Utilities::detection_message( 'contactform7_spam_message' );
57
  $result->invalidate( $tag[0], $message );
58
 
 
 
 
 
59
  if ( 'enabled' === ZeroSpam\Core\Settings::get_settings( 'log_blocked_contactform7' ) ) {
60
- $_REQUEST['failed'] = 'honeypot';
61
  // @codingStandardsIgnoreLine
62
- ZeroSpam\Includes\DB::log( 'contactform7', $_REQUEST );
 
 
 
 
 
 
63
  }
64
  }
65
 
56
  $message = ZeroSpam\Core\Utilities::detection_message( 'contactform7_spam_message' );
57
  $result->invalidate( $tag[0], $message );
58
 
59
+ $details = $_REQUEST;
60
+ $details['failed'] = 'honeypot';
61
+
62
+ // Log if enabled.
63
  if ( 'enabled' === ZeroSpam\Core\Settings::get_settings( 'log_blocked_contactform7' ) ) {
 
64
  // @codingStandardsIgnoreLine
65
+ ZeroSpam\Includes\DB::log( 'contactform7', $details );
66
+ }
67
+
68
+ // Share the detection if enabled.
69
+ if ( 'enabled' === ZeroSpam\Core\Settings::get_settings( 'share_data' ) ) {
70
+ $details['type'] = 'contactform7';
71
+ do_action( 'zerospam_share_detection', $details );
72
  }
73
  }
74
 
modules/davidwalsh/assets/js/davidwalsh.js CHANGED
@@ -33,7 +33,7 @@
33
  };
34
 
35
  $(function() {
36
- var selectors = '#commentform';
37
  if (typeof ZeroSpamDavidWalsh.selectors != "undefined" && ZeroSpamDavidWalsh.selectors ) {
38
  selectors += ',' + ZeroSpamDavidWalsh.selectors
39
  }
33
  };
34
 
35
  $(function() {
36
+ var selectors = '#commentform, #registerform';
37
  if (typeof ZeroSpamDavidWalsh.selectors != "undefined" && ZeroSpamDavidWalsh.selectors ) {
38
  selectors += ',' + ZeroSpamDavidWalsh.selectors
39
  }
modules/davidwalsh/class-davidwalsh.php CHANGED
@@ -25,8 +25,46 @@ class DavidWalsh {
25
 
26
  if ( 'enabled' === \ZeroSpam\Core\Settings::get_settings( 'davidwalsh' ) && \ZeroSpam\Core\Access::process() ) {
27
  add_action( 'wp_enqueue_scripts', array( $this, 'scripts' ) );
28
- add_action( 'zerospam_preprocess_comment', array( $this, 'preprocess_comments' ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  }
 
 
30
  }
31
 
32
  /**
@@ -35,17 +73,25 @@ class DavidWalsh {
35
  * @param array $commentdata Comment data array.
36
  */
37
  public function preprocess_comments( $commentdata ) {
38
- if ( empty( $_REQUEST['zerospam_david_walsh_key'] || self::get_davidwalsh() === $_REQUEST['zerospam_david_walsh_key'] ) ) {
 
 
 
 
 
 
39
  // Log if enabled.
40
- if ( 'enabled' === ZeroSpam\Core\Settings::get_settings( 'log_blocked_comments' ) ) {
41
- $details = array(
42
- 'failed' => 'david_walsh',
43
- );
44
- $details = array_merge( $details, $commentdata );
45
- ZeroSpam\Includes\DB::log( 'comment', $details );
 
 
46
  }
47
 
48
- $message = ZeroSpam\Core\Utilities::detection_message( 'comment_spam_message' );
49
 
50
  wp_die(
51
  wp_kses(
@@ -59,7 +105,7 @@ class DavidWalsh {
59
  'strong' => array(),
60
  )
61
  ),
62
- esc_html( ZeroSpam\Core\Utilities::detection_title( 'comment_spam_message' ) ),
63
  array(
64
  'response' => 403,
65
  )
25
 
26
  if ( 'enabled' === \ZeroSpam\Core\Settings::get_settings( 'davidwalsh' ) && \ZeroSpam\Core\Access::process() ) {
27
  add_action( 'wp_enqueue_scripts', array( $this, 'scripts' ) );
28
+ add_action( 'login_enqueue_scripts', array( $this, 'scripts' ) );
29
+
30
+ add_filter( 'zerospam_preprocess_comment', array( $this, 'preprocess_comments' ), 10, 1 );
31
+ add_filter( 'zerospam_registration_errors', array( $this, 'preprocess_registration' ), 10, 3 );
32
+ }
33
+ }
34
+
35
+ /**
36
+ * Preprocess registrations
37
+ *
38
+ * @param WP_Error $errors A WP_Error object containing any errors encountered during registration.
39
+ * @param string $sanitized_user_login User's username after it has been sanitized.
40
+ * @param string $user_email User's email.
41
+ */
42
+ public function preprocess_registration( $errors, $sanitized_user_login, $user_email ) {
43
+ if ( empty( $_REQUEST['zerospam_david_walsh_key'] ) || self::get_davidwalsh() !== $_REQUEST['zerospam_david_walsh_key'] ) {
44
+
45
+ $details = array(
46
+ 'user_login' => $sanitized_user_login,
47
+ 'user_email' => $user_email,
48
+ 'failed' => 'david_walsh',
49
+ );
50
+
51
+ // Log if enabled.
52
+ if ( 'enabled' === \ZeroSpam\Core\Settings::get_settings( 'log_blocked_registrations' ) ) {
53
+ \ZeroSpam\Includes\DB::log( 'registration', $details );
54
+ }
55
+
56
+ // Share the detection if enabled.
57
+ if ( 'enabled' === \ZeroSpam\Core\Settings::get_settings( 'share_data' ) ) {
58
+ $details['type'] = 'registration';
59
+ do_action( 'zerospam_share_detection', $details );
60
+ }
61
+
62
+ $message = \ZeroSpam\Core\Utilities::detection_message( 'registration_spam_message' );
63
+
64
+ $errors->add( 'zerospam_error', $message );
65
  }
66
+
67
+ return $errors;
68
  }
69
 
70
  /**
73
  * @param array $commentdata Comment data array.
74
  */
75
  public function preprocess_comments( $commentdata ) {
76
+ if ( empty( $_REQUEST['zerospam_david_walsh_key'] ) || self::get_davidwalsh() !== $_REQUEST['zerospam_david_walsh_key'] ) {
77
+
78
+ $details = array(
79
+ 'failed' => 'david_walsh',
80
+ );
81
+ $details = array_merge( $details, $commentdata );
82
+
83
  // Log if enabled.
84
+ if ( 'enabled' === \ZeroSpam\Core\Settings::get_settings( 'log_blocked_comments' ) ) {
85
+ \ZeroSpam\Includes\DB::log( 'comment', $details );
86
+ }
87
+
88
+ // Share the detection if enabled.
89
+ if ( 'enabled' === \ZeroSpam\Core\Settings::get_settings( 'share_data' ) ) {
90
+ $details['type'] = 'comment';
91
+ do_action( 'zerospam_share_detection', $details );
92
  }
93
 
94
+ $message = \ZeroSpam\Core\Utilities::detection_message( 'comment_spam_message' );
95
 
96
  wp_die(
97
  wp_kses(
105
  'strong' => array(),
106
  )
107
  ),
108
+ esc_html( \ZeroSpam\Core\Utilities::detection_title( 'comment_spam_message' ) ),
109
  array(
110
  'response' => 403,
111
  )
modules/formidable/class-formidable.php CHANGED
@@ -129,11 +129,19 @@ class Formidable {
129
 
130
  $errors['zerospam_honeypot'] = $message;
131
 
 
 
 
 
132
  if ( 'enabled' === ZeroSpam\Core\Settings::get_settings( 'log_blocked_formidable' ) ) {
133
- $details = $values;
134
- $details['failed'] = 'honeypot';
135
  ZeroSpam\Includes\DB::log( 'formidable', $details );
136
  }
 
 
 
 
 
 
137
  }
138
 
139
  return $errors;
129
 
130
  $errors['zerospam_honeypot'] = $message;
131
 
132
+ $details = $values;
133
+ $details['failed'] = 'honeypot';
134
+
135
+ // Log if enabled.
136
  if ( 'enabled' === ZeroSpam\Core\Settings::get_settings( 'log_blocked_formidable' ) ) {
 
 
137
  ZeroSpam\Includes\DB::log( 'formidable', $details );
138
  }
139
+
140
+ // Share the detection if enabled.
141
+ if ( 'enabled' === ZeroSpam\Core\Settings::get_settings( 'share_data' ) ) {
142
+ $details['type'] = 'formidable';
143
+ do_action( 'zerospam_share_detection', $details );
144
+ }
145
  }
146
 
147
  return $errors;
modules/registration/class-registration.php CHANGED
@@ -74,9 +74,7 @@ class Registration {
74
  }
75
  }
76
 
77
- $errors = apply_filters( 'zerospam_registration_errors', $errors, $sanitized_user_login, $user_email );
78
-
79
- return $errors;
80
  }
81
 
82
  /**
74
  }
75
  }
76
 
77
+ return apply_filters( 'zerospam_registration_errors', $errors, $sanitized_user_login, $user_email );
 
 
78
  }
79
 
80
  /**
modules/woocommerce/class-woocommerce.php CHANGED
@@ -107,14 +107,22 @@ class WooCommerce {
107
  $message = ZeroSpam\Core\Utilities::detection_message( 'registration_spam_message' );
108
  $errors->add( 'zerospam_error', $message );
109
 
 
 
 
 
 
 
 
110
  if ( 'enabled' === ZeroSpam\Core\Settings::get_settings( 'log_blocked_registrations' ) ) {
111
- $details = array(
112
- 'user_login' => $username,
113
- 'user_email' => $email,
114
- 'failed' => 'honeypot',
115
- );
116
  ZeroSpam\Includes\DB::log( 'woocommerce_registration', $details );
117
  }
 
 
 
 
 
 
118
  }
119
 
120
  $errors = apply_filters( 'zerospam_registration_errors', $errors, $username, $email );
107
  $message = ZeroSpam\Core\Utilities::detection_message( 'registration_spam_message' );
108
  $errors->add( 'zerospam_error', $message );
109
 
110
+ $details = array(
111
+ 'user_login' => $username,
112
+ 'user_email' => $email,
113
+ 'failed' => 'honeypot',
114
+ );
115
+
116
+ // Log if enabled.
117
  if ( 'enabled' === ZeroSpam\Core\Settings::get_settings( 'log_blocked_registrations' ) ) {
 
 
 
 
 
118
  ZeroSpam\Includes\DB::log( 'woocommerce_registration', $details );
119
  }
120
+
121
+ // Share the detection if enabled.
122
+ if ( 'enabled' === ZeroSpam\Core\Settings::get_settings( 'share_data' ) ) {
123
+ $details['type'] = 'woocommerce_registration';
124
+ do_action( 'zerospam_share_detection', $details );
125
+ }
126
  }
127
 
128
  $errors = apply_filters( 'zerospam_registration_errors', $errors, $username, $email );
modules/wpforms/class-wpforms.php CHANGED
@@ -129,14 +129,22 @@ class WPForms {
129
  $message = ZeroSpam\Core\Utilities::detection_message( 'wpforms_spam_message' );
130
  wpforms()->process->errors[ $form_data['id'] ][0] = $message;
131
 
132
- if ( 'enabled' === ZeroSpam\Core\Settings::get_settings( 'log_blocked_wpforms' ) ) {
133
- $details = $fields;
134
- $details = array_merge( $details, $entry );
135
- $details = array_merge( $details, $form_data );
 
136
 
137
- $details['failed'] = 'honeypot';
 
138
  ZeroSpam\Includes\DB::log( 'wpforms', $details );
139
  }
 
 
 
 
 
 
140
  }
141
  }
142
  }
129
  $message = ZeroSpam\Core\Utilities::detection_message( 'wpforms_spam_message' );
130
  wpforms()->process->errors[ $form_data['id'] ][0] = $message;
131
 
132
+ $details = $fields;
133
+ $details = array_merge( $details, $entry );
134
+ $details = array_merge( $details, $form_data );
135
+
136
+ $details['failed'] = 'honeypot';
137
 
138
+ // Log if enabled.
139
+ if ( 'enabled' === ZeroSpam\Core\Settings::get_settings( 'log_blocked_wpforms' ) ) {
140
  ZeroSpam\Includes\DB::log( 'wpforms', $details );
141
  }
142
+
143
+ // Share the detection if enabled.
144
+ if ( 'enabled' === ZeroSpam\Core\Settings::get_settings( 'share_data' ) ) {
145
+ $details['type'] = 'wpforms';
146
+ do_action( 'zerospam_share_detection', $details );
147
+ }
148
  }
149
  }
150
  }
readme.txt CHANGED
@@ -3,9 +3,9 @@ Contributors: bmarshall511
3
  Tags: comments, spam, antispam, anti-spam, comment spam, spambot, spammer, spam free, spam blocker, registration spam
4
  Donate link: https://www.benmarshall.me/donate/?utm_source=wordpress_zero_spam&utm_medium=wordpress_repo&utm_campaign=donate
5
  Requires at least: 5.2
6
- Tested up to: 5.6.2
7
  Requires PHP: 7.3
8
- Stable tag: 5.0.10
9
  License: GNU GPLv3
10
  License URI: https://choosealicense.com/licenses/gpl-3.0/
11
 
@@ -73,6 +73,11 @@ For more information & developer documentation, see the [plugin’s website](htt
73
 
74
  == Changelog ==
75
 
 
 
 
 
 
76
  = v5.0.10 =
77
 
78
  * PHP notice fix
3
  Tags: comments, spam, antispam, anti-spam, comment spam, spambot, spammer, spam free, spam blocker, registration spam
4
  Donate link: https://www.benmarshall.me/donate/?utm_source=wordpress_zero_spam&utm_medium=wordpress_repo&utm_campaign=donate
5
  Requires at least: 5.2
6
+ Tested up to: 5.7
7
  Requires PHP: 7.3
8
+ Stable tag: 5.0.11
9
  License: GNU GPLv3
10
  License URI: https://choosealicense.com/licenses/gpl-3.0/
11
 
73
 
74
  == Changelog ==
75
 
76
+ = v5.0.11 =
77
+
78
+ * Improved protection for comments, CF7, Formidbale, registrations, WooCommerce and WPForms submissions.
79
+ * David Walsh detection technique applied to core WP registration forms.
80
+
81
  = v5.0.10 =
82
 
83
  * PHP notice fix
wordpress-zero-spam.php CHANGED
@@ -13,7 +13,7 @@
13
  * Plugin Name: WordPress Zero Spam
14
  * Plugin URI: https://benmarshall.me/wordpress-zero-spam
15
  * Description: Tired of all the useless and bloated WordPress spam plugins? The WordPress Zero Spam plugin makes blocking spam a cinch. <strong>Just install, activate and say goodbye to spam.</strong>.
16
- * Version: 5.0.10
17
  * Requires at least: 5.2
18
  * Requires PHP: 7.3
19
  * Author: Ben Marshall
@@ -31,7 +31,7 @@ defined( 'ABSPATH' ) || die();
31
  define( 'ZEROSPAM', __FILE__ );
32
  define( 'ZEROSPAM_PATH', plugin_dir_path( ZEROSPAM ) );
33
  define( 'ZEROSPAM_PLUGIN_BASE', plugin_basename( ZEROSPAM ) );
34
- define( 'ZEROSPAM_VERSION', '5.0.10' );
35
 
36
  add_action( 'plugins_loaded', 'zerospam_load_plugin_textdomain' );
37
 
13
  * Plugin Name: WordPress Zero Spam
14
  * Plugin URI: https://benmarshall.me/wordpress-zero-spam
15
  * Description: Tired of all the useless and bloated WordPress spam plugins? The WordPress Zero Spam plugin makes blocking spam a cinch. <strong>Just install, activate and say goodbye to spam.</strong>.
16
+ * Version: 5.0.11
17
  * Requires at least: 5.2
18
  * Requires PHP: 7.3
19
  * Author: Ben Marshall
31
  define( 'ZEROSPAM', __FILE__ );
32
  define( 'ZEROSPAM_PATH', plugin_dir_path( ZEROSPAM ) );
33
  define( 'ZEROSPAM_PLUGIN_BASE', plugin_basename( ZEROSPAM ) );
34
+ define( 'ZEROSPAM_VERSION', '5.0.11' );
35
 
36
  add_action( 'plugins_loaded', 'zerospam_load_plugin_textdomain' );
37