WordPress Zero Spam - Version 1.5.3

Version Description

  • Fixed Gravity Form issues (https://github.com/bmarshall511/wordpress-zero-spam/issues/101)
Download this release

Release Info

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

Code changes from version 1.5.2 to 1.5.3

Files changed (3) hide show
  1. lib/zero-spam.class.php +30 -26
  2. readme.txt +5 -2
  3. zero-spam.php +1 -1
lib/zero-spam.class.php CHANGED
@@ -290,9 +290,9 @@ class Zero_Spam {
290
291
if ( 1 != $page ) {
292
if ( 2 != $page ) {
293
- $pre_html = '<li><a href="' . admin_url( $this->settings['page'] . '?page=zerospam&tab=' . $tab . '&p=1' ) . '"><i class="fa fa-angle-double-left"></i></a>';
294
}
295
- $pre_html .= '<li><a href="' . admin_url( $this->settings['page'] . '?page=zerospam&tab=' . $tab . '&p=' . ( $page - 1 ) ) . '"><i class="fa fa-angle-left"></i></a>';
296
}
297
298
echo '<ul class="zero-spam__pager">';
@@ -305,16 +305,10 @@ class Zero_Spam {
305
break;
306
}
307
308
- if ( is_plugin_active_for_network( plugin_basename( ZEROSPAM_PLUGIN ) ) ) {
309
- $settings_url = network_admin_url( $this->settings['page'] );
310
- } else {
311
- $settings_url = admin_url( $this->settings['page'] );
312
- }
313
-
314
if ( $num_pages != $page ) {
315
- $post_html = '<li><a href="' . $settings_url . '?page=zerospam&tab=' . $tab . '&p=' . ( $page + 1 ) . '"><i class="fa fa-angle-right"></i></a>';
316
if ( ( $page + 1 ) != $num_pages ) {
317
- $post_html .= '<li><a href="' . $settings_url . '?page=zerospam&tab=' . $tab . '&p=1"><i class="fa fa-angle-double-right"></i></a>';
318
}
319
}
320
@@ -322,7 +316,7 @@ class Zero_Spam {
322
if ( $page == $i ) {
323
$class = ' class="zero-spam__page-selected"';
324
}
325
- echo '<li><a href="' . $settings_url . '?page=zerospam&tab=' . $tab . '&p=' . $i . '"' . $class . '>' . $i . '</a>';
326
}
327
328
if( isset( $post_html ) ) {
@@ -746,7 +740,7 @@ class Zero_Spam {
746
<input type="checkbox" id="gf_support" name="zerospam_general_settings[ip_location_support]" value="1" <?php if( isset( $this->settings['zerospam_general_settings']['ip_location_support'] ) ) : checked( $this->settings['zerospam_general_settings']['ip_location_support'] ); endif; ?> /> <?php echo __( 'Enabled', 'zerospam' ); ?>
747
<p class="description">
748
<?php echo __( 'IP location data provided by', 'zerospam' ); ?> <a href="http://freegeoip.net/" target="_blank">freegeoip.net</a>. <?php echo __( 'API usage is limited to 10,000 queries per hour.', 'zerospam' ); ?><br>
749
- <?php echo __( 'Disable this option if you experience slow load times on the', 'zerospam' ); ?> <a href="<?php echo admin_url( $this->settings['page'] . '?page=zerospam&tab=zerospam_spammer_logs'); ?>"><?php echo __( 'Spammer Log', 'zerospam' ); ?></a> <?php echo __( 'page', 'zerospam' ); ?>.
750
</p>
751
</label>
752
<?php
@@ -850,12 +844,7 @@ class Zero_Spam {
850
* @link http://codex.wordpress.org/Plugin_API/Filter_Reference/plugin_action_links_(plugin_file_name)
851
*/
852
public function plugin_action_links( $links ) {
853
- if ( is_plugin_active_for_network( plugin_basename( ZEROSPAM_PLUGIN ) ) ) {
854
- $settings_url = network_admin_url( $this->settings['page'] );
855
- } else {
856
- $settings_url = admin_url( $this->settings['page'] );
857
- }
858
- $link = array( '<a href="' . $settings_url . '?page=zerospam">' . __( 'Settings', 'zerospam' ) . '</a>' );
859
860
return array_merge( $links, $link );
861
}
@@ -1292,8 +1281,6 @@ class Zero_Spam {
1292
$saved_settings = (array) get_option( 'zerospam_general_settings' );
1293
}
1294
1295
-
1296
-
1297
$this->settings['zerospam_general_settings'] = array_merge(
1298
$default_settings,
1299
$saved_settings
@@ -1386,7 +1373,7 @@ class Zero_Spam {
1386
}
1387
1388
// Gravity Forms support.
1389
- add_filter( 'gform_validation', array( &$this, 'gform_validation' ) );
1390
}
1391
1392
/**
@@ -1635,21 +1622,21 @@ class Zero_Spam {
1635
/**
1636
* Validate Gravity Form submissions.
1637
*
1638
- * @since 1.5.0
1639
*
1640
- * @link http://www.gravityhelp.com/documentation/page/Gform_validation
1641
*/
1642
- public function gform_validation( $result ) {
1643
if ( ! isset( $_POST['zerospam_key'] ) || ( $_POST['zerospam_key'] != $this->_get_key() ) ) {
1644
1645
do_action( 'zero_spam_found_spam_gf_form_submission' );
1646
1647
- $result['is_valid'] = false;
1648
1649
$this->_log_spam( 'gf' );
1650
}
1651
1652
- return $result;
1653
}
1654
1655
/**
@@ -1981,4 +1968,21 @@ class Zero_Spam {
1981
exit;
1982
}
1983
1984
}
290
291
if ( 1 != $page ) {
292
if ( 2 != $page ) {
293
+ $pre_html = '<li><a href="' . $this->_admin_url() . '?page=zerospam&tab=' . $tab . '&p=1"><i class="fa fa-angle-double-left"></i></a>';
294
}
295
+ $pre_html .= '<li><a href="' . $this->_admin_url() . '?page=zerospam&tab=' . $tab . '&p=' . ( $page - 1 ) . '"><i class="fa fa-angle-left"></i></a>';
296
}
297
298
echo '<ul class="zero-spam__pager">';
305
break;
306
}
307
308
if ( $num_pages != $page ) {
309
+ $post_html = '<li><a href="' . $this->_admin_url() . '?page=zerospam&tab=' . $tab . '&p=' . ( $page + 1 ) . '"><i class="fa fa-angle-right"></i></a>';
310
if ( ( $page + 1 ) != $num_pages ) {
311
+ $post_html .= '<li><a href="' . $this->_admin_url() . '?page=zerospam&tab=' . $tab . '&p=1"><i class="fa fa-angle-double-right"></i></a>';
312
}
313
}
314
316
if ( $page == $i ) {
317
$class = ' class="zero-spam__page-selected"';
318
}
319
+ echo '<li><a href="' . $this->_admin_url() . '?page=zerospam&tab=' . $tab . '&p=' . $i . '"' . $class . '>' . $i . '</a>';
320
}
321
322
if( isset( $post_html ) ) {
740
<input type="checkbox" id="gf_support" name="zerospam_general_settings[ip_location_support]" value="1" <?php if( isset( $this->settings['zerospam_general_settings']['ip_location_support'] ) ) : checked( $this->settings['zerospam_general_settings']['ip_location_support'] ); endif; ?> /> <?php echo __( 'Enabled', 'zerospam' ); ?>
741
<p class="description">
742
<?php echo __( 'IP location data provided by', 'zerospam' ); ?> <a href="http://freegeoip.net/" target="_blank">freegeoip.net</a>. <?php echo __( 'API usage is limited to 10,000 queries per hour.', 'zerospam' ); ?><br>
743
+ <?php echo __( 'Disable this option if you experience slow load times on the', 'zerospam' ); ?> <a href="<?php echo $this->_admin_url() . '?page=zerospam&tab=zerospam_spammer_logs'; ?>"><?php echo __( 'Spammer Log', 'zerospam' ); ?></a> <?php echo __( 'page', 'zerospam' ); ?>.
744
</p>
745
</label>
746
<?php
844
* @link http://codex.wordpress.org/Plugin_API/Filter_Reference/plugin_action_links_(plugin_file_name)
845
*/
846
public function plugin_action_links( $links ) {
847
+ $link = array( '<a href="' . $this->_admin_url() . '?page=zerospam">' . __( 'Settings', 'zerospam' ) . '</a>' );
848
849
return array_merge( $links, $link );
850
}
1281
$saved_settings = (array) get_option( 'zerospam_general_settings' );
1282
}
1283
1284
$this->settings['zerospam_general_settings'] = array_merge(
1285
$default_settings,
1286
$saved_settings
1373
}
1374
1375
// Gravity Forms support.
1376
+ add_filter( 'gform_entry_is_spam', array( &$this, 'gform_entry_is_spam' ), 10, 3 );
1377
}
1378
1379
/**
1622
/**
1623
* Validate Gravity Form submissions.
1624
*
1625
+ * @since 1.5.3
1626
*
1627
+ * @link https://github.com/bmarshall511/wordpress-zero-spam/issues/101
1628
*/
1629
+ public function gform_entry_is_spam( $is_spam, $form, $entry ) {
1630
if ( ! isset( $_POST['zerospam_key'] ) || ( $_POST['zerospam_key'] != $this->_get_key() ) ) {
1631
1632
do_action( 'zero_spam_found_spam_gf_form_submission' );
1633
1634
+ $is_spam = true;
1635
1636
$this->_log_spam( 'gf' );
1637
}
1638
1639
+ return $is_spam;
1640
}
1641
1642
/**
1968
exit;
1969
}
1970
1971
+ /**
1972
+ * Return proper admin_url for settings page.
1973
+ *
1974
+ * @return string|void
1975
+ */
1976
+ private function _admin_url() {
1977
+ if ( is_plugin_active_for_network( plugin_basename( ZEROSPAM_PLUGIN ) ) ) {
1978
+ $settings_url = network_admin_url( $this->settings['page'] );
1979
+ } else if ( home_url() != site_url() ) {
1980
+ $settings_url = home_url( '/wp-admin/' . $this->settings['page'] );
1981
+ } else {
1982
+ $settings_url = admin_url( $this->settings['page'] );
1983
+ }
1984
+
1985
+ return $settings_url;
1986
+ }
1987
+
1988
}
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: bmarshall511, afragen, tangrufus, leewillis77, macbookandrew
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.0.0
7
- Stable tag: 1.5.2
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
@@ -86,6 +86,9 @@ Yes! Thanks to @afragen. When using with multisite the plugin may be network act
86
87
== Changelog ==
88
89
= 1.5.2 =
90
* Added IP location service (https://github.com/bmarshall511/wordpress-zero-spam/issues/84)
91
* Improved pagination (https://github.com/bmarshall511/wordpress-zero-spam/issues/91)
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.0.1
7
+ Stable tag: 1.5.3
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
86
87
== Changelog ==
88
89
+ = 1.5.3 =
90
+ * Fixed Gravity Form issues (https://github.com/bmarshall511/wordpress-zero-spam/issues/101)
91
+
92
= 1.5.2 =
93
* Added IP location service (https://github.com/bmarshall511/wordpress-zero-spam/issues/84)
94
* Improved pagination (https://github.com/bmarshall511/wordpress-zero-spam/issues/91)
zero-spam.php CHANGED
@@ -3,7 +3,7 @@
3
* Plugin Name: WordPress Zero Spam
4
* Plugin URI: http://www.benmarshall.me/wordpress-zero-spam-plugin
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: 1.5.2
7
* Author: Ben Marshall
8
* Author URI: http://www.benmarshall.me
9
* License: GPL2
3
* Plugin Name: WordPress Zero Spam
4
* Plugin URI: http://www.benmarshall.me/wordpress-zero-spam-plugin
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: 1.5.3
7
* Author: Ben Marshall
8
* Author URI: http://www.benmarshall.me
9
* License: GPL2