Skip to content

Commit ed5d425

Browse files
authored
Merge pull request #613 from CleanTalk/release_6.56
Release 6.56
2 parents a54eb4e + 2665aab commit ed5d425

File tree

55 files changed

+950
-302
lines changed

Some content is hidden

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

55 files changed

+950
-302
lines changed

.github/workflows/eslint.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,14 @@ jobs: # list of things to do
3535
- name: Code Linting
3636
run: npm run eslint
3737

38-
- name: Telegram notify
38+
- name: Matrix notify
3939
if: failure()
40-
uses: appleboy/telegram-action@master
40+
uses: Glomberg/matrix-messenger-action@master
4141
with:
42-
to: ${{ secrets.TELEGRAM_PLUGINS_TO }}
43-
token: ${{ secrets.TELEGRAM_REVIEWER_TOKEN }}
42+
server: ${{ secrets.MATRIX_SERVER }}
43+
to: ${{ secrets.MATRIX_EXTERNSION_ROOM }}
44+
token: ${{ secrets.MATRIX_USER_TOKEN }}
4445
message: |
4546
Hi, <strong>${{ github.actor }}</strong>! Your commit for <strong>${{ github.repository }}</strong>
4647
contains 💯 the best solution but it have to be fixed!
4748
<a href="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}">Auto-Tests <strong>ESLint</strong></a> build failed ⛔!
48-
format: html
49-
disable_web_page_preview: true
Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Notice about releases via Telegram
1+
name: Notice about releases via Matrix
22

33
on:
44
release:
@@ -9,15 +9,14 @@ jobs:
99
build:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- name: send telegram message on release
13-
uses: appleboy/telegram-action@master
12+
- name: Send Matrix message on release
13+
uses: Glomberg/matrix-messenger-action@master
1414
with:
15-
to: ${{ secrets.TELEGRAM_TO }}
16-
token: ${{ secrets.TELEGRAM_TOKEN }}
15+
server: ${{ secrets.MATRIX_SERVER }}
16+
to: ${{ secrets.MATRIX_NEWS_ROOM }}
17+
token: ${{ secrets.MATRIX_USER_TOKEN }}
1718
message: |
1819
${{ github.event.repository.description }} <strong>v${{github.event.release.name}}</strong> released
19-
${{github.event.release.html_url}}
20-
21-
${{ github.event.release.body }}
22-
format: html
23-
disable_web_page_preview: true
20+
<br>${{github.event.release.html_url}}
21+
<br>
22+
<br><pre>${{ github.event.release.body }}</pre>

.github/workflows/reviewNotice.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Notice about review approved via Telegram
1+
name: Notice about review approved via Matrix
22

33
on:
44
pull_request_review:
@@ -13,15 +13,14 @@ jobs:
1313
- name: Convert date format
1414
id: date
1515
run: echo "::set-output name=date::$(date -d "${{ github.event.pull_request.created_at }}" +"%Y-%m-%d")"
16-
- name: Send telegram message on review approved
17-
uses: appleboy/telegram-action@master
16+
- name: Send Matrix message on review approved
17+
uses: Glomberg/matrix-messenger-action@master
1818
with:
19-
to: ${{ secrets.TELEGRAM_PLUGINS_TO }}
20-
token: ${{ secrets.TELEGRAM_REVIEWER_TOKEN }}
19+
server: ${{ secrets.MATRIX_SERVER }}
20+
to: ${{ secrets.MATRIX_EXTERNSION_ROOM }}
21+
token: ${{ secrets.MATRIX_USER_TOKEN }}
2122
message: |
2223
💥🎉🎉🎉💥 Pull-request <a href="${{ github.event.pull_request.html_url }}"><strong>${{ github.event.pull_request.title }}</strong></a>
2324
submitted by <strong>${{ github.event.pull_request.user.login }}</strong> at <strong>${{ steps.date.outputs.date }}</strong>
2425
2526
was <strong>approved</strong> and is ready to merge <a href="${{ github.event.pull_request.html_url }}">➡️</a> !!!
26-
format: html
27-
disable_web_page_preview: true

.github/workflows/tests.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,14 @@ jobs:
5252
CLEANTALK_TEST_API_KEY: ${{ secrets.CLEANTALK_TEST_API_KEY }}
5353
run: composer test
5454

55-
- name: Telegram notify
55+
- name: Matrix notify
5656
if: failure()
57-
uses: appleboy/telegram-action@master
57+
uses: Glomberg/matrix-messenger-action@master
5858
with:
59-
to: ${{ secrets.TELEGRAM_PLUGINS_TO }}
60-
token: ${{ secrets.TELEGRAM_REVIEWER_TOKEN }}
59+
server: ${{ secrets.MATRIX_SERVER }}
60+
to: ${{ secrets.MATRIX_EXTERNSION_ROOM }}
61+
token: ${{ secrets.MATRIX_USER_TOKEN }}
6162
message: |
6263
Hi, <strong>${{ github.actor }}</strong>! Your commit for <strong>${{ github.repository }}</strong>
6364
contains 💯 the best solution but it have to be fixed!
6465
<a href="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}">Auto-Tests (PHPUnit, PHPCS, Psalm)</a> build failed ⛔!
65-
format: html
66-
disable_web_page_preview: true

cleantalk.php

Lines changed: 18 additions & 6 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.55
7+
Version: 6.56
88
Author: CleanTalk - Anti-Spam Protection <welcome@cleantalk.org>
99
Author URI: https://cleantalk.org
1010
Text Domain: cleantalk-spam-protect
@@ -269,7 +269,7 @@ function apbct_register_my_rest_routes()
269269
global $apbct;
270270

271271
// Self cron
272-
$ct_cron = new Cron();
272+
$ct_cron = Cron::getInstance();
273273
$tasks_to_run = $ct_cron->checkTasks(); // Check for current tasks. Drop tasks inner counters.
274274
if (
275275
$tasks_to_run && // There are tasks to run
@@ -600,10 +600,6 @@ function apbct_write_js_errors($data)
600600

601601
// Public actions
602602
if ( ! is_admin() && ! apbct_is_ajax() && ! apbct_is_customize_preview() ) {
603-
// Default search
604-
add_filter('get_search_query', 'apbct_forms__search__testSpam');
605-
add_action('wp_head', 'apbct_search_add_noindex', 1);
606-
607603
if (apbct_is_plugin_active('fluentformpro/fluentformpro.php') && apbct_is_in_uri('ff_landing=')) {
608604
add_action('wp_head', function () {
609605
echo '<script data-pagespeed-no-defer="" src="'
@@ -2746,6 +2742,22 @@ function ct_account_status_check($api_key = null, $process_errors = true)
27462742
$apbct->data['notice_trial'] = TT::getArrayValueAsInt($result, 'trial', 0);
27472743
$apbct->data['notice_review'] = TT::getArrayValueAsInt($result, 'show_review', 0);
27482744

2745+
if ($apbct->data['notice_show']) {
2746+
$notice_banners = API::getNoticeBanners($api_key);
2747+
2748+
if (isset($notice_banners['operation_status'], $notice_banners['banners']) && $notice_banners['operation_status'] === 'SUCCESS') {
2749+
if (isset($notice_banners['banners']['TRIAL']['level'])) {
2750+
$apbct->data['notice_trial_level'] = strtolower($notice_banners['banners']['TRIAL']['level']);
2751+
}
2752+
if (isset($notice_banners['banners']['RENEW']['level'])) {
2753+
$apbct->data['notice_renew_level'] = strtolower($notice_banners['banners']['RENEW']['level']);
2754+
}
2755+
if (isset($notice_banners['banners']['REVIEW']['level'])) {
2756+
$apbct->data['notice_review_level'] = strtolower($notice_banners['banners']['REVIEW']['level']);
2757+
}
2758+
}
2759+
}
2760+
27492761
// Other
27502762
$apbct->data['service_id'] = TT::getArrayValueAsInt($result, 'service_id', 0);
27512763
$apbct->data['user_id'] = TT::getArrayValueAsInt($result, 'user_id', 0);

inc/cleantalk-integrations-by-class.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
'plugin_path' => 'woocommerce/woocommerce.php',
1010
'plugin_class' => 'WooCommerce',
1111
),
12+
'WPSearchForm' => array(
13+
'plugin_path' => '',
14+
'plugin_class' => '',
15+
'wp_includes' => true,
16+
),
1217
);
1318

1419
add_action('plugins_loaded', function () use ($apbct_integrations_by_class) {

inc/cleantalk-integrations-by-hook.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,21 @@
399399
'setting' => 'forms__contact_forms_test',
400400
'ajax' => true
401401
),
402+
'WPZOOMForms' => array(
403+
'hook' => 'admin_post_nopriv_wpzf_submit',
404+
'setting' => 'forms__contact_forms_test',
405+
'ajax' => false
406+
),
407+
'Newsletter' => array(
408+
'hook' => 'newsletter_action',
409+
'setting' => 'forms__contact_forms_test',
410+
'ajax' => false
411+
),
412+
'ChatyContactForm' => array(
413+
'hook' => 'chaty_front_form_save_data',
414+
'setting' => 'forms__contact_forms_test',
415+
'ajax' => true
416+
),
402417
);
403418

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

inc/cleantalk-pluggable.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,7 @@ function apbct_is_skip_request($ajax = false, $ajax_message_obj = array())
695695
'wcf_woocommerce_login', //WooCommerce CartFlows login
696696
'nasa_process_login', //Nasa login
697697
'leaky_paywall_validate_registration', //Leaky Paywall validation request
698+
'cleantalk_force_ajax_check', //Force ajax check has direct integration
698699
);
699700

700701
// Skip test if
@@ -1324,6 +1325,7 @@ function apbct_is_skip_request($ajax = false, $ajax_message_obj = array())
13241325
) &&
13251326
Post::get('action') === 'edd_add_to_cart' ||
13261327
Post::get('action') === 'edd_get_shipping_rate' ||
1328+
Post::get('action') === 'edd_check_email' ||
13271329
Post::get('action') === 'edd_recalculate_discounts_pro'
13281330
) {
13291331
return 'Easy Digital Downloads service action';
@@ -1521,6 +1523,22 @@ class_exists('Cleantalk\Antispam\Integrations\CleantalkInternalForms')
15211523
) {
15221524
return 'fusion_form/avada_theme skip';
15231525
}
1526+
1527+
// skip Newsletter - has direct integration
1528+
if (
1529+
apbct_is_plugin_active('newsletter/plugin.php') &&
1530+
Request::getString('action') === 'tnp'
1531+
) {
1532+
return 'Newsletter';
1533+
}
1534+
1535+
// skip ChatyContactForm - has direct integration
1536+
if (
1537+
apbct_is_plugin_active('chaty/cht-icons.php') &&
1538+
Request::getString('action') === 'chaty_front_form_save_data'
1539+
) {
1540+
return 'ChatyContactForm';
1541+
}
15241542
} else {
15251543
/*****************************************/
15261544
/* Here is non-ajax requests skipping */

inc/cleantalk-public-integrations.php

Lines changed: 7 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -206,70 +206,6 @@ function ct_woocommerce_wishlist_check($args)
206206
return $args;
207207
}
208208

209-
210-
/**
211-
* Test default search string for spam
212-
*
213-
* @param $search string
214-
*
215-
* @return string
216-
*/
217-
function apbct_forms__search__testSpam($search)
218-
{
219-
global $apbct, $cleantalk_executed;
220-
221-
if (
222-
empty($search) ||
223-
$cleantalk_executed ||
224-
$apbct->settings['forms__search_test'] == 0 ||
225-
($apbct->settings['data__protect_logged_in'] != 1 && is_user_logged_in()) // Skip processing for logged in users.
226-
) {
227-
do_action('apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST);
228-
229-
return $search;
230-
}
231-
232-
$user = apbct_is_user_logged_in() ? wp_get_current_user() : null;
233-
234-
$base_call_result = apbct_base_call(
235-
array(
236-
'message' => $search,
237-
'sender_email' => $user !== null ? $user->user_email : null,
238-
'sender_nickname' => $user !== null ? $user->user_login : null,
239-
'post_info' => array('comment_type' => 'site_search_wordpress'),
240-
'exception_action' => 0,
241-
)
242-
);
243-
244-
if ( isset($base_call_result['ct_result']) ) {
245-
$ct_result = $base_call_result['ct_result'];
246-
247-
$cleantalk_executed = true;
248-
249-
if ( $ct_result->allow == 0 ) {
250-
die($ct_result->comment);
251-
}
252-
}
253-
254-
return $search;
255-
}
256-
257-
function apbct_search_add_noindex()
258-
{
259-
global $apbct;
260-
261-
if (
262-
! is_search() || // If it is search results
263-
$apbct->settings['forms__search_test'] == 0 ||
264-
($apbct->settings['data__protect_logged_in'] != 1 && is_user_logged_in()) // Skip processing for logged in users.
265-
) {
266-
return;
267-
}
268-
269-
echo '<!-- meta by CleanTalk Anti-Spam Protection plugin -->' . "\n";
270-
echo '<meta name="robots" content="noindex,nofollow" />' . "\n";
271-
}
272-
273209
/**
274210
* Public function - Tests for Pirate contact forms
275211
* return NULL
@@ -2729,6 +2665,7 @@ function apbct_form__gravityForms__addField($form_string, $form)
27292665
* Gravity forms anti-spam test.
27302666
* @return boolean
27312667
* @psalm-suppress UnusedVariable
2668+
* @psalm-suppress ArgumentTypeCoercion
27322669
*/
27332670
function apbct_form__gravityForms__testSpam($is_spam, $form, $entry)
27342671
{
@@ -2861,7 +2798,12 @@ function apbct_form__gravityForms__testSpam($is_spam, $form, $entry)
28612798
$is_spam = true;
28622799
$ct_gform_is_spam = true;
28632800
$ct_gform_response = $ct_result->comment;
2864-
add_action('gform_entry_created', 'apbct_form__gravityForms__add_entry_note');
2801+
if ( isset($apbct->settings['forms__gravityforms_save_spam']) && $apbct->settings['forms__gravityforms_save_spam'] == 1 ) {
2802+
add_action('gform_entry_created', 'apbct_form__gravityForms__add_entry_note');
2803+
} elseif ( class_exists('GFFormsModel') && method_exists('GFFormsModel', 'delete_lead') ) {
2804+
/** @psalm-suppress UndefinedClass */
2805+
GFFormsModel::delete_lead($entry['id']);
2806+
}
28652807
}
28662808
}
28672809

@@ -3440,53 +3382,6 @@ function apbct_form_happyforms_test_spam($is_valid, $request, $_form)
34403382
return $is_valid;
34413383
}
34423384

3443-
/**
3444-
* Prepare data to add honeypot to the WordPress default search form.
3445-
* Fires ct_add_honeypot_field() on hook get_search_form when:
3446-
* - method of the form is post
3447-
* - spam test of search form is enabled
3448-
*
3449-
* @param string $form_html
3450-
* @return string
3451-
*/
3452-
function apbct_form_search__add_fields($form_html)
3453-
{
3454-
global $apbct;
3455-
3456-
if ( !empty($form_html) && is_string($form_html) && $apbct->settings['forms__search_test'] == 1 ) {
3457-
// extract method of the form with DOMDocument
3458-
if ( class_exists('DOMDocument') ) {
3459-
libxml_use_internal_errors(true);
3460-
$dom = new DOMDocument();
3461-
if ( @$dom->loadHTML($form_html) ) {
3462-
$search_form_dom = $dom->getElementById('searchform');
3463-
if ( !empty($search_form_dom) ) {
3464-
$method = empty($search_form_dom->getAttribute('method'))
3465-
//default method is get for any form if no method specified
3466-
? 'get'
3467-
: $search_form_dom->getAttribute('method');
3468-
}
3469-
}
3470-
libxml_clear_errors();
3471-
unset($dom);
3472-
}
3473-
3474-
// retry extract method of the form with regex
3475-
if ( empty($method) ) {
3476-
preg_match('/form.*method="(.*?)"/', $form_html, $matches);
3477-
$method = empty($matches[1])
3478-
? 'get'
3479-
: trim($matches[1]);
3480-
}
3481-
3482-
$form_method = strtolower($method);
3483-
3484-
return str_replace('</form>', Honeypot::generateHoneypotField('search_form', $form_method) . '</form>', $form_html);
3485-
}
3486-
3487-
return $form_html;
3488-
}
3489-
34903385
/**
34913386
* Advanced Classifieds & Directory Pro
34923387
*

inc/cleantalk-public-validate.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,21 @@ function_exists('hivepress') &&
398398
),
399399
)
400400
);
401+
} else if (
402+
// BuddyBoss App - request from mobile app usually
403+
apbct_is_plugin_active('buddyboss-app/buddyboss-app.php') &&
404+
Server::getString('REQUEST_URI') === '/wp-json/buddyboss-app/v1/signup'
405+
) {
406+
$data = [
407+
'code' => 'bp_rest_register_errors',
408+
'message' => [
409+
'signup_email' => $ct_result->comment
410+
],
411+
'data' => [
412+
'status' => 403,
413+
],
414+
];
415+
wp_send_json($data);
401416
} else {
402417
ct_die(null, null);
403418
}

0 commit comments

Comments
 (0)