-
Notifications
You must be signed in to change notification settings - Fork 7
New. ShadowrootProtection. Implementation of form protection in Shadowroot elements, integration with Mailchimp shadowroot #720
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
7bca548
d003cf9
f1ca027
605d87d
e9f0f70
33bdf7c
3f063e9
416b85c
d99d984
62ec39e
f568e73
b717fa3
29b67de
0b94422
5dd04e0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| 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, | ||
| ) | ||
| ) | ||
| ) | ||
| ); | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.