Skip to content

Commit 87b80d6

Browse files
authored
Merge pull request #802 from CleanTalk/beta
Beta
2 parents 148232d + dc8dd0e commit 87b80d6

38 files changed

Lines changed: 1046 additions & 339 deletions

cleantalk.php

Lines changed: 12 additions & 15 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.79.1
7+
Version: 6.80
88
Author: CleanTalk - Anti-Spam Protection <welcome@cleantalk.org>
99
Author URI: https://cleantalk.org
1010
Text Domain: cleantalk-spam-protect
@@ -135,7 +135,9 @@
135135
define('APBCT_MODERATE_URL', 'https://moderate.cleantalk.org'); // Api URL
136136
}
137137

138-
define('APBCT_BOT_DETECTOR_SCRIPT_URL', 'https://fd.cleantalk.org/ct-bot-detector-wrapper.js');
138+
if ( ! defined('APBCT_BOT_DETECTOR_SCRIPT_URL') ) {
139+
define('APBCT_BOT_DETECTOR_SCRIPT_URL', 'https://fd.cleantalk.org/ct-bot-detector-wrapper.js');
140+
}
139141

140142
/**
141143
* Require base classes.
@@ -2132,18 +2134,11 @@ function apbct_rc__install_plugin($_wp = null, $plugin = null)
21322134
} else {
21332135
die('FAIL ' . json_encode(array('error' => $installer->apbct_result)));
21342136
}
2135-
} elseif ( $result instanceof \WP_Error ) {
2136-
die(
2137-
'FAIL ' . json_encode(array(
2138-
'error' => 'FAIL_TO_GET_LATEST_VERSION',
2139-
'details' => $result->get_error_message(),
2140-
))
2141-
);
21422137
} else {
21432138
die(
21442139
'FAIL ' . json_encode(array(
21452140
'error' => 'FAIL_TO_GET_LATEST_VERSION',
2146-
'details' => 'Unknown error',
2141+
'details' => $result->get_error_message(),
21472142
))
21482143
);
21492144
}
@@ -2177,16 +2172,18 @@ function apbct_rc__activate_plugin($plugin)
21772172
$result = activate_plugins($plugin);
21782173

21792174
$result_array = array('success' => true);
2180-
$error_msg = '';
21812175

2182-
if ( ! $result || is_wp_error($result) ) {
2183-
if ( $result instanceof \WP_Error ) {
2184-
$error_msg = ' ' . $result->get_error_message();
2185-
}
2176+
if ( is_wp_error($result) ) {
2177+
$error_msg = ' ' . $result->get_error_message();
21862178
$result_array = array(
21872179
'error' => 'FAIL_TO_ACTIVATE',
21882180
'details' => $error_msg
21892181
);
2182+
} elseif ( ! $result ) {
2183+
$result_array = array(
2184+
'error' => 'FAIL_TO_ACTIVATE',
2185+
'details' => ''
2186+
);
21902187
}
21912188
return $result_array;
21922189
} else {

inc/cleantalk-ajax.php

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -906,23 +906,6 @@ function ct_ajax_hook($message_obj = null)
906906
die();
907907
}
908908

909-
// Plugin Name: User Registration; ajax register action user_registration_user_form_submit
910-
if (
911-
(
912-
apbct_is_plugin_active('user-registration/user-registration.php')
913-
||
914-
apbct_is_plugin_active('user-registration-pro/user-registration.php')
915-
) &&
916-
Post::get('action') === 'user_registration_user_form_submit'
917-
) {
918-
wp_send_json_error(
919-
array(
920-
'message' => $ct_result->comment
921-
)
922-
);
923-
die();
924-
}
925-
926909
// Plugin Name: eForm - WordPress Form Builder; ajax action ipt_fsqm_save_form
927910
if (
928911
apbct_is_plugin_active('wp-fsqm-pro/ipt_fsqm.php') &&

inc/cleantalk-public.php

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -851,11 +851,15 @@ function ct_die($_comment_id, $_comment_status)
851851
$ct_die_page = str_replace($place_holder, (is_null($replace) ? '' : $replace), $ct_die_page);
852852
}
853853

854-
http_response_code(200);
854+
if ( ! headers_sent() ) {
855+
http_response_code(200);
856+
}
855857
die($ct_die_page);
856858
}
857859

858-
http_response_code(200);
860+
if ( ! headers_sent() ) {
861+
http_response_code(200);
862+
}
859863
die("Forbidden. Sender blacklisted. Blocked by CleanTalk");
860864
}
861865

@@ -901,7 +905,9 @@ function ct_die_extended($comment_body)
901905
$ct_die_page = str_replace($place_holder, $replace, $ct_die_page);
902906
}
903907

904-
http_response_code(200);
908+
if ( ! headers_sent() ) {
909+
http_response_code(200);
910+
}
905911
$allowed_html = array(
906912
'html' => array(
907913
'lang' => array(),
@@ -938,7 +944,9 @@ function ct_die_extended($comment_body)
938944
die($content);
939945
}
940946

941-
http_response_code(200);
947+
if ( ! headers_sent() ) {
948+
http_response_code(200);
949+
}
942950
die("Forbidden. Sender blacklisted. Blocked by CleanTalk");
943951
}
944952

@@ -1039,20 +1047,6 @@ function ct_set_approved($approved, $_comment)
10391047
return 1;
10401048
}
10411049

1042-
/**
1043-
* Public action 'comment_post' - Store cleantalk hash in comment meta
1044-
*
1045-
* @psalm-suppress UnusedParam
1046-
* @return void
1047-
*/
1048-
function ct_set_real_user_badge_automod_hash($comment_id)
1049-
{
1050-
$hash1 = ct_hash();
1051-
if ( ! empty($hash1) ) {
1052-
update_comment_meta($comment_id, 'ct_real_user_badge_automod_hash', ct_hash());
1053-
}
1054-
}
1055-
10561050
/**
10571051
* Public filter 'pre_comment_approved' - Mark comment unapproved always
10581052
* @return string

inc/cleantalk-settings.php

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ function apbct_settings_add_page()
6363
global $apbct;
6464

6565
$filtered = ($value === '1' || $value === 1) ? '1' : '0';
66+
//sync discussion and plugin settings
6667
if ($old_value !== $filtered) {
6768
$apbct->settings['cleantalk_allowed_moderation'] = $filtered;
6869
$apbct->saveSettings();
@@ -169,16 +170,6 @@ function apbct_settings__set_fields()
169170
'html_before' => '<hr>',
170171
'html_after' => '',
171172
'fields' => array(
172-
'comments__hide_website_field' => array(
173-
'type' => 'checkbox',
174-
'title' => __('Hide the "Website" field', 'cleantalk-spam-protect'),
175-
'description' => __(
176-
'This option hides the "Website" field on the comment form.',
177-
'cleantalk-spam-protect'
178-
),
179-
'long_description' => true,
180-
'display' => ! $apbct->white_label,
181-
),
182173
'comments__the_real_person' => array(
183174
'type' => 'checkbox',
184175
'title' => __('The Real Person Badge!', 'cleantalk-spam-protect')
@@ -927,6 +918,12 @@ function apbct_settings__set_fields()
927918
'section' => 'hidden_section',
928919
'html_after' => '</div><div id="apbct_hidden_section_nav">{HIDDEN_SECTION_NAV}<div class="apbct_hidden_section_nav_mob_btn"></div></div></div>',
929920
'fields' => array(
921+
'comments__hide_website_field' => array(
922+
'type' => 'checkbox',
923+
'title' => __('Hide the "Website" field', 'cleantalk-spam-protect'),
924+
'long_description' => true,
925+
'display' => ! $apbct->white_label,
926+
),
930927
'misc__send_connection_reports' => array(
931928
'type' => 'checkbox',
932929
'title' => __('Send connection reports', 'cleantalk-spam-protect'),
@@ -2108,7 +2105,7 @@ function apbct_discussion_settings__field__moderation()
21082105
name="cleantalk_allowed_moderation"
21092106
id="cleantalk_allowed_moderation"
21102107
value="1" ' .
2111-
checked('1', $apbct->settings['cleantalk_allowed_moderation'], false) .
2108+
checked('1', TT::toString($apbct->settings['cleantalk_allowed_moderation'], '0'), false) .
21122109
'/> ';
21132110
$output .= esc_html__('Skip manual approving for the very first comment if a comment has been allowed by CleanTalk Anti-Spam protection.', 'cleantalk-spam-protect');
21142111
$output .= '</label>';
@@ -2582,6 +2579,11 @@ function apbct_settings__validate($incoming_settings)
25822579
$incoming_settings['data__email_decoder_obfuscation_custom_text'] = ContactsEncoder::getDefaultReplacingText();
25832580
}
25842581

2582+
//sync discussion and plugin settings
2583+
if (isset($incoming_settings['cleantalk_allowed_moderation'])) {
2584+
update_option('cleantalk_allowed_moderation', TT::toString($incoming_settings['cleantalk_allowed_moderation'], '0'));
2585+
}
2586+
25852587
/**
25862588
* Triggered before returning the settings
25872589
*/
@@ -3064,8 +3066,12 @@ function apbct_settings__get__long_description()
30643066
'title' => 'Anti-Crawler', // Do not to localize this phrase
30653067
//HANDLE LINK
30663068
'desc' => sprintf(
3067-
__(esc_html__($apbct->data['wl_brandname']) . ' Anti-Crawler — this option is meant to block all types of bots visiting website pages that can search vulnerabilities on a website, attempt to hack a site, collect personal data, price parsing or content and images, generate 404 error pages, or aggressive website scanning bots. %s', 'cleantalk-spam-protect'),
3068-
'<a href="https://cleantalk.org/help/anti-flood-and-anti-crawler{utm_mark}#anticrawl" target="_blank">' . __('Learn more.', 'cleantalk-spam-protect') . '</a>'
3069+
'<p>' . sprintf(
3070+
__('%1$s Anti-Crawler — this option is meant to block all types of bots visiting website pages that can search vulnerabilities on a website, attempt to hack a site, collect personal data, price parsing or content and images, generate 404 error pages, or aggressive website scanning bots. %2$s', 'cleantalk-spam-protect'),
3071+
esc_html($apbct->data['wl_brandname']),
3072+
'<a href="https://cleantalk.org/help/anti-flood-and-anti-crawler{utm_mark}#anticrawl" target="_blank">' . __('Learn more.', 'cleantalk-spam-protect') . '</a>'
3073+
) . '</p>' .
3074+
'<p>' . __('By default, well-known good bots are allowed, including AI crawlers like GPTBot (ChatGPT), ClaudeBot (Claude), Google-Extended (Gemini), and Copilot. You can selectively block any of these bots in your private lists.', 'cleantalk-spam-protect') . '</p>'
30693075
)
30703076
),
30713077
'sfw__anti_flood' => array(

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.

js/apbct-public-bundle_ext-protection_gathering.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_full-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.

js/apbct-public-bundle_full-protection_gathering.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_gathering.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)