Skip to content

Commit 9d98b6c

Browse files
committed
New. Integration. Chaty. Contact form.
1 parent 867f9cf commit 9d98b6c

3 files changed

Lines changed: 60 additions & 1 deletion

File tree

inc/cleantalk-integrations-by-hook.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,11 @@
404404
'setting' => 'forms__contact_forms_test',
405405
'ajax' => false
406406
),
407+
'ChatyContactForm' => array(
408+
'hook' => 'chaty_front_form_save_data',
409+
'setting' => 'forms__contact_forms_test',
410+
'ajax' => true
411+
),
407412
);
408413

409414
add_action('plugins_loaded', function () use ($apbct_active_integrations) {

inc/cleantalk-pluggable.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1522,13 +1522,21 @@ class_exists('Cleantalk\Antispam\Integrations\CleantalkInternalForms')
15221522
return 'fusion_form/avada_theme skip';
15231523
}
15241524

1525-
// skip Newsletter - have direct integration
1525+
// skip Newsletter - has direct integration
15261526
if (
15271527
apbct_is_plugin_active('newsletter/plugin.php') &&
15281528
Request::getString('action') === 'tnp'
15291529
) {
15301530
return 'Newsletter';
15311531
}
1532+
1533+
// skip ChatyContactForm - has direct integration
1534+
if (
1535+
apbct_is_plugin_active('chaty/cht-icons.php') &&
1536+
Request::getString('action') === 'chaty_front_form_save_data'
1537+
) {
1538+
return 'ChatyContactForm';
1539+
}
15321540
} else {
15331541
/*****************************************/
15341542
/* Here is non-ajax requests skipping */
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
3+
namespace Cleantalk\Antispam\Integrations;
4+
5+
use Cleantalk\ApbctWP\Variables\Request;
6+
use Cleantalk\ApbctWP\Variables\Post;
7+
8+
class ChatyContactForm extends IntegrationBase
9+
{
10+
public function getDataForChecking($argument)
11+
{
12+
if ( Request::get('nonce') ) {
13+
$event_token = Post::getString('ct_bot_detector_event_token');
14+
/**
15+
* Filter for POST
16+
*/
17+
$input_array = apply_filters('apbct__filter_post', $_POST);
18+
19+
unset($input_array['apbct_visible_fields']);
20+
21+
$base_call_data = ct_gfa_dto($input_array)->getArray();
22+
23+
$base_call_data['event_token'] = $event_token;
24+
25+
if (isset($base_call_data['message']['message'])) {
26+
$base_call_data['message'] = $base_call_data['message']['message'];
27+
}
28+
29+
return $base_call_data;
30+
}
31+
32+
return null;
33+
}
34+
35+
public function doBlock($message)
36+
{
37+
$response = [
38+
'status' => 0,
39+
'error' => '',
40+
'errors' => [],
41+
'message' => $message,
42+
];
43+
wp_send_json($response);
44+
exit;
45+
}
46+
}

0 commit comments

Comments
 (0)