Gravity_Forms\Gravity_Forms\Honeypot\GF_Honeypot_Handler
Class GF_Honeypot_Handler
Since: 2.7 (Provides functionality for handling honeypot spam prevention services.)
Source: includes/honeypot/class-gf-honeypot-handler.php:19
Details
- Kind:
class - Namespace:
Gravity_Forms\Gravity_Forms\Honeypot
Methods
| Method | Description |
|---|---|
handle_entry_is_spam() | Target of the gform_entry_is_spam filter. Checks entry for honeypot validation and returns true or false depending on the result. |
handle_abort_submission() | Target of the gform_abort_submission_with_confirmation filter. Aborts form submission early with a confirmation when honeypot fails and it is configured not to create an entry. |
handle_after_submission() | Target of the gform_after_submission. Clears the cached results. |
maybe_add_honeypot_field() | Adds the honeypot field to the form if honeypot is enabled. |
get_cached_result() | Returns the cached result for the given form ID. |
cache_result() | Caches the result for the given form ID. |
validate_honeypot() | Validates the submission against the honeypot field. |
get_honeypot_field_id() | Returns the ID of the honeypot field. |
get_input_name() | Returns the value used in the name attribute of the honeypot input. |
get_honeypot_field() | Creates the honeypot field object for the given form. |
is_valid_version_hash() | Validates a version hash. |
is_honeypot_enabled() | Determines if Honeypot should be enabled for this form submission. |
is_api_submission() | Determines if the current form submission was initiated via GFAPI. |
is_speed_check_enabled() | Determines if the submission speed check is enabled. |
get_submission_speed_threshold() | Returns the submission speed threshold. |
is_strict_submission_speed_mode_enabled() | Determines if strict mode is enabled for the submission speed check. |
is_valid_submission_speed() | Determines if the submission speed check is valid. |
format_submission_speeds_for_note() | Formats the submission speeds for the entry note. |
check_submission_speeds() | Checks the submission speeds against the threshold. |
get_submission_speeds_array() | Parses and sanitizes the submission speeds from the gform_submit_speeds input for the current form. |
get_submission_speeds_json() | JSON encodes the submission speeds for the current form markup. |
submission_speeds_entry_meta() | Registers and saves the submission speeds to the entry meta, so the user can display it as an entries list column. |
submission_speeds_entries_field_value() | Formats the value for display in an entries list column. |
submission_speeds_entry_detail_meta_box() | Displays the submission speeds on the entry detail page. |
cache_invalid_state_counts() | Caches the invalid state counts for the current form. |
Method Reference
handle_entry_is_spam()
public function handle_entry_is_spam( $is_spam, $form )
Target of the gform_entry_is_spam filter. Checks entry for honeypot validation and returns true or false depending on the result.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$is_spam | bool | Variable being filtered. True for spam, false for non-spam. | |
$form | array | Current form object. |
Returns
bool— Returns true if honeypot validation fails. False otherwise.
Since:
2.72.9.21(Updated to get the entry note message fromget_cached_result().)
Source: includes/honeypot/class-gf-honeypot-handler.php:32
handle_abort_submission()
public function handle_abort_submission( $do_abort, $form )
Target of the gform_abort_submission_with_confirmation filter. Aborts form submission early with a confirmation when honeypot fails and it is configured not to create an entry.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$do_abort | bool | Variable being filtered. True to abort submission, false to continue. | |
$form | array | Current form object. |
Returns
bool— Returns true to abort form submission early and display confirmation. Returns false to let submission continue.
Since:
2.72.9.8(Updated honeypotAction default to spam.)
Source: includes/honeypot/class-gf-honeypot-handler.php:68
handle_after_submission()
public function handle_after_submission( $entry, $form )
Target of the gform_after_submission. Clears the cached results.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$entry | array | Current entry object. | |
$form | array | Current form object. |
Since:
2.73.0(Updated to also clear cached invalid state counts.)
Source: includes/honeypot/class-gf-honeypot-handler.php:107