WordPress Zero Spam - Version 3.1.0

Version Description

Download this release

Release Info

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

Code changes from version 3.0.6 to 3.1.0

inc/helpers.php CHANGED
@@ -41,26 +41,35 @@ function zerospam_is_valid() {
41
return false;
42
}
43
44
- function zerospam_get_ip() {
45
- $ipaddress = '';
46
-
47
- if ( getenv('HTTP_CLIENT_IP') ) {
48
- $ipaddress = getenv('HTTP_CLIENT_IP');
49
- } else if ( getenv('HTTP_X_FORWARDED_FOR') ) {
50
- $ipaddress = getenv('HTTP_X_FORWARDED_FOR');
51
- } else if ( getenv('HTTP_X_FORWARDED') ) {
52
- $ipaddress = getenv('HTTP_X_FORWARDED');
53
- } else if ( getenv('HTTP_FORWARDED_FOR') ) {
54
- $ipaddress = getenv('HTTP_FORWARDED_FOR');
55
- } else if ( getenv('HTTP_FORWARDED') ) {
56
- $ipaddress = getenv('HTTP_FORWARDED');
57
- } else if ( getenv('REMOTE_ADDR') ) {
58
- $ipaddress = getenv('REMOTE_ADDR');
59
}
60
if ( false === WP_Http::is_ip_address( $ipaddress ) ) {
61
$ipaddress = 'UNKNOWN';
62
}
63
64
return $ipaddress;
65
}
66
41
return false;
42
}
43
44
+ function zerospam_get_server_var($var)
45
+ {
46
+ if ( getenv($var) ) {
47
+ return getenv($var);
48
+ } else if ( isset($_SERVER[$var]) ) {
49
+ return $_SERVER[$var];
50
+ } else {
51
+ return '';
52
}
53
+ }
54
+
55
+ function zerospam_get_ip() {
56
+
57
+ $ipaddress = zerospam_get_server_var('HTTP_CLIENT_IP');
58
+ if ( !$ipaddress ) { $ipaddress = zerospam_get_server_var('HTTP_X_FORWARDED_FOR'); }
59
+ if ( !$ipaddress ) { $ipaddress = zerospam_get_server_var('HTTP_X_FORWARDED'); }
60
+ if ( !$ipaddress ) { $ipaddress = zerospam_get_server_var('HTTP_FORWARDED_FOR'); }
61
+ if ( !$ipaddress ) { $ipaddress = zerospam_get_server_var('HTTP_FORWARDED'); }
62
+ if ( !$ipaddress ) { $ipaddress = zerospam_get_server_var('REMOTE_ADDR'); }
63
+
64
+ $ipaddress = explode(',', $ipaddress, 2);
65
+ $ipaddress = trim($ipaddress[0]);
66
+
67
if ( false === WP_Http::is_ip_address( $ipaddress ) ) {
68
$ipaddress = 'UNKNOWN';
69
}
70
71
+ $ipaddress = apply_filters( 'zerospam_get_ip_filter', $ipaddress );
72
+
73
return $ipaddress;
74
}
75
lib/ZeroSpam/Admin.php CHANGED
@@ -370,7 +370,7 @@ class ZeroSpam_Admin extends ZeroSpam_Plugin {
370
public function field_blocked_ip_msg() {
371
?>
372
<label for="blocked_ip_msg">
373
- <input type="text" class="regular-text" name="zerospam_general_settings[blocked_ip_msg]" value="<?php echo esc_attr( $this->settings['blocked_ip_msg'] ); ?>">
374
<p class="description"><?php echo __( 'Enter a short message to display when a blocked IP visits the site.', 'zerospam' ); ?></p>
375
</label>
376
<?php
370
public function field_blocked_ip_msg() {
371
?>
372
<label for="blocked_ip_msg">
373
+ <input type="text" class="regular-text" name="zerospam_general_settings[blocked_ip_msg]" value="<?php echo esc_attr( isset( $this->settings['blocked_ip_msg'] ) ? $this->settings['blocked_ip_msg'] : '' ); ?>">
374
<p class="description"><?php echo __( 'Enter a short message to display when a blocked IP visits the site.', 'zerospam' ); ?></p>
375
</label>
376
<?php
lib/ZeroSpam/Install.php CHANGED
@@ -63,7 +63,7 @@ class ZeroSpam_Install extends ZeroSpam_Plugin
63
* @see update_option
64
* @global string ZEROSPAM_PLUGIN The plugin root directory.
65
*/
66
- private function activate()
67
{
68
// Install the DB tables.
69
$this->install();
63
* @see update_option
64
* @global string ZEROSPAM_PLUGIN The plugin root directory.
65
*/
66
+ public function activate()
67
{
68
// Install the DB tables.
69
$this->install();
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
=== WordPress Zero Spam ===
2
- Contributors: bmarshall511, afragen, tangrufus, leewillis77, macbookandrew, jaredatch, karpstrucking, thiagolcks, geekstreetwp
3
Donate link: https://www.gittip.com/bmarshall511/
4
Tags: comments, spam, antispam, anti-spam, comment spam, spambot, spammer, spam free, spam blocker, registration spam
5
Requires at least: 3.0.0
6
- Tested up to: 4.6.1
7
- Stable tag: 3.0.6
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
@@ -124,6 +124,11 @@ Yes! Install [Sunny](https://wphuman.com/go/sunny/) and follow this [guide](http
124
125
== Changelog ==
126
127
= v3.0.6 (December 27, 2016) =
128
* [bug] Gravity Forms submission fix (https://github.com/bmarshall511/wordpress-zero-spam/pull/140).
129
@@ -132,13 +137,13 @@ Yes! Install [Sunny](https://wphuman.com/go/sunny/) and follow this [guide](http
132
133
= v3.0.4 (November 24, 2016) =
134
* [bug] Fixed IP location lookup issue.
135
- * [improvement] Updated the Grunt development tasks.
136
137
= v3.0.3 (November 23, 2016) =
138
* [bug] Fixed issue with settings not getting saved (https://wordpress.org/support/topic/can-unselect-default-options/).
139
* [bug] Fixed PHP notice on Spammer Log page.
140
* [bug] Removed outdated CloudFlare instructions.
141
- * [improvement] Made the JS file version dynamic.
142
143
= 3.0.2 =
144
* Fixed fatal error.
@@ -262,3 +267,5 @@ Yes! Install [Sunny](https://wphuman.com/go/sunny/) and follow this [guide](http
262
* [Jared Atchison](https://github.com/jaredatch)
263
* [Lucas Karpiuk](https://github.com/karpstrucking)
264
* [Russell Aaron](https://github.com/KrashKartMedia)
1
=== WordPress Zero Spam ===
2
+ Contributors: bmarshall511, jrf, afragen, tangrufus, leewillis77, macbookandrew, jaredatch, karpstrucking, thiagolcks, geekstreetwp
3
Donate link: https://www.gittip.com/bmarshall511/
4
Tags: comments, spam, antispam, anti-spam, comment spam, spambot, spammer, spam free, spam blocker, registration spam
5
Requires at least: 3.0.0
6
+ Tested up to: 5.2.1
7
+ Stable tag: 3.1.0
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
124
125
== Changelog ==
126
127
+ = v3.1.0 (June 4, 2019)
128
+ * [bug] install/activation routine would never run, thanks @jrf (https://github.com/bmarshall511/wordpress-zero-spam/pull/148)
129
+ * [bug] option may not be set, thanks @jrf (https://github.com/bmarshall511/wordpress-zero-spam/pull/149)
130
+ * [enhancement] Improve zerospam_get_ip(), thanks @ben-morin (https://github.com/bmarshall511/wordpress-zero-spam/pull/143)
131
+
132
= v3.0.6 (December 27, 2016) =
133
* [bug] Gravity Forms submission fix (https://github.com/bmarshall511/wordpress-zero-spam/pull/140).
134
137
138
= v3.0.4 (November 24, 2016) =
139
* [bug] Fixed IP location lookup issue.
140
+ * [enhancement] Updated the Grunt development tasks.
141
142
= v3.0.3 (November 23, 2016) =
143
* [bug] Fixed issue with settings not getting saved (https://wordpress.org/support/topic/can-unselect-default-options/).
144
* [bug] Fixed PHP notice on Spammer Log page.
145
* [bug] Removed outdated CloudFlare instructions.
146
+ * [enhancement] Made the JS file version dynamic.
147
148
= 3.0.2 =
149
* Fixed fatal error.
267
* [Jared Atchison](https://github.com/jaredatch)
268
* [Lucas Karpiuk](https://github.com/karpstrucking)
269
* [Russell Aaron](https://github.com/KrashKartMedia)
270
+ * [Juliette](https://github.com/jrfnl)
271
+ * [Benjamin Morin](https://github.com/ben-morin)
zero-spam.php CHANGED
@@ -3,13 +3,13 @@
3
* Plugin Name: WordPress Zero Spam
4
* Plugin URI: https://benmarshall.me/wordpress-zero-spam
5
* 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> Based on work by <a href="http://davidwalsh.name/wordpress-comment-spam" target="_blank">David Walsh</a>.
6
- * Version: 3.0.6
7
* Author: Ben Marshall
8
* Author URI: https://benmarshall.me
9
* License: GPL2
10
*/
11
12
- /* Copyright 2015 - 2016 Ben Marshall (email : me@benmarshall.me)
13
14
This program is free software; you can redistribute it and/or modify
15
it under the terms of the GNU General Public License, version 2, as
3
* Plugin Name: WordPress Zero Spam
4
* Plugin URI: https://benmarshall.me/wordpress-zero-spam
5
* 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> Based on work by <a href="http://davidwalsh.name/wordpress-comment-spam" target="_blank">David Walsh</a>.
6
+ * Version: 3.1.0
7
* Author: Ben Marshall
8
* Author URI: https://benmarshall.me
9
* License: GPL2
10
*/
11
12
+ /* Copyright 2015 - 2019 Ben Marshall (email : me@benmarshall.me)
13
14
This program is free software; you can redistribute it and/or modify
15
it under the terms of the GNU General Public License, version 2, as