Skip to content

Commit 55e785f

Browse files
authored
Merge pull request #762 from CleanTalk/beta
Beta
2 parents 80cbc7b + 21a8077 commit 55e785f

53 files changed

Lines changed: 3280 additions & 1325 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: 9 additions & 19 deletions
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.74
7+
Version: 6.75
88
Author: CleanTalk - Anti-Spam Protection <welcome@cleantalk.org>
99
Author URI: https://cleantalk.org
1010
Text Domain: cleantalk-spam-protect
@@ -476,10 +476,11 @@ function apbct_write_js_errors($data)
476476
}
477477

478478
// Memberpress integration
479+
// MemberPress sends mepr_process_signup_form='Y' or '1' — both must trigger the check
479480
if (
480481
!empty($_POST) &&
481482
apbct_is_plugin_active('memberpress/memberpress.php') &&
482-
Post::hasString('mepr_process_signup_form', '1') &&
483+
Post::getString('mepr_process_signup_form') &&
483484
(int)$apbct->settings['forms__registrations_test'] === 1
484485
) {
485486
apbct_memberpress_signup_request_test();
@@ -614,10 +615,12 @@ function apbct_write_js_errors($data)
614615
. '/js/apbct-public-bundle.min.js'
615616
. '?ver=' . APBCT_VERSION . '" id="ct_public_functions-js"></script>';
616617
echo '<script src="' . APBCT_BOT_DETECTOR_SCRIPT_URL . '?ver='
617-
. APBCT_VERSION . '" id="ct_bot_detector-js"></script>';
618+
. APBCT_VERSION . '" async id="ct_bot_detector-js" data-wp-strategy="async"></script>';
618619
}, 100);
619620
}
620621

622+
SFWUpdateHelper::processSFWOutdatedError($apbct);
623+
621624
// SpamFireWall check
622625
if ( $apbct->plugin_version == APBCT_VERSION && // Do not call with first start
623626
$apbct->settings['sfw__enabled'] == 1 &&
@@ -910,25 +913,12 @@ function apbct_sfw__check()
910913
}
911914

912915
// update mode - skip checking
913-
if ( isset($apbct->fw_stats['update_mode']) && $apbct->fw_stats['update_mode'] === 1 ) {
916+
if ( SFWUpdateHelper::SFWUpdateModeEnabled($apbct)) {
914917
return;
915918
}
916919

917-
// Checking if database was outdated
918-
$is_sfw_outdated = $apbct->stats['sfw']['last_update_time'] + $apbct->stats['sfw']['update_period'] * 3 < time();
919-
920-
add_action('init', function () use ($apbct, $is_sfw_outdated) {
921-
$apbct->errorToggle(
922-
$is_sfw_outdated,
923-
'sfw_outdated',
924-
esc_html__(
925-
'SpamFireWall database is outdated. Please, try to synchronize with the cloud.',
926-
'cleantalk-spam-protect'
927-
)
928-
);
929-
});
930-
931-
if ( $is_sfw_outdated ) {
920+
// sfw is outdated - skip checking
921+
if ( SFWUpdateHelper::SFWDataOutdated($apbct) ) {
932922
return;
933923
}
934924

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"vendor/bin/psalm --no-cache --config=psalm.xml --taint-analysis"
3636
],
3737
"just_phpunit": [
38-
"vendor/bin/phpunit --configuration tests/phpunit.xml --debug"
38+
"vendor/bin/phpunit --configuration tests/phpunit.xml --coverage-clover=coverage.xml"
3939
]
4040
},
4141
"config": {

css/cleantalk-trp.min.css

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

css/src/cleantalk-trp.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,15 @@
5656
gap: 1px;
5757
}
5858

59+
.apbct-real-user-popup-content_row * {
60+
color: grey;
61+
font-style: italic;
62+
}
63+
.apbct-real-user-popup-content_row strong {
64+
color: initial;
65+
font-style: initial;
66+
}
67+
5968
.apbct-real-user-popup-img {
6069
align-self: start;
6170
margin: 0!important;

inc/cleantalk-integrations-by-hook.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,11 @@
348348
'setting' => 'forms__contact_forms_test',
349349
'ajax' => true
350350
),
351+
'ElfsightForm' => array(
352+
'hook' => 'cleantalk_force_elfsight_check',
353+
'setting' => 'forms__check_external',
354+
'ajax' => true
355+
),
351356
'BloomForms' => array(
352357
'hook' => 'bloom_subscribe',
353358
'setting' => 'forms__contact_forms_test',

inc/cleantalk-integrations-by-route.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@
1111
'setting' => 'forms__contact_forms_test',
1212
'rest' => true,
1313
),
14+
'HivePress' => array(
15+
'rest_route' => '/hivepress/v1/listings/',
16+
'setting' => 'forms__contact_forms_test',
17+
'rest' => true,
18+
),
19+
'HivePressRegistration' => array(
20+
'rest_route' => '/hivepress/v1/users',
21+
'setting' => 'forms__registrations_test',
22+
'rest' => true,
23+
),
1424
);
1525

1626
add_filter('rest_pre_dispatch', function ($result, $_, $request) use ($apbct_active_rest_integrations) {

inc/cleantalk-pluggable.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1982,6 +1982,14 @@ class_exists('Cleantalk\Antispam\Integrations\CleantalkInternalForms')
19821982
) {
19831983
return 'AsgarosForum';
19841984
}
1985+
1986+
// Plugin Name: HivePress
1987+
if (
1988+
apbct_is_plugin_active('hivepress/hivepress.php') &&
1989+
(apbct_is_in_uri('/hivepress/v1/listings/') || apbct_is_in_uri('/hivepress/v1/users'))
1990+
) {
1991+
return 'Plugin Name: HivePress skip REST route checking';
1992+
}
19851993
}
19861994

19871995
// WP Fusion Abandoned Cart Addon

inc/cleantalk-public-integrations.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function apbct_print_public_scripts()
4444
echo CtPublicLocalize::getCode();
4545

4646
echo '<script src="' . $js_url . '" type="application/javascript"></script>';
47-
echo '<script src="' . $js_url_wrapper . '" type="application/javascript"></script>';
47+
echo '<script src="' . $js_url_wrapper . '" async data-wp-strategy="async" type="application/javascript"></script>';
4848
}
4949

5050
/**
@@ -2115,7 +2115,7 @@ function apbct_form__gravityForms__testSpam($is_spam, $form, $entry)
21152115
{
21162116
global $apbct, $ct_gform_is_spam, $ct_gform_response;
21172117

2118-
if (apbct_form__gravityForms__isSkippedRequest($is_spam)) {
2118+
if (apbct_form__gravityForms__isSkippedRequest()) {
21192119
return $is_spam;
21202120
}
21212121

@@ -2253,7 +2253,7 @@ function apbct_form__gravityForms__testSpam($is_spam, $form, $entry)
22532253
*
22542254
* @return bool
22552255
*/
2256-
function apbct_form__gravityForms__isSkippedRequest($is_spam)
2256+
function apbct_form__gravityForms__isSkippedRequest()
22572257
{
22582258
global $cleantalk_executed, $apbct;
22592259

@@ -2262,15 +2262,9 @@ function apbct_form__gravityForms__isSkippedRequest($is_spam)
22622262
'_GET' => $_GET,
22632263
'SERVER_URI' => Server::getString('REQUEST_URI'),
22642264
'HTTP_REFERER' => Server::getString('HTTP_REFERER'),
2265-
'$is_spam' => $is_spam,
22662265
'$cleantalk_executed' => $cleantalk_executed,
22672266
];
22682267

2269-
if ( $is_spam ) {
2270-
do_action('apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . 'ALREADY SET BY GRAVITY AS SPAM', $data);
2271-
return true;
2272-
}
2273-
22742268
if ( $apbct->settings['forms__contact_forms_test'] == 0 ) {
22752269
do_action('apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . 'CONTACT FORM TEST DISABLED', $data);
22762270
return true;

inc/cleantalk-public-validate.php

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -211,24 +211,6 @@ function ct_contact_form_validate()
211211
return false;
212212
}
213213

214-
//hivepress theme listing integration
215-
if ( empty($sender_email) &&
216-
function_exists('hivepress') &&
217-
is_callable('hivepress') &&
218-
apbct_is_user_logged_in() &&
219-
$apbct->settings['data__protect_logged_in']
220-
) {
221-
if (! isset($_POST['_model'])) {
222-
$current_user = wp_get_current_user();
223-
if ( ! empty($current_user->data->user_email) ) {
224-
$sender_email = $current_user->data->user_email;
225-
}
226-
} else {
227-
do_action('apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '(hivepress theme listing integration):' . __LINE__, $_POST);
228-
return false;
229-
}
230-
}
231-
232214
//tellallfriend integration #1
233215
if ( isset($_POST['TellAFriend_Link']) ) {
234216
$tmp = Sanitize::cleanTextField(Post::get('TellAFriend_Link'));

inc/cleantalk-public.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1254,7 +1254,7 @@ function apbct_enqueue_and_localize_public_scripts()
12541254
APBCT_VERSION,
12551255
array(
12561256
'in_footer' => $in_footer,
1257-
'strategy' => 'defer'
1257+
'strategy' => 'async'
12581258
)
12591259
);
12601260
}

0 commit comments

Comments
 (0)