Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
5 changes: 5 additions & 0 deletions inc/cleantalk-integrations-by-hook.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,11 @@
'setting' => 'forms__registrations_test',
'ajax' => false
),
'MailChimpShadowRoot' => array(
'hook' => 'cleantalk_force_mailchimp_shadowroot_check',
'setting' => 'forms__check_external',
'ajax' => true
),
'BloomForms' => array(
'hook' => 'bloom_subscribe',
'setting' => 'forms__contact_forms_test',
Expand Down
1 change: 1 addition & 0 deletions inc/cleantalk-pluggable.php
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,7 @@ function apbct_is_skip_request($ajax = false, $ajax_message_obj = array())
'nasa_process_login', //Nasa login
'leaky_paywall_validate_registration', //Leaky Paywall validation request
'cleantalk_force_ajax_check', //Force ajax check has direct integration
'cleantalk_force_mailchimp_shadowroot_check', // Mailchimp ShadowRoot has direct integration
'cscf-submitform', // CSCF has direct integration
'mailpoet', // Mailpoet has direct integration
'wpcommunity_auth_login', // WPCommunity login
Expand Down
2 changes: 1 addition & 1 deletion js/apbct-public-bundle.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/apbct-public-bundle_ext-protection.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/apbct-public-bundle_ext-protection_gathering.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/apbct-public-bundle_full-protection.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/apbct-public-bundle_full-protection_gathering.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/apbct-public-bundle_gathering.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/apbct-public-bundle_int-protection.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/apbct-public-bundle_int-protection_gathering.min.js

Large diffs are not rendered by default.

389 changes: 235 additions & 154 deletions js/prebuild/apbct-public-bundle.js

Large diffs are not rendered by default.

389 changes: 235 additions & 154 deletions js/prebuild/apbct-public-bundle_ext-protection.js

Large diffs are not rendered by default.

389 changes: 235 additions & 154 deletions js/prebuild/apbct-public-bundle_ext-protection_gathering.js

Large diffs are not rendered by default.

389 changes: 235 additions & 154 deletions js/prebuild/apbct-public-bundle_full-protection.js

Large diffs are not rendered by default.

389 changes: 235 additions & 154 deletions js/prebuild/apbct-public-bundle_full-protection_gathering.js

Large diffs are not rendered by default.

389 changes: 235 additions & 154 deletions js/prebuild/apbct-public-bundle_gathering.js

Large diffs are not rendered by default.

389 changes: 235 additions & 154 deletions js/prebuild/apbct-public-bundle_int-protection.js

Large diffs are not rendered by default.

389 changes: 235 additions & 154 deletions js/prebuild/apbct-public-bundle_int-protection_gathering.js

Large diffs are not rendered by default.

391 changes: 236 additions & 155 deletions js/src/public-1-main.js

Large diffs are not rendered by default.

68 changes: 68 additions & 0 deletions lib/Cleantalk/Antispam/Integrations/MailChimpShadowRoot.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?php

namespace Cleantalk\Antispam\Integrations;

/**
* This class handles the integration with Mailchimp forms embedded via ShadowRoot (external widget).
* These forms send data directly to Mailchimp servers bypassing WordPress,
* so we intercept fetch requests on the JS side and validate them via AJAX.
*/
class MailChimpShadowRoot extends IntegrationBase
{
public function getDataForChecking($argument)
{
global $apbct;

if (!empty($_POST)) {
if (!$apbct->stats['no_cookie_data_taken']) {
apbct_form__get_no_cookie_data();
}

$input_array = apply_filters('apbct__filter_post', $_POST);

$data = ct_gfa_dto($input_array)->getArray();

// Handle event token from bot detector
if (isset($data['ct_bot_detector_event_token'])) {
$data['event_token'] = $data['ct_bot_detector_event_token'];
}

return $data;
}

return null;
}

public function doBlock($message)
{
die(
json_encode(
array(
'apbct' => array(
'blocked' => true,
'comment' => $message,
'stop_script' => apbct__stop_script_after_ajax_checking()
)
)
)
);
}

/**
* Allow the request to proceed
* @return void
*/
public function allow()
{
die(
json_encode(
array(
'apbct' => array(
'blocked' => false,
'allow' => true,
)
)
)
);
}
}