Version Description
on March 15, 2021 =
- Fixed: JavaScript "null is not an object (evaluating 'el.addEventListener')" error on pages without a form
Download this release
Release Info
Developer | gravityview |
Plugin | Gravity Forms Zero Spam |
Version | 1.0.6.1 |
Comparing to | |
See all releases |
Code changes from version 1.0.5 to 1.0.6.1
- gravityforms-zero-spam.php +35 -16
- readme.txt +14 -11
gravityforms-zero-spam.php
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
/**
|
3 |
* Plugin Name: Gravity Forms Zero Spam
|
4 |
* Plugin URI: https://gravityview.co?utm_source=plugin&utm_campaign=zero-spam&utm_content=pluginuri
|
5 |
-
* Description: Enhance
|
6 |
-
* Version: 1.0.
|
7 |
* Author: GravityView
|
8 |
* Author URI: https://gravityview.co?utm_source=plugin&utm_campaign=zero-spam&utm_content=authoruri
|
9 |
* License: GPL-2.0+
|
@@ -41,7 +41,7 @@ class GF_Zero_Spam {
|
|
41 |
|
42 |
public function __construct() {
|
43 |
add_action( 'wp_print_footer_scripts', array( $this, 'add_key_field' ), 9999 );
|
44 |
-
add_filter( 'gform_entry_is_spam', array( $this, 'check_key_field' ) );
|
45 |
}
|
46 |
|
47 |
/**
|
@@ -69,17 +69,24 @@ class GF_Zero_Spam {
|
|
69 |
public function add_key_field() {
|
70 |
?>
|
71 |
<script type='text/javascript'>
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
</script>
|
84 |
<?php
|
85 |
}
|
@@ -88,10 +95,22 @@ class GF_Zero_Spam {
|
|
88 |
* Checks for our zero spam key during validation
|
89 |
*
|
90 |
* @param bool $is_spam Indicates if the submission has been flagged as spam.
|
|
|
|
|
91 |
*
|
92 |
* @return bool True: it's spam; False: it's not spam!
|
93 |
*/
|
94 |
-
public function check_key_field( $is_spam = false ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
|
96 |
if ( ! isset( $_POST['gf_zero_spam_key'] ) ) {
|
97 |
return true;
|
@@ -103,4 +122,4 @@ class GF_Zero_Spam {
|
|
103 |
|
104 |
return $is_spam;
|
105 |
}
|
106 |
-
}
|
2 |
/**
|
3 |
* Plugin Name: Gravity Forms Zero Spam
|
4 |
* Plugin URI: https://gravityview.co?utm_source=plugin&utm_campaign=zero-spam&utm_content=pluginuri
|
5 |
+
* Description: Enhance Gravity Forms to include effective anti-spam measures—without using a CAPTCHA.
|
6 |
+
* Version: 1.0.6.1
|
7 |
* Author: GravityView
|
8 |
* Author URI: https://gravityview.co?utm_source=plugin&utm_campaign=zero-spam&utm_content=authoruri
|
9 |
* License: GPL-2.0+
|
41 |
|
42 |
public function __construct() {
|
43 |
add_action( 'wp_print_footer_scripts', array( $this, 'add_key_field' ), 9999 );
|
44 |
+
add_filter( 'gform_entry_is_spam', array( $this, 'check_key_field' ), 10, 3 );
|
45 |
}
|
46 |
|
47 |
/**
|
69 |
public function add_key_field() {
|
70 |
?>
|
71 |
<script type='text/javascript'>
|
72 |
+
document.addEventListener("DOMContentLoaded", function() {
|
73 |
+
var gforms = '.gform_wrapper form';
|
74 |
+
|
75 |
+
var el = document.querySelector( gforms );
|
76 |
+
|
77 |
+
if ( ! el ) {
|
78 |
+
return;
|
79 |
+
}
|
80 |
+
|
81 |
+
el.addEventListener( "submit", function ( e ) {
|
82 |
+
var input = document.createElement( "input" );
|
83 |
+
input.type = 'hidden';
|
84 |
+
input.name = 'gf_zero_spam_key';
|
85 |
+
input.value = '<?php echo esc_js( $this->get_key() ); ?>';
|
86 |
+
|
87 |
+
e.target.appendChild( input );
|
88 |
+
} );
|
89 |
+
});
|
90 |
</script>
|
91 |
<?php
|
92 |
}
|
95 |
* Checks for our zero spam key during validation
|
96 |
*
|
97 |
* @param bool $is_spam Indicates if the submission has been flagged as spam.
|
98 |
+
* @param array $form The form currently being processed.
|
99 |
+
* @param array $entry The entry currently being processed.
|
100 |
*
|
101 |
* @return bool True: it's spam; False: it's not spam!
|
102 |
*/
|
103 |
+
public function check_key_field( $is_spam = false, $form = array(), $entry = array() ) {
|
104 |
+
|
105 |
+
// This was not submitted using a web form; created using API
|
106 |
+
if ( ! did_action( 'gform_pre_submission' ) ) {
|
107 |
+
return $is_spam;
|
108 |
+
}
|
109 |
+
|
110 |
+
// Created using REST API or GFAPI
|
111 |
+
if ( isset( $entry['user_agent'] ) && 'API' === $entry['user_agent'] ) {
|
112 |
+
return $is_spam;
|
113 |
+
}
|
114 |
|
115 |
if ( ! isset( $_POST['gf_zero_spam_key'] ) ) {
|
116 |
return true;
|
122 |
|
123 |
return $is_spam;
|
124 |
}
|
125 |
+
}
|
readme.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
=== Gravity Forms Zero Spam ===
|
2 |
Contributors: gravityview, karpstrucking, supporthero
|
3 |
-
Tags: gravityforms, gravity forms, anti-spam, antispam, spam, spam-blocker, spambot, spammer, addons,
|
4 |
Requires at least: 3.0.1
|
5 |
-
Tested up to: 5.
|
6 |
-
Stable tag:
|
7 |
Requires PHP: 5.2.6
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -12,20 +12,14 @@ Enhance your Gravity Forms to include anti-spam measures originally based on the
|
|
12 |
|
13 |
== Description ==
|
14 |
|
15 |
-
This Gravity Forms add-on blocks spam a non-obtrusive anti-spam measure
|
16 |
|
17 |
-
|
18 |
-
|
19 |
-
Do you not want to use ReCAPTCHA because it's user-hostile? Use this instead! There are no stoplights or crosswalks here.
|
20 |
|
21 |
Originally based on David Walsh's "Zero Spam" technique. Requires [Gravity Forms](https://www.gravityforms.com/?partner_id=1210629&irgwc=1&utm_medium=affiliate&utm_campaign=1210629&utm_source=Katz%20Web%20Services%2C%20Inc.).
|
22 |
|
23 |
== Frequently Asked Questions ==
|
24 |
|
25 |
-
= Why don't I see any changes after activating this on my site? =
|
26 |
-
|
27 |
-
There are no settings to this plugin! It will block spam automatically and invisibly.
|
28 |
-
|
29 |
= Is this plugin PHP7 compatible? =
|
30 |
|
31 |
Yes.
|
@@ -36,6 +30,15 @@ No. For that, we recommend Ben Marshall‘s [WordPress Zero Spam plugin](https:/
|
|
36 |
|
37 |
== Changelog ==
|
38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
= 1.0.5 on February 16, 2021 =
|
40 |
|
41 |
The Gravity Forms Zero Spam plugin is now maintained by [GravityView](https://gravityview.co?utm_source=plugin&utm_campaign=zero-spam&utm_content=changelog). We look forward to continuing to improve this simple, effective spam blocker for Gravity Forms. Thanks to GoWP for their great work!
|
1 |
=== Gravity Forms Zero Spam ===
|
2 |
Contributors: gravityview, karpstrucking, supporthero
|
3 |
+
Tags: gravityforms, gravity forms, anti-spam, antispam, spam, spam-blocker, spambot, spammer, addons, add-ons
|
4 |
Requires at least: 3.0.1
|
5 |
+
Tested up to: 5.7
|
6 |
+
Stable tag: trunk
|
7 |
Requires PHP: 5.2.6
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
|
13 |
== Description ==
|
14 |
|
15 |
+
This Gravity Forms add-on blocks spam using a non-obtrusive anti-spam measure. There are no settings or configuration needed: all you need to do is activate the plugin!
|
16 |
|
17 |
+
Do you not want to use ReCAPTCHA because it's user-hostile? Use this instead! There are no stoplights or crosswalks here.
|
|
|
|
|
18 |
|
19 |
Originally based on David Walsh's "Zero Spam" technique. Requires [Gravity Forms](https://www.gravityforms.com/?partner_id=1210629&irgwc=1&utm_medium=affiliate&utm_campaign=1210629&utm_source=Katz%20Web%20Services%2C%20Inc.).
|
20 |
|
21 |
== Frequently Asked Questions ==
|
22 |
|
|
|
|
|
|
|
|
|
23 |
= Is this plugin PHP7 compatible? =
|
24 |
|
25 |
Yes.
|
30 |
|
31 |
== Changelog ==
|
32 |
|
33 |
+
= 1.0.6.1 on March 15, 2021 =
|
34 |
+
|
35 |
+
* Fixed: JavaScript "null is not an object (evaluating 'el.addEventListener')" error on pages without a form
|
36 |
+
|
37 |
+
= 1.0.6 on March 11, 2021 =
|
38 |
+
|
39 |
+
* Improved: No longer requires jQuery
|
40 |
+
* Fixed: Only checks for spam on submissions that were submitted by a form, not for entries created programatically
|
41 |
+
|
42 |
= 1.0.5 on February 16, 2021 =
|
43 |
|
44 |
The Gravity Forms Zero Spam plugin is now maintained by [GravityView](https://gravityview.co?utm_source=plugin&utm_campaign=zero-spam&utm_content=changelog). We look forward to continuing to improve this simple, effective spam blocker for Gravity Forms. Thanks to GoWP for their great work!
|