Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions includes/class-gf-zero-spam-addon.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
require_once GF_ZERO_SPAM_DIR . 'includes/class-email-rejection.php';
require_once GF_ZERO_SPAM_DIR . 'includes/class-email-rejection-settings.php';
require_once GF_ZERO_SPAM_DIR . 'includes/class-email-rejection-field-settings.php';
require_once GF_ZERO_SPAM_DIR . 'includes/class-gf-zero-spam-shield-silent-captcha.php';

/**
* @since 1.2
Expand Down Expand Up @@ -64,6 +65,11 @@ class GF_Zero_Spam_AddOn extends GFAddOn {
*/
private $email_rejection_settings;

/**
* Shield silentCAPTCHA integration instance.
*/
private ?GF_Zero_Spam_Shield_Silent_Captcha $shield_silent_captcha = null;

/**
* Gets the singleton instance.
*
Expand Down Expand Up @@ -101,6 +107,9 @@ public function init() {
$email_rejection_field_settings = new GF_Zero_Spam_Email_Rejection_Field_Settings();
$email_rejection_field_settings->init();

$this->shield_silent_captcha = new GF_Zero_Spam_Shield_Silent_Captcha( $this );
$this->shield_silent_captcha->init();

parent::init();

add_filter( 'gform_form_settings_fields', [ $this, 'add_settings_field' ], 10, 2 );
Expand Down Expand Up @@ -437,6 +446,10 @@ public function plugin_settings_fields() {
$sections = $this->email_rejection_settings->add_settings_section( $sections );
}

if ( $this->shield_silent_captcha ) {
$sections = $this->shield_silent_captcha->add_plugin_settings_fields( $sections );
}

return $sections;
}

Expand All @@ -453,6 +466,9 @@ public function update_plugin_settings( $settings ) {
if ( $this->email_rejection_settings ) {
$settings = $this->email_rejection_settings->save_rules_from_post( $settings );
}
if ( $this->shield_silent_captcha ) {
$settings = $this->shield_silent_captcha->normalize_plugin_settings( $settings );
}

parent::update_plugin_settings( $settings );
}
Expand Down
Loading