WordPress Zero Spam - Version 5.1.0

Version Description

Download this release

Release Info

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

Code changes from version 5.0.13 to 5.1.0

assets/css/admin.css CHANGED
@@ -293,3 +293,19 @@
293
  text-align: right;
294
  width: 22%;
295
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
293
  text-align: right;
294
  width: 22%;
295
  }
296
+
297
+ .zerospam-export-import-block {
298
+ display: flex;
299
+ flex-wrap: wrap;
300
+ }
301
+
302
+ .zerospam-export-import-block-column {
303
+ width: 100%;
304
+ }
305
+
306
+
307
+ @media (min-width: 768px) {
308
+ .zerospam-export-import-block-column {
309
+ width: 50%;
310
+ }
311
+ }
core/admin/class-settings.php CHANGED
@@ -28,6 +28,7 @@ class Settings {
28
  public function __construct() {
29
  add_action( 'admin_menu', array( $this, 'admin_menu' ) );
30
  add_action( 'admin_init', array( $this, 'register_settings' ) );
 
31
 
32
  if ( ! empty( $_REQUEST['zerospam-auto-configure'] ) ) {
33
  \ZeroSpam\Core\Settings::auto_configure();
@@ -53,6 +54,46 @@ class Settings {
53
  }
54
  }
55
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  /**
57
  * Regenerates the honeypot ID.
58
  */
@@ -255,7 +296,7 @@ class Settings {
255
  <?php if ( $selected ) : ?>
256
  checked="checked"
257
  <?php endif; ?>
258
- />
259
  <?php
260
  echo wp_kses(
261
  $label,
@@ -325,6 +366,26 @@ class Settings {
325
  <h1><?php echo esc_html( get_admin_page_title() ); ?></h1>
326
  <?php require ZEROSPAM_PATH . 'includes/templates/admin-callout.php'; ?>
327
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
328
  <form action="options.php" method="post">
329
  <?php
330
  // Output security fields for the registered setting "wpzerospam".
@@ -336,9 +397,35 @@ class Settings {
336
 
337
  // Output save settings button.
338
  submit_button( 'Save Settings' );
339
- echo '</div>';
340
  ?>
341
  </form>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
342
  </div>
343
  <?php
344
  }
28
  public function __construct() {
29
  add_action( 'admin_menu', array( $this, 'admin_menu' ) );
30
  add_action( 'admin_init', array( $this, 'register_settings' ) );
31
+ add_action( 'admin_action_import_settings', array( $this, 'import_settings' ) );
32
 
33
  if ( ! empty( $_REQUEST['zerospam-auto-configure'] ) ) {
34
  \ZeroSpam\Core\Settings::auto_configure();
54
  }
55
  }
56
 
57
+ /**
58
+ * Imports settings.
59
+ *
60
+ * @since 5.1.0
61
+ */
62
+ public function import_settings() {
63
+ $redirect = ! empty( $_POST['redirect'] ) ? esc_url( sanitize_text_field( wp_unslash( $_POST['redirect'] ) ) ) : get_site_url();
64
+ $redirect = wp_parse_url( $redirect );
65
+
66
+ $redirect['query'] = str_replace(
67
+ array(
68
+ 'zerospam-success=1',
69
+ 'zerospam-error=1',
70
+ ),
71
+ '',
72
+ $redirect['query']
73
+ );
74
+
75
+ $redirect = $redirect['scheme'] . '://' . $redirect['host'] . ( ! empty( $redirect['port'] ) ? ':' . $redirect['port'] : '' ) . $redirect['path'] . '?' . $redirect['query'];
76
+
77
+ if ( isset( $_POST['zerospam'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['zerospam'] ) ), 'import_settings' ) ) {
78
+ $settings_json = sanitize_text_field( wp_unslash( $_POST['settings'] ) ); // @codingStandardsIgnoreLine
79
+ if ( ! empty( $settings_json ) ) {
80
+ $settings = json_decode( $settings_json, true );
81
+ if ( json_last_error() === JSON_ERROR_NONE ) {
82
+ update_option( 'wpzerospam', $settings, true );
83
+
84
+ wp_safe_redirect( $redirect . '&zerospam-success=1' );
85
+ exit;
86
+ } else {
87
+ wp_safe_redirect( $redirect . '&zerospam-error=1' );
88
+ exit;
89
+ }
90
+ }
91
+ } else {
92
+ wp_safe_redirect( $redirect . '&zerospam-error=1' );
93
+ exit;
94
+ }
95
+ }
96
+
97
  /**
98
  * Regenerates the honeypot ID.
99
  */
296
  <?php if ( $selected ) : ?>
297
  checked="checked"
298
  <?php endif; ?>
299
+ />
300
  <?php
301
  echo wp_kses(
302
  $label,
366
  <h1><?php echo esc_html( get_admin_page_title() ); ?></h1>
367
  <?php require ZEROSPAM_PATH . 'includes/templates/admin-callout.php'; ?>
368
 
369
+ <?php if ( ! empty( $_GET['zerospam-error'] ) ): ?>
370
+ <div class="notice notice-error is-dismissible">
371
+ <p><strong>
372
+ <?php
373
+ switch( intval( $_GET['zerospam-error'] ) ) :
374
+ case 1:
375
+ esc_html_e( 'There was a problem importing the settings JSON. Please try again.', 'zerospam' );
376
+ break;
377
+ endswitch;
378
+ ?>
379
+ </strong></p>
380
+ <button type="button" class="notice-dismiss"><span class="screen-reader-text"><?php esc_html_e( 'Dismiss this notice.', 'zerospam' ); ?></span></button>
381
+ </div>
382
+ <?php elseif ( ! empty( $_GET['zerospam-success'] ) ): ?>
383
+ <div class="notice notice-success is-dismissible">
384
+ <p><strong><?php esc_html_e( 'The settings JSON has been successfully imported.', 'zerospam' ); ?></strong></p>
385
+ <button type="button" class="notice-dismiss"><span class="screen-reader-text"><?php esc_html_e( 'Dismiss this notice.', 'zerospam' ); ?>.</span></button>
386
+ </div>
387
+ <?php endif; ?>
388
+
389
  <form action="options.php" method="post">
390
  <?php
391
  // Output security fields for the registered setting "wpzerospam".
397
 
398
  // Output save settings button.
399
  submit_button( 'Save Settings' );
 
400
  ?>
401
  </form>
402
+
403
+ <h3><?php esc_html_e( 'Settings Import/Export', 'zerospam' ); ?></h3>
404
+ <p><?php esc_html_e( 'Quickly export and import your saved settings into other sites below.', 'zerospam' ); ?></p>
405
+ <?php
406
+ $settings = ZeroSpam\Core\Settings::get_settings();
407
+ $settings_json = array();
408
+ foreach ( $settings as $key => $data ) {
409
+ $settings_json[ $key ] = $data['value'];
410
+ }
411
+ ?>
412
+ <div class="zerospam-export-import-block">
413
+ <div class="zerospam-export-import-block-column">
414
+ <h4><?php esc_html_e( 'Settings JSON', 'zerospam' ); ?></h4>
415
+ <textarea readonly class="large-text code" rows="10"><?php echo wp_json_encode( $settings_json ); ?></textarea>
416
+ </div>
417
+ <div class="zerospam-export-import-block-column">
418
+ <h4><?php esc_html_e( 'Paste the settings JSON to import.', 'zerospam' ); ?></h4>
419
+ <form method="post" action="<?php echo esc_url( admin_url( 'admin.php' ) ); ?>" class="zerospam-import-settings-form">
420
+ <?php wp_nonce_field( 'import_settings', 'zerospam' ); ?>
421
+ <input type="hidden" name="action" value="import_settings" />
422
+ <input type="hidden" name="redirect" value="<?php echo esc_url( ZeroSpam\Core\Utilities::current_url() ); ?>" />
423
+ <textarea class="large-text code" name="settings" rows="10"></textarea>
424
+ <input type="submit" class="button button-primary" value="<?php esc_html_e( 'Import Settings', 'zerospam' ); ?>" />
425
+ </form>
426
+ </div>
427
+ </div>
428
+ <?php echo '</div>'; ?>
429
  </div>
430
  <?php
431
  }
core/class-access.php CHANGED
@@ -80,6 +80,10 @@ class Access {
80
  if ( ! empty( $settings['block_handler']['value'] ) ) {
81
  switch ( $settings['block_handler']['value'] ) {
82
  case 403:
 
 
 
 
83
  $message = __( 'Your IP address has been blocked by WordPress Zero Spam due to detected spam/malicious activity.', 'zerospam' );
84
  if ( ! empty( $settings['blocked_message']['value'] ) ) {
85
  $message = $settings['blocked_message']['value'];
@@ -167,13 +171,15 @@ class Access {
167
  'blocked' => false,
168
  );
169
 
170
- // Attempt to get the IP address location & checked if block.
171
- $location = ZeroSpam\Modules\ipstack::get_geolocation( $user_ip );
172
- if ( $location ) {
 
 
173
  $location_keys = array( 'country_code', 'region_code', 'city', 'zip' );
174
  foreach ( $location_keys as $key => $loc ) {
175
- if ( ! empty( $location[ $loc ] ) ) {
176
- $blocked = ZeroSpam\Includes\DB::blocked( $location[ $loc ], $loc );
177
  if ( $blocked ) {
178
  $access_checks['blocked'] = self::get_blocked_details( $blocked, 'blocked_' . $loc );
179
  break;
@@ -182,6 +188,15 @@ class Access {
182
  }
183
  }
184
 
 
 
 
 
 
 
 
 
 
185
  // If passed location blocks, check the IP address.
186
  if ( ! $access_checks['blocked'] ) {
187
  // Check the user's IP access.
80
  if ( ! empty( $settings['block_handler']['value'] ) ) {
81
  switch ( $settings['block_handler']['value'] ) {
82
  case 403:
83
+ header( 'Cache-Control: no-cache, no-store, must-revalidate' );
84
+ header( 'Pragma: no-cache' );
85
+ header( 'Expires: 0' );
86
+
87
  $message = __( 'Your IP address has been blocked by WordPress Zero Spam due to detected spam/malicious activity.', 'zerospam' );
88
  if ( ! empty( $settings['blocked_message']['value'] ) ) {
89
  $message = $settings['blocked_message']['value'];
171
  'blocked' => false,
172
  );
173
 
174
+ // Attempt to get the IP address location from ipstack & checked if block.
175
+ $ipstack_location = ZeroSpam\Modules\ipstack::get_geolocation( $user_ip );
176
+ if ( $ipstack_location && ! empty( $ipstack_location['error'] ) ) {
177
+ ZeroSpam\Core\Utilities::log( wp_json_encode( $ipstack_location['error'] ) );
178
+ } elseif ( $ipstack_location ) {
179
  $location_keys = array( 'country_code', 'region_code', 'city', 'zip' );
180
  foreach ( $location_keys as $key => $loc ) {
181
+ if ( ! empty( $ipstack_location[ $loc ] ) ) {
182
+ $blocked = ZeroSpam\Includes\DB::blocked( $ipstack_location[ $loc ], $loc );
183
  if ( $blocked ) {
184
  $access_checks['blocked'] = self::get_blocked_details( $blocked, 'blocked_' . $loc );
185
  break;
188
  }
189
  }
190
 
191
+ // Try getting country from Cloudflare.
192
+ $cloudflare_country_code = ! empty( $_SERVER['HTTP_CF_IPCOUNTRY'] ) ? $_SERVER['HTTP_CF_IPCOUNTRY'] : false;
193
+ if ( $cloudflare_country_code ) {
194
+ $blocked = ZeroSpam\Includes\DB::blocked( $cloudflare_country_code, 'country_code' );
195
+ if ( $blocked ) {
196
+ $access_checks['blocked'] = self::get_blocked_details( $blocked, 'blocked_country_code' );
197
+ }
198
+ }
199
+
200
  // If passed location blocks, check the IP address.
201
  if ( ! $access_checks['blocked'] ) {
202
  // Check the user's IP access.
core/class-utilities.php CHANGED
@@ -17,6 +17,35 @@ defined( 'ABSPATH' ) || die();
17
  */
18
  class Utilities {
19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  /**
21
  * Validates submitted data agaisnt the WP core disallowed list.
22
  */
17
  */
18
  class Utilities {
19
 
20
+ /**
21
+ * Write an entry to a log file in the uploads directory.
22
+ *
23
+ * @since 5.1.0
24
+ *
25
+ * @param mixed $entry String or array of the information to write to the log.
26
+ * @param string $file Optional. The file basename for the .log file.
27
+ * @param string $mode Optional. The type of write. See 'mode' at https://www.php.net/manual/en/function.fopen.php.
28
+ * @return boolean|int Number of bytes written to the lof file, false otherwise.
29
+ */
30
+ public static function log( $entry, $mode = 'a', $file = 'zerospam' ) {
31
+ // Get WordPress uploads directory.
32
+ $upload_dir = wp_upload_dir();
33
+ $upload_dir = $upload_dir['basedir'];
34
+
35
+ // If the entry is array, json_encode.
36
+ if ( is_array( $entry ) ) {
37
+ $entry = json_encode( $entry );
38
+ }
39
+
40
+ // Write the log file.
41
+ $file = $upload_dir . '/' . $file . '.log';
42
+ $file = fopen( $file, $mode );
43
+ $bytes = fwrite( $file, current_time( 'mysql' ) . "::" . $entry . "\n" );
44
+ fclose( $file );
45
+
46
+ return $bytes;
47
+ }
48
+
49
  /**
50
  * Validates submitted data agaisnt the WP core disallowed list.
51
  */
includes/class-plugin.php CHANGED
@@ -153,7 +153,7 @@ class Plugin {
153
  }
154
 
155
  /**
156
- * Add to the types array
157
  */
158
  public function types( $types ) {
159
  $types['blocked'] = __( 'Blocked', 'zerospam' );
153
  }
154
 
155
  /**
156
+ * Add to the types array.
157
  */
158
  public function types( $types ) {
159
  $types['blocked'] = __( 'Blocked', 'zerospam' );
modules/class-stopforumspam.php CHANGED
@@ -113,13 +113,13 @@ class StopForumSpam {
113
  'type' => 'number',
114
  'field_class' => 'small-text',
115
  'suffix' => __( '%', 'zerospam' ),
116
- 'placeholder' => __( '30', 'zerospam' ),
117
  'min' => 0,
118
  'max' => 100,
119
  'step' => 0.1,
120
  'desc' => sprintf(
121
  wp_kses(
122
- __( 'Recommended setting is 20%%. Minimum <a href="%s" target="_blank" rel="noopener noreferrer">confidence score</a> an IP must meet before being blocked. Setting this too low could cause users to be blocked that shouldn\'t be.', 'zerospam' ),
123
  array(
124
  'a' => array(
125
  'target' => array(),
@@ -130,7 +130,7 @@ class StopForumSpam {
130
  ),
131
  esc_url( 'https://www.stopforumspam.com/usage#utm_source=wordpresszerospam&utm_medium=admin_link&utm_campaign=wordpresszerospam' )
132
  ),
133
- 'value' => ! empty( $options['stop_forum_spam_confidence_min'] ) ? $options['stop_forum_spam_confidence_min'] : 30,
134
  );
135
 
136
  return $settings;
113
  'type' => 'number',
114
  'field_class' => 'small-text',
115
  'suffix' => __( '%', 'zerospam' ),
116
+ 'placeholder' => __( '50', 'zerospam' ),
117
  'min' => 0,
118
  'max' => 100,
119
  'step' => 0.1,
120
  'desc' => sprintf(
121
  wp_kses(
122
+ __( 'Recommended setting is 50%%. Minimum <a href="%s" target="_blank" rel="noopener noreferrer">confidence score</a> an IP must meet before being blocked. Setting this too low could cause users to be blocked that shouldn\'t be.', 'zerospam' ),
123
  array(
124
  'a' => array(
125
  'target' => array(),
130
  ),
131
  esc_url( 'https://www.stopforumspam.com/usage#utm_source=wordpresszerospam&utm_medium=admin_link&utm_campaign=wordpresszerospam' )
132
  ),
133
+ 'value' => ! empty( $options['stop_forum_spam_confidence_min'] ) ? $options['stop_forum_spam_confidence_min'] : 50,
134
  );
135
 
136
  return $settings;
modules/comments/class-comments.php CHANGED
@@ -26,6 +26,7 @@ class Comments {
26
  add_filter( 'zerospam_types', array( $this, 'types' ), 10, 1 );
27
 
28
  if ( 'enabled' === ZeroSpam\Core\Settings::get_settings( 'verify_comments' ) && ZeroSpam\Core\Access::process() ) {
 
29
  add_filter( 'comment_form_defaults', array( $this, 'honeypot' ) );
30
  add_action( 'preprocess_comment', array( $this, 'preprocess_comments' ) );
31
  }
@@ -42,6 +43,13 @@ class Comments {
42
  return $types;
43
  }
44
 
 
 
 
 
 
 
 
45
  /**
46
  * Preprocess comments
47
  *
26
  add_filter( 'zerospam_types', array( $this, 'types' ), 10, 1 );
27
 
28
  if ( 'enabled' === ZeroSpam\Core\Settings::get_settings( 'verify_comments' ) && ZeroSpam\Core\Access::process() ) {
29
+ add_action( 'comment_form_before', array( $this, 'comment_form_before' ) );
30
  add_filter( 'comment_form_defaults', array( $this, 'honeypot' ) );
31
  add_action( 'preprocess_comment', array( $this, 'preprocess_comments' ) );
32
  }
43
  return $types;
44
  }
45
 
46
+ /**
47
+ * Fires before the comment form.
48
+ */
49
+ public function comment_form_before() {
50
+ do_action( 'zerospam_comment_form_before' );
51
+ }
52
+
53
  /**
54
  * Preprocess comments
55
  *
modules/contactform7/class-contactform7.php CHANGED
@@ -25,11 +25,19 @@ class ContactForm7 {
25
  add_filter( 'zerospam_types', array( $this, 'types' ), 10, 1 );
26
 
27
  if ( 'enabled' === ZeroSpam\Core\Settings::get_settings( 'verify_contactform7' ) && ZeroSpam\Core\Access::process() ) {
 
28
  add_filter( 'wpcf7_form_elements', array( $this, 'honeypot' ), 10, 1 );
29
  add_filter( 'wpcf7_validate', array( $this, 'preprocess_submission' ), 10, 2 );
30
  }
31
  }
32
 
 
 
 
 
 
 
 
33
  /**
34
  * Add a 'honeypot' field to the form
35
  *
25
  add_filter( 'zerospam_types', array( $this, 'types' ), 10, 1 );
26
 
27
  if ( 'enabled' === ZeroSpam\Core\Settings::get_settings( 'verify_contactform7' ) && ZeroSpam\Core\Access::process() ) {
28
+ add_action( 'wpcf7_enqueue_scripts', array( $this, 'wpcf7_enqueue_scripts' ) );
29
  add_filter( 'wpcf7_form_elements', array( $this, 'honeypot' ), 10, 1 );
30
  add_filter( 'wpcf7_validate', array( $this, 'preprocess_submission' ), 10, 2 );
31
  }
32
  }
33
 
34
+ /**
35
+ * Fires when a Contact Form 7 form is loaded on the page.
36
+ */
37
+ public function wpcf7_enqueue_scripts() {
38
+ do_action( 'zerospam_wpcf7_enqueue_scripts' );
39
+ }
40
+
41
  /**
42
  * Add a 'honeypot' field to the form
43
  *
modules/davidwalsh/class-davidwalsh.php CHANGED
@@ -24,9 +24,15 @@ class DavidWalsh {
24
  add_filter( 'zerospam_settings', array( $this, 'settings' ) );
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
  add_filter( 'zerospam_preprocess_cf7_submission', array( $this, 'preprocess_cf7_submission' ), 10, 2 );
@@ -35,7 +41,14 @@ class DavidWalsh {
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'] ) {
@@ -249,7 +262,7 @@ class DavidWalsh {
249
  * Register scripts
250
  */
251
  public function scripts() {
252
- wp_enqueue_script(
253
  'zerospam-davidwalsh',
254
  plugin_dir_url( ZEROSPAM ) . 'modules/davidwalsh/assets/js/davidwalsh.js',
255
  array( 'jquery' ),
24
  add_filter( 'zerospam_settings', array( $this, 'settings' ) );
25
 
26
  if ( 'enabled' === \ZeroSpam\Core\Settings::get_settings( 'davidwalsh' ) && \ZeroSpam\Core\Access::process() ) {
27
+ add_action( 'wp_enqueue_scripts', array( $this, 'scripts' ), 0 );
28
  add_action( 'login_enqueue_scripts', array( $this, 'scripts' ) );
29
 
30
+ add_action( 'zerospam_comment_form_before', array( $this, 'enqueue_script' ) );
31
+ // See https://contactform7.com/loading-javascript-and-stylesheet-only-when-it-is-necessary/.
32
+ add_action( 'zerospam_wpcf7_enqueue_scripts', array( $this, 'enqueue_script' ) );
33
+ add_action( 'zerospam_register_form', array( $this, 'enqueue_script' ) );
34
+ add_action( 'zerospam_wpforms_frontend_output', array( $this, 'enqueue_script' ) );
35
+
36
  add_filter( 'zerospam_preprocess_comment', array( $this, 'preprocess_comments' ), 10, 1 );
37
  add_filter( 'zerospam_registration_errors', array( $this, 'preprocess_registration' ), 10, 3 );
38
  add_filter( 'zerospam_preprocess_cf7_submission', array( $this, 'preprocess_cf7_submission' ), 10, 2 );
41
  }
42
 
43
  /**
44
+ * Enqueues the script.
45
+ */
46
+ public function enqueue_script() {
47
+ wp_enqueue_script( 'zerospam-davidwalsh' );
48
+ }
49
+
50
+ /**
51
+ * Preprocess CF7 submission.
52
  */
53
  public function preprocess_cf7_submission( $result, $tag ) {
54
  if ( empty( $_REQUEST['zerospam_david_walsh_key'] ) || self::get_davidwalsh() !== $_REQUEST['zerospam_david_walsh_key'] ) {
262
  * Register scripts
263
  */
264
  public function scripts() {
265
+ wp_register_script(
266
  'zerospam-davidwalsh',
267
  plugin_dir_url( ZEROSPAM ) . 'modules/davidwalsh/assets/js/davidwalsh.js',
268
  array( 'jquery' ),
modules/registration/class-registration.php CHANGED
@@ -27,6 +27,7 @@ class Registration {
27
  add_filter( 'zerospam_types', array( $this, 'types' ), 10, 1 );
28
 
29
  if ( 'enabled' === ZeroSpam\Core\Settings::get_settings( 'verify_registrations' ) && ZeroSpam\Core\Access::process() ) {
 
30
  add_action( 'register_form', array( $this, 'honeypot' ) );
31
  add_filter( 'registration_errors', array( $this, 'preprocess_registration' ), 10, 3 );
32
  }
@@ -44,6 +45,13 @@ class Registration {
44
  return $types;
45
  }
46
 
 
 
 
 
 
 
 
47
  /**
48
  * Preprocess registrations
49
  *
27
  add_filter( 'zerospam_types', array( $this, 'types' ), 10, 1 );
28
 
29
  if ( 'enabled' === ZeroSpam\Core\Settings::get_settings( 'verify_registrations' ) && ZeroSpam\Core\Access::process() ) {
30
+ add_action( 'register_form', array( $this, 'register_form' ) );
31
  add_action( 'register_form', array( $this, 'honeypot' ) );
32
  add_filter( 'registration_errors', array( $this, 'preprocess_registration' ), 10, 3 );
33
  }
45
  return $types;
46
  }
47
 
48
+ /**
49
+ * Fires following the ‘Email’ field in the user registration form.
50
+ */
51
+ public function register_form() {
52
+ do_action( 'zerospam_register_form' );
53
+ }
54
+
55
  /**
56
  * Preprocess registrations
57
  *
modules/wpforms/class-wpforms.php CHANGED
@@ -25,6 +25,7 @@ class WPForms {
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
  }
@@ -41,6 +42,13 @@ class WPForms {
41
  return $types;
42
  }
43
 
 
 
 
 
 
 
 
44
  /**
45
  * WPForms sections
46
  *
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, 'wpforms_frontend_output' ) );
29
  add_action( 'wpforms_frontend_output', array( $this, 'honeypot' ), 10, 1 );
30
  add_action( 'wpforms_process', array( $this, 'preprocess_submission' ), 10, 3 );
31
  }
42
  return $types;
43
  }
44
 
45
+ /**
46
+ * Fires before a form is displayed on the site’s frontend, only if the form exists and contains fields.
47
+ */
48
+ public function wpforms_frontend_output() {
49
+ do_action( 'zerospam_wpforms_frontend_output' );
50
+ }
51
+
52
  /**
53
  * WPForms sections
54
  *
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.8
7
  Requires PHP: 7.3
8
- Stable tag: 5.0.13
9
  License: GNU GPLv3
10
  License URI: https://choosealicense.com/licenses/gpl-3.0/
11
 
@@ -63,6 +63,10 @@ For more information & developer documentation, see the [plugin’s website](htt
63
 
64
  **No.** WordPress Zero Spam is unable to integrate Jetpack. For more information, see [https://wordpress.org/support/topic/incompatible-with-jetpack-comments](https://wordpress.org/support/topic/incompatible-with-jetpack-comments).
65
 
 
 
 
 
66
  == Screenshots ==
67
 
68
  1. WordPress Zero Spam dashboard
@@ -73,6 +77,16 @@ For more information & developer documentation, see the [plugin’s website](htt
73
 
74
  == Changelog ==
75
 
 
 
 
 
 
 
 
 
 
 
76
  = v5.0.13 =
77
 
78
  * fix(updates): resolves #262, sanitized & escaped variables
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.8.1
7
  Requires PHP: 7.3
8
+ Stable tag: 5.1.0
9
  License: GNU GPLv3
10
  License URI: https://choosealicense.com/licenses/gpl-3.0/
11
 
63
 
64
  **No.** WordPress Zero Spam is unable to integrate Jetpack. For more information, see [https://wordpress.org/support/topic/incompatible-with-jetpack-comments](https://wordpress.org/support/topic/incompatible-with-jetpack-comments).
65
 
66
+ = How do I boost performance of the plugin? =
67
+
68
+ Caching is highly recommended and will prevent repeated calls to third-party API and access checks on each page visit.
69
+
70
  == Screenshots ==
71
 
72
  1. WordPress Zero Spam dashboard
77
 
78
  == Changelog ==
79
 
80
+ = v5.1.0 =
81
+
82
+ * feat(ipstack): ipstack errors are logged to the zerospam.log file in the uploads directory
83
+ * feat(cloudflare): resolves #267, checks http_cf_ipcountry against blocked countries
84
+ * feat(admin): resolves #264, adds ability to export & import settings
85
+ * perf(davidwalsh): resolves #266, only loads the david walsh script on pages that are needed
86
+ * fix(caching): resolves #258, added no-cache header to the blocked page output
87
+ * refactor(stopforumspam): increased the default confidence score for stop forum spam to help prevent false positives
88
+ * docs(faq): added common question about how to boost performance of the plugin
89
+
90
  = v5.0.13 =
91
 
92
  * fix(updates): resolves #262, sanitized & escaped variables
wordpress-zero-spam.php CHANGED
@@ -5,19 +5,19 @@
5
  * @package WordPressZeroSpam
6
  * @subpackage WordPress
7
  * @since 5.0.0
8
- * @author Ben Marshall
9
- * @copyright 2021 Ben Marshall
10
  * @license GPL-2.0-or-later
11
  *
12
  * @wordpress-plugin
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.13
17
  * Requires at least: 5.2
18
  * Requires PHP: 7.3
19
- * Author: Ben Marshall
20
- * Author URI: https://benmarshall.me
21
  * Text Domain: zerospam
22
  * Domain Path: /languages
23
  * License: GPL v2 or later
@@ -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.13' );
35
 
36
  add_action( 'plugins_loaded', 'zerospam_load_plugin_textdomain' );
37
 
5
  * @package WordPressZeroSpam
6
  * @subpackage WordPress
7
  * @since 5.0.0
8
+ * @author Highfivery LLC
9
+ * @copyright 2021 Highfivery LLC
10
  * @license GPL-2.0-or-later
11
  *
12
  * @wordpress-plugin
13
  * Plugin Name: WordPress Zero Spam
14
+ * Plugin URI: https://www.highfivery.com/projects/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.1.0
17
  * Requires at least: 5.2
18
  * Requires PHP: 7.3
19
+ * Author: Highfivery LLC
20
+ * Author URI: https://www.highfivery.com/
21
  * Text Domain: zerospam
22
  * Domain Path: /languages
23
  * License: GPL v2 or later
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.1.0' );
35
 
36
  add_action( 'plugins_loaded', 'zerospam_load_plugin_textdomain' );
37