Skip to content

Commit b6f3832

Browse files
committed
Merge remote-tracking branch 'origin/master' into fix
# Conflicts: # js/apbct-public-bundle.min.js # js/apbct-public-bundle_ext-protection.min.js # js/apbct-public-bundle_ext-protection_gathering.min.js # js/apbct-public-bundle_full-protection.min.js # js/apbct-public-bundle_full-protection_gathering.min.js # js/apbct-public-bundle_gathering.min.js # js/apbct-public-bundle_int-protection.min.js # js/apbct-public-bundle_int-protection_gathering.min.js
2 parents 4e9ed00 + c1de423 commit b6f3832

59 files changed

Lines changed: 2185 additions & 588 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

cleantalk.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Plugin Name: Anti-Spam by CleanTalk
55
Plugin URI: https://cleantalk.org
66
Description: Max power, all-in-one, no Captcha, premium anti-spam plugin. No comment spam, no registration spam, no contact spam, protects any WordPress forms.
7-
Version: 6.75.99-fix
7+
Version: 6.76
88
Author: CleanTalk - Anti-Spam Protection <welcome@cleantalk.org>
99
Author URI: https://cleantalk.org
1010
Text Domain: cleantalk-spam-protect

inc/cleantalk-common.php

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,9 @@ function apbct_base_call($params = array(), $reg_flag = false)
193193

194194
// Misc
195195
'auth_key' => $apbct->api_key,
196-
'js_on' => apbct_js_test(Sanitize::cleanTextField(Cookie::get('ct_checkjs')), true) ? 1 : apbct_js_test(TT::toString(Post::get('ct_checkjs'))),
196+
'js_on' => apbct_js_test(Sanitize::cleanTextField(Cookie::getString('ct_checkjs')), true)
197+
? 1
198+
: apbct_js_test(Post::getString('ct_checkjs')),
197199

198200
'agent' => APBCT_AGENT,
199201
'sender_info' => $sender_info,
@@ -1857,7 +1859,6 @@ function apbct__bot_detector_get_fired_exclusions()
18571859
*/
18581860
function apbct__bot_detector_get_fd_log()
18591861
{
1860-
global $apbct;
18611862
$result = array(
18621863
'plugin_status' => 'OK',
18631864
'error_msg' => '',
@@ -1872,7 +1873,7 @@ function apbct__bot_detector_get_fd_log()
18721873
}
18731874

18741875
try {
1875-
if ( TT::toString($apbct->settings['data__bot_detector_enabled']) === '0') {
1876+
if ( ! apbct__is_bot_detector_enabled() ) {
18761877
throw new \Exception('bot detector library usage is disabled');
18771878
}
18781879
// Retrieve bot detector frontend data log from Alt Sessions
@@ -1929,3 +1930,24 @@ function apbct__bot_detector_get_custom_exclusion_from_settings()
19291930
}
19301931
return $exclusions;
19311932
}
1933+
1934+
/**
1935+
* Check if Bot-Detector is enabled/disabled
1936+
*
1937+
* @return bool
1938+
*/
1939+
function apbct__is_bot_detector_enabled()
1940+
{
1941+
global $apbct;
1942+
1943+
// Constant is preferred
1944+
if ( isset($apbct->service_constants->bot_detector_enabled) && $apbct->service_constants->bot_detector_enabled->isDefined() ) {
1945+
return (bool) $apbct->service_constants->bot_detector_enabled->getValue();
1946+
}
1947+
// Check by $apbct->data
1948+
if ( isset($apbct->data['bot_detector_enabled']) ) {
1949+
return (bool) $apbct->data['bot_detector_enabled'];
1950+
}
1951+
// By default - enabled
1952+
return true;
1953+
}

inc/cleantalk-integrations-by-hook.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@
226226
'ajax' => true
227227
),
228228
'PiotnetAddonsForElementorPro' => array(
229-
'hook' => array('pafe_ajax_form_builder'),
229+
'hook' => 'pafe_ajax_form_builder',
230230
'setting' => 'forms__contact_forms_test',
231231
'ajax' => true
232232
),

inc/cleantalk-pluggable.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,7 @@ function apbct_is_skip_request($ajax = false, $ajax_message_obj = array())
723723
'fl_builder_subscribe_form_submit', // FLBuilderForms has direct integration
724724
'tutor_pro_social_authentication', // Tutor Pro social authentication, we trust a third-party service
725725
'drplus_login', // Doctor Plus theme login
726+
'fluent_cal_schedule_meeting', // Fluent Booking has direct integration
726727
);
727728

728729
// Skip test if
@@ -1429,7 +1430,11 @@ function apbct_is_skip_request($ajax = false, $ajax_message_obj = array())
14291430
apbct_is_plugin_active('piotnet-addons-for-elementor-pro/piotnet-addons-for-elementor-pro.php') ||
14301431
apbct_is_plugin_active('piotnet-addons-for-elementor/piotnet-addons-for-elementor.php')
14311432
) &&
1432-
Post::get('action') === 'pafe_ajax_form_builder_preview_submission' ) {
1433+
(
1434+
Post::get('action') === 'pafe_ajax_form_builder_preview_submission' ||
1435+
Post::get('action') === 'pafe_ajax_form_builder'
1436+
)
1437+
) {
14331438
return 'PAFE';
14341439
}
14351440

inc/cleantalk-public-integrations.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1879,19 +1879,16 @@ function ct_quform_post_validate($result, $form)
18791879
* Filter for POST
18801880
*/
18811881
$input_array = apply_filters('apbct__filter_post', $form->getValues());
1882-
18831882
$ct_temp_msg_data = ct_get_fields_any($input_array);
18841883
$sender_email = isset($ct_temp_msg_data['email']) ? $ct_temp_msg_data['email'] : '';
18851884
$sender_emails_array = isset($ct_temp_msg_data['emails_array']) ? $ct_temp_msg_data['emails_array'] : '';
18861885

1887-
$checkjs = apbct_js_test(Sanitize::cleanTextField(Cookie::get('ct_checkjs')), true);
18881886
$base_call_result = apbct_base_call(
18891887
array(
18901888
'message' => $form->getValues(),
18911889
'sender_email' => $sender_email,
18921890
'post_info' => array('comment_type' => $comment_type),
18931891
'sender_info' => array('sender_emails_array' => $sender_emails_array),
1894-
'js_on' => $checkjs,
18951892
)
18961893
);
18971894

inc/cleantalk-public.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function apbct_init()
3232
$apbct->settings['data__pixel'] &&
3333
empty($apbct->pixel_url) &&
3434
!(
35-
$apbct->settings['data__bot_detector_enabled'] === '1' &&
35+
apbct__is_bot_detector_enabled() &&
3636
$apbct->settings['data__pixel'] === '3'
3737
)
3838
) {
@@ -570,7 +570,7 @@ function apbct_hook__wp_footer()
570570
(
571571
$apbct->settings['data__pixel'] === '3' &&
572572
! apbct_is_cache_plugins_exists() &&
573-
$apbct->settings['data__bot_detector_enabled'] !== '1'
573+
! apbct__is_bot_detector_enabled()
574574
)
575575
) {
576576
echo '<img alt="Cleantalk Pixel" title="Cleantalk Pixel" id="apbct_pixel" style="display: none;" src="' . Escape::escUrl($apbct->pixel_url) . '">';
@@ -1275,7 +1275,7 @@ function apbct_enqueue_and_localize_public_scripts()
12751275
ApbctEnqueue::getInstance()->js($bundle_name, array(), $in_footer);
12761276

12771277
// Bot detector
1278-
if ( $apbct->settings['data__bot_detector_enabled'] && ! apbct_bot_detector_scripts_exclusion()) {
1278+
if ( apbct__is_bot_detector_enabled() && ! apbct_bot_detector_scripts_exclusion()) {
12791279
// Attention! Skip old enqueue way for external script.
12801280
wp_enqueue_script(
12811281
'ct_bot_detector',

inc/cleantalk-settings.php

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -564,14 +564,17 @@ function apbct_settings__set_fields()
564564
'callback' => 'apbct_settings__check_alt_cookies_types'
565565
),
566566
//bot detector
567-
'data__bot_detector_enabled' => array(
568-
'title' => __('Use ', 'cleantalk-spam-protect')
569-
. $apbct->data['wl_brandname']
570-
. __(' JavaScript library', 'cleantalk-spam-protect'),
571-
'description' => __('This option includes external ', 'cleantalk-spam-protect')
572-
. $apbct->data['wl_brandname']
573-
. __(' JavaScript library to getting visitors info data', 'cleantalk-spam-protect'),
574-
'childrens' => array('exclusions__bot_detector')
567+
'bot_detector_state' => array(
568+
'callback' => function () {
569+
printf(
570+
esc_html__('JavaScript library (Bot Detector) is %s', 'cleantalk-spam-protect'),
571+
apbct__is_bot_detector_enabled()
572+
? esc_html__('enabled', 'cleantalk-spam-protect')
573+
: esc_html__('disabled', 'cleantalk-spam-protect')
574+
);
575+
},
576+
'long_description' => true,
577+
'display' => apbct__is_bot_detector_enabled(),
575578
),
576579
'exclusions__bot_detector' => array(
577580
'title' => __('JavaScript Library Exclusions', 'cleantalk-spam-protect'),
@@ -584,28 +587,31 @@ function apbct_settings__set_fields()
584587
'Regular expression. Use to skip a HTML form from special service field attach.',
585588
'cleantalk-spam-protect'
586589
),
587-
'parent' => 'data__bot_detector_enabled',
590+
'display' => apbct__is_bot_detector_enabled(),
588591
),
589592
'exclusions__bot_detector__form_attributes' => array(
590593
'type' => 'text',
591594
'title' => __('Exclude any forms that has attribute matches.', 'cleantalk-spam-protect'),
592595
'parent' => 'exclusions__bot_detector',
593596
'class' => 'apbct_settings-field_wrapper--sub',
594597
'long_description' => true,
598+
'display' => apbct__is_bot_detector_enabled(),
595599
),
596600
'exclusions__bot_detector__form_children_attributes' => array(
597601
'type' => 'text',
598602
'title' => __('Exclude any forms that includes a child element with attribute matches.', 'cleantalk-spam-protect'),
599603
'parent' => 'exclusions__bot_detector',
600604
'class' => 'apbct_settings-field_wrapper--sub',
601605
'long_description' => true,
606+
'display' => apbct__is_bot_detector_enabled(),
602607
),
603608
'exclusions__bot_detector__form_parent_attributes' => array(
604609
'type' => 'text',
605610
'title' => __('Exclude any forms that includes a parent element with attribute matches.', 'cleantalk-spam-protect'),
606611
'parent' => 'exclusions__bot_detector',
607612
'class' => 'apbct_settings-field_wrapper--sub',
608613
'long_description' => true,
614+
'display' => apbct__is_bot_detector_enabled(),
609615
),
610616
'wp__use_builtin_http_api' => array(
611617
'title' => __("Use WordPress HTTP API", 'cleantalk-spam-protect'),
@@ -3150,6 +3156,14 @@ function apbct_settings__get__long_description()
31503156
'title' => __('Contact data encoding', 'cleantalk-spam-protect'),
31513157
'desc' => ContactsEncoder::getEmailEncoderCommonLongDescription(),
31523158
),
3159+
'bot_detector_state' => array(
3160+
'title' => esc_html__('JavaScript library (Bot Detector)', 'cleantalk-spam-protect'),
3161+
'desc' => esc_html__("The Bot Detector is a JavaScript library that runs in the visitor's browser and collects behavioral signals to distinguish real users from bots.", 'cleantalk-spam-protect')
3162+
. '<br><br>' . esc_html__("This data is sent to the CleanTalk cloud along with each spam check request, significantly improving detection accuracy for spam on any website forms.", 'cleantalk-spam-protect')
3163+
. '<br><br>' . esc_html__("Disabling the Bot Detector will reduce anti-spam effectiveness.", 'cleantalk-spam-protect')
3164+
. '<br>' . esc_html__("It can only be disabled by adding the following constant to your wp-config.php: define('APBCT_SERVICE__BOT_DETECTOR_ENABLED', false);", 'cleantalk-spam-protect')
3165+
. '<br>' . esc_html__("We do not recommend disabling this functionality.", 'cleantalk-spam-protect')
3166+
),
31533167
);
31543168

31553169
if (!empty($setting_id) && isset($descriptions[$setting_id])) {

inc/cleantalk-updater.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1377,3 +1377,14 @@ function apbct_update_to_6_60_0()
13771377
}
13781378
}
13791379
}
1380+
1381+
function apbct_update_to_6_76_0()
1382+
{
1383+
global $apbct;
1384+
1385+
if ( isset($apbct->settings['data__bot_detector_enabled']) ) {
1386+
$bot_detector_state = $apbct->settings['data__bot_detector_enabled'];
1387+
$apbct->data['bot_detector_enabled'] = $bot_detector_state;
1388+
$apbct->saveData();
1389+
}
1390+
}

js/apbct-public-bundle.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/apbct-public-bundle_ext-protection.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)