WordPress Zero Spam - Version 5.0.4

Version Description

Download this release

Release Info

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

Code changes from version 5.0.3 to 5.0.4

core/class-access.php CHANGED
@@ -28,8 +28,21 @@ class Access {
28
  * @access private
29
  */
30
  public function __construct() {
31
- add_action( 'template_redirect', array( $this, 'access_check' ), 0 );
32
- add_filter( 'zerospam_access_checks', array( $this, 'check_blocked' ), 0, 3 );
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  }
34
 
35
  /**
28
  * @access private
29
  */
30
  public function __construct() {
31
+ if ( ZeroSpam\Core\Access::process() ) {
32
+ add_action( 'template_redirect', array( $this, 'access_check' ), 0 );
33
+ add_filter( 'zerospam_access_checks', array( $this, 'check_blocked' ), 0, 3 );
34
+ }
35
+ }
36
+
37
+ /**
38
+ * Returns true if WordPress Zero Spam should process a submission.
39
+ */
40
+ public static function process() {
41
+ if ( is_admin() || is_user_logged_in() ) {
42
+ return false;
43
+ }
44
+
45
+ return true;
46
  }
47
 
48
  /**
modules/class-stopforumspam.php CHANGED
@@ -27,9 +27,12 @@ class StopForumSpam {
27
  public function __construct() {
28
  add_filter( 'zerospam_setting_sections', array( $this, 'sections' ) );
29
  add_filter( 'zerospam_settings', array( $this, 'settings' ) );
30
- add_filter( 'zerospam_access_checks', array( $this, 'access_check' ), 10, 3 );
31
- add_filter( 'zerospam_registration_errors', array( $this, 'preprocess_registrations' ), 10, 3 );
32
- add_filter( 'zerospam_preprocess_comment', array( $this, 'preprocess_comments' ), 10, 1 );
 
 
 
33
  }
34
 
35
  /**
@@ -142,7 +145,7 @@ class StopForumSpam {
142
  $settings = ZeroSpam\Core\Settings::get_settings();
143
 
144
  if ( empty( $settings['stop_forum_spam']['value'] ) || 'enabled' !== $settings['stop_forum_spam']['value'] ) {
145
- return $errors;
146
  }
147
 
148
  $response = self::query(
@@ -181,7 +184,7 @@ class StopForumSpam {
181
  }
182
 
183
 
184
- return $errors;
185
  }
186
 
187
  /**
27
  public function __construct() {
28
  add_filter( 'zerospam_setting_sections', array( $this, 'sections' ) );
29
  add_filter( 'zerospam_settings', array( $this, 'settings' ) );
30
+
31
+ if ( ZeroSpam\Core\Access::process() ) {
32
+ add_filter( 'zerospam_access_checks', array( $this, 'access_check' ), 10, 3 );
33
+ add_filter( 'zerospam_registration_errors', array( $this, 'preprocess_registrations' ), 10, 3 );
34
+ add_filter( 'zerospam_preprocess_comment', array( $this, 'preprocess_comments' ), 10, 1 );
35
+ }
36
  }
37
 
38
  /**
145
  $settings = ZeroSpam\Core\Settings::get_settings();
146
 
147
  if ( empty( $settings['stop_forum_spam']['value'] ) || 'enabled' !== $settings['stop_forum_spam']['value'] ) {
148
+ return $commentdata;
149
  }
150
 
151
  $response = self::query(
184
  }
185
 
186
 
187
+ return $commentdata;
188
  }
189
 
190
  /**
modules/comments/class-comments.php CHANGED
@@ -31,7 +31,7 @@ class Comments {
31
  add_filter( 'zerospam_types', array( $this, 'types' ), 10, 1 );
32
 
33
  $settings = ZeroSpam\Core\Settings::get_settings();
34
- if ( ! empty( $settings['verify_comments']['value'] ) && 'enabled' === $settings['verify_comments']['value'] ) {
35
  add_filter( 'comment_form_defaults', array( $this, 'honeypot' ) );
36
  add_action( 'preprocess_comment', array( $this, 'preprocess_comments' ) );
37
  }
@@ -85,6 +85,8 @@ class Comments {
85
  );
86
  }
87
 
 
 
88
  return apply_filters( 'zerospam_preprocess_comment', $commentdata );
89
  }
90
 
31
  add_filter( 'zerospam_types', array( $this, 'types' ), 10, 1 );
32
 
33
  $settings = ZeroSpam\Core\Settings::get_settings();
34
+ if ( ! empty( $settings['verify_comments']['value'] ) && 'enabled' === $settings['verify_comments']['value'] && ZeroSpam\Core\Access::process() ) {
35
  add_filter( 'comment_form_defaults', array( $this, 'honeypot' ) );
36
  add_action( 'preprocess_comment', array( $this, 'preprocess_comments' ) );
37
  }
85
  );
86
  }
87
 
88
+ $commentdata = apply_filters( 'zerospam_preprocess_comment', $commentdata );
89
+
90
  return apply_filters( 'zerospam_preprocess_comment', $commentdata );
91
  }
92
 
modules/contactform7/class-contactform7.php CHANGED
@@ -30,7 +30,7 @@ class ContactForm7 {
30
  add_filter( 'zerospam_types', array( $this, 'types' ), 10, 1 );
31
 
32
  $settings = ZeroSpam\Core\Settings::get_settings();
33
- if ( ! empty( $settings['verify_contactform7']['value'] ) && 'enabled' === $settings['verify_contactform7']['value'] ) {
34
  add_filter( 'wpcf7_form_elements', array( $this, 'honeypot' ), 10, 1 );
35
  add_filter( 'wpcf7_validate', array( $this, 'preprocess_submission' ), 10, 2 );
36
  }
30
  add_filter( 'zerospam_types', array( $this, 'types' ), 10, 1 );
31
 
32
  $settings = ZeroSpam\Core\Settings::get_settings();
33
+ if ( ! empty( $settings['verify_contactform7']['value'] ) && 'enabled' === $settings['verify_contactform7']['value'] && ZeroSpam\Core\Access::process() ) {
34
  add_filter( 'wpcf7_form_elements', array( $this, 'honeypot' ), 10, 1 );
35
  add_filter( 'wpcf7_validate', array( $this, 'preprocess_submission' ), 10, 2 );
36
  }
modules/formidable/class-formidable.php CHANGED
@@ -24,7 +24,7 @@ class Formidable {
24
  add_filter( 'zerospam_settings', array( $this, 'settings' ) );
25
  add_filter( 'zerospam_types', array( $this, 'types' ), 10, 1 );
26
 
27
- if ( 'enabled' === ZeroSpam\Core\Settings::get_settings( 'verify_formidable' ) ) {
28
  add_action( 'frm_entry_form', array( $this, 'honeypot' ), 10, 1 );
29
  add_filter( 'frm_validate_entry', array( $this, 'preprocess_submission' ), 10, 2 );
30
  }
24
  add_filter( 'zerospam_settings', array( $this, 'settings' ) );
25
  add_filter( 'zerospam_types', array( $this, 'types' ), 10, 1 );
26
 
27
+ if ( 'enabled' === ZeroSpam\Core\Settings::get_settings( 'verify_formidable' ) && ZeroSpam\Core\Access::process() ) {
28
  add_action( 'frm_entry_form', array( $this, 'honeypot' ), 10, 1 );
29
  add_filter( 'frm_validate_entry', array( $this, 'preprocess_submission' ), 10, 2 );
30
  }
modules/registration/class-registration.php CHANGED
@@ -32,7 +32,7 @@ class Registration {
32
  add_filter( 'zerospam_types', array( $this, 'types' ), 10, 1 );
33
 
34
  $settings = ZeroSpam\Core\Settings::get_settings();
35
- if ( ! empty( $settings['verify_registrations']['value'] ) && 'enabled' === $settings['verify_registrations']['value'] ) {
36
  add_action( 'register_form', array( $this, 'honeypot' ) );
37
  add_filter( 'registration_errors', array( $this, 'preprocess_registration' ), 10, 3 );
38
  }
32
  add_filter( 'zerospam_types', array( $this, 'types' ), 10, 1 );
33
 
34
  $settings = ZeroSpam\Core\Settings::get_settings();
35
+ if ( ! empty( $settings['verify_registrations']['value'] ) && 'enabled' === $settings['verify_registrations']['value'] && ZeroSpam\Core\Access::process() ) {
36
  add_action( 'register_form', array( $this, 'honeypot' ) );
37
  add_filter( 'registration_errors', array( $this, 'preprocess_registration' ), 10, 3 );
38
  }
modules/woocommerce/class-woocommerce.php CHANGED
@@ -25,7 +25,7 @@ class WooCommerce {
25
  add_filter( 'zerospam_types', array( $this, 'types' ), 10, 1 );
26
 
27
  $settings = ZeroSpam\Core\Settings::get_settings();
28
- if ( ! empty( $settings['woocommerce_protection']['value'] ) && 'enabled' === $settings['woocommerce_protection']['value'] ) {
29
  $settings = ZeroSpam\Core\Settings::get_settings();
30
  if ( ! empty( $settings['verify_registrations']['value'] ) && 'enabled' === $settings['verify_registrations']['value'] ) {
31
  add_action( 'woocommerce_register_form', array( $this, 'honeypot' ) );
25
  add_filter( 'zerospam_types', array( $this, 'types' ), 10, 1 );
26
 
27
  $settings = ZeroSpam\Core\Settings::get_settings();
28
+ if ( ! empty( $settings['woocommerce_protection']['value'] ) && 'enabled' === $settings['woocommerce_protection']['value'] && ZeroSpam\Core\Access::process() ) {
29
  $settings = ZeroSpam\Core\Settings::get_settings();
30
  if ( ! empty( $settings['verify_registrations']['value'] ) && 'enabled' === $settings['verify_registrations']['value'] ) {
31
  add_action( 'woocommerce_register_form', array( $this, 'honeypot' ) );
modules/wpforms/class-wpforms.php CHANGED
@@ -24,7 +24,7 @@ class WPForms {
24
  add_filter( 'zerospam_settings', array( $this, 'settings' ) );
25
  add_filter( 'zerospam_types', array( $this, 'types' ), 10, 1 );
26
 
27
- if ( 'enabled' === ZeroSpam\Core\Settings::get_settings('verify_wpforms') ) {
28
  add_action( 'wpforms_frontend_output', array( $this, 'honeypot' ), 10, 1 );
29
  add_action( 'wpforms_process', array( $this, 'preprocess_submission' ), 10, 3 );
30
  }
24
  add_filter( 'zerospam_settings', array( $this, 'settings' ) );
25
  add_filter( 'zerospam_types', array( $this, 'types' ), 10, 1 );
26
 
27
+ if ( 'enabled' === ZeroSpam\Core\Settings::get_settings('verify_wpforms') && ZeroSpam\Core\Access::process() ) {
28
  add_action( 'wpforms_frontend_output', array( $this, 'honeypot' ), 10, 1 );
29
  add_action( 'wpforms_process', array( $this, 'preprocess_submission' ), 10, 3 );
30
  }
readme.txt CHANGED
@@ -5,7 +5,7 @@ Donate link: https://www.benmarshall.me/donate/?utm_source=wordpress_zero_spam&u
5
  Requires at least: 5.2
6
  Tested up to: 5.6.2
7
  Requires PHP: 7.3
8
- Stable tag: 5.0.3
9
  License: GNU GPLv3
10
  License URI: https://choosealicense.com/licenses/gpl-3.0/
11
 
@@ -72,6 +72,10 @@ For more information & developer documentation, see the [plugin’s website](htt
72
 
73
  == Changelog ==
74
 
 
 
 
 
75
  = v5.0.3 =
76
 
77
  * Added support for Formidable Form Builder
5
  Requires at least: 5.2
6
  Tested up to: 5.6.2
7
  Requires PHP: 7.3
8
+ Stable tag: 5.0.4
9
  License: GNU GPLv3
10
  License URI: https://choosealicense.com/licenses/gpl-3.0/
11
 
72
 
73
  == Changelog ==
74
 
75
+ = v5.0.4 =
76
+
77
+ * Fix for when checks should be preformed
78
+
79
  = v5.0.3 =
80
 
81
  * Added support for Formidable Form Builder
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.3
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.3' );
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.4
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.4' );
35
 
36
  add_action( 'plugins_loaded', 'zerospam_load_plugin_textdomain' );
37