WordPress Zero Spam - Version 5.0.12

Version Description

Download this release

Release Info

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

Code changes from version 5.0.11 to 5.0.12

core/admin/class-admin.php CHANGED
@@ -45,16 +45,18 @@ class Admin {
45
  $message = sprintf(
46
  wp_kses(
47
  /* translators: %s: url */
48
- __( 'Thanks for installing WordPress Zero Spam! Visit the <a href="%1$s">setting page</a> to configure your site\'s protection level or <strong><a href="%2$s">click here</a> to automatically configure recommended settings</strong>.', 'zerospam' ),
49
  array(
50
  'strong' => array(),
51
  'a' => array(
52
- 'href' => array(),
 
53
  ),
54
  )
55
  ),
56
  esc_url( admin_url( 'options-general.php?page=wordpress-zero-spam-settings' ) ),
57
- esc_url( admin_url( 'options-general.php?page=wordpress-zero-spam-settings&zerospam-auto-configure=1' ) )
 
58
  );
59
 
60
  $class = 'notice notice-success';
45
  $message = sprintf(
46
  wp_kses(
47
  /* translators: %s: url */
48
+ __( 'Thanks for installing WordPress Zero Spam! Visit the <a href="%1$s">setting page</a> to configure your site\'s protection level or <strong><a href="%2$s">click here</a> to automatically configure recommended settings</strong>. For enhanced protection, get a <a href="%3$s" target="_blank">Zero Spam premium license</a>.', 'zerospam' ),
49
  array(
50
  'strong' => array(),
51
  'a' => array(
52
+ 'href' => array(),
53
+ 'target' => array(),
54
  ),
55
  )
56
  ),
57
  esc_url( admin_url( 'options-general.php?page=wordpress-zero-spam-settings' ) ),
58
+ esc_url( admin_url( 'options-general.php?page=wordpress-zero-spam-settings&zerospam-auto-configure=1' ) ),
59
+ esc_url( 'https://www.zerospam.org/product/premium/' )
60
  );
61
 
62
  $class = 'notice notice-success';
core/class-access.php CHANGED
@@ -38,7 +38,7 @@ class Access {
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
 
38
  * Returns true if WordPress Zero Spam should process a submission.
39
  */
40
  public static function process() {
41
+ if ( ( is_admin() && ! wp_doing_ajax() ) || is_user_logged_in() ) {
42
  return false;
43
  }
44
 
core/class-cron.php CHANGED
@@ -39,10 +39,12 @@ class Cron {
39
  * Updates the WP core blacklist.
40
  */
41
  public function update_blacklist() {
42
- $response = wp_remote_get( 'https://raw.githubusercontent.com/splorp/wordpress-comment-blacklist/master/blacklist.txt' );
 
43
 
44
- if ( ! is_wp_error( $response ) && 200 === wp_remote_retrieve_response_code( $response ) ) {
45
- update_option( 'disallowed_keys', wp_remote_retrieve_body( $response ) );
 
46
  }
47
  }
48
 
39
  * Updates the WP core blacklist.
40
  */
41
  public function update_blacklist() {
42
+ if ( 'enabled' === \ZeroSpam\Core\Settings::get_settings( 'sync_disallowed_keys' ) ) {
43
+ $response = wp_remote_get( 'https://raw.githubusercontent.com/splorp/wordpress-comment-blacklist/master/blacklist.txt' );
44
 
45
+ if ( ! is_wp_error( $response ) && 200 === wp_remote_retrieve_response_code( $response ) ) {
46
+ update_option( 'disallowed_keys', wp_remote_retrieve_body( $response ) );
47
+ }
48
  }
49
  }
50
 
core/class-settings.php CHANGED
@@ -220,6 +220,18 @@ class Settings {
220
  ),
221
  );
222
 
 
 
 
 
 
 
 
 
 
 
 
 
223
  $settings = apply_filters( 'zerospam_settings', self::$settings );
224
 
225
  if ( $key ) {
220
  ),
221
  );
222
 
223
+ self::$settings['sync_disallowed_keys'] = array(
224
+ 'title' => __( 'Sync Disallowed Keys', 'zerospam' ),
225
+ 'desc' => __( 'Automatically sync WP core\'s disallowed words option with <a href="https://github.com/splorp/wordpress-comment-blacklist/" target="_blank" rel="noreferrer noopener">splorp\'s Comment Blacklist for WordPress</a>.', 'zerospam' ),
226
+ 'section' => 'general',
227
+ 'type' => 'checkbox',
228
+ 'options' => array(
229
+ 'enabled' => __( 'Enabled', 'zerospam' ),
230
+ ),
231
+ 'value' => ! empty( $options['sync_disallowed_keys'] ) ? $options['sync_disallowed_keys'] : false,
232
+ 'recommended' => 'enabled',
233
+ );
234
+
235
  $settings = apply_filters( 'zerospam_settings', self::$settings );
236
 
237
  if ( $key ) {
includes/class-plugin.php CHANGED
@@ -104,6 +104,7 @@ class Plugin {
104
  * initialize admin components.
105
  */
106
  private function init_components() {
 
107
  new DB();
108
  new Cron();
109
  new Registration();
@@ -135,7 +136,6 @@ class Plugin {
135
  new FluentForms();
136
  }*/
137
 
138
- new Zero_Spam();
139
  new StopForumSpam();
140
  new ipstack();
141
 
104
  * initialize admin components.
105
  */
106
  private function init_components() {
107
+ new Zero_Spam();
108
  new DB();
109
  new Cron();
110
  new Registration();
136
  new FluentForms();
137
  }*/
138
 
 
139
  new StopForumSpam();
140
  new ipstack();
141
 
includes/templates/admin-callout.php CHANGED
@@ -13,7 +13,7 @@
13
  <?php
14
  echo sprintf(
15
  wp_kses(
16
- __( 'Help support the <a href="%s" target="_blank" rel="noopener noreferrer">WordPress Zero Spam</a> plugin.', 'zerospam' ),
17
  array(
18
  'a' => array(
19
  'target' => array(),
@@ -22,7 +22,7 @@
22
  ),
23
  )
24
  ),
25
- esc_url( 'https://benmarshall.me/wordpress-zero-spam/?utm_source=wordpress_zero_spam&utm_medium=settings_page&utm_campaign=donation' )
26
  );
27
  ?>
28
  </h2>
@@ -30,13 +30,14 @@
30
  <?php
31
  echo sprintf(
32
  wp_kses(
33
- __( 'Support the continued development of the WPZS by <a href="%s" target="_blank" rel="noopener noreferrer">donating today</a>. Donation goes towards the time it takes to develop new features &amp; updates, but also helps provide pro bono work for nonprofits.', 'zerospam' ),
34
  array(
35
- 'a' => array(
36
  'target' => array(),
37
  'href' => array(),
38
  'rel' => array(),
39
  ),
 
40
  )
41
  ),
42
  esc_url( 'https://benmarshall.me/donate/?utm_source=wordpress_zero_spam&utm_medium=settings_page&utm_campaign=donation' )
@@ -47,7 +48,7 @@
47
  <?php
48
  echo sprintf(
49
  wp_kses(
50
- __( '<strong>Integrate Zero Spam in any application</strong> with the <a href="%s" target="_blank" rel="noopener noreferrer">Zero Spam Blacklist API</a>.', 'zerospam' ),
51
  array(
52
  'strong' => array(),
53
  'a' => array(
@@ -64,9 +65,9 @@
64
  </div>
65
  <div class="zerospam-callout-col zerospam-callout-actions">
66
  <ul>
 
67
  <li><a href="https://github.com/bmarshall511/wordpress-zero-spam/issues" target="_blank"><?php _e( 'Submit Bug/Feature Request', 'zerospam' ); ?></a></li>
68
- <li><a href="https://twitter.com/ZeroSpamOrg" target="_blank"><?php _e( 'Follow us on Twitter', 'zerospam' ); ?></a></li>
69
- <li><a href="https://www.facebook.com/zerospamorg/" target="_blank"><?php _e( 'Like us on Facebook', 'zerospam' ); ?></a></li>
70
  <li><a href="https://benmarshall.me/donate?utm_source=wordpress_zero_spam&utm_medium=settings_page&utm_campaign=admin" target="_blank"><?php _e( 'Show your Support &mdash; Donate', 'zerospam' ); ?></a></li>
71
  </ul>
72
  </div>
13
  <?php
14
  echo sprintf(
15
  wp_kses(
16
+ __( 'Support WordPress Zero Spam & <a href="%s" target="_blank" rel="noopener noreferrer">get enhanced protection</a>.', 'zerospam' ),
17
  array(
18
  'a' => array(
19
  'target' => array(),
22
  ),
23
  )
24
  ),
25
+ esc_url( 'https://www.zerospam.org/product/premium/' )
26
  );
27
  ?>
28
  </h2>
30
  <?php
31
  echo sprintf(
32
  wp_kses(
33
+ __( 'Support continued development by <a href="%1$s" target="_blank" rel="noopener noreferrer">donating</a> and subscribing to a <strong><a href="%1$s" target="_blank" rel="noopener noreferrer">Zero Spam premium license</a> for enhanced protection</strong>. Donations go toward time it takes to develop new features &amp; updates, but also helps provide pro bono work for nonprofits.', 'zerospam' ),
34
  array(
35
+ 'a' => array(
36
  'target' => array(),
37
  'href' => array(),
38
  'rel' => array(),
39
  ),
40
+ 'strong' => array(),
41
  )
42
  ),
43
  esc_url( 'https://benmarshall.me/donate/?utm_source=wordpress_zero_spam&utm_medium=settings_page&utm_campaign=donation' )
48
  <?php
49
  echo sprintf(
50
  wp_kses(
51
+ __( '<strong>Use Zero Spam in anything!</strong> Integrate the Zero Spam blacklist in any application with the <a href="%s" target="_blank" rel="noopener noreferrer">Zero Spam Blacklist API</a>.', 'zerospam' ),
52
  array(
53
  'strong' => array(),
54
  'a' => array(
65
  </div>
66
  <div class="zerospam-callout-col zerospam-callout-actions">
67
  <ul>
68
+ <li><a href="https://www.zerospam.org/product/premium/" target="_blank"><?php _e( 'Get a Zero Spam Premium License', 'zerospam' ); ?></a></li>
69
  <li><a href="https://github.com/bmarshall511/wordpress-zero-spam/issues" target="_blank"><?php _e( 'Submit Bug/Feature Request', 'zerospam' ); ?></a></li>
70
+ <li><a href="https://twitter.com/ZeroSpamOrg" target="_blank"><?php _e( 'Follow us on Twitter', 'zerospam' ); ?></a> &amp; <a href="https://www.facebook.com/zerospamorg/" target="_blank"><?php _e( 'Facebook', 'zerospam' ); ?></a></li>
 
71
  <li><a href="https://benmarshall.me/donate?utm_source=wordpress_zero_spam&utm_medium=settings_page&utm_campaign=admin" target="_blank"><?php _e( 'Show your Support &mdash; Donate', 'zerospam' ); ?></a></li>
72
  </ul>
73
  </div>
modules/contactform7/class-contactform7.php CHANGED
@@ -72,7 +72,7 @@ class ContactForm7 {
72
  }
73
  }
74
 
75
- return $result;
76
  }
77
 
78
  /**
72
  }
73
  }
74
 
75
+ return apply_filters( 'zerospam_preprocess_cf7_submission', $result, $tag );
76
  }
77
 
78
  /**
modules/davidwalsh/assets/js/davidwalsh.js CHANGED
@@ -33,7 +33,7 @@
33
  };
34
 
35
  $(function() {
36
- var selectors = '#commentform, #registerform';
37
  if (typeof ZeroSpamDavidWalsh.selectors != "undefined" && ZeroSpamDavidWalsh.selectors ) {
38
  selectors += ',' + ZeroSpamDavidWalsh.selectors
39
  }
33
  };
34
 
35
  $(function() {
36
+ var selectors = '#commentform, #registerform, .wpforms-form, .wpcf7-form';
37
  if (typeof ZeroSpamDavidWalsh.selectors != "undefined" && ZeroSpamDavidWalsh.selectors ) {
38
  selectors += ',' + ZeroSpamDavidWalsh.selectors
39
  }
modules/davidwalsh/class-davidwalsh.php CHANGED
@@ -29,6 +29,63 @@ class DavidWalsh {
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
 
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
+ add_filter( 'zerospam_preprocess_cf7_submission', array( $this, 'preprocess_cf7_submission' ), 10, 2 );
33
+ add_action( 'zerospam_preprocess_wpforms_submission', array( $this, 'preprocess_wpforms_submission' ), 10, 1 );
34
+ }
35
+ }
36
+
37
+ /**
38
+ * Preprocess CF7 submission
39
+ */
40
+ public function preprocess_cf7_submission( $result, $tag ) {
41
+ if ( empty( $_REQUEST['zerospam_david_walsh_key'] ) || self::get_davidwalsh() !== $_REQUEST['zerospam_david_walsh_key'] ) {
42
+ $message = \ZeroSpam\Core\Utilities::detection_message( 'contactform7_spam_message' );
43
+ $result->invalidate( $tag[0], $message );
44
+
45
+ $details = array(
46
+ 'result' => $result,
47
+ 'tag' => $tag,
48
+ 'failed' => 'david_walsh',
49
+ );
50
+
51
+ // Log if enabled.
52
+ if ( 'enabled' === \ZeroSpam\Core\Settings::get_settings( 'log_blocked_contactform7' ) ) {
53
+ \ZeroSpam\Includes\DB::log( 'contactform7', $details );
54
+ }
55
+
56
+ // Share the detection if enabled.
57
+ if ( 'enabled' === \ZeroSpam\Core\Settings::get_settings( 'share_data' ) ) {
58
+ $details['type'] = 'contactform7';
59
+ do_action( 'zerospam_share_detection', $details );
60
+ }
61
+ }
62
+
63
+ return $result;
64
+ }
65
+
66
+ /**
67
+ * Preprocess WPForms submission
68
+ */
69
+ public function preprocess_wpforms_submission( $form_data ) {
70
+ if ( empty( $_REQUEST['zerospam_david_walsh_key'] ) || self::get_davidwalsh() !== $_REQUEST['zerospam_david_walsh_key'] ) {
71
+ $message = \ZeroSpam\Core\Utilities::detection_message( 'wpforms_spam_message' );
72
+ wpforms()->process->errors[ $form_data['id'] ]['header'] = $message;
73
+
74
+ $details = array(
75
+ 'form_data' => $form_data,
76
+ 'failed' => 'david_walsh',
77
+ );
78
+
79
+ // Log if enabled.
80
+ if ( 'enabled' === \ZeroSpam\Core\Settings::get_settings( 'log_blocked_wpforms' ) ) {
81
+ \ZeroSpam\Includes\DB::log( 'wpforms', $details );
82
+ }
83
+
84
+ // Share the detection if enabled.
85
+ if ( 'enabled' === \ZeroSpam\Core\Settings::get_settings( 'share_data' ) ) {
86
+ $details['type'] = 'wpforms';
87
+ do_action( 'zerospam_share_detection', $details );
88
+ }
89
  }
90
  }
91
 
modules/wpforms/class-wpforms.php CHANGED
@@ -127,7 +127,7 @@ class WPForms {
127
  // @codingStandardsIgnoreLine
128
  if ( ! empty( $_REQUEST[ ZeroSpam\Core\Utilities::get_honeypot() ] ) ) {
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 );
@@ -146,5 +146,7 @@ class WPForms {
146
  do_action( 'zerospam_share_detection', $details );
147
  }
148
  }
 
 
149
  }
150
  }
127
  // @codingStandardsIgnoreLine
128
  if ( ! empty( $_REQUEST[ ZeroSpam\Core\Utilities::get_honeypot() ] ) ) {
129
  $message = ZeroSpam\Core\Utilities::detection_message( 'wpforms_spam_message' );
130
+ wpforms()->process->errors[ $form_data['id'] ]['header'] = $message;
131
 
132
  $details = $fields;
133
  $details = array_merge( $details, $entry );
146
  do_action( 'zerospam_share_detection', $details );
147
  }
148
  }
149
+
150
+ do_action( 'zerospam_preprocess_wpforms_submission', $form_data );
151
  }
152
  }
readme.txt CHANGED
@@ -1,11 +1,11 @@
1
  === WordPress Zero Spam ===
2
- 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.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
 
@@ -27,8 +27,8 @@ Quit forcing people to answer questions or confusing captchas to prove they're n
27
  * Automatically & manually block IPs temporarily or permanently
28
  * Geolocate IP addresses to see where offenders are coming from
29
  * Block entire countries, regions, zip/postal codes & cities
30
- * Automatically update the WP core disallowed list weekly using [splorp's Comment Blacklist for WordPress](https://github.com/splorp/wordpress-comment-blacklist)
31
- * Multiple detection techniques including [David Walsh's solution](https://davidwalsh.name/wordpress-comment-spam) for stopping WordPress spam.
32
 
33
  = WordPress Zero Spam also protects =
34
 
@@ -73,6 +73,13 @@ For more information & developer documentation, see the [plugin’s website](htt
73
 
74
  == Changelog ==
75
 
 
 
 
 
 
 
 
76
  = v5.0.11 =
77
 
78
  * Improved protection for comments, CF7, Formidbale, registrations, WooCommerce and WPForms submissions.
1
  === WordPress Zero Spam ===
2
+ 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.7
7
  Requires PHP: 7.3
8
+ Stable tag: 5.0.12
9
  License: GNU GPLv3
10
  License URI: https://choosealicense.com/licenses/gpl-3.0/
11
 
27
  * Automatically & manually block IPs temporarily or permanently
28
  * Geolocate IP addresses to see where offenders are coming from
29
  * Block entire countries, regions, zip/postal codes & cities
30
+ * Sync the WP core disallowed list weekly using [splorp's Comment Blacklist](https://github.com/splorp/wordpress-comment-blacklist)
31
+ * Multiple detection techniques including [David Walsh's solution](https://davidwalsh.name/wordpress-comment-spam)
32
 
33
  = WordPress Zero Spam also protects =
34
 
73
 
74
  == Changelog ==
75
 
76
+ = v5.0.12 =
77
+
78
+ * Fixed issue with WPForms AJAX forms not getting validated by WordPress Zero Spam [#238](https://github.com/bmarshall511/wordpress-zero-spam/issues/238)
79
+ * David Walsh detection technique applied to WPForms & CF7
80
+ * Miscellaneous admin UI improvements
81
+ * Added ability to disable syncing WP's Disallowed Comment Keys
82
+
83
  = v5.0.11 =
84
 
85
  * Improved protection for comments, CF7, Formidbale, registrations, WooCommerce and WPForms submissions.
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.11
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.11' );
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.12
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.12' );
35
 
36
  add_action( 'plugins_loaded', 'zerospam_load_plugin_textdomain' );
37