Version Description
Download this release
Release Info
Developer | bmarshall511 |
Plugin | WordPress Zero Spam |
Version | 5.1.4 |
Comparing to | |
See all releases |
Code changes from version 5.1.3 to 5.1.4
- core/admin/tables/class-blockedtable.php +9 -1
- core/class-access.php +9 -0
- core/class-settings.php +14 -0
- core/class-utilities.php +20 -1
- readme.txt +5 -1
- wordpress-zero-spam.php +2 -2
core/admin/tables/class-blockedtable.php
CHANGED
@@ -230,7 +230,15 @@ class BlockedTable extends WP_List_Table {
|
|
230 |
*/
|
231 |
?>
|
232 |
<button class="button zerospam-block-trigger"><?php echo __( 'Add Blocked IP Address', 'zerospam' ); ?></button>
|
233 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
234 |
</div>
|
235 |
<?php
|
236 |
}
|
230 |
*/
|
231 |
?>
|
232 |
<button class="button zerospam-block-trigger"><?php echo __( 'Add Blocked IP Address', 'zerospam' ); ?></button>
|
233 |
+
<?php
|
234 |
+
$settings = \ZeroSpam\Core\Settings::get_settings( 'block_method' );
|
235 |
+
|
236 |
+
if ( ! empty( $settings ) && 'php' !== $settings ) :
|
237 |
+
?>
|
238 |
+
<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>
|
239 |
+
<?php
|
240 |
+
endif;
|
241 |
+
?>
|
242 |
</div>
|
243 |
<?php
|
244 |
}
|
core/class-access.php
CHANGED
@@ -198,6 +198,15 @@ class Access {
|
|
198 |
}
|
199 |
}
|
200 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
return $access_checks;
|
202 |
}
|
203 |
|
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 |
|
core/class-settings.php
CHANGED
@@ -123,6 +123,20 @@ class Settings {
|
|
123 |
'recommended' => 403,
|
124 |
);
|
125 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
$message = __( 'Your IP address has been blocked by WordPress Zero Spam due to detected spam/malicious activity.', 'zerospam' );
|
127 |
|
128 |
self::$settings['blocked_message'] = array(
|
123 |
'recommended' => 403,
|
124 |
);
|
125 |
|
126 |
+
self::$settings['block_method'] = array(
|
127 |
+
'title' => __( 'IP Block Method', 'zerospam' ),
|
128 |
+
'desc' => __( '.htaccess is preferred for performance, however <strong>choosing the wrong Apache version could cause the website to crash</strong> and require a manual fix to the .htaccess file.', 'zerospam' ),
|
129 |
+
'section' => 'general',
|
130 |
+
'type' => 'radio',
|
131 |
+
'options' => array(
|
132 |
+
'htaccess_legacy' => __( '.htaccess (Apache servers < 2.4)', 'zerospam' ),
|
133 |
+
'htaccess_modern' => __( '.htaccess (Apache servers >= 2.4)', 'zerospam' ),
|
134 |
+
'php' => __( 'PHP', 'zerospam' ),
|
135 |
+
),
|
136 |
+
'value' => ! empty( $options['block_method'] ) ? $options['block_method'] : 'php',
|
137 |
+
'recommended' => 'php',
|
138 |
+
);
|
139 |
+
|
140 |
$message = __( 'Your IP address has been blocked by WordPress Zero Spam due to detected spam/malicious activity.', 'zerospam' );
|
141 |
|
142 |
self::$settings['blocked_message'] = array(
|
core/class-utilities.php
CHANGED
@@ -21,6 +21,13 @@ class Utilities {
|
|
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 ) ) {
|
@@ -36,7 +43,19 @@ class Utilities {
|
|
36 |
|
37 |
if ( $denied_ips ) {
|
38 |
$lines = array();
|
39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
}
|
41 |
|
42 |
if ( insert_with_markers( $htaccess_file, 'WordPress Zero Spam', $lines ) ) {
|
21 |
* Refreshes the .htaccess file
|
22 |
*/
|
23 |
public static function refresh_htaccess() {
|
24 |
+
// Check IP Block Method setting.
|
25 |
+
$settings = \ZeroSpam\Core\Settings::get_settings( 'block_method' );
|
26 |
+
|
27 |
+
if ( ! $settings || 'php' === $settings ) {
|
28 |
+
return false;
|
29 |
+
}
|
30 |
+
|
31 |
$denied_ips = array();
|
32 |
$htaccess_file = get_home_path() . '.htaccess';
|
33 |
if ( is_writable( $htaccess_file ) ) {
|
43 |
|
44 |
if ( $denied_ips ) {
|
45 |
$lines = array();
|
46 |
+
|
47 |
+
if ( 'htaccess_legacy' === $settings ) {
|
48 |
+
$lines[] = 'Deny from ' . implode( $denied_ips, ' ' );
|
49 |
+
} elseif ( 'htaccess_modern' === $settings ) {
|
50 |
+
$lines[] = '<RequireAll>';
|
51 |
+
$lines[] = 'Require all granted';
|
52 |
+
$lines[] = 'Require not ip ' . implode( $denied_ips, ' ' );
|
53 |
+
$lines[] = '</RequireAll>';
|
54 |
+
}
|
55 |
+
}
|
56 |
+
|
57 |
+
if ( empty( $lines ) ) {
|
58 |
+
return false;
|
59 |
}
|
60 |
|
61 |
if ( insert_with_markers( $htaccess_file, 'WordPress Zero Spam', $lines ) ) {
|
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 |
|
@@ -82,6 +82,10 @@ For more information & developer documentation, see the [plugin’s website](htt
|
|
82 |
|
83 |
== Changelog ==
|
84 |
|
|
|
|
|
|
|
|
|
85 |
= v5.1.3 =
|
86 |
|
87 |
* perf(blocked ips): moved blocked ips to .htacess for improved performance
|
5 |
Requires at least: 5.2
|
6 |
Tested up to: 5.8.1
|
7 |
Requires PHP: 7.3
|
8 |
+
Stable tag: 5.1.4
|
9 |
License: GNU GPLv3
|
10 |
License URI: https://choosealicense.com/licenses/gpl-3.0/
|
11 |
|
82 |
|
83 |
== Changelog ==
|
84 |
|
85 |
+
= v5.1.4 =
|
86 |
+
|
87 |
+
* fix(htaccess): resolves #274, fix for newer apache versions and option to select the method ips are blocked
|
88 |
+
|
89 |
= v5.1.3 =
|
90 |
|
91 |
* perf(blocked ips): moved blocked ips to .htacess for improved performance
|
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.4
|
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.4' );
|
35 |
|
36 |
if ( defined( 'ZEROSPAM_DEVELOPMENT_URL' ) ) {
|
37 |
define( 'ZEROSPAM_URL', ZEROSPAM_DEVELOPMENT_URL );
|