Version Description
Download this release
Release Info
Developer | bmarshall511 |
Plugin | WordPress Zero Spam |
Version | 5.1.3 |
Comparing to | |
See all releases |
Code changes from version 5.1.2 to 5.1.3
- assets/css/admin.css +15 -2
- core/admin/class-dashboard.php +10 -0
- core/admin/class-settings.php +1 -1
- core/admin/tables/class-blockedtable.php +1 -0
- core/class-access.php +1 -10
- core/class-utilities.php +34 -0
- includes/class-db.php +9 -0
- includes/class-plugin.php +0 -5
- includes/templates/admin-callout.php +30 -4
- modules/woocommerce/class-woocommerce.php +0 -132
- readme.txt +8 -3
- wordpress-zero-spam.php +2 -2
assets/css/admin.css
CHANGED
@@ -17,7 +17,6 @@
|
|
17 |
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
|
18 |
}
|
19 |
|
20 |
-
.zerospam-callout-col,
|
21 |
.zerospam-modal,
|
22 |
.zerospam-notice,
|
23 |
.zerospam-module {
|
@@ -63,6 +62,7 @@
|
|
63 |
|
64 |
.zerospam-callout {
|
65 |
display: flex;
|
|
|
66 |
}
|
67 |
|
68 |
.zerospam-callout h2,
|
@@ -75,6 +75,8 @@
|
|
75 |
}
|
76 |
|
77 |
.zerospam-callout-col {
|
|
|
|
|
78 |
width: 100%;
|
79 |
}
|
80 |
|
@@ -248,8 +250,19 @@
|
|
248 |
}
|
249 |
|
250 |
@media (min-width: 768px) {
|
|
|
|
|
|
|
|
|
251 |
.zerospam-callout-col {
|
252 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
253 |
}
|
254 |
}
|
255 |
|
17 |
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
|
18 |
}
|
19 |
|
|
|
20 |
.zerospam-modal,
|
21 |
.zerospam-notice,
|
22 |
.zerospam-module {
|
62 |
|
63 |
.zerospam-callout {
|
64 |
display: flex;
|
65 |
+
flex-wrap: wrap;
|
66 |
}
|
67 |
|
68 |
.zerospam-callout h2,
|
75 |
}
|
76 |
|
77 |
.zerospam-callout-col {
|
78 |
+
box-sizing: border-box;
|
79 |
+
padding: 20px;
|
80 |
width: 100%;
|
81 |
}
|
82 |
|
250 |
}
|
251 |
|
252 |
@media (min-width: 768px) {
|
253 |
+
.zerospam-callout {
|
254 |
+
flex-wrap: nowrap;
|
255 |
+
}
|
256 |
+
|
257 |
.zerospam-callout-col {
|
258 |
+
flex-grow: 1;
|
259 |
+
padding: 30px;
|
260 |
+
}
|
261 |
+
|
262 |
+
.zerospam-callout-col:last-child {
|
263 |
+
flex-shrink: 0;
|
264 |
+
max-width: 600px;
|
265 |
+
width: 100%;
|
266 |
}
|
267 |
}
|
268 |
|
core/admin/class-dashboard.php
CHANGED
@@ -26,10 +26,17 @@ class Dashboard {
|
|
26 |
* @access public
|
27 |
*/
|
28 |
public function __construct() {
|
|
|
29 |
add_action( 'admin_menu', array( $this, 'admin_menu' ) );
|
30 |
add_action( 'admin_action_add_blocked_ip', array( $this, 'block_ip' ) );
|
31 |
}
|
32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
/**
|
34 |
* Block IP handler.
|
35 |
*
|
@@ -123,6 +130,9 @@ class Dashboard {
|
|
123 |
exit;
|
124 |
}
|
125 |
|
|
|
|
|
|
|
126 |
wp_safe_redirect( $url . '&zerospam-success=1' );
|
127 |
exit;
|
128 |
}
|
26 |
* @access public
|
27 |
*/
|
28 |
public function __construct() {
|
29 |
+
add_action( 'admin_init', array( $this, 'admin_init' ) );
|
30 |
add_action( 'admin_menu', array( $this, 'admin_menu' ) );
|
31 |
add_action( 'admin_action_add_blocked_ip', array( $this, 'block_ip' ) );
|
32 |
}
|
33 |
|
34 |
+
public function admin_init() {
|
35 |
+
if ( ! empty( $_REQUEST['zerospam-refresh-htaccess'] ) ) {
|
36 |
+
\ZeroSpam\Core\Utilities::refresh_htaccess();
|
37 |
+
}
|
38 |
+
}
|
39 |
+
|
40 |
/**
|
41 |
* Block IP handler.
|
42 |
*
|
130 |
exit;
|
131 |
}
|
132 |
|
133 |
+
// Add the the .htaccess file.
|
134 |
+
\ZeroSpam\Core\Utilities::refresh_htaccess();
|
135 |
+
|
136 |
wp_safe_redirect( $url . '&zerospam-success=1' );
|
137 |
exit;
|
138 |
}
|
core/admin/class-settings.php
CHANGED
@@ -107,7 +107,7 @@ class Settings {
|
|
107 |
public function admin_menu() {
|
108 |
add_submenu_page(
|
109 |
'options-general.php',
|
110 |
-
__( '
|
111 |
__( 'Zero Spam', 'zerospam' ),
|
112 |
'manage_options',
|
113 |
'wordpress-zero-spam-settings',
|
107 |
public function admin_menu() {
|
108 |
add_submenu_page(
|
109 |
'options-general.php',
|
110 |
+
__( 'Zero Spam Settings', 'zerospam' ),
|
111 |
__( 'Zero Spam', 'zerospam' ),
|
112 |
'manage_options',
|
113 |
'wordpress-zero-spam-settings',
|
core/admin/tables/class-blockedtable.php
CHANGED
@@ -230,6 +230,7 @@ class BlockedTable extends WP_List_Table {
|
|
230 |
*/
|
231 |
?>
|
232 |
<button class="button zerospam-block-trigger"><?php echo __( 'Add Blocked IP Address', 'zerospam' ); ?></button>
|
|
|
233 |
</div>
|
234 |
<?php
|
235 |
}
|
230 |
*/
|
231 |
?>
|
232 |
<button class="button zerospam-block-trigger"><?php echo __( 'Add Blocked IP Address', 'zerospam' ); ?></button>
|
233 |
+
<a href="<?php echo esc_url( admin_url( 'index.php?page=wordpress-zero-spam-dashboard&tab=blocked&zerospam-refresh-htaccess=1' ) ); ?>" class="button"><?php esc_html_e( 'Refresh .htaccess', 'zerospam' ); ?></a>
|
234 |
</div>
|
235 |
<?php
|
236 |
}
|
core/class-access.php
CHANGED
@@ -112,7 +112,7 @@ class Access {
|
|
112 |
/**
|
113 |
* Helper to get blocked record details.
|
114 |
*/
|
115 |
-
public function get_blocked_details( $blocked_record, $failed = false ) {
|
116 |
$access_check = array(
|
117 |
'blocked' => false,
|
118 |
);
|
@@ -198,15 +198,6 @@ class Access {
|
|
198 |
}
|
199 |
}
|
200 |
|
201 |
-
// If passed location blocks, check the IP address.
|
202 |
-
if ( ! $access_checks['blocked'] ) {
|
203 |
-
// Check the user's IP access.
|
204 |
-
$blocked = \ZeroSpam\Includes\DB::blocked( $user_ip );
|
205 |
-
if ( $blocked ) {
|
206 |
-
$access_checks['blocked'] = self::get_blocked_details( $blocked, 'blocked_ip' );
|
207 |
-
}
|
208 |
-
}
|
209 |
-
|
210 |
return $access_checks;
|
211 |
}
|
212 |
|
112 |
/**
|
113 |
* Helper to get blocked record details.
|
114 |
*/
|
115 |
+
public static function get_blocked_details( $blocked_record, $failed = false ) {
|
116 |
$access_check = array(
|
117 |
'blocked' => false,
|
118 |
);
|
198 |
}
|
199 |
}
|
200 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
return $access_checks;
|
202 |
}
|
203 |
|
core/class-utilities.php
CHANGED
@@ -17,6 +17,40 @@ defined( 'ABSPATH' ) || die();
|
|
17 |
*/
|
18 |
class Utilities {
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
/**
|
21 |
* Update a plugin settings.
|
22 |
*
|
17 |
*/
|
18 |
class Utilities {
|
19 |
|
20 |
+
/**
|
21 |
+
* Refreshes the .htaccess file
|
22 |
+
*/
|
23 |
+
public static function refresh_htaccess() {
|
24 |
+
$denied_ips = array();
|
25 |
+
$htaccess_file = get_home_path() . '.htaccess';
|
26 |
+
if ( is_writable( $htaccess_file ) ) {
|
27 |
+
$blocked_ips = \ZeroSpam\Includes\DB::get_blocked();
|
28 |
+
if ( $blocked_ips ) {
|
29 |
+
foreach ( $blocked_ips as $key => $record ) {
|
30 |
+
$details = \ZeroSpam\Core\Access::get_blocked_details( $record );
|
31 |
+
if ( $details['blocked'] ) {
|
32 |
+
$denied_ips[] = $details['details']['user_ip'];
|
33 |
+
}
|
34 |
+
}
|
35 |
+
}
|
36 |
+
|
37 |
+
if ( $denied_ips ) {
|
38 |
+
$lines = array();
|
39 |
+
$lines[] = 'Deny from ' . implode( $denied_ips, ' ' );
|
40 |
+
}
|
41 |
+
|
42 |
+
if ( insert_with_markers( $htaccess_file, 'WordPress Zero Spam', $lines ) ) {
|
43 |
+
return true;
|
44 |
+
} else {
|
45 |
+
\ZeroSpam\Core\Utilities::log( 'Unable to update the .htacess file, unknown error.' );
|
46 |
+
}
|
47 |
+
} else {
|
48 |
+
\ZeroSpam\Core\Utilities::log( 'Unable to update the .htacess file, unwriteable.' );
|
49 |
+
}
|
50 |
+
|
51 |
+
return false;
|
52 |
+
}
|
53 |
+
|
54 |
/**
|
55 |
* Update a plugin settings.
|
56 |
*
|
includes/class-db.php
CHANGED
@@ -88,6 +88,15 @@ class DB {
|
|
88 |
}
|
89 |
}
|
90 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
/**
|
92 |
* Adds/returns a blocked IP.
|
93 |
*
|
88 |
}
|
89 |
}
|
90 |
|
91 |
+
/**
|
92 |
+
* Returns all blocked IP addresses.
|
93 |
+
*/
|
94 |
+
public static function get_blocked() {
|
95 |
+
global $wpdb;
|
96 |
+
|
97 |
+
return $wpdb->get_results( 'SELECT * FROM ' . $wpdb->prefix . self::$tables['blocked'], ARRAY_A );
|
98 |
+
}
|
99 |
+
|
100 |
/**
|
101 |
* Adds/returns a blocked IP.
|
102 |
*
|
includes/class-plugin.php
CHANGED
@@ -20,7 +20,6 @@ use ZeroSpam\Modules\Zero_Spam;
|
|
20 |
use ZeroSpam\Modules\Registration\Registration;
|
21 |
use ZeroSpam\Modules\Comments\Comments;
|
22 |
use ZeroSpam\Modules\ContactForm7\ContactForm7;
|
23 |
-
use ZeroSpam\Modules\WooCommerce\WooCommerce;
|
24 |
use ZeroSpam\Modules\WPForms\WPForms;
|
25 |
use ZeroSpam\Modules\Formidable\Formidable;
|
26 |
use ZeroSpam\Modules\FluentForms\FluentForms;
|
@@ -118,10 +117,6 @@ class Plugin {
|
|
118 |
new ContactForm7();
|
119 |
}
|
120 |
|
121 |
-
if ( is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
|
122 |
-
new WooCommerce();
|
123 |
-
}
|
124 |
-
|
125 |
if (
|
126 |
is_plugin_active( 'wpforms-lite/wpforms.php' ) ||
|
127 |
is_plugin_active( 'wpforms/wpforms.php' )
|
20 |
use ZeroSpam\Modules\Registration\Registration;
|
21 |
use ZeroSpam\Modules\Comments\Comments;
|
22 |
use ZeroSpam\Modules\ContactForm7\ContactForm7;
|
|
|
23 |
use ZeroSpam\Modules\WPForms\WPForms;
|
24 |
use ZeroSpam\Modules\Formidable\Formidable;
|
25 |
use ZeroSpam\Modules\FluentForms\FluentForms;
|
117 |
new ContactForm7();
|
118 |
}
|
119 |
|
|
|
|
|
|
|
|
|
120 |
if (
|
121 |
is_plugin_active( 'wpforms-lite/wpforms.php' ) ||
|
122 |
is_plugin_active( 'wpforms/wpforms.php' )
|
includes/templates/admin-callout.php
CHANGED
@@ -34,7 +34,7 @@ $settings = \ZeroSpam\Core\Settings::get_settings();
|
|
34 |
echo sprintf(
|
35 |
wp_kses(
|
36 |
/* translators: %s: Zero Spam API link */
|
37 |
-
__( '<p><strong>Is some spam still getting through?</strong> Enable enhanced protection with a <strong>Zero Spam API license</strong> — one of the largest, most comprehensive,
|
38 |
array(
|
39 |
'a' => array(
|
40 |
'target' => array(),
|
@@ -49,8 +49,10 @@ $settings = \ZeroSpam\Core\Settings::get_settings();
|
|
49 |
esc_url( ZEROSPAM_URL . 'subscribe/?utm_source=wordpress_zero_spam&utm_medium=settings_page&utm_campaign=license' )
|
50 |
);
|
51 |
?>
|
52 |
-
<
|
53 |
-
|
|
|
|
|
54 |
<?php else : ?>
|
55 |
<h2>
|
56 |
<?php
|
@@ -93,12 +95,36 @@ $settings = \ZeroSpam\Core\Settings::get_settings();
|
|
93 |
<div class="zerospam-callout-col zerospam-callout-actions">
|
94 |
<ul>
|
95 |
<?php if ( 'enabled' !== $settings['zerospam']['value'] || empty( $settings['zerospam_license']['value'] ) ) : ?>
|
96 |
-
<li
|
|
|
|
|
|
|
|
|
97 |
<?php endif; ?>
|
98 |
<li><a href="https://github.com/bmarshall511/wordpress-zero-spam/issues" target="_blank"><?php esc_html_e( 'Submit a Bug or Feature Request', 'zerospam' ); ?></a></li>
|
99 |
<li><a href="https://github.com/bmarshall511/wordpress-zero-spam/wiki" target="_blank" rel="noreferrer noopener"><?php esc_html_e( 'WordPress Zero Spam Plugin Documentation', 'zerospam' ); ?></a></li>
|
100 |
<li><a href="https://github.com/bmarshall511/wordpress-zero-spam" target="_blank" rel="noreferrer noopener"><?php esc_html_e( 'Become a Contributor — Fork on Github', 'zerospam' ); ?></a></li>
|
101 |
<li><a href="https://twitter.com/ZeroSpamOrg" target="_blank"><?php _e( 'Follow us on Twitter', 'zerospam' ); ?></a> & <a href="https://www.facebook.com/zerospamorg/" target="_blank"><?php esc_html_e( 'Facebook', 'zerospam' ); ?></a></li>
|
102 |
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
</div>
|
104 |
</div>
|
34 |
echo sprintf(
|
35 |
wp_kses(
|
36 |
/* translators: %s: Zero Spam API link */
|
37 |
+
__( '<p><strong>Is some spam still getting through?</strong> Enable enhanced protection with a <strong>Zero Spam API license</strong> — one of the largest, most comprehensive, constantly-growing global malicious IP databases available.</p><p><a href="%1$s" target="_blank" rel="noopener noreferrer">Zero Spam</a> is comprised of a global detection network of over 30,000+ apps and sites that monitor traffic and usage in real-time to detect malicious activity. <a href="%1$s" target="_blank" rel="noopener noreferrer"><strong>Subscribe today</strong></a> for enhanced protection.</p>', 'zerospam' ),
|
38 |
array(
|
39 |
'a' => array(
|
40 |
'target' => array(),
|
49 |
esc_url( ZEROSPAM_URL . 'subscribe/?utm_source=wordpress_zero_spam&utm_medium=settings_page&utm_campaign=license' )
|
50 |
);
|
51 |
?>
|
52 |
+
<p style="margin-top: 30px">
|
53 |
+
<a class="button button-primary" href="<?php echo esc_url( ZEROSPAM_URL ); ?>subscribe/?utm_source=wordpress_zero_spam&utm_medium=settings_page&utm_campaign=license" target="_blank" rel="noopener noreferrer"><?php esc_html_e( 'Enable Enhanced Protection', 'zerospam' ); ?></a>
|
54 |
+
<a href="<?php echo esc_url( ZEROSPAM_URL ); ?>?utm_source=wordpress_zero_spam&utm_medium=dashboard_widget&utm_campaign=license" target="_blank" rel="noreferrer noopener" class="button button-secondary"><?php esc_html_e( 'Learn More', 'zerospam' ); ?></a>
|
55 |
+
</p>
|
56 |
<?php else : ?>
|
57 |
<h2>
|
58 |
<?php
|
95 |
<div class="zerospam-callout-col zerospam-callout-actions">
|
96 |
<ul>
|
97 |
<?php if ( 'enabled' !== $settings['zerospam']['value'] || empty( $settings['zerospam_license']['value'] ) ) : ?>
|
98 |
+
<li style="margin-bottom: 20px;">
|
99 |
+
<a href="<?php echo esc_url( ZEROSPAM_URL ); ?>subscribe/?utm_source=wordpress_zero_spam&utm_medium=settings_page&utm_campaign=license" target="_blank">
|
100 |
+
<strong><?php esc_html_e( 'Get a Zero Spam API License', 'zerospam' ); ?></strong>
|
101 |
+
</a>
|
102 |
+
</li>
|
103 |
<?php endif; ?>
|
104 |
<li><a href="https://github.com/bmarshall511/wordpress-zero-spam/issues" target="_blank"><?php esc_html_e( 'Submit a Bug or Feature Request', 'zerospam' ); ?></a></li>
|
105 |
<li><a href="https://github.com/bmarshall511/wordpress-zero-spam/wiki" target="_blank" rel="noreferrer noopener"><?php esc_html_e( 'WordPress Zero Spam Plugin Documentation', 'zerospam' ); ?></a></li>
|
106 |
<li><a href="https://github.com/bmarshall511/wordpress-zero-spam" target="_blank" rel="noreferrer noopener"><?php esc_html_e( 'Become a Contributor — Fork on Github', 'zerospam' ); ?></a></li>
|
107 |
<li><a href="https://twitter.com/ZeroSpamOrg" target="_blank"><?php _e( 'Follow us on Twitter', 'zerospam' ); ?></a> & <a href="https://www.facebook.com/zerospamorg/" target="_blank"><?php esc_html_e( 'Facebook', 'zerospam' ); ?></a></li>
|
108 |
</ul>
|
109 |
+
<hr />
|
110 |
+
<?php
|
111 |
+
echo sprintf(
|
112 |
+
wp_kses(
|
113 |
+
/* translators: %s: Zero Spam API link */
|
114 |
+
__( '<p><small>WordPress Zero Spam is proudly developed & maintained by <a href="%1$s" target="_blank" rel="noopener noreferrer">Highfivery LLC — a creative digital agency</a>.</small></p>', 'zerospam' ),
|
115 |
+
array(
|
116 |
+
'a' => array(
|
117 |
+
'target' => array(),
|
118 |
+
'href' => array(),
|
119 |
+
'rel' => array(),
|
120 |
+
),
|
121 |
+
'p' => array(),
|
122 |
+
'strong' => array(),
|
123 |
+
'small' => array(),
|
124 |
+
)
|
125 |
+
),
|
126 |
+
esc_url( 'https://www.highfivery.com?utm_source=' . get_bloginfo( 'url' ) . '&utm_medium=zerospam_plugin_callout&utm_campaign=zerospam_plugin' )
|
127 |
+
);
|
128 |
+
?>
|
129 |
</div>
|
130 |
</div>
|
modules/woocommerce/class-woocommerce.php
DELETED
@@ -1,132 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* WooCommerce class
|
4 |
-
*
|
5 |
-
* @package ZeroSpam
|
6 |
-
*/
|
7 |
-
|
8 |
-
namespace ZeroSpam\Modules\WooCommerce;
|
9 |
-
|
10 |
-
use ZeroSpam;
|
11 |
-
|
12 |
-
// Security Note: Blocks direct access to the plugin PHP files.
|
13 |
-
defined( 'ABSPATH' ) || die();
|
14 |
-
|
15 |
-
/**
|
16 |
-
* WooCommerce
|
17 |
-
*/
|
18 |
-
class WooCommerce {
|
19 |
-
/**
|
20 |
-
* WooCommerce constructor
|
21 |
-
*/
|
22 |
-
public function __construct() {
|
23 |
-
add_filter( 'zerospam_setting_sections', array( $this, 'sections' ) );
|
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( 'woocommerce_protection' ) && ZeroSpam\Core\Access::process() ) {
|
28 |
-
if ( 'enabled' === ZeroSpam\Core\Settings::get_settings( 'verify_registrations' ) ) {
|
29 |
-
add_action( 'woocommerce_register_form', array( $this, 'honeypot' ) );
|
30 |
-
add_action( 'woocommerce_register_post', array( $this, 'preprocess_registration' ), 10, 3 );
|
31 |
-
}
|
32 |
-
}
|
33 |
-
}
|
34 |
-
|
35 |
-
/**
|
36 |
-
* Add to the types array
|
37 |
-
*
|
38 |
-
* @param array $types Array of available detection types.
|
39 |
-
*/
|
40 |
-
public function types( $types ) {
|
41 |
-
$types['woocommerce_registration'] = __( 'Registration (WooCommerce)', 'zerospam' );
|
42 |
-
|
43 |
-
return $types;
|
44 |
-
}
|
45 |
-
|
46 |
-
/**
|
47 |
-
* WooCommerce sections
|
48 |
-
*
|
49 |
-
* @param array $sections Array of available setting sections.
|
50 |
-
*/
|
51 |
-
public function sections( $sections ) {
|
52 |
-
$sections['woocommerce'] = array(
|
53 |
-
'title' => __( 'WooCommerce Integration', 'zerospam' ),
|
54 |
-
);
|
55 |
-
|
56 |
-
return $sections;
|
57 |
-
}
|
58 |
-
|
59 |
-
/**
|
60 |
-
* WooCommerce settings
|
61 |
-
*
|
62 |
-
* @param array $settings Array of available settings.
|
63 |
-
*/
|
64 |
-
public function settings( $settings ) {
|
65 |
-
$options = get_option( 'wpzerospam' );
|
66 |
-
|
67 |
-
$settings['woocommerce_protection'] = array(
|
68 |
-
'title' => __( 'WooCommerce Protection', 'zerospam' ),
|
69 |
-
'section' => 'woocommerce',
|
70 |
-
'type' => 'checkbox',
|
71 |
-
'desc' => __( 'Enables integration with the WooCommerce.', 'zerospam' ),
|
72 |
-
'options' => array(
|
73 |
-
'enabled' => __( 'Enabled', 'zerospam' ),
|
74 |
-
),
|
75 |
-
'value' => ! empty( $options['woocommerce_protection'] ) ? $options['woocommerce_protection'] : false,
|
76 |
-
'recommended' => 'enabled',
|
77 |
-
);
|
78 |
-
|
79 |
-
return $settings;
|
80 |
-
}
|
81 |
-
|
82 |
-
/**
|
83 |
-
* Add a 'honeypot' field to the WooCommerce registration form
|
84 |
-
*/
|
85 |
-
public function honeypot() {
|
86 |
-
$honeypot = ZeroSpam\Core\Utilities::get_honeypot();
|
87 |
-
|
88 |
-
woocommerce_form_field(
|
89 |
-
$honeypot,
|
90 |
-
array( 'type' => 'hidden' )
|
91 |
-
);
|
92 |
-
}
|
93 |
-
|
94 |
-
/**
|
95 |
-
* Preprocess registrations
|
96 |
-
*
|
97 |
-
* @param string $username The username.
|
98 |
-
* @param string $email The email.
|
99 |
-
* @param object $errors Errors object.
|
100 |
-
*/
|
101 |
-
public function preprocess_registration( $username, $email, $errors ) {
|
102 |
-
$settings = ZeroSpam\Core\Settings::get_settings();
|
103 |
-
|
104 |
-
// Check honeypot.
|
105 |
-
// @codingStandardsIgnoreLine
|
106 |
-
if ( ! empty( $_REQUEST[ ZeroSpam\Core\Utilities::get_honeypot() ] ) ) {
|
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 );
|
129 |
-
|
130 |
-
return $errors;
|
131 |
-
}
|
132 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.8.1
|
7 |
Requires PHP: 7.3
|
8 |
-
Stable tag: 5.1.
|
9 |
License: GNU GPLv3
|
10 |
License URI: https://choosealicense.com/licenses/gpl-3.0/
|
11 |
|
@@ -17,7 +17,7 @@ Quit forcing people to answer questions or confusing captchas to prove they're n
|
|
17 |
|
18 |
[WordPress Zero Spam](https://www.highfivery.com/projects/zero-spam/?utm_source=wordpress.org&utm_medium=plugin&utm_campaign=wordpress_zero_spam) uses AI in combination with proven spam detection techniques and databases of known malicious IPs from around the world to detect and block unwanted visitors.
|
19 |
|
20 |
-
**Just install, activate, and enjoy a spam-free site!**
|
21 |
|
22 |
= WordPress Zero Spam features =
|
23 |
|
@@ -34,7 +34,6 @@ Quit forcing people to answer questions or confusing captchas to prove they're n
|
|
34 |
|
35 |
* WordPress core comments & user registrations
|
36 |
* [Contact Form 7](https://wordpress.org/plugins/contact-form-7/) submissions
|
37 |
-
* [WooCommerce](https://woocommerce.com/) registration forms
|
38 |
* [WPForms](https://wordpress.org/plugins/wpforms-lite/) submissions
|
39 |
* [Formidable Form Builder](https://wordpress.org/plugins/formidable/) submissions
|
40 |
* and can be easily integrated into any existing theme or plugin
|
@@ -83,6 +82,12 @@ For more information & developer documentation, see the [plugin’s website](htt
|
|
83 |
|
84 |
== Changelog ==
|
85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
= v5.1.2 =
|
87 |
|
88 |
* perf(geolocation): improved performance for geolocation and data sharing
|
5 |
Requires at least: 5.2
|
6 |
Tested up to: 5.8.1
|
7 |
Requires PHP: 7.3
|
8 |
+
Stable tag: 5.1.3
|
9 |
License: GNU GPLv3
|
10 |
License URI: https://choosealicense.com/licenses/gpl-3.0/
|
11 |
|
17 |
|
18 |
[WordPress Zero Spam](https://www.highfivery.com/projects/zero-spam/?utm_source=wordpress.org&utm_medium=plugin&utm_campaign=wordpress_zero_spam) uses AI in combination with proven spam detection techniques and databases of known malicious IPs from around the world to detect and block unwanted visitors.
|
19 |
|
20 |
+
**Just install, activate, configure, and enjoy a spam-free site!**
|
21 |
|
22 |
= WordPress Zero Spam features =
|
23 |
|
34 |
|
35 |
* WordPress core comments & user registrations
|
36 |
* [Contact Form 7](https://wordpress.org/plugins/contact-form-7/) submissions
|
|
|
37 |
* [WPForms](https://wordpress.org/plugins/wpforms-lite/) submissions
|
38 |
* [Formidable Form Builder](https://wordpress.org/plugins/formidable/) submissions
|
39 |
* and can be easily integrated into any existing theme or plugin
|
82 |
|
83 |
== Changelog ==
|
84 |
|
85 |
+
= v5.1.3 =
|
86 |
+
|
87 |
+
* perf(blocked ips): moved blocked ips to .htacess for improved performance
|
88 |
+
* refactor(woocommerce): woocommerce registration forms support dropped in place of 3rd-party IP checks
|
89 |
+
* docs(admin): misc updates to admin interface
|
90 |
+
|
91 |
= v5.1.2 =
|
92 |
|
93 |
* perf(geolocation): improved performance for geolocation and data sharing
|
wordpress-zero-spam.php
CHANGED
@@ -13,7 +13,7 @@
|
|
13 |
* Plugin Name: WordPress Zero Spam
|
14 |
* Plugin URI: https://www.highfivery.com/projects/zero-spam/
|
15 |
* Description: Tired of all the worthless and bloated WordPress anti-spam plugins? The WordPress Zero Spam plugin makes blocking spam & malicious activity a cinch. <strong>Just install, activate, configure, and say goodbye to spam.</strong>
|
16 |
-
* Version: 5.1.
|
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.1.
|
35 |
|
36 |
if ( defined( 'ZEROSPAM_DEVELOPMENT_URL' ) ) {
|
37 |
define( 'ZEROSPAM_URL', ZEROSPAM_DEVELOPMENT_URL );
|
13 |
* Plugin Name: WordPress Zero Spam
|
14 |
* Plugin URI: https://www.highfivery.com/projects/zero-spam/
|
15 |
* Description: Tired of all the worthless and bloated WordPress anti-spam plugins? The WordPress Zero Spam plugin makes blocking spam & malicious activity a cinch. <strong>Just install, activate, configure, and say goodbye to spam.</strong>
|
16 |
+
* Version: 5.1.3
|
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.1.3' );
|
35 |
|
36 |
if ( defined( 'ZEROSPAM_DEVELOPMENT_URL' ) ) {
|
37 |
define( 'ZEROSPAM_URL', ZEROSPAM_DEVELOPMENT_URL );
|