WordPress Zero Spam - Version 5.3.9

Version Description

Download this release

Release Info

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

Code changes from version 5.3.8 to 5.3.9

core/admin/class-admin.php CHANGED
@@ -115,6 +115,11 @@ class Admin {
115
  * Display not configured notice
116
  */
117
  public function admin_notices() {
 
 
 
 
 
118
  $messages = array();
119
 
120
  // Check Zero Spam license key.
115
  * Display not configured notice
116
  */
117
  public function admin_notices() {
118
+ // Only display notices for administrators.
119
+ if ( ! current_user_can( 'administrator' ) ) {
120
+ return;
121
+ }
122
+
123
  $messages = array();
124
 
125
  // Check Zero Spam license key.
core/class-utilities.php CHANGED
@@ -684,13 +684,26 @@ class Utilities {
684
  }
685
 
686
  /**
687
- * Returns the current URL.
688
  *
689
- * @since 5.0.0
690
- * @access public
691
  */
692
- public static function current_url() {
693
- $url = ( isset( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] === 'on' ? "https" : "http" ) . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
694
 
695
  return $url;
696
  }
684
  }
685
 
686
  /**
687
+ * Returns the current URL
688
  *
689
+ * @param array $params Array of URL parameters to append to the URL.
 
690
  */
691
+ public static function current_url( $params = array() ) {
692
+ $request_uri = ! empty( $_SERVER['REQUEST_URI'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : false;
693
+
694
+ $url = ( isset( $_SERVER['HTTPS'] ) && 'on' === $_SERVER['HTTPS'] ? 'https' : 'http' ) . '://';
695
+ $url .= ! empty( $_SERVER['HTTP_HOST'] ) ? sanitize_text_field( wp_unslash( $_SERVER['HTTP_HOST'] ) ) : '';
696
+ $url .= $request_uri ? $request_uri : '';
697
+
698
+ if ( $request_uri && $params ) {
699
+
700
+
701
+ if ( strpos( $request_uri, '?' ) ) {
702
+ $url .= '&' . implode( '&', $params );
703
+ } else {
704
+ $url .= '?' . implode( '&', $params );
705
+ }
706
+ }
707
 
708
  return $url;
709
  }
modules/class-zerospam.php CHANGED
@@ -407,6 +407,11 @@ class Zero_Spam {
407
  * Outputs any available admin notices.
408
  */
409
  public function admin_notices() {
 
 
 
 
 
410
  $settings = \ZeroSpam\Core\Settings::get_settings();
411
  $user_id = get_current_user_id();
412
 
@@ -458,7 +463,7 @@ class Zero_Spam {
458
  if ( $message_dismissed ) {
459
  $days_since_last_dismissed = \ZeroSpam\Core\Utilities::time_since( $message_dismissed, current_time( 'mysql' ), 'd' );
460
 
461
- if ( $days_since_last_dismissed <= 7 ) {
462
  return false;
463
  }
464
  }
@@ -468,7 +473,7 @@ class Zero_Spam {
468
  $content = '<p>' . sprintf(
469
  wp_kses(
470
  /* translators: %1$s: Zero Spam settings URL, %2$s: dismiss message URL */
471
- __( '<strong>Your site is vulnerable to attacks.</strong> For enhanced protection, please enable <a href="%1$s"><strong>Zero Spam Enhanced Protection</strong></a>. <a href="%2$s">Dismiss</a>', 'zero-spam' ),
472
  array(
473
  'strong' => array(),
474
  'a' => array(
@@ -477,7 +482,7 @@ class Zero_Spam {
477
  )
478
  ),
479
  esc_url( admin_url( 'options-general.php?page=wordpress-zero-spam-settings' ) ),
480
- esc_url( admin_url( 'options-general.php?page=wordpress-zero-spam-settings&zero-spam-dismiss-notice-enhanced-protection' ) ),
481
  ) . '</p>';
482
  }
483
  ?>
407
  * Outputs any available admin notices.
408
  */
409
  public function admin_notices() {
410
+ // Only display notices for administrators.
411
+ if ( ! current_user_can( 'administrator' ) ) {
412
+ return;
413
+ }
414
+
415
  $settings = \ZeroSpam\Core\Settings::get_settings();
416
  $user_id = get_current_user_id();
417
 
463
  if ( $message_dismissed ) {
464
  $days_since_last_dismissed = \ZeroSpam\Core\Utilities::time_since( $message_dismissed, current_time( 'mysql' ), 'd' );
465
 
466
+ if ( $days_since_last_dismissed <= 365 ) {
467
  return false;
468
  }
469
  }
473
  $content = '<p>' . sprintf(
474
  wp_kses(
475
  /* translators: %1$s: Zero Spam settings URL, %2$s: dismiss message URL */
476
+ __( '<strong>Your site isn\'t taking full advantage of Zero Spam protection.</strong> For enhanced protection, please enable <a href="%1$s"><strong>Zero Spam Enhanced Protection</strong></a>. <a href="%2$s">Dismiss</a>', 'zero-spam' ),
477
  array(
478
  'strong' => array(),
479
  'a' => array(
482
  )
483
  ),
484
  esc_url( admin_url( 'options-general.php?page=wordpress-zero-spam-settings' ) ),
485
+ esc_url( \ZeroSpam\Core\Utilities::current_url( array( 'zero-spam-dismiss-notice-enhanced-protection' ) ) ),
486
  ) . '</p>';
487
  }
488
  ?>
readme.txt CHANGED
@@ -5,7 +5,7 @@ Donate link: https://www.zerospam.org/subscribe/
5
  Requires at least: 5.2
6
  Tested up to: 5.9.3
7
  Requires PHP: 7.3
8
- Stable tag: 5.3.8
9
  License: GNU GPLv3
10
  License URI: https://choosealicense.com/licenses/gpl-3.0/
11
 
@@ -106,6 +106,10 @@ If hosting with Pantheon, see their [known issues page](https://pantheon.io/docs
106
 
107
  == Changelog ==
108
 
 
 
 
 
109
  = v5.3.8 =
110
 
111
  * chore(zero spam api): updated the zero spam api to v2
5
  Requires at least: 5.2
6
  Tested up to: 5.9.3
7
  Requires PHP: 7.3
8
+ Stable tag: 5.3.9
9
  License: GNU GPLv3
10
  License URI: https://choosealicense.com/licenses/gpl-3.0/
11
 
106
 
107
  == Changelog ==
108
 
109
+ = v5.3.9 =
110
+
111
+ * fix(admin): fix issue with admin notice not dismissing properly, resolves #319
112
+
113
  = v5.3.8 =
114
 
115
  * chore(zero spam api): updated the zero spam api to v2
wordpress-zero-spam.php CHANGED
@@ -13,7 +13,7 @@
13
  * Plugin Name: Zero Spam for WordPress
14
  * Plugin URI: https://www.highfivery.com/projects/zero-spam/
15
  * Description: Tired of all the ineffective WordPress anti-spam & security plugins? Zero Spam for WordPress makes blocking spam &amp; malicious activity a cinch. <strong>Just activate, configure, and say goodbye to spam.</strong>
16
- * Version: 5.3.8
17
  * Requires at least: 5.2
18
  * Requires PHP: 7.3
19
  * Author: Highfivery LLC
@@ -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.3.8' );
35
 
36
  if ( defined( 'ZEROSPAM_DEVELOPMENT_URL' ) ) {
37
  define( 'ZEROSPAM_URL', ZEROSPAM_DEVELOPMENT_URL );
13
  * Plugin Name: Zero Spam for WordPress
14
  * Plugin URI: https://www.highfivery.com/projects/zero-spam/
15
  * Description: Tired of all the ineffective WordPress anti-spam & security plugins? Zero Spam for WordPress makes blocking spam &amp; malicious activity a cinch. <strong>Just activate, configure, and say goodbye to spam.</strong>
16
+ * Version: 5.3.9
17
  * Requires at least: 5.2
18
  * Requires PHP: 7.3
19
  * Author: Highfivery LLC
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.3.9' );
35
 
36
  if ( defined( 'ZEROSPAM_DEVELOPMENT_URL' ) ) {
37
  define( 'ZEROSPAM_URL', ZEROSPAM_DEVELOPMENT_URL );