Skip to content

Commit

Permalink
Merge pull request #16 from gravityview/develop
Browse files Browse the repository at this point in the history
Version 1.2.3
  • Loading branch information
zackkatz authored Feb 18, 2023
2 parents fabeed3 + 4480a0e commit cb812c7
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 8 deletions.
19 changes: 19 additions & 0 deletions gravityforms-zero-spam-form-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
*/
class GF_Zero_Spam_AddOn extends GFAddOn {

protected $_slug = 'gf-zero-spam';
protected $_path = GF_ZERO_SPAM_BASENAME;
protected $_full_path = __FILE__;
protected $_title = 'Gravity Forms Zero Spam';
protected $_short_title = 'Zero Spam';

public function init() {
parent::init();

Expand Down Expand Up @@ -76,6 +82,19 @@ function add_settings_field( $fields, $form = array() ) {

return $fields;
}

/**
* Logging is not currently supported.
*
* @param array $plugins An array of plugins that support logging.
*
* @return array
*/
public function set_logging_supported( $plugins ) {

return $plugins;
}

}

new GF_Zero_Spam_AddOn();
19 changes: 13 additions & 6 deletions gravityforms-zero-spam.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php
/**
* Plugin Name: Gravity Forms Zero Spam
* Plugin URI: https://gravityview.co?utm_source=plugin&utm_campaign=zero-spam&utm_content=pluginuri
* Plugin URI: https://www.gravitykit.com?utm_source=plugin&utm_campaign=zero-spam&utm_content=pluginuri
* Description: Enhance Gravity Forms to include effective anti-spam measures—without using a CAPTCHA.
* Version: 1.2.2
* Author: GravityView
* Author URI: https://gravityview.co?utm_source=plugin&utm_campaign=zero-spam&utm_content=authoruri
* Version: 1.2.3
* Author: GravityKit
* Author URI: https://www.gravitykit.com?utm_source=plugin&utm_campaign=zero-spam&utm_content=authoruri
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
*/
Expand All @@ -15,6 +15,8 @@
die;
}

define( 'GF_ZERO_SPAM_BASENAME', plugin_basename( __FILE__ ) );

// clean up after ourselves
register_deactivation_hook( __FILE__, array( 'GF_Zero_Spam', 'deactivate' ) );

Expand Down Expand Up @@ -77,7 +79,7 @@ public function add_key_field( $form ) {

$spam_key = esc_js( $this->get_key() );

$autocomplete = RGFormsModel::is_html5_enabled() ? ".attr( 'autocomplete', 'off' )\n\t\t" : '';
$autocomplete = RGFormsModel::is_html5_enabled() ? ".attr( 'autocomplete', 'new-password' )\n\t\t" : '';

$script = <<<EOD
jQuery( document ).on( 'submit.gravityforms', '.gform_wrapper form', function( event ) {
Expand Down Expand Up @@ -120,8 +122,13 @@ public function check_key_field( $is_spam = false, $form = array(), $entry = arr
return $is_spam;
}

$supports_context = method_exists( 'GFFormDisplay', 'get_submission_context' );
if ( $supports_context && GFFormDisplay::get_submission_context() !== 'form-submit' ) {
return $is_spam;
}

// This was not submitted using a web form; created using API
if ( ! did_action( 'gform_pre_submission' ) ) {
if ( ! $supports_context && ! did_action( 'gform_pre_submission' ) ) {
return $is_spam;
}

Expand Down
18 changes: 16 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Contributors: gravityview
Tags: gravityforms, gravity forms, anti-spam, antispam, spam, spam-blocker, spambot, spammer, add-ons, honeypot
Requires at least: 3.0.1
Tested up to: 6.0.1
Tested up to: 6.2
Stable tag: trunk
Requires PHP: 5.2.6
License: GPLv2 or later
Expand Down Expand Up @@ -39,6 +39,10 @@ Yes! When this plugin marks an entry as spam, it prevents processing of any conf

Note: When an entry is marked as Spam, it also prevents use of the configured confirmation. Users submitted a entry marked as Spam will see the default Gravity Forms “Thanks for contacting us! We will get in touch with you shortly.” confirmation text instead.

= I have Gravity Forms 2.7 installed. Do I need this plugin? =

Gravity Forms 2.7 added functionality that has similar features to this plugin, but we're adding additional features soon—keep this plugin installed!

= Does this plugin work in combination with other CAPTCHAs, honeypot fields, or spam blocker plugins? =

Yep, you can use this plugin in combination with all other spam-blocking plugins:
Expand All @@ -56,7 +60,7 @@ Zero Spam will not interfere with the operation of those plugins. It also doesn'

= What version of Gravity Forms does this work with? =

This works with all Gravity Forms releases after v2.3 (released June 2017). The plugin also blocks bots in the latest Gravity Forms 2.5!
This works with all Gravity Forms releases after v2.3 (released June 2017).

= Will this block spam comments or registrations on my site? =

Expand Down Expand Up @@ -97,6 +101,16 @@ First, **de-activate and re-activate the plugin**. Then let us know on the suppo

== Changelog ==

= 1.2.3 on February 18, 2023 =

Gravity Forms 2.7 added improved spam blocking in 2.7, but we're adding additional features soon—keep this plugin installed! ❤️

* Fixed: Gravity Forms 2.7 support. Thanks, Richard!
* Fixed: PHP 8.0 warnings. Thanks, Richard!
* Added: Support for API submissions (which don't have a form submit action). Thanks, Richard!
* Tweak: Changed the autocomplete on the hidden field to `new-password` instead of `off`. Thanks for the suggestion, Ross!
* Tested with WordPress 6.2

= 1.2.2 on August 11, 2022 =

* Improved: Prevent autocomplete on the hidden field. This may help prevent some reported false-positives.
Expand Down

0 comments on commit cb812c7

Please sign in to comment.