Version Description
Jun 16 2022 =
Email Encoder functionality improved, SFW updating process improved and some minor issues fixed.
- New. EmailEncoder.php->modifyContent. Admins and logged in exclusions.
- Fix. Email encoder. Prevent encoding data for logged in users.
- Fix. Queue. Return statement from executeStage() method added.
- Fix. SFW. Updating process fixed.
- Fix. SFW. SFW update worker fixed.
- Mod: Using the shutdown hook to call a function ct_contact_form_validate().
- Fix. apbct_sfw_update__worker. Clear errors if stage is finished.
- Fix. HTTP lib. Useragent for WP HTTP API requests fixed.
- Fix. cleantalk_external. Exclusion for tp.media booking forms.
- Fix. cleantalk_external. Exclusion for flodesk forms.
- Mod: Replace apbct_update_actions() to upgrader_process_complete hook
- Fix. cleantalk_external.js->ct_protect_external(). Exclusion for tp.media booking forms.
- Fix. RemoteCalls. No cache parameter added.
- Fix. apbct_remove_upd_folder(). Force unknown file deletion ('.last.jpegoptim')
- Fix. apbct_remove_upd_folder(). Add chek if a strange file is a file and exists.
- Fix. GetFieldsAny.php. Decode email if it is urlencoded.
- Fix. cleantalk-public-validate.php. Add JS check to public forms.
- Mod: Refactoring User Scanner
- Fixed apbct_cookies_test cookie
- Upd. JS. Cookies has_scrolling and mouse_moved optimized.
- Upd. Email encoder. Links mailto: processed.
Download this release
Release Info
Developer | glomberg |
Plugin | Spam protection, AntiSpam, FireWall by CleanTalk |
Version | 5.179 |
Comparing to | |
See all releases |
Code changes from version 5.178 to 5.179
- cleantalk.php +81 -19
- inc/cleantalk-common.php +66 -0
- inc/cleantalk-public-validate.php +11 -2
- inc/cleantalk-public.php +0 -26
- inc/cleantalk-settings.php +1 -1
- js/apbct-public--functions.min.js +1 -1
- js/apbct-public--functions.min.js.map +1 -1
- js/apbct-public.min.js +1 -1
- js/apbct-public.min.js.map +1 -1
- js/cleantalk-users-checkspam.min.js +1 -1
- js/cleantalk-users-checkspam.min.js.map +1 -1
- js/cleantalk_external.min.js +1 -1
- js/cleantalk_external.min.js.map +1 -1
- lib/Cleantalk/Antispam/Cleantalk.php +0 -1
- lib/Cleantalk/Antispam/EmailEncoder.php +134 -20
- lib/Cleantalk/ApbctWP/FindSpam/UsersChecker.php +353 -184
- lib/Cleantalk/ApbctWP/FindSpam/UsersScanParameters.php +99 -0
- lib/Cleantalk/ApbctWP/FindSpam/UsersScanResponse.php +179 -0
- lib/Cleantalk/ApbctWP/GetFieldsAny.php +2 -0
- lib/Cleantalk/ApbctWP/HTTP/Request.php +28 -0
- lib/Cleantalk/ApbctWP/Helper.php +2 -1
- lib/Cleantalk/Common/HTTP/Request.php +2 -2
- lib/Cleantalk/Common/Queue.php +2 -0
- lib/Cleantalk/Common/Validate.php +12 -0
- readme.txt +24 -0
cleantalk.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
Plugin Name: Anti-Spam by CleanTalk
|
5 |
Plugin URI: https://cleantalk.org
|
6 |
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: 5.
|
8 |
Author: СleanTalk <welcome@cleantalk.org>
|
9 |
Author URI: https://cleantalk.org
|
10 |
Text Domain: cleantalk-spam-protect
|
@@ -188,12 +188,36 @@ $apbct->db_prefix = ! $apbct->white_label && defined('CLEANTALK_ACCESS_KEY') ? $
|
|
188 |
if ( $apbct->plugin_version === '1.0.0' ) {
|
189 |
$apbct->plugin_version = '5.100';
|
190 |
}
|
191 |
-
// Do update actions if version is changed
|
192 |
-
apbct_update_actions();
|
193 |
|
194 |
/**
|
195 |
-
*
|
|
|
|
|
|
|
|
|
|
|
196 |
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
197 |
add_action('init', function () {
|
198 |
global $apbct;
|
199 |
// Self cron
|
@@ -211,7 +235,7 @@ add_action('init', function () {
|
|
211 |
if ( is_array($cron_res) ) {
|
212 |
foreach ( $cron_res as $_task => $res ) {
|
213 |
if ( $res === true ) {
|
214 |
-
$apbct->errorDelete('cron',
|
215 |
} else {
|
216 |
$apbct->errorAdd('cron', $res);
|
217 |
}
|
@@ -582,14 +606,6 @@ if ( is_admin() || is_network_admin() ) {
|
|
582 |
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public-validate.php');
|
583 |
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
|
584 |
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public-integrations.php');
|
585 |
-
//Bitrix24 contact form
|
586 |
-
if ( $apbct->settings['forms__general_contact_forms_test'] == 1 &&
|
587 |
-
! empty(Post::get('your-phone')) &&
|
588 |
-
! empty(Post::get('your-email')) &&
|
589 |
-
! empty(Post::get('your-message'))
|
590 |
-
) {
|
591 |
-
ct_contact_form_validate();
|
592 |
-
}
|
593 |
|
594 |
// Sends feedback to the cloud about comments
|
595 |
// add_action('wp_set_comment_status', 'ct_comment_send_feedback', 10, 2);
|
@@ -610,6 +626,14 @@ if ( is_admin() || is_network_admin() ) {
|
|
610 |
|
611 |
add_filter('plugin_row_meta', 'apbct_admin__register_plugin_links', 10, 3);
|
612 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
613 |
// Public pages actions
|
614 |
} else {
|
615 |
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public-validate.php');
|
@@ -654,6 +678,14 @@ if ( is_admin() || is_network_admin() ) {
|
|
654 |
ct_contact_form_validate();
|
655 |
$_POST['redirect_to'] = $tmp;
|
656 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
657 |
}
|
658 |
|
659 |
// Short code for GDPR
|
@@ -971,12 +1003,14 @@ function apbct_sfw_update__worker($checker_work = false)
|
|
971 |
{
|
972 |
global $apbct;
|
973 |
|
974 |
-
usleep(10000);
|
975 |
-
|
976 |
if ( ! $apbct->data['key_is_ok'] ) {
|
977 |
return array('error' => 'Worker: KEY_IS_NOT_VALID');
|
978 |
}
|
979 |
|
|
|
|
|
|
|
|
|
980 |
if ( ! $checker_work ) {
|
981 |
if (
|
982 |
Request::equal('firewall_updating_id', '') ||
|
@@ -1009,6 +1043,22 @@ function apbct_sfw_update__worker($checker_work = false)
|
|
1009 |
|
1010 |
$result = $queue->executeStage();
|
1011 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1012 |
if ( isset($result['error']) && $result['status'] === 'FINISHED' ) {
|
1013 |
$apbct->errorAdd('sfw_update', $result['error']);
|
1014 |
$apbct->saveErrors();
|
@@ -1022,10 +1072,10 @@ function apbct_sfw_update__worker($checker_work = false)
|
|
1022 |
$queue->queue['finished'] = time();
|
1023 |
$queue->saveQueue($queue->queue);
|
1024 |
foreach ( $queue->queue['stages'] as $stage ) {
|
1025 |
-
if ( isset($stage['error']) ) {
|
1026 |
//there could be an array of errors of files processed
|
1027 |
-
if (is_array($stage['error'])){
|
1028 |
-
$error = implode(" ",array_values($stage['error']));
|
1029 |
} else {
|
1030 |
$error = $result['error'];
|
1031 |
}
|
@@ -1092,6 +1142,7 @@ function apbct_sfw_update__get_multifiles()
|
|
1092 |
} else {
|
1093 |
return $result;
|
1094 |
}
|
|
|
1095 |
}
|
1096 |
|
1097 |
function apbct_sfw_update__download_files($urls)
|
@@ -1503,6 +1554,17 @@ function apbct_remove_upd_folder($dir_name)
|
|
1503 |
}
|
1504 |
}
|
1505 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1506 |
rmdir($dir_name);
|
1507 |
}
|
1508 |
}
|
@@ -2269,7 +2331,7 @@ function apbct_cookie()
|
|
2269 |
// Cookies test
|
2270 |
$cookie_test_value['check_value'] = md5($cookie_test_value['check_value']);
|
2271 |
if ( $apbct->data['cookies_type'] === 'native' ) {
|
2272 |
-
Cookie::set('apbct_cookies_test',
|
2273 |
}
|
2274 |
|
2275 |
$apbct->flags__cookies_setuped = true;
|
4 |
Plugin Name: Anti-Spam by CleanTalk
|
5 |
Plugin URI: https://cleantalk.org
|
6 |
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: 5.179
|
8 |
Author: СleanTalk <welcome@cleantalk.org>
|
9 |
Author URI: https://cleantalk.org
|
10 |
Text Domain: cleantalk-spam-protect
|
188 |
if ( $apbct->plugin_version === '1.0.0' ) {
|
189 |
$apbct->plugin_version = '5.100';
|
190 |
}
|
|
|
|
|
191 |
|
192 |
/**
|
193 |
+
* This function runs when WordPress completes its upgrade process
|
194 |
+
* It iterates through each plugin updated to see if ours is included
|
195 |
+
*
|
196 |
+
* @param $upgrader WP_Upgrader
|
197 |
+
* @param $options Array
|
198 |
+
*
|
199 |
*/
|
200 |
+
function apbct_upgrader_process_complete($_upgrader, $options)
|
201 |
+
{
|
202 |
+
$our_plugin = APBCT_PLUGIN_BASE_NAME;
|
203 |
+
|
204 |
+
// If an update has taken place and the updated type is plugins and the plugin's element exists
|
205 |
+
if ($options['action'] === 'update' && $options['type'] === 'plugin' && isset($options['plugins'])) {
|
206 |
+
// Iterate through the plugins being updated and check if ours is there
|
207 |
+
|
208 |
+
foreach ($options['plugins'] as $plugin) {
|
209 |
+
if ($plugin === $our_plugin) {
|
210 |
+
apbct_update_actions();
|
211 |
+
}
|
212 |
+
}
|
213 |
+
}
|
214 |
+
}
|
215 |
+
// compatibility with old version
|
216 |
+
if (version_compare($apbct->plugin_version, '5.179') === -1) {
|
217 |
+
apbct_update_actions();
|
218 |
+
}
|
219 |
+
add_action('upgrader_process_complete', 'apbct_upgrader_process_complete', 10, 2);
|
220 |
+
|
221 |
add_action('init', function () {
|
222 |
global $apbct;
|
223 |
// Self cron
|
235 |
if ( is_array($cron_res) ) {
|
236 |
foreach ( $cron_res as $_task => $res ) {
|
237 |
if ( $res === true ) {
|
238 |
+
$apbct->errorDelete('cron', true);
|
239 |
} else {
|
240 |
$apbct->errorAdd('cron', $res);
|
241 |
}
|
606 |
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public-validate.php');
|
607 |
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
|
608 |
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public-integrations.php');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
609 |
|
610 |
// Sends feedback to the cloud about comments
|
611 |
// add_action('wp_set_comment_status', 'ct_comment_send_feedback', 10, 2);
|
626 |
|
627 |
add_filter('plugin_row_meta', 'apbct_admin__register_plugin_links', 10, 3);
|
628 |
}
|
629 |
+
|
630 |
+
/**
|
631 |
+
* This hook is triggered if the request is from a form
|
632 |
+
* with which we did not integrate.
|
633 |
+
*/
|
634 |
+
if (apbct_need_to_process_unknown_post_request()) {
|
635 |
+
add_action('shutdown', 'ct_contact_form_validate', 999);
|
636 |
+
}
|
637 |
// Public pages actions
|
638 |
} else {
|
639 |
require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public-validate.php');
|
678 |
ct_contact_form_validate();
|
679 |
$_POST['redirect_to'] = $tmp;
|
680 |
}
|
681 |
+
|
682 |
+
/**
|
683 |
+
* This hook is triggered if the request is from a form
|
684 |
+
* with which we did not integrate.
|
685 |
+
*/
|
686 |
+
if (apbct_need_to_process_unknown_post_request()) {
|
687 |
+
add_action('shutdown', 'ct_contact_form_validate', 999);
|
688 |
+
}
|
689 |
}
|
690 |
|
691 |
// Short code for GDPR
|
1003 |
{
|
1004 |
global $apbct;
|
1005 |
|
|
|
|
|
1006 |
if ( ! $apbct->data['key_is_ok'] ) {
|
1007 |
return array('error' => 'Worker: KEY_IS_NOT_VALID');
|
1008 |
}
|
1009 |
|
1010 |
+
if ( ! $apbct->settings['sfw__enabled'] ) {
|
1011 |
+
return false;
|
1012 |
+
}
|
1013 |
+
|
1014 |
if ( ! $checker_work ) {
|
1015 |
if (
|
1016 |
Request::equal('firewall_updating_id', '') ||
|
1043 |
|
1044 |
$result = $queue->executeStage();
|
1045 |
|
1046 |
+
if ( $result === null ) {
|
1047 |
+
// The stage is in progress, will try to wait up to 5 seconds to its complete
|
1048 |
+
for ( $i = 0; $i < 5; $i++ ) {
|
1049 |
+
sleep(1);
|
1050 |
+
$queue->refreshQueue();
|
1051 |
+
if ( ! $queue->isQueueInProgress() ) {
|
1052 |
+
// The stage executed, break waiting and continue sfw_update__worker process
|
1053 |
+
break;
|
1054 |
+
}
|
1055 |
+
if ( $i >= 4 ) {
|
1056 |
+
// The stage still not executed, exit from sfw_update__worker
|
1057 |
+
return true;
|
1058 |
+
}
|
1059 |
+
}
|
1060 |
+
}
|
1061 |
+
|
1062 |
if ( isset($result['error']) && $result['status'] === 'FINISHED' ) {
|
1063 |
$apbct->errorAdd('sfw_update', $result['error']);
|
1064 |
$apbct->saveErrors();
|
1072 |
$queue->queue['finished'] = time();
|
1073 |
$queue->saveQueue($queue->queue);
|
1074 |
foreach ( $queue->queue['stages'] as $stage ) {
|
1075 |
+
if ( isset($stage['error'], $stage['status']) && $stage['status'] !== 'FINISHED' ) {
|
1076 |
//there could be an array of errors of files processed
|
1077 |
+
if ( is_array($stage['error']) ) {
|
1078 |
+
$error = implode(" ", array_values($stage['error']));
|
1079 |
} else {
|
1080 |
$error = $result['error'];
|
1081 |
}
|
1142 |
} else {
|
1143 |
return $result;
|
1144 |
}
|
1145 |
+
return null;
|
1146 |
}
|
1147 |
|
1148 |
function apbct_sfw_update__download_files($urls)
|
1554 |
}
|
1555 |
}
|
1556 |
|
1557 |
+
//add more paths if some strange files has been detected
|
1558 |
+
$non_cleantalk_files_filepaths = array(
|
1559 |
+
$dir_name . '.last.jpegoptim'
|
1560 |
+
);
|
1561 |
+
|
1562 |
+
foreach ( $non_cleantalk_files_filepaths as $filepath ) {
|
1563 |
+
if ( file_exists($filepath) && is_file($filepath) && !is_writable($filepath) ) {
|
1564 |
+
unlink($filepath);
|
1565 |
+
}
|
1566 |
+
}
|
1567 |
+
|
1568 |
rmdir($dir_name);
|
1569 |
}
|
1570 |
}
|
2331 |
// Cookies test
|
2332 |
$cookie_test_value['check_value'] = md5($cookie_test_value['check_value']);
|
2333 |
if ( $apbct->data['cookies_type'] === 'native' ) {
|
2334 |
+
Cookie::set('apbct_cookies_test', json_encode($cookie_test_value), 0, '/', $domain, null, true);
|
2335 |
}
|
2336 |
|
2337 |
$apbct->flags__cookies_setuped = true;
|
inc/cleantalk-common.php
CHANGED
@@ -10,6 +10,7 @@ use Cleantalk\ApbctWP\GetFieldsAny;
|
|
10 |
use Cleantalk\ApbctWP\Helper;
|
11 |
use Cleantalk\ApbctWP\Variables\Cookie;
|
12 |
use Cleantalk\Common\DB;
|
|
|
13 |
use Cleantalk\Variables\Post;
|
14 |
use Cleantalk\Variables\Server;
|
15 |
|
@@ -1246,3 +1247,68 @@ function apbct__wc_add_honeypot_field($fields)
|
|
1246 |
|
1247 |
return $fields;
|
1248 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
use Cleantalk\ApbctWP\Helper;
|
11 |
use Cleantalk\ApbctWP\Variables\Cookie;
|
12 |
use Cleantalk\Common\DB;
|
13 |
+
use Cleantalk\Variables\Get;
|
14 |
use Cleantalk\Variables\Post;
|
15 |
use Cleantalk\Variables\Server;
|
16 |
|
1247 |
|
1248 |
return $fields;
|
1249 |
}
|
1250 |
+
|
1251 |
+
/**
|
1252 |
+
* The function determines whether it is necessary
|
1253 |
+
* to conduct a general check of the post request
|
1254 |
+
*
|
1255 |
+
* @return boolean
|
1256 |
+
*/
|
1257 |
+
function apbct_need_to_process_unknown_post_request()
|
1258 |
+
{
|
1259 |
+
global $apbct;
|
1260 |
+
|
1261 |
+
/** Exclude Ajax requests */
|
1262 |
+
if ( apbct_is_ajax() ) {
|
1263 |
+
return false;
|
1264 |
+
}
|
1265 |
+
|
1266 |
+
/** Bitrix24 contact form */
|
1267 |
+
if ( $apbct->settings['forms__general_contact_forms_test'] == 1 &&
|
1268 |
+
! empty(Post::get('your-phone')) &&
|
1269 |
+
! empty(Post::get('your-email')) &&
|
1270 |
+
! empty(Post::get('your-message'))
|
1271 |
+
) {
|
1272 |
+
return true;
|
1273 |
+
}
|
1274 |
+
|
1275 |
+
/** VFB_Pro integration */
|
1276 |
+
if (
|
1277 |
+
! empty($_POST) &&
|
1278 |
+
$apbct->settings['forms__contact_forms_test'] == 1 &&
|
1279 |
+
empty(Post::get('ct_checkjs_cf7')) &&
|
1280 |
+
apbct_is_plugin_active('vfb-pro/vfb-pro.php') &&
|
1281 |
+
! empty(Post::get('_vfb-form-id'))
|
1282 |
+
) {
|
1283 |
+
return true;
|
1284 |
+
}
|
1285 |
+
|
1286 |
+
/** Integration with custom forms */
|
1287 |
+
if (
|
1288 |
+
! empty($_POST) &&
|
1289 |
+
apbct_custom_forms_trappings()
|
1290 |
+
) {
|
1291 |
+
return true;
|
1292 |
+
}
|
1293 |
+
|
1294 |
+
if (
|
1295 |
+
$apbct->settings['forms__general_contact_forms_test'] == 1 &&
|
1296 |
+
empty(Post::get('ct_checkjs_cf7')) &&
|
1297 |
+
! apbct_is_direct_trackback()
|
1298 |
+
) {
|
1299 |
+
return true;
|
1300 |
+
}
|
1301 |
+
|
1302 |
+
if ( apbct_is_user_enable() ) {
|
1303 |
+
if (
|
1304 |
+
$apbct->settings['forms__general_contact_forms_test'] == 1 &&
|
1305 |
+
! Post::get('comment_post_ID') &&
|
1306 |
+
! Get::get('for') &&
|
1307 |
+
! apbct_is_direct_trackback()
|
1308 |
+
) {
|
1309 |
+
return true;
|
1310 |
+
}
|
1311 |
+
}
|
1312 |
+
|
1313 |
+
return false;
|
1314 |
+
}
|
inc/cleantalk-public-validate.php
CHANGED
@@ -7,7 +7,7 @@ use Cleantalk\Variables\Server;
|
|
7 |
*/
|
8 |
function ct_contact_form_validate()
|
9 |
{
|
10 |
-
global $pagenow, $apbct, $ct_checkjs_frm;
|
11 |
|
12 |
// Exclude the XML-RPC requests
|
13 |
if ( defined('XMLRPC_REQUEST') ) {
|
@@ -21,6 +21,12 @@ function ct_contact_form_validate()
|
|
21 |
return null;
|
22 |
}
|
23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
if ( @sizeof($_POST) == 0 ||
|
25 |
(isset($_POST['signup_username']) && isset($_POST['signup_email']) && isset($_POST['signup_password'])) ||
|
26 |
(isset($pagenow) && $pagenow == 'wp-login.php') || // WordPress log in form
|
@@ -142,7 +148,7 @@ function ct_contact_form_validate()
|
|
142 |
}
|
143 |
|
144 |
// Do not execute anti-spam test for logged in users.
|
145 |
-
if ( isset($_COOKIE[LOGGED_IN_COOKIE]) && $apbct->settings['data__protect_logged_in'] != 1 ) {
|
146 |
do_action('apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST);
|
147 |
|
148 |
return null;
|
@@ -221,12 +227,15 @@ function ct_contact_form_validate()
|
|
221 |
unset($_POST['TellAFriend_Link']);
|
222 |
}
|
223 |
|
|
|
|
|
224 |
$base_call_result = apbct_base_call(
|
225 |
array(
|
226 |
'message' => $message,
|
227 |
'sender_email' => $sender_email,
|
228 |
'sender_nickname' => $sender_nickname,
|
229 |
'post_info' => $post_info,
|
|
|
230 |
'sender_info' => array('sender_email' => urlencode($sender_email)),
|
231 |
)
|
232 |
);
|
7 |
*/
|
8 |
function ct_contact_form_validate()
|
9 |
{
|
10 |
+
global $pagenow, $apbct, $ct_checkjs_frm, $cleantalk_executed;
|
11 |
|
12 |
// Exclude the XML-RPC requests
|
13 |
if ( defined('XMLRPC_REQUEST') ) {
|
21 |
return null;
|
22 |
}
|
23 |
|
24 |
+
// Verification completed
|
25 |
+
if ( $cleantalk_executed ) {
|
26 |
+
do_action('apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST);
|
27 |
+
return null;
|
28 |
+
}
|
29 |
+
|
30 |
if ( @sizeof($_POST) == 0 ||
|
31 |
(isset($_POST['signup_username']) && isset($_POST['signup_email']) && isset($_POST['signup_password'])) ||
|
32 |
(isset($pagenow) && $pagenow == 'wp-login.php') || // WordPress log in form
|
148 |
}
|
149 |
|
150 |
// Do not execute anti-spam test for logged in users.
|
151 |
+
if ( defined('LOGGED_IN_COOKIE') && isset($_COOKIE[LOGGED_IN_COOKIE]) && $apbct->settings['data__protect_logged_in'] != 1 ) {
|
152 |
do_action('apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST);
|
153 |
|
154 |
return null;
|
227 |
unset($_POST['TellAFriend_Link']);
|
228 |
}
|
229 |
|
230 |
+
$checkjs = apbct_js_test('ct_checkjs', $_COOKIE, true) ?: apbct_js_test('ct_checkjs', $_POST);
|
231 |
+
|
232 |
$base_call_result = apbct_base_call(
|
233 |
array(
|
234 |
'message' => $message,
|
235 |
'sender_email' => $sender_email,
|
236 |
'sender_nickname' => $sender_nickname,
|
237 |
'post_info' => $post_info,
|
238 |
+
'js_on' => $checkjs,
|
239 |
'sender_info' => array('sender_email' => urlencode($sender_email)),
|
240 |
)
|
241 |
);
|
inc/cleantalk-public.php
CHANGED
@@ -125,17 +125,6 @@ function apbct_init()
|
|
125 |
add_action('wp', 'ct_ajax_hook', 1);
|
126 |
}
|
127 |
|
128 |
-
/** VFB_Pro integration */
|
129 |
-
if (
|
130 |
-
! empty($_POST) &&
|
131 |
-
$apbct->settings['forms__contact_forms_test'] == 1 &&
|
132 |
-
empty(Post::get('ct_checkjs_cf7')) &&
|
133 |
-
apbct_is_plugin_active('vfb-pro/vfb-pro.php') &&
|
134 |
-
! empty(Post::get('_vfb-form-id'))
|
135 |
-
) {
|
136 |
-
ct_contact_form_validate();
|
137 |
-
}
|
138 |
-
|
139 |
//hook for Anonymous Post
|
140 |
if ( $apbct->settings['data__general_postdata_test'] == 1 && empty(Post::get('ct_checkjs_cf7')) ) {
|
141 |
add_action('init', 'ct_contact_form_validate_postdata', 1000);
|
@@ -143,7 +132,6 @@ function apbct_init()
|
|
143 |
|
144 |
if ( $apbct->settings['forms__general_contact_forms_test'] == 1 && empty(Post::get('ct_checkjs_cf7')) && ! apbct_is_direct_trackback() ) {
|
145 |
add_action('CMA_custom_post_type_nav', 'ct_contact_form_validate_postdata', 1);
|
146 |
-
add_action('init', 'ct_contact_form_validate', 999);
|
147 |
if (
|
148 |
Post::get('reg_redirect_link') !== '' &&
|
149 |
Post::get('tmpl_registration_nonce_field') !== ''
|
@@ -345,14 +333,7 @@ function apbct_init()
|
|
345 |
add_action('wp_footer', 'apbct_hook__wp_footer', 1);
|
346 |
}
|
347 |
|
348 |
-
if ( $apbct->settings['data__protect_logged_in'] != 1 && is_user_logged_in() ) {
|
349 |
-
add_action('init', 'ct_contact_form_validate', 999);
|
350 |
-
}
|
351 |
-
|
352 |
if ( apbct_is_user_enable() ) {
|
353 |
-
if ( $apbct->settings['forms__general_contact_forms_test'] == 1 && ! Post::get('comment_post_ID') && ! Get::get('for') && ! apbct_is_direct_trackback() ) {
|
354 |
-
add_action('init', 'ct_contact_form_validate', 999);
|
355 |
-
}
|
356 |
if ( apbct_is_post() &&
|
357 |
$apbct->settings['data__general_postdata_test'] == 1 &&
|
358 |
! Post::get('ct_checkjs_cf7') &&
|
@@ -362,13 +343,6 @@ function apbct_init()
|
|
362 |
add_action('init', 'ct_contact_form_validate_postdata', 1000);
|
363 |
}
|
364 |
}
|
365 |
-
|
366 |
-
/**
|
367 |
-
* Integration with custom forms
|
368 |
-
*/
|
369 |
-
if ( ! empty($_POST) && apbct_custom_forms_trappings() ) {
|
370 |
-
add_action('init', 'ct_contact_form_validate', 999);
|
371 |
-
}
|
372 |
}
|
373 |
|
374 |
function apbct_buffer__start()
|
125 |
add_action('wp', 'ct_ajax_hook', 1);
|
126 |
}
|
127 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
//hook for Anonymous Post
|
129 |
if ( $apbct->settings['data__general_postdata_test'] == 1 && empty(Post::get('ct_checkjs_cf7')) ) {
|
130 |
add_action('init', 'ct_contact_form_validate_postdata', 1000);
|
132 |
|
133 |
if ( $apbct->settings['forms__general_contact_forms_test'] == 1 && empty(Post::get('ct_checkjs_cf7')) && ! apbct_is_direct_trackback() ) {
|
134 |
add_action('CMA_custom_post_type_nav', 'ct_contact_form_validate_postdata', 1);
|
|
|
135 |
if (
|
136 |
Post::get('reg_redirect_link') !== '' &&
|
137 |
Post::get('tmpl_registration_nonce_field') !== ''
|
333 |
add_action('wp_footer', 'apbct_hook__wp_footer', 1);
|
334 |
}
|
335 |
|
|
|
|
|
|
|
|
|
336 |
if ( apbct_is_user_enable() ) {
|
|
|
|
|
|
|
337 |
if ( apbct_is_post() &&
|
338 |
$apbct->settings['data__general_postdata_test'] == 1 &&
|
339 |
! Post::get('ct_checkjs_cf7') &&
|
343 |
add_action('init', 'ct_contact_form_validate_postdata', 1000);
|
344 |
}
|
345 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
346 |
}
|
347 |
|
348 |
function apbct_buffer__start()
|
inc/cleantalk-settings.php
CHANGED
@@ -2287,7 +2287,7 @@ function apbct_settings__sync($direct_call = false)
|
|
2287 |
global $apbct;
|
2288 |
|
2289 |
//Clearing all errors
|
2290 |
-
$apbct->errorDeleteAll(
|
2291 |
|
2292 |
// Feedback with app_agent
|
2293 |
ct_send_feedback('0:' . APBCT_AGENT); // 0 - request_id, agent version.
|
2287 |
global $apbct;
|
2288 |
|
2289 |
//Clearing all errors
|
2290 |
+
$apbct->errorDeleteAll(true);
|
2291 |
|
2292 |
// Feedback with app_agent
|
2293 |
ct_send_feedback('0:' . APBCT_AGENT); // 0 - request_id, agent version.
|
js/apbct-public--functions.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
function ctSetCookie(
|
2 |
//# sourceMappingURL=apbct-public--functions.min.js.map
|
1 |
+
function ctSetCookie(t,e,o){var n;("string"==typeof t&&"string"==typeof e||"number"==typeof e)&&(n="ct_pointer_data"===t,t=[[t,e,o]]),"none"!==ctPublicFunctions.data__cookies_type&&("native"===ctPublicFunctions.data__cookies_type?t.forEach(function(t,e,o){var n=void 0!==t[2]?"expires="+n+"; ":"",a="https:"===location.protocol?"; secure":"";document.cookie=ctPublicFunctions.cookiePrefix+t[0]+"="+encodeURIComponent(t[1])+"; "+n+"path=/; samesite=lax"+a}):"alternative"!==ctPublicFunctions.data__cookies_type||n||("rest"===ctPublicFunctions.data__ajax_type?apbct_public_sendREST("alt_sessions",{method:"POST",data:{cookies:t}}):"admin_ajax"===ctPublicFunctions.data__ajax_type&&apbct_public_sendAJAX({action:"apbct_alt_session__save__AJAX",cookies:t},{notJson:1})))}function ctDeleteCookie(t){var e;"none"!==ctPublicFunctions.data__cookies_type&&("native"===ctPublicFunctions.data__cookies_type?(e="https:"===location.protocol?"; secure":"",document.cookie=t+'=""; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; samesite=lax'+e):ctPublicFunctions.data__cookies_type)}function apbct_public_sendAJAX(e,o,n){var a=o.callback||null,c=o.callback_context||null,l=o.callback_params||null,t=o.async||!0,s=o.notJson||null,r=o.timeout||15e3,n=n||null,i=o.button||null,u=o.spinner||null,p=o.progressbar||null,_=o.silent||null,d=o.no_nonce||null;"string"==typeof e?e=(e=d?e:e+"&_ajax_nonce="+ctPublicFunctions._ajax_nonce)+"&no_cache="+Math.random():(d||(e._ajax_nonce=ctPublicFunctions._ajax_nonce),e.no_cache=Math.random()),i&&(i.setAttribute("disabled","disabled"),i.style.cursor="not-allowed"),u&&jQuery(u).css("display","inline"),jQuery.ajax({type:"POST",url:ctPublicFunctions._ajax_url,data:e,async:t,success:function(t){i&&(i.removeAttribute("disabled"),i.style.cursor="pointer"),u&&jQuery(u).css("display","none"),(t=s?t:JSON.parse(t)).error?(setTimeout(function(){p&&p.fadeOut("slow")},1e3),console.log("Error happens: "+(t.error||"Unkown"))):a&&(l?a.apply(c,l.concat(t,e,o,n)):a(t,e,o,n))},error:function(t,e,o){i&&(i.removeAttribute("disabled"),i.style.cursor="pointer"),u&&jQuery(u).css("display","none"),o&&!_&&(console.log("APBCT_AJAX_ERROR"),console.log(t),console.log(e),console.log("Anti-spam by Cleantalk plugin error: "+o+"Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/"))},timeout:r})}function apbct_public_sendREST(e,o){var n=o.callback||null,t=o.data||[],a=o.method||"POST";jQuery.ajax({type:a,url:ctPublicFunctions._rest_url+"cleantalk-antispam/v1/"+e,data:t,beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",ctPublicFunctions._rest_nonce)},success:function(t){t.error?console.log("Error happens: "+(t.error||"Unknown")):n&&n(t,e,o,null)},error:function(t,e,o){o&&(console.log("APBCT_REST_ERROR"),console.log(t),console.log(e),console.log("Anti-spam by Cleantalk plugin REST API error: "+o+" Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/"))}})}apbctLocalStorage={get:function(t,e){void 0===e&&(e="value");t=localStorage.getItem(t);if(null!==t)try{const o=JSON.parse(t);return o.hasOwnProperty(e)?JSON.parse(o[e]):o}catch(t){return new Error(t)}return!1},set:function(t,e){e={value:JSON.stringify(e),timestamp:Math.floor((new Date).getTime()/1e3)};localStorage.setItem(t,JSON.stringify(e))},isAlive:function(t,e){return void 0===e&&(e=86400),this.get(t,"timestamp")+e>Math.floor((new Date).getTime()/1e3)},isSet:function(t){return null!==localStorage.getItem(t)}};
|
2 |
//# sourceMappingURL=apbct-public--functions.min.js.map
|
js/apbct-public--functions.min.js.map
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"file":"apbct-public--functions.min.js","sources":["apbct-public--functions.js"],"sourcesContent":["function ctSetCookie( cookies, value, expires ){\n\n if( typeof cookies === 'string' && typeof value === 'string' || typeof value === 'number'){\n var skip_alt = cookies === 'ct_pointer_data';\n cookies = [ [ cookies, value, expires ] ];\n }\n\n // Cookies disabled\n if( ctPublicFunctions.data__cookies_type === 'none' ){\n return;\n\n // Using traditional cookies\n }else if( ctPublicFunctions.data__cookies_type === 'native' ){\n cookies.forEach( function (item, i, arr\t) {\n var expires = typeof item[2] !== 'undefined' ? \"expires=\" + expires + '; ' : '';\n var ctSecure = location.protocol === 'https:' ? '; secure' : '';\n document.cookie = ctPublicFunctions.cookiePrefix + item[0] + \"=\" + encodeURIComponent(item[1]) + \"; \" + expires + \"path=/; samesite=lax\" + ctSecure;\n });\n\n // Using alternative cookies\n }else if( ctPublicFunctions.data__cookies_type === 'alternative' && ! skip_alt ){\n\n // Using REST API handler\n if( ctPublicFunctions.data__ajax_type === 'rest' ){\n apbct_public_sendREST(\n 'alt_sessions',\n {\n method: 'POST',\n data: { cookies: cookies }\n }\n );\n\n // Using AJAX request and handler\n } else if( ctPublicFunctions.data__ajax_type === 'admin_ajax' ) {\n apbct_public_sendAJAX(\n {\n action: 'apbct_alt_session__save__AJAX',\n cookies: cookies,\n },\n {\n notJson: 1,\n }\n );\n }\n }\n}\n\nfunction ctDeleteCookie(cookieName) {\n // Cookies disabled\n if( ctPublicFunctions.data__cookies_type === 'none' ){\n return;\n\n // Using traditional cookies\n }else if( ctPublicFunctions.data__cookies_type === 'native' ){\n\n var ctSecure = location.protocol === 'https:' ? '; secure' : '';\n document.cookie = cookieName + \"=\\\"\\\"; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; samesite=lax\" + ctSecure;\n\n // Using alternative cookies\n }else if( ctPublicFunctions.data__cookies_type === 'alternative' ){\n // @ToDo implement this logic\n }\n}\n\nfunction apbct_public_sendAJAX(data, params, obj){\n\n // Default params\n var callback = params.callback || null;\n var callback_context = params.callback_context || null;\n var callback_params = params.callback_params || null;\n var async = params.async || true;\n var notJson = params.notJson || null;\n var timeout = params.timeout || 15000;\n var obj = obj || null;\n var button = params.button || null;\n var spinner = params.spinner || null;\n var progressbar = params.progressbar || null;\n var silent = params.silent || null;\n var no_nonce = params.no_nonce || null;\n\n if(typeof (data) === 'string') {\n if( ! no_nonce )\n data = data + '&_ajax_nonce=' + ctPublicFunctions._ajax_nonce;\n data = data + '&no_cache=' + Math.random()\n } else {\n if( ! no_nonce )\n data._ajax_nonce = ctPublicFunctions._ajax_nonce;\n data.no_cache = Math.random();\n }\n // Button and spinner\n if(button) {button.setAttribute('disabled', 'disabled'); button.style.cursor = 'not-allowed'; }\n if(spinner) jQuery(spinner).css('display', 'inline');\n\n jQuery.ajax({\n type: \"POST\",\n url: ctPublicFunctions._ajax_url,\n data: data,\n async: async,\n success: function(result){\n if(button){ button.removeAttribute('disabled'); button.style.cursor = 'pointer'; }\n if(spinner) jQuery(spinner).css('display', 'none');\n if(!notJson) result = JSON.parse(result);\n if(result.error){\n setTimeout(function(){ if(progressbar) progressbar.fadeOut('slow'); }, 1000);\n console.log('Error happens: ' + (result.error || 'Unkown'));\n }else{\n if(callback) {\n if (callback_params)\n callback.apply( callback_context, callback_params.concat( result, data, params, obj ) );\n else\n callback(result, data, params, obj);\n }\n }\n },\n error: function(jqXHR, textStatus, errorThrown){\n if(button){ button.removeAttribute('disabled'); button.style.cursor = 'pointer'; }\n if(spinner) jQuery(spinner).css('display', 'none');\n if( errorThrown && ! silent ) {\n console.log('APBCT_AJAX_ERROR');\n console.log(jqXHR);\n console.log(textStatus);\n console.log('Anti-spam by Cleantalk plugin error: ' + errorThrown + 'Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/');\n }\n },\n timeout: timeout,\n });\n}\n\nfunction apbct_public_sendREST( route, params ) {\n\n var callback = params.callback || null;\n var data = params.data || [];\n var method = params.method || 'POST';\n\n jQuery.ajax({\n type: method,\n url: ctPublicFunctions._rest_url + 'cleantalk-antispam/v1/' + route,\n data: data,\n beforeSend : function ( xhr ) {\n xhr.setRequestHeader( 'X-WP-Nonce', ctPublicFunctions._rest_nonce );\n },\n success: function(result){\n if(result.error){\n console.log('Error happens: ' + (result.error || 'Unknown'));\n }else{\n if(callback) {\n var obj = null;\n callback(result, route, params, obj);\n }\n }\n },\n error: function(jqXHR, textStatus, errorThrown){\n if( errorThrown ) {\n console.log('APBCT_REST_ERROR');\n console.log(jqXHR);\n console.log(textStatus);\n console.log('Anti-spam by Cleantalk plugin REST API error: ' + errorThrown + ' Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/');\n }\n },\n });\n\n}\n"],"names":["ctSetCookie","cookies","value","expires","skip_alt","ctPublicFunctions","data__cookies_type","forEach","item","i","arr","ctSecure","location","protocol","document","cookie","cookiePrefix","encodeURIComponent","data__ajax_type","apbct_public_sendREST","method","data","apbct_public_sendAJAX","action","notJson","ctDeleteCookie","cookieName","params","obj","callback","callback_context","callback_params","async","timeout","button","spinner","progressbar","silent","no_nonce","_ajax_nonce","Math","random","no_cache","setAttribute","style","cursor","jQuery","css","ajax","type","url","_ajax_url","success","result","removeAttribute","JSON","parse","error","setTimeout","fadeOut","console","log","apply","concat","jqXHR","textStatus","errorThrown","route","_rest_url","beforeSend","xhr","setRequestHeader","_rest_nonce"],"mappings":"AAAA,SAASA,YAAaC,EAASC,EAAOC,GAElC,IACQC,GADe,iBAAZH,GAAyC,iBAAVC,GAAuC,iBAAVA,KAC/DE,EAAuB,oBAAZH,EACfA,EAAU,CAAE,CAAEA,EAASC,EAAOC,KAIW,SAAzCE,kBAAkBC,qBAI6B,WAAzCD,kBAAkBC,mBACxBL,EAAQM,QAAS,SAAUC,EAAMC,EAAGC,GAChC,IAAIP,OAA6B,IAAZK,EAAK,GAAqB,WAAaL,EAAU,KAAO,GACzEQ,EAAiC,WAAtBC,SAASC,SAAwB,WAAa,GAC7DC,SAASC,OAASV,kBAAkBW,aAAeR,EAAK,GAAK,IAAMS,mBAAmBT,EAAK,IAAM,KAAOL,EAAU,uBAAyBQ,IAIhG,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Y,IAAI,UAAW,SAC/BM,EAAT7B,EACD6B,EADmBE,KAAKC,MAAMH,IACvBI,OACNC,WAAW,WAAetB,GAAaA,EAAYuB,QAAQ,SAAY,KACvEC,QAAQC,IAAI,mBAAqBR,EAAOI,OAAS,YAE9C5B,IACKE,EACAF,EAASiC,MAAOhC,EAAkBC,EAAgBgC,OAAQV,EAAQhC,EAAMM,EAAQC,IAEhFC,EAASwB,EAAQhC,EAAMM,EAAQC,KAI/C6B,MAAO,SAASO,EAAOC,EAAYC,GAC5BhC,IAAUA,EAAOoB,gBAAgB,YAAapB,EAAOU,MAAMC,OAAS,WACpEV,GAASW,OAAOX,GAASY,IAAI,UAAW,QACvCmB,IAAiB7B,IACjBuB,QAAQC,IAAI,oBACZD,QAAQC,IAAIG,GACZJ,QAAQC,IAAII,GACZL,QAAQC,IAAI,wCAA0CK,EAAc,yGAG5EjC,QAASA,IAIjB,SAASd,sBAAuBgD,EAAOxC,GAEnC,IAAIE,EAAWF,EAAOE,UAAY,KAC9BR,EAAWM,EAAON,MAAQ,GAC1BD,EAAWO,EAAOP,QAAU,OAEhC0B,OAAOE,KAAK,CACRC,KAAM7B,EACN8B,IAAK7C,kBAAkB+D,UAAY,yBAA2BD,EAC9D9C,KAAMA,EACNgD,WAAa,SAAWC,GACpBA,EAAIC,iBAAkB,aAAclE,kBAAkBmE,cAE1DpB,QAAS,SAASC,GACXA,EAAOI,MACNG,QAAQC,IAAI,mBAAqBR,EAAOI,OAAS,YAE9C5B,GAECA,EAASwB,EAAQc,EAAOxC,EADd,OAKtB8B,MAAO,SAASO,EAAOC,EAAYC,GAC3BA,IACAN,QAAQC,IAAI,oBACZD,QAAQC,IAAIG,GACZJ,QAAQC,IAAII,GACZL,QAAQC,IAAI,iDAAmDK,EAAc"}
|
1 |
+
{"version":3,"file":"apbct-public--functions.min.js","sources":["apbct-public--functions.js"],"sourcesContent":["function ctSetCookie( cookies, value, expires ){\n\n if( typeof cookies === 'string' && typeof value === 'string' || typeof value === 'number'){\n var skip_alt = cookies === 'ct_pointer_data';\n cookies = [ [ cookies, value, expires ] ];\n }\n\n // Cookies disabled\n if( ctPublicFunctions.data__cookies_type === 'none' ){\n return;\n\n // Using traditional cookies\n }else if( ctPublicFunctions.data__cookies_type === 'native' ){\n cookies.forEach( function (item, i, arr\t) {\n var expires = typeof item[2] !== 'undefined' ? \"expires=\" + expires + '; ' : '';\n var ctSecure = location.protocol === 'https:' ? '; secure' : '';\n document.cookie = ctPublicFunctions.cookiePrefix + item[0] + \"=\" + encodeURIComponent(item[1]) + \"; \" + expires + \"path=/; samesite=lax\" + ctSecure;\n });\n\n // Using alternative cookies\n }else if( ctPublicFunctions.data__cookies_type === 'alternative' && ! skip_alt ){\n\n // Using REST API handler\n if( ctPublicFunctions.data__ajax_type === 'rest' ){\n apbct_public_sendREST(\n 'alt_sessions',\n {\n method: 'POST',\n data: { cookies: cookies }\n }\n );\n\n // Using AJAX request and handler\n } else if( ctPublicFunctions.data__ajax_type === 'admin_ajax' ) {\n apbct_public_sendAJAX(\n {\n action: 'apbct_alt_session__save__AJAX',\n cookies: cookies,\n },\n {\n notJson: 1,\n }\n );\n }\n }\n}\n\nfunction ctDeleteCookie(cookieName) {\n // Cookies disabled\n if( ctPublicFunctions.data__cookies_type === 'none' ){\n return;\n\n // Using traditional cookies\n }else if( ctPublicFunctions.data__cookies_type === 'native' ){\n\n var ctSecure = location.protocol === 'https:' ? '; secure' : '';\n document.cookie = cookieName + \"=\\\"\\\"; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; samesite=lax\" + ctSecure;\n\n // Using alternative cookies\n }else if( ctPublicFunctions.data__cookies_type === 'alternative' ){\n // @ToDo implement this logic\n }\n}\n\nfunction apbct_public_sendAJAX(data, params, obj){\n\n // Default params\n var callback = params.callback || null;\n var callback_context = params.callback_context || null;\n var callback_params = params.callback_params || null;\n var async = params.async || true;\n var notJson = params.notJson || null;\n var timeout = params.timeout || 15000;\n var obj = obj || null;\n var button = params.button || null;\n var spinner = params.spinner || null;\n var progressbar = params.progressbar || null;\n var silent = params.silent || null;\n var no_nonce = params.no_nonce || null;\n\n if(typeof (data) === 'string') {\n if( ! no_nonce )\n data = data + '&_ajax_nonce=' + ctPublicFunctions._ajax_nonce;\n data = data + '&no_cache=' + Math.random()\n } else {\n if( ! no_nonce )\n data._ajax_nonce = ctPublicFunctions._ajax_nonce;\n data.no_cache = Math.random();\n }\n // Button and spinner\n if(button) {button.setAttribute('disabled', 'disabled'); button.style.cursor = 'not-allowed'; }\n if(spinner) jQuery(spinner).css('display', 'inline');\n\n jQuery.ajax({\n type: \"POST\",\n url: ctPublicFunctions._ajax_url,\n data: data,\n async: async,\n success: function(result){\n if(button){ button.removeAttribute('disabled'); button.style.cursor = 'pointer'; }\n if(spinner) jQuery(spinner).css('display', 'none');\n if(!notJson) result = JSON.parse(result);\n if(result.error){\n setTimeout(function(){ if(progressbar) progressbar.fadeOut('slow'); }, 1000);\n console.log('Error happens: ' + (result.error || 'Unkown'));\n }else{\n if(callback) {\n if (callback_params)\n callback.apply( callback_context, callback_params.concat( result, data, params, obj ) );\n else\n callback(result, data, params, obj);\n }\n }\n },\n error: function(jqXHR, textStatus, errorThrown){\n if(button){ button.removeAttribute('disabled'); button.style.cursor = 'pointer'; }\n if(spinner) jQuery(spinner).css('display', 'none');\n if( errorThrown && ! silent ) {\n console.log('APBCT_AJAX_ERROR');\n console.log(jqXHR);\n console.log(textStatus);\n console.log('Anti-spam by Cleantalk plugin error: ' + errorThrown + 'Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/');\n }\n },\n timeout: timeout,\n });\n}\n\nfunction apbct_public_sendREST( route, params ) {\n\n var callback = params.callback || null;\n var data = params.data || [];\n var method = params.method || 'POST';\n\n jQuery.ajax({\n type: method,\n url: ctPublicFunctions._rest_url + 'cleantalk-antispam/v1/' + route,\n data: data,\n beforeSend : function ( xhr ) {\n xhr.setRequestHeader( 'X-WP-Nonce', ctPublicFunctions._rest_nonce );\n },\n success: function(result){\n if(result.error){\n console.log('Error happens: ' + (result.error || 'Unknown'));\n }else{\n if(callback) {\n var obj = null;\n callback(result, route, params, obj);\n }\n }\n },\n error: function(jqXHR, textStatus, errorThrown){\n if( errorThrown ) {\n console.log('APBCT_REST_ERROR');\n console.log(jqXHR);\n console.log(textStatus);\n console.log('Anti-spam by Cleantalk plugin REST API error: ' + errorThrown + ' Please, contact Cleantalk tech support https://wordpress.org/support/plugin/cleantalk-spam-protect/');\n }\n },\n });\n}\n\napbctLocalStorage = {\n get : function(key, property) {\n if ( typeof property === 'undefined' ) {\n property = 'value';\n }\n const storageValue = localStorage.getItem(key);\n if ( storageValue !== null ) {\n try {\n const json = JSON.parse(storageValue);\n return json.hasOwnProperty(property) ? JSON.parse(json[property]) : json;\n } catch (e) {\n return new Error(e);\n }\n }\n return false;\n },\n set : function(key, value) {\n let objToSave = {'value': JSON.stringify(value), 'timestamp': Math.floor(new Date().getTime() / 1000)};\n localStorage.setItem(key, JSON.stringify(objToSave));\n },\n isAlive : function(key, maxLifetime) {\n if ( typeof maxLifetime === 'undefined' ) {\n maxLifetime = 86400;\n }\n const keyTimestamp = this.get(key, 'timestamp');\n return keyTimestamp + maxLifetime > Math.floor(new Date().getTime() / 1000);\n },\n isSet : function(key) {\n return localStorage.getItem(key) !== null;\n }\n}"],"names":["ctSetCookie","cookies","value","expires","skip_alt","ctPublicFunctions","data__cookies_type","forEach","item","i","arr","ctSecure","location","protocol","document","cookie","cookiePrefix","encodeURIComponent","data__ajax_type","apbct_public_sendREST","method","data","apbct_public_sendAJAX","action","notJson","ctDeleteCookie","cookieName","params","obj","callback","callback_context","callback_params","async","timeout","button","spinner","progressbar","silent","no_nonce","_ajax_nonce","Math","random","no_cache","setAttribute","style","cursor","jQuery","css","ajax","type","url","_ajax_url","success","result","removeAttribute","JSON","parse","error","setTimeout","fadeOut","console","log","apply","concat","jqXHR","textStatus","errorThrown","route","_rest_url","beforeSend","xhr","setRequestHeader","_rest_nonce","apbctLocalStorage","get","key","property","storageValue","localStorage","getItem","json","hasOwnProperty","e","Error","set","objToSave","stringify","timestamp","floor","Date","getTime","setItem","isAlive","maxLifetime","this","isSet"],"mappings":"AAAA,SAASA,YAAaC,EAASC,EAAOC,GAElC,IACQC,GADe,iBAAZH,GAAyC,iBAAVC,GAAuC,iBAAVA,KAC/DE,EAAuB,oBAAZH,EACfA,EAAU,CAAE,CAAEA,EAASC,EAAOC,KAIW,SAAzCE,kBAAkBC,qBAI6B,WAAzCD,kBAAkBC,mBACxBL,EAAQM,QAAS,SAAUC,EAAMC,EAAGC,GAChC,IAAIP,OAA6B,IAAZK,EAAK,GAAqB,WAAaL,EAAU,KAAO,GACzEQ,EAAiC,WAAtBC,SAASC,SAAwB,WAAa,GAC7DC,SAASC,OAASV,kBAAkBW,aAAeR,EAAK,GAAK,IAAMS,mBAAmBT,EAAK,IAAM,KAAOL,EAAU,uBAAyBQ,IAIhG,gBAAzCN,kBAAkBC,oBAA0CF,IAGxB,SAAtCC,kBAAkBa,gBAClBC,sBACI,eACA,CACIC,OAAQ,OACRC,KAAM,CAAEpB,QAASA,KAKoB,eAAtCI,kBAAkBa,iBACzBI,sBACI,CACIC,OAAQ,gCACRtB,QAASA,GAEb,CACIuB,QAAS,MAO7B,SAASC,eAAeC,GAEpB,IAMQf,EANqC,SAAzCN,kBAAkBC,qBAI6B,WAAzCD,kBAAkBC,oBAEpBK,EAAiC,WAAtBC,SAASC,SAAwB,WAAa,GAC7DC,SAASC,OAASW,EAAa,mEAAuEf,GAGhGN,kBAAkBC,oBAKhC,SAASgB,sBAAsBD,EAAMM,EAAQC,GAGzC,IAAIC,EAAcF,EAAOE,UAAe,KACpCC,EAAmBH,EAAOG,kBAAoB,KAC9CC,EAAkBJ,EAAOI,iBAAmB,KAC5CC,EAAQL,EAAOK,QAAS,EACxBR,EAAcG,EAAOH,SAAe,KACpCS,EAAcN,EAAOM,SAAe,KACpCL,EAAcA,GAAsB,KACpCM,EAAcP,EAAOO,QAAe,KACp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e){const i=e.target;i.setAttribute("title",ctPublicFunctions.text__wait_for_decoding),i.style.cursor="progress","rest"===ctPublicFunctions.data__ajax_type?apbct_public_sendREST("apbct_decode_email",{data:{encodedEmail:e.target.dataset.originalString},method:"POST",callback:function(t){t.success&&(ctFillDecodedEmail(t.data,e.target),i.setAttribute("title",""),i.removeAttribute("style"))}}):apbct_public_sendAJAX({action:"apbct_decode_email",encodedEmail:e.target.dataset.originalString},{notJson:!0,callback:function(t){t.success&&(ctFillDecodedEmail(t.data,e.target),i.setAttribute("title",""),i.removeAttribute("style"))}})}function ctFillDecodedEmail(t,e){e.innerHTML=t}function apbct_collect_visible_fields(t){var e,i=[],o="",c=0,n="",a=0,l=[];for(e in t.elements)isNaN(+e)||(i[e]=t.elements[e]);return(i=i.filter(function(t){return-1===l.indexOf(t.getAttribute("name"))&&(-1===["radio","checkbox"].indexOf(t.getAttribute("type"))||(l.push(t.getAttribute("name")),!1))})).forEach(function(t,e,i){"submit"!==t.getAttribute("type")&&null!==t.getAttribute("name")&&"ct_checkjs"!==t.getAttribute("name")&&("none"!==getComputedStyle(t).display&&"hidden"!==getComputedStyle(t).visibility&&"0"!==getComputedStyle(t).opacity&&"hidden"!==t.getAttribute("type")||t.classList.contains("wp-editor-area")?(o+=" "+t.getAttribute("name"),c++):(n+=" "+t.getAttribute("name"),a++))}),n=n.trim(),{visible_fields:o=o.trim(),visible_fields_count:c,invisible_fields:n,invisible_fields_count:a}}function apbct_visible_fields_set_cookie(t,e){var i="object"==typeof t&&null!==t?t:{};if("native"===ctPublic.data__cookies_type)for(var o in i){if(10<o)return;ctSetCookie("apbct_visible_fields_"+(void 0!==e?e:o),JSON.stringify(i[o]))}else ctSetCookie("apbct_visible_fields",JSON.stringify(i))}function apbct_js_keys__set_input_value(t,e,i,o){if(0<document.querySelectorAll("[name^=ct_checkjs]").length)for(var c=document.querySelectorAll("[name^=ct_checkjs]"),n=0;n<c.length;n++)c[n].value=t.js_key}function apbctGetScreenInfo(){return JSON.stringify({fullWidth:document.documentElement.scrollWidth,fullHeight:Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight),visibleWidth:document.documentElement.clientWidth,visibleHeight:document.documentElement.clientHeight})}function ctSetPixelUrlLocalstorage(t){localStorage.setItem("session_pixel_url",t),localStorage.setItem(t,Math.floor(Date.now()/1e3).toString())}function ctGetPixelUrlLocalstorage(){var t=localStorage.getItem("session_pixel_url");return null!==t&&t}function ctIsOutdatedPixelUrlLocalstorage(t){t=Number(localStorage.getItem(t));return 10800<Math.floor(Date.now()/1e3).toString()-t}function ctCleaPixelUrlLocalstorage(t){localStorage.removeItem(t),localStorage.removeItem("session_pixel_url")}!function(){var n=new Date,e=(new Date).getTime(),i=!0,o=[],c=0,a={};function t(t,e,i){"function"==typeof window.addEventListener?t.addEventListener(e,i):t.attachEvent(e,i)}function l(t,e,i){"function"==typeof window.removeEventListener?t.removeEventListener(e,i):t.detachEvent(e,i)}var s=function(t){var e=Math.floor((new Date).getTime()/1e3);ctSetCookie("ct_fkp_timestamp",e),l(window,"mousedown",s),l(window,"keydown",s)},r=setInterval(function(){i=!0},150),d=setInterval(function(){ctSetCookie("ct_pointer_data",JSON.stringify(o))},1200),u=function(t){apbctLocalStorage.isSet("ct_mouse_moved")&&apbctLocalStorage.get("ct_mouse_moved")||(ctSetCookie("ct_mouse_moved","true"),apbctLocalStorage.set("ct_mouse_moved",!0)),!0===i&&(o.push([Math.round(t.clientY),Math.round(t.clientX),Math.round((new Date).getTime()-e)]),i=!1,50<=++c&&(l(window,"mousemove",u),clearInterval(r),clearInterval(d)))};function _(t){var e=t.target.value;!e||e in a||("rest"===ctPublicFunctions.data__ajax_type?apbct_public_sendREST("check_email_before_post",{method:"POST",data:{email:e},callback:function(t){t.result&&(a[e]={result:t.result,timestamp:Date.now()/1e3|0},ctSetCookie("ct_checked_emails",JSON.stringify(a)))}}):"admin_ajax"===ctPublicFunctions.data__ajax_type&&apbct_public_sendAJAX({action:"apbct_email_check_before_post",email:e},{callback:function(t){t.result&&(a[e]={result:t.result,timestamp:Date.now()/1e3|0},ctSetCookie("ct_checked_emails",JSON.stringify(a)))}}))}function m(t){ctSetCookie("apbct_pixel_url",t),+ctPublic.pixel__enabled&&!document.getElementById("apbct_pixel")&&jQuery("body").append('<img alt="Cleantalk Pixel" id="apbct_pixel" style="display: none; left: 99999px;" src="'+t+'">')}t(window,"mousemove",u),t(window,"mousedown",s),t(window,"keydown",s),t(window,"scroll",function(){apbctLocalStorage.isSet("ct_has_scrolled")&&apbctLocalStorage.get("ct_has_scrolled")||(ctSetCookie("ct_has_scrolled","true"),apbctLocalStorage.set("ct_has_scrolled",!0))}),t(window,"DOMContentLoaded",function(){var t=[["ct_ps_timestamp",Math.floor((new Date).getTime()/1e3)],["ct_fkp_timestamp","0"],["ct_pointer_data","0"],["ct_timezone",n.getTimezoneOffset()/60*-1],["ct_screen_info",apbctGetScreenInfo()],["apbct_headless",navigator.webdriver]];if("native"!==ctPublic.data__cookies_type)t.push(["apbct_visible_fields","0"]);else{var e=document.cookie.split(";");if(0!==e.length)for(var i=0;i<e.length;i++){var o=e[i].trim().split("=")[0];0===o.indexOf("apbct_visible_fields_")&&ctDeleteCookie(o)}}+ctPublic.pixel__setting&&(+ctPublic.pixel__enabled?function(){var t=ctGetPixelUrlLocalstorage();if(!1!==t){if(!ctIsOutdatedPixelUrlLocalstorage(t))return m(t);ctCleaPixelUrlLocalstorage(t)}"rest"===ctPublicFunctions.data__ajax_type?apbct_public_sendREST("apbct_get_pixel_url",{method:"POST",callback:function(t){t&&(ctGetPixelUrlLocalstorage()||ctSetPixelUrlLocalstorage(t),m(t))}}):apbct_public_sendAJAX({action:"apbct_get_pixel_url"},{notJson:!0,callback:function(t){t&&(ctGetPixelUrlLocalstorage()||ctSetPixelUrlLocalstorage(t),m(t))}})}():t.push(["apbct_pixel_url",ctPublic.pixel__url])),+ctPublic.data__email_check_before_post&&(t.push(["ct_checked_emails","0"]),jQuery("input[type = 'email'], #email").blur(_)),ctSetCookie(t),setTimeout(function(){for(var t=0;t<document.forms.length;t++){var e,i,o=document.forms[t];0==+ctPublic.data__visible_fields_required||"get"===o.method.toString().toLowerCase()||o.classList.contains("slp_search_form")||o.parentElement.classList.contains("mec-booking")||-1!==o.action.toString().indexOf("activehosted.com")||o.id&&"caspioform"===o.id||o.classList&&o.classList.contains("tinkoffPayRow")||o.classList&&o.classList.contains("give-form")||o.id&&"ult-forgot-password-form"===o.id||o.id&&-1!==o.id.toString().indexOf("calculatedfields")||o.id&&-1!==o.id.toString().indexOf("sac-form")||o.id&&-1!==o.id.toString().indexOf("cp_tslotsbooking_pform")||o.name&&-1!==o.name.toString().indexOf("cp_tslotsbooking_pform")||"https://epayment.epymtservice.com/epay.jhtml"===o.action.toString()||o.name&&-1!==o.name.toString().indexOf("tribe-bar-form")||((e=document.createElement("input")).setAttribute("type","hidden"),e.setAttribute("id","apbct_visible_fields_"+t),e.setAttribute("name","apbct_visible_fields"),(i={})[0]=apbct_collect_visible_fields(o),e.value=JSON.stringify(i),o.append(e),o.onsubmit_prev=o.onsubmit,o.ctFormIndex=t,o.onsubmit=function(t){var e;"native"!==ctPublic.data__cookies_type&&void 0!==t.target.ctFormIndex&&((e={})[0]=apbct_collect_visible_fields(this),apbct_visible_fields_set_cookie(e,t.target.ctFormIndex)),t.target.onsubmit_prev instanceof Function&&setTimeout(function(){t.target.onsubmit_prev.call(t.target,t)},500)})}},1e3);let c=document.querySelectorAll("[data-original-string]");if(c.length)for(let t=0;t<c.length;++t)c[t].parentElement.href||c[t].parentElement.parentElement.href||c[t].addEventListener("click",function t(e){this.removeEventListener("click",t),apbctAjaxEmailDecode(e)})})}(),"undefined"!=typeof jQuery&&jQuery(document).ajaxComplete(function(t,e,i){e.responseText&&-1!==e.responseText.indexOf('"apbct')&&void 0!==(e=JSON.parse(e.responseText)).apbct&&(e=e.apbct).blocked&&(document.dispatchEvent(new CustomEvent("apbctAjaxBockAlert",{bubbles:!0,detail:{message:e.comment}})),cleantalkModal.loaded=e.comment,cleantalkModal.open(),1==+e.stop_script&&window.stop())});
|
2 |
//# sourceMappingURL=apbct-public.min.js.map
|
js/apbct-public.min.js.map
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"file":"apbct-public.min.js","sources":["apbct-public.js"],"sourcesContent":["(function() {\n\n\tvar ct_date = new Date(),\n\t\tctTimeMs = new Date().getTime(),\n\t\tctMouseEventTimerFlag = true, //Reading interval flag\n\t\tctMouseData = [],\n\t\tctMouseDataCounter = 0,\n\t\tctCheckedEmails = {},\n\t\tctScrollCollected = false,\n\t\tctMouseMovedCollected = false;\n\n\tfunction apbct_attach_event_handler(elem, event, callback){\n\t\tif(typeof window.addEventListener === \"function\") elem.addEventListener(event, callback);\n\t\telse elem.attachEvent(event, callback);\n\t}\n\n\tfunction apbct_remove_event_handler(elem, event, callback){\n\t\tif(typeof window.removeEventListener === \"function\") elem.removeEventListener(event, callback);\n\t\telse elem.detachEvent(event, callback);\n\t}\n\n\t//Writing first key press timestamp\n\tvar ctFunctionFirstKey = function output(event){\n\t\tvar KeyTimestamp = Math.floor(new Date().getTime()/1000);\n\t\tctSetCookie(\"ct_fkp_timestamp\", KeyTimestamp);\n\t\tctKeyStopStopListening();\n\t};\n\n\t//Reading interval\n\tvar ctMouseReadInterval = setInterval(function(){\n\t\tctMouseEventTimerFlag = true;\n\t}, 150);\n\n\t//Writting interval\n\tvar ctMouseWriteDataInterval = setInterval(function(){\n\t\tctSetCookie(\"ct_pointer_data\", JSON.stringify(ctMouseData));\n\t}, 1200);\n\n\t//Logging mouse position each 150 ms\n\tvar ctFunctionMouseMove = function output(event){\n\t\tctSetMouseMoved();\n\t\tif(ctMouseEventTimerFlag === true){\n\n\t\t\tctMouseData.push([\n\t\t\t\tMath.round(event.clientY),\n\t\t\t\tMath.round(event.clientX),\n\t\t\t\tMath.round(new Date().getTime() - ctTimeMs)\n\t\t\t]);\n\n\t\t\tctMouseDataCounter++;\n\t\t\tctMouseEventTimerFlag = false;\n\t\t\tif(ctMouseDataCounter >= 50){\n\t\t\t\tctMouseStopData();\n\t\t\t}\n\t\t}\n\t};\n\n\t//Stop mouse observing function\n\tfunction ctMouseStopData(){\n\t\tapbct_remove_event_handler(window, \"mousemove\", ctFunctionMouseMove);\n\t\tclearInterval(ctMouseReadInterval);\n\t\tclearInterval(ctMouseWriteDataInterval);\n\t}\n\n\t//Stop key listening function\n\tfunction ctKeyStopStopListening(){\n\t\tapbct_remove_event_handler(window, \"mousedown\", ctFunctionFirstKey);\n\t\tapbct_remove_event_handler(window, \"keydown\", ctFunctionFirstKey);\n\t}\n\n\tfunction checkEmail(e) {\n\t\tvar current_email = e.target.value;\n\t\tif (current_email && !(current_email in ctCheckedEmails)) {\n\t\t\t// Using REST API handler\n\t\t\tif( ctPublicFunctions.data__ajax_type === 'rest' ){\n\t\t\t\tapbct_public_sendREST(\n\t\t\t\t\t'check_email_before_post',\n\t\t\t\t\t{\n\t\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\t\tdata: {'email' : current_email},\n\t\t\t\t\t\tcallback: function (result) {\n\t\t\t\t\t\t\tif (result.result) {\n\t\t\t\t\t\t\t\tctCheckedEmails[current_email] = {'result' : result.result, 'timestamp': Date.now() / 1000 |0};\n\t\t\t\t\t\t\t\tctSetCookie('ct_checked_emails', JSON.stringify(ctCheckedEmails));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t// Using AJAX request and handler\n\t\t\t} else if( ctPublicFunctions.data__ajax_type === 'admin_ajax' ) {\n\t\t\t\tapbct_public_sendAJAX(\n\t\t\t\t\t{\n\t\t\t\t\t\taction: 'apbct_email_check_before_post',\n\t\t\t\t\t\temail : current_email,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tcallback: function (result) {\n\t\t\t\t\t\t\tif (result.result) {\n\t\t\t\t\t\t\t\tctCheckedEmails[current_email] = {'result' : result.result, 'timestamp': Date.now() / 1000 |0};\n\t\t\t\t\t\t\t\tctSetCookie('ct_checked_emails', JSON.stringify(ctCheckedEmails));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction ctSetPixelImg(pixelUrl) {\n\t\tctSetCookie('apbct_pixel_url', pixelUrl);\n\t\tif( +ctPublic.pixel__enabled ){\n\t\t\tif( ! document.getElementById('apbct_pixel') ) {\n\t\t\t\tjQuery('body').append( '<img alt=\"Cleantalk Pixel\" id=\"apbct_pixel\" style=\"display: none; left: 99999px;\" src=\"' + pixelUrl + '\">' );\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction ctGetPixelUrl() {\n\t\t// Check if pixel is already in localstorage and is not outdated\n\t\tlet local_storage_pixel_url = ctGetPixelUrlLocalstorage();\n\t\tif ( local_storage_pixel_url !== false ) {\n\t\t\tif ( ctIsOutdatedPixelUrlLocalstorage(local_storage_pixel_url) ) {\n\t\t\t\tctCleaPixelUrlLocalstorage(local_storage_pixel_url)\n\t\t\t} else {\n\t\t\t\t//if so - load pixel from localstorage and draw it skipping AJAX\n\t\t\t\tctSetPixelImg(local_storage_pixel_url);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t// Using REST API handler\n\t\tif( ctPublicFunctions.data__ajax_type === 'rest' ){\n\t\t\tapbct_public_sendREST(\n\t\t\t\t'apbct_get_pixel_url',\n\t\t\t\t{\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\tcallback: function (result) {\n\t\t\t\t\t\tif (result) {\n\t\t\t\t\t\t\t//set pixel url to localstorage\n\t\t\t\t\t\t\tif ( ! ctGetPixelUrlLocalstorage() ){\n\t\t\t\t\t\t\t\tctSetPixelUrlLocalstorage(result);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t//then run pixel drawing\n\t\t\t\t\t\t\tctSetPixelImg(result);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t);\n\t\t// Using AJAX request and handler\n\t\t}else{\n\t\t\tapbct_public_sendAJAX(\n\t\t\t\t{\n\t\t\t\t\taction: 'apbct_get_pixel_url',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tnotJson: true,\n\t\t\t\t\tcallback: function (result) {\n\t\t\t\t\t\tif (result) {\n\t\t\t\t\t\t\t//set pixel url to localstorage\n\t\t\t\t\t\t\tif ( ! ctGetPixelUrlLocalstorage() ){\n\t\t\t\t\t\t\t\tctSetPixelUrlLocalstorage(result);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t//then run pixel drawing\n\t\t\t\t\t\t\tctSetPixelImg(result);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t}\n\n\tfunction ctSetHasScrolled() {\n\t\tif( ! ctScrollCollected ) {\n\t\t\tctSetCookie(\"ct_has_scrolled\", 'true');\n\t\t\tctScrollCollected = true;\n\t\t}\n\t}\n\n\tfunction ctSetMouseMoved() {\n\t\tif( ! ctMouseMovedCollected ) {\n\t\t\tctSetCookie(\"ct_mouse_moved\", 'true');\n\t\t\tctMouseMovedCollected = true;\n\t\t}\n\t}\n\n\tapbct_attach_event_handler(window, \"mousemove\", ctFunctionMouseMove);\n\tapbct_attach_event_handler(window, \"mousedown\", ctFunctionFirstKey);\n\tapbct_attach_event_handler(window, \"keydown\", ctFunctionFirstKey);\n\tapbct_attach_event_handler(window, \"scroll\", ctSetHasScrolled);\n\n\t// Ready function\n\tfunction apbct_ready(){\n\n\t\t// Collect scrolling info\n\t\tvar initCookies = [\n\t\t\t[\"ct_ps_timestamp\", Math.floor(new Date().getTime() / 1000)],\n\t\t\t[\"ct_fkp_timestamp\", \"0\"],\n\t\t\t[\"ct_pointer_data\", \"0\"],\n\t\t\t[\"ct_timezone\", ct_date.getTimezoneOffset()/60*(-1) ],\n\t\t\t[\"ct_screen_info\", apbctGetScreenInfo()],\n\t\t\t[\"ct_has_scrolled\", 'false'],\n\t\t\t[\"ct_mouse_moved\", 'false'],\n\t\t\t[\"apbct_headless\", navigator.webdriver],\n\t\t];\n\n\t\tif( ctPublic.data__cookies_type !== 'native' ) {\n\t\t\tinitCookies.push(['apbct_visible_fields', '0']);\n\t\t} else {\n\t\t\t// Delete all visible fields cookies on load the page\n\t\t\tvar cookiesArray = document.cookie.split(\";\");\n\t\t\tif( cookiesArray.length !== 0 ) {\n\t\t\t\tfor ( var i = 0; i < cookiesArray.length; i++ ) {\n\t\t\t\t\tvar currentCookie = cookiesArray[i].trim();\n\t\t\t\t\tvar cookieName = currentCookie.split(\"=\")[0];\n\t\t\t\t\tif( cookieName.indexOf(\"apbct_visible_fields_\") === 0 ) {\n\t\t\t\t\t\tctDeleteCookie(cookieName);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif( +ctPublic.pixel__setting ){\n\t\t\tif( +ctPublic.pixel__enabled ){\n\t\t\t\tctGetPixelUrl()\n\t\t\t} else {\n\t\t\t\tinitCookies.push(['apbct_pixel_url', ctPublic.pixel__url]);\n\t\t\t}\n\t\t}\n\n\t\tif ( +ctPublic.data__email_check_before_post) {\n\t\t\tinitCookies.push(['ct_checked_emails', '0']);\n\t\t\tjQuery(\"input[type = 'email'], #email\").blur(checkEmail);\n\t\t}\n\n\t\tctSetCookie(initCookies);\n\n\t\tsetTimeout(function(){\n\n\t\t\tfor(var i = 0; i < document.forms.length; i++){\n\t\t\t\tvar form = document.forms[i];\n\n\t\t\t\t//Exclusion for forms\n\t\t\t\tif (\n\t\t\t\t\t+ctPublic.data__visible_fields_required === 0 ||\n\t\t\t\t\tform.method.toString().toLowerCase() === 'get' ||\n\t\t\t\t\tform.classList.contains('slp_search_form') || //StoreLocatorPlus form\n\t\t\t\t\tform.parentElement.classList.contains('mec-booking') ||\n\t\t\t\t\tform.action.toString().indexOf('activehosted.com') !== -1 || // Active Campaign\n\t\t\t\t\t(form.id && form.id === 'caspioform') || //Caspio Form\n\t\t\t\t\t(form.classList && form.classList.contains('tinkoffPayRow')) || // TinkoffPayForm\n\t\t\t\t\t(form.classList && form.classList.contains('give-form')) || // GiveWP\n\t\t\t\t\t(form.id && form.id === 'ult-forgot-password-form') || //ult forgot password\n\t\t\t\t\t(form.id && form.id.toString().indexOf('calculatedfields') !== -1) || // CalculatedFieldsForm\n\t\t\t\t\t(form.id && form.id.toString().indexOf('sac-form') !== -1) || // Simple Ajax Chat\n\t\t\t\t\t(form.id && form.id.toString().indexOf('cp_tslotsbooking_pform') !== -1) || // WP Time Slots Booking Form\n\t\t\t\t\t(form.name && form.name.toString().indexOf('cp_tslotsbooking_pform') !== -1) || // WP Time Slots Booking Form\n\t\t\t\t\tform.action.toString() === 'https://epayment.epymtservice.com/epay.jhtml' || // Custom form\n\t\t\t\t\t(form.name && form.name.toString().indexOf('tribe-bar-form') !== -1) // The Events Calendar\n\t\t\t\t) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tvar hiddenInput = document.createElement( 'input' );\n\t\t\t\thiddenInput.setAttribute( 'type', 'hidden' );\n\t\t\t\thiddenInput.setAttribute( 'id', 'apbct_visible_fields_' + i );\n\t\t\t\thiddenInput.setAttribute( 'name', 'apbct_visible_fields');\n\t\t\t\tvar visibleFieldsToInput = {};\n\t\t\t\tvisibleFieldsToInput[0] = apbct_collect_visible_fields(form);\n\t\t\t\thiddenInput.value = JSON.stringify(visibleFieldsToInput);\n\t\t\t\tform.append( hiddenInput );\n\n\t\t\t\tform.onsubmit_prev = form.onsubmit;\n\n\t\t\t\tform.ctFormIndex = i;\n\t\t\t\tform.onsubmit = function (event) {\n\n\t\t\t\t\tif ( ctPublic.data__cookies_type !== 'native' && typeof event.target.ctFormIndex !== 'undefined' ) {\n\n\t\t\t\t\t\tvar visible_fields = {};\n\t\t\t\t\t\tvisible_fields[0] = apbct_collect_visible_fields(this);\n\t\t\t\t\t\tapbct_visible_fields_set_cookie( visible_fields, event.target.ctFormIndex );\n\t\t\t\t\t}\n\n\t\t\t\t\t// Call previous submit action\n\t\t\t\t\tif (event.target.onsubmit_prev instanceof Function) {\n\t\t\t\t\t\tsetTimeout(function () {\n\t\t\t\t\t\t\tevent.target.onsubmit_prev.call(event.target, event);\n\t\t\t\t\t\t}, 500);\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t}\n\n\t\t}, 1000);\n\n\t\t// Listen clicks on encoded emails\n\t\tlet decodedEmailNodes = document.querySelectorAll(\"[data-original-string]\");\n\t\tif (decodedEmailNodes.length) {\n\t\t\tfor (let i = 0; i < decodedEmailNodes.length; ++i) {\n\t\t\t\tif (\n\t\t\t\t\tdecodedEmailNodes[i].parentElement.href ||\n\t\t\t\t\tdecodedEmailNodes[i].parentElement.parentElement.href\n\t\t\t\t) {\n\t\t\t\t\t// Skip listening click on hyperlinks\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tdecodedEmailNodes[i].addEventListener('click', function ctFillDecodedEmailHandler(event) {\n\t\t\t\t\tthis.removeEventListener('click', ctFillDecodedEmailHandler);\n\t\t\t\t\tapbctAjaxEmailDecode(event);\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\tapbct_attach_event_handler(window, \"DOMContentLoaded\", apbct_ready);\n\n}());\n\nfunction apbctAjaxEmailDecode(event){\n\tconst element = event.target;\n\telement.setAttribute('title', ctPublicFunctions.text__wait_for_decoding);\n\telement.style.cursor = 'progress';\n\t// Using REST API handler\n\tif( ctPublicFunctions.data__ajax_type === 'rest' ){\n\t\tapbct_public_sendREST(\n\t\t\t'apbct_decode_email',\n\t\t\t{\n\t\t\t\tdata: {encodedEmail: event.target.dataset.originalString},\n\t\t\t\tmethod: 'POST',\n\t\t\t\tcallback: function (result) {\n\t\t\t\t\tif (result.success) {\n\t\t\t\t\t\tctFillDecodedEmail(result.data, event.target);\n\t\t\t\t\t\telement.setAttribute('title', '');\n\t\t\t\t\t\telement.removeAttribute('style');\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t}\n\t\t);\n\t\t// Using AJAX request and handler\n\t}else{\n\t\tapbct_public_sendAJAX(\n\t\t\t{\n\t\t\t\taction: 'apbct_decode_email',\n\t\t\t\tencodedEmail: event.target.dataset.originalString\n\t\t\t},\n\t\t\t{\n\t\t\t\tnotJson: true,\n\t\t\t\tcallback: function (result) {\n\t\t\t\t\tif (result.success) {\n\t\t\t\t\t\tctFillDecodedEmail(result.data, event.target);\n\t\t\t\t\t\telement.setAttribute('title', '');\n\t\t\t\t\t\telement.removeAttribute('style');\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t}\n\t\t);\n\t}\n}\n\nfunction ctFillDecodedEmail(result, targetElement){\n\ttargetElement.innerText = result;\n}\n\nfunction apbct_collect_visible_fields( form ) {\n\n\t// Get only fields\n\tvar inputs = [],\n\t\tinputs_visible = '',\n\t\tinputs_visible_count = 0,\n\t\tinputs_invisible = '',\n\t\tinputs_invisible_count = 0,\n\t\tinputs_with_duplicate_names = [];\n\n\tfor(var key in form.elements){\n\t\tif(!isNaN(+key))\n\t\t\tinputs[key] = form.elements[key];\n\t}\n\n\t// Filter fields\n\tinputs = inputs.filter(function(elem){\n\n\t\t// Filter already added fields\n\t\tif( inputs_with_duplicate_names.indexOf( elem.getAttribute('name') ) !== -1 ){\n\t\t\treturn false;\n\t\t}\n\t\t// Filter inputs with same names for type == radio\n\t\tif( -1 !== ['radio', 'checkbox'].indexOf( elem.getAttribute(\"type\") )){\n\t\t\tinputs_with_duplicate_names.push( elem.getAttribute('name') );\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t});\n\n\t// Visible fields\n\tinputs.forEach(function(elem, i, elements){\n\t\t// Unnecessary fields\n\t\tif(\n\t\t\telem.getAttribute(\"type\") === \"submit\" || // type == submit\n\t\t\telem.getAttribute('name') === null ||\n\t\t\telem.getAttribute('name') === 'ct_checkjs'\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\t// Invisible fields\n\t\tif(\n\t\t\tgetComputedStyle(elem).display === \"none\" || // hidden\n\t\t\tgetComputedStyle(elem).visibility === \"hidden\" || // hidden\n\t\t\tgetComputedStyle(elem).opacity === \"0\" || // hidden\n\t\t\telem.getAttribute(\"type\") === \"hidden\" // type == hidden\n\t\t) {\n\t\t\tif( elem.classList.contains(\"wp-editor-area\") ) {\n\t\t\t\tinputs_visible += \" \" + elem.getAttribute(\"name\");\n\t\t\t\tinputs_visible_count++;\n\t\t\t} else {\n\t\t\t\tinputs_invisible += \" \" + elem.getAttribute(\"name\");\n\t\t\t\tinputs_invisible_count++;\n\t\t\t}\n\t\t}\n\t\t// Visible fields\n\t\telse {\n\t\t\tinputs_visible += \" \" + elem.getAttribute(\"name\");\n\t\t\tinputs_visible_count++;\n\t\t}\n\n\t});\n\n\tinputs_invisible = inputs_invisible.trim();\n\tinputs_visible = inputs_visible.trim();\n\n\treturn {\n\t\tvisible_fields : inputs_visible,\n\t\tvisible_fields_count : inputs_visible_count,\n\t\tinvisible_fields : inputs_invisible,\n\t\tinvisible_fields_count : inputs_invisible_count,\n\t}\n\n}\n\nfunction apbct_visible_fields_set_cookie( visible_fields_collection, form_id ) {\n\n\tvar collection = typeof visible_fields_collection === 'object' && visible_fields_collection !== null ? visible_fields_collection : {};\n\n\tif( ctPublic.data__cookies_type === 'native' ) {\n\t\tfor ( var i in collection ) {\n\t\t\tif ( i > 10 ) {\n\t\t\t\t// Do not generate more than 10 cookies\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar collectionIndex = form_id !== undefined ? form_id : i;\n\t\t\tctSetCookie(\"apbct_visible_fields_\" + collectionIndex, JSON.stringify( collection[i] ) );\n\t\t}\n\t} else {\n\t\tctSetCookie(\"apbct_visible_fields\", JSON.stringify( collection ) );\n\t}\n}\n\nfunction apbct_js_keys__set_input_value(result, data, params, obj){\n\tif( document.querySelectorAll('[name^=ct_checkjs]').length > 0 ) {\n\t\tvar elements = document.querySelectorAll('[name^=ct_checkjs]');\n\t\tfor ( var i = 0; i < elements.length; i++ ) {\n\t\t\telements[i].value = result.js_key;\n\t\t}\n\t}\n}\n\nfunction apbctGetScreenInfo() {\n\treturn JSON.stringify({\n\t\tfullWidth : document.documentElement.scrollWidth,\n\t\tfullHeight : Math.max(\n\t\t\tdocument.body.scrollHeight, document.documentElement.scrollHeight,\n\t\t\tdocument.body.offsetHeight, document.documentElement.offsetHeight,\n\t\t\tdocument.body.clientHeight, document.documentElement.clientHeight\n\t\t),\n\t\tvisibleWidth : document.documentElement.clientWidth,\n\t\tvisibleHeight : document.documentElement.clientHeight,\n\t});\n}\n\nif(typeof jQuery !== 'undefined') {\n\n\t// Capturing responses and output block message for unknown AJAX forms\n\tjQuery(document).ajaxComplete(function (event, xhr, settings) {\n\t\tif (xhr.responseText && xhr.responseText.indexOf('\"apbct') !== -1) {\n\t\t\tvar response = JSON.parse(xhr.responseText);\n\t\t\tif (typeof response.apbct !== 'undefined') {\n\t\t\t\tresponse = response.apbct;\n\t\t\t\tif (response.blocked) {\n\t\t\t\t\tdocument.dispatchEvent(\n\t\t\t\t\t\tnew CustomEvent( \"apbctAjaxBockAlert\", {\n\t\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\t\tdetail: { message: response.comment }\n\t\t\t\t\t\t} )\n\t\t\t\t\t);\n\n\t\t\t\t\t// Show the result by modal\n\t\t\t\t\tcleantalkModal.loaded = response.comment;\n\t\t\t\t\tcleantalkModal.open();\n\n\t\t\t\t\tif(+response.stop_script == 1)\n\t\t\t\t\t\twindow.stop();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n}\n\nfunction ctSetPixelUrlLocalstorage(ajax_pixel_url) {\n\t//set pixel to the storage\n\tlocalStorage.setItem('session_pixel_url', ajax_pixel_url)\n\t//set pixel timestamp to the storage\n\tlocalStorage.setItem(ajax_pixel_url, Math.floor(Date.now() / 1000).toString())\n}\n\nfunction ctGetPixelUrlLocalstorage() {\n\tlet local_storage_pixel = localStorage.getItem('session_pixel_url');\n\tif ( local_storage_pixel !== null ) {\n\t\treturn local_storage_pixel;\n\t} else {\n\t\treturn false;\n\t}\n}\n\nfunction ctIsOutdatedPixelUrlLocalstorage(local_storage_pixel_url) {\n\tlet local_storage_pixel_timestamp = Number(localStorage.getItem(local_storage_pixel_url));\n\tlet current_timestamp = Math.floor(Date.now() / 1000).toString()\n\tlet timestamp_difference = current_timestamp - local_storage_pixel_timestamp;\n\treturn timestamp_difference > 3600 * 3;\n}\n\nfunction ctCleaPixelUrlLocalstorage(local_storage_pixel_url) {\n\t//remove timestamp\n\tlocalStorage.removeItem(local_storage_pixel_url)\n\t//remove pixel itself\n\tlocalStorage.removeItem('session_pixel_url')\n}"],"names":["apbctAjaxEmailDecode","event","element","target","setAttribute","ctPublicFunctions","text__wait_for_decoding","style","cursor","data__ajax_type","apbct_public_sendREST","data","encodedEmail","dataset","originalString","method","callback","result","success","ctFillDecodedEmail","removeAttribute","apbct_public_sendAJAX","action","notJson","targetElement","innerText","apbct_collect_visible_fields","form","key","inputs","inputs_visible","inputs_visible_count","inputs_invisible","inputs_invisible_count","inputs_with_duplicate_names","elements","isNaN","filter","elem","indexOf","getAttribute","push","forEach","i","getComputedStyle","display","visibility","opacity","classList","contains","trim","visible_fields","visible_fields_count","invisible_fields","invisible_fields_count","apbct_visible_fields_set_cookie","visible_fields_collection","form_id","collection","ctPublic","data__cookies_type","ctSetCookie","undefined","JSON","stringify","apbct_js_keys__set_input_value","params","obj","document","querySelectorAll","length","value","js_key","apbctGetScreenInfo","fullWidth","documentElement","scrollWidth","fullHeight","Math","max","body","scrollHeight","offsetHeight","clientHeight","visibleWidth","clientWidth","visibleHeight","ctSetPixelUrlLocalstorage","ajax_pixel_url","localStorage","setItem","floor","Date","now","toString","ctGetPixelUrlLocalstorage","let","local_storage_pixel","getItem","ctIsOutdatedPixelUrlLocalstorage","local_storage_pixel_url","local_storage_pixel_timestamp","Number","ctCleaPixelUrlLocalstorage","removeItem","ct_date","ctTimeMs","getTime","ctMouseEventTimerFlag","ctMouseData","ctMouseDataCounter","ctCheckedEmails","ctScrollCollected","ctMouseMovedCollected","apbct_attach_event_handler","window","addEventListener","attachEvent","apbct_remove_event_handler","removeEventListener","detachEvent","ctFunctionFirstKey","KeyTimestamp","ctMouseReadInterval","setInterval","ctMouseWriteDataInterval","ctFunctionMouseMove","round","clientY","clientX","clearInterval","checkEmail","e","current_email","email","timestamp","ctSetPixelImg","pixelUrl","pixel__enabled","getElementById","jQuery","append","initCookies","getTimezoneOffset","navigator","webdriver","cookiesArray","cookie","split","cookieName","ctDeleteCookie","pixel__setting","ctGetPixelUrl","pixel__url","data__email_check_before_post","blur","setTimeout","forms","hiddenInput","visibleFieldsToInput","data__visible_fields_required","toLowerCase","parentElement","id","name","createElement","onsubmit_prev","onsubmit","ctFormIndex","this","Function","call","decodedEmailNodes","href","ctFillDecodedEmailHandler","ajaxComplete","xhr","settings","responseText","response","parse","apbct","blocked","dispatchEvent","CustomEvent","bubbles","detail","message","comment","cleantalkModal","loaded","open","stop_script","stop"],"mappings":"AA2TA,SAASA,qBAAqBC,GAC7B,MAAMC,EAAUD,EAAME,OACtBD,EAAQE,aAAa,QAASC,kBAAkBC,yBAChDJ,EAAQK,MAAMC,OAAS,WAEmB,SAAtCH,kBAAkBI,gBACrBC,sBACC,qBACA,CACCC,KAAM,CAACC,aAAcX,EAAME,OAAOU,QAAQC,gBAC1CC,OAAQ,OACRC,SAAU,SAAUC,GACfA,EAAOC,UACVC,mBAAmBF,EAAON,KAAMV,EAAME,QACtCD,EAAQE,aAAa,QAAS,IAC9BF,EAAQkB,gBAAgB,aAO5BC,sBACC,CACCC,OAAQ,qBACRV,aAAcX,EAAME,OAAOU,QAAQC,gBAEpC,CACCS,SAAS,EACTP,SAAU,SAAUC,GACfA,EAAOC,UACVC,mBAAmBF,EAAON,KAAMV,EAAME,QACtCD,EAAQE,aAAa,QAAS,IAC9BF,EAAQkB,gBAAgB,aAQ9B,SAASD,mBAAmBF,EAAQO,GACnCA,EAA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imeMs = new Date().getTime(),\n\t\tctMouseEventTimerFlag = true, //Reading interval flag\n\t\tctMouseData = [],\n\t\tctMouseDataCounter = 0,\n\t\tctCheckedEmails = {};\n\n\tfunction apbct_attach_event_handler(elem, event, callback){\n\t\tif(typeof window.addEventListener === \"function\") elem.addEventListener(event, callback);\n\t\telse elem.attachEvent(event, callback);\n\t}\n\n\tfunction apbct_remove_event_handler(elem, event, callback){\n\t\tif(typeof window.removeEventListener === \"function\") elem.removeEventListener(event, callback);\n\t\telse elem.detachEvent(event, callback);\n\t}\n\n\t//Writing first key press timestamp\n\tvar ctFunctionFirstKey = function output(event){\n\t\tvar KeyTimestamp = Math.floor(new Date().getTime()/1000);\n\t\tctSetCookie(\"ct_fkp_timestamp\", KeyTimestamp);\n\t\tctKeyStopStopListening();\n\t};\n\n\t//Reading interval\n\tvar ctMouseReadInterval = setInterval(function(){\n\t\tctMouseEventTimerFlag = true;\n\t}, 150);\n\n\t//Writting interval\n\tvar ctMouseWriteDataInterval = setInterval(function(){\n\t\tctSetCookie(\"ct_pointer_data\", JSON.stringify(ctMouseData));\n\t}, 1200);\n\n\t//Logging mouse position each 150 ms\n\tvar ctFunctionMouseMove = function output(event){\n\t\tctSetMouseMoved();\n\t\tif(ctMouseEventTimerFlag === true){\n\n\t\t\tctMouseData.push([\n\t\t\t\tMath.round(event.clientY),\n\t\t\t\tMath.round(event.clientX),\n\t\t\t\tMath.round(new Date().getTime() - ctTimeMs)\n\t\t\t]);\n\n\t\t\tctMouseDataCounter++;\n\t\t\tctMouseEventTimerFlag = false;\n\t\t\tif(ctMouseDataCounter >= 50){\n\t\t\t\tctMouseStopData();\n\t\t\t}\n\t\t}\n\t};\n\n\t//Stop mouse observing function\n\tfunction ctMouseStopData(){\n\t\tapbct_remove_event_handler(window, \"mousemove\", ctFunctionMouseMove);\n\t\tclearInterval(ctMouseReadInterval);\n\t\tclearInterval(ctMouseWriteDataInterval);\n\t}\n\n\t//Stop key listening function\n\tfunction ctKeyStopStopListening(){\n\t\tapbct_remove_event_handler(window, \"mousedown\", ctFunctionFirstKey);\n\t\tapbct_remove_event_handler(window, \"keydown\", ctFunctionFirstKey);\n\t}\n\n\tfunction checkEmail(e) {\n\t\tvar current_email = e.target.value;\n\t\tif (current_email && !(current_email in ctCheckedEmails)) {\n\t\t\t// Using REST API handler\n\t\t\tif( ctPublicFunctions.data__ajax_type === 'rest' ){\n\t\t\t\tapbct_public_sendREST(\n\t\t\t\t\t'check_email_before_post',\n\t\t\t\t\t{\n\t\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\t\tdata: {'email' : current_email},\n\t\t\t\t\t\tcallback: function (result) {\n\t\t\t\t\t\t\tif (result.result) {\n\t\t\t\t\t\t\t\tctCheckedEmails[current_email] = {'result' : result.result, 'timestamp': Date.now() / 1000 |0};\n\t\t\t\t\t\t\t\tctSetCookie('ct_checked_emails', JSON.stringify(ctCheckedEmails));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t// Using AJAX request and handler\n\t\t\t} else if( ctPublicFunctions.data__ajax_type === 'admin_ajax' ) {\n\t\t\t\tapbct_public_sendAJAX(\n\t\t\t\t\t{\n\t\t\t\t\t\taction: 'apbct_email_check_before_post',\n\t\t\t\t\t\temail : current_email,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tcallback: function (result) {\n\t\t\t\t\t\t\tif (result.result) {\n\t\t\t\t\t\t\t\tctCheckedEmails[current_email] = {'result' : result.result, 'timestamp': Date.now() / 1000 |0};\n\t\t\t\t\t\t\t\tctSetCookie('ct_checked_emails', JSON.stringify(ctCheckedEmails));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction ctSetPixelImg(pixelUrl) {\n\t\tctSetCookie('apbct_pixel_url', pixelUrl);\n\t\tif( +ctPublic.pixel__enabled ){\n\t\t\tif( ! document.getElementById('apbct_pixel') ) {\n\t\t\t\tjQuery('body').append( '<img alt=\"Cleantalk Pixel\" id=\"apbct_pixel\" style=\"display: none; left: 99999px;\" src=\"' + pixelUrl + '\">' );\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction ctGetPixelUrl() {\n\t\t// Check if pixel is already in localstorage and is not outdated\n\t\tlet local_storage_pixel_url = ctGetPixelUrlLocalstorage();\n\t\tif ( local_storage_pixel_url !== false ) {\n\t\t\tif ( ctIsOutdatedPixelUrlLocalstorage(local_storage_pixel_url) ) {\n\t\t\t\tctCleaPixelUrlLocalstorage(local_storage_pixel_url)\n\t\t\t} else {\n\t\t\t\t//if so - load pixel from localstorage and draw it skipping AJAX\n\t\t\t\tctSetPixelImg(local_storage_pixel_url);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t// Using REST API handler\n\t\tif( ctPublicFunctions.data__ajax_type === 'rest' ){\n\t\t\tapbct_public_sendREST(\n\t\t\t\t'apbct_get_pixel_url',\n\t\t\t\t{\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\tcallback: function (result) {\n\t\t\t\t\t\tif (result) {\n\t\t\t\t\t\t\t//set pixel url to localstorage\n\t\t\t\t\t\t\tif ( ! ctGetPixelUrlLocalstorage() ){\n\t\t\t\t\t\t\t\tctSetPixelUrlLocalstorage(result);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t//then run pixel drawing\n\t\t\t\t\t\t\tctSetPixelImg(result);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t);\n\t\t// Using AJAX request and handler\n\t\t}else{\n\t\t\tapbct_public_sendAJAX(\n\t\t\t\t{\n\t\t\t\t\taction: 'apbct_get_pixel_url',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tnotJson: true,\n\t\t\t\t\tcallback: function (result) {\n\t\t\t\t\t\tif (result) {\n\t\t\t\t\t\t\t//set pixel url to localstorage\n\t\t\t\t\t\t\tif ( ! ctGetPixelUrlLocalstorage() ){\n\t\t\t\t\t\t\t\tctSetPixelUrlLocalstorage(result);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t//then run pixel drawing\n\t\t\t\t\t\t\tctSetPixelImg(result);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t}\n\n\tfunction ctSetHasScrolled() {\n\t\tif( ! apbctLocalStorage.isSet('ct_has_scrolled') || ! apbctLocalStorage.get('ct_has_scrolled') ) {\n\t\t\tctSetCookie(\"ct_has_scrolled\", 'true');\n\t\t\tapbctLocalStorage.set('ct_has_scrolled', true);\n\t\t}\n\t}\n\n\tfunction ctSetMouseMoved() {\n\t\tif( ! apbctLocalStorage.isSet('ct_mouse_moved') || ! apbctLocalStorage.get('ct_mouse_moved') ) {\n\t\t\tctSetCookie(\"ct_mouse_moved\", 'true');\n\t\t\tapbctLocalStorage.set('ct_mouse_moved', true);\n\t\t}\n\t}\n\n\tapbct_attach_event_handler(window, \"mousemove\", ctFunctionMouseMove);\n\tapbct_attach_event_handler(window, \"mousedown\", ctFunctionFirstKey);\n\tapbct_attach_event_handler(window, \"keydown\", ctFunctionFirstKey);\n\tapbct_attach_event_handler(window, \"scroll\", ctSetHasScrolled);\n\n\t// Ready function\n\tfunction apbct_ready(){\n\n\t\t// Collect scrolling info\n\t\tvar initCookies = [\n\t\t\t[\"ct_ps_timestamp\", Math.floor(new Date().getTime() / 1000)],\n\t\t\t[\"ct_fkp_timestamp\", \"0\"],\n\t\t\t[\"ct_pointer_data\", \"0\"],\n\t\t\t[\"ct_timezone\", ct_date.getTimezoneOffset()/60*(-1) ],\n\t\t\t[\"ct_screen_info\", apbctGetScreenInfo()],\n\t\t\t[\"apbct_headless\", navigator.webdriver],\n\t\t];\n\n\t\tif( ctPublic.data__cookies_type !== 'native' ) {\n\t\t\tinitCookies.push(['apbct_visible_fields', '0']);\n\t\t} else {\n\t\t\t// Delete all visible fields cookies on load the page\n\t\t\tvar cookiesArray = document.cookie.split(\";\");\n\t\t\tif( cookiesArray.length !== 0 ) {\n\t\t\t\tfor ( var i = 0; i < cookiesArray.length; i++ ) {\n\t\t\t\t\tvar currentCookie = cookiesArray[i].trim();\n\t\t\t\t\tvar cookieName = currentCookie.split(\"=\")[0];\n\t\t\t\t\tif( cookieName.indexOf(\"apbct_visible_fields_\") === 0 ) {\n\t\t\t\t\t\tctDeleteCookie(cookieName);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif( +ctPublic.pixel__setting ){\n\t\t\tif( +ctPublic.pixel__enabled ){\n\t\t\t\tctGetPixelUrl()\n\t\t\t} else {\n\t\t\t\tinitCookies.push(['apbct_pixel_url', ctPublic.pixel__url]);\n\t\t\t}\n\t\t}\n\n\t\tif ( +ctPublic.data__email_check_before_post) {\n\t\t\tinitCookies.push(['ct_checked_emails', '0']);\n\t\t\tjQuery(\"input[type = 'email'], #email\").blur(checkEmail);\n\t\t}\n\n\t\tctSetCookie(initCookies);\n\n\t\tsetTimeout(function(){\n\n\t\t\tfor(var i = 0; i < document.forms.length; i++){\n\t\t\t\tvar form = document.forms[i];\n\n\t\t\t\t//Exclusion for forms\n\t\t\t\tif (\n\t\t\t\t\t+ctPublic.data__visible_fields_required === 0 ||\n\t\t\t\t\tform.method.toString().toLowerCase() === 'get' ||\n\t\t\t\t\tform.classList.contains('slp_search_form') || //StoreLocatorPlus form\n\t\t\t\t\tform.parentElement.classList.contains('mec-booking') ||\n\t\t\t\t\tform.action.toString().indexOf('activehosted.com') !== -1 || // Active Campaign\n\t\t\t\t\t(form.id && form.id === 'caspioform') || //Caspio Form\n\t\t\t\t\t(form.classList && form.classList.contains('tinkoffPayRow')) || // TinkoffPayForm\n\t\t\t\t\t(form.classList && form.classList.contains('give-form')) || // GiveWP\n\t\t\t\t\t(form.id && form.id === 'ult-forgot-password-form') || //ult forgot password\n\t\t\t\t\t(form.id && form.id.toString().indexOf('calculatedfields') !== -1) || // CalculatedFieldsForm\n\t\t\t\t\t(form.id && form.id.toString().indexOf('sac-form') !== -1) || // Simple Ajax Chat\n\t\t\t\t\t(form.id && form.id.toString().indexOf('cp_tslotsbooking_pform') !== -1) || // WP Time Slots Booking Form\n\t\t\t\t\t(form.name && form.name.toString().indexOf('cp_tslotsbooking_pform') !== -1) || // WP Time Slots Booking Form\n\t\t\t\t\tform.action.toString() === 'https://epayment.epymtservice.com/epay.jhtml' || // Custom form\n\t\t\t\t\t(form.name && form.name.toString().indexOf('tribe-bar-form') !== -1) // The Events Calendar\n\t\t\t\t) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tvar hiddenInput = document.createElement( 'input' );\n\t\t\t\thiddenInput.setAttribute( 'type', 'hidden' );\n\t\t\t\thiddenInput.setAttribute( 'id', 'apbct_visible_fields_' + i );\n\t\t\t\thiddenInput.setAttribute( 'name', 'apbct_visible_fields');\n\t\t\t\tvar visibleFieldsToInput = {};\n\t\t\t\tvisibleFieldsToInput[0] = apbct_collect_visible_fields(form);\n\t\t\t\thiddenInput.value = JSON.stringify(visibleFieldsToInput);\n\t\t\t\tform.append( hiddenInput );\n\n\t\t\t\tform.onsubmit_prev = form.onsubmit;\n\n\t\t\t\tform.ctFormIndex = i;\n\t\t\t\tform.onsubmit = function (event) {\n\n\t\t\t\t\tif ( ctPublic.data__cookies_type !== 'native' && typeof event.target.ctFormIndex !== 'undefined' ) {\n\n\t\t\t\t\t\tvar visible_fields = {};\n\t\t\t\t\t\tvisible_fields[0] = apbct_collect_visible_fields(this);\n\t\t\t\t\t\tapbct_visible_fields_set_cookie( visible_fields, event.target.ctFormIndex );\n\t\t\t\t\t}\n\n\t\t\t\t\t// Call previous submit action\n\t\t\t\t\tif (event.target.onsubmit_prev instanceof Function) {\n\t\t\t\t\t\tsetTimeout(function () {\n\t\t\t\t\t\t\tevent.target.onsubmit_prev.call(event.target, event);\n\t\t\t\t\t\t}, 500);\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t}\n\n\t\t}, 1000);\n\n\t\t// Listen clicks on encoded emails\n\t\tlet decodedEmailNodes = document.querySelectorAll(\"[data-original-string]\");\n\t\tif (decodedEmailNodes.length) {\n\t\t\tfor (let i = 0; i < decodedEmailNodes.length; ++i) {\n\t\t\t\tif (\n\t\t\t\t\tdecodedEmailNodes[i].parentElement.href ||\n\t\t\t\t\tdecodedEmailNodes[i].parentElement.parentElement.href\n\t\t\t\t) {\n\t\t\t\t\t// Skip listening click on hyperlinks\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tdecodedEmailNodes[i].addEventListener('click', function ctFillDecodedEmailHandler(event) {\n\t\t\t\t\tthis.removeEventListener('click', ctFillDecodedEmailHandler);\n\t\t\t\t\tapbctAjaxEmailDecode(event);\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\tapbct_attach_event_handler(window, \"DOMContentLoaded\", apbct_ready);\n\n}());\n\nfunction apbctAjaxEmailDecode(event){\n\tconst element = event.target;\n\telement.setAttribute('title', ctPublicFunctions.text__wait_for_decoding);\n\telement.style.cursor = 'progress';\n\t// Using REST API handler\n\tif( ctPublicFunctions.data__ajax_type === 'rest' ){\n\t\tapbct_public_sendREST(\n\t\t\t'apbct_decode_email',\n\t\t\t{\n\t\t\t\tdata: {encodedEmail: event.target.dataset.originalString},\n\t\t\t\tmethod: 'POST',\n\t\t\t\tcallback: function (result) {\n\t\t\t\t\tif (result.success) {\n\t\t\t\t\t\tctFillDecodedEmail(result.data, event.target);\n\t\t\t\t\t\telement.setAttribute('title', '');\n\t\t\t\t\t\telement.removeAttribute('style');\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t}\n\t\t);\n\t\t// Using AJAX request and handler\n\t}else{\n\t\tapbct_public_sendAJAX(\n\t\t\t{\n\t\t\t\taction: 'apbct_decode_email',\n\t\t\t\tencodedEmail: event.target.dataset.originalString\n\t\t\t},\n\t\t\t{\n\t\t\t\tnotJson: true,\n\t\t\t\tcallback: function (result) {\n\t\t\t\t\tif (result.success) {\n\t\t\t\t\t\tctFillDecodedEmail(result.data, event.target);\n\t\t\t\t\t\telement.setAttribute('title', '');\n\t\t\t\t\t\telement.removeAttribute('style');\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t}\n\t\t);\n\t}\n}\n\nfunction ctFillDecodedEmail(result, targetElement){\n\ttargetElement.innerHTML = result;\n}\n\nfunction apbct_collect_visible_fields( form ) {\n\n\t// Get only fields\n\tvar inputs = [],\n\t\tinputs_visible = '',\n\t\tinputs_visible_count = 0,\n\t\tinputs_invisible = '',\n\t\tinputs_invisible_count = 0,\n\t\tinputs_with_duplicate_names = [];\n\n\tfor(var key in form.elements){\n\t\tif(!isNaN(+key))\n\t\t\tinputs[key] = form.elements[key];\n\t}\n\n\t// Filter fields\n\tinputs = inputs.filter(function(elem){\n\n\t\t// Filter already added fields\n\t\tif( inputs_with_duplicate_names.indexOf( elem.getAttribute('name') ) !== -1 ){\n\t\t\treturn false;\n\t\t}\n\t\t// Filter inputs with same names for type == radio\n\t\tif( -1 !== ['radio', 'checkbox'].indexOf( elem.getAttribute(\"type\") )){\n\t\t\tinputs_with_duplicate_names.push( elem.getAttribute('name') );\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t});\n\n\t// Visible fields\n\tinputs.forEach(function(elem, i, elements){\n\t\t// Unnecessary fields\n\t\tif(\n\t\t\telem.getAttribute(\"type\") === \"submit\" || // type == submit\n\t\t\telem.getAttribute('name') === null ||\n\t\t\telem.getAttribute('name') === 'ct_checkjs'\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\t// Invisible fields\n\t\tif(\n\t\t\tgetComputedStyle(elem).display === \"none\" || // hidden\n\t\t\tgetComputedStyle(elem).visibility === \"hidden\" || // hidden\n\t\t\tgetComputedStyle(elem).opacity === \"0\" || // hidden\n\t\t\telem.getAttribute(\"type\") === \"hidden\" // type == hidden\n\t\t) {\n\t\t\tif( elem.classList.contains(\"wp-editor-area\") ) {\n\t\t\t\tinputs_visible += \" \" + elem.getAttribute(\"name\");\n\t\t\t\tinputs_visible_count++;\n\t\t\t} else {\n\t\t\t\tinputs_invisible += \" \" + elem.getAttribute(\"name\");\n\t\t\t\tinputs_invisible_count++;\n\t\t\t}\n\t\t}\n\t\t// Visible fields\n\t\telse {\n\t\t\tinputs_visible += \" \" + elem.getAttribute(\"name\");\n\t\t\tinputs_visible_count++;\n\t\t}\n\n\t});\n\n\tinputs_invisible = inputs_invisible.trim();\n\tinputs_visible = inputs_visible.trim();\n\n\treturn {\n\t\tvisible_fields : inputs_visible,\n\t\tvisible_fields_count : inputs_visible_count,\n\t\tinvisible_fields : inputs_invisible,\n\t\tinvisible_fields_count : inputs_invisible_count,\n\t}\n\n}\n\nfunction apbct_visible_fields_set_cookie( visible_fields_collection, form_id ) {\n\n\tvar collection = typeof visible_fields_collection === 'object' && visible_fields_collection !== null ? visible_fields_collection : {};\n\n\tif( ctPublic.data__cookies_type === 'native' ) {\n\t\tfor ( var i in collection ) {\n\t\t\tif ( i > 10 ) {\n\t\t\t\t// Do not generate more than 10 cookies\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar collectionIndex = form_id !== undefined ? form_id : i;\n\t\t\tctSetCookie(\"apbct_visible_fields_\" + collectionIndex, JSON.stringify( collection[i] ) );\n\t\t}\n\t} else {\n\t\tctSetCookie(\"apbct_visible_fields\", JSON.stringify( collection ) );\n\t}\n}\n\nfunction apbct_js_keys__set_input_value(result, data, params, obj){\n\tif( document.querySelectorAll('[name^=ct_checkjs]').length > 0 ) {\n\t\tvar elements = document.querySelectorAll('[name^=ct_checkjs]');\n\t\tfor ( var i = 0; i < elements.length; i++ ) {\n\t\t\telements[i].value = result.js_key;\n\t\t}\n\t}\n}\n\nfunction apbctGetScreenInfo() {\n\treturn JSON.stringify({\n\t\tfullWidth : document.documentElement.scrollWidth,\n\t\tfullHeight : Math.max(\n\t\t\tdocument.body.scrollHeight, document.documentElement.scrollHeight,\n\t\t\tdocument.body.offsetHeight, document.documentElement.offsetHeight,\n\t\t\tdocument.body.clientHeight, document.documentElement.clientHeight\n\t\t),\n\t\tvisibleWidth : document.documentElement.clientWidth,\n\t\tvisibleHeight : document.documentElement.clientHeight,\n\t});\n}\n\nif(typeof jQuery !== 'undefined') {\n\n\t// Capturing responses and output block message for unknown AJAX forms\n\tjQuery(document).ajaxComplete(function (event, xhr, settings) {\n\t\tif (xhr.responseText && xhr.responseText.indexOf('\"apbct') !== -1) {\n\t\t\tvar response = JSON.parse(xhr.responseText);\n\t\t\tif (typeof response.apbct !== 'undefined') {\n\t\t\t\tresponse = response.apbct;\n\t\t\t\tif (response.blocked) {\n\t\t\t\t\tdocument.dispatchEvent(\n\t\t\t\t\t\tnew CustomEvent( \"apbctAjaxBockAlert\", {\n\t\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\t\tdetail: { message: response.comment }\n\t\t\t\t\t\t} )\n\t\t\t\t\t);\n\n\t\t\t\t\t// Show the result by modal\n\t\t\t\t\tcleantalkModal.loaded = response.comment;\n\t\t\t\t\tcleantalkModal.open();\n\n\t\t\t\t\tif(+response.stop_script == 1)\n\t\t\t\t\t\twindow.stop();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n}\n\nfunction ctSetPixelUrlLocalstorage(ajax_pixel_url) {\n\t//set pixel to the storage\n\tlocalStorage.setItem('session_pixel_url', ajax_pixel_url)\n\t//set pixel timestamp to the storage\n\tlocalStorage.setItem(ajax_pixel_url, Math.floor(Date.now() / 1000).toString())\n}\n\nfunction ctGetPixelUrlLocalstorage() {\n\tlet local_storage_pixel = localStorage.getItem('session_pixel_url');\n\tif ( local_storage_pixel !== null ) {\n\t\treturn local_storage_pixel;\n\t} else {\n\t\treturn false;\n\t}\n}\n\nfunction ctIsOutdatedPixelUrlLocalstorage(local_storage_pixel_url) {\n\tlet local_storage_pixel_timestamp = Number(localStorage.getItem(local_storage_pixel_url));\n\tlet current_timestamp = Math.floor(Date.now() / 1000).toString()\n\tlet timestamp_difference = current_timestamp - local_storage_pixel_timestamp;\n\treturn timestamp_difference > 3600 * 3;\n}\n\nfunction ctCleaPixelUrlLocalstorage(local_storage_pixel_url) {\n\t//remove timestamp\n\tlocalStorage.removeItem(local_storage_pixel_url)\n\t//remove pixel itself\n\tlocalStorage.removeItem('session_pixel_url')\n}"],"names":["apbctAjaxEmailDecode","event","element","target","setAttribute","ctPublicFunctions","text__wait_for_decoding","style","cursor","data__ajax_type","apbct_public_sendREST","data","encodedEmail","dataset","originalString","method","callback","result","success","ctFillDecodedEmail","removeAttribute","apbct_public_sendAJAX","action","notJson","targetElement","innerHTML","apbct_collect_visible_fields","form","key","inputs","inputs_visible","inputs_visible_count","inputs_invisible","inputs_invisible_count","inputs_with_duplicate_names","elements","isNaN","filter","elem","indexOf","getAttribute","push","forEach","i","getComputedStyle","display","visibility","opacity","classList","contains","trim","visible_fields","visible_fields_count","invisible_fields","invisible_fields_count","apbct_visible_fields_set_cookie","visible_fields_collection","form_id","collection","ctPublic","data__cookies_type","ctSetCookie","undefined","JSON","stringify","apbct_js_keys__set_input_value","params","obj","document","querySelectorAll","length","value","js_key","apbctGetScreenInfo","fullWidth","documentElement","scrollWidth","fullHeight","Math","max","body","scrollHeight","offsetHeight","clientHeight","visibleWidth","clientWidth","visibleHeight","ctSetPixelUrlLocalstorage","ajax_pixel_url","localStorage","setItem","floor","Date","now","toString","ctGetPixelUrlLocalstorage","let","local_storage_pixel","getItem","ctIsOutdatedPixelUrlLocalstorage","local_storage_pixel_url","local_storage_pixel_timestamp","Number","ctCleaPixelUrlLocalstorage","removeItem","ct_date","ctTimeMs","getTime","ctMouseEventTimerFlag","ctMouseData","ctMouseDataCounter","ctCheckedEmails","apbct_attach_event_handler","window","addEventListener","attachEvent","apbct_remove_event_handler","removeEventListener","detachEvent","ctFunctionFirstKey","KeyTimestamp","ctMouseReadInterval","setInterval","ctMouseWriteDataInterval","ctFunctionMouseMove","apbctLocalStorage","isSet","get","set","round","clientY","clientX","clearInterval","checkEmail","e","current_email","email","timestamp","ctSetPixelImg","pixelUrl","pixel__enabled","getElementById","jQuery","append","initCookies","getTimezoneOffset","navigator","webdriver","cookiesArray","cookie","split","cookieName","ctDeleteCookie","pixel__setting","ctGetPixelUrl","pixel__url","data__email_check_before_post","blur","setTimeout","forms","hiddenInput","visibleFieldsToInput","data__visible_fields_required","toLowerCase","parentElement","id","name","createElement","onsubmit_prev","onsubmit","ctFormIndex","this","Function","call","decodedEmailNodes","href","ctFillDecodedEmailHandler","ajaxComplete","xhr","settings","responseText","response","parse","apbct","blocked","dispatchEvent","CustomEvent","bubbles","detail","message","comment","cleantalkModal","loaded","open","stop_script","stop"],"mappings":"AAuTA,SAASA,qBAAqBC,GAC7B,MAAMC,EAAUD,EAAME,OACtBD,EAAQE,aAAa,QAASC,kBAAkBC,yBAChDJ,EAAQK,MAAMC,OAAS,WAEmB,SAAtCH,kBAAkBI,gBACrBC,sBACC,qBACA,CACCC,KAAM,CAACC,aAAcX,EAAME,OAAOU,QAAQC,gBAC1CC,OAAQ,OACRC,SAAU,SAAUC,GACfA,EAAOC,UACVC,mBAAmBF,EAAON,KAAMV,EAAME,QACtCD,EAAQE,aAAa,QAAS,IAC9BF,EAAQkB,gBAAgB,aAO5BC,sBACC,CACCC,OAAQ,qBACRV,aAAcX,EAAME,OAAOU,QAAQC,gBAEpC,CACCS,SAAS,EACTP,SAAU,SAAUC,GACfA,EAAOC,UACVC,mBAAmBF,EAAON,KAAMV,EAAME,QACtCD,EAAQE,aAAa,QAAS,IAC9BF,EAAQkB,gBAAgB,aAQ9B,SAASD,mBAAmBF,EAAQO,GACnCA,EAAcC,UAAYR,EAG3B,SAASS,6BAA8BC,GAGtC,IAOQC,EAPJC,EAAS,GACZC,EAAiB,GACjBC,EAAuB,EACvBC,EAAmB,GACnBC,EAAyB,EACzBC,EAA8B,GAE/B,IAAQN,KAAOD,EAAKQ,SACfC,OAAOR,KACVC,EAAOD,GAAOD,EAAKQ,SAASP,IAsD9B,OAlDAC,EAASA,EAAOQ,OAAO,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hCQ,SAASC,yBAAuE,IAA7B3D,EAAME,OAAOuK,eAEhEvH,EAAiB,IACN,GAAKzB,6BAA6BiJ,MACjDpH,gCAAiCJ,EAAgBlD,EAAME,OAAOuK,cAI3DzK,EAAME,OAAOqK,yBAAyBI,UACzCd,WAAW,WACV7J,EAAME,OAAOqK,cAAcK,KAAK5K,EAAME,OAAQF,IAC5C,SAKJ,KAGH+F,IAAI8E,EAAoB1G,SAASC,iBAAiB,0BAClD,GAAIyG,EAAkBxG,OACrB,IAAK0B,IAAIrD,EAAI,EAAGA,EAAImI,EAAkBxG,SAAU3B,EAE9CmI,EAAkBnI,GAAGyH,cAAcW,MACnCD,EAAkBnI,GAAGyH,cAAcA,cAAcW,MAKlDD,EAAkBnI,GAAGuE,iBAAiB,QAAS,SAAS8D,EAA0B/K,GACjF0K,KAAKtD,oBAAoB,QAAS2D,GAClChL,qBAAqBC,OA9S1B,GAudqB,oBAAX6I,QAGTA,OAAO1E,UAAU6G,aAAa,SAAUhL,EAAOiL,EAAKC,GAC/CD,EAAIE,eAAwD,IAAxCF,EAAIE,aAAa7I,QAAQ,gBAElB,KAD1B8I,EAAWtH,KAAKuH,MAAMJ,EAAIE,eACVG,QACnBF,EAAWA,EAASE,OACPC,UACZpH,SAASqH,cACR,IAAIC,YAAa,qBAAsB,CACtCC,SAAS,EACTC,OAAQ,CAAEC,QAASR,EAASS,YAK9BC,eAAeC,OAASX,EAASS,QACjCC,eAAeE,OAEa,IAAxBZ,EAASa,aACZjF,OAAOkF"}
|
js/cleantalk-users-checkspam.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
String.prototype.printf=function(){var e,t=this;for(e in arguments)var c=t.substring(0,t.indexOf("%s",0)),a=t.substring(t.indexOf("%s",0)+2,t.length),t=c+arguments[e]+a;return t};var ct_working=!(document.cookie="ct_check_users__amount=100; path=/; samesite=lax"),ct_new_check=!0,ct_cooling_down_flag=!1,ct_close_animate=!0,ct_accurate_check=!1,ct_pause=!1,ct_prev_accurate=ctUsersCheck.ct_prev_accurate,ct_prev_from=ctUsersCheck.ct_prev_from,ct_prev_till=ctUsersCheck.ct_prev_till,ct_cool_down_time=9e4,ct_requests_counter=0,ct_max_requests=60,ct_ajax_nonce=ctUsersCheck.ct_ajax_nonce,ct_users_total=0,ct_users_checked=0,ct_users_spam=0,ct_users_bad=0,ct_unchecked="unset",ct_date_from=0,ct_date_till=0;function apbct_cookie__get(_,r){var s={};return"string"==typeof(_=_||null)&&(_=_.split()),"string"==typeof(r="none"===(r=r||["apbct_","ct_"])?null:r)&&(r=r.split()),document.cookie.split(";").forEach(function(e,t,c){var a=e.trim().split("=");_&&_.forEach(function(e,t,c){a[0]===e&&(s[a[0]]=a[1])}),r&&r.forEach(function(e,t,c){0===a[0].indexOf(e)&&(s[a[0]]=a[1])})}),s}function apbct_get_cookie(e){var t=apbct_cookie__get(e,e);return"object"==typeof t&&void 0!==t[e]?t[e]:null}function animate_comment(e,t){ct_close_animate?.3===e?jQuery("#comment-"+t).fadeTo(200,e,function(){animate_comment(1,t)}):jQuery("#comment-"+t).fadeTo(200,e,function(){animate_comment(.3,t)}):ct_close_animate=!0}function ct_clear_users(){var e=0,t=0,c=(jQuery("#ct_allow_date_range").is(":checked")&&(e=jQuery("#ct_date_range_from").val(),t=jQuery("#ct_date_range_till").val()),"https:"===location.protocol?"; secure":""),c=(document.cookie="apbct_check_users_offset=0; path=/; samesite=lax"+c,{action:"ajax_clear_users",security:ct_ajax_nonce,from:e,till:t,no_cache:Math.random()});jQuery.ajax({type:"POST",url:ajaxurl,data:c,success:function(e){ct_show_users_info(),ct_send_users()}})}function ct_cooling_down_toggle(){ct_cooling_down_flag=!1,ct_send_users(),ct_show_users_info()}function ct_send_users(){if(!0!==ct_cooling_down_flag){if(ct_max_requests<=ct_requests_counter)return setTimeout(ct_cooling_down_toggle,ct_cool_down_time),void(ct_cooling_down_flag=!(ct_requests_counter=0));ct_requests_counter++;var a=apbct_get_cookie("ct_check_users__amount"),e={action:"ajax_check_users",security:ct_ajax_nonce,new_check:ct_new_check,unchecked:ct_unchecked,amount:a,no_cache:Math.random(),offset:Number(getCookie("apbct_check_users_offset"))};ct_accurate_check&&(e.accurate_check=!0),ct_date_from&&ct_date_till&&(e.from=ct_date_from,e.till=ct_date_till),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){var t;e=jQuery.parseJSON(e),parseInt(e.error)?(ct_working=!1,confirm(e.error_message+". Do you want to proceed?")?ct_send_users():(t="users.php?page=ct_check_users",0!=ct_date_from&&0!=ct_date_till&&(t+="&from="+ct_date_from+"&till="+ct_date_till),location.href=t)):(ct_new_check=!1,1==parseInt(e.end)||1==ct_pause?(1==parseInt(e.end)&&(document.cookie="ct_paused_users_check=0; path=/; samesite=lax"),ct_working=!1,jQuery("#ct_working_message").hide(),t="users.php?page=ct_check_users&ct_worked=1",0!=ct_date_from&&0!=ct_date_till&&(t+="&from="+ct_date_from+"&till="+ct_date_till),location.href=t):0==parseInt(e.end)&&(ct_users_checked=parseInt(ct_users_checked)+parseInt(e.checked),ct_users_spam=parseInt(ct_users_spam)+parseInt(e.spam),ct_users_bad=parseInt(ct_users_bad)+parseInt(e.bad),ct_unchecked=ct_users_total-ct_users_checked-ct_users_bad,t=(t=String(ctUsersCheck.ct_status_string)).printf(ct_users_checked,ct_users_spam,ct_users_bad),0<parseInt(ct_users_spam)&&(t+=ctUsersCheck.ct_status_string_warning),jQuery("#ct_checking_status").html(t),jQuery("#ct_error_message").hide(),e=Number(getCookie("apbct_check_users_offset"))+100,t="https:"===location.protocol?"; secure":"",document.cookie="apbct_check_users_offset="+e+"; path=/; samesite=lax"+t,ct_send_users()))},error:function(e,t,c){20<a&&(a-=20,document.cookie="ct_check_users__amount="+a+"; path=/; samesite=lax"),jQuery("#ct_error_message").show(),jQuery("#cleantalk_ajax_error").html(t),jQuery("#cleantalk_js_func").html("Check users"),setTimeout(ct_send_users(),3e3)},timeout:25e3})}}function ct_show_users_info(){var e;ct_working&&(!0===ct_cooling_down_flag?jQuery("#ct_cooling_notice").html("Waiting for API to cool down. (About a minute)").show():(jQuery("#ct_cooling_notice").hide(),ct_users_total||(e={action:"ajax_info_users",security:ct_ajax_nonce,no_cache:Math.random()},ct_date_from&&ct_date_till&&(e.from=ct_date_from,e.till=ct_date_till),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){e=jQuery.parseJSON(e),jQuery("#ct_checking_status").html(e.message),ct_users_spam=e.spam,ct_users_checked=e.checked,ct_users_bad=e.bad},error:function(e,t,c){jQuery("#ct_error_message").show(),jQuery("#cleantalk_ajax_error").html(t),jQuery("#cleantalk_js_func").html("Show users"),setTimeout(ct_show_users_info(),3e3)},timeout:15e3}))))}function ct_toggle_depended(e,t){t=t||null;var c=jQuery(e.data("depended"));e.data("state")||t?(e.data("state",!1),c.prop("disabled",!0),c.removeProp("checked"),c.data("depended")&&ct_toggle_depended(c,!0)):(e.data("state",!0),c.removeProp("disabled"))}function ct_start_check(e){e=e||null,jQuery("#ct_allow_date_range").is(":checked")&&(ct_date_from=jQuery("#ct_date_range_from").val(),ct_date_till=jQuery("#ct_date_range_till").val(),""===ct_date_from||""===ct_date_till)?alert("Please, specify a date range."):(jQuery("#ct_accurate_check").is(":checked")&&(ct_accurate_check=!0),jQuery(".ct_to_hide").hide(),jQuery("#ct_working_message").show(),jQuery("#ct_preloader").show(),jQuery("#ct_pause").show(),ct_working=!0,e?(ct_show_users_info(),ct_send_users()):ct_clear_users())}function ct_delete_all_users(a){var t={action:"ajax_delete_all_users",security:ct_ajax_nonce,no_cache:Math.random()};jQuery("."+a.target.id).addClass("disabled"),jQuery(".spinner").css("visibility","visible"),jQuery.ajax({type:"POST",url:ajaxurl,data:t,success:function(e){0<e?(jQuery("#cleantalk_users_left").html(e),ct_delete_all_users(a,t)):(jQuery("."+a.target.id).removeClass("disabled"),jQuery(".spinner").css("visibility","hidden"),location.href="users.php?page=ct_check_users")},error:function(e,t,c){jQuery("#ct_error_message").show(),jQuery("#cleantalk_ajax_error").html(t),jQuery("#cleantalk_js_func").html("All users deleteion"),setTimeout(ct_delete_all_users(a),3e3)},timeout:25e3})}function getCookie(e){e=document.cookie.match(new RegExp("(?:^|; )"+e.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,"\\$1")+"=([^;]*)"));return e?decodeURIComponent(e[1]):void 0}jQuery(document).ready(function(){ct_prev_accurate&&jQuery("#ct_accurate_check").prop("checked",!0),ct_prev_from&&(jQuery("#ct_allow_date_range").prop("checked",!0).data("state",!0),jQuery("#ct_date_range_from").removeProp("disabled").val(ct_prev_from),jQuery("#ct_date_range_till").removeProp("disabled").val(ct_prev_till)),jQuery("#ct_allow_date_range").on("change",function(){document.cookie="ct_users_dates_from="+jQuery("#ct_date_range_from").val()+"; path=/; samesite=lax",document.cookie="ct_users_dates_till="+jQuery("#ct_date_range_till").val()+"; path=/; samesite=lax",this.checked?(document.cookie="ct_users_dates_allowed=1; path=/; samesite=lax",jQuery(".ct_date").prop("checked",!0).attr("disabled",!1)):(document.cookie="ct_users_dates_allowed=0; path=/; samesite=lax",jQuery(".ct_date").prop("disabled",!0).attr("disabled",!0))}),jQuery.datepicker.setDefaults(jQuery.datepicker.regional.en);var a=jQuery("#ct_date_range_from, #ct_date_range_till").datepicker({dateFormat:"M d yy",maxDate:"+0D",changeMonth:!0,changeYear:!0,showAnim:"slideDown",onSelect:function(e){var t="ct_date_range_from"==this.id?"minDate":"maxDate",c=jQuery(this).data("datepicker"),e=jQuery.datepicker.parseDate(c.settings.dateFormat||jQuery.datepicker._defaults.dateFormat,e,c.settings);a.not(this).datepicker("option",t,e),document.cookie="ct_users_dates_from="+jQuery("#ct_date_range_from").val()+"; path=/; samesite=lax",document.cookie="ct_users_dates_till="+jQuery("#ct_date_range_till").val()+"; path=/; samesite=lax"}});function t(t){t=t||null;var e={action:"ajax_insert_users",security:ct_ajax_nonce,no_cache:Math.random()};t&&(e.delete=!0),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){t?alert("Deleted "+e+" users"):alert("Inserted "+e+" users")}})}jQuery("#ct_check_spam_button").click(function(){ct_start_check(!(document.cookie="ct_paused_users_check=0; path=/; samesite=lax"))}),jQuery("#ct_proceed_check_button").click(function(){ct_start_check(!0)}),jQuery("#ct_pause").on("click",function(){ct_pause=!0;var e={accurate:ct_accurate_check,from:ct_date_from,till:ct_date_till};document.cookie="ct_paused_users_check="+JSON.stringify(e)+"; path=/; samesite=lax"}),jQuery(".cleantalk_delete_from_list_button").click(function(){ct_id=jQuery(this).attr("data-id");var e={action:"ajax_ct_approve_user",security:ct_ajax_nonce,id:ct_id,no_cache:Math.random()},e=(jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){jQuery("#comment-"+ct_id).fadeOut("slow",function(){jQuery("#comment-"+ct_id).remove()})}}),{action:"ct_feedback_user",security:ct_ajax_nonce,user_id:ct_id,status:"approve",no_cache:Math.random()});jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){},error:function(e,t,c){},timeout:5e3})}),jQuery(".ct_get_csv_file").click(function(c){var e={action:"ajax_ct_get_csv_file",security:ct_ajax_nonce,filename:ctUsersCheck.ct_csv_filename,no_cache:Math.random()};jQuery("."+c.target.id).addClass("disabled"),jQuery(".spinner").css("visibility","visible"),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){var t;0===parseInt(e)?alert(ctUsersCheck.ct_bad_csv):(e=URL.createObjectURL(new Blob([e])),(t=document.createElement("a")).href=e,t.download=ctUsersCheck.ct_csv_filename+".csv",document.body.appendChild(t),t.click()),jQuery("."+c.target.id).removeClass("disabled"),jQuery(".spinner").css("visibility","hidden")}})}),jQuery(".ct_insert_users").click(function(e){t()}),jQuery(".ct_insert_users__delete").click(function(e){t(!0)}),jQuery(".ct_delete_all_users").click(function(e){if(!confirm(ctUsersCheck.ct_confirm_deletion_all))return!1;ct_delete_all_users(e)})});
|
2 |
//# sourceMappingURL=cleantalk-users-checkspam.min.js.map
|
1 |
+
String.prototype.printf=function(){var e,t=this;for(e in arguments)var c=t.substring(0,t.indexOf("%s",0)),a=t.substring(t.indexOf("%s",0)+2,t.length),t=c+arguments[e]+a;return t};var ct_working=!(document.cookie="ct_check_users__amount=100; path=/; samesite=lax"),ct_new_check=!0,ct_cooling_down_flag=!1,ct_close_animate=!0,ct_accurate_check=!1,ct_pause=!1,ct_prev_accurate=ctUsersCheck.ct_prev_accurate,ct_prev_from=ctUsersCheck.ct_prev_from,ct_prev_till=ctUsersCheck.ct_prev_till,ct_cool_down_time=9e4,ct_requests_counter=0,ct_max_requests=60,ct_ajax_nonce=ctUsersCheck.ct_ajax_nonce,ct_users_total=0,ct_users_checked=0,ct_users_spam=0,ct_users_bad=0,ct_unchecked="unset",ct_date_from=0,ct_date_till=0;function apbct_cookie__get(_,r){var s={};return"string"==typeof(_=_||null)&&(_=_.split()),"string"==typeof(r="none"===(r=r||["apbct_","ct_"])?null:r)&&(r=r.split()),document.cookie.split(";").forEach(function(e,t,c){var a=e.trim().split("=");_&&_.forEach(function(e,t,c){a[0]===e&&(s[a[0]]=a[1])}),r&&r.forEach(function(e,t,c){0===a[0].indexOf(e)&&(s[a[0]]=a[1])})}),s}function apbct_get_cookie(e){var t=apbct_cookie__get(e,e);return"object"==typeof t&&void 0!==t[e]?t[e]:null}function animate_comment(e,t){ct_close_animate?.3===e?jQuery("#comment-"+t).fadeTo(200,e,function(){animate_comment(1,t)}):jQuery("#comment-"+t).fadeTo(200,e,function(){animate_comment(.3,t)}):ct_close_animate=!0}function ct_clear_users(){var e=0,t=0,c=(jQuery("#ct_allow_date_range").is(":checked")&&(e=jQuery("#ct_date_range_from").val(),t=jQuery("#ct_date_range_till").val()),"https:"===location.protocol?"; secure":""),c=(document.cookie="apbct_check_users_offset=0; path=/; samesite=lax"+c,{action:"ajax_clear_users",security:ct_ajax_nonce,from:e,till:t,no_cache:Math.random()});jQuery.ajax({type:"POST",url:ajaxurl,data:c,success:function(e){ct_show_users_info(),ct_send_users()}})}function ct_cooling_down_toggle(){ct_cooling_down_flag=!1,ct_send_users(),ct_show_users_info()}function ct_send_users(){if(!0!==ct_cooling_down_flag){if(ct_max_requests<=ct_requests_counter)return setTimeout(ct_cooling_down_toggle,ct_cool_down_time),void(ct_cooling_down_flag=!(ct_requests_counter=0));ct_requests_counter++;var a=apbct_get_cookie("ct_check_users__amount"),e={action:"ajax_check_users",security:ct_ajax_nonce,new_check:ct_new_check,unchecked:ct_unchecked,amount:a,no_cache:Math.random(),offset:Number(getCookie("apbct_check_users_offset"))};ct_accurate_check&&(e.accurate_check=!0),ct_date_from&&ct_date_till&&(e.from=ct_date_from,e.till=ct_date_till),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){var t;e=jQuery.parseJSON(e),parseInt(e.error)?(ct_working=!1,confirm(e.error_message+". Do you want to proceed?")?ct_send_users():(t="users.php?page=ct_check_users",0!=ct_date_from&&0!=ct_date_till&&(t+="&from="+ct_date_from+"&till="+ct_date_till),location.href=t)):(ct_new_check=!1,1==parseInt(e.end)||1==ct_pause?(1==parseInt(e.end)&&(document.cookie="ct_paused_users_check=0; path=/; samesite=lax"),ct_working=!1,jQuery("#ct_working_message").hide(),t="users.php?page=ct_check_users&ct_worked=1",0!=ct_date_from&&0!=ct_date_till&&(t+="&from="+ct_date_from+"&till="+ct_date_till),location.href=t):0==parseInt(e.end)&&(ct_users_checked=parseInt(ct_users_checked)+parseInt(e.checked),ct_users_spam=parseInt(ct_users_spam)+parseInt(e.spam),ct_users_bad=parseInt(e.bad),ct_unchecked=ct_users_total-ct_users_checked-ct_users_bad,t=(t=String(ctUsersCheck.ct_status_string)).printf(ct_users_checked,ct_users_spam,ct_users_bad),0<parseInt(ct_users_spam)&&(t+=ctUsersCheck.ct_status_string_warning),jQuery("#ct_checking_status").html(t),jQuery("#ct_error_message").hide(),e=Number(getCookie("apbct_check_users_offset"))+100,t="https:"===location.protocol?"; secure":"",document.cookie="apbct_check_users_offset="+e+"; path=/; samesite=lax"+t,ct_send_users()))},error:function(e,t,c){20<a&&(a-=20,document.cookie="ct_check_users__amount="+a+"; path=/; samesite=lax"),jQuery("#ct_error_message").show(),jQuery("#cleantalk_ajax_error").html(t),jQuery("#cleantalk_js_func").html("Check users"),setTimeout(ct_send_users(),3e3)},timeout:25e3})}}function ct_show_users_info(){var e;ct_working&&(!0===ct_cooling_down_flag?jQuery("#ct_cooling_notice").html("Waiting for API to cool down. (About a minute)").show():(jQuery("#ct_cooling_notice").hide(),ct_users_total||(e={action:"ajax_info_users",security:ct_ajax_nonce,no_cache:Math.random()},ct_date_from&&ct_date_till&&(e.from=ct_date_from,e.till=ct_date_till),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){e=jQuery.parseJSON(e),jQuery("#ct_checking_status").html(e.message),ct_users_spam=e.spam,ct_users_checked=e.checked,ct_users_bad=e.bad},error:function(e,t,c){jQuery("#ct_error_message").show(),jQuery("#cleantalk_ajax_error").html(t),jQuery("#cleantalk_js_func").html("Show users"),setTimeout(ct_show_users_info(),3e3)},timeout:15e3}))))}function ct_toggle_depended(e,t){t=t||null;var c=jQuery(e.data("depended"));e.data("state")||t?(e.data("state",!1),c.prop("disabled",!0),c.removeProp("checked"),c.data("depended")&&ct_toggle_depended(c,!0)):(e.data("state",!0),c.removeProp("disabled"))}function ct_start_check(e){e=e||null,jQuery("#ct_allow_date_range").is(":checked")&&(ct_date_from=jQuery("#ct_date_range_from").val(),ct_date_till=jQuery("#ct_date_range_till").val(),""===ct_date_from||""===ct_date_till)?alert(ctUsersCheck.ct_specify_date_range):(jQuery("#ct_accurate_check").is(":checked")&&(ct_accurate_check=!0),jQuery("#ct_accurate_check").is(":checked")&&!jQuery("#ct_allow_date_range").is(":checked")?alert(ctUsersCheck.ct_select_date_range):(jQuery(".ct_to_hide").hide(),jQuery("#ct_working_message").show(),jQuery("#ct_preloader").show(),jQuery("#ct_pause").show(),ct_working=!0,e?(ct_show_users_info(),ct_send_users()):ct_clear_users()))}function ct_delete_all_users(a){var t={action:"ajax_delete_all_users",security:ct_ajax_nonce,no_cache:Math.random()};jQuery("."+a.target.id).addClass("disabled"),jQuery(".spinner").css("visibility","visible"),jQuery.ajax({type:"POST",url:ajaxurl,data:t,success:function(e){0<e?(jQuery("#cleantalk_users_left").html(e),ct_delete_all_users(a,t)):(jQuery("."+a.target.id).removeClass("disabled"),jQuery(".spinner").css("visibility","hidden"),location.href="users.php?page=ct_check_users")},error:function(e,t,c){jQuery("#ct_error_message").show(),jQuery("#cleantalk_ajax_error").html(t),jQuery("#cleantalk_js_func").html("All users deleteion"),setTimeout(ct_delete_all_users(a),3e3)},timeout:25e3})}function getCookie(e){e=document.cookie.match(new RegExp("(?:^|; )"+e.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,"\\$1")+"=([^;]*)"));return e?decodeURIComponent(e[1]):void 0}jQuery(document).ready(function(){ct_prev_accurate&&jQuery("#ct_accurate_check").prop("checked",!0),ct_prev_from&&(jQuery("#ct_allow_date_range").prop("checked",!0).data("state",!0),jQuery("#ct_date_range_from").removeProp("disabled").val(ct_prev_from),jQuery("#ct_date_range_till").removeProp("disabled").val(ct_prev_till)),jQuery("#ct_allow_date_range").on("change",function(){document.cookie="ct_users_dates_from="+jQuery("#ct_date_range_from").val()+"; path=/; samesite=lax",document.cookie="ct_users_dates_till="+jQuery("#ct_date_range_till").val()+"; path=/; samesite=lax",this.checked?(document.cookie="ct_users_dates_allowed=1; path=/; samesite=lax",jQuery(".ct_date").prop("checked",!0).attr("disabled",!1)):(document.cookie="ct_users_dates_allowed=0; path=/; samesite=lax",jQuery(".ct_date").prop("disabled",!0).attr("disabled",!0))}),jQuery.datepicker.setDefaults(jQuery.datepicker.regional.en);var a=jQuery("#ct_date_range_from, #ct_date_range_till").datepicker({dateFormat:"M d yy",maxDate:"+0D",changeMonth:!0,changeYear:!0,showAnim:"slideDown",onSelect:function(e){var t="ct_date_range_from"==this.id?"minDate":"maxDate",c=jQuery(this).data("datepicker"),e=jQuery.datepicker.parseDate(c.settings.dateFormat||jQuery.datepicker._defaults.dateFormat,e,c.settings);a.not(this).datepicker("option",t,e),document.cookie="ct_users_dates_from="+jQuery("#ct_date_range_from").val()+"; path=/; samesite=lax",document.cookie="ct_users_dates_till="+jQuery("#ct_date_range_till").val()+"; path=/; samesite=lax"}});function t(t){t=t||null;var e={action:"ajax_insert_users",security:ct_ajax_nonce,no_cache:Math.random()};t&&(e.delete=!0),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){t?alert("Deleted "+e+" users"):alert("Inserted "+e+" users")}})}jQuery("#ct_check_spam_button").click(function(){ct_start_check(!(document.cookie="ct_paused_users_check=0; path=/; samesite=lax"))}),jQuery("#ct_proceed_check_button").click(function(){ct_start_check(!0)}),jQuery("#ct_pause").on("click",function(){ct_pause=!0;var e={accurate:ct_accurate_check,from:ct_date_from,till:ct_date_till};document.cookie="ct_paused_users_check="+JSON.stringify(e)+"; path=/; samesite=lax"}),jQuery(".cleantalk_delete_from_list_button").click(function(){ct_id=jQuery(this).attr("data-id");var e={action:"ajax_ct_approve_user",security:ct_ajax_nonce,id:ct_id,no_cache:Math.random()},e=(jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){jQuery("#comment-"+ct_id).fadeOut("slow",function(){jQuery("#comment-"+ct_id).remove()})}}),{action:"ct_feedback_user",security:ct_ajax_nonce,user_id:ct_id,status:"approve",no_cache:Math.random()});jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){},error:function(e,t,c){},timeout:5e3})}),jQuery(".ct_get_csv_file").click(function(c){var e={action:"ajax_ct_get_csv_file",security:ct_ajax_nonce,filename:ctUsersCheck.ct_csv_filename,no_cache:Math.random()};jQuery("."+c.target.id).addClass("disabled"),jQuery(".spinner").css("visibility","visible"),jQuery.ajax({type:"POST",url:ajaxurl,data:e,success:function(e){var t;0===parseInt(e)?alert(ctUsersCheck.ct_bad_csv):(e=URL.createObjectURL(new Blob([e])),(t=document.createElement("a")).href=e,t.download=ctUsersCheck.ct_csv_filename+".csv",document.body.appendChild(t),t.click()),jQuery("."+c.target.id).removeClass("disabled"),jQuery(".spinner").css("visibility","hidden")}})}),jQuery(".ct_insert_users").click(function(e){t()}),jQuery(".ct_insert_users__delete").click(function(e){t(!0)}),jQuery(".ct_delete_all_users").click(function(e){if(!confirm(ctUsersCheck.ct_confirm_deletion_all))return!1;ct_delete_all_users(e)}),jQuery("#ct_accurate_check").change(function(){this.checked&&(jQuery("#ct_allow_date_range").prop("checked",!0),jQuery(".ct_date").prop("checked",!0).attr("disabled",!1))})});
|
2 |
//# sourceMappingURL=cleantalk-users-checkspam.min.js.map
|
js/cleantalk-users-checkspam.min.js.map
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"file":"cleantalk-users-checkspam.min.js","sources":["cleantalk-users-checkspam.js"],"sourcesContent":["// Printf for JS\nString.prototype.printf = function(){\n var formatted = this;\n for( var arg in arguments ) {\n\t\tvar before_formatted = formatted.substring(0, formatted.indexOf(\"%s\", 0));\n\t\tvar after_formatted = formatted.substring(formatted.indexOf(\"%s\", 0)+2, formatted.length);\n\t\tformatted = before_formatted + arguments[arg] + after_formatted;\n }\n return formatted;\n};\n\n// Set deafult amount to check by request.\ndocument.cookie = \"ct_check_users__amount=\" + 100 + \"; path=/; samesite=lax\";\n\n// Flags\nvar ct_working = false,\n\tct_new_check = true,\n\tct_cooling_down_flag = false,\n\tct_close_animate = true,\n\tct_accurate_check = false,\n\tct_pause = false,\n\tct_prev_accurate = ctUsersCheck.ct_prev_accurate,\n\tct_prev_from = ctUsersCheck.ct_prev_from,\t\n\tct_prev_till = ctUsersCheck.ct_prev_till;\n// Settings\nvar ct_cool_down_time = 90000,\n\tct_requests_counter = 0,\n\tct_max_requests = 60;\n// Variables\nvar ct_ajax_nonce = ctUsersCheck.ct_ajax_nonce,\n\tct_users_total = 0,\n\tct_users_checked = 0,\n\tct_users_spam = 0,\n\tct_users_bad = 0,\n\tct_unchecked = 'unset',\n\tct_date_from = 0,\n\tct_date_till = 0;\n\n/* Function: Reuturns cookie with prefix */\nfunction apbct_cookie__get(names, prefixes){\n\tvar cookie = {};\n\tnames = names || null;\n\tif(typeof names == 'string') names = names.split();\n\tprefixes = prefixes || ['apbct_', 'ct_'];\n\tif(prefixes === 'none') prefixes = null;\n\tif(typeof prefixes == 'string') prefixes = prefixes.split();\n\tdocument.cookie.split(';').forEach(function(item, i, arr){\n\t\tvar curr = item.trim().split('=');\n\t\t// Detect by full cookie name\n\t\tif(names){\n\t\t\tnames.forEach(function(name, i, all){\n\t\t\t\tif(curr[0] === name)\n\t\t\t\t\tcookie[curr[0]] = (curr[1]);\n\t\t\t});\n\t\t}\n\t\t// Detect by name prefix\n\t\tif(prefixes){\n\t\t\tprefixes.forEach(function(prefix, i, all){\n\t\t\t\tif(curr[0].indexOf(prefix) === 0)\n\t\t\t\t\tcookie[curr[0]] = (curr[1]);\n\t\t\t});\n\t\t}\n\t});\n\treturn cookie;\n}\n\nfunction apbct_get_cookie( name ){\n\tvar cookie = apbct_cookie__get( name, name );\n\tif(typeof cookie === 'object' && typeof cookie[name] != 'undefined'){\n\t\treturn cookie[name];\n\t}else\n\t\treturn null;\n}\n\nfunction animate_comment(to,id){\n\tif(ct_close_animate){\n\t\tif(to === 0.3){\n\t\t\tjQuery('#comment-'+id).fadeTo(200,to,function(){\n\t\t\t\tanimate_comment(1,id)\n\t\t\t});\n\t\t}else{\n\t\t\tjQuery('#comment-'+id).fadeTo(200,to,function(){\n\t\t\t\tanimate_comment(0.3,id)\n\t\t\t});\n\t\t}\n\t}else{\n\t\tct_close_animate=true;\n\t}\n}\n\nfunction ct_clear_users(){\n\n\tvar from = 0, till = 0;\n\tif(jQuery('#ct_allow_date_range').is(':checked')) {\n\t\tfrom = jQuery('#ct_date_range_from').val();\n\t\ttill = jQuery('#ct_date_range_till').val();\n\t}\n\n\tvar ctSecure = location.protocol === 'https:' ? '; secure' : '';\n\tdocument.cookie = 'apbct_check_users_offset' + \"=\" + 0 + \"; path=/; samesite=lax\" + ctSecure;\n\n\tvar data = {\n\t\t'action' : 'ajax_clear_users',\n\t\t'security' : ct_ajax_nonce,\n\t\t'from' : from,\n\t\t'till' : till,\n\t\t'no_cache': Math.random()\n\t};\n\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(msg){\n\t\t\tct_show_users_info();\n\t\t\tct_send_users();\n\t\t}\n\t});\n\n}\n\n//Continues the check after cooldown time\n//Called by ct_send_users();\nfunction ct_cooling_down_toggle(){\n\tct_cooling_down_flag = false;\n\tct_send_users();\n\tct_show_users_info();\n}\n\nfunction ct_send_users(){\n\t\n\tif(ct_cooling_down_flag === true)\n\t\treturn;\n\t\n\tif(ct_requests_counter >= ct_max_requests){\n\t\tsetTimeout(ct_cooling_down_toggle, ct_cool_down_time);\n\t\tct_requests_counter = 0;\n\t\tct_cooling_down_flag = true;\n\t\treturn;\n\t}else{\n\t\tct_requests_counter++;\n\t}\n\n\tvar check_amount = apbct_get_cookie('ct_check_users__amount');\n\n\tvar data = {\n\t\taction: 'ajax_check_users',\n\t\tsecurity: ct_ajax_nonce,\n\t\tnew_check: ct_new_check,\n\t\tunchecked: ct_unchecked,\n\t\tamount: check_amount,\n\t\t'no_cache': Math.random(),\n\t\t'offset' : Number(getCookie('apbct_check_users_offset'))\n\t};\n\t\n\tif(ct_accurate_check)\n\t\tdata['accurate_check'] = true;\n\t\n\tif(ct_date_from && ct_date_till){\n\t\tdata['from'] = ct_date_from;\n\t\tdata['till'] = ct_date_till;\n\t}\n\t\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(msg){\n\t\t\t\n\t\t\tmsg = jQuery.parseJSON(msg);\n\t\t\t\n\t\t\tif(parseInt(msg.error)){\n\t\t\t\tct_working=false;\n\t\t\t\tif(!confirm(msg.error_message+\". Do you want to proceed?\")){\n\t\t\t\t\tvar new_href = 'users.php?page=ct_check_users';\n\t\t\t\t\tif(ct_date_from != 0 && ct_date_till != 0)\n\t\t\t\t\t\tnew_href+='&from='+ct_date_from+'&till='+ct_date_till;\n\t\t\t\t\tlocation.href = new_href;\n\t\t\t\t}else\n\t\t\t\t\tct_send_users();\n\t\t\t}else{\n\t\t\t\tct_new_check = false;\n\t\t\t\tif(parseInt(msg.end) == 1 || ct_pause == true){\n\t\t\t\t\tif(parseInt(msg.end) == 1)\n\t\t\t\t\t\tdocument.cookie = 'ct_paused_users_check=0; path=/; samesite=lax';\n\t\t\t\t\tct_working=false;\n\t\t\t\t\tjQuery('#ct_working_message').hide();\n\t\t\t\t\tvar new_href = 'users.php?page=ct_check_users&ct_worked=1';\n\t\t\t\t\tif(ct_date_from != 0 && ct_date_till != 0)\n\t\t\t\t\t\tnew_href+='&from='+ct_date_from+'&till='+ct_date_till;\n\t\t\t\t\tlocation.href = new_href;\n\t\t\t\t}else if(parseInt(msg.end) == 0){\n\t\t\t\t\tct_users_checked = parseInt( ct_users_checked ) + parseInt( msg.checked );\n\t\t\t\t\tct_users_spam = parseInt( ct_users_spam ) + parseInt (msg.spam );\n\t\t\t\t\tct_users_bad = parseInt( ct_users_bad ) + parseInt( msg.bad );\n\t\t\t\t\tct_unchecked = ct_users_total - ct_users_checked - ct_users_bad;\n\t\t\t\t\tvar status_string = String(ctUsersCheck.ct_status_string);\n\t\t\t\t\tvar status_string = status_string.printf(ct_users_checked, ct_users_spam, ct_users_bad);\n\t\t\t\t\tif(parseInt(ct_users_spam) > 0)\n\t\t\t\t\t\tstatus_string += ctUsersCheck.ct_status_string_warning;\n\t\t\t\t\tjQuery('#ct_checking_status').html(status_string);\n\t\t\t\t\tjQuery('#ct_error_message').hide();\n\n\t\t\t\t\tvar offset = Number(getCookie('apbct_check_users_offset')) + 100;\n\t\t\t\t\tvar ctSecure = location.protocol === 'https:' ? '; secure' : '';\n\t\t\t\t\tdocument.cookie = 'apbct_check_users_offset' + \"=\" + offset + \"; path=/; samesite=lax\" + ctSecure;\n\t\t\t\t\t\n\t\t\t\t\tct_send_users();\n\t\t\t\t}\n\t\t\t}\n\t\t},\n error: function(jqXHR, textStatus, errorThrown) {\n\t\t\tif(check_amount > 20){\n\t\t\t\tcheck_amount -= 20;\n\t\t\t\tdocument.cookie = \"ct_check_users__amount=\" + check_amount + \"; path=/; samesite=lax\";\n\t\t\t}\n\t\t\tjQuery('#ct_error_message').show();\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\n\t\t\tjQuery('#cleantalk_js_func').html('Check users');\n\t\t\tsetTimeout(ct_send_users(), 3000);\n },\n timeout: 25000\n\t});\n}\nfunction ct_show_users_info(){\n\t\n\tif( ct_working ){\n\t\t\n\t\tif(ct_cooling_down_flag === true){\n\t\t\tjQuery('#ct_cooling_notice').html('Waiting for API to cool down. (About a minute)').show();\n\t\t\treturn;\t\t\t\n\t\t}else{\n\t\t\tjQuery('#ct_cooling_notice').hide();\n\t\t}\n\t\t\n\t\tif( ! ct_users_total ){\n\t\t\t\n\t\t\tvar data = {\n\t\t\t\t'action': 'ajax_info_users',\n\t\t\t\t'security': ct_ajax_nonce,\n\t\t\t\t'no_cache': Math.random()\n\t\t\t};\n\t\t\t\n\t\t\tif( ct_date_from && ct_date_till ){\n\t\t\t\tdata['from'] = ct_date_from;\n\t\t\t\tdata['till'] = ct_date_till;\n\t\t\t}\n\t\t\t\n\t\t\tjQuery.ajax({\n\t\t\t\ttype: \"POST\",\n\t\t\t\turl: ajaxurl,\n\t\t\t\tdata: data,\n\t\t\t\tsuccess: function(msg){\n\t\t\t\t\tmsg = jQuery.parseJSON(msg);\n\t\t\t\t\tjQuery('#ct_checking_status').html(msg.message);\n\t\t\t\t\tct_users_spam = msg.spam;\n\t\t\t\t\tct_users_checked = msg.checked;\n\t\t\t\t\tct_users_bad = msg.bad;\n\t\t\t\t},\n\t\t\t\terror: function (jqXHR, textStatus, errorThrown){\n\t\t\t\t\tjQuery('#ct_error_message').show();\n\t\t\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\n\t\t\t\t\tjQuery('#cleantalk_js_func').html('Show users');\n\t\t\t\t\tsetTimeout(ct_show_users_info(), 3000);\n\t\t\t\t},\n\t\t\t\ttimeout: 15000\n\t\t\t});\n\t\t}\n\t}\n}\n// Function to toggle dependences\nfunction ct_toggle_depended(obj, secondary){\n\n secondary = secondary || null;\n\n\tvar depended = jQuery(obj.data('depended')),\n\t\tstate = obj.data('state');\n\t\t\n\tif(!state && !secondary){\n\t\tobj.data('state', true);\n\t\tdepended.removeProp('disabled');\n\t}else{\n\t\tobj.data('state', false);\n\t\tdepended.prop('disabled', true);\n\t\tdepended.removeProp('checked');\n\t\tif(depended.data('depended'))\n\t\t\tct_toggle_depended(depended, true);\n\t}\n}\n\n// Main function of checking\nfunction ct_start_check( continue_check ){\n\n\tcontinue_check = continue_check || null;\n\n\tif(jQuery('#ct_allow_date_range').is(':checked')){\n\n\t\tct_date_from = jQuery('#ct_date_range_from').val();\n\t\tct_date_till = jQuery('#ct_date_range_till').val();\n\n\t\tif(!(ct_date_from !== '' && ct_date_till !== '')){\n\t\t\talert('Please, specify a date range.');\n\t\t\treturn;\n\t\t}\n\t}\n\n\tif(jQuery('#ct_accurate_check').is(':checked')){\n\t\tct_accurate_check = true;\n\t}\n\n\tjQuery('.ct_to_hide').hide();\n\tjQuery('#ct_working_message').show();\n\tjQuery('#ct_preloader').show();\n\tjQuery('#ct_pause').show();\n\n\tct_working = true;\n\n\tif( continue_check ){\n\t\tct_show_users_info();\n\t\tct_send_users();\n\t} else {\n\t\tct_clear_users();\n\t}\n\n}\n\nfunction ct_delete_all_users( e ){\n\n\tvar data = {\n\t\t'action': 'ajax_delete_all_users',\n\t\t'security': ct_ajax_nonce,\n\t\t'no_cache': Math.random()\n\t};\n\n\tjQuery('.' + e.target.id).addClass('disabled');\n\tjQuery('.spinner').css('visibility', 'visible');\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function( msg ){\n\t\t\tif( msg > 0 ){\n\t\t\t\tjQuery('#cleantalk_users_left').html(msg);\n\t\t\t\tct_delete_all_users( e, data );\n\t\t\t}else{\n\t\t\t\tjQuery('.' + e.target.id).removeClass('disabled');\n\t\t\t\tjQuery('.spinner').css('visibility', 'hidden');\n\t\t\t\tlocation.href='users.php?page=ct_check_users';\n\t\t\t}\n\t\t},\n\t\terror: function(jqXHR, textStatus, errorThrown) {\n\t\t\tjQuery('#ct_error_message').show();\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\n\t\t\tjQuery('#cleantalk_js_func').html('All users deleteion');\n\t\t\tsetTimeout(ct_delete_all_users( e ), 3000);\n\t\t},\n\t\ttimeout: 25000\n\t});\n}\n\njQuery(document).ready(function(){\n\n\t// Setting dependences\n\t\n\t// Prev check parameters\n\tif(ct_prev_accurate){\n\t\tjQuery(\"#ct_accurate_check\").prop('checked', true);\n\t}\n\tif(ct_prev_from){\n\t\tjQuery(\"#ct_allow_date_range\").prop('checked', true).data('state', true);\n\t\tjQuery(\"#ct_date_range_from\").removeProp('disabled').val(ct_prev_from);\n\t\tjQuery(\"#ct_date_range_till\").removeProp('disabled').val(ct_prev_till);\n\t}\n\t\n\t// Toggle dependences\n\tjQuery(\"#ct_allow_date_range\").on('change', function(){\n\t\tdocument.cookie = 'ct_users_dates_from='+ jQuery('#ct_date_range_from').val() +'; path=/; samesite=lax';\n\t\tdocument.cookie = 'ct_users_dates_till='+ jQuery('#ct_date_range_till').val() +'; path=/; samesite=lax';\n\t\tif( this.checked ) {\n\t\t\tdocument.cookie = 'ct_users_dates_allowed=1; path=/; samesite=lax';\n\t\t\tjQuery('.ct_date').prop('checked', true).attr('disabled',false);\n\t\t} else {\n\t\t\tdocument.cookie = 'ct_users_dates_allowed=0; path=/; samesite=lax';\n\t\t\tjQuery('.ct_date').prop('disabled', true).attr('disabled',true);\n\t\t}\n\t});\n\n\tjQuery.datepicker.setDefaults(jQuery.datepicker.regional['en']);\n\tvar dates = jQuery('#ct_date_range_from, #ct_date_range_till').datepicker(\n\t\t{\n\t\t\tdateFormat: 'M d yy',\n\t\t\tmaxDate:\"+0D\",\n\t\t\tchangeMonth:true,\n\t\t\tchangeYear:true,\n\t\t\tshowAnim: 'slideDown',\n\t\t\tonSelect: function(selectedDate){\n\t\t\tvar option = this.id == \"ct_date_range_from\" ? \"minDate\" : \"maxDate\",\n\t\t\t\tinstance = jQuery( this ).data( \"datepicker\" ),\n\t\t\t\tdate = jQuery.datepicker.parseDate(\n\t\t\t\t\tinstance.settings.dateFormat || jQuery.datepicker._defaults.dateFormat,\n\t\t\t\t\tselectedDate, instance.settings);\n\t\t\t\tdates.not(this).datepicker(\"option\", option, date);\n\t\t\t\tdocument.cookie = 'ct_users_dates_from='+ jQuery('#ct_date_range_from').val() +'; path=/; samesite=lax';\n\t\t\t\tdocument.cookie = 'ct_users_dates_till='+ jQuery('#ct_date_range_till').val() +'; path=/; samesite=lax';\n\t\t\t}\n\t\t}\n\t);\n\t\n\t// Check users\n\tjQuery(\"#ct_check_spam_button\").click(function(){\n\t\tdocument.cookie = 'ct_paused_users_check=0; path=/; samesite=lax';\n\t\tct_start_check(false);\n\t});\n\tjQuery(\"#ct_proceed_check_button\").click(function(){\n\t\tct_start_check(true);\n\t});\n\t\n\t// Pause the check\n\tjQuery('#ct_pause').on('click', function(){\n\t\tct_pause = true;\n\t\tvar ct_check = {\n\t\t\t'accurate': ct_accurate_check,\n\t\t\t'from' : ct_date_from,\n\t\t\t'till' : ct_date_till\n\t\t};\n\t\tdocument.cookie = 'ct_paused_users_check=' + JSON.stringify(ct_check) + '; path=/; samesite=lax';\n\t});\n\t\t\n\t//Approve button\n\tjQuery(\".cleantalk_delete_from_list_button\").click(function(){\n\t\tct_id = jQuery(this).attr(\"data-id\");\n\t\t\n\t\t// Approving\n\t\tvar data = {\n\t\t\t'action': 'ajax_ct_approve_user',\n\t\t\t'security': ct_ajax_nonce,\n\t\t\t'id': ct_id,\n\t\t\t'no_cache': Math.random()\n\t\t};\n\t\tjQuery.ajax({\n\t\t\ttype: \"POST\",\n\t\t\turl: ajaxurl,\n\t\t\tdata: data,\n\t\t\tsuccess: function(msg){\n\t\t\t\tjQuery(\"#comment-\"+ct_id).fadeOut('slow', function(){\n\t\t\t\t\tjQuery(\"#comment-\"+ct_id).remove();\n\t\t\t\t});\n\t\t\t},\n\t\t});\n\t\t\n\t\t// Positive feedback\n\t\tvar data = {\n\t\t\t'action': 'ct_feedback_user',\n\t\t\t'security': ct_ajax_nonce,\n\t\t\t'user_id': ct_id,\n\t\t\t'status': 'approve',\n\t\t\t'no_cache': Math.random()\n\t\t};\n\t\tjQuery.ajax({\n\t\t\ttype: \"POST\",\n\t\t\turl: ajaxurl,\n\t\t\tdata: data,\n\t\t\tsuccess: function(msg){\n\t\t\t\tif(msg == 1){\n\t\t\t\t\t// Success\n\t\t\t\t}\n\t\t\t\tif(msg == 0){\n\t\t\t\t\t// Error occurred\n\t\t\t\t}\n\t\t\t\tif(msg == 'no_hash'){\n\t\t\t\t\t// No hash\n\t\t\t\t}\n\t\t\t},\n\t\t\terror: function(jqXHR, textStatus, errorThrown) {\n\t\t\t\t\n\t\t\t},\n\t\t\ttimeout: 5000\n\t\t});\n\t\t\n\t});\n\t\n\t// Request to Download CSV file.\n\tjQuery(\".ct_get_csv_file\").click(function( e ){\n\t\tvar data = {\n\t\t\t'action': 'ajax_ct_get_csv_file',\n\t\t\t'security': ct_ajax_nonce,\n\t\t\t'filename': ctUsersCheck.ct_csv_filename,\n\t\t\t'no_cache': Math.random()\n\t\t};\n\t\tjQuery('.' + e.target.id).addClass('disabled');\n\t\tjQuery('.spinner').css('visibility', 'visible');\n\t\tjQuery.ajax({\n\t\t\ttype: \"POST\",\n\t\t\turl: ajaxurl,\n\t\t\tdata: data,\n\t\t\tsuccess: function(msg){\n\t\t\t\tif( parseInt(msg) === 0 ) {\n\t\t\t\t\talert(ctUsersCheck.ct_bad_csv);\n\t\t\t\t} else {\n\t\t\t\t\tvar url = URL.createObjectURL(new Blob([msg]));\n\n\t\t\t\t\tvar dummy = document.createElement('a');\n\t\t\t\t\tdummy.href = url;\n\t\t\t\t\tdummy.download = ctUsersCheck.ct_csv_filename + '.csv';\n\n\t\t\t\t\tdocument.body.appendChild(dummy);\n\t\t\t\t\tdummy.click();\n\t\t\t\t}\n\t\t\t\tjQuery('.' + e.target.id).removeClass('disabled');\n\t\t\t\tjQuery('.spinner').css('visibility', 'hidden');\n\t\t\t}\n\t\t});\n\t});\n\n\t// Delete inserted users\n\tjQuery(\".ct_insert_users\").click(function( e ){\n\t\tct_insert_users();\n\t});\n\n\t// Insert users\n\tjQuery(\".ct_insert_users__delete\").click(function( e ){\n\t\tct_insert_users( true );\n\t});\n\n\t// Delete all spam users\n\tjQuery(\".ct_delete_all_users\").click(function( e ){\n\n\t\tif ( ! confirm( ctUsersCheck.ct_confirm_deletion_all ) )\n\t\t\treturn false;\n\n\t\tct_delete_all_users( e );\n\n\t});\n\n\tfunction ct_insert_users(delete_accounts){\n\n\t\tdelete_accounts = delete_accounts || null;\n\n\t\tvar data = {\n\t\t\t'action': 'ajax_insert_users',\n\t\t\t'security': ct_ajax_nonce,\n\t\t\t'no_cache': Math.random()\n\t\t};\n\n\t\tif(delete_accounts)\n\t\t\tdata['delete'] = true;\n\n\t\tjQuery.ajax({\n\t\t\ttype: \"POST\",\n\t\t\turl: ajaxurl,\n\t\t\tdata: data,\n\t\t\tsuccess: function(msg){\n\t\t\t\tif(delete_accounts)\n\t\t\t\t\talert('Deleted ' + msg + ' users');\n\t\t\t\telse\n\t\t\t\t\talert('Inserted ' + msg + ' users');\n\t\t\t}\n\t\t});\n\t}\n\n});\n\n/**\n * Get cookie by name\n * @param name\n * @returns {string|undefined}\n */\nfunction getCookie(name) {\n\tlet matches = document.cookie.match(new RegExp(\n\t\t\"(?:^|; )\" + name.replace(/([\\.$?*|{}\\(\\)\\[\\]\\\\\\/\\+^])/g, '\\\\$1') + \"=([^;]*)\"\n\t));\n\treturn matches ? decodeURIComponent(matches[1]) : undefined;\n} "],"names":["String","prototype","printf","arg","formatted","this","arguments","before_formatted","substring","indexOf","after_formatted","length","ct_working","document","cookie","ct_new_check","ct_cooling_down_flag","ct_close_animate","ct_accurate_check","ct_pause","ct_prev_accurate","ctUsersCheck","ct_prev_from","ct_prev_till","ct_cool_down_time","ct_requests_counter","ct_max_requests","ct_ajax_nonce","ct_users_total","ct_users_checked","ct_users_spam","ct_users_bad","ct_unchecked","ct_date_from","ct_date_till","apbct_cookie__get","names","prefixes","split","forEach","item","i","arr","curr","trim","name","all","prefix","apbct_get_cookie","animate_comment","to","id","jQuery","fadeTo","ct_clear_users","from","till","ctSecure","is","val","location","protocol","data","action","security","no_cache","Math","random","ajax","type","url","ajaxurl","success","msg","ct_show_users_info","ct_send_users","ct_cooling_down_toggle","setTimeout","check_amount","new_check","unchecked","amount","offset","Number","getCookie","parseJSON","parseInt","error","confirm","error_message","new_href","href","end","hide","checked","spam","bad","status_string","ct_status_string","ct_status_string_warning","html","jqXHR","textStatus","errorThrown","show","timeout","message","ct_toggle_depended","obj","secondary","depended","prop","removeProp","ct_start_check","continue_check","alert","ct_delete_all_users","e","target","addClass","css","removeClass","matches","match","RegExp","replace","decodeURIComponent","undefined","ready","on","attr","datepicker","setDefaults","regional","dates","dateFormat","maxDate","changeMonth","changeYear","showAnim","onSelect","selectedDate","option","instance","date","parseDate","settings","_defaults","not","ct_insert_users","delete_accounts","click","ct_check","accurate","JSON","stringify","ct_id","fadeOut","remove","user_id","status","filename","ct_csv_filename","dummy","ct_bad_csv","URL","createObjectURL","Blob","createElement","download","body","appendChild","ct_confirm_deletion_all"],"mappings":"AACAA,OAAOC,UAAUC,OAAS,WACtB,IACSC,EADLC,EAAYC,KAChB,IAASF,KAAOG,UAClB,IAAIC,EAAmBH,EAAUI,UAAU,EAAGJ,EAAUK,QAAQ,KAAM,IAClEC,EAAmBN,EAAUI,UAAUJ,EAAUK,QAAQ,KAAM,GAAG,EAAGL,EAAUO,QACnFP,EAAYG,EAAmBD,UA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-users-checkspam.min.js","sources":["cleantalk-users-checkspam.js"],"sourcesContent":["// Printf for JS\nString.prototype.printf = function(){\n var formatted = this;\n for( var arg in arguments ) {\n\t\tvar before_formatted = formatted.substring(0, formatted.indexOf(\"%s\", 0));\n\t\tvar after_formatted = formatted.substring(formatted.indexOf(\"%s\", 0)+2, formatted.length);\n\t\tformatted = before_formatted + arguments[arg] + after_formatted;\n }\n return formatted;\n};\n\n// Set deafult amount to check by request.\ndocument.cookie = \"ct_check_users__amount=\" + 100 + \"; path=/; samesite=lax\";\n\n// Flags\nvar ct_working = false,\n\tct_new_check = true,\n\tct_cooling_down_flag = false,\n\tct_close_animate = true,\n\tct_accurate_check = false,\n\tct_pause = false,\n\tct_prev_accurate = ctUsersCheck.ct_prev_accurate,\n\tct_prev_from = ctUsersCheck.ct_prev_from,\t\n\tct_prev_till = ctUsersCheck.ct_prev_till;\n// Settings\nvar ct_cool_down_time = 90000,\n\tct_requests_counter = 0,\n\tct_max_requests = 60;\n// Variables\nvar ct_ajax_nonce = ctUsersCheck.ct_ajax_nonce,\n\tct_users_total = 0,\n\tct_users_checked = 0,\n\tct_users_spam = 0,\n\tct_users_bad = 0,\n\tct_unchecked = 'unset',\n\tct_date_from = 0,\n\tct_date_till = 0;\n\n/* Function: Reuturns cookie with prefix */\nfunction apbct_cookie__get(names, prefixes){\n\tvar cookie = {};\n\tnames = names || null;\n\tif(typeof names == 'string') names = names.split();\n\tprefixes = prefixes || ['apbct_', 'ct_'];\n\tif(prefixes === 'none') prefixes = null;\n\tif(typeof prefixes == 'string') prefixes = prefixes.split();\n\tdocument.cookie.split(';').forEach(function(item, i, arr){\n\t\tvar curr = item.trim().split('=');\n\t\t// Detect by full cookie name\n\t\tif(names){\n\t\t\tnames.forEach(function(name, i, all){\n\t\t\t\tif(curr[0] === name)\n\t\t\t\t\tcookie[curr[0]] = (curr[1]);\n\t\t\t});\n\t\t}\n\t\t// Detect by name prefix\n\t\tif(prefixes){\n\t\t\tprefixes.forEach(function(prefix, i, all){\n\t\t\t\tif(curr[0].indexOf(prefix) === 0)\n\t\t\t\t\tcookie[curr[0]] = (curr[1]);\n\t\t\t});\n\t\t}\n\t});\n\treturn cookie;\n}\n\nfunction apbct_get_cookie( name ){\n\tvar cookie = apbct_cookie__get( name, name );\n\tif(typeof cookie === 'object' && typeof cookie[name] != 'undefined'){\n\t\treturn cookie[name];\n\t}else\n\t\treturn null;\n}\n\nfunction animate_comment(to,id){\n\tif(ct_close_animate){\n\t\tif(to === 0.3){\n\t\t\tjQuery('#comment-'+id).fadeTo(200,to,function(){\n\t\t\t\tanimate_comment(1,id)\n\t\t\t});\n\t\t}else{\n\t\t\tjQuery('#comment-'+id).fadeTo(200,to,function(){\n\t\t\t\tanimate_comment(0.3,id)\n\t\t\t});\n\t\t}\n\t}else{\n\t\tct_close_animate=true;\n\t}\n}\n\nfunction ct_clear_users(){\n\n\tvar from = 0, till = 0;\n\tif(jQuery('#ct_allow_date_range').is(':checked')) {\n\t\tfrom = jQuery('#ct_date_range_from').val();\n\t\ttill = jQuery('#ct_date_range_till').val();\n\t}\n\n\tvar ctSecure = location.protocol === 'https:' ? '; secure' : '';\n\tdocument.cookie = 'apbct_check_users_offset' + \"=\" + 0 + \"; path=/; samesite=lax\" + ctSecure;\n\n\tvar data = {\n\t\t'action' : 'ajax_clear_users',\n\t\t'security' : ct_ajax_nonce,\n\t\t'from' : from,\n\t\t'till' : till,\n\t\t'no_cache': Math.random()\n\t};\n\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(msg){\n\t\t\tct_show_users_info();\n\t\t\tct_send_users();\n\t\t}\n\t});\n\n}\n\n//Continues the check after cooldown time\n//Called by ct_send_users();\nfunction ct_cooling_down_toggle(){\n\tct_cooling_down_flag = false;\n\tct_send_users();\n\tct_show_users_info();\n}\n\nfunction ct_send_users(){\n\t\n\tif(ct_cooling_down_flag === true)\n\t\treturn;\n\t\n\tif(ct_requests_counter >= ct_max_requests){\n\t\tsetTimeout(ct_cooling_down_toggle, ct_cool_down_time);\n\t\tct_requests_counter = 0;\n\t\tct_cooling_down_flag = true;\n\t\treturn;\n\t}else{\n\t\tct_requests_counter++;\n\t}\n\n\tvar check_amount = apbct_get_cookie('ct_check_users__amount');\n\n\tvar data = {\n\t\taction: 'ajax_check_users',\n\t\tsecurity: ct_ajax_nonce,\n\t\tnew_check: ct_new_check,\n\t\tunchecked: ct_unchecked,\n\t\tamount: check_amount,\n\t\t'no_cache': Math.random(),\n\t\t'offset' : Number(getCookie('apbct_check_users_offset'))\n\t};\n\t\n\tif(ct_accurate_check)\n\t\tdata['accurate_check'] = true;\n\t\n\tif(ct_date_from && ct_date_till){\n\t\tdata['from'] = ct_date_from;\n\t\tdata['till'] = ct_date_till;\n\t}\n\t\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(msg){\n\t\t\t\n\t\t\tmsg = jQuery.parseJSON(msg);\n\t\t\t\n\t\t\tif(parseInt(msg.error)){\n\t\t\t\tct_working=false;\n\t\t\t\tif(!confirm(msg.error_message+\". Do you want to proceed?\")){\n\t\t\t\t\tvar new_href = 'users.php?page=ct_check_users';\n\t\t\t\t\tif(ct_date_from != 0 && ct_date_till != 0)\n\t\t\t\t\t\tnew_href+='&from='+ct_date_from+'&till='+ct_date_till;\n\t\t\t\t\tlocation.href = new_href;\n\t\t\t\t}else\n\t\t\t\t\tct_send_users();\n\t\t\t}else{\n\t\t\t\tct_new_check = false;\n\t\t\t\tif(parseInt(msg.end) == 1 || ct_pause == true){\n\t\t\t\t\tif(parseInt(msg.end) == 1)\n\t\t\t\t\t\tdocument.cookie = 'ct_paused_users_check=0; path=/; samesite=lax';\n\t\t\t\t\tct_working=false;\n\t\t\t\t\tjQuery('#ct_working_message').hide();\n\t\t\t\t\tvar new_href = 'users.php?page=ct_check_users&ct_worked=1';\n\t\t\t\t\tif(ct_date_from != 0 && ct_date_till != 0)\n\t\t\t\t\t\tnew_href+='&from='+ct_date_from+'&till='+ct_date_till;\n\t\t\t\t\tlocation.href = new_href;\n\t\t\t\t}else if(parseInt(msg.end) == 0){\n\t\t\t\t\tct_users_checked = parseInt( ct_users_checked ) + parseInt( msg.checked );\n\t\t\t\t\tct_users_spam = parseInt( ct_users_spam ) + parseInt (msg.spam );\n\t\t\t\t\tct_users_bad = parseInt( msg.bad );\n\t\t\t\t\tct_unchecked = ct_users_total - ct_users_checked - ct_users_bad;\n\t\t\t\t\tvar status_string = String(ctUsersCheck.ct_status_string);\n\t\t\t\t\tvar status_string = status_string.printf(ct_users_checked, ct_users_spam, ct_users_bad);\n\t\t\t\t\tif(parseInt(ct_users_spam) > 0)\n\t\t\t\t\t\tstatus_string += ctUsersCheck.ct_status_string_warning;\n\t\t\t\t\tjQuery('#ct_checking_status').html(status_string);\n\t\t\t\t\tjQuery('#ct_error_message').hide();\n\n\t\t\t\t\tvar offset = Number(getCookie('apbct_check_users_offset')) + 100;\n\t\t\t\t\tvar ctSecure = location.protocol === 'https:' ? '; secure' : '';\n\t\t\t\t\tdocument.cookie = 'apbct_check_users_offset' + \"=\" + offset + \"; path=/; samesite=lax\" + ctSecure;\n\t\t\t\t\t\n\t\t\t\t\tct_send_users();\n\t\t\t\t}\n\t\t\t}\n\t\t},\n error: function(jqXHR, textStatus, errorThrown) {\n\t\t\tif(check_amount > 20){\n\t\t\t\tcheck_amount -= 20;\n\t\t\t\tdocument.cookie = \"ct_check_users__amount=\" + check_amount + \"; path=/; samesite=lax\";\n\t\t\t}\n\t\t\tjQuery('#ct_error_message').show();\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\n\t\t\tjQuery('#cleantalk_js_func').html('Check users');\n\t\t\tsetTimeout(ct_send_users(), 3000);\n },\n timeout: 25000\n\t});\n}\nfunction ct_show_users_info(){\n\t\n\tif( ct_working ){\n\t\t\n\t\tif(ct_cooling_down_flag === true){\n\t\t\tjQuery('#ct_cooling_notice').html('Waiting for API to cool down. (About a minute)').show();\n\t\t\treturn;\t\t\t\n\t\t}else{\n\t\t\tjQuery('#ct_cooling_notice').hide();\n\t\t}\n\t\t\n\t\tif( ! ct_users_total ){\n\t\t\t\n\t\t\tvar data = {\n\t\t\t\t'action': 'ajax_info_users',\n\t\t\t\t'security': ct_ajax_nonce,\n\t\t\t\t'no_cache': Math.random()\n\t\t\t};\n\t\t\t\n\t\t\tif( ct_date_from && ct_date_till ){\n\t\t\t\tdata['from'] = ct_date_from;\n\t\t\t\tdata['till'] = ct_date_till;\n\t\t\t}\n\t\t\t\n\t\t\tjQuery.ajax({\n\t\t\t\ttype: \"POST\",\n\t\t\t\turl: ajaxurl,\n\t\t\t\tdata: data,\n\t\t\t\tsuccess: function(msg){\n\t\t\t\t\tmsg = jQuery.parseJSON(msg);\n\t\t\t\t\tjQuery('#ct_checking_status').html(msg.message);\n\t\t\t\t\tct_users_spam = msg.spam;\n\t\t\t\t\tct_users_checked = msg.checked;\n\t\t\t\t\tct_users_bad = msg.bad;\n\t\t\t\t},\n\t\t\t\terror: function (jqXHR, textStatus, errorThrown){\n\t\t\t\t\tjQuery('#ct_error_message').show();\n\t\t\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\n\t\t\t\t\tjQuery('#cleantalk_js_func').html('Show users');\n\t\t\t\t\tsetTimeout(ct_show_users_info(), 3000);\n\t\t\t\t},\n\t\t\t\ttimeout: 15000\n\t\t\t});\n\t\t}\n\t}\n}\n// Function to toggle dependences\nfunction ct_toggle_depended(obj, secondary){\n\n secondary = secondary || null;\n\n\tvar depended = jQuery(obj.data('depended')),\n\t\tstate = obj.data('state');\n\t\t\n\tif(!state && !secondary){\n\t\tobj.data('state', true);\n\t\tdepended.removeProp('disabled');\n\t}else{\n\t\tobj.data('state', false);\n\t\tdepended.prop('disabled', true);\n\t\tdepended.removeProp('checked');\n\t\tif(depended.data('depended'))\n\t\t\tct_toggle_depended(depended, true);\n\t}\n}\n\n// Main function of checking\nfunction ct_start_check( continue_check ){\n\n\tcontinue_check = continue_check || null;\n\n\tif(jQuery('#ct_allow_date_range').is(':checked')){\n\n\t\tct_date_from = jQuery('#ct_date_range_from').val();\n\t\tct_date_till = jQuery('#ct_date_range_till').val();\n\n\t\tif(!(ct_date_from !== '' && ct_date_till !== '')){\n\t\t\talert(ctUsersCheck.ct_specify_date_range);\n\t\t\treturn;\n\t\t}\n\t}\n\n\tif(jQuery('#ct_accurate_check').is(':checked')){\n\t\tct_accurate_check = true;\n\t}\n\n\t//\n\tif (\n\t\tjQuery('#ct_accurate_check').is(':checked') &&\n\t\t! jQuery('#ct_allow_date_range').is(':checked')\n\t) {\n\t\talert(ctUsersCheck.ct_select_date_range);\n\t\treturn;\n\t}\n\n\tjQuery('.ct_to_hide').hide();\n\tjQuery('#ct_working_message').show();\n\tjQuery('#ct_preloader').show();\n\tjQuery('#ct_pause').show();\n\n\tct_working = true;\n\n\tif( continue_check ){\n\t\tct_show_users_info();\n\t\tct_send_users();\n\t} else {\n\t\tct_clear_users();\n\t}\n\n}\n\nfunction ct_delete_all_users( e ){\n\n\tvar data = {\n\t\t'action': 'ajax_delete_all_users',\n\t\t'security': ct_ajax_nonce,\n\t\t'no_cache': Math.random()\n\t};\n\n\tjQuery('.' + e.target.id).addClass('disabled');\n\tjQuery('.spinner').css('visibility', 'visible');\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function( msg ){\n\t\t\tif( msg > 0 ){\n\t\t\t\tjQuery('#cleantalk_users_left').html(msg);\n\t\t\t\tct_delete_all_users( e, data );\n\t\t\t}else{\n\t\t\t\tjQuery('.' + e.target.id).removeClass('disabled');\n\t\t\t\tjQuery('.spinner').css('visibility', 'hidden');\n\t\t\t\tlocation.href='users.php?page=ct_check_users';\n\t\t\t}\n\t\t},\n\t\terror: function(jqXHR, textStatus, errorThrown) {\n\t\t\tjQuery('#ct_error_message').show();\n\t\t\tjQuery('#cleantalk_ajax_error').html(textStatus);\n\t\t\tjQuery('#cleantalk_js_func').html('All users deleteion');\n\t\t\tsetTimeout(ct_delete_all_users( e ), 3000);\n\t\t},\n\t\ttimeout: 25000\n\t});\n}\n\njQuery(document).ready(function(){\n\n\t// Setting dependences\n\t\n\t// Prev check parameters\n\tif(ct_prev_accurate){\n\t\tjQuery(\"#ct_accurate_check\").prop('checked', true);\n\t}\n\tif(ct_prev_from){\n\t\tjQuery(\"#ct_allow_date_range\").prop('checked', true).data('state', true);\n\t\tjQuery(\"#ct_date_range_from\").removeProp('disabled').val(ct_prev_from);\n\t\tjQuery(\"#ct_date_range_till\").removeProp('disabled').val(ct_prev_till);\n\t}\n\t\n\t// Toggle dependences\n\tjQuery(\"#ct_allow_date_range\").on('change', function(){\n\t\tdocument.cookie = 'ct_users_dates_from='+ jQuery('#ct_date_range_from').val() +'; path=/; samesite=lax';\n\t\tdocument.cookie = 'ct_users_dates_till='+ jQuery('#ct_date_range_till').val() +'; path=/; samesite=lax';\n\t\tif( this.checked ) {\n\t\t\tdocument.cookie = 'ct_users_dates_allowed=1; path=/; samesite=lax';\n\t\t\tjQuery('.ct_date').prop('checked', true).attr('disabled',false);\n\t\t} else {\n\t\t\tdocument.cookie = 'ct_users_dates_allowed=0; path=/; samesite=lax';\n\t\t\tjQuery('.ct_date').prop('disabled', true).attr('disabled',true);\n\t\t}\n\t});\n\n\tjQuery.datepicker.setDefaults(jQuery.datepicker.regional['en']);\n\tvar dates = jQuery('#ct_date_range_from, #ct_date_range_till').datepicker(\n\t\t{\n\t\t\tdateFormat: 'M d yy',\n\t\t\tmaxDate:\"+0D\",\n\t\t\tchangeMonth:true,\n\t\t\tchangeYear:true,\n\t\t\tshowAnim: 'slideDown',\n\t\t\tonSelect: function(selectedDate){\n\t\t\tvar option = this.id == \"ct_date_range_from\" ? \"minDate\" : \"maxDate\",\n\t\t\t\tinstance = jQuery( this ).data( \"datepicker\" ),\n\t\t\t\tdate = jQuery.datepicker.parseDate(\n\t\t\t\t\tinstance.settings.dateFormat || jQuery.datepicker._defaults.dateFormat,\n\t\t\t\t\tselectedDate, instance.settings);\n\t\t\t\tdates.not(this).datepicker(\"option\", option, date);\n\t\t\t\tdocument.cookie = 'ct_users_dates_from='+ jQuery('#ct_date_range_from').val() +'; path=/; samesite=lax';\n\t\t\t\tdocument.cookie = 'ct_users_dates_till='+ jQuery('#ct_date_range_till').val() +'; path=/; samesite=lax';\n\t\t\t}\n\t\t}\n\t);\n\t\n\t// Check users\n\tjQuery(\"#ct_check_spam_button\").click(function(){\n\t\tdocument.cookie = 'ct_paused_users_check=0; path=/; samesite=lax';\n\n\t\t//\n\n\n\t\tct_start_check(false);\n\t});\n\tjQuery(\"#ct_proceed_check_button\").click(function(){\n\t\tct_start_check(true);\n\t});\n\t\n\t// Pause the check\n\tjQuery('#ct_pause').on('click', function(){\n\t\tct_pause = true;\n\t\tvar ct_check = {\n\t\t\t'accurate': ct_accurate_check,\n\t\t\t'from' : ct_date_from,\n\t\t\t'till' : ct_date_till\n\t\t};\n\t\tdocument.cookie = 'ct_paused_users_check=' + JSON.stringify(ct_check) + '; path=/; samesite=lax';\n\t});\n\t\t\n\t//Approve button\n\tjQuery(\".cleantalk_delete_from_list_button\").click(function(){\n\t\tct_id = jQuery(this).attr(\"data-id\");\n\t\t\n\t\t// Approving\n\t\tvar data = {\n\t\t\t'action': 'ajax_ct_approve_user',\n\t\t\t'security': ct_ajax_nonce,\n\t\t\t'id': ct_id,\n\t\t\t'no_cache': Math.random()\n\t\t};\n\t\tjQuery.ajax({\n\t\t\ttype: \"POST\",\n\t\t\turl: ajaxurl,\n\t\t\tdata: data,\n\t\t\tsuccess: function(msg){\n\t\t\t\tjQuery(\"#comment-\"+ct_id).fadeOut('slow', function(){\n\t\t\t\t\tjQuery(\"#comment-\"+ct_id).remove();\n\t\t\t\t});\n\t\t\t},\n\t\t});\n\t\t\n\t\t// Positive feedback\n\t\tvar data = {\n\t\t\t'action': 'ct_feedback_user',\n\t\t\t'security': ct_ajax_nonce,\n\t\t\t'user_id': ct_id,\n\t\t\t'status': 'approve',\n\t\t\t'no_cache': Math.random()\n\t\t};\n\t\tjQuery.ajax({\n\t\t\ttype: \"POST\",\n\t\t\turl: ajaxurl,\n\t\t\tdata: data,\n\t\t\tsuccess: function(msg){\n\t\t\t\tif(msg == 1){\n\t\t\t\t\t// Success\n\t\t\t\t}\n\t\t\t\tif(msg == 0){\n\t\t\t\t\t// Error occurred\n\t\t\t\t}\n\t\t\t\tif(msg == 'no_hash'){\n\t\t\t\t\t// No hash\n\t\t\t\t}\n\t\t\t},\n\t\t\terror: function(jqXHR, textStatus, errorThrown) {\n\t\t\t\t\n\t\t\t},\n\t\t\ttimeout: 5000\n\t\t});\n\t\t\n\t});\n\t\n\t// Request to Download CSV file.\n\tjQuery(\".ct_get_csv_file\").click(function( e ){\n\t\tvar data = {\n\t\t\t'action': 'ajax_ct_get_csv_file',\n\t\t\t'security': ct_ajax_nonce,\n\t\t\t'filename': ctUsersCheck.ct_csv_filename,\n\t\t\t'no_cache': Math.random()\n\t\t};\n\t\tjQuery('.' + e.target.id).addClass('disabled');\n\t\tjQuery('.spinner').css('visibility', 'visible');\n\t\tjQuery.ajax({\n\t\t\ttype: \"POST\",\n\t\t\turl: ajaxurl,\n\t\t\tdata: data,\n\t\t\tsuccess: function(msg){\n\t\t\t\tif( parseInt(msg) === 0 ) {\n\t\t\t\t\talert(ctUsersCheck.ct_bad_csv);\n\t\t\t\t} else {\n\t\t\t\t\tvar url = URL.createObjectURL(new Blob([msg]));\n\n\t\t\t\t\tvar dummy = document.createElement('a');\n\t\t\t\t\tdummy.href = url;\n\t\t\t\t\tdummy.download = ctUsersCheck.ct_csv_filename + '.csv';\n\n\t\t\t\t\tdocument.body.appendChild(dummy);\n\t\t\t\t\tdummy.click();\n\t\t\t\t}\n\t\t\t\tjQuery('.' + e.target.id).removeClass('disabled');\n\t\t\t\tjQuery('.spinner').css('visibility', 'hidden');\n\t\t\t}\n\t\t});\n\t});\n\n\t// Delete inserted users\n\tjQuery(\".ct_insert_users\").click(function( e ){\n\t\tct_insert_users();\n\t});\n\n\t// Insert users\n\tjQuery(\".ct_insert_users__delete\").click(function( e ){\n\t\tct_insert_users( true );\n\t});\n\n\t// Delete all spam users\n\tjQuery(\".ct_delete_all_users\").click(function( e ){\n\n\t\tif ( ! confirm( ctUsersCheck.ct_confirm_deletion_all ) )\n\t\t\treturn false;\n\n\t\tct_delete_all_users( e );\n\n\t});\n\n\tfunction ct_insert_users(delete_accounts){\n\n\t\tdelete_accounts = delete_accounts || null;\n\n\t\tvar data = {\n\t\t\t'action': 'ajax_insert_users',\n\t\t\t'security': ct_ajax_nonce,\n\t\t\t'no_cache': Math.random()\n\t\t};\n\n\t\tif(delete_accounts)\n\t\t\tdata['delete'] = true;\n\n\t\tjQuery.ajax({\n\t\t\ttype: \"POST\",\n\t\t\turl: ajaxurl,\n\t\t\tdata: data,\n\t\t\tsuccess: function(msg){\n\t\t\t\tif(delete_accounts)\n\t\t\t\t\talert('Deleted ' + msg + ' users');\n\t\t\t\telse\n\t\t\t\t\talert('Inserted ' + msg + ' users');\n\t\t\t}\n\t\t});\n\t}\n\n\n\t/**\n\t * Checked ct_accurate_check\n\t */\n\tjQuery('#ct_accurate_check').change(function () {\n\t\tif(this.checked) {\n\t\t\tjQuery('#ct_allow_date_range').prop('checked', true);\n\t\t\tjQuery('.ct_date').prop('checked', true).attr('disabled',false);\n\t\t}\n\t});\n});\n\n/**\n * Get cookie by name\n * @param name\n * @returns {string|undefined}\n */\nfunction getCookie(name) {\n\tlet matches = document.cookie.match(new RegExp(\n\t\t\"(?:^|; )\" + name.replace(/([\\.$?*|{}\\(\\)\\[\\]\\\\\\/\\+^])/g, '\\\\$1') + \"=([^;]*)\"\n\t));\n\treturn matches ? decodeURIComponent(matches[1]) : undefined;\n}"],"names":["String","prototype","printf","arg","formatted","this","arguments","before_formatted","substring","indexOf","after_formatted","length","ct_working","document","cookie","ct_new_check","ct_cooling_down_flag","ct_close_animate","ct_accurate_check","ct_pause","ct_prev_accurate","ctUsersCheck","ct_prev_from","ct_prev_till","ct_cool_down_time","ct_requests_counter","ct_max_requests","ct_ajax_nonce","ct_users_total","ct_users_checked","ct_users_spam","ct_users_bad","ct_unchecked","ct_date_from","ct_date_till","apbct_cookie__get","names","prefixes","split","forEach","item","i","arr","curr","trim","name","all","prefix","apbct_get_cookie","animate_comment","to","id","jQuery","fadeTo","ct_clear_users","from","till","ctSecure","is","val","location","protocol","data","action","security","no_cache","Math","random","ajax","type","url","ajaxurl","success","msg","ct_show_users_info","ct_send_users","ct_cooling_down_toggle","setTimeout","check_amount","new_check","unchecked","amount","offset","Number","getCookie","parseJSON","parseInt","error","confirm","error_message","new_href","href","end","hide","checked","spam","bad","status_string","ct_status_string","ct_status_string_warning","html","jqXHR","textStatus","errorThrown","show","timeout","message","ct_toggle_depended","obj","secondary","depended","prop","removeProp","ct_start_check","continue_check","alert","ct_specify_date_range","ct_select_date_range","ct_delete_all_users","e","target","addClass","css","removeClass","matches","match","RegExp","replace","decodeURIComponent","undefined","ready","on","attr","datepicker","setDefaults","regional","dates","dateFormat","maxDate","changeMonth","changeYear","showAnim","onSelect","selectedDate","option","instance","date","parseDate","settings","_defaults","not","ct_insert_users","delete_accounts","click","ct_check","accurate","JSON","stringify","ct_id","fadeOut","remove","user_id","status","filename","ct_csv_filename","dummy","ct_bad_csv","URL","createObjectURL","Blob","createElement","download","body","appendChild","ct_confirm_deletion_all","change"],"mappings":"AACAA,OAAOC,UAAUC,OAAS,WACtB,IACSC,EADLC,EAAYC,KAChB,IAASF,KAAOG,UAClB,IAAIC,EAAmBH,EAAUI,UAAU,EAAGJ,EAAUK,QAAQ,KAAM,IAClEC,EAAmBN,EAAUI,UAAUJ,EAAUK,QAAQ,KAAM,GAAG,EAAGL,EAAUO,QACnFP,EAAYG,EAAmBD,UAAUH,GAAOO,EAE9C,OAAON,GAOX,IAAIQ,aAHJC,SAASC,OAAS,oDAIjBC,cAAe,EACfC,sBAAuB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K,KAAKyF,UACP1C,OAAO,wBAAwB2D,KAAK,WAAW,GAC/C3D,OAAO,YAAY2D,KAAK,WAAW,GAAMqB,KAAK,YAAW"}
|
js/cleantalk_external.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
function ct_protect_external(){for(var e,t,n,a,o,i,c=0;c<document.forms.length;c++)void 0!==document.forms[c].cleantalk_hidden_action||void 0!==document.forms[c].cleantalk_hidden_method||"string"==typeof(e=document.forms[c]).action&&(isIntegratedForm(e)?(jQuery(e).before('<i class="cleantalk_placeholder" style="display: none;"></i>'),t=jQuery(e).prev(),o=e.outerHTML,n=jQuery(e).detach(),t.after(o),(o=document.createElement("input")).name="action",o.value="cleantalk_force_ajax_check",o.type="hidden",(a=document.forms[c]).appendChild(o),void 0!==a.classList&&a.classList.contains("ml-block-form")?void 0!==(o=jQuery("form.ml-block-form").find('button[type="submit"]'))&&o.click(function(e){e.preventDefault(),sendAjaxCheckingFormData(a,t,n)}):document.forms[c].onsubmit=function(e){e.preventDefault();var t=jQuery(e.currentTarget).prev(),n=jQuery(e.currentTarget).clone();sendAjaxCheckingFormData(e.currentTarget,t,n)}):-1===e.action.indexOf("http://")&&-1===e.action.indexOf("https://")||e.action.split("//")[1].split("/")[0].toLowerCase()!==location.hostname.toLowerCase()&&((o=document.createElement("input")).name="cleantalk_hidden_action",o.value=e.action,o.type="hidden",e.appendChild(o),(i=document.createElement("input")).name="cleantalk_hidden_method",i.value=e.method,i.type="hidden",e.method="POST",e.appendChild(i),e.action=document.location))}function apbct_replace_inputs_values_from_other_form(e,t){var e=jQuery(e).find("button, input, textarea, select"),n=jQuery(t).find("button, input, textarea, select");e.each(function(e,a){var o=jQuery(a);n.each(function(e,t){var n=jQuery(t);a.outerHTML===t.outerHTML&&n.val(o.val())})})}function isIntegratedForm(e){var t=e.action;return!!(-1!==t.indexOf("activehosted.com")||-1!==t.indexOf("app.convertkit.com")||void 0!==e.firstChild.classList&&e.firstChild.classList.contains("cb-form-group")||-1!==t.indexOf("mailerlite.com")||-1!==t.indexOf("colcolmail.co.uk")||-1!==t.indexOf("paypal.com")||-1!==t.indexOf("infusionsoft.com")||-1!==t.indexOf("webto.salesforce.com")||-1!==t.indexOf("secure2.convio.net")||-1!==t.indexOf("hookb.in")||-1!==t.indexOf("external.url"))}function sendAjaxCheckingFormData(a,e,t){var n={},o=(n[0]=apbct_collect_visible_fields(a),apbct_visible_fields_set_cookie(n),{}),n=a.elements;(n=Array.prototype.slice.call(n)).forEach(function(e,t){""===e.name?o["input_"+t]=e.value:o[e.name]=e.value}),apbct_public_sendAJAX(o,{async:!1,callback:function(e,t,n){void 0!==n.apbct&&+n.apbct.blocked||(apbct_replace_inputs_values_from_other_form(jQuery(a).detach(),t),e.after(t),0===(n=jQuery(t).find("button[type=submit]")).length&&0===(n=jQuery(t).find("input[type=submit]")).length&&0===(n=jQuery(t).find('button[data-element="submit"]')).length&&0===(n=jQuery(t).find('input[type="image"][name="submit"]')).length||n[0].click())},callback_context:null,callback_params:[e,t]})}window.onload=function(){setTimeout(function(){ct_protect_external()},1500)};
|
2 |
//# sourceMappingURL=cleantalk_external.min.js.map
|
1 |
+
function ct_protect_external(){for(var e,t,n,a,o,i,c=0;c<document.forms.length;c++)void 0!==document.forms[c].cleantalk_hidden_action||void 0!==document.forms[c].cleantalk_hidden_method||"string"==typeof(e=document.forms[c]).action&&(isIntegratedForm(e)?(jQuery(e).before('<i class="cleantalk_placeholder" style="display: none;"></i>'),t=jQuery(e).prev(),o=e.outerHTML,n=jQuery(e).detach(),t.after(o),(o=document.createElement("input")).name="action",o.value="cleantalk_force_ajax_check",o.type="hidden",(a=document.forms[c]).appendChild(o),void 0!==a.classList&&a.classList.contains("ml-block-form")?void 0!==(o=jQuery("form.ml-block-form").find('button[type="submit"]'))&&o.click(function(e){e.preventDefault(),sendAjaxCheckingFormData(a,t,n)}):document.forms[c].onsubmit=function(e){e.preventDefault();var t=jQuery(e.currentTarget).prev(),n=jQuery(e.currentTarget).clone();sendAjaxCheckingFormData(e.currentTarget,t,n)}):-1===e.action.indexOf("http://")&&-1===e.action.indexOf("https://")||e.action.split("//")[1].split("/")[0].toLowerCase()!==location.hostname.toLowerCase()&&((o=document.createElement("input")).name="cleantalk_hidden_action",o.value=e.action,o.type="hidden",e.appendChild(o),(i=document.createElement("input")).name="cleantalk_hidden_method",i.value=e.method,i.type="hidden",e.method="POST",e.appendChild(i),e.action=document.location))}function apbct_replace_inputs_values_from_other_form(e,t){var e=jQuery(e).find("button, input, textarea, select"),n=jQuery(t).find("button, input, textarea, select");e.each(function(e,a){var o=jQuery(a);n.each(function(e,t){var n=jQuery(t);a.outerHTML===t.outerHTML&&n.val(o.val())})})}function isIntegratedForm(e){var t=e.action;return!!(-1!==t.indexOf("activehosted.com")||-1!==t.indexOf("app.convertkit.com")||void 0!==e.firstChild.classList&&e.firstChild.classList.contains("cb-form-group")||-1!==t.indexOf("mailerlite.com")||-1!==t.indexOf("colcolmail.co.uk")||-1!==t.indexOf("paypal.com")||-1!==t.indexOf("infusionsoft.com")||-1!==t.indexOf("webto.salesforce.com")||-1!==t.indexOf("secure2.convio.net")||-1!==t.indexOf("hookb.in")||-1!==t.indexOf("external.url")||-1!==t.indexOf("tp.media")||-1!==t.indexOf("flodesk.com"))}function sendAjaxCheckingFormData(a,e,t){var n={},o=(n[0]=apbct_collect_visible_fields(a),apbct_visible_fields_set_cookie(n),{}),n=a.elements;(n=Array.prototype.slice.call(n)).forEach(function(e,t){""===e.name?o["input_"+t]=e.value:o[e.name]=e.value}),apbct_public_sendAJAX(o,{async:!1,callback:function(e,t,n){void 0!==n.apbct&&+n.apbct.blocked||(apbct_replace_inputs_values_from_other_form(jQuery(a).detach(),t),e.after(t),0===(n=jQuery(t).find("button[type=submit]")).length&&0===(n=jQuery(t).find("input[type=submit]")).length&&0===(n=jQuery(t).find('button[data-element="submit"]')).length&&0===(n=jQuery(t).find('input[type="image"][name="submit"]')).length||n[0].click())},callback_context:null,callback_params:[e,t]})}window.onload=function(){setTimeout(function(){ct_protect_external()},1500)};
|
2 |
//# sourceMappingURL=cleantalk_external.min.js.map
|
js/cleantalk_external.min.js.map
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"file":"cleantalk_external.min.js","sources":["cleantalk_external.js"],"sourcesContent":["/**\n * Handle external forms\n */\nfunction ct_protect_external() {\n for(var i = 0; i < document.forms.length; i++) {\n\n if (document.forms[i].cleantalk_hidden_action === undefined && document.forms[i].cleantalk_hidden_method === undefined) {\n\n // current form\n var currentForm = document.forms[i];\n\n if(typeof(currentForm.action) == 'string') {\n\n if(isIntegratedForm(currentForm)) {\n jQuery( currentForm ).before('<i class=\"cleantalk_placeholder\" style=\"display: none;\"></i>');\n\n // Deleting form to prevent submit event\n var prev = jQuery(currentForm).prev(),\n form_html = currentForm.outerHTML,\n form_original = jQuery(currentForm).detach();\n\n prev.after( form_html );\n\n var force_action = document.createElement(\"input\");\n force_action.name = 'action';\n force_action.value = 'cleantalk_force_ajax_check';\n force_action.type = 'hidden';\n\n var reUseCurrentForm = document.forms[i];\n\n reUseCurrentForm.appendChild(force_action);\n\n // mailerlite integration - disable click on submit button\n if(reUseCurrentForm.classList !== undefined && reUseCurrentForm.classList.contains('ml-block-form')) {\n var mailerliteSubmitButton = jQuery('form.ml-block-form').find('button[type=\"submit\"]');\n\n if(mailerliteSubmitButton !== undefined) {\n mailerliteSubmitButton.click(function (event) {\n event.preventDefault();\n sendAjaxCheckingFormData(reUseCurrentForm, prev, form_original);\n });\n }\n } else {\n document.forms[i].onsubmit = function ( event ){\n event.preventDefault();\n\n const prev = jQuery(event.currentTarget).prev();\n const form_original = jQuery(event.currentTarget).clone();\n\n sendAjaxCheckingFormData(event.currentTarget, prev, form_original);\n };\n }\n\n // Common flow\n }else if(currentForm.action.indexOf('http://') !== -1 || currentForm.action.indexOf('https://') !== -1) {\n\n var tmp = currentForm.action.split('//');\n tmp = tmp[1].split('/');\n var host = tmp[0].toLowerCase();\n\n if(host !== location.hostname.toLowerCase()){\n\n var ct_action = document.createElement(\"input\");\n ct_action.name = 'cleantalk_hidden_action';\n ct_action.value = currentForm.action;\n ct_action.type = 'hidden';\n currentForm.appendChild(ct_action);\n\n var ct_method = document.createElement(\"input\");\n ct_method.name = 'cleantalk_hidden_method';\n ct_method.value = currentForm.method;\n ct_method.type = 'hidden';\n\n currentForm.method = 'POST';\n currentForm.appendChild(ct_method);\n\n currentForm.action = document.location;\n }\n }\n }\n }\n\n }\n}\nfunction apbct_replace_inputs_values_from_other_form( form_source, form_target ){\n\n var\tinputs_source = jQuery( form_source ).find( 'button, input, textarea, select' ),\n inputs_target = jQuery( form_target ).find( 'button, input, textarea, select' );\n\n inputs_source.each( function( index, elem_source ){\n\n var source = jQuery( elem_source );\n\n inputs_target.each( function( index2, elem_target ){\n\n var target = jQuery( elem_target );\n\n if( elem_source.outerHTML === elem_target.outerHTML ){\n\n target.val( source.val() );\n }\n });\n });\n\n}\nwindow.onload = function () {\n setTimeout(function () {\n ct_protect_external()\n }, 1500);\n};\n\n/**\n * Checking the form integration\n */\nfunction isIntegratedForm(formObj) {\n var formAction = formObj.action;\n\n if(\n formAction.indexOf('activehosted.com') !== -1 || // ActiveCampaign form\n formAction.indexOf('app.convertkit.com') !== -1 || // ConvertKit form\n ( formObj.firstChild.classList !== undefined && formObj.firstChild.classList.contains('cb-form-group') ) || // Convertbox form\n formAction.indexOf('mailerlite.com') !== -1 || // Mailerlite integration\n formAction.indexOf('colcolmail.co.uk') !== -1 || // colcolmail.co.uk integration\n formAction.indexOf('paypal.com') !== -1 ||\n formAction.indexOf('infusionsoft.com') !== -1 ||\n formAction.indexOf('webto.salesforce.com') !== -1 ||\n formAction.indexOf('secure2.convio.net') !== -1 ||\n formAction.indexOf('hookb.in') !== -1 ||\n formAction.indexOf('external.url') !== -1\n ) {\n return true;\n }\n\n return false;\n}\n\n/**\n * Sending Ajax for checking form data\n */\nfunction sendAjaxCheckingFormData(form, prev, formOriginal) {\n // Get visible fields and set cookie\n var visible_fields = {};\n visible_fields[0] = apbct_collect_visible_fields(form);\n apbct_visible_fields_set_cookie( visible_fields );\n\n var data = {};\n var elems = form.elements;\n elems = Array.prototype.slice.call(elems);\n\n elems.forEach( function( elem, y ) {\n if( elem.name === '' ) {\n data['input_' + y] = elem.value;\n } else {\n data[elem.name] = elem.value;\n }\n });\n\n apbct_public_sendAJAX(\n data,\n {\n async: false,\n callback: function( prev, formOriginal, result ){\n\n if( result.apbct === undefined || ! +result.apbct.blocked ) {\n\n var form_new = jQuery(form).detach();\n\n apbct_replace_inputs_values_from_other_form(form_new, formOriginal);\n\n prev.after( formOriginal );\n\n // Common click event\n var subm_button = jQuery(formOriginal).find('button[type=submit]');\n if( subm_button.length !== 0 ) {\n subm_button[0].click();\n return;\n }\n\n subm_button = jQuery(formOriginal).find('input[type=submit]');\n if( subm_button.length !== 0 ) {\n subm_button[0].click();\n return;\n }\n\n // ConvertKit direct integration\n subm_button = jQuery(formOriginal).find('button[data-element=\"submit\"]');\n if( subm_button.length !== 0 ) {\n subm_button[0].click();\n return;\n }\n\n // Paypal integration\n subm_button = jQuery(formOriginal).find('input[type=\"image\"][name=\"submit\"]');\n if( subm_button.length !== 0 ) {\n subm_button[0].click();\n }\n\n }\n },\n callback_context: null,\n callback_params: [prev, formOriginal],\n }\n );\n}\n"],"names":["ct_protect_external","currentForm","prev","form_original","reUseCurrentForm","ct_action","ct_method","i","document","forms","length","undefined","cleantalk_hidden_action","cleantalk_hidden_method","isIntegratedForm","jQuery","before","form_html","outerHTML","detach","after","force_action","createElement","name","value","type","appendChild","classList","contains","mailerliteSubmitButton","find","click","event","preventDefault","sendAjaxCheckingFormData","onsubmit","currentTarget","clone","action","indexOf","split","toLowerCase","location","hostname","method","apbct_replace_inputs_values_from_other_form","form_source","form_target","inputs_source","inputs_target","each","index","elem_source","source","index2","elem_target","target","val","formObj","formAction","firstChild","form","formOriginal","visible_fields","data","apbct_collect_visible_fields","apbct_visible_fields_set_cookie","elems","elements","Array","prototype","slice","call","forEach","elem","y","apbct_public_sendAJAX","async","callback","result","apbct","blocked","subm_button","callback_context","callback_params","window","onload","setTimeout"],"mappings":"AAGA,SAASA,sBACL,IAAI,IAKQC,EAQQC,EAEAC,EASAC,EAkCIC,EAMAC,EAhEhBC,EAAI,EAAGA,EAAIC,SAASC,MAAMC,OAAQH,SAEYI,IAA9CH,SAASC,MAAMF,GAAGK,8BAAuFD,IAA9CH,SAASC,MAAMF,GAAGM,yBAK5C,iBAF7BZ,EAAcO,SAASC,MAAMF,IAEL,SAErBO,iBAAiBb,IAChBc,OAAQd,GAAce,OAAO,gEAGzBd,EAAOa,OAAOd,GAAaC,OAC3Be,EAAYhB,EAAYiB,UACxBf,EAAgBY,OAAOd,GAAakB,SAExCjB,EAAKkB,MAAOH,IAERI,EAAeb,SAASc,cAAc,UAC7BC,KAAO,SACpBF,EAAaG,MAAQ,6BACrBH,EAAaI,KAAO,UAEhBrB,EAAmBI,SAASC,MAAMF,IAErBmB,YAAYL,QAGKV,IAA/BP,EAAiBuB,WAA2BvB,EAAiBuB,UAAUC,SAAS,sBAGjDjB,KAF1BkB,EAAyBd,OAAO,sBAAsBe,KAAK,2BAG3DD,EAAuBE,MAAM,SAAUC,GACnCA,EAAMC,iBACNC,yBAAyB9B,EAAkBF,EAAMC,KAIzDK,SAASC,MAAMF,GAAG4B,SAAW,SAAWH,GACpCA,EAAMC,iBAEN,IAAM/B,EAAOa,OAAOiB,EAAMI,eAAelC,OACnCC,EAAgBY,OAAOiB,EAAMI,eAAeC,QAElDH,yBAAyBF,EAAMI,cAAelC,EAAMC,MAKZ,IAA3CF,EAAYqC,OAAOC,QAAQ,aAAiE,IAA5CtC,EAAYqC,OAAOC,QAAQ,aAEtEtC,EAAYqC,OAAOE,MAAM,MACzB,GAAGA,MAAM,KACJ,GAAGC,gBAENC,SAASC,SAASF,iBAEtBpC,EAAYG,SAASc,cAAc,UAC7BC,KAAO,0BACjBlB,EAAUmB,MAAQvB,EAAYqC,OAC9BjC,EAAUoB,KA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KACLyC,EAAK,SAAWW,GAAKD,EAAKlD,MAE1BwC,EAAKU,EAAKnD,MAAQmD,EAAKlD,QAI/BoD,sBACIZ,EACA,CACIa,OAAO,EACPC,SAAU,SAAU5E,EAAM4D,EAAciB,QAEfpE,IAAjBoE,EAAOC,QAA0BD,EAAOC,MAAMC,UAI9CpC,4CAFe9B,OAAO8C,GAAM1C,SAE0B2C,GAEtD5D,EAAKkB,MAAO0C,GAIe,KADvBoB,EAAcnE,OAAO+C,GAAchC,KAAK,wBAC5BpB,QAMW,KAD3BwE,EAAcnE,OAAO+C,GAAchC,KAAK,uBACxBpB,QAOW,KAD3BwE,EAAcnE,OAAO+C,GAAchC,KAAK,kCACxBpB,QAOW,KAD3BwE,EAAcnE,OAAO+C,GAAchC,KAAK,uCACxBpB,QAnBZwE,EAAY,GAAGnD,UAyB3BoD,iBAAkB,KAClBC,gBAAiB,CAAClF,EAAM4D,KA/FpCuB,OAAOC,OAAS,WACZC,WAAW,WACPvF,uBACD"}
|
1 |
+
{"version":3,"file":"cleantalk_external.min.js","sources":["cleantalk_external.js"],"sourcesContent":["/**\n * Handle external forms\n */\nfunction ct_protect_external() {\n for(var i = 0; i < document.forms.length; i++) {\n\n if (document.forms[i].cleantalk_hidden_action === undefined && document.forms[i].cleantalk_hidden_method === undefined) {\n\n // current form\n var currentForm = document.forms[i];\n\n if(typeof(currentForm.action) == 'string') {\n\n if(isIntegratedForm(currentForm)) {\n\n jQuery( currentForm ).before('<i class=\"cleantalk_placeholder\" style=\"display: none;\"></i>');\n\n // if (currentForm.action.indexOf('tp.media') !== -1){\n // return\n // }\n\n // Deleting form to prevent submit event\n var prev = jQuery(currentForm).prev(),\n form_html = currentForm.outerHTML,\n form_original = jQuery(currentForm).detach();\n\n prev.after( form_html );\n\n var force_action = document.createElement(\"input\");\n force_action.name = 'action';\n force_action.value = 'cleantalk_force_ajax_check';\n force_action.type = 'hidden';\n\n var reUseCurrentForm = document.forms[i];\n\n reUseCurrentForm.appendChild(force_action);\n\n // mailerlite integration - disable click on submit button\n if(reUseCurrentForm.classList !== undefined && reUseCurrentForm.classList.contains('ml-block-form')) {\n var mailerliteSubmitButton = jQuery('form.ml-block-form').find('button[type=\"submit\"]');\n\n if(mailerliteSubmitButton !== undefined) {\n mailerliteSubmitButton.click(function (event) {\n event.preventDefault();\n sendAjaxCheckingFormData(reUseCurrentForm, prev, form_original);\n });\n }\n } else {\n document.forms[i].onsubmit = function ( event ){\n event.preventDefault();\n\n const prev = jQuery(event.currentTarget).prev();\n const form_original = jQuery(event.currentTarget).clone();\n\n sendAjaxCheckingFormData(event.currentTarget, prev, form_original);\n };\n }\n\n // Common flow\n }else if(currentForm.action.indexOf('http://') !== -1 || currentForm.action.indexOf('https://') !== -1) {\n\n var tmp = currentForm.action.split('//');\n tmp = tmp[1].split('/');\n var host = tmp[0].toLowerCase();\n\n if(host !== location.hostname.toLowerCase()){\n\n var ct_action = document.createElement(\"input\");\n ct_action.name = 'cleantalk_hidden_action';\n ct_action.value = currentForm.action;\n ct_action.type = 'hidden';\n currentForm.appendChild(ct_action);\n\n var ct_method = document.createElement(\"input\");\n ct_method.name = 'cleantalk_hidden_method';\n ct_method.value = currentForm.method;\n ct_method.type = 'hidden';\n\n currentForm.method = 'POST'\n\n currentForm.appendChild(ct_method);\n\n currentForm.action = document.location;\n }\n }\n }\n }\n\n }\n}\nfunction apbct_replace_inputs_values_from_other_form( form_source, form_target ){\n\n var\tinputs_source = jQuery( form_source ).find( 'button, input, textarea, select' ),\n inputs_target = jQuery( form_target ).find( 'button, input, textarea, select' );\n\n inputs_source.each( function( index, elem_source ){\n\n var source = jQuery( elem_source );\n\n inputs_target.each( function( index2, elem_target ){\n\n var target = jQuery( elem_target );\n\n if( elem_source.outerHTML === elem_target.outerHTML ){\n\n target.val( source.val() );\n }\n });\n });\n\n}\nwindow.onload = function () {\n setTimeout(function () {\n ct_protect_external()\n }, 1500);\n};\n\n/**\n * Checking the form integration\n */\nfunction isIntegratedForm(formObj) {\n var formAction = formObj.action;\n\n if(\n formAction.indexOf('activehosted.com') !== -1 || // ActiveCampaign form\n formAction.indexOf('app.convertkit.com') !== -1 || // ConvertKit form\n ( formObj.firstChild.classList !== undefined && formObj.firstChild.classList.contains('cb-form-group') ) || // Convertbox form\n formAction.indexOf('mailerlite.com') !== -1 || // Mailerlite integration\n formAction.indexOf('colcolmail.co.uk') !== -1 || // colcolmail.co.uk integration\n formAction.indexOf('paypal.com') !== -1 ||\n formAction.indexOf('infusionsoft.com') !== -1 ||\n formAction.indexOf('webto.salesforce.com') !== -1 ||\n formAction.indexOf('secure2.convio.net') !== -1 ||\n formAction.indexOf('hookb.in') !== -1 ||\n formAction.indexOf('external.url') !== -1 ||\n formAction.indexOf('tp.media') !== -1 ||\n formAction.indexOf('flodesk.com') !== -1\n\n ) {\n return true;\n }\n\n return false;\n}\n\n/**\n * Sending Ajax for checking form data\n */\nfunction sendAjaxCheckingFormData(form, prev, formOriginal) {\n // Get visible fields and set cookie\n var visible_fields = {};\n visible_fields[0] = apbct_collect_visible_fields(form);\n apbct_visible_fields_set_cookie( visible_fields );\n\n var data = {};\n var elems = form.elements;\n elems = Array.prototype.slice.call(elems);\n\n elems.forEach( function( elem, y ) {\n if( elem.name === '' ) {\n data['input_' + y] = elem.value;\n } else {\n data[elem.name] = elem.value;\n }\n });\n\n apbct_public_sendAJAX(\n data,\n {\n async: false,\n callback: function( prev, formOriginal, result ){\n\n if( result.apbct === undefined || ! +result.apbct.blocked ) {\n\n var form_new = jQuery(form).detach();\n\n apbct_replace_inputs_values_from_other_form(form_new, formOriginal);\n\n prev.after( formOriginal );\n\n // Common click event\n var subm_button = jQuery(formOriginal).find('button[type=submit]');\n if( subm_button.length !== 0 ) {\n subm_button[0].click();\n return;\n }\n\n subm_button = jQuery(formOriginal).find('input[type=submit]');\n if( subm_button.length !== 0 ) {\n subm_button[0].click();\n return;\n }\n\n // ConvertKit direct integration\n subm_button = jQuery(formOriginal).find('button[data-element=\"submit\"]');\n if( subm_button.length !== 0 ) {\n subm_button[0].click();\n return;\n }\n\n // Paypal integration\n subm_button = jQuery(formOriginal).find('input[type=\"image\"][name=\"submit\"]');\n if( subm_button.length !== 0 ) {\n subm_button[0].click();\n }\n\n }\n },\n callback_context: null,\n callback_params: [prev, formOriginal],\n }\n );\n}\n"],"names":["ct_protect_external","currentForm","prev","form_original","reUseCurrentForm","ct_action","ct_method","i","document","forms","length","undefined","cleantalk_hidden_action","cleantalk_hidden_method","isIntegratedForm","jQuery","before","form_html","outerHTML","detach","after","force_action","createElement","name","value","type","appendChild","classList","contains","mailerliteSubmitButton","find","click","event","preventDefault","sendAjaxCheckingFormData","onsubmit","currentTarget","clone","action","indexOf","split","toLowerCase","location","hostname","method","apbct_replace_inputs_values_from_other_form","form_source","form_target","inputs_source","inputs_target","each","index","elem_source","source","index2","elem_target","target","val","formObj","formAction","firstChild","form","formOriginal","visible_fields","data","apbct_collect_visible_fields","apbct_visible_fields_set_cookie","elems","elements","Array","prototype","slice","call","forEach","elem","y","apbct_public_sendAJAX","async","callback","result","apbct","blocked","subm_button","callback_context","callback_params","window","onload","setTimeout"],"mappings":"AAGA,SAASA,sBACL,IAAI,IAKQC,EAaQC,EAEAC,EASAC,EAkCIC,EAMAC,EArEhBC,EAAI,EAAGA,EAAIC,SAASC,MAAMC,OAAQH,SAEYI,IAA9CH,SAASC,MAAMF,GAAGK,8BAAuFD,IAA9CH,SAASC,MAAMF,GAAGM,yBAK5C,iBAF7BZ,EAAcO,SAASC,MAAMF,IAEL,SAErBO,iBAAiBb,IAEhBc,OAAQd,GAAce,OAAO,gEAOzBd,EAAOa,OAAOd,GAAaC,OAC3Be,EAAYhB,EAAYiB,UACxBf,EAAgBY,OAAOd,GAAakB,SAExCjB,EAAKkB,MAAOH,IAERI,EAAeb,SAASc,cAAc,UAC7BC,KAAO,SACpBF,EAAaG,MAAQ,6BACrBH,EAAaI,KAAO,UAEhBrB,EAAmBI,SAASC,MAAMF,IAErBmB,YAAYL,QAGKV,IAA/B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ClF,EAAM4D,KAlGpCuB,OAAOC,OAAS,WACZC,WAAW,WACPvF,uBACD"}
|
lib/Cleantalk/Antispam/Cleantalk.php
CHANGED
@@ -207,7 +207,6 @@ class Cleantalk
|
|
207 |
'/\s?apbct_site_landing_ts=\d*[^;]*;?/',
|
208 |
'/\s?apbct_cookies_test=%7B.*%7D[^;]*;?/',
|
209 |
'/\s?apbct_prev_referer=http.*?[^;]*;?/',
|
210 |
-
'/\s?ct_cookies_test=.*?[^;]*;?/',
|
211 |
'/\s?ct_ps_timestamp=.*?[^;]*;?/',
|
212 |
'/\s?ct_fkp_timestamp=\d*?[^;]*;?/',
|
213 |
'/\s?wordpress_ct_sfw_pass_key=\d*?[^;]*;?/',
|
207 |
'/\s?apbct_site_landing_ts=\d*[^;]*;?/',
|
208 |
'/\s?apbct_cookies_test=%7B.*%7D[^;]*;?/',
|
209 |
'/\s?apbct_prev_referer=http.*?[^;]*;?/',
|
|
|
210 |
'/\s?ct_ps_timestamp=.*?[^;]*;?/',
|
211 |
'/\s?ct_fkp_timestamp=\d*?[^;]*;?/',
|
212 |
'/\s?wordpress_ct_sfw_pass_key=\d*?[^;]*;?/',
|
lib/Cleantalk/Antispam/EmailEncoder.php
CHANGED
@@ -2,7 +2,6 @@
|
|
2 |
|
3 |
namespace Cleantalk\Antispam;
|
4 |
|
5 |
-
use Cleantalk\ApbctWP\Escape;
|
6 |
use Cleantalk\Templates\Singleton;
|
7 |
use Cleantalk\Variables\Post;
|
8 |
|
@@ -10,10 +9,19 @@ class EmailEncoder
|
|
10 |
{
|
11 |
use Singleton;
|
12 |
|
|
|
|
|
|
|
13 |
private $secret_key;
|
14 |
|
|
|
|
|
|
|
15 |
private $encription;
|
16 |
|
|
|
|
|
|
|
17 |
protected function init()
|
18 |
{
|
19 |
global $apbct;
|
@@ -50,62 +58,101 @@ class EmailEncoder
|
|
50 |
add_action('wp_ajax_apbct_decode_email', array($this, 'ajaxDecodeEmailHandler'));
|
51 |
}
|
52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
public function modifyContent($content)
|
54 |
{
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
}
|
59 |
|
60 |
-
|
61 |
|
62 |
-
$
|
|
|
|
|
63 |
|
64 |
-
|
|
|
|
|
65 |
|
66 |
-
return
|
67 |
-
data-original-string="' . $encoded . '"
|
68 |
-
class="apbct-email-encoder"
|
69 |
-
title="' . esc_attr($tooltip) . '">' . $obfuscated . '</span>';
|
70 |
}, $content);
|
71 |
}
|
72 |
|
|
|
|
|
|
|
|
|
|
|
73 |
public function ajaxDecodeEmailHandler()
|
74 |
{
|
75 |
check_ajax_referer('ct_secret_stuff');
|
76 |
$this->ajaxDecodeEmail();
|
77 |
}
|
78 |
|
|
|
|
|
|
|
|
|
|
|
79 |
public function ajaxDecodeEmail()
|
80 |
{
|
81 |
// @ToDo implement bot checking via API. the method not implemented yet.
|
82 |
|
83 |
$encoded_email = trim(Post::get('encodedEmail'));
|
84 |
-
$email = $this->
|
85 |
-
wp_send_json_success(
|
86 |
}
|
87 |
|
88 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
{
|
90 |
if ( $this->encription ) {
|
91 |
-
$encoded_email = htmlspecialchars(@openssl_encrypt($
|
92 |
} else {
|
93 |
-
$encoded_email = htmlspecialchars(base64_encode(str_rot13($
|
94 |
}
|
95 |
return $encoded_email;
|
96 |
}
|
97 |
|
98 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
{
|
100 |
if ( $this->encription ) {
|
101 |
-
$decoded_email = htmlspecialchars_decode(@openssl_decrypt($
|
102 |
} else {
|
103 |
-
$decoded_email = htmlspecialchars_decode(base64_decode($
|
104 |
$decoded_email = str_rot13($decoded_email);
|
105 |
}
|
106 |
return $decoded_email;
|
107 |
}
|
108 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
private function obfuscateEmail($email)
|
110 |
{
|
111 |
$first_part = strpos($email, '@') > 2
|
@@ -116,4 +163,71 @@ class EmailEncoder
|
|
116 |
$last_part = substr($email, (int) strrpos($email, '.', -1) - strlen($email));
|
117 |
return $first_part . '@' . $second_part . $last_part;
|
118 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
}
|
2 |
|
3 |
namespace Cleantalk\Antispam;
|
4 |
|
|
|
5 |
use Cleantalk\Templates\Singleton;
|
6 |
use Cleantalk\Variables\Post;
|
7 |
|
9 |
{
|
10 |
use Singleton;
|
11 |
|
12 |
+
/**
|
13 |
+
* @var string
|
14 |
+
*/
|
15 |
private $secret_key;
|
16 |
|
17 |
+
/**
|
18 |
+
* @var bool
|
19 |
+
*/
|
20 |
private $encription;
|
21 |
|
22 |
+
/**
|
23 |
+
* @inheritDoc
|
24 |
+
*/
|
25 |
protected function init()
|
26 |
{
|
27 |
global $apbct;
|
58 |
add_action('wp_ajax_apbct_decode_email', array($this, 'ajaxDecodeEmailHandler'));
|
59 |
}
|
60 |
|
61 |
+
/**
|
62 |
+
* @param $content string
|
63 |
+
*
|
64 |
+
* @return string
|
65 |
+
* @psalm-suppress PossiblyUnusedReturnValue
|
66 |
+
*/
|
67 |
public function modifyContent($content)
|
68 |
{
|
69 |
+
if ( apbct_is_user_logged_in() ) {
|
70 |
+
return $content;
|
71 |
+
}
|
|
|
72 |
|
73 |
+
return preg_replace_callback('/(<a.*?mailto\:.*?<\/a>?)|(\b[_A-Za-z0-9-\.]+@[_A-Za-z0-9-\.]+(\.[A-Za-z]{2,}))/', function ($matches) {
|
74 |
|
75 |
+
if ( isset($matches[3]) && in_array(strtolower($matches[3]), ['.jpg', '.jpeg', '.png', '.gif', '.svg', '.webp']) ) {
|
76 |
+
return $matches[0];
|
77 |
+
}
|
78 |
|
79 |
+
if ( $this->isMailto($matches[0]) ) {
|
80 |
+
return $this->encodeMailtoLink($matches[0]);
|
81 |
+
}
|
82 |
|
83 |
+
return $this->encodePlainEmail($matches[0]);
|
|
|
|
|
|
|
84 |
}, $content);
|
85 |
}
|
86 |
|
87 |
+
/**
|
88 |
+
* Ajax handler for the apbct_decode_email action
|
89 |
+
*
|
90 |
+
* @return void
|
91 |
+
*/
|
92 |
public function ajaxDecodeEmailHandler()
|
93 |
{
|
94 |
check_ajax_referer('ct_secret_stuff');
|
95 |
$this->ajaxDecodeEmail();
|
96 |
}
|
97 |
|
98 |
+
/**
|
99 |
+
* Main logic of the decoding the encoded data.
|
100 |
+
*
|
101 |
+
* @return void returns json string to the JS
|
102 |
+
*/
|
103 |
public function ajaxDecodeEmail()
|
104 |
{
|
105 |
// @ToDo implement bot checking via API. the method not implemented yet.
|
106 |
|
107 |
$encoded_email = trim(Post::get('encodedEmail'));
|
108 |
+
$email = $this->decodeString($encoded_email, $this->secret_key);
|
109 |
+
wp_send_json_success(strip_tags($email, '<a>'));
|
110 |
}
|
111 |
|
112 |
+
/**
|
113 |
+
* Encoding any string
|
114 |
+
*
|
115 |
+
* @param $plain_string string
|
116 |
+
* @param $key string
|
117 |
+
*
|
118 |
+
* @return string
|
119 |
+
*/
|
120 |
+
private function encodeString($plain_string, $key)
|
121 |
{
|
122 |
if ( $this->encription ) {
|
123 |
+
$encoded_email = htmlspecialchars(@openssl_encrypt($plain_string, 'aes-128-cbc', $key));
|
124 |
} else {
|
125 |
+
$encoded_email = htmlspecialchars(base64_encode(str_rot13($plain_string)));
|
126 |
}
|
127 |
return $encoded_email;
|
128 |
}
|
129 |
|
130 |
+
/**
|
131 |
+
* Decoding previously encoded string
|
132 |
+
*
|
133 |
+
* @param $encoded_string string
|
134 |
+
* @param $key string
|
135 |
+
*
|
136 |
+
* @return string
|
137 |
+
*/
|
138 |
+
private function decodeString($encoded_string, $key)
|
139 |
{
|
140 |
if ( $this->encription ) {
|
141 |
+
$decoded_email = htmlspecialchars_decode(@openssl_decrypt($encoded_string, 'aes-128-cbc', $key));
|
142 |
} else {
|
143 |
+
$decoded_email = htmlspecialchars_decode(base64_decode($encoded_string));
|
144 |
$decoded_email = str_rot13($decoded_email);
|
145 |
}
|
146 |
return $decoded_email;
|
147 |
}
|
148 |
|
149 |
+
/**
|
150 |
+
* Obfuscate an email to the s****@**.com view
|
151 |
+
*
|
152 |
+
* @param $email string
|
153 |
+
*
|
154 |
+
* @return string
|
155 |
+
*/
|
156 |
private function obfuscateEmail($email)
|
157 |
{
|
158 |
$first_part = strpos($email, '@') > 2
|
163 |
$last_part = substr($email, (int) strrpos($email, '.', -1) - strlen($email));
|
164 |
return $first_part . '@' . $second_part . $last_part;
|
165 |
}
|
166 |
+
|
167 |
+
/**
|
168 |
+
* Method to process plain email
|
169 |
+
*
|
170 |
+
* @param $email_str string
|
171 |
+
*
|
172 |
+
* @return string
|
173 |
+
*/
|
174 |
+
private function encodePlainEmail($email_str)
|
175 |
+
{
|
176 |
+
$obfuscated = $this->obfuscateEmail($email_str);
|
177 |
+
|
178 |
+
$encoded = $this->encodeString($email_str, $this->secret_key);
|
179 |
+
|
180 |
+
return '<span
|
181 |
+
data-original-string="' . $encoded . '"
|
182 |
+
class="apbct-email-encoder"
|
183 |
+
title="' . esc_attr($this->getTooltip()) . '">' . $obfuscated . '</span>';
|
184 |
+
}
|
185 |
+
|
186 |
+
/**
|
187 |
+
* Checking if the string contains mailto: link
|
188 |
+
*
|
189 |
+
* @param $string string
|
190 |
+
*
|
191 |
+
* @return bool
|
192 |
+
*/
|
193 |
+
private function isMailto($string)
|
194 |
+
{
|
195 |
+
return strpos($string, 'mailto:') !== false;
|
196 |
+
}
|
197 |
+
|
198 |
+
/**
|
199 |
+
* Method to process mailto: links
|
200 |
+
*
|
201 |
+
* @param $mailto_link_str string
|
202 |
+
*
|
203 |
+
* @return string
|
204 |
+
*/
|
205 |
+
private function encodeMailtoLink($mailto_link_str)
|
206 |
+
{
|
207 |
+
// Get inner tag text and place it in $matches[1]
|
208 |
+
preg_match('/<a.*?mailto\:.*?>(.*?)<\/a>?/', $mailto_link_str, $matches);
|
209 |
+
if ( isset($matches[1]) ) {
|
210 |
+
$mailto_inner_text = preg_replace_callback('/\b[_A-Za-z0-9-\.]+@[_A-Za-z0-9-\.]+\.[A-Za-z]{2,}/', function ($matches) {
|
211 |
+
return $this->obfuscateEmail($matches[0]);
|
212 |
+
}, $matches[1]);
|
213 |
+
}
|
214 |
+
$encoded = $this->encodeString($mailto_link_str, $this->secret_key);
|
215 |
+
|
216 |
+
$text = isset($mailto_inner_text) ? $mailto_inner_text : $mailto_link_str;
|
217 |
+
|
218 |
+
return '<span
|
219 |
+
data-original-string="' . $encoded . '"
|
220 |
+
class="apbct-email-encoder"
|
221 |
+
title="' . esc_attr($this->getTooltip()) . '">' . $text . '</span>';
|
222 |
+
}
|
223 |
+
|
224 |
+
/**
|
225 |
+
* Get text for the title attribute
|
226 |
+
*
|
227 |
+
* @return string
|
228 |
+
*/
|
229 |
+
private function getTooltip()
|
230 |
+
{
|
231 |
+
return esc_html__('This contact was encoded by CleanTalk. Click to decode.', 'cleantalk-spam-protect');
|
232 |
+
}
|
233 |
}
|
lib/Cleantalk/ApbctWP/FindSpam/UsersChecker.php
CHANGED
@@ -65,7 +65,9 @@ class UsersChecker extends Checker
|
|
65 |
'ct_status_string_warning' => "<p>" . __(
|
66 |
"Please do backup of WordPress database before delete any accounts!",
|
67 |
'cleantalk-spam-protect'
|
68 |
-
) . "</p>"
|
|
|
|
|
69 |
));
|
70 |
|
71 |
wp_enqueue_style(
|
@@ -77,6 +79,159 @@ class UsersChecker extends Checker
|
|
77 |
);
|
78 |
}
|
79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
public function getCurrentScanPage()
|
81 |
{
|
82 |
$this->list_table = new UsersScan();
|
@@ -171,190 +326,16 @@ class UsersChecker extends Checker
|
|
171 |
{
|
172 |
check_ajax_referer('ct_secret_nonce', 'security');
|
173 |
|
174 |
-
|
175 |
-
|
176 |
-
$wc_active = false;
|
177 |
-
if ( in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins'))) ) {
|
178 |
-
$wc_active = true;
|
179 |
-
}
|
180 |
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
'administrator'
|
187 |
-
);
|
188 |
-
|
189 |
-
$from_till = '';
|
190 |
-
|
191 |
-
if ( Post::get('from') && Post::get('till') ) {
|
192 |
-
$from_date = date('Y-m-d', intval(strtotime(Post::get('from')))) . ' 00:00:00';
|
193 |
-
$till_date = date('Y-m-d', intval(strtotime(Post::get('till')))) . ' 23:59:59';
|
194 |
-
|
195 |
-
$from_till = "WHERE $wpdb->users.user_registered >= '$from_date' AND $wpdb->users.user_registered <= '$till_date'";
|
196 |
-
}
|
197 |
-
|
198 |
-
$wc_orders = '';
|
199 |
-
|
200 |
-
if ( $wc_active && ! empty($_POST['accurate_check']) ) {
|
201 |
-
$sql_command = $from_till ? ' AND' : 'WHERE';
|
202 |
-
$wc_orders = $sql_command
|
203 |
-
. " NOT EXISTS (SELECT posts.* FROM {$wpdb->posts} AS posts"
|
204 |
-
. " INNER JOIN {$wpdb->postmeta} AS postmeta"
|
205 |
-
. " WHERE posts.post_type = 'shop_order'"
|
206 |
-
. " AND posts.post_status = 'wc-completed'"
|
207 |
-
. " AND posts.ID = postmeta.post_id"
|
208 |
-
. " AND postmeta.meta_key = '_customer_user'"
|
209 |
-
. " AND postmeta.meta_value = {$wpdb->users}.ID)";
|
210 |
-
}
|
211 |
-
|
212 |
-
$offset = (int)$_COOKIE['apbct_check_users_offset'] ?: 0;
|
213 |
-
|
214 |
-
$u = $wpdb->get_results(
|
215 |
-
"
|
216 |
-
SELECT {$wpdb->users}.ID, {$wpdb->users}.user_email, {$wpdb->users}.user_registered
|
217 |
-
FROM {$wpdb->users}
|
218 |
-
$wc_orders
|
219 |
-
$from_till
|
220 |
-
ORDER BY {$wpdb->users}.ID ASC
|
221 |
-
LIMIT $amount OFFSET $offset;"
|
222 |
-
);
|
223 |
-
|
224 |
-
$check_result = array(
|
225 |
-
'end' => 0,
|
226 |
-
'checked' => 0,
|
227 |
-
'spam' => 0,
|
228 |
-
'bad' => 0,
|
229 |
-
'error' => 0
|
230 |
-
);
|
231 |
-
|
232 |
-
if ( count($u) > 0 ) {
|
233 |
-
if ( ! empty(Post::get('accurate_check')) ) {
|
234 |
-
// Leaving users only with first comment's date. Unsetting others.
|
235 |
-
foreach ( $u as $user_index => $user ) {
|
236 |
-
if ( ! isset($curr_date) ) {
|
237 |
-
$curr_date = (substr($user->user_registered, 0, 10) ?: '');
|
238 |
-
}
|
239 |
-
|
240 |
-
if ( substr($user->user_registered, 0, 10) != $curr_date ) {
|
241 |
-
unset($u[$user_index]);
|
242 |
-
}
|
243 |
-
}
|
244 |
-
}
|
245 |
-
|
246 |
-
// Checking comments IP/Email. Gathering $data for check.
|
247 |
-
$data = array();
|
248 |
-
|
249 |
-
foreach ( $u as $i => $iValue ) {
|
250 |
-
$user_meta = get_user_meta($iValue->ID, 'session_tokens', true);
|
251 |
-
if ( is_array($user_meta) ) {
|
252 |
-
$user_meta = array_values($user_meta);
|
253 |
-
}
|
254 |
-
|
255 |
-
$curr_ip = ! empty($user_meta[0]['ip']) ? trim($user_meta[0]['ip']) : '';
|
256 |
-
$curr_email = ! empty($iValue->user_email) ? trim($iValue->user_email) : '';
|
257 |
-
|
258 |
-
// Check for identity
|
259 |
-
$curr_ip = preg_match('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/', $curr_ip) === 1 ? $curr_ip : null;
|
260 |
-
$curr_email = preg_match('/^\S+@\S+\.\S+$/', $curr_email) === 1 ? $curr_email : null;
|
261 |
-
|
262 |
-
if ( empty($curr_ip) && empty($curr_email) ) {
|
263 |
-
$check_result['bad']++;
|
264 |
-
update_user_meta($iValue->ID, 'ct_bad', '1', true);
|
265 |
-
unset($u[$i]);
|
266 |
-
} else {
|
267 |
-
if ( ! empty($curr_ip) ) {
|
268 |
-
$data[] = $curr_ip;
|
269 |
-
}
|
270 |
-
if ( ! empty($curr_email) ) {
|
271 |
-
$data[] = $curr_email;
|
272 |
-
}
|
273 |
-
// Patch for empty IP/Email
|
274 |
-
$iValue->data = new \stdClass();
|
275 |
-
$iValue->user_ip = empty($curr_ip) ? 'none' : $curr_ip;
|
276 |
-
$iValue->user_email = empty($curr_email) ? 'none' : $curr_email;
|
277 |
-
}
|
278 |
-
}
|
279 |
-
|
280 |
-
// save count bad comments to State:data
|
281 |
-
$apbct->data['count_bad_users'] += $check_result['bad'];
|
282 |
-
$apbct->saveData();
|
283 |
-
|
284 |
-
// Recombining after checking and unsetting
|
285 |
-
$u = array_values($u);
|
286 |
-
|
287 |
-
// Drop if data empty and there's no users to check
|
288 |
-
if ( count($data) === 0 ) {
|
289 |
-
if ( (int) Post::get('unchecked') === 0 ) {
|
290 |
-
$check_result['end'] = 1;
|
291 |
-
}
|
292 |
-
print json_encode($check_result);
|
293 |
-
die();
|
294 |
-
}
|
295 |
-
|
296 |
-
$result = \Cleantalk\ApbctWP\API::methodSpamCheckCms(
|
297 |
-
$apbct->api_key,
|
298 |
-
$data,
|
299 |
-
! empty(Post::get('accurate_check')) ? $curr_date : null
|
300 |
-
);
|
301 |
-
|
302 |
-
if ( empty($result['error']) ) {
|
303 |
-
foreach ( $u as $iValue ) {
|
304 |
-
$check_result['checked']++;
|
305 |
-
|
306 |
-
// Do not display forbidden roles.
|
307 |
-
foreach ( $skip_roles as $role ) {
|
308 |
-
$user_meta = get_userdata($iValue->ID);
|
309 |
-
$user_roles = $user_meta->roles;
|
310 |
-
if ( in_array($role, $user_roles) ) {
|
311 |
-
delete_user_meta($iValue->ID, 'ct_marked_as_spam');
|
312 |
-
continue 2;
|
313 |
-
}
|
314 |
-
}
|
315 |
-
|
316 |
-
$mark_spam_ip = false;
|
317 |
-
$mark_spam_email = false;
|
318 |
-
|
319 |
-
$uip = $iValue->user_ip;
|
320 |
-
$uim = $iValue->user_email;
|
321 |
-
|
322 |
-
if ( isset($result[$uip]) && $result[$uip]['appears'] == 1 ) {
|
323 |
-
$mark_spam_ip = true;
|
324 |
-
}
|
325 |
-
|
326 |
-
if ( isset($result[$uim]) && $result[$uim]['appears'] == 1 ) {
|
327 |
-
$mark_spam_email = true;
|
328 |
-
}
|
329 |
-
|
330 |
-
if ( $mark_spam_ip || $mark_spam_email ) {
|
331 |
-
$check_result['spam']++;
|
332 |
-
update_user_meta($iValue->ID, 'ct_marked_as_spam', '1', true);
|
333 |
-
}
|
334 |
-
}
|
335 |
-
|
336 |
-
// save count checked users to State:data
|
337 |
-
$apbct->data['count_checked_users'] = $offset + $check_result['checked'];
|
338 |
-
$apbct->saveData();
|
339 |
-
} else {
|
340 |
-
$check_result['error'] = 1;
|
341 |
-
$check_result['error_message'] = $result['error'];
|
342 |
-
}
|
343 |
} else {
|
344 |
-
$
|
345 |
-
|
346 |
-
$log_data = static::getLogData();
|
347 |
-
static::writeSpamLog(
|
348 |
-
'users',
|
349 |
-
date("Y-m-d H:i:s"),
|
350 |
-
$log_data['checked'],
|
351 |
-
$log_data['spam'],
|
352 |
-
$log_data['bad']
|
353 |
-
);
|
354 |
}
|
355 |
-
echo json_encode($check_result);
|
356 |
-
|
357 |
-
die;
|
358 |
}
|
359 |
|
360 |
/**
|
@@ -391,7 +372,7 @@ class UsersChecker extends Checker
|
|
391 |
$cnt_spam = self::getCountSpammers();
|
392 |
|
393 |
// Bad users (without IP and Email)
|
394 |
-
$cnt_bad =
|
395 |
|
396 |
$return = array(
|
397 |
'message' => '',
|
@@ -462,7 +443,7 @@ class UsersChecker extends Checker
|
|
462 |
$cnt_spam = self::getCountSpammers();
|
463 |
|
464 |
// Bad users (without IP and Email)
|
465 |
-
$cnt_bad
|
466 |
|
467 |
return array(
|
468 |
'spam' => $cnt_spam,
|
@@ -647,4 +628,192 @@ class UsersChecker extends Checker
|
|
647 |
|
648 |
return (int) $count_spammers;
|
649 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
650 |
}
|
65 |
'ct_status_string_warning' => "<p>" . __(
|
66 |
"Please do backup of WordPress database before delete any accounts!",
|
67 |
'cleantalk-spam-protect'
|
68 |
+
) . "</p>",
|
69 |
+
'ct_specify_date_range' => esc_html__('Please, specify a date range.', 'cleantalk-spam-protect'),
|
70 |
+
'ct_select_date_range' => esc_html__('Please, select a date range.', 'cleantalk-spam-protect'),
|
71 |
));
|
72 |
|
73 |
wp_enqueue_style(
|
79 |
);
|
80 |
}
|
81 |
|
82 |
+
/**
|
83 |
+
* Get all users from DB
|
84 |
+
*
|
85 |
+
* @return array|false
|
86 |
+
*/
|
87 |
+
private static function getAllUsers(UsersScanParameters $userScanParameters)
|
88 |
+
{
|
89 |
+
global $wpdb;
|
90 |
+
|
91 |
+
$amount = $userScanParameters->getAmount();
|
92 |
+
$skip_roles = $userScanParameters->getSkipRoles();
|
93 |
+
$offset = $userScanParameters->getOffset();
|
94 |
+
$between_dates_sql = '';
|
95 |
+
$date_from = $userScanParameters->getFrom();
|
96 |
+
$date_till = $userScanParameters->getTill();
|
97 |
+
if ($date_from && $date_till) {
|
98 |
+
$date_from = date('Y-m-d', (int) strtotime($date_from)) . ' 00:00:00';
|
99 |
+
$date_till = date('Y-m-d', (int) strtotime($date_till)) . ' 23:59:59';
|
100 |
+
|
101 |
+
$between_dates_sql = "WHERE $wpdb->users.user_registered >= '$date_from' AND $wpdb->users.user_registered <= '$date_till'";
|
102 |
+
}
|
103 |
+
|
104 |
+
// Woocommerce
|
105 |
+
$wc_active = false;
|
106 |
+
$wc_orders = '';
|
107 |
+
if (in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins')), true)) {
|
108 |
+
$wc_active = true;
|
109 |
+
}
|
110 |
+
if ($wc_active && $userScanParameters->getAccurateCheck()) {
|
111 |
+
$wc_orders = " AND NOT EXISTS (SELECT posts.* FROM {$wpdb->posts} AS posts"
|
112 |
+
. " INNER JOIN {$wpdb->postmeta} AS postmeta"
|
113 |
+
. " WHERE posts.post_type = 'shop_order'"
|
114 |
+
. " AND posts.post_status = 'wc-completed'"
|
115 |
+
. " AND posts.ID = postmeta.post_id"
|
116 |
+
. " AND postmeta.meta_key = '_customer_user'"
|
117 |
+
. " AND postmeta.meta_value = {$wpdb->users}.ID)";
|
118 |
+
}
|
119 |
+
|
120 |
+
$users = $wpdb->get_results(
|
121 |
+
"
|
122 |
+
SELECT {$wpdb->users}.ID, {$wpdb->users}.user_email, {$wpdb->users}.user_registered
|
123 |
+
FROM {$wpdb->users}
|
124 |
+
{$between_dates_sql}
|
125 |
+
{$wc_orders}
|
126 |
+
ORDER BY {$wpdb->users}.ID ASC
|
127 |
+
LIMIT $amount OFFSET $offset;"
|
128 |
+
);
|
129 |
+
|
130 |
+
if (!$users) {
|
131 |
+
$users = array();
|
132 |
+
}
|
133 |
+
|
134 |
+
// removed skip_roles and return $users
|
135 |
+
$users = self::removeSkipRoles($users, $skip_roles);
|
136 |
+
|
137 |
+
// removed users without IP and Email
|
138 |
+
$users = self::removeUsersWithoutIPEmail($users);
|
139 |
+
|
140 |
+
return $users;
|
141 |
+
}
|
142 |
+
|
143 |
+
/**
|
144 |
+
* @param array $users
|
145 |
+
* @param array $skip_roles
|
146 |
+
*
|
147 |
+
* @return array|false
|
148 |
+
*/
|
149 |
+
private static function removeSkipRoles(array $users, array $skip_roles)
|
150 |
+
{
|
151 |
+
foreach ($users as $index => $user) {
|
152 |
+
$user_meta = get_userdata($user->ID);
|
153 |
+
$user_roles = $user_meta->roles;
|
154 |
+
foreach ($user_roles as $user_role) {
|
155 |
+
if (in_array($user_role, $skip_roles, true)) {
|
156 |
+
delete_user_meta($user->ID, 'ct_marked_as_spam');
|
157 |
+
unset($users[$index]);
|
158 |
+
break;
|
159 |
+
}
|
160 |
+
}
|
161 |
+
}
|
162 |
+
|
163 |
+
return $users;
|
164 |
+
}
|
165 |
+
|
166 |
+
/**
|
167 |
+
* @param array $users
|
168 |
+
*
|
169 |
+
* @return array|false
|
170 |
+
*/
|
171 |
+
private static function removeUsersWithoutIPEmail(array $users)
|
172 |
+
{
|
173 |
+
foreach ($users as $index => $user) {
|
174 |
+
$user_meta = self::getUserMeta($user->ID);
|
175 |
+
|
176 |
+
$user_ip = ! empty($user_meta[0]['ip']) ? trim($user_meta[0]['ip']) : false;
|
177 |
+
$user_email = ! empty($user->user_email) ? trim($user->user_email) : false;
|
178 |
+
|
179 |
+
// Validate IP and Email
|
180 |
+
$user_ip = filter_var($user_ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4);
|
181 |
+
$user_email = filter_var($user_email, FILTER_VALIDATE_EMAIL);
|
182 |
+
|
183 |
+
if (!$user_ip && !$user_email) {
|
184 |
+
update_user_meta($user->ID, 'ct_bad', '1', true);
|
185 |
+
unset($users[$index]);
|
186 |
+
continue;
|
187 |
+
}
|
188 |
+
|
189 |
+
// Add user ip to $user
|
190 |
+
$user->user_ip = $user_ip;
|
191 |
+
}
|
192 |
+
|
193 |
+
return $users;
|
194 |
+
}
|
195 |
+
|
196 |
+
/**
|
197 |
+
* @param array $users
|
198 |
+
*
|
199 |
+
* @return array
|
200 |
+
*/
|
201 |
+
private static function getIPEmailsData(array $users)
|
202 |
+
{
|
203 |
+
$data = array();
|
204 |
+
|
205 |
+
foreach ($users as $user) {
|
206 |
+
if ($user->user_ip) {
|
207 |
+
$data[] = $user->user_ip;
|
208 |
+
}
|
209 |
+
if ($user->user_email) {
|
210 |
+
$data[] = $user->user_email;
|
211 |
+
}
|
212 |
+
}
|
213 |
+
|
214 |
+
return $data;
|
215 |
+
}
|
216 |
+
|
217 |
+
/**
|
218 |
+
* @param array $result
|
219 |
+
*
|
220 |
+
* @return array
|
221 |
+
*/
|
222 |
+
private static function getSpammersFromResultAPI(array $result)
|
223 |
+
{
|
224 |
+
$spammers = array();
|
225 |
+
|
226 |
+
foreach ($result as $param => $status) {
|
227 |
+
if ((int) $status['appears'] === 1) {
|
228 |
+
$spammers[] = $param;
|
229 |
+
}
|
230 |
+
}
|
231 |
+
|
232 |
+
return $spammers;
|
233 |
+
}
|
234 |
+
|
235 |
public function getCurrentScanPage()
|
236 |
{
|
237 |
$this->list_table = new UsersScan();
|
326 |
{
|
327 |
check_ajax_referer('ct_secret_nonce', 'security');
|
328 |
|
329 |
+
$userScanParameters = new UsersScanParameters($_POST);
|
|
|
|
|
|
|
|
|
|
|
330 |
|
331 |
+
// Set type checking
|
332 |
+
if ($userScanParameters->getAccurateCheck() && ($userScanParameters->getFrom() && $userScanParameters->getTill())) {
|
333 |
+
self::startAccurateChecking($userScanParameters);
|
334 |
+
} elseif (!$userScanParameters->getAccurateCheck() && ($userScanParameters->getFrom() && $userScanParameters->getTill())) {
|
335 |
+
self::startCommonChecking($userScanParameters);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
336 |
} else {
|
337 |
+
self::startCommonChecking($userScanParameters);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
338 |
}
|
|
|
|
|
|
|
339 |
}
|
340 |
|
341 |
/**
|
372 |
$cnt_spam = self::getCountSpammers();
|
373 |
|
374 |
// Bad users (without IP and Email)
|
375 |
+
$cnt_bad = self::getCountBadUsers();
|
376 |
|
377 |
$return = array(
|
378 |
'message' => '',
|
443 |
$cnt_spam = self::getCountSpammers();
|
444 |
|
445 |
// Bad users (without IP and Email)
|
446 |
+
$cnt_bad = self::getCountBadUsers();
|
447 |
|
448 |
return array(
|
449 |
'spam' => $cnt_spam,
|
628 |
|
629 |
return (int) $count_spammers;
|
630 |
}
|
631 |
+
|
632 |
+
/**
|
633 |
+
* Getting count bas users without IP and Email
|
634 |
+
*
|
635 |
+
* @return int
|
636 |
+
*/
|
637 |
+
public static function getCountBadUsers()
|
638 |
+
{
|
639 |
+
global $wpdb;
|
640 |
+
|
641 |
+
$sql = "SELECT
|
642 |
+
COUNT(`user_id`)
|
643 |
+
FROM $wpdb->usermeta
|
644 |
+
where `meta_key`='ct_bad'";
|
645 |
+
|
646 |
+
$count_bad = $wpdb->get_var($sql);
|
647 |
+
|
648 |
+
if (is_null($count_bad)) {
|
649 |
+
return 0;
|
650 |
+
}
|
651 |
+
|
652 |
+
return (int) $count_bad;
|
653 |
+
}
|
654 |
+
|
655 |
+
public static function getUserMeta($user_id)
|
656 |
+
{
|
657 |
+
$user_meta = get_user_meta($user_id, 'session_tokens', true);
|
658 |
+
|
659 |
+
if ( is_array($user_meta) ) {
|
660 |
+
return array_values($user_meta);
|
661 |
+
}
|
662 |
+
|
663 |
+
return false;
|
664 |
+
}
|
665 |
+
|
666 |
+
/**
|
667 |
+
* All users checking
|
668 |
+
*
|
669 |
+
* @param UsersScanParameters $userScanParameters
|
670 |
+
*
|
671 |
+
* @return void
|
672 |
+
*/
|
673 |
+
public static function startCommonChecking(UsersScanParameters $userScanParameters)
|
674 |
+
{
|
675 |
+
global $apbct;
|
676 |
+
$users = self::getAllUsers($userScanParameters);
|
677 |
+
|
678 |
+
if (!$users) {
|
679 |
+
UsersScanResponse::getInstance()->setEnd(1);
|
680 |
+
|
681 |
+
$log_data = static::getLogData();
|
682 |
+
static::writeSpamLog(
|
683 |
+
'users',
|
684 |
+
date("Y-m-d H:i:s"),
|
685 |
+
$log_data['checked'],
|
686 |
+
$log_data['spam'],
|
687 |
+
$log_data['bad']
|
688 |
+
);
|
689 |
+
|
690 |
+
echo UsersScanResponse::getInstance()->toJson();
|
691 |
+
die;
|
692 |
+
}
|
693 |
+
|
694 |
+
$ips_emails_data = self::getIPEmailsData($users);
|
695 |
+
|
696 |
+
$result = \Cleantalk\ApbctWP\API::methodSpamCheckCms(
|
697 |
+
$apbct->api_key,
|
698 |
+
$ips_emails_data,
|
699 |
+
null
|
700 |
+
);
|
701 |
+
|
702 |
+
if (!empty($result['error'])) {
|
703 |
+
UsersScanResponse::getInstance()->setError(1);
|
704 |
+
UsersScanResponse::getInstance()->setErrorMessage($result['error']);
|
705 |
+
} else {
|
706 |
+
$onlySpammers = self::getSpammersFromResultAPI($result);
|
707 |
+
$marked_user_ids = [];
|
708 |
+
|
709 |
+
foreach ($users as $user) {
|
710 |
+
if (
|
711 |
+
! in_array($user->ID, $marked_user_ids, true) &&
|
712 |
+
(in_array($user->user_ip, $onlySpammers, true) ||
|
713 |
+
in_array($user->user_email, $onlySpammers, true))
|
714 |
+
) {
|
715 |
+
$marked_user_ids[] = $user->ID;
|
716 |
+
update_user_meta($user->ID, 'ct_marked_as_spam', '1', true);
|
717 |
+
}
|
718 |
+
}
|
719 |
+
|
720 |
+
// Count spam
|
721 |
+
UsersScanResponse::getInstance()->setSpam(count($marked_user_ids));
|
722 |
+
}
|
723 |
+
|
724 |
+
// Count bad users
|
725 |
+
UsersScanResponse::getInstance()->setBad((int)self::getCountBadUsers());
|
726 |
+
// Count checked users
|
727 |
+
UsersScanResponse::getInstance()->setChecked(count($users));
|
728 |
+
// save count checked users to State:data
|
729 |
+
$apbct->data['count_checked_users'] += count($users);
|
730 |
+
$apbct->saveData();
|
731 |
+
|
732 |
+
echo UsersScanResponse::getInstance()->toJson();
|
733 |
+
die;
|
734 |
+
}
|
735 |
+
|
736 |
+
/**
|
737 |
+
* Accurate user checking
|
738 |
+
*
|
739 |
+
* @param UsersScanParameters $userScanParameters
|
740 |
+
*
|
741 |
+
* @return void
|
742 |
+
*/
|
743 |
+
private static function startAccurateChecking(UsersScanParameters $userScanParameters)
|
744 |
+
{
|
745 |
+
global $apbct;
|
746 |
+
$users = self::getAllUsers($userScanParameters);
|
747 |
+
|
748 |
+
if (!$users) {
|
749 |
+
UsersScanResponse::getInstance()->setEnd(1);
|
750 |
+
|
751 |
+
$log_data = static::getLogData();
|
752 |
+
static::writeSpamLog(
|
753 |
+
'users',
|
754 |
+
date("Y-m-d H:i:s"),
|
755 |
+
$log_data['checked'],
|
756 |
+
$log_data['spam'],
|
757 |
+
$log_data['bad']
|
758 |
+
);
|
759 |
+
|
760 |
+
echo UsersScanResponse::getInstance()->toJson();
|
761 |
+
die;
|
762 |
+
}
|
763 |
+
|
764 |
+
$users_grouped_by_date = array();
|
765 |
+
|
766 |
+
foreach ($users as $index => $user) {
|
767 |
+
if (!empty($user->user_registered)) {
|
768 |
+
$registered_date = date('Y-m-d', strtotime($user->user_registered));
|
769 |
+
$users_grouped_by_date[$registered_date][] = $user;
|
770 |
+
} else {
|
771 |
+
unset($users[$index]);
|
772 |
+
}
|
773 |
+
}
|
774 |
+
|
775 |
+
foreach ($users_grouped_by_date as $date => $users) {
|
776 |
+
$ips_emails_data = self::getIPEmailsData($users);
|
777 |
+
|
778 |
+
$result = \Cleantalk\ApbctWP\API::methodSpamCheckCms(
|
779 |
+
$apbct->api_key,
|
780 |
+
$ips_emails_data,
|
781 |
+
$date
|
782 |
+
);
|
783 |
+
|
784 |
+
if (!empty($result['error'])) {
|
785 |
+
UsersScanResponse::getInstance()->setError(1);
|
786 |
+
UsersScanResponse::getInstance()->setErrorMessage($result['error']);
|
787 |
+
} else {
|
788 |
+
$onlySpammers = self::getSpammersFromResultAPI($result);
|
789 |
+
$marked_user_ids = [];
|
790 |
+
|
791 |
+
foreach ($users as $user) {
|
792 |
+
if (
|
793 |
+
! in_array($user->ID, $marked_user_ids, true) &&
|
794 |
+
(in_array($user->user_ip, $onlySpammers, true) ||
|
795 |
+
in_array($user->user_email, $onlySpammers, true))
|
796 |
+
) {
|
797 |
+
$marked_user_ids[] = $user->ID;
|
798 |
+
update_user_meta($user->ID, 'ct_marked_as_spam', '1', true);
|
799 |
+
}
|
800 |
+
}
|
801 |
+
|
802 |
+
// Count spam
|
803 |
+
UsersScanResponse::getInstance()->updateSpam(count($marked_user_ids));
|
804 |
+
}
|
805 |
+
|
806 |
+
// Count checked users
|
807 |
+
UsersScanResponse::getInstance()->updateChecked(count($users));
|
808 |
+
// save count checked users to State:data
|
809 |
+
$apbct->data['count_checked_users'] += count($users);
|
810 |
+
$apbct->saveData();
|
811 |
+
}
|
812 |
+
|
813 |
+
// Count bad users
|
814 |
+
UsersScanResponse::getInstance()->setBad((int)self::getCountBadUsers());
|
815 |
+
|
816 |
+
echo UsersScanResponse::getInstance()->toJson();
|
817 |
+
die;
|
818 |
+
}
|
819 |
}
|
lib/Cleantalk/ApbctWP/FindSpam/UsersScanParameters.php
ADDED
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Cleantalk\ApbctWP\FindSpam;
|
4 |
+
|
5 |
+
class UsersScanParameters
|
6 |
+
{
|
7 |
+
private $new_check;
|
8 |
+
private $unchecked;
|
9 |
+
private $amount;
|
10 |
+
private $offset;
|
11 |
+
private $accurate_check;
|
12 |
+
private $from;
|
13 |
+
private $till;
|
14 |
+
private $skip_roles;
|
15 |
+
|
16 |
+
public function __construct($post)
|
17 |
+
{
|
18 |
+
$this->new_check = isset($post['new_check']) ? $post['new_check'] : true;
|
19 |
+
$this->unchecked = isset($post['unchecked']) ? $post['unchecked'] : 'unset';
|
20 |
+
$this->amount = isset($post['amount']) ? $post['amount'] : 100;
|
21 |
+
$this->offset = isset($_COOKIE['apbct_check_users_offset']) ? (int)$_COOKIE['apbct_check_users_offset'] : 0;
|
22 |
+
$this->accurate_check = isset($post['accurate_check']) ? $post['accurate_check'] : false;
|
23 |
+
$this->from = isset($post['from']) ? $post['from'] : false;
|
24 |
+
$this->till = isset($post['till']) ? $post['till'] : false;
|
25 |
+
$this->skip_roles = array('administrator');
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* @return array[]
|
30 |
+
* @psalm-suppress PossiblyUnusedMethod
|
31 |
+
*/
|
32 |
+
public function getSkipRoles()
|
33 |
+
{
|
34 |
+
return $this->skip_roles;
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* @return bool|mixed
|
39 |
+
* @psalm-suppress PossiblyUnusedMethod
|
40 |
+
*/
|
41 |
+
public function getNewCheck()
|
42 |
+
{
|
43 |
+
return $this->new_check;
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* @return mixed|string
|
48 |
+
* @psalm-suppress PossiblyUnusedMethod
|
49 |
+
*/
|
50 |
+
public function getUnchecked()
|
51 |
+
{
|
52 |
+
return $this->unchecked;
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* @return int|mixed
|
57 |
+
* @psalm-suppress PossiblyUnusedMethod
|
58 |
+
*/
|
59 |
+
public function getAmount()
|
60 |
+
{
|
61 |
+
return $this->amount;
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* @return int|mixed
|
66 |
+
* @psalm-suppress PossiblyUnusedMethod
|
67 |
+
*/
|
68 |
+
public function getOffset()
|
69 |
+
{
|
70 |
+
return $this->offset;
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* @return false|mixed
|
75 |
+
* @psalm-suppress PossiblyUnusedMethod
|
76 |
+
*/
|
77 |
+
public function getAccurateCheck()
|
78 |
+
{
|
79 |
+
return $this->accurate_check;
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* @return false|mixed
|
84 |
+
* @psalm-suppress PossiblyUnusedMethod
|
85 |
+
*/
|
86 |
+
public function getFrom()
|
87 |
+
{
|
88 |
+
return $this->from;
|
89 |
+
}
|
90 |
+
|
91 |
+
/**
|
92 |
+
* @return false|mixed
|
93 |
+
* @psalm-suppress PossiblyUnusedMethod
|
94 |
+
*/
|
95 |
+
public function getTill()
|
96 |
+
{
|
97 |
+
return $this->till;
|
98 |
+
}
|
99 |
+
}
|
lib/Cleantalk/ApbctWP/FindSpam/UsersScanResponse.php
ADDED
@@ -0,0 +1,179 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// Singleton
|
4 |
+
namespace Cleantalk\ApbctWP\FindSpam;
|
5 |
+
|
6 |
+
use Cleantalk\Templates\Singleton;
|
7 |
+
|
8 |
+
class UsersScanResponse
|
9 |
+
{
|
10 |
+
use Singleton;
|
11 |
+
|
12 |
+
private $end;
|
13 |
+
private $checked;
|
14 |
+
private $spam;
|
15 |
+
private $bad;
|
16 |
+
private $error;
|
17 |
+
private $error_message;
|
18 |
+
|
19 |
+
private function init()
|
20 |
+
{
|
21 |
+
$this->end = 0;
|
22 |
+
$this->checked = 0;
|
23 |
+
$this->spam = 0;
|
24 |
+
$this->bad = 0;
|
25 |
+
$this->error = 0;
|
26 |
+
$this->error_message = '';
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* @return array
|
31 |
+
* @psalm-suppress PossiblyUnusedMethod
|
32 |
+
*/
|
33 |
+
public function toArray()
|
34 |
+
{
|
35 |
+
return array(
|
36 |
+
'end' => $this->end,
|
37 |
+
'checked' => $this->checked,
|
38 |
+
'spam' => $this->spam,
|
39 |
+
'bad' => $this->bad,
|
40 |
+
'error' => $this->error,
|
41 |
+
'error_message' => $this->error_message,
|
42 |
+
);
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* @return false|string
|
47 |
+
* @psalm-suppress PossiblyUnusedMethod
|
48 |
+
*/
|
49 |
+
public function toJson()
|
50 |
+
{
|
51 |
+
return json_encode($this->toArray());
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* @return string
|
56 |
+
* @psalm-suppress PossiblyUnusedMethod
|
57 |
+
*/
|
58 |
+
public function getErrorMessage()
|
59 |
+
{
|
60 |
+
return $this->error_message;
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* @param string $error_message
|
65 |
+
* @psalm-suppress PossiblyUnusedMethod
|
66 |
+
*/
|
67 |
+
public function setErrorMessage($error_message)
|
68 |
+
{
|
69 |
+
$this->error_message = $error_message;
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* @return string
|
74 |
+
* @psalm-suppress PossiblyUnusedMethod
|
75 |
+
*/
|
76 |
+
public function getEnd()
|
77 |
+
{
|
78 |
+
return $this->end;
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* @param int 1|0 $end
|
83 |
+
* @psalm-suppress PossiblyUnusedMethod
|
84 |
+
*/
|
85 |
+
public function setEnd($end)
|
86 |
+
{
|
87 |
+
$this->end = $end;
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* @return integer
|
92 |
+
* @psalm-suppress PossiblyUnusedMethod
|
93 |
+
*/
|
94 |
+
public function getChecked()
|
95 |
+
{
|
96 |
+
return $this->checked;
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* @param integer $checked
|
101 |
+
* @psalm-suppress PossiblyUnusedMethod
|
102 |
+
*/
|
103 |
+
public function setChecked($checked)
|
104 |
+
{
|
105 |
+
$this->checked = $checked;
|
106 |
+
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* @param integer $checked
|
110 |
+
* @psalm-suppress PossiblyUnusedMethod
|
111 |
+
*/
|
112 |
+
public function updateChecked($checked)
|
113 |
+
{
|
114 |
+
$this->checked += $checked;
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* @return string|integer
|
119 |
+
* @psalm-suppress PossiblyUnusedMethod
|
120 |
+
*/
|
121 |
+
public function getSpam()
|
122 |
+
{
|
123 |
+
return $this->spam;
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* @param integer $spam
|
128 |
+
* @psalm-suppress PossiblyUnusedMethod
|
129 |
+
*/
|
130 |
+
public function setSpam($spam)
|
131 |
+
{
|
132 |
+
$this->spam = $spam;
|
133 |
+
}
|
134 |
+
|
135 |
+
/**
|
136 |
+
* @param integer $spam
|
137 |
+
* @psalm-suppress PossiblyUnusedMethod
|
138 |
+
*/
|
139 |
+
public function updateSpam($spam)
|
140 |
+
{
|
141 |
+
$this->spam += $spam;
|
142 |
+
}
|
143 |
+
|
144 |
+
/**
|
145 |
+
* @return integer
|
146 |
+
* @psalm-suppress PossiblyUnusedMethod
|
147 |
+
*/
|
148 |
+
public function getBad()
|
149 |
+
{
|
150 |
+
return $this->bad;
|
151 |
+
}
|
152 |
+
|
153 |
+
/**
|
154 |
+
* @param integer $bad
|
155 |
+
* @psalm-suppress PossiblyUnusedMethod
|
156 |
+
*/
|
157 |
+
public function setBad($bad)
|
158 |
+
{
|
159 |
+
$this->bad = $bad;
|
160 |
+
}
|
161 |
+
|
162 |
+
/**
|
163 |
+
* @return string
|
164 |
+
* @psalm-suppress PossiblyUnusedMethod
|
165 |
+
*/
|
166 |
+
public function getError()
|
167 |
+
{
|
168 |
+
return $this->error;
|
169 |
+
}
|
170 |
+
|
171 |
+
/**
|
172 |
+
* @param int 1|0 $error
|
173 |
+
* @psalm-suppress PossiblyUnusedMethod
|
174 |
+
*/
|
175 |
+
public function setError($error)
|
176 |
+
{
|
177 |
+
$this->error = $error;
|
178 |
+
}
|
179 |
+
}
|
lib/Cleantalk/ApbctWP/GetFieldsAny.php
CHANGED
@@ -280,6 +280,8 @@ class GetFieldsAny
|
|
280 |
$value = urldecode(trim($this->stripShortcodes($value))); // Fully cleaned message
|
281 |
|
282 |
// Email
|
|
|
|
|
283 |
if (preg_match("/^\S+@\S+\.\S+$/", $value_for_email) &&
|
284 |
(empty($this->visible_fields_arr) ||
|
285 |
in_array($key, $this->visible_fields_arr, true))) {
|
280 |
$value = urldecode(trim($this->stripShortcodes($value))); // Fully cleaned message
|
281 |
|
282 |
// Email
|
283 |
+
$value_for_email = Validate::isUrlencoded($value_for_email) ? urldecode($value_for_email) : $value_for_email;
|
284 |
+
|
285 |
if (preg_match("/^\S+@\S+\.\S+$/", $value_for_email) &&
|
286 |
(empty($this->visible_fields_arr) ||
|
287 |
in_array($key, $this->visible_fields_arr, true))) {
|
lib/Cleantalk/ApbctWP/HTTP/Request.php
CHANGED
@@ -105,6 +105,20 @@ class Request extends \Cleantalk\Common\HTTP\Request
|
|
105 |
return $responses;
|
106 |
}
|
107 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
/**
|
109 |
* Append options considering passed presets
|
110 |
*/
|
@@ -142,6 +156,20 @@ class Request extends \Cleantalk\Common\HTTP\Request
|
|
142 |
$this->options['header'] = true;
|
143 |
$this->options['nobody'] = true;
|
144 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
}
|
146 |
}
|
147 |
}
|
105 |
return $responses;
|
106 |
}
|
107 |
|
108 |
+
/**
|
109 |
+
* Set default options to make a request
|
110 |
+
*/
|
111 |
+
protected function appendOptionsObligatory()
|
112 |
+
{
|
113 |
+
parent::appendOptionsObligatory();
|
114 |
+
|
115 |
+
global $apbct;
|
116 |
+
|
117 |
+
if ( $apbct->settings['wp__use_builtin_http_api'] ) {
|
118 |
+
$this->options['useragent'] = self::AGENT;
|
119 |
+
}
|
120 |
+
}
|
121 |
+
|
122 |
/**
|
123 |
* Append options considering passed presets
|
124 |
*/
|
156 |
$this->options['header'] = true;
|
157 |
$this->options['nobody'] = true;
|
158 |
break;
|
159 |
+
|
160 |
+
case 'no_cache':
|
161 |
+
// Append parameter in a different way for single and multiple requests
|
162 |
+
if ( is_array($this->url) ) {
|
163 |
+
$this->url = array_map(static function ($elem) {
|
164 |
+
return self::appendParametersToURL($elem, ['apbct_no_cache' => mt_rand()]);
|
165 |
+
}, $this->url);
|
166 |
+
} else {
|
167 |
+
$this->url = self::appendParametersToURL(
|
168 |
+
$this->url,
|
169 |
+
['apbct_no_cache' => mt_rand()]
|
170 |
+
);
|
171 |
+
}
|
172 |
+
break;
|
173 |
}
|
174 |
}
|
175 |
}
|
lib/Cleantalk/ApbctWP/Helper.php
CHANGED
@@ -112,7 +112,8 @@ class Helper extends \Cleantalk\Common\Helper
|
|
112 |
), $request_params);
|
113 |
$patterns = array_merge(
|
114 |
array(
|
115 |
-
'dont_split_to_array'
|
|
|
116 |
),
|
117 |
$patterns
|
118 |
);
|
112 |
), $request_params);
|
113 |
$patterns = array_merge(
|
114 |
array(
|
115 |
+
'dont_split_to_array',
|
116 |
+
'no_cache'
|
117 |
),
|
118 |
$patterns
|
119 |
);
|
lib/Cleantalk/Common/HTTP/Request.php
CHANGED
@@ -515,12 +515,12 @@ class Request
|
|
515 |
// Append parameter in a different way for single and multiple requests
|
516 |
if ( is_array($this->url) ) {
|
517 |
$this->url = array_map(static function ($elem) {
|
518 |
-
return self::appendParametersToURL($elem, ['
|
519 |
}, $this->url);
|
520 |
} else {
|
521 |
$this->options[CURLOPT_URL] = self::appendParametersToURL(
|
522 |
$this->options[CURLOPT_URL],
|
523 |
-
['
|
524 |
);
|
525 |
}
|
526 |
break;
|
515 |
// Append parameter in a different way for single and multiple requests
|
516 |
if ( is_array($this->url) ) {
|
517 |
$this->url = array_map(static function ($elem) {
|
518 |
+
return self::appendParametersToURL($elem, ['apbct_no_cache' => mt_rand()]);
|
519 |
}, $this->url);
|
520 |
} else {
|
521 |
$this->options[CURLOPT_URL] = self::appendParametersToURL(
|
522 |
$this->options[CURLOPT_URL],
|
523 |
+
['apbct_no_cache' => mt_rand()]
|
524 |
);
|
525 |
}
|
526 |
break;
|
lib/Cleantalk/Common/Queue.php
CHANGED
@@ -148,6 +148,8 @@ abstract class Queue
|
|
148 |
|
149 |
return array('error' => $stage_to_execute['name'] . ' is not a callable function.');
|
150 |
}
|
|
|
|
|
151 |
}
|
152 |
|
153 |
public function isQueueInProgress()
|
148 |
|
149 |
return array('error' => $stage_to_execute['name'] . ' is not a callable function.');
|
150 |
}
|
151 |
+
|
152 |
+
return null;
|
153 |
}
|
154 |
|
155 |
public function isQueueInProgress()
|
lib/Cleantalk/Common/Validate.php
CHANGED
@@ -97,4 +97,16 @@ class Validate
|
|
97 |
{
|
98 |
return @preg_match('/' . $regexp . '/', '') !== false;
|
99 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
}
|
97 |
{
|
98 |
return @preg_match('/' . $regexp . '/', '') !== false;
|
99 |
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Check if the string is encoded by urlencode()
|
103 |
+
*
|
104 |
+
* @param $value
|
105 |
+
*
|
106 |
+
* @return bool
|
107 |
+
*/
|
108 |
+
public static function isUrlencoded($value)
|
109 |
+
{
|
110 |
+
return urlencode(urldecode($value)) === $value;
|
111 |
+
}
|
112 |
}
|
readme.txt
CHANGED
@@ -602,6 +602,30 @@ If your website has forms that send data to external sources, you can enable opt
|
|
602 |
|
603 |
== Changelog ==
|
604 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
605 |
= 5.178 Jun 02 2022 =
|
606 |
#### Comment moderation option added, cookies prefix added, RemoteCalls stability improved and some minor issues fixed.
|
607 |
* New. Options. Comment moderation option added on discussion page.
|
602 |
|
603 |
== Changelog ==
|
604 |
|
605 |
+
= 5.179 Jun 16 2022 =
|
606 |
+
#### Email Encoder functionality improved, SFW updating process improved and some minor issues fixed.
|
607 |
+
* New. EmailEncoder.php->modifyContent. Admins and logged in exclusions.
|
608 |
+
* Fix. Email encoder. Prevent encoding data for logged in users.
|
609 |
+
* Fix. Queue. Return statement from executeStage() method added.
|
610 |
+
* Fix. SFW. Updating process fixed.
|
611 |
+
* Fix. SFW. SFW update worker fixed.
|
612 |
+
* Mod: Using the shutdown hook to call a function ct_contact_form_validate().
|
613 |
+
* Fix. apbct_sfw_update__worker. Clear errors if stage is finished.
|
614 |
+
* Fix. HTTP lib. Useragent for WP HTTP API requests fixed.
|
615 |
+
* Fix. cleantalk_external. Exclusion for tp.media booking forms.
|
616 |
+
* Fix. cleantalk_external. Exclusion for flodesk forms.
|
617 |
+
* Mod: Replace apbct_update_actions() to upgrader_process_complete hook
|
618 |
+
* Fix. cleantalk_external.js->ct_protect_external(). Exclusion for tp.media booking forms.
|
619 |
+
* Fix. RemoteCalls. No cache parameter added.
|
620 |
+
* Fix. apbct_remove_upd_folder(). Force unknown file deletion ('.last.jpegoptim')
|
621 |
+
* Fix. apbct_remove_upd_folder(). Add chek if a strange file is a file and exists.
|
622 |
+
* Fix. GetFieldsAny.php. Decode email if it is urlencoded.
|
623 |
+
* Fix. cleantalk-public-validate.php. Add JS check to public forms.
|
624 |
+
* Mod: Refactoring User Scanner
|
625 |
+
* Fixed apbct_cookies_test cookie
|
626 |
+
* Upd. JS. Cookies has_scrolling and mouse_moved optimized.
|
627 |
+
* Upd. Email encoder. Links mailto: processed.
|
628 |
+
|
629 |
= 5.178 Jun 02 2022 =
|
630 |
#### Comment moderation option added, cookies prefix added, RemoteCalls stability improved and some minor issues fixed.
|
631 |
* New. Options. Comment moderation option added on discussion page.
|