Spam protection, AntiSpam, FireWall by CleanTalk - Version 5.133.1

Version Description

February 03 2020 = * Fix: PHP 7.4 issues. * Fix: Woocommerce options moved to a separate block. * Fix: CSS/HTML issues on settings page. * Minor fixes. * Spam protection improved.

Download this release

Release Info

Developer sartemd174
Plugin Icon 128x128 Spam protection, AntiSpam, FireWall by CleanTalk
Version 5.133.1
Comparing to
See all releases

Code changes from version 5.133 to 5.133.1

cleantalk.php CHANGED
@@ -1,1928 +1,1931 @@
1
- <?php
2
- /*
3
- Plugin Name: Anti-Spam by CleanTalk
4
- Plugin URI: https://cleantalk.org
5
- 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.
6
- Version: 5.133
7
- Author: СleanTalk <welcome@cleantalk.org>
8
- Author URI: https://cleantalk.org
9
- Text Domain: cleantalk
10
- Domain Path: /i18n
11
- */
12
-
13
- $cleantalk_executed = false;
14
-
15
- // Getting version form main file (look above)
16
- $plugin_info = get_file_data(__FILE__, array('Version' => 'Version', 'Name' => 'Plugin Name',));
17
-
18
- // Common params
19
- define('APBCT_NAME', $plugin_info['Name']);
20
- define('APBCT_VERSION', $plugin_info['Version']);
21
- define('APBCT_URL_PATH', plugins_url('', __FILE__)); //HTTP path. Plugin root folder without '/'.
22
- define('APBCT_DIR_PATH', dirname(__FILE__ ) . '/'); //System path. Plugin root folder with '/'.
23
- define('APBCT_PLUGIN_BASE_NAME', plugin_basename(__FILE__)); //Plugin base name.
24
- define('APBCT_CASERT_PATH', file_exists(ABSPATH . WPINC . '/certificates/ca-bundle.crt') ? ABSPATH . WPINC . '/certificates/ca-bundle.crt' : ''); // SSL Serttificate path
25
-
26
- // API params
27
- define('APBCT_AGENT', 'wordpress-'.str_replace('.', '', $plugin_info['Version']));
28
- define('APBCT_MODERATE_URL', 'http://moderate.cleantalk.org'); //Api URL
29
-
30
- // Option names
31
- define('APBCT_DATA', 'cleantalk_data'); //Option name with different plugin data.
32
- define('APBCT_SETTINGS', 'cleantalk_settings'); //Option name with plugin settings.
33
- define('APBCT_NETWORK_SETTINGS', 'cleantalk_network_settings'); //Option name with plugin network settings.
34
- define('APBCT_DEBUG', 'cleantalk_debug'); //Option name with a debug data. Empty by default.
35
-
36
- // Multisite
37
- define('APBCT_WPMS', (is_multisite() ? true : false)); // WMPS is enabled
38
-
39
- // Sessions
40
- define('APBCT_SEESION__LIVE_TIME', 86400*2);
41
- define('APBCT_SEESION__CHANCE_TO_CLEAN', 100);
42
-
43
- // Different params
44
- define('APBCT_REMOTE_CALL_SLEEP', 5); // Minimum time between remote call
45
-
46
- if( !defined( 'CLEANTALK_PLUGIN_DIR' ) ){
47
-
48
- define('CLEANTALK_PLUGIN_DIR', dirname(__FILE__ ) . '/');
49
-
50
- // PHP functions patches
51
- require_once(CLEANTALK_PLUGIN_DIR . 'lib/cleantalk-php-patch.php'); // Pathces fpr different functions which not exists
52
-
53
- // Base classes
54
- require_once(CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/Antispam/API.php'); // API
55
- require_once(CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/Antispam/DB.php'); // Database driver
56
- require_once(CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/Antispam/Helper.php'); // Helper
57
- include_once(CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/Antispam/SFW.php'); // SpamFireWall
58
- include_once(CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/Arr.php'); // Array functions
59
-
60
- // Child classes
61
- require_once(CLEANTALK_PLUGIN_DIR . 'lib/CleantalkAPI.php'); // API for Wordpress
62
- require_once(CLEANTALK_PLUGIN_DIR . 'lib/CleantalkDB.php'); // Database class for Wordpress
63
- require_once(CLEANTALK_PLUGIN_DIR . 'lib/CleantalkHelper.php'); // Helper for Worpdress
64
- include_once(CLEANTALK_PLUGIN_DIR . "lib/CleantalkSFW.php"); // SpamFireWall for Wordpress
65
-
66
- require_once(CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk.php'); // Main class for request
67
- require_once(CLEANTALK_PLUGIN_DIR . 'lib/CleantalkRequest.php'); // Holds request data
68
- require_once(CLEANTALK_PLUGIN_DIR . 'lib/CleantalkResponse.php'); // Holds response data
69
-
70
- require_once(CLEANTALK_PLUGIN_DIR . 'lib/CleantalkCron.php'); // Cron handling
71
- require_once(CLEANTALK_PLUGIN_DIR . 'lib/CleantalkState.php'); // State class
72
- require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-pluggable.php'); // Pluggable functions
73
- require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-common.php');
74
-
75
- // Global ArrayObject with settings and other global varables
76
- global $apbct;
77
- $apbct = new CleantalkState('cleantalk', array('settings', 'data', 'debug', 'errors', 'remote_calls', 'stats'));
78
-
79
- $apbct->base_name = 'cleantalk-spam-protect/cleantalk.php';
80
-
81
- $apbct->logo = plugin_dir_url(__FILE__) . 'inc/images/logo.png';
82
- $apbct->logo__small = plugin_dir_url(__FILE__) . 'inc/images/logo_small.png';
83
- $apbct->logo__small__colored = plugin_dir_url(__FILE__) . 'inc/images/logo_color.png';
84
-
85
- // Customize CleantalkState
86
- // Account status
87
-
88
- $apbct->white_label = $apbct->network_settings['white_label'];
89
- $apbct->allow_custom_key = $apbct->network_settings['allow_custom_key'];
90
- $apbct->plugin_name = $apbct->network_settings['white_label__plugin_name'] ? $apbct->network_settings['white_label__plugin_name'] : APBCT_NAME;
91
- $apbct->api_key = !APBCT_WPMS || $apbct->allow_custom_key || $apbct->white_label ? $apbct->settings['apikey'] : $apbct->network_settings['apikey'];
92
- $apbct->key_is_ok = !APBCT_WPMS || $apbct->allow_custom_key || $apbct->white_label ? $apbct->data['key_is_ok'] : $apbct->network_data['key_is_ok'];
93
- $apbct->moderate = !APBCT_WPMS || $apbct->allow_custom_key || $apbct->white_label ? $apbct->data['moderate'] : $apbct->network_data['moderate'];
94
-
95
- $apbct->data['user_counter']['since'] = isset($apbct->data['user_counter']['since']) ? $apbct->data['user_counter']['since'] : date('d M');
96
- $apbct->data['connection_reports']['since'] = isset($apbct->data['connection_reports']['since']) ? $apbct->data['user_counter']['since'] : date('d M');
97
-
98
- $apbct->settings_link = is_network_admin() ? 'settings.php?page=cleantalk' : 'options-general.php?page=cleantalk';
99
-
100
- if(!$apbct->white_label){
101
- require_once( CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-widget.php');
102
- }
103
-
104
- // Disabling comments
105
- if($apbct->settings['disable_comments__all'] || $apbct->settings['disable_comments__posts'] || $apbct->settings['disable_comments__pages'] || $apbct->settings['disable_comments__media']){
106
- require_once(CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/Templates/Singleton.php');
107
- require_once(CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/DisableComments.php');
108
- \Cleantalk\DisableComments::getInstance();
109
- }
110
-
111
- // Passing JS key to frontend
112
- add_action('wp_ajax_apbct_js_keys__get', 'apbct_js_keys__get__ajax');
113
- add_action('wp_ajax_nopriv_apbct_js_keys__get', 'apbct_js_keys__get__ajax');
114
-
115
- // Database prefix
116
- global $wpdb;
117
- $apbct->db_prefix = !APBCT_WPMS || $apbct->allow_custom_key || $apbct->white_label ? $wpdb->prefix : $wpdb->base_prefix;
118
- $apbct->db_prefix = !$apbct->white_label && defined('CLEANTALK_ACCESS_KEY') ? $wpdb->base_prefix : $wpdb->prefix;
119
- // Database constants
120
- define('APBCT_TBL_FIREWALL_DATA', $apbct->db_prefix . 'cleantalk_sfw'); // Table with firewall data.
121
- define('APBCT_TBL_FIREWALL_LOG', $apbct->db_prefix . 'cleantalk_sfw_logs'); // Table with firewall logs.
122
- define('APBCT_TBL_SESSIONS', $apbct->db_prefix . 'cleantalk_sessions'); // Table with session data.
123
- define('APBCT_SPAMSCAN_LOGS', $apbct->db_prefix . 'cleantalk_spamscan_logs'); // Table with session data.
124
- define('APBCT_SELECT_LIMIT', 5000); // Select limit for logs.
125
- define('APBCT_WRITE_LIMIT', 5000); // Write limit for firewall data.
126
-
127
- /** @todo HARDCODE FIX */
128
- if($apbct->plugin_version === '1.0.0')
129
- $apbct->plugin_version = '5.100';
130
-
131
- // Do update actions if version is changed
132
- apbct_update_actions();
133
-
134
- // Self cron
135
- if(!defined('DOING_CRON') || (defined('DOING_CRON') && DOING_CRON !== true)){
136
-
137
- $ct_cron = new CleantalkCron();
138
- $ct_cron->checkTasks();
139
-
140
- if(!empty($ct_cron->tasks_to_run)){
141
-
142
- define('CT_CRON', true); // Letting know functions that they are running under CT_CRON
143
- $ct_cron->runTasks();
144
- unset($ct_cron);
145
-
146
- }
147
- }
148
-
149
- //Delete cookie for admin trial notice
150
- add_action('wp_logout', 'apbct__hook__wp_logout__delete_trial_notice_cookie');
151
-
152
- // Set cookie only for public pages and for non-AJAX requests
153
- if (!is_admin() && !apbct_is_ajax() && !defined('DOING_CRON')
154
- && empty($_POST['ct_checkjs_register_form']) // Buddy press registration fix
155
- && empty($_GET['ct_checkjs_search_default']) // Search form fix
156
- && empty($_POST['action']) //bbPress
157
- ){
158
- add_action('template_redirect','apbct_cookie', 2);
159
- add_action('template_redirect','apbct_store__urls', 2);
160
- if (empty($_POST) && empty($_GET)){
161
- apbct_cookie();
162
- apbct_store__urls();
163
- }
164
- }
165
-
166
- // Early checks
167
-
168
- // Iphorm
169
- if( isset( $_POST['iphorm_ajax'], $_POST['iphorm_id'], $_POST['iphorm_uid'] ) ){
170
- require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
171
- require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-ajax.php');
172
- ct_ajax_hook();
173
- }
174
-
175
- // Facebook
176
- if ($apbct->settings['general_contact_forms_test'] == 1
177
- && (!empty($_POST['action']) && $_POST['action'] == 'fb_intialize')
178
- && !empty($_POST['FB_userdata'])
179
- ){
180
- require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
181
- if (apbct_is_user_enable()){
182
- $ct_check_post_result=false;
183
- ct_registration_errors(null);
184
- }
185
-
186
- }
187
-
188
- // Ninja Forms. Making GET action to POST action
189
- if( apbct_is_in_uri( 'admin-ajax.php' ) && sizeof($_POST) > 0 && isset($_GET['action']) && $_GET['action']=='ninja_forms_ajax_submit' )
190
- $_POST['action']='ninja_forms_ajax_submit';
191
-
192
- add_action( 'wp_ajax_nopriv_ninja_forms_ajax_submit', 'apbct_form__ninjaForms__testSpam', 1);
193
- add_action( 'wp_ajax_ninja_forms_ajax_submit', 'apbct_form__ninjaForms__testSpam', 1);
194
- add_action( 'wp_ajax_nopriv_nf_ajax_submit', 'apbct_form__ninjaForms__testSpam', 1);
195
- add_action( 'wp_ajax_nf_ajax_submit', 'apbct_form__ninjaForms__testSpam', 1);
196
- add_action( 'ninja_forms_process', 'apbct_form__ninjaForms__testSpam', 1); // Depricated ?
197
-
198
- // SeedProd Coming Soon Page Pro integration
199
- add_action( 'wp_ajax_seed_cspv5_subscribe_callback', 'apbct_form__seedprod_coming_soon__testSpam', 1 );
200
- add_action( 'wp_ajax_nopriv_seed_cspv5_subscribe_callback', 'apbct_form__seedprod_coming_soon__testSpam', 1 );
201
- add_action( 'wp_ajax_seed_cspv5_contactform_callback', 'apbct_form__seedprod_coming_soon__testSpam', 1 );
202
- add_action( 'wp_ajax_nopriv_seed_cspv5_contactform_callback', 'apbct_form__seedprod_coming_soon__testSpam', 1 );
203
-
204
- // The 7 theme contact form integration
205
- add_action( 'wp_ajax_nopriv_dt_send_mail', 'apbct_form__the7_contact_form', 1 );
206
- add_action( 'wp_ajax_dt_send_mail', 'apbct_form__the7_contact_form', 1 );
207
-
208
- // Elementor Pro page builder forms
209
- add_action( 'wp_ajax_elementor_pro_forms_send_form', 'apbct_form__elementor_pro__testSpam' );
210
- add_action( 'wp_ajax_nopriv_elementor_pro_forms_send_form', 'apbct_form__elementor_pro__testSpam' );
211
-
212
- // Custom register form (ticket_id=13668)
213
- add_action('website_neotrends_signup_fields_check',function( $username, $fields ){
214
- $ip = CleantalkHelper::ip__get( array('real'), false );
215
- $ct_result = ct_test_registration( $username, $fields['email'], $ip );
216
- if( $ct_result['allow'] == 0 ) {
217
- ct_die_extended( $ct_result['comment'] );
218
- }
219
- }, 1, 2);
220
-
221
- // Public actions
222
- if(!is_admin() && !apbct_is_ajax()){
223
-
224
- // Default search
225
- //add_filter( 'get_search_form', 'apbct_forms__search__addField' );
226
- add_filter( 'get_search_query', 'apbct_forms__search__testSpam' );
227
-
228
- // Remote calls
229
- if(isset($_GET['spbc_remote_call_token'], $_GET['spbc_remote_call_action'], $_GET['plugin_name']) && in_array($_GET['plugin_name'], array('antispam','anti-spam', 'apbct'))){
230
- apbct_remote_call__perform();
231
- }
232
-
233
- // SpamFireWall check
234
- if( $apbct->plugin_version == APBCT_VERSION && // Do not call with first start
235
- $apbct->settings['spam_firewall'] == 1 &&
236
- apbct_is_get() &&
237
- ! apbct_wp_doing_cron()
238
- ){
239
- apbct_sfw__check();
240
- }
241
-
242
- }
243
-
244
-
245
- // Activation/deactivation functions must be in main plugin file.
246
- // http://codex.wordpress.org/Function_Reference/register_activation_hook
247
- register_activation_hook( __FILE__, 'apbct_activation' );
248
- register_deactivation_hook( __FILE__, 'apbct_deactivation' );
249
-
250
- // Hook for newly added blog
251
- add_action('wpmu_new_blog', 'apbct_activation__new_blog', 10, 6);
252
-
253
- // Async loading for JavaScript
254
- add_filter('script_loader_tag', 'apbct_add_async_attribute', 10, 3);
255
-
256
- // Redirect admin to plugin settings.
257
- if(!defined('WP_ALLOW_MULTISITE') || defined('WP_ALLOW_MULTISITE') && WP_ALLOW_MULTISITE == false)
258
- add_action('admin_init', 'apbct_plugin_redirect');
259
-
260
- // Deleting SFW tables when deleting websites
261
- if(defined('WP_ALLOW_MULTISITE') && WP_ALLOW_MULTISITE === true)
262
- add_action( 'delete_blog', 'apbct_sfw__delete_tables', 10, 2 );
263
-
264
- // After plugin loaded - to load locale as described in manual
265
- add_action('plugins_loaded', 'apbct_plugin_loaded' );
266
-
267
- if( !empty($apbct->settings['use_ajax']) &&
268
- ! apbct_is_in_uri( '.xml' ) &&
269
- ! apbct_is_in_uri( '.xsl' ) )
270
- {
271
- add_action( 'wp_ajax_nopriv_ct_get_cookie', 'ct_get_cookie',1 );
272
- add_action( 'wp_ajax_ct_get_cookie', 'ct_get_cookie',1 );
273
- }
274
-
275
- // Admin panel actions
276
- if (is_admin() || is_network_admin()){
277
-
278
- require_once( CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-find-spam.php' );
279
- require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-admin.php');
280
- require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-settings.php');
281
-
282
- if (!(defined( 'DOING_AJAX' ) && DOING_AJAX)){
283
-
284
- add_action('admin_enqueue_scripts', 'apbct_admin__enqueue_scripts');
285
-
286
- add_action('admin_init', 'apbct_admin__init', 1);
287
- add_action('admin_menu', 'apbct_settings_add_page');
288
- add_action('network_admin_menu', 'apbct_settings_add_page');
289
- add_action('admin_notices', 'apbct_admin__notice_message');
290
- add_action('network_admin_notices', 'apbct_admin__notice_message');
291
-
292
- //Show widget only if not IP license
293
- if(!$apbct->moderate_ip)
294
- add_action('wp_dashboard_setup', 'ct_dashboard_statistics_widget' );
295
- }
296
-
297
- if(apbct_is_ajax() || isset($_POST['cma-action'])){
298
-
299
- $cleantalk_hooked_actions = array();
300
- $cleantalk_ajax_actions_to_check = array();
301
-
302
- require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
303
- require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-ajax.php');
304
-
305
- // Feedback for comments
306
- if(isset($_POST['action']) && $_POST['action'] == 'ct_feedback_comment'){
307
- add_action( 'wp_ajax_nopriv_ct_feedback_comment', 'apbct_comment__send_feedback',1 );
308
- add_action( 'wp_ajax_ct_feedback_comment', 'apbct_comment__send_feedback',1 );
309
- }
310
- if(isset($_POST['action']) && $_POST['action'] == 'ct_feedback_user'){
311
- add_action( 'wp_ajax_nopriv_ct_feedback_user', 'apbct_user__send_feedback',1 );
312
- add_action( 'wp_ajax_ct_feedback_user', 'apbct_user__send_feedback',1 );
313
- }
314
-
315
- // Check AJAX requests
316
- // if User is not logged in
317
- // if Unknown action or Known action with mandatory check
318
- if( (!apbct_is_user_logged_in() || $apbct->settings['protect_logged_in'] == 1) &&
319
- isset($_POST['action']) && (!in_array($_POST['action'], $cleantalk_hooked_actions) || in_array($_POST['action'], $cleantalk_ajax_actions_to_check))
320
- ){
321
- ct_ajax_hook();
322
- }
323
-
324
- //QAEngine Theme answers
325
- if (intval($apbct->settings['general_contact_forms_test']))
326
- add_filter('et_pre_insert_question', 'ct_ajax_hook', 1, 1); // Questions
327
- add_filter('et_pre_insert_answer', 'ct_ajax_hook', 1, 1); // Answers
328
-
329
- // Formidable
330
- add_filter( 'frm_entries_before_create', 'apbct_rorm__formidable__testSpam', 10, 2 );
331
- add_action( 'frm_entries_footer_scripts', 'apbct_rorm__formidable__footerScripts', 20, 2 );
332
-
333
- // Some of plugins to register a users use AJAX context.
334
- add_filter('registration_errors', 'ct_registration_errors', 1, 3);
335
- add_filter('registration_errors', 'ct_check_registration_erros', 999999, 3);
336
- add_action('user_register', 'apbct_user_register');
337
-
338
- if(class_exists('BuddyPress')){
339
- require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
340
- add_filter('bp_activity_is_spam_before_save', 'apbct_integration__buddyPres__activityWall', 999 ,2); /* ActivityWall */
341
- add_action('bp_locate_template', 'apbct_integration__buddyPres__getTemplateName', 10, 6);
342
- }
343
-
344
- }
345
-
346
- require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
347
- //Bitrix24 contact form
348
- if ($apbct->settings['general_contact_forms_test'] == 1 &&
349
- !empty($_POST['your-phone']) &&
350
- !empty($_POST['your-email']) &&
351
- !empty($_POST['your-message'])
352
- ){
353
- $ct_check_post_result=false;
354
- ct_contact_form_validate();
355
- }
356
-
357
- // Sends feedback to the cloud about comments
358
- // add_action('wp_set_comment_status', 'ct_comment_send_feedback', 10, 2);
359
-
360
- // Sends feedback to the cloud about deleted users
361
- global $pagenow;
362
- if($pagenow=='users.php')
363
- add_action('delete_user', 'apbct_user__delete__hook', 10, 2);
364
-
365
- if( $pagenow=='plugins.php' || apbct_is_in_uri( 'plugins.php' ) ){
366
-
367
- add_filter('plugin_action_links_'.plugin_basename(__FILE__), 'apbct_admin__plugin_action_links', 10, 2);
368
- add_filter('network_admin_plugin_action_links_'.plugin_basename(__FILE__), 'apbct_admin__plugin_action_links', 10, 2);
369
-
370
- add_filter('plugin_row_meta', 'apbct_admin__register_plugin_links', 10, 2);
371
- }
372
-
373
- // Public pages actions
374
- }else{
375
-
376
- require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
377
-
378
- add_action('wp_enqueue_scripts', 'ct_enqueue_scripts_public');
379
-
380
- // Init action.
381
- add_action('plugins_loaded', 'apbct_init', 1);
382
-
383
- // Comments
384
- add_filter('preprocess_comment', 'ct_preprocess_comment', 1, 1); // param - comment data array
385
- add_filter('comment_text', 'ct_comment_text' );
386
- add_filter('wp_die_handler', 'apbct_comment__sanitize_data__before_wp_die', 1); // Check comments after validation
387
-
388
- // Registrations
389
- if(!isset($_POST['wp-submit'])){
390
- add_action('login_form_register', 'apbct_cookie');
391
- add_action('login_form_register', 'apbct_store__urls');
392
- }
393
- add_action('login_enqueue_scripts', 'apbct_login__scripts');
394
- add_action('register_form', 'ct_register_form');
395
- add_filter('registration_errors', 'ct_registration_errors', 1, 3);
396
- add_filter('registration_errors', 'ct_check_registration_erros', 999999, 3);
397
- add_action('user_register', 'apbct_user_register');
398
-
399
- // Multisite registrations
400
- add_action('signup_extra_fields','ct_register_form');
401
- add_filter('wpmu_validate_user_signup', 'ct_registration_errors_wpmu', 10, 3);
402
-
403
- // Login form - for notifications only
404
- add_filter('login_message', 'ct_login_message');
405
-
406
- // Comments output hook
407
- add_filter('wp_list_comments_args', 'ct_wp_list_comments_args');
408
-
409
- // Ait-Themes fix
410
- if(isset($_GET['ait-action']) && $_GET['ait-action']=='register'){
411
- $tmp=$_POST['redirect_to'];
412
- unset($_POST['redirect_to']);
413
- ct_contact_form_validate();
414
- $_POST['redirect_to']=$tmp;
415
- }
416
- }
417
-
418
- // Short code for GDPR
419
- if($apbct->settings['gdpr_enabled'])
420
- add_shortcode('cleantalk_gdpr_form', 'apbct_shrotcode_handler__GDPR_public_notice__form');
421
-
422
- }
423
-
424
- /**
425
- * Function preforms remote call
426
- */
427
- function apbct_remote_call__perform()
428
- {
429
- global $apbct;
430
-
431
- $remote_action = $_GET['spbc_remote_call_action'];
432
-
433
- if(array_key_exists($remote_action, $apbct->remote_calls)){
434
-
435
- if(time() - $apbct->remote_calls[$remote_action]['last_call'] > APBCT_REMOTE_CALL_SLEEP){
436
-
437
- $apbct->remote_calls[$remote_action]['last_call'] = time();
438
- $apbct->save('remote_calls');
439
-
440
- if(strtolower($_GET['spbc_remote_call_token']) == strtolower(md5($apbct->api_key))){
441
-
442
- // Flag to let plugin know that Remote Call is running.
443
- $apbct->rc_running = true;
444
-
445
- switch ($_GET['spbc_remote_call_action']) {
446
-
447
- // Close renew banner
448
- case 'close_renew_banner':
449
- $apbct->data['notice_trial'] = 0;
450
- $apbct->data['notice_renew'] = 0;
451
- $apbct->saveData();
452
- CleantalkCron::updateTask('check_account_status', 'ct_account_status_check', 86400);
453
- die('OK');
454
- break;
455
-
456
- // SFW update
457
- case 'sfw_update':
458
- $result = ct_sfw_update(true);
459
- /**
460
- * @todo CRUNCH
461
- */
462
- if(is_string($result) && strpos($result, 'FAIL') !== false){
463
- $result = json_decode(substr($result, 5), true);
464
- }
465
- die(empty($result['error']) ? 'OK' : 'FAIL '.json_encode(array('error' => $result['error'])));
466
- break;
467
-
468
- // SFW send logs
469
- case 'sfw_send_logs':
470
- $result = ct_sfw_send_logs();
471
- die(empty($result['error']) ? 'OK' : 'FAIL '.json_encode(array('error' => $result['error'])));
472
- break;
473
-
474
- // Update plugin
475
- case 'update_plugin':
476
- add_action('wp', 'apbct_rc__update', 1);
477
- break;
478
-
479
- // Install plugin
480
- case 'install_plugin':
481
- add_action('wp', 'apbct_rc__install_plugin', 1);
482
- break;
483
- // Activate plugin
484
- case 'activate_plugin':
485
- $result = apbct_rc__activate_plugin($_GET['plugin']);
486
- die(empty($result['error'])
487
- ? 'OK'
488
- : 'FAIL '.json_encode(array('error' => $result['error'])));
489
- break;
490
-
491
- // Insert API key
492
- case 'insert_auth_key':
493
- $result = apbct_rc__insert_auth_key($_GET['auth_key'], $_GET['plugin']);
494
- die(empty($result['error'])
495
- ? 'OK'
496
- : 'FAIL '.json_encode(array('error' => $result['error'])));
497
- break;
498
-
499
- // Update settins
500
- case 'update_settings':
501
- $result = apbct_rc__update_settings($_GET);
502
- die(empty($result['error'])
503
- ? 'OK'
504
- : 'FAIL '.json_encode(array('error' => $result['error'])));
505
- break;
506
- // Deactivate plugin
507
- case 'deactivate_plugin':
508
- add_action('plugins_loaded', 'apbct_rc__deactivate_plugin', 1);
509
- break;
510
-
511
- // Uninstall plugin
512
- case 'uninstall_plugin':
513
- add_action('plugins_loaded', 'apbct_rc__uninstall_plugin', 1);
514
- break;
515
- // No action found
516
- default:
517
- die('FAIL '.json_encode(array('error' => 'UNKNOWN_ACTION_2')));
518
- break;
519
- }
520
-
521
- }else
522
- die('FAIL '.json_encode(array('error' => 'WRONG_TOKEN')));
523
- }else
524
- die('FAIL '.json_encode(array('error' => 'TOO_MANY_ATTEMPTS')));
525
- }else
526
- die('FAIL '.json_encode(array('error' => 'UNKNOWN_ACTION')));
527
- }
528
-
529
- /**
530
- * Function for SpamFireWall check
531
- */
532
- function apbct_sfw__check()
533
- {
534
- global $apbct, $spbc, $cleantalk_url_exclusions;
535
-
536
- // Turn off the SpamFireWall if current url in the exceptions list and WordPress core pages
537
- if (!empty($cleantalk_url_exclusions) && is_array($cleantalk_url_exclusions)) {
538
- $core_page_to_skip_check = array('/feed');
539
- foreach (array_merge($cleantalk_url_exclusions, $core_page_to_skip_check) as $v) {
540
- if ( apbct_is_in_uri( $v ) ) {
541
- return;
542
- }
543
- }
544
- }
545
-
546
- // Turn off the SpamFireWall if Remote Call is in progress
547
- if($apbct->rc_running || (!empty($spbc) && $spbc->rc_running))
548
- return;
549
-
550
- $is_sfw_check = true;
551
- $sfw = new CleantalkSFW();
552
- $sfw->ip_array = (array)$sfw->ip__get(array('real'), true);
553
-
554
- // Skip by cookie
555
- foreach($sfw->ip_array as $ct_cur_ip){
556
- if(isset($_COOKIE['ct_sfw_pass_key']) && $_COOKIE['ct_sfw_pass_key'] == md5($ct_cur_ip.$apbct->api_key)){
557
- $is_sfw_check=false;
558
- if(isset($_COOKIE['ct_sfw_passed'])){
559
- $sfw->logs__update($ct_cur_ip, 'passed');
560
- $apbct->data['sfw_counter']['all']++;
561
- $apbct->saveData();
562
- if(!headers_sent())
563
- apbct_cookie__set ('ct_sfw_passed', '0', time()+86400*3, '/', parse_url(get_option('siteurl'),PHP_URL_HOST), false, true, 'Lax' );
564
- }
565
- break;
566
- }else{
567
- $is_sfw_check = true;
568
- }
569
- }
570
-
571
- // Skip the check
572
- if(!empty($_GET['access'])){
573
- $spbc_settings = get_option('spbc_settings');
574
- $spbc_key = !empty($spbc_settings['spbc_key']) ? $spbc_settings['spbc_key'] : false;
575
- if($_GET['access'] === $apbct->api_key || ($spbc_key !== false && $_GET['access'] === $spbc_key)){
576
- $is_sfw_check = false;
577
- setcookie ('spbc_firewall_pass_key', md5(apbct_get_server_variable( 'REMOTE_ADDR' ) . $spbc_key), time()+1200, '/');
578
- setcookie ('ct_sfw_pass_key', md5(apbct_get_server_variable( 'REMOTE_ADDR' ) . $apbct->api_key), time()+1200, '/');
579
- }
580
- unset($spbc_settings, $spbc_key);
581
- }
582
-
583
- if($is_sfw_check){
584
-
585
- $sfw->ip_check();
586
-
587
- // Pass remote calls
588
- if($sfw->pass === false){
589
- if(isset($_GET['spbc_remote_call_token'], $_GET['spbc_remote_call_action'], $_GET['plugin_name'])){
590
- foreach($sfw->blocked_ips as $ip){
591
- $resolved = CleantalkHelper::ip__resolve($ip['ip']);
592
- if($resolved && preg_match('/cleantalk\.org/', $resolved) === 1 || $resolved === 'back'){
593
- $sfw->pass = true;
594
- }
595
- } unset($ip);
596
- }
597
- }
598
-
599
- if($sfw->test){
600
- $sfw->sfw_die($apbct->api_key, '', parse_url(get_option('siteurl'),PHP_URL_HOST), 'test');
601
- }
602
-
603
- if($sfw->pass === false){
604
- foreach($sfw->blocked_ips as $ip){
605
- $sfw->logs__update($ip['ip'], 'blocked');
606
- }
607
- $apbct->data['sfw_counter']['blocked']++;
608
- $apbct->saveData();
609
- $sfw->sfw_die($apbct->api_key, '', parse_url(get_option('siteurl'),PHP_URL_HOST));
610
- }else{
611
- reset($sfw->passed_ips);
612
- if(!empty($apbct->settings['set_cookies']) && !headers_sent() && key($sfw->passed_ips))
613
- setcookie ('ct_sfw_pass_key', md5($sfw->passed_ips[key($sfw->passed_ips)]['ip'].$apbct->api_key), time()+86400*30, '/', parse_url(get_option('siteurl'),PHP_URL_HOST) ,false);
614
- }
615
- }
616
- unset($is_sfw_check, $sfw, $sfw_ip, $ct_cur_ip);
617
- }
618
-
619
- /**
620
- * On activation, set a time, frequency and name of an action hook to be scheduled.
621
- */
622
- function apbct_activation( $network = false ) {
623
-
624
- global $wpdb;
625
-
626
- // SFW data
627
- $sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sfw` (
628
- `network` int(11) unsigned NOT NULL,
629
- `mask` int(11) unsigned NOT NULL,
630
- INDEX ( `network` , `mask` )
631
- );';
632
-
633
- // SFW log
634
- $sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sfw_logs` (
635
- `ip` VARCHAR(15) NOT NULL,
636
- `all_entries` INT NOT NULL,
637
- `blocked_entries` INT NOT NULL,
638
- `entries_timestamp` INT NOT NULL,
639
- PRIMARY KEY (`ip`));';
640
-
641
- // Sessions
642
- $sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sessions` (
643
- `id` VARCHAR(64) NOT NULL,
644
- `name` VARCHAR(40) NOT NULL,
645
- `value` TEXT NULL DEFAULT NULL,
646
- `last_update` DATETIME NULL DEFAULT NULL,
647
- PRIMARY KEY (`name`(40), `id`(64)));';
648
-
649
- if($network && !defined('CLEANTALK_ACCESS_KEY')){
650
- $initial_blog = get_current_blog_id();
651
- $blogs = array_keys($wpdb->get_results('SELECT blog_id FROM '. $wpdb->blogs, OBJECT_K));
652
- foreach ($blogs as $blog) {
653
- switch_to_blog($blog);
654
- apbct_activation__create_tables($sqls);
655
- // Cron tasks
656
- CleantalkCron::addTask('check_account_status', 'ct_account_status_check', 3600, time()+1800); // Checks account status
657
- CleantalkCron::addTask('delete_spam_comments', 'ct_delete_spam_comments', 3600, time()+3500); // Formerly ct_hourly_event_hook()
658
- CleantalkCron::addTask('send_feedback', 'ct_send_feedback', 3600, time()+3500); // Formerly ct_hourly_event_hook()
659
- CleantalkCron::addTask('sfw_update', 'ct_sfw_update', 86400, time()+300); // SFW update
660
- CleantalkCron::addTask('send_sfw_logs', 'ct_sfw_send_logs', 3600, time()+1800); // SFW send logs
661
- CleantalkCron::addTask('get_brief_data', 'cleantalk_get_brief_data', 86400, time()+3500); // Get data for dashboard widget
662
- CleantalkCron::addTask('send_connection_report','ct_mail_send_connection_report', 86400, time()+3500); // Send connection report to welcome@cleantalk.org
663
- }
664
- switch_to_blog($initial_blog);
665
- }else{
666
-
667
- // Cron tasks
668
- CleantalkCron::addTask('check_account_status', 'ct_account_status_check', 3600, time()+1800); // Checks account status
669
- CleantalkCron::addTask('delete_spam_comments', 'ct_delete_spam_comments', 3600, time()+3500); // Formerly ct_hourly_event_hook()
670
- CleantalkCron::addTask('send_feedback', 'ct_send_feedback', 3600, time()+3500); // Formerly ct_hourly_event_hook()
671
- CleantalkCron::addTask('sfw_update', 'ct_sfw_update', 86400, time()+43200); // SFW update
672
- CleantalkCron::addTask('send_sfw_logs', 'ct_sfw_send_logs', 3600, time()+1800); // SFW send logs
673
- CleantalkCron::addTask('get_brief_data', 'cleantalk_get_brief_data', 86400, time()+3500); // Get data for dashboard widget
674
- CleantalkCron::addTask('send_connection_report','ct_mail_send_connection_report', 86400, time()+3500); // Send connection report to welcome@cleantalk.org
675
-
676
- apbct_activation__create_tables($sqls);
677
- ct_sfw_update(); // Updating SFW
678
- ct_account_status_check(null, false);
679
- }
680
-
681
- // Additional options
682
- add_option('ct_plugin_do_activation_redirect', true);
683
- }
684
-
685
- function apbct_activation__create_tables($sqls) {
686
- global $wpdb;
687
- $wpdb->show_errors = false;
688
- foreach($sqls as $sql){
689
- $sql = sprintf($sql, $wpdb->prefix); // Adding current blog prefix
690
- $result = $wpdb->query($sql);
691
- if($result === false)
692
- $errors[] = "Failed.\nQuery: {$wpdb->last_query}\nError: {$wpdb->last_error}";
693
- }
694
- $wpdb->show_errors = true;
695
-
696
- // Logging errors
697
- if(!empty($errors))
698
- apbct_log($errors);
699
- }
700
-
701
- function apbct_activation__new_blog($blog_id, $user_id, $domain, $path, $site_id, $meta) {
702
- if (apbct_is_plugin_active_for_network('cleantalk-spam-protect/cleantalk.php')){
703
-
704
- switch_to_blog($blog_id);
705
-
706
- global $wpdb;
707
-
708
- // SFW data
709
- $sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sfw` (
710
- `network` int(11) unsigned NOT NULL,
711
- `mask` int(11) unsigned NOT NULL,
712
- INDEX ( `network` , `mask` )
713
- );';
714
-
715
- // SFW log
716
- $sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sfw_logs` (
717
- `ip` VARCHAR(15) NOT NULL,
718
- `all_entries` INT NOT NULL,
719
- `blocked_entries` INT NOT NULL,
720
- `entries_timestamp` INT NOT NULL,
721
- PRIMARY KEY (`ip`));';
722
-
723
- // Sessions
724
- $sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sessions` (
725
- `id` VARCHAR(64) NOT NULL,
726
- `name` TEXT NOT NULL,
727
- `value` TEXT NULL DEFAULT NULL,
728
- `last_update` DATETIME NULL DEFAULT NULL,
729
- PRIMARY KEY (`id`(64), `name`(64)));';
730
-
731
- // Cron tasks
732
- CleantalkCron::addTask('check_account_status', 'ct_account_status_check', 3600, time()+1800); // Checks account status
733
- CleantalkCron::addTask('delete_spam_comments', 'ct_delete_spam_comments', 3600, time()+3500); // Formerly ct_hourly_event_hook()
734
- CleantalkCron::addTask('send_feedback', 'ct_send_feedback', 3600, time()+3500); // Formerly ct_hourly_event_hook()
735
- CleantalkCron::addTask('sfw_update', 'ct_sfw_update', 86400, time()+43200); // SFW update
736
- CleantalkCron::addTask('send_sfw_logs', 'ct_sfw_send_logs', 3600, time()+1800); // SFW send logs
737
- CleantalkCron::addTask('get_brief_data', 'cleantalk_get_brief_data', 86400, time()+3500); // Get data for dashboard widget
738
- CleantalkCron::addTask('send_connection_report','ct_mail_send_connection_report', 86400, time()+3500); // Send connection report to welcome@cleantalk.org
739
- apbct_activation__create_tables($sqls);
740
- ct_sfw_update(); // Updating SFW
741
- ct_account_status_check(null, false);
742
- restore_current_blog();
743
- }
744
- }
745
-
746
- /**
747
- * On deactivation, clear schedule.
748
- */
749
- function apbct_deactivation( $network ) {
750
-
751
- global $apbct, $wpdb;
752
-
753
- // Deactivation for network
754
- if(is_multisite() && $network){
755
-
756
- $initial_blog = get_current_blog_id();
757
- $blogs = array_keys($wpdb->get_results('SELECT blog_id FROM '. $wpdb->blogs, OBJECT_K));
758
- foreach ($blogs as $blog) {
759
- switch_to_blog($blog);
760
- apbct_deactivation__delete_blog_tables();
761
- delete_option('cleantalk_cron'); // Deleting cron entries
762
-
763
- if($apbct->settings['complete_deactivation']){
764
- apbct_deactivation__delete_all_options();
765
- apbct_deactivation__delete_all_options__in_network();
766
- }
767
-
768
- }
769
- switch_to_blog($initial_blog);
770
-
771
- // Deactivation for blog
772
- }elseif(is_multisite()){
773
-
774
- apbct_deactivation__delete_common_tables();
775
- delete_option('cleantalk_cron'); // Deleting cron entries
776
-
777
- if($apbct->settings['complete_deactivation'])
778
- apbct_deactivation__delete_all_options();
779
-
780
- // Deactivation on standalone blog
781
- }elseif(!is_multisite()){
782
-
783
- apbct_deactivation__delete_common_tables();
784
- delete_option('cleantalk_cron'); // Deleting cron entries
785
-
786
- if($apbct->settings['complete_deactivation'])
787
- apbct_deactivation__delete_all_options();
788
-
789
- }
790
- }
791
-
792
- /**
793
- * Delete all cleantalk_* entries from _options table
794
- */
795
- function apbct_deactivation__delete_all_options(){
796
- delete_option('cleantalk_settings');
797
- delete_option('cleantalk_data');
798
- delete_option('cleantalk_cron');
799
- delete_option('cleantalk_errors');
800
- delete_option('cleantalk_remote_calls');
801
- delete_option('cleantalk_server');
802
- delete_option('cleantalk_stats');
803
- delete_option('cleantalk_timelabel_reg');
804
- }
805
-
806
- /**
807
- * Delete all cleantalk_* entries from _sitemeta table
808
- */
809
- function apbct_deactivation__delete_all_options__in_network(){
810
- delete_site_option('cleantalk_network_settings');
811
- delete_site_option('cleantalk_network_data');
812
- }
813
-
814
- function apbct_deactivation__delete_common_tables() {
815
- global $wpdb;
816
- $wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->base_prefix.'cleantalk_sfw`;'); // Deleting SFW data
817
- $wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->base_prefix.'cleantalk_sfw_logs`;'); // Deleting SFW logs
818
- $wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->base_prefix.'cleantalk_sessions`;'); // Deleting session table
819
- }
820
-
821
- function apbct_deactivation__delete_blog_tables() {
822
- global $wpdb;
823
- $wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->prefix.'cleantalk_sfw`;'); // Deleting SFW data
824
- $wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->prefix.'cleantalk_sfw_logs`;'); // Deleting SFW logs
825
- $wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->prefix.'cleantalk_sessions`;'); // Deleting session table
826
- }
827
-
828
- /**
829
- * Redirects admin to plugin settings after activation.
830
- */
831
- function apbct_plugin_redirect()
832
- {
833
- global $apbct;
834
- if (get_option('ct_plugin_do_activation_redirect', false) && !isset($_GET['activate-multi'])){
835
- delete_option('ct_plugin_do_activation_redirect');
836
- wp_redirect($apbct->settings_link);
837
- }
838
- }
839
-
840
- function ct_add_event($event_type)
841
- {
842
- global $apbct, $cleantalk_executed;
843
-
844
- //
845
- // To migrate on the new version of ct_add_event().
846
- //
847
- switch ($event_type) {
848
- case '0': $event_type = 'no';break;
849
- case '1': $event_type = 'yes';break;
850
- }
851
-
852
- $current_hour = intval(date('G'));
853
-
854
- // Updating current hour
855
- if($current_hour!=$apbct->data['current_hour']){
856
- $apbct->data['current_hour'] = $current_hour;
857
- $apbct->data['array_accepted'][$current_hour] = 0;
858
- $apbct->data['array_blocked'][$current_hour] = 0;
859
- }
860
-
861
- //Add 1 to counters
862
- if($event_type=='yes'){
863
- $apbct->data['array_accepted'][$current_hour]++;
864
- $apbct->data['all_time_counter']['accepted']++;
865
- $apbct->data['user_counter']['accepted']++;
866
- }
867
- if($event_type=='no'){
868
- $apbct->data['array_blocked'][$current_hour]++;
869
- $apbct->data['all_time_counter']['blocked']++;
870
- $apbct->data['user_counter']['blocked']++;
871
- }
872
-
873
- $apbct->saveData();
874
-
875
- $cleantalk_executed=true;
876
- }
877
-
878
- /**
879
- * return new cookie value
880
- */
881
- function ct_get_cookie()
882
- {
883
- global $ct_checkjs_def;
884
- $ct_checkjs_key = ct_get_checkjs_value();
885
- print $ct_checkjs_key;
886
- die();
887
- }
888
-
889
- function ct_sfw_update($immediate = false){
890
-
891
- global $apbct;
892
-
893
- if($apbct->settings['spam_firewall'] == 1){
894
-
895
- $sfw = new CleantalkSFW();
896
-
897
- $file_url = isset($_GET['file_url']) ? $_GET['file_url'] : null;
898
- $result = $sfw->sfw_update($apbct->api_key, $file_url, $immediate);
899
-
900
- if(empty($result['error'])){
901
- $apbct->stats['sfw']['last_update_time'] = time();
902
- $apbct->stats['sfw']['entries'] = $result;
903
- $apbct->save('stats');
904
- }
905
-
906
- return $result;
907
- }
908
-
909
- return array('error' => 'SFW_DISABLED');
910
-
911
- }
912
-
913
- function ct_sfw_send_logs()
914
- {
915
- global $apbct;
916
-
917
- if($apbct->settings['spam_firewall'] == 1){
918
-
919
- $sfw = new CleantalkSFW();
920
- $result = $sfw->logs__send($apbct->api_key);
921
-
922
- if(empty($result['error'])){
923
- $apbct->stats['sfw']['last_send_time'] = time();
924
- $apbct->stats['sfw']['last_send_amount'] = $result['rows'];
925
- $apbct->save('stats');
926
- }
927
-
928
- return $result;
929
-
930
- }
931
-
932
- return array('error' => 'SFW_DISABLED');
933
- }
934
-
935
- /**
936
- * Wrapper for Cleantalk's remote calls
937
- *
938
- * @param string $action What you want to do?
939
- * @param array $additional_params Additional GET parameters for RC
940
- * @param string $presets Presets for CleantalkHelper::http__request(). 'async' maybe?
941
- * @param string $plugin_name Plugin name 'antispam' by default
942
- * @param string $call_token RC securirty token
943
- * @param string $url Current site URL by default
944
- *
945
- * @return array|bool
946
- */
947
- function apbct_rc__send($action, $additional_params = array(), $presets = 'get', $plugin_name = 'antispam', $call_token = '', $url = ''){
948
-
949
- global $apbct;
950
-
951
- $default_params = array(
952
- 'plugin_name' => $plugin_name,
953
- 'spbc_remote_call_token' => $call_token ? $call_token : md5($apbct->api_key),
954
- 'spbc_remote_call_action' => $action,
955
- );
956
-
957
- $params = array_merge($additional_params, $default_params);
958
-
959
- return apbct_rc__parse_result(
960
- CleantalkHelper::http__request(
961
- $url ? $url : get_option('siteurl'),
962
- $params,
963
- $presets
964
- )
965
- );
966
- }
967
-
968
- /**
969
- * Parse different types of remote call results
970
- *
971
- * @param array|string $rc_result
972
- * string - 'FAIL {"some":"result}'
973
- * string - 'OK {"some":"result}'
974
- *
975
- * @return array|string
976
- */
977
- function apbct_rc__parse_result($rc_result){
978
- if(is_string($rc_result)){
979
- $rc_result = preg_replace('/^(OK\s?|FAIL\s?)(.*)/', '$2', $rc_result, 1);
980
- $rc_result = json_decode($rc_result, true);
981
- $rc_result = $rc_result
982
- ? $rc_result
983
- : array('error' => 'FAIL_TO_PARSE_RC_RESULT');
984
- }
985
- return $rc_result;
986
- }
987
-
988
- /**
989
- * Install plugin from wordpress catalog
990
- *
991
- * @param WP $wp
992
- * @param string $plugin_slug
993
- */
994
- function apbct_rc__install_plugin($wp = null, $plugin = null){
995
- global $wp_version;
996
-
997
- $plugin = $plugin ? $plugin : (isset($_GET['plugin']) ? $_GET['plugin'] : null);
998
-
999
- if($plugin){
1000
-
1001
- if(preg_match('/[a-zA-Z-\d]+[\/\\][a-zA-Z-\d]+\.php/', $plugin)){
1002
-
1003
- $plugin_slug = preg_replace('@([a-zA-Z-\d]+)[\\\/].*@', '$1', $plugin);
1004
-
1005
- if($plugin_slug){
1006
-
1007
- require_once(ABSPATH.'wp-admin/includes/plugin-install.php');
1008
- $result = plugins_api(
1009
- 'plugin_information',
1010
- array(
1011
- 'slug' => $plugin_slug,
1012
- 'fileds' => array('version' => true, 'download_link' => true,),
1013
- )
1014
- );
1015
-
1016
- if(!is_wp_error($result)){
1017
-
1018
- require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
1019
- include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
1020
- include_once( ABSPATH . 'wp-admin/includes/file.php' );
1021
- include_once( ABSPATH . 'wp-admin/includes/misc.php' );
1022
- include_once( CLEANTALK_PLUGIN_DIR . 'lib/CleantalkUpgrader.php' );
1023
- include_once( CLEANTALK_PLUGIN_DIR . 'lib/CleantalkUpgraderSkin.php' );
1024
- include_once( CLEANTALK_PLUGIN_DIR . 'lib/CleantalkUpgraderSkin_Deprecated.php' );
1025
- if (version_compare(PHP_VERSION, '5.6.0') >= 0 && version_compare($wp_version, '5.3') >= 0)
1026
- $installer= new CleantalkUpgrader( new CleantalkUpgraderSkin() );
1027
- else
1028
- $installer= new CleantalkUpgrader( new CleantalkUpgraderSkin_Deprecated() );
1029
- $installer->install($result->download_link);
1030
-
1031
- if($installer->apbct_result === 'OK'){
1032
- die('OK');
1033
-
1034
- }else
1035
- die('FAIL '. json_encode(array('error' => $installer->apbct_result)));
1036
- }else
1037
- die('FAIL '. json_encode(array('error' => 'FAIL_TO_GET_LATEST_VERSION', 'details' => $result->get_error_message(),)));
1038
- }else
1039
- die('FAIL '. json_encode(array('error' => 'PLUGIN_SLUG_INCORRECT')));
1040
- }else
1041
- die('FAIL '. json_encode(array('error' => 'PLUGIN_NAME_IS_INCORRECT')));
1042
- }else
1043
- die('FAIL '. json_encode(array('error' => 'PLUGIN_NAME_IS_UNSET')));
1044
- }
1045
-
1046
- function apbct_rc__activate_plugin($plugin){
1047
-
1048
- $plugin = $plugin ? $plugin : (isset($_GET['plugin']) ? $_GET['plugin'] : null);
1049
-
1050
- if($plugin){
1051
-
1052
- if(preg_match('@[a-zA-Z-\d]+[\\\/][a-zA-Z-\d]+\.php@', $plugin)){
1053
-
1054
- require_once (ABSPATH .'/wp-admin/includes/plugin.php');
1055
-
1056
- $result = activate_plugins($plugin);
1057
-
1058
- if($result && !is_wp_error($result)){
1059
- return array('success' => true);
1060
- }else
1061
- return array('error' => 'FAIL_TO_ACTIVATE', 'details' => (is_wp_error($result) ? ' '.$result->get_error_message() : ''));
1062
- }else
1063
- return array('error' => 'PLUGIN_NAME_IS_INCORRECT');
1064
- }else
1065
- return array('error' => 'PLUGIN_NAME_IS_UNSET');
1066
- }
1067
-
1068
- /**
1069
- * Uninstall plugin from wordpress catalog
1070
- *
1071
- * @param null $plugin_name
1072
- */
1073
- function apbct_rc__deactivate_plugin($plugin = null){
1074
-
1075
- global $apbct;
1076
-
1077
- $plugin = $plugin ? $plugin : (isset($_GET['plugin']) ? $_GET['plugin'] : null);
1078
-
1079
- if($plugin){
1080
-
1081
- // Switching complete deactivation for security
1082
- if($plugin == 'security-malware-firewall/security-malware-firewall.php' && !empty($_GET['complete_deactivation'])){
1083
- $spbc_settings = get_option('spbc_settings');
1084
- $spbc_settings['complete_deactivation'] = intval($_GET['complete_deactivation']);
1085
- update_option('spbc_settings', $spbc_settings);
1086
- }
1087
-
1088
- require_once (ABSPATH .'/wp-admin/includes/plugin.php');
1089
-
1090
- if(is_plugin_active( $plugin )){
1091
- // Hook to set flag if the plugin is deactivated
1092
- add_action( 'deactivate_'.$plugin, 'apbct_rc__uninstall_plugin__check_deactivate' );
1093
- deactivate_plugins($plugin, false, is_multisite() ? true : false);
1094
- }else{
1095
- $apbct->plugin_deactivated = true;
1096
- }
1097
-
1098
- // Hook to set flag if the plugin is deactivated
1099
- add_action( 'deactivate_'.$plugin, 'apbct_rc__uninstall_plugin__check_deactivate' );
1100
- deactivate_plugins($plugin, false, is_multisite() ? true : false);
1101
-
1102
- if($apbct->plugin_deactivated){
1103
- die('OK');
1104
- }else
1105
- die('FAIL '. json_encode(array('error' => 'PLUGIN_STILL_ACTIVE')));
1106
- }else
1107
- die('FAIL '. json_encode(array('error' => 'PLUGIN_NAME_IS_UNSET')));
1108
- }
1109
-
1110
-
1111
- /**
1112
- * Uninstall plugin from wordpress. Delete files.
1113
- *
1114
- * @param null $plugin
1115
- */
1116
- function apbct_rc__uninstall_plugin($plugin = null){
1117
-
1118
- global $apbct;
1119
-
1120
- $plugin = $plugin ? $plugin : (isset($_GET['plugin']) ? $_GET['plugin'] : null);
1121
-
1122
- if($plugin){
1123
-
1124
- // Switching complete deactivation for security
1125
- if($plugin == 'security-malware-firewall/security-malware-firewall.php' && !empty($_GET['complete_deactivation'])){
1126
- $spbc_settings = get_option('spbc_settings');
1127
- $spbc_settings['complete_deactivation'] = intval($_GET['complete_deactivation']);
1128
- update_option('spbc_settings', $spbc_settings);
1129
- }
1130
-
1131
- require_once (ABSPATH .'/wp-admin/includes/plugin.php');
1132
-
1133
- if(is_plugin_active( $plugin )){
1134
- // Hook to set flag if the plugin is deactivated
1135
- add_action( 'deactivate_'.$plugin, 'apbct_rc__uninstall_plugin__check_deactivate' );
1136
- deactivate_plugins($plugin, false, is_multisite() ? true : false);
1137
- }else{
1138
- $apbct->plugin_deactivated = true;
1139
- }
1140
-
1141
- if($apbct->plugin_deactivated){
1142
-
1143
- require_once (ABSPATH .'/wp-admin/includes/file.php');
1144
-
1145
- $result = delete_plugins(array($plugin));
1146
-
1147
- if($result && !is_wp_error($result)){
1148
- die('OK');
1149
- }else
1150
- die('FAIL '. json_encode(array('error' => 'PLUGIN_STILL_EXISTS', 'details' => (is_wp_error($result) ? ' '.$result->get_error_message() : ''))));
1151
- }else
1152
- die('FAIL '. json_encode(array('error' => 'PLUGIN_STILL_ACTIVE')));
1153
- }else
1154
- die('FAIL '. json_encode(array('error' => 'PLUGIN_NAME_IS_UNSET')));
1155
- }
1156
-
1157
- function apbct_rc__uninstall_plugin__check_deactivate(){
1158
- global $apbct;
1159
- $apbct->plugin_deactivated = true;
1160
- }
1161
-
1162
- function apbct_rc__update(){
1163
- global $wp_version;
1164
-
1165
- //Upgrade params
1166
- $plugin = 'cleantalk-spam-protect/cleantalk.php';
1167
- $plugin_slug = 'cleantalk-spam-protect';
1168
- $title = __('Update Plugin');
1169
- $nonce = 'upgrade-plugin_' . $plugin;
1170
- $url = 'update.php?action=upgrade-plugin&plugin=' . urlencode( $plugin );
1171
- $activate_for_network = false;
1172
- if( APBCT_WPMS && is_main_site() && array_key_exists( $plugin, get_site_option( 'active_sitewide_plugins' ) ) ) {
1173
- $activate_for_network = true;
1174
- }
1175
-
1176
- $prev_version = APBCT_VERSION;
1177
-
1178
- require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
1179
- include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
1180
- include_once( ABSPATH . 'wp-admin/includes/file.php' );
1181
- include_once( ABSPATH . 'wp-admin/includes/misc.php' );
1182
-
1183
- include_once( CLEANTALK_PLUGIN_DIR . 'lib/CleantalkUpgrader.php' );
1184
- include_once( CLEANTALK_PLUGIN_DIR . 'lib/CleantalkUpgraderSkin.php' );
1185
- include_once( CLEANTALK_PLUGIN_DIR . 'lib/CleantalkUpgraderSkin_Deprecated.php' );
1186
-
1187
- apbct_maintance_mode__enable( 30 );
1188
- if (version_compare(PHP_VERSION, '5.6.0') >= 0 && version_compare($wp_version, '5.3') >= 0)
1189
- $upgrader = new CleantalkUpgrader( new CleantalkUpgraderSkin( compact('title', 'nonce', 'url', 'plugin') ) );
1190
- else
1191
- $upgrader = new CleantalkUpgrader( new CleantalkUpgraderSkin_Deprecated( compact('title', 'nonce', 'url', 'plugin') ) );
1192
- $upgrader->upgrade($plugin);
1193
-
1194
- apbct_maintance_mode__disable();
1195
-
1196
- $result = activate_plugins( $plugin, '', $activate_for_network );
1197
-
1198
- // Changing response UP_TO_DATE to OK
1199
- if($upgrader->apbct_result === 'UP_TO_DATE')
1200
- $upgrader->apbct_result = 'OK';
1201
-
1202
- if($upgrader->apbct_result === 'OK'){
1203
-
1204
- if(is_wp_error($result)){
1205
- die('FAIL '. json_encode(array('error' => 'COULD_NOT_ACTIVATE', 'wp_error' => $result->get_error_message())));
1206
- }
1207
-
1208
- $httpResponseCode = CleantalkHelper::http__request(get_option('siteurl'), array(), 'get_code');
1209
-
1210
- if( strpos($httpResponseCode, '200') === false ){
1211
-
1212
- apbct_maintance_mode__enable( 30 );
1213
-
1214
- // Rollback
1215
- if (version_compare(PHP_VERSION, '5.6.0') >= 0 && version_compare($wp_version, '5.3') >= 0)
1216
- $rollback = new CleantalkUpgrader( new CleantalkUpgraderSkin( compact('title', 'nonce', 'url', 'plugin_slug', 'prev_version') ) );
1217
- else
1218
- $rollback = new CleantalkUpgrader( new CleantalkUpgraderSkin_Deprecated( compact('title', 'nonce', 'url', 'plugin_slug', 'prev_version') ) );
1219
- $rollback->rollback($plugin);
1220
-
1221
- apbct_maintance_mode__disable();
1222
-
1223
- $response = array(
1224
- 'error' => 'BAD_HTTP_CODE',
1225
- 'http_code' => $httpResponseCode,
1226
- 'output' => substr(file_get_contents(get_option('siteurl')), 0, 900),
1227
- 'rollback_result' => $rollback->apbct_result,
1228
- );
1229
-
1230
- die('FAIL '.json_encode($response));
1231
- }
1232
-
1233
- $plugin_data = get_plugin_data(__FILE__);
1234
- $apbct_agent = 'wordpress-'.str_replace('.', '', $plugin_data['Version']);
1235
- ct_send_feedback('0:' . $apbct_agent);
1236
-
1237
- die('OK '.json_encode(array('agent' => $apbct_agent)));
1238
-
1239
- }else{
1240
- die('FAIL '. json_encode(array('error' => $upgrader->apbct_result)));
1241
- }
1242
- }
1243
-
1244
- function apbct_rc__update_settings($source) {
1245
-
1246
- global $apbct;
1247
-
1248
- foreach($apbct->def_settings as $setting => $def_value){
1249
- if(array_key_exists($setting, $source)){
1250
- $var = $source[$setting];
1251
- $type = gettype($def_value);
1252
- settype($var, $type);
1253
- if($type == 'string')
1254
- $var = preg_replace(array('/=/', '/`/'), '', $var);
1255
- $apbct->settings[$setting] = $var;
1256
- }
1257
- }
1258
-
1259
- $apbct->save('settings');
1260
-
1261
- return true;
1262
- }
1263
-
1264
- function apbct_rc__insert_auth_key($key, $plugin){
1265
-
1266
- global $apbct;
1267
-
1268
- if($plugin === 'security-malware-firewall/security-malware-firewall.php'){
1269
-
1270
- require_once (ABSPATH .'/wp-admin/includes/plugin.php');
1271
-
1272
- if(is_plugin_active( $plugin )){
1273
-
1274
- $key = trim($key);
1275
-
1276
- if($key && preg_match('/^[a-z\d]{3,15}$/', $key)){
1277
-
1278
- $result = CleantalkAPI::method__notice_paid_till(
1279
- $key,
1280
- preg_replace('/http[s]?:\/\//', '', get_option('siteurl'), 1), // Site URL
1281
- 'security'
1282
- );
1283
-
1284
- if( empty( $result['error'] ) ) {
1285
-
1286
- if( $result['valid'] ){
1287
-
1288
- // Set account params
1289
- $data = get_option('spbc_data', array());
1290
- $data['user_token'] = $result['user_token'];
1291
- $data['notice_show'] = $result['show_notice'];
1292
- $data['notice_renew'] = $result['renew'];
1293
- $data['notice_trial'] = $result['trial'];
1294
- $data['auto_update_app'] = isset($result['show_auto_update_notice']) ? $result['show_auto_update_notice'] : 0;
1295
- $data['service_id'] = $result['service_id'];
1296
- $data['moderate'] = $result['moderate'];
1297
- $data['auto_update_app '] = isset($result['auto_update_app']) ? $result['auto_update_app'] : 0;
1298
- $data['license_trial'] = isset($result['license_trial']) ? $result['license_trial'] : 0;
1299
- $data['account_name_ob'] = isset($result['account_name_ob']) ? $result['account_name_ob'] : '';
1300
- $data['key_is_ok'] = true;
1301
- update_option('spbc_data', $data);
1302
-
1303
- // Set key
1304
- $settings = get_option('spbc_settings', array());
1305
- $settings['spbc_key'] = $key;
1306
- update_option('spbc_settings', $settings);
1307
-
1308
- return 'OK';
1309
- }else
1310
- return array('error' => 'KEY_IS_NOT_VALID');
1311
- }else
1312
- return array('error' => $result);
1313
- }else
1314
- return array('error' => 'KEY_IS_NOT_CORRECT');
1315
- }else
1316
- return array('error' => 'PLUGIN_IS_NOT_ACTIVE_OR_NOT_INSTALLED');
1317
- }else
1318
- return array('error' => 'PLUGIN_SLUG_INCORRECT');
1319
- }
1320
-
1321
- /**
1322
- * Putting Wordpress to maintenance mode.
1323
- * For given duration in seconds
1324
- *
1325
- * @param $duration
1326
- *
1327
- * @return bool
1328
- */
1329
- function apbct_maintance_mode__enable( $duration ) {
1330
- apbct_maintance_mode__disable();
1331
- $content = "<?php\n\n"
1332
- . '$upgrading = ' . (time() - ( 60 * 10 ) + $duration) . ';';
1333
-
1334
- return (bool)file_put_contents( ABSPATH . '.maintenance', $content );
1335
- }
1336
-
1337
- /**
1338
- * Disabling maintenance mode by deleting .maintenance file.
1339
- *
1340
- * @return void
1341
- */
1342
- function apbct_maintance_mode__disable() {
1343
- $maintenance_file = ABSPATH . '.maintenance';
1344
- if ( file_exists( $maintenance_file ) ) {
1345
- unlink( $maintenance_file );
1346
- }
1347
- }
1348
-
1349
- function cleantalk_get_brief_data(){
1350
-
1351
- global $apbct;
1352
-
1353
- $apbct->data['brief_data'] = CleantalkAPI::method__get_antispam_report_breif($apbct->api_key);
1354
- $apbct->saveData();
1355
-
1356
- return;
1357
- }
1358
-
1359
- //Delete cookie for admin trial notice
1360
- function apbct__hook__wp_logout__delete_trial_notice_cookie(){
1361
- if(!headers_sent())
1362
- setcookie('ct_trial_banner_closed', '', time()-3600);
1363
- }
1364
-
1365
- function apbct_alt_session__id__get(){
1366
- $id = CleantalkHelper::ip__get(array('real'))
1367
- .apbct_get_server_variable( 'HTTP_USER_AGENT' )
1368
- .apbct_get_server_variable( 'HTTP_ACCEPT_LANGUAGE' );
1369
- return hash('sha256', $id);
1370
- }
1371
-
1372
- function apbct_alt_sessions__remove_old(){
1373
- if(rand(0, 1000) < APBCT_SEESION__CHANCE_TO_CLEAN){
1374
- global $wpdb;
1375
- $wpdb->query(
1376
- 'DELETE
1377
- FROM `'. APBCT_TBL_SESSIONS .'`
1378
- WHERE last_update < NOW() - INTERVAL '. APBCT_SEESION__LIVE_TIME .' SECOND
1379
- LIMIT 100000;'
1380
- );
1381
- }
1382
- }
1383
-
1384
- function apbct_alt_session__save($name, $value){
1385
-
1386
- global $wpdb;
1387
-
1388
- $session_id = apbct_alt_session__id__get();
1389
-
1390
- $wpdb->query(
1391
- $wpdb->prepare(
1392
- 'INSERT INTO '. APBCT_TBL_SESSIONS .'
1393
- (id, name, value, last_update)
1394
- VALUES (%s, %s, %s, %s)
1395
- ON DUPLICATE KEY UPDATE
1396
- value = %s,
1397
- last_update = %s',
1398
- $session_id, $name, $value, date('Y-m-d H:i:s'), $value, date('Y-m-d H:i:s')
1399
- )
1400
- );
1401
-
1402
- }
1403
-
1404
- function apbct_alt_session__get($name){
1405
- global $wpdb;
1406
- $session_id = apbct_alt_session__id__get();
1407
- $result = $wpdb->get_row(
1408
- $wpdb->prepare(
1409
- 'SELECT value
1410
- FROM `'. APBCT_TBL_SESSIONS .'`
1411
- WHERE id = %s AND name = %s;',
1412
- $session_id, $name
1413
- ),
1414
- OBJECT
1415
- );
1416
-
1417
- $result = isset($result->value)
1418
- ? strpos($result->value, '{') === 0
1419
- ? (array)json_decode($result->value, true) // JSON
1420
- : $result->value
1421
- : false;
1422
-
1423
- return $result ? $result : null;
1424
- }
1425
-
1426
- function apbct_store__urls(){
1427
-
1428
- global $apbct;
1429
-
1430
- if($apbct->settings['store_urls'] && empty($apbct->flags__url_stored) && !headers_sent()){
1431
-
1432
- // URLs HISTORY
1433
- // Get current url
1434
- $current_url = apbct_get_server_variable( 'HTTP_HOST' ) . apbct_get_server_variable( 'REQUEST_URI' );
1435
-
1436
- $current_url = $current_url ? substr($current_url, 0,256) : 'UNKNOWN';
1437
-
1438
- // Get already stored URLs
1439
- $urls = $apbct->settings['store_urls__sessions']
1440
- ? (array)apbct_alt_session__get('apbct_urls')
1441
- : (array)json_decode(filter_input(INPUT_COOKIE, 'apbct_urls'), true);
1442
-
1443
- $urls[$current_url][] = time();
1444
-
1445
- // Rotating. Saving only latest 10
1446
- $urls[$current_url] = count($urls[$current_url]) > 10 ? array_slice($urls[$current_url], 1, 10) : $urls[$current_url];
1447
- $urls = count($urls) > 10 ? array_slice($urls, 1, 10) : $urls;
1448
-
1449
- // Saving
1450
- $apbct->settings['store_urls__sessions']
1451
- ? apbct_alt_session__save('apbct_urls', json_encode($urls))
1452
- : apbct_cookie__set('apbct_urls', json_encode($urls), time()+86400*3, '/', parse_url(get_option('siteurl'),PHP_URL_HOST), false, true, 'Lax');
1453
-
1454
- // REFERER
1455
- // Get current fererer
1456
- $new_site_referer = apbct_get_server_variable( 'HTTP_REFERER' );
1457
- $new_site_referer = $new_site_referer ? $new_site_referer : 'UNKNOWN';
1458
-
1459
- // Get already stored referer
1460
- $site_referer = $apbct->settings['store_urls__sessions']
1461
- ? apbct_alt_session__get('apbct_site_referer')
1462
- : filter_input(INPUT_COOKIE, 'apbct_site_referer');
1463
-
1464
- // Save if empty
1465
- if( !$site_referer || parse_url($new_site_referer, PHP_URL_HOST) !== apbct_get_server_variable( 'HTTP_HOST' ) ){
1466
-
1467
- $apbct->settings['store_urls__sessions']
1468
- ? apbct_alt_session__save('apbct_site_referer', $new_site_referer)
1469
- : apbct_cookie__set('apbct_site_referer', $new_site_referer, time()+86400*3, '/', parse_url(get_option('siteurl'),PHP_URL_HOST), false, true, 'Lax');
1470
- }
1471
-
1472
- $apbct->flags__url_stored = true;
1473
-
1474
- }
1475
- }
1476
-
1477
- function apbct_cookie__set($name, $value = '', $expires = 0, $path = '', $domain = null, $secure = false, $httponly = false, $samesite = null ){
1478
-
1479
- // For PHP 7.3+ and above
1480
- if( version_compare( phpversion(), '7.3.0', '>=' ) ){
1481
-
1482
- $params = array(
1483
- 'expires' => $expires,
1484
- 'path' => $path,
1485
- 'domain' => $domain,
1486
- 'secure' => $secure,
1487
- 'httponly' => $httponly,
1488
- );
1489
-
1490
- if($samesite)
1491
- $params['samesite'] = $samesite;
1492
-
1493
- setcookie( $name, $value, $params );
1494
-
1495
- // For PHP 5.6 - 7.2
1496
- }else
1497
- setcookie( $name, $value, $expires, $path, $domain, $secure, $httponly );
1498
- }
1499
-
1500
- /*
1501
- * Set Cookies test for cookie test
1502
- * Sets cookies with pararms timestamp && landing_timestamp && pervious_referer
1503
- * Sets test cookie with all other cookies
1504
- */
1505
- function apbct_cookie(){
1506
-
1507
- global $apbct;
1508
-
1509
- if($apbct->settings['store_urls__sessions'] || $apbct->settings['set_cookies__sessions'])
1510
- apbct_alt_sessions__remove_old();
1511
-
1512
- if(
1513
- empty($apbct->settings['set_cookies']) || // Do not set cookies if option is disabled (for Varnish cache).
1514
- !empty($apbct->flags__cookies_setuped) || // Cookies already set
1515
- !empty($apbct->headers_sent) // Headers sent
1516
- )
1517
- return false;
1518
-
1519
- // Prevent headers sent error
1520
- if(headers_sent($file, $line)){
1521
- $apbct->headers_sent = true;
1522
- $apbct->headers_sent__hook = current_action();
1523
- $apbct->headers_sent__where = $file.':'.$line;
1524
- return false;
1525
- }
1526
-
1527
-
1528
- // Cookie names to validate
1529
- $cookie_test_value = array(
1530
- 'cookies_names' => array(),
1531
- 'check_value' => $apbct->api_key,
1532
- );
1533
-
1534
- $domain = parse_url(get_option('siteurl'),PHP_URL_HOST);
1535
-
1536
- // Submit time
1537
- if(empty($_POST['ct_multipage_form'])){ // Do not start/reset page timer if it is multipage form (Gravitiy forms))
1538
- $apbct_timestamp = time();
1539
- $apbct->settings['set_cookies__sessions']
1540
- ? apbct_alt_session__save('apbct_timestamp', $apbct_timestamp)
1541
- : apbct_cookie__set('apbct_timestamp', $apbct_timestamp, 0, '/', $domain, false, true, 'Lax' );
1542
- $cookie_test_value['cookies_names'][] = 'apbct_timestamp';
1543
- $cookie_test_value['check_value'] .= $apbct_timestamp;
1544
- }
1545
-
1546
- // Pervious referer
1547
- if(apbct_get_server_variable( 'HTTP_REFERER' )){
1548
- $apbct->settings['set_cookies__sessions']
1549
- ? apbct_alt_session__save('apbct_prev_referer', apbct_get_server_variable( 'HTTP_REFERER' ))
1550
- : apbct_cookie__set('apbct_prev_referer', apbct_get_server_variable( 'HTTP_REFERER' ), 0, '/', $domain, false, true, 'Lax' );
1551
- $cookie_test_value['cookies_names'][] = 'apbct_prev_referer';
1552
- $cookie_test_value['check_value'] .= apbct_get_server_variable( 'HTTP_REFERER' );
1553
- }
1554
-
1555
- // Landing time
1556
- $site_landing_timestamp = $apbct->settings['set_cookies__sessions']
1557
- ? apbct_alt_session__get('apbct_site_landing_ts')
1558
- : filter_input(INPUT_COOKIE, 'apbct_site_landing_ts');
1559
- if(!$site_landing_timestamp){
1560
- $site_landing_timestamp = time();
1561
- $apbct->settings['set_cookies__sessions']
1562
- ? apbct_alt_session__save('apbct_site_landing_ts', $site_landing_timestamp)
1563
- : apbct_cookie__set('apbct_site_landing_ts', $site_landing_timestamp, 0, '/', $domain, false, true, 'Lax' );
1564
- }
1565
- $cookie_test_value['cookies_names'][] = 'apbct_site_landing_ts';
1566
- $cookie_test_value['check_value'] .= $site_landing_timestamp;
1567
-
1568
- // Page hits
1569
- // Get
1570
- $page_hits = $apbct->settings['set_cookies__sessions']
1571
- ? apbct_alt_session__get('apbct_page_hits')
1572
- : filter_input(INPUT_COOKIE, 'apbct_page_hits');
1573
- // Set / Increase
1574
- $page_hits = intval($page_hits) ? $page_hits + 1 : 1;
1575
-
1576
- $apbct->settings['set_cookies__sessions']
1577
- ? apbct_alt_session__save('apbct_page_hits', $page_hits)
1578
- : apbct_cookie__set('apbct_page_hits', $page_hits, 0, '/', $domain, false, true, 'Lax' );
1579
-
1580
- $cookie_test_value['cookies_names'][] = 'apbct_page_hits';
1581
- $cookie_test_value['check_value'] .= $page_hits;
1582
-
1583
- // Cookies test
1584
- $cookie_test_value['check_value'] = md5($cookie_test_value['check_value']);
1585
- if(!$apbct->settings['set_cookies__sessions'])
1586
- apbct_cookie__set('apbct_cookies_test', urlencode(json_encode($cookie_test_value)), 0, '/', $domain, false, true, 'Lax' );
1587
-
1588
- $apbct->flags__cookies_setuped = true;
1589
-
1590
- }
1591
-
1592
- /**
1593
- * Cookies test for sender
1594
- * Also checks for valid timestamp in $_COOKIE['apbct_timestamp'] and other apbct_ COOKIES
1595
- * @return null|0|1;
1596
- */
1597
- function apbct_cookies_test()
1598
- {
1599
- global $apbct;
1600
-
1601
- if($apbct->settings['set_cookies__sessions'])
1602
- return 1;
1603
-
1604
- if(isset($_COOKIE['apbct_cookies_test'])){
1605
-
1606
- $cookie_test = json_decode(urldecode($_COOKIE['apbct_cookies_test']),true);
1607
-
1608
- if(!is_array($cookie_test))
1609
- return 0;
1610
-
1611
- $check_srting = $apbct->api_key;
1612
- foreach($cookie_test['cookies_names'] as $cookie_name){
1613
- $check_srting .= isset($_COOKIE[$cookie_name]) ? $_COOKIE[$cookie_name] : '';
1614
- } unset($cookie_name);
1615
-
1616
- if($cookie_test['check_value'] == md5($check_srting)){
1617
- return 1;
1618
- }else{
1619
- return 0;
1620
- }
1621
- }else{
1622
- return null;
1623
- }
1624
- }
1625
-
1626
- function apbct_cookies__delete($cookie){
1627
- if(isset($_COOKIE[$cookie]))
1628
- setcookie($cookie, '', time()-3600);
1629
- }
1630
-
1631
- function apbct_cookies__delete_all(){
1632
- if(count($_COOKIE)){
1633
- foreach($_COOKIE as $key => $val){
1634
- if(preg_match("/apbct_|ct_/", $key)){
1635
- setcookie($key, '', time()-3600);
1636
- }
1637
- } unset($key, $val);
1638
- }
1639
- return false;
1640
- }
1641
-
1642
- /**
1643
- * Gets submit time
1644
- * Uses Cookies with check via apbct_cookies_test()
1645
- * @return null|int;
1646
- */
1647
- function apbct_get_submit_time()
1648
- {
1649
- global $apbct;
1650
- $apbct_timestamp = $apbct->settings['set_cookies__sessions']
1651
- ? apbct_alt_session__get('apbct_timestamp')
1652
- : filter_input(INPUT_COOKIE, 'apbct_timestamp');
1653
- return apbct_cookies_test() == 1 ? time() - (int)$apbct_timestamp : null;
1654
- }
1655
-
1656
- /*
1657
- * Inner function - Account status check
1658
- * Scheduled in 1800 seconds for default!
1659
- */
1660
- function ct_account_status_check($api_key = null, $process_errors = true){
1661
-
1662
- global $apbct;
1663
-
1664
- $api_key = $api_key ? $api_key : $apbct->api_key;
1665
- $result = CleantalkAPI::method__notice_paid_till(
1666
- $api_key,
1667
- preg_replace('/http[s]?:\/\//', '', get_option('siteurl'), 1),
1668
- 'antispam'
1669
- );
1670
-
1671
- if(empty($result['error']) || !empty($result['valid'])){
1672
-
1673
- // Notices
1674
- $apbct->data['notice_show'] = isset($result['show_notice']) ? (int)$result['show_notice'] : 0;
1675
- $apbct->data['notice_renew'] = isset($result['renew']) ? (int)$result['renew'] : 0;
1676
- $apbct->data['notice_trial'] = isset($result['trial']) ? (int)$result['trial'] : 0;
1677
- $apbct->data['notice_review'] = isset($result['show_review']) ? (int)$result['show_review'] : 0;
1678
- $apbct->data['notice_auto_update'] = isset($result['show_auto_update_notice']) ? (int)$result['show_auto_update_notice'] : 0;
1679
-
1680
- // Other
1681
- $apbct->data['service_id'] = isset($result['service_id']) ? (int)$result['service_id'] : 0;
1682
- $apbct->data['valid'] = isset($result['valid']) ? (int)$result['valid'] : 0;
1683
- $apbct->data['moderate'] = isset($result['moderate']) ? (int)$result['moderate'] : 0;
1684
- $apbct->data['ip_license'] = isset($result['ip_license']) ? (int)$result['ip_license'] : 0;
1685
- $apbct->data['moderate_ip'] = isset($result['moderate_ip'], $result['ip_license']) ? (int)$result['moderate_ip'] : 0;
1686
- $apbct->data['spam_count'] = isset($result['spam_count']) ? (int)$result['spam_count'] : 0;
1687
- $apbct->data['auto_update'] = isset($result['auto_update_app']) ? (int)$result['auto_update_app'] : 0;
1688
- $apbct->data['user_token'] = isset($result['user_token']) ? (string)$result['user_token'] : '';
1689
- $apbct->data['license_trial'] = isset($result['license_trial']) ? (int)$result['license_trial'] : 0;
1690
- $apbct->data['account_name_ob'] = isset($result['account_name_ob']) ? (string)$result['account_name_ob'] : '';
1691
-
1692
- if($apbct->data['notice_show'] == 1 && $apbct->data['notice_trial'] == 1)
1693
- CleantalkCron::updateTask('check_account_status', 'ct_account_status_check', 3600);
1694
-
1695
- if($apbct->data['notice_show'] == 1 && $apbct->data['notice_renew'] == 1)
1696
- CleantalkCron::updateTask('check_account_status', 'ct_account_status_check', 1800);
1697
-
1698
- if($apbct->data['notice_show'] == 0)
1699
- CleantalkCron::updateTask('check_account_status', 'ct_account_status_check', 86400);
1700
-
1701
- $apbct->error_delete('account_check', 'save');
1702
-
1703
- $apbct->saveData();
1704
-
1705
- }elseif($process_errors){
1706
- $apbct->error_add('account_check', $result);
1707
- }
1708
-
1709
- if(!empty($result['valid'])){
1710
- $apbct->data['key_is_ok'] = true;
1711
- $result = true;
1712
- }else{
1713
- $apbct->data['key_is_ok'] = false;
1714
- $result = false;
1715
- }
1716
-
1717
- return $result;
1718
- }
1719
-
1720
- function ct_mail_send_connection_report() {
1721
-
1722
- global $apbct;
1723
-
1724
- if (($apbct->settings['send_connection_reports'] == 1 && $apbct->connection_reports['negative'] > 0) || !empty($_GET['ct_send_connection_report']))
1725
- {
1726
- $to = "welcome@cleantalk.org" ;
1727
- $subject = "Connection report for " . apbct_get_server_variable( 'HTTP_HOST' );
1728
- $message = '
1729
- <html>
1730
- <head>
1731
- <title></title>
1732
- </head>
1733
- <body>
1734
- <p>From '.$apbct->connection_reports['since'].' to '.date('d M').' has been made '.($apbct->connection_reports['success']+$apbct->connection_reports['negative']).' calls, where '.$apbct->connection_reports['success'].' were success and '.$apbct->connection_reports['negative'].' were negative</p>
1735
- <p>Negative report:</p>
1736
- <table> <tr>
1737
- <td>&nbsp;</td>
1738
- <td><b>Date</b></td>
1739
- <td><b>Page URL</b></td>
1740
- <td><b>Library report</b></td>
1741
- <td><b>Server IP</b></td>
1742
- </tr>
1743
- ';
1744
- foreach ($apbct->connection_reports['negative_report'] as $key => $report)
1745
- {
1746
- $message.= '<tr>'
1747
- . '<td>'.($key+1).'.</td>'
1748
- . '<td>'.$report['date'].'</td>'
1749
- . '<td>'.$report['page_url'].'</td>'
1750
- . '<td>'.$report['lib_report'].'</td>'
1751
- . '<td>'.$report['work_url'].'</td>'
1752
- . '</tr>';
1753
- }
1754
- $message.='</table></body></html>';
1755
-
1756
- $headers = 'Content-type: text/html; charset=windows-1251 \r\n';
1757
- $headers .= 'From: '.get_option('admin_email');
1758
- mail($to, $subject, $message, $headers);
1759
- }
1760
-
1761
- $apbct->data['connection_reports'] = $apbct->def_data['connection_reports'];
1762
- $apbct->data['connection_reports']['since'] = date('d M');
1763
- $apbct->saveData();
1764
- }
1765
-
1766
- //* Write $message to the plugin's debug option
1767
- function apbct_log($message = 'empty', $func = null, $params = array())
1768
- {
1769
- global $apbct;
1770
-
1771
- $debug = get_option( APBCT_DEBUG );
1772
-
1773
- $function = $func ? $func : '';
1774
- $cron = in_array('cron', $params) ? true : false;
1775
- $data = in_array('data', $params) ? true : false;
1776
- $settings = in_array('settings', $params) ? true : false;
1777
-
1778
- if(is_array($message) or is_object($message))
1779
- $message = print_r($message, true);
1780
-
1781
- if($message) $debug[date("H:i:s", microtime(true))."_ACTION_".strval(current_action())."_FUNCTION_".strval($func)] = $message;
1782
- if($cron) $debug[date("H:i:s", microtime(true))."_ACTION_".strval(current_action())."_FUNCTION_".strval($func).'_cron'] = $apbct->cron;
1783
- if($data) $debug[date("H:i:s", microtime(true))."_ACTION_".strval(current_action())."_FUNCTION_".strval($func).'_data'] = $apbct->data;
1784
- if($settings) $debug[date("H:i:s", microtime(true))."_ACTION_".strval(current_action())."_FUNCTION_".strval($func).'_settings'] = $apbct->settings;
1785
-
1786
- update_option(APBCT_DEBUG, $debug);
1787
- }
1788
-
1789
- function apbct_sfw__delete_tables( $blog_id, $drop ) {
1790
-
1791
- global $wpdb;
1792
-
1793
- $initial_blog = get_current_blog_id();
1794
-
1795
- switch_to_blog($blog_id);
1796
- $wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->prefix.'cleantalk_sfw`;'); // Deleting SFW data
1797
- $wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->prefix.'cleantalk_sfw_logs`;'); // Deleting SFW logs
1798
-
1799
- switch_to_blog($initial_blog);
1800
- }
1801
-
1802
- /**
1803
- * Is enable for user group
1804
- *
1805
- * @param WP_User $user
1806
- *
1807
- * @return boolean
1808
- */
1809
- function apbct_is_user_enable($user = null) {
1810
-
1811
- global $current_user;
1812
-
1813
- $user = !empty($user) ? $user : $current_user;
1814
-
1815
- return apbct_is_user_role_in(array('administrator', 'editor', 'author'), $user)
1816
- ? false
1817
- : true;
1818
- }
1819
-
1820
- /**
1821
- * Checks if the current user has role
1822
- *
1823
- * @param array $roles array of strings
1824
- * @param int|string|WP_User|mixed $user User ID to check|user_login|WP_User
1825
- *
1826
- * @return boolean Does the user has this role|roles
1827
- */
1828
- function apbct_is_user_role_in( $roles, $user = false ){
1829
-
1830
- if( is_numeric($user) && function_exists('get_userdata')) $user = get_userdata( $user );
1831
- if( is_string($user) && function_exists('get_user_by')) $user = get_user_by('login', $user );
1832
- if( ! $user && function_exists('wp_get_current_user')) $user = wp_get_current_user();
1833
- if( ! $user ) $user = apbct_wp_get_current_user();
1834
-
1835
- if( empty($user->ID) )
1836
- return false;
1837
-
1838
- foreach( (array) $roles as $role ){
1839
- if( isset($user->caps[ strtolower($role) ]) || in_array(strtolower($role), $user->roles) )
1840
- return true;
1841
- }
1842
-
1843
- return false;
1844
- }
1845
-
1846
- /**
1847
- * Update and rotate statistics with requests exection time
1848
- *
1849
- * @param $exec_time
1850
- */
1851
- function apbct_statistics__rotate($exec_time){
1852
-
1853
- global $apbct;
1854
-
1855
- // Delete old stats
1856
- if(min(array_keys($apbct->stats['requests'])) < time() - (86400 * 7))
1857
- unset($apbct->stats['requests'][min(array_keys($apbct->stats['requests']))]);
1858
-
1859
- // Create new if newest older than 1 day
1860
- if(empty($apbct->stats['requests']) || max(array_keys($apbct->stats['requests'])) < time() - (86400 * 1))
1861
- $apbct->stats['requests'][time()] = array('amount' => 0, 'average_time' => 0);
1862
-
1863
- // Update all existing stats
1864
- foreach($apbct->stats['requests'] as &$weak_stat){
1865
- $weak_stat['average_time'] = ($weak_stat['average_time'] * $weak_stat['amount'] + $exec_time) / ++$weak_stat['amount'];
1866
- }
1867
-
1868
- $apbct->save('stats');
1869
- }
1870
-
1871
- /**
1872
- * Runs update actions for new version.
1873
- *
1874
- * @global CleantalkState $apbct
1875
- */
1876
- function apbct_update_actions(){
1877
-
1878
- global $apbct;
1879
-
1880
- // Update logic
1881
- if($apbct->plugin_version != APBCT_VERSION){
1882
-
1883
- // Main blog
1884
- if(is_main_site()){
1885
-
1886
- require_once(CLEANTALK_PLUGIN_DIR.'inc/cleantalk-updater.php');
1887
-
1888
- $result = apbct_run_update_actions($apbct->plugin_version, APBCT_VERSION);
1889
-
1890
- //If update is successfull
1891
- if($result === true)
1892
- apbct_update__set_version__from_plugin('from_plugin');
1893
-
1894
- ct_send_feedback('0:' . APBCT_AGENT ); // Send feedback to let cloud know about updated version.
1895
-
1896
- // Side blogs
1897
- }else{
1898
- apbct_update__set_version__from_plugin('from_plugin');
1899
- }
1900
- }
1901
-
1902
- }
1903
-
1904
- /**
1905
- * Set version of plugin in database
1906
- *
1907
- * @param string $ver
1908
- *
1909
- * @return bool
1910
- * @global CleantalkState $apbct
1911
- *
1912
- */
1913
- function apbct_update__set_version__from_plugin($ver){
1914
- global $apbct;
1915
- switch (true){
1916
- case $ver === 'from_plugin':
1917
- $apbct->data['plugin_version'] = APBCT_VERSION;
1918
- break;
1919
- case preg_match('/^\d+\.\d+(\.\d+)?(-[a-zA-Z0-9-_]+)?$/', $ver) === 1;
1920
- $apbct->data['plugin_version'] = $ver;
1921
- break;
1922
- default:
1923
- return false;
1924
- break;
1925
- }
1926
- $apbct->saveData();
1927
- return true;
1928
- }
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: Anti-Spam by CleanTalk
4
+ Plugin URI: https://cleantalk.org
5
+ 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.
6
+ Version: 5.133.1
7
+ Author: СleanTalk <welcome@cleantalk.org>
8
+ Author URI: https://cleantalk.org
9
+ Text Domain: cleantalk
10
+ Domain Path: /i18n
11
+ */
12
+
13
+ $cleantalk_executed = false;
14
+
15
+ // Getting version form main file (look above)
16
+ $plugin_info = get_file_data(__FILE__, array('Version' => 'Version', 'Name' => 'Plugin Name',));
17
+
18
+ // Common params
19
+ define('APBCT_NAME', $plugin_info['Name']);
20
+ define('APBCT_VERSION', $plugin_info['Version']);
21
+ define('APBCT_URL_PATH', plugins_url('', __FILE__)); //HTTP path. Plugin root folder without '/'.
22
+ define('APBCT_DIR_PATH', dirname(__FILE__ ) . '/'); //System path. Plugin root folder with '/'.
23
+ define('APBCT_PLUGIN_BASE_NAME', plugin_basename(__FILE__)); //Plugin base name.
24
+ define('APBCT_CASERT_PATH', file_exists(ABSPATH . WPINC . '/certificates/ca-bundle.crt') ? ABSPATH . WPINC . '/certificates/ca-bundle.crt' : ''); // SSL Serttificate path
25
+
26
+ // API params
27
+ define('APBCT_AGENT', 'wordpress-'.str_replace('.', '', $plugin_info['Version']));
28
+ define('APBCT_MODERATE_URL', 'http://moderate.cleantalk.org'); //Api URL
29
+
30
+ // Option names
31
+ define('APBCT_DATA', 'cleantalk_data'); //Option name with different plugin data.
32
+ define('APBCT_SETTINGS', 'cleantalk_settings'); //Option name with plugin settings.
33
+ define('APBCT_NETWORK_SETTINGS', 'cleantalk_network_settings'); //Option name with plugin network settings.
34
+ define('APBCT_DEBUG', 'cleantalk_debug'); //Option name with a debug data. Empty by default.
35
+
36
+ // Multisite
37
+ define('APBCT_WPMS', (is_multisite() ? true : false)); // WMPS is enabled
38
+
39
+ // Sessions
40
+ define('APBCT_SEESION__LIVE_TIME', 86400*2);
41
+ define('APBCT_SEESION__CHANCE_TO_CLEAN', 100);
42
+
43
+ // Different params
44
+ define('APBCT_REMOTE_CALL_SLEEP', 5); // Minimum time between remote call
45
+
46
+ if( !defined( 'CLEANTALK_PLUGIN_DIR' ) ){
47
+
48
+ define('CLEANTALK_PLUGIN_DIR', dirname(__FILE__ ) . '/');
49
+
50
+ // PHP functions patches
51
+ require_once(CLEANTALK_PLUGIN_DIR . 'lib/cleantalk-php-patch.php'); // Pathces fpr different functions which not exists
52
+
53
+ // Base classes
54
+ require_once(CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/Antispam/API.php'); // API
55
+ require_once(CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/Antispam/DB.php'); // Database driver
56
+ require_once(CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/Antispam/Helper.php'); // Helper
57
+ include_once(CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/Antispam/SFW.php'); // SpamFireWall
58
+ include_once(CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/Arr.php'); // Array functions
59
+
60
+ // Child classes
61
+ require_once(CLEANTALK_PLUGIN_DIR . 'lib/CleantalkAPI.php'); // API for Wordpress
62
+ require_once(CLEANTALK_PLUGIN_DIR . 'lib/CleantalkDB.php'); // Database class for Wordpress
63
+ require_once(CLEANTALK_PLUGIN_DIR . 'lib/CleantalkHelper.php'); // Helper for Worpdress
64
+ include_once(CLEANTALK_PLUGIN_DIR . "lib/CleantalkSFW.php"); // SpamFireWall for Wordpress
65
+
66
+ require_once(CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk.php'); // Main class for request
67
+ require_once(CLEANTALK_PLUGIN_DIR . 'lib/CleantalkRequest.php'); // Holds request data
68
+ require_once(CLEANTALK_PLUGIN_DIR . 'lib/CleantalkResponse.php'); // Holds response data
69
+
70
+ require_once(CLEANTALK_PLUGIN_DIR . 'lib/CleantalkCron.php'); // Cron handling
71
+ require_once(CLEANTALK_PLUGIN_DIR . 'lib/CleantalkState.php'); // State class
72
+ require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-pluggable.php'); // Pluggable functions
73
+ require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-common.php');
74
+
75
+ // Global ArrayObject with settings and other global varables
76
+ global $apbct;
77
+ $apbct = new CleantalkState('cleantalk', array('settings', 'data', 'debug', 'errors', 'remote_calls', 'stats'));
78
+
79
+ $apbct->base_name = 'cleantalk-spam-protect/cleantalk.php';
80
+
81
+ $apbct->logo = plugin_dir_url(__FILE__) . 'inc/images/logo.png';
82
+ $apbct->logo__small = plugin_dir_url(__FILE__) . 'inc/images/logo_small.png';
83
+ $apbct->logo__small__colored = plugin_dir_url(__FILE__) . 'inc/images/logo_color.png';
84
+
85
+ // Customize CleantalkState
86
+ // Account status
87
+
88
+ $apbct->white_label = $apbct->network_settings['white_label'];
89
+ $apbct->allow_custom_key = $apbct->network_settings['allow_custom_key'];
90
+ $apbct->plugin_name = $apbct->network_settings['white_label__plugin_name'] ? $apbct->network_settings['white_label__plugin_name'] : APBCT_NAME;
91
+ $apbct->api_key = !APBCT_WPMS || $apbct->allow_custom_key || $apbct->white_label ? $apbct->settings['apikey'] : $apbct->network_settings['apikey'];
92
+ $apbct->key_is_ok = !APBCT_WPMS || $apbct->allow_custom_key || $apbct->white_label ? $apbct->data['key_is_ok'] : $apbct->network_data['key_is_ok'];
93
+ $apbct->moderate = !APBCT_WPMS || $apbct->allow_custom_key || $apbct->white_label ? $apbct->data['moderate'] : $apbct->network_data['moderate'];
94
+
95
+ $apbct->data['user_counter']['since'] = isset($apbct->data['user_counter']['since']) ? $apbct->data['user_counter']['since'] : date('d M');
96
+ $apbct->data['connection_reports']['since'] = isset($apbct->data['connection_reports']['since']) ? $apbct->data['user_counter']['since'] : date('d M');
97
+
98
+ $apbct->settings_link = is_network_admin() ? 'settings.php?page=cleantalk' : 'options-general.php?page=cleantalk';
99
+
100
+ if(!$apbct->white_label){
101
+ require_once( CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-widget.php');
102
+ }
103
+
104
+ // Disabling comments
105
+ if($apbct->settings['disable_comments__all'] || $apbct->settings['disable_comments__posts'] || $apbct->settings['disable_comments__pages'] || $apbct->settings['disable_comments__media']){
106
+ require_once(CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/Templates/Singleton.php');
107
+ require_once(CLEANTALK_PLUGIN_DIR . 'lib/Cleantalk/DisableComments.php');
108
+ \Cleantalk\DisableComments::getInstance();
109
+ }
110
+
111
+ // Passing JS key to frontend
112
+ add_action('wp_ajax_apbct_js_keys__get', 'apbct_js_keys__get__ajax');
113
+ add_action('wp_ajax_nopriv_apbct_js_keys__get', 'apbct_js_keys__get__ajax');
114
+
115
+ // Database prefix
116
+ global $wpdb;
117
+ $apbct->db_prefix = !APBCT_WPMS || $apbct->allow_custom_key || $apbct->white_label ? $wpdb->prefix : $wpdb->base_prefix;
118
+ $apbct->db_prefix = !$apbct->white_label && defined('CLEANTALK_ACCESS_KEY') ? $wpdb->base_prefix : $wpdb->prefix;
119
+ // Database constants
120
+ define('APBCT_TBL_FIREWALL_DATA', $apbct->db_prefix . 'cleantalk_sfw'); // Table with firewall data.
121
+ define('APBCT_TBL_FIREWALL_LOG', $apbct->db_prefix . 'cleantalk_sfw_logs'); // Table with firewall logs.
122
+ define('APBCT_TBL_SESSIONS', $apbct->db_prefix . 'cleantalk_sessions'); // Table with session data.
123
+ define('APBCT_SPAMSCAN_LOGS', $apbct->db_prefix . 'cleantalk_spamscan_logs'); // Table with session data.
124
+ define('APBCT_SELECT_LIMIT', 5000); // Select limit for logs.
125
+ define('APBCT_WRITE_LIMIT', 5000); // Write limit for firewall data.
126
+
127
+ /** @todo HARDCODE FIX */
128
+ if($apbct->plugin_version === '1.0.0')
129
+ $apbct->plugin_version = '5.100';
130
+
131
+ // Do update actions if version is changed
132
+ apbct_update_actions();
133
+
134
+ // Self cron
135
+ if(!defined('DOING_CRON') || (defined('DOING_CRON') && DOING_CRON !== true)){
136
+
137
+ $ct_cron = new CleantalkCron();
138
+ $ct_cron->checkTasks();
139
+
140
+ if(!empty($ct_cron->tasks_to_run)){
141
+
142
+ define('CT_CRON', true); // Letting know functions that they are running under CT_CRON
143
+ $ct_cron->runTasks();
144
+ unset($ct_cron);
145
+
146
+ }
147
+ }
148
+
149
+ //Delete cookie for admin trial notice
150
+ add_action('wp_logout', 'apbct__hook__wp_logout__delete_trial_notice_cookie');
151
+
152
+ // Set cookie only for public pages and for non-AJAX requests
153
+ if (!is_admin() && !apbct_is_ajax() && !defined('DOING_CRON')
154
+ && empty($_POST['ct_checkjs_register_form']) // Buddy press registration fix
155
+ && empty($_GET['ct_checkjs_search_default']) // Search form fix
156
+ && empty($_POST['action']) //bbPress
157
+ ){
158
+ add_action('template_redirect','apbct_cookie', 2);
159
+ add_action('template_redirect','apbct_store__urls', 2);
160
+ if (empty($_POST) && empty($_GET)){
161
+ apbct_cookie();
162
+ apbct_store__urls();
163
+ }
164
+ }
165
+
166
+ // Early checks
167
+
168
+ // Iphorm
169
+ if( isset( $_POST['iphorm_ajax'], $_POST['iphorm_id'], $_POST['iphorm_uid'] ) ){
170
+ require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
171
+ require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-ajax.php');
172
+ ct_ajax_hook();
173
+ }
174
+
175
+ // Facebook
176
+ if ($apbct->settings['general_contact_forms_test'] == 1
177
+ && (!empty($_POST['action']) && $_POST['action'] == 'fb_intialize')
178
+ && !empty($_POST['FB_userdata'])
179
+ ){
180
+ require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
181
+ if (apbct_is_user_enable()){
182
+ $ct_check_post_result=false;
183
+ ct_registration_errors(null);
184
+ }
185
+
186
+ }
187
+
188
+ // Ninja Forms. Making GET action to POST action
189
+ if( apbct_is_in_uri( 'admin-ajax.php' ) && sizeof($_POST) > 0 && isset($_GET['action']) && $_GET['action']=='ninja_forms_ajax_submit' )
190
+ $_POST['action']='ninja_forms_ajax_submit';
191
+
192
+ add_action( 'wp_ajax_nopriv_ninja_forms_ajax_submit', 'apbct_form__ninjaForms__testSpam', 1);
193
+ add_action( 'wp_ajax_ninja_forms_ajax_submit', 'apbct_form__ninjaForms__testSpam', 1);
194
+ add_action( 'wp_ajax_nopriv_nf_ajax_submit', 'apbct_form__ninjaForms__testSpam', 1);
195
+ add_action( 'wp_ajax_nf_ajax_submit', 'apbct_form__ninjaForms__testSpam', 1);
196
+ add_action( 'ninja_forms_process', 'apbct_form__ninjaForms__testSpam', 1); // Depricated ?
197
+
198
+ // SeedProd Coming Soon Page Pro integration
199
+ add_action( 'wp_ajax_seed_cspv5_subscribe_callback', 'apbct_form__seedprod_coming_soon__testSpam', 1 );
200
+ add_action( 'wp_ajax_nopriv_seed_cspv5_subscribe_callback', 'apbct_form__seedprod_coming_soon__testSpam', 1 );
201
+ add_action( 'wp_ajax_seed_cspv5_contactform_callback', 'apbct_form__seedprod_coming_soon__testSpam', 1 );
202
+ add_action( 'wp_ajax_nopriv_seed_cspv5_contactform_callback', 'apbct_form__seedprod_coming_soon__testSpam', 1 );
203
+
204
+ // The 7 theme contact form integration
205
+ add_action( 'wp_ajax_nopriv_dt_send_mail', 'apbct_form__the7_contact_form', 1 );
206
+ add_action( 'wp_ajax_dt_send_mail', 'apbct_form__the7_contact_form', 1 );
207
+
208
+ // Elementor Pro page builder forms
209
+ add_action( 'wp_ajax_elementor_pro_forms_send_form', 'apbct_form__elementor_pro__testSpam' );
210
+ add_action( 'wp_ajax_nopriv_elementor_pro_forms_send_form', 'apbct_form__elementor_pro__testSpam' );
211
+
212
+ // Custom register form (ticket_id=13668)
213
+ add_action('website_neotrends_signup_fields_check',function( $username, $fields ){
214
+ $ip = CleantalkHelper::ip__get( array('real'), false );
215
+ $ct_result = ct_test_registration( $username, $fields['email'], $ip );
216
+ if( $ct_result['allow'] == 0 ) {
217
+ ct_die_extended( $ct_result['comment'] );
218
+ }
219
+ }, 1, 2);
220
+
221
+ // Public actions
222
+ if(!is_admin() && !apbct_is_ajax()){
223
+
224
+ // Default search
225
+ //add_filter( 'get_search_form', 'apbct_forms__search__addField' );
226
+ add_filter( 'get_search_query', 'apbct_forms__search__testSpam' );
227
+
228
+ // Remote calls
229
+ if(isset($_GET['spbc_remote_call_token'], $_GET['spbc_remote_call_action'], $_GET['plugin_name']) && in_array($_GET['plugin_name'], array('antispam','anti-spam', 'apbct'))){
230
+ apbct_remote_call__perform();
231
+ }
232
+
233
+ // SpamFireWall check
234
+ if( $apbct->plugin_version == APBCT_VERSION && // Do not call with first start
235
+ $apbct->settings['spam_firewall'] == 1 &&
236
+ apbct_is_get() &&
237
+ ! apbct_wp_doing_cron()
238
+ ){
239
+ apbct_sfw__check();
240
+ }
241
+
242
+ }
243
+
244
+
245
+ // Activation/deactivation functions must be in main plugin file.
246
+ // http://codex.wordpress.org/Function_Reference/register_activation_hook
247
+ register_activation_hook( __FILE__, 'apbct_activation' );
248
+ register_deactivation_hook( __FILE__, 'apbct_deactivation' );
249
+
250
+ // Hook for newly added blog
251
+ add_action('wpmu_new_blog', 'apbct_activation__new_blog', 10, 6);
252
+
253
+ // Async loading for JavaScript
254
+ add_filter('script_loader_tag', 'apbct_add_async_attribute', 10, 3);
255
+
256
+ // Redirect admin to plugin settings.
257
+ if(!defined('WP_ALLOW_MULTISITE') || defined('WP_ALLOW_MULTISITE') && WP_ALLOW_MULTISITE == false)
258
+ add_action('admin_init', 'apbct_plugin_redirect');
259
+
260
+ // Deleting SFW tables when deleting websites
261
+ if(defined('WP_ALLOW_MULTISITE') && WP_ALLOW_MULTISITE === true)
262
+ add_action( 'delete_blog', 'apbct_sfw__delete_tables', 10, 2 );
263
+
264
+ // After plugin loaded - to load locale as described in manual
265
+ add_action('plugins_loaded', 'apbct_plugin_loaded' );
266
+
267
+ if( !empty($apbct->settings['use_ajax']) &&
268
+ ! apbct_is_in_uri( '.xml' ) &&
269
+ ! apbct_is_in_uri( '.xsl' ) )
270
+ {
271
+ add_action( 'wp_ajax_nopriv_ct_get_cookie', 'ct_get_cookie',1 );
272
+ add_action( 'wp_ajax_ct_get_cookie', 'ct_get_cookie',1 );
273
+ }
274
+
275
+ // Admin panel actions
276
+ if (is_admin() || is_network_admin()){
277
+
278
+ require_once( CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-find-spam.php' );
279
+ require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-admin.php');
280
+ require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-settings.php');
281
+
282
+ if (!(defined( 'DOING_AJAX' ) && DOING_AJAX)){
283
+
284
+ add_action('admin_enqueue_scripts', 'apbct_admin__enqueue_scripts');
285
+
286
+ add_action('admin_init', 'apbct_admin__init', 1);
287
+ add_action('admin_menu', 'apbct_settings_add_page');
288
+ add_action('network_admin_menu', 'apbct_settings_add_page');
289
+ add_action('admin_notices', 'apbct_admin__notice_message');
290
+ add_action('network_admin_notices', 'apbct_admin__notice_message');
291
+
292
+ //Show widget only if not IP license
293
+ if(!$apbct->moderate_ip)
294
+ add_action('wp_dashboard_setup', 'ct_dashboard_statistics_widget' );
295
+ }
296
+
297
+ if(apbct_is_ajax() || isset($_POST['cma-action'])){
298
+
299
+ $cleantalk_hooked_actions = array();
300
+ $cleantalk_ajax_actions_to_check = array();
301
+
302
+ require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
303
+ require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-ajax.php');
304
+
305
+ // Feedback for comments
306
+ if(isset($_POST['action']) && $_POST['action'] == 'ct_feedback_comment'){
307
+ add_action( 'wp_ajax_nopriv_ct_feedback_comment', 'apbct_comment__send_feedback',1 );
308
+ add_action( 'wp_ajax_ct_feedback_comment', 'apbct_comment__send_feedback',1 );
309
+ }
310
+ if(isset($_POST['action']) && $_POST['action'] == 'ct_feedback_user'){
311
+ add_action( 'wp_ajax_nopriv_ct_feedback_user', 'apbct_user__send_feedback',1 );
312
+ add_action( 'wp_ajax_ct_feedback_user', 'apbct_user__send_feedback',1 );
313
+ }
314
+
315
+ // Check AJAX requests
316
+ // if User is not logged in
317
+ // if Unknown action or Known action with mandatory check
318
+ if( (!apbct_is_user_logged_in() || $apbct->settings['protect_logged_in'] == 1) &&
319
+ isset($_POST['action']) && (!in_array($_POST['action'], $cleantalk_hooked_actions) || in_array($_POST['action'], $cleantalk_ajax_actions_to_check))
320
+ ){
321
+ ct_ajax_hook();
322
+ }
323
+
324
+ //QAEngine Theme answers
325
+ if (intval($apbct->settings['general_contact_forms_test']))
326
+ add_filter('et_pre_insert_question', 'ct_ajax_hook', 1, 1); // Questions
327
+ add_filter('et_pre_insert_answer', 'ct_ajax_hook', 1, 1); // Answers
328
+
329
+ // Formidable
330
+ add_filter( 'frm_entries_before_create', 'apbct_rorm__formidable__testSpam', 10, 2 );
331
+ add_action( 'frm_entries_footer_scripts', 'apbct_rorm__formidable__footerScripts', 20, 2 );
332
+
333
+ // Some of plugins to register a users use AJAX context.
334
+ add_filter('registration_errors', 'ct_registration_errors', 1, 3);
335
+ add_filter('registration_errors', 'ct_check_registration_erros', 999999, 3);
336
+ add_action('user_register', 'apbct_user_register');
337
+
338
+ if(class_exists('BuddyPress')){
339
+ require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
340
+ add_filter('bp_activity_is_spam_before_save', 'apbct_integration__buddyPres__activityWall', 999 ,2); /* ActivityWall */
341
+ add_action('bp_locate_template', 'apbct_integration__buddyPres__getTemplateName', 10, 6);
342
+ }
343
+
344
+ }
345
+
346
+ require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
347
+ //Bitrix24 contact form
348
+ if ($apbct->settings['general_contact_forms_test'] == 1 &&
349
+ !empty($_POST['your-phone']) &&
350
+ !empty($_POST['your-email']) &&
351
+ !empty($_POST['your-message'])
352
+ ){
353
+ $ct_check_post_result=false;
354
+ ct_contact_form_validate();
355
+ }
356
+
357
+ // Sends feedback to the cloud about comments
358
+ // add_action('wp_set_comment_status', 'ct_comment_send_feedback', 10, 2);
359
+
360
+ // Sends feedback to the cloud about deleted users
361
+ global $pagenow;
362
+ if($pagenow=='users.php')
363
+ add_action('delete_user', 'apbct_user__delete__hook', 10, 2);
364
+
365
+ if( $pagenow=='plugins.php' || apbct_is_in_uri( 'plugins.php' ) ){
366
+
367
+ add_filter('plugin_action_links_'.plugin_basename(__FILE__), 'apbct_admin__plugin_action_links', 10, 2);
368
+ add_filter('network_admin_plugin_action_links_'.plugin_basename(__FILE__), 'apbct_admin__plugin_action_links', 10, 2);
369
+
370
+ add_filter('plugin_row_meta', 'apbct_admin__register_plugin_links', 10, 2);
371
+ }
372
+
373
+ // Public pages actions
374
+ }else{
375
+
376
+ require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-public.php');
377
+
378
+ add_action('wp_enqueue_scripts', 'ct_enqueue_scripts_public');
379
+
380
+ // Init action.
381
+ add_action('plugins_loaded', 'apbct_init', 1);
382
+
383
+ // Comments
384
+ add_filter('preprocess_comment', 'ct_preprocess_comment', 1, 1); // param - comment data array
385
+ add_filter('comment_text', 'ct_comment_text' );
386
+ add_filter('wp_die_handler', 'apbct_comment__sanitize_data__before_wp_die', 1); // Check comments after validation
387
+
388
+ // Registrations
389
+ if(!isset($_POST['wp-submit'])){
390
+ add_action('login_form_register', 'apbct_cookie');
391
+ add_action('login_form_register', 'apbct_store__urls');
392
+ }
393
+ add_action('login_enqueue_scripts', 'apbct_login__scripts');
394
+ add_action('register_form', 'ct_register_form');
395
+ add_filter('registration_errors', 'ct_registration_errors', 1, 3);
396
+ add_filter('registration_errors', 'ct_check_registration_erros', 999999, 3);
397
+ add_action('user_register', 'apbct_user_register');
398
+
399
+ // Multisite registrations
400
+ add_action('signup_extra_fields','ct_register_form');
401
+ add_filter('wpmu_validate_user_signup', 'ct_registration_errors_wpmu', 10, 3);
402
+
403
+ // Login form - for notifications only
404
+ add_filter('login_message', 'ct_login_message');
405
+
406
+ // Comments output hook
407
+ add_filter('wp_list_comments_args', 'ct_wp_list_comments_args');
408
+
409
+ // Ait-Themes fix
410
+ if(isset($_GET['ait-action']) && $_GET['ait-action']=='register'){
411
+ $tmp=$_POST['redirect_to'];
412
+ unset($_POST['redirect_to']);
413
+ ct_contact_form_validate();
414
+ $_POST['redirect_to']=$tmp;
415
+ }
416
+ }
417
+
418
+ // Short code for GDPR
419
+ if($apbct->settings['gdpr_enabled'])
420
+ add_shortcode('cleantalk_gdpr_form', 'apbct_shrotcode_handler__GDPR_public_notice__form');
421
+
422
+ }
423
+
424
+ /**
425
+ * Function preforms remote call
426
+ */
427
+ function apbct_remote_call__perform()
428
+ {
429
+ global $apbct;
430
+
431
+ $remote_action = $_GET['spbc_remote_call_action'];
432
+
433
+ if( isset( $apbct->remote_calls[$remote_action] ) ){
434
+ if(time() - $apbct->remote_calls[$remote_action]['last_call'] > APBCT_REMOTE_CALL_SLEEP){
435
+
436
+ $apbct->remote_calls[$remote_action]['last_call'] = time();
437
+ $apbct->save('remote_calls');
438
+
439
+ if(strtolower($_GET['spbc_remote_call_token']) == strtolower(md5($apbct->api_key))){
440
+
441
+ // Flag to let plugin know that Remote Call is running.
442
+ $apbct->rc_running = true;
443
+
444
+ switch ($_GET['spbc_remote_call_action']) {
445
+
446
+ // Close renew banner
447
+ case 'close_renew_banner':
448
+ $apbct->data['notice_trial'] = 0;
449
+ $apbct->data['notice_renew'] = 0;
450
+ $apbct->saveData();
451
+ CleantalkCron::updateTask('check_account_status', 'ct_account_status_check', 86400);
452
+ die('OK');
453
+ break;
454
+
455
+ // SFW update
456
+ case 'sfw_update':
457
+ $result = ct_sfw_update(true);
458
+ /**
459
+ * @todo CRUNCH
460
+ */
461
+ if(is_string($result) && strpos($result, 'FAIL') !== false){
462
+ $result = json_decode(substr($result, 5), true);
463
+ }
464
+ die(empty($result['error']) ? 'OK' : 'FAIL '.json_encode(array('error' => $result['error'])));
465
+ break;
466
+
467
+ // SFW send logs
468
+ case 'sfw_send_logs':
469
+ $result = ct_sfw_send_logs();
470
+ die(empty($result['error']) ? 'OK' : 'FAIL '.json_encode(array('error' => $result['error'])));
471
+ break;
472
+
473
+ // Update plugin
474
+ case 'update_plugin':
475
+ add_action('wp', 'apbct_rc__update', 1);
476
+ break;
477
+
478
+ // Install plugin
479
+ case 'install_plugin':
480
+ add_action('wp', 'apbct_rc__install_plugin', 1);
481
+ break;
482
+ // Activate plugin
483
+ case 'activate_plugin':
484
+ $result = apbct_rc__activate_plugin($_GET['plugin']);
485
+ die(empty($result['error'])
486
+ ? 'OK'
487
+ : 'FAIL '.json_encode(array('error' => $result['error'])));
488
+ break;
489
+
490
+ // Insert API key
491
+ case 'insert_auth_key':
492
+ $result = apbct_rc__insert_auth_key($_GET['auth_key'], $_GET['plugin']);
493
+ die(empty($result['error'])
494
+ ? 'OK'
495
+ : 'FAIL '.json_encode(array('error' => $result['error'])));
496
+ break;
497
+
498
+ // Update settins
499
+ case 'update_settings':
500
+ $result = apbct_rc__update_settings($_GET);
501
+ die(empty($result['error'])
502
+ ? 'OK'
503
+ : 'FAIL '.json_encode(array('error' => $result['error'])));
504
+ break;
505
+ // Deactivate plugin
506
+ case 'deactivate_plugin':
507
+ add_action('plugins_loaded', 'apbct_rc__deactivate_plugin', 1);
508
+ break;
509
+
510
+ // Uninstall plugin
511
+ case 'uninstall_plugin':
512
+ add_action('plugins_loaded', 'apbct_rc__uninstall_plugin', 1);
513
+ break;
514
+ // No action found
515
+ default:
516
+ die('FAIL '.json_encode(array('error' => 'UNKNOWN_ACTION_2')));
517
+ break;
518
+ }
519
+
520
+ }else
521
+ die('FAIL '.json_encode(array('error' => 'WRONG_TOKEN')));
522
+ }else
523
+ die('FAIL '.json_encode(array('error' => 'TOO_MANY_ATTEMPTS')));
524
+ }else
525
+ die('FAIL '.json_encode(array('error' => 'UNKNOWN_ACTION')));
526
+ }
527
+
528
+ /**
529
+ * Function for SpamFireWall check
530
+ */
531
+ function apbct_sfw__check()
532
+ {
533
+ global $apbct, $spbc, $cleantalk_url_exclusions;
534
+
535
+ // Turn off the SpamFireWall if current url in the exceptions list and WordPress core pages
536
+ if (!empty($cleantalk_url_exclusions) && is_array($cleantalk_url_exclusions)) {
537
+ $core_page_to_skip_check = array('/feed');
538
+ foreach (array_merge($cleantalk_url_exclusions, $core_page_to_skip_check) as $v) {
539
+ if ( apbct_is_in_uri( $v ) ) {
540
+ return;
541
+ }
542
+ }
543
+ }
544
+
545
+ // Turn off the SpamFireWall if Remote Call is in progress
546
+ if($apbct->rc_running || (!empty($spbc) && $spbc->rc_running))
547
+ return;
548
+
549
+ $is_sfw_check = true;
550
+ $sfw = new CleantalkSFW();
551
+ $sfw->ip_array = (array)$sfw->ip__get(array('real'), true);
552
+
553
+ // Skip by cookie
554
+ foreach($sfw->ip_array as $ct_cur_ip){
555
+ if(isset($_COOKIE['ct_sfw_pass_key']) && $_COOKIE['ct_sfw_pass_key'] == md5($ct_cur_ip.$apbct->api_key)){
556
+ $is_sfw_check=false;
557
+ if(isset($_COOKIE['ct_sfw_passed'])){
558
+ $sfw->logs__update($ct_cur_ip, 'passed');
559
+ $apbct->data['sfw_counter']['all']++;
560
+ $apbct->saveData();
561
+ if(!headers_sent())
562
+ apbct_cookie__set ('ct_sfw_passed', '0', time()+86400*3, '/', parse_url(get_option('siteurl'),PHP_URL_HOST), false, true, 'Lax' );
563
+ }
564
+ break;
565
+ }else{
566
+ $is_sfw_check = true;
567
+ }
568
+ }
569
+
570
+ // Skip the check
571
+ if(!empty($_GET['access'])){
572
+ $spbc_settings = get_option('spbc_settings');
573
+ $spbc_key = !empty($spbc_settings['spbc_key']) ? $spbc_settings['spbc_key'] : false;
574
+ if($_GET['access'] === $apbct->api_key || ($spbc_key !== false && $_GET['access'] === $spbc_key)){
575
+ $is_sfw_check = false;
576
+ setcookie ('spbc_firewall_pass_key', md5(apbct_get_server_variable( 'REMOTE_ADDR' ) . $spbc_key), time()+1200, '/');
577
+ setcookie ('ct_sfw_pass_key', md5(apbct_get_server_variable( 'REMOTE_ADDR' ) . $apbct->api_key), time()+1200, '/');
578
+ }
579
+ unset($spbc_settings, $spbc_key);
580
+ }
581
+
582
+ if($is_sfw_check){
583
+
584
+ $sfw->ip_check();
585
+
586
+ // Pass remote calls
587
+ if($sfw->pass === false){
588
+ if(isset($_GET['spbc_remote_call_token'], $_GET['spbc_remote_call_action'], $_GET['plugin_name'])){
589
+ foreach($sfw->blocked_ips as $ip){
590
+ $resolved = CleantalkHelper::ip__resolve($ip['ip']);
591
+ if($resolved && preg_match('/cleantalk\.org/', $resolved) === 1 || $resolved === 'back'){
592
+ $sfw->pass = true;
593
+ }
594
+ } unset($ip);
595
+ }
596
+ }
597
+
598
+ if($sfw->test){
599
+ $sfw->sfw_die($apbct->api_key, '', parse_url(get_option('siteurl'),PHP_URL_HOST), 'test');
600
+ }
601
+
602
+ if($sfw->pass === false){
603
+ foreach($sfw->blocked_ips as $ip){
604
+ $sfw->logs__update($ip['ip'], 'blocked');
605
+ }
606
+ $apbct->data['sfw_counter']['blocked']++;
607
+ $apbct->saveData();
608
+ $sfw->sfw_die($apbct->api_key, '', parse_url(get_option('siteurl'),PHP_URL_HOST));
609
+ }else{
610
+ reset($sfw->passed_ips);
611
+ if(!empty($apbct->settings['set_cookies']) && !headers_sent() && key($sfw->passed_ips))
612
+ setcookie ('ct_sfw_pass_key', md5($sfw->passed_ips[key($sfw->passed_ips)]['ip'].$apbct->api_key), time()+86400*30, '/', parse_url(get_option('siteurl'),PHP_URL_HOST) ,false);
613
+ }
614
+ }
615
+ unset($is_sfw_check, $sfw, $sfw_ip, $ct_cur_ip);
616
+ }
617
+
618
+ /**
619
+ * On activation, set a time, frequency and name of an action hook to be scheduled.
620
+ */
621
+ function apbct_activation( $network = false ) {
622
+
623
+ global $wpdb;
624
+
625
+ // SFW data
626
+ $sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sfw` (
627
+ `network` int(11) unsigned NOT NULL,
628
+ `mask` int(11) unsigned NOT NULL,
629
+ INDEX ( `network` , `mask` )
630
+ );';
631
+
632
+ // SFW log
633
+ $sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sfw_logs` (
634
+ `ip` VARCHAR(15) NOT NULL,
635
+ `all_entries` INT NOT NULL,
636
+ `blocked_entries` INT NOT NULL,
637
+ `entries_timestamp` INT NOT NULL,
638
+ PRIMARY KEY (`ip`));';
639
+
640
+ // Sessions
641
+ $sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sessions` (
642
+ `id` VARCHAR(64) NOT NULL,
643
+ `name` VARCHAR(40) NOT NULL,
644
+ `value` TEXT NULL DEFAULT NULL,
645
+ `last_update` DATETIME NULL DEFAULT NULL,
646
+ PRIMARY KEY (`name`(40), `id`(64)));';
647
+
648
+ if($network && !defined('CLEANTALK_ACCESS_KEY')){
649
+ $initial_blog = get_current_blog_id();
650
+ $blogs = array_keys($wpdb->get_results('SELECT blog_id FROM '. $wpdb->blogs, OBJECT_K));
651
+ foreach ($blogs as $blog) {
652
+ switch_to_blog($blog);
653
+ apbct_activation__create_tables($sqls);
654
+ // Cron tasks
655
+ CleantalkCron::addTask('check_account_status', 'ct_account_status_check', 3600, time()+1800); // Checks account status
656
+ CleantalkCron::addTask('delete_spam_comments', 'ct_delete_spam_comments', 3600, time()+3500); // Formerly ct_hourly_event_hook()
657
+ CleantalkCron::addTask('send_feedback', 'ct_send_feedback', 3600, time()+3500); // Formerly ct_hourly_event_hook()
658
+ CleantalkCron::addTask('sfw_update', 'ct_sfw_update', 86400, time()+300); // SFW update
659
+ CleantalkCron::addTask('send_sfw_logs', 'ct_sfw_send_logs', 3600, time()+1800); // SFW send logs
660
+ CleantalkCron::addTask('get_brief_data', 'cleantalk_get_brief_data', 86400, time()+3500); // Get data for dashboard widget
661
+ CleantalkCron::addTask('send_connection_report','ct_mail_send_connection_report', 86400, time()+3500); // Send connection report to welcome@cleantalk.org
662
+ }
663
+ switch_to_blog($initial_blog);
664
+ }else{
665
+
666
+ // Cron tasks
667
+ CleantalkCron::addTask('check_account_status', 'ct_account_status_check', 3600, time()+1800); // Checks account status
668
+ CleantalkCron::addTask('delete_spam_comments', 'ct_delete_spam_comments', 3600, time()+3500); // Formerly ct_hourly_event_hook()
669
+ CleantalkCron::addTask('send_feedback', 'ct_send_feedback', 3600, time()+3500); // Formerly ct_hourly_event_hook()
670
+ CleantalkCron::addTask('sfw_update', 'ct_sfw_update', 86400, time()+43200); // SFW update
671
+ CleantalkCron::addTask('send_sfw_logs', 'ct_sfw_send_logs', 3600, time()+1800); // SFW send logs
672
+ CleantalkCron::addTask('get_brief_data', 'cleantalk_get_brief_data', 86400, time()+3500); // Get data for dashboard widget
673
+ CleantalkCron::addTask('send_connection_report','ct_mail_send_connection_report', 86400, time()+3500); // Send connection report to welcome@cleantalk.org
674
+
675
+ apbct_activation__create_tables($sqls);
676
+ ct_sfw_update(); // Updating SFW
677
+ ct_account_status_check(null, false);
678
+ }
679
+
680
+ // Additional options
681
+ add_option('ct_plugin_do_activation_redirect', true);
682
+ }
683
+
684
+ function apbct_activation__create_tables($sqls) {
685
+ global $wpdb;
686
+ $wpdb->show_errors = false;
687
+ foreach($sqls as $sql){
688
+ $sql = sprintf($sql, $wpdb->prefix); // Adding current blog prefix
689
+ $result = $wpdb->query($sql);
690
+ if($result === false)
691
+ $errors[] = "Failed.\nQuery: {$wpdb->last_query}\nError: {$wpdb->last_error}";
692
+ }
693
+ $wpdb->show_errors = true;
694
+
695
+ // Logging errors
696
+ if(!empty($errors))
697
+ apbct_log($errors);
698
+ }
699
+
700
+ function apbct_activation__new_blog($blog_id, $user_id, $domain, $path, $site_id, $meta) {
701
+ if (apbct_is_plugin_active_for_network('cleantalk-spam-protect/cleantalk.php')){
702
+
703
+ switch_to_blog($blog_id);
704
+
705
+ global $wpdb;
706
+
707
+ // SFW data
708
+ $sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sfw` (
709
+ `network` int(11) unsigned NOT NULL,
710
+ `mask` int(11) unsigned NOT NULL,
711
+ INDEX ( `network` , `mask` )
712
+ );';
713
+
714
+ // SFW log
715
+ $sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sfw_logs` (
716
+ `ip` VARCHAR(15) NOT NULL,
717
+ `all_entries` INT NOT NULL,
718
+ `blocked_entries` INT NOT NULL,
719
+ `entries_timestamp` INT NOT NULL,
720
+ PRIMARY KEY (`ip`));';
721
+
722
+ // Sessions
723
+ $sqls[] = 'CREATE TABLE IF NOT EXISTS `%scleantalk_sessions` (
724
+ `id` VARCHAR(64) NOT NULL,
725
+ `name` TEXT NOT NULL,
726
+ `value` TEXT NULL DEFAULT NULL,
727
+ `last_update` DATETIME NULL DEFAULT NULL,
728
+ PRIMARY KEY (`id`(64), `name`(64)));';
729
+
730
+ // Cron tasks
731
+ CleantalkCron::addTask('check_account_status', 'ct_account_status_check', 3600, time()+1800); // Checks account status
732
+ CleantalkCron::addTask('delete_spam_comments', 'ct_delete_spam_comments', 3600, time()+3500); // Formerly ct_hourly_event_hook()
733
+ CleantalkCron::addTask('send_feedback', 'ct_send_feedback', 3600, time()+3500); // Formerly ct_hourly_event_hook()
734
+ CleantalkCron::addTask('sfw_update', 'ct_sfw_update', 86400, time()+43200); // SFW update
735
+ CleantalkCron::addTask('send_sfw_logs', 'ct_sfw_send_logs', 3600, time()+1800); // SFW send logs
736
+ CleantalkCron::addTask('get_brief_data', 'cleantalk_get_brief_data', 86400, time()+3500); // Get data for dashboard widget
737
+ CleantalkCron::addTask('send_connection_report','ct_mail_send_connection_report', 86400, time()+3500); // Send connection report to welcome@cleantalk.org
738
+ apbct_activation__create_tables($sqls);
739
+ ct_sfw_update(); // Updating SFW
740
+ ct_account_status_check(null, false);
741
+ restore_current_blog();
742
+ }
743
+ }
744
+
745
+ /**
746
+ * On deactivation, clear schedule.
747
+ */
748
+ function apbct_deactivation( $network ) {
749
+
750
+ global $apbct, $wpdb;
751
+
752
+ // Deactivation for network
753
+ if(is_multisite() && $network){
754
+
755
+ $initial_blog = get_current_blog_id();
756
+ $blogs = array_keys($wpdb->get_results('SELECT blog_id FROM '. $wpdb->blogs, OBJECT_K));
757
+ foreach ($blogs as $blog) {
758
+ switch_to_blog($blog);
759
+ apbct_deactivation__delete_blog_tables();
760
+ delete_option('cleantalk_cron'); // Deleting cron entries
761
+
762
+ if($apbct->settings['complete_deactivation']){
763
+ apbct_deactivation__delete_all_options();
764
+ apbct_deactivation__delete_all_options__in_network();
765
+ }
766
+
767
+ }
768
+ switch_to_blog($initial_blog);
769
+
770
+ // Deactivation for blog
771
+ }elseif(is_multisite()){
772
+
773
+ apbct_deactivation__delete_common_tables();
774
+ delete_option('cleantalk_cron'); // Deleting cron entries
775
+
776
+ if($apbct->settings['complete_deactivation'])
777
+ apbct_deactivation__delete_all_options();
778
+
779
+ // Deactivation on standalone blog
780
+ }elseif(!is_multisite()){
781
+
782
+ apbct_deactivation__delete_common_tables();
783
+ delete_option('cleantalk_cron'); // Deleting cron entries
784
+
785
+ if($apbct->settings['complete_deactivation'])
786
+ apbct_deactivation__delete_all_options();
787
+
788
+ }
789
+ }
790
+
791
+ /**
792
+ * Delete all cleantalk_* entries from _options table
793
+ */
794
+ function apbct_deactivation__delete_all_options(){
795
+ delete_option('cleantalk_settings');
796
+ delete_option('cleantalk_data');
797
+ delete_option('cleantalk_cron');
798
+ delete_option('cleantalk_errors');
799
+ delete_option('cleantalk_remote_calls');
800
+ delete_option('cleantalk_server');
801
+ delete_option('cleantalk_stats');
802
+ delete_option('cleantalk_timelabel_reg');
803
+ }
804
+
805
+ /**
806
+ * Delete all cleantalk_* entries from _sitemeta table
807
+ */
808
+ function apbct_deactivation__delete_all_options__in_network(){
809
+ delete_site_option('cleantalk_network_settings');
810
+ delete_site_option('cleantalk_network_data');
811
+ }
812
+
813
+ function apbct_deactivation__delete_common_tables() {
814
+ global $wpdb;
815
+ $wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->base_prefix.'cleantalk_sfw`;'); // Deleting SFW data
816
+ $wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->base_prefix.'cleantalk_sfw_logs`;'); // Deleting SFW logs
817
+ $wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->base_prefix.'cleantalk_sessions`;'); // Deleting session table
818
+ }
819
+
820
+ function apbct_deactivation__delete_blog_tables() {
821
+ global $wpdb;
822
+ $wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->prefix.'cleantalk_sfw`;'); // Deleting SFW data
823
+ $wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->prefix.'cleantalk_sfw_logs`;'); // Deleting SFW logs
824
+ $wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->prefix.'cleantalk_sessions`;'); // Deleting session table
825
+ }
826
+
827
+ /**
828
+ * Redirects admin to plugin settings after activation.
829
+ */
830
+ function apbct_plugin_redirect()
831
+ {
832
+ global $apbct;
833
+ if (get_option('ct_plugin_do_activation_redirect', false) && !isset($_GET['activate-multi'])){
834
+ delete_option('ct_plugin_do_activation_redirect');
835
+ wp_redirect($apbct->settings_link);
836
+ }
837
+ }
838
+
839
+ function ct_add_event($event_type)
840
+ {
841
+ global $apbct, $cleantalk_executed;
842
+
843
+ //
844
+ // To migrate on the new version of ct_add_event().
845
+ //
846
+ switch ($event_type) {
847
+ case '0': $event_type = 'no';break;
848
+ case '1': $event_type = 'yes';break;
849
+ }
850
+
851
+ $current_hour = intval(date('G'));
852
+
853
+ // Updating current hour
854
+ if($current_hour!=$apbct->data['current_hour']){
855
+ $apbct->data['current_hour'] = $current_hour;
856
+ $apbct->data['array_accepted'][$current_hour] = 0;
857
+ $apbct->data['array_blocked'][$current_hour] = 0;
858
+ }
859
+
860
+ //Add 1 to counters
861
+ if($event_type=='yes'){
862
+ $apbct->data['array_accepted'][$current_hour]++;
863
+ $apbct->data['all_time_counter']['accepted']++;
864
+ $apbct->data['user_counter']['accepted']++;
865
+ }
866
+ if($event_type=='no'){
867
+ $apbct->data['array_blocked'][$current_hour]++;
868
+ $apbct->data['all_time_counter']['blocked']++;
869
+ $apbct->data['user_counter']['blocked']++;
870
+ }
871
+
872
+ $apbct->saveData();
873
+
874
+ $cleantalk_executed=true;
875
+ }
876
+
877
+ /**
878
+ * return new cookie value
879
+ */
880
+ function ct_get_cookie()
881
+ {
882
+ global $ct_checkjs_def;
883
+ $ct_checkjs_key = ct_get_checkjs_value();
884
+ print $ct_checkjs_key;
885
+ die();
886
+ }
887
+
888
+ function ct_sfw_update($immediate = false){
889
+
890
+ global $apbct;
891
+
892
+ if($apbct->settings['spam_firewall'] == 1){
893
+
894
+ $sfw = new CleantalkSFW();
895
+
896
+ $file_url = isset($_GET['file_url']) ? $_GET['file_url'] : null;
897
+ $result = $sfw->sfw_update($apbct->api_key, $file_url, $immediate);
898
+
899
+ if(empty($result['error'])){
900
+ $apbct->stats['sfw']['last_update_time'] = time();
901
+ $apbct->stats['sfw']['entries'] = $result;
902
+ $apbct->save('stats');
903
+ }
904
+
905
+ return $result;
906
+ }
907
+
908
+ return array('error' => 'SFW_DISABLED');
909
+
910
+ }
911
+
912
+ function ct_sfw_send_logs()
913
+ {
914
+ global $apbct;
915
+
916
+ if($apbct->settings['spam_firewall'] == 1){
917
+
918
+ $sfw = new CleantalkSFW();
919
+ $result = $sfw->logs__send($apbct->api_key);
920
+
921
+ if(empty($result['error'])){
922
+ $apbct->stats['sfw']['last_send_time'] = time();
923
+ $apbct->stats['sfw']['last_send_amount'] = $result['rows'];
924
+ $apbct->save('stats');
925
+ }
926
+
927
+ return $result;
928
+
929
+ }
930
+
931
+ return array('error' => 'SFW_DISABLED');
932
+ }
933
+
934
+ /**
935
+ * Wrapper for Cleantalk's remote calls
936
+ *
937
+ * @param string $action What you want to do?
938
+ * @param array $additional_params Additional GET parameters for RC
939
+ * @param string $presets Presets for CleantalkHelper::http__request(). 'async' maybe?
940
+ * @param string $plugin_name Plugin name 'antispam' by default
941
+ * @param string $call_token RC securirty token
942
+ * @param string $url Current site URL by default
943
+ *
944
+ * @return array|bool
945
+ */
946
+ function apbct_rc__send($action, $additional_params = array(), $presets = 'get', $plugin_name = 'antispam', $call_token = '', $url = ''){
947
+
948
+ global $apbct;
949
+
950
+ $default_params = array(
951
+ 'plugin_name' => $plugin_name,
952
+ 'spbc_remote_call_token' => $call_token ? $call_token : md5($apbct->api_key),
953
+ 'spbc_remote_call_action' => $action,
954
+ );
955
+
956
+ $params = array_merge($additional_params, $default_params);
957
+
958
+ return apbct_rc__parse_result(
959
+ CleantalkHelper::http__request(
960
+ $url ? $url : get_option('siteurl'),
961
+ $params,
962
+ $presets
963
+ )
964
+ );
965
+ }
966
+
967
+ /**
968
+ * Parse different types of remote call results
969
+ *
970
+ * @param array|string $rc_result
971
+ * string - 'FAIL {"some":"result}'
972
+ * string - 'OK {"some":"result}'
973
+ *
974
+ * @return array|string
975
+ */
976
+ function apbct_rc__parse_result($rc_result){
977
+ if(is_string($rc_result)){
978
+ $rc_result = preg_replace('/^(OK\s?|FAIL\s?)(.*)/', '$2', $rc_result, 1);
979
+ $rc_result = json_decode($rc_result, true);
980
+ $rc_result = $rc_result
981
+ ? $rc_result
982
+ : array('error' => 'FAIL_TO_PARSE_RC_RESULT');
983
+ }
984
+ return $rc_result;
985
+ }
986
+
987
+ /**
988
+ * Install plugin from wordpress catalog
989
+ *
990
+ * @param WP $wp
991
+ * @param string $plugin_slug
992
+ */
993
+ function apbct_rc__install_plugin($wp = null, $plugin = null){
994
+ global $wp_version;
995
+
996
+ $plugin = $plugin ? $plugin : (isset($_GET['plugin']) ? $_GET['plugin'] : null);
997
+
998
+ if($plugin){
999
+
1000
+ if(preg_match('/[a-zA-Z-\d]+[\/\\][a-zA-Z-\d]+\.php/', $plugin)){
1001
+
1002
+ $plugin_slug = preg_replace('@([a-zA-Z-\d]+)[\\\/].*@', '$1', $plugin);
1003
+
1004
+ if($plugin_slug){
1005
+
1006
+ require_once(ABSPATH.'wp-admin/includes/plugin-install.php');
1007
+ $result = plugins_api(
1008
+ 'plugin_information',
1009
+ array(
1010
+ 'slug' => $plugin_slug,
1011
+ 'fileds' => array('version' => true, 'download_link' => true,),
1012
+ )
1013
+ );
1014
+
1015
+ if(!is_wp_error($result)){
1016
+
1017
+ require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
1018
+ include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
1019
+ include_once( ABSPATH . 'wp-admin/includes/file.php' );
1020
+ include_once( ABSPATH . 'wp-admin/includes/misc.php' );
1021
+ include_once( CLEANTALK_PLUGIN_DIR . 'lib/CleantalkUpgrader.php' );
1022
+ include_once( CLEANTALK_PLUGIN_DIR . 'lib/CleantalkUpgraderSkin.php' );
1023
+ include_once( CLEANTALK_PLUGIN_DIR . 'lib/CleantalkUpgraderSkin_Deprecated.php' );
1024
+ if (version_compare(PHP_VERSION, '5.6.0') >= 0 && version_compare($wp_version, '5.3') >= 0)
1025
+ $installer= new CleantalkUpgrader( new CleantalkUpgraderSkin() );
1026
+ else
1027
+ $installer= new CleantalkUpgrader( new CleantalkUpgraderSkin_Deprecated() );
1028
+ $installer->install($result->download_link);
1029
+
1030
+ if($installer->apbct_result === 'OK'){
1031
+ die('OK');
1032
+
1033
+ }else
1034
+ die('FAIL '. json_encode(array('error' => $installer->apbct_result)));
1035
+ }else
1036
+ die('FAIL '. json_encode(array('error' => 'FAIL_TO_GET_LATEST_VERSION', 'details' => $result->get_error_message(),)));
1037
+ }else
1038
+ die('FAIL '. json_encode(array('error' => 'PLUGIN_SLUG_INCORRECT')));
1039
+ }else
1040
+ die('FAIL '. json_encode(array('error' => 'PLUGIN_NAME_IS_INCORRECT')));
1041
+ }else
1042
+ die('FAIL '. json_encode(array('error' => 'PLUGIN_NAME_IS_UNSET')));
1043
+ }
1044
+
1045
+ function apbct_rc__activate_plugin($plugin){
1046
+
1047
+ $plugin = $plugin ? $plugin : (isset($_GET['plugin']) ? $_GET['plugin'] : null);
1048
+
1049
+ if($plugin){
1050
+
1051
+ if(preg_match('@[a-zA-Z-\d]+[\\\/][a-zA-Z-\d]+\.php@', $plugin)){
1052
+
1053
+ require_once (ABSPATH .'/wp-admin/includes/plugin.php');
1054
+
1055
+ $result = activate_plugins($plugin);
1056
+
1057
+ if($result && !is_wp_error($result)){
1058
+ return array('success' => true);
1059
+ }else
1060
+ return array('error' => 'FAIL_TO_ACTIVATE', 'details' => (is_wp_error($result) ? ' '.$result->get_error_message() : ''));
1061
+ }else
1062
+ return array('error' => 'PLUGIN_NAME_IS_INCORRECT');
1063
+ }else
1064
+ return array('error' => 'PLUGIN_NAME_IS_UNSET');
1065
+ }
1066
+
1067
+ /**
1068
+ * Uninstall plugin from wordpress catalog
1069
+ *
1070
+ * @param null $plugin_name
1071
+ */
1072
+ function apbct_rc__deactivate_plugin($plugin = null){
1073
+
1074
+ global $apbct;
1075
+
1076
+ $plugin = $plugin ? $plugin : (isset($_GET['plugin']) ? $_GET['plugin'] : null);
1077
+
1078
+ if($plugin){
1079
+
1080
+ // Switching complete deactivation for security
1081
+ if($plugin == 'security-malware-firewall/security-malware-firewall.php' && !empty($_GET['complete_deactivation'])){
1082
+ $spbc_settings = get_option('spbc_settings');
1083
+ $spbc_settings['complete_deactivation'] = intval($_GET['complete_deactivation']);
1084
+ update_option('spbc_settings', $spbc_settings);
1085
+ }
1086
+
1087
+ require_once (ABSPATH .'/wp-admin/includes/plugin.php');
1088
+
1089
+ if(is_plugin_active( $plugin )){
1090
+ // Hook to set flag if the plugin is deactivated
1091
+ add_action( 'deactivate_'.$plugin, 'apbct_rc__uninstall_plugin__check_deactivate' );
1092
+ deactivate_plugins($plugin, false, is_multisite() ? true : false);
1093
+ }else{
1094
+ $apbct->plugin_deactivated = true;
1095
+ }
1096
+
1097
+ // Hook to set flag if the plugin is deactivated
1098
+ add_action( 'deactivate_'.$plugin, 'apbct_rc__uninstall_plugin__check_deactivate' );
1099
+ deactivate_plugins($plugin, false, is_multisite() ? true : false);
1100
+
1101
+ if($apbct->plugin_deactivated){
1102
+ die('OK');
1103
+ }else
1104
+ die('FAIL '. json_encode(array('error' => 'PLUGIN_STILL_ACTIVE')));
1105
+ }else
1106
+ die('FAIL '. json_encode(array('error' => 'PLUGIN_NAME_IS_UNSET')));
1107
+ }
1108
+
1109
+
1110
+ /**
1111
+ * Uninstall plugin from wordpress. Delete files.
1112
+ *
1113
+ * @param null $plugin
1114
+ */
1115
+ function apbct_rc__uninstall_plugin($plugin = null){
1116
+
1117
+ global $apbct;
1118
+
1119
+ $plugin = $plugin ? $plugin : (isset($_GET['plugin']) ? $_GET['plugin'] : null);
1120
+
1121
+ if($plugin){
1122
+
1123
+ // Switching complete deactivation for security
1124
+ if($plugin == 'security-malware-firewall/security-malware-firewall.php' && !empty($_GET['complete_deactivation'])){
1125
+ $spbc_settings = get_option('spbc_settings');
1126
+ $spbc_settings['complete_deactivation'] = intval($_GET['complete_deactivation']);
1127
+ update_option('spbc_settings', $spbc_settings);
1128
+ }
1129
+
1130
+ require_once (ABSPATH .'/wp-admin/includes/plugin.php');
1131
+
1132
+ if(is_plugin_active( $plugin )){
1133
+ // Hook to set flag if the plugin is deactivated
1134
+ add_action( 'deactivate_'.$plugin, 'apbct_rc__uninstall_plugin__check_deactivate' );
1135
+ deactivate_plugins($plugin, false, is_multisite() ? true : false);
1136
+ }else{
1137
+ $apbct->plugin_deactivated = true;
1138
+ }
1139
+
1140
+ if($apbct->plugin_deactivated){
1141
+
1142
+ require_once (ABSPATH .'/wp-admin/includes/file.php');
1143
+
1144
+ $result = delete_plugins(array($plugin));
1145
+
1146
+ if($result && !is_wp_error($result)){
1147
+ die('OK');
1148
+ }else
1149
+ die('FAIL '. json_encode(array('error' => 'PLUGIN_STILL_EXISTS', 'details' => (is_wp_error($result) ? ' '.$result->get_error_message() : ''))));
1150
+ }else
1151
+ die('FAIL '. json_encode(array('error' => 'PLUGIN_STILL_ACTIVE')));
1152
+ }else
1153
+ die('FAIL '. json_encode(array('error' => 'PLUGIN_NAME_IS_UNSET')));
1154
+ }
1155
+
1156
+ function apbct_rc__uninstall_plugin__check_deactivate(){
1157
+ global $apbct;
1158
+ $apbct->plugin_deactivated = true;
1159
+ }
1160
+
1161
+ function apbct_rc__update(){
1162
+ global $wp_version;
1163
+
1164
+ //Upgrade params
1165
+ $plugin = 'cleantalk-spam-protect/cleantalk.php';
1166
+ $plugin_slug = 'cleantalk-spam-protect';
1167
+ $title = __('Update Plugin');
1168
+ $nonce = 'upgrade-plugin_' . $plugin;
1169
+ $url = 'update.php?action=upgrade-plugin&plugin=' . urlencode( $plugin );
1170
+ $activate_for_network = false;
1171
+ if( APBCT_WPMS && is_main_site() && array_key_exists( $plugin, get_site_option( 'active_sitewide_plugins' ) ) ) {
1172
+ $activate_for_network = true;
1173
+ }
1174
+
1175
+ $prev_version = APBCT_VERSION;
1176
+
1177
+ require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
1178
+ include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
1179
+ include_once( ABSPATH . 'wp-admin/includes/file.php' );
1180
+ include_once( ABSPATH . 'wp-admin/includes/misc.php' );
1181
+
1182
+ include_once( CLEANTALK_PLUGIN_DIR . 'lib/CleantalkUpgrader.php' );
1183
+
1184
+ apbct_maintance_mode__enable( 30 );
1185
+
1186
+ if (version_compare(PHP_VERSION, '5.6.0') >= 0 && version_compare($wp_version, '5.3') >= 0){
1187
+ include_once( CLEANTALK_PLUGIN_DIR . 'lib/CleantalkUpgraderSkin.php' );
1188
+ $upgrader = new CleantalkUpgrader( new CleantalkUpgraderSkin( compact('title', 'nonce', 'url', 'plugin') ) );
1189
+ }else{
1190
+ include_once( CLEANTALK_PLUGIN_DIR . 'lib/CleantalkUpgraderSkin_Deprecated.php' );
1191
+ $upgrader = new CleantalkUpgrader( new CleantalkUpgraderSkin_Deprecated( compact('title', 'nonce', 'url', 'plugin') ) );
1192
+ }
1193
+
1194
+ $upgrader->upgrade($plugin);
1195
+
1196
+ apbct_maintance_mode__disable();
1197
+
1198
+ $result = activate_plugins( $plugin, '', $activate_for_network );
1199
+
1200
+ // Changing response UP_TO_DATE to OK
1201
+ if($upgrader->apbct_result === 'UP_TO_DATE')
1202
+ $upgrader->apbct_result = 'OK';
1203
+
1204
+ if($upgrader->apbct_result === 'OK'){
1205
+
1206
+ if(is_wp_error($result)){
1207
+ die('FAIL '. json_encode(array('error' => 'COULD_NOT_ACTIVATE', 'wp_error' => $result->get_error_message())));
1208
+ }
1209
+
1210
+ $httpResponseCode = CleantalkHelper::http__request(get_option('siteurl'), array(), 'get_code');
1211
+
1212
+ if( strpos($httpResponseCode, '200') === false ){
1213
+
1214
+ apbct_maintance_mode__enable( 30 );
1215
+
1216
+ // Rollback
1217
+ if (version_compare(PHP_VERSION, '5.6.0') >= 0 && version_compare($wp_version, '5.3') >= 0)
1218
+ $rollback = new CleantalkUpgrader( new CleantalkUpgraderSkin( compact('title', 'nonce', 'url', 'plugin_slug', 'prev_version') ) );
1219
+ else
1220
+ $rollback = new CleantalkUpgrader( new CleantalkUpgraderSkin_Deprecated( compact('title', 'nonce', 'url', 'plugin_slug', 'prev_version') ) );
1221
+ $rollback->rollback($plugin);
1222
+
1223
+ apbct_maintance_mode__disable();
1224
+
1225
+ $response = array(
1226
+ 'error' => 'BAD_HTTP_CODE',
1227
+ 'http_code' => $httpResponseCode,
1228
+ 'output' => substr(file_get_contents(get_option('siteurl')), 0, 900),
1229
+ 'rollback_result' => $rollback->apbct_result,
1230
+ );
1231
+
1232
+ die('FAIL '.json_encode($response));
1233
+ }
1234
+
1235
+ $plugin_data = get_plugin_data(__FILE__);
1236
+ $apbct_agent = 'wordpress-'.str_replace('.', '', $plugin_data['Version']);
1237
+ ct_send_feedback('0:' . $apbct_agent);
1238
+
1239
+ die('OK '.json_encode(array('agent' => $apbct_agent)));
1240
+
1241
+ }else{
1242
+ die('FAIL '. json_encode(array('error' => $upgrader->apbct_result)));
1243
+ }
1244
+ }
1245
+
1246
+ function apbct_rc__update_settings($source) {
1247
+
1248
+ global $apbct;
1249
+
1250
+ foreach($apbct->def_settings as $setting => $def_value){
1251
+ if(array_key_exists($setting, $source)){
1252
+ $var = $source[$setting];
1253
+ $type = gettype($def_value);
1254
+ settype($var, $type);
1255
+ if($type == 'string')
1256
+ $var = preg_replace(array('/=/', '/`/'), '', $var);
1257
+ $apbct->settings[$setting] = $var;
1258
+ }
1259
+ }
1260
+
1261
+ $apbct->save('settings');
1262
+
1263
+ return true;
1264
+ }
1265
+
1266
+ function apbct_rc__insert_auth_key($key, $plugin){
1267
+
1268
+ global $apbct;
1269
+
1270
+ if($plugin === 'security-malware-firewall/security-malware-firewall.php'){
1271
+
1272
+ require_once (ABSPATH .'/wp-admin/includes/plugin.php');
1273
+
1274
+ if(is_plugin_active( $plugin )){
1275
+
1276
+ $key = trim($key);
1277
+
1278
+ if($key && preg_match('/^[a-z\d]{3,15}$/', $key)){
1279
+
1280
+ $result = CleantalkAPI::method__notice_paid_till(
1281
+ $key,
1282
+ preg_replace('/http[s]?:\/\//', '', get_option('siteurl'), 1), // Site URL
1283
+ 'security'
1284
+ );
1285
+
1286
+ if( empty( $result['error'] ) ) {
1287
+
1288
+ if( $result['valid'] ){
1289
+
1290
+ // Set account params
1291
+ $data = get_option('spbc_data', array());
1292
+ $data['user_token'] = $result['user_token'];
1293
+ $data['notice_show'] = $result['show_notice'];
1294
+ $data['notice_renew'] = $result['renew'];
1295
+ $data['notice_trial'] = $result['trial'];
1296
+ $data['auto_update_app'] = isset($result['show_auto_update_notice']) ? $result['show_auto_update_notice'] : 0;
1297
+ $data['service_id'] = $result['service_id'];
1298
+ $data['moderate'] = $result['moderate'];
1299
+ $data['auto_update_app '] = isset($result['auto_update_app']) ? $result['auto_update_app'] : 0;
1300
+ $data['license_trial'] = isset($result['license_trial']) ? $result['license_trial'] : 0;
1301
+ $data['account_name_ob'] = isset($result['account_name_ob']) ? $result['account_name_ob'] : '';
1302
+ $data['key_is_ok'] = true;
1303
+ update_option('spbc_data', $data);
1304
+
1305
+ // Set key
1306
+ $settings = get_option('spbc_settings', array());
1307
+ $settings['spbc_key'] = $key;
1308
+ update_option('spbc_settings', $settings);
1309
+
1310
+ return 'OK';
1311
+ }else
1312
+ return array('error' => 'KEY_IS_NOT_VALID');
1313
+ }else
1314
+ return array('error' => $result);
1315
+ }else
1316
+ return array('error' => 'KEY_IS_NOT_CORRECT');
1317
+ }else
1318
+ return array('error' => 'PLUGIN_IS_NOT_ACTIVE_OR_NOT_INSTALLED');
1319
+ }else
1320
+ return array('error' => 'PLUGIN_SLUG_INCORRECT');
1321
+ }
1322
+
1323
+ /**
1324
+ * Putting Wordpress to maintenance mode.
1325
+ * For given duration in seconds
1326
+ *
1327
+ * @param $duration
1328
+ *
1329
+ * @return bool
1330
+ */
1331
+ function apbct_maintance_mode__enable( $duration ) {
1332
+ apbct_maintance_mode__disable();
1333
+ $content = "<?php\n\n"
1334
+ . '$upgrading = ' . (time() - ( 60 * 10 ) + $duration) . ';';
1335
+
1336
+ return (bool)file_put_contents( ABSPATH . '.maintenance', $content );
1337
+ }
1338
+
1339
+ /**
1340
+ * Disabling maintenance mode by deleting .maintenance file.
1341
+ *
1342
+ * @return void
1343
+ */
1344
+ function apbct_maintance_mode__disable() {
1345
+ $maintenance_file = ABSPATH . '.maintenance';
1346
+ if ( file_exists( $maintenance_file ) ) {
1347
+ unlink( $maintenance_file );
1348
+ }
1349
+ }
1350
+
1351
+ function cleantalk_get_brief_data(){
1352
+
1353
+ global $apbct;
1354
+
1355
+ $apbct->data['brief_data'] = CleantalkAPI::method__get_antispam_report_breif($apbct->api_key);
1356
+ $apbct->saveData();
1357
+
1358
+ return;
1359
+ }
1360
+
1361
+ //Delete cookie for admin trial notice
1362
+ function apbct__hook__wp_logout__delete_trial_notice_cookie(){
1363
+ if(!headers_sent())
1364
+ setcookie('ct_trial_banner_closed', '', time()-3600);
1365
+ }
1366
+
1367
+ function apbct_alt_session__id__get(){
1368
+ $id = CleantalkHelper::ip__get(array('real'))
1369
+ .apbct_get_server_variable( 'HTTP_USER_AGENT' )
1370
+ .apbct_get_server_variable( 'HTTP_ACCEPT_LANGUAGE' );
1371
+ return hash('sha256', $id);
1372
+ }
1373
+
1374
+ function apbct_alt_sessions__remove_old(){
1375
+ if(rand(0, 1000) < APBCT_SEESION__CHANCE_TO_CLEAN){
1376
+ global $wpdb;
1377
+ $wpdb->query(
1378
+ 'DELETE
1379
+ FROM `'. APBCT_TBL_SESSIONS .'`
1380
+ WHERE last_update < NOW() - INTERVAL '. APBCT_SEESION__LIVE_TIME .' SECOND
1381
+ LIMIT 100000;'
1382
+ );
1383
+ }
1384
+ }
1385
+
1386
+ function apbct_alt_session__save($name, $value){
1387
+
1388
+ global $wpdb;
1389
+
1390
+ $session_id = apbct_alt_session__id__get();
1391
+
1392
+ $wpdb->query(
1393
+ $wpdb->prepare(
1394
+ 'INSERT INTO '. APBCT_TBL_SESSIONS .'
1395
+ (id, name, value, last_update)
1396
+ VALUES (%s, %s, %s, %s)
1397
+ ON DUPLICATE KEY UPDATE
1398
+ value = %s,
1399
+ last_update = %s',
1400
+ $session_id, $name, $value, date('Y-m-d H:i:s'), $value, date('Y-m-d H:i:s')
1401
+ )
1402
+ );
1403
+
1404
+ }
1405
+
1406
+ function apbct_alt_session__get($name){
1407
+ global $wpdb;
1408
+ $session_id = apbct_alt_session__id__get();
1409
+ $result = $wpdb->get_row(
1410
+ $wpdb->prepare(
1411
+ 'SELECT value
1412
+ FROM `'. APBCT_TBL_SESSIONS .'`
1413
+ WHERE id = %s AND name = %s;',
1414
+ $session_id, $name
1415
+ ),
1416
+ OBJECT
1417
+ );
1418
+
1419
+ $result = isset($result->value)
1420
+ ? strpos($result->value, '{') === 0
1421
+ ? (array)json_decode($result->value, true) // JSON
1422
+ : $result->value
1423
+ : false;
1424
+
1425
+ return $result ? $result : null;
1426
+ }
1427
+
1428
+ function apbct_store__urls(){
1429
+
1430
+ global $apbct;
1431
+
1432
+ if($apbct->settings['store_urls'] && empty($apbct->flags__url_stored) && !headers_sent()){
1433
+
1434
+ // URLs HISTORY
1435
+ // Get current url
1436
+ $current_url = apbct_get_server_variable( 'HTTP_HOST' ) . apbct_get_server_variable( 'REQUEST_URI' );
1437
+
1438
+ $current_url = $current_url ? substr($current_url, 0,256) : 'UNKNOWN';
1439
+
1440
+ // Get already stored URLs
1441
+ $urls = $apbct->settings['store_urls__sessions']
1442
+ ? (array)apbct_alt_session__get('apbct_urls')
1443
+ : (array)json_decode(filter_input(INPUT_COOKIE, 'apbct_urls'), true);
1444
+
1445
+ $urls[$current_url][] = time();
1446
+
1447
+ // Rotating. Saving only latest 10
1448
+ $urls[$current_url] = count($urls[$current_url]) > 10 ? array_slice($urls[$current_url], 1, 10) : $urls[$current_url];
1449
+ $urls = count($urls) > 10 ? array_slice($urls, 1, 10) : $urls;
1450
+
1451
+ // Saving
1452
+ $apbct->settings['store_urls__sessions']
1453
+ ? apbct_alt_session__save('apbct_urls', json_encode($urls))
1454
+ : apbct_cookie__set('apbct_urls', json_encode($urls), time()+86400*3, '/', parse_url(get_option('siteurl'),PHP_URL_HOST), false, true, 'Lax');
1455
+
1456
+ // REFERER
1457
+ // Get current fererer
1458
+ $new_site_referer = apbct_get_server_variable( 'HTTP_REFERER' );
1459
+ $new_site_referer = $new_site_referer ? $new_site_referer : 'UNKNOWN';
1460
+
1461
+ // Get already stored referer
1462
+ $site_referer = $apbct->settings['store_urls__sessions']
1463
+ ? apbct_alt_session__get('apbct_site_referer')
1464
+ : filter_input(INPUT_COOKIE, 'apbct_site_referer');
1465
+
1466
+ // Save if empty
1467
+ if( !$site_referer || parse_url($new_site_referer, PHP_URL_HOST) !== apbct_get_server_variable( 'HTTP_HOST' ) ){
1468
+
1469
+ $apbct->settings['store_urls__sessions']
1470
+ ? apbct_alt_session__save('apbct_site_referer', $new_site_referer)
1471
+ : apbct_cookie__set('apbct_site_referer', $new_site_referer, time()+86400*3, '/', parse_url(get_option('siteurl'),PHP_URL_HOST), false, true, 'Lax');
1472
+ }
1473
+
1474
+ $apbct->flags__url_stored = true;
1475
+
1476
+ }
1477
+ }
1478
+
1479
+ function apbct_cookie__set($name, $value = '', $expires = 0, $path = '', $domain = null, $secure = false, $httponly = false, $samesite = null ){
1480
+
1481
+ // For PHP 7.3+ and above
1482
+ if( version_compare( phpversion(), '7.3.0', '>=' ) ){
1483
+
1484
+ $params = array(
1485
+ 'expires' => $expires,
1486
+ 'path' => $path,
1487
+ 'domain' => $domain,
1488
+ 'secure' => $secure,
1489
+ 'httponly' => $httponly,
1490
+ );
1491
+
1492
+ if($samesite)
1493
+ $params['samesite'] = $samesite;
1494
+
1495
+ setcookie( $name, $value, $params );
1496
+
1497
+ // For PHP 5.6 - 7.2
1498
+ }else
1499
+ setcookie( $name, $value, $expires, $path, $domain, $secure, $httponly );
1500
+ }
1501
+
1502
+ /*
1503
+ * Set Cookies test for cookie test
1504
+ * Sets cookies with pararms timestamp && landing_timestamp && pervious_referer
1505
+ * Sets test cookie with all other cookies
1506
+ */
1507
+ function apbct_cookie(){
1508
+
1509
+ global $apbct;
1510
+
1511
+ if($apbct->settings['store_urls__sessions'] || $apbct->settings['set_cookies__sessions'])
1512
+ apbct_alt_sessions__remove_old();
1513
+
1514
+ if(
1515
+ empty($apbct->settings['set_cookies']) || // Do not set cookies if option is disabled (for Varnish cache).
1516
+ !empty($apbct->flags__cookies_setuped) || // Cookies already set
1517
+ !empty($apbct->headers_sent) // Headers sent
1518
+ )
1519
+ return false;
1520
+
1521
+ // Prevent headers sent error
1522
+ if(headers_sent($file, $line)){
1523
+ $apbct->headers_sent = true;
1524
+ $apbct->headers_sent__hook = current_action();
1525
+ $apbct->headers_sent__where = $file.':'.$line;
1526
+ return false;
1527
+ }
1528
+
1529
+
1530
+ // Cookie names to validate
1531
+ $cookie_test_value = array(
1532
+ 'cookies_names' => array(),
1533
+ 'check_value' => $apbct->api_key,
1534
+ );
1535
+
1536
+ $domain = parse_url(get_option('siteurl'),PHP_URL_HOST);
1537
+
1538
+ // Submit time
1539
+ if(empty($_POST['ct_multipage_form'])){ // Do not start/reset page timer if it is multipage form (Gravitiy forms))
1540
+ $apbct_timestamp = time();
1541
+ $apbct->settings['set_cookies__sessions']
1542
+ ? apbct_alt_session__save('apbct_timestamp', $apbct_timestamp)
1543
+ : apbct_cookie__set('apbct_timestamp', $apbct_timestamp, 0, '/', $domain, false, true, 'Lax' );
1544
+ $cookie_test_value['cookies_names'][] = 'apbct_timestamp';
1545
+ $cookie_test_value['check_value'] .= $apbct_timestamp;
1546
+ }
1547
+
1548
+ // Pervious referer
1549
+ if(apbct_get_server_variable( 'HTTP_REFERER' )){
1550
+ $apbct->settings['set_cookies__sessions']
1551
+ ? apbct_alt_session__save('apbct_prev_referer', apbct_get_server_variable( 'HTTP_REFERER' ))
1552
+ : apbct_cookie__set('apbct_prev_referer', apbct_get_server_variable( 'HTTP_REFERER' ), 0, '/', $domain, false, true, 'Lax' );
1553
+ $cookie_test_value['cookies_names'][] = 'apbct_prev_referer';
1554
+ $cookie_test_value['check_value'] .= apbct_get_server_variable( 'HTTP_REFERER' );
1555
+ }
1556
+
1557
+ // Landing time
1558
+ $site_landing_timestamp = $apbct->settings['set_cookies__sessions']
1559
+ ? apbct_alt_session__get('apbct_site_landing_ts')
1560
+ : filter_input(INPUT_COOKIE, 'apbct_site_landing_ts');
1561
+ if(!$site_landing_timestamp){
1562
+ $site_landing_timestamp = time();
1563
+ $apbct->settings['set_cookies__sessions']
1564
+ ? apbct_alt_session__save('apbct_site_landing_ts', $site_landing_timestamp)
1565
+ : apbct_cookie__set('apbct_site_landing_ts', $site_landing_timestamp, 0, '/', $domain, false, true, 'Lax' );
1566
+ }
1567
+ $cookie_test_value['cookies_names'][] = 'apbct_site_landing_ts';
1568
+ $cookie_test_value['check_value'] .= $site_landing_timestamp;
1569
+
1570
+ // Page hits
1571
+ // Get
1572
+ $page_hits = $apbct->settings['set_cookies__sessions']
1573
+ ? apbct_alt_session__get('apbct_page_hits')
1574
+ : filter_input(INPUT_COOKIE, 'apbct_page_hits');
1575
+ // Set / Increase
1576
+ $page_hits = intval($page_hits) ? $page_hits + 1 : 1;
1577
+
1578
+ $apbct->settings['set_cookies__sessions']
1579
+ ? apbct_alt_session__save('apbct_page_hits', $page_hits)
1580
+ : apbct_cookie__set('apbct_page_hits', $page_hits, 0, '/', $domain, false, true, 'Lax' );
1581
+
1582
+ $cookie_test_value['cookies_names'][] = 'apbct_page_hits';
1583
+ $cookie_test_value['check_value'] .= $page_hits;
1584
+
1585
+ // Cookies test
1586
+ $cookie_test_value['check_value'] = md5($cookie_test_value['check_value']);
1587
+ if(!$apbct->settings['set_cookies__sessions'])
1588
+ apbct_cookie__set('apbct_cookies_test', urlencode(json_encode($cookie_test_value)), 0, '/', $domain, false, true, 'Lax' );
1589
+
1590
+ $apbct->flags__cookies_setuped = true;
1591
+
1592
+ }
1593
+
1594
+ /**
1595
+ * Cookies test for sender
1596
+ * Also checks for valid timestamp in $_COOKIE['apbct_timestamp'] and other apbct_ COOKIES
1597
+ * @return null|0|1;
1598
+ */
1599
+ function apbct_cookies_test()
1600
+ {
1601
+ global $apbct;
1602
+
1603
+ if($apbct->settings['set_cookies__sessions'])
1604
+ return 1;
1605
+
1606
+ if(isset($_COOKIE['apbct_cookies_test'])){
1607
+
1608
+ $cookie_test = json_decode(urldecode($_COOKIE['apbct_cookies_test']),true);
1609
+
1610
+ if(!is_array($cookie_test))
1611
+ return 0;
1612
+
1613
+ $check_srting = $apbct->api_key;
1614
+ foreach($cookie_test['cookies_names'] as $cookie_name){
1615
+ $check_srting .= isset($_COOKIE[$cookie_name]) ? $_COOKIE[$cookie_name] : '';
1616
+ } unset($cookie_name);
1617
+
1618
+ if($cookie_test['check_value'] == md5($check_srting)){
1619
+ return 1;
1620
+ }else{
1621
+ return 0;
1622
+ }
1623
+ }else{
1624
+ return null;
1625
+ }
1626
+ }
1627
+
1628
+ function apbct_cookies__delete($cookie){
1629
+ if(isset($_COOKIE[$cookie]))
1630
+ setcookie($cookie, '', time()-3600);
1631
+ }
1632
+
1633
+ function apbct_cookies__delete_all(){
1634
+ if(count($_COOKIE)){
1635
+ foreach($_COOKIE as $key => $val){
1636
+ if(preg_match("/apbct_|ct_/", $key)){
1637
+ setcookie($key, '', time()-3600);
1638
+ }
1639
+ } unset($key, $val);
1640
+ }
1641
+ return false;
1642
+ }
1643
+
1644
+ /**
1645
+ * Gets submit time
1646
+ * Uses Cookies with check via apbct_cookies_test()
1647
+ * @return null|int;
1648
+ */
1649
+ function apbct_get_submit_time()
1650
+ {
1651
+ global $apbct;
1652
+ $apbct_timestamp = $apbct->settings['set_cookies__sessions']
1653
+ ? apbct_alt_session__get('apbct_timestamp')
1654
+ : filter_input(INPUT_COOKIE, 'apbct_timestamp');
1655
+ return apbct_cookies_test() == 1 ? time() - (int)$apbct_timestamp : null;
1656
+ }
1657
+
1658
+ /*
1659
+ * Inner function - Account status check
1660
+ * Scheduled in 1800 seconds for default!
1661
+ */
1662
+ function ct_account_status_check($api_key = null, $process_errors = true){
1663
+
1664
+ global $apbct;
1665
+
1666
+ $api_key = $api_key ? $api_key : $apbct->api_key;
1667
+ $result = CleantalkAPI::method__notice_paid_till(
1668
+ $api_key,
1669
+ preg_replace('/http[s]?:\/\//', '', get_option('siteurl'), 1),
1670
+ 'antispam'
1671
+ );
1672
+ error_log(var_export($result,1));
1673
+
1674
+ if(empty($result['error']) || !empty($result['valid'])){
1675
+
1676
+ // Notices
1677
+ $apbct->data['notice_show'] = isset($result['show_notice']) ? (int)$result['show_notice'] : 0;
1678
+ $apbct->data['notice_renew'] = isset($result['renew']) ? (int)$result['renew'] : 0;
1679
+ $apbct->data['notice_trial'] = isset($result['trial']) ? (int)$result['trial'] : 0;
1680
+ $apbct->data['notice_review'] = isset($result['show_review']) ? (int)$result['show_review'] : 0;
1681
+ $apbct->data['notice_auto_update'] = isset($result['show_auto_update_notice']) ? (int)$result['show_auto_update_notice'] : 0;
1682
+
1683
+ // Other
1684
+ $apbct->data['service_id'] = isset($result['service_id']) ? (int)$result['service_id'] : 0;
1685
+ $apbct->data['valid'] = isset($result['valid']) ? (int)$result['valid'] : 0;
1686
+ $apbct->data['moderate'] = isset($result['moderate']) ? (int)$result['moderate'] : 0;
1687
+ $apbct->data['ip_license'] = isset($result['ip_license']) ? (int)$result['ip_license'] : 0;
1688
+ $apbct->data['moderate_ip'] = isset($result['moderate_ip'], $result['ip_license']) ? (int)$result['moderate_ip'] : 0;
1689
+ $apbct->data['spam_count'] = isset($result['spam_count']) ? (int)$result['spam_count'] : 0;
1690
+ $apbct->data['auto_update'] = isset($result['auto_update_app']) ? (int)$result['auto_update_app'] : 0;
1691
+ $apbct->data['user_token'] = isset($result['user_token']) ? (string)$result['user_token'] : '';
1692
+ $apbct->data['license_trial'] = isset($result['license_trial']) ? (int)$result['license_trial'] : 0;
1693
+ $apbct->data['account_name_ob'] = isset($result['account_name_ob']) ? (string)$result['account_name_ob'] : '';
1694
+
1695
+ if($apbct->data['notice_show'] == 1 && $apbct->data['notice_trial'] == 1)
1696
+ CleantalkCron::updateTask('check_account_status', 'ct_account_status_check', 3600);
1697
+
1698
+ if($apbct->data['notice_show'] == 1 && $apbct->data['notice_renew'] == 1)
1699
+ CleantalkCron::updateTask('check_account_status', 'ct_account_status_check', 1800);
1700
+
1701
+ if($apbct->data['notice_show'] == 0)
1702
+ CleantalkCron::updateTask('check_account_status', 'ct_account_status_check', 86400);
1703
+
1704
+ $apbct->error_delete('account_check', 'save');
1705
+
1706
+ $apbct->saveData();
1707
+
1708
+ }elseif($process_errors){
1709
+ $apbct->error_add('account_check', $result);
1710
+ }
1711
+
1712
+ if(!empty($result['valid'])){
1713
+ $apbct->data['key_is_ok'] = true;
1714
+ $result = true;
1715
+ }else{
1716
+ $apbct->data['key_is_ok'] = false;
1717
+ $result = false;
1718
+ }
1719
+
1720
+ return $result;
1721
+ }
1722
+
1723
+ function ct_mail_send_connection_report() {
1724
+
1725
+ global $apbct;
1726
+
1727
+ if (($apbct->settings['send_connection_reports'] == 1 && $apbct->connection_reports['negative'] > 0) || !empty($_GET['ct_send_connection_report']))
1728
+ {
1729
+ $to = "welcome@cleantalk.org" ;
1730
+ $subject = "Connection report for " . apbct_get_server_variable( 'HTTP_HOST' );
1731
+ $message = '
1732
+ <html>
1733
+ <head>
1734
+ <title></title>
1735
+ </head>
1736
+ <body>
1737
+ <p>From '.$apbct->connection_reports['since'].' to '.date('d M').' has been made '.($apbct->connection_reports['success']+$apbct->connection_reports['negative']).' calls, where '.$apbct->connection_reports['success'].' were success and '.$apbct->connection_reports['negative'].' were negative</p>
1738
+ <p>Negative report:</p>
1739
+ <table> <tr>
1740
+ <td>&nbsp;</td>
1741
+ <td><b>Date</b></td>
1742
+ <td><b>Page URL</b></td>
1743
+ <td><b>Library report</b></td>
1744
+ <td><b>Server IP</b></td>
1745
+ </tr>
1746
+ ';
1747
+ foreach ($apbct->connection_reports['negative_report'] as $key => $report)
1748
+ {
1749
+ $message.= '<tr>'
1750
+ . '<td>'.($key+1).'.</td>'
1751
+ . '<td>'.$report['date'].'</td>'
1752
+ . '<td>'.$report['page_url'].'</td>'
1753
+ . '<td>'.$report['lib_report'].'</td>'
1754
+ . '<td>'.$report['work_url'].'</td>'
1755
+ . '</tr>';
1756
+ }
1757
+ $message.='</table></body></html>';
1758
+
1759
+ $headers = 'Content-type: text/html; charset=windows-1251 \r\n';
1760
+ $headers .= 'From: '.get_option('admin_email');
1761
+ mail($to, $subject, $message, $headers);
1762
+ }
1763
+
1764
+ $apbct->data['connection_reports'] = $apbct->def_data['connection_reports'];
1765
+ $apbct->data['connection_reports']['since'] = date('d M');
1766
+ $apbct->saveData();
1767
+ }
1768
+
1769
+ //* Write $message to the plugin's debug option
1770
+ function apbct_log($message = 'empty', $func = null, $params = array())
1771
+ {
1772
+ global $apbct;
1773
+
1774
+ $debug = get_option( APBCT_DEBUG );
1775
+
1776
+ $function = $func ? $func : '';
1777
+ $cron = in_array('cron', $params) ? true : false;
1778
+ $data = in_array('data', $params) ? true : false;
1779
+ $settings = in_array('settings', $params) ? true : false;
1780
+
1781
+ if(is_array($message) or is_object($message))
1782
+ $message = print_r($message, true);
1783
+
1784
+ if($message) $debug[date("H:i:s", microtime(true))."_ACTION_".strval(current_action())."_FUNCTION_".strval($func)] = $message;
1785
+ if($cron) $debug[date("H:i:s", microtime(true))."_ACTION_".strval(current_action())."_FUNCTION_".strval($func).'_cron'] = $apbct->cron;
1786
+ if($data) $debug[date("H:i:s", microtime(true))."_ACTION_".strval(current_action())."_FUNCTION_".strval($func).'_data'] = $apbct->data;
1787
+ if($settings) $debug[date("H:i:s", microtime(true))."_ACTION_".strval(current_action())."_FUNCTION_".strval($func).'_settings'] = $apbct->settings;
1788
+
1789
+ update_option(APBCT_DEBUG, $debug);
1790
+ }
1791
+
1792
+ function apbct_sfw__delete_tables( $blog_id, $drop ) {
1793
+
1794
+ global $wpdb;
1795
+
1796
+ $initial_blog = get_current_blog_id();
1797
+
1798
+ switch_to_blog($blog_id);
1799
+ $wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->prefix.'cleantalk_sfw`;'); // Deleting SFW data
1800
+ $wpdb->query('DROP TABLE IF EXISTS `'. $wpdb->prefix.'cleantalk_sfw_logs`;'); // Deleting SFW logs
1801
+
1802
+ switch_to_blog($initial_blog);
1803
+ }
1804
+
1805
+ /**
1806
+ * Is enable for user group
1807
+ *
1808
+ * @param WP_User $user
1809
+ *
1810
+ * @return boolean
1811
+ */
1812
+ function apbct_is_user_enable($user = null) {
1813
+
1814
+ global $current_user;
1815
+
1816
+ $user = !empty($user) ? $user : $current_user;
1817
+
1818
+ return apbct_is_user_role_in(array('administrator', 'editor', 'author'), $user)
1819
+ ? false
1820
+ : true;
1821
+ }
1822
+
1823
+ /**
1824
+ * Checks if the current user has role
1825
+ *
1826
+ * @param array $roles array of strings
1827
+ * @param int|string|WP_User|mixed $user User ID to check|user_login|WP_User
1828
+ *
1829
+ * @return boolean Does the user has this role|roles
1830
+ */
1831
+ function apbct_is_user_role_in( $roles, $user = false ){
1832
+
1833
+ if( is_numeric($user) && function_exists('get_userdata')) $user = get_userdata( $user );
1834
+ if( is_string($user) && function_exists('get_user_by')) $user = get_user_by('login', $user );
1835
+ if( ! $user && function_exists('wp_get_current_user')) $user = wp_get_current_user();
1836
+ if( ! $user ) $user = apbct_wp_get_current_user();
1837
+
1838
+ if( empty($user->ID) )
1839
+ return false;
1840
+
1841
+ foreach( (array) $roles as $role ){
1842
+ if( isset($user->caps[ strtolower($role) ]) || in_array(strtolower($role), $user->roles) )
1843
+ return true;
1844
+ }
1845
+
1846
+ return false;
1847
+ }
1848
+
1849
+ /**
1850
+ * Update and rotate statistics with requests exection time
1851
+ *
1852
+ * @param $exec_time
1853
+ */
1854
+ function apbct_statistics__rotate($exec_time){
1855
+
1856
+ global $apbct;
1857
+
1858
+ // Delete old stats
1859
+ if(min(array_keys($apbct->stats['requests'])) < time() - (86400 * 7))
1860
+ unset($apbct->stats['requests'][min(array_keys($apbct->stats['requests']))]);
1861
+
1862
+ // Create new if newest older than 1 day
1863
+ if(empty($apbct->stats['requests']) || max(array_keys($apbct->stats['requests'])) < time() - (86400 * 1))
1864
+ $apbct->stats['requests'][time()] = array('amount' => 0, 'average_time' => 0);
1865
+
1866
+ // Update all existing stats
1867
+ foreach($apbct->stats['requests'] as &$weak_stat){
1868
+ $weak_stat['average_time'] = ($weak_stat['average_time'] * $weak_stat['amount'] + $exec_time) / ++$weak_stat['amount'];
1869
+ }
1870
+
1871
+ $apbct->save('stats');
1872
+ }
1873
+
1874
+ /**
1875
+ * Runs update actions for new version.
1876
+ *
1877
+ * @global CleantalkState $apbct
1878
+ */
1879
+ function apbct_update_actions(){
1880
+
1881
+ global $apbct;
1882
+
1883
+ // Update logic
1884
+ if($apbct->plugin_version != APBCT_VERSION){
1885
+
1886
+ // Main blog
1887
+ if(is_main_site()){
1888
+
1889
+ require_once(CLEANTALK_PLUGIN_DIR.'inc/cleantalk-updater.php');
1890
+
1891
+ $result = apbct_run_update_actions($apbct->plugin_version, APBCT_VERSION);
1892
+
1893
+ //If update is successfull
1894
+ if($result === true)
1895
+ apbct_update__set_version__from_plugin('from_plugin');
1896
+
1897
+ ct_send_feedback('0:' . APBCT_AGENT ); // Send feedback to let cloud know about updated version.
1898
+
1899
+ // Side blogs
1900
+ }else{
1901
+ apbct_update__set_version__from_plugin('from_plugin');
1902
+ }
1903
+ }
1904
+
1905
+ }
1906
+
1907
+ /**
1908
+ * Set version of plugin in database
1909
+ *
1910
+ * @param string $ver
1911
+ *
1912
+ * @return bool
1913
+ * @global CleantalkState $apbct
1914
+ *
1915
+ */
1916
+ function apbct_update__set_version__from_plugin($ver){
1917
+ global $apbct;
1918
+ switch (true){
1919
+ case $ver === 'from_plugin':
1920
+ $apbct->data['plugin_version'] = APBCT_VERSION;
1921
+ break;
1922
+ case preg_match('/^\d+\.\d+(\.\d+)?(-[a-zA-Z0-9-_]+)?$/', $ver) === 1;
1923
+ $apbct->data['plugin_version'] = $ver;
1924
+ break;
1925
+ default:
1926
+ return false;
1927
+ break;
1928
+ }
1929
+ $apbct->saveData();
1930
+ return true;
1931
+ }
css/fonts/icons/icons.svg CHANGED
@@ -1,240 +1,240 @@
1
- <?xml version="1.0" standalone="no"?>
2
- <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
- <svg xmlns="http://www.w3.org/2000/svg">
4
- <metadata>Copyright (C) 2019 by original authors @ fontello.com</metadata>
5
- <defs>
6
- <font id="fontello" horiz-adv-x="1000" >
7
- <font-face font-family="fontello" font-weight="400" font-stretch="normal" units-per-em="1000" ascent="850" descent="-150" />
8
- <missing-glyph horiz-adv-x="1000" />
9
- <glyph glyph-name="download" unicode="&#xe800;" d="M714 590q15-15 15-37t-15-36l-245-244-245 244q-15 15-15 36t15 37 36 15q23 0 38-15l118-120 0 349q0 21 16 37t37 16 37-16 15-37l0-349 119 120q14 14 38 14 22 0 36-14z m222-448l2-261q0-21-16-36t-37-16l-832 0q-22 0-37 16t-16 36q0 261 1 261 0 11 2 16l105 312q12 37 48 37l12 0q8-18 18-28l78-76-70 0-86-261 722 0-86 261-70 0 77 76q10 10 19 28l11 0q37 0 49-37l105-312q1-5 1-16z" horiz-adv-x="938" />
10
-
11
- <glyph glyph-name="glass" unicode="&#xe801;" d="M948 746q0-19-24-43l-353-353v-429h179q15 0 25-10t11-25-11-25-25-11h-500q-14 0-25 11t-11 25 11 25 25 10h179v429l-353 353q-24 24-24 43 0 13 10 21t21 9 24 3h786q13 0 24-3t21-9 10-21z" horiz-adv-x="1000" />
12
-
13
- <glyph glyph-name="emo-happy" unicode="&#xe802;" d="M261 800c-60 0-109-65-109-144 0-80 49-145 109-145s110 65 110 145c0 79-49 144-110 144z m477 0c-61 0-110-65-110-144 0-80 49-145 110-145 60 0 110 65 110 145 0 79-50 144-110 144z m208-599c-13 0-27-5-37-16-4-4-8-8-12-12-111-109-253-164-396-165-142-2-285 50-396 155l-3 3-12 12c-21 21-54 20-75-1-20-21-20-55 1-76 3-4 8-8 14-14l3-3c132-124 301-186 469-184 169 1 337 67 468 195 5 5 9 10 14 14 20 22 20 56-1 77-10 10-23 15-37 15z" horiz-adv-x="999" />
14
-
15
- <glyph glyph-name="search" unicode="&#xe803;" d="M643 386q0 103-73 176t-177 74-177-74-73-176 73-177 177-73 177 73 73 177z m286-465q0-29-22-50t-50-21q-30 0-50 21l-191 191q-100-69-223-69-80 0-153 31t-125 84-84 125-31 153 31 152 84 126 125 84 153 31 153-31 125-84 84-126 31-152q0-123-69-223l191-191q21-21 21-51z" horiz-adv-x="928.6" />
16
-
17
- <glyph glyph-name="emo-unhappy" unicode="&#xe804;" d="M261 800c-60 0-109-65-109-144 0-80 49-145 109-145s110 65 110 145c0 79-49 144-110 144z m477 0c-61 0-110-65-110-144 0-80 49-145 110-145 60 0 110 65 110 145 0 79-50 144-110 144z m-244-599c-165 0-331-62-461-184l-3-3c-6-5-11-10-14-14-21-21-21-55-1-76 21-21 54-21 75-1l12 12 3 3c111 105 254 157 396 155 143-1 285-56 396-165 4-4 8-8 12-12 20-21 54-21 74-1 21 21 21 55 1 77-5 5-9 10-14 14-131 129-299 194-468 195-3 0-6 0-8 0z" horiz-adv-x="999" />
18
-
19
- <glyph glyph-name="mail" unicode="&#xe805;" d="M929 11v428q-18-20-39-36-149-115-238-189-28-24-46-37t-48-28-57-13h-2q-26 0-57 13t-48 28-46 37q-88 74-238 189-21 16-39 36v-428q0-7 6-13t12-5h822q7 0 12 5t6 13z m0 586v14t-1 7-1 7-3 5-5 4-8 2h-822q-7 0-12-6t-6-12q0-94 83-159 107-84 223-176 4-3 20-17t25-21 25-17 28-16 24-5h2q11 0 24 5t28 16 25 17 25 21 20 17q116 92 224 176 30 24 56 65t26 73z m71 21v-607q0-37-26-63t-63-27h-822q-36 0-63 27t-26 63v607q0 37 26 63t63 26h822q37 0 63-26t26-63z" horiz-adv-x="1000" />
20
-
21
- <glyph glyph-name="info-circled" unicode="&#xe806;" d="M571 82v89q0 8-5 13t-12 5h-54v286q0 8-5 13t-13 5h-178q-8 0-13-5t-5-13v-89q0-8 5-13t13-5h53v-179h-53q-8 0-13-5t-5-13v-89q0-8 5-13t13-5h250q7 0 12 5t5 13z m-71 500v89q0 8-5 13t-13 5h-107q-8 0-13-5t-5-13v-89q0-8 5-13t13-5h107q8 0 13 5t5 13z m357-232q0-117-57-215t-156-156-215-58-216 58-155 156-58 215 58 215 155 156 216 58 215-58 156-156 57-215z" horiz-adv-x="857.1" />
22
-
23
- <glyph glyph-name="help-circled" unicode="&#xe807;" d="M500 82v107q0 8-5 13t-13 5h-107q-8 0-13-5t-5-13v-107q0-8 5-13t13-5h107q8 0 13 5t5 13z m143 375q0 49-31 91t-77 65-95 23q-136 0-207-119-9-13 4-24l74-55q4-4 10-4 9 0 14 7 30 38 48 51 19 14 48 14 27 0 48-15t21-33q0-21-11-34t-38-25q-35-15-65-48t-29-70v-20q0-8 5-13t13-5h107q8 0 13 5t5 13q0 10 12 27t30 28q18 10 28 16t25 19 25 27 16 34 7 45z m214-107q0-117-57-215t-156-156-215-58-216 58-155 156-58 215 58 215 155 156 216 58 215-58 156-156 57-215z" horiz-adv-x="857.1" />
24
-
25
- <glyph glyph-name="heart" unicode="&#xe808;" d="M500-79q-14 0-25 10l-348 336q-5 5-15 15t-31 37-38 54-30 67-13 77q0 123 71 192t196 70q34 0 70-12t67-33 54-38 42-38q20 20 42 38t54 38 67 33 70 12q125 0 196-70t71-192q0-123-128-251l-347-335q-10-10-25-10z" horiz-adv-x="1000" />
26
-
27
- <glyph glyph-name="heart-empty" unicode="&#xe809;" d="M929 517q0 46-12 80t-31 55-46 33-52 18-55 4-62-14-62-36-48-40-34-34q-10-13-27-13t-27 13q-14 15-34 34t-48 40-62 36-62 14-55-4-52-18-46-33-31-55-12-80q0-93 105-198l324-312 324 312q105 105 105 198z m71 0q0-123-128-251l-347-335q-10-10-25-10t-25 10l-348 336q-5 5-15 15t-31 37-38 54-30 67-13 77q0 123 71 192t196 70q34 0 70-12t67-33 54-38 42-38q20 20 42 38t54 38 67 33 70 12q125 0 196-70t71-192z" horiz-adv-x="1000" />
28
-
29
- <glyph glyph-name="star" unicode="&#xe80a;" d="M929 489q0-12-15-27l-202-197 48-279q0-4 0-12 0-11-6-19t-17-9q-10 0-22 7l-251 132-250-132q-12-7-23-7-11 0-17 9t-6 19q0 4 1 12l48 279-203 197q-14 15-14 27 0 21 31 26l280 40 126 254q11 23 27 23t28-23l125-254 280-40q32-5 32-26z" horiz-adv-x="928.6" />
30
-
31
- <glyph glyph-name="star-empty" unicode="&#xe80b;" d="M635 290l170 166-235 34-106 213-105-213-236-34 171-166-41-235 211 111 211-111z m294 199q0-12-15-27l-202-197 48-279q0-4 0-12 0-28-23-28-10 0-22 7l-251 132-250-132q-12-7-23-7-11 0-17 9t-6 19q0 4 1 12l48 279-203 197q-14 15-14 27 0 21 31 26l280 40 126 254q11 23 27 23t28-23l125-254 280-40q32-5 32-26z" horiz-adv-x="928.6" />
32
-
33
- <glyph glyph-name="user" unicode="&#xe80c;" d="M714 69q0-60-35-104t-84-44h-476q-49 0-84 44t-35 104q0 48 5 90t17 85 33 73 52 50 76 19q73-72 174-72t175 72q42 0 75-19t52-50 33-73 18-85 4-90z m-143 495q0-88-62-151t-152-63-151 63-63 151 63 152 151 63 152-63 62-152z" horiz-adv-x="714.3" />
34
-
35
- <glyph glyph-name="users" unicode="&#xe80d;" d="M331 350q-90-3-148-71h-75q-45 0-77 22t-31 66q0 197 69 197 4 0 25-11t54-24 66-12q38 0 75 13-3-21-3-37 0-78 45-143z m598-356q0-66-41-105t-108-39h-488q-68 0-108 39t-41 105q0 30 2 58t8 61 14 61 24 54 35 45 48 30 62 11q6 0 24-12t41-26 59-27 76-12 75 12 60 27 41 26 24 12q34 0 62-11t47-30 35-45 24-54 15-61 8-61 2-58z m-572 713q0-59-42-101t-101-42-101 42-42 101 42 101 101 42 101-42 42-101z m393-214q0-89-63-152t-151-62-152 62-63 152 63 151 152 63 151-63 63-151z m321-126q0-43-31-66t-77-22h-75q-57 68-147 71 45 65 45 143 0 16-3 37 37-13 74-13 33 0 67 12t54 24 24 11q69 0 69-197z m-71 340q0-59-42-101t-101-42-101 42-42 101 42 101 101 42 101-42 42-101z" horiz-adv-x="1071.4" />
36
-
37
- <glyph glyph-name="th-large" unicode="&#xe80e;" d="M429 279v-215q0-29-22-50t-50-21h-286q-29 0-50 21t-21 50v215q0 29 21 50t50 21h286q29 0 50-21t22-50z m0 428v-214q0-29-22-50t-50-22h-286q-29 0-50 22t-21 50v214q0 29 21 50t50 22h286q29 0 50-22t22-50z m500-428v-215q0-29-22-50t-50-21h-286q-29 0-50 21t-21 50v215q0 29 21 50t50 21h286q29 0 50-21t22-50z m0 428v-214q0-29-22-50t-50-22h-286q-29 0-50 22t-21 50v214q0 29 21 50t50 22h286q29 0 50-22t22-50z" horiz-adv-x="928.6" />
38
-
39
- <glyph glyph-name="th" unicode="&#xe80f;" d="M286 154v-108q0-22-16-37t-38-16h-178q-23 0-38 16t-16 37v108q0 22 16 38t38 15h178q23 0 38-15t16-38z m0 285v-107q0-22-16-38t-38-15h-178q-23 0-38 15t-16 38v107q0 23 16 38t38 16h178q23 0 38-16t16-38z m357-285v-108q0-22-16-37t-38-16h-178q-23 0-38 16t-16 37v108q0 22 16 38t38 15h178q23 0 38-15t16-38z m-357 571v-107q0-22-16-38t-38-16h-178q-23 0-38 16t-16 38v107q0 22 16 38t38 16h178q23 0 38-16t16-38z m357-286v-107q0-22-16-38t-38-15h-178q-23 0-38 15t-16 38v107q0 23 16 38t38 16h178q23 0 38-16t16-38z m357-285v-108q0-22-16-37t-38-16h-178q-22 0-38 16t-16 37v108q0 22 16 38t38 15h178q23 0 38-15t16-38z m-357 571v-107q0-22-16-38t-38-16h-178q-23 0-38 16t-16 38v107q0 22 16 38t38 16h178q23 0 38-16t16-38z m357-286v-107q0-22-16-38t-38-15h-178q-22 0-38 15t-16 38v107q0 23 16 38t38 16h178q23 0 38-16t16-38z m0 286v-107q0-22-16-38t-38-16h-178q-22 0-38 16t-16 38v107q0 22 16 38t38 16h178q23 0 38-16t16-38z" horiz-adv-x="1000" />
40
-
41
- <glyph glyph-name="th-list" unicode="&#xe810;" d="M286 154v-108q0-22-16-37t-38-16h-178q-23 0-38 16t-16 37v108q0 22 16 38t38 15h178q23 0 38-15t16-38z m0 285v-107q0-22-16-38t-38-15h-178q-23 0-38 15t-16 38v107q0 23 16 38t38 16h178q23 0 38-16t16-38z m714-285v-108q0-22-16-37t-38-16h-535q-23 0-38 16t-16 37v108q0 22 16 38t38 15h535q23 0 38-15t16-38z m-714 571v-107q0-22-16-38t-38-16h-178q-23 0-38 16t-16 38v107q0 22 16 38t38 16h178q23 0 38-16t16-38z m714-286v-107q0-22-16-38t-38-15h-535q-23 0-38 15t-16 38v107q0 23 16 38t38 16h535q23 0 38-16t16-38z m0 286v-107q0-22-16-38t-38-16h-535q-23 0-38 16t-16 38v107q0 22 16 38t38 16h535q23 0 38-16t16-38z" horiz-adv-x="1000" />
42
-
43
- <glyph glyph-name="to-end" unicode="&#xe811;" d="M25-71q-10-11-18-8t-7 18v822q0 14 7 18t18-8l396-396q5-5 8-10v378q0 14 10 25t25 11h72q14 0 25-11t10-25v-786q0-14-10-25t-25-11h-72q-14 0-25 11t-10 25v379q-3-6-8-11z" horiz-adv-x="571.4" />
44
-
45
- <glyph glyph-name="to-start" unicode="&#xe812;" d="M546 771q11 11 18 8t7-18v-822q0-14-7-18t-18 8l-396 396q-5 5-7 11v-379q0-14-11-25t-25-11h-71q-15 0-25 11t-11 25v786q0 14 11 25t25 11h71q15 0 25-11t11-25v-378q2 5 7 10z" horiz-adv-x="571.4" />
46
-
47
- <glyph glyph-name="fast-fw" unicode="&#xe813;" d="M25-71q-10-11-18-8t-7 18v822q0 14 7 18t18-8l396-396q5-5 8-10v396q0 14 7 18t18-8l396-396q11-10 11-25t-11-25l-396-396q-11-11-18-8t-7 18v397q-3-6-8-11z" horiz-adv-x="928.6" />
48
-
49
- <glyph glyph-name="fast-bw" unicode="&#xe814;" d="M904 771q10 11 17 8t8-18v-822q0-14-8-18t-17 8l-397 396q-5 5-7 11v-397q0-14-7-18t-18 8l-396 396q-11 11-11 25t11 25l396 396q11 11 18 8t7-18v-396q2 5 7 10z" horiz-adv-x="928.6" />
50
-
51
- <glyph glyph-name="off" unicode="&#xe815;" d="M857 350q0-87-34-166t-91-137-137-92-166-34-167 34-136 92-92 137-34 166q0 102 45 191t126 151q24 18 54 14t46-28q18-23 14-53t-28-47q-54-41-84-101t-30-127q0-58 23-111t61-91 91-61 111-23 110 23 92 61 61 91 22 111q0 68-30 127t-84 101q-23 18-28 47t14 53q17 24 47 28t53-14q81-61 126-151t45-191z m-357 429v-358q0-29-21-50t-50-21-51 21-21 50v358q0 29 21 50t51 21 50-21 21-50z" horiz-adv-x="857.1" />
52
-
53
- <glyph glyph-name="chart-bar" unicode="&#xe816;" d="M357 350v-286h-143v286h143z m214 286v-572h-142v572h142z m572-643v-72h-1143v858h71v-786h1072z m-357 500v-429h-143v429h143z m214 214v-643h-143v643h143z" horiz-adv-x="1142.9" />
54
-
55
- <glyph glyph-name="home" unicode="&#xe817;" d="M786 296v-267q0-15-11-25t-25-11h-214v214h-143v-214h-214q-15 0-25 11t-11 25v267q0 1 0 2t0 2l321 264 321-264q1-1 1-4z m124 39l-34-41q-5-5-12-6h-2q-7 0-12 3l-386 322-386-322q-7-4-13-3-7 1-12 6l-35 41q-4 6-3 13t6 12l401 334q18 15 42 15t43-15l136-113v108q0 8 5 13t13 5h107q8 0 13-5t5-13v-227l122-102q6-4 6-12t-4-13z" horiz-adv-x="928.6" />
56
-
57
- <glyph glyph-name="link-1" unicode="&#xe818;" d="M813 171q0 23-16 38l-116 116q-16 16-38 16-24 0-40-18 1-1 10-10t12-12 9-11 7-14 2-15q0-23-16-38t-38-16q-8 0-15 2t-14 7-11 9-12 12-10 10q-19-17-19-40 0-23 16-38l115-116q15-15 38-15 22 0 38 15l82 81q16 16 16 37z m-393 394q0 22-15 38l-115 115q-16 16-38 16-22 0-38-15l-82-82q-16-15-16-37 0-22 16-38l116-116q15-15 38-15 23 0 40 17-2 2-11 11t-12 12-8 10-7 14-2 16q0 22 15 38t38 15q9 0 16-2t14-7 11-8 12-12 10-11q18 17 18 41z m500-394q0-66-48-113l-82-81q-46-47-113-47-68 0-114 48l-115 115q-46 47-46 114 0 68 49 116l-49 49q-48-49-116-49-67 0-114 47l-116 116q-47 47-47 114t47 113l82 82q47 46 114 46 67 0 114-47l115-116q46-46 46-113 0-69-49-117l49-49q48 49 116 49 67 0 114-47l116-116q47-47 47-114z" horiz-adv-x="928.6" />
58
-
59
- <glyph glyph-name="lock-open" unicode="&#xe819;" d="M929 529v-143q0-15-11-25t-25-11h-36q-14 0-25 11t-11 25v143q0 59-41 101t-101 41-101-41-42-101v-108h53q23 0 38-15t16-38v-322q0-22-16-37t-38-16h-535q-23 0-38 16t-16 37v322q0 22 16 38t38 15h375v108q0 103 73 176t177 74 176-74 74-176z" horiz-adv-x="928.6" />
60
-
61
- <glyph glyph-name="eye" unicode="&#xe81a;" d="M929 314q-85 132-213 197 34-58 34-125 0-103-73-177t-177-73-177 73-73 177q0 67 34 125-128-65-213-197 75-114 187-182t242-68 243 68 186 182z m-402 215q0 11-8 19t-19 7q-70 0-120-50t-50-119q0-11 8-19t19-8 19 8 8 19q0 48 34 82t82 34q11 0 19 8t8 19z m473-215q0-19-11-38-78-129-210-206t-279-77-279 77-210 206q-11 19-11 38t11 39q78 128 210 205t279 78 279-78 210-205q11-20 11-39z" horiz-adv-x="1000" />
62
-
63
- <glyph glyph-name="eye-off" unicode="&#xe81b;" d="M310 105l43 79q-48 35-76 88t-27 114q0 67 34 125-128-65-213-197 94-144 239-209z m217 424q0 11-8 19t-19 7q-70 0-120-50t-50-119q0-11 8-19t19-8 19 8 8 19q0 48 34 82t82 34q11 0 19 8t8 19z m202 106q0-4 0-5-59-105-176-316t-176-316l-28-50q-5-9-15-9-7 0-75 39-9 6-9 16 0 7 25 49-80 36-147 96t-117 137q-11 17-11 38t11 39q86 131 212 207t277 76q50 0 100-10l31 54q5 9 15 9 3 0 10-3t18-9 18-10 18-10 10-7q9-5 9-15z m21-249q0-78-44-142t-117-91l157 280q4-25 4-47z m250-72q0-19-11-38-22-36-61-81-84-96-194-149t-234-53l41 74q119 10 219 76t169 171q-65 100-158 164l35 63q53-36 102-85t81-103q11-19 11-39z" horiz-adv-x="1000" />
64
-
65
- <glyph glyph-name="download-1" unicode="&#xe81c;" d="M714 100q0 15-10 25t-25 11-25-11-11-25 11-25 25-11 25 11 10 25z m143 0q0 15-10 25t-26 11-25-11-10-25 10-25 25-11 26 11 10 25z m72 125v-179q0-22-16-37t-38-16h-821q-23 0-38 16t-16 37v179q0 22 16 38t38 16h259l75-76q33-32 76-32t76 32l76 76h259q22 0 38-16t16-38z m-182 318q10-23-8-39l-250-250q-10-11-25-11t-25 11l-250 250q-17 16-8 39 10 21 33 21h143v250q0 15 11 25t25 11h143q14 0 25-11t10-25v-250h143q24 0 33-21z" horiz-adv-x="928.6" />
66
-
67
- <glyph glyph-name="chat" unicode="&#xe81d;" d="M786 421q0-77-53-143t-143-104-197-38q-48 0-98 9-70-49-155-72-21-5-48-9h-2q-6 0-12 5t-6 12q-1 1-1 3t1 4 1 3l1 3t2 3 2 3 3 3 2 2q3 3 13 14t15 16 12 17 14 21 11 25q-69 40-108 98t-40 125q0 78 53 144t143 104 197 38 197-38 143-104 53-144z m214-142q0-67-40-126t-108-98q5-14 11-25t14-21 13-16 14-17 13-14q0 0 2-2t3-3 2-3 2-3l1-3t1-3 1-4-1-3q-2-8-7-13t-12-4q-28 4-48 9-86 23-156 72-50-9-98-9-151 0-263 74 32-3 49-3 90 0 172 25t148 72q69 52 107 119t37 141q0 43-13 85 72-39 114-99t42-128z" horiz-adv-x="1000" />
68
-
69
- <glyph glyph-name="comment" unicode="&#xe81e;" d="M1000 350q0-97-67-179t-182-130-251-48q-39 0-81 4-110-97-257-135-27-8-63-12-10-1-17 5t-10 16v1q-2 2 0 6t1 6 2 5l4 5t4 5 4 5q4 5 17 19t20 22 17 22 18 28 15 33 15 42q-88 50-138 123t-51 157q0 73 40 139t106 114 160 76 194 28q136 0 251-48t182-130 67-179z" horiz-adv-x="1000" />
70
-
71
- <glyph glyph-name="doc" unicode="&#xe81f;" d="M819 638q16-16 27-42t11-50v-642q0-23-15-38t-38-16h-750q-23 0-38 16t-16 38v892q0 23 16 38t38 16h500q22 0 49-11t42-27z m-248 136v-210h210q-5 17-12 23l-175 175q-6 7-23 12z m215-853v572h-232q-23 0-38 16t-16 37v233h-429v-858h715z" horiz-adv-x="857.1" />
72
-
73
- <glyph glyph-name="lock" unicode="&#xe820;" d="M179 421h285v108q0 59-42 101t-101 41-101-41-41-101v-108z m464-53v-322q0-22-16-37t-38-16h-535q-23 0-38 16t-16 37v322q0 22 16 38t38 15h17v108q0 102 74 176t176 74 177-74 73-176v-108h18q23 0 38-15t16-38z" horiz-adv-x="642.9" />
74
-
75
- <glyph glyph-name="emo-wink2" unicode="&#xe821;" d="M664 800c-61 0-110-65-110-144 0-80 49-145 110-145 60 0 110 65 110 145 0 79-50 144-110 144z m-343-98l-267 0c-30 0-54-24-54-54 0-30 24-54 54-54l267 0c30 0 54 24 54 54 0 30-24 54-54 54z m-262-361c-6 0-13-1-19-3-27-10-41-41-31-68 46-127 136-228 249-289 22-12 45-22 69-31 58-21 120-33 184-33 57 0 113 9 166 27 10 3 20 7 30 11 11 4 22 8 31 12l0 1 0 0 0 0c26 12 38 44 25 71-13 26-44 37-70 25l0 0c-9-4-17-8-24-11-8-3-17-6-25-8-43-14-88-22-133-22-51 0-101 10-148 27-19 7-37 15-55 25-90 48-163 130-200 231-8 21-28 35-49 35z" horiz-adv-x="774" />
76
-
77
- <glyph glyph-name="plus" unicode="&#xe822;" d="M786 439v-107q0-22-16-38t-38-15h-232v-233q0-22-16-37t-38-16h-107q-22 0-38 16t-15 37v233h-232q-23 0-38 15t-16 38v107q0 23 16 38t38 16h232v232q0 22 15 38t38 16h107q23 0 38-16t16-38v-232h232q23 0 38-16t16-38z" horiz-adv-x="785.7" />
78
-
79
- <glyph glyph-name="upload" unicode="&#xe823;" d="M936 128l2-260q0-21-16-37t-37-15l-832 0q-22 0-37 15t-16 37q0 260 1 260 0 12 2 17l105 312q12 36 48 36l209 0 0-103-171 0-86-262 722 0-86 262-171 0 0 103 208 0q37 0 49-36l105-312q1-5 1-17z m-258 423q-24 0-38 14l-119 120 0-348q0-21-15-37t-37-15-37 15-16 37l0 348-118-120q-14-14-38-14-22 0-36 14-15 15-15 36t15 37l245 247 245-247q15-15 15-37t-15-36q-14-14-36-14z" horiz-adv-x="938" />
80
-
81
- <glyph glyph-name="picture" unicode="&#xe824;" d="M357 529q0-45-31-76t-76-32-76 32-31 76 31 76 76 31 76-31 31-76z m572-215v-250h-786v107l178 179 90-89 285 285z m53 393h-893q-7 0-12-5t-6-13v-678q0-7 6-13t12-5h893q7 0 13 5t5 13v678q0 8-5 13t-13 5z m89-18v-678q0-37-26-63t-63-27h-893q-36 0-63 27t-26 63v678q0 37 26 63t63 27h893q37 0 63-27t26-63z" horiz-adv-x="1071.4" />
82
-
83
- <glyph glyph-name="ok" unicode="&#xe825;" d="M933 534q0-22-16-38l-404-404-76-76q-16-15-38-15t-38 15l-76 76-202 202q-15 16-15 38t15 38l76 76q16 16 38 16t38-16l164-165 366 367q16 16 38 16t38-16l76-76q16-15 16-38z" horiz-adv-x="1000" />
84
-
85
- <glyph glyph-name="cancel" unicode="&#xe826;" d="M724 112q0-22-15-38l-76-76q-16-15-38-15t-38 15l-164 165-164-165q-16-15-38-15t-38 15l-76 76q-16 16-16 38t16 38l164 164-164 164q-16 16-16 38t16 38l76 76q16 16 38 16t38-16l164-164 164 164q16 16 38 16t38-16l76-76q15-15 15-38t-15-38l-164-164 164-164q15-15 15-38z" horiz-adv-x="785.7" />
86
-
87
- <glyph glyph-name="pencil" unicode="&#xe827;" d="M203-7l50 51-131 131-51-51v-60h72v-71h60z m291 518q0 12-12 12-5 0-9-4l-303-302q-4-4-4-10 0-12 13-12 5 0 9 4l303 302q3 4 3 10z m-30 107l232-232-464-465h-232v233z m381-54q0-29-20-50l-93-93-232 233 93 92q20 21 50 21 29 0 51-21l131-131q20-22 20-51z" horiz-adv-x="857.1" />
88
-
89
- <glyph glyph-name="edit" unicode="&#xe828;" d="M496 189l64 65-85 85-64-65v-31h53v-54h32z m245 402q-9 9-18 0l-196-196q-9-9 0-18t18 0l196 196q9 9 0 18z m45-331v-106q0-67-47-114t-114-47h-464q-67 0-114 47t-47 114v464q0 66 47 113t114 48h464q35 0 65-14 9-4 10-13 2-10-5-16l-27-28q-8-8-18-4-13 3-25 3h-464q-37 0-63-26t-27-63v-464q0-37 27-63t63-27h464q37 0 63 27t26 63v70q0 7 5 12l36 36q8 8 20 4t11-16z m-54 411l161-160-375-375h-161v160z m248-73l-51-52-161 161 51 52q16 15 38 15t38-15l85-85q16-16 16-38t-16-38z" horiz-adv-x="1000" />
90
-
91
- <glyph glyph-name="forward" unicode="&#xe829;" d="M1000 493q0-15-11-25l-285-286q-11-11-25-11t-25 11-11 25v143h-125q-55 0-98-3t-86-12-74-24-59-39-45-56-27-77-10-101q0-31 3-69 0-4 2-13t1-15q0-8-5-14t-13-6q-9 0-15 10-4 5-8 12t-7 17-6 13q-71 159-71 252 0 111 30 186 90 225 488 225h125v143q0 14 11 25t25 10 25-10l285-286q11-11 11-25z" horiz-adv-x="1000" />
92
-
93
- <glyph glyph-name="export" unicode="&#xe82a;" d="M750 60l0 56 100 82 0-188q0-20-15-35t-35-15l-750 0q-20 0-35 15t-15 35l0 550q0 22 14 36t36 14l288 0q-32-24-59-49t-39-39l-10-12-130 0 0-450 650 0z m-82 348q-166 0-242-41t-160-181q0 8 1 22t9 56 22 79 44 83 70 79 107 56 149 23l0 156 332-250-332-260 0 178z" horiz-adv-x="1000" />
94
-
95
- <glyph glyph-name="trash-empty" unicode="&#xe82b;" d="M286 439v-321q0-8-5-13t-13-5h-36q-8 0-13 5t-5 13v321q0 8 5 13t13 5h36q8 0 13-5t5-13z m143 0v-321q0-8-5-13t-13-5h-36q-8 0-13 5t-5 13v321q0 8 5 13t13 5h36q8 0 13-5t5-13z m142 0v-321q0-8-5-13t-12-5h-36q-8 0-13 5t-5 13v321q0 8 5 13t13 5h36q7 0 12-5t5-13z m72-404v529h-500v-529q0-12 4-22t8-15 6-5h464q2 0 6 5t8 15 4 22z m-375 601h250l-27 65q-4 5-9 6h-177q-6-1-10-6z m518-18v-36q0-8-5-13t-13-5h-54v-529q0-46-26-80t-63-34h-464q-37 0-63 33t-27 79v531h-53q-8 0-13 5t-5 13v36q0 8 5 13t13 5h172l39 93q9 21 31 35t44 15h178q23 0 44-15t30-35l39-93h173q8 0 13-5t5-13z" horiz-adv-x="785.7" />
96
-
97
- <glyph glyph-name="down-dir" unicode="&#xe82c;" d="M571 457q0-14-10-25l-250-250q-11-11-25-11t-25 11l-250 250q-11 11-11 25t11 25 25 11h500q14 0 25-11t10-25z" horiz-adv-x="571.4" />
98
-
99
- <glyph glyph-name="up-dir" unicode="&#xe82d;" d="M571 171q0-14-10-25t-25-10h-500q-15 0-25 10t-11 25 11 26l250 250q10 10 25 10t25-10l250-250q10-11 10-26z" horiz-adv-x="571.4" />
100
-
101
- <glyph glyph-name="left-dir" unicode="&#xe82e;" d="M357 600v-500q0-14-10-25t-26-11-25 11l-250 250q-10 11-10 25t10 25l250 250q11 11 25 11t26-11 10-25z" horiz-adv-x="357.1" />
102
-
103
- <glyph glyph-name="right-dir" unicode="&#xe82f;" d="M321 350q0-14-10-25l-250-250q-11-11-25-11t-25 11-11 25v500q0 15 11 25t25 11 25-11l250-250q10-10 10-25z" horiz-adv-x="357.1" />
104
-
105
- <glyph glyph-name="spin1" unicode="&#xe830;" d="M496 850c-176 0-331-90-421-226-18-27-33-55-46-85-12-29-21-60-28-92 0 0 0-1 0-1l0 0 0 0c0-1 0-2 0-2 0-7 5-12 11-12l101 0c5 0 10 4 11 9 29 113 109 206 214 253 20 10 41 17 63 23 31 7 62 11 95 11l0 0 0 0 0 0c25 0 50-2 74-7 5-1 10-2 14-3 6-1 10-3 14-4l0 0c5-1 11 1 13 6l51 87c0 0 1 1 1 2 2 6-1 13-7 15-22 7-43 13-65 17-5 1-9 1-13 2-27 5-54 7-82 7l0 0 0 0z m327-114c-5 0-9-2-11-6l-50-87c-3-4-2-10 2-14 29-29 54-63 73-101 4-7 7-14 11-22 19-46 30-97 30-151l0 0 0 0c0-77-22-149-62-209-7-11-15-23-24-33-9-11-18-21-28-31l0 0 0 0 0 0c-4-4-5-10-2-14l50-87c0-1 1-2 2-3 4-5 11-5 16-1 58 52 104 117 134 190 6 15 11 29 15 44 14 46 21 94 21 144 0 108-34 209-92 291-11 16-23 31-37 46-13 14-26 28-41 41l0 0c-1 1-1 1-2 1-2 1-4 2-5 2z m-811-468l0 0c-1 0-2 0-3 0-6-1-10-8-9-14 34-166 149-302 302-366 30-12 61-21 93-28 32-6 66-10 100-10l0 0 0 0c40 0 79 5 117 14 7 1 14 3 22 5 6 2 13 5 20 7 1 0 2 1 3 1 6 3 8 10 4 16l-50 87c-3 5-8 7-13 6-14-4-28-7-42-9-3-1-6-1-8-2-18-2-35-3-53-3l0 0 0 0c-128 0-242 63-311 160-1 0-1 0-1 0-13 19-25 40-35 61-10 21-18 43-24 65-1 6-6 10-11 10l-101 0z" horiz-adv-x="1000" />
106
-
107
- <glyph glyph-name="spin2" unicode="&#xe831;" d="M46 144l0 0c0 0-1 0-1 0-8 18-15 37-21 55-6 19-11 38-15 58-19 99-8 203 35 298 3 6 10 8 15 5 1 0 2 0 2-1l0 0 80-59c5-3 6-9 4-14-5-12-9-25-12-37-4-13-7-26-9-40-11-67-3-137 23-201 2-5 0-10-4-13l0 0-80-56c-5-4-12-2-16 3-1 0-1 1-1 2l0 0z m120 574l0 0c0 1 0 1 0 1 15 13 30 25 46 37 16 11 33 22 51 31 89 50 192 72 297 60 6-1 10-6 10-13 0-1-1-1-1-2l0 0-31-94c-2-5-8-8-13-7-13 0-27 0-40 0-14-1-27-2-40-4-68-11-133-40-186-84-4-3-10-3-14 0l0 0-79 58c-5 3-6 11-2 16 0 0 1 1 2 1l0 0z m588 65l0 0c0 0 1 0 1 0 17-10 34-21 50-32 16-12 31-25 46-38 74-69 127-160 148-262 2-6-2-12-9-13-1 0-1 0-2 0l0 0-100 1c-5 0-10 4-11 9-3 13-8 26-12 38-5 12-10 25-17 36-31 61-78 113-137 150-5 3-6 8-5 13l0 0 31 92c2 6 9 9 15 7 1 0 2-1 2-1l0 0z m244-535l0 0c0 0 0 0 0 0-4-20-9-39-15-57-7-19-14-37-22-55-44-92-114-170-205-221-6-3-13-1-16 4 0 1-1 2-1 2l0 0-30 94c-2 6 1 12 6 14 11 7 22 15 32 23 11 9 21 18 30 27 49 48 84 109 101 176 2 5 6 8 11 8l0 0 98-1c6 0 11-5 11-11 0-1 0-2 0-3l0 0z m-438-395l0 0c0 0 0 0 0 0-20-2-40-3-60-3-20 0-40 1-59 4-102 12-198 54-276 125-5 4-5 11 0 16 0 0 1 1 1 1l0 0 81 58c5 3 12 2 16-2 10-8 20-16 32-23 11-7 22-14 34-20 62-31 131-45 200-41 6 0 10-3 12-8l0 0 29-92c2-6-1-12-7-14-1-1-2-1-3-1l0 0z" horiz-adv-x="1000" />
108
-
109
- <glyph glyph-name="mobile" unicode="&#xe832;" d="M480 840q42 0 71-29t29-71l0-780q0-40-29-70t-71-30l-380 0q-40 0-70 30t-30 70l0 780q0 42 30 71t70 29l380 0z m-190-940q30 0 50 15t20 35q0 22-20 36t-50 14q-28 0-49-15t-21-35 21-35 49-15z m210 150l0 660-420 0 0-660 420 0z" horiz-adv-x="580" />
110
-
111
- <glyph glyph-name="bell" unicode="&#xe833;" d="M509-96q0 8-9 8-33 0-57 24t-23 57q0 9-9 9t-9-9q0-41 29-70t69-28q9 0 9 9z m-372 160h726q-149 168-149 465 0 28-13 58t-39 58-67 45-95 17-95-17-67-45-39-58-13-58q0-297-149-465z m827 0q0-29-21-50t-50-21h-250q0-59-42-101t-101-42-101 42-42 101h-250q-29 0-50 21t-21 50q28 24 51 49t47 67 42 89 27 115 11 145q0 84 66 157t171 89q-5 10-5 21 0 23 16 38t38 16 38-16 16-38q0-11-5-21 106-16 171-89t66-157q0-78 11-145t28-115 41-89 48-67 50-49z" horiz-adv-x="1000" />
112
-
113
- <glyph glyph-name="ccw" unicode="&#xe834;" d="M857 350q0-87-34-166t-91-137-137-92-166-34q-96 0-183 41t-147 114q-4 6-4 13t5 11l76 77q6 5 14 5 9-1 13-7 41-53 100-82t126-29q58 0 110 23t92 61 61 91 22 111-22 111-61 91-92 61-110 23q-55 0-105-20t-90-57l77-77q17-16 8-38-10-23-33-23h-250q-15 0-25 11t-11 25v250q0 24 22 33 22 10 39-8l72-72q60 57 137 88t159 31q87 0 166-34t137-92 91-137 34-166z" horiz-adv-x="857.1" />
114
-
115
- <glyph glyph-name="wrench" unicode="&#xe835;" d="M214 29q0 14-10 25t-25 10-25-10-11-25 11-25 25-11 25 11 10 25z m360 234l-381-381q-21-20-50-20-29 0-51 20l-59 61q-21 20-21 50 0 29 21 51l380 380q22-55 64-97t97-64z m354 243q0-22-13-59-27-75-92-122t-144-46q-104 0-177 73t-73 177 73 176 177 74q32 0 67-10t60-26q9-6 9-15t-9-16l-163-94v-125l108-60q2 2 44 27t75 45 40 20q8 0 13-5t5-14z" horiz-adv-x="928.6" />
116
-
117
- <glyph glyph-name="stop-1" unicode="&#xe837;" d="M857 743v-786q0-14-10-25t-26-11h-785q-15 0-25 11t-11 25v786q0 14 11 25t25 11h785q15 0 26-11t10-25z" horiz-adv-x="857.1" />
118
-
119
- <glyph glyph-name="spin5" unicode="&#xe838;" d="M462 850c-6 0-11-5-11-11l0-183 0 0c0-6 5-11 11-11l69 0c1 0 1 0 1 0 7 0 12 5 12 11l0 183 0 0c0 6-5 11-12 11l-69 0c0 0 0 0-1 0z m250-47c-4 1-8-2-10-5l-91-158 0 0c-4-6-2-13 4-16l60-34c0-1 0-1 0-1 6-3 13-1 16 4l91 158c3 6 2 13-4 16l-61 35c-1 1-3 1-5 1z m-428-2c-2 0-4-1-6-2l-61-35c-5-3-7-10-4-16l91-157c0 0 0 0 0 0 3-6 10-8 16-5l61 35c5 4 7 11 4 16l-91 157c0 1 0 1 0 1-2 4-6 6-10 6z m620-163c-2 0-4 0-6-1l-157-91c0 0 0 0 0 0-6-3-8-10-5-16l35-61c4-5 11-7 16-4l157 91c1 0 1 0 1 0 6 3 7 11 4 16l-35 61c-2 4-6 6-10 5z m-810-4c-5 0-9-2-11-6l-35-61c-3-5-1-12 4-15l158-91 0 0c6-4 13-2 16 4l35 60c0 0 0 0 0 0 3 6 1 13-4 16l-158 91c-2 1-4 2-5 2z m712-235l0 0c-6 0-11-5-11-11l0-69c0-1 0-1 0-1 0-7 5-12 11-12l183 0 0 0c6 0 11 5 11 12l0 69c0 0 0 0 0 1 0 6-5 11-11 11l-183 0z m-794-5l0 0c-7 0-12-5-12-12l0-69c0 0 0 0 0-1 0-6 5-11 12-11l182 0 0 0c6 0 11 5 11 11l0 69c0 1 0 1 0 1 0 7-5 12-11 12l-182 0z m772-153c-4 0-8-2-10-6l-34-60c-1 0-1 0-1 0-3-6-1-13 4-16l158-91c6-3 13-1 16 4l35 61c3 5 1 12-4 15l-158 92 0 0c-2 1-4 1-6 1z m-566-5c-1 0-3 0-5-1l-157-91c0 0-1 0-1 0-5-3-7-10-4-16l35-61c3-5 10-7 16-4l157 91c0 0 0 0 0 0 6 3 8 10 5 16l-35 61c-3 3-7 6-11 5z m468-121c-2 0-4 0-6-1l-61-35c-5-4-7-11-4-16l91-157c0-1 0-1 0-1 3-6 11-7 16-4l61 35c5 3 7 10 4 16l-91 157c0 0 0 0 0 0-2 4-6 6-10 6z m-367-2c-4 0-8-2-10-6l-91-158c-3-6-1-13 4-16l61-35c5-3 12-1 15 4l92 158 0 0c3 6 1 13-5 16l-60 35c0 0 0 0 0 0-2 1-4 1-6 2z m149-58c-7 0-12-5-12-11l0-183 0 0c0-6 5-11 12-11l69 0c0 0 0 0 1 0 6 0 11 5 11 11l0 183 0 0c0 6-5 11-11 11l-69 0c-1 0-1 0-1 0z" horiz-adv-x="1000" />
120
-
121
- <glyph glyph-name="pause-1" unicode="&#xe839;" d="M857 743v-786q0-14-10-25t-26-11h-285q-15 0-25 11t-11 25v786q0 14 11 25t25 11h285q15 0 26-11t10-25z m-500 0v-786q0-14-10-25t-26-11h-285q-15 0-25 11t-11 25v786q0 14 11 25t25 11h285q15 0 26-11t10-25z" horiz-adv-x="857.1" />
122
-
123
- <glyph glyph-name="play-1" unicode="&#xe83a;" d="M772 333l-741-412q-13-7-22-2t-9 20v822q0 14 9 20t22-2l741-412q13-7 13-17t-13-17z" horiz-adv-x="785.7" />
124
-
125
- <glyph glyph-name="link-ext" unicode="&#xf08e;" d="M786 332v-178q0-67-47-114t-114-47h-464q-67 0-114 47t-47 114v464q0 66 47 113t114 48h393q7 0 12-5t5-13v-36q0-8-5-13t-12-5h-393q-37 0-63-26t-27-63v-464q0-37 27-63t63-27h464q37 0 63 27t26 63v178q0 8 5 13t13 5h36q8 0 13-5t5-13z m214 482v-285q0-15-11-25t-25-11-25 11l-98 98-364-364q-5-6-13-6t-12 6l-64 64q-6 5-6 12t6 13l364 364-98 98q-11 11-11 25t11 25 25 11h285q15 0 25-11t11-25z" horiz-adv-x="1000" />
126
-
127
- <glyph glyph-name="menu" unicode="&#xf0c9;" d="M857 100v-71q0-15-10-25t-26-11h-785q-15 0-25 11t-11 25v71q0 15 11 25t25 11h785q15 0 26-11t10-25z m0 286v-72q0-14-10-25t-26-10h-785q-15 0-25 10t-11 25v72q0 14 11 25t25 10h785q15 0 26-10t10-25z m0 285v-71q0-14-10-25t-26-11h-785q-15 0-25 11t-11 25v71q0 15 11 26t25 10h785q15 0 26-10t10-26z" horiz-adv-x="857.1" />
128
-
129
- <glyph glyph-name="sort" unicode="&#xf0dc;" d="M571 243q0-15-10-25l-250-250q-11-11-25-11t-25 11l-250 250q-11 10-11 25t11 25 25 11h500q14 0 25-11t10-25z m0 214q0-14-10-25t-25-11h-500q-15 0-25 11t-11 25 11 25l250 250q10 11 25 11t25-11l250-250q10-10 10-25z" horiz-adv-x="571.4" />
130
-
131
- <glyph glyph-name="mail-alt" unicode="&#xf0e0;" d="M1000 454v-443q0-37-26-63t-63-27h-822q-36 0-63 27t-26 63v443q25-27 56-49 202-137 278-192 32-24 51-37t53-27 61-13h2q28 0 61 13t53 27 51 37q95 68 278 192 32 22 56 49z m0 164q0-44-27-84t-68-69q-210-146-262-181-5-4-23-17t-30-22-29-18-32-15-28-5h-2q-12 0-27 5t-32 15-30 18-30 22-23 17q-51 35-147 101t-114 80q-35 23-65 64t-31 77q0 43 23 72t66 29h822q36 0 63-26t26-63z" horiz-adv-x="1000" />
132
-
133
- <glyph glyph-name="lightbulb" unicode="&#xf0eb;" d="M411 529q0-8-6-13t-12-5-13 5-5 13q0 25-30 39t-59 14q-7 0-13 5t-5 13 5 13 13 5q28 0 55-9t49-30 21-50z m89 0q0 40-19 74t-50 57-69 35-76 12-76-12-69-35-50-57-20-74q0-57 38-101 6-6 17-18t17-19q72-85 79-166h127q8 81 79 166 6 6 17 19t17 18q38 44 38 101z m71 0q0-87-57-150-25-27-42-48t-33-54-19-60q26-15 26-46 0-20-13-35 13-15 13-36 0-29-25-45 8-13 8-26 0-26-18-40t-43-14q-11-25-34-39t-48-15-49 15-33 39q-26 0-44 14t-17 40q0 13 7 26-25 16-25 45 0 21 14 36-14 15-14 35 0 31 26 46-2 28-19 60t-33 54-41 48q-58 63-58 150 0 55 25 103t65 79 92 49 104 19 104-19 91-49 66-79 24-103z" horiz-adv-x="571.4" />
134
-
135
- <glyph glyph-name="exchange" unicode="&#xf0ec;" d="M1000 189v-107q0-7-5-12t-13-6h-768v-107q0-7-5-12t-13-6q-6 0-13 6l-178 178q-5 6-5 13 0 8 5 13l179 178q5 5 12 5 8 0 13-5t5-13v-107h768q7 0 13-5t5-13z m0 304q0-8-5-13l-179-178q-5-6-12-6-8 0-13 6t-5 12v107h-768q-7 0-13 6t-5 12v107q0 8 5 13t13 5h768v107q0 8 5 13t13 5q6 0 13-5l178-178q5-5 5-13z" horiz-adv-x="1000" />
136
-
137
- <glyph glyph-name="upload-cloud" unicode="&#xf0ee;" d="M714 368q0 8-5 13l-196 196q-5 5-13 5t-13-5l-196-196q-5-6-5-13 0-8 5-13t13-5h125v-196q0-8 5-13t12-5h108q7 0 12 5t5 13v196h125q8 0 13 5t5 13z m357-161q0-89-62-151t-152-63h-607q-103 0-177 73t-73 177q0 72 39 134t105 92q-1 17-1 24 0 118 84 202t202 84q87 0 159-49t105-129q40 35 93 35 59 0 101-42t42-101q0-43-23-77 72-17 119-76t46-133z" horiz-adv-x="1071.4" />
138
-
139
- <glyph glyph-name="bell-alt" unicode="&#xf0f3;" d="M509-96q0 8-9 8-33 0-57 24t-23 57q0 9-9 9t-9-9q0-41 29-70t69-28q9 0 9 9z m455 160q0-29-21-50t-50-21h-250q0-59-42-101t-101-42-101 42-42 101h-250q-29 0-50 21t-21 50q28 24 51 49t47 67 42 89 27 115 11 145q0 84 66 157t171 89q-5 10-5 21 0 23 16 38t38 16 38-16 16-38q0-11-5-21 106-16 171-89t66-157q0-78 11-145t28-115 41-89 48-67 50-49z" horiz-adv-x="1000" />
140
-
141
- <glyph glyph-name="doc-text" unicode="&#xf0f6;" d="M819 638q16-16 27-42t11-50v-642q0-23-15-38t-38-16h-750q-23 0-38 16t-16 38v892q0 23 16 38t38 16h500q22 0 49-11t42-27z m-248 136v-210h210q-5 17-12 23l-175 175q-6 7-23 12z m215-853v572h-232q-23 0-38 16t-16 37v233h-429v-858h715z m-572 483q0 7 5 12t13 5h393q8 0 13-5t5-12v-36q0-8-5-13t-13-5h-393q-8 0-13 5t-5 13v36z m411-125q8 0 13-5t5-13v-36q0-8-5-13t-13-5h-393q-8 0-13 5t-5 13v36q0 8 5 13t13 5h393z m0-143q8 0 13-5t5-13v-36q0-8-5-13t-13-5h-393q-8 0-13 5t-5 13v36q0 8 5 13t13 5h393z" horiz-adv-x="857.1" />
142
-
143
- <glyph glyph-name="angle-double-left" unicode="&#xf100;" d="M350 82q0-7-6-13l-28-28q-5-5-12-5t-13 5l-260 261q-6 5-6 12t6 13l260 260q5 6 13 6t12-6l28-28q6-5 6-13t-6-12l-219-220 219-219q6-6 6-13z m214 0q0-7-5-13l-28-28q-6-5-13-5t-13 5l-260 261q-6 5-6 12t6 13l260 260q6 6 13 6t13-6l28-28q5-5 5-13t-5-12l-220-220 220-219q5-6 5-13z" horiz-adv-x="571.4" />
144
-
145
- <glyph glyph-name="angle-double-right" unicode="&#xf101;" d="M332 314q0-7-5-12l-261-261q-5-5-12-5t-13 5l-28 28q-6 6-6 13t6 13l219 219-219 220q-6 5-6 12t6 13l28 28q5 6 13 6t12-6l261-260q5-5 5-13z m214 0q0-7-5-12l-260-261q-6-5-13-5t-13 5l-28 28q-5 6-5 13t5 13l219 219-219 220q-5 5-5 12t5 13l28 28q6 6 13 6t13-6l260-260q5-5 5-13z" horiz-adv-x="571.4" />
146
-
147
- <glyph glyph-name="angle-double-up" unicode="&#xf102;" d="M600 118q0-7-6-13l-28-28q-5-5-12-5t-13 5l-220 219-219-219q-5-5-13-5t-12 5l-28 28q-6 6-6 13t6 13l260 260q5 5 12 5t13-5l260-260q6-6 6-13z m0 214q0-7-6-13l-28-28q-5-5-12-5t-13 5l-220 220-219-220q-5-5-13-5t-12 5l-28 28q-6 6-6 13t6 13l260 260q5 6 12 6t13-6l260-260q6-6 6-13z" horiz-adv-x="642.9" />
148
-
149
- <glyph glyph-name="angle-double-down" unicode="&#xf103;" d="M600 368q0-7-6-13l-260-260q-5-6-13-6t-12 6l-260 260q-6 6-6 13t6 13l28 28q5 5 12 5t13-5l219-220 220 220q5 5 13 5t12-5l28-28q6-6 6-13z m0 214q0-7-6-13l-260-260q-5-5-13-5t-12 5l-260 260q-6 6-6 13t6 13l28 28q5 6 12 6t13-6l219-219 220 219q5 6 13 6t12-6l28-28q6-6 6-13z" horiz-adv-x="642.9" />
150
-
151
- <glyph glyph-name="desktop" unicode="&#xf108;" d="M1000 296v465q0 7-5 12t-13 6h-893q-7 0-12-6t-6-12v-465q0-7 6-12t12-5h893q7 0 13 5t5 12z m71 465v-607q0-37-26-63t-63-27h-303q0-20 9-43t17-40 9-24q0-14-10-25t-25-11h-286q-15 0-25 11t-11 25q0 8 9 25t18 39 9 43h-304q-36 0-63 27t-26 63v607q0 37 26 63t63 26h893q37 0 63-26t26-63z" horiz-adv-x="1071.4" />
152
-
153
- <glyph glyph-name="laptop" unicode="&#xf109;" d="M232 136q-37 0-63 26t-26 63v393q0 37 26 63t63 26h607q37 0 63-26t27-63v-393q0-37-27-63t-63-26h-607z m-18 482v-393q0-7 6-13t12-5h607q8 0 13 5t5 13v393q0 7-5 12t-13 6h-607q-7 0-12-6t-6-12z m768-518h89v-54q0-22-26-37t-63-16h-893q-36 0-63 16t-26 37v54h982z m-402-54q9 0 9 9t-9 9h-89q-9 0-9-9t9-9h89z" horiz-adv-x="1071.4" />
154
-
155
- <glyph glyph-name="tablet" unicode="&#xf10a;" d="M357 64q0 15-10 25t-26 11-25-11-10-25 10-25 25-10 26 10 10 25z m214 90v535q0 8-5 13t-12 5h-465q-7 0-12-5t-6-13v-535q0-8 6-13t12-5h465q7 0 12 5t5 13z m72 535v-607q0-37-26-63t-63-26h-465q-36 0-63 26t-26 63v607q0 37 26 63t63 27h465q36 0 63-27t26-63z" horiz-adv-x="642.9" />
156
-
157
- <glyph glyph-name="circle-empty" unicode="&#xf10c;" d="M429 654q-83 0-153-41t-110-111-41-152 41-152 110-111 153-41 152 41 110 111 41 152-41 152-110 111-152 41z m428-304q0-117-57-215t-156-156-215-58-216 58-155 156-58 215 58 215 155 156 216 58 215-58 156-156 57-215z" horiz-adv-x="857.1" />
158
-
159
- <glyph glyph-name="circle" unicode="&#xf111;" d="M857 350q0-117-57-215t-156-156-215-58-216 58-155 156-58 215 58 215 155 156 216 58 215-58 156-156 57-215z" horiz-adv-x="857.1" />
160
-
161
- <glyph glyph-name="unlink" unicode="&#xf127;" d="M245 141l-143-143q-6-5-13-5t-12 5q-6 6-6 13t6 13l142 142q6 5 13 5t13-5q5-5 5-12t-5-13z m94-23v-179q0-8-5-13t-13-5-12 5-5 13v179q0 8 5 13t12 5 13-5 5-13z m-125 125q0-8-5-13t-13-5h-178q-8 0-13 5t-5 13 5 13 13 5h178q8 0 13-5t5-13z m706-72q0-66-48-113l-82-81q-46-47-113-47-68 0-114 48l-186 187q-12 12-24 31l134 10 152-153q15-15 38-15t38 15l82 81q16 16 16 37 0 23-16 38l-153 154 10 133q20-11 31-23l188-188q47-48 47-114z m-345 404l-133-10-152 153q-16 16-38 16-22 0-38-15l-82-82q-16-15-16-37 0-22 16-38l153-153-10-134q-20 12-32 24l-187 187q-47 48-47 114 0 67 47 113l82 82q47 46 114 46 67 0 114-47l186-187q12-12 23-32z m354-46q0-8-5-13t-13-5h-179q-8 0-13 5t-5 13 5 12 13 5h179q8 0 13-5t5-12z m-304 303v-178q0-8-5-13t-13-5-13 5-5 13v178q0 8 5 13t13 5 13-5 5-13z m227-84l-143-143q-6-5-13-5t-12 5q-5 6-5 13t5 13l143 143q5 5 12 5t13-5q5-6 5-13t-5-13z" horiz-adv-x="928.6" />
162
-
163
- <glyph glyph-name="help" unicode="&#xf128;" d="M393 149v-134q0-9-7-15t-15-7h-134q-9 0-16 7t-7 15v134q0 9 7 16t16 6h134q9 0 15-6t7-16z m176 335q0-30-8-56t-20-43-31-33-32-25-34-19q-23-13-38-37t-15-37q0-10-7-18t-16-9h-134q-8 0-14 11t-6 20v26q0 46 37 87t79 60q33 16 47 32t14 42q0 24-26 41t-60 18q-36 0-60-16-20-14-60-64-7-9-17-9-7 0-14 4l-91 70q-8 6-9 14t3 16q89 148 259 148 45 0 90-17t81-46 59-72 23-88z" horiz-adv-x="571.4" />
164
-
165
- <glyph glyph-name="info" unicode="&#xf129;" d="M357 100v-71q0-15-10-25t-26-11h-285q-15 0-25 11t-11 25v71q0 15 11 25t25 11h35v214h-35q-15 0-25 11t-11 25v71q0 15 11 25t25 11h214q15 0 25-11t11-25v-321h35q15 0 26-11t10-25z m-71 643v-107q0-15-11-25t-25-11h-143q-14 0-25 11t-11 25v107q0 14 11 25t25 11h143q15 0 25-11t11-25z" horiz-adv-x="357.1" />
166
-
167
- <glyph glyph-name="attention-alt" unicode="&#xf12a;" d="M286 154v-125q0-15-11-25t-25-11h-143q-14 0-25 11t-11 25v125q0 14 11 25t25 10h143q15 0 25-10t11-25z m17 589l-16-429q-1-14-12-25t-25-10h-143q-14 0-25 10t-12 25l-15 429q-1 14 10 25t24 11h179q14 0 25-11t10-25z" horiz-adv-x="357.1" />
168
-
169
- <glyph glyph-name="ellipsis" unicode="&#xf141;" d="M214 439v-107q0-22-15-38t-38-15h-107q-23 0-38 15t-16 38v107q0 23 16 38t38 16h107q22 0 38-16t15-38z m286 0v-107q0-22-16-38t-38-15h-107q-22 0-38 15t-15 38v107q0 23 15 38t38 16h107q23 0 38-16t16-38z m286 0v-107q0-22-16-38t-38-15h-107q-22 0-38 15t-16 38v107q0 23 16 38t38 16h107q23 0 38-16t16-38z" horiz-adv-x="785.7" />
170
-
171
- <glyph glyph-name="ellipsis-vert" unicode="&#xf142;" d="M214 154v-108q0-22-15-37t-38-16h-107q-23 0-38 16t-16 37v108q0 22 16 38t38 15h107q22 0 38-15t15-38z m0 285v-107q0-22-15-38t-38-15h-107q-23 0-38 15t-16 38v107q0 23 16 38t38 16h107q22 0 38-16t15-38z m0 286v-107q0-22-15-38t-38-16h-107q-23 0-38 16t-16 38v107q0 22 16 38t38 16h107q22 0 38-16t15-38z" horiz-adv-x="214.3" />
172
-
173
- <glyph glyph-name="euro" unicode="&#xf153;" d="M545 121l19-89q2-7-1-13t-10-8l-3 0q-2-1-6-2t-9-3-12-3-14-3-16-2-19-3-21-2-21 0q-131 0-228 73t-133 196h-53q-7 0-13 5t-5 13v63q0 7 5 12t13 6h37q-1 31 0 58h-37q-8 0-13 5t-5 13v64q0 8 5 13t13 5h55q37 117 135 188t224 72q57 0 108-13 6-2 11-9 4-6 2-13l-24-89q-2-7-8-11t-13-1l-2 1q-3 0-7 1l-10 2t-12 2-15 2-16 1-16 1q-71 0-126-36t-84-98h261q9 0 14-7 6-7 4-15l-13-63q-3-15-18-15h-273q-1-20 0-58h257q8 0 13-7 5-7 4-15l-14-63q-1-6-6-10t-11-4h-216q27-65 84-104t127-38q10 0 20 1t19 2 16 2 14 3 10 3l7 1 3 2q7 2 14-2 7-3 9-11z" horiz-adv-x="571.4" />
174
-
175
- <glyph glyph-name="pound" unicode="&#xf154;" d="M569 216v-205q0-8-5-13t-13-5h-533q-8 0-13 5t-5 13v83q0 8 5 13t13 5h54v214h-53q-8 0-13 5t-5 13v73q0 8 5 13t13 5h53v124q0 96 69 158t175 62q104 0 187-70 5-5 6-12t-4-12l-57-71q-5-6-13-7-7-1-13 4-2 3-14 11t-39 18-51 10q-48 0-77-27t-29-68v-120h170q8 0 13-5t5-13v-73q0-7-5-13t-13-5h-170v-211h231v101q0 7 5 12t13 5h90q8 0 13-5t5-12z" horiz-adv-x="571.4" />
176
-
177
- <glyph glyph-name="dollar" unicode="&#xf155;" d="M546 189q0-86-56-147t-144-77v-97q0-8-5-13t-13-5h-75q-7 0-13 5t-5 13v97q-37 5-71 18t-57 25-41 26-26 21-10 10q-9 12-1 23l58 76q3 5 12 6 9 1 14-5l1-1q63-55 135-70 21-4 42-4 45 0 79 24t35 68q0 16-9 30t-18 23-33 21-37 18-45 18q-21 9-34 14t-34 15-35 17-32 20-29 24-25 27-20 32-11 37-5 44q0 77 55 135t142 75v100q0 7 5 13t13 5h75q8 0 13-5t5-13v-98q32-3 62-13t48-19 36-20 21-17 9-7q9-11 3-22l-46-81q-4-9-12-9-8-2-15 4-2 2-9 7t-21 14-33 18-42 15-47 6q-53 0-87-24t-33-62q0-14 4-27t17-23 22-18 31-18 34-15 39-15q30-11 45-17t43-20 42-24 34-28 30-35 18-43 7-52z" horiz-adv-x="571.4" />
178
-
179
- <glyph glyph-name="rupee" unicode="&#xf156;" d="M501 588v-57q0-8-5-13t-13-5h-93q-13-80-72-131t-154-61q93-99 256-299 8-9 2-19-5-10-16-10h-109q-9 0-14 7-171 204-278 318-5 5-5 13v70q0 8 5 13t13 5h62q74 0 119 24t57 70h-238q-8 0-13 5t-5 13v57q0 8 5 13t13 5h230q-31 63-149 63h-81q-7 0-13 5t-5 13v74q0 8 5 13t13 5h464q8 0 13-5t5-13v-57q0-8-5-13t-13-5h-130q26-34 36-80h95q8 0 13-5t5-13z" horiz-adv-x="501.1" />
180
-
181
- <glyph glyph-name="yen" unicode="&#xf157;" d="M337-7h-96q-8 0-13 5t-5 13v184h-161q-7 0-13 5t-5 13v57q0 8 5 13t13 5h161v48h-161q-7 0-13 5t-5 12v58q0 8 5 13t13 5h119l-179 323q-4 9 0 18 6 9 16 9h108q11 0 16-10l120-238q11-21 32-69 5 13 17 38t15 34l107 234q4 11 16 11h106q10 0 15-9 5-8 1-18l-175-323h120q7 0 13-5t5-13v-58q0-7-5-12t-13-5h-162v-48h162q7 0 13-5t5-13v-57q0-8-5-13t-13-5h-162v-184q0-7-5-13t-12-5z" horiz-adv-x="573.1" />
182
-
183
- <glyph glyph-name="rouble" unicode="&#xf158;" d="M582 535q0 56-36 90t-96 35h-178v-250h178q60 0 96 34t36 91z m132 0q0-108-70-176t-182-68h-190v-66h282q7 0 12-5t5-13v-71q0-8-5-13t-12-5h-282v-107q0-8-5-13t-13-5h-93q-8 0-13 5t-5 13v107h-125q-8 0-13 5t-5 13v71q0 8 5 13t13 5h125v66h-125q-8 0-13 5t-5 13v83q0 7 5 12t13 6h125v351q0 8 5 13t13 5h301q111 0 182-68t70-176z" horiz-adv-x="714.3" />
184
-
185
- <glyph glyph-name="won" unicode="&#xf159;" d="M287 183l45 167h-89l42-167q1-1 1-2t0-2q0 1 1 2t0 2z m65 238l19 72h-163l18-72h126z m107 0h77l-19 72h-39z m250-238l44 167h-91l46-167q0 0 0-2t1-2q0 1 0 2t0 2z m62 238l19 72h-166l19-72h128z m229-17v-36q0-8-5-13t-13-5h-119l-91-344q-4-13-17-13h-89q-14 0-18 13l-92 344h-117l-93-344q-4-13-17-13h-89q-6 0-11 4t-6 9l-89 344h-116q-8 0-13 5t-5 13v36q0 7 5 12t13 5h98l-19 72h-79q-8 0-13 5t-5 13v35q0 8 5 13t13 5h61l-50 192q-3 9 3 16 5 7 14 7h77q14 0 17-14l50-201h201l54 201q4 14 17 14h70q14 0 18-14l54-201h204l52 201q3 14 17 14h77q9 0 14-7 6-7 3-16l-51-192h62q8 0 13-5t5-13v-35q0-8-5-13t-13-5h-81l-19-72h100q8 0 13-5t5-12z" horiz-adv-x="1000" />
186
-
187
- <glyph glyph-name="bitcoin" unicode="&#xf15a;" d="M651 493q10-102-73-144 65-16 98-58t25-119q-4-40-18-70t-36-49-54-33-68-19-81-9v-142h-86v140q-45 0-68 1v-141h-86v142q-10 0-30 1t-31 0h-112l18 102h62q27 0 32 28v225h9q-4 0-9 0v161q-7 37-50 37h-62v92l119-1q35 0 54 1v141h86v-138q45 1 68 1v137h86v-141q44-4 78-13t63-25 46-43 20-64z m-120-304q0 20-8 35t-21 26-32 17-36 11-42 5-38 1-36 0-27-1v-189q5 0 21 0t27 0 29 1 33 2 32 5 31 8 26 11 22 17 14 22 5 29z m-39 265q0 19-7 33t-17 23-27 16-31 9-34 5-32 1-31 0-22-1v-171q3 0 20 0t26 0 27 1 31 3 29 6 27 10 21 15 15 22 5 28z" horiz-adv-x="714.3" />
188
-
189
- <glyph glyph-name="sort-alt-up" unicode="&#xf160;" d="M411 46q0-6-6-13l-178-178q-5-5-13-5-6 0-12 5l-179 179q-8 9-4 19 4 11 17 11h107v768q0 8 5 13t13 5h107q8 0 13-5t5-13v-768h107q8 0 13-5t5-13z m589-71v-107q0-8-5-13t-13-5h-464q-8 0-13 5t-5 13v107q0 8 5 13t13 5h464q8 0 13-5t5-13z m-107 286v-107q0-8-5-13t-13-5h-357q-8 0-13 5t-5 13v107q0 8 5 13t13 5h357q8 0 13-5t5-13z m-107 285v-107q0-7-5-12t-13-6h-250q-8 0-13 6t-5 12v107q0 8 5 13t13 5h250q8 0 13-5t5-13z m-107 286v-107q0-8-5-13t-13-5h-143q-8 0-13 5t-5 13v107q0 8 5 13t13 5h143q8 0 13-5t5-13z" horiz-adv-x="1000" />
190
-
191
- <glyph glyph-name="sort-alt-down" unicode="&#xf161;" d="M679-25v-107q0-8-5-13t-13-5h-143q-8 0-13 5t-5 13v107q0 8 5 13t13 5h143q8 0 13-5t5-13z m-268 71q0-6-6-13l-178-178q-5-5-13-5-6 0-12 5l-179 179q-8 9-4 19 4 11 17 11h107v768q0 8 5 13t13 5h107q8 0 13-5t5-13v-768h107q8 0 13-5t5-13z m375 215v-107q0-8-5-13t-13-5h-250q-8 0-13 5t-5 13v107q0 8 5 13t13 5h250q8 0 13-5t5-13z m107 285v-107q0-7-5-12t-13-6h-357q-8 0-13 6t-5 12v107q0 8 5 13t13 5h357q8 0 13-5t5-13z m107 286v-107q0-8-5-13t-13-5h-464q-8 0-13 5t-5 13v107q0 8 5 13t13 5h464q8 0 13-5t5-13z" horiz-adv-x="1000" />
192
-
193
- <glyph glyph-name="bug" unicode="&#xf188;" d="M911 314q0-14-11-25t-25-10h-125q0-96-37-162l116-117q10-11 10-25t-10-25q-10-11-25-11t-25 11l-111 110q-3-3-8-7t-24-16-36-21-46-16-54-7v500h-71v-500q-29 0-57 7t-49 19-36 22-25 18l-8 8-102-116q-11-12-27-12-13 0-24 9-11 10-11 25t8 26l113 127q-32 63-32 153h-125q-15 0-25 10t-11 25 11 25 25 11h125v164l-97 97q-11 10-11 25t11 25 25 10 25-10l97-97h471l96 97q11 10 25 10t26-10 10-25-10-25l-97-97v-164h125q15 0 25-11t11-25z m-268 322h-357q0 74 52 126t126 52 127-52 52-126z" horiz-adv-x="928.6" />
194
-
195
- <glyph glyph-name="try" unicode="&#xf195;" d="M643 386q0-107-53-197t-143-143-197-53h-89q-8 0-13 5t-5 13v341l-120-37q-2-1-5-1-6 0-11 4-7 5-7 14v72q0 12 13 17l130 40v51l-120-36q-2-1-5-1-6 0-11 3-7 6-7 15v71q0 13 13 18l130 39v140q0 8 5 13t13 5h89q8 0 13-5t5-13v-101l209 64q9 3 16-2t7-15v-71q0-13-13-18l-219-67v-52l209 65q9 3 16-3t7-15v-71q0-13-13-17l-219-68v-272q105 8 177 85t73 183q0 8 5 13t13 5h89q8 0 13-5t5-13z" horiz-adv-x="642.9" />
196
-
197
- <glyph glyph-name="wordpress" unicode="&#xf19a;" d="M71 350q0 91 37 175l205-561q-109 53-176 157t-66 229z m719 22q0-11-2-22t-5-27-7-25-9-33-10-32l-43-143-155 461q26 2 49 4 11 2 15 11t-2 17-15 8l-115-6q-42 1-113 6-6 0-11-3t-6-9-1-10 5-9 11-5l44-4 67-183-94-281-156 464q26 2 49 4 11 2 15 11t-2 17-15 8l-115-6q-4 0-13 0t-14 1q58 89 153 141t205 52q82 0 157-29t133-84h-6q-31 0-51-22t-21-53q0-7 1-14t2-12 5-13 5-11 7-13 7-12 8-13 8-13q35-60 35-118z m-283-59l133-361q0-4 2-7-70-24-142-24-62 0-121 18z m369 243q53-97 53-206 0-117-58-215t-156-156l132 379q33 94 33 154 0 23-4 44z m-376 294q102 0 194-40t160-106 106-160 40-194-40-194-106-160-160-106-194-40-194 40-160 106-106 160-40 194 40 194 106 160 160 106 194 40z m0-977q97 0 185 38t152 102 102 152 38 185-38 185-102 152-152 102-185 38-185-38-152-102-102-152-38-185 38-185 102-152 152-102 185-38z" horiz-adv-x="1000" />
198
-
199
- <glyph glyph-name="cubes" unicode="&#xf1b3;" d="M357-61l214 107v176l-214-92v-191z m-36 254l226 96-226 97-225-97z m608-254l214 107v176l-214-92v-191z m-36 254l225 96-225 97-226-97z m-250 163l214 92v149l-214-92v-149z m-36 212l246 105-246 106-246-106z m607-289v-233q0-20-10-37t-29-26l-250-125q-14-8-32-8t-32 8l-250 125q-2 1-4 2-1-1-4-2l-250-125q-14-8-32-8t-31 8l-250 125q-19 9-29 26t-11 37v233q0 21 12 39t32 26l242 104v223q0 22 12 40t31 26l250 107q13 6 28 6t28-6l250-107q20-9 32-26t12-40v-223l242-104q20-8 32-26t11-39z" horiz-adv-x="1285.7" />
200
-
201
- <glyph glyph-name="database" unicode="&#xf1c0;" d="M429 421q132 0 247 24t181 71v-95q0-38-57-71t-157-52-214-19-215 19-156 52-58 71v95q66-47 181-71t248-24z m0-428q132 0 247 24t181 71v-95q0-39-57-72t-157-52-214-19-215 19-156 52-58 72v95q66-47 181-71t248-24z m0 214q132 0 247 24t181 71v-95q0-38-57-71t-157-52-214-20-215 20-156 52-58 71v95q66-47 181-71t248-24z m0 643q116 0 214-19t157-52 57-72v-71q0-39-57-72t-157-52-214-19-215 19-156 52-58 72v71q0 39 58 72t156 52 215 19z" horiz-adv-x="857.1" />
202
-
203
- <glyph glyph-name="circle-thin" unicode="&#xf1db;" d="M429 707q-73 0-139-28t-114-76-76-114-29-139 29-139 76-113 114-77 139-28 138 28 114 77 76 113 29 139-29 139-76 114-114 76-138 28z m428-357q0-117-57-215t-156-156-215-58-216 58-155 156-58 215 58 215 155 156 216 58 215-58 156-156 57-215z" horiz-adv-x="857.1" />
204
-
205
- <glyph glyph-name="sliders" unicode="&#xf1de;" d="M196 64v-71h-196v71h196z m197 72q14 0 25-11t11-25v-143q0-14-11-25t-25-11h-143q-14 0-25 11t-11 25v143q0 15 11 25t25 11h143z m89 214v-71h-482v71h482z m-357 286v-72h-125v72h125z m732-572v-71h-411v71h411z m-536 643q15 0 26-10t10-26v-142q0-15-10-25t-26-11h-142q-15 0-25 11t-11 25v142q0 15 11 26t25 10h142z m358-286q14 0 25-10t10-25v-143q0-15-10-25t-25-11h-143q-15 0-25 11t-11 25v143q0 14 11 25t25 10h143z m178-71v-71h-125v71h125z m0 286v-72h-482v72h482z" horiz-adv-x="857.1" />
206
-
207
- <glyph glyph-name="share" unicode="&#xf1e0;" d="M679 279q74 0 126-53t52-126-52-126-126-53-127 53-52 126q0 7 1 19l-201 100q-51-48-121-48-75 0-127 53t-52 126 52 126 127 53q70 0 121-48l201 100q-1 12-1 19 0 74 52 126t127 53 126-53 52-126-52-126-126-53q-71 0-122 48l-201-100q1-12 1-19t-1-19l201-100q51 48 122 48z" horiz-adv-x="857.1" />
208
-
209
- <glyph glyph-name="plug" unicode="&#xf1e6;" d="M979 597q21-21 21-50t-21-51l-223-223 83-84-89-89q-91-91-217-104t-230 56l-202-202h-101v101l202 202q-69 103-56 230t104 217l89 89 84-83 223 223q21 21 51 21t50-21 21-50-21-51l-223-223 131-131 223 223q22 21 51 21t50-21z" horiz-adv-x="1000" />
210
-
211
- <glyph glyph-name="trash" unicode="&#xf1f8;" d="M286 82v393q0 8-5 13t-13 5h-36q-8 0-13-5t-5-13v-393q0-8 5-13t13-5h36q8 0 13 5t5 13z m143 0v393q0 8-5 13t-13 5h-36q-8 0-13-5t-5-13v-393q0-8 5-13t13-5h36q8 0 13 5t5 13z m142 0v393q0 8-5 13t-12 5h-36q-8 0-13-5t-5-13v-393q0-8 5-13t13-5h36q7 0 12 5t5 13z m-303 554h250l-27 65q-4 5-9 6h-177q-6-1-10-6z m518-18v-36q0-8-5-13t-13-5h-54v-529q0-46-26-80t-63-34h-464q-37 0-63 33t-27 79v531h-53q-8 0-13 5t-5 13v36q0 8 5 13t13 5h172l39 93q9 21 31 35t44 15h178q23 0 44-15t30-35l39-93h173q8 0 13-5t5-13z" horiz-adv-x="785.7" />
212
-
213
- <glyph glyph-name="chart-line" unicode="&#xf201;" d="M1143-7v-72h-1143v858h71v-786h1072z m-72 696v-242q0-12-10-17t-20 4l-68 68-353-353q-6-6-13-6t-13 6l-130 130-232-233-107 108 327 326q5 6 12 6t13-6l130-130 259 259-67 68q-9 8-5 19t17 11h243q7 0 12-5t5-13z" horiz-adv-x="1142.9" />
214
-
215
- <glyph glyph-name="shekel" unicode="&#xf20b;" d="M554 502v-277q0-8-5-13t-13-5h-90q-7 0-12 5t-5 13v277q0 62-45 107t-107 45h-152v-643q0-8-5-13t-13-5h-89q-8 0-13 5t-5 13v750q0 8 5 13t13 5h259q75 0 139-37t101-101 37-139z m214 259v-491q0-76-37-139t-101-101-139-37h-259q-8 0-13 5t-5 13v535q0 8 5 13t13 5h89q8 0 13-5t5-13v-428h152q63 0 107 45t45 107v491q0 8 5 13t13 5h89q8 0 13-5t5-13z" horiz-adv-x="857.1" />
216
-
217
- <glyph glyph-name="user-secret" unicode="&#xf21b;" d="M321-7l54 250-54 71-71 36z m143 0l72 357-72-36-53-71z m90 564q-1 2-3 3-5 4-53 4-39 0-93-10-4-1-12-1t-12 1q-54 10-93 10-48 0-54-4-1-1-2-3 1-11 2-16 2-1 5-3t4-6q1-2 4-11t4-12 4-9 5-10 5-8 7-7 7-6 10-4 12-2 13-1q20 0 33 7t18 16 8 20 7 16 10 7h6q6 0 10-7t6-16 9-20 18-16 33-7q7 0 13 1t12 2 9 4 8 6 7 7 5 8 5 10 4 9 4 12 4 11q1 4 4 6t4 3q2 5 3 16z m232-491q0-68-41-106t-108-39h-488q-67 0-108 39t-41 106q0 34 3 66t10 70 21 69 36 58 52 41l-51 123h120q-12 36-12 71 0 7 1 18-109 23-109 54 0 32 118 55 9 35 28 75t40 63q18 21 42 21 17 0 47-17t47-18 47 18 47 17q24 0 42-21 20-23 39-63t29-75q117-23 117-55 0-31-108-54 4-45-11-89h119l-45-126q35-18 60-54t36-80 16-84 5-83z" horiz-adv-x="857.1" />
218
-
219
- <glyph glyph-name="user-plus" unicode="&#xf234;" d="M393 350q-89 0-152 63t-62 151 62 152 152 63 151-63 63-152-63-151-151-63z m536-71h196q7 0 13-6t5-12v-107q0-8-5-13t-13-5h-196v-197q0-7-6-12t-12-6h-107q-8 0-13 6t-5 12v197h-197q-7 0-12 5t-6 13v107q0 7 6 12t12 6h197v196q0 7 5 13t13 5h107q7 0 12-5t6-13v-196z m-411-125q0-29 21-51t50-21h143v-133q-38-28-95-28h-488q-67 0-108 39t-41 106q0 30 2 58t8 61 15 60 24 55 34 45 48 30 62 11q11 0 22-10 44-34 86-51t92-17 92 17 86 51q11 10 22 10 73 0 121-54h-125q-29 0-50-21t-21-50v-107z" horiz-adv-x="1142.9" />
220
-
221
- <glyph glyph-name="user-times" unicode="&#xf235;" d="M393 350q-89 0-152 63t-62 151 62 152 152 63 151-63 63-152-63-151-151-63z m601-179l139-138q5-5 5-13 0-8-5-13l-76-76q-5-5-12-5-8 0-13 5l-139 139-139-139q-5-5-13-5-7 0-12 5l-76 76q-5 5-5 13 0 8 5 13l139 138-139 139q-5 5-5 13 0 8 5 13l76 75q5 5 12 5 8 0 13-5l139-139 139 139q5 5 13 5 7 0 12-5l76-75q5-5 5-13 0-8-5-13z m-278 0l-101-101q-21-20-21-50 0-30 21-51l46-46q-11-2-24-2h-488q-67 0-108 39t-41 106q0 30 2 58t8 61 15 60 24 55 34 45 48 30 62 11q11 0 22-10 86-68 178-68t178 68q11 10 22 10 15 0 31-4-15-15-22-27t-8-32q0-30 21-51z" horiz-adv-x="1142.9" />
222
-
223
- <glyph glyph-name="viacoin" unicode="&#xf237;" d="M857 850l-107-250h107v-107h-153l-30-72h183v-107h-229l-199-464-200 464h-229v107h184l-31 72h-153v107h107l-107 250h143l180-429h211l180 429h143z m-428-679l60 143h-121z" horiz-adv-x="857.1" />
224
-
225
- <glyph glyph-name="safari" unicode="&#xf267;" d="M530 352q0-15-10-25t-23-11q-14 0-25 9t-10 23q0 15 9 25t23 11 25-9 11-23z m8-33l195 325q-5-5-37-35t-70-65-77-71-65-62-28-29l-195-323q4 4 38 34t70 65 76 71 65 62 28 28z m361 31q0-112-58-207-2 1-9 6t-15 9-9 5q-8 0-8-8 0-5 33-24-41-63-103-107t-135-61l-8 37q-1 6-9 6-3 0-4-3t-1-6l9-38q-41-8-82-8-111 0-208 59 1 1 8 11t12 19 5 10q0 8-7 8-4 0-10-8t-12-20-8-13q-63 42-107 105t-61 137l38 8q6 2 6 8 0 3-3 5t-6 1l-38-9q-8 41-8 78 0 115 61 212 1-1 10-7t17-11 10-4q7 0 7 6 0 4-7 9t-18 12l-11 7q43 62 105 105t136 60l9-37q1-6 8-6 3 0 5 3t1 6l-9 37q40 7 75 7 114 0 212-61-22-31-22-36 0-7 6-7 7 0 27 35 62-41 105-103t60-135l-31-7q-6-1-6-8 0-3 3-5t5-1l32 7q8-40 8-78z m47 0q0 91-35 174t-95 142-142 95-174 35-173-35-143-95-95-142-35-174 35-173 95-143 143-95 173-35 174 35 142 95 95 143 35 173z m54 0q0-102-40-194t-106-160-160-106-194-40-194 40-160 106-106 160-40 194 40 194 106 160 160 106 194 40 194-40 160-106 106-160 40-194z" horiz-adv-x="1000" />
226
-
227
- <glyph glyph-name="chrome" unicode="&#xf268;" d="M498 850q134 1 252-67 130-75 196-208l-414 22q-89 5-164-41t-103-128l-154 236q72 89 174 137t213 49z m-416-226l188-370q40-80 117-121t164-25l-129-252q-118 19-214 88t-152 176-56 230q0 149 82 274z m885-94q32-84 33-174t-27-170-86-152-137-117q-128-74-278-66l226 347q49 73 46 162t-59 155z m-467-11q70 0 119-50t50-119-50-119-119-49-119 49-49 119 49 119 119 50z" horiz-adv-x="1000" />
228
-
229
- <glyph glyph-name="firefox" unicode="&#xf269;" d="M504-150q-158 0-282 84t-183 222q-33 74-38 168t15 186 62 174 100 135l-7-156q7 7 38 8t39-8q24 45 90 77t131 32q-30-25-67-82t-33-92q14-4 35-7t36-4 37-3 29-1q8-3 5-26t-17-42q-3-4-9-10t-32-20-56-19l8-105-77 37q-10-24-5-45t21-38 36-23 45-3q29 5 55 19t47 25 41 10q34-2 50-19t10-36q0-1-1-3t-5-7-10-9-17-5-26-1q-34-53-81-76t-117-16q41-34 91-46t94-3 86 29 71 48 45 58q24 51 22 108t-21 105-44 70q49-21 77-45t43-62q8 95-32 191t-117 159q148-43 230-156t84-289q1-71-23-143t-68-132-106-110-138-75-161-28z" horiz-adv-x="1000" />
230
-
231
- <glyph glyph-name="opera" unicode="&#xf26a;" d="M833 723q-92 61-200 61-87 0-164-41t-134-111q-41-52-66-122t-27-148v-24q2-78 27-148t66-122q57-71 134-111t164-41q108 0 200 61-67-60-153-94t-180-33q-16 0-24 1-98 4-186 45t-152 108-101 157-37 189q0 102 40 194t106 160 160 106 194 40h2q93-1 179-34t152-93z m167-373q0-107-43-202t-119-166q-58-35-124-35-76 0-142 47 86 31 141 130t56 226q0 127-55 225t-141 131q66 46 141 46 67 0 126-36 76-70 118-164t42-202z" horiz-adv-x="1000" />
232
-
233
- <glyph glyph-name="internet-explorer" unicode="&#xf26b;" d="M1000 327q0-31-4-58h-642q0-81 61-136t144-55q55 0 103 26t76 73h236q-31-89-95-157t-149-106-179-37q-105 0-199 47-127-65-220-65-132 0-132 147 0 64 25 153 10 34 61 128 111 201 265 338-103-44-238-197 35 153 158 250t280 98q17 0 25 0 142 65 242 65 35 0 64-7t53-23 37-42 14-65q0-64-42-159 56-102 56-218z m-39 357q0 47-30 74t-76 27q-60 0-142-39 68-26 124-73t96-109q28 75 28 120z m-890-690q0-48 28-74t75-26q64 0 148 46-68 41-119 103t-77 136q-55-114-55-185z m282 398h406q-3 79-63 132t-140 53q-81 0-140-53t-63-132z" horiz-adv-x="1000" />
234
-
235
- <glyph glyph-name="television" unicode="&#xf26c;" d="M1000 154v535q0 8-5 13t-13 5h-893q-7 0-12-5t-6-13v-535q0-8 6-13t12-5h893q7 0 13 5t5 13z m71 535v-535q0-37-26-63t-63-27h-411v-71h197q8 0 13-5t5-13v-36q0-8-5-13t-13-5h-464q-8 0-13 5t-5 13v36q0 8 5 13t13 5h196v71h-411q-36 0-63 27t-26 63v535q0 37 26 63t63 27h893q37 0 63-27t26-63z" horiz-adv-x="1142.9" />
236
-
237
- <glyph glyph-name="percent" unicode="&#xf295;" d="M714 136q0 29-21 50t-50 21-50-21-22-50 22-50 50-22 50 22 21 50z m-428 428q0 29-21 51t-51 21-50-21-21-51 21-50 50-21 51 21 21 50z m571-428q0-89-63-152t-151-63-152 63-62 152 62 151 152 63 151-63 63-151z m-53 607q0-11-8-21l-589-786q-11-15-28-15h-90q-14 0-25 11t-10 25q0 11 7 21l589 786q11 15 29 15h89q14 0 25-11t11-25z m-375-179q0-88-63-151t-152-63-151 63-63 151 63 152 151 63 152-63 63-152z" horiz-adv-x="857.1" />
238
- </font>
239
- </defs>
240
  </svg>
1
+ <?xml version="1.0" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg xmlns="http://www.w3.org/2000/svg">
4
+ <metadata>Copyright (C) 2019 by original authors @ fontello.com</metadata>
5
+ <defs>
6
+ <font id="fontello" horiz-adv-x="1000" >
7
+ <font-face font-family="fontello" font-weight="400" font-stretch="normal" units-per-em="1000" ascent="850" descent="-150" />
8
+ <missing-glyph horiz-adv-x="1000" />
9
+ <glyph glyph-name="download" unicode="&#xe800;" d="M714 590q15-15 15-37t-15-36l-245-244-245 244q-15 15-15 36t15 37 36 15q23 0 38-15l118-120 0 349q0 21 16 37t37 16 37-16 15-37l0-349 119 120q14 14 38 14 22 0 36-14z m222-448l2-261q0-21-16-36t-37-16l-832 0q-22 0-37 16t-16 36q0 261 1 261 0 11 2 16l105 312q12 37 48 37l12 0q8-18 18-28l78-76-70 0-86-261 722 0-86 261-70 0 77 76q10 10 19 28l11 0q37 0 49-37l105-312q1-5 1-16z" horiz-adv-x="938" />
10
+
11
+ <glyph glyph-name="glass" unicode="&#xe801;" d="M948 746q0-19-24-43l-353-353v-429h179q15 0 25-10t11-25-11-25-25-11h-500q-14 0-25 11t-11 25 11 25 25 10h179v429l-353 353q-24 24-24 43 0 13 10 21t21 9 24 3h786q13 0 24-3t21-9 10-21z" horiz-adv-x="1000" />
12
+
13
+ <glyph glyph-name="emo-happy" unicode="&#xe802;" d="M261 800c-60 0-109-65-109-144 0-80 49-145 109-145s110 65 110 145c0 79-49 144-110 144z m477 0c-61 0-110-65-110-144 0-80 49-145 110-145 60 0 110 65 110 145 0 79-50 144-110 144z m208-599c-13 0-27-5-37-16-4-4-8-8-12-12-111-109-253-164-396-165-142-2-285 50-396 155l-3 3-12 12c-21 21-54 20-75-1-20-21-20-55 1-76 3-4 8-8 14-14l3-3c132-124 301-186 469-184 169 1 337 67 468 195 5 5 9 10 14 14 20 22 20 56-1 77-10 10-23 15-37 15z" horiz-adv-x="999" />
14
+
15
+ <glyph glyph-name="search" unicode="&#xe803;" d="M643 386q0 103-73 176t-177 74-177-74-73-176 73-177 177-73 177 73 73 177z m286-465q0-29-22-50t-50-21q-30 0-50 21l-191 191q-100-69-223-69-80 0-153 31t-125 84-84 125-31 153 31 152 84 126 125 84 153 31 153-31 125-84 84-126 31-152q0-123-69-223l191-191q21-21 21-51z" horiz-adv-x="928.6" />
16
+
17
+ <glyph glyph-name="emo-unhappy" unicode="&#xe804;" d="M261 800c-60 0-109-65-109-144 0-80 49-145 109-145s110 65 110 145c0 79-49 144-110 144z m477 0c-61 0-110-65-110-144 0-80 49-145 110-145 60 0 110 65 110 145 0 79-50 144-110 144z m-244-599c-165 0-331-62-461-184l-3-3c-6-5-11-10-14-14-21-21-21-55-1-76 21-21 54-21 75-1l12 12 3 3c111 105 254 157 396 155 143-1 285-56 396-165 4-4 8-8 12-12 20-21 54-21 74-1 21 21 21 55 1 77-5 5-9 10-14 14-131 129-299 194-468 195-3 0-6 0-8 0z" horiz-adv-x="999" />
18
+
19
+ <glyph glyph-name="mail" unicode="&#xe805;" d="M929 11v428q-18-20-39-36-149-115-238-189-28-24-46-37t-48-28-57-13h-2q-26 0-57 13t-48 28-46 37q-88 74-238 189-21 16-39 36v-428q0-7 6-13t12-5h822q7 0 12 5t6 13z m0 586v14t-1 7-1 7-3 5-5 4-8 2h-822q-7 0-12-6t-6-12q0-94 83-159 107-84 223-176 4-3 20-17t25-21 25-17 28-16 24-5h2q11 0 24 5t28 16 25 17 25 21 20 17q116 92 224 176 30 24 56 65t26 73z m71 21v-607q0-37-26-63t-63-27h-822q-36 0-63 27t-26 63v607q0 37 26 63t63 26h822q37 0 63-26t26-63z" horiz-adv-x="1000" />
20
+
21
+ <glyph glyph-name="info-circled" unicode="&#xe806;" d="M571 82v89q0 8-5 13t-12 5h-54v286q0 8-5 13t-13 5h-178q-8 0-13-5t-5-13v-89q0-8 5-13t13-5h53v-179h-53q-8 0-13-5t-5-13v-89q0-8 5-13t13-5h250q7 0 12 5t5 13z m-71 500v89q0 8-5 13t-13 5h-107q-8 0-13-5t-5-13v-89q0-8 5-13t13-5h107q8 0 13 5t5 13z m357-232q0-117-57-215t-156-156-215-58-216 58-155 156-58 215 58 215 155 156 216 58 215-58 156-156 57-215z" horiz-adv-x="857.1" />
22
+
23
+ <glyph glyph-name="help-circled" unicode="&#xe807;" d="M500 82v107q0 8-5 13t-13 5h-107q-8 0-13-5t-5-13v-107q0-8 5-13t13-5h107q8 0 13 5t5 13z m143 375q0 49-31 91t-77 65-95 23q-136 0-207-119-9-13 4-24l74-55q4-4 10-4 9 0 14 7 30 38 48 51 19 14 48 14 27 0 48-15t21-33q0-21-11-34t-38-25q-35-15-65-48t-29-70v-20q0-8 5-13t13-5h107q8 0 13 5t5 13q0 10 12 27t30 28q18 10 28 16t25 19 25 27 16 34 7 45z m214-107q0-117-57-215t-156-156-215-58-216 58-155 156-58 215 58 215 155 156 216 58 215-58 156-156 57-215z" horiz-adv-x="857.1" />
24
+
25
+ <glyph glyph-name="heart" unicode="&#xe808;" d="M500-79q-14 0-25 10l-348 336q-5 5-15 15t-31 37-38 54-30 67-13 77q0 123 71 192t196 70q34 0 70-12t67-33 54-38 42-38q20 20 42 38t54 38 67 33 70 12q125 0 196-70t71-192q0-123-128-251l-347-335q-10-10-25-10z" horiz-adv-x="1000" />
26
+
27
+ <glyph glyph-name="heart-empty" unicode="&#xe809;" d="M929 517q0 46-12 80t-31 55-46 33-52 18-55 4-62-14-62-36-48-40-34-34q-10-13-27-13t-27 13q-14 15-34 34t-48 40-62 36-62 14-55-4-52-18-46-33-31-55-12-80q0-93 105-198l324-312 324 312q105 105 105 198z m71 0q0-123-128-251l-347-335q-10-10-25-10t-25 10l-348 336q-5 5-15 15t-31 37-38 54-30 67-13 77q0 123 71 192t196 70q34 0 70-12t67-33 54-38 42-38q20 20 42 38t54 38 67 33 70 12q125 0 196-70t71-192z" horiz-adv-x="1000" />
28
+
29
+ <glyph glyph-name="star" unicode="&#xe80a;" d="M929 489q0-12-15-27l-202-197 48-279q0-4 0-12 0-11-6-19t-17-9q-10 0-22 7l-251 132-250-132q-12-7-23-7-11 0-17 9t-6 19q0 4 1 12l48 279-203 197q-14 15-14 27 0 21 31 26l280 40 126 254q11 23 27 23t28-23l125-254 280-40q32-5 32-26z" horiz-adv-x="928.6" />
30
+
31
+ <glyph glyph-name="star-empty" unicode="&#xe80b;" d="M635 290l170 166-235 34-106 213-105-213-236-34 171-166-41-235 211 111 211-111z m294 199q0-12-15-27l-202-197 48-279q0-4 0-12 0-28-23-28-10 0-22 7l-251 132-250-132q-12-7-23-7-11 0-17 9t-6 19q0 4 1 12l48 279-203 197q-14 15-14 27 0 21 31 26l280 40 126 254q11 23 27 23t28-23l125-254 280-40q32-5 32-26z" horiz-adv-x="928.6" />
32
+
33
+ <glyph glyph-name="user" unicode="&#xe80c;" d="M714 69q0-60-35-104t-84-44h-476q-49 0-84 44t-35 104q0 48 5 90t17 85 33 73 52 50 76 19q73-72 174-72t175 72q42 0 75-19t52-50 33-73 18-85 4-90z m-143 495q0-88-62-151t-152-63-151 63-63 151 63 152 151 63 152-63 62-152z" horiz-adv-x="714.3" />
34
+
35
+ <glyph glyph-name="users" unicode="&#xe80d;" d="M331 350q-90-3-148-71h-75q-45 0-77 22t-31 66q0 197 69 197 4 0 25-11t54-24 66-12q38 0 75 13-3-21-3-37 0-78 45-143z m598-356q0-66-41-105t-108-39h-488q-68 0-108 39t-41 105q0 30 2 58t8 61 14 61 24 54 35 45 48 30 62 11q6 0 24-12t41-26 59-27 76-12 75 12 60 27 41 26 24 12q34 0 62-11t47-30 35-45 24-54 15-61 8-61 2-58z m-572 713q0-59-42-101t-101-42-101 42-42 101 42 101 101 42 101-42 42-101z m393-214q0-89-63-152t-151-62-152 62-63 152 63 151 152 63 151-63 63-151z m321-126q0-43-31-66t-77-22h-75q-57 68-147 71 45 65 45 143 0 16-3 37 37-13 74-13 33 0 67 12t54 24 24 11q69 0 69-197z m-71 340q0-59-42-101t-101-42-101 42-42 101 42 101 101 42 101-42 42-101z" horiz-adv-x="1071.4" />
36
+
37
+ <glyph glyph-name="th-large" unicode="&#xe80e;" d="M429 279v-215q0-29-22-50t-50-21h-286q-29 0-50 21t-21 50v215q0 29 21 50t50 21h286q29 0 50-21t22-50z m0 428v-214q0-29-22-50t-50-22h-286q-29 0-50 22t-21 50v214q0 29 21 50t50 22h286q29 0 50-22t22-50z m500-428v-215q0-29-22-50t-50-21h-286q-29 0-50 21t-21 50v215q0 29 21 50t50 21h286q29 0 50-21t22-50z m0 428v-214q0-29-22-50t-50-22h-286q-29 0-50 22t-21 50v214q0 29 21 50t50 22h286q29 0 50-22t22-50z" horiz-adv-x="928.6" />
38
+
39
+ <glyph glyph-name="th" unicode="&#xe80f;" d="M286 154v-108q0-22-16-37t-38-16h-178q-23 0-38 16t-16 37v108q0 22 16 38t38 15h178q23 0 38-15t16-38z m0 285v-107q0-22-16-38t-38-15h-178q-23 0-38 15t-16 38v107q0 23 16 38t38 16h178q23 0 38-16t16-38z m357-285v-108q0-22-16-37t-38-16h-178q-23 0-38 16t-16 37v108q0 22 16 38t38 15h178q23 0 38-15t16-38z m-357 571v-107q0-22-16-38t-38-16h-178q-23 0-38 16t-16 38v107q0 22 16 38t38 16h178q23 0 38-16t16-38z m357-286v-107q0-22-16-38t-38-15h-178q-23 0-38 15t-16 38v107q0 23 16 38t38 16h178q23 0 38-16t16-38z m357-285v-108q0-22-16-37t-38-16h-178q-22 0-38 16t-16 37v108q0 22 16 38t38 15h178q23 0 38-15t16-38z m-357 571v-107q0-22-16-38t-38-16h-178q-23 0-38 16t-16 38v107q0 22 16 38t38 16h178q23 0 38-16t16-38z m357-286v-107q0-22-16-38t-38-15h-178q-22 0-38 15t-16 38v107q0 23 16 38t38 16h178q23 0 38-16t16-38z m0 286v-107q0-22-16-38t-38-16h-178q-22 0-38 16t-16 38v107q0 22 16 38t38 16h178q23 0 38-16t16-38z" horiz-adv-x="1000" />
40
+
41
+ <glyph glyph-name="th-list" unicode="&#xe810;" d="M286 154v-108q0-22-16-37t-38-16h-178q-23 0-38 16t-16 37v108q0 22 16 38t38 15h178q23 0 38-15t16-38z m0 285v-107q0-22-16-38t-38-15h-178q-23 0-38 15t-16 38v107q0 23 16 38t38 16h178q23 0 38-16t16-38z m714-285v-108q0-22-16-37t-38-16h-535q-23 0-38 16t-16 37v108q0 22 16 38t38 15h535q23 0 38-15t16-38z m-714 571v-107q0-22-16-38t-38-16h-178q-23 0-38 16t-16 38v107q0 22 16 38t38 16h178q23 0 38-16t16-38z m714-286v-107q0-22-16-38t-38-15h-535q-23 0-38 15t-16 38v107q0 23 16 38t38 16h535q23 0 38-16t16-38z m0 286v-107q0-22-16-38t-38-16h-535q-23 0-38 16t-16 38v107q0 22 16 38t38 16h535q23 0 38-16t16-38z" horiz-adv-x="1000" />
42
+
43
+ <glyph glyph-name="to-end" unicode="&#xe811;" d="M25-71q-10-11-18-8t-7 18v822q0 14 7 18t18-8l396-396q5-5 8-10v378q0 14 10 25t25 11h72q14 0 25-11t10-25v-786q0-14-10-25t-25-11h-72q-14 0-25 11t-10 25v379q-3-6-8-11z" horiz-adv-x="571.4" />
44
+
45
+ <glyph glyph-name="to-start" unicode="&#xe812;" d="M546 771q11 11 18 8t7-18v-822q0-14-7-18t-18 8l-396 396q-5 5-7 11v-379q0-14-11-25t-25-11h-71q-15 0-25 11t-11 25v786q0 14 11 25t25 11h71q15 0 25-11t11-25v-378q2 5 7 10z" horiz-adv-x="571.4" />
46
+
47
+ <glyph glyph-name="fast-fw" unicode="&#xe813;" d="M25-71q-10-11-18-8t-7 18v822q0 14 7 18t18-8l396-396q5-5 8-10v396q0 14 7 18t18-8l396-396q11-10 11-25t-11-25l-396-396q-11-11-18-8t-7 18v397q-3-6-8-11z" horiz-adv-x="928.6" />
48
+
49
+ <glyph glyph-name="fast-bw" unicode="&#xe814;" d="M904 771q10 11 17 8t8-18v-822q0-14-8-18t-17 8l-397 396q-5 5-7 11v-397q0-14-7-18t-18 8l-396 396q-11 11-11 25t11 25l396 396q11 11 18 8t7-18v-396q2 5 7 10z" horiz-adv-x="928.6" />
50
+
51
+ <glyph glyph-name="off" unicode="&#xe815;" d="M857 350q0-87-34-166t-91-137-137-92-166-34-167 34-136 92-92 137-34 166q0 102 45 191t126 151q24 18 54 14t46-28q18-23 14-53t-28-47q-54-41-84-101t-30-127q0-58 23-111t61-91 91-61 111-23 110 23 92 61 61 91 22 111q0 68-30 127t-84 101q-23 18-28 47t14 53q17 24 47 28t53-14q81-61 126-151t45-191z m-357 429v-358q0-29-21-50t-50-21-51 21-21 50v358q0 29 21 50t51 21 50-21 21-50z" horiz-adv-x="857.1" />
52
+
53
+ <glyph glyph-name="chart-bar" unicode="&#xe816;" d="M357 350v-286h-143v286h143z m214 286v-572h-142v572h142z m572-643v-72h-1143v858h71v-786h1072z m-357 500v-429h-143v429h143z m214 214v-643h-143v643h143z" horiz-adv-x="1142.9" />
54
+
55
+ <glyph glyph-name="home" unicode="&#xe817;" d="M786 296v-267q0-15-11-25t-25-11h-214v214h-143v-214h-214q-15 0-25 11t-11 25v267q0 1 0 2t0 2l321 264 321-264q1-1 1-4z m124 39l-34-41q-5-5-12-6h-2q-7 0-12 3l-386 322-386-322q-7-4-13-3-7 1-12 6l-35 41q-4 6-3 13t6 12l401 334q18 15 42 15t43-15l136-113v108q0 8 5 13t13 5h107q8 0 13-5t5-13v-227l122-102q6-4 6-12t-4-13z" horiz-adv-x="928.6" />
56
+
57
+ <glyph glyph-name="link-1" unicode="&#xe818;" d="M813 171q0 23-16 38l-116 116q-16 16-38 16-24 0-40-18 1-1 10-10t12-12 9-11 7-14 2-15q0-23-16-38t-38-16q-8 0-15 2t-14 7-11 9-12 12-10 10q-19-17-19-40 0-23 16-38l115-116q15-15 38-15 22 0 38 15l82 81q16 16 16 37z m-393 394q0 22-15 38l-115 115q-16 16-38 16-22 0-38-15l-82-82q-16-15-16-37 0-22 16-38l116-116q15-15 38-15 23 0 40 17-2 2-11 11t-12 12-8 10-7 14-2 16q0 22 15 38t38 15q9 0 16-2t14-7 11-8 12-12 10-11q18 17 18 41z m500-394q0-66-48-113l-82-81q-46-47-113-47-68 0-114 48l-115 115q-46 47-46 114 0 68 49 116l-49 49q-48-49-116-49-67 0-114 47l-116 116q-47 47-47 114t47 113l82 82q47 46 114 46 67 0 114-47l115-116q46-46 46-113 0-69-49-117l49-49q48 49 116 49 67 0 114-47l116-116q47-47 47-114z" horiz-adv-x="928.6" />
58
+
59
+ <glyph glyph-name="lock-open" unicode="&#xe819;" d="M929 529v-143q0-15-11-25t-25-11h-36q-14 0-25 11t-11 25v143q0 59-41 101t-101 41-101-41-42-101v-108h53q23 0 38-15t16-38v-322q0-22-16-37t-38-16h-535q-23 0-38 16t-16 37v322q0 22 16 38t38 15h375v108q0 103 73 176t177 74 176-74 74-176z" horiz-adv-x="928.6" />
60
+
61
+ <glyph glyph-name="eye" unicode="&#xe81a;" d="M929 314q-85 132-213 197 34-58 34-125 0-103-73-177t-177-73-177 73-73 177q0 67 34 125-128-65-213-197 75-114 187-182t242-68 243 68 186 182z m-402 215q0 11-8 19t-19 7q-70 0-120-50t-50-119q0-11 8-19t19-8 19 8 8 19q0 48 34 82t82 34q11 0 19 8t8 19z m473-215q0-19-11-38-78-129-210-206t-279-77-279 77-210 206q-11 19-11 38t11 39q78 128 210 205t279 78 279-78 210-205q11-20 11-39z" horiz-adv-x="1000" />
62
+
63
+ <glyph glyph-name="eye-off" unicode="&#xe81b;" d="M310 105l43 79q-48 35-76 88t-27 114q0 67 34 125-128-65-213-197 94-144 239-209z m217 424q0 11-8 19t-19 7q-70 0-120-50t-50-119q0-11 8-19t19-8 19 8 8 19q0 48 34 82t82 34q11 0 19 8t8 19z m202 106q0-4 0-5-59-105-176-316t-176-316l-28-50q-5-9-15-9-7 0-75 39-9 6-9 16 0 7 25 49-80 36-147 96t-117 137q-11 17-11 38t11 39q86 131 212 207t277 76q50 0 100-10l31 54q5 9 15 9 3 0 10-3t18-9 18-10 18-10 10-7q9-5 9-15z m21-249q0-78-44-142t-117-91l157 280q4-25 4-47z m250-72q0-19-11-38-22-36-61-81-84-96-194-149t-234-53l41 74q119 10 219 76t169 171q-65 100-158 164l35 63q53-36 102-85t81-103q11-19 11-39z" horiz-adv-x="1000" />
64
+
65
+ <glyph glyph-name="download-1" unicode="&#xe81c;" d="M714 100q0 15-10 25t-25 11-25-11-11-25 11-25 25-11 25 11 10 25z m143 0q0 15-10 25t-26 11-25-11-10-25 10-25 25-11 26 11 10 25z m72 125v-179q0-22-16-37t-38-16h-821q-23 0-38 16t-16 37v179q0 22 16 38t38 16h259l75-76q33-32 76-32t76 32l76 76h259q22 0 38-16t16-38z m-182 318q10-23-8-39l-250-250q-10-11-25-11t-25 11l-250 250q-17 16-8 39 10 21 33 21h143v250q0 15 11 25t25 11h143q14 0 25-11t10-25v-250h143q24 0 33-21z" horiz-adv-x="928.6" />
66
+
67
+ <glyph glyph-name="chat" unicode="&#xe81d;" d="M786 421q0-77-53-143t-143-104-197-38q-48 0-98 9-70-49-155-72-21-5-48-9h-2q-6 0-12 5t-6 12q-1 1-1 3t1 4 1 3l1 3t2 3 2 3 3 3 2 2q3 3 13 14t15 16 12 17 14 21 11 25q-69 40-108 98t-40 125q0 78 53 144t143 104 197 38 197-38 143-104 53-144z m214-142q0-67-40-126t-108-98q5-14 11-25t14-21 13-16 14-17 13-14q0 0 2-2t3-3 2-3 2-3l1-3t1-3 1-4-1-3q-2-8-7-13t-12-4q-28 4-48 9-86 23-156 72-50-9-98-9-151 0-263 74 32-3 49-3 90 0 172 25t148 72q69 52 107 119t37 141q0 43-13 85 72-39 114-99t42-128z" horiz-adv-x="1000" />
68
+
69
+ <glyph glyph-name="comment" unicode="&#xe81e;" d="M1000 350q0-97-67-179t-182-130-251-48q-39 0-81 4-110-97-257-135-27-8-63-12-10-1-17 5t-10 16v1q-2 2 0 6t1 6 2 5l4 5t4 5 4 5q4 5 17 19t20 22 17 22 18 28 15 33 15 42q-88 50-138 123t-51 157q0 73 40 139t106 114 160 76 194 28q136 0 251-48t182-130 67-179z" horiz-adv-x="1000" />
70
+
71
+ <glyph glyph-name="doc" unicode="&#xe81f;" d="M819 638q16-16 27-42t11-50v-642q0-23-15-38t-38-16h-750q-23 0-38 16t-16 38v892q0 23 16 38t38 16h500q22 0 49-11t42-27z m-248 136v-210h210q-5 17-12 23l-175 175q-6 7-23 12z m215-853v572h-232q-23 0-38 16t-16 37v233h-429v-858h715z" horiz-adv-x="857.1" />
72
+
73
+ <glyph glyph-name="lock" unicode="&#xe820;" d="M179 421h285v108q0 59-42 101t-101 41-101-41-41-101v-108z m464-53v-322q0-22-16-37t-38-16h-535q-23 0-38 16t-16 37v322q0 22 16 38t38 15h17v108q0 102 74 176t176 74 177-74 73-176v-108h18q23 0 38-15t16-38z" horiz-adv-x="642.9" />
74
+
75
+ <glyph glyph-name="emo-wink2" unicode="&#xe821;" d="M664 800c-61 0-110-65-110-144 0-80 49-145 110-145 60 0 110 65 110 145 0 79-50 144-110 144z m-343-98l-267 0c-30 0-54-24-54-54 0-30 24-54 54-54l267 0c30 0 54 24 54 54 0 30-24 54-54 54z m-262-361c-6 0-13-1-19-3-27-10-41-41-31-68 46-127 136-228 249-289 22-12 45-22 69-31 58-21 120-33 184-33 57 0 113 9 166 27 10 3 20 7 30 11 11 4 22 8 31 12l0 1 0 0 0 0c26 12 38 44 25 71-13 26-44 37-70 25l0 0c-9-4-17-8-24-11-8-3-17-6-25-8-43-14-88-22-133-22-51 0-101 10-148 27-19 7-37 15-55 25-90 48-163 130-200 231-8 21-28 35-49 35z" horiz-adv-x="774" />
76
+
77
+ <glyph glyph-name="plus" unicode="&#xe822;" d="M786 439v-107q0-22-16-38t-38-15h-232v-233q0-22-16-37t-38-16h-107q-22 0-38 16t-15 37v233h-232q-23 0-38 15t-16 38v107q0 23 16 38t38 16h232v232q0 22 15 38t38 16h107q23 0 38-16t16-38v-232h232q23 0 38-16t16-38z" horiz-adv-x="785.7" />
78
+
79
+ <glyph glyph-name="upload" unicode="&#xe823;" d="M936 128l2-260q0-21-16-37t-37-15l-832 0q-22 0-37 15t-16 37q0 260 1 260 0 12 2 17l105 312q12 36 48 36l209 0 0-103-171 0-86-262 722 0-86 262-171 0 0 103 208 0q37 0 49-36l105-312q1-5 1-17z m-258 423q-24 0-38 14l-119 120 0-348q0-21-15-37t-37-15-37 15-16 37l0 348-118-120q-14-14-38-14-22 0-36 14-15 15-15 36t15 37l245 247 245-247q15-15 15-37t-15-36q-14-14-36-14z" horiz-adv-x="938" />
80
+
81
+ <glyph glyph-name="picture" unicode="&#xe824;" d="M357 529q0-45-31-76t-76-32-76 32-31 76 31 76 76 31 76-31 31-76z m572-215v-250h-786v107l178 179 90-89 285 285z m53 393h-893q-7 0-12-5t-6-13v-678q0-7 6-13t12-5h893q7 0 13 5t5 13v678q0 8-5 13t-13 5z m89-18v-678q0-37-26-63t-63-27h-893q-36 0-63 27t-26 63v678q0 37 26 63t63 27h893q37 0 63-27t26-63z" horiz-adv-x="1071.4" />
82
+
83
+ <glyph glyph-name="ok" unicode="&#xe825;" d="M933 534q0-22-16-38l-404-404-76-76q-16-15-38-15t-38 15l-76 76-202 202q-15 16-15 38t15 38l76 76q16 16 38 16t38-16l164-165 366 367q16 16 38 16t38-16l76-76q16-15 16-38z" horiz-adv-x="1000" />
84
+
85
+ <glyph glyph-name="cancel" unicode="&#xe826;" d="M724 112q0-22-15-38l-76-76q-16-15-38-15t-38 15l-164 165-164-165q-16-15-38-15t-38 15l-76 76q-16 16-16 38t16 38l164 164-164 164q-16 16-16 38t16 38l76 76q16 16 38 16t38-16l164-164 164 164q16 16 38 16t38-16l76-76q15-15 15-38t-15-38l-164-164 164-164q15-15 15-38z" horiz-adv-x="785.7" />
86
+
87
+ <glyph glyph-name="pencil" unicode="&#xe827;" d="M203-7l50 51-131 131-51-51v-60h72v-71h60z m291 518q0 12-12 12-5 0-9-4l-303-302q-4-4-4-10 0-12 13-12 5 0 9 4l303 302q3 4 3 10z m-30 107l232-232-464-465h-232v233z m381-54q0-29-20-50l-93-93-232 233 93 92q20 21 50 21 29 0 51-21l131-131q20-22 20-51z" horiz-adv-x="857.1" />
88
+
89
+ <glyph glyph-name="edit" unicode="&#xe828;" d="M496 189l64 65-85 85-64-65v-31h53v-54h32z m245 402q-9 9-18 0l-196-196q-9-9 0-18t18 0l196 196q9 9 0 18z m45-331v-106q0-67-47-114t-114-47h-464q-67 0-114 47t-47 114v464q0 66 47 113t114 48h464q35 0 65-14 9-4 10-13 2-10-5-16l-27-28q-8-8-18-4-13 3-25 3h-464q-37 0-63-26t-27-63v-464q0-37 27-63t63-27h464q37 0 63 27t26 63v70q0 7 5 12l36 36q8 8 20 4t11-16z m-54 411l161-160-375-375h-161v160z m248-73l-51-52-161 161 51 52q16 15 38 15t38-15l85-85q16-16 16-38t-16-38z" horiz-adv-x="1000" />
90
+
91
+ <glyph glyph-name="forward" unicode="&#xe829;" d="M1000 493q0-15-11-25l-285-286q-11-11-25-11t-25 11-11 25v143h-125q-55 0-98-3t-86-12-74-24-59-39-45-56-27-77-10-101q0-31 3-69 0-4 2-13t1-15q0-8-5-14t-13-6q-9 0-15 10-4 5-8 12t-7 17-6 13q-71 159-71 252 0 111 30 186 90 225 488 225h125v143q0 14 11 25t25 10 25-10l285-286q11-11 11-25z" horiz-adv-x="1000" />
92
+
93
+ <glyph glyph-name="export" unicode="&#xe82a;" d="M750 60l0 56 100 82 0-188q0-20-15-35t-35-15l-750 0q-20 0-35 15t-15 35l0 550q0 22 14 36t36 14l288 0q-32-24-59-49t-39-39l-10-12-130 0 0-450 650 0z m-82 348q-166 0-242-41t-160-181q0 8 1 22t9 56 22 79 44 83 70 79 107 56 149 23l0 156 332-250-332-260 0 178z" horiz-adv-x="1000" />
94
+
95
+ <glyph glyph-name="trash-empty" unicode="&#xe82b;" d="M286 439v-321q0-8-5-13t-13-5h-36q-8 0-13 5t-5 13v321q0 8 5 13t13 5h36q8 0 13-5t5-13z m143 0v-321q0-8-5-13t-13-5h-36q-8 0-13 5t-5 13v321q0 8 5 13t13 5h36q8 0 13-5t5-13z m142 0v-321q0-8-5-13t-12-5h-36q-8 0-13 5t-5 13v321q0 8 5 13t13 5h36q7 0 12-5t5-13z m72-404v529h-500v-529q0-12 4-22t8-15 6-5h464q2 0 6 5t8 15 4 22z m-375 601h250l-27 65q-4 5-9 6h-177q-6-1-10-6z m518-18v-36q0-8-5-13t-13-5h-54v-529q0-46-26-80t-63-34h-464q-37 0-63 33t-27 79v531h-53q-8 0-13 5t-5 13v36q0 8 5 13t13 5h172l39 93q9 21 31 35t44 15h178q23 0 44-15t30-35l39-93h173q8 0 13-5t5-13z" horiz-adv-x="785.7" />
96
+
97
+ <glyph glyph-name="down-dir" unicode="&#xe82c;" d="M571 457q0-14-10-25l-250-250q-11-11-25-11t-25 11l-250 250q-11 11-11 25t11 25 25 11h500q14 0 25-11t10-25z" horiz-adv-x="571.4" />
98
+
99
+ <glyph glyph-name="up-dir" unicode="&#xe82d;" d="M571 171q0-14-10-25t-25-10h-500q-15 0-25 10t-11 25 11 26l250 250q10 10 25 10t25-10l250-250q10-11 10-26z" horiz-adv-x="571.4" />
100
+
101
+ <glyph glyph-name="left-dir" unicode="&#xe82e;" d="M357 600v-500q0-14-10-25t-26-11-25 11l-250 250q-10 11-10 25t10 25l250 250q11 11 25 11t26-11 10-25z" horiz-adv-x="357.1" />
102
+
103
+ <glyph glyph-name="right-dir" unicode="&#xe82f;" d="M321 350q0-14-10-25l-250-250q-11-11-25-11t-25 11-11 25v500q0 15 11 25t25 11 25-11l250-250q10-10 10-25z" horiz-adv-x="357.1" />
104
+
105
+ <glyph glyph-name="spin1" unicode="&#xe830;" d="M496 850c-176 0-331-90-421-226-18-27-33-55-46-85-12-29-21-60-28-92 0 0 0-1 0-1l0 0 0 0c0-1 0-2 0-2 0-7 5-12 11-12l101 0c5 0 10 4 11 9 29 113 109 206 214 253 20 10 41 17 63 23 31 7 62 11 95 11l0 0 0 0 0 0c25 0 50-2 74-7 5-1 10-2 14-3 6-1 10-3 14-4l0 0c5-1 11 1 13 6l51 87c0 0 1 1 1 2 2 6-1 13-7 15-22 7-43 13-65 17-5 1-9 1-13 2-27 5-54 7-82 7l0 0 0 0z m327-114c-5 0-9-2-11-6l-50-87c-3-4-2-10 2-14 29-29 54-63 73-101 4-7 7-14 11-22 19-46 30-97 30-151l0 0 0 0c0-77-22-149-62-209-7-11-15-23-24-33-9-11-18-21-28-31l0 0 0 0 0 0c-4-4-5-10-2-14l50-87c0-1 1-2 2-3 4-5 11-5 16-1 58 52 104 117 134 190 6 15 11 29 15 44 14 46 21 94 21 144 0 108-34 209-92 291-11 16-23 31-37 46-13 14-26 28-41 41l0 0c-1 1-1 1-2 1-2 1-4 2-5 2z m-811-468l0 0c-1 0-2 0-3 0-6-1-10-8-9-14 34-166 149-302 302-366 30-12 61-21 93-28 32-6 66-10 100-10l0 0 0 0c40 0 79 5 117 14 7 1 14 3 22 5 6 2 13 5 20 7 1 0 2 1 3 1 6 3 8 10 4 16l-50 87c-3 5-8 7-13 6-14-4-28-7-42-9-3-1-6-1-8-2-18-2-35-3-53-3l0 0 0 0c-128 0-242 63-311 160-1 0-1 0-1 0-13 19-25 40-35 61-10 21-18 43-24 65-1 6-6 10-11 10l-101 0z" horiz-adv-x="1000" />
106
+
107
+ <glyph glyph-name="spin2" unicode="&#xe831;" d="M46 144l0 0c0 0-1 0-1 0-8 18-15 37-21 55-6 19-11 38-15 58-19 99-8 203 35 298 3 6 10 8 15 5 1 0 2 0 2-1l0 0 80-59c5-3 6-9 4-14-5-12-9-25-12-37-4-13-7-26-9-40-11-67-3-137 23-201 2-5 0-10-4-13l0 0-80-56c-5-4-12-2-16 3-1 0-1 1-1 2l0 0z m120 574l0 0c0 1 0 1 0 1 15 13 30 25 46 37 16 11 33 22 51 31 89 50 192 72 297 60 6-1 10-6 10-13 0-1-1-1-1-2l0 0-31-94c-2-5-8-8-13-7-13 0-27 0-40 0-14-1-27-2-40-4-68-11-133-40-186-84-4-3-10-3-14 0l0 0-79 58c-5 3-6 11-2 16 0 0 1 1 2 1l0 0z m588 65l0 0c0 0 1 0 1 0 17-10 34-21 50-32 16-12 31-25 46-38 74-69 127-160 148-262 2-6-2-12-9-13-1 0-1 0-2 0l0 0-100 1c-5 0-10 4-11 9-3 13-8 26-12 38-5 12-10 25-17 36-31 61-78 113-137 150-5 3-6 8-5 13l0 0 31 92c2 6 9 9 15 7 1 0 2-1 2-1l0 0z m244-535l0 0c0 0 0 0 0 0-4-20-9-39-15-57-7-19-14-37-22-55-44-92-114-170-205-221-6-3-13-1-16 4 0 1-1 2-1 2l0 0-30 94c-2 6 1 12 6 14 11 7 22 15 32 23 11 9 21 18 30 27 49 48 84 109 101 176 2 5 6 8 11 8l0 0 98-1c6 0 11-5 11-11 0-1 0-2 0-3l0 0z m-438-395l0 0c0 0 0 0 0 0-20-2-40-3-60-3-20 0-40 1-59 4-102 12-198 54-276 125-5 4-5 11 0 16 0 0 1 1 1 1l0 0 81 58c5 3 12 2 16-2 10-8 20-16 32-23 11-7 22-14 34-20 62-31 131-45 200-41 6 0 10-3 12-8l0 0 29-92c2-6-1-12-7-14-1-1-2-1-3-1l0 0z" horiz-adv-x="1000" />
108
+
109
+ <glyph glyph-name="mobile" unicode="&#xe832;" d="M480 840q42 0 71-29t29-71l0-780q0-40-29-70t-71-30l-380 0q-40 0-70 30t-30 70l0 780q0 42 30 71t70 29l380 0z m-190-940q30 0 50 15t20 35q0 22-20 36t-50 14q-28 0-49-15t-21-35 21-35 49-15z m210 150l0 660-420 0 0-660 420 0z" horiz-adv-x="580" />
110
+
111
+ <glyph glyph-name="bell" unicode="&#xe833;" d="M509-96q0 8-9 8-33 0-57 24t-23 57q0 9-9 9t-9-9q0-41 29-70t69-28q9 0 9 9z m-372 160h726q-149 168-149 465 0 28-13 58t-39 58-67 45-95 17-95-17-67-45-39-58-13-58q0-297-149-465z m827 0q0-29-21-50t-50-21h-250q0-59-42-101t-101-42-101 42-42 101h-250q-29 0-50 21t-21 50q28 24 51 49t47 67 42 89 27 115 11 145q0 84 66 157t171 89q-5 10-5 21 0 23 16 38t38 16 38-16 16-38q0-11-5-21 106-16 171-89t66-157q0-78 11-145t28-115 41-89 48-67 50-49z" horiz-adv-x="1000" />
112
+
113
+ <glyph glyph-name="ccw" unicode="&#xe834;" d="M857 350q0-87-34-166t-91-137-137-92-166-34q-96 0-183 41t-147 114q-4 6-4 13t5 11l76 77q6 5 14 5 9-1 13-7 41-53 100-82t126-29q58 0 110 23t92 61 61 91 22 111-22 111-61 91-92 61-110 23q-55 0-105-20t-90-57l77-77q17-16 8-38-10-23-33-23h-250q-15 0-25 11t-11 25v250q0 24 22 33 22 10 39-8l72-72q60 57 137 88t159 31q87 0 166-34t137-92 91-137 34-166z" horiz-adv-x="857.1" />
114
+
115
+ <glyph glyph-name="wrench" unicode="&#xe835;" d="M214 29q0 14-10 25t-25 10-25-10-11-25 11-25 25-11 25 11 10 25z m360 234l-381-381q-21-20-50-20-29 0-51 20l-59 61q-21 20-21 50 0 29 21 51l380 380q22-55 64-97t97-64z m354 243q0-22-13-59-27-75-92-122t-144-46q-104 0-177 73t-73 177 73 176 177 74q32 0 67-10t60-26q9-6 9-15t-9-16l-163-94v-125l108-60q2 2 44 27t75 45 40 20q8 0 13-5t5-14z" horiz-adv-x="928.6" />
116
+
117
+ <glyph glyph-name="stop-1" unicode="&#xe837;" d="M857 743v-786q0-14-10-25t-26-11h-785q-15 0-25 11t-11 25v786q0 14 11 25t25 11h785q15 0 26-11t10-25z" horiz-adv-x="857.1" />
118
+
119
+ <glyph glyph-name="spin5" unicode="&#xe838;" d="M462 850c-6 0-11-5-11-11l0-183 0 0c0-6 5-11 11-11l69 0c1 0 1 0 1 0 7 0 12 5 12 11l0 183 0 0c0 6-5 11-12 11l-69 0c0 0 0 0-1 0z m250-47c-4 1-8-2-10-5l-91-158 0 0c-4-6-2-13 4-16l60-34c0-1 0-1 0-1 6-3 13-1 16 4l91 158c3 6 2 13-4 16l-61 35c-1 1-3 1-5 1z m-428-2c-2 0-4-1-6-2l-61-35c-5-3-7-10-4-16l91-157c0 0 0 0 0 0 3-6 10-8 16-5l61 35c5 4 7 11 4 16l-91 157c0 1 0 1 0 1-2 4-6 6-10 6z m620-163c-2 0-4 0-6-1l-157-91c0 0 0 0 0 0-6-3-8-10-5-16l35-61c4-5 11-7 16-4l157 91c1 0 1 0 1 0 6 3 7 11 4 16l-35 61c-2 4-6 6-10 5z m-810-4c-5 0-9-2-11-6l-35-61c-3-5-1-12 4-15l158-91 0 0c6-4 13-2 16 4l35 60c0 0 0 0 0 0 3 6 1 13-4 16l-158 91c-2 1-4 2-5 2z m712-235l0 0c-6 0-11-5-11-11l0-69c0-1 0-1 0-1 0-7 5-12 11-12l183 0 0 0c6 0 11 5 11 12l0 69c0 0 0 0 0 1 0 6-5 11-11 11l-183 0z m-794-5l0 0c-7 0-12-5-12-12l0-69c0 0 0 0 0-1 0-6 5-11 12-11l182 0 0 0c6 0 11 5 11 11l0 69c0 1 0 1 0 1 0 7-5 12-11 12l-182 0z m772-153c-4 0-8-2-10-6l-34-60c-1 0-1 0-1 0-3-6-1-13 4-16l158-91c6-3 13-1 16 4l35 61c3 5 1 12-4 15l-158 92 0 0c-2 1-4 1-6 1z m-566-5c-1 0-3 0-5-1l-157-91c0 0-1 0-1 0-5-3-7-10-4-16l35-61c3-5 10-7 16-4l157 91c0 0 0 0 0 0 6 3 8 10 5 16l-35 61c-3 3-7 6-11 5z m468-121c-2 0-4 0-6-1l-61-35c-5-4-7-11-4-16l91-157c0-1 0-1 0-1 3-6 11-7 16-4l61 35c5 3 7 10 4 16l-91 157c0 0 0 0 0 0-2 4-6 6-10 6z m-367-2c-4 0-8-2-10-6l-91-158c-3-6-1-13 4-16l61-35c5-3 12-1 15 4l92 158 0 0c3 6 1 13-5 16l-60 35c0 0 0 0 0 0-2 1-4 1-6 2z m149-58c-7 0-12-5-12-11l0-183 0 0c0-6 5-11 12-11l69 0c0 0 0 0 1 0 6 0 11 5 11 11l0 183 0 0c0 6-5 11-11 11l-69 0c-1 0-1 0-1 0z" horiz-adv-x="1000" />
120
+
121
+ <glyph glyph-name="pause-1" unicode="&#xe839;" d="M857 743v-786q0-14-10-25t-26-11h-285q-15 0-25 11t-11 25v786q0 14 11 25t25 11h285q15 0 26-11t10-25z m-500 0v-786q0-14-10-25t-26-11h-285q-15 0-25 11t-11 25v786q0 14 11 25t25 11h285q15 0 26-11t10-25z" horiz-adv-x="857.1" />
122
+
123
+ <glyph glyph-name="play-1" unicode="&#xe83a;" d="M772 333l-741-412q-13-7-22-2t-9 20v822q0 14 9 20t22-2l741-412q13-7 13-17t-13-17z" horiz-adv-x="785.7" />
124
+
125
+ <glyph glyph-name="link-ext" unicode="&#xf08e;" d="M786 332v-178q0-67-47-114t-114-47h-464q-67 0-114 47t-47 114v464q0 66 47 113t114 48h393q7 0 12-5t5-13v-36q0-8-5-13t-12-5h-393q-37 0-63-26t-27-63v-464q0-37 27-63t63-27h464q37 0 63 27t26 63v178q0 8 5 13t13 5h36q8 0 13-5t5-13z m214 482v-285q0-15-11-25t-25-11-25 11l-98 98-364-364q-5-6-13-6t-12 6l-64 64q-6 5-6 12t6 13l364 364-98 98q-11 11-11 25t11 25 25 11h285q15 0 25-11t11-25z" horiz-adv-x="1000" />
126
+
127
+ <glyph glyph-name="menu" unicode="&#xf0c9;" d="M857 100v-71q0-15-10-25t-26-11h-785q-15 0-25 11t-11 25v71q0 15 11 25t25 11h785q15 0 26-11t10-25z m0 286v-72q0-14-10-25t-26-10h-785q-15 0-25 10t-11 25v72q0 14 11 25t25 10h785q15 0 26-10t10-25z m0 285v-71q0-14-10-25t-26-11h-785q-15 0-25 11t-11 25v71q0 15 11 26t25 10h785q15 0 26-10t10-26z" horiz-adv-x="857.1" />
128
+
129
+ <glyph glyph-name="sort" unicode="&#xf0dc;" d="M571 243q0-15-10-25l-250-250q-11-11-25-11t-25 11l-250 250q-11 10-11 25t11 25 25 11h500q14 0 25-11t10-25z m0 214q0-14-10-25t-25-11h-500q-15 0-25 11t-11 25 11 25l250 250q10 11 25 11t25-11l250-250q10-10 10-25z" horiz-adv-x="571.4" />
130
+
131
+ <glyph glyph-name="mail-alt" unicode="&#xf0e0;" d="M1000 454v-443q0-37-26-63t-63-27h-822q-36 0-63 27t-26 63v443q25-27 56-49 202-137 278-192 32-24 51-37t53-27 61-13h2q28 0 61 13t53 27 51 37q95 68 278 192 32 22 56 49z m0 164q0-44-27-84t-68-69q-210-146-262-181-5-4-23-17t-30-22-29-18-32-15-28-5h-2q-12 0-27 5t-32 15-30 18-30 22-23 17q-51 35-147 101t-114 80q-35 23-65 64t-31 77q0 43 23 72t66 29h822q36 0 63-26t26-63z" horiz-adv-x="1000" />
132
+
133
+ <glyph glyph-name="lightbulb" unicode="&#xf0eb;" d="M411 529q0-8-6-13t-12-5-13 5-5 13q0 25-30 39t-59 14q-7 0-13 5t-5 13 5 13 13 5q28 0 55-9t49-30 21-50z m89 0q0 40-19 74t-50 57-69 35-76 12-76-12-69-35-50-57-20-74q0-57 38-101 6-6 17-18t17-19q72-85 79-166h127q8 81 79 166 6 6 17 19t17 18q38 44 38 101z m71 0q0-87-57-150-25-27-42-48t-33-54-19-60q26-15 26-46 0-20-13-35 13-15 13-36 0-29-25-45 8-13 8-26 0-26-18-40t-43-14q-11-25-34-39t-48-15-49 15-33 39q-26 0-44 14t-17 40q0 13 7 26-25 16-25 45 0 21 14 36-14 15-14 35 0 31 26 46-2 28-19 60t-33 54-41 48q-58 63-58 150 0 55 25 103t65 79 92 49 104 19 104-19 91-49 66-79 24-103z" horiz-adv-x="571.4" />
134
+
135
+ <glyph glyph-name="exchange" unicode="&#xf0ec;" d="M1000 189v-107q0-7-5-12t-13-6h-768v-107q0-7-5-12t-13-6q-6 0-13 6l-178 178q-5 6-5 13 0 8 5 13l179 178q5 5 12 5 8 0 13-5t5-13v-107h768q7 0 13-5t5-13z m0 304q0-8-5-13l-179-178q-5-6-12-6-8 0-13 6t-5 12v107h-768q-7 0-13 6t-5 12v107q0 8 5 13t13 5h768v107q0 8 5 13t13 5q6 0 13-5l178-178q5-5 5-13z" horiz-adv-x="1000" />
136
+
137
+ <glyph glyph-name="upload-cloud" unicode="&#xf0ee;" d="M714 368q0 8-5 13l-196 196q-5 5-13 5t-13-5l-196-196q-5-6-5-13 0-8 5-13t13-5h125v-196q0-8 5-13t12-5h108q7 0 12 5t5 13v196h125q8 0 13 5t5 13z m357-161q0-89-62-151t-152-63h-607q-103 0-177 73t-73 177q0 72 39 134t105 92q-1 17-1 24 0 118 84 202t202 84q87 0 159-49t105-129q40 35 93 35 59 0 101-42t42-101q0-43-23-77 72-17 119-76t46-133z" horiz-adv-x="1071.4" />
138
+
139
+ <glyph glyph-name="bell-alt" unicode="&#xf0f3;" d="M509-96q0 8-9 8-33 0-57 24t-23 57q0 9-9 9t-9-9q0-41 29-70t69-28q9 0 9 9z m455 160q0-29-21-50t-50-21h-250q0-59-42-101t-101-42-101 42-42 101h-250q-29 0-50 21t-21 50q28 24 51 49t47 67 42 89 27 115 11 145q0 84 66 157t171 89q-5 10-5 21 0 23 16 38t38 16 38-16 16-38q0-11-5-21 106-16 171-89t66-157q0-78 11-145t28-115 41-89 48-67 50-49z" horiz-adv-x="1000" />
140
+
141
+ <glyph glyph-name="doc-text" unicode="&#xf0f6;" d="M819 638q16-16 27-42t11-50v-642q0-23-15-38t-38-16h-750q-23 0-38 16t-16 38v892q0 23 16 38t38 16h500q22 0 49-11t42-27z m-248 136v-210h210q-5 17-12 23l-175 175q-6 7-23 12z m215-853v572h-232q-23 0-38 16t-16 37v233h-429v-858h715z m-572 483q0 7 5 12t13 5h393q8 0 13-5t5-12v-36q0-8-5-13t-13-5h-393q-8 0-13 5t-5 13v36z m411-125q8 0 13-5t5-13v-36q0-8-5-13t-13-5h-393q-8 0-13 5t-5 13v36q0 8 5 13t13 5h393z m0-143q8 0 13-5t5-13v-36q0-8-5-13t-13-5h-393q-8 0-13 5t-5 13v36q0 8 5 13t13 5h393z" horiz-adv-x="857.1" />
142
+
143
+ <glyph glyph-name="angle-double-left" unicode="&#xf100;" d="M350 82q0-7-6-13l-28-28q-5-5-12-5t-13 5l-260 261q-6 5-6 12t6 13l260 260q5 6 13 6t12-6l28-28q6-5 6-13t-6-12l-219-220 219-219q6-6 6-13z m214 0q0-7-5-13l-28-28q-6-5-13-5t-13 5l-260 261q-6 5-6 12t6 13l260 260q6 6 13 6t13-6l28-28q5-5 5-13t-5-12l-220-220 220-219q5-6 5-13z" horiz-adv-x="571.4" />
144
+
145
+ <glyph glyph-name="angle-double-right" unicode="&#xf101;" d="M332 314q0-7-5-12l-261-261q-5-5-12-5t-13 5l-28 28q-6 6-6 13t6 13l219 219-219 220q-6 5-6 12t6 13l28 28q5 6 13 6t12-6l261-260q5-5 5-13z m214 0q0-7-5-12l-260-261q-6-5-13-5t-13 5l-28 28q-5 6-5 13t5 13l219 219-219 220q-5 5-5 12t5 13l28 28q6 6 13 6t13-6l260-260q5-5 5-13z" horiz-adv-x="571.4" />
146
+
147
+ <glyph glyph-name="angle-double-up" unicode="&#xf102;" d="M600 118q0-7-6-13l-28-28q-5-5-12-5t-13 5l-220 219-219-219q-5-5-13-5t-12 5l-28 28q-6 6-6 13t6 13l260 260q5 5 12 5t13-5l260-260q6-6 6-13z m0 214q0-7-6-13l-28-28q-5-5-12-5t-13 5l-220 220-219-220q-5-5-13-5t-12 5l-28 28q-6 6-6 13t6 13l260 260q5 6 12 6t13-6l260-260q6-6 6-13z" horiz-adv-x="642.9" />
148
+
149
+ <glyph glyph-name="angle-double-down" unicode="&#xf103;" d="M600 368q0-7-6-13l-260-260q-5-6-13-6t-12 6l-260 260q-6 6-6 13t6 13l28 28q5 5 12 5t13-5l219-220 220 220q5 5 13 5t12-5l28-28q6-6 6-13z m0 214q0-7-6-13l-260-260q-5-5-13-5t-12 5l-260 260q-6 6-6 13t6 13l28 28q5 6 12 6t13-6l219-219 220 219q5 6 13 6t12-6l28-28q6-6 6-13z" horiz-adv-x="642.9" />
150
+
151
+ <glyph glyph-name="desktop" unicode="&#xf108;" d="M1000 296v465q0 7-5 12t-13 6h-893q-7 0-12-6t-6-12v-465q0-7 6-12t12-5h893q7 0 13 5t5 12z m71 465v-607q0-37-26-63t-63-27h-303q0-20 9-43t17-40 9-24q0-14-10-25t-25-11h-286q-15 0-25 11t-11 25q0 8 9 25t18 39 9 43h-304q-36 0-63 27t-26 63v607q0 37 26 63t63 26h893q37 0 63-26t26-63z" horiz-adv-x="1071.4" />
152
+
153
+ <glyph glyph-name="laptop" unicode="&#xf109;" d="M232 136q-37 0-63 26t-26 63v393q0 37 26 63t63 26h607q37 0 63-26t27-63v-393q0-37-27-63t-63-26h-607z m-18 482v-393q0-7 6-13t12-5h607q8 0 13 5t5 13v393q0 7-5 12t-13 6h-607q-7 0-12-6t-6-12z m768-518h89v-54q0-22-26-37t-63-16h-893q-36 0-63 16t-26 37v54h982z m-402-54q9 0 9 9t-9 9h-89q-9 0-9-9t9-9h89z" horiz-adv-x="1071.4" />
154
+
155
+ <glyph glyph-name="tablet" unicode="&#xf10a;" d="M357 64q0 15-10 25t-26 11-25-11-10-25 10-25 25-10 26 10 10 25z m214 90v535q0 8-5 13t-12 5h-465q-7 0-12-5t-6-13v-535q0-8 6-13t12-5h465q7 0 12 5t5 13z m72 535v-607q0-37-26-63t-63-26h-465q-36 0-63 26t-26 63v607q0 37 26 63t63 27h465q36 0 63-27t26-63z" horiz-adv-x="642.9" />
156
+
157
+ <glyph glyph-name="circle-empty" unicode="&#xf10c;" d="M429 654q-83 0-153-41t-110-111-41-152 41-152 110-111 153-41 152 41 110 111 41 152-41 152-110 111-152 41z m428-304q0-117-57-215t-156-156-215-58-216 58-155 156-58 215 58 215 155 156 216 58 215-58 156-156 57-215z" horiz-adv-x="857.1" />
158
+
159
+ <glyph glyph-name="circle" unicode="&#xf111;" d="M857 350q0-117-57-215t-156-156-215-58-216 58-155 156-58 215 58 215 155 156 216 58 215-58 156-156 57-215z" horiz-adv-x="857.1" />
160
+
161
+ <glyph glyph-name="unlink" unicode="&#xf127;" d="M245 141l-143-143q-6-5-13-5t-12 5q-6 6-6 13t6 13l142 142q6 5 13 5t13-5q5-5 5-12t-5-13z m94-23v-179q0-8-5-13t-13-5-12 5-5 13v179q0 8 5 13t12 5 13-5 5-13z m-125 125q0-8-5-13t-13-5h-178q-8 0-13 5t-5 13 5 13 13 5h178q8 0 13-5t5-13z m706-72q0-66-48-113l-82-81q-46-47-113-47-68 0-114 48l-186 187q-12 12-24 31l134 10 152-153q15-15 38-15t38 15l82 81q16 16 16 37 0 23-16 38l-153 154 10 133q20-11 31-23l188-188q47-48 47-114z m-345 404l-133-10-152 153q-16 16-38 16-22 0-38-15l-82-82q-16-15-16-37 0-22 16-38l153-153-10-134q-20 12-32 24l-187 187q-47 48-47 114 0 67 47 113l82 82q47 46 114 46 67 0 114-47l186-187q12-12 23-32z m354-46q0-8-5-13t-13-5h-179q-8 0-13 5t-5 13 5 12 13 5h179q8 0 13-5t5-12z m-304 303v-178q0-8-5-13t-13-5-13 5-5 13v178q0 8 5 13t13 5 13-5 5-13z m227-84l-143-143q-6-5-13-5t-12 5q-5 6-5 13t5 13l143 143q5 5 12 5t13-5q5-6 5-13t-5-13z" horiz-adv-x="928.6" />
162
+
163
+ <glyph glyph-name="help" unicode="&#xf128;" d="M393 149v-134q0-9-7-15t-15-7h-134q-9 0-16 7t-7 15v134q0 9 7 16t16 6h134q9 0 15-6t7-16z m176 335q0-30-8-56t-20-43-31-33-32-25-34-19q-23-13-38-37t-15-37q0-10-7-18t-16-9h-134q-8 0-14 11t-6 20v26q0 46 37 87t79 60q33 16 47 32t14 42q0 24-26 41t-60 18q-36 0-60-16-20-14-60-64-7-9-17-9-7 0-14 4l-91 70q-8 6-9 14t3 16q89 148 259 148 45 0 90-17t81-46 59-72 23-88z" horiz-adv-x="571.4" />
164
+
165
+ <glyph glyph-name="info" unicode="&#xf129;" d="M357 100v-71q0-15-10-25t-26-11h-285q-15 0-25 11t-11 25v71q0 15 11 25t25 11h35v214h-35q-15 0-25 11t-11 25v71q0 15 11 25t25 11h214q15 0 25-11t11-25v-321h35q15 0 26-11t10-25z m-71 643v-107q0-15-11-25t-25-11h-143q-14 0-25 11t-11 25v107q0 14 11 25t25 11h143q15 0 25-11t11-25z" horiz-adv-x="357.1" />
166
+
167
+ <glyph glyph-name="attention-alt" unicode="&#xf12a;" d="M286 154v-125q0-15-11-25t-25-11h-143q-14 0-25 11t-11 25v125q0 14 11 25t25 10h143q15 0 25-10t11-25z m17 589l-16-429q-1-14-12-25t-25-10h-143q-14 0-25 10t-12 25l-15 429q-1 14 10 25t24 11h179q14 0 25-11t10-25z" horiz-adv-x="357.1" />
168
+
169
+ <glyph glyph-name="ellipsis" unicode="&#xf141;" d="M214 439v-107q0-22-15-38t-38-15h-107q-23 0-38 15t-16 38v107q0 23 16 38t38 16h107q22 0 38-16t15-38z m286 0v-107q0-22-16-38t-38-15h-107q-22 0-38 15t-15 38v107q0 23 15 38t38 16h107q23 0 38-16t16-38z m286 0v-107q0-22-16-38t-38-15h-107q-22 0-38 15t-16 38v107q0 23 16 38t38 16h107q23 0 38-16t16-38z" horiz-adv-x="785.7" />
170
+
171
+ <glyph glyph-name="ellipsis-vert" unicode="&#xf142;" d="M214 154v-108q0-22-15-37t-38-16h-107q-23 0-38 16t-16 37v108q0 22 16 38t38 15h107q22 0 38-15t15-38z m0 285v-107q0-22-15-38t-38-15h-107q-23 0-38 15t-16 38v107q0 23 16 38t38 16h107q22 0 38-16t15-38z m0 286v-107q0-22-15-38t-38-16h-107q-23 0-38 16t-16 38v107q0 22 16 38t38 16h107q22 0 38-16t15-38z" horiz-adv-x="214.3" />
172
+
173
+ <glyph glyph-name="euro" unicode="&#xf153;" d="M545 121l19-89q2-7-1-13t-10-8l-3 0q-2-1-6-2t-9-3-12-3-14-3-16-2-19-3-21-2-21 0q-131 0-228 73t-133 196h-53q-7 0-13 5t-5 13v63q0 7 5 12t13 6h37q-1 31 0 58h-37q-8 0-13 5t-5 13v64q0 8 5 13t13 5h55q37 117 135 188t224 72q57 0 108-13 6-2 11-9 4-6 2-13l-24-89q-2-7-8-11t-13-1l-2 1q-3 0-7 1l-10 2t-12 2-15 2-16 1-16 1q-71 0-126-36t-84-98h261q9 0 14-7 6-7 4-15l-13-63q-3-15-18-15h-273q-1-20 0-58h257q8 0 13-7 5-7 4-15l-14-63q-1-6-6-10t-11-4h-216q27-65 84-104t127-38q10 0 20 1t19 2 16 2 14 3 10 3l7 1 3 2q7 2 14-2 7-3 9-11z" horiz-adv-x="571.4" />
174
+
175
+ <glyph glyph-name="pound" unicode="&#xf154;" d="M569 216v-205q0-8-5-13t-13-5h-533q-8 0-13 5t-5 13v83q0 8 5 13t13 5h54v214h-53q-8 0-13 5t-5 13v73q0 8 5 13t13 5h53v124q0 96 69 158t175 62q104 0 187-70 5-5 6-12t-4-12l-57-71q-5-6-13-7-7-1-13 4-2 3-14 11t-39 18-51 10q-48 0-77-27t-29-68v-120h170q8 0 13-5t5-13v-73q0-7-5-13t-13-5h-170v-211h231v101q0 7 5 12t13 5h90q8 0 13-5t5-12z" horiz-adv-x="571.4" />
176
+
177
+ <glyph glyph-name="dollar" unicode="&#xf155;" d="M546 189q0-86-56-147t-144-77v-97q0-8-5-13t-13-5h-75q-7 0-13 5t-5 13v97q-37 5-71 18t-57 25-41 26-26 21-10 10q-9 12-1 23l58 76q3 5 12 6 9 1 14-5l1-1q63-55 135-70 21-4 42-4 45 0 79 24t35 68q0 16-9 30t-18 23-33 21-37 18-45 18q-21 9-34 14t-34 15-35 17-32 20-29 24-25 27-20 32-11 37-5 44q0 77 55 135t142 75v100q0 7 5 13t13 5h75q8 0 13-5t5-13v-98q32-3 62-13t48-19 36-20 21-17 9-7q9-11 3-22l-46-81q-4-9-12-9-8-2-15 4-2 2-9 7t-21 14-33 18-42 15-47 6q-53 0-87-24t-33-62q0-14 4-27t17-23 22-18 31-18 34-15 39-15q30-11 45-17t43-20 42-24 34-28 30-35 18-43 7-52z" horiz-adv-x="571.4" />
178
+
179
+ <glyph glyph-name="rupee" unicode="&#xf156;" d="M501 588v-57q0-8-5-13t-13-5h-93q-13-80-72-131t-154-61q93-99 256-299 8-9 2-19-5-10-16-10h-109q-9 0-14 7-171 204-278 318-5 5-5 13v70q0 8 5 13t13 5h62q74 0 119 24t57 70h-238q-8 0-13 5t-5 13v57q0 8 5 13t13 5h230q-31 63-149 63h-81q-7 0-13 5t-5 13v74q0 8 5 13t13 5h464q8 0 13-5t5-13v-57q0-8-5-13t-13-5h-130q26-34 36-80h95q8 0 13-5t5-13z" horiz-adv-x="501.1" />
180
+
181
+ <glyph glyph-name="yen" unicode="&#xf157;" d="M337-7h-96q-8 0-13 5t-5 13v184h-161q-7 0-13 5t-5 13v57q0 8 5 13t13 5h161v48h-161q-7 0-13 5t-5 12v58q0 8 5 13t13 5h119l-179 323q-4 9 0 18 6 9 16 9h108q11 0 16-10l120-238q11-21 32-69 5 13 17 38t15 34l107 234q4 11 16 11h106q10 0 15-9 5-8 1-18l-175-323h120q7 0 13-5t5-13v-58q0-7-5-12t-13-5h-162v-48h162q7 0 13-5t5-13v-57q0-8-5-13t-13-5h-162v-184q0-7-5-13t-12-5z" horiz-adv-x="573.1" />
182
+
183
+ <glyph glyph-name="rouble" unicode="&#xf158;" d="M582 535q0 56-36 90t-96 35h-178v-250h178q60 0 96 34t36 91z m132 0q0-108-70-176t-182-68h-190v-66h282q7 0 12-5t5-13v-71q0-8-5-13t-12-5h-282v-107q0-8-5-13t-13-5h-93q-8 0-13 5t-5 13v107h-125q-8 0-13 5t-5 13v71q0 8 5 13t13 5h125v66h-125q-8 0-13 5t-5 13v83q0 7 5 12t13 6h125v351q0 8 5 13t13 5h301q111 0 182-68t70-176z" horiz-adv-x="714.3" />
184
+
185
+ <glyph glyph-name="won" unicode="&#xf159;" d="M287 183l45 167h-89l42-167q1-1 1-2t0-2q0 1 1 2t0 2z m65 238l19 72h-163l18-72h126z m107 0h77l-19 72h-39z m250-238l44 167h-91l46-167q0 0 0-2t1-2q0 1 0 2t0 2z m62 238l19 72h-166l19-72h128z m229-17v-36q0-8-5-13t-13-5h-119l-91-344q-4-13-17-13h-89q-14 0-18 13l-92 344h-117l-93-344q-4-13-17-13h-89q-6 0-11 4t-6 9l-89 344h-116q-8 0-13 5t-5 13v36q0 7 5 12t13 5h98l-19 72h-79q-8 0-13 5t-5 13v35q0 8 5 13t13 5h61l-50 192q-3 9 3 16 5 7 14 7h77q14 0 17-14l50-201h201l54 201q4 14 17 14h70q14 0 18-14l54-201h204l52 201q3 14 17 14h77q9 0 14-7 6-7 3-16l-51-192h62q8 0 13-5t5-13v-35q0-8-5-13t-13-5h-81l-19-72h100q8 0 13-5t5-12z" horiz-adv-x="1000" />
186
+
187
+ <glyph glyph-name="bitcoin" unicode="&#xf15a;" d="M651 493q10-102-73-144 65-16 98-58t25-119q-4-40-18-70t-36-49-54-33-68-19-81-9v-142h-86v140q-45 0-68 1v-141h-86v142q-10 0-30 1t-31 0h-112l18 102h62q27 0 32 28v225h9q-4 0-9 0v161q-7 37-50 37h-62v92l119-1q35 0 54 1v141h86v-138q45 1 68 1v137h86v-141q44-4 78-13t63-25 46-43 20-64z m-120-304q0 20-8 35t-21 26-32 17-36 11-42 5-38 1-36 0-27-1v-189q5 0 21 0t27 0 29 1 33 2 32 5 31 8 26 11 22 17 14 22 5 29z m-39 265q0 19-7 33t-17 23-27 16-31 9-34 5-32 1-31 0-22-1v-171q3 0 20 0t26 0 27 1 31 3 29 6 27 10 21 15 15 22 5 28z" horiz-adv-x="714.3" />
188
+
189
+ <glyph glyph-name="sort-alt-up" unicode="&#xf160;" d="M411 46q0-6-6-13l-178-178q-5-5-13-5-6 0-12 5l-179 179q-8 9-4 19 4 11 17 11h107v768q0 8 5 13t13 5h107q8 0 13-5t5-13v-768h107q8 0 13-5t5-13z m589-71v-107q0-8-5-13t-13-5h-464q-8 0-13 5t-5 13v107q0 8 5 13t13 5h464q8 0 13-5t5-13z m-107 286v-107q0-8-5-13t-13-5h-357q-8 0-13 5t-5 13v107q0 8 5 13t13 5h357q8 0 13-5t5-13z m-107 285v-107q0-7-5-12t-13-6h-250q-8 0-13 6t-5 12v107q0 8 5 13t13 5h250q8 0 13-5t5-13z m-107 286v-107q0-8-5-13t-13-5h-143q-8 0-13 5t-5 13v107q0 8 5 13t13 5h143q8 0 13-5t5-13z" horiz-adv-x="1000" />
190
+
191
+ <glyph glyph-name="sort-alt-down" unicode="&#xf161;" d="M679-25v-107q0-8-5-13t-13-5h-143q-8 0-13 5t-5 13v107q0 8 5 13t13 5h143q8 0 13-5t5-13z m-268 71q0-6-6-13l-178-178q-5-5-13-5-6 0-12 5l-179 179q-8 9-4 19 4 11 17 11h107v768q0 8 5 13t13 5h107q8 0 13-5t5-13v-768h107q8 0 13-5t5-13z m375 215v-107q0-8-5-13t-13-5h-250q-8 0-13 5t-5 13v107q0 8 5 13t13 5h250q8 0 13-5t5-13z m107 285v-107q0-7-5-12t-13-6h-357q-8 0-13 6t-5 12v107q0 8 5 13t13 5h357q8 0 13-5t5-13z m107 286v-107q0-8-5-13t-13-5h-464q-8 0-13 5t-5 13v107q0 8 5 13t13 5h464q8 0 13-5t5-13z" horiz-adv-x="1000" />
192
+
193
+ <glyph glyph-name="bug" unicode="&#xf188;" d="M911 314q0-14-11-25t-25-10h-125q0-96-37-162l116-117q10-11 10-25t-10-25q-10-11-25-11t-25 11l-111 110q-3-3-8-7t-24-16-36-21-46-16-54-7v500h-71v-500q-29 0-57 7t-49 19-36 22-25 18l-8 8-102-116q-11-12-27-12-13 0-24 9-11 10-11 25t8 26l113 127q-32 63-32 153h-125q-15 0-25 10t-11 25 11 25 25 11h125v164l-97 97q-11 10-11 25t11 25 25 10 25-10l97-97h471l96 97q11 10 25 10t26-10 10-25-10-25l-97-97v-164h125q15 0 25-11t11-25z m-268 322h-357q0 74 52 126t126 52 127-52 52-126z" horiz-adv-x="928.6" />
194
+
195
+ <glyph glyph-name="try" unicode="&#xf195;" d="M643 386q0-107-53-197t-143-143-197-53h-89q-8 0-13 5t-5 13v341l-120-37q-2-1-5-1-6 0-11 4-7 5-7 14v72q0 12 13 17l130 40v51l-120-36q-2-1-5-1-6 0-11 3-7 6-7 15v71q0 13 13 18l130 39v140q0 8 5 13t13 5h89q8 0 13-5t5-13v-101l209 64q9 3 16-2t7-15v-71q0-13-13-18l-219-67v-52l209 65q9 3 16-3t7-15v-71q0-13-13-17l-219-68v-272q105 8 177 85t73 183q0 8 5 13t13 5h89q8 0 13-5t5-13z" horiz-adv-x="642.9" />
196
+
197
+ <glyph glyph-name="wordpress" unicode="&#xf19a;" d="M71 350q0 91 37 175l205-561q-109 53-176 157t-66 229z m719 22q0-11-2-22t-5-27-7-25-9-33-10-32l-43-143-155 461q26 2 49 4 11 2 15 11t-2 17-15 8l-115-6q-42 1-113 6-6 0-11-3t-6-9-1-10 5-9 11-5l44-4 67-183-94-281-156 464q26 2 49 4 11 2 15 11t-2 17-15 8l-115-6q-4 0-13 0t-14 1q58 89 153 141t205 52q82 0 157-29t133-84h-6q-31 0-51-22t-21-53q0-7 1-14t2-12 5-13 5-11 7-13 7-12 8-13 8-13q35-60 35-118z m-283-59l133-361q0-4 2-7-70-24-142-24-62 0-121 18z m369 243q53-97 53-206 0-117-58-215t-156-156l132 379q33 94 33 154 0 23-4 44z m-376 294q102 0 194-40t160-106 106-160 40-194-40-194-106-160-160-106-194-40-194 40-160 106-106 160-40 194 40 194 106 160 160 106 194 40z m0-977q97 0 185 38t152 102 102 152 38 185-38 185-102 152-152 102-185 38-185-38-152-102-102-152-38-185 38-185 102-152 152-102 185-38z" horiz-adv-x="1000" />
198
+
199
+ <glyph glyph-name="cubes" unicode="&#xf1b3;" d="M357-61l214 107v176l-214-92v-191z m-36 254l226 96-226 97-225-97z m608-254l214 107v176l-214-92v-191z m-36 254l225 96-225 97-226-97z m-250 163l214 92v149l-214-92v-149z m-36 212l246 105-246 106-246-106z m607-289v-233q0-20-10-37t-29-26l-250-125q-14-8-32-8t-32 8l-250 125q-2 1-4 2-1-1-4-2l-250-125q-14-8-32-8t-31 8l-250 125q-19 9-29 26t-11 37v233q0 21 12 39t32 26l242 104v223q0 22 12 40t31 26l250 107q13 6 28 6t28-6l250-107q20-9 32-26t12-40v-223l242-104q20-8 32-26t11-39z" horiz-adv-x="1285.7" />
200
+
201
+ <glyph glyph-name="database" unicode="&#xf1c0;" d="M429 421q132 0 247 24t181 71v-95q0-38-57-71t-157-52-214-19-215 19-156 52-58 71v95q66-47 181-71t248-24z m0-428q132 0 247 24t181 71v-95q0-39-57-72t-157-52-214-19-215 19-156 52-58 72v95q66-47 181-71t248-24z m0 214q132 0 247 24t181 71v-95q0-38-57-71t-157-52-214-20-215 20-156 52-58 71v95q66-47 181-71t248-24z m0 643q116 0 214-19t157-52 57-72v-71q0-39-57-72t-157-52-214-19-215 19-156 52-58 72v71q0 39 58 72t156 52 215 19z" horiz-adv-x="857.1" />
202
+
203
+ <glyph glyph-name="circle-thin" unicode="&#xf1db;" d="M429 707q-73 0-139-28t-114-76-76-114-29-139 29-139 76-113 114-77 139-28 138 28 114 77 76 113 29 139-29 139-76 114-114 76-138 28z m428-357q0-117-57-215t-156-156-215-58-216 58-155 156-58 215 58 215 155 156 216 58 215-58 156-156 57-215z" horiz-adv-x="857.1" />
204
+
205
+ <glyph glyph-name="sliders" unicode="&#xf1de;" d="M196 64v-71h-196v71h196z m197 72q14 0 25-11t11-25v-143q0-14-11-25t-25-11h-143q-14 0-25 11t-11 25v143q0 15 11 25t25 11h143z m89 214v-71h-482v71h482z m-357 286v-72h-125v72h125z m732-572v-71h-411v71h411z m-536 643q15 0 26-10t10-26v-142q0-15-10-25t-26-11h-142q-15 0-25 11t-11 25v142q0 15 11 26t25 10h142z m358-286q14 0 25-10t10-25v-143q0-15-10-25t-25-11h-143q-15 0-25 11t-11 25v143q0 14 11 25t25 10h143z m178-71v-71h-125v71h125z m0 286v-72h-482v72h482z" horiz-adv-x="857.1" />
206
+
207
+ <glyph glyph-name="share" unicode="&#xf1e0;" d="M679 279q74 0 126-53t52-126-52-126-126-53-127 53-52 126q0 7 1 19l-201 100q-51-48-121-48-75 0-127 53t-52 126 52 126 127 53q70 0 121-48l201 100q-1 12-1 19 0 74 52 126t127 53 126-53 52-126-52-126-126-53q-71 0-122 48l-201-100q1-12 1-19t-1-19l201-100q51 48 122 48z" horiz-adv-x="857.1" />
208
+
209
+ <glyph glyph-name="plug" unicode="&#xf1e6;" d="M979 597q21-21 21-50t-21-51l-223-223 83-84-89-89q-91-91-217-104t-230 56l-202-202h-101v101l202 202q-69 103-56 230t104 217l89 89 84-83 223 223q21 21 51 21t50-21 21-50-21-51l-223-223 131-131 223 223q22 21 51 21t50-21z" horiz-adv-x="1000" />
210
+
211
+ <glyph glyph-name="trash" unicode="&#xf1f8;" d="M286 82v393q0 8-5 13t-13 5h-36q-8 0-13-5t-5-13v-393q0-8 5-13t13-5h36q8 0 13 5t5 13z m143 0v393q0 8-5 13t-13 5h-36q-8 0-13-5t-5-13v-393q0-8 5-13t13-5h36q8 0 13 5t5 13z m142 0v393q0 8-5 13t-12 5h-36q-8 0-13-5t-5-13v-393q0-8 5-13t13-5h36q7 0 12 5t5 13z m-303 554h250l-27 65q-4 5-9 6h-177q-6-1-10-6z m518-18v-36q0-8-5-13t-13-5h-54v-529q0-46-26-80t-63-34h-464q-37 0-63 33t-27 79v531h-53q-8 0-13 5t-5 13v36q0 8 5 13t13 5h172l39 93q9 21 31 35t44 15h178q23 0 44-15t30-35l39-93h173q8 0 13-5t5-13z" horiz-adv-x="785.7" />
212
+
213
+ <glyph glyph-name="chart-line" unicode="&#xf201;" d="M1143-7v-72h-1143v858h71v-786h1072z m-72 696v-242q0-12-10-17t-20 4l-68 68-353-353q-6-6-13-6t-13 6l-130 130-232-233-107 108 327 326q5 6 12 6t13-6l130-130 259 259-67 68q-9 8-5 19t17 11h243q7 0 12-5t5-13z" horiz-adv-x="1142.9" />
214
+
215
+ <glyph glyph-name="shekel" unicode="&#xf20b;" d="M554 502v-277q0-8-5-13t-13-5h-90q-7 0-12 5t-5 13v277q0 62-45 107t-107 45h-152v-643q0-8-5-13t-13-5h-89q-8 0-13 5t-5 13v750q0 8 5 13t13 5h259q75 0 139-37t101-101 37-139z m214 259v-491q0-76-37-139t-101-101-139-37h-259q-8 0-13 5t-5 13v535q0 8 5 13t13 5h89q8 0 13-5t5-13v-428h152q63 0 107 45t45 107v491q0 8 5 13t13 5h89q8 0 13-5t5-13z" horiz-adv-x="857.1" />
216
+
217
+ <glyph glyph-name="user-secret" unicode="&#xf21b;" d="M321-7l54 250-54 71-71 36z m143 0l72 357-72-36-53-71z m90 564q-1 2-3 3-5 4-53 4-39 0-93-10-4-1-12-1t-12 1q-54 10-93 10-48 0-54-4-1-1-2-3 1-11 2-16 2-1 5-3t4-6q1-2 4-11t4-12 4-9 5-10 5-8 7-7 7-6 10-4 12-2 13-1q20 0 33 7t18 16 8 20 7 16 10 7h6q6 0 10-7t6-16 9-20 18-16 33-7q7 0 13 1t12 2 9 4 8 6 7 7 5 8 5 10 4 9 4 12 4 11q1 4 4 6t4 3q2 5 3 16z m232-491q0-68-41-106t-108-39h-488q-67 0-108 39t-41 106q0 34 3 66t10 70 21 69 36 58 52 41l-51 123h120q-12 36-12 71 0 7 1 18-109 23-109 54 0 32 118 55 9 35 28 75t40 63q18 21 42 21 17 0 47-17t47-18 47 18 47 17q24 0 42-21 20-23 39-63t29-75q117-23 117-55 0-31-108-54 4-45-11-89h119l-45-126q35-18 60-54t36-80 16-84 5-83z" horiz-adv-x="857.1" />
218
+
219
+ <glyph glyph-name="user-plus" unicode="&#xf234;" d="M393 350q-89 0-152 63t-62 151 62 152 152 63 151-63 63-152-63-151-151-63z m536-71h196q7 0 13-6t5-12v-107q0-8-5-13t-13-5h-196v-197q0-7-6-12t-12-6h-107q-8 0-13 6t-5 12v197h-197q-7 0-12 5t-6 13v107q0 7 6 12t12 6h197v196q0 7 5 13t13 5h107q7 0 12-5t6-13v-196z m-411-125q0-29 21-51t50-21h143v-133q-38-28-95-28h-488q-67 0-108 39t-41 106q0 30 2 58t8 61 15 60 24 55 34 45 48 30 62 11q11 0 22-10 44-34 86-51t92-17 92 17 86 51q11 10 22 10 73 0 121-54h-125q-29 0-50-21t-21-50v-107z" horiz-adv-x="1142.9" />
220
+
221
+ <glyph glyph-name="user-times" unicode="&#xf235;" d="M393 350q-89 0-152 63t-62 151 62 152 152 63 151-63 63-152-63-151-151-63z m601-179l139-138q5-5 5-13 0-8-5-13l-76-76q-5-5-12-5-8 0-13 5l-139 139-139-139q-5-5-13-5-7 0-12 5l-76 76q-5 5-5 13 0 8 5 13l139 138-139 139q-5 5-5 13 0 8 5 13l76 75q5 5 12 5 8 0 13-5l139-139 139 139q5 5 13 5 7 0 12-5l76-75q5-5 5-13 0-8-5-13z m-278 0l-101-101q-21-20-21-50 0-30 21-51l46-46q-11-2-24-2h-488q-67 0-108 39t-41 106q0 30 2 58t8 61 15 60 24 55 34 45 48 30 62 11q11 0 22-10 86-68 178-68t178 68q11 10 22 10 15 0 31-4-15-15-22-27t-8-32q0-30 21-51z" horiz-adv-x="1142.9" />
222
+
223
+ <glyph glyph-name="viacoin" unicode="&#xf237;" d="M857 850l-107-250h107v-107h-153l-30-72h183v-107h-229l-199-464-200 464h-229v107h184l-31 72h-153v107h107l-107 250h143l180-429h211l180 429h143z m-428-679l60 143h-121z" horiz-adv-x="857.1" />
224
+
225
+ <glyph glyph-name="safari" unicode="&#xf267;" d="M530 352q0-15-10-25t-23-11q-14 0-25 9t-10 23q0 15 9 25t23 11 25-9 11-23z m8-33l195 325q-5-5-37-35t-70-65-77-71-65-62-28-29l-195-323q4 4 38 34t70 65 76 71 65 62 28 28z m361 31q0-112-58-207-2 1-9 6t-15 9-9 5q-8 0-8-8 0-5 33-24-41-63-103-107t-135-61l-8 37q-1 6-9 6-3 0-4-3t-1-6l9-38q-41-8-82-8-111 0-208 59 1 1 8 11t12 19 5 10q0 8-7 8-4 0-10-8t-12-20-8-13q-63 42-107 105t-61 137l38 8q6 2 6 8 0 3-3 5t-6 1l-38-9q-8 41-8 78 0 115 61 212 1-1 10-7t17-11 10-4q7 0 7 6 0 4-7 9t-18 12l-11 7q43 62 105 105t136 60l9-37q1-6 8-6 3 0 5 3t1 6l-9 37q40 7 75 7 114 0 212-61-22-31-22-36 0-7 6-7 7 0 27 35 62-41 105-103t60-135l-31-7q-6-1-6-8 0-3 3-5t5-1l32 7q8-40 8-78z m47 0q0 91-35 174t-95 142-142 95-174 35-173-35-143-95-95-142-35-174 35-173 95-143 143-95 173-35 174 35 142 95 95 143 35 173z m54 0q0-102-40-194t-106-160-160-106-194-40-194 40-160 106-106 160-40 194 40 194 106 160 160 106 194 40 194-40 160-106 106-160 40-194z" horiz-adv-x="1000" />
226
+
227
+ <glyph glyph-name="chrome" unicode="&#xf268;" d="M498 850q134 1 252-67 130-75 196-208l-414 22q-89 5-164-41t-103-128l-154 236q72 89 174 137t213 49z m-416-226l188-370q40-80 117-121t164-25l-129-252q-118 19-214 88t-152 176-56 230q0 149 82 274z m885-94q32-84 33-174t-27-170-86-152-137-117q-128-74-278-66l226 347q49 73 46 162t-59 155z m-467-11q70 0 119-50t50-119-50-119-119-49-119 49-49 119 49 119 119 50z" horiz-adv-x="1000" />
228
+
229
+ <glyph glyph-name="firefox" unicode="&#xf269;" d="M504-150q-158 0-282 84t-183 222q-33 74-38 168t15 186 62 174 100 135l-7-156q7 7 38 8t39-8q24 45 90 77t131 32q-30-25-67-82t-33-92q14-4 35-7t36-4 37-3 29-1q8-3 5-26t-17-42q-3-4-9-10t-32-20-56-19l8-105-77 37q-10-24-5-45t21-38 36-23 45-3q29 5 55 19t47 25 41 10q34-2 50-19t10-36q0-1-1-3t-5-7-10-9-17-5-26-1q-34-53-81-76t-117-16q41-34 91-46t94-3 86 29 71 48 45 58q24 51 22 108t-21 105-44 70q49-21 77-45t43-62q8 95-32 191t-117 159q148-43 230-156t84-289q1-71-23-143t-68-132-106-110-138-75-161-28z" horiz-adv-x="1000" />
230
+
231
+ <glyph glyph-name="opera" unicode="&#xf26a;" d="M833 723q-92 61-200 61-87 0-164-41t-134-111q-41-52-66-122t-27-148v-24q2-78 27-148t66-122q57-71 134-111t164-41q108 0 200 61-67-60-153-94t-180-33q-16 0-24 1-98 4-186 45t-152 108-101 157-37 189q0 102 40 194t106 160 160 106 194 40h2q93-1 179-34t152-93z m167-373q0-107-43-202t-119-166q-58-35-124-35-76 0-142 47 86 31 141 130t56 226q0 127-55 225t-141 131q66 46 141 46 67 0 126-36 76-70 118-164t42-202z" horiz-adv-x="1000" />
232
+
233
+ <glyph glyph-name="internet-explorer" unicode="&#xf26b;" d="M1000 327q0-31-4-58h-642q0-81 61-136t144-55q55 0 103 26t76 73h236q-31-89-95-157t-149-106-179-37q-105 0-199 47-127-65-220-65-132 0-132 147 0 64 25 153 10 34 61 128 111 201 265 338-103-44-238-197 35 153 158 250t280 98q17 0 25 0 142 65 242 65 35 0 64-7t53-23 37-42 14-65q0-64-42-159 56-102 56-218z m-39 357q0 47-30 74t-76 27q-60 0-142-39 68-26 124-73t96-109q28 75 28 120z m-890-690q0-48 28-74t75-26q64 0 148 46-68 41-119 103t-77 136q-55-114-55-185z m282 398h406q-3 79-63 132t-140 53q-81 0-140-53t-63-132z" horiz-adv-x="1000" />
234
+
235
+ <glyph glyph-name="television" unicode="&#xf26c;" d="M1000 154v535q0 8-5 13t-13 5h-893q-7 0-12-5t-6-13v-535q0-8 6-13t12-5h893q7 0 13 5t5 13z m71 535v-535q0-37-26-63t-63-27h-411v-71h197q8 0 13-5t5-13v-36q0-8-5-13t-13-5h-464q-8 0-13 5t-5 13v36q0 8 5 13t13 5h196v71h-411q-36 0-63 27t-26 63v535q0 37 26 63t63 27h893q37 0 63-27t26-63z" horiz-adv-x="1142.9" />
236
+
237
+ <glyph glyph-name="percent" unicode="&#xf295;" d="M714 136q0 29-21 50t-50 21-50-21-22-50 22-50 50-22 50 22 21 50z m-428 428q0 29-21 51t-51 21-50-21-21-51 21-50 50-21 51 21 21 50z m571-428q0-89-63-152t-151-63-152 63-62 152 62 151 152 63 151-63 63-151z m-53 607q0-11-8-21l-589-786q-11-15-28-15h-90q-14 0-25 11t-10 25q0 11 7 21l589 786q11 15 29 15h89q14 0 25-11t11-25z m-375-179q0-88-63-151t-152-63-151 63-63 151 63 152 151 63 152-63 63-152z" horiz-adv-x="857.1" />
238
+ </font>
239
+ </defs>
240
  </svg>
css/jquery-ui.min.css CHANGED
@@ -1,7 +1,7 @@
1
- /*! jQuery UI - v1.12.1 - 2020-01-10
2
- * http://jqueryui.com
3
- * Includes: draggable.css, core.css, resizable.css, selectable.css, sortable.css, accordion.css, autocomplete.css, menu.css, button.css, controlgroup.css, checkboxradio.css, datepicker.css, dialog.css, progressbar.css, selectmenu.css, slider.css, spinner.css, tabs.css, tooltip.css, theme.css
4
- * To view and modify this theme, visit http://jqueryui.com/themeroller/?scope=&folderName=base&cornerRadiusShadow=8px&offsetLeftShadow=0px&offsetTopShadow=0px&thicknessShadow=5px&opacityShadow=30&bgImgOpacityShadow=0&bgTextureShadow=flat&bgColorShadow=666666&opacityOverlay=30&bgImgOpacityOverlay=0&bgTextureOverlay=flat&bgColorOverlay=aaaaaa&iconColorError=cc0000&fcError=5f3f3f&borderColorError=f1a899&bgTextureError=flat&bgColorError=fddfdf&iconColorHighlight=777620&fcHighlight=777620&borderColorHighlight=dad55e&bgTextureHighlight=flat&bgColorHighlight=fffa90&iconColorActive=ffffff&fcActive=ffffff&borderColorActive=003eff&bgTextureActive=flat&bgColorActive=007fff&iconColorHover=555555&fcHover=2b2b2b&borderColorHover=cccccc&bgTextureHover=flat&bgColorHover=ededed&iconColorDefault=777777&fcDefault=454545&borderColorDefault=c5c5c5&bgTextureDefault=flat&bgColorDefault=f6f6f6&iconColorContent=444444&fcContent=333333&borderColorContent=dddddd&bgTextureContent=flat&bgColorContent=ffffff&iconColorHeader=444444&fcHeader=333333&borderColorHeader=dddddd&bgTextureHeader=flat&bgColorHeader=e9e9e9&cornerRadius=3px&fwDefault=normal&fsDefault=1em&ffDefault=Arial%2CHelvetica%2Csans-serif
5
- * Copyright jQuery Foundation and other contributors; Licensed MIT */
6
-
7
  .ui-draggable-handle{-ms-touch-action:none;touch-action:none}.ui-helper-hidden{display:none}.ui-helper-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:before,.ui-helper-clearfix:after{content:"";display:table;border-collapse:collapse}.ui-helper-clearfix:after{clear:both}.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-front{z-index:100}.ui-state-disabled{cursor:default!important;pointer-events:none}.ui-icon{display:inline-block;vertical-align:middle;margin-top:-.25em;position:relative;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-icon-block{left:50%;margin-left:-8px;display:block}.ui-widget-overlay{position:fixed;top:0;left:0;width:100%;height:100%}.ui-resizable{position:relative}.ui-resizable-handle{position:absolute;font-size:0.1px;display:block;-ms-touch-action:none;touch-action:none}.ui-resizable-disabled .ui-resizable-handle,.ui-resizable-autohide .ui-resizable-handle{display:none}.ui-resizable-n{cursor:n-resize;height:7px;width:100%;top:-5px;left:0}.ui-resizable-s{cursor:s-resize;height:7px;width:100%;bottom:-5px;left:0}.ui-resizable-e{cursor:e-resize;width:7px;right:-5px;top:0;height:100%}.ui-resizable-w{cursor:w-resize;width:7px;left:-5px;top:0;height:100%}.ui-resizable-se{cursor:se-resize;width:12px;height:12px;right:1px;bottom:1px}.ui-resizable-sw{cursor:sw-resize;width:9px;height:9px;left:-5px;bottom:-5px}.ui-resizable-nw{cursor:nw-resize;width:9px;height:9px;left:-5px;top:-5px}.ui-resizable-ne{cursor:ne-resize;width:9px;height:9px;right:-5px;top:-5px}.ui-selectable{-ms-touch-action:none;touch-action:none}.ui-selectable-helper{position:absolute;z-index:100;border:1px dotted black}.ui-sortable-handle{-ms-touch-action:none;touch-action:none}.ui-accordion .ui-accordion-header{display:block;cursor:pointer;position:relative;margin:2px 0 0 0;padding:.5em .5em .5em .7em;font-size:100%}.ui-accordion .ui-accordion-content{padding:1em 2.2em;border-top:0;overflow:auto}.ui-autocomplete{position:absolute;top:0;left:0;cursor:default}.ui-menu{list-style:none;padding:0;margin:0;display:block;outline:0}.ui-menu .ui-menu{position:absolute}.ui-menu .ui-menu-item{margin:0;cursor:pointer;list-style-image:url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7")}.ui-menu .ui-menu-item-wrapper{position:relative;padding:3px 1em 3px .4em}.ui-menu .ui-menu-divider{margin:5px 0;height:0;font-size:0;line-height:0;border-width:1px 0 0 0}.ui-menu .ui-state-focus,.ui-menu .ui-state-active{margin:-1px}.ui-menu-icons{position:relative}.ui-menu-icons .ui-menu-item-wrapper{padding-left:2em}.ui-menu .ui-icon{position:absolute;top:0;bottom:0;left:.2em;margin:auto 0}.ui-menu .ui-menu-icon{left:auto;right:0}.ui-button{padding:.4em 1em;display:inline-block;position:relative;line-height:normal;margin-right:.1em;cursor:pointer;vertical-align:middle;text-align:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;overflow:visible}.ui-button,.ui-button:link,.ui-button:visited,.ui-button:hover,.ui-button:active{text-decoration:none}.ui-button-icon-only{width:2em;box-sizing:border-box;text-indent:-9999px;white-space:nowrap}input.ui-button.ui-button-icon-only{text-indent:0}.ui-button-icon-only .ui-icon{position:absolute;top:50%;left:50%;margin-top:-8px;margin-left:-8px}.ui-button.ui-icon-notext .ui-icon{padding:0;width:2.1em;height:2.1em;text-indent:-9999px;white-space:nowrap}input.ui-button.ui-icon-notext .ui-icon{width:auto;height:auto;text-indent:0;white-space:normal;padding:.4em 1em}input.ui-button::-moz-focus-inner,button.ui-button::-moz-focus-inner{border:0;padding:0}.ui-controlgroup{vertical-align:middle;display:inline-block}.ui-controlgroup > .ui-controlgroup-item{float:left;margin-left:0;margin-right:0}.ui-controlgroup > .ui-controlgroup-item:focus,.ui-controlgroup > .ui-controlgroup-item.ui-visual-focus{z-index:9999}.ui-controlgroup-vertical > .ui-controlgroup-item{display:block;float:none;width:100%;margin-top:0;margin-bottom:0;text-align:left}.ui-controlgroup-vertical .ui-controlgroup-item{box-sizing:border-box}.ui-controlgroup .ui-controlgroup-label{padding:.4em 1em}.ui-controlgroup .ui-controlgroup-label span{font-size:80%}.ui-controlgroup-horizontal .ui-controlgroup-label + .ui-controlgroup-item{border-left:none}.ui-controlgroup-vertical .ui-controlgroup-label + .ui-controlgroup-item{border-top:none}.ui-controlgroup-horizontal .ui-controlgroup-label.ui-widget-content{border-right:none}.ui-controlgroup-vertical .ui-controlgroup-label.ui-widget-content{border-bottom:none}.ui-controlgroup-vertical .ui-spinner-input{width:75%;width:calc( 100% - 2.4em )}.ui-controlgroup-vertical .ui-spinner .ui-spinner-up{border-top-style:solid}.ui-checkboxradio-label .ui-icon-background{box-shadow:inset 1px 1px 1px #ccc;border-radius:.12em;border:none}.ui-checkboxradio-radio-label .ui-icon-background{width:16px;height:16px;border-radius:1em;overflow:visible;border:none}.ui-checkboxradio-radio-label.ui-checkboxradio-checked .ui-icon,.ui-checkboxradio-radio-label.ui-checkboxradio-checked:hover .ui-icon{background-image:none;width:8px;height:8px;border-width:4px;border-style:solid}.ui-checkboxradio-disabled{pointer-events:none}.ui-datepicker{width:17em;padding:.2em .2em 0;display:none}.ui-datepicker .ui-datepicker-header{position:relative;padding:.2em 0}.ui-datepicker .ui-datepicker-prev,.ui-datepicker .ui-datepicker-next{position:absolute;top:2px;width:1.8em;height:1.8em}.ui-datepicker .ui-datepicker-prev-hover,.ui-datepicker .ui-datepicker-next-hover{top:1px}.ui-datepicker .ui-datepicker-prev{left:2px}.ui-datepicker .ui-datepicker-next{right:2px}.ui-datepicker .ui-datepicker-prev-hover{left:1px}.ui-datepicker .ui-datepicker-next-hover{right:1px}.ui-datepicker .ui-datepicker-prev span,.ui-datepicker .ui-datepicker-next span{display:block;position:absolute;left:50%;margin-left:-8px;top:50%;margin-top:-8px}.ui-datepicker .ui-datepicker-title{margin:0 2.3em;line-height:1.8em;text-align:center}.ui-datepicker .ui-datepicker-title select{font-size:1em;margin:1px 0}.ui-datepicker select.ui-datepicker-month,.ui-datepicker select.ui-datepicker-year{width:45%}.ui-datepicker table{width:100%;font-size:.9em;border-collapse:collapse;margin:0 0 .4em}.ui-datepicker th{padding:.7em .3em;text-align:center;font-weight:bold;border:0}.ui-datepicker td{border:0;padding:1px}.ui-datepicker td span,.ui-datepicker td a{display:block;padding:.2em;text-align:right;text-decoration:none}.ui-datepicker .ui-datepicker-buttonpane{background-image:none;margin:.7em 0 0 0;padding:0 .2em;border-left:0;border-right:0;border-bottom:0}.ui-datepicker .ui-datepicker-buttonpane button{float:right;margin:.5em .2em .4em;cursor:pointer;padding:.2em .6em .3em .6em;width:auto;overflow:visible}.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current{float:left}.ui-datepicker.ui-datepicker-multi{width:auto}.ui-datepicker-multi .ui-datepicker-group{float:left}.ui-datepicker-multi .ui-datepicker-group table{width:95%;margin:0 auto .4em}.ui-datepicker-multi-2 .ui-datepicker-group{width:50%}.ui-datepicker-multi-3 .ui-datepicker-group{width:33.3%}.ui-datepicker-multi-4 .ui-datepicker-group{width:25%}.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header{border-left-width:0}.ui-datepicker-multi .ui-datepicker-buttonpane{clear:left}.ui-datepicker-row-break{clear:both;width:100%;font-size:0}.ui-datepicker-rtl{direction:rtl}.ui-datepicker-rtl .ui-datepicker-prev{right:2px;left:auto}.ui-datepicker-rtl .ui-datepicker-next{left:2px;right:auto}.ui-datepicker-rtl .ui-datepicker-prev:hover{right:1px;left:auto}.ui-datepicker-rtl .ui-datepicker-next:hover{left:1px;right:auto}.ui-datepicker-rtl .ui-datepicker-buttonpane{clear:right}.ui-datepicker-rtl .ui-datepicker-buttonpane button{float:left}.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current,.ui-datepicker-rtl .ui-datepicker-group{float:right}.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header{border-right-width:0;border-left-width:1px}.ui-datepicker .ui-icon{display:block;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat;left:.5em;top:.3em}.ui-dialog{position:absolute;top:0;left:0;padding:.2em;outline:0}.ui-dialog .ui-dialog-titlebar{padding:.4em 1em;position:relative}.ui-dialog .ui-dialog-title{float:left;margin:.1em 0;white-space:nowrap;width:90%;overflow:hidden;text-overflow:ellipsis}.ui-dialog .ui-dialog-titlebar-close{position:absolute;right:.3em;top:50%;width:20px;margin:-10px 0 0 0;padding:1px;height:20px}.ui-dialog .ui-dialog-content{position:relative;border:0;padding:.5em 1em;background:none;overflow:auto}.ui-dialog .ui-dialog-buttonpane{text-align:left;border-width:1px 0 0 0;background-image:none;margin-top:.5em;padding:.3em 1em .5em .4em}.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset{float:right}.ui-dialog .ui-dialog-buttonpane button{margin:.5em .4em .5em 0;cursor:pointer}.ui-dialog .ui-resizable-n{height:2px;top:0}.ui-dialog .ui-resizable-e{width:2px;right:0}.ui-dialog .ui-resizable-s{height:2px;bottom:0}.ui-dialog .ui-resizable-w{width:2px;left:0}.ui-dialog .ui-resizable-se,.ui-dialog .ui-resizable-sw,.ui-dialog .ui-resizable-ne,.ui-dialog .ui-resizable-nw{width:7px;height:7px}.ui-dialog .ui-resizable-se{right:0;bottom:0}.ui-dialog .ui-resizable-sw{left:0;bottom:0}.ui-dialog .ui-resizable-ne{right:0;top:0}.ui-dialog .ui-resizable-nw{left:0;top:0}.ui-draggable .ui-dialog-titlebar{cursor:move}.ui-progressbar{height:2em;text-align:left;overflow:hidden}.ui-progressbar .ui-progressbar-value{margin:-1px;height:100%}.ui-progressbar .ui-progressbar-overlay{background:url("data:image/gif;base64,R0lGODlhKAAoAIABAAAAAP///yH/C05FVFNDQVBFMi4wAwEAAAAh+QQJAQABACwAAAAAKAAoAAACkYwNqXrdC52DS06a7MFZI+4FHBCKoDeWKXqymPqGqxvJrXZbMx7Ttc+w9XgU2FB3lOyQRWET2IFGiU9m1frDVpxZZc6bfHwv4c1YXP6k1Vdy292Fb6UkuvFtXpvWSzA+HycXJHUXiGYIiMg2R6W459gnWGfHNdjIqDWVqemH2ekpObkpOlppWUqZiqr6edqqWQAAIfkECQEAAQAsAAAAACgAKAAAApSMgZnGfaqcg1E2uuzDmmHUBR8Qil95hiPKqWn3aqtLsS18y7G1SzNeowWBENtQd+T1JktP05nzPTdJZlR6vUxNWWjV+vUWhWNkWFwxl9VpZRedYcflIOLafaa28XdsH/ynlcc1uPVDZxQIR0K25+cICCmoqCe5mGhZOfeYSUh5yJcJyrkZWWpaR8doJ2o4NYq62lAAACH5BAkBAAEALAAAAAAoACgAAAKVDI4Yy22ZnINRNqosw0Bv7i1gyHUkFj7oSaWlu3ovC8GxNso5fluz3qLVhBVeT/Lz7ZTHyxL5dDalQWPVOsQWtRnuwXaFTj9jVVh8pma9JjZ4zYSj5ZOyma7uuolffh+IR5aW97cHuBUXKGKXlKjn+DiHWMcYJah4N0lYCMlJOXipGRr5qdgoSTrqWSq6WFl2ypoaUAAAIfkECQEAAQAsAAAAACgAKAAAApaEb6HLgd/iO7FNWtcFWe+ufODGjRfoiJ2akShbueb0wtI50zm02pbvwfWEMWBQ1zKGlLIhskiEPm9R6vRXxV4ZzWT2yHOGpWMyorblKlNp8HmHEb/lCXjcW7bmtXP8Xt229OVWR1fod2eWqNfHuMjXCPkIGNileOiImVmCOEmoSfn3yXlJWmoHGhqp6ilYuWYpmTqKUgAAIfkECQEAAQAsAAAAACgAKAAAApiEH6kb58biQ3FNWtMFWW3eNVcojuFGfqnZqSebuS06w5V80/X02pKe8zFwP6EFWOT1lDFk8rGERh1TTNOocQ61Hm4Xm2VexUHpzjymViHrFbiELsefVrn6XKfnt2Q9G/+Xdie499XHd2g4h7ioOGhXGJboGAnXSBnoBwKYyfioubZJ2Hn0RuRZaflZOil56Zp6iioKSXpUAAAh+QQJAQABACwAAAAAKAAoAAACkoQRqRvnxuI7kU1a1UU5bd5tnSeOZXhmn5lWK3qNTWvRdQxP8qvaC+/yaYQzXO7BMvaUEmJRd3TsiMAgswmNYrSgZdYrTX6tSHGZO73ezuAw2uxuQ+BbeZfMxsexY35+/Qe4J1inV0g4x3WHuMhIl2jXOKT2Q+VU5fgoSUI52VfZyfkJGkha6jmY+aaYdirq+lQAACH5BAkBAAEALAAAAAAoACgAAAKWBIKpYe0L3YNKToqswUlvznigd4wiR4KhZrKt9Upqip61i9E3vMvxRdHlbEFiEXfk9YARYxOZZD6VQ2pUunBmtRXo1Lf8hMVVcNl8JafV38aM2/Fu5V16Bn63r6xt97j09+MXSFi4BniGFae3hzbH9+hYBzkpuUh5aZmHuanZOZgIuvbGiNeomCnaxxap2upaCZsq+1kAACH5BAkBAAEALAAAAAAoACgAAAKXjI8By5zf4kOxTVrXNVlv1X0d8IGZGKLnNpYtm8Lr9cqVeuOSvfOW79D9aDHizNhDJidFZhNydEahOaDH6nomtJjp1tutKoNWkvA6JqfRVLHU/QUfau9l2x7G54d1fl995xcIGAdXqMfBNadoYrhH+Mg2KBlpVpbluCiXmMnZ2Sh4GBqJ+ckIOqqJ6LmKSllZmsoq6wpQAAAh+QQJAQABACwAAAAAKAAoAAAClYx/oLvoxuJDkU1a1YUZbJ59nSd2ZXhWqbRa2/gF8Gu2DY3iqs7yrq+xBYEkYvFSM8aSSObE+ZgRl1BHFZNr7pRCavZ5BW2142hY3AN/zWtsmf12p9XxxFl2lpLn1rseztfXZjdIWIf2s5dItwjYKBgo9yg5pHgzJXTEeGlZuenpyPmpGQoKOWkYmSpaSnqKileI2FAAACH5BAkBAAEALAAAAAAoACgAAAKVjB+gu+jG4kORTVrVhRlsnn2dJ3ZleFaptFrb+CXmO9OozeL5VfP99HvAWhpiUdcwkpBH3825AwYdU8xTqlLGhtCosArKMpvfa1mMRae9VvWZfeB2XfPkeLmm18lUcBj+p5dnN8jXZ3YIGEhYuOUn45aoCDkp16hl5IjYJvjWKcnoGQpqyPlpOhr3aElaqrq56Bq7VAAAOw==");height:100%;filter:alpha(opacity=25);opacity:0.25}.ui-progressbar-indeterminate .ui-progressbar-value{background-image:none}.ui-selectmenu-menu{padding:0;margin:0;position:absolute;top:0;left:0;display:none}.ui-selectmenu-menu .ui-menu{overflow:auto;overflow-x:hidden;padding-bottom:1px}.ui-selectmenu-menu .ui-menu .ui-selectmenu-optgroup{font-size:1em;font-weight:bold;line-height:1.5;padding:2px 0.4em;margin:0.5em 0 0 0;height:auto;border:0}.ui-selectmenu-open{display:block}.ui-selectmenu-text{display:block;margin-right:20px;overflow:hidden;text-overflow:ellipsis}.ui-selectmenu-button.ui-button{text-align:left;white-space:nowrap;width:14em}.ui-selectmenu-icon.ui-icon{float:right;margin-top:0}.ui-slider{position:relative;text-align:left}.ui-slider .ui-slider-handle{position:absolute;z-index:2;width:1.2em;height:1.2em;cursor:default;-ms-touch-action:none;touch-action:none}.ui-slider .ui-slider-range{position:absolute;z-index:1;font-size:.7em;display:block;border:0;background-position:0 0}.ui-slider.ui-state-disabled .ui-slider-handle,.ui-slider.ui-state-disabled .ui-slider-range{filter:inherit}.ui-slider-horizontal{height:.8em}.ui-slider-horizontal .ui-slider-handle{top:-.3em;margin-left:-.6em}.ui-slider-horizontal .ui-slider-range{top:0;height:100%}.ui-slider-horizontal .ui-slider-range-min{left:0}.ui-slider-horizontal .ui-slider-range-max{right:0}.ui-slider-vertical{width:.8em;height:100px}.ui-slider-vertical .ui-slider-handle{left:-.3em;margin-left:0;margin-bottom:-.6em}.ui-slider-vertical .ui-slider-range{left:0;width:100%}.ui-slider-vertical .ui-slider-range-min{bottom:0}.ui-slider-vertical .ui-slider-range-max{top:0}.ui-spinner{position:relative;display:inline-block;overflow:hidden;padding:0;vertical-align:middle}.ui-spinner-input{border:none;background:none;color:inherit;padding:.222em 0;margin:.2em 0;vertical-align:middle;margin-left:.4em;margin-right:2em}.ui-spinner-button{width:1.6em;height:50%;font-size:.5em;padding:0;margin:0;text-align:center;position:absolute;cursor:default;display:block;overflow:hidden;right:0}.ui-spinner a.ui-spinner-button{border-top-style:none;border-bottom-style:none;border-right-style:none}.ui-spinner-up{top:0}.ui-spinner-down{bottom:0}.ui-tabs{position:relative;padding:.2em}.ui-tabs .ui-tabs-nav{margin:0;padding:.2em .2em 0}.ui-tabs .ui-tabs-nav li{list-style:none;float:left;position:relative;top:0;margin:1px .2em 0 0;border-bottom-width:0;padding:0;white-space:nowrap}.ui-tabs .ui-tabs-nav .ui-tabs-anchor{float:left;padding:.5em 1em;text-decoration:none}.ui-tabs .ui-tabs-nav li.ui-tabs-active{margin-bottom:-1px;padding-bottom:1px}.ui-tabs .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor,.ui-tabs .ui-tabs-nav li.ui-state-disabled .ui-tabs-anchor,.ui-tabs .ui-tabs-nav li.ui-tabs-loading .ui-tabs-anchor{cursor:text}.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor{cursor:pointer}.ui-tabs .ui-tabs-panel{display:block;border-width:0;padding:1em 1.4em;background:none}.ui-tooltip{padding:8px;position:absolute;z-index:9999;max-width:300px}body .ui-tooltip{border-width:2px}.ui-widget{font-family:Arial,Helvetica,sans-serif;font-size:1em}.ui-widget .ui-widget{font-size:1em}.ui-widget input,.ui-widget select,.ui-widget textarea,.ui-widget button{font-family:Arial,Helvetica,sans-serif;font-size:1em}.ui-widget.ui-widget-content{border:1px solid #c5c5c5}.ui-widget-content{border:1px solid #ddd;background:#fff;color:#333}.ui-widget-content a{color:#333}.ui-widget-header{border:1px solid #ddd;background:#e9e9e9;color:#333;font-weight:bold}.ui-widget-header a{color:#333}.ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default,.ui-button,html .ui-button.ui-state-disabled:hover,html .ui-button.ui-state-disabled:active{border:1px solid #c5c5c5;background:#f6f6f6;font-weight:normal;color:#454545}.ui-state-default a,.ui-state-default a:link,.ui-state-default a:visited,a.ui-button,a:link.ui-button,a:visited.ui-button,.ui-button{color:#454545;text-decoration:none}.ui-state-hover,.ui-widget-content .ui-state-hover,.ui-widget-header .ui-state-hover,.ui-state-focus,.ui-widget-content .ui-state-focus,.ui-widget-header .ui-state-focus,.ui-button:hover,.ui-button:focus{border:1px solid #ccc;background:#ededed;font-weight:normal;color:#2b2b2b}.ui-state-hover a,.ui-state-hover a:hover,.ui-state-hover a:link,.ui-state-hover a:visited,.ui-state-focus a,.ui-state-focus a:hover,.ui-state-focus a:link,.ui-state-focus a:visited,a.ui-button:hover,a.ui-button:focus{color:#2b2b2b;text-decoration:none}.ui-visual-focus{box-shadow:0 0 3px 1px rgb(94,158,214)}.ui-state-active,.ui-widget-content .ui-state-active,.ui-widget-header .ui-state-active,a.ui-button:active,.ui-button:active,.ui-button.ui-state-active:hover{border:1px solid #003eff;background:#007fff;font-weight:normal;color:#fff}.ui-icon-background,.ui-state-active .ui-icon-background{border:#003eff;background-color:#fff}.ui-state-active a,.ui-state-active a:link,.ui-state-active a:visited{color:#fff;text-decoration:none}.ui-state-highlight,.ui-widget-content .ui-state-highlight,.ui-widget-header .ui-state-highlight{border:1px solid #dad55e;background:#fffa90;color:#777620}.ui-state-checked{border:1px solid #dad55e;background:#fffa90}.ui-state-highlight a,.ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a{color:#777620}.ui-state-error,.ui-widget-content .ui-state-error,.ui-widget-header .ui-state-error{border:1px solid #f1a899;background:#fddfdf;color:#5f3f3f}.ui-state-error a,.ui-widget-content .ui-state-error a,.ui-widget-header .ui-state-error a{color:#5f3f3f}.ui-state-error-text,.ui-widget-content .ui-state-error-text,.ui-widget-header .ui-state-error-text{color:#5f3f3f}.ui-priority-primary,.ui-widget-content .ui-priority-primary,.ui-widget-header .ui-priority-primary{font-weight:bold}.ui-priority-secondary,.ui-widget-content .ui-priority-secondary,.ui-widget-header .ui-priority-secondary{opacity:.7;filter:Alpha(Opacity=70);font-weight:normal}.ui-state-disabled,.ui-widget-content .ui-state-disabled,.ui-widget-header .ui-state-disabled{opacity:.35;filter:Alpha(Opacity=35);background-image:none}.ui-state-disabled .ui-icon{filter:Alpha(Opacity=35)}.ui-icon{width:16px;height:16px}.ui-icon,.ui-widget-content .ui-icon{background-image:url("images/ui-icons_444444_256x240.png")}.ui-widget-header .ui-icon{background-image:url("images/ui-icons_444444_256x240.png")}.ui-state-hover .ui-icon,.ui-state-focus .ui-icon,.ui-button:hover .ui-icon,.ui-button:focus .ui-icon{background-image:url("images/ui-icons_555555_256x240.png")}.ui-state-active .ui-icon,.ui-button:active .ui-icon{background-image:url("images/ui-icons_ffffff_256x240.png")}.ui-state-highlight .ui-icon,.ui-button .ui-state-highlight.ui-icon{background-image:url("images/ui-icons_777620_256x240.png")}.ui-state-error .ui-icon,.ui-state-error-text .ui-icon{background-image:url("images/ui-icons_cc0000_256x240.png")}.ui-button .ui-icon{background-image:url("images/ui-icons_777777_256x240.png")}.ui-icon-blank{background-position:16px 16px}.ui-icon-caret-1-n{background-position:0 0}.ui-icon-caret-1-ne{background-position:-16px 0}.ui-icon-caret-1-e{background-position:-32px 0}.ui-icon-caret-1-se{background-position:-48px 0}.ui-icon-caret-1-s{background-position:-65px 0}.ui-icon-caret-1-sw{background-position:-80px 0}.ui-icon-caret-1-w{background-position:-96px 0}.ui-icon-caret-1-nw{background-position:-112px 0}.ui-icon-caret-2-n-s{background-position:-128px 0}.ui-icon-caret-2-e-w{background-position:-144px 0}.ui-icon-triangle-1-n{background-position:0 -16px}.ui-icon-triangle-1-ne{background-position:-16px -16px}.ui-icon-triangle-1-e{background-position:-32px -16px}.ui-icon-triangle-1-se{background-position:-48px -16px}.ui-icon-triangle-1-s{background-position:-65px -16px}.ui-icon-triangle-1-sw{background-position:-80px -16px}.ui-icon-triangle-1-w{background-position:-96px -16px}.ui-icon-triangle-1-nw{background-position:-112px -16px}.ui-icon-triangle-2-n-s{background-position:-128px -16px}.ui-icon-triangle-2-e-w{background-position:-144px -16px}.ui-icon-arrow-1-n{background-position:0 -32px}.ui-icon-arrow-1-ne{background-position:-16px -32px}.ui-icon-arrow-1-e{background-position:-32px -32px}.ui-icon-arrow-1-se{background-position:-48px -32px}.ui-icon-arrow-1-s{background-position:-65px -32px}.ui-icon-arrow-1-sw{background-position:-80px -32px}.ui-icon-arrow-1-w{background-position:-96px -32px}.ui-icon-arrow-1-nw{background-position:-112px -32px}.ui-icon-arrow-2-n-s{background-position:-128px -32px}.ui-icon-arrow-2-ne-sw{background-position:-144px -32px}.ui-icon-arrow-2-e-w{background-position:-160px -32px}.ui-icon-arrow-2-se-nw{background-position:-176px -32px}.ui-icon-arrowstop-1-n{background-position:-192px -32px}.ui-icon-arrowstop-1-e{background-position:-208px -32px}.ui-icon-arrowstop-1-s{background-position:-224px -32px}.ui-icon-arrowstop-1-w{background-position:-240px -32px}.ui-icon-arrowthick-1-n{background-position:1px -48px}.ui-icon-arrowthick-1-ne{background-position:-16px -48px}.ui-icon-arrowthick-1-e{background-position:-32px -48px}.ui-icon-arrowthick-1-se{background-position:-48px -48px}.ui-icon-arrowthick-1-s{background-position:-64px -48px}.ui-icon-arrowthick-1-sw{background-position:-80px -48px}.ui-icon-arrowthick-1-w{background-position:-96px -48px}.ui-icon-arrowthick-1-nw{background-position:-112px -48px}.ui-icon-arrowthick-2-n-s{background-position:-128px -48px}.ui-icon-arrowthick-2-ne-sw{background-position:-144px -48px}.ui-icon-arrowthick-2-e-w{background-position:-160px -48px}.ui-icon-arrowthick-2-se-nw{background-position:-176px -48px}.ui-icon-arrowthickstop-1-n{background-position:-192px -48px}.ui-icon-arrowthickstop-1-e{background-position:-208px -48px}.ui-icon-arrowthickstop-1-s{background-position:-224px -48px}.ui-icon-arrowthickstop-1-w{background-position:-240px -48px}.ui-icon-arrowreturnthick-1-w{background-position:0 -64px}.ui-icon-arrowreturnthick-1-n{background-position:-16px -64px}.ui-icon-arrowreturnthick-1-e{background-position:-32px -64px}.ui-icon-arrowreturnthick-1-s{background-position:-48px -64px}.ui-icon-arrowreturn-1-w{background-position:-64px -64px}.ui-icon-arrowreturn-1-n{background-position:-80px -64px}.ui-icon-arrowreturn-1-e{background-position:-96px -64px}.ui-icon-arrowreturn-1-s{background-position:-112px -64px}.ui-icon-arrowrefresh-1-w{background-position:-128px -64px}.ui-icon-arrowrefresh-1-n{background-position:-144px -64px}.ui-icon-arrowrefresh-1-e{background-position:-160px -64px}.ui-icon-arrowrefresh-1-s{background-position:-176px -64px}.ui-icon-arrow-4{background-position:0 -80px}.ui-icon-arrow-4-diag{background-position:-16px -80px}.ui-icon-extlink{background-position:-32px -80px}.ui-icon-newwin{background-position:-48px -80px}.ui-icon-refresh{background-position:-64px -80px}.ui-icon-shuffle{background-position:-80px -80px}.ui-icon-transfer-e-w{background-position:-96px -80px}.ui-icon-transferthick-e-w{background-position:-112px -80px}.ui-icon-folder-collapsed{background-position:0 -96px}.ui-icon-folder-open{background-position:-16px -96px}.ui-icon-document{background-position:-32px -96px}.ui-icon-document-b{background-position:-48px -96px}.ui-icon-note{background-position:-64px -96px}.ui-icon-mail-closed{background-position:-80px -96px}.ui-icon-mail-open{background-position:-96px -96px}.ui-icon-suitcase{background-position:-112px -96px}.ui-icon-comment{background-position:-128px -96px}.ui-icon-person{background-position:-144px -96px}.ui-icon-print{background-position:-160px -96px}.ui-icon-trash{background-position:-176px -96px}.ui-icon-locked{background-position:-192px -96px}.ui-icon-unlocked{background-position:-208px -96px}.ui-icon-bookmark{background-position:-224px -96px}.ui-icon-tag{background-position:-240px -96px}.ui-icon-home{background-position:0 -112px}.ui-icon-flag{background-position:-16px -112px}.ui-icon-calendar{background-position:-32px -112px}.ui-icon-cart{background-position:-48px -112px}.ui-icon-pencil{background-position:-64px -112px}.ui-icon-clock{background-position:-80px -112px}.ui-icon-disk{background-position:-96px -112px}.ui-icon-calculator{background-position:-112px -112px}.ui-icon-zoomin{background-position:-128px -112px}.ui-icon-zoomout{background-position:-144px -112px}.ui-icon-search{background-position:-160px -112px}.ui-icon-wrench{background-position:-176px -112px}.ui-icon-gear{background-position:-192px -112px}.ui-icon-heart{background-position:-208px -112px}.ui-icon-star{background-position:-224px -112px}.ui-icon-link{background-position:-240px -112px}.ui-icon-cancel{background-position:0 -128px}.ui-icon-plus{background-position:-16px -128px}.ui-icon-plusthick{background-position:-32px -128px}.ui-icon-minus{background-position:-48px -128px}.ui-icon-minusthick{background-position:-64px -128px}.ui-icon-close{background-position:-80px -128px}.ui-icon-closethick{background-position:-96px -128px}.ui-icon-key{background-position:-112px -128px}.ui-icon-lightbulb{background-position:-128px -128px}.ui-icon-scissors{background-position:-144px -128px}.ui-icon-clipboard{background-position:-160px -128px}.ui-icon-copy{background-position:-176px -128px}.ui-icon-contact{background-position:-192px -128px}.ui-icon-image{background-position:-208px -128px}.ui-icon-video{background-position:-224px -128px}.ui-icon-script{background-position:-240px -128px}.ui-icon-alert{background-position:0 -144px}.ui-icon-info{background-position:-16px -144px}.ui-icon-notice{background-position:-32px -144px}.ui-icon-help{background-position:-48px -144px}.ui-icon-check{background-position:-64px -144px}.ui-icon-bullet{background-position:-80px -144px}.ui-icon-radio-on{background-position:-96px -144px}.ui-icon-radio-off{background-position:-112px -144px}.ui-icon-pin-w{background-position:-128px -144px}.ui-icon-pin-s{background-position:-144px -144px}.ui-icon-play{background-position:0 -160px}.ui-icon-pause{background-position:-16px -160px}.ui-icon-seek-next{background-position:-32px -160px}.ui-icon-seek-prev{background-position:-48px -160px}.ui-icon-seek-end{background-position:-64px -160px}.ui-icon-seek-start{background-position:-80px -160px}.ui-icon-seek-first{background-position:-80px -160px}.ui-icon-stop{background-position:-96px -160px}.ui-icon-eject{background-position:-112px -160px}.ui-icon-volume-off{background-position:-128px -160px}.ui-icon-volume-on{background-position:-144px -160px}.ui-icon-power{background-position:0 -176px}.ui-icon-signal-diag{background-position:-16px -176px}.ui-icon-signal{background-position:-32px -176px}.ui-icon-battery-0{background-position:-48px -176px}.ui-icon-battery-1{background-position:-64px -176px}.ui-icon-battery-2{background-position:-80px -176px}.ui-icon-battery-3{background-position:-96px -176px}.ui-icon-circle-plus{background-position:0 -192px}.ui-icon-circle-minus{background-position:-16px -192px}.ui-icon-circle-close{background-position:-32px -192px}.ui-icon-circle-triangle-e{background-position:-48px -192px}.ui-icon-circle-triangle-s{background-position:-64px -192px}.ui-icon-circle-triangle-w{background-position:-80px -192px}.ui-icon-circle-triangle-n{background-position:-96px -192px}.ui-icon-circle-arrow-e{background-position:-112px -192px}.ui-icon-circle-arrow-s{background-position:-128px -192px}.ui-icon-circle-arrow-w{background-position:-144px -192px}.ui-icon-circle-arrow-n{background-position:-160px -192px}.ui-icon-circle-zoomin{background-position:-176px -192px}.ui-icon-circle-zoomout{background-position:-192px -192px}.ui-icon-circle-check{background-position:-208px -192px}.ui-icon-circlesmall-plus{background-position:0 -208px}.ui-icon-circlesmall-minus{background-position:-16px -208px}.ui-icon-circlesmall-close{background-position:-32px -208px}.ui-icon-squaresmall-plus{background-position:-48px -208px}.ui-icon-squaresmall-minus{background-position:-64px -208px}.ui-icon-squaresmall-close{background-position:-80px -208px}.ui-icon-grip-dotted-vertical{background-position:0 -224px}.ui-icon-grip-dotted-horizontal{background-position:-16px -224px}.ui-icon-grip-solid-vertical{background-position:-32px -224px}.ui-icon-grip-solid-horizontal{background-position:-48px -224px}.ui-icon-gripsmall-diagonal-se{background-position:-64px -224px}.ui-icon-grip-diagonal-se{background-position:-80px -224px}.ui-corner-all,.ui-corner-top,.ui-corner-left,.ui-corner-tl{border-top-left-radius:3px}.ui-corner-all,.ui-corner-top,.ui-corner-right,.ui-corner-tr{border-top-right-radius:3px}.ui-corner-all,.ui-corner-bottom,.ui-corner-left,.ui-corner-bl{border-bottom-left-radius:3px}.ui-corner-all,.ui-corner-bottom,.ui-corner-right,.ui-corner-br{border-bottom-right-radius:3px}.ui-widget-overlay{background:#aaa;opacity:.3;filter:Alpha(Opacity=30)}.ui-widget-shadow{-webkit-box-shadow:0 0 5px #666;box-shadow:0 0 5px #666}
1
+ /*! jQuery UI - v1.12.1 - 2020-01-10
2
+ * http://jqueryui.com
3
+ * Includes: draggable.css, core.css, resizable.css, selectable.css, sortable.css, accordion.css, autocomplete.css, menu.css, button.css, controlgroup.css, checkboxradio.css, datepicker.css, dialog.css, progressbar.css, selectmenu.css, slider.css, spinner.css, tabs.css, tooltip.css, theme.css
4
+ * To view and modify this theme, visit http://jqueryui.com/themeroller/?scope=&folderName=base&cornerRadiusShadow=8px&offsetLeftShadow=0px&offsetTopShadow=0px&thicknessShadow=5px&opacityShadow=30&bgImgOpacityShadow=0&bgTextureShadow=flat&bgColorShadow=666666&opacityOverlay=30&bgImgOpacityOverlay=0&bgTextureOverlay=flat&bgColorOverlay=aaaaaa&iconColorError=cc0000&fcError=5f3f3f&borderColorError=f1a899&bgTextureError=flat&bgColorError=fddfdf&iconColorHighlight=777620&fcHighlight=777620&borderColorHighlight=dad55e&bgTextureHighlight=flat&bgColorHighlight=fffa90&iconColorActive=ffffff&fcActive=ffffff&borderColorActive=003eff&bgTextureActive=flat&bgColorActive=007fff&iconColorHover=555555&fcHover=2b2b2b&borderColorHover=cccccc&bgTextureHover=flat&bgColorHover=ededed&iconColorDefault=777777&fcDefault=454545&borderColorDefault=c5c5c5&bgTextureDefault=flat&bgColorDefault=f6f6f6&iconColorContent=444444&fcContent=333333&borderColorContent=dddddd&bgTextureContent=flat&bgColorContent=ffffff&iconColorHeader=444444&fcHeader=333333&borderColorHeader=dddddd&bgTextureHeader=flat&bgColorHeader=e9e9e9&cornerRadius=3px&fwDefault=normal&fsDefault=1em&ffDefault=Arial%2CHelvetica%2Csans-serif
5
+ * Copyright jQuery Foundation and other contributors; Licensed MIT */
6
+
7
  .ui-draggable-handle{-ms-touch-action:none;touch-action:none}.ui-helper-hidden{display:none}.ui-helper-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:before,.ui-helper-clearfix:after{content:"";display:table;border-collapse:collapse}.ui-helper-clearfix:after{clear:both}.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-front{z-index:100}.ui-state-disabled{cursor:default!important;pointer-events:none}.ui-icon{display:inline-block;vertical-align:middle;margin-top:-.25em;position:relative;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-icon-block{left:50%;margin-left:-8px;display:block}.ui-widget-overlay{position:fixed;top:0;left:0;width:100%;height:100%}.ui-resizable{position:relative}.ui-resizable-handle{position:absolute;font-size:0.1px;display:block;-ms-touch-action:none;touch-action:none}.ui-resizable-disabled .ui-resizable-handle,.ui-resizable-autohide .ui-resizable-handle{display:none}.ui-resizable-n{cursor:n-resize;height:7px;width:100%;top:-5px;left:0}.ui-resizable-s{cursor:s-resize;height:7px;width:100%;bottom:-5px;left:0}.ui-resizable-e{cursor:e-resize;width:7px;right:-5px;top:0;height:100%}.ui-resizable-w{cursor:w-resize;width:7px;left:-5px;top:0;height:100%}.ui-resizable-se{cursor:se-resize;width:12px;height:12px;right:1px;bottom:1px}.ui-resizable-sw{cursor:sw-resize;width:9px;height:9px;left:-5px;bottom:-5px}.ui-resizable-nw{cursor:nw-resize;width:9px;height:9px;left:-5px;top:-5px}.ui-resizable-ne{cursor:ne-resize;width:9px;height:9px;right:-5px;top:-5px}.ui-selectable{-ms-touch-action:none;touch-action:none}.ui-selectable-helper{position:absolute;z-index:100;border:1px dotted black}.ui-sortable-handle{-ms-touch-action:none;touch-action:none}.ui-accordion .ui-accordion-header{display:block;cursor:pointer;position:relative;margin:2px 0 0 0;padding:.5em .5em .5em .7em;font-size:100%}.ui-accordion .ui-accordion-content{padding:1em 2.2em;border-top:0;overflow:auto}.ui-autocomplete{position:absolute;top:0;left:0;cursor:default}.ui-menu{list-style:none;padding:0;margin:0;display:block;outline:0}.ui-menu .ui-menu{position:absolute}.ui-menu .ui-menu-item{margin:0;cursor:pointer;list-style-image:url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7")}.ui-menu .ui-menu-item-wrapper{position:relative;padding:3px 1em 3px .4em}.ui-menu .ui-menu-divider{margin:5px 0;height:0;font-size:0;line-height:0;border-width:1px 0 0 0}.ui-menu .ui-state-focus,.ui-menu .ui-state-active{margin:-1px}.ui-menu-icons{position:relative}.ui-menu-icons .ui-menu-item-wrapper{padding-left:2em}.ui-menu .ui-icon{position:absolute;top:0;bottom:0;left:.2em;margin:auto 0}.ui-menu .ui-menu-icon{left:auto;right:0}.ui-button{padding:.4em 1em;display:inline-block;position:relative;line-height:normal;margin-right:.1em;cursor:pointer;vertical-align:middle;text-align:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;overflow:visible}.ui-button,.ui-button:link,.ui-button:visited,.ui-button:hover,.ui-button:active{text-decoration:none}.ui-button-icon-only{width:2em;box-sizing:border-box;text-indent:-9999px;white-space:nowrap}input.ui-button.ui-button-icon-only{text-indent:0}.ui-button-icon-only .ui-icon{position:absolute;top:50%;left:50%;margin-top:-8px;margin-left:-8px}.ui-button.ui-icon-notext .ui-icon{padding:0;width:2.1em;height:2.1em;text-indent:-9999px;white-space:nowrap}input.ui-button.ui-icon-notext .ui-icon{width:auto;height:auto;text-indent:0;white-space:normal;padding:.4em 1em}input.ui-button::-moz-focus-inner,button.ui-button::-moz-focus-inner{border:0;padding:0}.ui-controlgroup{vertical-align:middle;display:inline-block}.ui-controlgroup > .ui-controlgroup-item{float:left;margin-left:0;margin-right:0}.ui-controlgroup > .ui-controlgroup-item:focus,.ui-controlgroup > .ui-controlgroup-item.ui-visual-focus{z-index:9999}.ui-controlgroup-vertical > .ui-controlgroup-item{display:block;float:none;width:100%;margin-top:0;margin-bottom:0;text-align:left}.ui-controlgroup-vertical .ui-controlgroup-item{box-sizing:border-box}.ui-controlgroup .ui-controlgroup-label{padding:.4em 1em}.ui-controlgroup .ui-controlgroup-label span{font-size:80%}.ui-controlgroup-horizontal .ui-controlgroup-label + .ui-controlgroup-item{border-left:none}.ui-controlgroup-vertical .ui-controlgroup-label + .ui-controlgroup-item{border-top:none}.ui-controlgroup-horizontal .ui-controlgroup-label.ui-widget-content{border-right:none}.ui-controlgroup-vertical .ui-controlgroup-label.ui-widget-content{border-bottom:none}.ui-controlgroup-vertical .ui-spinner-input{width:75%;width:calc( 100% - 2.4em )}.ui-controlgroup-vertical .ui-spinner .ui-spinner-up{border-top-style:solid}.ui-checkboxradio-label .ui-icon-background{box-shadow:inset 1px 1px 1px #ccc;border-radius:.12em;border:none}.ui-checkboxradio-radio-label .ui-icon-background{width:16px;height:16px;border-radius:1em;overflow:visible;border:none}.ui-checkboxradio-radio-label.ui-checkboxradio-checked .ui-icon,.ui-checkboxradio-radio-label.ui-checkboxradio-checked:hover .ui-icon{background-image:none;width:8px;height:8px;border-width:4px;border-style:solid}.ui-checkboxradio-disabled{pointer-events:none}.ui-datepicker{width:17em;padding:.2em .2em 0;display:none}.ui-datepicker .ui-datepicker-header{position:relative;padding:.2em 0}.ui-datepicker .ui-datepicker-prev,.ui-datepicker .ui-datepicker-next{position:absolute;top:2px;width:1.8em;height:1.8em}.ui-datepicker .ui-datepicker-prev-hover,.ui-datepicker .ui-datepicker-next-hover{top:1px}.ui-datepicker .ui-datepicker-prev{left:2px}.ui-datepicker .ui-datepicker-next{right:2px}.ui-datepicker .ui-datepicker-prev-hover{left:1px}.ui-datepicker .ui-datepicker-next-hover{right:1px}.ui-datepicker .ui-datepicker-prev span,.ui-datepicker .ui-datepicker-next span{display:block;position:absolute;left:50%;margin-left:-8px;top:50%;margin-top:-8px}.ui-datepicker .ui-datepicker-title{margin:0 2.3em;line-height:1.8em;text-align:center}.ui-datepicker .ui-datepicker-title select{font-size:1em;margin:1px 0}.ui-datepicker select.ui-datepicker-month,.ui-datepicker select.ui-datepicker-year{width:45%}.ui-datepicker table{width:100%;font-size:.9em;border-collapse:collapse;margin:0 0 .4em}.ui-datepicker th{padding:.7em .3em;text-align:center;font-weight:bold;border:0}.ui-datepicker td{border:0;padding:1px}.ui-datepicker td span,.ui-datepicker td a{display:block;padding:.2em;text-align:right;text-decoration:none}.ui-datepicker .ui-datepicker-buttonpane{background-image:none;margin:.7em 0 0 0;padding:0 .2em;border-left:0;border-right:0;border-bottom:0}.ui-datepicker .ui-datepicker-buttonpane button{float:right;margin:.5em .2em .4em;cursor:pointer;padding:.2em .6em .3em .6em;width:auto;overflow:visible}.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current{float:left}.ui-datepicker.ui-datepicker-multi{width:auto}.ui-datepicker-multi .ui-datepicker-group{float:left}.ui-datepicker-multi .ui-datepicker-group table{width:95%;margin:0 auto .4em}.ui-datepicker-multi-2 .ui-datepicker-group{width:50%}.ui-datepicker-multi-3 .ui-datepicker-group{width:33.3%}.ui-datepicker-multi-4 .ui-datepicker-group{width:25%}.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header{border-left-width:0}.ui-datepicker-multi .ui-datepicker-buttonpane{clear:left}.ui-datepicker-row-break{clear:both;width:100%;font-size:0}.ui-datepicker-rtl{direction:rtl}.ui-datepicker-rtl .ui-datepicker-prev{right:2px;left:auto}.ui-datepicker-rtl .ui-datepicker-next{left:2px;right:auto}.ui-datepicker-rtl .ui-datepicker-prev:hover{right:1px;left:auto}.ui-datepicker-rtl .ui-datepicker-next:hover{left:1px;right:auto}.ui-datepicker-rtl .ui-datepicker-buttonpane{clear:right}.ui-datepicker-rtl .ui-datepicker-buttonpane button{float:left}.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current,.ui-datepicker-rtl .ui-datepicker-group{float:right}.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header{border-right-width:0;border-left-width:1px}.ui-datepicker .ui-icon{display:block;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat;left:.5em;top:.3em}.ui-dialog{position:absolute;top:0;left:0;padding:.2em;outline:0}.ui-dialog .ui-dialog-titlebar{padding:.4em 1em;position:relative}.ui-dialog .ui-dialog-title{float:left;margin:.1em 0;white-space:nowrap;width:90%;overflow:hidden;text-overflow:ellipsis}.ui-dialog .ui-dialog-titlebar-close{position:absolute;right:.3em;top:50%;width:20px;margin:-10px 0 0 0;padding:1px;height:20px}.ui-dialog .ui-dialog-content{position:relative;border:0;padding:.5em 1em;background:none;overflow:auto}.ui-dialog .ui-dialog-buttonpane{text-align:left;border-width:1px 0 0 0;background-image:none;margin-top:.5em;padding:.3em 1em .5em .4em}.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset{float:right}.ui-dialog .ui-dialog-buttonpane button{margin:.5em .4em .5em 0;cursor:pointer}.ui-dialog .ui-resizable-n{height:2px;top:0}.ui-dialog .ui-resizable-e{width:2px;right:0}.ui-dialog .ui-resizable-s{height:2px;bottom:0}.ui-dialog .ui-resizable-w{width:2px;left:0}.ui-dialog .ui-resizable-se,.ui-dialog .ui-resizable-sw,.ui-dialog .ui-resizable-ne,.ui-dialog .ui-resizable-nw{width:7px;height:7px}.ui-dialog .ui-resizable-se{right:0;bottom:0}.ui-dialog .ui-resizable-sw{left:0;bottom:0}.ui-dialog .ui-resizable-ne{right:0;top:0}.ui-dialog .ui-resizable-nw{left:0;top:0}.ui-draggable .ui-dialog-titlebar{cursor:move}.ui-progressbar{height:2em;text-align:left;overflow:hidden}.ui-progressbar .ui-progressbar-value{margin:-1px;height:100%}.ui-progressbar .ui-progressbar-overlay{background:url("data:image/gif;base64,R0lGODlhKAAoAIABAAAAAP///yH/C05FVFNDQVBFMi4wAwEAAAAh+QQJAQABACwAAAAAKAAoAAACkYwNqXrdC52DS06a7MFZI+4FHBCKoDeWKXqymPqGqxvJrXZbMx7Ttc+w9XgU2FB3lOyQRWET2IFGiU9m1frDVpxZZc6bfHwv4c1YXP6k1Vdy292Fb6UkuvFtXpvWSzA+HycXJHUXiGYIiMg2R6W459gnWGfHNdjIqDWVqemH2ekpObkpOlppWUqZiqr6edqqWQAAIfkECQEAAQAsAAAAACgAKAAAApSMgZnGfaqcg1E2uuzDmmHUBR8Qil95hiPKqWn3aqtLsS18y7G1SzNeowWBENtQd+T1JktP05nzPTdJZlR6vUxNWWjV+vUWhWNkWFwxl9VpZRedYcflIOLafaa28XdsH/ynlcc1uPVDZxQIR0K25+cICCmoqCe5mGhZOfeYSUh5yJcJyrkZWWpaR8doJ2o4NYq62lAAACH5BAkBAAEALAAAAAAoACgAAAKVDI4Yy22ZnINRNqosw0Bv7i1gyHUkFj7oSaWlu3ovC8GxNso5fluz3qLVhBVeT/Lz7ZTHyxL5dDalQWPVOsQWtRnuwXaFTj9jVVh8pma9JjZ4zYSj5ZOyma7uuolffh+IR5aW97cHuBUXKGKXlKjn+DiHWMcYJah4N0lYCMlJOXipGRr5qdgoSTrqWSq6WFl2ypoaUAAAIfkECQEAAQAsAAAAACgAKAAAApaEb6HLgd/iO7FNWtcFWe+ufODGjRfoiJ2akShbueb0wtI50zm02pbvwfWEMWBQ1zKGlLIhskiEPm9R6vRXxV4ZzWT2yHOGpWMyorblKlNp8HmHEb/lCXjcW7bmtXP8Xt229OVWR1fod2eWqNfHuMjXCPkIGNileOiImVmCOEmoSfn3yXlJWmoHGhqp6ilYuWYpmTqKUgAAIfkECQEAAQAsAAAAACgAKAAAApiEH6kb58biQ3FNWtMFWW3eNVcojuFGfqnZqSebuS06w5V80/X02pKe8zFwP6EFWOT1lDFk8rGERh1TTNOocQ61Hm4Xm2VexUHpzjymViHrFbiELsefVrn6XKfnt2Q9G/+Xdie499XHd2g4h7ioOGhXGJboGAnXSBnoBwKYyfioubZJ2Hn0RuRZaflZOil56Zp6iioKSXpUAAAh+QQJAQABACwAAAAAKAAoAAACkoQRqRvnxuI7kU1a1UU5bd5tnSeOZXhmn5lWK3qNTWvRdQxP8qvaC+/yaYQzXO7BMvaUEmJRd3TsiMAgswmNYrSgZdYrTX6tSHGZO73ezuAw2uxuQ+BbeZfMxsexY35+/Qe4J1inV0g4x3WHuMhIl2jXOKT2Q+VU5fgoSUI52VfZyfkJGkha6jmY+aaYdirq+lQAACH5BAkBAAEALAAAAAAoACgAAAKWBIKpYe0L3YNKToqswUlvznigd4wiR4KhZrKt9Upqip61i9E3vMvxRdHlbEFiEXfk9YARYxOZZD6VQ2pUunBmtRXo1Lf8hMVVcNl8JafV38aM2/Fu5V16Bn63r6xt97j09+MXSFi4BniGFae3hzbH9+hYBzkpuUh5aZmHuanZOZgIuvbGiNeomCnaxxap2upaCZsq+1kAACH5BAkBAAEALAAAAAAoACgAAAKXjI8By5zf4kOxTVrXNVlv1X0d8IGZGKLnNpYtm8Lr9cqVeuOSvfOW79D9aDHizNhDJidFZhNydEahOaDH6nomtJjp1tutKoNWkvA6JqfRVLHU/QUfau9l2x7G54d1fl995xcIGAdXqMfBNadoYrhH+Mg2KBlpVpbluCiXmMnZ2Sh4GBqJ+ckIOqqJ6LmKSllZmsoq6wpQAAAh+QQJAQABACwAAAAAKAAoAAAClYx/oLvoxuJDkU1a1YUZbJ59nSd2ZXhWqbRa2/gF8Gu2DY3iqs7yrq+xBYEkYvFSM8aSSObE+ZgRl1BHFZNr7pRCavZ5BW2142hY3AN/zWtsmf12p9XxxFl2lpLn1rseztfXZjdIWIf2s5dItwjYKBgo9yg5pHgzJXTEeGlZuenpyPmpGQoKOWkYmSpaSnqKileI2FAAACH5BAkBAAEALAAAAAAoACgAAAKVjB+gu+jG4kORTVrVhRlsnn2dJ3ZleFaptFrb+CXmO9OozeL5VfP99HvAWhpiUdcwkpBH3825AwYdU8xTqlLGhtCosArKMpvfa1mMRae9VvWZfeB2XfPkeLmm18lUcBj+p5dnN8jXZ3YIGEhYuOUn45aoCDkp16hl5IjYJvjWKcnoGQpqyPlpOhr3aElaqrq56Bq7VAAAOw==");height:100%;filter:alpha(opacity=25);opacity:0.25}.ui-progressbar-indeterminate .ui-progressbar-value{background-image:none}.ui-selectmenu-menu{padding:0;margin:0;position:absolute;top:0;left:0;display:none}.ui-selectmenu-menu .ui-menu{overflow:auto;overflow-x:hidden;padding-bottom:1px}.ui-selectmenu-menu .ui-menu .ui-selectmenu-optgroup{font-size:1em;font-weight:bold;line-height:1.5;padding:2px 0.4em;margin:0.5em 0 0 0;height:auto;border:0}.ui-selectmenu-open{display:block}.ui-selectmenu-text{display:block;margin-right:20px;overflow:hidden;text-overflow:ellipsis}.ui-selectmenu-button.ui-button{text-align:left;white-space:nowrap;width:14em}.ui-selectmenu-icon.ui-icon{float:right;margin-top:0}.ui-slider{position:relative;text-align:left}.ui-slider .ui-slider-handle{position:absolute;z-index:2;width:1.2em;height:1.2em;cursor:default;-ms-touch-action:none;touch-action:none}.ui-slider .ui-slider-range{position:absolute;z-index:1;font-size:.7em;display:block;border:0;background-position:0 0}.ui-slider.ui-state-disabled .ui-slider-handle,.ui-slider.ui-state-disabled .ui-slider-range{filter:inherit}.ui-slider-horizontal{height:.8em}.ui-slider-horizontal .ui-slider-handle{top:-.3em;margin-left:-.6em}.ui-slider-horizontal .ui-slider-range{top:0;height:100%}.ui-slider-horizontal .ui-slider-range-min{left:0}.ui-slider-horizontal .ui-slider-range-max{right:0}.ui-slider-vertical{width:.8em;height:100px}.ui-slider-vertical .ui-slider-handle{left:-.3em;margin-left:0;margin-bottom:-.6em}.ui-slider-vertical .ui-slider-range{left:0;width:100%}.ui-slider-vertical .ui-slider-range-min{bottom:0}.ui-slider-vertical .ui-slider-range-max{top:0}.ui-spinner{position:relative;display:inline-block;overflow:hidden;padding:0;vertical-align:middle}.ui-spinner-input{border:none;background:none;color:inherit;padding:.222em 0;margin:.2em 0;vertical-align:middle;margin-left:.4em;margin-right:2em}.ui-spinner-button{width:1.6em;height:50%;font-size:.5em;padding:0;margin:0;text-align:center;position:absolute;cursor:default;display:block;overflow:hidden;right:0}.ui-spinner a.ui-spinner-button{border-top-style:none;border-bottom-style:none;border-right-style:none}.ui-spinner-up{top:0}.ui-spinner-down{bottom:0}.ui-tabs{position:relative;padding:.2em}.ui-tabs .ui-tabs-nav{margin:0;padding:.2em .2em 0}.ui-tabs .ui-tabs-nav li{list-style:none;float:left;position:relative;top:0;margin:1px .2em 0 0;border-bottom-width:0;padding:0;white-space:nowrap}.ui-tabs .ui-tabs-nav .ui-tabs-anchor{float:left;padding:.5em 1em;text-decoration:none}.ui-tabs .ui-tabs-nav li.ui-tabs-active{margin-bottom:-1px;padding-bottom:1px}.ui-tabs .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor,.ui-tabs .ui-tabs-nav li.ui-state-disabled .ui-tabs-anchor,.ui-tabs .ui-tabs-nav li.ui-tabs-loading .ui-tabs-anchor{cursor:text}.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor{cursor:pointer}.ui-tabs .ui-tabs-panel{display:block;border-width:0;padding:1em 1.4em;background:none}.ui-tooltip{padding:8px;position:absolute;z-index:9999;max-width:300px}body .ui-tooltip{border-width:2px}.ui-widget{font-family:Arial,Helvetica,sans-serif;font-size:1em}.ui-widget .ui-widget{font-size:1em}.ui-widget input,.ui-widget select,.ui-widget textarea,.ui-widget button{font-family:Arial,Helvetica,sans-serif;font-size:1em}.ui-widget.ui-widget-content{border:1px solid #c5c5c5}.ui-widget-content{border:1px solid #ddd;background:#fff;color:#333}.ui-widget-content a{color:#333}.ui-widget-header{border:1px solid #ddd;background:#e9e9e9;color:#333;font-weight:bold}.ui-widget-header a{color:#333}.ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default,.ui-button,html .ui-button.ui-state-disabled:hover,html .ui-button.ui-state-disabled:active{border:1px solid #c5c5c5;background:#f6f6f6;font-weight:normal;color:#454545}.ui-state-default a,.ui-state-default a:link,.ui-state-default a:visited,a.ui-button,a:link.ui-button,a:visited.ui-button,.ui-button{color:#454545;text-decoration:none}.ui-state-hover,.ui-widget-content .ui-state-hover,.ui-widget-header .ui-state-hover,.ui-state-focus,.ui-widget-content .ui-state-focus,.ui-widget-header .ui-state-focus,.ui-button:hover,.ui-button:focus{border:1px solid #ccc;background:#ededed;font-weight:normal;color:#2b2b2b}.ui-state-hover a,.ui-state-hover a:hover,.ui-state-hover a:link,.ui-state-hover a:visited,.ui-state-focus a,.ui-state-focus a:hover,.ui-state-focus a:link,.ui-state-focus a:visited,a.ui-button:hover,a.ui-button:focus{color:#2b2b2b;text-decoration:none}.ui-visual-focus{box-shadow:0 0 3px 1px rgb(94,158,214)}.ui-state-active,.ui-widget-content .ui-state-active,.ui-widget-header .ui-state-active,a.ui-button:active,.ui-button:active,.ui-button.ui-state-active:hover{border:1px solid #003eff;background:#007fff;font-weight:normal;color:#fff}.ui-icon-background,.ui-state-active .ui-icon-background{border:#003eff;background-color:#fff}.ui-state-active a,.ui-state-active a:link,.ui-state-active a:visited{color:#fff;text-decoration:none}.ui-state-highlight,.ui-widget-content .ui-state-highlight,.ui-widget-header .ui-state-highlight{border:1px solid #dad55e;background:#fffa90;color:#777620}.ui-state-checked{border:1px solid #dad55e;background:#fffa90}.ui-state-highlight a,.ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a{color:#777620}.ui-state-error,.ui-widget-content .ui-state-error,.ui-widget-header .ui-state-error{border:1px solid #f1a899;background:#fddfdf;color:#5f3f3f}.ui-state-error a,.ui-widget-content .ui-state-error a,.ui-widget-header .ui-state-error a{color:#5f3f3f}.ui-state-error-text,.ui-widget-content .ui-state-error-text,.ui-widget-header .ui-state-error-text{color:#5f3f3f}.ui-priority-primary,.ui-widget-content .ui-priority-primary,.ui-widget-header .ui-priority-primary{font-weight:bold}.ui-priority-secondary,.ui-widget-content .ui-priority-secondary,.ui-widget-header .ui-priority-secondary{opacity:.7;filter:Alpha(Opacity=70);font-weight:normal}.ui-state-disabled,.ui-widget-content .ui-state-disabled,.ui-widget-header .ui-state-disabled{opacity:.35;filter:Alpha(Opacity=35);background-image:none}.ui-state-disabled .ui-icon{filter:Alpha(Opacity=35)}.ui-icon{width:16px;height:16px}.ui-icon,.ui-widget-content .ui-icon{background-image:url("images/ui-icons_444444_256x240.png")}.ui-widget-header .ui-icon{background-image:url("images/ui-icons_444444_256x240.png")}.ui-state-hover .ui-icon,.ui-state-focus .ui-icon,.ui-button:hover .ui-icon,.ui-button:focus .ui-icon{background-image:url("images/ui-icons_555555_256x240.png")}.ui-state-active .ui-icon,.ui-button:active .ui-icon{background-image:url("images/ui-icons_ffffff_256x240.png")}.ui-state-highlight .ui-icon,.ui-button .ui-state-highlight.ui-icon{background-image:url("images/ui-icons_777620_256x240.png")}.ui-state-error .ui-icon,.ui-state-error-text .ui-icon{background-image:url("images/ui-icons_cc0000_256x240.png")}.ui-button .ui-icon{background-image:url("images/ui-icons_777777_256x240.png")}.ui-icon-blank{background-position:16px 16px}.ui-icon-caret-1-n{background-position:0 0}.ui-icon-caret-1-ne{background-position:-16px 0}.ui-icon-caret-1-e{background-position:-32px 0}.ui-icon-caret-1-se{background-position:-48px 0}.ui-icon-caret-1-s{background-position:-65px 0}.ui-icon-caret-1-sw{background-position:-80px 0}.ui-icon-caret-1-w{background-position:-96px 0}.ui-icon-caret-1-nw{background-position:-112px 0}.ui-icon-caret-2-n-s{background-position:-128px 0}.ui-icon-caret-2-e-w{background-position:-144px 0}.ui-icon-triangle-1-n{background-position:0 -16px}.ui-icon-triangle-1-ne{background-position:-16px -16px}.ui-icon-triangle-1-e{background-position:-32px -16px}.ui-icon-triangle-1-se{background-position:-48px -16px}.ui-icon-triangle-1-s{background-position:-65px -16px}.ui-icon-triangle-1-sw{background-position:-80px -16px}.ui-icon-triangle-1-w{background-position:-96px -16px}.ui-icon-triangle-1-nw{background-position:-112px -16px}.ui-icon-triangle-2-n-s{background-position:-128px -16px}.ui-icon-triangle-2-e-w{background-position:-144px -16px}.ui-icon-arrow-1-n{background-position:0 -32px}.ui-icon-arrow-1-ne{background-position:-16px -32px}.ui-icon-arrow-1-e{background-position:-32px -32px}.ui-icon-arrow-1-se{background-position:-48px -32px}.ui-icon-arrow-1-s{background-position:-65px -32px}.ui-icon-arrow-1-sw{background-position:-80px -32px}.ui-icon-arrow-1-w{background-position:-96px -32px}.ui-icon-arrow-1-nw{background-position:-112px -32px}.ui-icon-arrow-2-n-s{background-position:-128px -32px}.ui-icon-arrow-2-ne-sw{background-position:-144px -32px}.ui-icon-arrow-2-e-w{background-position:-160px -32px}.ui-icon-arrow-2-se-nw{background-position:-176px -32px}.ui-icon-arrowstop-1-n{background-position:-192px -32px}.ui-icon-arrowstop-1-e{background-position:-208px -32px}.ui-icon-arrowstop-1-s{background-position:-224px -32px}.ui-icon-arrowstop-1-w{background-position:-240px -32px}.ui-icon-arrowthick-1-n{background-position:1px -48px}.ui-icon-arrowthick-1-ne{background-position:-16px -48px}.ui-icon-arrowthick-1-e{background-position:-32px -48px}.ui-icon-arrowthick-1-se{background-position:-48px -48px}.ui-icon-arrowthick-1-s{background-position:-64px -48px}.ui-icon-arrowthick-1-sw{background-position:-80px -48px}.ui-icon-arrowthick-1-w{background-position:-96px -48px}.ui-icon-arrowthick-1-nw{background-position:-112px -48px}.ui-icon-arrowthick-2-n-s{background-position:-128px -48px}.ui-icon-arrowthick-2-ne-sw{background-position:-144px -48px}.ui-icon-arrowthick-2-e-w{background-position:-160px -48px}.ui-icon-arrowthick-2-se-nw{background-position:-176px -48px}.ui-icon-arrowthickstop-1-n{background-position:-192px -48px}.ui-icon-arrowthickstop-1-e{background-position:-208px -48px}.ui-icon-arrowthickstop-1-s{background-position:-224px -48px}.ui-icon-arrowthickstop-1-w{background-position:-240px -48px}.ui-icon-arrowreturnthick-1-w{background-position:0 -64px}.ui-icon-arrowreturnthick-1-n{background-position:-16px -64px}.ui-icon-arrowreturnthick-1-e{background-position:-32px -64px}.ui-icon-arrowreturnthick-1-s{background-position:-48px -64px}.ui-icon-arrowreturn-1-w{background-position:-64px -64px}.ui-icon-arrowreturn-1-n{background-position:-80px -64px}.ui-icon-arrowreturn-1-e{background-position:-96px -64px}.ui-icon-arrowreturn-1-s{background-position:-112px -64px}.ui-icon-arrowrefresh-1-w{background-position:-128px -64px}.ui-icon-arrowrefresh-1-n{background-position:-144px -64px}.ui-icon-arrowrefresh-1-e{background-position:-160px -64px}.ui-icon-arrowrefresh-1-s{background-position:-176px -64px}.ui-icon-arrow-4{background-position:0 -80px}.ui-icon-arrow-4-diag{background-position:-16px -80px}.ui-icon-extlink{background-position:-32px -80px}.ui-icon-newwin{background-position:-48px -80px}.ui-icon-refresh{background-position:-64px -80px}.ui-icon-shuffle{background-position:-80px -80px}.ui-icon-transfer-e-w{background-position:-96px -80px}.ui-icon-transferthick-e-w{background-position:-112px -80px}.ui-icon-folder-collapsed{background-position:0 -96px}.ui-icon-folder-open{background-position:-16px -96px}.ui-icon-document{background-position:-32px -96px}.ui-icon-document-b{background-position:-48px -96px}.ui-icon-note{background-position:-64px -96px}.ui-icon-mail-closed{background-position:-80px -96px}.ui-icon-mail-open{background-position:-96px -96px}.ui-icon-suitcase{background-position:-112px -96px}.ui-icon-comment{background-position:-128px -96px}.ui-icon-person{background-position:-144px -96px}.ui-icon-print{background-position:-160px -96px}.ui-icon-trash{background-position:-176px -96px}.ui-icon-locked{background-position:-192px -96px}.ui-icon-unlocked{background-position:-208px -96px}.ui-icon-bookmark{background-position:-224px -96px}.ui-icon-tag{background-position:-240px -96px}.ui-icon-home{background-position:0 -112px}.ui-icon-flag{background-position:-16px -112px}.ui-icon-calendar{background-position:-32px -112px}.ui-icon-cart{background-position:-48px -112px}.ui-icon-pencil{background-position:-64px -112px}.ui-icon-clock{background-position:-80px -112px}.ui-icon-disk{background-position:-96px -112px}.ui-icon-calculator{background-position:-112px -112px}.ui-icon-zoomin{background-position:-128px -112px}.ui-icon-zoomout{background-position:-144px -112px}.ui-icon-search{background-position:-160px -112px}.ui-icon-wrench{background-position:-176px -112px}.ui-icon-gear{background-position:-192px -112px}.ui-icon-heart{background-position:-208px -112px}.ui-icon-star{background-position:-224px -112px}.ui-icon-link{background-position:-240px -112px}.ui-icon-cancel{background-position:0 -128px}.ui-icon-plus{background-position:-16px -128px}.ui-icon-plusthick{background-position:-32px -128px}.ui-icon-minus{background-position:-48px -128px}.ui-icon-minusthick{background-position:-64px -128px}.ui-icon-close{background-position:-80px -128px}.ui-icon-closethick{background-position:-96px -128px}.ui-icon-key{background-position:-112px -128px}.ui-icon-lightbulb{background-position:-128px -128px}.ui-icon-scissors{background-position:-144px -128px}.ui-icon-clipboard{background-position:-160px -128px}.ui-icon-copy{background-position:-176px -128px}.ui-icon-contact{background-position:-192px -128px}.ui-icon-image{background-position:-208px -128px}.ui-icon-video{background-position:-224px -128px}.ui-icon-script{background-position:-240px -128px}.ui-icon-alert{background-position:0 -144px}.ui-icon-info{background-position:-16px -144px}.ui-icon-notice{background-position:-32px -144px}.ui-icon-help{background-position:-48px -144px}.ui-icon-check{background-position:-64px -144px}.ui-icon-bullet{background-position:-80px -144px}.ui-icon-radio-on{background-position:-96px -144px}.ui-icon-radio-off{background-position:-112px -144px}.ui-icon-pin-w{background-position:-128px -144px}.ui-icon-pin-s{background-position:-144px -144px}.ui-icon-play{background-position:0 -160px}.ui-icon-pause{background-position:-16px -160px}.ui-icon-seek-next{background-position:-32px -160px}.ui-icon-seek-prev{background-position:-48px -160px}.ui-icon-seek-end{background-position:-64px -160px}.ui-icon-seek-start{background-position:-80px -160px}.ui-icon-seek-first{background-position:-80px -160px}.ui-icon-stop{background-position:-96px -160px}.ui-icon-eject{background-position:-112px -160px}.ui-icon-volume-off{background-position:-128px -160px}.ui-icon-volume-on{background-position:-144px -160px}.ui-icon-power{background-position:0 -176px}.ui-icon-signal-diag{background-position:-16px -176px}.ui-icon-signal{background-position:-32px -176px}.ui-icon-battery-0{background-position:-48px -176px}.ui-icon-battery-1{background-position:-64px -176px}.ui-icon-battery-2{background-position:-80px -176px}.ui-icon-battery-3{background-position:-96px -176px}.ui-icon-circle-plus{background-position:0 -192px}.ui-icon-circle-minus{background-position:-16px -192px}.ui-icon-circle-close{background-position:-32px -192px}.ui-icon-circle-triangle-e{background-position:-48px -192px}.ui-icon-circle-triangle-s{background-position:-64px -192px}.ui-icon-circle-triangle-w{background-position:-80px -192px}.ui-icon-circle-triangle-n{background-position:-96px -192px}.ui-icon-circle-arrow-e{background-position:-112px -192px}.ui-icon-circle-arrow-s{background-position:-128px -192px}.ui-icon-circle-arrow-w{background-position:-144px -192px}.ui-icon-circle-arrow-n{background-position:-160px -192px}.ui-icon-circle-zoomin{background-position:-176px -192px}.ui-icon-circle-zoomout{background-position:-192px -192px}.ui-icon-circle-check{background-position:-208px -192px}.ui-icon-circlesmall-plus{background-position:0 -208px}.ui-icon-circlesmall-minus{background-position:-16px -208px}.ui-icon-circlesmall-close{background-position:-32px -208px}.ui-icon-squaresmall-plus{background-position:-48px -208px}.ui-icon-squaresmall-minus{background-position:-64px -208px}.ui-icon-squaresmall-close{background-position:-80px -208px}.ui-icon-grip-dotted-vertical{background-position:0 -224px}.ui-icon-grip-dotted-horizontal{background-position:-16px -224px}.ui-icon-grip-solid-vertical{background-position:-32px -224px}.ui-icon-grip-solid-horizontal{background-position:-48px -224px}.ui-icon-gripsmall-diagonal-se{background-position:-64px -224px}.ui-icon-grip-diagonal-se{background-position:-80px -224px}.ui-corner-all,.ui-corner-top,.ui-corner-left,.ui-corner-tl{border-top-left-radius:3px}.ui-corner-all,.ui-corner-top,.ui-corner-right,.ui-corner-tr{border-top-right-radius:3px}.ui-corner-all,.ui-corner-bottom,.ui-corner-left,.ui-corner-bl{border-bottom-left-radius:3px}.ui-corner-all,.ui-corner-bottom,.ui-corner-right,.ui-corner-br{border-bottom-right-radius:3px}.ui-widget-overlay{background:#aaa;opacity:.3;filter:Alpha(Opacity=30)}.ui-widget-shadow{-webkit-box-shadow:0 0 5px #666;box-shadow:0 0 5px #666}
css/jquery-ui.theme.min.css CHANGED
@@ -1,5 +1,5 @@
1
- /*! jQuery UI - v1.12.1 - 2020-01-10
2
- * http://jqueryui.com
3
- * Copyright jQuery Foundation and other contributors; Licensed MIT */
4
-
5
  .ui-widget{font-family:Arial,Helvetica,sans-serif;font-size:1em}.ui-widget .ui-widget{font-size:1em}.ui-widget input,.ui-widget select,.ui-widget textarea,.ui-widget button{font-family:Arial,Helvetica,sans-serif;font-size:1em}.ui-widget.ui-widget-content{border:1px solid #c5c5c5}.ui-widget-content{border:1px solid #ddd;background:#fff;color:#333}.ui-widget-content a{color:#333}.ui-widget-header{border:1px solid #ddd;background:#e9e9e9;color:#333;font-weight:bold}.ui-widget-header a{color:#333}.ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default,.ui-button,html .ui-button.ui-state-disabled:hover,html .ui-button.ui-state-disabled:active{border:1px solid #c5c5c5;background:#f6f6f6;font-weight:normal;color:#454545}.ui-state-default a,.ui-state-default a:link,.ui-state-default a:visited,a.ui-button,a:link.ui-button,a:visited.ui-button,.ui-button{color:#454545;text-decoration:none}.ui-state-hover,.ui-widget-content .ui-state-hover,.ui-widget-header .ui-state-hover,.ui-state-focus,.ui-widget-content .ui-state-focus,.ui-widget-header .ui-state-focus,.ui-button:hover,.ui-button:focus{border:1px solid #ccc;background:#ededed;font-weight:normal;color:#2b2b2b}.ui-state-hover a,.ui-state-hover a:hover,.ui-state-hover a:link,.ui-state-hover a:visited,.ui-state-focus a,.ui-state-focus a:hover,.ui-state-focus a:link,.ui-state-focus a:visited,a.ui-button:hover,a.ui-button:focus{color:#2b2b2b;text-decoration:none}.ui-visual-focus{box-shadow:0 0 3px 1px rgb(94,158,214)}.ui-state-active,.ui-widget-content .ui-state-active,.ui-widget-header .ui-state-active,a.ui-button:active,.ui-button:active,.ui-button.ui-state-active:hover{border:1px solid #003eff;background:#007fff;font-weight:normal;color:#fff}.ui-icon-background,.ui-state-active .ui-icon-background{border:#003eff;background-color:#fff}.ui-state-active a,.ui-state-active a:link,.ui-state-active a:visited{color:#fff;text-decoration:none}.ui-state-highlight,.ui-widget-content .ui-state-highlight,.ui-widget-header .ui-state-highlight{border:1px solid #dad55e;background:#fffa90;color:#777620}.ui-state-checked{border:1px solid #dad55e;background:#fffa90}.ui-state-highlight a,.ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a{color:#777620}.ui-state-error,.ui-widget-content .ui-state-error,.ui-widget-header .ui-state-error{border:1px solid #f1a899;background:#fddfdf;color:#5f3f3f}.ui-state-error a,.ui-widget-content .ui-state-error a,.ui-widget-header .ui-state-error a{color:#5f3f3f}.ui-state-error-text,.ui-widget-content .ui-state-error-text,.ui-widget-header .ui-state-error-text{color:#5f3f3f}.ui-priority-primary,.ui-widget-content .ui-priority-primary,.ui-widget-header .ui-priority-primary{font-weight:bold}.ui-priority-secondary,.ui-widget-content .ui-priority-secondary,.ui-widget-header .ui-priority-secondary{opacity:.7;filter:Alpha(Opacity=70);font-weight:normal}.ui-state-disabled,.ui-widget-content .ui-state-disabled,.ui-widget-header .ui-state-disabled{opacity:.35;filter:Alpha(Opacity=35);background-image:none}.ui-state-disabled .ui-icon{filter:Alpha(Opacity=35)}.ui-icon{width:16px;height:16px}.ui-icon,.ui-widget-content .ui-icon{background-image:url("images/ui-icons_444444_256x240.png")}.ui-widget-header .ui-icon{background-image:url("images/ui-icons_444444_256x240.png")}.ui-state-hover .ui-icon,.ui-state-focus .ui-icon,.ui-button:hover .ui-icon,.ui-button:focus .ui-icon{background-image:url("images/ui-icons_555555_256x240.png")}.ui-state-active .ui-icon,.ui-button:active .ui-icon{background-image:url("images/ui-icons_ffffff_256x240.png")}.ui-state-highlight .ui-icon,.ui-button .ui-state-highlight.ui-icon{background-image:url("images/ui-icons_777620_256x240.png")}.ui-state-error .ui-icon,.ui-state-error-text .ui-icon{background-image:url("images/ui-icons_cc0000_256x240.png")}.ui-button .ui-icon{background-image:url("images/ui-icons_777777_256x240.png")}.ui-icon-blank{background-position:16px 16px}.ui-icon-caret-1-n{background-position:0 0}.ui-icon-caret-1-ne{background-position:-16px 0}.ui-icon-caret-1-e{background-position:-32px 0}.ui-icon-caret-1-se{background-position:-48px 0}.ui-icon-caret-1-s{background-position:-65px 0}.ui-icon-caret-1-sw{background-position:-80px 0}.ui-icon-caret-1-w{background-position:-96px 0}.ui-icon-caret-1-nw{background-position:-112px 0}.ui-icon-caret-2-n-s{background-position:-128px 0}.ui-icon-caret-2-e-w{background-position:-144px 0}.ui-icon-triangle-1-n{background-position:0 -16px}.ui-icon-triangle-1-ne{background-position:-16px -16px}.ui-icon-triangle-1-e{background-position:-32px -16px}.ui-icon-triangle-1-se{background-position:-48px -16px}.ui-icon-triangle-1-s{background-position:-65px -16px}.ui-icon-triangle-1-sw{background-position:-80px -16px}.ui-icon-triangle-1-w{background-position:-96px -16px}.ui-icon-triangle-1-nw{background-position:-112px -16px}.ui-icon-triangle-2-n-s{background-position:-128px -16px}.ui-icon-triangle-2-e-w{background-position:-144px -16px}.ui-icon-arrow-1-n{background-position:0 -32px}.ui-icon-arrow-1-ne{background-position:-16px -32px}.ui-icon-arrow-1-e{background-position:-32px -32px}.ui-icon-arrow-1-se{background-position:-48px -32px}.ui-icon-arrow-1-s{background-position:-65px -32px}.ui-icon-arrow-1-sw{background-position:-80px -32px}.ui-icon-arrow-1-w{background-position:-96px -32px}.ui-icon-arrow-1-nw{background-position:-112px -32px}.ui-icon-arrow-2-n-s{background-position:-128px -32px}.ui-icon-arrow-2-ne-sw{background-position:-144px -32px}.ui-icon-arrow-2-e-w{background-position:-160px -32px}.ui-icon-arrow-2-se-nw{background-position:-176px -32px}.ui-icon-arrowstop-1-n{background-position:-192px -32px}.ui-icon-arrowstop-1-e{background-position:-208px -32px}.ui-icon-arrowstop-1-s{background-position:-224px -32px}.ui-icon-arrowstop-1-w{background-position:-240px -32px}.ui-icon-arrowthick-1-n{background-position:1px -48px}.ui-icon-arrowthick-1-ne{background-position:-16px -48px}.ui-icon-arrowthick-1-e{background-position:-32px -48px}.ui-icon-arrowthick-1-se{background-position:-48px -48px}.ui-icon-arrowthick-1-s{background-position:-64px -48px}.ui-icon-arrowthick-1-sw{background-position:-80px -48px}.ui-icon-arrowthick-1-w{background-position:-96px -48px}.ui-icon-arrowthick-1-nw{background-position:-112px -48px}.ui-icon-arrowthick-2-n-s{background-position:-128px -48px}.ui-icon-arrowthick-2-ne-sw{background-position:-144px -48px}.ui-icon-arrowthick-2-e-w{background-position:-160px -48px}.ui-icon-arrowthick-2-se-nw{background-position:-176px -48px}.ui-icon-arrowthickstop-1-n{background-position:-192px -48px}.ui-icon-arrowthickstop-1-e{background-position:-208px -48px}.ui-icon-arrowthickstop-1-s{background-position:-224px -48px}.ui-icon-arrowthickstop-1-w{background-position:-240px -48px}.ui-icon-arrowreturnthick-1-w{background-position:0 -64px}.ui-icon-arrowreturnthick-1-n{background-position:-16px -64px}.ui-icon-arrowreturnthick-1-e{background-position:-32px -64px}.ui-icon-arrowreturnthick-1-s{background-position:-48px -64px}.ui-icon-arrowreturn-1-w{background-position:-64px -64px}.ui-icon-arrowreturn-1-n{background-position:-80px -64px}.ui-icon-arrowreturn-1-e{background-position:-96px -64px}.ui-icon-arrowreturn-1-s{background-position:-112px -64px}.ui-icon-arrowrefresh-1-w{background-position:-128px -64px}.ui-icon-arrowrefresh-1-n{background-position:-144px -64px}.ui-icon-arrowrefresh-1-e{background-position:-160px -64px}.ui-icon-arrowrefresh-1-s{background-position:-176px -64px}.ui-icon-arrow-4{background-position:0 -80px}.ui-icon-arrow-4-diag{background-position:-16px -80px}.ui-icon-extlink{background-position:-32px -80px}.ui-icon-newwin{background-position:-48px -80px}.ui-icon-refresh{background-position:-64px -80px}.ui-icon-shuffle{background-position:-80px -80px}.ui-icon-transfer-e-w{background-position:-96px -80px}.ui-icon-transferthick-e-w{background-position:-112px -80px}.ui-icon-folder-collapsed{background-position:0 -96px}.ui-icon-folder-open{background-position:-16px -96px}.ui-icon-document{background-position:-32px -96px}.ui-icon-document-b{background-position:-48px -96px}.ui-icon-note{background-position:-64px -96px}.ui-icon-mail-closed{background-position:-80px -96px}.ui-icon-mail-open{background-position:-96px -96px}.ui-icon-suitcase{background-position:-112px -96px}.ui-icon-comment{background-position:-128px -96px}.ui-icon-person{background-position:-144px -96px}.ui-icon-print{background-position:-160px -96px}.ui-icon-trash{background-position:-176px -96px}.ui-icon-locked{background-position:-192px -96px}.ui-icon-unlocked{background-position:-208px -96px}.ui-icon-bookmark{background-position:-224px -96px}.ui-icon-tag{background-position:-240px -96px}.ui-icon-home{background-position:0 -112px}.ui-icon-flag{background-position:-16px -112px}.ui-icon-calendar{background-position:-32px -112px}.ui-icon-cart{background-position:-48px -112px}.ui-icon-pencil{background-position:-64px -112px}.ui-icon-clock{background-position:-80px -112px}.ui-icon-disk{background-position:-96px -112px}.ui-icon-calculator{background-position:-112px -112px}.ui-icon-zoomin{background-position:-128px -112px}.ui-icon-zoomout{background-position:-144px -112px}.ui-icon-search{background-position:-160px -112px}.ui-icon-wrench{background-position:-176px -112px}.ui-icon-gear{background-position:-192px -112px}.ui-icon-heart{background-position:-208px -112px}.ui-icon-star{background-position:-224px -112px}.ui-icon-link{background-position:-240px -112px}.ui-icon-cancel{background-position:0 -128px}.ui-icon-plus{background-position:-16px -128px}.ui-icon-plusthick{background-position:-32px -128px}.ui-icon-minus{background-position:-48px -128px}.ui-icon-minusthick{background-position:-64px -128px}.ui-icon-close{background-position:-80px -128px}.ui-icon-closethick{background-position:-96px -128px}.ui-icon-key{background-position:-112px -128px}.ui-icon-lightbulb{background-position:-128px -128px}.ui-icon-scissors{background-position:-144px -128px}.ui-icon-clipboard{background-position:-160px -128px}.ui-icon-copy{background-position:-176px -128px}.ui-icon-contact{background-position:-192px -128px}.ui-icon-image{background-position:-208px -128px}.ui-icon-video{background-position:-224px -128px}.ui-icon-script{background-position:-240px -128px}.ui-icon-alert{background-position:0 -144px}.ui-icon-info{background-position:-16px -144px}.ui-icon-notice{background-position:-32px -144px}.ui-icon-help{background-position:-48px -144px}.ui-icon-check{background-position:-64px -144px}.ui-icon-bullet{background-position:-80px -144px}.ui-icon-radio-on{background-position:-96px -144px}.ui-icon-radio-off{background-position:-112px -144px}.ui-icon-pin-w{background-position:-128px -144px}.ui-icon-pin-s{background-position:-144px -144px}.ui-icon-play{background-position:0 -160px}.ui-icon-pause{background-position:-16px -160px}.ui-icon-seek-next{background-position:-32px -160px}.ui-icon-seek-prev{background-position:-48px -160px}.ui-icon-seek-end{background-position:-64px -160px}.ui-icon-seek-start{background-position:-80px -160px}.ui-icon-seek-first{background-position:-80px -160px}.ui-icon-stop{background-position:-96px -160px}.ui-icon-eject{background-position:-112px -160px}.ui-icon-volume-off{background-position:-128px -160px}.ui-icon-volume-on{background-position:-144px -160px}.ui-icon-power{background-position:0 -176px}.ui-icon-signal-diag{background-position:-16px -176px}.ui-icon-signal{background-position:-32px -176px}.ui-icon-battery-0{background-position:-48px -176px}.ui-icon-battery-1{background-position:-64px -176px}.ui-icon-battery-2{background-position:-80px -176px}.ui-icon-battery-3{background-position:-96px -176px}.ui-icon-circle-plus{background-position:0 -192px}.ui-icon-circle-minus{background-position:-16px -192px}.ui-icon-circle-close{background-position:-32px -192px}.ui-icon-circle-triangle-e{background-position:-48px -192px}.ui-icon-circle-triangle-s{background-position:-64px -192px}.ui-icon-circle-triangle-w{background-position:-80px -192px}.ui-icon-circle-triangle-n{background-position:-96px -192px}.ui-icon-circle-arrow-e{background-position:-112px -192px}.ui-icon-circle-arrow-s{background-position:-128px -192px}.ui-icon-circle-arrow-w{background-position:-144px -192px}.ui-icon-circle-arrow-n{background-position:-160px -192px}.ui-icon-circle-zoomin{background-position:-176px -192px}.ui-icon-circle-zoomout{background-position:-192px -192px}.ui-icon-circle-check{background-position:-208px -192px}.ui-icon-circlesmall-plus{background-position:0 -208px}.ui-icon-circlesmall-minus{background-position:-16px -208px}.ui-icon-circlesmall-close{background-position:-32px -208px}.ui-icon-squaresmall-plus{background-position:-48px -208px}.ui-icon-squaresmall-minus{background-position:-64px -208px}.ui-icon-squaresmall-close{background-position:-80px -208px}.ui-icon-grip-dotted-vertical{background-position:0 -224px}.ui-icon-grip-dotted-horizontal{background-position:-16px -224px}.ui-icon-grip-solid-vertical{background-position:-32px -224px}.ui-icon-grip-solid-horizontal{background-position:-48px -224px}.ui-icon-gripsmall-diagonal-se{background-position:-64px -224px}.ui-icon-grip-diagonal-se{background-position:-80px -224px}.ui-corner-all,.ui-corner-top,.ui-corner-left,.ui-corner-tl{border-top-left-radius:3px}.ui-corner-all,.ui-corner-top,.ui-corner-right,.ui-corner-tr{border-top-right-radius:3px}.ui-corner-all,.ui-corner-bottom,.ui-corner-left,.ui-corner-bl{border-bottom-left-radius:3px}.ui-corner-all,.ui-corner-bottom,.ui-corner-right,.ui-corner-br{border-bottom-right-radius:3px}.ui-widget-overlay{background:#aaa;opacity:.3;filter:Alpha(Opacity=30)}.ui-widget-shadow{-webkit-box-shadow:0 0 5px #666;box-shadow:0 0 5px #666}
1
+ /*! jQuery UI - v1.12.1 - 2020-01-10
2
+ * http://jqueryui.com
3
+ * Copyright jQuery Foundation and other contributors; Licensed MIT */
4
+
5
  .ui-widget{font-family:Arial,Helvetica,sans-serif;font-size:1em}.ui-widget .ui-widget{font-size:1em}.ui-widget input,.ui-widget select,.ui-widget textarea,.ui-widget button{font-family:Arial,Helvetica,sans-serif;font-size:1em}.ui-widget.ui-widget-content{border:1px solid #c5c5c5}.ui-widget-content{border:1px solid #ddd;background:#fff;color:#333}.ui-widget-content a{color:#333}.ui-widget-header{border:1px solid #ddd;background:#e9e9e9;color:#333;font-weight:bold}.ui-widget-header a{color:#333}.ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default,.ui-button,html .ui-button.ui-state-disabled:hover,html .ui-button.ui-state-disabled:active{border:1px solid #c5c5c5;background:#f6f6f6;font-weight:normal;color:#454545}.ui-state-default a,.ui-state-default a:link,.ui-state-default a:visited,a.ui-button,a:link.ui-button,a:visited.ui-button,.ui-button{color:#454545;text-decoration:none}.ui-state-hover,.ui-widget-content .ui-state-hover,.ui-widget-header .ui-state-hover,.ui-state-focus,.ui-widget-content .ui-state-focus,.ui-widget-header .ui-state-focus,.ui-button:hover,.ui-button:focus{border:1px solid #ccc;background:#ededed;font-weight:normal;color:#2b2b2b}.ui-state-hover a,.ui-state-hover a:hover,.ui-state-hover a:link,.ui-state-hover a:visited,.ui-state-focus a,.ui-state-focus a:hover,.ui-state-focus a:link,.ui-state-focus a:visited,a.ui-button:hover,a.ui-button:focus{color:#2b2b2b;text-decoration:none}.ui-visual-focus{box-shadow:0 0 3px 1px rgb(94,158,214)}.ui-state-active,.ui-widget-content .ui-state-active,.ui-widget-header .ui-state-active,a.ui-button:active,.ui-button:active,.ui-button.ui-state-active:hover{border:1px solid #003eff;background:#007fff;font-weight:normal;color:#fff}.ui-icon-background,.ui-state-active .ui-icon-background{border:#003eff;background-color:#fff}.ui-state-active a,.ui-state-active a:link,.ui-state-active a:visited{color:#fff;text-decoration:none}.ui-state-highlight,.ui-widget-content .ui-state-highlight,.ui-widget-header .ui-state-highlight{border:1px solid #dad55e;background:#fffa90;color:#777620}.ui-state-checked{border:1px solid #dad55e;background:#fffa90}.ui-state-highlight a,.ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a{color:#777620}.ui-state-error,.ui-widget-content .ui-state-error,.ui-widget-header .ui-state-error{border:1px solid #f1a899;background:#fddfdf;color:#5f3f3f}.ui-state-error a,.ui-widget-content .ui-state-error a,.ui-widget-header .ui-state-error a{color:#5f3f3f}.ui-state-error-text,.ui-widget-content .ui-state-error-text,.ui-widget-header .ui-state-error-text{color:#5f3f3f}.ui-priority-primary,.ui-widget-content .ui-priority-primary,.ui-widget-header .ui-priority-primary{font-weight:bold}.ui-priority-secondary,.ui-widget-content .ui-priority-secondary,.ui-widget-header .ui-priority-secondary{opacity:.7;filter:Alpha(Opacity=70);font-weight:normal}.ui-state-disabled,.ui-widget-content .ui-state-disabled,.ui-widget-header .ui-state-disabled{opacity:.35;filter:Alpha(Opacity=35);background-image:none}.ui-state-disabled .ui-icon{filter:Alpha(Opacity=35)}.ui-icon{width:16px;height:16px}.ui-icon,.ui-widget-content .ui-icon{background-image:url("images/ui-icons_444444_256x240.png")}.ui-widget-header .ui-icon{background-image:url("images/ui-icons_444444_256x240.png")}.ui-state-hover .ui-icon,.ui-state-focus .ui-icon,.ui-button:hover .ui-icon,.ui-button:focus .ui-icon{background-image:url("images/ui-icons_555555_256x240.png")}.ui-state-active .ui-icon,.ui-button:active .ui-icon{background-image:url("images/ui-icons_ffffff_256x240.png")}.ui-state-highlight .ui-icon,.ui-button .ui-state-highlight.ui-icon{background-image:url("images/ui-icons_777620_256x240.png")}.ui-state-error .ui-icon,.ui-state-error-text .ui-icon{background-image:url("images/ui-icons_cc0000_256x240.png")}.ui-button .ui-icon{background-image:url("images/ui-icons_777777_256x240.png")}.ui-icon-blank{background-position:16px 16px}.ui-icon-caret-1-n{background-position:0 0}.ui-icon-caret-1-ne{background-position:-16px 0}.ui-icon-caret-1-e{background-position:-32px 0}.ui-icon-caret-1-se{background-position:-48px 0}.ui-icon-caret-1-s{background-position:-65px 0}.ui-icon-caret-1-sw{background-position:-80px 0}.ui-icon-caret-1-w{background-position:-96px 0}.ui-icon-caret-1-nw{background-position:-112px 0}.ui-icon-caret-2-n-s{background-position:-128px 0}.ui-icon-caret-2-e-w{background-position:-144px 0}.ui-icon-triangle-1-n{background-position:0 -16px}.ui-icon-triangle-1-ne{background-position:-16px -16px}.ui-icon-triangle-1-e{background-position:-32px -16px}.ui-icon-triangle-1-se{background-position:-48px -16px}.ui-icon-triangle-1-s{background-position:-65px -16px}.ui-icon-triangle-1-sw{background-position:-80px -16px}.ui-icon-triangle-1-w{background-position:-96px -16px}.ui-icon-triangle-1-nw{background-position:-112px -16px}.ui-icon-triangle-2-n-s{background-position:-128px -16px}.ui-icon-triangle-2-e-w{background-position:-144px -16px}.ui-icon-arrow-1-n{background-position:0 -32px}.ui-icon-arrow-1-ne{background-position:-16px -32px}.ui-icon-arrow-1-e{background-position:-32px -32px}.ui-icon-arrow-1-se{background-position:-48px -32px}.ui-icon-arrow-1-s{background-position:-65px -32px}.ui-icon-arrow-1-sw{background-position:-80px -32px}.ui-icon-arrow-1-w{background-position:-96px -32px}.ui-icon-arrow-1-nw{background-position:-112px -32px}.ui-icon-arrow-2-n-s{background-position:-128px -32px}.ui-icon-arrow-2-ne-sw{background-position:-144px -32px}.ui-icon-arrow-2-e-w{background-position:-160px -32px}.ui-icon-arrow-2-se-nw{background-position:-176px -32px}.ui-icon-arrowstop-1-n{background-position:-192px -32px}.ui-icon-arrowstop-1-e{background-position:-208px -32px}.ui-icon-arrowstop-1-s{background-position:-224px -32px}.ui-icon-arrowstop-1-w{background-position:-240px -32px}.ui-icon-arrowthick-1-n{background-position:1px -48px}.ui-icon-arrowthick-1-ne{background-position:-16px -48px}.ui-icon-arrowthick-1-e{background-position:-32px -48px}.ui-icon-arrowthick-1-se{background-position:-48px -48px}.ui-icon-arrowthick-1-s{background-position:-64px -48px}.ui-icon-arrowthick-1-sw{background-position:-80px -48px}.ui-icon-arrowthick-1-w{background-position:-96px -48px}.ui-icon-arrowthick-1-nw{background-position:-112px -48px}.ui-icon-arrowthick-2-n-s{background-position:-128px -48px}.ui-icon-arrowthick-2-ne-sw{background-position:-144px -48px}.ui-icon-arrowthick-2-e-w{background-position:-160px -48px}.ui-icon-arrowthick-2-se-nw{background-position:-176px -48px}.ui-icon-arrowthickstop-1-n{background-position:-192px -48px}.ui-icon-arrowthickstop-1-e{background-position:-208px -48px}.ui-icon-arrowthickstop-1-s{background-position:-224px -48px}.ui-icon-arrowthickstop-1-w{background-position:-240px -48px}.ui-icon-arrowreturnthick-1-w{background-position:0 -64px}.ui-icon-arrowreturnthick-1-n{background-position:-16px -64px}.ui-icon-arrowreturnthick-1-e{background-position:-32px -64px}.ui-icon-arrowreturnthick-1-s{background-position:-48px -64px}.ui-icon-arrowreturn-1-w{background-position:-64px -64px}.ui-icon-arrowreturn-1-n{background-position:-80px -64px}.ui-icon-arrowreturn-1-e{background-position:-96px -64px}.ui-icon-arrowreturn-1-s{background-position:-112px -64px}.ui-icon-arrowrefresh-1-w{background-position:-128px -64px}.ui-icon-arrowrefresh-1-n{background-position:-144px -64px}.ui-icon-arrowrefresh-1-e{background-position:-160px -64px}.ui-icon-arrowrefresh-1-s{background-position:-176px -64px}.ui-icon-arrow-4{background-position:0 -80px}.ui-icon-arrow-4-diag{background-position:-16px -80px}.ui-icon-extlink{background-position:-32px -80px}.ui-icon-newwin{background-position:-48px -80px}.ui-icon-refresh{background-position:-64px -80px}.ui-icon-shuffle{background-position:-80px -80px}.ui-icon-transfer-e-w{background-position:-96px -80px}.ui-icon-transferthick-e-w{background-position:-112px -80px}.ui-icon-folder-collapsed{background-position:0 -96px}.ui-icon-folder-open{background-position:-16px -96px}.ui-icon-document{background-position:-32px -96px}.ui-icon-document-b{background-position:-48px -96px}.ui-icon-note{background-position:-64px -96px}.ui-icon-mail-closed{background-position:-80px -96px}.ui-icon-mail-open{background-position:-96px -96px}.ui-icon-suitcase{background-position:-112px -96px}.ui-icon-comment{background-position:-128px -96px}.ui-icon-person{background-position:-144px -96px}.ui-icon-print{background-position:-160px -96px}.ui-icon-trash{background-position:-176px -96px}.ui-icon-locked{background-position:-192px -96px}.ui-icon-unlocked{background-position:-208px -96px}.ui-icon-bookmark{background-position:-224px -96px}.ui-icon-tag{background-position:-240px -96px}.ui-icon-home{background-position:0 -112px}.ui-icon-flag{background-position:-16px -112px}.ui-icon-calendar{background-position:-32px -112px}.ui-icon-cart{background-position:-48px -112px}.ui-icon-pencil{background-position:-64px -112px}.ui-icon-clock{background-position:-80px -112px}.ui-icon-disk{background-position:-96px -112px}.ui-icon-calculator{background-position:-112px -112px}.ui-icon-zoomin{background-position:-128px -112px}.ui-icon-zoomout{background-position:-144px -112px}.ui-icon-search{background-position:-160px -112px}.ui-icon-wrench{background-position:-176px -112px}.ui-icon-gear{background-position:-192px -112px}.ui-icon-heart{background-position:-208px -112px}.ui-icon-star{background-position:-224px -112px}.ui-icon-link{background-position:-240px -112px}.ui-icon-cancel{background-position:0 -128px}.ui-icon-plus{background-position:-16px -128px}.ui-icon-plusthick{background-position:-32px -128px}.ui-icon-minus{background-position:-48px -128px}.ui-icon-minusthick{background-position:-64px -128px}.ui-icon-close{background-position:-80px -128px}.ui-icon-closethick{background-position:-96px -128px}.ui-icon-key{background-position:-112px -128px}.ui-icon-lightbulb{background-position:-128px -128px}.ui-icon-scissors{background-position:-144px -128px}.ui-icon-clipboard{background-position:-160px -128px}.ui-icon-copy{background-position:-176px -128px}.ui-icon-contact{background-position:-192px -128px}.ui-icon-image{background-position:-208px -128px}.ui-icon-video{background-position:-224px -128px}.ui-icon-script{background-position:-240px -128px}.ui-icon-alert{background-position:0 -144px}.ui-icon-info{background-position:-16px -144px}.ui-icon-notice{background-position:-32px -144px}.ui-icon-help{background-position:-48px -144px}.ui-icon-check{background-position:-64px -144px}.ui-icon-bullet{background-position:-80px -144px}.ui-icon-radio-on{background-position:-96px -144px}.ui-icon-radio-off{background-position:-112px -144px}.ui-icon-pin-w{background-position:-128px -144px}.ui-icon-pin-s{background-position:-144px -144px}.ui-icon-play{background-position:0 -160px}.ui-icon-pause{background-position:-16px -160px}.ui-icon-seek-next{background-position:-32px -160px}.ui-icon-seek-prev{background-position:-48px -160px}.ui-icon-seek-end{background-position:-64px -160px}.ui-icon-seek-start{background-position:-80px -160px}.ui-icon-seek-first{background-position:-80px -160px}.ui-icon-stop{background-position:-96px -160px}.ui-icon-eject{background-position:-112px -160px}.ui-icon-volume-off{background-position:-128px -160px}.ui-icon-volume-on{background-position:-144px -160px}.ui-icon-power{background-position:0 -176px}.ui-icon-signal-diag{background-position:-16px -176px}.ui-icon-signal{background-position:-32px -176px}.ui-icon-battery-0{background-position:-48px -176px}.ui-icon-battery-1{background-position:-64px -176px}.ui-icon-battery-2{background-position:-80px -176px}.ui-icon-battery-3{background-position:-96px -176px}.ui-icon-circle-plus{background-position:0 -192px}.ui-icon-circle-minus{background-position:-16px -192px}.ui-icon-circle-close{background-position:-32px -192px}.ui-icon-circle-triangle-e{background-position:-48px -192px}.ui-icon-circle-triangle-s{background-position:-64px -192px}.ui-icon-circle-triangle-w{background-position:-80px -192px}.ui-icon-circle-triangle-n{background-position:-96px -192px}.ui-icon-circle-arrow-e{background-position:-112px -192px}.ui-icon-circle-arrow-s{background-position:-128px -192px}.ui-icon-circle-arrow-w{background-position:-144px -192px}.ui-icon-circle-arrow-n{background-position:-160px -192px}.ui-icon-circle-zoomin{background-position:-176px -192px}.ui-icon-circle-zoomout{background-position:-192px -192px}.ui-icon-circle-check{background-position:-208px -192px}.ui-icon-circlesmall-plus{background-position:0 -208px}.ui-icon-circlesmall-minus{background-position:-16px -208px}.ui-icon-circlesmall-close{background-position:-32px -208px}.ui-icon-squaresmall-plus{background-position:-48px -208px}.ui-icon-squaresmall-minus{background-position:-64px -208px}.ui-icon-squaresmall-close{background-position:-80px -208px}.ui-icon-grip-dotted-vertical{background-position:0 -224px}.ui-icon-grip-dotted-horizontal{background-position:-16px -224px}.ui-icon-grip-solid-vertical{background-position:-32px -224px}.ui-icon-grip-solid-horizontal{background-position:-48px -224px}.ui-icon-gripsmall-diagonal-se{background-position:-64px -224px}.ui-icon-grip-diagonal-se{background-position:-80px -224px}.ui-corner-all,.ui-corner-top,.ui-corner-left,.ui-corner-tl{border-top-left-radius:3px}.ui-corner-all,.ui-corner-top,.ui-corner-right,.ui-corner-tr{border-top-right-radius:3px}.ui-corner-all,.ui-corner-bottom,.ui-corner-left,.ui-corner-bl{border-bottom-left-radius:3px}.ui-corner-all,.ui-corner-bottom,.ui-corner-right,.ui-corner-br{border-bottom-right-radius:3px}.ui-widget-overlay{background:#aaa;opacity:.3;filter:Alpha(Opacity=30)}.ui-widget-shadow{-webkit-box-shadow:0 0 5px #666;box-shadow:0 0 5px #666}
i18n/cleantalk.pot CHANGED
@@ -1,1388 +1,1388 @@
1
- #, fuzzy
2
- msgid ""
3
- msgstr ""
4
- "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
5
- "Project-Id-Version: Anti-Spam by CleanTalk\n"
6
- "POT-Creation-Date: 2019-10-27 16:02+0000\n"
7
- "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
8
- "Last-Translator: \n"
9
- "Language-Team: \n"
10
- "MIME-Version: 1.0\n"
11
- "Content-Type: text/plain; charset=UTF-8\n"
12
- "Content-Transfer-Encoding: 8bit\n"
13
- "X-Generator: Loco https://localise.biz/\n"
14
- "X-Poedit-Basepath: ..\n"
15
- "X-Poedit-WPHeader: cleantalk.php\n"
16
- "X-Poedit-SourceCharset: UTF-8\n"
17
- "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
18
- "esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
19
- "_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
20
- "X-Poedit-SearchPath-0: .\n"
21
- "X-Poedit-SearchPathExcluded-0: *.js\n"
22
- "Language: "
23
-
24
- #: inc/classCleantalkComments.php:32 inc/cleantalk-comments.php:16
25
- #: inc/cleantalk-users.php:15
26
- msgid "Check for spam"
27
- msgstr ""
28
-
29
- #: inc/classCleantalkComments.php:33 inc/cleantalk-admin.php:350
30
- #: inc/cleantalk-comments.php:16
31
- msgid "Find spam comments"
32
- msgstr ""
33
-
34
- #: inc/classCleantalkComments.php:66 inc/cleantalk-comments.php:26
35
- #: inc/cleantalk-users.php:25
36
- msgid "Plugin Settings"
37
- msgstr ""
38
-
39
- #: inc/classCleantalkComments.php:76 inc/cleantalk-comments.php:35
40
- #: inc/cleantalk-users.php:34
41
- #, php-format
42
- msgid ""
43
- "Antispam hosting tariff does not allow you to use this feature. To do so, "
44
- "you need to enter an Access Key in the %splugin settings%s."
45
- msgstr ""
46
-
47
- #: inc/classCleantalkComments.php:101 inc/cleantalk-comments.php:60
48
- #: inc/cleantalk-users.php:60
49
- msgid ""
50
- "Ajax error. Process will be automatically restarted in 3 seconds. Status: "
51
- msgstr ""
52
-
53
- #: inc/classCleantalkComments.php:108 inc/cleantalk-comments.php:67
54
- msgid ""
55
- "Please wait for a while. CleanTalk is deleting spam comments. Comments left: "
56
- msgstr ""
57
-
58
- #: inc/classCleantalkComments.php:118 inc/cleantalk-comments.php:77
59
- #: inc/cleantalk-users.php:77
60
- msgid "Start check"
61
- msgstr ""
62
-
63
- #: inc/classCleantalkComments.php:119 inc/cleantalk-comments.php:78
64
- #: inc/cleantalk-users.php:78
65
- msgid "Continue check"
66
- msgstr ""
67
-
68
- #: inc/classCleantalkComments.php:120 inc/cleantalk-comments.php:79
69
- msgid ""
70
- "The plugin will check all comments against blacklists database and show you "
71
- "senders that have spam activity on other websites."
72
- msgstr ""
73
-
74
- #: inc/classCleantalkComments.php:123 inc/cleantalk-comments.php:82
75
- #: inc/cleantalk-users.php:82
76
- msgid "Accurate check"
77
- msgstr ""
78
-
79
- #: inc/classCleantalkComments.php:125 inc/cleantalk-comments.php:84
80
- msgid ""
81
- "Allows to use comment's dates to perform more accurate check. Could "
82
- "seriously slow down the check."
83
- msgstr ""
84
-
85
- #: inc/classCleantalkComments.php:128 inc/cleantalk-comments.php:87
86
- #: inc/cleantalk-users.php:87
87
- msgid "Specify date range"
88
- msgstr ""
89
-
90
- #: inc/classCleantalkComments.php:149 inc/cleantalk-comments.php:108
91
- msgid ""
92
- "Please wait! CleanTalk is checking all approved and pending comments via "
93
- "blacklist database at cleantalk.org. You will have option to delete found "
94
- "spam comments after plugin finish."
95
- msgstr ""
96
-
97
- #: inc/classCleantalkCommentsListTable.php:24
98
- msgid "Author"
99
- msgstr ""
100
-
101
- #: inc/classCleantalkCommentsListTable.php:25 inc/cleantalk-comments.php:158
102
- msgid "Comment"
103
- msgstr ""
104
-
105
- #: inc/classCleantalkCommentsListTable.php:26 inc/cleantalk-comments.php:159
106
- msgid "In Response To"
107
- msgstr ""
108
-
109
- #: inc/classCleantalkCommentsListTable.php:33
110
- msgid "No spam comments."
111
- msgstr ""
112
-
113
- #: inc/cleantalk-admin.php:27
114
- #, php-format
115
- msgid "Find spam %s"
116
- msgstr ""
117
-
118
- #: inc/cleantalk-admin.php:31
119
- msgid "CleanTalk Anti-Spam Log"
120
- msgstr ""
121
-
122
- #: inc/cleantalk-admin.php:50
123
- #, php-format
124
- msgid "%sRefresh%s"
125
- msgstr ""
126
-
127
- #: inc/cleantalk-admin.php:51
128
- #, php-format
129
- msgid "%sConfigure%s"
130
- msgstr ""
131
-
132
- #: inc/cleantalk-admin.php:68
133
- msgid "7 days anti-spam stats"
134
- msgstr ""
135
-
136
- #: inc/cleantalk-admin.php:72
137
- msgid "Top 5 spam IPs blocked"
138
- msgstr ""
139
-
140
- #: inc/cleantalk-admin.php:78
141
- msgid "Get Access key to activate Anti-Spam protection!"
142
- msgstr ""
143
-
144
- #: inc/cleantalk-admin.php:86
145
- #, php-format
146
- msgid "Something went wrong! Error: \"%s\"."
147
- msgstr ""
148
-
149
- #: inc/cleantalk-admin.php:90
150
- msgid "Please, visit your dashboard."
151
- msgstr ""
152
-
153
- #: inc/cleantalk-admin.php:104
154
- msgid "IP"
155
- msgstr ""
156
-
157
- #: inc/cleantalk-admin.php:105
158
- msgid "Country"
159
- msgstr ""
160
-
161
- #: inc/cleantalk-admin.php:106
162
- msgid "Block Count"
163
- msgstr ""
164
-
165
- #: inc/cleantalk-admin.php:134
166
- #, php-format
167
- msgid ""
168
- "This is the count from the %s's cloud and could be different to admin bar "
169
- "counters"
170
- msgstr ""
171
-
172
- #. %s: Number of spam messages
173
- #: inc/cleantalk-admin.php:137
174
- #, php-format
175
- msgid ""
176
- "%s%s%s has blocked %s spam for all time. The statistics are automatically "
177
- "updated every 24 hours."
178
- msgstr ""
179
-
180
- #: inc/cleantalk-admin.php:148 inc/cleantalk-settings.php:544
181
- #, php-format
182
- msgid "Do you like CleanTalk? %sPost your feedback here%s."
183
- msgstr ""
184
-
185
- #: inc/cleantalk-admin.php:234
186
- msgid "Translate"
187
- msgstr ""
188
-
189
- #: inc/cleantalk-admin.php:237
190
- msgid "Start here"
191
- msgstr ""
192
-
193
- #: inc/cleantalk-admin.php:238
194
- msgid "FAQ"
195
- msgstr ""
196
-
197
- #: inc/cleantalk-admin.php:239 inc/cleantalk-admin.php:644
198
- #: inc/cleantalk-settings.php:575
199
- msgid "Support"
200
- msgstr ""
201
-
202
- #: inc/cleantalk-admin.php:306 inc/cleantalk-settings.php:523
203
- msgid "Hosting AntiSpam"
204
- msgstr ""
205
-
206
- #: inc/cleantalk-admin.php:333
207
- msgid "Failed from timeout. Going to check comments again."
208
- msgstr ""
209
-
210
- #: inc/cleantalk-admin.php:334
211
- msgid "Added"
212
- msgstr ""
213
-
214
- #: inc/cleantalk-admin.php:335 inc/cleantalk-admin.php:386
215
- msgid "Deleted"
216
- msgstr ""
217
-
218
- #: inc/cleantalk-admin.php:336
219
- msgid "comments"
220
- msgstr ""
221
-
222
- #: inc/cleantalk-admin.php:337
223
- msgid "Delete all spam comments?"
224
- msgstr ""
225
-
226
- #: inc/cleantalk-admin.php:338
227
- msgid "Delete checked comments?"
228
- msgstr ""
229
-
230
- #: inc/cleantalk-admin.php:339
231
- #, php-format
232
- msgid ""
233
- "Total comments %s. Checked %s. Found %s spam comments. %s bad comments "
234
- "(without IP or email)."
235
- msgstr ""
236
-
237
- #: inc/cleantalk-admin.php:340 inc/cleantalk-admin.php:393
238
- #: inc/cleantalk-users.php:531
239
- msgid "Please do backup of WordPress database before delete any accounts!"
240
- msgstr ""
241
-
242
- #: inc/cleantalk-admin.php:351
243
- msgid "The sender has been whitelisted."
244
- msgstr ""
245
-
246
- #: inc/cleantalk-admin.php:352
247
- msgid "The sender has been blacklisted."
248
- msgstr ""
249
-
250
- #: inc/cleantalk-admin.php:353 inc/cleantalk-public.php:3321
251
- #, php-format
252
- msgid "Feedback has been sent to %sCleanTalk Dashboard%s."
253
- msgstr ""
254
-
255
- #: inc/cleantalk-admin.php:383
256
- msgid "Failed from timeout. Going to check users again."
257
- msgstr ""
258
-
259
- #: inc/cleantalk-admin.php:384
260
- msgid "Failed from timeout. Going to run a new attempt to delete spam users."
261
- msgstr ""
262
-
263
- #: inc/cleantalk-admin.php:385
264
- msgid "Inserted"
265
- msgstr ""
266
-
267
- #: inc/cleantalk-admin.php:387
268
- msgid "users."
269
- msgstr ""
270
-
271
- #: inc/cleantalk-admin.php:388
272
- msgid "Delete all spam users?"
273
- msgstr ""
274
-
275
- #: inc/cleantalk-admin.php:389
276
- msgid "Delete checked users?"
277
- msgstr ""
278
-
279
- #: inc/cleantalk-admin.php:392
280
- #, php-format
281
- msgid ""
282
- "Total users %s, checked %s, found %s spam users and %s bad users (without IP "
283
- "or email)"
284
- msgstr ""
285
-
286
- #: inc/cleantalk-admin.php:401
287
- msgid "Find spam-users"
288
- msgstr ""
289
-
290
- #: inc/cleantalk-admin.php:449
291
- #, php-format
292
- msgid "Unable to get Access key automatically: %s"
293
- msgstr ""
294
-
295
- #: inc/cleantalk-admin.php:450
296
- msgid "Get the Access key"
297
- msgstr ""
298
-
299
- #: inc/cleantalk-admin.php:459
300
- #, php-format
301
- msgid "Please enter Access Key in %s settings to enable anti spam protection!"
302
- msgstr ""
303
-
304
- #: inc/cleantalk-admin.php:469
305
- #, php-format
306
- msgid "%s trial period ends, please upgrade to %s!"
307
- msgstr ""
308
-
309
- #: inc/cleantalk-admin.php:481
310
- msgid "RENEW ANTI-SPAM"
311
- msgstr ""
312
-
313
- #: inc/cleantalk-admin.php:482
314
- msgid "next year"
315
- msgstr ""
316
-
317
- #: inc/cleantalk-admin.php:486
318
- #, php-format
319
- msgid "Please renew your anti-spam license for %s."
320
- msgstr ""
321
-
322
- #: inc/cleantalk-admin.php:511
323
- msgid "Make it right!"
324
- msgstr ""
325
-
326
- #: inc/cleantalk-admin.php:513
327
- #, php-format
328
- msgid "%sGet premium%s"
329
- msgstr ""
330
-
331
- #: inc/cleantalk-admin.php:552
332
- msgid "Since"
333
- msgstr ""
334
-
335
- #: inc/cleantalk-admin.php:558
336
- msgid ""
337
- "All / Allowed / Blocked submissions. The number of submissions is being "
338
- "counted since CleanTalk plugin installation."
339
- msgstr ""
340
-
341
- #: inc/cleantalk-admin.php:558
342
- msgid "All"
343
- msgstr ""
344
-
345
- #: inc/cleantalk-admin.php:566
346
- msgid ""
347
- "Allowed / Blocked submissions. The number of submissions for past 24 hours. "
348
- msgstr ""
349
-
350
- #: inc/cleantalk-admin.php:566
351
- msgid "Day"
352
- msgstr ""
353
-
354
- #: inc/cleantalk-admin.php:572
355
- msgid ""
356
- "All / Blocked events. Access attempts regitred by SpamFireWall counted since "
357
- "the last plugin activation."
358
- msgstr ""
359
-
360
- #: inc/cleantalk-admin.php:582
361
- msgid ""
362
- "Allowed / Blocked submissions. The number of submissions is being counted "
363
- "since "
364
- msgstr ""
365
-
366
- #: inc/cleantalk-admin.php:593
367
- msgid "dashboard"
368
- msgstr ""
369
-
370
- #: inc/cleantalk-admin.php:600
371
- msgid "Settings"
372
- msgstr ""
373
-
374
- #: inc/cleantalk-admin.php:608
375
- msgid "Bulk spam comments removal tool."
376
- msgstr ""
377
-
378
- #: inc/cleantalk-admin.php:608 inc/cleantalk-settings.php:882
379
- msgid "Check comments for spam"
380
- msgstr ""
381
-
382
- #: inc/cleantalk-admin.php:618 inc/cleantalk-settings.php:885
383
- msgid "Check users for spam"
384
- msgstr ""
385
-
386
- #: inc/cleantalk-admin.php:627
387
- msgid "Reset first counter"
388
- msgstr ""
389
-
390
- #: inc/cleantalk-admin.php:635
391
- msgid "Reset all counters"
392
- msgstr ""
393
-
394
- #: inc/cleantalk-comments.php:221 inc/cleantalk-users.php:220
395
- msgid "Approve"
396
- msgstr ""
397
-
398
- #: inc/cleantalk-comments.php:223 inc/cleantalk-users.php:222
399
- msgid "Delete"
400
- msgstr ""
401
-
402
- #: inc/cleantalk-comments.php:265
403
- msgid "Delete all comments from the list"
404
- msgstr ""
405
-
406
- #: inc/cleantalk-comments.php:266 inc/cleantalk-users.php:268
407
- msgid "Delete selected"
408
- msgstr ""
409
-
410
- #: inc/cleantalk-comments.php:270
411
- msgid "Insert comments"
412
- msgstr ""
413
-
414
- #: inc/cleantalk-comments.php:271
415
- msgid "Delete comments"
416
- msgstr ""
417
-
418
- #: inc/cleantalk-comments.php:276 inc/cleantalk-users.php:279
419
- msgid ""
420
- "There is some differencies between blacklists database and our API "
421
- "mechanisms. Blacklists shows all history of spam activity, but our API (that "
422
- "used in spam checking) used another parameters, too: last day of activity, "
423
- "number of spam attacks during last days etc. This mechanisms help us to "
424
- "reduce number of false positivitie. So, there is nothing strange, if some "
425
- "emails/IPs will be not found by this checking."
426
- msgstr ""
427
-
428
- #: inc/cleantalk-comments.php:281 inc/cleantalk-users.php:284
429
- msgid "Stop deletion"
430
- msgstr ""
431
-
432
- #: inc/cleantalk-comments.php:495
433
- #, php-format
434
- msgid ""
435
- "Total comments %s. Checked %s. Last check %s. Found %s spam comments. %s bad "
436
- "comments (without IP or email)."
437
- msgstr ""
438
-
439
- #: inc/cleantalk-comments.php:499
440
- msgid "Please do backup of WordPress database before delete any comments!"
441
- msgstr ""
442
-
443
- #: inc/cleantalk-public.php:500 inc/cleantalk-public.php:641
444
- #: inc/cleantalk-public.php:743 inc/cleantalk-public.php:2363
445
- #: inc/cleantalk-public.php:3052
446
- msgid "Spam protection by CleanTalk"
447
- msgstr ""
448
-
449
- #: inc/cleantalk-public.php:1233 inc/cleantalk-public.php:1361
450
- #: inc/cleantalk-public.php:1379
451
- msgid "Spam protection"
452
- msgstr ""
453
-
454
- #: inc/cleantalk-public.php:1332
455
- msgid "CleanTalk AntiSpam: This message is possible spam."
456
- msgstr ""
457
-
458
- #: inc/cleantalk-public.php:1333
459
- msgid "You could check it in CleanTalk's anti-spam database:"
460
- msgstr ""
461
-
462
- #: inc/cleantalk-public.php:1569
463
- #, php-format
464
- msgid "Registration approved by %s."
465
- msgstr ""
466
-
467
- #: inc/cleantalk-public.php:1849
468
- msgid "CleanTalk AntiSpam: This registration is spam."
469
- msgstr ""
470
-
471
- #: inc/cleantalk-public.php:1850 inc/cleantalk-public.php:2219
472
- #: inc/cleantalk-public.php:2387 inc/cleantalk-public.php:2542
473
- msgid "CleanTalk's anti-spam database:"
474
- msgstr ""
475
-
476
- #: inc/cleantalk-public.php:2218 inc/cleantalk-public.php:2386
477
- #: inc/cleantalk-public.php:2541
478
- msgid "CleanTalk AntiSpam: This message is spam."
479
- msgstr ""
480
-
481
- #: inc/cleantalk-public.php:2666
482
- msgid "Comment approved. Anti-spam by CleanTalk."
483
- msgstr ""
484
-
485
- #: inc/cleantalk-public.php:3219
486
- msgid "Attention, please!"
487
- msgstr ""
488
-
489
- #: inc/cleantalk-public.php:3220
490
- #, php-format
491
- msgid "\"%s\" plugin error on your site \"%s\":"
492
- msgstr ""
493
-
494
- #: inc/cleantalk-public.php:3222
495
- #, php-format
496
- msgid "[%s] \"%s\" error!"
497
- msgstr ""
498
-
499
- #: inc/cleantalk-public.php:3271
500
- msgid ""
501
- "By using this form you agree with the storage and processing of your data by "
502
- "using the Privacy Policy on this website."
503
- msgstr ""
504
-
505
- #: inc/cleantalk-public.php:3319
506
- msgid "Error occured while sending feedback."
507
- msgstr ""
508
-
509
- #: inc/cleantalk-public.php:3320
510
- msgid "Feedback wasn't sent. There is no associated request."
511
- msgstr ""
512
-
513
- #: inc/cleantalk-public.php:3364
514
- msgid "Sender info"
515
- msgstr ""
516
-
517
- #: inc/cleantalk-public.php:3367
518
- msgid "by"
519
- msgstr ""
520
-
521
- #: inc/cleantalk-public.php:3378
522
- msgid "No email"
523
- msgstr ""
524
-
525
- #: inc/cleantalk-public.php:3388
526
- msgid "No IP"
527
- msgstr ""
528
-
529
- #: inc/cleantalk-public.php:3391
530
- msgid "Mark as spam"
531
- msgstr ""
532
-
533
- #: inc/cleantalk-public.php:3392
534
- msgid "Unspam"
535
- msgstr ""
536
-
537
- #: inc/cleantalk-public.php:3394
538
- msgid "Marked as spam."
539
- msgstr ""
540
-
541
- #: inc/cleantalk-public.php:3395
542
- msgid "Marked as not spam."
543
- msgstr ""
544
-
545
- #: inc/cleantalk-settings.php:96
546
- msgid "SpamFireWall"
547
- msgstr ""
548
-
549
- #: inc/cleantalk-settings.php:97
550
- msgid ""
551
- "This option allows to filter spam bots before they access website. Also "
552
- "reduces CPU usage on hosting server and accelerates pages load time."
553
- msgstr ""
554
-
555
- #: inc/cleantalk-settings.php:104
556
- msgid "Forms to protect"
557
- msgstr ""
558
-
559
- #: inc/cleantalk-settings.php:110
560
- msgid "Advanced settings"
561
- msgstr ""
562
-
563
- #: inc/cleantalk-settings.php:117
564
- msgid "Registration Forms"
565
- msgstr ""
566
-
567
- #: inc/cleantalk-settings.php:118
568
- msgid "WordPress, BuddyPress, bbPress, S2Member, WooCommerce."
569
- msgstr ""
570
-
571
- #: inc/cleantalk-settings.php:121
572
- msgid "Comments form"
573
- msgstr ""
574
-
575
- #: inc/cleantalk-settings.php:122
576
- msgid "WordPress, JetPack, WooCommerce."
577
- msgstr ""
578
-
579
- #: inc/cleantalk-settings.php:125 inc/cleantalk-settings.php:761
580
- msgid "Contact forms"
581
- msgstr ""
582
-
583
- #: inc/cleantalk-settings.php:126
584
- msgid ""
585
- "Contact Form 7, Formidable forms, JetPack, Fast Secure Contact Form, "
586
- "WordPress Landing Pages, Gravity Forms."
587
- msgstr ""
588
-
589
- #: inc/cleantalk-settings.php:129 inc/cleantalk-settings.php:762
590
- msgid "Custom contact forms"
591
- msgstr ""
592
-
593
- #: inc/cleantalk-settings.php:130
594
- msgid "Anti spam test for any WordPress themes or contacts forms."
595
- msgstr ""
596
-
597
- #: inc/cleantalk-settings.php:133 inc/cleantalk-settings.php:775
598
- msgid "WooCommerce checkout form"
599
- msgstr ""
600
-
601
- #: inc/cleantalk-settings.php:134
602
- msgid "Anti spam test for WooCommerce checkout form."
603
- msgstr ""
604
-
605
- #: inc/cleantalk-settings.php:138
606
- msgid "Spam test for registration during checkout"
607
- msgstr ""
608
-
609
- #: inc/cleantalk-settings.php:139
610
- msgid ""
611
- "Enable anti spam test for registration process which during woocommerce's "
612
- "checkout."
613
- msgstr ""
614
-
615
- #: inc/cleantalk-settings.php:145
616
- msgid "Test default Wordpress search form for spam"
617
- msgstr ""
618
-
619
- #: inc/cleantalk-settings.php:146
620
- msgid "Spam protection for Search form."
621
- msgstr ""
622
-
623
- #: inc/cleantalk-settings.php:148
624
- #, php-format
625
- msgid "Read more about %sspam protection for Search form%s on our blog."
626
- msgstr ""
627
-
628
- #: inc/cleantalk-settings.php:156
629
- msgid "Protect external forms"
630
- msgstr ""
631
-
632
- #: inc/cleantalk-settings.php:157
633
- msgid ""
634
- "Turn this option on to protect forms on your WordPress that send data to "
635
- "third-part servers (like MailChimp)."
636
- msgstr ""
637
-
638
- #: inc/cleantalk-settings.php:161
639
- msgid "Capture buffer"
640
- msgstr ""
641
-
642
- #: inc/cleantalk-settings.php:162
643
- msgid ""
644
- "This setting gives you more sophisticated and strengthened protection for "
645
- "external forms. But it could break plugins which use a buffer like Ninja "
646
- "Forms."
647
- msgstr ""
648
-
649
- #: inc/cleantalk-settings.php:167
650
- msgid "Protect internal forms"
651
- msgstr ""
652
-
653
- #: inc/cleantalk-settings.php:168
654
- msgid ""
655
- "This option will enable protection for custom (hand-made) AJAX forms with "
656
- "PHP scripts handlers on your WordPress."
657
- msgstr ""
658
-
659
- #: inc/cleantalk-settings.php:175
660
- msgid "Comments and Messages"
661
- msgstr ""
662
-
663
- #: inc/cleantalk-settings.php:178
664
- msgid "BuddyPress Private Messages"
665
- msgstr ""
666
-
667
- #: inc/cleantalk-settings.php:179
668
- msgid "Check buddyPress private messages."
669
- msgstr ""
670
-
671
- #: inc/cleantalk-settings.php:182
672
- msgid "Don't check trusted user's comments"
673
- msgstr ""
674
-
675
- #: inc/cleantalk-settings.php:183
676
- #, php-format
677
- msgid "Don't check comments for users with above %d comments."
678
- msgstr ""
679
-
680
- #: inc/cleantalk-settings.php:186
681
- msgid "Automatically delete spam comments"
682
- msgstr ""
683
-
684
- #: inc/cleantalk-settings.php:187
685
- #, php-format
686
- msgid "Delete spam comments older than %d days."
687
- msgstr ""
688
-
689
- #: inc/cleantalk-settings.php:190
690
- msgid "Remove links from approved comments"
691
- msgstr ""
692
-
693
- #: inc/cleantalk-settings.php:191
694
- msgid "Remove links from approved comments. Replace it with \"[Link deleted]\""
695
- msgstr ""
696
-
697
- #: inc/cleantalk-settings.php:194
698
- msgid "Show links to check Emails, IPs for spam."
699
- msgstr ""
700
-
701
- #: inc/cleantalk-settings.php:195
702
- msgid ""
703
- "Shows little icon near IP addresses and Emails allowing you to check it via "
704
- "CleanTalk's database. Also allowing you to manage comments from the public "
705
- "post's page."
706
- msgstr ""
707
-
708
- #: inc/cleantalk-settings.php:203
709
- msgid "Data Processing"
710
- msgstr ""
711
-
712
- #: inc/cleantalk-settings.php:206
713
- msgid "Protect logged in Users"
714
- msgstr ""
715
-
716
- #: inc/cleantalk-settings.php:207
717
- msgid ""
718
- "Turn this option on to check for spam any submissions (comments, contact "
719
- "forms and etc.) from registered Users."
720
- msgstr ""
721
-
722
- #: inc/cleantalk-settings.php:210
723
- msgid "Use AJAX for JavaScript check"
724
- msgstr ""
725
-
726
- #: inc/cleantalk-settings.php:211
727
- msgid ""
728
- "Options helps protect WordPress against spam with any caching plugins. Turn "
729
- "this option on to avoid issues with caching plugins."
730
- msgstr ""
731
-
732
- #: inc/cleantalk-settings.php:214
733
- msgid "Use static keys for JS check."
734
- msgstr ""
735
-
736
- #: inc/cleantalk-settings.php:215
737
- msgid ""
738
- "Could help if you have cache for AJAX requests and you are dealing with "
739
- "false positives. Slightly decreases protection quality. Auto - Static key "
740
- "will be used if caching plugin is spotted."
741
- msgstr ""
742
-
743
- #: inc/cleantalk-settings.php:223
744
- msgid "Check all post data"
745
- msgstr ""
746
-
747
- #: inc/cleantalk-settings.php:224
748
- msgid ""
749
- "Check all POST submissions from website visitors. Enable this option if you "
750
- "have spam misses on website."
751
- msgstr ""
752
-
753
- #: inc/cleantalk-settings.php:226
754
- msgid " Or you don`t have records about missed spam here:"
755
- msgstr ""
756
-
757
- #: inc/cleantalk-settings.php:226
758
- msgid "CleanTalk dashboard"
759
- msgstr ""
760
-
761
- #: inc/cleantalk-settings.php:229
762
- msgid "СAUTION! Option can catch POST requests in WordPress backend"
763
- msgstr ""
764
-
765
- #: inc/cleantalk-settings.php:232
766
- msgid "Set cookies"
767
- msgstr ""
768
-
769
- #: inc/cleantalk-settings.php:233
770
- msgid ""
771
- "Turn this option off to deny plugin generates any cookies on website front-"
772
- "end. This option is helpful if you use Varnish. But most of contact forms "
773
- "will not be protected if the option is turned off! <b>Warning: We strongly "
774
- "recommend you to enable this otherwise it could cause false positives spam "
775
- "detection.</b>"
776
- msgstr ""
777
-
778
- #: inc/cleantalk-settings.php:237
779
- msgid "Use alternative mechanism for cookies"
780
- msgstr ""
781
-
782
- #: inc/cleantalk-settings.php:238 inc/cleantalk-settings.php:360
783
- msgid "Doesn't use cookie or PHP sessions. Collect data for all types of bots."
784
- msgstr ""
785
-
786
- #: inc/cleantalk-settings.php:243
787
- msgid "Use SSL"
788
- msgstr ""
789
-
790
- #: inc/cleantalk-settings.php:244
791
- msgid "Turn this option on to use encrypted (SSL) connection with servers."
792
- msgstr ""
793
-
794
- #: inc/cleantalk-settings.php:247
795
- msgid "Use Wordpress HTTP API"
796
- msgstr ""
797
-
798
- #: inc/cleantalk-settings.php:248
799
- msgid ""
800
- "Alternative way to connect the Cloud. Use this if you have connection "
801
- "problems."
802
- msgstr ""
803
-
804
- #: inc/cleantalk-settings.php:255
805
- msgid "Exclusions"
806
- msgstr ""
807
-
808
- #: inc/cleantalk-settings.php:259
809
- msgid "URL exclusions"
810
- msgstr ""
811
-
812
- #: inc/cleantalk-settings.php:260
813
- msgid "You could type here URL you want to exclude. Use comma as separator."
814
- msgstr ""
815
-
816
- #: inc/cleantalk-settings.php:264
817
- msgid "Use Regular Expression in URL Exclusions"
818
- msgstr ""
819
-
820
- #: inc/cleantalk-settings.php:268
821
- msgid "Field name exclusions"
822
- msgstr ""
823
-
824
- #: inc/cleantalk-settings.php:269
825
- msgid ""
826
- "You could type here fields names you want to exclude. Use comma as separator."
827
- msgstr ""
828
-
829
- #: inc/cleantalk-settings.php:273
830
- msgid "Use Regular Expression in Field Exclusions"
831
- msgstr ""
832
-
833
- #: inc/cleantalk-settings.php:280
834
- msgid "Roles which bypass spam test. Hold CTRL to select multiple roles."
835
- msgstr ""
836
-
837
- #: inc/cleantalk-settings.php:287
838
- msgid "Admin bar"
839
- msgstr ""
840
-
841
- #: inc/cleantalk-settings.php:294
842
- msgid "Show statistics in admin bar"
843
- msgstr ""
844
-
845
- #: inc/cleantalk-settings.php:295
846
- msgid ""
847
- "Show/hide icon in top level menu in WordPress backend. The number of "
848
- "submissions is being counted for past 24 hours."
849
- msgstr ""
850
-
851
- #: inc/cleantalk-settings.php:299
852
- msgid "Show All-time counter"
853
- msgstr ""
854
-
855
- #: inc/cleantalk-settings.php:300
856
- msgid ""
857
- "Display all-time requests counter in the admin bar. Counter displays number "
858
- "of requests since plugin installation."
859
- msgstr ""
860
-
861
- #: inc/cleantalk-settings.php:305
862
- msgid "Show 24 hours counter"
863
- msgstr ""
864
-
865
- #: inc/cleantalk-settings.php:306
866
- msgid ""
867
- "Display daily requests counter in the admin bar. Counter displays number of "
868
- "requests of the past 24 hours."
869
- msgstr ""
870
-
871
- #: inc/cleantalk-settings.php:311
872
- msgid "SpamFireWall counter"
873
- msgstr ""
874
-
875
- #: inc/cleantalk-settings.php:312
876
- msgid ""
877
- "Display SpamFireWall requests in the admin bar. Counter displays number of "
878
- "requests since plugin installation."
879
- msgstr ""
880
-
881
- #: inc/cleantalk-settings.php:325
882
- msgid "Collect details about browsers"
883
- msgstr ""
884
-
885
- #: inc/cleantalk-settings.php:326
886
- msgid ""
887
- "Checking this box you allow plugin store information about screen size and "
888
- "browser plugins of website visitors. The option in a beta state."
889
- msgstr ""
890
-
891
- #: inc/cleantalk-settings.php:330
892
- msgid "Send connection reports"
893
- msgstr ""
894
-
895
- #: inc/cleantalk-settings.php:331
896
- msgid ""
897
- "Checking this box you allow plugin to send the information about your "
898
- "connection. The option in a beta state."
899
- msgstr ""
900
-
901
- #: inc/cleantalk-settings.php:335
902
- msgid "Async JavaScript loading"
903
- msgstr ""
904
-
905
- #: inc/cleantalk-settings.php:336
906
- msgid ""
907
- "Use async loading for scripts. Warning: This could reduce filtration quality."
908
- msgstr ""
909
-
910
- #: inc/cleantalk-settings.php:340
911
- msgid "Allow to add GDPR notice via shortcode"
912
- msgstr ""
913
-
914
- #: inc/cleantalk-settings.php:341
915
- msgid ""
916
- " Adds small checkbox under your website form. To add it you should use the "
917
- "shortcode on the form's page: [cleantalk_gdpr_form id=\"FORM_ID\"]"
918
- msgstr ""
919
-
920
- #: inc/cleantalk-settings.php:346
921
- msgid "GDPR text notice"
922
- msgstr ""
923
-
924
- #: inc/cleantalk-settings.php:347
925
- msgid "This text will be added as a description to the GDPR checkbox."
926
- msgstr ""
927
-
928
- #: inc/cleantalk-settings.php:353
929
- msgid "Store visited URLs"
930
- msgstr ""
931
-
932
- #: inc/cleantalk-settings.php:354
933
- msgid ""
934
- "Plugin stores last 10 visited URLs (HTTP REFFERERS) before visitor submits "
935
- "form on the site. You can see stored visited URLS for each visitor in your "
936
- "Dashboard. Turn the option on to improve Anti-Spam protection."
937
- msgstr ""
938
-
939
- #: inc/cleantalk-settings.php:359
940
- msgid "Use cookies less sessions"
941
- msgstr ""
942
-
943
- #: inc/cleantalk-settings.php:366
944
- msgid ""
945
- "Notify users with selected roles about new approved comments. Hold CTRL to "
946
- "select multiple roles."
947
- msgstr ""
948
-
949
- #: inc/cleantalk-settings.php:367
950
- #, php-format
951
- msgid "If enabled, overrides similar Wordpress %sdiscussion settings%s."
952
- msgstr ""
953
-
954
- #: inc/cleantalk-settings.php:380
955
- msgid "Complete deactivation"
956
- msgstr ""
957
-
958
- #: inc/cleantalk-settings.php:381
959
- msgid "Leave no trace in the system after deactivation."
960
- msgstr ""
961
-
962
- #: inc/cleantalk-settings.php:398
963
- msgid "Enable White Label Mode"
964
- msgstr ""
965
-
966
- #: inc/cleantalk-settings.php:399
967
- #, php-format
968
- msgid "Learn more information %shere%s."
969
- msgstr ""
970
-
971
- #: inc/cleantalk-settings.php:404
972
- msgid "Hoster API Key"
973
- msgstr ""
974
-
975
- #: inc/cleantalk-settings.php:405
976
- #, php-format
977
- msgid "You can get it in %sCleantalk's Control Panel%s"
978
- msgstr ""
979
-
980
- #: inc/cleantalk-settings.php:413
981
- msgid "Plugin name"
982
- msgstr ""
983
-
984
- #: inc/cleantalk-settings.php:414
985
- #, php-format
986
- msgid "Specify plugin name. Leave empty for deafult %sAntispam by Cleantalk%s"
987
- msgstr ""
988
-
989
- #: inc/cleantalk-settings.php:423
990
- msgid "Allow users to use other key"
991
- msgstr ""
992
-
993
- #: inc/cleantalk-settings.php:424
994
- msgid ""
995
- "Allow users to use different Access key in their plugin settings on child "
996
- "blogs. They could use different CleanTalk account."
997
- msgstr ""
998
-
999
- #: inc/cleantalk-settings.php:427
1000
- msgid ""
1001
- "Constant <b>CLEANTALK_ACCESS_KEY</b> is set. All websites will use API key "
1002
- "from this constant. Look into wp-config.php"
1003
- msgstr ""
1004
-
1005
- #: inc/cleantalk-settings.php:533
1006
- msgid "CleanTalk's tech support:"
1007
- msgstr ""
1008
-
1009
- #: inc/cleantalk-settings.php:539
1010
- msgid "Plugin Homepage at"
1011
- msgstr ""
1012
-
1013
- #: inc/cleantalk-settings.php:540
1014
- msgid "GDPR compliance"
1015
- msgstr ""
1016
-
1017
- #: inc/cleantalk-settings.php:541
1018
- msgid "Use s@cleantalk.org to test plugin in any WordPress form."
1019
- msgstr ""
1020
-
1021
- #: inc/cleantalk-settings.php:542
1022
- msgid "CleanTalk is registered Trademark. All rights reserved."
1023
- msgstr ""
1024
-
1025
- #: inc/cleantalk-settings.php:559
1026
- #, php-format
1027
- msgid "%s has blocked <b>%s</b> spam."
1028
- msgstr ""
1029
-
1030
- #: inc/cleantalk-settings.php:571
1031
- msgid "Click here to get anti-spam statistics"
1032
- msgstr ""
1033
-
1034
- #: inc/cleantalk-settings.php:614
1035
- #, php-format
1036
- msgid "Please, enter the %splugin settings%s in main site dashboard."
1037
- msgstr ""
1038
-
1039
- #: inc/cleantalk-settings.php:633
1040
- msgid "Error occured while API key validating. Error: "
1041
- msgstr ""
1042
-
1043
- #: inc/cleantalk-settings.php:634
1044
- msgid "Error occured while automatically gettings access key. Error: "
1045
- msgstr ""
1046
-
1047
- #: inc/cleantalk-settings.php:635
1048
- msgid "Error occured while sending sending SpamFireWall logs. Error: "
1049
- msgstr ""
1050
-
1051
- #: inc/cleantalk-settings.php:636
1052
- msgid "Error occured while updating SpamFireWall local base. Error: "
1053
- msgstr ""
1054
-
1055
- #: inc/cleantalk-settings.php:637
1056
- msgid "Error occured while checking account status. Error: "
1057
- msgstr ""
1058
-
1059
- #: inc/cleantalk-settings.php:638
1060
- msgid "Error occured while excuting API call. Error: "
1061
- msgstr ""
1062
-
1063
- #: inc/cleantalk-settings.php:646
1064
- msgid "Unknown error. Error: "
1065
- msgstr ""
1066
-
1067
- #: inc/cleantalk-settings.php:677
1068
- msgid "Errors:"
1069
- msgstr ""
1070
-
1071
- #: inc/cleantalk-settings.php:682
1072
- #, php-format
1073
- msgid "You can get support any time here: %s."
1074
- msgstr ""
1075
-
1076
- #: inc/cleantalk-settings.php:757
1077
- msgid "Protection is active"
1078
- msgstr ""
1079
-
1080
- #: inc/cleantalk-settings.php:759
1081
- msgid "Registration forms"
1082
- msgstr ""
1083
-
1084
- #: inc/cleantalk-settings.php:760
1085
- msgid "Comments forms"
1086
- msgstr ""
1087
-
1088
- #: inc/cleantalk-settings.php:765
1089
- msgid "Validate email for existence"
1090
- msgstr ""
1091
-
1092
- #: inc/cleantalk-settings.php:769
1093
- msgid "Auto update"
1094
- msgstr ""
1095
-
1096
- #: inc/cleantalk-settings.php:793
1097
- msgid "<h3>Key is provided by Super Admin.</h3>"
1098
- msgstr ""
1099
-
1100
- #: inc/cleantalk-settings.php:797
1101
- msgid "Access key"
1102
- msgstr ""
1103
-
1104
- #: inc/cleantalk-settings.php:812
1105
- msgid "Enter the key"
1106
- msgstr ""
1107
-
1108
- #: inc/cleantalk-settings.php:818
1109
- #, php-format
1110
- msgid "Account at cleantalk.org is %s."
1111
- msgstr ""
1112
-
1113
- #: inc/cleantalk-settings.php:827
1114
- msgid "Show the access key"
1115
- msgstr ""
1116
-
1117
- #: inc/cleantalk-settings.php:838
1118
- msgid "Get Access Key Automatically"
1119
- msgstr ""
1120
-
1121
- #: inc/cleantalk-settings.php:846
1122
- #, php-format
1123
- msgid ""
1124
- "Admin e-mail (%s) will be used for registration, if you want to use other "
1125
- "email please %sGet Access Key Manually%s."
1126
- msgstr ""
1127
-
1128
- #: inc/cleantalk-settings.php:862
1129
- #, php-format
1130
- msgid "I accept %sLicense Agreement%s."
1131
- msgstr ""
1132
-
1133
- #: inc/cleantalk-settings.php:888
1134
- msgid "Statistics & Reports"
1135
- msgstr ""
1136
-
1137
- #: inc/cleantalk-settings.php:904
1138
- #, php-format
1139
- msgid "Last spam check request to %s server was at %s."
1140
- msgstr ""
1141
-
1142
- #: inc/cleantalk-settings.php:905 inc/cleantalk-settings.php:906
1143
- #: inc/cleantalk-settings.php:915 inc/cleantalk-settings.php:922
1144
- #: inc/cleantalk-settings.php:923 inc/cleantalk-settings.php:931
1145
- #: inc/cleantalk-settings.php:932 inc/cleantalk-settings.php:939
1146
- #: inc/cleantalk-settings.php:940
1147
- msgid "unknown"
1148
- msgstr ""
1149
-
1150
- #: inc/cleantalk-settings.php:912
1151
- #, php-format
1152
- msgid "Average request time for past 7 days: %s seconds."
1153
- msgstr ""
1154
-
1155
- #: inc/cleantalk-settings.php:921
1156
- #, php-format
1157
- msgid "Last time SpamFireWall was triggered for %s IP at %s"
1158
- msgstr ""
1159
-
1160
- #: inc/cleantalk-settings.php:930
1161
- #, php-format
1162
- msgid "SpamFireWall was updated %s. Now contains %s entries."
1163
- msgstr ""
1164
-
1165
- #: inc/cleantalk-settings.php:938
1166
- #, php-format
1167
- msgid "SpamFireWall sent %s events at %s."
1168
- msgstr ""
1169
-
1170
- #: inc/cleantalk-settings.php:948
1171
- msgid "There are no failed connections to server."
1172
- msgstr ""
1173
-
1174
- #: inc/cleantalk-settings.php:975
1175
- msgid "Send report"
1176
- msgstr ""
1177
-
1178
- #: inc/cleantalk-settings.php:979
1179
- msgid ""
1180
- "Please, enable \"Send connection reports\" setting to be able to send reports"
1181
- msgstr ""
1182
-
1183
- #: inc/cleantalk-settings.php:1327
1184
- msgid "Testing is failed. Please check the Access key."
1185
- msgstr ""
1186
-
1187
- #: inc/cleantalk-settings.php:1442
1188
- msgid "XSS check"
1189
- msgstr ""
1190
-
1191
- #: inc/cleantalk-settings.php:1443
1192
- msgid ""
1193
- "Cross-Site Scripting (XSS) — prevents malicious code to be executed/sent to "
1194
- "any user. As a result malicious scripts can not get access to the cookie "
1195
- "files, session tokens and any other confidential information browsers use "
1196
- "and store. Such scripts can even overwrite content of HTML pages. CleanTalk "
1197
- "WAF monitors for patterns of these parameters and block them."
1198
- msgstr ""
1199
-
1200
- #: inc/cleantalk-settings.php:1446
1201
- msgid "SQL-injection check"
1202
- msgstr ""
1203
-
1204
- #: inc/cleantalk-settings.php:1447
1205
- msgid ""
1206
- "SQL Injection — one of the most popular ways to hack websites and programs "
1207
- "that work with databases. It is based on injection of a custom SQL code into "
1208
- "database queries. It could transmit data through GET, POST requests or "
1209
- "cookie files in an SQL code. If a website is vulnerable and execute such "
1210
- "injections then it would allow attackers to apply changes to the website's "
1211
- "MySQL database."
1212
- msgstr ""
1213
-
1214
- #: inc/cleantalk-settings.php:1450
1215
- msgid "Check uploaded files"
1216
- msgstr ""
1217
-
1218
- #: inc/cleantalk-settings.php:1451
1219
- msgid ""
1220
- "The option checks each uploaded file to a website for malicious code. If "
1221
- "it's possible for visitors to upload files to a website, for instance a work "
1222
- "resume, then attackers could abuse it and upload an infected file to execute "
1223
- "it later and get access to your website."
1224
- msgstr ""
1225
-
1226
- #: inc/cleantalk-users.php:15
1227
- msgid "Find spam users"
1228
- msgstr ""
1229
-
1230
- #: inc/cleantalk-users.php:67
1231
- msgid "Please wait for a while. CleanTalk is deleting spam users. Users left: "
1232
- msgstr ""
1233
-
1234
- #: inc/cleantalk-users.php:79
1235
- msgid ""
1236
- "The plugin will check all users against blacklists database and show you "
1237
- "senders that have spam activity on other websites."
1238
- msgstr ""
1239
-
1240
- #: inc/cleantalk-users.php:84
1241
- msgid ""
1242
- "Allows to use user's dates to perform more accurate check. Could seriously "
1243
- "slow down the check."
1244
- msgstr ""
1245
-
1246
- #: inc/cleantalk-users.php:108
1247
- msgid ""
1248
- "Please wait for a while. CleanTalk is checking all users via blacklist "
1249
- "database at cleantalk.org. You will have option to delete found spam users "
1250
- "after plugin finish."
1251
- msgstr ""
1252
-
1253
- #: inc/cleantalk-users.php:267
1254
- msgid "Delete all users from list"
1255
- msgstr ""
1256
-
1257
- #: inc/cleantalk-users.php:269
1258
- msgid "Download results in CSV"
1259
- msgstr ""
1260
-
1261
- #: inc/cleantalk-users.php:273
1262
- msgid "Insert accounts"
1263
- msgstr ""
1264
-
1265
- #: inc/cleantalk-users.php:274
1266
- msgid "Delete accounts"
1267
- msgstr ""
1268
-
1269
- #: inc/cleantalk-users.php:527
1270
- #, php-format
1271
- msgid ""
1272
- "Total users %s, checked %s, last check %s, found %s spam users and %s bad "
1273
- "users (without IP or email)"
1274
- msgstr ""
1275
-
1276
- #: inc/cleantalk-widget.php:22
1277
- msgid "CleanTalk Widget"
1278
- msgstr ""
1279
-
1280
- #: inc/cleantalk-widget.php:25
1281
- msgid "CleanTalk widget"
1282
- msgstr ""
1283
-
1284
- #: inc/cleantalk-widget.php:72
1285
- msgid "CleanTalk's main page"
1286
- msgstr ""
1287
-
1288
- #: inc/cleantalk-widget.php:73
1289
- msgid "spam"
1290
- msgstr ""
1291
-
1292
- #: inc/cleantalk-widget.php:73
1293
- msgid "blocked by"
1294
- msgstr ""
1295
-
1296
- #: inc/cleantalk-widget.php:85
1297
- msgid "Spam blocked"
1298
- msgstr ""
1299
-
1300
- #: inc/cleantalk-widget.php:90
1301
- msgid "Title:"
1302
- msgstr ""
1303
-
1304
- #: inc/cleantalk-widget.php:95
1305
- msgid "Style:"
1306
- msgstr ""
1307
-
1308
- #: inc/cleantalk-widget.php:97
1309
- msgid "CleanTalk's Style"
1310
- msgstr ""
1311
-
1312
- #: inc/cleantalk-widget.php:98
1313
- msgid "Light"
1314
- msgstr ""
1315
-
1316
- #: inc/cleantalk-widget.php:99
1317
- msgid "Extremely Light"
1318
- msgstr ""
1319
-
1320
- #: inc/cleantalk-widget.php:100
1321
- msgid "Dark"
1322
- msgstr ""
1323
-
1324
- #: inc/cleantalk-widget.php:105
1325
- msgid "Referal link ID:"
1326
- msgstr ""
1327
-
1328
- #: lib/CleantalkSFW.php:71
1329
- msgid "SpamFireWall is activated for your IP "
1330
- msgstr ""
1331
-
1332
- #: lib/CleantalkSFW.php:72
1333
- msgid ""
1334
- "To continue working with web site, please make sure that you have enabled "
1335
- "JavaScript."
1336
- msgstr ""
1337
-
1338
- #: lib/CleantalkSFW.php:73
1339
- msgid "Please click below to pass protection,"
1340
- msgstr ""
1341
-
1342
- #: lib/CleantalkSFW.php:74
1343
- #, php-format
1344
- msgid ""
1345
- "Or you will be automatically redirected to the requested page after %d "
1346
- "seconds."
1347
- msgstr ""
1348
-
1349
- #: lib/CleantalkSFW.php:75
1350
- msgid "Antispam by CleanTalk"
1351
- msgstr ""
1352
-
1353
- #: lib/CleantalkSFW.php:76
1354
- msgid "This is the testing page for SpamFireWall"
1355
- msgstr ""
1356
-
1357
- #: templates/translate_banner.php:6
1358
- msgid "Help others use the plugin in your language."
1359
- msgstr ""
1360
-
1361
- #: templates/translate_banner.php:7
1362
- msgid ""
1363
- "We ask you to help with the translation of the plugin in your language. "
1364
- "Please take a few minutes to make the plugin more comfortable."
1365
- msgstr ""
1366
-
1367
- #: templates/translate_banner.php:10
1368
- msgid "TRANSLATE"
1369
- msgstr ""
1370
-
1371
- #. Plugin Name of the plugin/theme
1372
- msgid "Anti-Spam by CleanTalk"
1373
- msgstr ""
1374
-
1375
- #. Description of the plugin/theme
1376
- msgid ""
1377
- "Max power, all-in-one, no Captcha, premium anti-spam plugin. No comment spam,"
1378
- " no registration spam, no contact spam, protects any WordPress forms."
1379
- msgstr ""
1380
-
1381
- #. Plugin URI of the plugin/theme
1382
- #. Author URI of the plugin/theme
1383
- msgid "http://cleantalk.org"
1384
- msgstr ""
1385
-
1386
- #. Author of the plugin/theme
1387
- msgid "СleanTalk <welcome@cleantalk.org>"
1388
- msgstr ""
1
+ #, fuzzy
2
+ msgid ""
3
+ msgstr ""
4
+ "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
5
+ "Project-Id-Version: Anti-Spam by CleanTalk\n"
6
+ "POT-Creation-Date: 2019-10-27 16:02+0000\n"
7
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
8
+ "Last-Translator: \n"
9
+ "Language-Team: \n"
10
+ "MIME-Version: 1.0\n"
11
+ "Content-Type: text/plain; charset=UTF-8\n"
12
+ "Content-Transfer-Encoding: 8bit\n"
13
+ "X-Generator: Loco https://localise.biz/\n"
14
+ "X-Poedit-Basepath: ..\n"
15
+ "X-Poedit-WPHeader: cleantalk.php\n"
16
+ "X-Poedit-SourceCharset: UTF-8\n"
17
+ "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
18
+ "esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
19
+ "_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
20
+ "X-Poedit-SearchPath-0: .\n"
21
+ "X-Poedit-SearchPathExcluded-0: *.js\n"
22
+ "Language: "
23
+
24
+ #: inc/classCleantalkComments.php:32 inc/cleantalk-comments.php:16
25
+ #: inc/cleantalk-users.php:15
26
+ msgid "Check for spam"
27
+ msgstr ""
28
+
29
+ #: inc/classCleantalkComments.php:33 inc/cleantalk-admin.php:350
30
+ #: inc/cleantalk-comments.php:16
31
+ msgid "Find spam comments"
32
+ msgstr ""
33
+
34
+ #: inc/classCleantalkComments.php:66 inc/cleantalk-comments.php:26
35
+ #: inc/cleantalk-users.php:25
36
+ msgid "Plugin Settings"
37
+ msgstr ""
38
+
39
+ #: inc/classCleantalkComments.php:76 inc/cleantalk-comments.php:35
40
+ #: inc/cleantalk-users.php:34
41
+ #, php-format
42
+ msgid ""
43
+ "Antispam hosting tariff does not allow you to use this feature. To do so, "
44
+ "you need to enter an Access Key in the %splugin settings%s."
45
+ msgstr ""
46
+
47
+ #: inc/classCleantalkComments.php:101 inc/cleantalk-comments.php:60
48
+ #: inc/cleantalk-users.php:60
49
+ msgid ""
50
+ "Ajax error. Process will be automatically restarted in 3 seconds. Status: "
51
+ msgstr ""
52
+
53
+ #: inc/classCleantalkComments.php:108 inc/cleantalk-comments.php:67
54
+ msgid ""
55
+ "Please wait for a while. CleanTalk is deleting spam comments. Comments left: "
56
+ msgstr ""
57
+
58
+ #: inc/classCleantalkComments.php:118 inc/cleantalk-comments.php:77
59
+ #: inc/cleantalk-users.php:77
60
+ msgid "Start check"
61
+ msgstr ""
62
+
63
+ #: inc/classCleantalkComments.php:119 inc/cleantalk-comments.php:78
64
+ #: inc/cleantalk-users.php:78
65
+ msgid "Continue check"
66
+ msgstr ""
67
+
68
+ #: inc/classCleantalkComments.php:120 inc/cleantalk-comments.php:79
69
+ msgid ""
70
+ "The plugin will check all comments against blacklists database and show you "
71
+ "senders that have spam activity on other websites."
72
+ msgstr ""
73
+
74
+ #: inc/classCleantalkComments.php:123 inc/cleantalk-comments.php:82
75
+ #: inc/cleantalk-users.php:82
76
+ msgid "Accurate check"
77
+ msgstr ""
78
+
79
+ #: inc/classCleantalkComments.php:125 inc/cleantalk-comments.php:84
80
+ msgid ""
81
+ "Allows to use comment's dates to perform more accurate check. Could "
82
+ "seriously slow down the check."
83
+ msgstr ""
84
+
85
+ #: inc/classCleantalkComments.php:128 inc/cleantalk-comments.php:87
86
+ #: inc/cleantalk-users.php:87
87
+ msgid "Specify date range"
88
+ msgstr ""
89
+
90
+ #: inc/classCleantalkComments.php:149 inc/cleantalk-comments.php:108
91
+ msgid ""
92
+ "Please wait! CleanTalk is checking all approved and pending comments via "
93
+ "blacklist database at cleantalk.org. You will have option to delete found "
94
+ "spam comments after plugin finish."
95
+ msgstr ""
96
+
97
+ #: inc/classCleantalkCommentsListTable.php:24
98
+ msgid "Author"
99
+ msgstr ""
100
+
101
+ #: inc/classCleantalkCommentsListTable.php:25 inc/cleantalk-comments.php:158
102
+ msgid "Comment"
103
+ msgstr ""
104
+
105
+ #: inc/classCleantalkCommentsListTable.php:26 inc/cleantalk-comments.php:159
106
+ msgid "In Response To"
107
+ msgstr ""
108
+
109
+ #: inc/classCleantalkCommentsListTable.php:33
110
+ msgid "No spam comments."
111
+ msgstr ""
112
+
113
+ #: inc/cleantalk-admin.php:27
114
+ #, php-format
115
+ msgid "Find spam %s"
116
+ msgstr ""
117
+
118
+ #: inc/cleantalk-admin.php:31
119
+ msgid "CleanTalk Anti-Spam Log"
120
+ msgstr ""
121
+
122
+ #: inc/cleantalk-admin.php:50
123
+ #, php-format
124
+ msgid "%sRefresh%s"
125
+ msgstr ""
126
+
127
+ #: inc/cleantalk-admin.php:51
128
+ #, php-format
129
+ msgid "%sConfigure%s"
130
+ msgstr ""
131
+
132
+ #: inc/cleantalk-admin.php:68
133
+ msgid "7 days anti-spam stats"
134
+ msgstr ""
135
+
136
+ #: inc/cleantalk-admin.php:72
137
+ msgid "Top 5 spam IPs blocked"
138
+ msgstr ""
139
+
140
+ #: inc/cleantalk-admin.php:78
141
+ msgid "Get Access key to activate Anti-Spam protection!"
142
+ msgstr ""
143
+
144
+ #: inc/cleantalk-admin.php:86
145
+ #, php-format
146
+ msgid "Something went wrong! Error: \"%s\"."
147
+ msgstr ""
148
+
149
+ #: inc/cleantalk-admin.php:90
150
+ msgid "Please, visit your dashboard."
151
+ msgstr ""
152
+
153
+ #: inc/cleantalk-admin.php:104
154
+ msgid "IP"
155
+ msgstr ""
156
+
157
+ #: inc/cleantalk-admin.php:105
158
+ msgid "Country"
159
+ msgstr ""
160
+
161
+ #: inc/cleantalk-admin.php:106
162
+ msgid "Block Count"
163
+ msgstr ""
164
+
165
+ #: inc/cleantalk-admin.php:134
166
+ #, php-format
167
+ msgid ""
168
+ "This is the count from the %s's cloud and could be different to admin bar "
169
+ "counters"
170
+ msgstr ""
171
+
172
+ #. %s: Number of spam messages
173
+ #: inc/cleantalk-admin.php:137
174
+ #, php-format
175
+ msgid ""
176
+ "%s%s%s has blocked %s spam for all time. The statistics are automatically "
177
+ "updated every 24 hours."
178
+ msgstr ""
179
+
180
+ #: inc/cleantalk-admin.php:148 inc/cleantalk-settings.php:544
181
+ #, php-format
182
+ msgid "Do you like CleanTalk? %sPost your feedback here%s."
183
+ msgstr ""
184
+
185
+ #: inc/cleantalk-admin.php:234
186
+ msgid "Translate"
187
+ msgstr ""
188
+
189
+ #: inc/cleantalk-admin.php:237
190
+ msgid "Start here"
191
+ msgstr ""
192
+
193
+ #: inc/cleantalk-admin.php:238
194
+ msgid "FAQ"
195
+ msgstr ""
196
+
197
+ #: inc/cleantalk-admin.php:239 inc/cleantalk-admin.php:644
198
+ #: inc/cleantalk-settings.php:575
199
+ msgid "Support"
200
+ msgstr ""
201
+
202
+ #: inc/cleantalk-admin.php:306 inc/cleantalk-settings.php:523
203
+ msgid "Hosting AntiSpam"
204
+ msgstr ""
205
+
206
+ #: inc/cleantalk-admin.php:333
207
+ msgid "Failed from timeout. Going to check comments again."
208
+ msgstr ""
209
+
210
+ #: inc/cleantalk-admin.php:334
211
+ msgid "Added"
212
+ msgstr ""
213
+
214
+ #: inc/cleantalk-admin.php:335 inc/cleantalk-admin.php:386
215
+ msgid "Deleted"
216
+ msgstr ""
217
+
218
+ #: inc/cleantalk-admin.php:336
219
+ msgid "comments"
220
+ msgstr ""
221
+
222
+ #: inc/cleantalk-admin.php:337
223
+ msgid "Delete all spam comments?"
224
+ msgstr ""
225
+
226
+ #: inc/cleantalk-admin.php:338
227
+ msgid "Delete checked comments?"
228
+ msgstr ""
229
+
230
+ #: inc/cleantalk-admin.php:339
231
+ #, php-format
232
+ msgid ""
233
+ "Total comments %s. Checked %s. Found %s spam comments. %s bad comments "
234
+ "(without IP or email)."
235
+ msgstr ""
236
+
237
+ #: inc/cleantalk-admin.php:340 inc/cleantalk-admin.php:393
238
+ #: inc/cleantalk-users.php:531
239
+ msgid "Please do backup of WordPress database before delete any accounts!"
240
+ msgstr ""
241
+
242
+ #: inc/cleantalk-admin.php:351
243
+ msgid "The sender has been whitelisted."
244
+ msgstr ""
245
+
246
+ #: inc/cleantalk-admin.php:352
247
+ msgid "The sender has been blacklisted."
248
+ msgstr ""
249
+
250
+ #: inc/cleantalk-admin.php:353 inc/cleantalk-public.php:3321
251
+ #, php-format
252
+ msgid "Feedback has been sent to %sCleanTalk Dashboard%s."
253
+ msgstr ""
254
+
255
+ #: inc/cleantalk-admin.php:383
256
+ msgid "Failed from timeout. Going to check users again."
257
+ msgstr ""
258
+
259
+ #: inc/cleantalk-admin.php:384
260
+ msgid "Failed from timeout. Going to run a new attempt to delete spam users."
261
+ msgstr ""
262
+
263
+ #: inc/cleantalk-admin.php:385
264
+ msgid "Inserted"
265
+ msgstr ""
266
+
267
+ #: inc/cleantalk-admin.php:387
268
+ msgid "users."
269
+ msgstr ""
270
+
271
+ #: inc/cleantalk-admin.php:388
272
+ msgid "Delete all spam users?"
273
+ msgstr ""
274
+
275
+ #: inc/cleantalk-admin.php:389
276
+ msgid "Delete checked users?"
277
+ msgstr ""
278
+
279
+ #: inc/cleantalk-admin.php:392
280
+ #, php-format
281
+ msgid ""
282
+ "Total users %s, checked %s, found %s spam users and %s bad users (without IP "
283
+ "or email)"
284
+ msgstr ""
285
+
286
+ #: inc/cleantalk-admin.php:401
287
+ msgid "Find spam-users"
288
+ msgstr ""
289
+
290
+ #: inc/cleantalk-admin.php:449
291
+ #, php-format
292
+ msgid "Unable to get Access key automatically: %s"
293
+ msgstr ""
294
+
295
+ #: inc/cleantalk-admin.php:450
296
+ msgid "Get the Access key"
297
+ msgstr ""
298
+
299
+ #: inc/cleantalk-admin.php:459
300
+ #, php-format
301
+ msgid "Please enter Access Key in %s settings to enable anti spam protection!"
302
+ msgstr ""
303
+
304
+ #: inc/cleantalk-admin.php:469
305
+ #, php-format
306
+ msgid "%s trial period ends, please upgrade to %s!"
307
+ msgstr ""
308
+
309
+ #: inc/cleantalk-admin.php:481
310
+ msgid "RENEW ANTI-SPAM"
311
+ msgstr ""
312
+
313
+ #: inc/cleantalk-admin.php:482
314
+ msgid "next year"
315
+ msgstr ""
316
+
317
+ #: inc/cleantalk-admin.php:486
318
+ #, php-format
319
+ msgid "Please renew your anti-spam license for %s."
320
+ msgstr ""
321
+
322
+ #: inc/cleantalk-admin.php:511
323
+ msgid "Make it right!"
324
+ msgstr ""
325
+
326
+ #: inc/cleantalk-admin.php:513
327
+ #, php-format
328
+ msgid "%sGet premium%s"
329
+ msgstr ""
330
+
331
+ #: inc/cleantalk-admin.php:552
332
+ msgid "Since"
333
+ msgstr ""
334
+
335
+ #: inc/cleantalk-admin.php:558
336
+ msgid ""
337
+ "All / Allowed / Blocked submissions. The number of submissions is being "
338
+ "counted since CleanTalk plugin installation."
339
+ msgstr ""
340
+
341
+ #: inc/cleantalk-admin.php:558
342
+ msgid "All"
343
+ msgstr ""
344
+
345
+ #: inc/cleantalk-admin.php:566
346
+ msgid ""
347
+ "Allowed / Blocked submissions. The number of submissions for past 24 hours. "
348
+ msgstr ""
349
+
350
+ #: inc/cleantalk-admin.php:566
351
+ msgid "Day"
352
+ msgstr ""
353
+
354
+ #: inc/cleantalk-admin.php:572
355
+ msgid ""
356
+ "All / Blocked events. Access attempts regitred by SpamFireWall counted since "
357
+ "the last plugin activation."
358
+ msgstr ""
359
+
360
+ #: inc/cleantalk-admin.php:582
361
+ msgid ""
362
+ "Allowed / Blocked submissions. The number of submissions is being counted "
363
+ "since "
364
+ msgstr ""
365
+
366
+ #: inc/cleantalk-admin.php:593
367
+ msgid "dashboard"
368
+ msgstr ""
369
+
370
+ #: inc/cleantalk-admin.php:600
371
+ msgid "Settings"
372
+ msgstr ""
373
+
374
+ #: inc/cleantalk-admin.php:608
375
+ msgid "Bulk spam comments removal tool."
376
+ msgstr ""
377
+
378
+ #: inc/cleantalk-admin.php:608 inc/cleantalk-settings.php:882
379
+ msgid "Check comments for spam"
380
+ msgstr ""
381
+
382
+ #: inc/cleantalk-admin.php:618 inc/cleantalk-settings.php:885
383
+ msgid "Check users for spam"
384
+ msgstr ""
385
+
386
+ #: inc/cleantalk-admin.php:627
387
+ msgid "Reset first counter"
388
+ msgstr ""
389
+
390
+ #: inc/cleantalk-admin.php:635
391
+ msgid "Reset all counters"
392
+ msgstr ""
393
+
394
+ #: inc/cleantalk-comments.php:221 inc/cleantalk-users.php:220
395
+ msgid "Approve"
396
+ msgstr ""
397
+
398
+ #: inc/cleantalk-comments.php:223 inc/cleantalk-users.php:222
399
+ msgid "Delete"
400
+ msgstr ""
401
+
402
+ #: inc/cleantalk-comments.php:265
403
+ msgid "Delete all comments from the list"
404
+ msgstr ""
405
+
406
+ #: inc/cleantalk-comments.php:266 inc/cleantalk-users.php:268
407
+ msgid "Delete selected"
408
+ msgstr ""
409
+
410
+ #: inc/cleantalk-comments.php:270
411
+ msgid "Insert comments"
412
+ msgstr ""
413
+
414
+ #: inc/cleantalk-comments.php:271
415
+ msgid "Delete comments"
416
+ msgstr ""
417
+
418
+ #: inc/cleantalk-comments.php:276 inc/cleantalk-users.php:279
419
+ msgid ""
420
+ "There is some differencies between blacklists database and our API "
421
+ "mechanisms. Blacklists shows all history of spam activity, but our API (that "
422
+ "used in spam checking) used another parameters, too: last day of activity, "
423
+ "number of spam attacks during last days etc. This mechanisms help us to "
424
+ "reduce number of false positivitie. So, there is nothing strange, if some "
425
+ "emails/IPs will be not found by this checking."
426
+ msgstr ""
427
+
428
+ #: inc/cleantalk-comments.php:281 inc/cleantalk-users.php:284
429
+ msgid "Stop deletion"
430
+ msgstr ""
431
+
432
+ #: inc/cleantalk-comments.php:495
433
+ #, php-format
434
+ msgid ""
435
+ "Total comments %s. Checked %s. Last check %s. Found %s spam comments. %s bad "
436
+ "comments (without IP or email)."
437
+ msgstr ""
438
+
439
+ #: inc/cleantalk-comments.php:499
440
+ msgid "Please do backup of WordPress database before delete any comments!"
441
+ msgstr ""
442
+
443
+ #: inc/cleantalk-public.php:500 inc/cleantalk-public.php:641
444
+ #: inc/cleantalk-public.php:743 inc/cleantalk-public.php:2363
445
+ #: inc/cleantalk-public.php:3052
446
+ msgid "Spam protection by CleanTalk"
447
+ msgstr ""
448
+
449
+ #: inc/cleantalk-public.php:1233 inc/cleantalk-public.php:1361
450
+ #: inc/cleantalk-public.php:1379
451
+ msgid "Spam protection"
452
+ msgstr ""
453
+
454
+ #: inc/cleantalk-public.php:1332
455
+ msgid "CleanTalk AntiSpam: This message is possible spam."
456
+ msgstr ""
457
+
458
+ #: inc/cleantalk-public.php:1333
459
+ msgid "You could check it in CleanTalk's anti-spam database:"
460
+ msgstr ""
461
+
462
+ #: inc/cleantalk-public.php:1569
463
+ #, php-format
464
+ msgid "Registration approved by %s."
465
+ msgstr ""
466
+
467
+ #: inc/cleantalk-public.php:1849
468
+ msgid "CleanTalk AntiSpam: This registration is spam."
469
+ msgstr ""
470
+
471
+ #: inc/cleantalk-public.php:1850 inc/cleantalk-public.php:2219
472
+ #: inc/cleantalk-public.php:2387 inc/cleantalk-public.php:2542
473
+ msgid "CleanTalk's anti-spam database:"
474
+ msgstr ""
475
+
476
+ #: inc/cleantalk-public.php:2218 inc/cleantalk-public.php:2386
477
+ #: inc/cleantalk-public.php:2541
478
+ msgid "CleanTalk AntiSpam: This message is spam."
479
+ msgstr ""
480
+
481
+ #: inc/cleantalk-public.php:2666
482
+ msgid "Comment approved. Anti-spam by CleanTalk."
483
+ msgstr ""
484
+
485
+ #: inc/cleantalk-public.php:3219
486
+ msgid "Attention, please!"
487
+ msgstr ""
488
+
489
+ #: inc/cleantalk-public.php:3220
490
+ #, php-format
491
+ msgid "\"%s\" plugin error on your site \"%s\":"
492
+ msgstr ""
493
+
494
+ #: inc/cleantalk-public.php:3222
495
+ #, php-format
496
+ msgid "[%s] \"%s\" error!"
497
+ msgstr ""
498
+
499
+ #: inc/cleantalk-public.php:3271
500
+ msgid ""
501
+ "By using this form you agree with the storage and processing of your data by "
502
+ "using the Privacy Policy on this website."
503
+ msgstr ""
504
+
505
+ #: inc/cleantalk-public.php:3319
506
+ msgid "Error occured while sending feedback."
507
+ msgstr ""
508
+
509
+ #: inc/cleantalk-public.php:3320
510
+ msgid "Feedback wasn't sent. There is no associated request."
511
+ msgstr ""
512
+
513
+ #: inc/cleantalk-public.php:3364
514
+ msgid "Sender info"
515
+ msgstr ""
516
+
517
+ #: inc/cleantalk-public.php:3367
518
+ msgid "by"
519
+ msgstr ""
520
+
521
+ #: inc/cleantalk-public.php:3378
522
+ msgid "No email"
523
+ msgstr ""
524
+
525
+ #: inc/cleantalk-public.php:3388
526
+ msgid "No IP"
527
+ msgstr ""
528
+
529
+ #: inc/cleantalk-public.php:3391
530
+ msgid "Mark as spam"
531
+ msgstr ""
532
+
533
+ #: inc/cleantalk-public.php:3392
534
+ msgid "Unspam"
535
+ msgstr ""
536
+
537
+ #: inc/cleantalk-public.php:3394
538
+ msgid "Marked as spam."
539
+ msgstr ""
540
+
541
+ #: inc/cleantalk-public.php:3395
542
+ msgid "Marked as not spam."
543
+ msgstr ""
544
+
545
+ #: inc/cleantalk-settings.php:96
546
+ msgid "SpamFireWall"
547
+ msgstr ""
548
+
549
+ #: inc/cleantalk-settings.php:97
550
+ msgid ""
551
+ "This option allows to filter spam bots before they access website. Also "
552
+ "reduces CPU usage on hosting server and accelerates pages load time."
553
+ msgstr ""
554
+
555
+ #: inc/cleantalk-settings.php:104
556
+ msgid "Forms to protect"
557
+ msgstr ""
558
+
559
+ #: inc/cleantalk-settings.php:110
560
+ msgid "Advanced settings"
561
+ msgstr ""
562
+
563
+ #: inc/cleantalk-settings.php:117
564
+ msgid "Registration Forms"
565
+ msgstr ""
566
+
567
+ #: inc/cleantalk-settings.php:118
568
+ msgid "WordPress, BuddyPress, bbPress, S2Member, WooCommerce."
569
+ msgstr ""
570
+
571
+ #: inc/cleantalk-settings.php:121
572
+ msgid "Comments form"
573
+ msgstr ""
574
+
575
+ #: inc/cleantalk-settings.php:122
576
+ msgid "WordPress, JetPack, WooCommerce."
577
+ msgstr ""
578
+
579
+ #: inc/cleantalk-settings.php:125 inc/cleantalk-settings.php:761
580
+ msgid "Contact forms"
581
+ msgstr ""
582
+
583
+ #: inc/cleantalk-settings.php:126
584
+ msgid ""
585
+ "Contact Form 7, Formidable forms, JetPack, Fast Secure Contact Form, "
586
+ "WordPress Landing Pages, Gravity Forms."
587
+ msgstr ""
588
+
589
+ #: inc/cleantalk-settings.php:129 inc/cleantalk-settings.php:762
590
+ msgid "Custom contact forms"
591
+ msgstr ""
592
+
593
+ #: inc/cleantalk-settings.php:130
594
+ msgid "Anti spam test for any WordPress themes or contacts forms."
595
+ msgstr ""
596
+
597
+ #: inc/cleantalk-settings.php:133 inc/cleantalk-settings.php:775
598
+ msgid "WooCommerce checkout form"
599
+ msgstr ""
600
+
601
+ #: inc/cleantalk-settings.php:134
602
+ msgid "Anti spam test for WooCommerce checkout form."
603
+ msgstr ""
604
+
605
+ #: inc/cleantalk-settings.php:138
606
+ msgid "Spam test for registration during checkout"
607
+ msgstr ""
608
+
609
+ #: inc/cleantalk-settings.php:139
610
+ msgid ""
611
+ "Enable anti spam test for registration process which during woocommerce's "
612
+ "checkout."
613
+ msgstr ""
614
+
615
+ #: inc/cleantalk-settings.php:145
616
+ msgid "Test default Wordpress search form for spam"
617
+ msgstr ""
618
+
619
+ #: inc/cleantalk-settings.php:146
620
+ msgid "Spam protection for Search form."
621
+ msgstr ""
622
+
623
+ #: inc/cleantalk-settings.php:148
624
+ #, php-format
625
+ msgid "Read more about %sspam protection for Search form%s on our blog."
626
+ msgstr ""
627
+
628
+ #: inc/cleantalk-settings.php:156
629
+ msgid "Protect external forms"
630
+ msgstr ""
631
+
632
+ #: inc/cleantalk-settings.php:157
633
+ msgid ""
634
+ "Turn this option on to protect forms on your WordPress that send data to "
635
+ "third-part servers (like MailChimp)."
636
+ msgstr ""
637
+
638
+ #: inc/cleantalk-settings.php:161
639
+ msgid "Capture buffer"
640
+ msgstr ""
641
+
642
+ #: inc/cleantalk-settings.php:162
643
+ msgid ""
644
+ "This setting gives you more sophisticated and strengthened protection for "
645
+ "external forms. But it could break plugins which use a buffer like Ninja "
646
+ "Forms."
647
+ msgstr ""
648
+
649
+ #: inc/cleantalk-settings.php:167
650
+ msgid "Protect internal forms"
651
+ msgstr ""
652
+
653
+ #: inc/cleantalk-settings.php:168
654
+ msgid ""
655
+ "This option will enable protection for custom (hand-made) AJAX forms with "
656
+ "PHP scripts handlers on your WordPress."
657
+ msgstr ""
658
+
659
+ #: inc/cleantalk-settings.php:175
660
+ msgid "Comments and Messages"
661
+ msgstr ""
662
+
663
+ #: inc/cleantalk-settings.php:178
664
+ msgid "BuddyPress Private Messages"
665
+ msgstr ""
666
+
667
+ #: inc/cleantalk-settings.php:179
668
+ msgid "Check buddyPress private messages."
669
+ msgstr ""
670
+
671
+ #: inc/cleantalk-settings.php:182
672
+ msgid "Don't check trusted user's comments"
673
+ msgstr ""
674
+
675
+ #: inc/cleantalk-settings.php:183
676
+ #, php-format
677
+ msgid "Don't check comments for users with above %d comments."
678
+ msgstr ""
679
+
680
+ #: inc/cleantalk-settings.php:186
681
+ msgid "Automatically delete spam comments"
682
+ msgstr ""
683
+
684
+ #: inc/cleantalk-settings.php:187
685
+ #, php-format
686
+ msgid "Delete spam comments older than %d days."
687
+ msgstr ""
688
+
689
+ #: inc/cleantalk-settings.php:190
690
+ msgid "Remove links from approved comments"
691
+ msgstr ""
692
+
693
+ #: inc/cleantalk-settings.php:191
694
+ msgid "Remove links from approved comments. Replace it with \"[Link deleted]\""
695
+ msgstr ""
696
+
697
+ #: inc/cleantalk-settings.php:194
698
+ msgid "Show links to check Emails, IPs for spam."
699
+ msgstr ""
700
+
701
+ #: inc/cleantalk-settings.php:195
702
+ msgid ""
703
+ "Shows little icon near IP addresses and Emails allowing you to check it via "
704
+ "CleanTalk's database. Also allowing you to manage comments from the public "
705
+ "post's page."
706
+ msgstr ""
707
+
708
+ #: inc/cleantalk-settings.php:203
709
+ msgid "Data Processing"
710
+ msgstr ""
711
+
712
+ #: inc/cleantalk-settings.php:206
713
+ msgid "Protect logged in Users"
714
+ msgstr ""
715
+
716
+ #: inc/cleantalk-settings.php:207
717
+ msgid ""
718
+ "Turn this option on to check for spam any submissions (comments, contact "
719
+ "forms and etc.) from registered Users."
720
+ msgstr ""
721
+
722
+ #: inc/cleantalk-settings.php:210
723
+ msgid "Use AJAX for JavaScript check"
724
+ msgstr ""
725
+
726
+ #: inc/cleantalk-settings.php:211
727
+ msgid ""
728
+ "Options helps protect WordPress against spam with any caching plugins. Turn "
729
+ "this option on to avoid issues with caching plugins."
730
+ msgstr ""
731
+
732
+ #: inc/cleantalk-settings.php:214
733
+ msgid "Use static keys for JS check."
734
+ msgstr ""
735
+
736
+ #: inc/cleantalk-settings.php:215
737
+ msgid ""
738
+ "Could help if you have cache for AJAX requests and you are dealing with "
739
+ "false positives. Slightly decreases protection quality. Auto - Static key "
740
+ "will be used if caching plugin is spotted."
741
+ msgstr ""
742
+
743
+ #: inc/cleantalk-settings.php:223
744
+ msgid "Check all post data"
745
+ msgstr ""
746
+
747
+ #: inc/cleantalk-settings.php:224
748
+ msgid ""
749
+ "Check all POST submissions from website visitors. Enable this option if you "
750
+ "have spam misses on website."
751
+ msgstr ""
752
+
753
+ #: inc/cleantalk-settings.php:226
754
+ msgid " Or you don`t have records about missed spam here:"
755
+ msgstr ""
756
+
757
+ #: inc/cleantalk-settings.php:226
758
+ msgid "CleanTalk dashboard"
759
+ msgstr ""
760
+
761
+ #: inc/cleantalk-settings.php:229
762
+ msgid "СAUTION! Option can catch POST requests in WordPress backend"
763
+ msgstr ""
764
+
765
+ #: inc/cleantalk-settings.php:232
766
+ msgid "Set cookies"
767
+ msgstr ""
768
+
769
+ #: inc/cleantalk-settings.php:233
770
+ msgid ""
771
+ "Turn this option off to deny plugin generates any cookies on website front-"
772
+ "end. This option is helpful if you use Varnish. But most of contact forms "
773
+ "will not be protected if the option is turned off! <b>Warning: We strongly "
774
+ "recommend you to enable this otherwise it could cause false positives spam "
775
+ "detection.</b>"
776
+ msgstr ""
777
+
778
+ #: inc/cleantalk-settings.php:237
779
+ msgid "Use alternative mechanism for cookies"
780
+ msgstr ""
781
+
782
+ #: inc/cleantalk-settings.php:238 inc/cleantalk-settings.php:360
783
+ msgid "Doesn't use cookie or PHP sessions. Collect data for all types of bots."
784
+ msgstr ""
785
+
786
+ #: inc/cleantalk-settings.php:243
787
+ msgid "Use SSL"
788
+ msgstr ""
789
+
790
+ #: inc/cleantalk-settings.php:244
791
+ msgid "Turn this option on to use encrypted (SSL) connection with servers."
792
+ msgstr ""
793
+
794
+ #: inc/cleantalk-settings.php:247
795
+ msgid "Use Wordpress HTTP API"
796
+ msgstr ""
797
+
798
+ #: inc/cleantalk-settings.php:248
799
+ msgid ""
800
+ "Alternative way to connect the Cloud. Use this if you have connection "
801
+ "problems."
802
+ msgstr ""
803
+
804
+ #: inc/cleantalk-settings.php:255
805
+ msgid "Exclusions"
806
+ msgstr ""
807
+
808
+ #: inc/cleantalk-settings.php:259
809
+ msgid "URL exclusions"
810
+ msgstr ""
811
+
812
+ #: inc/cleantalk-settings.php:260
813
+ msgid "You could type here URL you want to exclude. Use comma as separator."
814
+ msgstr ""
815
+
816
+ #: inc/cleantalk-settings.php:264
817
+ msgid "Use Regular Expression in URL Exclusions"
818
+ msgstr ""
819
+
820
+ #: inc/cleantalk-settings.php:268
821
+ msgid "Field name exclusions"
822
+ msgstr ""
823
+
824
+ #: inc/cleantalk-settings.php:269
825
+ msgid ""
826
+ "You could type here fields names you want to exclude. Use comma as separator."
827
+ msgstr ""
828
+
829
+ #: inc/cleantalk-settings.php:273
830
+ msgid "Use Regular Expression in Field Exclusions"
831
+ msgstr ""
832
+
833
+ #: inc/cleantalk-settings.php:280
834
+ msgid "Roles which bypass spam test. Hold CTRL to select multiple roles."
835
+ msgstr ""
836
+
837
+ #: inc/cleantalk-settings.php:287
838
+ msgid "Admin bar"
839
+ msgstr ""
840
+
841
+ #: inc/cleantalk-settings.php:294
842
+ msgid "Show statistics in admin bar"
843
+ msgstr ""
844
+
845
+ #: inc/cleantalk-settings.php:295
846
+ msgid ""
847
+ "Show/hide icon in top level menu in WordPress backend. The number of "
848
+ "submissions is being counted for past 24 hours."
849
+ msgstr ""
850
+
851
+ #: inc/cleantalk-settings.php:299
852
+ msgid "Show All-time counter"
853
+ msgstr ""
854
+
855
+ #: inc/cleantalk-settings.php:300
856
+ msgid ""
857
+ "Display all-time requests counter in the admin bar. Counter displays number "
858
+ "of requests since plugin installation."
859
+ msgstr ""
860
+
861
+ #: inc/cleantalk-settings.php:305
862
+ msgid "Show 24 hours counter"
863
+ msgstr ""
864
+
865
+ #: inc/cleantalk-settings.php:306
866
+ msgid ""
867
+ "Display daily requests counter in the admin bar. Counter displays number of "
868
+ "requests of the past 24 hours."
869
+ msgstr ""
870
+
871
+ #: inc/cleantalk-settings.php:311
872
+ msgid "SpamFireWall counter"
873
+ msgstr ""
874
+
875
+ #: inc/cleantalk-settings.php:312
876
+ msgid ""
877
+ "Display SpamFireWall requests in the admin bar. Counter displays number of "
878
+ "requests since plugin installation."
879
+ msgstr ""
880
+
881
+ #: inc/cleantalk-settings.php:325
882
+ msgid "Collect details about browsers"
883
+ msgstr ""
884
+
885
+ #: inc/cleantalk-settings.php:326
886
+ msgid ""
887
+ "Checking this box you allow plugin store information about screen size and "
888
+ "browser plugins of website visitors. The option in a beta state."
889
+ msgstr ""
890
+
891
+ #: inc/cleantalk-settings.php:330
892
+ msgid "Send connection reports"
893
+ msgstr ""
894
+
895
+ #: inc/cleantalk-settings.php:331
896
+ msgid ""
897
+ "Checking this box you allow plugin to send the information about your "
898
+ "connection. The option in a beta state."
899
+ msgstr ""
900
+
901
+ #: inc/cleantalk-settings.php:335
902
+ msgid "Async JavaScript loading"
903
+ msgstr ""
904
+
905
+ #: inc/cleantalk-settings.php:336
906
+ msgid ""
907
+ "Use async loading for scripts. Warning: This could reduce filtration quality."
908
+ msgstr ""
909
+
910
+ #: inc/cleantalk-settings.php:340
911
+ msgid "Allow to add GDPR notice via shortcode"
912
+ msgstr ""
913
+
914
+ #: inc/cleantalk-settings.php:341
915
+ msgid ""
916
+ " Adds small checkbox under your website form. To add it you should use the "
917
+ "shortcode on the form's page: [cleantalk_gdpr_form id=\"FORM_ID\"]"
918
+ msgstr ""
919
+
920
+ #: inc/cleantalk-settings.php:346
921
+ msgid "GDPR text notice"
922
+ msgstr ""
923
+
924
+ #: inc/cleantalk-settings.php:347
925
+ msgid "This text will be added as a description to the GDPR checkbox."
926
+ msgstr ""
927
+
928
+ #: inc/cleantalk-settings.php:353
929
+ msgid "Store visited URLs"
930
+ msgstr ""
931
+
932
+ #: inc/cleantalk-settings.php:354
933
+ msgid ""
934
+ "Plugin stores last 10 visited URLs (HTTP REFFERERS) before visitor submits "
935
+ "form on the site. You can see stored visited URLS for each visitor in your "
936
+ "Dashboard. Turn the option on to improve Anti-Spam protection."
937
+ msgstr ""
938
+
939
+ #: inc/cleantalk-settings.php:359
940
+ msgid "Use cookies less sessions"
941
+ msgstr ""
942
+
943
+ #: inc/cleantalk-settings.php:366
944
+ msgid ""
945
+ "Notify users with selected roles about new approved comments. Hold CTRL to "
946
+ "select multiple roles."
947
+ msgstr ""
948
+
949
+ #: inc/cleantalk-settings.php:367
950
+ #, php-format
951
+ msgid "If enabled, overrides similar Wordpress %sdiscussion settings%s."
952
+ msgstr ""
953
+
954
+ #: inc/cleantalk-settings.php:380
955
+ msgid "Complete deactivation"
956
+ msgstr ""
957
+
958
+ #: inc/cleantalk-settings.php:381
959
+ msgid "Leave no trace in the system after deactivation."
960
+ msgstr ""
961
+
962
+ #: inc/cleantalk-settings.php:398
963
+ msgid "Enable White Label Mode"
964
+ msgstr ""
965
+
966
+ #: inc/cleantalk-settings.php:399
967
+ #, php-format
968
+ msgid "Learn more information %shere%s."
969
+ msgstr ""
970
+
971
+ #: inc/cleantalk-settings.php:404
972
+ msgid "Hoster API Key"
973
+ msgstr ""
974
+
975
+ #: inc/cleantalk-settings.php:405
976
+ #, php-format
977
+ msgid "You can get it in %sCleantalk's Control Panel%s"
978
+ msgstr ""
979
+
980
+ #: inc/cleantalk-settings.php:413
981
+ msgid "Plugin name"
982
+ msgstr ""
983
+
984
+ #: inc/cleantalk-settings.php:414
985
+ #, php-format
986
+ msgid "Specify plugin name. Leave empty for deafult %sAntispam by Cleantalk%s"
987
+ msgstr ""
988
+
989
+ #: inc/cleantalk-settings.php:423
990
+ msgid "Allow users to use other key"
991
+ msgstr ""
992
+
993
+ #: inc/cleantalk-settings.php:424
994
+ msgid ""
995
+ "Allow users to use different Access key in their plugin settings on child "
996
+ "blogs. They could use different CleanTalk account."
997
+ msgstr ""
998
+
999
+ #: inc/cleantalk-settings.php:427
1000
+ msgid ""
1001
+ "Constant <b>CLEANTALK_ACCESS_KEY</b> is set. All websites will use API key "
1002
+ "from this constant. Look into wp-config.php"
1003
+ msgstr ""
1004
+
1005
+ #: inc/cleantalk-settings.php:533
1006
+ msgid "CleanTalk's tech support:"
1007
+ msgstr ""
1008
+
1009
+ #: inc/cleantalk-settings.php:539
1010
+ msgid "Plugin Homepage at"
1011
+ msgstr ""
1012
+
1013
+ #: inc/cleantalk-settings.php:540
1014
+ msgid "GDPR compliance"
1015
+ msgstr ""
1016
+
1017
+ #: inc/cleantalk-settings.php:541
1018
+ msgid "Use s@cleantalk.org to test plugin in any WordPress form."
1019
+ msgstr ""
1020
+
1021
+ #: inc/cleantalk-settings.php:542
1022
+ msgid "CleanTalk is registered Trademark. All rights reserved."
1023
+ msgstr ""
1024
+
1025
+ #: inc/cleantalk-settings.php:559
1026
+ #, php-format
1027
+ msgid "%s has blocked <b>%s</b> spam."
1028
+ msgstr ""
1029
+
1030
+ #: inc/cleantalk-settings.php:571
1031
+ msgid "Click here to get anti-spam statistics"
1032
+ msgstr ""
1033
+
1034
+ #: inc/cleantalk-settings.php:614
1035
+ #, php-format
1036
+ msgid "Please, enter the %splugin settings%s in main site dashboard."
1037
+ msgstr ""
1038
+
1039
+ #: inc/cleantalk-settings.php:633
1040
+ msgid "Error occured while API key validating. Error: "
1041
+ msgstr ""
1042
+
1043
+ #: inc/cleantalk-settings.php:634
1044
+ msgid "Error occured while automatically gettings access key. Error: "
1045
+ msgstr ""
1046
+
1047
+ #: inc/cleantalk-settings.php:635
1048
+ msgid "Error occured while sending sending SpamFireWall logs. Error: "
1049
+ msgstr ""
1050
+
1051
+ #: inc/cleantalk-settings.php:636
1052
+ msgid "Error occured while updating SpamFireWall local base. Error: "
1053
+ msgstr ""
1054
+
1055
+ #: inc/cleantalk-settings.php:637
1056
+ msgid "Error occured while checking account status. Error: "
1057
+ msgstr ""
1058
+
1059
+ #: inc/cleantalk-settings.php:638
1060
+ msgid "Error occured while excuting API call. Error: "
1061
+ msgstr ""
1062
+
1063
+ #: inc/cleantalk-settings.php:646
1064
+ msgid "Unknown error. Error: "
1065
+ msgstr ""
1066
+
1067
+ #: inc/cleantalk-settings.php:677
1068
+ msgid "Errors:"
1069
+ msgstr ""
1070
+
1071
+ #: inc/cleantalk-settings.php:682
1072
+ #, php-format
1073
+ msgid "You can get support any time here: %s."
1074
+ msgstr ""
1075
+
1076
+ #: inc/cleantalk-settings.php:757
1077
+ msgid "Protection is active"
1078
+ msgstr ""
1079
+
1080
+ #: inc/cleantalk-settings.php:759
1081
+ msgid "Registration forms"
1082
+ msgstr ""
1083
+
1084
+ #: inc/cleantalk-settings.php:760
1085
+ msgid "Comments forms"
1086
+ msgstr ""
1087
+
1088
+ #: inc/cleantalk-settings.php:765
1089
+ msgid "Validate email for existence"
1090
+ msgstr ""
1091
+
1092
+ #: inc/cleantalk-settings.php:769
1093
+ msgid "Auto update"
1094
+ msgstr ""
1095
+
1096
+ #: inc/cleantalk-settings.php:793
1097
+ msgid "<h3>Key is provided by Super Admin.</h3>"
1098
+ msgstr ""
1099
+
1100
+ #: inc/cleantalk-settings.php:797
1101
+ msgid "Access key"
1102
+ msgstr ""
1103
+
1104
+ #: inc/cleantalk-settings.php:812
1105
+ msgid "Enter the key"
1106
+ msgstr ""
1107
+
1108
+ #: inc/cleantalk-settings.php:818
1109
+ #, php-format
1110
+ msgid "Account at cleantalk.org is %s."
1111
+ msgstr ""
1112
+
1113
+ #: inc/cleantalk-settings.php:827
1114
+ msgid "Show the access key"
1115
+ msgstr ""
1116
+
1117
+ #: inc/cleantalk-settings.php:838
1118
+ msgid "Get Access Key Automatically"
1119
+ msgstr ""
1120
+
1121
+ #: inc/cleantalk-settings.php:846
1122
+ #, php-format
1123
+ msgid ""
1124
+ "Admin e-mail (%s) will be used for registration, if you want to use other "
1125
+ "email please %sGet Access Key Manually%s."
1126
+ msgstr ""
1127
+
1128
+ #: inc/cleantalk-settings.php:862
1129
+ #, php-format
1130
+ msgid "I accept %sLicense Agreement%s."
1131
+ msgstr ""
1132
+
1133
+ #: inc/cleantalk-settings.php:888
1134
+ msgid "Statistics & Reports"
1135
+ msgstr ""
1136
+
1137
+ #: inc/cleantalk-settings.php:904
1138
+ #, php-format
1139
+ msgid "Last spam check request to %s server was at %s."
1140
+ msgstr ""
1141
+
1142
+ #: inc/cleantalk-settings.php:905 inc/cleantalk-settings.php:906
1143
+ #: inc/cleantalk-settings.php:915 inc/cleantalk-settings.php:922
1144
+ #: inc/cleantalk-settings.php:923 inc/cleantalk-settings.php:931
1145
+ #: inc/cleantalk-settings.php:932 inc/cleantalk-settings.php:939
1146
+ #: inc/cleantalk-settings.php:940
1147
+ msgid "unknown"
1148
+ msgstr ""
1149
+
1150
+ #: inc/cleantalk-settings.php:912
1151
+ #, php-format
1152
+ msgid "Average request time for past 7 days: %s seconds."
1153
+ msgstr ""
1154
+
1155
+ #: inc/cleantalk-settings.php:921
1156
+ #, php-format
1157
+ msgid "Last time SpamFireWall was triggered for %s IP at %s"
1158
+ msgstr ""
1159
+
1160
+ #: inc/cleantalk-settings.php:930
1161
+ #, php-format
1162
+ msgid "SpamFireWall was updated %s. Now contains %s entries."
1163
+ msgstr ""
1164
+
1165
+ #: inc/cleantalk-settings.php:938
1166
+ #, php-format
1167
+ msgid "SpamFireWall sent %s events at %s."
1168
+ msgstr ""
1169
+
1170
+ #: inc/cleantalk-settings.php:948
1171
+ msgid "There are no failed connections to server."
1172
+ msgstr ""
1173
+
1174
+ #: inc/cleantalk-settings.php:975
1175
+ msgid "Send report"
1176
+ msgstr ""
1177
+
1178
+ #: inc/cleantalk-settings.php:979
1179
+ msgid ""
1180
+ "Please, enable \"Send connection reports\" setting to be able to send reports"
1181
+ msgstr ""
1182
+
1183
+ #: inc/cleantalk-settings.php:1327
1184
+ msgid "Testing is failed. Please check the Access key."
1185
+ msgstr ""
1186
+
1187
+ #: inc/cleantalk-settings.php:1442
1188
+ msgid "XSS check"
1189
+ msgstr ""
1190
+
1191
+ #: inc/cleantalk-settings.php:1443
1192
+ msgid ""
1193
+ "Cross-Site Scripting (XSS) — prevents malicious code to be executed/sent to "
1194
+ "any user. As a result malicious scripts can not get access to the cookie "
1195
+ "files, session tokens and any other confidential information browsers use "
1196
+ "and store. Such scripts can even overwrite content of HTML pages. CleanTalk "
1197
+ "WAF monitors for patterns of these parameters and block them."
1198
+ msgstr ""
1199
+
1200
+ #: inc/cleantalk-settings.php:1446
1201
+ msgid "SQL-injection check"
1202
+ msgstr ""
1203
+
1204
+ #: inc/cleantalk-settings.php:1447
1205
+ msgid ""
1206
+ "SQL Injection — one of the most popular ways to hack websites and programs "
1207
+ "that work with databases. It is based on injection of a custom SQL code into "
1208
+ "database queries. It could transmit data through GET, POST requests or "
1209
+ "cookie files in an SQL code. If a website is vulnerable and execute such "
1210
+ "injections then it would allow attackers to apply changes to the website's "
1211
+ "MySQL database."
1212
+ msgstr ""
1213
+
1214
+ #: inc/cleantalk-settings.php:1450
1215
+ msgid "Check uploaded files"
1216
+ msgstr ""
1217
+
1218
+ #: inc/cleantalk-settings.php:1451
1219
+ msgid ""
1220
+ "The option checks each uploaded file to a website for malicious code. If "
1221
+ "it's possible for visitors to upload files to a website, for instance a work "
1222
+ "resume, then attackers could abuse it and upload an infected file to execute "
1223
+ "it later and get access to your website."
1224
+ msgstr ""
1225
+
1226
+ #: inc/cleantalk-users.php:15
1227
+ msgid "Find spam users"
1228
+ msgstr ""
1229
+
1230
+ #: inc/cleantalk-users.php:67
1231
+ msgid "Please wait for a while. CleanTalk is deleting spam users. Users left: "
1232
+ msgstr ""
1233
+
1234
+ #: inc/cleantalk-users.php:79
1235
+ msgid ""
1236
+ "The plugin will check all users against blacklists database and show you "
1237
+ "senders that have spam activity on other websites."
1238
+ msgstr ""
1239
+
1240
+ #: inc/cleantalk-users.php:84
1241
+ msgid ""
1242
+ "Allows to use user's dates to perform more accurate check. Could seriously "
1243
+ "slow down the check."
1244
+ msgstr ""
1245
+
1246
+ #: inc/cleantalk-users.php:108
1247
+ msgid ""
1248
+ "Please wait for a while. CleanTalk is checking all users via blacklist "
1249
+ "database at cleantalk.org. You will have option to delete found spam users "
1250
+ "after plugin finish."
1251
+ msgstr ""
1252
+
1253
+ #: inc/cleantalk-users.php:267
1254
+ msgid "Delete all users from list"
1255
+ msgstr ""
1256
+
1257
+ #: inc/cleantalk-users.php:269
1258
+ msgid "Download results in CSV"
1259
+ msgstr ""
1260
+
1261
+ #: inc/cleantalk-users.php:273
1262
+ msgid "Insert accounts"
1263
+ msgstr ""
1264
+
1265
+ #: inc/cleantalk-users.php:274
1266
+ msgid "Delete accounts"
1267
+ msgstr ""
1268
+
1269
+ #: inc/cleantalk-users.php:527
1270
+ #, php-format
1271
+ msgid ""
1272
+ "Total users %s, checked %s, last check %s, found %s spam users and %s bad "
1273
+ "users (without IP or email)"
1274
+ msgstr ""
1275
+
1276
+ #: inc/cleantalk-widget.php:22
1277
+ msgid "CleanTalk Widget"
1278
+ msgstr ""
1279
+
1280
+ #: inc/cleantalk-widget.php:25
1281
+ msgid "CleanTalk widget"
1282
+ msgstr ""
1283
+
1284
+ #: inc/cleantalk-widget.php:72
1285
+ msgid "CleanTalk's main page"
1286
+ msgstr ""
1287
+
1288
+ #: inc/cleantalk-widget.php:73
1289
+ msgid "spam"
1290
+ msgstr ""
1291
+
1292
+ #: inc/cleantalk-widget.php:73
1293
+ msgid "blocked by"
1294
+ msgstr ""
1295
+
1296
+ #: inc/cleantalk-widget.php:85
1297
+ msgid "Spam blocked"
1298
+ msgstr ""
1299
+
1300
+ #: inc/cleantalk-widget.php:90
1301
+ msgid "Title:"
1302
+ msgstr ""
1303
+
1304
+ #: inc/cleantalk-widget.php:95
1305
+ msgid "Style:"
1306
+ msgstr ""
1307
+
1308
+ #: inc/cleantalk-widget.php:97
1309
+ msgid "CleanTalk's Style"
1310
+ msgstr ""
1311
+
1312
+ #: inc/cleantalk-widget.php:98
1313
+ msgid "Light"
1314
+ msgstr ""
1315
+
1316
+ #: inc/cleantalk-widget.php:99
1317
+ msgid "Extremely Light"
1318
+ msgstr ""
1319
+
1320
+ #: inc/cleantalk-widget.php:100
1321
+ msgid "Dark"
1322
+ msgstr ""
1323
+
1324
+ #: inc/cleantalk-widget.php:105
1325
+ msgid "Referal link ID:"
1326
+ msgstr ""
1327
+
1328
+ #: lib/CleantalkSFW.php:71
1329
+ msgid "SpamFireWall is activated for your IP "
1330
+ msgstr ""
1331
+
1332
+ #: lib/CleantalkSFW.php:72
1333
+ msgid ""
1334
+ "To continue working with web site, please make sure that you have enabled "
1335
+ "JavaScript."
1336
+ msgstr ""
1337
+
1338
+ #: lib/CleantalkSFW.php:73
1339
+ msgid "Please click below to pass protection,"
1340
+ msgstr ""
1341
+
1342
+ #: lib/CleantalkSFW.php:74
1343
+ #, php-format
1344
+ msgid ""
1345
+ "Or you will be automatically redirected to the requested page after %d "
1346
+ "seconds."
1347
+ msgstr ""
1348
+
1349
+ #: lib/CleantalkSFW.php:75
1350
+ msgid "Antispam by CleanTalk"
1351
+ msgstr ""
1352
+
1353
+ #: lib/CleantalkSFW.php:76
1354
+ msgid "This is the testing page for SpamFireWall"
1355
+ msgstr ""
1356
+
1357
+ #: templates/translate_banner.php:6
1358
+ msgid "Help others use the plugin in your language."
1359
+ msgstr ""
1360
+
1361
+ #: templates/translate_banner.php:7
1362
+ msgid ""
1363
+ "We ask you to help with the translation of the plugin in your language. "
1364
+ "Please take a few minutes to make the plugin more comfortable."
1365
+ msgstr ""
1366
+
1367
+ #: templates/translate_banner.php:10
1368
+ msgid "TRANSLATE"
1369
+ msgstr ""
1370
+
1371
+ #. Plugin Name of the plugin/theme
1372
+ msgid "Anti-Spam by CleanTalk"
1373
+ msgstr ""
1374
+
1375
+ #. Description of the plugin/theme
1376
+ msgid ""
1377
+ "Max power, all-in-one, no Captcha, premium anti-spam plugin. No comment spam,"
1378
+ " no registration spam, no contact spam, protects any WordPress forms."
1379
+ msgstr ""
1380
+
1381
+ #. Plugin URI of the plugin/theme
1382
+ #. Author URI of the plugin/theme
1383
+ msgid "http://cleantalk.org"
1384
+ msgstr ""
1385
+
1386
+ #. Author of the plugin/theme
1387
+ msgid "СleanTalk <welcome@cleantalk.org>"
1388
+ msgstr ""
inc/ClassApbctListTable.php CHANGED
@@ -1,1434 +1,1434 @@
1
- <?php
2
- /**
3
- * This is copy of the WP_List_Table class for the future compability
4
- */
5
-
6
- /**
7
- * Administration API: WP_List_Table class
8
- *
9
- * @package WordPress
10
- * @subpackage List_Table
11
- * @since 3.1.0
12
- */
13
-
14
- /**
15
- * Base class for displaying a list of items in an ajaxified HTML table.
16
- *
17
- * @since 3.1.0
18
- * @access private
19
- */
20
- class ABPCT_List_Table {
21
-
22
- /**
23
- * The current list of items.
24
- *
25
- * @since 3.1.0
26
- * @var array
27
- */
28
- public $items;
29
-
30
- /**
31
- * Various information about the current table.
32
- *
33
- * @since 3.1.0
34
- * @var array
35
- */
36
- protected $_args;
37
-
38
- /**
39
- * Various information needed for displaying the pagination.
40
- *
41
- * @since 3.1.0
42
- * @var array
43
- */
44
- protected $_pagination_args = array();
45
-
46
- /**
47
- * The current screen.
48
- *
49
- * @since 3.1.0
50
- * @var object
51
- */
52
- protected $screen;
53
-
54
- /**
55
- * Cached bulk actions.
56
- *
57
- * @since 3.1.0
58
- * @var array
59
- */
60
- private $_actions;
61
-
62
- /**
63
- * Cached pagination output.
64
- *
65
- * @since 3.1.0
66
- * @var string
67
- */
68
- private $_pagination;
69
-
70
- /**
71
- * The view switcher modes.
72
- *
73
- * @since 4.1.0
74
- * @var array
75
- */
76
- protected $modes = array();
77
-
78
- /**
79
- * Stores the value returned by ->get_column_info().
80
- *
81
- * @since 4.1.0
82
- * @var array
83
- */
84
- protected $_column_headers;
85
-
86
- /**
87
- * {@internal Missing Summary}
88
- *
89
- * @var array
90
- */
91
- protected $compat_fields = array( '_args', '_pagination_args', 'screen', '_actions', '_pagination' );
92
-
93
- /**
94
- * {@internal Missing Summary}
95
- *
96
- * @var array
97
- */
98
- protected $compat_methods = array(
99
- 'set_pagination_args',
100
- 'get_views',
101
- 'get_bulk_actions',
102
- 'bulk_actions',
103
- 'row_actions',
104
- 'months_dropdown',
105
- 'view_switcher',
106
- 'comments_bubble',
107
- 'get_items_per_page',
108
- 'pagination',
109
- 'get_sortable_columns',
110
- 'get_column_info',
111
- 'get_table_classes',
112
- 'display_tablenav',
113
- 'extra_tablenav',
114
- 'single_row_columns',
115
- );
116
-
117
- /**
118
- * Constructor.
119
- *
120
- * The child class should call this constructor from its own constructor to override
121
- * the default $args.
122
- *
123
- * @since 3.1.0
124
- *
125
- * @param array|string $args {
126
- * Array or string of arguments.
127
- *
128
- * @type string $plural Plural value used for labels and the objects being listed.
129
- * This affects things such as CSS class-names and nonces used
130
- * in the list table, e.g. 'posts'. Default empty.
131
- * @type string $singular Singular label for an object being listed, e.g. 'post'.
132
- * Default empty
133
- * @type bool $ajax Whether the list table supports Ajax. This includes loading
134
- * and sorting data, for example. If true, the class will call
135
- * the _js_vars() method in the footer to provide variables
136
- * to any scripts handling Ajax events. Default false.
137
- * @type string $screen String containing the hook name used to determine the current
138
- * screen. If left null, the current screen will be automatically set.
139
- * Default null.
140
- * }
141
- */
142
- public function __construct( $args = array() ) {
143
- $args = wp_parse_args(
144
- $args,
145
- array(
146
- 'plural' => '',
147
- 'singular' => '',
148
- 'ajax' => false,
149
- 'screen' => null,
150
- )
151
- );
152
-
153
- $this->screen = convert_to_screen( $args['screen'] );
154
-
155
- add_filter( "manage_{$this->screen->id}_columns", array( $this, 'get_columns' ), 0 );
156
-
157
- if ( ! $args['plural'] ) {
158
- $args['plural'] = $this->screen->base;
159
- }
160
-
161
- $args['plural'] = sanitize_key( $args['plural'] );
162
- $args['singular'] = sanitize_key( $args['singular'] );
163
-
164
- $this->_args = $args;
165
-
166
- if ( $args['ajax'] ) {
167
- // wp_enqueue_script( 'list-table' );
168
- add_action( 'admin_footer', array( $this, '_js_vars' ) );
169
- }
170
-
171
- if ( empty( $this->modes ) ) {
172
- $this->modes = array(
173
- 'list' => __( 'List View' ),
174
- 'excerpt' => __( 'Excerpt View' ),
175
- );
176
- }
177
- }
178
-
179
- /**
180
- * Make private properties readable for backward compatibility.
181
- *
182
- * @since 4.0.0
183
- *
184
- * @param string $name Property to get.
185
- * @return mixed Property.
186
- */
187
- public function __get( $name ) {
188
- if ( in_array( $name, $this->compat_fields ) ) {
189
- return $this->$name;
190
- }
191
- }
192
-
193
- /**
194
- * Make private properties settable for backward compatibility.
195
- *
196
- * @since 4.0.0
197
- *
198
- * @param string $name Property to check if set.
199
- * @param mixed $value Property value.
200
- * @return mixed Newly-set property.
201
- */
202
- public function __set( $name, $value ) {
203
- if ( in_array( $name, $this->compat_fields ) ) {
204
- return $this->$name = $value;
205
- }
206
- }
207
-
208
- /**
209
- * Make private properties checkable for backward compatibility.
210
- *
211
- * @since 4.0.0
212
- *
213
- * @param string $name Property to check if set.
214
- * @return bool Whether the property is set.
215
- */
216
- public function __isset( $name ) {
217
- if ( in_array( $name, $this->compat_fields ) ) {
218
- return isset( $this->$name );
219
- }
220
- }
221
-
222
- /**
223
- * Make private properties un-settable for backward compatibility.
224
- *
225
- * @since 4.0.0
226
- *
227
- * @param string $name Property to unset.
228
- */
229
- public function __unset( $name ) {
230
- if ( in_array( $name, $this->compat_fields ) ) {
231
- unset( $this->$name );
232
- }
233
- }
234
-
235
- /**
236
- * Make private/protected methods readable for backward compatibility.
237
- *
238
- * @since 4.0.0
239
- *
240
- * @param string $name Method to call.
241
- * @param array $arguments Arguments to pass when calling.
242
- * @return mixed|bool Return value of the callback, false otherwise.
243
- */
244
- public function __call( $name, $arguments ) {
245
- if ( in_array( $name, $this->compat_methods ) ) {
246
- return $this->$name( ...$arguments );
247
- }
248
- return false;
249
- }
250
-
251
- /**
252
- * Checks the current user's permissions
253
- *
254
- * @since 3.1.0
255
- * @abstract
256
- */
257
- public function ajax_user_can() {
258
- die( 'function WP_List_Table::ajax_user_can() must be over-ridden in a sub-class.' );
259
- }
260
-
261
- /**
262
- * Prepares the list of items for displaying.
263
- *
264
- * @uses WP_List_Table::set_pagination_args()
265
- *
266
- * @since 3.1.0
267
- * @abstract
268
- */
269
- public function prepare_items() {
270
- die( 'function WP_List_Table::prepare_items() must be over-ridden in a sub-class.' );
271
- }
272
-
273
- /**
274
- * An internal method that sets all the necessary pagination arguments
275
- *
276
- * @since 3.1.0
277
- *
278
- * @param array|string $args Array or string of arguments with information about the pagination.
279
- */
280
- protected function set_pagination_args( $args ) {
281
- $args = wp_parse_args(
282
- $args,
283
- array(
284
- 'total_items' => 0,
285
- 'total_pages' => 0,
286
- 'per_page' => 0,
287
- )
288
- );
289
-
290
- if ( ! $args['total_pages'] && $args['per_page'] > 0 ) {
291
- $args['total_pages'] = ceil( $args['total_items'] / $args['per_page'] );
292
- }
293
-
294
- // Redirect if page number is invalid and headers are not already sent.
295
- if ( ! headers_sent() && ! wp_doing_ajax() && $args['total_pages'] > 0 && $this->get_pagenum() > $args['total_pages'] ) {
296
- wp_redirect( add_query_arg( 'paged', $args['total_pages'] ) );
297
- exit;
298
- }
299
-
300
- $this->_pagination_args = $args;
301
- }
302
-
303
- /**
304
- * Access the pagination args.
305
- *
306
- * @since 3.1.0
307
- *
308
- * @param string $key Pagination argument to retrieve. Common values include 'total_items',
309
- * 'total_pages', 'per_page', or 'infinite_scroll'.
310
- * @return int Number of items that correspond to the given pagination argument.
311
- */
312
- public function get_pagination_arg( $key ) {
313
- if ( 'page' === $key ) {
314
- return $this->get_pagenum();
315
- }
316
-
317
- if ( isset( $this->_pagination_args[ $key ] ) ) {
318
- return $this->_pagination_args[ $key ];
319
- }
320
- }
321
-
322
- /**
323
- * Whether the table has items to display or not
324
- *
325
- * @since 3.1.0
326
- *
327
- * @return bool
328
- */
329
- public function has_items() {
330
- return ! empty( $this->items );
331
- }
332
-
333
- /**
334
- * Message to be displayed when there are no items
335
- *
336
- * @since 3.1.0
337
- */
338
- public function no_items() {
339
- _e( 'No items found.' );
340
- }
341
-
342
- /**
343
- * Displays the search box.
344
- *
345
- * @since 3.1.0
346
- *
347
- * @param string $text The 'submit' button label.
348
- * @param string $input_id ID attribute value for the search input field.
349
- */
350
- public function search_box( $text, $input_id ) {
351
- if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) {
352
- return;
353
- }
354
-
355
- $input_id = $input_id . '-search-input';
356
-
357
- if ( ! empty( $_REQUEST['orderby'] ) ) {
358
- echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
359
- }
360
- if ( ! empty( $_REQUEST['order'] ) ) {
361
- echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
362
- }
363
- if ( ! empty( $_REQUEST['post_mime_type'] ) ) {
364
- echo '<input type="hidden" name="post_mime_type" value="' . esc_attr( $_REQUEST['post_mime_type'] ) . '" />';
365
- }
366
- if ( ! empty( $_REQUEST['detached'] ) ) {
367
- echo '<input type="hidden" name="detached" value="' . esc_attr( $_REQUEST['detached'] ) . '" />';
368
- }
369
- ?>
370
- <p class="search-box">
371
- <label class="screen-reader-text" for="<?php echo esc_attr( $input_id ); ?>"><?php echo $text; ?>:</label>
372
- <input type="search" id="<?php echo esc_attr( $input_id ); ?>" name="s" value="<?php _admin_search_query(); ?>" />
373
- <?php submit_button( $text, '', '', false, array( 'id' => 'search-submit' ) ); ?>
374
- </p>
375
- <?php
376
- }
377
-
378
- /**
379
- * Get an associative array ( id => link ) with the list
380
- * of views available on this table.
381
- *
382
- * @since 3.1.0
383
- *
384
- * @return array
385
- */
386
- protected function get_views() {
387
- return array();
388
- }
389
-
390
- /**
391
- * Display the list of views available on this table.
392
- *
393
- * @since 3.1.0
394
- */
395
- public function views() {
396
- $views = $this->get_views();
397
- /**
398
- * Filters the list of available list table views.
399
- *
400
- * The dynamic portion of the hook name, `$this->screen->id`, refers
401
- * to the ID of the current screen, usually a string.
402
- *
403
- * @since 3.5.0
404
- *
405
- * @param string[] $views An array of available list table views.
406
- */
407
- $views = apply_filters( "views_{$this->screen->id}", $views );
408
-
409
- if ( empty( $views ) ) {
410
- return;
411
- }
412
-
413
- $this->screen->render_screen_reader_content( 'heading_views' );
414
-
415
- echo "<ul class='subsubsub'>\n";
416
- foreach ( $views as $class => $view ) {
417
- $views[ $class ] = "\t<li class='$class'>$view";
418
- }
419
- echo implode( " |</li>\n", $views ) . "</li>\n";
420
- echo '</ul>';
421
- }
422
-
423
- /**
424
- * Get an associative array ( option_name => option_title ) with the list
425
- * of bulk actions available on this table.
426
- *
427
- * @since 3.1.0
428
- *
429
- * @return array
430
- */
431
- protected function get_bulk_actions() {
432
- return array();
433
- }
434
-
435
- /**
436
- * Display the bulk actions dropdown.
437
- *
438
- * @since 3.1.0
439
- *
440
- * @param string $which The location of the bulk actions: 'top' or 'bottom'.
441
- * This is designated as optional for backward compatibility.
442
- */
443
- protected function bulk_actions( $which = '' ) {
444
- if ( is_null( $this->_actions ) ) {
445
- $this->_actions = $this->get_bulk_actions();
446
- /**
447
- * Filters the list table Bulk Actions drop-down.
448
- *
449
- * The dynamic portion of the hook name, `$this->screen->id`, refers
450
- * to the ID of the current screen, usually a string.
451
- *
452
- * This filter can currently only be used to remove bulk actions.
453
- *
454
- * @since 3.5.0
455
- *
456
- * @param string[] $actions An array of the available bulk actions.
457
- */
458
- $this->_actions = apply_filters( "bulk_actions-{$this->screen->id}", $this->_actions ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
459
- $two = '';
460
- } else {
461
- $two = '2';
462
- }
463
-
464
- if ( empty( $this->_actions ) ) {
465
- return;
466
- }
467
-
468
- echo '<label for="bulk-action-selector-' . esc_attr( $which ) . '" class="screen-reader-text">' . __( 'Select bulk action' ) . '</label>';
469
- echo '<select name="action' . $two . '" id="bulk-action-selector-' . esc_attr( $which ) . "\">\n";
470
- echo '<option value="-1">' . __( 'Bulk Actions' ) . "</option>\n";
471
-
472
- foreach ( $this->_actions as $name => $title ) {
473
- $class = 'edit' === $name ? ' class="hide-if-no-js"' : '';
474
-
475
- echo "\t" . '<option value="' . $name . '"' . $class . '>' . $title . "</option>\n";
476
- }
477
-
478
- echo "</select>\n";
479
-
480
- submit_button( __( 'Apply' ), 'action', '', false, array( 'id' => "doaction$two" ) );
481
- echo "\n";
482
- }
483
-
484
- /**
485
- * Get the current action selected from the bulk actions dropdown.
486
- *
487
- * @since 3.1.0
488
- *
489
- * @return string|false The action name or False if no action was selected
490
- */
491
- public function current_action() {
492
- if ( isset( $_REQUEST['filter_action'] ) && ! empty( $_REQUEST['filter_action'] ) ) {
493
- return false;
494
- }
495
-
496
- if ( isset( $_REQUEST['action'] ) && -1 != $_REQUEST['action'] ) {
497
- return $_REQUEST['action'];
498
- }
499
-
500
- if ( isset( $_REQUEST['action2'] ) && -1 != $_REQUEST['action2'] ) {
501
- return $_REQUEST['action2'];
502
- }
503
-
504
- return false;
505
- }
506
-
507
- /**
508
- * Generate row actions div
509
- *
510
- * @since 3.1.0
511
- *
512
- * @param string[] $actions An array of action links.
513
- * @param bool $always_visible Whether the actions should be always visible.
514
- * @return string
515
- */
516
- protected function row_actions( $actions, $always_visible = false ) {
517
- $action_count = count( $actions );
518
- $i = 0;
519
-
520
- if ( ! $action_count ) {
521
- return '';
522
- }
523
-
524
- $out = '<div class="' . ( $always_visible ? 'row-actions visible' : 'row-actions' ) . '">';
525
- foreach ( $actions as $action => $link ) {
526
- ++$i;
527
- ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
528
- $out .= "<span class='$action'>$link$sep</span>";
529
- }
530
- $out .= '</div>';
531
-
532
- $out .= '<button type="button" class="toggle-row"><span class="screen-reader-text">' . __( 'Show more details' ) . '</span></button>';
533
-
534
- return $out;
535
- }
536
-
537
- /**
538
- * Display a monthly dropdown for filtering items
539
- *
540
- * @since 3.1.0
541
- *
542
- * @global wpdb $wpdb WordPress database abstraction object.
543
- * @global WP_Locale $wp_locale WordPress date and time locale object.
544
- *
545
- * @param string $post_type
546
- */
547
- protected function months_dropdown( $post_type ) {
548
- global $wpdb, $wp_locale;
549
-
550
- /**
551
- * Filters whether to remove the 'Months' drop-down from the post list table.
552
- *
553
- * @since 4.2.0
554
- *
555
- * @param bool $disable Whether to disable the drop-down. Default false.
556
- * @param string $post_type The post type.
557
- */
558
- if ( apply_filters( 'disable_months_dropdown', false, $post_type ) ) {
559
- return;
560
- }
561
-
562
- $extra_checks = "AND post_status != 'auto-draft'";
563
- if ( ! isset( $_GET['post_status'] ) || 'trash' !== $_GET['post_status'] ) {
564
- $extra_checks .= " AND post_status != 'trash'";
565
- } elseif ( isset( $_GET['post_status'] ) ) {
566
- $extra_checks = $wpdb->prepare( ' AND post_status = %s', $_GET['post_status'] );
567
- }
568
-
569
- $months = $wpdb->get_results(
570
- $wpdb->prepare(
571
- "
572
- SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month
573
- FROM $wpdb->posts
574
- WHERE post_type = %s
575
- $extra_checks
576
- ORDER BY post_date DESC
577
- ",
578
- $post_type
579
- )
580
- );
581
-
582
- /**
583
- * Filters the 'Months' drop-down results.
584
- *
585
- * @since 3.7.0
586
- *
587
- * @param object $months The months drop-down query results.
588
- * @param string $post_type The post type.
589
- */
590
- $months = apply_filters( 'months_dropdown_results', $months, $post_type );
591
-
592
- $month_count = count( $months );
593
-
594
- if ( ! $month_count || ( 1 == $month_count && 0 == $months[0]->month ) ) {
595
- return;
596
- }
597
-
598
- $m = isset( $_GET['m'] ) ? (int) $_GET['m'] : 0;
599
- ?>
600
- <label for="filter-by-date" class="screen-reader-text"><?php _e( 'Filter by date' ); ?></label>
601
- <select name="m" id="filter-by-date">
602
- <option<?php selected( $m, 0 ); ?> value="0"><?php _e( 'All dates' ); ?></option>
603
- <?php
604
- foreach ( $months as $arc_row ) {
605
- if ( 0 == $arc_row->year ) {
606
- continue;
607
- }
608
-
609
- $month = zeroise( $arc_row->month, 2 );
610
- $year = $arc_row->year;
611
-
612
- printf(
613
- "<option %s value='%s'>%s</option>\n",
614
- selected( $m, $year . $month, false ),
615
- esc_attr( $arc_row->year . $month ),
616
- /* translators: 1: Month name, 2: 4-digit year. */
617
- sprintf( __( '%1$s %2$d' ), $wp_locale->get_month( $month ), $year )
618
- );
619
- }
620
- ?>
621
- </select>
622
- <?php
623
- }
624
-
625
- /**
626
- * Display a view switcher
627
- *
628
- * @since 3.1.0
629
- *
630
- * @param string $current_mode
631
- */
632
- protected function view_switcher( $current_mode ) {
633
- ?>
634
- <input type="hidden" name="mode" value="<?php echo esc_attr( $current_mode ); ?>" />
635
- <div class="view-switch">
636
- <?php
637
- foreach ( $this->modes as $mode => $title ) {
638
- $classes = array( 'view-' . $mode );
639
- $aria_current = '';
640
-
641
- if ( $current_mode === $mode ) {
642
- $classes[] = 'current';
643
- $aria_current = ' aria-current="page"';
644
- }
645
- printf(
646
- "<a href='%s' class='%s' id='view-switch-$mode'$aria_current><span class='screen-reader-text'>%s</span></a>\n",
647
- esc_url( add_query_arg( 'mode', $mode ) ),
648
- implode( ' ', $classes ),
649
- $title
650
- );
651
- }
652
- ?>
653
- </div>
654
- <?php
655
- }
656
-
657
- /**
658
- * Display a comment count bubble
659
- *
660
- * @since 3.1.0
661
- *
662
- * @param int $post_id The post ID.
663
- * @param int $pending_comments Number of pending comments.
664
- */
665
- protected function comments_bubble( $post_id, $pending_comments ) {
666
- $approved_comments = get_comments_number();
667
-
668
- $approved_comments_number = number_format_i18n( $approved_comments );
669
- $pending_comments_number = number_format_i18n( $pending_comments );
670
-
671
- $approved_only_phrase = sprintf(
672
- /* translators: %s: Number of comments. */
673
- _n( '%s comment', '%s comments', $approved_comments ),
674
- $approved_comments_number
675
- );
676
-
677
- $approved_phrase = sprintf(
678
- /* translators: %s: Number of comments. */
679
- _n( '%s approved comment', '%s approved comments', $approved_comments ),
680
- $approved_comments_number
681
- );
682
-
683
- $pending_phrase = sprintf(
684
- /* translators: %s: Number of comments. */
685
- _n( '%s pending comment', '%s pending comments', $pending_comments ),
686
- $pending_comments_number
687
- );
688
-
689
- // No comments at all.
690
- if ( ! $approved_comments && ! $pending_comments ) {
691
- printf(
692
- '<span aria-hidden="true">&#8212;</span><span class="screen-reader-text">%s</span>',
693
- __( 'No comments' )
694
- );
695
- // Approved comments have different display depending on some conditions.
696
- } elseif ( $approved_comments ) {
697
- printf(
698
- '<a href="%s" class="post-com-count post-com-count-approved"><span class="comment-count-approved" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></a>',
699
- esc_url(
700
- add_query_arg(
701
- array(
702
- 'p' => $post_id,
703
- 'comment_status' => 'approved',
704
- ),
705
- admin_url( 'edit-comments.php' )
706
- )
707
- ),
708
- $approved_comments_number,
709
- $pending_comments ? $approved_phrase : $approved_only_phrase
710
- );
711
- } else {
712
- printf(
713
- '<span class="post-com-count post-com-count-no-comments"><span class="comment-count comment-count-no-comments" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></span>',
714
- $approved_comments_number,
715
- $pending_comments ? __( 'No approved comments' ) : __( 'No comments' )
716
- );
717
- }
718
-
719
- if ( $pending_comments ) {
720
- printf(
721
- '<a href="%s" class="post-com-count post-com-count-pending"><span class="comment-count-pending" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></a>',
722
- esc_url(
723
- add_query_arg(
724
- array(
725
- 'p' => $post_id,
726
- 'comment_status' => 'moderated',
727
- ),
728
- admin_url( 'edit-comments.php' )
729
- )
730
- ),
731
- $pending_comments_number,
732
- $pending_phrase
733
- );
734
- } else {
735
- printf(
736
- '<span class="post-com-count post-com-count-pending post-com-count-no-pending"><span class="comment-count comment-count-no-pending" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></span>',
737
- $pending_comments_number,
738
- $approved_comments ? __( 'No pending comments' ) : __( 'No comments' )
739
- );
740
- }
741
- }
742
-
743
- /**
744
- * Get the current page number
745
- *
746
- * @since 3.1.0
747
- *
748
- * @return int
749
- */
750
- public function get_pagenum() {
751
- $pagenum = isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 0;
752
-
753
- if ( isset( $this->_pagination_args['total_pages'] ) && $pagenum > $this->_pagination_args['total_pages'] ) {
754
- $pagenum = $this->_pagination_args['total_pages'];
755
- }
756
-
757
- return max( 1, $pagenum );
758
- }
759
-
760
- /**
761
- * Get number of items to display on a single page
762
- *
763
- * @since 3.1.0
764
- *
765
- * @param string $option
766
- * @param int $default
767
- * @return int
768
- */
769
- protected function get_items_per_page( $option, $default = 20 ) {
770
- $per_page = (int) get_user_option( $option );
771
- if ( empty( $per_page ) || $per_page < 1 ) {
772
- $per_page = $default;
773
- }
774
-
775
- /**
776
- * Filters the number of items to be displayed on each page of the list table.
777
- *
778
- * The dynamic hook name, $option, refers to the `per_page` option depending
779
- * on the type of list table in use. Possible values include: 'edit_comments_per_page',
780
- * 'sites_network_per_page', 'site_themes_network_per_page', 'themes_network_per_page',
781
- * 'users_network_per_page', 'edit_post_per_page', 'edit_page_per_page',
782
- * 'edit_{$post_type}_per_page', etc.
783
- *
784
- * @since 2.9.0
785
- *
786
- * @param int $per_page Number of items to be displayed. Default 20.
787
- */
788
- return (int) apply_filters( "{$option}", $per_page );
789
- }
790
-
791
- /**
792
- * Display the pagination.
793
- *
794
- * @since 3.1.0
795
- *
796
- * @param string $which
797
- */
798
- protected function pagination( $which ) {
799
- if ( empty( $this->_pagination_args ) ) {
800
- return;
801
- }
802
-
803
- $total_items = $this->_pagination_args['total_items'];
804
- $total_pages = $this->_pagination_args['total_pages'];
805
- $infinite_scroll = false;
806
- if ( isset( $this->_pagination_args['infinite_scroll'] ) ) {
807
- $infinite_scroll = $this->_pagination_args['infinite_scroll'];
808
- }
809
-
810
- if ( 'top' === $which && $total_pages > 1 ) {
811
- $this->screen->render_screen_reader_content( 'heading_pagination' );
812
- }
813
-
814
- $output = '<span class="displaying-num">' . sprintf(
815
- /* translators: %s: Number of items. */
816
- _n( '%s item', '%s items', $total_items ),
817
- number_format_i18n( $total_items )
818
- ) . '</span>';
819
-
820
- $current = $this->get_pagenum();
821
- $removable_query_args = wp_removable_query_args();
822
-
823
- $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
824
-
825
- $current_url = remove_query_arg( $removable_query_args, $current_url );
826
-
827
- $page_links = array();
828
-
829
- $total_pages_before = '<span class="paging-input">';
830
- $total_pages_after = '</span></span>';
831
-
832
- $disable_first = false;
833
- $disable_last = false;
834
- $disable_prev = false;
835
- $disable_next = false;
836
-
837
- if ( $current == 1 ) {
838
- $disable_first = true;
839
- $disable_prev = true;
840
- }
841
- if ( $current == 2 ) {
842
- $disable_first = true;
843
- }
844
- if ( $current == $total_pages ) {
845
- $disable_last = true;
846
- $disable_next = true;
847
- }
848
- if ( $current == $total_pages - 1 ) {
849
- $disable_last = true;
850
- }
851
-
852
- if ( $disable_first ) {
853
- $page_links[] = '<span class="tablenav-pages-navspan button disabled" aria-hidden="true">&laquo;</span>';
854
- } else {
855
- $page_links[] = sprintf(
856
- "<a class='first-page button' href='%s'><span class='screen-reader-text'>%s</span><span aria-hidden='true'>%s</span></a>",
857
- esc_url( remove_query_arg( 'paged', $current_url ) ),
858
- __( 'First page' ),
859
- '&laquo;'
860
- );
861
- }
862
-
863
- if ( $disable_prev ) {
864
- $page_links[] = '<span class="tablenav-pages-navspan button disabled" aria-hidden="true">&lsaquo;</span>';
865
- } else {
866
- $page_links[] = sprintf(
867
- "<a class='prev-page button' href='%s'><span class='screen-reader-text'>%s</span><span aria-hidden='true'>%s</span></a>",
868
- esc_url( add_query_arg( 'paged', max( 1, $current - 1 ), $current_url ) ),
869
- __( 'Previous page' ),
870
- '&lsaquo;'
871
- );
872
- }
873
-
874
- if ( 'bottom' === $which ) {
875
- $html_current_page = $current;
876
- $total_pages_before = '<span class="screen-reader-text">' . __( 'Current Page' ) . '</span><span id="table-paging" class="paging-input"><span class="tablenav-paging-text">';
877
- } else {
878
- $html_current_page = sprintf(
879
- "%s<input class='current-page' id='current-page-selector' type='text' name='paged' value='%s' size='%d' aria-describedby='table-paging' /><span class='tablenav-paging-text'>",
880
- '<label for="current-page-selector" class="screen-reader-text">' . __( 'Current Page' ) . '</label>',
881
- $current,
882
- strlen( $total_pages )
883
- );
884
- }
885
- $html_total_pages = sprintf( "<span class='total-pages'>%s</span>", number_format_i18n( $total_pages ) );
886
- $page_links[] = $total_pages_before . sprintf(
887
- /* translators: 1: Current page, 2: Total pages. */
888
- _x( '%1$s of %2$s', 'paging' ),
889
- $html_current_page,
890
- $html_total_pages
891
- ) . $total_pages_after;
892
-
893
- if ( $disable_next ) {
894
- $page_links[] = '<span class="tablenav-pages-navspan button disabled" aria-hidden="true">&rsaquo;</span>';
895
- } else {
896
- $page_links[] = sprintf(
897
- "<a class='next-page button' href='%s'><span class='screen-reader-text'>%s</span><span aria-hidden='true'>%s</span></a>",
898
- esc_url( add_query_arg( 'paged', min( $total_pages, $current + 1 ), $current_url ) ),
899
- __( 'Next page' ),
900
- '&rsaquo;'
901
- );
902
- }
903
-
904
- if ( $disable_last ) {
905
- $page_links[] = '<span class="tablenav-pages-navspan button disabled" aria-hidden="true">&raquo;</span>';
906
- } else {
907
- $page_links[] = sprintf(
908
- "<a class='last-page button' href='%s'><span class='screen-reader-text'>%s</span><span aria-hidden='true'>%s</span></a>",
909
- esc_url( add_query_arg( 'paged', $total_pages, $current_url ) ),
910
- __( 'Last page' ),
911
- '&raquo;'
912
- );
913
- }
914
-
915
- $pagination_links_class = 'pagination-links';
916
- if ( ! empty( $infinite_scroll ) ) {
917
- $pagination_links_class .= ' hide-if-js';
918
- }
919
- $output .= "\n<span class='$pagination_links_class'>" . join( "\n", $page_links ) . '</span>';
920
-
921
- if ( $total_pages ) {
922
- $page_class = $total_pages < 2 ? ' one-page' : '';
923
- } else {
924
- $page_class = ' no-pages';
925
- }
926
- $this->_pagination = "<div class='tablenav-pages{$page_class}'>$output</div>";
927
-
928
- echo $this->_pagination;
929
- }
930
-
931
- /**
932
- * Get a list of columns. The format is:
933
- * 'internal-name' => 'Title'
934
- *
935
- * @since 3.1.0
936
- * @abstract
937
- *
938
- * @return array
939
- */
940
- public function get_columns() {
941
- die( 'function WP_List_Table::get_columns() must be over-ridden in a sub-class.' );
942
- }
943
-
944
- /**
945
- * Get a list of sortable columns. The format is:
946
- * 'internal-name' => 'orderby'
947
- * or
948
- * 'internal-name' => array( 'orderby', true )
949
- *
950
- * The second format will make the initial sorting order be descending
951
- *
952
- * @since 3.1.0
953
- *
954
- * @return array
955
- */
956
- protected function get_sortable_columns() {
957
- return array();
958
- }
959
-
960
- /**
961
- * Gets the name of the default primary column.
962
- *
963
- * @since 4.3.0
964
- *
965
- * @return string Name of the default primary column, in this case, an empty string.
966
- */
967
- protected function get_default_primary_column_name() {
968
- $columns = $this->get_columns();
969
- $column = '';
970
-
971
- if ( empty( $columns ) ) {
972
- return $column;
973
- }
974
-
975
- // We need a primary defined so responsive views show something,
976
- // so let's fall back to the first non-checkbox column.
977
- foreach ( $columns as $col => $column_name ) {
978
- if ( 'cb' === $col ) {
979
- continue;
980
- }
981
-
982
- $column = $col;
983
- break;
984
- }
985
-
986
- return $column;
987
- }
988
-
989
- /**
990
- * Public wrapper for WP_List_Table::get_default_primary_column_name().
991
- *
992
- * @since 4.4.0
993
- *
994
- * @return string Name of the default primary column.
995
- */
996
- public function get_primary_column() {
997
- return $this->get_primary_column_name();
998
- }
999
-
1000
- /**
1001
- * Gets the name of the primary column.
1002
- *
1003
- * @since 4.3.0
1004
- *
1005
- * @return string The name of the primary column.
1006
- */
1007
- protected function get_primary_column_name() {
1008
- $columns = get_column_headers( $this->screen );
1009
- $default = $this->get_default_primary_column_name();
1010
-
1011
- // If the primary column doesn't exist fall back to the
1012
- // first non-checkbox column.
1013
- if ( ! isset( $columns[ $default ] ) ) {
1014
- $default = ABPCT_List_Table::get_default_primary_column_name();
1015
- }
1016
-
1017
- /**
1018
- * Filters the name of the primary column for the current list table.
1019
- *
1020
- * @since 4.3.0
1021
- *
1022
- * @param string $default Column name default for the specific list table, e.g. 'name'.
1023
- * @param string $context Screen ID for specific list table, e.g. 'plugins'.
1024
- */
1025
- $column = apply_filters( 'list_table_primary_column', $default, $this->screen->id );
1026
-
1027
- if ( empty( $column ) || ! isset( $columns[ $column ] ) ) {
1028
- $column = $default;
1029
- }
1030
-
1031
- return $column;
1032
- }
1033
-
1034
- /**
1035
- * Get a list of all, hidden and sortable columns, with filter applied
1036
- *
1037
- * @since 3.1.0
1038
- *
1039
- * @return array
1040
- */
1041
- protected function get_column_info() {
1042
- // $_column_headers is already set / cached
1043
- if ( isset( $this->_column_headers ) && is_array( $this->_column_headers ) ) {
1044
- // Back-compat for list tables that have been manually setting $_column_headers for horse reasons.
1045
- // In 4.3, we added a fourth argument for primary column.
1046
- $column_headers = array( array(), array(), array(), $this->get_primary_column_name() );
1047
- foreach ( $this->_column_headers as $key => $value ) {
1048
- $column_headers[ $key ] = $value;
1049
- }
1050
-
1051
- return $column_headers;
1052
- }
1053
-
1054
- $columns = get_column_headers( $this->screen );
1055
- $hidden = get_hidden_columns( $this->screen );
1056
-
1057
- $sortable_columns = $this->get_sortable_columns();
1058
- /**
1059
- * Filters the list table sortable columns for a specific screen.
1060
- *
1061
- * The dynamic portion of the hook name, `$this->screen->id`, refers
1062
- * to the ID of the current screen, usually a string.
1063
- *
1064
- * @since 3.5.0
1065
- *
1066
- * @param array $sortable_columns An array of sortable columns.
1067
- */
1068
- $_sortable = apply_filters( "manage_{$this->screen->id}_sortable_columns", $sortable_columns );
1069
-
1070
- $sortable = array();
1071
- foreach ( $_sortable as $id => $data ) {
1072
- if ( empty( $data ) ) {
1073
- continue;
1074
- }
1075
-
1076
- $data = (array) $data;
1077
- if ( ! isset( $data[1] ) ) {
1078
- $data[1] = false;
1079
- }
1080
-
1081
- $sortable[ $id ] = $data;
1082
- }
1083
-
1084
- $primary = $this->get_primary_column_name();
1085
- $this->_column_headers = array( $columns, $hidden, $sortable, $primary );
1086
-
1087
- return $this->_column_headers;
1088
- }
1089
-
1090
- /**
1091
- * Return number of visible columns
1092
- *
1093
- * @since 3.1.0
1094
- *
1095
- * @return int
1096
- */
1097
- public function get_column_count() {
1098
- list ( $columns, $hidden ) = $this->get_column_info();
1099
- $hidden = array_intersect( array_keys( $columns ), array_filter( $hidden ) );
1100
- return count( $columns ) - count( $hidden );
1101
- }
1102
-
1103
- /**
1104
- * Print column headers, accounting for hidden and sortable columns.
1105
- *
1106
- * @since 3.1.0
1107
- *
1108
- * @staticvar int $cb_counter
1109
- *
1110
- * @param bool $with_id Whether to set the id attribute or not
1111
- */
1112
- public function print_column_headers( $with_id = true ) {
1113
- list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
1114
-
1115
- $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
1116
- $current_url = remove_query_arg( 'paged', $current_url );
1117
-
1118
- if ( isset( $_GET['orderby'] ) ) {
1119
- $current_orderby = $_GET['orderby'];
1120
- } else {
1121
- $current_orderby = '';
1122
- }
1123
-
1124
- if ( isset( $_GET['order'] ) && 'desc' === $_GET['order'] ) {
1125
- $current_order = 'desc';
1126
- } else {
1127
- $current_order = 'asc';
1128
- }
1129
-
1130
- if ( ! empty( $columns['cb'] ) ) {
1131
- static $cb_counter = 1;
1132
- $columns['cb'] = '<label class="screen-reader-text" for="cb-select-all-' . $cb_counter . '">' . __( 'Select All' ) . '</label>'
1133
- . '<input id="cb-select-all-' . $cb_counter . '" type="checkbox" />';
1134
- $cb_counter++;
1135
- }
1136
-
1137
- foreach ( $columns as $column_key => $column_display_name ) {
1138
- $class = array( 'manage-column', "column-$column_key" );
1139
-
1140
- if ( in_array( $column_key, $hidden ) ) {
1141
- $class[] = 'hidden';
1142
- }
1143
-
1144
- if ( 'cb' === $column_key ) {
1145
- $class[] = 'check-column';
1146
- } elseif ( in_array( $column_key, array( 'posts', 'comments', 'links' ) ) ) {
1147
- $class[] = 'num';
1148
- }
1149
-
1150
- if ( $column_key === $primary ) {
1151
- $class[] = 'column-primary';
1152
- }
1153
-
1154
- if ( isset( $sortable[ $column_key ] ) ) {
1155
- list( $orderby, $desc_first ) = $sortable[ $column_key ];
1156
-
1157
- if ( $current_orderby === $orderby ) {
1158
- $order = 'asc' === $current_order ? 'desc' : 'asc';
1159
- $class[] = 'sorted';
1160
- $class[] = $current_order;
1161
- } else {
1162
- $order = $desc_first ? 'desc' : 'asc';
1163
- $class[] = 'sortable';
1164
- $class[] = $desc_first ? 'asc' : 'desc';
1165
- }
1166
-
1167
- $column_display_name = '<a href="' . esc_url( add_query_arg( compact( 'orderby', 'order' ), $current_url ) ) . '"><span>' . $column_display_name . '</span><span class="sorting-indicator"></span></a>';
1168
- }
1169
-
1170
- $tag = ( 'cb' === $column_key ) ? 'td' : 'th';
1171
- $scope = ( 'th' === $tag ) ? 'scope="col"' : '';
1172
- $id = $with_id ? "id='$column_key'" : '';
1173
-
1174
- if ( ! empty( $class ) ) {
1175
- $class = "class='" . join( ' ', $class ) . "'";
1176
- }
1177
-
1178
- echo "<$tag $scope $id $class>$column_display_name</$tag>";
1179
- }
1180
- }
1181
-
1182
- /**
1183
- * Displays the table.
1184
- *
1185
- * @since 3.1.0
1186
- */
1187
- public function display() {
1188
- $singular = $this->_args['singular'];
1189
-
1190
- $this->display_tablenav( 'top' );
1191
-
1192
- $this->screen->render_screen_reader_content( 'heading_list' );
1193
- ?>
1194
- <table class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>">
1195
- <thead>
1196
- <tr>
1197
- <?php $this->print_column_headers(); ?>
1198
- </tr>
1199
- </thead>
1200
-
1201
- <tbody id="the-list"
1202
- <?php
1203
- if ( $singular ) {
1204
- echo " data-wp-lists='list:$singular'";
1205
- }
1206
- ?>
1207
- >
1208
- <?php $this->display_rows_or_placeholder(); ?>
1209
- </tbody>
1210
-
1211
- <tfoot>
1212
- <tr>
1213
- <?php $this->print_column_headers( false ); ?>
1214
- </tr>
1215
- </tfoot>
1216
-
1217
- </table>
1218
- <?php
1219
- $this->display_tablenav( 'bottom' );
1220
- }
1221
-
1222
- /**
1223
- * Get a list of CSS classes for the WP_List_Table table tag.
1224
- *
1225
- * @since 3.1.0
1226
- *
1227
- * @return array List of CSS classes for the table tag.
1228
- */
1229
- protected function get_table_classes() {
1230
- return array( 'widefat', 'fixed', 'striped', $this->_args['plural'] );
1231
- }
1232
-
1233
- /**
1234
- * Generate the table navigation above or below the table
1235
- *
1236
- * @since 3.1.0
1237
- * @param string $which
1238
- */
1239
- protected function display_tablenav( $which ) {
1240
- if ( 'top' === $which ) {
1241
- wp_nonce_field( 'bulk-' . $this->_args['plural'] );
1242
- }
1243
- ?>
1244
- <div class="tablenav <?php echo esc_attr( $which ); ?>">
1245
-
1246
- <?php if ( $this->has_items() ) : ?>
1247
- <div class="alignleft actions bulkactions">
1248
- <?php $this->bulk_actions( $which ); ?>
1249
- </div>
1250
- <?php
1251
- endif;
1252
- $this->extra_tablenav( $which );
1253
- $this->pagination( $which );
1254
- ?>
1255
-
1256
- <br class="clear" />
1257
- </div>
1258
- <?php
1259
- }
1260
-
1261
- /**
1262
- * Extra controls to be displayed between bulk actions and pagination
1263
- *
1264
- * @since 3.1.0
1265
- *
1266
- * @param string $which
1267
- */
1268
- protected function extra_tablenav( $which ) {}
1269
-
1270
- /**
1271
- * Generate the tbody element for the list table.
1272
- *
1273
- * @since 3.1.0
1274
- */
1275
- public function display_rows_or_placeholder() {
1276
- if ( $this->has_items() ) {
1277
- $this->display_rows();
1278
- } else {
1279
- echo '<tr class="no-items"><td class="colspanchange" colspan="' . $this->get_column_count() . '">';
1280
- $this->no_items();
1281
- echo '</td></tr>';
1282
- }
1283
- }
1284
-
1285
- /**
1286
- * Generate the table rows
1287
- *
1288
- * @since 3.1.0
1289
- */
1290
- public function display_rows() {
1291
- foreach ( $this->items as $item ) {
1292
- $this->single_row( $item );
1293
- }
1294
- }
1295
-
1296
- /**
1297
- * Generates content for a single row of the table
1298
- *
1299
- * @since 3.1.0
1300
- *
1301
- * @param object $item The current item
1302
- */
1303
- public function single_row( $item ) {
1304
- echo '<tr>';
1305
- $this->single_row_columns( $item );
1306
- echo '</tr>';
1307
- }
1308
-
1309
- /**
1310
- * @param object $item
1311
- * @param string $column_name
1312
- */
1313
- protected function column_default( $item, $column_name ) {}
1314
-
1315
- /**
1316
- * @param object $item
1317
- */
1318
- protected function column_cb( $item ) {}
1319
-
1320
- /**
1321
- * Generates the columns for a single row of the table
1322
- *
1323
- * @since 3.1.0
1324
- *
1325
- * @param object $item The current item
1326
- */
1327
- protected function single_row_columns( $item ) {
1328
- list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
1329
-
1330
- foreach ( $columns as $column_name => $column_display_name ) {
1331
- $classes = "$column_name column-$column_name";
1332
- if ( $primary === $column_name ) {
1333
- $classes .= ' has-row-actions column-primary';
1334
- }
1335
-
1336
- if ( in_array( $column_name, $hidden ) ) {
1337
- $classes .= ' hidden';
1338
- }
1339
-
1340
- // Comments column uses HTML in the display name with screen reader text.
1341
- // Instead of using esc_attr(), we strip tags to get closer to a user-friendly string.
1342
- $data = 'data-colname="' . wp_strip_all_tags( $column_display_name ) . '"';
1343
-
1344
- $attributes = "class='$classes' $data";
1345
-
1346
- if ( 'cb' === $column_name ) {
1347
- echo '<th scope="row" class="check-column">';
1348
- echo $this->column_cb( $item );
1349
- echo '</th>';
1350
- } elseif ( method_exists( $this, '_column_' . $column_name ) ) {
1351
- echo call_user_func(
1352
- array( $this, '_column_' . $column_name ),
1353
- $item,
1354
- $classes,
1355
- $data,
1356
- $primary
1357
- );
1358
- } elseif ( method_exists( $this, 'column_' . $column_name ) ) {
1359
- echo "<td $attributes>";
1360
- echo call_user_func( array( $this, 'column_' . $column_name ), $item );
1361
- echo $this->handle_row_actions( $item, $column_name, $primary );
1362
- echo '</td>';
1363
- } else {
1364
- echo "<td $attributes>";
1365
- echo $this->column_default( $item, $column_name );
1366
- echo $this->handle_row_actions( $item, $column_name, $primary );
1367
- echo '</td>';
1368
- }
1369
- }
1370
- }
1371
-
1372
- /**
1373
- * Generates and display row actions links for the list table.
1374
- *
1375
- * @since 4.3.0
1376
- *
1377
- * @param object $item The item being acted upon.
1378
- * @param string $column_name Current column name.
1379
- * @param string $primary Primary column name.
1380
- * @return string The row actions HTML, or an empty string if the current column is the primary column.
1381
- */
1382
- protected function handle_row_actions( $item, $column_name, $primary ) {
1383
- return $column_name === $primary ? '<button type="button" class="toggle-row"><span class="screen-reader-text">' . __( 'Show more details' ) . '</span></button>' : '';
1384
- }
1385
-
1386
- /**
1387
- * Handle an incoming ajax request (called from admin-ajax.php)
1388
- *
1389
- * @since 3.1.0
1390
- */
1391
- public function ajax_response() {
1392
- $this->prepare_items();
1393
-
1394
- ob_start();
1395
- if ( ! empty( $_REQUEST['no_placeholder'] ) ) {
1396
- $this->display_rows();
1397
- } else {
1398
- $this->display_rows_or_placeholder();
1399
- }
1400
-
1401
- $rows = ob_get_clean();
1402
-
1403
- $response = array( 'rows' => $rows );
1404
-
1405
- if ( isset( $this->_pagination_args['total_items'] ) ) {
1406
- $response['total_items_i18n'] = sprintf(
1407
- /* translators: Number of items. */
1408
- _n( '%s item', '%s items', $this->_pagination_args['total_items'] ),
1409
- number_format_i18n( $this->_pagination_args['total_items'] )
1410
- );
1411
- }
1412
- if ( isset( $this->_pagination_args['total_pages'] ) ) {
1413
- $response['total_pages'] = $this->_pagination_args['total_pages'];
1414
- $response['total_pages_i18n'] = number_format_i18n( $this->_pagination_args['total_pages'] );
1415
- }
1416
-
1417
- die( wp_json_encode( $response ) );
1418
- }
1419
-
1420
- /**
1421
- * Send required variables to JavaScript land
1422
- */
1423
- public function _js_vars() {
1424
- $args = array(
1425
- 'class' => get_class( $this ),
1426
- 'screen' => array(
1427
- 'id' => $this->screen->id,
1428
- 'base' => $this->screen->base,
1429
- ),
1430
- );
1431
-
1432
- printf( "<script type='text/javascript'>list_args = %s;</script>\n", wp_json_encode( $args ) );
1433
- }
1434
- }
1
+ <?php
2
+ /**
3
+ * This is copy of the WP_List_Table class for the future compability
4
+ */
5
+
6
+ /**
7
+ * Administration API: WP_List_Table class
8
+ *
9
+ * @package WordPress
10
+ * @subpackage List_Table
11
+ * @since 3.1.0
12
+ */
13
+
14
+ /**
15
+ * Base class for displaying a list of items in an ajaxified HTML table.
16
+ *
17
+ * @since 3.1.0
18
+ * @access private
19
+ */
20
+ class ABPCT_List_Table {
21
+
22
+ /**
23
+ * The current list of items.
24
+ *
25
+ * @since 3.1.0
26
+ * @var array
27
+ */
28
+ public $items;
29
+
30
+ /**
31
+ * Various information about the current table.
32
+ *
33
+ * @since 3.1.0
34
+ * @var array
35
+ */
36
+ protected $_args;
37
+
38
+ /**
39
+ * Various information needed for displaying the pagination.
40
+ *
41
+ * @since 3.1.0
42
+ * @var array
43
+ */
44
+ protected $_pagination_args = array();
45
+
46
+ /**
47
+ * The current screen.
48
+ *
49
+ * @since 3.1.0
50
+ * @var object
51
+ */
52
+ protected $screen;
53
+
54
+ /**
55
+ * Cached bulk actions.
56
+ *
57
+ * @since 3.1.0
58
+ * @var array
59
+ */
60
+ private $_actions;
61
+
62
+ /**
63
+ * Cached pagination output.
64
+ *
65
+ * @since 3.1.0
66
+ * @var string
67
+ */
68
+ private $_pagination;
69
+
70
+ /**
71
+ * The view switcher modes.
72
+ *
73
+ * @since 4.1.0
74
+ * @var array
75
+ */
76
+ protected $modes = array();
77
+
78
+ /**
79
+ * Stores the value returned by ->get_column_info().
80
+ *
81
+ * @since 4.1.0
82
+ * @var array
83
+ */
84
+ protected $_column_headers;
85
+
86
+ /**
87
+ * {@internal Missing Summary}
88
+ *
89
+ * @var array
90
+ */
91
+ protected $compat_fields = array( '_args', '_pagination_args', 'screen', '_actions', '_pagination' );
92
+
93
+ /**
94
+ * {@internal Missing Summary}
95
+ *
96
+ * @var array
97
+ */
98
+ protected $compat_methods = array(
99
+ 'set_pagination_args',
100
+ 'get_views',
101
+ 'get_bulk_actions',
102
+ 'bulk_actions',
103
+ 'row_actions',
104
+ 'months_dropdown',
105
+ 'view_switcher',
106
+ 'comments_bubble',
107
+ 'get_items_per_page',
108
+ 'pagination',
109
+ 'get_sortable_columns',
110
+ 'get_column_info',
111
+ 'get_table_classes',
112
+ 'display_tablenav',
113
+ 'extra_tablenav',
114
+ 'single_row_columns',
115
+ );
116
+
117
+ /**
118
+ * Constructor.
119
+ *
120
+ * The child class should call this constructor from its own constructor to override
121
+ * the default $args.
122
+ *
123
+ * @since 3.1.0
124
+ *
125
+ * @param array|string $args {
126
+ * Array or string of arguments.
127
+ *
128
+ * @type string $plural Plural value used for labels and the objects being listed.
129
+ * This affects things such as CSS class-names and nonces used
130
+ * in the list table, e.g. 'posts'. Default empty.
131
+ * @type string $singular Singular label for an object being listed, e.g. 'post'.
132
+ * Default empty
133
+ * @type bool $ajax Whether the list table supports Ajax. This includes loading
134
+ * and sorting data, for example. If true, the class will call
135
+ * the _js_vars() method in the footer to provide variables
136
+ * to any scripts handling Ajax events. Default false.
137
+ * @type string $screen String containing the hook name used to determine the current
138
+ * screen. If left null, the current screen will be automatically set.
139
+ * Default null.
140
+ * }
141
+ */
142
+ public function __construct( $args = array() ) {
143
+ $args = wp_parse_args(
144
+ $args,
145
+ array(
146
+ 'plural' => '',
147
+ 'singular' => '',
148
+ 'ajax' => false,
149
+ 'screen' => null,
150
+ )
151
+ );
152
+
153
+ $this->screen = convert_to_screen( $args['screen'] );
154
+
155
+ add_filter( "manage_{$this->screen->id}_columns", array( $this, 'get_columns' ), 0 );
156
+
157
+ if ( ! $args['plural'] ) {
158
+ $args['plural'] = $this->screen->base;
159
+ }
160
+
161
+ $args['plural'] = sanitize_key( $args['plural'] );
162
+ $args['singular'] = sanitize_key( $args['singular'] );
163
+
164
+ $this->_args = $args;
165
+
166
+ if ( $args['ajax'] ) {
167
+ // wp_enqueue_script( 'list-table' );
168
+ add_action( 'admin_footer', array( $this, '_js_vars' ) );
169
+ }
170
+
171
+ if ( empty( $this->modes ) ) {
172
+ $this->modes = array(
173
+ 'list' => __( 'List View' ),
174
+ 'excerpt' => __( 'Excerpt View' ),
175
+ );
176
+ }
177
+ }
178
+
179
+ /**
180
+ * Make private properties readable for backward compatibility.
181
+ *
182
+ * @since 4.0.0
183
+ *
184
+ * @param string $name Property to get.
185
+ * @return mixed Property.
186
+ */
187
+ public function __get( $name ) {
188
+ if ( in_array( $name, $this->compat_fields ) ) {
189
+ return $this->$name;
190
+ }
191
+ }
192
+
193
+ /**
194
+ * Make private properties settable for backward compatibility.
195
+ *
196
+ * @since 4.0.0
197
+ *
198
+ * @param string $name Property to check if set.
199
+ * @param mixed $value Property value.
200
+ * @return mixed Newly-set property.
201
+ */
202
+ public function __set( $name, $value ) {
203
+ if ( in_array( $name, $this->compat_fields ) ) {
204
+ return $this->$name = $value;
205
+ }
206
+ }
207
+
208
+ /**
209
+ * Make private properties checkable for backward compatibility.
210
+ *
211
+ * @since 4.0.0
212
+ *
213
+ * @param string $name Property to check if set.
214
+ * @return bool Whether the property is set.
215
+ */
216
+ public function __isset( $name ) {
217
+ if ( in_array( $name, $this->compat_fields ) ) {
218
+ return isset( $this->$name );
219
+ }
220
+ }
221
+
222
+ /**
223
+ * Make private properties un-settable for backward compatibility.
224
+ *
225
+ * @since 4.0.0
226
+ *
227
+ * @param string $name Property to unset.
228
+ */
229
+ public function __unset( $name ) {
230
+ if ( in_array( $name, $this->compat_fields ) ) {
231
+ unset( $this->$name );
232
+ }
233
+ }
234
+
235
+ /**
236
+ * Make private/protected methods readable for backward compatibility.
237
+ *
238
+ * @since 4.0.0
239
+ *
240
+ * @param string $name Method to call.
241
+ * @param array $arguments Arguments to pass when calling.
242
+ * @return mixed|bool Return value of the callback, false otherwise.
243
+ */
244
+ public function __call( $name, $arguments ) {
245
+ if ( in_array( $name, $this->compat_methods ) ) {
246
+ return $this->$name( ...$arguments );
247
+ }
248
+ return false;
249
+ }
250
+
251
+ /**
252
+ * Checks the current user's permissions
253
+ *
254
+ * @since 3.1.0
255
+ * @abstract
256
+ */
257
+ public function ajax_user_can() {
258
+ die( 'function WP_List_Table::ajax_user_can() must be over-ridden in a sub-class.' );
259
+ }
260
+
261
+ /**
262
+ * Prepares the list of items for displaying.
263
+ *
264
+ * @uses WP_List_Table::set_pagination_args()
265
+ *
266
+ * @since 3.1.0
267
+ * @abstract
268
+ */
269
+ public function prepare_items() {
270
+ die( 'function WP_List_Table::prepare_items() must be over-ridden in a sub-class.' );
271
+ }
272
+
273
+ /**
274
+ * An internal method that sets all the necessary pagination arguments
275
+ *
276
+ * @since 3.1.0
277
+ *
278
+ * @param array|string $args Array or string of arguments with information about the pagination.
279
+ */
280
+ protected function set_pagination_args( $args ) {
281
+ $args = wp_parse_args(
282
+ $args,
283
+ array(
284
+ 'total_items' => 0,
285
+ 'total_pages' => 0,
286
+ 'per_page' => 0,
287
+ )
288
+ );
289
+
290
+ if ( ! $args['total_pages'] && $args['per_page'] > 0 ) {
291
+ $args['total_pages'] = ceil( $args['total_items'] / $args['per_page'] );
292
+ }
293
+
294
+ // Redirect if page number is invalid and headers are not already sent.
295
+ if ( ! headers_sent() && ! wp_doing_ajax() && $args['total_pages'] > 0 && $this->get_pagenum() > $args['total_pages'] ) {
296
+ wp_redirect( add_query_arg( 'paged', $args['total_pages'] ) );
297
+ exit;
298
+ }
299
+
300
+ $this->_pagination_args = $args;
301
+ }
302
+
303
+ /**
304
+ * Access the pagination args.
305
+ *
306
+ * @since 3.1.0
307
+ *
308
+ * @param string $key Pagination argument to retrieve. Common values include 'total_items',
309
+ * 'total_pages', 'per_page', or 'infinite_scroll'.
310
+ * @return int Number of items that correspond to the given pagination argument.
311
+ */
312
+ public function get_pagination_arg( $key ) {
313
+ if ( 'page' === $key ) {
314
+ return $this->get_pagenum();
315
+ }
316
+
317
+ if ( isset( $this->_pagination_args[ $key ] ) ) {
318
+ return $this->_pagination_args[ $key ];
319
+ }
320
+ }
321
+
322
+ /**
323
+ * Whether the table has items to display or not
324
+ *
325
+ * @since 3.1.0
326
+ *
327
+ * @return bool
328
+ */
329
+ public function has_items() {
330
+ return ! empty( $this->items );
331
+ }
332
+
333
+ /**
334
+ * Message to be displayed when there are no items
335
+ *
336
+ * @since 3.1.0
337
+ */
338
+ public function no_items() {
339
+ _e( 'No items found.' );
340
+ }
341
+
342
+ /**
343
+ * Displays the search box.
344
+ *
345
+ * @since 3.1.0
346
+ *
347
+ * @param string $text The 'submit' button label.
348
+ * @param string $input_id ID attribute value for the search input field.
349
+ */
350
+ public function search_box( $text, $input_id ) {
351
+ if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) {
352
+ return;
353
+ }
354
+
355
+ $input_id = $input_id . '-search-input';
356
+
357
+ if ( ! empty( $_REQUEST['orderby'] ) ) {
358
+ echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
359
+ }
360
+ if ( ! empty( $_REQUEST['order'] ) ) {
361
+ echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
362
+ }
363
+ if ( ! empty( $_REQUEST['post_mime_type'] ) ) {
364
+ echo '<input type="hidden" name="post_mime_type" value="' . esc_attr( $_REQUEST['post_mime_type'] ) . '" />';
365
+ }
366
+ if ( ! empty( $_REQUEST['detached'] ) ) {
367
+ echo '<input type="hidden" name="detached" value="' . esc_attr( $_REQUEST['detached'] ) . '" />';
368
+ }
369
+ ?>
370
+ <p class="search-box">
371
+ <label class="screen-reader-text" for="<?php echo esc_attr( $input_id ); ?>"><?php echo $text; ?>:</label>
372
+ <input type="search" id="<?php echo esc_attr( $input_id ); ?>" name="s" value="<?php _admin_search_query(); ?>" />
373
+ <?php submit_button( $text, '', '', false, array( 'id' => 'search-submit' ) ); ?>
374
+ </p>
375
+ <?php
376
+ }
377
+
378
+ /**
379
+ * Get an associative array ( id => link ) with the list
380
+ * of views available on this table.
381
+ *
382
+ * @since 3.1.0
383
+ *
384
+ * @return array
385
+ */
386
+ protected function get_views() {
387
+ return array();
388
+ }
389
+
390
+ /**
391
+ * Display the list of views available on this table.
392
+ *
393
+ * @since 3.1.0
394
+ */
395
+ public function views() {
396
+ $views = $this->get_views();
397
+ /**
398
+ * Filters the list of available list table views.
399
+ *
400
+ * The dynamic portion of the hook name, `$this->screen->id`, refers
401
+ * to the ID of the current screen, usually a string.
402
+ *
403
+ * @since 3.5.0
404
+ *
405
+ * @param string[] $views An array of available list table views.
406
+ */
407
+ $views = apply_filters( "views_{$this->screen->id}", $views );
408
+
409
+ if ( empty( $views ) ) {
410
+ return;
411
+ }
412
+
413
+ $this->screen->render_screen_reader_content( 'heading_views' );
414
+
415
+ echo "<ul class='subsubsub'>\n";
416
+ foreach ( $views as $class => $view ) {
417
+ $views[ $class ] = "\t<li class='$class'>$view";
418
+ }
419
+ echo implode( " |</li>\n", $views ) . "</li>\n";
420
+ echo '</ul>';
421
+ }
422
+
423
+ /**
424
+ * Get an associative array ( option_name => option_title ) with the list
425
+ * of bulk actions available on this table.
426
+ *
427
+ * @since 3.1.0
428
+ *
429
+ * @return array
430
+ */
431
+ protected function get_bulk_actions() {
432
+ return array();
433
+ }
434
+
435
+ /**
436
+ * Display the bulk actions dropdown.
437
+ *
438
+ * @since 3.1.0
439
+ *
440
+ * @param string $which The location of the bulk actions: 'top' or 'bottom'.
441
+ * This is designated as optional for backward compatibility.
442
+ */
443
+ protected function bulk_actions( $which = '' ) {
444
+ if ( is_null( $this->_actions ) ) {
445
+ $this->_actions = $this->get_bulk_actions();
446
+ /**
447
+ * Filters the list table Bulk Actions drop-down.
448
+ *
449
+ * The dynamic portion of the hook name, `$this->screen->id`, refers
450
+ * to the ID of the current screen, usually a string.
451
+ *
452
+ * This filter can currently only be used to remove bulk actions.
453
+ *
454
+ * @since 3.5.0
455
+ *
456
+ * @param string[] $actions An array of the available bulk actions.
457
+ */
458
+ $this->_actions = apply_filters( "bulk_actions-{$this->screen->id}", $this->_actions ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
459
+ $two = '';
460
+ } else {
461
+ $two = '2';
462
+ }
463
+
464
+ if ( empty( $this->_actions ) ) {
465
+ return;
466
+ }
467
+
468
+ echo '<label for="bulk-action-selector-' . esc_attr( $which ) . '" class="screen-reader-text">' . __( 'Select bulk action' ) . '</label>';
469
+ echo '<select name="action' . $two . '" id="bulk-action-selector-' . esc_attr( $which ) . "\">\n";
470
+ echo '<option value="-1">' . __( 'Bulk Actions' ) . "</option>\n";
471
+
472
+ foreach ( $this->_actions as $name => $title ) {
473
+ $class = 'edit' === $name ? ' class="hide-if-no-js"' : '';
474
+
475
+ echo "\t" . '<option value="' . $name . '"' . $class . '>' . $title . "</option>\n";
476
+ }
477
+
478
+ echo "</select>\n";
479
+
480
+ submit_button( __( 'Apply' ), 'action', '', false, array( 'id' => "doaction$two" ) );
481
+ echo "\n";
482
+ }
483
+
484
+ /**
485
+ * Get the current action selected from the bulk actions dropdown.
486
+ *
487
+ * @since 3.1.0
488
+ *
489
+ * @return string|false The action name or False if no action was selected
490
+ */
491
+ public function current_action() {
492
+ if ( isset( $_REQUEST['filter_action'] ) && ! empty( $_REQUEST['filter_action'] ) ) {
493
+ return false;
494
+ }
495
+
496
+ if ( isset( $_REQUEST['action'] ) && -1 != $_REQUEST['action'] ) {
497
+ return $_REQUEST['action'];
498
+ }
499
+
500
+ if ( isset( $_REQUEST['action2'] ) && -1 != $_REQUEST['action2'] ) {
501
+ return $_REQUEST['action2'];
502
+ }
503
+
504
+ return false;
505
+ }
506
+
507
+ /**
508
+ * Generate row actions div
509
+ *
510
+ * @since 3.1.0
511
+ *
512
+ * @param string[] $actions An array of action links.
513
+ * @param bool $always_visible Whether the actions should be always visible.
514
+ * @return string
515
+ */
516
+ protected function row_actions( $actions, $always_visible = false ) {
517
+ $action_count = count( $actions );
518
+ $i = 0;
519
+
520
+ if ( ! $action_count ) {
521
+ return '';
522
+ }
523
+
524
+ $out = '<div class="' . ( $always_visible ? 'row-actions visible' : 'row-actions' ) . '">';
525
+ foreach ( $actions as $action => $link ) {
526
+ ++$i;
527
+ ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
528
+ $out .= "<span class='$action'>$link$sep</span>";
529
+ }
530
+ $out .= '</div>';
531
+
532
+ $out .= '<button type="button" class="toggle-row"><span class="screen-reader-text">' . __( 'Show more details' ) . '</span></button>';
533
+
534
+ return $out;
535
+ }
536
+
537
+ /**
538
+ * Display a monthly dropdown for filtering items
539
+ *
540
+ * @since 3.1.0
541
+ *
542
+ * @global wpdb $wpdb WordPress database abstraction object.
543
+ * @global WP_Locale $wp_locale WordPress date and time locale object.
544
+ *
545
+ * @param string $post_type
546
+ */
547
+ protected function months_dropdown( $post_type ) {
548
+ global $wpdb, $wp_locale;
549
+
550
+ /**
551
+ * Filters whether to remove the 'Months' drop-down from the post list table.
552
+ *
553
+ * @since 4.2.0
554
+ *
555
+ * @param bool $disable Whether to disable the drop-down. Default false.
556
+ * @param string $post_type The post type.
557
+ */
558
+ if ( apply_filters( 'disable_months_dropdown', false, $post_type ) ) {
559
+ return;
560
+ }
561
+
562
+ $extra_checks = "AND post_status != 'auto-draft'";
563
+ if ( ! isset( $_GET['post_status'] ) || 'trash' !== $_GET['post_status'] ) {
564
+ $extra_checks .= " AND post_status != 'trash'";
565
+ } elseif ( isset( $_GET['post_status'] ) ) {
566
+ $extra_checks = $wpdb->prepare( ' AND post_status = %s', $_GET['post_status'] );
567
+ }
568
+
569
+ $months = $wpdb->get_results(
570
+ $wpdb->prepare(
571
+ "
572
+ SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month
573
+ FROM $wpdb->posts
574
+ WHERE post_type = %s
575
+ $extra_checks
576
+ ORDER BY post_date DESC
577
+ ",
578
+ $post_type
579
+ )
580
+ );
581
+
582
+ /**
583
+ * Filters the 'Months' drop-down results.
584
+ *
585
+ * @since 3.7.0
586
+ *
587
+ * @param object $months The months drop-down query results.
588
+ * @param string $post_type The post type.
589
+ */
590
+ $months = apply_filters( 'months_dropdown_results', $months, $post_type );
591
+
592
+ $month_count = count( $months );
593
+
594
+ if ( ! $month_count || ( 1 == $month_count && 0 == $months[0]->month ) ) {
595
+ return;
596
+ }
597
+
598
+ $m = isset( $_GET['m'] ) ? (int) $_GET['m'] : 0;
599
+ ?>
600
+ <label for="filter-by-date" class="screen-reader-text"><?php _e( 'Filter by date' ); ?></label>
601
+ <select name="m" id="filter-by-date">
602
+ <option<?php selected( $m, 0 ); ?> value="0"><?php _e( 'All dates' ); ?></option>
603
+ <?php
604
+ foreach ( $months as $arc_row ) {
605
+ if ( 0 == $arc_row->year ) {
606
+ continue;
607
+ }
608
+
609
+ $month = zeroise( $arc_row->month, 2 );
610
+ $year = $arc_row->year;
611
+
612
+ printf(
613
+ "<option %s value='%s'>%s</option>\n",
614
+ selected( $m, $year . $month, false ),
615
+ esc_attr( $arc_row->year . $month ),
616
+ /* translators: 1: Month name, 2: 4-digit year. */
617
+ sprintf( __( '%1$s %2$d' ), $wp_locale->get_month( $month ), $year )
618
+ );
619
+ }
620
+ ?>
621
+ </select>
622
+ <?php
623
+ }
624
+
625
+ /**
626
+ * Display a view switcher
627
+ *
628
+ * @since 3.1.0
629
+ *
630
+ * @param string $current_mode
631
+ */
632
+ protected function view_switcher( $current_mode ) {
633
+ ?>
634
+ <input type="hidden" name="mode" value="<?php echo esc_attr( $current_mode ); ?>" />
635
+ <div class="view-switch">
636
+ <?php
637
+ foreach ( $this->modes as $mode => $title ) {
638
+ $classes = array( 'view-' . $mode );
639
+ $aria_current = '';
640
+
641
+ if ( $current_mode === $mode ) {
642
+ $classes[] = 'current';
643
+ $aria_current = ' aria-current="page"';
644
+ }
645
+ printf(
646
+ "<a href='%s' class='%s' id='view-switch-$mode'$aria_current><span class='screen-reader-text'>%s</span></a>\n",
647
+ esc_url( add_query_arg( 'mode', $mode ) ),
648
+ implode( ' ', $classes ),
649
+ $title
650
+ );
651
+ }
652
+ ?>
653
+ </div>
654
+ <?php
655
+ }
656
+
657
+ /**
658
+ * Display a comment count bubble
659
+ *
660
+ * @since 3.1.0
661
+ *
662
+ * @param int $post_id The post ID.
663
+ * @param int $pending_comments Number of pending comments.
664
+ */
665
+ protected function comments_bubble( $post_id, $pending_comments ) {
666
+ $approved_comments = get_comments_number();
667
+
668
+ $approved_comments_number = number_format_i18n( $approved_comments );
669
+ $pending_comments_number = number_format_i18n( $pending_comments );
670
+
671
+ $approved_only_phrase = sprintf(
672
+ /* translators: %s: Number of comments. */
673
+ _n( '%s comment', '%s comments', $approved_comments ),
674
+ $approved_comments_number
675
+ );
676
+
677
+ $approved_phrase = sprintf(
678
+ /* translators: %s: Number of comments. */
679
+ _n( '%s approved comment', '%s approved comments', $approved_comments ),
680
+ $approved_comments_number
681
+ );
682
+
683
+ $pending_phrase = sprintf(
684
+ /* translators: %s: Number of comments. */
685
+ _n( '%s pending comment', '%s pending comments', $pending_comments ),
686
+ $pending_comments_number
687
+ );
688
+
689
+ // No comments at all.
690
+ if ( ! $approved_comments && ! $pending_comments ) {
691
+ printf(
692
+ '<span aria-hidden="true">&#8212;</span><span class="screen-reader-text">%s</span>',
693
+ __( 'No comments' )
694
+ );
695
+ // Approved comments have different display depending on some conditions.
696
+ } elseif ( $approved_comments ) {
697
+ printf(
698
+ '<a href="%s" class="post-com-count post-com-count-approved"><span class="comment-count-approved" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></a>',
699
+ esc_url(
700
+ add_query_arg(
701
+ array(
702
+ 'p' => $post_id,
703
+ 'comment_status' => 'approved',
704
+ ),
705
+ admin_url( 'edit-comments.php' )
706
+ )
707
+ ),
708
+ $approved_comments_number,
709
+ $pending_comments ? $approved_phrase : $approved_only_phrase
710
+ );
711
+ } else {
712
+ printf(
713
+ '<span class="post-com-count post-com-count-no-comments"><span class="comment-count comment-count-no-comments" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></span>',
714
+ $approved_comments_number,
715
+ $pending_comments ? __( 'No approved comments' ) : __( 'No comments' )
716
+ );
717
+ }
718
+
719
+ if ( $pending_comments ) {
720
+ printf(
721
+ '<a href="%s" class="post-com-count post-com-count-pending"><span class="comment-count-pending" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></a>',
722
+ esc_url(
723
+ add_query_arg(
724
+ array(
725
+ 'p' => $post_id,
726
+ 'comment_status' => 'moderated',
727
+ ),
728
+ admin_url( 'edit-comments.php' )
729
+ )
730
+ ),
731
+ $pending_comments_number,
732
+ $pending_phrase
733
+ );
734
+ } else {
735
+ printf(
736
+ '<span class="post-com-count post-com-count-pending post-com-count-no-pending"><span class="comment-count comment-count-no-pending" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></span>',
737
+ $pending_comments_number,
738
+ $approved_comments ? __( 'No pending comments' ) : __( 'No comments' )
739
+ );
740
+ }
741
+ }
742
+
743
+ /**
744
+ * Get the current page number
745
+ *
746
+ * @since 3.1.0
747
+ *
748
+ * @return int
749
+ */
750
+ public function get_pagenum() {
751
+ $pagenum = isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 0;
752
+
753
+ if ( isset( $this->_pagination_args['total_pages'] ) && $pagenum > $this->_pagination_args['total_pages'] ) {
754
+ $pagenum = $this->_pagination_args['total_pages'];
755
+ }
756
+
757
+ return max( 1, $pagenum );
758
+ }
759
+
760
+ /**
761
+ * Get number of items to display on a single page
762
+ *
763
+ * @since 3.1.0
764
+ *
765
+ * @param string $option
766
+ * @param int $default
767
+ * @return int
768
+ */
769
+ protected function get_items_per_page( $option, $default = 20 ) {
770
+ $per_page = (int) get_user_option( $option );
771
+ if ( empty( $per_page ) || $per_page < 1 ) {
772
+ $per_page = $default;
773
+ }
774
+
775
+ /**
776
+ * Filters the number of items to be displayed on each page of the list table.
777
+ *
778
+ * The dynamic hook name, $option, refers to the `per_page` option depending
779
+ * on the type of list table in use. Possible values include: 'edit_comments_per_page',
780
+ * 'sites_network_per_page', 'site_themes_network_per_page', 'themes_network_per_page',
781
+ * 'users_network_per_page', 'edit_post_per_page', 'edit_page_per_page',
782
+ * 'edit_{$post_type}_per_page', etc.
783
+ *
784
+ * @since 2.9.0
785
+ *
786
+ * @param int $per_page Number of items to be displayed. Default 20.
787
+ */
788
+ return (int) apply_filters( "{$option}", $per_page );
789
+ }
790
+
791
+ /**
792
+ * Display the pagination.
793
+ *
794
+ * @since 3.1.0
795
+ *
796
+ * @param string $which
797
+ */
798
+ protected function pagination( $which ) {
799
+ if ( empty( $this->_pagination_args ) ) {
800
+ return;
801
+ }
802
+
803
+ $total_items = $this->_pagination_args['total_items'];
804
+ $total_pages = $this->_pagination_args['total_pages'];
805
+ $infinite_scroll = false;
806
+ if ( isset( $this->_pagination_args['infinite_scroll'] ) ) {
807
+ $infinite_scroll = $this->_pagination_args['infinite_scroll'];
808
+ }
809
+
810
+ if ( 'top' === $which && $total_pages > 1 ) {
811
+ $this->screen->render_screen_reader_content( 'heading_pagination' );
812
+ }
813
+
814
+ $output = '<span class="displaying-num">' . sprintf(
815
+ /* translators: %s: Number of items. */
816
+ _n( '%s item', '%s items', $total_items ),
817
+ number_format_i18n( $total_items )
818
+ ) . '</span>';
819
+
820
+ $current = $this->get_pagenum();
821
+ $removable_query_args = wp_removable_query_args();
822
+
823
+ $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
824
+
825
+ $current_url = remove_query_arg( $removable_query_args, $current_url );
826
+
827
+ $page_links = array();
828
+
829
+ $total_pages_before = '<span class="paging-input">';
830
+ $total_pages_after = '</span></span>';
831
+
832
+ $disable_first = false;
833
+ $disable_last = false;
834
+ $disable_prev = false;
835
+ $disable_next = false;
836
+
837
+ if ( $current == 1 ) {
838
+ $disable_first = true;
839
+ $disable_prev = true;
840
+ }
841
+ if ( $current == 2 ) {
842
+ $disable_first = true;
843
+ }
844
+ if ( $current == $total_pages ) {
845
+ $disable_last = true;
846
+ $disable_next = true;
847
+ }
848
+ if ( $current == $total_pages - 1 ) {
849
+ $disable_last = true;
850
+ }
851
+
852
+ if ( $disable_first ) {
853
+ $page_links[] = '<span class="tablenav-pages-navspan button disabled" aria-hidden="true">&laquo;</span>';
854
+ } else {
855
+ $page_links[] = sprintf(
856
+ "<a class='first-page button' href='%s'><span class='screen-reader-text'>%s</span><span aria-hidden='true'>%s</span></a>",
857
+ esc_url( remove_query_arg( 'paged', $current_url ) ),
858
+ __( 'First page' ),
859
+ '&laquo;'
860
+ );
861
+ }
862
+
863
+ if ( $disable_prev ) {
864
+ $page_links[] = '<span class="tablenav-pages-navspan button disabled" aria-hidden="true">&lsaquo;</span>';
865
+ } else {
866
+ $page_links[] = sprintf(
867
+ "<a class='prev-page button' href='%s'><span class='screen-reader-text'>%s</span><span aria-hidden='true'>%s</span></a>",
868
+ esc_url( add_query_arg( 'paged', max( 1, $current - 1 ), $current_url ) ),
869
+ __( 'Previous page' ),
870
+ '&lsaquo;'
871
+ );
872
+ }
873
+
874
+ if ( 'bottom' === $which ) {
875
+ $html_current_page = $current;
876
+ $total_pages_before = '<span class="screen-reader-text">' . __( 'Current Page' ) . '</span><span id="table-paging" class="paging-input"><span class="tablenav-paging-text">';
877
+ } else {
878
+ $html_current_page = sprintf(
879
+ "%s<input class='current-page' id='current-page-selector' type='text' name='paged' value='%s' size='%d' aria-describedby='table-paging' /><span class='tablenav-paging-text'>",
880
+ '<label for="current-page-selector" class="screen-reader-text">' . __( 'Current Page' ) . '</label>',
881
+ $current,
882
+ strlen( $total_pages )
883
+ );
884
+ }
885
+ $html_total_pages = sprintf( "<span class='total-pages'>%s</span>", number_format_i18n( $total_pages ) );
886
+ $page_links[] = $total_pages_before . sprintf(
887
+ /* translators: 1: Current page, 2: Total pages. */
888
+ _x( '%1$s of %2$s', 'paging' ),
889
+ $html_current_page,
890
+ $html_total_pages
891
+ ) . $total_pages_after;
892
+
893
+ if ( $disable_next ) {
894
+ $page_links[] = '<span class="tablenav-pages-navspan button disabled" aria-hidden="true">&rsaquo;</span>';
895
+ } else {
896
+ $page_links[] = sprintf(
897
+ "<a class='next-page button' href='%s'><span class='screen-reader-text'>%s</span><span aria-hidden='true'>%s</span></a>",
898
+ esc_url( add_query_arg( 'paged', min( $total_pages, $current + 1 ), $current_url ) ),
899
+ __( 'Next page' ),
900
+ '&rsaquo;'
901
+ );
902
+ }
903
+
904
+ if ( $disable_last ) {
905
+ $page_links[] = '<span class="tablenav-pages-navspan button disabled" aria-hidden="true">&raquo;</span>';
906
+ } else {
907
+ $page_links[] = sprintf(
908
+ "<a class='last-page button' href='%s'><span class='screen-reader-text'>%s</span><span aria-hidden='true'>%s</span></a>",
909
+ esc_url( add_query_arg( 'paged', $total_pages, $current_url ) ),
910
+ __( 'Last page' ),
911
+ '&raquo;'
912
+ );
913
+ }
914
+
915
+ $pagination_links_class = 'pagination-links';
916
+ if ( ! empty( $infinite_scroll ) ) {
917
+ $pagination_links_class .= ' hide-if-js';
918
+ }
919
+ $output .= "\n<span class='$pagination_links_class'>" . join( "\n", $page_links ) . '</span>';
920
+
921
+ if ( $total_pages ) {
922
+ $page_class = $total_pages < 2 ? ' one-page' : '';
923
+ } else {
924
+ $page_class = ' no-pages';
925
+ }
926
+ $this->_pagination = "<div class='tablenav-pages{$page_class}'>$output</div>";
927
+
928
+ echo $this->_pagination;
929
+ }
930
+
931
+ /**
932
+ * Get a list of columns. The format is:
933
+ * 'internal-name' => 'Title'
934
+ *
935
+ * @since 3.1.0
936
+ * @abstract
937
+ *
938
+ * @return array
939
+ */
940
+ public function get_columns() {
941
+ die( 'function WP_List_Table::get_columns() must be over-ridden in a sub-class.' );
942
+ }
943
+
944
+ /**
945
+ * Get a list of sortable columns. The format is:
946
+ * 'internal-name' => 'orderby'
947
+ * or
948
+ * 'internal-name' => array( 'orderby', true )
949
+ *
950
+ * The second format will make the initial sorting order be descending
951
+ *
952
+ * @since 3.1.0
953
+ *
954
+ * @return array
955
+ */
956
+ protected function get_sortable_columns() {
957
+ return array();
958
+ }
959
+
960
+ /**
961
+ * Gets the name of the default primary column.
962
+ *
963
+ * @since 4.3.0
964
+ *
965
+ * @return string Name of the default primary column, in this case, an empty string.
966
+ */
967
+ protected function get_default_primary_column_name() {
968
+ $columns = $this->get_columns();
969
+ $column = '';
970
+
971
+ if ( empty( $columns ) ) {
972
+ return $column;
973
+ }
974
+
975
+ // We need a primary defined so responsive views show something,
976
+ // so let's fall back to the first non-checkbox column.
977
+ foreach ( $columns as $col => $column_name ) {
978
+ if ( 'cb' === $col ) {
979
+ continue;
980
+ }
981
+
982
+ $column = $col;
983
+ break;
984
+ }
985
+
986
+ return $column;
987
+ }
988
+
989
+ /**
990
+ * Public wrapper for WP_List_Table::get_default_primary_column_name().
991
+ *
992
+ * @since 4.4.0
993
+ *
994
+ * @return string Name of the default primary column.
995
+ */
996
+ public function get_primary_column() {
997
+ return $this->get_primary_column_name();
998
+ }
999
+
1000
+ /**
1001
+ * Gets the name of the primary column.
1002
+ *
1003
+ * @since 4.3.0
1004
+ *
1005
+ * @return string The name of the primary column.
1006
+ */
1007
+ protected function get_primary_column_name() {
1008
+ $columns = get_column_headers( $this->screen );
1009
+ $default = $this->get_default_primary_column_name();
1010
+
1011
+ // If the primary column doesn't exist fall back to the
1012
+ // first non-checkbox column.
1013
+ if ( ! isset( $columns[ $default ] ) ) {
1014
+ $default = ABPCT_List_Table::get_default_primary_column_name();
1015
+ }
1016
+
1017
+ /**
1018
+ * Filters the name of the primary column for the current list table.
1019
+ *
1020
+ * @since 4.3.0
1021
+ *
1022
+ * @param string $default Column name default for the specific list table, e.g. 'name'.
1023
+ * @param string $context Screen ID for specific list table, e.g. 'plugins'.
1024
+ */
1025
+ $column = apply_filters( 'list_table_primary_column', $default, $this->screen->id );
1026
+
1027
+ if ( empty( $column ) || ! isset( $columns[ $column ] ) ) {
1028
+ $column = $default;
1029
+ }
1030
+
1031
+ return $column;
1032
+ }
1033
+
1034
+ /**
1035
+ * Get a list of all, hidden and sortable columns, with filter applied
1036
+ *
1037
+ * @since 3.1.0
1038
+ *
1039
+ * @return array
1040
+ */
1041
+ protected function get_column_info() {
1042
+ // $_column_headers is already set / cached
1043
+ if ( isset( $this->_column_headers ) && is_array( $this->_column_headers ) ) {
1044
+ // Back-compat for list tables that have been manually setting $_column_headers for horse reasons.
1045
+ // In 4.3, we added a fourth argument for primary column.
1046
+ $column_headers = array( array(), array(), array(), $this->get_primary_column_name() );
1047
+ foreach ( $this->_column_headers as $key => $value ) {
1048
+ $column_headers[ $key ] = $value;
1049
+ }
1050
+
1051
+ return $column_headers;
1052
+ }
1053
+
1054
+ $columns = get_column_headers( $this->screen );
1055
+ $hidden = get_hidden_columns( $this->screen );
1056
+
1057
+ $sortable_columns = $this->get_sortable_columns();
1058
+ /**
1059
+ * Filters the list table sortable columns for a specific screen.
1060
+ *
1061
+ * The dynamic portion of the hook name, `$this->screen->id`, refers
1062
+ * to the ID of the current screen, usually a string.
1063
+ *
1064
+ * @since 3.5.0
1065
+ *
1066
+ * @param array $sortable_columns An array of sortable columns.
1067
+ */
1068
+ $_sortable = apply_filters( "manage_{$this->screen->id}_sortable_columns", $sortable_columns );
1069
+
1070
+ $sortable = array();
1071
+ foreach ( $_sortable as $id => $data ) {
1072
+ if ( empty( $data ) ) {
1073
+ continue;
1074
+ }
1075
+
1076
+ $data = (array) $data;
1077
+ if ( ! isset( $data[1] ) ) {
1078
+ $data[1] = false;
1079
+ }
1080
+
1081
+ $sortable[ $id ] = $data;
1082
+ }
1083
+
1084
+ $primary = $this->get_primary_column_name();
1085
+ $this->_column_headers = array( $columns, $hidden, $sortable, $primary );
1086
+
1087
+ return $this->_column_headers;
1088
+ }
1089
+
1090
+ /**
1091
+ * Return number of visible columns
1092
+ *
1093
+ * @since 3.1.0
1094
+ *
1095
+ * @return int
1096
+ */
1097
+ public function get_column_count() {
1098
+ list ( $columns, $hidden ) = $this->get_column_info();
1099
+ $hidden = array_intersect( array_keys( $columns ), array_filter( $hidden ) );
1100
+ return count( $columns ) - count( $hidden );
1101
+ }
1102
+
1103
+ /**
1104
+ * Print column headers, accounting for hidden and sortable columns.
1105
+ *
1106
+ * @since 3.1.0
1107
+ *
1108
+ * @staticvar int $cb_counter
1109
+ *
1110
+ * @param bool $with_id Whether to set the id attribute or not
1111
+ */
1112
+ public function print_column_headers( $with_id = true ) {
1113
+ list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
1114
+
1115
+ $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
1116
+ $current_url = remove_query_arg( 'paged', $current_url );
1117
+
1118
+ if ( isset( $_GET['orderby'] ) ) {
1119
+ $current_orderby = $_GET['orderby'];
1120
+ } else {
1121
+ $current_orderby = '';
1122
+ }
1123
+
1124
+ if ( isset( $_GET['order'] ) && 'desc' === $_GET['order'] ) {
1125
+ $current_order = 'desc';
1126
+ } else {
1127
+ $current_order = 'asc';
1128
+ }
1129
+
1130
+ if ( ! empty( $columns['cb'] ) ) {
1131
+ static $cb_counter = 1;
1132
+ $columns['cb'] = '<label class="screen-reader-text" for="cb-select-all-' . $cb_counter . '">' . __( 'Select All' ) . '</label>'
1133
+ . '<input id="cb-select-all-' . $cb_counter . '" type="checkbox" />';
1134
+ $cb_counter++;
1135
+ }
1136
+
1137
+ foreach ( $columns as $column_key => $column_display_name ) {
1138
+ $class = array( 'manage-column', "column-$column_key" );
1139
+
1140
+ if ( in_array( $column_key, $hidden ) ) {
1141
+ $class[] = 'hidden';
1142
+ }
1143
+
1144
+ if ( 'cb' === $column_key ) {
1145
+ $class[] = 'check-column';
1146
+ } elseif ( in_array( $column_key, array( 'posts', 'comments', 'links' ) ) ) {
1147
+ $class[] = 'num';
1148
+ }
1149
+
1150
+ if ( $column_key === $primary ) {
1151
+ $class[] = 'column-primary';
1152
+ }
1153
+
1154
+ if ( isset( $sortable[ $column_key ] ) ) {
1155
+ list( $orderby, $desc_first ) = $sortable[ $column_key ];
1156
+
1157
+ if ( $current_orderby === $orderby ) {
1158
+ $order = 'asc' === $current_order ? 'desc' : 'asc';
1159
+ $class[] = 'sorted';
1160
+ $class[] = $current_order;
1161
+ } else {
1162
+ $order = $desc_first ? 'desc' : 'asc';
1163
+ $class[] = 'sortable';
1164
+ $class[] = $desc_first ? 'asc' : 'desc';
1165
+ }
1166
+
1167
+ $column_display_name = '<a href="' . esc_url( add_query_arg( compact( 'orderby', 'order' ), $current_url ) ) . '"><span>' . $column_display_name . '</span><span class="sorting-indicator"></span></a>';
1168
+ }
1169
+
1170
+ $tag = ( 'cb' === $column_key ) ? 'td' : 'th';
1171
+ $scope = ( 'th' === $tag ) ? 'scope="col"' : '';
1172
+ $id = $with_id ? "id='$column_key'" : '';
1173
+
1174
+ if ( ! empty( $class ) ) {
1175
+ $class = "class='" . join( ' ', $class ) . "'";
1176
+ }
1177
+
1178
+ echo "<$tag $scope $id $class>$column_display_name</$tag>";
1179
+ }
1180
+ }
1181
+
1182
+ /**
1183
+ * Displays the table.
1184
+ *
1185
+ * @since 3.1.0
1186
+ */
1187
+ public function display() {
1188
+ $singular = $this->_args['singular'];
1189
+
1190
+ $this->display_tablenav( 'top' );
1191
+
1192
+ $this->screen->render_screen_reader_content( 'heading_list' );
1193
+ ?>
1194
+ <table class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>">
1195
+ <thead>
1196
+ <tr>
1197
+ <?php $this->print_column_headers(); ?>
1198
+ </tr>
1199
+ </thead>
1200
+
1201
+ <tbody id="the-list"
1202
+ <?php
1203
+ if ( $singular ) {
1204
+ echo " data-wp-lists='list:$singular'";
1205
+ }
1206
+ ?>
1207
+ >
1208
+ <?php $this->display_rows_or_placeholder(); ?>
1209
+ </tbody>
1210
+
1211
+ <tfoot>
1212
+ <tr>
1213
+ <?php $this->print_column_headers( false ); ?>
1214
+ </tr>
1215
+ </tfoot>
1216
+
1217
+ </table>
1218
+ <?php
1219
+ $this->display_tablenav( 'bottom' );
1220
+ }
1221
+
1222
+ /**
1223
+ * Get a list of CSS classes for the WP_List_Table table tag.
1224
+ *
1225
+ * @since 3.1.0
1226
+ *
1227
+ * @return array List of CSS classes for the table tag.
1228
+ */
1229
+ protected function get_table_classes() {
1230
+ return array( 'widefat', 'fixed', 'striped', $this->_args['plural'] );
1231
+ }
1232
+
1233
+ /**
1234
+ * Generate the table navigation above or below the table
1235
+ *
1236
+ * @since 3.1.0
1237
+ * @param string $which
1238
+ */
1239
+ protected function display_tablenav( $which ) {
1240
+ if ( 'top' === $which ) {
1241
+ wp_nonce_field( 'bulk-' . $this->_args['plural'] );
1242
+ }
1243
+ ?>
1244
+ <div class="tablenav <?php echo esc_attr( $which ); ?>">
1245
+
1246
+ <?php if ( $this->has_items() ) : ?>
1247
+ <div class="alignleft actions bulkactions">
1248
+ <?php $this->bulk_actions( $which ); ?>
1249
+ </div>
1250
+ <?php
1251
+ endif;
1252
+ $this->extra_tablenav( $which );
1253
+ $this->pagination( $which );
1254
+ ?>
1255
+
1256
+ <br class="clear" />
1257
+ </div>
1258
+ <?php
1259
+ }
1260
+
1261
+ /**
1262
+ * Extra controls to be displayed between bulk actions and pagination
1263
+ *
1264
+ * @since 3.1.0
1265
+ *
1266
+ * @param string $which
1267
+ */
1268
+ protected function extra_tablenav( $which ) {}
1269
+
1270
+ /**
1271
+ * Generate the tbody element for the list table.
1272
+ *
1273
+ * @since 3.1.0
1274
+ */
1275
+ public function display_rows_or_placeholder() {
1276
+ if ( $this->has_items() ) {
1277
+ $this->display_rows();
1278
+ } else {
1279
+ echo '<tr class="no-items"><td class="colspanchange" colspan="' . $this->get_column_count() . '">';
1280
+ $this->no_items();
1281
+ echo '</td></tr>';
1282
+ }
1283
+ }
1284
+
1285
+ /**
1286
+ * Generate the table rows
1287
+ *
1288
+ * @since 3.1.0
1289
+ */
1290
+ public function display_rows() {
1291
+ foreach ( $this->items as $item ) {
1292
+ $this->single_row( $item );
1293
+ }
1294
+ }
1295
+
1296
+ /**
1297
+ * Generates content for a single row of the table
1298
+ *
1299
+ * @since 3.1.0
1300
+ *
1301
+ * @param object $item The current item
1302
+ */
1303
+ public function single_row( $item ) {
1304
+ echo '<tr>';
1305
+ $this->single_row_columns( $item );
1306
+ echo '</tr>';
1307
+ }
1308
+
1309
+ /**
1310
+ * @param object $item
1311
+ * @param string $column_name
1312
+ */
1313
+ protected function column_default( $item, $column_name ) {}
1314
+
1315
+ /**
1316
+ * @param object $item
1317
+ */
1318
+ protected function column_cb( $item ) {}
1319
+
1320
+ /**
1321
+ * Generates the columns for a single row of the table
1322
+ *
1323
+ * @since 3.1.0
1324
+ *
1325
+ * @param object $item The current item
1326
+ */
1327
+ protected function single_row_columns( $item ) {
1328
+ list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
1329
+
1330
+ foreach ( $columns as $column_name => $column_display_name ) {
1331
+ $classes = "$column_name column-$column_name";
1332
+ if ( $primary === $column_name ) {
1333
+ $classes .= ' has-row-actions column-primary';
1334
+ }
1335
+
1336
+ if ( in_array( $column_name, $hidden ) ) {
1337
+ $classes .= ' hidden';
1338
+ }
1339
+
1340
+ // Comments column uses HTML in the display name with screen reader text.
1341
+ // Instead of using esc_attr(), we strip tags to get closer to a user-friendly string.
1342
+ $data = 'data-colname="' . wp_strip_all_tags( $column_display_name ) . '"';
1343
+
1344
+ $attributes = "class='$classes' $data";
1345
+
1346
+ if ( 'cb' === $column_name ) {
1347
+ echo '<th scope="row" class="check-column">';
1348
+ echo $this->column_cb( $item );
1349
+ echo '</th>';
1350
+ } elseif ( method_exists( $this, '_column_' . $column_name ) ) {
1351
+ echo call_user_func(
1352
+ array( $this, '_column_' . $column_name ),
1353
+ $item,
1354
+ $classes,
1355
+ $data,
1356
+ $primary
1357
+ );
1358
+ } elseif ( method_exists( $this, 'column_' . $column_name ) ) {
1359
+ echo "<td $attributes>";
1360
+ echo call_user_func( array( $this, 'column_' . $column_name ), $item );
1361
+ echo $this->handle_row_actions( $item, $column_name, $primary );
1362
+ echo '</td>';
1363
+ } else {
1364
+ echo "<td $attributes>";
1365
+ echo $this->column_default( $item, $column_name );
1366
+ echo $this->handle_row_actions( $item, $column_name, $primary );
1367
+ echo '</td>';
1368
+ }
1369
+ }
1370
+ }
1371
+
1372
+ /**
1373
+ * Generates and display row actions links for the list table.
1374
+ *
1375
+ * @since 4.3.0
1376
+ *
1377
+ * @param object $item The item being acted upon.
1378
+ * @param string $column_name Current column name.
1379
+ * @param string $primary Primary column name.
1380
+ * @return string The row actions HTML, or an empty string if the current column is the primary column.
1381
+ */
1382
+ protected function handle_row_actions( $item, $column_name, $primary ) {
1383
+ return $column_name === $primary ? '<button type="button" class="toggle-row"><span class="screen-reader-text">' . __( 'Show more details' ) . '</span></button>' : '';
1384
+ }
1385
+
1386
+ /**
1387
+ * Handle an incoming ajax request (called from admin-ajax.php)
1388
+ *
1389
+ * @since 3.1.0
1390
+ */
1391
+ public function ajax_response() {
1392
+ $this->prepare_items();
1393
+
1394
+ ob_start();
1395
+ if ( ! empty( $_REQUEST['no_placeholder'] ) ) {
1396
+ $this->display_rows();
1397
+ } else {
1398
+ $this->display_rows_or_placeholder();
1399
+ }
1400
+
1401
+ $rows = ob_get_clean();
1402
+
1403
+ $response = array( 'rows' => $rows );
1404
+
1405
+ if ( isset( $this->_pagination_args['total_items'] ) ) {
1406
+ $response['total_items_i18n'] = sprintf(
1407
+ /* translators: Number of items. */
1408
+ _n( '%s item', '%s items', $this->_pagination_args['total_items'] ),
1409
+ number_format_i18n( $this->_pagination_args['total_items'] )
1410
+ );
1411
+ }
1412
+ if ( isset( $this->_pagination_args['total_pages'] ) ) {
1413
+ $response['total_pages'] = $this->_pagination_args['total_pages'];
1414
+ $response['total_pages_i18n'] = number_format_i18n( $this->_pagination_args['total_pages'] );
1415
+ }
1416
+
1417
+ die( wp_json_encode( $response ) );
1418
+ }
1419
+
1420
+ /**
1421
+ * Send required variables to JavaScript land
1422
+ */
1423
+ public function _js_vars() {
1424
+ $args = array(
1425
+ 'class' => get_class( $this ),
1426
+ 'screen' => array(
1427
+ 'id' => $this->screen->id,
1428
+ 'base' => $this->screen->base,
1429
+ ),
1430
+ );
1431
+
1432
+ printf( "<script type='text/javascript'>list_args = %s;</script>\n", wp_json_encode( $args ) );
1433
+ }
1434
+ }
inc/cleantalk-admin.php CHANGED
@@ -1,685 +1,685 @@
1
- <?php
2
-
3
- require_once('cleantalk-settings.php');
4
-
5
- // Add buttons to comments list table
6
- add_action( 'manage_comments_nav', 'apbct_add_buttons_to_comments_and_users', 10, 1 );
7
- add_action( 'manage_users_extra_tablenav', 'apbct_add_buttons_to_comments_and_users', 10, 1 );
8
-
9
- function apbct_add_buttons_to_comments_and_users( $unused_argument ) {
10
-
11
- global $apbct;
12
- $current_screen = get_current_screen();
13
-
14
- if( 'users' == $current_screen->base ) {
15
- $button_url = $current_screen->base . '.php?page=ct_check_users';
16
- $button_description = 'users';
17
- } elseif ( 'edit-comments' == $current_screen->base ) {
18
- $button_url = $current_screen->base . '.php?page=ct_check_spam';
19
- $button_description = 'comments';
20
- } else {
21
- return;
22
- }
23
-
24
- echo '
25
- <a href="' . $button_url . '" class="button" style="margin:1px 0 0 0; display: inline-block;">
26
- <img src="' . $apbct->logo__small__colored . '" alt="Cleantalk Antispam logo" height="" style="width: 17px; vertical-align: text-bottom;" />
27
- ' . sprintf(__( 'Find spam %s', 'cleantalk' ), $button_description ) . '
28
- </a>
29
- <a href="https://cleantalk.org/my/show_requests?service_id=' . $apbct->data['service_id'] . '&int=week" target="_blank" class="button" style="margin:1px 0 0 0; display: inline-block;">
30
- <img src="' . $apbct->logo__small__colored . '" alt="Cleantalk Antispam logo" height="" style="width: 17px; vertical-align: text-bottom;" />
31
- ' . __( 'CleanTalk Anti-Spam Log', 'cleantalk' ) . '
32
- </a>
33
- ';
34
-
35
- }
36
-
37
- add_action( 'admin_bar_menu', 'apbct_admin__admin_bar__add', 999 );
38
-
39
- //Adding widjet
40
- function ct_dashboard_statistics_widget() {
41
-
42
- global $apbct;
43
-
44
- if(apbct_is_user_role_in(array('administrator'))){
45
- wp_add_dashboard_widget(
46
- 'ct_dashboard_statistics_widget',
47
- $apbct->plugin_name
48
- ."<div class='ct_widget_top_links'>"
49
- ."<img src='".plugins_url('/cleantalk-spam-protect/inc/images/preloader.gif')."' class='ct_preloader'>"
50
- .sprintf(__("%sRefresh%s", 'cleantalk'), "<a href='#ct_widget' class='ct_widget_refresh_link'>", "</a>")
51
- .sprintf(__("%sConfigure%s", 'cleantalk'), "<a href='{$apbct->settings_link}' class='ct_widget_settings_link'>", "</a>")
52
- ."</div>",
53
- 'ct_dashboard_statistics_widget_output'
54
- );
55
- }
56
- }
57
-
58
- // Outputs statistics widget content
59
- function ct_dashboard_statistics_widget_output( $post, $callback_args ) {
60
-
61
- global $apbct, $current_user;
62
-
63
- echo "<div id='ct_widget_wrapper'>";
64
- ?>
65
- <form id='ct_refresh_form' method='POST' action='#ct_widget'>
66
- <input type='hidden' name='ct_brief_refresh' value='1'>
67
- </form>
68
- <h4 class='ct_widget_block_header' style='margin-left: 12px;'><?php _e('7 days anti-spam stats', 'cleantalk'); ?></h4>
69
- <div class='ct_widget_block ct_widget_chart_wrapper'>
70
- <div id='ct_widget_chart'></div>
71
- </div>
72
- <h4 class='ct_widget_block_header'><?php _e('Top 5 spam IPs blocked', 'cleantalk'); ?></h4>
73
- <hr class='ct_widget_hr'>
74
- <?php
75
- if(!apbct_api_key__is_correct() || (isset($apbct->data['brief_data']['error_no']) && $apbct->data['brief_data']['error_no'] == 6)){
76
- ?> <div class='ct_widget_block'>
77
- <form action='<? echo $apbct->settings_link; ?>' method='POST'>
78
- <h2 class='ct_widget_activate_header'><?php _e('Get Access key to activate Anti-Spam protection!', 'cleantalk'); ?></h2>
79
- <input class='ct_widget_button ct_widget_activate_button' type='submit' name='get_apikey_auto' value='ACTIVATE' />
80
- </form>
81
- </div>
82
- <?php
83
- }elseif(!empty($apbct->data['brief_data']['error'])){
84
- echo '<div class="ct_widget_block">'
85
- .'<h2 class="ct_widget_activate_header">'
86
- .sprintf(__('Something went wrong! Error: "%s".', 'cleantalk'), "<u>{$apbct->brief_data['error']}</u>")
87
- .'</h2>';
88
- if($apbct->user_token && !$apbct->white_label){
89
- echo '<h2 class="ct_widget_activate_header">'
90
- .__('Please, visit your dashboard.', 'cleantalk')
91
- .'</h2>'
92
- .'<a target="_blank" href="https://cleantalk.org/my?user_token='.$apbct->user_token.'&cp_mode=antispam">'
93
- .'<input class="ct_widget_button ct_widget_activate_button ct_widget_resolve_button" type="button" value="VISIT CONTROL PANEL">'
94
- .'</a>';
95
- }
96
- echo '</div>';
97
- }
98
-
99
- if(apbct_api_key__is_correct() && empty($apbct->data['brief_data']['error'])){
100
- ?>
101
- <div class='ct_widget_block'>
102
- <table cellspacing="0">
103
- <tr>
104
- <th><?php _e('IP', 'cleantalk'); ?></th>
105
- <th><?php _e('Country', 'cleantalk'); ?></th>
106
- <th><?php _e('Block Count', 'cleantalk'); ?></th>
107
- </tr>
108
- <?php foreach($apbct->brief_data['top5_spam_ip'] as $val){ ?>
109
- <tr>
110
- <td><?php echo $val[0]; ?></td>
111
- <td><?php echo $val[1] ? "<img src='https://cleantalk.org/images/flags/".strtolower($val[1]).".png'>" : ''; ?>&nbsp;<?php
112
- echo $val[1]
113
- ? locale_get_display_region('sl-Latn-'.$val[1].'-nedis', substr(get_locale(), 0, 2))
114
- : 'Unknown'; ?></td>
115
- <td style='text-align: center;'><?php echo $val[2]; ?></td>
116
- </tr>
117
- <?php } ?>
118
- </table>
119
- <?php if($apbct->user_token){ ?>
120
- <a target='_blank' href='https://cleantalk.org/my?user_token=<?php echo $apbct->user_token; ?>&cp_mode=antispam'>
121
- <input class='ct_widget_button' id='ct_widget_button_view_all' type='button' value='View all'>
122
- </a>
123
- <?php } ?>
124
- </div>
125
-
126
- <?php
127
- }
128
- // Notice at the bottom
129
- if(isset($current_user) && in_array('administrator', $current_user->roles)){
130
-
131
- if($apbct->spam_count && $apbct->spam_count > 0){
132
- echo '<div class="ct_widget_wprapper_total_blocked">'
133
- .'<img src="'.$apbct->logo__small__colored.'" class="ct_widget_small_logo"/>'
134
- .'<span title="'.sprintf(__('This is the count from the %s\'s cloud and could be different to admin bar counters', 'cleantalk').'">', $apbct->plugin_name)
135
- .sprintf(
136
- /* translators: %s: Number of spam messages */
137
- __( '%s%s%s has blocked %s spam for all time. The statistics are automatically updated every 24 hours.', 'cleantalk'),
138
- !$apbct->white_label ? '<a href="https://cleantalk.org/my/?user_token='.$apbct->user_token.'&utm_source=wp-backend&utm_medium=dashboard_widget&cp_mode=antispam" target="_blank">' : '',
139
- $apbct->plugin_name,
140
- !$apbct->white_label ? '</a>' : '',
141
- number_format($apbct->data['spam_count'], 0, ',', ' ')
142
- )
143
- .'</span>'
144
- .(!$apbct->white_label
145
- ? '<br><br>'
146
- .'<b style="font-size: 16px;">'
147
- .sprintf(
148
- __('Do you like CleanTalk? %sPost your feedback here%s.', 'cleantalk'),
149
- '<u><a href="https://wordpress.org/support/plugin/cleantalk-spam-protect/reviews/#new-post" target="_blank">',
150
- '</a></u>'
151
- )
152
- .'</b>'
153
- : ''
154
- )
155
- .'</div>';
156
- }
157
- }
158
- echo '</div>';
159
- }
160
-
161
- /**
162
- * Admin action 'admin_init' - Add the admin settings and such
163
- */
164
- function apbct_admin__init(){
165
-
166
- global $apbct;
167
-
168
- // Getting dashboard widget statistics
169
- if(!empty($_POST['ct_brief_refresh'])){
170
- $apbct->data['brief_data'] = CleantalkAPI::method__get_antispam_report_breif($apbct->api_key);
171
- $apbct->saveData();
172
- }
173
-
174
- // Getting key like hoster. Only once!
175
- if(!is_main_site() && $apbct->white_label && empty($apbct->api_key)){
176
-
177
- $_POST['submit'] = 'get_key_auto';
178
- $settings = apbct_settings__validate(array());
179
- unset($_POST['submit']);
180
-
181
- if(!empty($settings['apikey'])){
182
- $apbct->settings['apikey'] = $settings['apikey'];
183
- $apbct->api_key = $settings['apikey'];
184
- $apbct->saveSettings();
185
- }
186
-
187
- }
188
-
189
- // AJAX actions
190
-
191
- // Settings
192
- add_action('wp_ajax_apbct_settings__get__long_description', 'apbct_settings__get__long_description'); // Long description
193
- }
194
-
195
- /**
196
- * Manage links in plugins list
197
- * @return array
198
- */
199
- function apbct_admin__plugin_action_links($links, $file) {
200
-
201
- global $apbct;
202
-
203
- $settings_link = '<a href="' . $apbct->settings_link . '">' . __( 'Settings' ) . '</a>';
204
-
205
- array_unshift( $links, $settings_link ); // before other links
206
- return $links;
207
- }
208
-
209
- /**
210
- * Manage links and plugins page
211
- * @return array
212
- */
213
- function apbct_admin__register_plugin_links($links, $file){
214
-
215
- global $apbct;
216
-
217
- //Return if it's not our plugin
218
- if ($file != $apbct->base_name)
219
- return $links;
220
-
221
- if($apbct->white_label){
222
- $links = array_slice($links, 0, 1);
223
- $links[] = "<script>jQuery('.plugin-title strong').each(function(i, item){
224
- if(jQuery(item).html() == 'Anti-Spam by CleanTalk')
225
- jQuery(item).html('{$apbct->plugin_name}');
226
- });</script>";
227
- return $links;
228
- }
229
-
230
- if(substr(get_locale(), 0, 2) != 'en')
231
- $links[] = '<a class="ct_meta_links ct_translate_links" href="'
232
- .sprintf('https://translate.wordpress.org/locale/%s/default/wp-plugins/cleantalk-spam-protect', substr(get_locale(), 0, 2))
233
- .'" target="_blank">'
234
- .__('Translate', 'cleantalk')
235
- .'</a>';
236
-
237
- $links[] = '<a class="ct_meta_links" href="'.$apbct->settings_link.'" target="_blank">' . __( 'Start here','cleantalk' ) . '</a>';
238
- $links[] = '<a class="ct_meta_links ct_faq_links" href="https://wordpress.org/plugins/cleantalk-spam-protect/faq/" target="_blank">' . __( 'FAQ','cleantalk' ) . '</a>';
239
- $links[] = '<a class="ct_meta_links ct_support_links"href="https://wordpress.org/support/plugin/cleantalk-spam-protect" target="_blank">' . __( 'Support','cleantalk' ) . '</a>';
240
- $trial = apbct_admin__badge__get_premium(false);
241
- if(!empty($trial))
242
- $links[] = apbct_admin__badge__get_premium(false);
243
-
244
- return $links;
245
- }
246
-
247
- /**
248
- * Admin action 'admin_enqueue_scripts' - Enqueue admin script of reloading admin page after needed AJAX events
249
- * @param string $hook URL of hooked page
250
- */
251
- function apbct_admin__enqueue_scripts($hook){
252
-
253
- global $apbct;
254
-
255
- // Scripts to all admin pages
256
- wp_enqueue_script('ct_admin_js_notices', plugins_url('/cleantalk-spam-protect/js/cleantalk-admin.min.js'), array(), APBCT_VERSION);
257
- wp_enqueue_style ('ct_admin_css', plugins_url('/cleantalk-spam-protect/css/cleantalk-admin.min.css'), array(), APBCT_VERSION, 'all');
258
-
259
- wp_localize_script( 'jquery', 'ctAdminCommon', array(
260
- '_ajax_nonce' => wp_create_nonce( 'ct_secret_nonce' ),
261
- '_ajax_url' => admin_url( 'admin-ajax.php' ),
262
- 'plugin_name' => $apbct->plugin_name,
263
- 'logo' => '<img src="' . $apbct->logo . '" alt="" height="" style="width: 17px; vertical-align: text-bottom;" />',
264
- 'logo_small' => '<img src="' . $apbct->logo__small . '" alt="" height="" style="width: 17px; vertical-align: text-bottom;" />',
265
- 'logo_small_colored' => '<img src="' . $apbct->logo__small__colored . '" alt="" height="" style="width: 17px; vertical-align: text-bottom;" />',
266
- ) );
267
-
268
- // DASHBOARD page JavaScript and CSS
269
- if($hook == 'index.php' && apbct_is_user_role_in(array('administrator'))){
270
-
271
- wp_enqueue_style('ct_admin_css_widget_dashboard', plugins_url('/cleantalk-spam-protect/css/cleantalk-dashboard-widget.min.css'), array(), APBCT_VERSION, 'all');
272
- wp_enqueue_style ('ct_icons', plugins_url('/cleantalk-spam-protect/css/cleantalk-icons.min.css'), array(), APBCT_VERSION, 'all');
273
-
274
- wp_enqueue_script('ct_gstatic_charts_loader', plugins_url('/cleantalk-spam-protect/js/cleantalk-dashboard-widget--google-charts.min.js'), array(), APBCT_VERSION);
275
- wp_enqueue_script('ct_admin_js_widget_dashboard', plugins_url('/cleantalk-spam-protect/js/cleantalk-dashboard-widget.min.js'), array('ct_gstatic_charts_loader'), APBCT_VERSION);
276
-
277
- // Preparing widget data
278
- // Parsing brief data 'spam_stat' {"yyyy-mm-dd": spam_count, "yyyy-mm-dd": spam_count} to [["yyyy-mm-dd", "spam_count"], ["yyyy-mm-dd", "spam_count"]]
279
- $to_chart = array();
280
-
281
- // Crunch. Response contains error.
282
- if(!empty($apbct->data['brief_data']['error']))
283
- $apbct->data['brief_data'] = array_merge($apbct->data['brief_data'], $apbct->def_data['brief_data']);
284
-
285
- foreach( $apbct->data['brief_data']['spam_stat'] as $key => $value ){
286
- $to_chart[] = array( $key, $value );
287
- } unset( $key, $value );
288
-
289
- wp_localize_script( 'jquery', 'apbctDashboardWidget', array(
290
- 'data' => $to_chart,
291
- ));
292
- }
293
-
294
- // SETTINGS's page JavaScript and CSS
295
- if( $hook == 'settings_page_cleantalk' ){
296
-
297
- // jQueryUI
298
- wp_enqueue_script('jqueryui', plugins_url('/cleantalk-spam-protect/js/jquery-ui.min.js'), array('jquery'), '1.12.1' );
299
- wp_enqueue_style('jqueryui_css', plugins_url('/cleantalk-spam-protect/css/jquery-ui.min.css'),array(), '1.21.1', 'all');
300
-
301
- wp_enqueue_script('cleantalk_admin_js_settings_page', plugins_url('/cleantalk-spam-protect/js/cleantalk-admin-settings-page.min.js'), array(), APBCT_VERSION);
302
- wp_enqueue_style('cleantalk_admin_css_settings_page', plugins_url('/cleantalk-spam-protect/css/cleantalk-admin-settings-page.min.css'), array(), APBCT_VERSION, 'all');
303
- wp_enqueue_style ('ct_icons', plugins_url('/cleantalk-spam-protect/css/cleantalk-icons.min.css'), array(), APBCT_VERSION, 'all');
304
-
305
- wp_localize_script( 'jquery', 'ctSettingsPage', array(
306
- 'ct_subtitle' => $apbct->ip_license ? __('Hosting AntiSpam', 'cleantalk') : '',
307
- 'ip_license' => $apbct->ip_license ? true : false,
308
- ));
309
- }
310
-
311
- // COMMENTS page JavaScript
312
- if($hook == 'edit-comments.php'){
313
- wp_enqueue_script('ct_comments_editscreen', plugins_url('/cleantalk-spam-protect/js/cleantalk-comments-editscreen.min.js'), array(), APBCT_VERSION);
314
- wp_localize_script( 'jquery', 'ctCommentsScreen', array(
315
- 'ct_ajax_nonce' => wp_create_nonce('ct_secret_nonce'),
316
- 'spambutton_text' => __("Find spam comments", 'cleantalk'),
317
- 'ct_feedback_msg_whitelisted' => __("The sender has been whitelisted.", 'cleantalk'),
318
- 'ct_feedback_msg_blacklisted' => __("The sender has been blacklisted.", 'cleantalk'),
319
- 'ct_feedback_msg' => sprintf(__("Feedback has been sent to %sCleanTalk Dashboard%s.", 'cleantalk'), $apbct->user_token ? "<a target='_blank' href=https://cleantalk.org/my?user_token={$apbct->user_token}&cp_mode=antispam>" : '', $apbct->user_token ? "</a>" : ''),
320
- 'ct_show_check_links' => (bool)$apbct->settings['show_check_links'],
321
- 'ct_img_src_new_tab' => plugin_dir_url(__FILE__)."images/new_window.gif",
322
- ));
323
- }
324
-
325
- // USERS page JavaScript
326
- if($hook == 'users.php'){
327
- wp_enqueue_script('ct_users_editscreen', plugins_url('/cleantalk-spam-protect/js/cleantalk-users-editscreen.min.js'), array(), APBCT_VERSION);
328
- wp_localize_script( 'jquery', 'ctUsersScreen', array(
329
- 'spambutton_text' => __("Find spam-users", 'cleantalk'),
330
- 'ct_show_check_links' => (bool)$apbct->settings['show_check_links'],
331
- 'ct_img_src_new_tab' => plugin_dir_url(__FILE__)."images/new_window.gif"
332
- ));
333
- }
334
-
335
- }
336
-
337
- /**
338
- * Notice blog owner if plugin is used without Access key
339
- * @return bool
340
- */
341
- function apbct_admin__notice_message(){
342
-
343
- global $apbct;
344
-
345
- $page = get_current_screen();
346
-
347
- //General notice control flags
348
- $self_owned_key = ($apbct->moderate_ip == 0 && !defined('CLEANTALK_ACCESS_KEY') ? true : false);
349
- $is_dashboard = (is_network_admin() || is_admin() ? true : false);
350
- $is_admin = (current_user_can('activate_plugins') ? true : false);
351
-
352
- $page_is_ct_settings = (in_array($page->id, array('settings_page_cleantalk', 'settings_page_cleantalk-network', 'comments_page_ct_check_spam', 'users_page_ct_check_users')) ? true : false);
353
-
354
- //Misc
355
- $user_token = ($apbct->user_token ? '&user_token='.$apbct->user_token : '');
356
- $settings_link = (is_network_admin() ? 'settings.php?page=cleantalk' : 'options-general.php?page=cleantalk');
357
-
358
- if($self_owned_key && $is_dashboard && $is_admin){
359
- // Auto update notice
360
- /* Disabled at 09.09.2018
361
- if($apbct->notice_auto_update == 1 && $apbct->auto_update != -1 && empty($_COOKIE['apbct_update_banner_closed'])){
362
- $link = '<a href="https://cleantalk.org/help/cleantalk-auto-update" target="_blank">%s</a>';
363
- $button = sprintf($link, '<input type="button" class="button button-primary" value="'.__('Learn more', 'cleantalk').'" />');
364
- echo '<div class="error notice is-dismissible apbct_update_notice">'
365
- .'<h3>'
366
- .__('Do you know that Anti-Spam by CleanTalk has auto update option?', 'cleantalk')
367
- .'</br></br>'
368
- .$button
369
- .'</h3>'
370
- .'</div>';
371
- }
372
- */
373
- //Unable to get key automatically (if apbct_admin__init().getAutoKey() returns error)
374
- if ($apbct->notice_show && !empty($apbct->errors['get_key']) && !$apbct->white_label){
375
- echo '<div class="error">
376
- <h3>' . sprintf(__("Unable to get Access key automatically: %s", 'cleantalk'), $apbct->api_key).
377
- "<a target='__blank' style='margin-left: 10px' href='https://cleantalk.org/register?platform=wordpress&email=" . urlencode(ct_get_admin_email())."&website=" . urlencode(parse_url(get_option('siteurl'),PHP_URL_HOST))."'>".__('Get the Access key', 'cleantalk').'</a>
378
- </h3>
379
- </div>';
380
- }
381
-
382
- //key == "" || "enter key"
383
- if (!apbct_api_key__is_correct() && $apbct->moderate_ip == 0){
384
- echo "<div class='error'>"
385
- ."<h3>"
386
- .sprintf(__("Please enter Access Key in %s settings to enable anti spam protection!", 'cleantalk'), "<a href='{$settings_link}'>CleanTalk plugin</a>")
387
- ."</h3>"
388
- ."</div>";
389
- $apbct->notice_show = false;
390
- }
391
-
392
- //"Trial period ends" notice from apbct_admin__init().api_method__notice_paid_till()
393
- if ($apbct->notice_show && $apbct->notice_trial == 1 && $apbct->moderate_ip == 0 && !$apbct->white_label) {
394
- if(isset($_GET['page']) && in_array($_GET['page'], array('cleantalk', 'ct_check_spam', 'ct_check_users'))){
395
- echo '<div class="error">
396
- <h3>' . sprintf(__("%s trial period ends, please upgrade to %s!", 'cleantalk'),
397
- "<a href='{$settings_link}'>".$apbct->plugin_name."</a>",
398
- "<a href=\"https://cleantalk.org/my/bill/recharge?utm_source=wp-backend&utm_medium=cpc&utm_campaign=WP%20backend%20trial$user_token&cp_mode=antispam\" target=\"_blank\"><b>premium version</b></a>") .
399
- '</h3>
400
- <h4 style = "color: gray">If you already paid for the service, please, re-save the plugin settings (WP Dashboard —> Settings —> Anti-Spam by CleanTalk) to dismiss the notice.</h4>
401
- </div>';
402
- $apbct->notice_show = false;
403
- }
404
- }
405
-
406
- //Renew notice from apbct_admin_init().api_method__notice_paid_till()
407
- if ($apbct->notice_show && $apbct->notice_renew == 1 && $apbct->moderate_ip == 0 && !$apbct->white_label) {
408
- $renew_link = "<a href=\"https://cleantalk.org/my/bill/recharge?utm_source=wp-backend&utm_medium=cpc&utm_campaign=WP%%20backend%%20renew$user_token&cp_mode=antispam\" target=\"_blank\">%s</a>";
409
- $button_html = sprintf($renew_link, '<input type="button" class="button button-primary" value="'.__('RENEW ANTI-SPAM', 'cleantalk').'" />');
410
- $link_html = sprintf($renew_link, "<b>".__('next year', 'cleantalk')."</b>");
411
-
412
- echo '<div class="updated">
413
- <h3>'.
414
- sprintf(__("Please renew your anti-spam license for %s.", 'cleantalk'), $link_html). '<br /><br />' . $button_html .
415
- '</h3>
416
- </div>';
417
- $apbct->notice_show = false;
418
- }
419
-
420
- //"Wrong access key" notice (if ct_update_option().METHOD_notice_validate_key returns a error)
421
- if ($apbct->notice_show && $page_is_ct_settings && !$apbct->data['key_is_ok'] && $apbct->moderate_ip == 0 && !$apbct->white_label){
422
- echo '<div class="error">
423
- <h3><b>'.
424
- __("Wrong <a href='{$settings_link}'><b style=\"color: #49C73B;\">Clean</b><b style=\"color: #349ebf;\">Talk</b> access key</a>! Please check it or ask <a target=\"_blank\" href=\"https://cleantalk.org/forum/\">support</a>.", 'cleantalk').
425
- '</b></h3>
426
- </div>';
427
- }
428
- }
429
-
430
- return true;
431
- }
432
-
433
- function apbct_admin__badge__get_premium($print = true, $out = ''){
434
-
435
- global $apbct;
436
-
437
- if($apbct->license_trial == 1 && $apbct->user_token){
438
- $out .= '<b style="display: inline-block; margin-top: 10px;">'
439
- .($print ? __('Make it right!', 'cleantalk').' ' : '')
440
- .sprintf(
441
- __('%sGet premium%s', 'cleantalk'),
442
- '<a href="https://cleantalk.org/my/bill/recharge?user_token='.$apbct->user_token.'" target="_blank">',
443
- '</a>'
444
- )
445
- .'</b>';
446
- }
447
-
448
- if($print)
449
- echo $out;
450
- else
451
- return $out;
452
- }
453
-
454
- function apbct_admin__admin_bar__add( $wp_admin_bar ) {
455
-
456
- global $apbct;
457
-
458
- if (current_user_can('activate_plugins') && $apbct->settings['show_adminbar'] == 1 && (apbct_api_key__is_correct($apbct->api_key) !== false || (defined('CLEANTALK_SHOW_ADMIN_BAR_FORCE') && CLEANTALK_SHOW_ADMIN_BAR_FORCE))) {
459
-
460
- //Reset or create user counter
461
- if(!empty($_GET['ct_reset_user_counter'])){
462
- $apbct->data['user_counter']['accepted'] = 0;
463
- $apbct->data['user_counter']['blocked'] = 0;
464
- $apbct->data['user_counter']['since'] = date('d M');
465
- $apbct->saveData();
466
- }
467
- //Reset or create all counters
468
- if(!empty($_GET['ct_reset_all_counters'])){
469
- $apbct->data['sfw_counter'] = array('all' => 0, 'blocked' => 0);
470
- $apbct->data['all_time_counter'] = array('accepted' => 0, 'blocked' => 0);
471
- $apbct->data['user_counter'] = array('all' => 0, 'accepted' => 0, 'blocked' => 0, 'since' => date('d M'));
472
- $apbct->data['array_accepted'] = array();
473
- $apbct->data['array_blocked'] = array();
474
- $apbct->data['current_hour'] = '';
475
- $apbct->saveData();
476
- }
477
- //Compile user's counter string
478
- $user_counter=Array('accepted'=>$apbct->data['user_counter']['accepted'], 'blocked'=>$apbct->data['user_counter']['blocked'], 'all'=>$apbct->data['user_counter']['accepted'] + $apbct->data['user_counter']['blocked'], 'since'=>$apbct->data['user_counter']['since']);
479
- //Previous version $user_counter_str='<span style="color: white;">Since '.$user_counter['since'].': ' .$user_counter['all']*/. '</span> / <span style="color: green;">' .$user_counter['accepted']. '</span> / <span style="color: red;">' .$user_counter['blocked']. '</span>';
480
- $user_counter_str='<span style="color: white;">' . __('Since', 'cleantalk') . '&nbsp;' . $user_counter['since'].': </span><span style="color: green;">' .$user_counter['accepted']. '</span> / <span style="color: red;">' .$user_counter['blocked']. '</span>';
481
-
482
- $all_time_counter_str='';
483
- //Don't compile if all time counter disabled
484
- if($apbct->settings['all_time_counter'] == 1){
485
- $all_time_counter=Array('accepted'=>$apbct->data['all_time_counter']['accepted'], 'blocked'=>$apbct->data['all_time_counter']['blocked'], 'all'=>$apbct->data['all_time_counter']['accepted'] + $apbct->data['all_time_counter']['blocked']);
486
- $all_time_counter_str='<span style="color: white;" title="'.__('All / Allowed / Blocked submissions. The number of submissions is being counted since CleanTalk plugin installation.', 'cleantalk').'"><span style="color: white;"> | ' . __('All', 'cleantalk') . ': ' .$all_time_counter['all']. '</span> / <span style="color: green;">' .$all_time_counter['accepted']. '</span> / <span style="color: red;">' .$all_time_counter['blocked']. '</span></span>';
487
- }
488
-
489
- $daily_counter_str='';
490
- //Don't compile if daily counter disabled
491
- if( $apbct->settings['daily_counter'] == 1){
492
- $daily_counter=Array('accepted'=>array_sum($apbct->data['array_accepted']), 'blocked'=>array_sum($apbct->data['array_blocked']), 'all'=>array_sum($apbct->data['array_accepted']) + array_sum($apbct->data['array_blocked']));
493
- //Previous version $daily_counter_str='<span style="color: white;" title="'.__('All / Allowed / Blocked submissions. The number of submissions for past 24 hours. ', 'cleantalk').'"><span style="color: white;"> | Day: ' .$daily_counter['all']. '</span> / <span style="color: green;">' .$daily_counter['accepted']. '</span> / <span style="color: red;">' .$daily_counter['blocked']. '</span></span>';
494
- $daily_counter_str='<span style="color: white;" title="'.__('Allowed / Blocked submissions. The number of submissions for past 24 hours. ', 'cleantalk').'"><span style="color: white;"> | ' . __('Day', 'cleantalk') . ': </span><span style="color: green;">' .$daily_counter['accepted']. '</span> / <span style="color: red;">' .$daily_counter['blocked']. '</span></span>';
495
- }
496
- $sfw_counter_str='';
497
- //Don't compile if SFW counter disabled
498
- if( $apbct->settings['sfw_counter'] == 1 && $apbct->settings['spam_firewall'] == 1){
499
- $sfw_counter=Array('all'=>$apbct->data['sfw_counter']['all'], 'blocked'=>$apbct->data['sfw_counter']['blocked']);
500
- $sfw_counter_str='<span style="color: white;" title="'.__('All / Blocked events. Access attempts regitred by SpamFireWall counted since the last plugin activation.', 'cleantalk').'"><span style="color: white;"> | SpamFireWall: ' .$sfw_counter['all']. '</span> / <span style="color: red;">' .$sfw_counter['blocked']. '</span></span>';
501
- }
502
-
503
- $args = array(
504
- 'id' => 'ct_parent_node',
505
- 'title' => '<img src="' . plugin_dir_url(__FILE__) . 'images/logo_small1.png" alt="" height="" style="margin-top:9px; float: left;" />'
506
- .'<div style="margin: auto 7px;" class="ab-item alignright">'
507
- .'<div class="ab-label" id="ct_stats">'
508
- .($apbct->notice_trial == 1
509
- ? "<span><a style='color: red;' href=\"https://cleantalk.org/my/bill/recharge?utm_source=wp-backend&utm_medium=cpc&utm_campaign=WP%20backend%20trial&user_token={$apbct->user_token}&cp_mode=antispam\" target=\"_blank\">Renew Anti-Spam</a></span>"
510
- : '<span style="color: white;" title="'.__('Allowed / Blocked submissions. The number of submissions is being counted since ', 'cleantalk').' '.$user_counter['since'].'">'.$user_counter_str.'</span> '.$daily_counter_str.$all_time_counter_str.$sfw_counter_str
511
- )
512
- .'</div>'
513
- .'</div>' //You could change widget string here by simply deleting variables
514
- );
515
- $wp_admin_bar->add_node( $args );
516
-
517
- // DASHBOARD LINK
518
- if(!$apbct->white_label){
519
- $wp_admin_bar->add_node( array(
520
- 'id' => 'ct_dashboard_link',
521
- 'title' => '<a href="https://cleantalk.org/my/?user_token='.$apbct->user_token.'&utm_source=wp-backend&utm_medium=admin-bar&cp_mode=antispam " target="_blank">CleanTalk '.__('dashboard', 'cleantalk').'</a>',
522
- 'parent' => 'ct_parent_node'
523
- ));
524
- }
525
-
526
- $wp_admin_bar->add_node( array(
527
- 'id' => 'ct_settings_link',
528
- 'title' => '<a href="'.$apbct->settings_link.'">'.__('Settings', 'cleantalk').'</a>',
529
- 'parent' => 'ct_parent_node'
530
- ));
531
-
532
- // add a child item to our parent item. Bulk checks.
533
- if(!is_network_admin()){
534
- $args = array(
535
- 'id' => 'ct_settings_bulk_comments',
536
- 'title' => '<hr style="margin-top: 7px;" /><a href="edit-comments.php?page=ct_check_spam" title="'.__('Bulk spam comments removal tool.', 'cleantalk').'">'.__('Check comments for spam', 'cleantalk').'</a>',
537
- 'parent' => 'ct_parent_node'
538
- );
539
- }
540
- $wp_admin_bar->add_node( $args );
541
-
542
- // add a child item to our parent item. Bulk checks.
543
- if(!is_network_admin()){
544
- $args = array(
545
- 'id' => 'ct_settings_bulk_users',
546
- 'title' => '<a href="users.php?page=ct_check_users" title="Bulk spam users removal tool.">'.__('Check users for spam', 'cleantalk').'</a>',
547
- 'parent' => 'ct_parent_node'
548
- );
549
- }
550
- $wp_admin_bar->add_node( $args );
551
-
552
- // User counter reset.
553
- $args = array(
554
- 'id' => 'ct_reset_counter',
555
- 'title' => '<hr style="margin-top: 7px;"><a href="?ct_reset_user_counter=1" title="Reset your personal counter of submissions.">'.__('Reset first counter', 'cleantalk').'</a>',
556
- 'parent' => 'ct_parent_node'
557
- );
558
- $wp_admin_bar->add_node( $args );// add a child item to our parent item. Counter reset.
559
-
560
- // Reset ALL counter
561
- $args = array(
562
- 'id' => 'ct_reset_counters_all',
563
- 'title' => '<a href="?ct_reset_all_counters=1" title="Reset all counters.">'.__('Reset all counters', 'cleantalk').'</a>',
564
- 'parent' => 'ct_parent_node'
565
- );
566
- $wp_admin_bar->add_node( $args );
567
-
568
- // Support link
569
- if(!$apbct->white_label){
570
- $wp_admin_bar->add_node( array(
571
- 'id' => 'ct_admin_bar_support_link',
572
- 'title' => '<hr style="margin-top: 7px;" /><a target="_blank" href="https://wordpress.org/support/plugin/cleantalk-spam-protect">'.__('Support', 'cleantalk').'</a>',
573
- 'parent' => 'ct_parent_node'
574
- ));
575
- }
576
- }
577
- }
578
-
579
- /**
580
- * Unmark bad words
581
- * @param string $message
582
- * @return string Cleat comment
583
- */
584
- function apbct_comment__unmark_red($message) {
585
- $message = preg_replace("/\<font rel\=\"cleantalk\" color\=\"\#FF1000\"\>(\S+)\<\/font>/iu", '$1', $message);
586
-
587
- return $message;
588
- }
589
-
590
- // Ajax action feedback form comments page.
591
- function apbct_comment__send_feedback($comment_id = null, $comment_status = null, $change_status = false, $direct_call = null){
592
-
593
- // For AJAX call
594
- if( ! $direct_call ){
595
- check_ajax_referer('ct_secret_nonce', 'security');
596
- }
597
-
598
- $comment_id = !empty($_POST['comment_id']) ? $_POST['comment_id'] : false;
599
- $comment_status = !empty($_POST['comment_status']) ? $_POST['comment_status'] : false;
600
- $change_status = !empty($_POST['change_status']) ? $_POST['change_status'] : false;
601
-
602
- // If enter params is empty exit
603
- if(!$comment_id || !$comment_status)
604
- die();
605
-
606
- // $comment = get_comment($comment_id, 'ARRAY_A');
607
- $hash = get_comment_meta($comment_id, 'ct_hash', true);
608
-
609
- // If we can send the feedback
610
- if($hash){
611
-
612
- // Approving
613
- if($comment_status == '1' || $comment_status == 'approve'){
614
- $result = ct_send_feedback($hash.":1");
615
- // $comment['comment_content'] = apbct_comment__unmark_red($comment['comment_content']);
616
- // wp_update_comment($comment);
617
- $result === true ? 1 : 0;
618
- }
619
-
620
- // Disapproving
621
- if($comment_status == 'spam'){
622
- $result = ct_send_feedback($hash.":0");
623
- $result === true ? 1 : 0;
624
- }
625
- }else{
626
- $result = 'no_hash';
627
- }
628
-
629
- // Changing comment status(folder) if flag is set. spam || approve
630
- if($change_status !== false)
631
- wp_set_comment_status($comment_id, $comment_status);
632
-
633
- if(!$direct_call){
634
- echo !empty($result) ? $result : 0;
635
- die();
636
- }else{
637
-
638
- }
639
- }
640
-
641
- // Ajax action feedback form user page.
642
- function apbct_user__send_feedback($user_id = null, $status = null, $direct_call = null){
643
-
644
- check_ajax_referer('ct_secret_nonce', 'security');
645
-
646
- if(!$direct_call){
647
- $user_id = $_POST['user_id'];
648
- $status = $_POST['status'];
649
- }
650
-
651
- $hash = get_user_meta($user_id, 'ct_hash', true);
652
-
653
- if($hash){
654
- if($status == 'approve' || $status == 1){
655
- $result = ct_send_feedback($hash.":1");
656
- $result === true ? 1 : 0;
657
- }
658
- if($status == 'spam' || $status == 'disapprove' || $status == 0){
659
- $result = ct_send_feedback($hash.":0");
660
- $result === true ? 1 : 0;
661
- }
662
- }else{
663
- $result = 'no_hash';
664
- }
665
-
666
- if(!$direct_call){
667
- echo !empty($result) ? $result : 0;
668
- die();
669
- }else{
670
-
671
- }
672
-
673
- }
674
-
675
- /**
676
- * Send feedback when user deleted
677
- * @return null
678
- */
679
- function apbct_user__delete__hook($user_id, $reassign = null){
680
-
681
- $hash = get_user_meta($user_id, 'ct_hash', true);
682
- if ($hash !== '') {
683
- ct_feedback($hash, 0);
684
- }
685
  }
1
+ <?php
2
+
3
+ require_once('cleantalk-settings.php');
4
+
5
+ // Add buttons to comments list table
6
+ add_action( 'manage_comments_nav', 'apbct_add_buttons_to_comments_and_users', 10, 1 );
7
+ add_action( 'manage_users_extra_tablenav', 'apbct_add_buttons_to_comments_and_users', 10, 1 );
8
+
9
+ function apbct_add_buttons_to_comments_and_users( $unused_argument ) {
10
+
11
+ global $apbct;
12
+ $current_screen = get_current_screen();
13
+
14
+ if( 'users' == $current_screen->base ) {
15
+ $button_url = $current_screen->base . '.php?page=ct_check_users';
16
+ $button_description = 'users';
17
+ } elseif ( 'edit-comments' == $current_screen->base ) {
18
+ $button_url = $current_screen->base . '.php?page=ct_check_spam';
19
+ $button_description = 'comments';
20
+ } else {
21
+ return;
22
+ }
23
+
24
+ echo '
25
+ <a href="' . $button_url . '" class="button" style="margin:1px 0 0 0; display: inline-block;">
26
+ <img src="' . $apbct->logo__small__colored . '" alt="Cleantalk Antispam logo" height="" style="width: 17px; vertical-align: text-bottom;" />
27
+ ' . sprintf(__( 'Find spam %s', 'cleantalk' ), $button_description ) . '
28
+ </a>
29
+ <a href="https://cleantalk.org/my/show_requests?service_id=' . $apbct->data['service_id'] . '&int=week" target="_blank" class="button" style="margin:1px 0 0 0; display: inline-block;">
30
+ <img src="' . $apbct->logo__small__colored . '" alt="Cleantalk Antispam logo" height="" style="width: 17px; vertical-align: text-bottom;" />
31
+ ' . __( 'CleanTalk Anti-Spam Log', 'cleantalk' ) . '
32
+ </a>
33
+ ';
34
+
35
+ }
36
+
37
+ add_action( 'admin_bar_menu', 'apbct_admin__admin_bar__add', 999 );
38
+
39
+ //Adding widjet
40
+ function ct_dashboard_statistics_widget() {
41
+
42
+ global $apbct;
43
+
44
+ if(apbct_is_user_role_in(array('administrator'))){
45
+ wp_add_dashboard_widget(
46
+ 'ct_dashboard_statistics_widget',
47
+ $apbct->plugin_name
48
+ ."<div class='ct_widget_top_links'>"
49
+ ."<img src='".plugins_url('/cleantalk-spam-protect/inc/images/preloader.gif')."' class='ct_preloader'>"
50
+ .sprintf(__("%sRefresh%s", 'cleantalk'), "<a href='#ct_widget' class='ct_widget_refresh_link'>", "</a>")
51
+ .sprintf(__("%sConfigure%s", 'cleantalk'), "<a href='{$apbct->settings_link}' class='ct_widget_settings_link'>", "</a>")
52
+ ."</div>",
53
+ 'ct_dashboard_statistics_widget_output'
54
+ );
55
+ }
56
+ }
57
+
58
+ // Outputs statistics widget content
59
+ function ct_dashboard_statistics_widget_output( $post, $callback_args ) {
60
+
61
+ global $apbct, $current_user;
62
+
63
+ echo "<div id='ct_widget_wrapper'>";
64
+ ?>
65
+ <form id='ct_refresh_form' method='POST' action='#ct_widget'>
66
+ <input type='hidden' name='ct_brief_refresh' value='1'>
67
+ </form>
68
+ <h4 class='ct_widget_block_header' style='margin-left: 12px;'><?php _e('7 days anti-spam stats', 'cleantalk'); ?></h4>
69
+ <div class='ct_widget_block ct_widget_chart_wrapper'>
70
+ <div id='ct_widget_chart'></div>
71
+ </div>
72
+ <h4 class='ct_widget_block_header'><?php _e('Top 5 spam IPs blocked', 'cleantalk'); ?></h4>
73
+ <hr class='ct_widget_hr'>
74
+ <?php
75
+ if(!apbct_api_key__is_correct() || (isset($apbct->data['brief_data']['error_no']) && $apbct->data['brief_data']['error_no'] == 6)){
76
+ ?> <div class='ct_widget_block'>
77
+ <form action='<? echo $apbct->settings_link; ?>' method='POST'>
78
+ <h2 class='ct_widget_activate_header'><?php _e('Get Access key to activate Anti-Spam protection!', 'cleantalk'); ?></h2>
79
+ <input class='ct_widget_button ct_widget_activate_button' type='submit' name='get_apikey_auto' value='ACTIVATE' />
80
+ </form>
81
+ </div>
82
+ <?php
83
+ }elseif(!empty($apbct->data['brief_data']['error'])){
84
+ echo '<div class="ct_widget_block">'
85
+ .'<h2 class="ct_widget_activate_header">'
86
+ .sprintf(__('Something went wrong! Error: "%s".', 'cleantalk'), "<u>{$apbct->brief_data['error']}</u>")
87
+ .'</h2>';
88
+ if($apbct->user_token && !$apbct->white_label){
89
+ echo '<h2 class="ct_widget_activate_header">'
90
+ .__('Please, visit your dashboard.', 'cleantalk')
91
+ .'</h2>'
92
+ .'<a target="_blank" href="https://cleantalk.org/my?user_token='.$apbct->user_token.'&cp_mode=antispam">'
93
+ .'<input class="ct_widget_button ct_widget_activate_button ct_widget_resolve_button" type="button" value="VISIT CONTROL PANEL">'
94
+ .'</a>';
95
+ }
96
+ echo '</div>';
97
+ }
98
+
99
+ if(apbct_api_key__is_correct() && empty($apbct->data['brief_data']['error'])){
100
+ ?>
101
+ <div class='ct_widget_block'>
102
+ <table cellspacing="0">
103
+ <tr>
104
+ <th><?php _e('IP', 'cleantalk'); ?></th>
105
+ <th><?php _e('Country', 'cleantalk'); ?></th>
106
+ <th><?php _e('Block Count', 'cleantalk'); ?></th>
107
+ </tr>
108
+ <?php foreach($apbct->brief_data['top5_spam_ip'] as $val){ ?>
109
+ <tr>
110
+ <td><?php echo $val[0]; ?></td>
111
+ <td><?php echo $val[1] ? "<img src='https://cleantalk.org/images/flags/".strtolower($val[1]).".png'>" : ''; ?>&nbsp;<?php
112
+ echo $val[1]
113
+ ? locale_get_display_region('sl-Latn-'.$val[1].'-nedis', substr(get_locale(), 0, 2))
114
+ : 'Unknown'; ?></td>
115
+ <td style='text-align: center;'><?php echo $val[2]; ?></td>
116
+ </tr>
117
+ <?php } ?>
118
+ </table>
119
+ <?php if($apbct->user_token){ ?>
120
+ <a target='_blank' href='https://cleantalk.org/my?user_token=<?php echo $apbct->user_token; ?>&cp_mode=antispam'>
121
+ <input class='ct_widget_button' id='ct_widget_button_view_all' type='button' value='View all'>
122
+ </a>
123
+ <?php } ?>
124
+ </div>
125
+
126
+ <?php
127
+ }
128
+ // Notice at the bottom
129
+ if(isset($current_user) && in_array('administrator', $current_user->roles)){
130
+
131
+ if($apbct->spam_count && $apbct->spam_count > 0){
132
+ echo '<div class="ct_widget_wprapper_total_blocked">'
133
+ .'<img src="'.$apbct->logo__small__colored.'" class="ct_widget_small_logo"/>'
134
+ .'<span title="'.sprintf(__('This is the count from the %s\'s cloud and could be different to admin bar counters', 'cleantalk').'">', $apbct->plugin_name)
135
+ .sprintf(
136
+ /* translators: %s: Number of spam messages */
137
+ __( '%s%s%s has blocked %s spam for all time. The statistics are automatically updated every 24 hours.', 'cleantalk'),
138
+ !$apbct->white_label ? '<a href="https://cleantalk.org/my/?user_token='.$apbct->user_token.'&utm_source=wp-backend&utm_medium=dashboard_widget&cp_mode=antispam" target="_blank">' : '',
139
+ $apbct->plugin_name,
140
+ !$apbct->white_label ? '</a>' : '',
141
+ number_format($apbct->data['spam_count'], 0, ',', ' ')
142
+ )
143
+ .'</span>'
144
+ .(!$apbct->white_label
145
+ ? '<br><br>'
146
+ .'<b style="font-size: 16px;">'
147
+ .sprintf(
148
+ __('Do you like CleanTalk? %sPost your feedback here%s.', 'cleantalk'),
149
+ '<u><a href="https://wordpress.org/support/plugin/cleantalk-spam-protect/reviews/#new-post" target="_blank">',
150
+ '</a></u>'
151
+ )
152
+ .'</b>'
153
+ : ''
154
+ )
155
+ .'</div>';
156
+ }
157
+ }
158
+ echo '</div>';
159
+ }
160
+
161
+ /**
162
+ * Admin action 'admin_init' - Add the admin settings and such
163
+ */
164
+ function apbct_admin__init(){
165
+
166
+ global $apbct;
167
+
168
+ // Getting dashboard widget statistics
169
+ if(!empty($_POST['ct_brief_refresh'])){
170
+ $apbct->data['brief_data'] = CleantalkAPI::method__get_antispam_report_breif($apbct->api_key);
171
+ $apbct->saveData();
172
+ }
173
+
174
+ // Getting key like hoster. Only once!
175
+ if(!is_main_site() && $apbct->white_label && empty($apbct->api_key)){
176
+
177
+ $_POST['submit'] = 'get_key_auto';
178
+ $settings = apbct_settings__validate(array());
179
+ unset($_POST['submit']);
180
+
181
+ if(!empty($settings['apikey'])){
182
+ $apbct->settings['apikey'] = $settings['apikey'];
183
+ $apbct->api_key = $settings['apikey'];
184
+ $apbct->saveSettings();
185
+ }
186
+
187
+ }
188
+
189
+ // AJAX actions
190
+
191
+ // Settings
192
+ add_action('wp_ajax_apbct_settings__get__long_description', 'apbct_settings__get__long_description'); // Long description
193
+ }
194
+
195
+ /**
196
+ * Manage links in plugins list
197
+ * @return array
198
+ */
199
+ function apbct_admin__plugin_action_links($links, $file) {
200
+
201
+ global $apbct;
202
+
203
+ $settings_link = '<a href="' . $apbct->settings_link . '">' . __( 'Settings' ) . '</a>';
204
+
205
+ array_unshift( $links, $settings_link ); // before other links
206
+ return $links;
207
+ }
208
+
209
+ /**
210
+ * Manage links and plugins page
211
+ * @return array
212
+ */
213
+ function apbct_admin__register_plugin_links($links, $file){
214
+
215
+ global $apbct;
216
+
217
+ //Return if it's not our plugin
218
+ if ($file != $apbct->base_name)
219
+ return $links;
220
+
221
+ if($apbct->white_label){
222
+ $links = array_slice($links, 0, 1);
223
+ $links[] = "<script>jQuery('.plugin-title strong').each(function(i, item){
224
+ if(jQuery(item).html() == 'Anti-Spam by CleanTalk')
225
+ jQuery(item).html('{$apbct->plugin_name}');
226
+ });</script>";
227
+ return $links;
228
+ }
229
+
230
+ if(substr(get_locale(), 0, 2) != 'en')
231
+ $links[] = '<a class="ct_meta_links ct_translate_links" href="'
232
+ .sprintf('https://translate.wordpress.org/locale/%s/default/wp-plugins/cleantalk-spam-protect', substr(get_locale(), 0, 2))
233
+ .'" target="_blank">'
234
+ .__('Translate', 'cleantalk')
235
+ .'</a>';
236
+
237
+ $links[] = '<a class="ct_meta_links" href="'.$apbct->settings_link.'" target="_blank">' . __( 'Start here','cleantalk' ) . '</a>';
238
+ $links[] = '<a class="ct_meta_links ct_faq_links" href="https://wordpress.org/plugins/cleantalk-spam-protect/faq/" target="_blank">' . __( 'FAQ','cleantalk' ) . '</a>';
239
+ $links[] = '<a class="ct_meta_links ct_support_links"href="https://wordpress.org/support/plugin/cleantalk-spam-protect" target="_blank">' . __( 'Support','cleantalk' ) . '</a>';
240
+ $trial = apbct_admin__badge__get_premium(false);
241
+ if(!empty($trial))
242
+ $links[] = apbct_admin__badge__get_premium(false);
243
+
244
+ return $links;
245
+ }
246
+
247
+ /**
248
+ * Admin action 'admin_enqueue_scripts' - Enqueue admin script of reloading admin page after needed AJAX events
249
+ * @param string $hook URL of hooked page
250
+ */
251
+ function apbct_admin__enqueue_scripts($hook){
252
+
253
+ global $apbct;
254
+
255
+ // Scripts to all admin pages
256
+ wp_enqueue_script('ct_admin_js_notices', plugins_url('/cleantalk-spam-protect/js/cleantalk-admin.min.js'), array(), APBCT_VERSION);
257
+ wp_enqueue_style ('ct_admin_css', plugins_url('/cleantalk-spam-protect/css/cleantalk-admin.min.css'), array(), APBCT_VERSION, 'all');
258
+
259
+ wp_localize_script( 'jquery', 'ctAdminCommon', array(
260
+ '_ajax_nonce' => wp_create_nonce( 'ct_secret_nonce' ),
261
+ '_ajax_url' => admin_url( 'admin-ajax.php' ),
262
+ 'plugin_name' => $apbct->plugin_name,
263
+ 'logo' => '<img src="' . $apbct->logo . '" alt="" height="" style="width: 17px; vertical-align: text-bottom;" />',
264
+ 'logo_small' => '<img src="' . $apbct->logo__small . '" alt="" height="" style="width: 17px; vertical-align: text-bottom;" />',
265
+ 'logo_small_colored' => '<img src="' . $apbct->logo__small__colored . '" alt="" height="" style="width: 17px; vertical-align: text-bottom;" />',
266
+ ) );
267
+
268
+ // DASHBOARD page JavaScript and CSS
269
+ if($hook == 'index.php' && apbct_is_user_role_in(array('administrator'))){
270
+
271
+ wp_enqueue_style('ct_admin_css_widget_dashboard', plugins_url('/cleantalk-spam-protect/css/cleantalk-dashboard-widget.min.css'), array(), APBCT_VERSION, 'all');
272
+ wp_enqueue_style ('ct_icons', plugins_url('/cleantalk-spam-protect/css/cleantalk-icons.min.css'), array(), APBCT_VERSION, 'all');
273
+
274
+ wp_enqueue_script('ct_gstatic_charts_loader', plugins_url('/cleantalk-spam-protect/js/cleantalk-dashboard-widget--google-charts.min.js'), array(), APBCT_VERSION);
275
+ wp_enqueue_script('ct_admin_js_widget_dashboard', plugins_url('/cleantalk-spam-protect/js/cleantalk-dashboard-widget.min.js'), array('ct_gstatic_charts_loader'), APBCT_VERSION);
276
+
277
+ // Preparing widget data
278
+ // Parsing brief data 'spam_stat' {"yyyy-mm-dd": spam_count, "yyyy-mm-dd": spam_count} to [["yyyy-mm-dd", "spam_count"], ["yyyy-mm-dd", "spam_count"]]
279
+ $to_chart = array();
280
+
281
+ // Crunch. Response contains error.
282
+ if(!empty($apbct->data['brief_data']['error']))
283
+ $apbct->data['brief_data'] = array_merge($apbct->data['brief_data'], $apbct->def_data['brief_data']);
284
+
285
+ foreach( $apbct->data['brief_data']['spam_stat'] as $key => $value ){
286
+ $to_chart[] = array( $key, $value );
287
+ } unset( $key, $value );
288
+
289
+ wp_localize_script( 'jquery', 'apbctDashboardWidget', array(
290
+ 'data' => $to_chart,
291
+ ));
292
+ }
293
+
294
+ // SETTINGS's page JavaScript and CSS
295
+ if( $hook == 'settings_page_cleantalk' ){
296
+
297
+ // jQueryUI
298
+ wp_enqueue_script('jqueryui', plugins_url('/cleantalk-spam-protect/js/jquery-ui.min.js'), array('jquery'), '1.12.1' );
299
+ wp_enqueue_style('jqueryui_css', plugins_url('/cleantalk-spam-protect/css/jquery-ui.min.css'),array(), '1.21.1', 'all');
300
+
301
+ wp_enqueue_script('cleantalk_admin_js_settings_page', plugins_url('/cleantalk-spam-protect/js/cleantalk-admin-settings-page.min.js'), array(), APBCT_VERSION);
302
+ wp_enqueue_style('cleantalk_admin_css_settings_page', plugins_url('/cleantalk-spam-protect/css/cleantalk-admin-settings-page.min.css'), array(), APBCT_VERSION, 'all');
303
+ wp_enqueue_style ('ct_icons', plugins_url('/cleantalk-spam-protect/css/cleantalk-icons.min.css'), array(), APBCT_VERSION, 'all');
304
+
305
+ wp_localize_script( 'jquery', 'ctSettingsPage', array(
306
+ 'ct_subtitle' => $apbct->ip_license ? __('Hosting AntiSpam', 'cleantalk') : '',
307
+ 'ip_license' => $apbct->ip_license ? true : false,
308
+ ));
309
+ }
310
+
311
+ // COMMENTS page JavaScript
312
+ if($hook == 'edit-comments.php'){
313
+ wp_enqueue_script('ct_comments_editscreen', plugins_url('/cleantalk-spam-protect/js/cleantalk-comments-editscreen.min.js'), array(), APBCT_VERSION);
314
+ wp_localize_script( 'jquery', 'ctCommentsScreen', array(
315
+ 'ct_ajax_nonce' => wp_create_nonce('ct_secret_nonce'),
316
+ 'spambutton_text' => __("Find spam comments", 'cleantalk'),
317
+ 'ct_feedback_msg_whitelisted' => __("The sender has been whitelisted.", 'cleantalk'),
318
+ 'ct_feedback_msg_blacklisted' => __("The sender has been blacklisted.", 'cleantalk'),
319
+ 'ct_feedback_msg' => sprintf(__("Feedback has been sent to %sCleanTalk Dashboard%s.", 'cleantalk'), $apbct->user_token ? "<a target='_blank' href=https://cleantalk.org/my?user_token={$apbct->user_token}&cp_mode=antispam>" : '', $apbct->user_token ? "</a>" : ''),
320
+ 'ct_show_check_links' => (bool)$apbct->settings['show_check_links'],
321
+ 'ct_img_src_new_tab' => plugin_dir_url(__FILE__)."images/new_window.gif",
322
+ ));
323
+ }
324
+
325
+ // USERS page JavaScript
326
+ if($hook == 'users.php'){
327
+ wp_enqueue_script('ct_users_editscreen', plugins_url('/cleantalk-spam-protect/js/cleantalk-users-editscreen.min.js'), array(), APBCT_VERSION);
328
+ wp_localize_script( 'jquery', 'ctUsersScreen', array(
329
+ 'spambutton_text' => __("Find spam-users", 'cleantalk'),
330
+ 'ct_show_check_links' => (bool)$apbct->settings['show_check_links'],
331
+ 'ct_img_src_new_tab' => plugin_dir_url(__FILE__)."images/new_window.gif"
332
+ ));
333
+ }
334
+
335
+ }
336
+
337
+ /**
338
+ * Notice blog owner if plugin is used without Access key
339
+ * @return bool
340
+ */
341
+ function apbct_admin__notice_message(){
342
+
343
+ global $apbct;
344
+
345
+ $page = get_current_screen();
346
+
347
+ //General notice control flags
348
+ $self_owned_key = ($apbct->moderate_ip == 0 && !defined('CLEANTALK_ACCESS_KEY') ? true : false);
349
+ $is_dashboard = (is_network_admin() || is_admin() ? true : false);
350
+ $is_admin = (current_user_can('activate_plugins') ? true : false);
351
+
352
+ $page_is_ct_settings = (in_array($page->id, array('settings_page_cleantalk', 'settings_page_cleantalk-network', 'comments_page_ct_check_spam', 'users_page_ct_check_users')) ? true : false);
353
+
354
+ //Misc
355
+ $user_token = ($apbct->user_token ? '&user_token='.$apbct->user_token : '');
356
+ $settings_link = (is_network_admin() ? 'settings.php?page=cleantalk' : 'options-general.php?page=cleantalk');
357
+
358
+ if($self_owned_key && $is_dashboard && $is_admin){
359
+ // Auto update notice
360
+ /* Disabled at 09.09.2018
361
+ if($apbct->notice_auto_update == 1 && $apbct->auto_update != -1 && empty($_COOKIE['apbct_update_banner_closed'])){
362
+ $link = '<a href="https://cleantalk.org/help/cleantalk-auto-update" target="_blank">%s</a>';
363
+ $button = sprintf($link, '<input type="button" class="button button-primary" value="'.__('Learn more', 'cleantalk').'" />');
364
+ echo '<div class="error notice is-dismissible apbct_update_notice">'
365
+ .'<h3>'
366
+ .__('Do you know that Anti-Spam by CleanTalk has auto update option?', 'cleantalk')
367
+ .'</br></br>'
368
+ .$button
369
+ .'</h3>'
370
+ .'</div>';
371
+ }
372
+ */
373
+ //Unable to get key automatically (if apbct_admin__init().getAutoKey() returns error)
374
+ if ($apbct->notice_show && !empty($apbct->errors['get_key']) && !$apbct->white_label){
375
+ echo '<div class="error">
376
+ <h3>' . sprintf(__("Unable to get Access key automatically: %s", 'cleantalk'), $apbct->api_key).
377
+ "<a target='__blank' style='margin-left: 10px' href='https://cleantalk.org/register?platform=wordpress&email=" . urlencode(ct_get_admin_email())."&website=" . urlencode(parse_url(get_option('siteurl'),PHP_URL_HOST))."'>".__('Get the Access key', 'cleantalk').'</a>
378
+ </h3>
379
+ </div>';
380
+ }
381
+
382
+ //key == "" || "enter key"
383
+ if (!apbct_api_key__is_correct() && $apbct->moderate_ip == 0){
384
+ echo "<div class='error'>"
385
+ ."<h3>"
386
+ .sprintf(__("Please enter Access Key in %s settings to enable anti spam protection!", 'cleantalk'), "<a href='{$settings_link}'>CleanTalk plugin</a>")
387
+ ."</h3>"
388
+ ."</div>";
389
+ $apbct->notice_show = false;
390
+ }
391
+
392
+ //"Trial period ends" notice from apbct_admin__init().api_method__notice_paid_till()
393
+ if ($apbct->notice_show && $apbct->notice_trial == 1 && $apbct->moderate_ip == 0 && !$apbct->white_label) {
394
+ if(isset($_GET['page']) && in_array($_GET['page'], array('cleantalk', 'ct_check_spam', 'ct_check_users'))){
395
+ echo '<div class="error">
396
+ <h3>' . sprintf(__("%s trial period ends, please upgrade to %s!", 'cleantalk'),
397
+ "<a href='{$settings_link}'>".$apbct->plugin_name."</a>",
398
+ "<a href=\"https://cleantalk.org/my/bill/recharge?utm_source=wp-backend&utm_medium=cpc&utm_campaign=WP%20backend%20trial$user_token&cp_mode=antispam\" target=\"_blank\"><b>premium version</b></a>") .
399
+ '</h3>
400
+ <h4 style = "color: gray">If you already paid for the service, please, re-save the plugin settings (WP Dashboard —> Settings —> Anti-Spam by CleanTalk) to dismiss the notice.</h4>
401
+ </div>';
402
+ $apbct->notice_show = false;
403
+ }
404
+ }
405
+
406
+ //Renew notice from apbct_admin_init().api_method__notice_paid_till()
407
+ if ($apbct->notice_show && $apbct->notice_renew == 1 && $apbct->moderate_ip == 0 && !$apbct->white_label) {
408
+ $renew_link = "<a href=\"https://cleantalk.org/my/bill/recharge?utm_source=wp-backend&utm_medium=cpc&utm_campaign=WP%%20backend%%20renew$user_token&cp_mode=antispam\" target=\"_blank\">%s</a>";
409
+ $button_html = sprintf($renew_link, '<input type="button" class="button button-primary" value="'.__('RENEW ANTI-SPAM', 'cleantalk').'" />');
410
+ $link_html = sprintf($renew_link, "<b>".__('next year', 'cleantalk')."</b>");
411
+
412
+ echo '<div class="updated">
413
+ <h3>'.
414
+ sprintf(__("Please renew your anti-spam license for %s.", 'cleantalk'), $link_html). '<br /><br />' . $button_html .
415
+ '</h3>
416
+ </div>';
417
+ $apbct->notice_show = false;
418
+ }
419
+
420
+ //"Wrong access key" notice (if ct_update_option().METHOD_notice_validate_key returns a error)
421
+ if ($apbct->notice_show && $page_is_ct_settings && !$apbct->data['key_is_ok'] && $apbct->moderate_ip == 0 && !$apbct->white_label){
422
+ echo '<div class="error">
423
+ <h3><b>'.
424
+ __("Wrong <a href='{$settings_link}'><b style=\"color: #49C73B;\">Clean</b><b style=\"color: #349ebf;\">Talk</b> access key</a>! Please check it or ask <a target=\"_blank\" href=\"https://cleantalk.org/forum/\">support</a>.", 'cleantalk').
425
+ '</b></h3>
426
+ </div>';
427
+ }
428
+ }
429
+
430
+ return true;
431
+ }
432
+
433
+ function apbct_admin__badge__get_premium($print = true, $out = ''){
434
+
435
+ global $apbct;
436
+
437
+ if($apbct->license_trial == 1 && $apbct->user_token){
438
+ $out .= '<b style="display: inline-block; margin-top: 10px;">'
439
+ .($print ? __('Make it right!', 'cleantalk').' ' : '')
440
+ .sprintf(
441
+ __('%sGet premium%s', 'cleantalk'),
442
+ '<a href="https://cleantalk.org/my/bill/recharge?user_token='.$apbct->user_token.'" target="_blank">',
443
+ '</a>'
444
+ )
445
+ .'</b>';
446
+ }
447
+
448
+ if($print)
449
+ echo $out;
450
+ else
451
+ return $out;
452
+ }
453
+
454
+ function apbct_admin__admin_bar__add( $wp_admin_bar ) {
455
+
456
+ global $apbct;
457
+
458
+ if (current_user_can('activate_plugins') && $apbct->settings['show_adminbar'] == 1 && (apbct_api_key__is_correct($apbct->api_key) !== false || (defined('CLEANTALK_SHOW_ADMIN_BAR_FORCE') && CLEANTALK_SHOW_ADMIN_BAR_FORCE))) {
459
+
460
+ //Reset or create user counter
461
+ if(!empty($_GET['ct_reset_user_counter'])){
462
+ $apbct->data['user_counter']['accepted'] = 0;
463
+ $apbct->data['user_counter']['blocked'] = 0;
464
+ $apbct->data['user_counter']['since'] = date('d M');
465
+ $apbct->saveData();
466
+ }
467
+ //Reset or create all counters
468
+ if(!empty($_GET['ct_reset_all_counters'])){
469
+ $apbct->data['sfw_counter'] = array('all' => 0, 'blocked' => 0);
470
+ $apbct->data['all_time_counter'] = array('accepted' => 0, 'blocked' => 0);
471
+ $apbct->data['user_counter'] = array('all' => 0, 'accepted' => 0, 'blocked' => 0, 'since' => date('d M'));
472
+ $apbct->data['array_accepted'] = array();
473
+ $apbct->data['array_blocked'] = array();
474
+ $apbct->data['current_hour'] = '';
475
+ $apbct->saveData();
476
+ }
477
+ //Compile user's counter string
478
+ $user_counter=Array('accepted'=>$apbct->data['user_counter']['accepted'], 'blocked'=>$apbct->data['user_counter']['blocked'], 'all'=>$apbct->data['user_counter']['accepted'] + $apbct->data['user_counter']['blocked'], 'since'=>$apbct->data['user_counter']['since']);
479
+ //Previous version $user_counter_str='<span style="color: white;">Since '.$user_counter['since'].': ' .$user_counter['all']*/. '</span> / <span style="color: green;">' .$user_counter['accepted']. '</span> / <span style="color: red;">' .$user_counter['blocked']. '</span>';
480
+ $user_counter_str='<span style="color: white;">' . __('Since', 'cleantalk') . '&nbsp;' . $user_counter['since'].': </span><span style="color: green;">' .$user_counter['accepted']. '</span> / <span style="color: red;">' .$user_counter['blocked']. '</span>';
481
+
482
+ $all_time_counter_str='';
483
+ //Don't compile if all time counter disabled
484
+ if($apbct->settings['all_time_counter'] == 1){
485
+ $all_time_counter=Array('accepted'=>$apbct->data['all_time_counter']['accepted'], 'blocked'=>$apbct->data['all_time_counter']['blocked'], 'all'=>$apbct->data['all_time_counter']['accepted'] + $apbct->data['all_time_counter']['blocked']);
486
+ $all_time_counter_str='<span style="color: white;" title="'.__('All / Allowed / Blocked submissions. The number of submissions is being counted since CleanTalk plugin installation.', 'cleantalk').'"><span style="color: white;"> | ' . __('All', 'cleantalk') . ': ' .$all_time_counter['all']. '</span> / <span style="color: green;">' .$all_time_counter['accepted']. '</span> / <span style="color: red;">' .$all_time_counter['blocked']. '</span></span>';
487
+ }
488
+
489
+ $daily_counter_str='';
490
+ //Don't compile if daily counter disabled
491
+ if( $apbct->settings['daily_counter'] == 1){
492
+ $daily_counter=Array('accepted'=>array_sum($apbct->data['array_accepted']), 'blocked'=>array_sum($apbct->data['array_blocked']), 'all'=>array_sum($apbct->data['array_accepted']) + array_sum($apbct->data['array_blocked']));
493
+ //Previous version $daily_counter_str='<span style="color: white;" title="'.__('All / Allowed / Blocked submissions. The number of submissions for past 24 hours. ', 'cleantalk').'"><span style="color: white;"> | Day: ' .$daily_counter['all']. '</span> / <span style="color: green;">' .$daily_counter['accepted']. '</span> / <span style="color: red;">' .$daily_counter['blocked']. '</span></span>';
494
+ $daily_counter_str='<span style="color: white;" title="'.__('Allowed / Blocked submissions. The number of submissions for past 24 hours. ', 'cleantalk').'"><span style="color: white;"> | ' . __('Day', 'cleantalk') . ': </span><span style="color: green;">' .$daily_counter['accepted']. '</span> / <span style="color: red;">' .$daily_counter['blocked']. '</span></span>';
495
+ }
496
+ $sfw_counter_str='';
497
+ //Don't compile if SFW counter disabled
498
+ if( $apbct->settings['sfw_counter'] == 1 && $apbct->settings['spam_firewall'] == 1){
499
+ $sfw_counter=Array('all'=>$apbct->data['sfw_counter']['all'], 'blocked'=>$apbct->data['sfw_counter']['blocked']);
500
+ $sfw_counter_str='<span style="color: white;" title="'.__('All / Blocked events. Access attempts regitred by SpamFireWall counted since the last plugin activation.', 'cleantalk').'"><span style="color: white;"> | SpamFireWall: ' .$sfw_counter['all']. '</span> / <span style="color: red;">' .$sfw_counter['blocked']. '</span></span>';
501
+ }
502
+
503
+ $args = array(
504
+ 'id' => 'ct_parent_node',
505
+ 'title' => '<img src="' . plugin_dir_url(__FILE__) . 'images/logo_small1.png" alt="" height="" style="margin-top:9px; float: left;" />'
506
+ .'<div style="margin: auto 7px;" class="ab-item alignright">'
507
+ .'<div class="ab-label" id="ct_stats">'
508
+ .($apbct->notice_trial == 1
509
+ ? "<span><a style='color: red;' href=\"https://cleantalk.org/my/bill/recharge?utm_source=wp-backend&utm_medium=cpc&utm_campaign=WP%20backend%20trial&user_token={$apbct->user_token}&cp_mode=antispam\" target=\"_blank\">Renew Anti-Spam</a></span>"
510
+ : '<span style="color: white;" title="'.__('Allowed / Blocked submissions. The number of submissions is being counted since ', 'cleantalk').' '.$user_counter['since'].'">'.$user_counter_str.'</span> '.$daily_counter_str.$all_time_counter_str.$sfw_counter_str
511
+ )
512
+ .'</div>'
513
+ .'</div>' //You could change widget string here by simply deleting variables
514
+ );
515
+ $wp_admin_bar->add_node( $args );
516
+
517
+ // DASHBOARD LINK
518
+ if(!$apbct->white_label){
519
+ $wp_admin_bar->add_node( array(
520
+ 'id' => 'ct_dashboard_link',
521
+ 'title' => '<a href="https://cleantalk.org/my/?user_token='.$apbct->user_token.'&utm_source=wp-backend&utm_medium=admin-bar&cp_mode=antispam " target="_blank">CleanTalk '.__('dashboard', 'cleantalk').'</a>',
522
+ 'parent' => 'ct_parent_node'
523
+ ));
524
+ }
525
+
526
+ $wp_admin_bar->add_node( array(
527
+ 'id' => 'ct_settings_link',
528
+ 'title' => '<a href="'.$apbct->settings_link.'">'.__('Settings', 'cleantalk').'</a>',
529
+ 'parent' => 'ct_parent_node'
530
+ ));
531
+
532
+ // add a child item to our parent item. Bulk checks.
533
+ if(!is_network_admin()){
534
+ $args = array(
535
+ 'id' => 'ct_settings_bulk_comments',
536
+ 'title' => '<hr style="margin-top: 7px;" /><a href="edit-comments.php?page=ct_check_spam" title="'.__('Bulk spam comments removal tool.', 'cleantalk').'">'.__('Check comments for spam', 'cleantalk').'</a>',
537
+ 'parent' => 'ct_parent_node'
538
+ );
539
+ }
540
+ $wp_admin_bar->add_node( $args );
541
+
542
+ // add a child item to our parent item. Bulk checks.
543
+ if(!is_network_admin()){
544
+ $args = array(
545
+ 'id' => 'ct_settings_bulk_users',
546
+ 'title' => '<a href="users.php?page=ct_check_users" title="Bulk spam users removal tool.">'.__('Check users for spam', 'cleantalk').'</a>',
547
+ 'parent' => 'ct_parent_node'
548
+ );
549
+ }
550
+ $wp_admin_bar->add_node( $args );
551
+
552
+ // User counter reset.
553
+ $args = array(
554
+ 'id' => 'ct_reset_counter',
555
+ 'title' => '<hr style="margin-top: 7px;"><a href="?ct_reset_user_counter=1" title="Reset your personal counter of submissions.">'.__('Reset first counter', 'cleantalk').'</a>',
556
+ 'parent' => 'ct_parent_node'
557
+ );
558
+ $wp_admin_bar->add_node( $args );// add a child item to our parent item. Counter reset.
559
+
560
+ // Reset ALL counter
561
+ $args = array(
562
+ 'id' => 'ct_reset_counters_all',
563
+ 'title' => '<a href="?ct_reset_all_counters=1" title="Reset all counters.">'.__('Reset all counters', 'cleantalk').'</a>',
564
+ 'parent' => 'ct_parent_node'
565
+ );
566
+ $wp_admin_bar->add_node( $args );
567
+
568
+ // Support link
569
+ if(!$apbct->white_label){
570
+ $wp_admin_bar->add_node( array(
571
+ 'id' => 'ct_admin_bar_support_link',
572
+ 'title' => '<hr style="margin-top: 7px;" /><a target="_blank" href="https://wordpress.org/support/plugin/cleantalk-spam-protect">'.__('Support', 'cleantalk').'</a>',
573
+ 'parent' => 'ct_parent_node'
574
+ ));
575
+ }
576
+ }
577
+ }
578
+
579
+ /**
580
+ * Unmark bad words
581
+ * @param string $message
582
+ * @return string Cleat comment
583
+ */
584
+ function apbct_comment__unmark_red($message) {
585
+ $message = preg_replace("/\<font rel\=\"cleantalk\" color\=\"\#FF1000\"\>(\S+)\<\/font>/iu", '$1', $message);
586
+
587
+ return $message;
588
+ }
589
+
590
+ // Ajax action feedback form comments page.
591
+ function apbct_comment__send_feedback($comment_id = null, $comment_status = null, $change_status = false, $direct_call = null){
592
+
593
+ // For AJAX call
594
+ if( ! $direct_call ){
595
+ check_ajax_referer('ct_secret_nonce', 'security');
596
+ }
597
+
598
+ $comment_id = !empty($_POST['comment_id']) ? $_POST['comment_id'] : false;
599
+ $comment_status = !empty($_POST['comment_status']) ? $_POST['comment_status'] : false;
600
+ $change_status = !empty($_POST['change_status']) ? $_POST['change_status'] : false;
601
+
602
+ // If enter params is empty exit
603
+ if(!$comment_id || !$comment_status)
604
+ die();
605
+
606
+ // $comment = get_comment($comment_id, 'ARRAY_A');
607
+ $hash = get_comment_meta($comment_id, 'ct_hash', true);
608
+
609
+ // If we can send the feedback
610
+ if($hash){
611
+
612
+ // Approving
613
+ if($comment_status == '1' || $comment_status == 'approve'){
614
+ $result = ct_send_feedback($hash.":1");
615
+ // $comment['comment_content'] = apbct_comment__unmark_red($comment['comment_content']);
616
+ // wp_update_comment($comment);
617
+ $result === true ? 1 : 0;
618
+ }
619
+
620
+ // Disapproving
621
+ if($comment_status == 'spam'){
622
+ $result = ct_send_feedback($hash.":0");
623
+ $result === true ? 1 : 0;
624
+ }
625
+ }else{
626
+ $result = 'no_hash';
627
+ }
628
+
629
+ // Changing comment status(folder) if flag is set. spam || approve
630
+ if($change_status !== false)
631
+ wp_set_comment_status($comment_id, $comment_status);
632
+
633
+ if(!$direct_call){
634
+ echo !empty($result) ? $result : 0;
635
+ die();
636
+ }else{
637
+
638
+ }
639
+ }
640
+
641
+ // Ajax action feedback form user page.
642
+ function apbct_user__send_feedback($user_id = null, $status = null, $direct_call = null){
643
+
644
+ check_ajax_referer('ct_secret_nonce', 'security');
645
+
646
+ if(!$direct_call){
647
+ $user_id = $_POST['user_id'];
648
+ $status = $_POST['status'];
649
+ }
650
+
651
+ $hash = get_user_meta($user_id, 'ct_hash', true);
652
+
653
+ if($hash){
654
+ if($status == 'approve' || $status == 1){
655
+ $result = ct_send_feedback($hash.":1");
656
+ $result === true ? 1 : 0;
657
+ }
658
+ if($status == 'spam' || $status == 'disapprove' || $status == 0){
659
+ $result = ct_send_feedback($hash.":0");
660
+ $result === true ? 1 : 0;
661
+ }
662
+ }else{
663
+ $result = 'no_hash';
664
+ }
665
+
666
+ if(!$direct_call){
667
+ echo !empty($result) ? $result : 0;
668
+ die();
669
+ }else{
670
+
671
+ }
672
+
673
+ }
674
+
675
+ /**
676
+ * Send feedback when user deleted
677
+ * @return null
678
+ */
679
+ function apbct_user__delete__hook($user_id, $reassign = null){
680
+
681
+ $hash = get_user_meta($user_id, 'ct_hash', true);
682
+ if ($hash !== '') {
683
+ ct_feedback($hash, 0);
684
+ }
685
  }
inc/cleantalk-ajax.php CHANGED
@@ -1,728 +1,731 @@
1
- <?php
2
- global $cleantalk_hooked_actions;
3
-
4
- /*
5
- AJAX functions
6
- */
7
-
8
- //$cleantalk_ajax_actions_to_check - array for POST 'actions' we should check.
9
-
10
- $cleantalk_ajax_actions_to_check[] = 'qcf_validate_form'; //Quick Contact Form
11
- $cleantalk_ajax_actions_to_check[] = 'amoforms_submit'; //amoForms
12
-
13
- //cleantalk_hooked_actions[] - array for POST 'actions' which were direct hooked.
14
-
15
- $cleantalk_hooked_actions[] = 'rwp_ajax_action_rating'; //Don't check Reviewer plugin
16
-
17
- $cleantalk_hooked_actions[] = 'ct_feedback_comment';
18
-
19
- /* MailChimp Premium*/
20
- add_filter('mc4wp_form_errors', 'ct_mc4wp_ajax_hook');
21
-
22
- /*hooks for Usernoise Form*/
23
- add_action('un_feedback_form_body', 'ct_add_hidden_fields',1);
24
- add_filter('un_validate_feedback', 'ct_ajax_hook', 1, 2);
25
-
26
- /*hooks for AJAX Login & Register email validation*/
27
- add_action( 'wp_ajax_nopriv_validate_email', 'ct_validate_email_ajaxlogin',1 );
28
- add_action( 'wp_ajax_validate_email', 'ct_validate_email_ajaxlogin',1 );
29
- $cleantalk_hooked_actions[]='validate_email';
30
-
31
- /*hooks for user registration*/
32
- add_action( 'user_register', 'ct_user_register_ajaxlogin',1 );
33
-
34
- /*hooks for WPUF pro */
35
- //add_action( 'wp_ajax_nopriv_wpuf_submit_register', 'ct_wpuf_submit_register',1 );
36
- //add_action( 'wp_ajax_wpuf_submit_register', 'ct_wpuf_submit_register',1 );
37
- add_action( 'wp_ajax_nopriv_wpuf_submit_register', 'ct_ajax_hook',1 );
38
- add_action( 'wp_ajax_wpuf_submit_register', 'ct_ajax_hook',1 );
39
- $cleantalk_hooked_actions[]='submit_register';
40
-
41
- /*hooks for MyMail */
42
- //add_action( 'wp_ajax_nopriv_mymail_form_submit', 'ct_mymail_form_submit',1 );
43
- //add_action( 'wp_ajax_mymail_form_submit', 'ct_mymail_form_submit',1 );
44
- add_action( 'wp_ajax_nopriv_mymail_form_submit', 'ct_ajax_hook',1 );
45
- add_action( 'wp_ajax_mymail_form_submit', 'ct_ajax_hook',1 );
46
- $cleantalk_hooked_actions[]='form_submit';
47
-
48
- /*hooks for MailPoet */
49
- //add_action( 'wp_ajax_nopriv_wysija_ajax', 'ct_wysija_ajax',1 );
50
- //add_action( 'wp_ajax_wysija_ajax', 'ct_wysija_ajax',1 );
51
- add_action( 'wp_ajax_nopriv_wysija_ajax', 'ct_ajax_hook',1 );
52
- add_action( 'wp_ajax_wysija_ajax', 'ct_ajax_hook',1 );
53
- $cleantalk_hooked_actions[]='wysija_ajax';
54
-
55
- /*hooks for cs_registration_validation */
56
- //add_action( 'wp_ajax_nopriv_cs_registration_validation', 'ct_cs_registration_validation',1 );
57
- //add_action( 'wp_ajax_cs_registration_validation', 'ct_cs_registration_validation',1 );
58
- add_action( 'wp_ajax_nopriv_cs_registration_validation', 'ct_ajax_hook',1 );
59
- add_action( 'wp_ajax_cs_registration_validation', 'ct_ajax_hook',1 );
60
- $cleantalk_hooked_actions[]='cs_registration_validation';
61
-
62
- /*hooks for send_message and request_appointment */
63
- //add_action( 'wp_ajax_nopriv_send_message', 'ct_sm_ra',1 );
64
- //add_action( 'wp_ajax_send_message', 'ct_sm_ra',1 );
65
- //add_action( 'wp_ajax_nopriv_request_appointment', 'ct_sm_ra',1 );
66
- //add_action( 'wp_ajax_request_appointment', 'ct_sm_ra',1 );
67
- add_action( 'wp_ajax_nopriv_send_message', 'ct_ajax_hook',1 );
68
- add_action( 'wp_ajax_send_message', 'ct_ajax_hook',1 );
69
- add_action( 'wp_ajax_nopriv_request_appointment', 'ct_ajax_hook',1 );
70
- add_action( 'wp_ajax_request_appointment', 'ct_ajax_hook',1 );
71
- $cleantalk_hooked_actions[]='send_message';
72
- $cleantalk_hooked_actions[]='request_appointment';
73
-
74
- /*hooks for zn_do_login */
75
- //add_action( 'wp_ajax_nopriv_zn_do_login', 'ct_zn_do_login',1 );
76
- //add_action( 'wp_ajax_zn_do_login', 'ct_zn_do_login',1 );
77
- add_action( 'wp_ajax_nopriv_zn_do_login', 'ct_ajax_hook',1 );
78
- add_action( 'wp_ajax_zn_do_login', 'ct_ajax_hook',1 );
79
- $cleantalk_hooked_actions[]='zn_do_login';
80
-
81
- /*hooks for zn_do_login */
82
- //add_action( 'wp_ajax_nopriv_cscf-submitform', 'ct_cscf_submitform',1 );
83
- //add_action( 'wp_ajax_cscf-submitform', 'ct_cscf_submitform',1 );
84
- if(isset($_POST['action']) && $_POST['action'] == 'cscf-submitform'){
85
- add_filter('preprocess_comment', 'ct_ajax_hook', 1);
86
- //add_action( 'wp_ajax_nopriv_cscf-submitform', 'ct_ajax_hook',1 );
87
- //add_action( 'wp_ajax_cscf-submitform', 'ct_ajax_hook',1 );
88
- $cleantalk_hooked_actions[]='cscf-submitform';
89
- }
90
-
91
-
92
- /*hooks for visual form builder */
93
- //add_action( 'wp_ajax_nopriv_vfb_submit', 'ct_vfb_submit',1 );
94
- //add_action( 'wp_ajax_vfb_submit', 'ct_vfb_submit',1 );
95
- add_action( 'wp_ajax_nopriv_vfb_submit', 'ct_ajax_hook',1 );
96
- add_action( 'wp_ajax_vfb_submit', 'ct_ajax_hook',1 );
97
- $cleantalk_hooked_actions[]='vfb_submit';
98
-
99
- /*hooks for woocommerce_checkout*/
100
- add_action( 'wp_ajax_nopriv_woocommerce_checkout', 'ct_ajax_hook',1 );
101
- add_action( 'wp_ajax_woocommerce_checkout', 'ct_ajax_hook',1 );
102
- $cleantalk_hooked_actions[]='woocommerce_checkout';
103
- $cleantalk_hooked_actions[]='wcfm_ajax_controller';
104
-
105
- /*hooks for frm_action*/
106
- add_action( 'wp_ajax_nopriv_frm_entries_create', 'ct_ajax_hook',1 );
107
- add_action( 'wp_ajax_frm_entries_create', 'ct_ajax_hook',1 );
108
- $cleantalk_hooked_actions[]='frm_entries_create';
109
-
110
- add_action( 'wp_ajax_nopriv_td_mod_register', 'ct_ajax_hook',1 );
111
- add_action( 'wp_ajax_td_mod_register', 'ct_ajax_hook',1 );
112
- $cleantalk_hooked_actions[]='td_mod_register';
113
-
114
- /*hooks for tevolution theme*/
115
- add_action( 'wp_ajax_nopriv_tmpl_ajax_check_user_email', 'ct_ajax_hook',1 );
116
- add_action( 'wp_ajax_tmpl_ajax_check_user_email', 'ct_ajax_hook',1 );
117
- add_action( 'wp_ajax_nopriv_tevolution_submit_from_preview', 'ct_ajax_hook',1 );
118
- add_action( 'wp_ajax_tevolution_submit_from_preview', 'ct_ajax_hook',1 );
119
- add_action( 'wp_ajax_nopriv_submit_form_recaptcha_validation', 'ct_ajax_hook',1 );
120
- add_action( 'wp_ajax_tmpl_submit_form_recaptcha_validation', 'ct_ajax_hook',1 );
121
- $cleantalk_hooked_actions[]='tmpl_ajax_check_user_email';
122
- $cleantalk_hooked_actions[]='tevolution_submit_from_preview';
123
- $cleantalk_hooked_actions[]='submit_form_recaptcha_validation';
124
-
125
- /* hooks for contact forms by web settler ajax*/
126
- add_action( 'wp_ajax_nopriv_smuzform-storage', 'ct_ajax_hook',1 );
127
- $cleantalk_hooked_actions[]='smuzform_form_submit';
128
-
129
- /* hooks for reviewer plugin*/
130
- add_action( 'wp_ajax_nopriv_rwp_ajax_action_rating', 'ct_ajax_hook',1 );
131
- $cleantalk_hooked_actions[]='rwp-submit-wrap';
132
-
133
- $cleantalk_hooked_actions[]='post_update';
134
-
135
- /* Ninja Forms hoocked actions */
136
- $cleantalk_hooked_actions[]='ninja_forms_ajax_submit';
137
- $cleantalk_hooked_actions[]='nf_ajax_submit';
138
- $cleantalk_hooked_actions[]='ninja_forms_process'; // Depricated ?
139
-
140
- /* Follow-Up Emails */
141
- $cleantalk_hooked_actions[] = 'fue_wc_set_cart_email'; // Don't check email via this plugin
142
-
143
- /* Follow-Up Emails */
144
- $cleantalk_hooked_actions[] = 'fue_wc_set_cart_email'; // Don't check email via this plugin
145
-
146
- function ct_validate_email_ajaxlogin($email=null, $is_ajax=true){
147
-
148
- $email = is_null( $email ) ? $email : $_POST['email'];
149
- $email = sanitize_email($email);
150
- $is_good = !filter_var($email, FILTER_VALIDATE_EMAIL) || email_exists($email) ? false : true;
151
-
152
- if(class_exists('AjaxLogin')&&isset($_POST['action'])&&$_POST['action']=='validate_email'){
153
-
154
- $checkjs = apbct_js_test('ct_checkjs', $_POST);
155
- $sender_info['post_checkjs_passed'] = $checkjs;
156
- if ($checkjs === null){
157
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
158
- $sender_info['cookie_checkjs_passed'] = $checkjs;
159
- }
160
-
161
- //Making a call
162
- $base_call_result = apbct_base_call(
163
- array(
164
- 'sender_email' => $email,
165
- 'sender_nickname' => '',
166
- 'sender_info' => $sender_info,
167
- 'js_on' => $checkjs,
168
- ),
169
- true
170
- );
171
-
172
- $ct_result = $base_call_result['ct_result'];
173
-
174
- if ($ct_result->allow===0){
175
- $is_good=false;
176
- }
177
- }
178
-
179
- if($is_good){
180
- $ajaxresult=array(
181
- 'description' => null,
182
- 'cssClass' => 'noon',
183
- 'code' => 'success'
184
- );
185
- }else{
186
- $ajaxresult=array(
187
- 'description' => 'Invalid Email',
188
- 'cssClass' => 'error-container',
189
- 'code' => 'error'
190
- );
191
- }
192
-
193
- $ajaxresult = json_encode($ajaxresult);
194
- print $ajaxresult;
195
- wp_die();
196
- }
197
-
198
- function ct_user_register_ajaxlogin($user_id)
199
- {
200
- if(class_exists('AjaxLogin')&&isset($_POST['action'])&&$_POST['action']=='register_submit')
201
- {
202
-
203
- $checkjs = apbct_js_test('ct_checkjs', $_POST);
204
- $sender_info['post_checkjs_passed'] = $checkjs;
205
- if ($checkjs === null){
206
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
207
- $sender_info['cookie_checkjs_passed'] = $checkjs;
208
- }
209
-
210
- //Making a call
211
- $base_call_result = apbct_base_call(
212
- array(
213
- 'sender_email' => sanitize_email($_POST['email']),
214
- 'sender_nickname' => sanitize_email($_POST['login']),
215
- 'sender_info' => $sender_info,
216
- 'js_on' => $checkjs,
217
- ),
218
- true
219
- );
220
-
221
- $ct_result = $base_call_result['ct_result'];
222
-
223
- if ($ct_result->allow === 0)
224
- {
225
- wp_delete_user($user_id);
226
- }
227
- }
228
- return $user_id;
229
- }
230
-
231
- /**
232
- * Hook into MailChimp for WordPress `mc4wp_form_errors` filter.
233
- *
234
- * @param array $errors
235
- * @return array
236
- */
237
- function ct_mc4wp_ajax_hook( array $errors )
238
- {
239
- $result = ct_ajax_hook();
240
-
241
- // only return modified errors array when function returned a string value (the message key)
242
- if( is_string( $result ) ) {
243
- $errors[] = $result;
244
- }
245
-
246
- return $errors;
247
- }
248
-
249
- function ct_ajax_hook($message_obj = false, $additional = false)
250
- {
251
- global $apbct, $current_user;
252
-
253
- $message_obj = (array)$message_obj;
254
-
255
- // Get current_user and set it globaly
256
- apbct_wp_set_current_user($current_user instanceof WP_User ? $current_user : apbct_wp_get_current_user() );
257
-
258
- // Go out because of not spam data
259
- $skip_post = array(
260
- 'apbct_js_keys__get', // Our service code
261
- 'gmaps_display_info_window', // Geo My WP pop-up windows.
262
- 'gmw_ps_display_info_window', // Geo My WP pop-up windows.
263
- 'the_champ_user_auth', // Super Socializer
264
- 'simbatfa-init-otp', //Two-Factor Auth
265
- 'wppb_msf_check_required_fields', //ProfileBuilder skip step checking
266
- 'boss_we_login', //Login form
267
- 'sidebar_login_process', // Login CF7
268
- 'cp_update_style_settings', // Convert Pro. Saving settings
269
- 'updraft_savesettings', // UpdraftPlus
270
- 'wpdUpdateAutomatically', //Comments update
271
- 'upload-attachment', // Skip ulpload attachments
272
- 'iwj_update_profile', //Skip profile page checker
273
- 'st_partner_create_service', //Skip add hotel via admin
274
- 'vp_ajax_vpt_option_save', // https://themeforest.net/item/motor-vehicles-parts-equipments-accessories-wordpress-woocommerce-theme/16829946
275
- 'mailster_send_test', //Mailster send test admin
276
- 'acf/validate_save_post', //ACF validate post admin
277
- 'admin:saveThemeOptions', //Ait-theme admin checking
278
- 'save_tourmaster_option', //Tourmaster admin save
279
- 'validate_register_email', // Service id #313320
280
- 'elementor_pro_forms_send_form', //Elementor Pro
281
- 'phone-orders-for-woocommerce', //Phone orders for woocommerce backend
282
- 'ihc_check_reg_field_ajax', //Ajax check required fields
283
- 'OSTC_lostPassword', //Lost password ajax form
284
- 'check_retina_image_availability', //There are too many ajax requests from mobile
285
- 'uap_check_reg_field_ajax', // Ultimate Affiliate Pro. Form validation.
286
- 'edit-comment', // Edit comments by admin ??? that shouldn't happen
287
- 'formcraft3_save_form_progress', // FormCraft – Contact Form Builder for WordPress. Save progress.
288
- 'wpdmpp_save_settings', // PayPal save settings.
289
- 'give_process_donation', // GiveWP will be checked by feedback_general_contact_form
290
- 'iwj_login', // Fix for unknown plugin for user #133315
291
- );
292
-
293
- // Skip test if
294
- if( !$apbct->settings['general_contact_forms_test'] || // Test disabled
295
- !apbct_is_user_enable($apbct->user) || // User is admin, editor, author
296
- // (function_exists('get_current_user_id') && get_current_user_id() != 0) || // Check with default wp_* function if it's admin
297
- (!$apbct->settings['protect_logged_in'] && ($apbct->user instanceof WP_User) && $apbct->user->ID !== 0 ) || // Logged in user
298
- apbct_exclusions_check__url() || // url exclusions
299
- (isset($_POST['action']) && in_array($_POST['action'], $skip_post)) || // Special params
300
- (isset($_GET['action']) && in_array($_GET['action'], $skip_post)) || // Special params
301
- isset($_POST['quform_submit']) || //QForms multi-paged form skip
302
- // QAEngine Theme fix
303
- ( strval(current_action()) != 'et_pre_insert_answer' &&
304
- (
305
- (isset($message_obj['author']) && intval($message_obj['author']) == 0) ||
306
- (isset($message_obj['post_author']) && intval($message_obj['post_author']) == 0)
307
- )
308
- )
309
- )
310
- {
311
- return false;
312
- }
313
-
314
- //General post_info for all ajax calls
315
- $post_info = array('comment_type' => 'feedback_ajax');
316
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
317
-
318
- if(isset($_POST['user_login']))
319
- $sender_nickname = $_POST['user_login'];
320
- else
321
- $sender_nickname = '';
322
-
323
- //QAEngine Theme answers
324
- if( !empty($message_obj) && isset($message_obj['post_type'], $message_obj['post_content']) ){
325
- $curr_user = get_user_by('id', $message_obj['author']);
326
- if (!$curr_user)
327
- $curr_user = get_user_by('id', $message_obj['post_author']);
328
- $ct_post_temp['comment'] = $message_obj['post_content'];
329
- $ct_post_temp['email'] = $curr_user->data->user_email;
330
- $ct_post_temp['name'] = $curr_user->data->user_login;
331
- }
332
-
333
- //CSCF fix
334
- if(isset($_POST['action']) && $_POST['action']== 'cscf-submitform'){
335
- $ct_post_temp[] = $message_obj['comment_author'];
336
- $ct_post_temp[] = $message_obj['comment_author_email'];
337
- $ct_post_temp[] = $message_obj['comment_content'];
338
- }
339
-
340
- //??? fix
341
- if(isset($_POST['action'], $_POST['target']) && ($_POST['action']=='request_appointment'||$_POST['action']=='send_message')){
342
- $ct_post_temp=$_POST;
343
- $ct_post_temp['target']=1;
344
- }
345
-
346
- //UserPro fix
347
- if(isset($_POST['action'], $_POST['template']) && $_POST['action']=='userpro_process_form' && $_POST['template']=='register'){
348
- $ct_post_temp = $_POST;
349
- $ct_post_temp['shortcode'] = '';
350
- }
351
- //Reviewer fix
352
- if(isset($_POST['action']) && $_POST['action'] == 'rwp_ajax_action_rating')
353
- {
354
- $ct_post_temp['name'] = $_POST['user_name'];
355
- $ct_post_temp['email'] = $_POST['user_email'];
356
- $ct_post_temp['comment'] = $_POST['comment'];
357
- }
358
- //Woocommerce checkout
359
- if(isset($_POST['action']) && $_POST['action']=='woocommerce_checkout'){
360
- $post_info['comment_type'] = 'order';
361
- }
362
- //Easy Forms for Mailchimp
363
- if( isset($_POST['action']) && $_POST['action']=='process_form_submission' ){
364
- $post_info['comment_type'] = 'contact_enquire_wordpress_easy_forms_for_mailchimp';
365
- if( isset($_POST['form_data']) ) {
366
- $form_data = explode( '&', $_POST['form_data'] );
367
- $form_data_arr = array();
368
- foreach ( $form_data as $val ) {
369
- $form_data_element = explode( '=', $val );
370
- $form_data_arr[$form_data_element[0]] = @$form_data_element[1];
371
- }
372
- if( isset( $form_data_arr['EMAIL'] ) ) {
373
- $ct_post_temp['email'] = $form_data_arr['EMAIL'];
374
- }
375
- }
376
- }
377
-
378
- $ct_temp_msg_data = isset($ct_post_temp)
379
- ? ct_get_fields_any($ct_post_temp)
380
- : ct_get_fields_any($_POST);
381
-
382
- $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
383
- $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
384
- $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
385
- $contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
386
- $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
387
- if($subject != '') {
388
- $message['subject'] = $subject;
389
- }
390
-
391
- // Skip submission if no data found
392
- if ($sender_email === ''|| !$contact_form)
393
- return false;
394
-
395
- // Mailpoet fix
396
- if (isset($message['wysijaData'], $message['wysijaplugin'], $message['task'], $message['controller']) && $message['wysijaplugin'] == 'wysija-newsletters' && $message['controller'] == 'campaigns')
397
- return false;
398
- // Mailpoet3 admin skip fix
399
- if (isset($_POST['action'], $_POST['method']) && $_POST['action'] == 'mailpoet' && $_POST['method'] =='save')
400
- return false;
401
-
402
- // WP Foto Vote Fix
403
- if (!empty($_FILES)){
404
- foreach($message as $key => $value){
405
- if(strpos($key, 'oje') !== false)
406
- return;
407
- } unset($key ,$value);
408
- }
409
-
410
- /**
411
- * @todo Contact form detect
412
- */
413
- // Detect contact form an set it's name to $contact_form to use later
414
- $contact_form = null;
415
- foreach($_POST as $param => $value){
416
- if(strpos($param, 'et_pb_contactform_submit') === 0){
417
- $contact_form = 'contact_form_divi_theme';
418
- $contact_form_additional = str_replace($param, '', $param);
419
- }
420
- if(strpos($param, 'avia_generated_form') === 0){
421
- $contact_form = 'contact_form_enfold_theme';
422
- $contact_form_additional = str_replace('avia_generated_form', '', $param);
423
- }
424
- if(!empty($contact_form))
425
- break;
426
- }
427
-
428
- $base_call_result = apbct_base_call(
429
- array(
430
- 'message' => $message,
431
- 'sender_email' => $sender_email,
432
- 'sender_nickname' => $sender_nickname,
433
- 'sender_info' => array('post_checkjs_passed' => $checkjs),
434
- 'post_info' => $post_info,
435
- 'js_on' => $checkjs,
436
- )
437
- );
438
- $ct_result = $base_call_result['ct_result'];
439
-
440
- if ($ct_result->allow == 0)
441
- {
442
- if(isset($_POST['action']) && $_POST['action']=='wpuf_submit_register'){
443
- $result=Array('success'=>false,'error'=>$ct_result->comment);
444
- @header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
445
- print json_encode($result);
446
- die();
447
- }
448
- else if(isset($_POST['action']) && $_POST['action']=='mymail_form_submit')
449
- {
450
- $result=Array('success'=>false,'html'=>$ct_result->comment);
451
- @header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
452
- print json_encode($result);
453
- die();
454
- }
455
- else if(isset($_POST['action'], $_POST['task']) && $_POST['action'] == 'wysija_ajax' && $_POST['task'] != 'send_preview' && $_POST['task'] != 'send_test_mail')
456
- {
457
- $result=Array('result'=>false,'msgs'=>Array('updated'=>Array($ct_result->comment)));
458
- //@header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
459
- print $_GET['callback'].'('.json_encode($result).');';
460
- die();
461
- }
462
- else if(isset($_POST['action']) && $_POST['action']=='cs_registration_validation')
463
- {
464
- $result=Array("type"=>"error","message"=>$ct_result->comment);
465
- print json_encode($result);
466
- die();
467
- }
468
- else if(isset($_POST['action']) && ($_POST['action']=='request_appointment' || $_POST['action']=='send_message'))
469
- {
470
- print $ct_result->comment;
471
- die();
472
- }
473
- else if(isset($_POST['action']) && $_POST['action']=='zn_do_login')
474
- {
475
- print '<div id="login_error">'.$ct_result->comment.'</div>';
476
- die();
477
- }
478
- else if(isset($_POST['action']) && $_POST['action']=='vfb_submit')
479
- {
480
- $result=Array('result'=>false,'message'=>$ct_result->comment);
481
- @header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
482
- print json_encode($result);
483
- die();
484
- }
485
- else if(isset($_POST['action']) && $_POST['action']=='woocommerce_checkout')
486
- {
487
- print $ct_result->comment;
488
- die();
489
- }
490
- else if(isset($_POST['action']) && $_POST['action']=='frm_entries_create')
491
- {
492
- $result=Array('112'=>$ct_result->comment);
493
- print json_encode($result);
494
- die();
495
- }
496
- else if(isset($_POST['cma-action']) && $_POST['cma-action']=='add')
497
- {
498
- $result=Array('success'=>0, 'thread_id'=>null,'messages'=>Array($ct_result->comment));
499
- print json_encode($result);
500
- die();
501
- }
502
- else if(isset($_POST['action']) && $_POST['action']=='td_mod_register')
503
- {
504
- print json_encode(array('register', 0, $ct_result->comment));
505
- die();
506
- }
507
- else if(isset($_POST['action']) && $_POST['action']=='tmpl_ajax_check_user_email')
508
- {
509
- print "17,email";
510
- die();
511
- }
512
- else if(isset($_POST['action']) && ($_POST['action']=='tevolution_submit_from_preview' || $_POST['action']=='submit_form_recaptcha_validation'))
513
- {
514
- print $ct_result->comment;
515
- die();
516
- }
517
- // WooWaitList
518
- // http://codecanyon.net/item/woowaitlist-woocommerce-back-in-stock-notifier/7103373
519
- else if(isset($_POST['action']) && $_POST['action']=='wew_save_to_db_callback')
520
- {
521
- $result = array();
522
- $result['error'] = 1;
523
- $result['message'] = $ct_result->comment;
524
- $result['code'] = 5; // Unused code number in WooWaitlist
525
- print json_encode($result);
526
- die();
527
- }
528
- // UserPro
529
- else if(isset($_POST['action'], $_POST['template']) && $_POST['action']=='userpro_process_form' && $_POST['template']=='register')
530
- {
531
- foreach($_POST as $key => $value){
532
- $output[$key]=$value;
533
- }unset($key, $value);
534
- $output['template'] = $ct_result->comment;
535
- $output=json_encode($output);
536
- print_r($output);
537
- die;
538
- }
539
- // Quick event manager
540
- else if(isset($_POST['action']) && $_POST['action']=='qem_validate_form'){
541
- $errors[] = 'registration_forbidden';
542
- $result = Array(
543
- 'success' => 'false',
544
- 'errors' => $errors,
545
- 'title' => $ct_result->comment
546
- );
547
- print json_encode($result);
548
- die();
549
- }
550
- // Quick Contact Form
551
- elseif(isset($_POST['action']) && $_POST['action'] == 'qcf_validate_form')
552
- {
553
- $result = Array(
554
- 'blurb' => "<h1>".$ct_result->comment."</h1>",
555
- 'display' => "Oops, got a few problems here",
556
- 'errors' => array(
557
- 0 => array(
558
- error => 'error',
559
- name => 'name'
560
- ),
561
- ),
562
- 'success' => 'false',
563
- );
564
- print json_encode($result);
565
- die();
566
- }
567
- // Usernoise Contact Form
568
- elseif(isset($_POST['title'], $_POST['email'], $_POST['type'], $_POST['ct_checkjs']))
569
- {
570
- return array($ct_result->comment);
571
- die();
572
- }
573
- // amoForms
574
- elseif(isset($_POST['action']) && $_POST['action'] == 'amoforms_submit')
575
- {
576
- $result = Array(
577
- 'result' => true,
578
- 'type' => "html",
579
- 'value' => "<h1 style='font-size: 25px; color: red;'>".$ct_result->comment."</h1>",
580
- 'fast' => false
581
- );
582
- print json_encode($result);
583
- die();
584
- }
585
- // MailChimp for Wordpress Premium
586
- elseif(!empty($_POST['_mc4wp_form_id']))
587
- {
588
- return 'ct_mc4wp_response';
589
- }
590
- // QAEngine Theme answers
591
- elseif ( !empty($message_obj) && isset($message_obj['post_type'], $message_obj['post_content']) ){
592
- throw new Exception($ct_result->comment);
593
- }
594
- //ES Add subscriber
595
- elseif(isset($_POST['action']) && $_POST['action'] == 'es_add_subscriber')
596
- {
597
- $result = Array(
598
- 'error' => 'unexpected-error',
599
- );
600
- print json_encode($result);
601
- die();
602
- }
603
- //Convertplug. Strpos because action value dynamically changes and depends on mailing service
604
- elseif (isset($_POST['action']) && strpos($_POST['action'], '_add_subscriber') !== false){
605
- $result = Array(
606
- 'action' => "message",
607
- 'detailed_msg' => "",
608
- 'email_status' => false,
609
- 'message' => "<h1 style='font-size: 25px; color: red;'>".$ct_result->comment."</h1>",
610
- 'status' => "error",
611
- 'url' => "none"
612
- );
613
- print json_encode($result);
614
- die();
615
- }
616
- // Ultimate Form Builder
617
- elseif (isset($_POST['action']) && $_POST['action'] == 'ufbl_front_form_action'){
618
- $result = Array(
619
- 'error_keys' => array(),
620
- 'error_flag' => 1,
621
- 'response_message' => $ct_result->comment
622
- );
623
- print json_encode($result);
624
- die();
625
- }
626
- // Smart Forms
627
- elseif (isset($_POST['action']) && $_POST['action'] == 'rednao_smart_forms_save_form_values'){
628
- $result = Array(
629
- 'message' => $ct_result->comment,
630
- 'refreshCaptcha' => 'n',
631
- 'success' => 'n'
632
- );
633
- print json_encode($result);
634
- die();
635
- }
636
- //cFormsII
637
- elseif(isset($_POST['action']) && $_POST['action'] == 'submitcform')
638
- {
639
- header('Content-Type: application/json');
640
- $result = Array(
641
- 'no' => "",
642
- 'result' => "failure",
643
- 'html' =>$ct_result->comment,
644
- 'hide' => false,
645
- 'redirection' => null
646
-
647
- );
648
- print json_encode($result);
649
- die();
650
- }
651
- //Contact Form by Web-Settler
652
- elseif(isset($_POST['smFieldData']))
653
- {
654
- $result = Array(
655
- 'signal' => true,
656
- 'code' => 0,
657
- 'thanksMsg' => $ct_result->comment,
658
- 'errors' => array(),
659
- 'isMsg' => true,
660
- 'redirectUrl' => null
661
- );
662
- print json_encode($result);
663
- die();
664
- }
665
- //Reviewer
666
- elseif(isset($_POST['action']) && $_POST['action'] == 'rwp_ajax_action_rating')
667
- {
668
- $result = Array(
669
- 'success' => false,
670
- 'data' => array(0=>$ct_result->comment)
671
- );
672
- print json_encode($result);
673
- die();
674
- }
675
- // CouponXXL Theme
676
- elseif(isset($_POST['_wp_http_referer'], $_POST['register_field'], $_POST['action']) && strpos($_POST['_wp_http_referer'],'/register/account') !== false && $_POST['action'] == 'register'){
677
- $result = array(
678
- 'message' => '<div class="alert alert-error">'.$ct_result->comment.'</div>',
679
- );
680
- die(json_encode($result));
681
- }
682
- //ConvertPro
683
- elseif(isset($_POST['action']) && $_POST['action'] == 'cp_v2_notify_admin' || $_POST['action'] == 'cpro_notify_via_email')
684
- {
685
- $result = Array(
686
- 'success' => false,
687
- 'data' => array('error'=>$ct_result->comment,'style_slug'=>'convertprot-form'),
688
- );
689
- print json_encode($result);
690
- die();
691
- }
692
- //Easy Forms for Mailchimp
693
- elseif( isset($_POST['action']) && $_POST['action']=='process_form_submission' ) {
694
- wp_send_json_error(
695
- array(
696
- 'error' => 1,
697
- 'response' => $ct_result->comment
698
- )
699
- );
700
- }
701
- //Optin wheel
702
- elseif( isset($_POST['action']) && ($_POST['action'] == 'wof-lite-email-optin' || $_POST['action'] == 'wof-email-optin')) {
703
- wp_send_json_error(__($ct_result->comment, 'wp-optin-wheel'));
704
- }
705
- // Forminator
706
- elseif( isset($_POST['action']) && strpos($_POST['action'], 'forminator_submit') !== false ){
707
- wp_send_json_error(
708
- array(
709
- 'message' => $ct_result->comment,
710
- 'success' => false,
711
- 'errors' => array(),
712
- 'behav' => 'behaviour-thankyou',
713
- )
714
- );
715
- }
716
- else
717
- {
718
- die(json_encode(array('apbct' => array('blocked' => true, 'comment' => $ct_result->comment,))));
719
- }
720
- }
721
- //Allow == 1
722
- else{
723
- //QAEngine Theme answers
724
- if ( !empty($message_obj) && isset($message_obj['post_type'], $message_obj['post_content']) ){
725
- return $message_obj;
726
- }
727
- }
728
- }
 
 
 
1
+ <?php
2
+ global $cleantalk_hooked_actions;
3
+
4
+ /*
5
+ AJAX functions
6
+ */
7
+
8
+ //$cleantalk_ajax_actions_to_check - array for POST 'actions' we should check.
9
+
10
+ $cleantalk_ajax_actions_to_check[] = 'qcf_validate_form'; //Quick Contact Form
11
+ $cleantalk_ajax_actions_to_check[] = 'amoforms_submit'; //amoForms
12
+
13
+ //cleantalk_hooked_actions[] - array for POST 'actions' which were direct hooked.
14
+
15
+ $cleantalk_hooked_actions[] = 'rwp_ajax_action_rating'; //Don't check Reviewer plugin
16
+
17
+ $cleantalk_hooked_actions[] = 'ct_feedback_comment';
18
+
19
+ /* MailChimp Premium*/
20
+ add_filter('mc4wp_form_errors', 'ct_mc4wp_ajax_hook');
21
+
22
+ /*hooks for Usernoise Form*/
23
+ add_action('un_feedback_form_body', 'ct_add_hidden_fields',1);
24
+ add_filter('un_validate_feedback', 'ct_ajax_hook', 1, 2);
25
+
26
+ /*hooks for AJAX Login & Register email validation*/
27
+ add_action( 'wp_ajax_nopriv_validate_email', 'ct_validate_email_ajaxlogin',1 );
28
+ add_action( 'wp_ajax_validate_email', 'ct_validate_email_ajaxlogin',1 );
29
+ $cleantalk_hooked_actions[]='validate_email';
30
+
31
+ /*hooks for user registration*/
32
+ add_action( 'user_register', 'ct_user_register_ajaxlogin',1 );
33
+
34
+ /*hooks for WPUF pro */
35
+ //add_action( 'wp_ajax_nopriv_wpuf_submit_register', 'ct_wpuf_submit_register',1 );
36
+ //add_action( 'wp_ajax_wpuf_submit_register', 'ct_wpuf_submit_register',1 );
37
+ add_action( 'wp_ajax_nopriv_wpuf_submit_register', 'ct_ajax_hook',1 );
38
+ add_action( 'wp_ajax_wpuf_submit_register', 'ct_ajax_hook',1 );
39
+ $cleantalk_hooked_actions[]='submit_register';
40
+
41
+ /*hooks for MyMail */
42
+ //add_action( 'wp_ajax_nopriv_mymail_form_submit', 'ct_mymail_form_submit',1 );
43
+ //add_action( 'wp_ajax_mymail_form_submit', 'ct_mymail_form_submit',1 );
44
+ add_action( 'wp_ajax_nopriv_mymail_form_submit', 'ct_ajax_hook',1 );
45
+ add_action( 'wp_ajax_mymail_form_submit', 'ct_ajax_hook',1 );
46
+ $cleantalk_hooked_actions[]='form_submit';
47
+
48
+ /*hooks for MailPoet */
49
+ //add_action( 'wp_ajax_nopriv_wysija_ajax', 'ct_wysija_ajax',1 );
50
+ //add_action( 'wp_ajax_wysija_ajax', 'ct_wysija_ajax',1 );
51
+ add_action( 'wp_ajax_nopriv_wysija_ajax', 'ct_ajax_hook',1 );
52
+ add_action( 'wp_ajax_wysija_ajax', 'ct_ajax_hook',1 );
53
+ $cleantalk_hooked_actions[]='wysija_ajax';
54
+
55
+ /*hooks for cs_registration_validation */
56
+ //add_action( 'wp_ajax_nopriv_cs_registration_validation', 'ct_cs_registration_validation',1 );
57
+ //add_action( 'wp_ajax_cs_registration_validation', 'ct_cs_registration_validation',1 );
58
+ add_action( 'wp_ajax_nopriv_cs_registration_validation', 'ct_ajax_hook',1 );
59
+ add_action( 'wp_ajax_cs_registration_validation', 'ct_ajax_hook',1 );
60
+ $cleantalk_hooked_actions[]='cs_registration_validation';
61
+
62
+ /*hooks for send_message and request_appointment */
63
+ //add_action( 'wp_ajax_nopriv_send_message', 'ct_sm_ra',1 );
64
+ //add_action( 'wp_ajax_send_message', 'ct_sm_ra',1 );
65
+ //add_action( 'wp_ajax_nopriv_request_appointment', 'ct_sm_ra',1 );
66
+ //add_action( 'wp_ajax_request_appointment', 'ct_sm_ra',1 );
67
+ add_action( 'wp_ajax_nopriv_send_message', 'ct_ajax_hook',1 );
68
+ add_action( 'wp_ajax_send_message', 'ct_ajax_hook',1 );
69
+ add_action( 'wp_ajax_nopriv_request_appointment', 'ct_ajax_hook',1 );
70
+ add_action( 'wp_ajax_request_appointment', 'ct_ajax_hook',1 );
71
+ $cleantalk_hooked_actions[]='send_message';
72
+ $cleantalk_hooked_actions[]='request_appointment';
73
+
74
+ /*hooks for zn_do_login */
75
+ //add_action( 'wp_ajax_nopriv_zn_do_login', 'ct_zn_do_login',1 );
76
+ //add_action( 'wp_ajax_zn_do_login', 'ct_zn_do_login',1 );
77
+ add_action( 'wp_ajax_nopriv_zn_do_login', 'ct_ajax_hook',1 );
78
+ add_action( 'wp_ajax_zn_do_login', 'ct_ajax_hook',1 );
79
+ $cleantalk_hooked_actions[]='zn_do_login';
80
+
81
+ /*hooks for zn_do_login */
82
+ //add_action( 'wp_ajax_nopriv_cscf-submitform', 'ct_cscf_submitform',1 );
83
+ //add_action( 'wp_ajax_cscf-submitform', 'ct_cscf_submitform',1 );
84
+ if(isset($_POST['action']) && $_POST['action'] == 'cscf-submitform'){
85
+ add_filter('preprocess_comment', 'ct_ajax_hook', 1);
86
+ //add_action( 'wp_ajax_nopriv_cscf-submitform', 'ct_ajax_hook',1 );
87
+ //add_action( 'wp_ajax_cscf-submitform', 'ct_ajax_hook',1 );
88
+ $cleantalk_hooked_actions[]='cscf-submitform';
89
+ }
90
+
91
+
92
+ /*hooks for visual form builder */
93
+ //add_action( 'wp_ajax_nopriv_vfb_submit', 'ct_vfb_submit',1 );
94
+ //add_action( 'wp_ajax_vfb_submit', 'ct_vfb_submit',1 );
95
+ add_action( 'wp_ajax_nopriv_vfb_submit', 'ct_ajax_hook',1 );
96
+ add_action( 'wp_ajax_vfb_submit', 'ct_ajax_hook',1 );
97
+ $cleantalk_hooked_actions[]='vfb_submit';
98
+
99
+ /*hooks for woocommerce_checkout*/
100
+ add_action( 'wp_ajax_nopriv_woocommerce_checkout', 'ct_ajax_hook',1 );
101
+ add_action( 'wp_ajax_woocommerce_checkout', 'ct_ajax_hook',1 );
102
+ $cleantalk_hooked_actions[]='woocommerce_checkout';
103
+ $cleantalk_hooked_actions[]='wcfm_ajax_controller';
104
+
105
+ /*hooks for frm_action*/
106
+ add_action( 'wp_ajax_nopriv_frm_entries_create', 'ct_ajax_hook',1 );
107
+ add_action( 'wp_ajax_frm_entries_create', 'ct_ajax_hook',1 );
108
+ $cleantalk_hooked_actions[]='frm_entries_create';
109
+
110
+ add_action( 'wp_ajax_nopriv_td_mod_register', 'ct_ajax_hook',1 );
111
+ add_action( 'wp_ajax_td_mod_register', 'ct_ajax_hook',1 );
112
+ $cleantalk_hooked_actions[]='td_mod_register';
113
+
114
+ /*hooks for tevolution theme*/
115
+ add_action( 'wp_ajax_nopriv_tmpl_ajax_check_user_email', 'ct_ajax_hook',1 );
116
+ add_action( 'wp_ajax_tmpl_ajax_check_user_email', 'ct_ajax_hook',1 );
117
+ add_action( 'wp_ajax_nopriv_tevolution_submit_from_preview', 'ct_ajax_hook',1 );
118
+ add_action( 'wp_ajax_tevolution_submit_from_preview', 'ct_ajax_hook',1 );
119
+ add_action( 'wp_ajax_nopriv_submit_form_recaptcha_validation', 'ct_ajax_hook',1 );
120
+ add_action( 'wp_ajax_tmpl_submit_form_recaptcha_validation', 'ct_ajax_hook',1 );
121
+ $cleantalk_hooked_actions[]='tmpl_ajax_check_user_email';
122
+ $cleantalk_hooked_actions[]='tevolution_submit_from_preview';
123
+ $cleantalk_hooked_actions[]='submit_form_recaptcha_validation';
124
+
125
+ /* hooks for contact forms by web settler ajax*/
126
+ add_action( 'wp_ajax_nopriv_smuzform-storage', 'ct_ajax_hook',1 );
127
+ $cleantalk_hooked_actions[]='smuzform_form_submit';
128
+
129
+ /* hooks for reviewer plugin*/
130
+ add_action( 'wp_ajax_nopriv_rwp_ajax_action_rating', 'ct_ajax_hook',1 );
131
+ $cleantalk_hooked_actions[]='rwp-submit-wrap';
132
+
133
+ $cleantalk_hooked_actions[]='post_update';
134
+
135
+ /* Ninja Forms hoocked actions */
136
+ $cleantalk_hooked_actions[]='ninja_forms_ajax_submit';
137
+ $cleantalk_hooked_actions[]='nf_ajax_submit';
138
+ $cleantalk_hooked_actions[]='ninja_forms_process'; // Depricated ?
139
+
140
+ /* Follow-Up Emails */
141
+ $cleantalk_hooked_actions[] = 'fue_wc_set_cart_email'; // Don't check email via this plugin
142
+
143
+ /* Follow-Up Emails */
144
+ $cleantalk_hooked_actions[] = 'fue_wc_set_cart_email'; // Don't check email via this plugin
145
+
146
+ function ct_validate_email_ajaxlogin($email=null, $is_ajax=true){
147
+
148
+ $email = is_null( $email ) ? $email : $_POST['email'];
149
+ $email = sanitize_email($email);
150
+ $is_good = !filter_var($email, FILTER_VALIDATE_EMAIL) || email_exists($email) ? false : true;
151
+
152
+ if(class_exists('AjaxLogin')&&isset($_POST['action'])&&$_POST['action']=='validate_email'){
153
+
154
+ $checkjs = apbct_js_test('ct_checkjs', $_POST);
155
+ $sender_info['post_checkjs_passed'] = $checkjs;
156
+ if ($checkjs === null){
157
+ $checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
158
+ $sender_info['cookie_checkjs_passed'] = $checkjs;
159
+ }
160
+
161
+ //Making a call
162
+ $base_call_result = apbct_base_call(
163
+ array(
164
+ 'sender_email' => $email,
165
+ 'sender_nickname' => '',
166
+ 'sender_info' => $sender_info,
167
+ 'js_on' => $checkjs,
168
+ ),
169
+ true
170
+ );
171
+
172
+ $ct_result = $base_call_result['ct_result'];
173
+
174
+ if ($ct_result->allow===0){
175
+ $is_good=false;
176
+ }
177
+ }
178
+
179
+ if($is_good){
180
+ $ajaxresult=array(
181
+ 'description' => null,
182
+ 'cssClass' => 'noon',
183
+ 'code' => 'success'
184
+ );
185
+ }else{
186
+ $ajaxresult=array(
187
+ 'description' => 'Invalid Email',
188
+ 'cssClass' => 'error-container',
189
+ 'code' => 'error'
190
+ );
191
+ }
192
+
193
+ $ajaxresult = json_encode($ajaxresult);
194
+ print $ajaxresult;
195
+ wp_die();
196
+ }
197
+
198
+ function ct_user_register_ajaxlogin($user_id)
199
+ {
200
+ if(class_exists('AjaxLogin')&&isset($_POST['action'])&&$_POST['action']=='register_submit')
201
+ {
202
+
203
+ $checkjs = apbct_js_test('ct_checkjs', $_POST);
204
+ $sender_info['post_checkjs_passed'] = $checkjs;
205
+ if ($checkjs === null){
206
+ $checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
207
+ $sender_info['cookie_checkjs_passed'] = $checkjs;
208
+ }
209
+
210
+ //Making a call
211
+ $base_call_result = apbct_base_call(
212
+ array(
213
+ 'sender_email' => sanitize_email($_POST['email']),
214
+ 'sender_nickname' => sanitize_email($_POST['login']),
215
+ 'sender_info' => $sender_info,
216
+ 'js_on' => $checkjs,
217
+ ),
218
+ true
219
+ );
220
+
221
+ $ct_result = $base_call_result['ct_result'];
222
+
223
+ if ($ct_result->allow === 0)
224
+ {
225
+ wp_delete_user($user_id);
226
+ }
227
+ }
228
+ return $user_id;
229
+ }
230
+
231
+ /**
232
+ * Hook into MailChimp for WordPress `mc4wp_form_errors` filter.
233
+ *
234
+ * @param array $errors
235
+ * @return array
236
+ */
237
+ function ct_mc4wp_ajax_hook( array $errors )
238
+ {
239
+ $result = ct_ajax_hook();
240
+
241
+ // only return modified errors array when function returned a string value (the message key)
242
+ if( is_string( $result ) ) {
243
+ $errors[] = $result;
244
+ }
245
+
246
+ return $errors;
247
+ }
248
+
249
+ function ct_ajax_hook($message_obj = false, $additional = false)
250
+ {
251
+ global $apbct, $current_user;
252
+
253
+ $message_obj = (array)$message_obj;
254
+
255
+ // Get current_user and set it globaly
256
+ apbct_wp_set_current_user($current_user instanceof WP_User ? $current_user : apbct_wp_get_current_user() );
257
+
258
+ // Go out because of not spam data
259
+ $skip_post = array(
260
+ 'apbct_js_keys__get', // Our service code
261
+ 'gmaps_display_info_window', // Geo My WP pop-up windows.
262
+ 'gmw_ps_display_info_window', // Geo My WP pop-up windows.
263
+ 'the_champ_user_auth', // Super Socializer
264
+ 'simbatfa-init-otp', //Two-Factor Auth
265
+ 'wppb_msf_check_required_fields', //ProfileBuilder skip step checking
266
+ 'boss_we_login', //Login form
267
+ 'sidebar_login_process', // Login CF7
268
+ 'cp_update_style_settings', // Convert Pro. Saving settings
269
+ 'updraft_savesettings', // UpdraftPlus
270
+ 'wpdUpdateAutomatically', //Comments update
271
+ 'upload-attachment', // Skip ulpload attachments
272
+ 'iwj_update_profile', //Skip profile page checker
273
+ 'st_partner_create_service', //Skip add hotel via admin
274
+ 'vp_ajax_vpt_option_save', // https://themeforest.net/item/motor-vehicles-parts-equipments-accessories-wordpress-woocommerce-theme/16829946
275
+ 'mailster_send_test', //Mailster send test admin
276
+ 'acf/validate_save_post', //ACF validate post admin
277
+ 'admin:saveThemeOptions', //Ait-theme admin checking
278
+ 'save_tourmaster_option', //Tourmaster admin save
279
+ 'validate_register_email', // Service id #313320
280
+ 'elementor_pro_forms_send_form', //Elementor Pro
281
+ 'phone-orders-for-woocommerce', //Phone orders for woocommerce backend
282
+ 'ihc_check_reg_field_ajax', //Ajax check required fields
283
+ 'OSTC_lostPassword', //Lost password ajax form
284
+ 'check_retina_image_availability', //There are too many ajax requests from mobile
285
+ 'uap_check_reg_field_ajax', // Ultimate Affiliate Pro. Form validation.
286
+ 'edit-comment', // Edit comments by admin ??? that shouldn't happen
287
+ 'formcraft3_save_form_progress', // FormCraft – Contact Form Builder for WordPress. Save progress.
288
+ 'wpdmpp_save_settings', // PayPal save settings.
289
+ 'give_process_donation', // GiveWP will be checked by feedback_general_contact_form
290
+ 'iwj_login', // Fix for unknown plugin for user #133315
291
+ 'custom_user_login', // Fix for unknown plugin for user #466875
292
+ 'wordfence_ls_authenticate', //Fix for wordfence auth
293
+ 'frm_strp_amount', //Admin stripe form
294
+ 'wouCheckOnlineUsers', //Skip updraft admin checking users
295
+ );
296
+
297
+ // Skip test if
298
+ if( !$apbct->settings['general_contact_forms_test'] || // Test disabled
299
+ !apbct_is_user_enable($apbct->user) || // User is admin, editor, author
300
+ // (function_exists('get_current_user_id') && get_current_user_id() != 0) || // Check with default wp_* function if it's admin
301
+ (!$apbct->settings['protect_logged_in'] && ($apbct->user instanceof WP_User) && $apbct->user->ID !== 0 ) || // Logged in user
302
+ apbct_exclusions_check__url() || // url exclusions
303
+ (isset($_POST['action']) && in_array($_POST['action'], $skip_post)) || // Special params
304
+ (isset($_GET['action']) && in_array($_GET['action'], $skip_post)) || // Special params
305
+ isset($_POST['quform_submit']) || //QForms multi-paged form skip
306
+ // QAEngine Theme fix
307
+ ( strval(current_action()) != 'et_pre_insert_answer' &&
308
+ (
309
+ (isset($message_obj['author']) && intval($message_obj['author']) == 0) ||
310
+ (isset($message_obj['post_author']) && intval($message_obj['post_author']) == 0)
311
+ )
312
+ )
313
+ )
314
+ {
315
+ return false;
316
+ }
317
+
318
+ //General post_info for all ajax calls
319
+ $post_info = array('comment_type' => 'feedback_ajax');
320
+ $checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
321
+
322
+ if(isset($_POST['user_login']))
323
+ $sender_nickname = $_POST['user_login'];
324
+ else
325
+ $sender_nickname = '';
326
+
327
+ //QAEngine Theme answers
328
+ if( !empty($message_obj) && isset($message_obj['post_type'], $message_obj['post_content']) ){
329
+ $curr_user = get_user_by('id', $message_obj['author']);
330
+ if (!$curr_user)
331
+ $curr_user = get_user_by('id', $message_obj['post_author']);
332
+ $ct_post_temp['comment'] = $message_obj['post_content'];
333
+ $ct_post_temp['email'] = $curr_user->data->user_email;
334
+ $ct_post_temp['name'] = $curr_user->data->user_login;
335
+ }
336
+
337
+ //CSCF fix
338
+ if(isset($_POST['action']) && $_POST['action']== 'cscf-submitform'){
339
+ $ct_post_temp[] = $message_obj['comment_author'];
340
+ $ct_post_temp[] = $message_obj['comment_author_email'];
341
+ $ct_post_temp[] = $message_obj['comment_content'];
342
+ }
343
+
344
+ //??? fix
345
+ if(isset($_POST['action'], $_POST['target']) && ($_POST['action']=='request_appointment'||$_POST['action']=='send_message')){
346
+ $ct_post_temp=$_POST;
347
+ $ct_post_temp['target']=1;
348
+ }
349
+
350
+ //UserPro fix
351
+ if(isset($_POST['action'], $_POST['template']) && $_POST['action']=='userpro_process_form' && $_POST['template']=='register'){
352
+ $ct_post_temp = $_POST;
353
+ $ct_post_temp['shortcode'] = '';
354
+ }
355
+ //Reviewer fix
356
+ if(isset($_POST['action']) && $_POST['action'] == 'rwp_ajax_action_rating')
357
+ {
358
+ $ct_post_temp['name'] = $_POST['user_name'];
359
+ $ct_post_temp['email'] = $_POST['user_email'];
360
+ $ct_post_temp['comment'] = $_POST['comment'];
361
+ }
362
+ //Woocommerce checkout
363
+ if(isset($_POST['action']) && $_POST['action']=='woocommerce_checkout'){
364
+ $post_info['comment_type'] = 'order';
365
+ }
366
+ //Easy Forms for Mailchimp
367
+ if( isset($_POST['action']) && $_POST['action']=='process_form_submission' ){
368
+ $post_info['comment_type'] = 'contact_enquire_wordpress_easy_forms_for_mailchimp';
369
+ if( isset($_POST['form_data']) ) {
370
+ $form_data = explode( '&', $_POST['form_data'] );
371
+ $form_data_arr = array();
372
+ foreach ( $form_data as $val ) {
373
+ $form_data_element = explode( '=', $val );
374
+ $form_data_arr[$form_data_element[0]] = @$form_data_element[1];
375
+ }
376
+ if( isset( $form_data_arr['EMAIL'] ) ) {
377
+ $ct_post_temp['email'] = $form_data_arr['EMAIL'];
378
+ }
379
+ }
380
+ }
381
+
382
+ $ct_temp_msg_data = isset($ct_post_temp)
383
+ ? ct_get_fields_any($ct_post_temp)
384
+ : ct_get_fields_any($_POST);
385
+
386
+ $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
387
+ $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
388
+ $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
389
+ $contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
390
+ $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
391
+ if($subject != '') {
392
+ $message['subject'] = $subject;
393
+ }
394
+
395
+ // Skip submission if no data found
396
+ if ($sender_email === ''|| !$contact_form)
397
+ return false;
398
+
399
+ // Mailpoet fix
400
+ if (isset($message['wysijaData'], $message['wysijaplugin'], $message['task'], $message['controller']) && $message['wysijaplugin'] == 'wysija-newsletters' && $message['controller'] == 'campaigns')
401
+ return false;
402
+ // Mailpoet3 admin skip fix
403
+ if (isset($_POST['action'], $_POST['method']) && $_POST['action'] == 'mailpoet' && $_POST['method'] =='save')
404
+ return false;
405
+
406
+ // WP Foto Vote Fix
407
+ if (!empty($_FILES)){
408
+ foreach($message as $key => $value){
409
+ if(strpos($key, 'oje') !== false)
410
+ return;
411
+ } unset($key ,$value);
412
+ }
413
+
414
+ /**
415
+ * @todo Contact form detect
416
+ */
417
+ // Detect contact form an set it's name to $contact_form to use later
418
+ $contact_form = null;
419
+ foreach($_POST as $param => $value){
420
+ if(strpos($param, 'et_pb_contactform_submit') === 0){
421
+ $contact_form = 'contact_form_divi_theme';
422
+ $contact_form_additional = str_replace($param, '', $param);
423
+ }
424
+ if(strpos($param, 'avia_generated_form') === 0){
425
+ $contact_form = 'contact_form_enfold_theme';
426
+ $contact_form_additional = str_replace('avia_generated_form', '', $param);
427
+ }
428
+ if(!empty($contact_form))
429
+ break;
430
+ }
431
+
432
+ $base_call_result = apbct_base_call(
433
+ array(
434
+ 'message' => $message,
435
+ 'sender_email' => $sender_email,
436
+ 'sender_nickname' => $sender_nickname,
437
+ 'sender_info' => array('post_checkjs_passed' => $checkjs),
438
+ 'post_info' => $post_info,
439
+ 'js_on' => $checkjs,
440
+ )
441
+ );
442
+ $ct_result = $base_call_result['ct_result'];
443
+
444
+ if ($ct_result->allow == 0)
445
+ {
446
+ if(isset($_POST['action']) && $_POST['action']=='wpuf_submit_register'){
447
+ $result=Array('success'=>false,'error'=>$ct_result->comment);
448
+ @header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
449
+ print json_encode($result);
450
+ die();
451
+ }
452
+ else if(isset($_POST['action']) && $_POST['action']=='mymail_form_submit')
453
+ {
454
+ $result=Array('success'=>false,'html'=>$ct_result->comment);
455
+ @header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
456
+ print json_encode($result);
457
+ die();
458
+ }
459
+ else if(isset($_POST['action'], $_POST['task']) && $_POST['action'] == 'wysija_ajax' && $_POST['task'] != 'send_preview' && $_POST['task'] != 'send_test_mail')
460
+ {
461
+ $result=Array('result'=>false,'msgs'=>Array('updated'=>Array($ct_result->comment)));
462
+ //@header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
463
+ print $_GET['callback'].'('.json_encode($result).');';
464
+ die();
465
+ }
466
+ else if(isset($_POST['action']) && $_POST['action']=='cs_registration_validation')
467
+ {
468
+ $result=Array("type"=>"error","message"=>$ct_result->comment);
469
+ print json_encode($result);
470
+ die();
471
+ }
472
+ else if(isset($_POST['action']) && ($_POST['action']=='request_appointment' || $_POST['action']=='send_message'))
473
+ {
474
+ print $ct_result->comment;
475
+ die();
476
+ }
477
+ else if(isset($_POST['action']) && $_POST['action']=='zn_do_login')
478
+ {
479
+ print '<div id="login_error">'.$ct_result->comment.'</div>';
480
+ die();
481
+ }
482
+ else if(isset($_POST['action']) && $_POST['action']=='vfb_submit')
483
+ {
484
+ $result=Array('result'=>false,'message'=>$ct_result->comment);
485
+ @header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
486
+ print json_encode($result);
487
+ die();
488
+ }
489
+ else if(isset($_POST['action']) && $_POST['action']=='woocommerce_checkout')
490
+ {
491
+ print $ct_result->comment;
492
+ die();
493
+ }
494
+ else if(isset($_POST['action']) && $_POST['action']=='frm_entries_create')
495
+ {
496
+ $result=Array('112'=>$ct_result->comment);
497
+ print json_encode($result);
498
+ die();
499
+ }
500
+ else if(isset($_POST['cma-action']) && $_POST['cma-action']=='add')
501
+ {
502
+ $result=Array('success'=>0, 'thread_id'=>null,'messages'=>Array($ct_result->comment));
503
+ print json_encode($result);
504
+ die();
505
+ }
506
+ else if(isset($_POST['action']) && $_POST['action']=='td_mod_register')
507
+ {
508
+ print json_encode(array('register', 0, $ct_result->comment));
509
+ die();
510
+ }
511
+ else if(isset($_POST['action']) && $_POST['action']=='tmpl_ajax_check_user_email')
512
+ {
513
+ print "17,email";
514
+ die();
515
+ }
516
+ else if(isset($_POST['action']) && ($_POST['action']=='tevolution_submit_from_preview' || $_POST['action']=='submit_form_recaptcha_validation'))
517
+ {
518
+ print $ct_result->comment;
519
+ die();
520
+ }
521
+ // WooWaitList
522
+ // http://codecanyon.net/item/woowaitlist-woocommerce-back-in-stock-notifier/7103373
523
+ else if(isset($_POST['action']) && $_POST['action']=='wew_save_to_db_callback')
524
+ {
525
+ $result = array();
526
+ $result['error'] = 1;
527
+ $result['message'] = $ct_result->comment;
528
+ $result['code'] = 5; // Unused code number in WooWaitlist
529
+ print json_encode($result);
530
+ die();
531
+ }
532
+ // UserPro
533
+ else if(isset($_POST['action'], $_POST['template']) && $_POST['action']=='userpro_process_form' && $_POST['template']=='register')
534
+ {
535
+ foreach($_POST as $key => $value){
536
+ $output[$key]=$value;
537
+ }unset($key, $value);
538
+ $output['template'] = $ct_result->comment;
539
+ $output=json_encode($output);
540
+ print_r($output);
541
+ die;
542
+ }
543
+ // Quick event manager
544
+ else if(isset($_POST['action']) && $_POST['action']=='qem_validate_form'){
545
+ $errors[] = 'registration_forbidden';
546
+ $result = Array(
547
+ 'success' => 'false',
548
+ 'errors' => $errors,
549
+ 'title' => $ct_result->comment
550
+ );
551
+ print json_encode($result);
552
+ die();
553
+ }
554
+ // Quick Contact Form
555
+ elseif(isset($_POST['action']) && $_POST['action'] == 'qcf_validate_form')
556
+ {
557
+ $result = Array(
558
+ 'blurb' => "<h1>".$ct_result->comment."</h1>",
559
+ 'display' => "Oops, got a few problems here",
560
+ 'errors' => array(
561
+ 0 => array(
562
+ error => 'error',
563
+ name => 'name'
564
+ ),
565
+ ),
566
+ 'success' => 'false',
567
+ );
568
+ print json_encode($result);
569
+ die();
570
+ }
571
+ // Usernoise Contact Form
572
+ elseif(isset($_POST['title'], $_POST['email'], $_POST['type'], $_POST['ct_checkjs']))
573
+ {
574
+ return array($ct_result->comment);
575
+ die();
576
+ }
577
+ // amoForms
578
+ elseif(isset($_POST['action']) && $_POST['action'] == 'amoforms_submit')
579
+ {
580
+ $result = Array(
581
+ 'result' => true,
582
+ 'type' => "html",
583
+ 'value' => "<h1 style='font-size: 25px; color: red;'>".$ct_result->comment."</h1>",
584
+ 'fast' => false
585
+ );
586
+ print json_encode($result);
587
+ die();
588
+ }
589
+ // MailChimp for Wordpress Premium
590
+ elseif(!empty($_POST['_mc4wp_form_id']))
591
+ {
592
+ return 'ct_mc4wp_response';
593
+ }
594
+ // QAEngine Theme answers
595
+ elseif ( !empty($message_obj) && isset($message_obj['post_type'], $message_obj['post_content']) ){
596
+ throw new Exception($ct_result->comment);
597
+ }
598
+ //ES Add subscriber
599
+ elseif(isset($_POST['action']) && $_POST['action'] == 'es_add_subscriber')
600
+ {
601
+ $result = Array(
602
+ 'error' => 'unexpected-error',
603
+ );
604
+ print json_encode($result);
605
+ die();
606
+ }
607
+ //Convertplug. Strpos because action value dynamically changes and depends on mailing service
608
+ elseif (isset($_POST['action']) && strpos($_POST['action'], '_add_subscriber') !== false){
609
+ $result = Array(
610
+ 'action' => "message",
611
+ 'detailed_msg' => "",
612
+ 'email_status' => false,
613
+ 'message' => "<h1 style='font-size: 25px; color: red;'>".$ct_result->comment."</h1>",
614
+ 'status' => "error",
615
+ 'url' => "none"
616
+ );
617
+ print json_encode($result);
618
+ die();
619
+ }
620
+ // Ultimate Form Builder
621
+ elseif (isset($_POST['action']) && $_POST['action'] == 'ufbl_front_form_action'){
622
+ $result = Array(
623
+ 'error_keys' => array(),
624
+ 'error_flag' => 1,
625
+ 'response_message' => $ct_result->comment
626
+ );
627
+ print json_encode($result);
628
+ die();
629
+ }
630
+ // Smart Forms
631
+ elseif (isset($_POST['action']) && $_POST['action'] == 'rednao_smart_forms_save_form_values'){
632
+ $result = Array(
633
+ 'message' => $ct_result->comment,
634
+ 'refreshCaptcha' => 'n',
635
+ 'success' => 'n'
636
+ );
637
+ print json_encode($result);
638
+ die();
639
+ }
640
+ //cFormsII
641
+ elseif(isset($_POST['action']) && $_POST['action'] == 'submitcform')
642
+ {
643
+ header('Content-Type: application/json');
644
+ $result = Array(
645
+ 'no' => isset($_POST['cforms_id']) ? $_POST['cforms_id'] : '',
646
+ 'result' => 'failure',
647
+ 'html' =>$ct_result->comment,
648
+ 'hide' => false,
649
+ 'redirection' => null
650
+ );
651
+ print json_encode($result);
652
+ die();
653
+ }
654
+ //Contact Form by Web-Settler
655
+ elseif(isset($_POST['smFieldData']))
656
+ {
657
+ $result = Array(
658
+ 'signal' => true,
659
+ 'code' => 0,
660
+ 'thanksMsg' => $ct_result->comment,
661
+ 'errors' => array(),
662
+ 'isMsg' => true,
663
+ 'redirectUrl' => null
664
+ );
665
+ print json_encode($result);
666
+ die();
667
+ }
668
+ //Reviewer
669
+ elseif(isset($_POST['action']) && $_POST['action'] == 'rwp_ajax_action_rating')
670
+ {
671
+ $result = Array(
672
+ 'success' => false,
673
+ 'data' => array(0=>$ct_result->comment)
674
+ );
675
+ print json_encode($result);
676
+ die();
677
+ }
678
+ // CouponXXL Theme
679
+ elseif(isset($_POST['_wp_http_referer'], $_POST['register_field'], $_POST['action']) && strpos($_POST['_wp_http_referer'],'/register/account') !== false && $_POST['action'] == 'register'){
680
+ $result = array(
681
+ 'message' => '<div class="alert alert-error">'.$ct_result->comment.'</div>',
682
+ );
683
+ die(json_encode($result));
684
+ }
685
+ //ConvertPro
686
+ elseif(isset($_POST['action']) && $_POST['action'] == 'cp_v2_notify_admin' || $_POST['action'] == 'cpro_notify_via_email')
687
+ {
688
+ $result = Array(
689
+ 'success' => false,
690
+ 'data' => array('error'=>$ct_result->comment,'style_slug'=>'convertprot-form'),
691
+ );
692
+ print json_encode($result);
693
+ die();
694
+ }
695
+ //Easy Forms for Mailchimp
696
+ elseif( isset($_POST['action']) && $_POST['action']=='process_form_submission' ) {
697
+ wp_send_json_error(
698
+ array(
699
+ 'error' => 1,
700
+ 'response' => $ct_result->comment
701
+ )
702
+ );
703
+ }
704
+ //Optin wheel
705
+ elseif( isset($_POST['action']) && ($_POST['action'] == 'wof-lite-email-optin' || $_POST['action'] == 'wof-email-optin')) {
706
+ wp_send_json_error(__($ct_result->comment, 'wp-optin-wheel'));
707
+ }
708
+ // Forminator
709
+ elseif( isset($_POST['action']) && strpos($_POST['action'], 'forminator_submit') !== false ){
710
+ wp_send_json_error(
711
+ array(
712
+ 'message' => $ct_result->comment,
713
+ 'success' => false,
714
+ 'errors' => array(),
715
+ 'behav' => 'behaviour-thankyou',
716
+ )
717
+ );
718
+ }
719
+ else
720
+ {
721
+ die(json_encode(array('apbct' => array('blocked' => true, 'comment' => $ct_result->comment,))));
722
+ }
723
+ }
724
+ //Allow == 1
725
+ else{
726
+ //QAEngine Theme answers
727
+ if ( !empty($message_obj) && isset($message_obj['post_type'], $message_obj['post_content']) ){
728
+ return $message_obj;
729
+ }
730
+ }
731
+ }
inc/cleantalk-autoloader.php CHANGED
@@ -1,21 +1,21 @@
1
- <?php
2
-
3
- /**
4
- * Autoloader for \Cleantalk\* classes
5
- *
6
- * @param string $class
7
- *
8
- * @return void
9
- */
10
- function apbct_autoloader( $class ){
11
- // Register class auto loader
12
- // Custom modules
13
- if( strpos( $class, 'Cleantalk' ) !== false && ! class_exists( '\\' . $class )) {
14
- $class_file = CLEANTALK_PLUGIN_DIR . 'lib' . DIRECTORY_SEPARATOR . $class . '.php';
15
- if( file_exists( $class_file ) ){
16
- require_once( $class_file );
17
- }
18
- }
19
- }
20
-
21
- spl_autoload_register( 'apbct_autoloader' );
1
+ <?php
2
+
3
+ /**
4
+ * Autoloader for \Cleantalk\* classes
5
+ *
6
+ * @param string $class
7
+ *
8
+ * @return void
9
+ */
10
+ function apbct_autoloader( $class ){
11
+ // Register class auto loader
12
+ // Custom modules
13
+ if( strpos( $class, 'Cleantalk' ) !== false && ! class_exists( '\\' . $class )) {
14
+ $class_file = CLEANTALK_PLUGIN_DIR . 'lib' . DIRECTORY_SEPARATOR . $class . '.php';
15
+ if( file_exists( $class_file ) ){
16
+ require_once( $class_file );
17
+ }
18
+ }
19
+ }
20
+
21
+ spl_autoload_register( 'apbct_autoloader' );
inc/cleantalk-common.php CHANGED
@@ -1,992 +1,991 @@
1
- <?php
2
-
3
- function apbct_array( $array ){
4
- return new Cleantalk\Arr( $array );
5
- }
6
-
7
- $ct_checkjs_frm = 'ct_checkjs_frm';
8
- $ct_checkjs_register_form = 'ct_checkjs_register_form';
9
-
10
- $apbct_cookie_request_id_label = 'request_id';
11
- $apbct_cookie_register_ok_label = 'register_ok';
12
-
13
- $ct_checkjs_cf7 = 'ct_checkjs_cf7';
14
- $ct_cf7_comment = '';
15
-
16
- $ct_checkjs_jpcf = 'ct_checkjs_jpcf';
17
- $ct_jpcf_patched = false;
18
- $ct_jpcf_fields = array('name', 'email');
19
-
20
- // Comment already proccessed
21
- $ct_comment_done = false;
22
-
23
- // Comment already proccessed
24
- $ct_signup_done = false;
25
-
26
- //Contains registration error
27
- $ct_registration_error_comment = false;
28
-
29
- // Default value for JS test
30
- $ct_checkjs_def = 0;
31
-
32
- // COOKIE label to store request id for last approved
33
- $ct_approved_request_id_label = 'ct_approved_request_id';
34
-
35
- // Last request id approved for publication
36
- $ct_approved_request_id = null;
37
-
38
- // Trial notice show time in minutes
39
- $trial_notice_showtime = 10;
40
-
41
- // Renew notice show time in minutes
42
- $renew_notice_showtime = 10;
43
-
44
- // COOKIE label for WP Landing Page proccessing result
45
- $ct_wplp_result_label = 'ct_wplp_result';
46
-
47
- // Flag indicates active JetPack comments
48
- $ct_jp_comments = false;
49
-
50
- // WP admin email notice interval in seconds
51
- $ct_admin_notoice_period = 21600;
52
-
53
- // Sevice negative comment to visitor.
54
- // It uses for BuddyPress registrations to avoid double checks
55
- $ct_negative_comment = null;
56
-
57
- // Set globals to NULL to avoid massive DB requests. Globals will be set when needed only and by accessors only.
58
- $ct_server = NULL;
59
- $admin_email = NULL;
60
-
61
- /**
62
- * Public action 'plugins_loaded' - Loads locale, see http://codex.wordpress.org/Function_Reference/load_plugin_textdomain
63
- */
64
- function apbct_plugin_loaded() {
65
- $dir=plugin_basename( dirname( __FILE__ ) ) . '/../i18n';
66
- $loaded=load_plugin_textdomain('cleantalk', false, $dir);
67
- }
68
-
69
- /**
70
- * Inner function - Request's wrapper for anything
71
- * @param array Array of parameters:
72
- * 'message' - string
73
- * 'example' - string
74
- * 'checkjs' - int
75
- * 'sender_email' - string
76
- * 'sender_nickname' - string
77
- * 'sender_info' - array
78
- * 'post_info' - string
79
- * @return array array('ct'=> Cleantalk, 'ct_result' => CleantalkResponse)
80
- */
81
- function apbct_base_call($params = array(), $reg_flag = false){
82
-
83
- global $apbct, $cleantalk_executed;
84
-
85
- $cleantalk_executed = true;
86
-
87
- $sender_info = !empty($params['sender_info'])
88
- ? CleantalkHelper::array_merge__save_numeric_keys__recursive(apbct_get_sender_info(), (array)$params['sender_info'])
89
- : apbct_get_sender_info();
90
-
91
- // Fileds exclusions
92
- if( ! empty( $params['message'] ) && is_array( $params['message'] ) ){
93
-
94
- $params['message'] = apbct_array( $params['message'] )
95
- ->get_keys( $apbct->settings['exclusions__fields'], $apbct->settings['exclusions__fields__use_regexp'] )
96
- ->delete();
97
- }
98
-
99
- $default_params = array(
100
-
101
- // IPs
102
- 'sender_ip' => defined('CT_TEST_IP') ? CT_TEST_IP : (isset($params['sender_ip']) ? $params['sender_ip'] : CleantalkHelper::ip__get(array('real'), false)),
103
- 'x_forwarded_for' => CleantalkHelper::ip__get(array('x_forwarded_for'), false),
104
- 'x_real_ip' => CleantalkHelper::ip__get(array('x_real_ip'), false),
105
-
106
- // Misc
107
- 'auth_key' => $apbct->api_key,
108
- 'js_on' => apbct_js_test('ct_checkjs', $_COOKIE) ? 1 : apbct_js_test('ct_checkjs', $_POST),
109
-
110
- 'agent' => APBCT_AGENT,
111
- 'sender_info' => $sender_info,
112
- 'submit_time' => apbct_get_submit_time(),
113
- );
114
-
115
- // Send $_SERVER if couldn't find IP
116
- if(empty($default_params['sender_ip']))
117
- $default_params['sender_info']['server_info'] = $_SERVER;
118
-
119
- $ct_request = new CleantalkRequest(
120
- CleantalkHelper::array_merge__save_numeric_keys__recursive($default_params, $params)
121
- );
122
-
123
- $ct = new Cleantalk();
124
-
125
- $ct->use_bultin_api = $apbct->settings['use_buitin_http_api'] ? true : false;
126
- $ct->ssl_on = $apbct->settings['ssl_on'];
127
- $ct->ssl_path = APBCT_CASERT_PATH;
128
-
129
- // Options store url without shceme because of DB error with ''://'
130
- $config = ct_get_server();
131
- $ct->server_url = APBCT_MODERATE_URL;
132
- $ct->work_url = preg_match('/http:\/\/.+/', $config['ct_work_url']) ? $config['ct_work_url'] : null;
133
- $ct->server_ttl = $config['ct_server_ttl'];
134
- $ct->server_changed = $config['ct_server_changed'];
135
-
136
- $start = microtime(true);
137
- $ct_result = $reg_flag
138
- ? @$ct->isAllowUser($ct_request)
139
- : @$ct->isAllowMessage($ct_request);
140
- $exec_time = microtime(true) - $start;
141
-
142
- // Statistics
143
- // Average request time
144
- apbct_statistics__rotate($exec_time);
145
- // Last request
146
- $apbct->stats['last_request']['time'] = time();
147
- $apbct->stats['last_request']['server'] = $ct->work_url;
148
- $apbct->save('stats');
149
-
150
- // Connection reports
151
- if ($ct_result->errno === 0 && empty($ct_result->errstr))
152
- $apbct->data['connection_reports']['success']++;
153
- else
154
- {
155
- $apbct->data['connection_reports']['negative']++;
156
- $apbct->data['connection_reports']['negative_report'][] = array(
157
- 'date' => date("Y-m-d H:i:s"),
158
- 'page_url' => apbct_get_server_variable( 'REQUEST_URI' ),
159
- 'lib_report' => $ct_result->errstr,
160
- 'work_url' => $ct->work_url,
161
- );
162
-
163
- if(count($apbct->data['connection_reports']['negative_report']) > 20)
164
- $apbct->data['connection_reports']['negative_report'] = array_slice($apbct->data['connection_reports']['negative_report'], -20, 20);
165
-
166
- }
167
-
168
- if ($ct->server_change) {
169
- update_option(
170
- 'cleantalk_server',
171
- array(
172
- 'ct_work_url' => $ct->work_url,
173
- 'ct_server_ttl' => $ct->server_ttl,
174
- 'ct_server_changed' => time(),
175
- )
176
- );
177
- }
178
-
179
- $ct_result = ct_change_plugin_resonse($ct_result, $ct_request->js_on);
180
-
181
- // Restart submit form counter for failed requests
182
- if ($ct_result->allow == 0){
183
- apbct_cookie(); // Setting page timer and cookies
184
- ct_add_event('no');
185
- }else{
186
- ct_add_event('yes');
187
- }
188
-
189
- // Set cookies if it's not.
190
- if(empty($apbct->flags__cookies_setuped))
191
- apbct_cookie();
192
-
193
- return array('ct' => $ct, 'ct_result' => $ct_result);
194
-
195
- }
196
-
197
- function apbct_exclusions_check($func = null){
198
-
199
- global $apbct, $cleantalk_executed;
200
-
201
- // Common exclusions
202
- if(
203
- apbct_exclusions_check__ip() ||
204
- apbct_exclusions_check__url() ||
205
- apbct_is_user_role_in( $apbct->settings['exclusions__roles'] ) ||
206
- $cleantalk_executed
207
- )
208
- return true;
209
-
210
- // Personal exclusions
211
- switch ($func){
212
- case 'ct_contact_form_validate_postdata':
213
- if(
214
- (defined( 'DOING_AJAX' ) && DOING_AJAX) ||
215
- apbct_array( $_POST )->get_keys( 'members_search_submit' )->result()
216
- )
217
- return true;
218
- break;
219
- case 'ct_contact_form_validate':
220
- if(
221
- apbct_array( $_POST )->get_keys( 'members_search_submit' )->result()
222
- )
223
- return true;
224
- break;
225
- default:
226
- return false;
227
- break;
228
- }
229
-
230
- return false;
231
- }
232
-
233
- /**
234
- * Checks if reuqest URI is in exclusion list
235
- *
236
- * @return bool
237
- */
238
- function apbct_exclusions_check__url() {
239
-
240
- global $apbct;
241
-
242
- if ( ! empty( $apbct->settings['exclusions__urls'] ) ) {
243
-
244
- $exclusions = explode( ',', $apbct->settings['exclusions__urls'] );
245
-
246
- // Fix for AJAX forms
247
- $haystack = apbct_get_server_variable( 'REQUEST_URI' ) == '/wp-admin/admin-ajax.php' && ! apbct_get_server_variable( 'HTTP_REFERER' )
248
- ? apbct_get_server_variable( 'HTTP_REFERER' )
249
- : apbct_get_server_variable( 'REQUEST_URI' );
250
-
251
- foreach ( $exclusions as $exclusion ) {
252
- if (
253
- ($apbct->settings['exclusions__urls__use_regexp'] && preg_match( '/' . $exclusion . '/', $haystack ) === 1) ||
254
- stripos( $haystack, $exclusion ) !== false
255
- ){
256
- return true;
257
- }
258
- }
259
- return false;
260
- }
261
- }
262
- /**
263
- * @deprecated 5.128 Using IP white-lists instead
264
- * @deprecated since 18.09.2019
265
- * Checks if sender_ip is in exclusion list
266
- *
267
- * @return bool
268
- */
269
- function apbct_exclusions_check__ip(){
270
-
271
- global $cleantalk_ip_exclusions;
272
-
273
- if( apbct_get_server_variable( 'REMOTE_ADDR' ) ){
274
-
275
- if( CleantalkHelper::ip__is_cleantalks( apbct_get_server_variable( 'REMOTE_ADDR' ) ) ){
276
- return true;
277
- }
278
-
279
- if( ! empty( $cleantalk_ip_exclusions ) && is_array( $cleantalk_ip_exclusions ) ){
280
- foreach ( $cleantalk_ip_exclusions as $exclusion ){
281
- if( stripos( apbct_get_server_variable( 'REMOTE_ADDR' ), $exclusion ) !== false ){
282
- return true;
283
- }
284
- }
285
- }
286
- }
287
-
288
- return false;
289
- }
290
-
291
- /**
292
- * Inner function - Default data array for senders
293
- * @return array
294
- */
295
- function apbct_get_sender_info() {
296
-
297
- global $apbct;
298
-
299
- // Validate cookie from the backend
300
- $cookie_is_ok = apbct_cookies_test();
301
-
302
- $referer_previous = $apbct->settings['set_cookies__sessions']
303
- ? apbct_alt_session__get('apbct_prev_referer')
304
- : filter_input(INPUT_COOKIE, 'apbct_prev_referer');
305
-
306
- $site_landing_ts = $apbct->settings['set_cookies__sessions']
307
- ? apbct_alt_session__get('apbct_site_landing_ts')
308
- : filter_input(INPUT_COOKIE, 'apbct_site_landing_ts');
309
-
310
- $page_hits = $apbct->settings['set_cookies__sessions']
311
- ? apbct_alt_session__get('apbct_page_hits')
312
- : filter_input(INPUT_COOKIE, 'apbct_page_hits');
313
-
314
- if (count($_POST) > 0) {
315
- foreach ($_POST as $k => $v) {
316
- if (preg_match("/^(ct_check|checkjs).+/", $k)) {
317
- $checkjs_data_post = $v;
318
- }
319
- }
320
- }
321
-
322
- // AMP check
323
- $amp_detected = apbct_get_server_variable( 'HTTP_REFERER' )
324
- ? strpos(apbct_get_server_variable( 'HTTP_REFERER' ), '/amp/') !== false || strpos(apbct_get_server_variable( 'HTTP_REFERER' ), '?amp=1') !== false || strpos(apbct_get_server_variable( 'HTTP_REFERER' ), '&amp=1') !== false
325
- ? 1
326
- : 0
327
- : null;
328
-
329
- $site_referer = $apbct->settings['store_urls__sessions']
330
- ? apbct_alt_session__get('apbct_site_referer')
331
- : filter_input(INPUT_COOKIE, 'apbct_site_referer');
332
-
333
- $urls = $apbct->settings['store_urls__sessions']
334
- ? (array)apbct_alt_session__get('apbct_urls')
335
- : (array)json_decode(filter_input(INPUT_COOKIE, 'apbct_urls'), true);
336
-
337
- return array(
338
- 'remote_addr' => CleantalkHelper::ip__get(array('remote_addr'), false),
339
- 'REFFERRER' => apbct_get_server_variable( 'HTTP_REFERER' ),
340
- 'USER_AGENT' => apbct_get_server_variable( 'HTTP_USER_AGENT' ),
341
- 'page_url' => apbct_get_server_variable( 'SERVER_NAME' ) . apbct_get_server_variable( 'REQUEST_URI' ),
342
- 'cms_lang' => substr(get_locale(), 0, 2),
343
- 'ct_options' => json_encode($apbct->settings),
344
- 'fields_number' => sizeof($_POST),
345
- 'direct_post' => $cookie_is_ok === null && apbct_is_post() ? 1 : 0,
346
- // Raw data to validated JavaScript test in the cloud
347
- 'checkjs_data_cookies' => !empty($_COOKIE['ct_checkjs']) ? $_COOKIE['ct_checkjs'] : null,
348
- 'checkjs_data_post' => !empty($checkjs_data_post) ? $checkjs_data_post : null,
349
- // PHP cookies
350
- 'cookies_enabled' => $cookie_is_ok,
351
- 'REFFERRER_PREVIOUS' => !empty($referer_previous) && $cookie_is_ok ? $referer_previous : null,
352
- 'site_landing_ts' => !empty($site_landing_ts) && $cookie_is_ok ? $site_landing_ts : null,
353
- 'page_hits' => !empty($page_hits) ? $page_hits : null,
354
- // JS cookies
355
- 'js_info' => !empty($_COOKIE['ct_user_info']) ? json_decode(stripslashes($_COOKIE['ct_user_info']), true) : null,
356
- 'mouse_cursor_positions' => !empty($_COOKIE['ct_pointer_data']) ? json_decode(stripslashes($_COOKIE['ct_pointer_data']), true) : null,
357
- 'js_timezone' => !empty($_COOKIE['ct_timezone']) ? $_COOKIE['ct_timezone'] : null,
358
- 'key_press_timestamp' => !empty($_COOKIE['ct_fkp_timestamp']) ? $_COOKIE['ct_fkp_timestamp'] : null,
359
- 'page_set_timestamp' => !empty($_COOKIE['ct_ps_timestamp']) ? $_COOKIE['ct_ps_timestamp'] : null,
360
- 'form_visible_inputs' => !empty($_COOKIE['apbct_visible_fields_count']) ? $_COOKIE['apbct_visible_fields_count'] : null,
361
- 'apbct_visible_fields' => !empty($_COOKIE['apbct_visible_fields']) ? apbct_visibile_fields__process($_COOKIE['apbct_visible_fields']) : null,
362
- // Misc
363
- 'site_referer' => !empty($site_referer) ? $site_referer : null,
364
- 'source_url' => !empty($urls) ? json_encode($urls) : null,
365
- // Debug stuff
366
- 'amp_detected' => $amp_detected,
367
- 'hook' => current_action(),
368
- 'headers_sent' => !empty($apbct->headers_sent) ? $apbct->headers_sent : false,
369
- 'headers_sent__hook' => !empty($apbct->headers_sent__hook) ? $apbct->headers_sent__hook : false,
370
- 'headers_sent__where' => !empty($apbct->headers_sent__where) ? $apbct->headers_sent__where : false,
371
- 'request_type' => apbct_get_server_variable('REQUEST_METHOD') ? apbct_get_server_variable('REQUEST_METHOD') : 'UNKNOWN',
372
- 'abpct_hyro_acc_collect' => !empty($_COOKIE['abpct_hyro_acc_collect']) ? json_decode(stripslashes($_COOKIE['abpct_hyro_acc_collect']), true): null,
373
- );
374
- }
375
-
376
- /**
377
- * Process visible fields for specific form to match the fields from request
378
- *
379
- * @param string $visible_fields
380
- *
381
- * @return string
382
- */
383
- function apbct_visibile_fields__process($visible_fields) {
384
- if(strpos($visible_fields, 'wpforms') !== false){
385
- $visible_fields = preg_replace(
386
- array('/\[/', '/\]/'),
387
- '',
388
- str_replace(
389
- '][',
390
- '_',
391
- str_replace(
392
- 'wpforms[fields]',
393
- '',
394
- $visible_fields
395
- )
396
- )
397
- );
398
- }
399
-
400
- return $visible_fields;
401
- }
402
-
403
- /*
404
- * Outputs JS key for AJAX-use only. Stops script.
405
- */
406
- function apbct_js_keys__get__ajax($direct_call = false){
407
- if(!$direct_call){
408
- if(isset($_POST['_ajax_nonce'])){
409
- if(!wp_verify_nonce($_POST['_ajax_nonce'], 'ct_secret_stuff')){
410
- wp_doing_ajax()
411
- ? wp_die( -1, 403 )
412
- : die( '-1' );
413
- }
414
- }else{
415
- wp_doing_ajax()
416
- ? wp_die( -1, 403 )
417
- : die( '-1' );
418
- }
419
- }
420
- die(json_encode(array(
421
- 'js_key' => ct_get_checkjs_value()
422
- )));
423
- }
424
-
425
- /**
426
- * Get ct_get_checkjs_value
427
- *
428
- * @param bool $random_key
429
- *
430
- * @return int|string|null
431
- */
432
- function ct_get_checkjs_value(){
433
-
434
- global $apbct;
435
-
436
- // Use static JS keys
437
- if($apbct->settings['use_static_js_key'] == 1){
438
-
439
- $key = hash('sha256', $apbct->api_key.ct_get_admin_email().$apbct->salt);
440
-
441
- // Auto detecting. Detected.
442
- }elseif(
443
- $apbct->settings['use_static_js_key'] == - 1 &&
444
- ( apbct_is_cache_plugins_exists() ||
445
- ( apbct_is_post() && $apbct->data['cache_detected'] == 1 )
446
- )
447
- ){
448
- $key = hash('sha256', $apbct->api_key.ct_get_admin_email().$apbct->salt);
449
- if( apbct_is_cache_plugins_exists() )
450
- $apbct->data['cache_detected'] = 1;
451
-
452
- // Using dynamic JS keys
453
- }else{
454
-
455
- $keys = $apbct->data['js_keys'];
456
- $keys_checksum = md5(json_encode($keys));
457
-
458
- $key = null;
459
- $latest_key_time = 0;
460
-
461
- foreach ($keys as $k => $t) {
462
-
463
- // Removing key if it's to old
464
- if (time() - $t > $apbct->data['js_keys_store_days'] * 86400 * 7) {
465
- unset($keys[$k]);
466
- continue;
467
- }
468
-
469
- if ($t > $latest_key_time) {
470
- $latest_key_time = $t;
471
- $key = $k;
472
- }
473
- }
474
-
475
- // Set new key if the latest key is too old
476
- if (time() - $latest_key_time > $apbct->data['js_key_lifetime']) {
477
- $key = rand();
478
- $keys[$key] = time();
479
- }
480
-
481
- // Save keys if they were changed
482
- if (md5(json_encode($keys)) != $keys_checksum) {
483
- $apbct->data['js_keys'] = $keys;
484
- // $apbct->saveData();
485
- }
486
-
487
- $apbct->data['cache_detected'] = 0;
488
- }
489
-
490
- $apbct->saveData();
491
-
492
- return $key;
493
- }
494
-
495
- function apbct_is_cache_plugins_exists(){
496
- return
497
- defined('WP_ROCKET_VERSION') || // WPRocket
498
- defined('LSCWP_DIR') || // LiteSpeed Cache
499
- defined('WPFC_WP_CONTENT_BASENAME') || // WP Fastest Cache
500
- defined('W3TC') || // W3 Total Cache
501
- defined('WPO_VERSION') || // WP-Optimize – Clean, Compress, Cache
502
- defined('AUTOPTIMIZE_PLUGIN_VERSION') || // Autoptimize
503
- defined('WPCACHEHOME') || // WP Super Cache
504
- defined('WPHB_VERSION') || // HummingbirdSpeed up, Cache, Optimize Your CSS and JS
505
- defined('CE_FILE') || // Cache Enabler – WordPress Cache
506
- class_exists('RedisObjectCache') || // Redis Object Cache
507
- defined('SiteGround_Optimizer\VERSION') || // SG Optimizer
508
- class_exists('WP_Rest_Cache_Plugin\Includes\Plugin'); // WP REST Cache
509
- }
510
-
511
- /**
512
- * Inner function - Current site admin e-mail
513
- * @return string Admin e-mail
514
- */
515
- function ct_get_admin_email() {
516
- global $admin_email;
517
- if(!isset($admin_email))
518
- {
519
- $admin_email = get_option('admin_email');
520
- }
521
- return $admin_email;
522
- }
523
-
524
- /**
525
- * Inner function - Current Cleantalk working server info
526
- * @return mixed[] Array of server data
527
- */
528
- function ct_get_server($force=false) {
529
- global $ct_server;
530
- if(!$force && isset($ct_server) && isset($ct_server['ct_work_url']) && !empty($ct_server['ct_work_url'])){
531
-
532
- return $ct_server;
533
-
534
- }else{
535
-
536
- $ct_server = get_option('cleantalk_server');
537
- if (!is_array($ct_server)){
538
- $ct_server = array(
539
- 'ct_work_url' => NULL,
540
- 'ct_server_ttl' => NULL,
541
- 'ct_server_changed' => NULL
542
- );
543
- }
544
- return $ct_server;
545
- }
546
- }
547
-
548
- /**
549
- * Inner function - Stores ang returns cleantalk hash of current comment
550
- * @param string New hash or NULL
551
- * @return string New hash or current hash depending on parameter
552
- */
553
- function ct_hash($new_hash = '') {
554
- /**
555
- * Current hash
556
- */
557
- static $hash;
558
-
559
- if (!empty($new_hash)) {
560
- $hash = $new_hash;
561
- }
562
- return $hash;
563
- }
564
-
565
- /**
566
- * Inner function - Write manual moderation results to PHP sessions
567
- * @param string $hash Cleantalk comment hash
568
- * @param string $message comment_content
569
- * @param int $allow flag good comment (1) or bad (0)
570
- * @return string comment_content w\o cleantalk resume
571
- */
572
- function ct_feedback($hash, $allow) {
573
- global $apbct;
574
-
575
- $ct_feedback = $hash . ':' . $allow . ';';
576
- if($apbct->data['feedback_request'])
577
- $apbct->data['feedback_request'] = $ct_feedback;
578
- else
579
- $apbct->data['feedback_request'] .= $ct_feedback;
580
-
581
- $apbct->saveData();
582
- }
583
-
584
- /**
585
- * Inner function - Sends the results of moderation
586
- * Scheduled in 3600 seconds!
587
- * @param string $feedback_request
588
- * @return bool
589
- */
590
- function ct_send_feedback($feedback_request = null) {
591
-
592
- global $apbct;
593
-
594
- if (empty($feedback_request) && isset($apbct->data['feedback_request']) && preg_match("/^[a-z0-9\;\:]+$/", $apbct->data['feedback_request'])){
595
- $feedback_request = $apbct->data['feedback_request'];
596
- $apbct->data['feedback_request'] = '';
597
- $apbct->saveData();
598
- }
599
-
600
- if ($feedback_request !== null) {
601
-
602
- $ct_request = new CleantalkRequest(array(
603
- // General
604
- 'auth_key' => $apbct->api_key,
605
- // Additional
606
- 'feedback' => $feedback_request,
607
- ));
608
-
609
- $ct = new Cleantalk();
610
-
611
- // Server URL handling
612
- $config = ct_get_server();
613
- $ct->server_url = APBCT_MODERATE_URL;
614
- $ct->work_url = preg_match('/http:\/\/.+/', $config['ct_work_url']) ? $config['ct_work_url'] : null;
615
- $ct->server_ttl = $config['ct_server_ttl'];
616
- $ct->server_changed = $config['ct_server_changed'];
617
-
618
- $ct->sendFeedback($ct_request);
619
-
620
- if ($ct->server_change) {
621
- update_option(
622
- 'cleantalk_server',
623
- array(
624
- 'ct_work_url' => $ct->work_url,
625
- 'ct_server_ttl' => $ct->server_ttl,
626
- 'ct_server_changed' => time(),
627
- )
628
- );
629
- }
630
-
631
- return true;
632
- }
633
-
634
- return false;
635
- }
636
-
637
- /**
638
- * Delete old spam comments
639
- * Scheduled in 3600 seconds!
640
- * @return null
641
- */
642
- function ct_delete_spam_comments() {
643
-
644
- global $apbct;
645
-
646
- if ($apbct->settings['remove_old_spam'] == 1) {
647
- $last_comments = get_comments(array('status' => 'spam', 'number' => 1000, 'order' => 'ASC'));
648
- foreach ($last_comments as $c) {
649
- $comment_date_gmt = strtotime($c->comment_date_gmt);
650
- if ($comment_date_gmt && is_numeric($comment_date_gmt)) {
651
- if (time() - $comment_date_gmt > 86400 * $apbct->data['spam_store_days']) {
652
- // Force deletion old spam comments
653
- wp_delete_comment($c->comment_ID, true);
654
- }
655
- }
656
- }
657
- }
658
-
659
- return null;
660
- }
661
-
662
- /*
663
- * Get data from an ARRAY recursively
664
- * @return array
665
- */
666
- function ct_get_fields_any($arr, $message=array(), $email = null, $nickname = array('nick' => '', 'first' => '', 'last' => ''), $subject = null, $contact = true, $prev_name = ''){
667
-
668
- //Skip request if fields exists
669
- $skip_params = array(
670
- 'ipn_track_id', // PayPal IPN #
671
- 'txn_type', // PayPal transaction type
672
- 'payment_status', // PayPal payment status
673
- 'ccbill_ipn', // CCBill IPN
674
- 'ct_checkjs', // skip ct_checkjs field
675
- 'api_mode', // DigiStore-API
676
- 'loadLastCommentId' // Plugin: WP Discuz. ticket_id=5571
677
- );
678
-
679
- // Fields to replace with ****
680
- $obfuscate_params = array(
681
- 'password',
682
- 'pass',
683
- 'pwd',
684
- 'pswd'
685
- );
686
-
687
- // Skip feilds with these strings and known service fields
688
- $skip_fields_with_strings = array(
689
- // Common
690
- 'ct_checkjs', //Do not send ct_checkjs
691
- 'nonce', //nonce for strings such as 'rsvp_nonce_name'
692
- 'security',
693
- // 'action',
694
- 'http_referer',
695
- 'referer-page',
696
- 'timestamp',
697
- 'captcha',
698
- // Formidable Form
699
- 'form_key',
700
- 'submit_entry',
701
- // Custom Contact Forms
702
- 'form_id',
703
- 'ccf_form',
704
- 'form_page',
705
- // Qu Forms
706
- 'iphorm_uid',
707
- 'form_url',
708
- 'post_id',
709
- 'iphorm_ajax',
710
- 'iphorm_id',
711
- // Fast SecureContact Froms
712
- 'fs_postonce_1',
713
- 'fscf_submitted',
714
- 'mailto_id',
715
- 'si_contact_action',
716
- // Ninja Forms
717
- 'formData_id',
718
- 'formData_settings',
719
- 'formData_fields_\d+_id',
720
- 'formData_fields_\d+_files.*',
721
- // E_signature
722
- 'recipient_signature',
723
- 'output_\d+_\w{0,2}',
724
- // Contact Form by Web-Settler protection
725
- '_formId',
726
- '_returnLink',
727
- // Social login and more
728
- '_save',
729
- '_facebook',
730
- '_social',
731
- 'user_login-',
732
- // Contact Form 7
733
- '_wpcf7',
734
- 'ebd_settings',
735
- 'ebd_downloads_',
736
- 'ecole_origine',
737
- );
738
-
739
- // Reset $message if we have a sign-up data
740
- $skip_message_post = array(
741
- 'edd_action', // Easy Digital Downloads
742
- );
743
-
744
- if( apbct_array( array( $_POST, $_GET ) )->get_keys( $skip_params )->result() )
745
- $contact = false;
746
-
747
- if(count($arr)){
748
-
749
- foreach($arr as $key => $value){
750
-
751
- if(gettype($value) == 'string'){
752
-
753
- $tmp = strpos($value, '\\') !== false ? stripslashes($value) : $value;
754
- $decoded_json_value = json_decode($tmp, true);
755
-
756
- // Decoding JSON
757
- if($decoded_json_value !== null){
758
- $value = $decoded_json_value;
759
-
760
- // Ajax Contact Forms. Get data from such strings:
761
- // acfw30_name %% Blocked~acfw30_email %% s@cleantalk.org
762
- // acfw30_textarea %% msg
763
- }elseif(preg_match('/^\S+\s%%\s\S+.+$/', $value)){
764
- $value = explode('~', $value);
765
- foreach ($value as &$val){
766
- $tmp = explode(' %% ', $val);
767
- $val = array($tmp[0] => $tmp[1]);
768
- }
769
- }
770
- }
771
-
772
- if(!is_array($value) && !is_object($value)){
773
-
774
- if (in_array($key, $skip_params, true) && $key != 0 && $key != '' || preg_match("/^ct_checkjs/", $key))
775
- $contact = false;
776
-
777
- if($value === '')
778
- continue;
779
-
780
- // Skipping fields names with strings from (array)skip_fields_with_strings
781
- foreach($skip_fields_with_strings as $needle){
782
- if (preg_match("/".$needle."/", $prev_name.$key) == 1){
783
- continue(2);
784
- }
785
- }unset($needle);
786
-
787
- // Obfuscating params
788
- foreach($obfuscate_params as $needle){
789
- if (strpos($key, $needle) !== false){
790
- $value = ct_obfuscate_param($value);
791
- continue(2);
792
- }
793
- }unset($needle);
794
-
795
- // Removes whitespaces
796
- $value = urldecode( trim( strip_shortcodes( $value ) ) ); // Fully cleaned message
797
- $value_for_email = trim( strip_shortcodes( $value ) ); // Removes shortcodes to do better spam filtration on server side.
798
-
799
- // Email
800
- if ( ! $email && preg_match( "/^\S+@\S+\.\S+$/", $value_for_email ) ) {
801
- $email = $value_for_email;
802
-
803
- // Names
804
- }elseif (preg_match("/name/i", $key)){
805
-
806
- preg_match("/((name.?)?(your|first|for)(.?name)?)/", $key, $match_forename);
807
- preg_match("/((name.?)?(last|family|second|sur)(.?name)?)/", $key, $match_surname);
808
- preg_match("/(name.?)?(nick|user)(.?name)?/", $key, $match_nickname);
809
-
810
- if(count($match_forename) > 1)
811
- $nickname['first'] = $value;
812
- elseif(count($match_surname) > 1)
813
- $nickname['last'] = $value;
814
- elseif(count($match_nickname) > 1)
815
- $nickname['nick'] = $value;
816
- else
817
- $message[$prev_name.$key] = $value;
818
-
819
- // Subject
820
- }elseif ($subject === null && preg_match("/subject/i", $key)){
821
- $subject = $value;
822
-
823
- // Message
824
- }else{
825
- $message[$prev_name.$key] = $value;
826
- }
827
-
828
- }elseif(!is_object($value)){
829
-
830
- $prev_name_original = $prev_name;
831
- $prev_name = ($prev_name === '' ? $key.'_' : $prev_name.$key.'_');
832
-
833
- $temp = ct_get_fields_any($value, $message, $email, $nickname, $subject, $contact, $prev_name);
834
-
835
- $message = $temp['message'];
836
- $email = ($temp['email'] ? $temp['email'] : null);
837
- $nickname = ($temp['nickname'] ? $temp['nickname'] : null);
838
- $subject = ($temp['subject'] ? $temp['subject'] : null);
839
- if($contact === true)
840
- $contact = ($temp['contact'] === false ? false : true);
841
- $prev_name = $prev_name_original;
842
- }
843
- } unset($key, $value);
844
- }
845
-
846
- foreach ($skip_message_post as $v) {
847
- if (isset($_POST[$v])) {
848
- $message = null;
849
- break;
850
- }
851
- } unset($v);
852
-
853
- //If top iteration, returns compiled name field. Example: "Nickname Firtsname Lastname".
854
- if($prev_name === ''){
855
- if(!empty($nickname)){
856
- $nickname_str = '';
857
- foreach($nickname as $value){
858
- $nickname_str .= ($value ? $value." " : "");
859
- }unset($value);
860
- }
861
- $nickname = $nickname_str;
862
- }
863
-
864
- $return_param = array(
865
- 'email' => $email,
866
- 'nickname' => $nickname,
867
- 'subject' => $subject,
868
- 'contact' => $contact,
869
- 'message' => $message
870
- );
871
- return $return_param;
872
- }
873
-
874
- /**
875
- * Masks a value with asterisks (*)
876
- * @return string
877
- */
878
- function ct_obfuscate_param($value = null) {
879
- if ($value && (!is_object($value) || !is_array($value))) {
880
- $length = strlen($value);
881
- $value = str_repeat('*', $length);
882
- }
883
-
884
- return $value;
885
- }
886
-
887
- //New ct_get_fields_any_postdata
888
- function ct_get_fields_any_postdata($arr, $message=array()){
889
- $skip_params = array(
890
- 'ipn_track_id', // PayPal IPN #
891
- 'txn_type', // PayPal transaction type
892
- 'payment_status', // PayPal payment status
893
- );
894
-
895
- foreach($arr as $key => $value){
896
- if(!is_array($value)){
897
- if($value == '')
898
- continue;
899
- if (!(in_array($key, $skip_params) || preg_match("/^ct_checkjs/", $key)) && $value!='')
900
- $message[$key] = $value;
901
- }else{
902
- $temp = ct_get_fields_any_postdata($value);
903
- $message = (count($temp) == 0 ? $message : array_merge($message, $temp));
904
- }
905
- }
906
- return $message;
907
- }
908
-
909
- /**
910
- * Checks if given string is valid regular expression
911
- *
912
- * @param string $regexp
913
- *
914
- * @return bool
915
- */
916
- function apbct_is_regexp($regexp){
917
- return @preg_match('/' . $regexp . '/', null) !== false;
918
- }
919
-
920
- function cleantalk_debug($key,$value)
921
- {
922
- if(isset($_COOKIE) && isset($_COOKIE['cleantalk_debug']))
923
- {
924
- @header($key.": ".$value);
925
- }
926
- }
927
-
928
- /**
929
- * Function changes CleanTalk result object if an error occured.
930
- * @return object
931
- */
932
- function ct_change_plugin_resonse($ct_result = null, $checkjs = null) {
933
-
934
- global $apbct;
935
-
936
- if (!$ct_result) {
937
- return $ct_result;
938
- }
939
-
940
- if(@intval($ct_result->errno) != 0)
941
- {
942
- if($checkjs === null || $checkjs != 1)
943
- {
944
- $ct_result->allow = 0;
945
- $ct_result->spam = 1;
946
- $ct_result->comment = sprintf('We\'ve got an issue: %s. Forbidden. Please, enable Javascript. %s.',
947
- $ct_result->comment,
948
- $apbct->plugin_name
949
- );
950
- }
951
- else
952
- {
953
- $ct_result->allow = 1;
954
- $ct_result->comment = 'Allow';
955
- }
956
- }
957
-
958
- return $ct_result;
959
- }
960
-
961
- /**
962
- * Does key has correct symbols? Checks against regexp ^[a-z\d]{3,15}$
963
- * @param api_key
964
- * @return bool
965
- */
966
- function apbct_api_key__is_correct($api_key = null)
967
- {
968
- global $apbct;
969
- $api_key = $api_key !== null ? $api_key : $apbct->api_key;
970
- return $api_key && preg_match('/^[a-z\d]{3,15}$/', $api_key) ? true : false;
971
- }
972
-
973
- function apbct_add_async_attribute($tag, $handle, $src) {
974
-
975
- global $apbct;
976
-
977
- if(
978
- $apbct->settings['async_js'] &&
979
- (
980
- $handle === 'ct_public'
981
- || $handle === 'ct_public_gdpr'
982
- || $handle === 'ct_debug_js'
983
- || $handle === 'ct_public_admin_js'
984
- || $handle === 'ct_internal'
985
- || $handle === 'ct_external'
986
- || $handle === 'ct_nocache'
987
- )
988
- )
989
- return str_replace( ' src', ' async="async" src', $tag );
990
- else
991
- return $tag;
992
  }
1
+ <?php
2
+
3
+ function apbct_array( $array ){
4
+ return new Cleantalk\Arr( $array );
5
+ }
6
+
7
+ $ct_checkjs_frm = 'ct_checkjs_frm';
8
+ $ct_checkjs_register_form = 'ct_checkjs_register_form';
9
+
10
+ $apbct_cookie_request_id_label = 'request_id';
11
+ $apbct_cookie_register_ok_label = 'register_ok';
12
+
13
+ $ct_checkjs_cf7 = 'ct_checkjs_cf7';
14
+ $ct_cf7_comment = '';
15
+
16
+ $ct_checkjs_jpcf = 'ct_checkjs_jpcf';
17
+ $ct_jpcf_patched = false;
18
+ $ct_jpcf_fields = array('name', 'email');
19
+
20
+ // Comment already proccessed
21
+ $ct_comment_done = false;
22
+
23
+ // Comment already proccessed
24
+ $ct_signup_done = false;
25
+
26
+ //Contains registration error
27
+ $ct_registration_error_comment = false;
28
+
29
+ // Default value for JS test
30
+ $ct_checkjs_def = 0;
31
+
32
+ // COOKIE label to store request id for last approved
33
+ $ct_approved_request_id_label = 'ct_approved_request_id';
34
+
35
+ // Last request id approved for publication
36
+ $ct_approved_request_id = null;
37
+
38
+ // Trial notice show time in minutes
39
+ $trial_notice_showtime = 10;
40
+
41
+ // Renew notice show time in minutes
42
+ $renew_notice_showtime = 10;
43
+
44
+ // COOKIE label for WP Landing Page proccessing result
45
+ $ct_wplp_result_label = 'ct_wplp_result';
46
+
47
+ // Flag indicates active JetPack comments
48
+ $ct_jp_comments = false;
49
+
50
+ // WP admin email notice interval in seconds
51
+ $ct_admin_notoice_period = 21600;
52
+
53
+ // Sevice negative comment to visitor.
54
+ // It uses for BuddyPress registrations to avoid double checks
55
+ $ct_negative_comment = null;
56
+
57
+ // Set globals to NULL to avoid massive DB requests. Globals will be set when needed only and by accessors only.
58
+ $ct_server = NULL;
59
+ $admin_email = NULL;
60
+
61
+ /**
62
+ * Public action 'plugins_loaded' - Loads locale, see http://codex.wordpress.org/Function_Reference/load_plugin_textdomain
63
+ */
64
+ function apbct_plugin_loaded() {
65
+ $dir=plugin_basename( dirname( __FILE__ ) ) . '/../i18n';
66
+ $loaded=load_plugin_textdomain('cleantalk', false, $dir);
67
+ }
68
+
69
+ /**
70
+ * Inner function - Request's wrapper for anything
71
+ * @param array Array of parameters:
72
+ * 'message' - string
73
+ * 'example' - string
74
+ * 'checkjs' - int
75
+ * 'sender_email' - string
76
+ * 'sender_nickname' - string
77
+ * 'sender_info' - array
78
+ * 'post_info' - string
79
+ * @return array array('ct'=> Cleantalk, 'ct_result' => CleantalkResponse)
80
+ */
81
+ function apbct_base_call($params = array(), $reg_flag = false){
82
+
83
+ global $apbct, $cleantalk_executed;
84
+
85
+ $cleantalk_executed = true;
86
+
87
+ $sender_info = !empty($params['sender_info'])
88
+ ? CleantalkHelper::array_merge__save_numeric_keys__recursive(apbct_get_sender_info(), (array)$params['sender_info'])
89
+ : apbct_get_sender_info();
90
+
91
+ // Fileds exclusions
92
+ if( ! empty( $params['message'] ) && is_array( $params['message'] ) ){
93
+
94
+ $params['message'] = apbct_array( $params['message'] )
95
+ ->get_keys( $apbct->settings['exclusions__fields'], $apbct->settings['exclusions__fields__use_regexp'] )
96
+ ->delete();
97
+ }
98
+
99
+ $default_params = array(
100
+
101
+ // IPs
102
+ 'sender_ip' => defined('CT_TEST_IP') ? CT_TEST_IP : (isset($params['sender_ip']) ? $params['sender_ip'] : CleantalkHelper::ip__get(array('real'), false)),
103
+ 'x_forwarded_for' => CleantalkHelper::ip__get(array('x_forwarded_for'), false),
104
+ 'x_real_ip' => CleantalkHelper::ip__get(array('x_real_ip'), false),
105
+
106
+ // Misc
107
+ 'auth_key' => $apbct->api_key,
108
+ 'js_on' => apbct_js_test('ct_checkjs', $_COOKIE) ? 1 : apbct_js_test('ct_checkjs', $_POST),
109
+
110
+ 'agent' => APBCT_AGENT,
111
+ 'sender_info' => $sender_info,
112
+ 'submit_time' => apbct_get_submit_time(),
113
+ );
114
+
115
+ // Send $_SERVER if couldn't find IP
116
+ if(empty($default_params['sender_ip']))
117
+ $default_params['sender_info']['server_info'] = $_SERVER;
118
+
119
+ $ct_request = new CleantalkRequest(
120
+ CleantalkHelper::array_merge__save_numeric_keys__recursive($default_params, $params)
121
+ );
122
+
123
+ $ct = new Cleantalk();
124
+
125
+ $ct->use_bultin_api = $apbct->settings['use_buitin_http_api'] ? true : false;
126
+ $ct->ssl_on = $apbct->settings['ssl_on'];
127
+ $ct->ssl_path = APBCT_CASERT_PATH;
128
+
129
+ // Options store url without shceme because of DB error with ''://'
130
+ $config = ct_get_server();
131
+ $ct->server_url = APBCT_MODERATE_URL;
132
+ $ct->work_url = preg_match('/http:\/\/.+/', $config['ct_work_url']) ? $config['ct_work_url'] : null;
133
+ $ct->server_ttl = $config['ct_server_ttl'];
134
+ $ct->server_changed = $config['ct_server_changed'];
135
+
136
+ $start = microtime(true);
137
+ $ct_result = $reg_flag
138
+ ? @$ct->isAllowUser($ct_request)
139
+ : @$ct->isAllowMessage($ct_request);
140
+ $exec_time = microtime(true) - $start;
141
+
142
+ // Statistics
143
+ // Average request time
144
+ apbct_statistics__rotate($exec_time);
145
+ // Last request
146
+ $apbct->stats['last_request']['time'] = time();
147
+ $apbct->stats['last_request']['server'] = $ct->work_url;
148
+ $apbct->save('stats');
149
+
150
+ // Connection reports
151
+ if ($ct_result->errno === 0 && empty($ct_result->errstr))
152
+ $apbct->data['connection_reports']['success']++;
153
+ else
154
+ {
155
+ $apbct->data['connection_reports']['negative']++;
156
+ $apbct->data['connection_reports']['negative_report'][] = array(
157
+ 'date' => date("Y-m-d H:i:s"),
158
+ 'page_url' => apbct_get_server_variable( 'REQUEST_URI' ),
159
+ 'lib_report' => $ct_result->errstr,
160
+ 'work_url' => $ct->work_url,
161
+ );
162
+
163
+ if(count($apbct->data['connection_reports']['negative_report']) > 20)
164
+ $apbct->data['connection_reports']['negative_report'] = array_slice($apbct->data['connection_reports']['negative_report'], -20, 20);
165
+
166
+ }
167
+
168
+ if ($ct->server_change) {
169
+ update_option(
170
+ 'cleantalk_server',
171
+ array(
172
+ 'ct_work_url' => $ct->work_url,
173
+ 'ct_server_ttl' => $ct->server_ttl,
174
+ 'ct_server_changed' => time(),
175
+ )
176
+ );
177
+ }
178
+
179
+ $ct_result = ct_change_plugin_resonse($ct_result, $ct_request->js_on);
180
+
181
+ // Restart submit form counter for failed requests
182
+ if ($ct_result->allow == 0){
183
+ apbct_cookie(); // Setting page timer and cookies
184
+ ct_add_event('no');
185
+ }else{
186
+ ct_add_event('yes');
187
+ }
188
+
189
+ // Set cookies if it's not.
190
+ if(empty($apbct->flags__cookies_setuped))
191
+ apbct_cookie();
192
+
193
+ return array('ct' => $ct, 'ct_result' => $ct_result);
194
+
195
+ }
196
+
197
+ function apbct_exclusions_check($func = null){
198
+
199
+ global $apbct, $cleantalk_executed;
200
+
201
+ // Common exclusions
202
+ if(
203
+ apbct_exclusions_check__ip() ||
204
+ apbct_exclusions_check__url() ||
205
+ apbct_is_user_role_in( $apbct->settings['exclusions__roles'] ) ||
206
+ $cleantalk_executed
207
+ )
208
+ return true;
209
+
210
+ // Personal exclusions
211
+ switch ($func){
212
+ case 'ct_contact_form_validate_postdata':
213
+ if(
214
+ (defined( 'DOING_AJAX' ) && DOING_AJAX) ||
215
+ apbct_array( $_POST )->get_keys( 'members_search_submit' )->result()
216
+ )
217
+ return true;
218
+ break;
219
+ case 'ct_contact_form_validate':
220
+ if(
221
+ apbct_array( $_POST )->get_keys( 'members_search_submit' )->result()
222
+ )
223
+ return true;
224
+ break;
225
+ default:
226
+ return false;
227
+ break;
228
+ }
229
+
230
+ return false;
231
+ }
232
+
233
+ /**
234
+ * Checks if reuqest URI is in exclusion list
235
+ *
236
+ * @return bool
237
+ */
238
+ function apbct_exclusions_check__url() {
239
+
240
+ global $apbct;
241
+
242
+ if ( ! empty( $apbct->settings['exclusions__urls'] ) ) {
243
+
244
+ $exclusions = explode( ',', $apbct->settings['exclusions__urls'] );
245
+
246
+ // Fix for AJAX forms
247
+ $haystack = apbct_get_server_variable( 'REQUEST_URI' ) == '/wp-admin/admin-ajax.php' && ! apbct_get_server_variable( 'HTTP_REFERER' )
248
+ ? apbct_get_server_variable( 'HTTP_REFERER' )
249
+ : apbct_get_server_variable( 'REQUEST_URI' );
250
+
251
+ foreach ( $exclusions as $exclusion ) {
252
+ if (
253
+ ($apbct->settings['exclusions__urls__use_regexp'] && preg_match( '/' . $exclusion . '/', $haystack ) === 1) ||
254
+ stripos( $haystack, $exclusion ) !== false
255
+ ){
256
+ return true;
257
+ }
258
+ }
259
+ return false;
260
+ }
261
+ }
262
+ /**
263
+ * @deprecated 5.128 Using IP white-lists instead
264
+ * @deprecated since 18.09.2019
265
+ * Checks if sender_ip is in exclusion list
266
+ *
267
+ * @return bool
268
+ */
269
+ function apbct_exclusions_check__ip(){
270
+
271
+ global $cleantalk_ip_exclusions;
272
+
273
+ if( apbct_get_server_variable( 'REMOTE_ADDR' ) ){
274
+
275
+ if( CleantalkHelper::ip__is_cleantalks( apbct_get_server_variable( 'REMOTE_ADDR' ) ) ){
276
+ return true;
277
+ }
278
+
279
+ if( ! empty( $cleantalk_ip_exclusions ) && is_array( $cleantalk_ip_exclusions ) ){
280
+ foreach ( $cleantalk_ip_exclusions as $exclusion ){
281
+ if( stripos( apbct_get_server_variable( 'REMOTE_ADDR' ), $exclusion ) !== false ){
282
+ return true;
283
+ }
284
+ }
285
+ }
286
+ }
287
+
288
+ return false;
289
+ }
290
+
291
+ /**
292
+ * Inner function - Default data array for senders
293
+ * @return array
294
+ */
295
+ function apbct_get_sender_info() {
296
+
297
+ global $apbct;
298
+
299
+ // Validate cookie from the backend
300
+ $cookie_is_ok = apbct_cookies_test();
301
+
302
+ $referer_previous = $apbct->settings['set_cookies__sessions']
303
+ ? apbct_alt_session__get('apbct_prev_referer')
304
+ : filter_input(INPUT_COOKIE, 'apbct_prev_referer');
305
+
306
+ $site_landing_ts = $apbct->settings['set_cookies__sessions']
307
+ ? apbct_alt_session__get('apbct_site_landing_ts')
308
+ : filter_input(INPUT_COOKIE, 'apbct_site_landing_ts');
309
+
310
+ $page_hits = $apbct->settings['set_cookies__sessions']
311
+ ? apbct_alt_session__get('apbct_page_hits')
312
+ : filter_input(INPUT_COOKIE, 'apbct_page_hits');
313
+
314
+ if (count($_POST) > 0) {
315
+ foreach ($_POST as $k => $v) {
316
+ if (preg_match("/^(ct_check|checkjs).+/", $k)) {
317
+ $checkjs_data_post = $v;
318
+ }
319
+ }
320
+ }
321
+
322
+ // AMP check
323
+ $amp_detected = apbct_get_server_variable( 'HTTP_REFERER' )
324
+ ? strpos(apbct_get_server_variable( 'HTTP_REFERER' ), '/amp/') !== false || strpos(apbct_get_server_variable( 'HTTP_REFERER' ), '?amp=1') !== false || strpos(apbct_get_server_variable( 'HTTP_REFERER' ), '&amp=1') !== false
325
+ ? 1
326
+ : 0
327
+ : null;
328
+
329
+ $site_referer = $apbct->settings['store_urls__sessions']
330
+ ? apbct_alt_session__get('apbct_site_referer')
331
+ : filter_input(INPUT_COOKIE, 'apbct_site_referer');
332
+
333
+ $urls = $apbct->settings['store_urls__sessions']
334
+ ? (array)apbct_alt_session__get('apbct_urls')
335
+ : (array)json_decode(filter_input(INPUT_COOKIE, 'apbct_urls'), true);
336
+
337
+ return array(
338
+ 'remote_addr' => CleantalkHelper::ip__get(array('remote_addr'), false),
339
+ 'REFFERRER' => apbct_get_server_variable( 'HTTP_REFERER' ),
340
+ 'USER_AGENT' => apbct_get_server_variable( 'HTTP_USER_AGENT' ),
341
+ 'page_url' => apbct_get_server_variable( 'SERVER_NAME' ) . apbct_get_server_variable( 'REQUEST_URI' ),
342
+ 'cms_lang' => substr(get_locale(), 0, 2),
343
+ 'ct_options' => json_encode($apbct->settings),
344
+ 'fields_number' => sizeof($_POST),
345
+ 'direct_post' => $cookie_is_ok === null && apbct_is_post() ? 1 : 0,
346
+ // Raw data to validated JavaScript test in the cloud
347
+ 'checkjs_data_cookies' => !empty($_COOKIE['ct_checkjs']) ? $_COOKIE['ct_checkjs'] : null,
348
+ 'checkjs_data_post' => !empty($checkjs_data_post) ? $checkjs_data_post : null,
349
+ // PHP cookies
350
+ 'cookies_enabled' => $cookie_is_ok,
351
+ 'REFFERRER_PREVIOUS' => !empty($referer_previous) && $cookie_is_ok ? $referer_previous : null,
352
+ 'site_landing_ts' => !empty($site_landing_ts) && $cookie_is_ok ? $site_landing_ts : null,
353
+ 'page_hits' => !empty($page_hits) ? $page_hits : null,
354
+ // JS cookies
355
+ 'js_info' => !empty($_COOKIE['ct_user_info']) ? json_decode(stripslashes($_COOKIE['ct_user_info']), true) : null,
356
+ 'mouse_cursor_positions' => !empty($_COOKIE['ct_pointer_data']) ? json_decode(stripslashes($_COOKIE['ct_pointer_data']), true) : null,
357
+ 'js_timezone' => !empty($_COOKIE['ct_timezone']) ? $_COOKIE['ct_timezone'] : null,
358
+ 'key_press_timestamp' => !empty($_COOKIE['ct_fkp_timestamp']) ? $_COOKIE['ct_fkp_timestamp'] : null,
359
+ 'page_set_timestamp' => !empty($_COOKIE['ct_ps_timestamp']) ? $_COOKIE['ct_ps_timestamp'] : null,
360
+ 'form_visible_inputs' => !empty($_COOKIE['apbct_visible_fields_count']) ? $_COOKIE['apbct_visible_fields_count'] : null,
361
+ 'apbct_visible_fields' => !empty($_COOKIE['apbct_visible_fields']) ? apbct_visibile_fields__process($_COOKIE['apbct_visible_fields']) : null,
362
+ // Misc
363
+ 'site_referer' => !empty($site_referer) ? $site_referer : null,
364
+ 'source_url' => !empty($urls) ? json_encode($urls) : null,
365
+ // Debug stuff
366
+ 'amp_detected' => $amp_detected,
367
+ 'hook' => current_action(),
368
+ 'headers_sent' => !empty($apbct->headers_sent) ? $apbct->headers_sent : false,
369
+ 'headers_sent__hook' => !empty($apbct->headers_sent__hook) ? $apbct->headers_sent__hook : false,
370
+ 'headers_sent__where' => !empty($apbct->headers_sent__where) ? $apbct->headers_sent__where : false,
371
+ 'request_type' => apbct_get_server_variable('REQUEST_METHOD') ? apbct_get_server_variable('REQUEST_METHOD') : 'UNKNOWN',
372
+ );
373
+ }
374
+
375
+ /**
376
+ * Process visible fields for specific form to match the fields from request
377
+ *
378
+ * @param string $visible_fields
379
+ *
380
+ * @return string
381
+ */
382
+ function apbct_visibile_fields__process($visible_fields) {
383
+ if(strpos($visible_fields, 'wpforms') !== false){
384
+ $visible_fields = preg_replace(
385
+ array('/\[/', '/\]/'),
386
+ '',
387
+ str_replace(
388
+ '][',
389
+ '_',
390
+ str_replace(
391
+ 'wpforms[fields]',
392
+ '',
393
+ $visible_fields
394
+ )
395
+ )
396
+ );
397
+ }
398
+
399
+ return $visible_fields;
400
+ }
401
+
402
+ /*
403
+ * Outputs JS key for AJAX-use only. Stops script.
404
+ */
405
+ function apbct_js_keys__get__ajax($direct_call = false){
406
+ if(!$direct_call){
407
+ if(isset($_POST['_ajax_nonce'])){
408
+ if(!wp_verify_nonce($_POST['_ajax_nonce'], 'ct_secret_stuff')){
409
+ wp_doing_ajax()
410
+ ? wp_die( -1, 403 )
411
+ : die( '-1' );
412
+ }
413
+ }else{
414
+ wp_doing_ajax()
415
+ ? wp_die( -1, 403 )
416
+ : die( '-1' );
417
+ }
418
+ }
419
+ die(json_encode(array(
420
+ 'js_key' => ct_get_checkjs_value()
421
+ )));
422
+ }
423
+
424
+ /**
425
+ * Get ct_get_checkjs_value
426
+ *
427
+ * @param bool $random_key
428
+ *
429
+ * @return int|string|null
430
+ */
431
+ function ct_get_checkjs_value(){
432
+
433
+ global $apbct;
434
+
435
+ // Use static JS keys
436
+ if($apbct->settings['use_static_js_key'] == 1){
437
+
438
+ $key = hash('sha256', $apbct->api_key.ct_get_admin_email().$apbct->salt);
439
+
440
+ // Auto detecting. Detected.
441
+ }elseif(
442
+ $apbct->settings['use_static_js_key'] == - 1 &&
443
+ ( apbct_is_cache_plugins_exists() ||
444
+ ( apbct_is_post() && $apbct->data['cache_detected'] == 1 )
445
+ )
446
+ ){
447
+ $key = hash('sha256', $apbct->api_key.ct_get_admin_email().$apbct->salt);
448
+ if( apbct_is_cache_plugins_exists() )
449
+ $apbct->data['cache_detected'] = 1;
450
+
451
+ // Using dynamic JS keys
452
+ }else{
453
+
454
+ $keys = $apbct->data['js_keys'];
455
+ $keys_checksum = md5(json_encode($keys));
456
+
457
+ $key = null;
458
+ $latest_key_time = 0;
459
+
460
+ foreach ($keys as $k => $t) {
461
+
462
+ // Removing key if it's to old
463
+ if (time() - $t > $apbct->data['js_keys_store_days'] * 86400 * 7) {
464
+ unset($keys[$k]);
465
+ continue;
466
+ }
467
+
468
+ if ($t > $latest_key_time) {
469
+ $latest_key_time = $t;
470
+ $key = $k;
471
+ }
472
+ }
473
+
474
+ // Set new key if the latest key is too old
475
+ if (time() - $latest_key_time > $apbct->data['js_key_lifetime']) {
476
+ $key = rand();
477
+ $keys[$key] = time();
478
+ }
479
+
480
+ // Save keys if they were changed
481
+ if (md5(json_encode($keys)) != $keys_checksum) {
482
+ $apbct->data['js_keys'] = $keys;
483
+ // $apbct->saveData();
484
+ }
485
+
486
+ $apbct->data['cache_detected'] = 0;
487
+ }
488
+
489
+ $apbct->saveData();
490
+
491
+ return $key;
492
+ }
493
+
494
+ function apbct_is_cache_plugins_exists(){
495
+ return
496
+ defined('WP_ROCKET_VERSION') || // WPRocket
497
+ defined('LSCWP_DIR') || // LiteSpeed Cache
498
+ defined('WPFC_WP_CONTENT_BASENAME') || // WP Fastest Cache
499
+ defined('W3TC') || // W3 Total Cache
500
+ defined('WPO_VERSION') || // WP-Optimize Clean, Compress, Cache
501
+ defined('AUTOPTIMIZE_PLUGIN_VERSION') || // Autoptimize
502
+ defined('WPCACHEHOME') || // WP Super Cache
503
+ defined('WPHB_VERSION') || // Hummingbird Speed up, Cache, Optimize Your CSS and JS
504
+ defined('CE_FILE') || // Cache Enabler WordPress Cache
505
+ class_exists('RedisObjectCache') || // Redis Object Cache
506
+ defined('SiteGround_Optimizer\VERSION') || // SG Optimizer
507
+ class_exists('WP_Rest_Cache_Plugin\Includes\Plugin'); // WP REST Cache
508
+ }
509
+
510
+ /**
511
+ * Inner function - Current site admin e-mail
512
+ * @return string Admin e-mail
513
+ */
514
+ function ct_get_admin_email() {
515
+ global $admin_email;
516
+ if(!isset($admin_email))
517
+ {
518
+ $admin_email = get_option('admin_email');
519
+ }
520
+ return $admin_email;
521
+ }
522
+
523
+ /**
524
+ * Inner function - Current Cleantalk working server info
525
+ * @return mixed[] Array of server data
526
+ */
527
+ function ct_get_server($force=false) {
528
+ global $ct_server;
529
+ if(!$force && isset($ct_server) && isset($ct_server['ct_work_url']) && !empty($ct_server['ct_work_url'])){
530
+
531
+ return $ct_server;
532
+
533
+ }else{
534
+
535
+ $ct_server = get_option('cleantalk_server');
536
+ if (!is_array($ct_server)){
537
+ $ct_server = array(
538
+ 'ct_work_url' => NULL,
539
+ 'ct_server_ttl' => NULL,
540
+ 'ct_server_changed' => NULL
541
+ );
542
+ }
543
+ return $ct_server;
544
+ }
545
+ }
546
+
547
+ /**
548
+ * Inner function - Stores ang returns cleantalk hash of current comment
549
+ * @param string New hash or NULL
550
+ * @return string New hash or current hash depending on parameter
551
+ */
552
+ function ct_hash($new_hash = '') {
553
+ /**
554
+ * Current hash
555
+ */
556
+ static $hash;
557
+
558
+ if (!empty($new_hash)) {
559
+ $hash = $new_hash;
560
+ }
561
+ return $hash;
562
+ }
563
+
564
+ /**
565
+ * Inner function - Write manual moderation results to PHP sessions
566
+ * @param string $hash Cleantalk comment hash
567
+ * @param string $message comment_content
568
+ * @param int $allow flag good comment (1) or bad (0)
569
+ * @return string comment_content w\o cleantalk resume
570
+ */
571
+ function ct_feedback($hash, $allow) {
572
+ global $apbct;
573
+
574
+ $ct_feedback = $hash . ':' . $allow . ';';
575
+ if($apbct->data['feedback_request'])
576
+ $apbct->data['feedback_request'] = $ct_feedback;
577
+ else
578
+ $apbct->data['feedback_request'] .= $ct_feedback;
579
+
580
+ $apbct->saveData();
581
+ }
582
+
583
+ /**
584
+ * Inner function - Sends the results of moderation
585
+ * Scheduled in 3600 seconds!
586
+ * @param string $feedback_request
587
+ * @return bool
588
+ */
589
+ function ct_send_feedback($feedback_request = null) {
590
+
591
+ global $apbct;
592
+
593
+ if (empty($feedback_request) && isset($apbct->data['feedback_request']) && preg_match("/^[a-z0-9\;\:]+$/", $apbct->data['feedback_request'])){
594
+ $feedback_request = $apbct->data['feedback_request'];
595
+ $apbct->data['feedback_request'] = '';
596
+ $apbct->saveData();
597
+ }
598
+
599
+ if ($feedback_request !== null) {
600
+
601
+ $ct_request = new CleantalkRequest(array(
602
+ // General
603
+ 'auth_key' => $apbct->api_key,
604
+ // Additional
605
+ 'feedback' => $feedback_request,
606
+ ));
607
+
608
+ $ct = new Cleantalk();
609
+
610
+ // Server URL handling
611
+ $config = ct_get_server();
612
+ $ct->server_url = APBCT_MODERATE_URL;
613
+ $ct->work_url = preg_match('/http:\/\/.+/', $config['ct_work_url']) ? $config['ct_work_url'] : null;
614
+ $ct->server_ttl = $config['ct_server_ttl'];
615
+ $ct->server_changed = $config['ct_server_changed'];
616
+
617
+ $ct->sendFeedback($ct_request);
618
+
619
+ if ($ct->server_change) {
620
+ update_option(
621
+ 'cleantalk_server',
622
+ array(
623
+ 'ct_work_url' => $ct->work_url,
624
+ 'ct_server_ttl' => $ct->server_ttl,
625
+ 'ct_server_changed' => time(),
626
+ )
627
+ );
628
+ }
629
+
630
+ return true;
631
+ }
632
+
633
+ return false;
634
+ }
635
+
636
+ /**
637
+ * Delete old spam comments
638
+ * Scheduled in 3600 seconds!
639
+ * @return null
640
+ */
641
+ function ct_delete_spam_comments() {
642
+
643
+ global $apbct;
644
+
645
+ if ($apbct->settings['remove_old_spam'] == 1) {
646
+ $last_comments = get_comments(array('status' => 'spam', 'number' => 1000, 'order' => 'ASC'));
647
+ foreach ($last_comments as $c) {
648
+ $comment_date_gmt = strtotime($c->comment_date_gmt);
649
+ if ($comment_date_gmt && is_numeric($comment_date_gmt)) {
650
+ if (time() - $comment_date_gmt > 86400 * $apbct->data['spam_store_days']) {
651
+ // Force deletion old spam comments
652
+ wp_delete_comment($c->comment_ID, true);
653
+ }
654
+ }
655
+ }
656
+ }
657
+
658
+ return null;
659
+ }
660
+
661
+ /*
662
+ * Get data from an ARRAY recursively
663
+ * @return array
664
+ */
665
+ function ct_get_fields_any($arr, $message=array(), $email = null, $nickname = array('nick' => '', 'first' => '', 'last' => ''), $subject = null, $contact = true, $prev_name = ''){
666
+
667
+ //Skip request if fields exists
668
+ $skip_params = array(
669
+ 'ipn_track_id', // PayPal IPN #
670
+ 'txn_type', // PayPal transaction type
671
+ 'payment_status', // PayPal payment status
672
+ 'ccbill_ipn', // CCBill IPN
673
+ 'ct_checkjs', // skip ct_checkjs field
674
+ 'api_mode', // DigiStore-API
675
+ 'loadLastCommentId' // Plugin: WP Discuz. ticket_id=5571
676
+ );
677
+
678
+ // Fields to replace with ****
679
+ $obfuscate_params = array(
680
+ 'password',
681
+ 'pass',
682
+ 'pwd',
683
+ 'pswd'
684
+ );
685
+
686
+ // Skip feilds with these strings and known service fields
687
+ $skip_fields_with_strings = array(
688
+ // Common
689
+ 'ct_checkjs', //Do not send ct_checkjs
690
+ 'nonce', //nonce for strings such as 'rsvp_nonce_name'
691
+ 'security',
692
+ // 'action',
693
+ 'http_referer',
694
+ 'referer-page',
695
+ 'timestamp',
696
+ 'captcha',
697
+ // Formidable Form
698
+ 'form_key',
699
+ 'submit_entry',
700
+ // Custom Contact Forms
701
+ 'form_id',
702
+ 'ccf_form',
703
+ 'form_page',
704
+ // Qu Forms
705
+ 'iphorm_uid',
706
+ 'form_url',
707
+ 'post_id',
708
+ 'iphorm_ajax',
709
+ 'iphorm_id',
710
+ // Fast SecureContact Froms
711
+ 'fs_postonce_1',
712
+ 'fscf_submitted',
713
+ 'mailto_id',
714
+ 'si_contact_action',
715
+ // Ninja Forms
716
+ 'formData_id',
717
+ 'formData_settings',
718
+ 'formData_fields_\d+_id',
719
+ 'formData_fields_\d+_files.*',
720
+ // E_signature
721
+ 'recipient_signature',
722
+ 'output_\d+_\w{0,2}',
723
+ // Contact Form by Web-Settler protection
724
+ '_formId',
725
+ '_returnLink',
726
+ // Social login and more
727
+ '_save',
728
+ '_facebook',
729
+ '_social',
730
+ 'user_login-',
731
+ // Contact Form 7
732
+ '_wpcf7',
733
+ 'ebd_settings',
734
+ 'ebd_downloads_',
735
+ 'ecole_origine',
736
+ );
737
+
738
+ // Reset $message if we have a sign-up data
739
+ $skip_message_post = array(
740
+ 'edd_action', // Easy Digital Downloads
741
+ );
742
+
743
+ if( apbct_array( array( $_POST, $_GET ) )->get_keys( $skip_params )->result() )
744
+ $contact = false;
745
+
746
+ if(count($arr)){
747
+
748
+ foreach($arr as $key => $value){
749
+
750
+ if(gettype($value) == 'string'){
751
+
752
+ $tmp = strpos($value, '\\') !== false ? stripslashes($value) : $value;
753
+ $decoded_json_value = json_decode($tmp, true);
754
+
755
+ // Decoding JSON
756
+ if($decoded_json_value !== null){
757
+ $value = $decoded_json_value;
758
+
759
+ // Ajax Contact Forms. Get data from such strings:
760
+ // acfw30_name %% Blocked~acfw30_email %% s@cleantalk.org
761
+ // acfw30_textarea %% msg
762
+ }elseif(preg_match('/^\S+\s%%\s\S+.+$/', $value)){
763
+ $value = explode('~', $value);
764
+ foreach ($value as &$val){
765
+ $tmp = explode(' %% ', $val);
766
+ $val = array($tmp[0] => $tmp[1]);
767
+ }
768
+ }
769
+ }
770
+
771
+ if(!is_array($value) && !is_object($value)){
772
+
773
+ if (in_array($key, $skip_params, true) && $key != 0 && $key != '' || preg_match("/^ct_checkjs/", $key))
774
+ $contact = false;
775
+
776
+ if($value === '')
777
+ continue;
778
+
779
+ // Skipping fields names with strings from (array)skip_fields_with_strings
780
+ foreach($skip_fields_with_strings as $needle){
781
+ if (preg_match("/".$needle."/", $prev_name.$key) == 1){
782
+ continue(2);
783
+ }
784
+ }unset($needle);
785
+
786
+ // Obfuscating params
787
+ foreach($obfuscate_params as $needle){
788
+ if (strpos($key, $needle) !== false){
789
+ $value = ct_obfuscate_param($value);
790
+ continue(2);
791
+ }
792
+ }unset($needle);
793
+
794
+ // Removes whitespaces
795
+ $value = urldecode( trim( strip_shortcodes( $value ) ) ); // Fully cleaned message
796
+ $value_for_email = trim( strip_shortcodes( $value ) ); // Removes shortcodes to do better spam filtration on server side.
797
+
798
+ // Email
799
+ if ( ! $email && preg_match( "/^\S+@\S+\.\S+$/", $value_for_email ) ) {
800
+ $email = $value_for_email;
801
+
802
+ // Names
803
+ }elseif (preg_match("/name/i", $key)){
804
+
805
+ preg_match("/((name.?)?(your|first|for)(.?name)?)/", $key, $match_forename);
806
+ preg_match("/((name.?)?(last|family|second|sur)(.?name)?)/", $key, $match_surname);
807
+ preg_match("/(name.?)?(nick|user)(.?name)?/", $key, $match_nickname);
808
+
809
+ if(count($match_forename) > 1)
810
+ $nickname['first'] = $value;
811
+ elseif(count($match_surname) > 1)
812
+ $nickname['last'] = $value;
813
+ elseif(count($match_nickname) > 1)
814
+ $nickname['nick'] = $value;
815
+ else
816
+ $message[$prev_name.$key] = $value;
817
+
818
+ // Subject
819
+ }elseif ($subject === null && preg_match("/subject/i", $key)){
820
+ $subject = $value;
821
+
822
+ // Message
823
+ }else{
824
+ $message[$prev_name.$key] = $value;
825
+ }
826
+
827
+ }elseif(!is_object($value)){
828
+
829
+ $prev_name_original = $prev_name;
830
+ $prev_name = ($prev_name === '' ? $key.'_' : $prev_name.$key.'_');
831
+
832
+ $temp = ct_get_fields_any($value, $message, $email, $nickname, $subject, $contact, $prev_name);
833
+
834
+ $message = $temp['message'];
835
+ $email = ($temp['email'] ? $temp['email'] : null);
836
+ $nickname = ($temp['nickname'] ? $temp['nickname'] : null);
837
+ $subject = ($temp['subject'] ? $temp['subject'] : null);
838
+ if($contact === true)
839
+ $contact = ($temp['contact'] === false ? false : true);
840
+ $prev_name = $prev_name_original;
841
+ }
842
+ } unset($key, $value);
843
+ }
844
+
845
+ foreach ($skip_message_post as $v) {
846
+ if (isset($_POST[$v])) {
847
+ $message = null;
848
+ break;
849
+ }
850
+ } unset($v);
851
+
852
+ //If top iteration, returns compiled name field. Example: "Nickname Firtsname Lastname".
853
+ if($prev_name === ''){
854
+ if(!empty($nickname)){
855
+ $nickname_str = '';
856
+ foreach($nickname as $value){
857
+ $nickname_str .= ($value ? $value." " : "");
858
+ }unset($value);
859
+ }
860
+ $nickname = $nickname_str;
861
+ }
862
+
863
+ $return_param = array(
864
+ 'email' => $email,
865
+ 'nickname' => $nickname,
866
+ 'subject' => $subject,
867
+ 'contact' => $contact,
868
+ 'message' => $message
869
+ );
870
+ return $return_param;
871
+ }
872
+
873
+ /**
874
+ * Masks a value with asterisks (*)
875
+ * @return string
876
+ */
877
+ function ct_obfuscate_param($value = null) {
878
+ if ($value && (!is_object($value) || !is_array($value))) {
879
+ $length = strlen($value);
880
+ $value = str_repeat('*', $length);
881
+ }
882
+
883
+ return $value;
884
+ }
885
+
886
+ //New ct_get_fields_any_postdata
887
+ function ct_get_fields_any_postdata($arr, $message=array()){
888
+ $skip_params = array(
889
+ 'ipn_track_id', // PayPal IPN #
890
+ 'txn_type', // PayPal transaction type
891
+ 'payment_status', // PayPal payment status
892
+ );
893
+
894
+ foreach($arr as $key => $value){
895
+ if(!is_array($value)){
896
+ if($value == '')
897
+ continue;
898
+ if (!(in_array($key, $skip_params) || preg_match("/^ct_checkjs/", $key)) && $value!='')
899
+ $message[$key] = $value;
900
+ }else{
901
+ $temp = ct_get_fields_any_postdata($value);
902
+ $message = (count($temp) == 0 ? $message : array_merge($message, $temp));
903
+ }
904
+ }
905
+ return $message;
906
+ }
907
+
908
+ /**
909
+ * Checks if given string is valid regular expression
910
+ *
911
+ * @param string $regexp
912
+ *
913
+ * @return bool
914
+ */
915
+ function apbct_is_regexp($regexp){
916
+ return @preg_match('/' . $regexp . '/', null) !== false;
917
+ }
918
+
919
+ function cleantalk_debug($key,$value)
920
+ {
921
+ if(isset($_COOKIE) && isset($_COOKIE['cleantalk_debug']))
922
+ {
923
+ @header($key.": ".$value);
924
+ }
925
+ }
926
+
927
+ /**
928
+ * Function changes CleanTalk result object if an error occured.
929
+ * @return object
930
+ */
931
+ function ct_change_plugin_resonse($ct_result = null, $checkjs = null) {
932
+
933
+ global $apbct;
934
+
935
+ if (!$ct_result) {
936
+ return $ct_result;
937
+ }
938
+
939
+ if(@intval($ct_result->errno) != 0)
940
+ {
941
+ if($checkjs === null || $checkjs != 1)
942
+ {
943
+ $ct_result->allow = 0;
944
+ $ct_result->spam = 1;
945
+ $ct_result->comment = sprintf('We\'ve got an issue: %s. Forbidden. Please, enable Javascript. %s.',
946
+ $ct_result->comment,
947
+ $apbct->plugin_name
948
+ );
949
+ }
950
+ else
951
+ {
952
+ $ct_result->allow = 1;
953
+ $ct_result->comment = 'Allow';
954
+ }
955
+ }
956
+
957
+ return $ct_result;
958
+ }
959
+
960
+ /**
961
+ * Does key has correct symbols? Checks against regexp ^[a-z\d]{3,15}$
962
+ * @param api_key
963
+ * @return bool
964
+ */
965
+ function apbct_api_key__is_correct($api_key = null)
966
+ {
967
+ global $apbct;
968
+ $api_key = $api_key !== null ? $api_key : $apbct->api_key;
969
+ return $api_key && preg_match('/^[a-z\d]{3,15}$/', $api_key) ? true : false;
970
+ }
971
+
972
+ function apbct_add_async_attribute($tag, $handle, $src) {
973
+
974
+ global $apbct;
975
+
976
+ if(
977
+ $apbct->settings['async_js'] &&
978
+ (
979
+ $handle === 'ct_public'
980
+ || $handle === 'ct_public_gdpr'
981
+ || $handle === 'ct_debug_js'
982
+ || $handle === 'ct_public_admin_js'
983
+ || $handle === 'ct_internal'
984
+ || $handle === 'ct_external'
985
+ || $handle === 'ct_nocache'
986
+ )
987
+ )
988
+ return str_replace( ' src', ' async="async" src', $tag );
989
+ else
990
+ return $tag;
 
991
  }
inc/cleantalk-find-spam.php CHANGED
@@ -1,57 +1,59 @@
1
- <?php
2
-
3
- require_once(CLEANTALK_PLUGIN_DIR . 'inc/find-spam/ClassCleantalkFindSpamPage.php');
4
- require_once(CLEANTALK_PLUGIN_DIR . 'inc/find-spam/ClassCleantalkFindSpamChecker.php');
5
- require_once(CLEANTALK_PLUGIN_DIR . 'inc/find-spam/ClassCleantalkFindSpamUsersChecker.php');
6
- require_once(CLEANTALK_PLUGIN_DIR . 'inc/find-spam/ClassCleantalkFindSpamCommentsChecker.php');
7
-
8
- // Adding menu items for USERS and COMMENTS spam checking pages
9
- add_action( 'admin_menu', 'ct_add_find_spam_pages' );
10
- function ct_add_find_spam_pages(){
11
-
12
- // Check users pages
13
- $ct_check_users = add_users_page( __( "Check for spam", 'cleantalk' ), __( "Find spam users", 'cleantalk' ), 'activate_plugins', 'ct_check_users', array( 'ClassCleantalkFindSpamPage', 'showFindSpamPage' ) );
14
- $ct_check_users_total = add_users_page( __( "Total spam found", 'cleantalk' ), '', 'activate_plugins', 'ct_check_users_total', array( 'ClassCleantalkFindSpamPage', 'showFindSpamPage' ) );
15
- $ct_check_users_logs = add_users_page( __( "Scan logs", 'cleantalk' ), '', 'activate_plugins', 'ct_check_users_logs', array( 'ClassCleantalkFindSpamPage', 'showFindSpamPage' ) );
16
-
17
- // Cheack comments pages
18
- $ct_check_spam = add_comments_page( __( "Check for spam", 'cleantalk' ), __( "Find spam comments", 'cleantalk' ), 'activate_plugins', 'ct_check_spam', array( 'ClassCleantalkFindSpamPage', 'showFindSpamPage' ) );
19
- $ct_check_spam_total = add_comments_page( __( "Total spam found", 'cleantalk' ), '', 'activate_plugins', 'ct_check_spam_total', array( 'ClassCleantalkFindSpamPage', 'showFindSpamPage' ) );
20
- $ct_check_spam_logs = add_comments_page( __( "Scan logs", 'cleantalk' ), '', 'activate_plugins', 'ct_check_spam_logs', array( 'ClassCleantalkFindSpamPage', 'showFindSpamPage' ) );
21
-
22
- // Remove some pages from main menu
23
- remove_submenu_page( 'users.php', 'ct_check_users_total' );
24
- remove_submenu_page( 'users.php', 'ct_check_users_logs' );
25
- remove_submenu_page( 'edit-comments.php', 'ct_check_spam_total' );
26
- remove_submenu_page( 'edit-comments.php', 'ct_check_spam_logs' );
27
-
28
- // Set screen option for every pages
29
- add_action( "load-$ct_check_users", array( 'ClassCleantalkFindSpamPage', 'setScreenOption' ) );
30
- add_action( "load-$ct_check_users_total", array( 'ClassCleantalkFindSpamPage', 'setScreenOption' ) );
31
- add_action( "load-$ct_check_users_logs", array( 'ClassCleantalkFindSpamPage', 'setScreenOption' ) );
32
- add_action( "load-$ct_check_spam", array( 'ClassCleantalkFindSpamPage', 'setScreenOption' ) );
33
- add_action( "load-$ct_check_spam_total", array( 'ClassCleantalkFindSpamPage', 'setScreenOption' ) );
34
- add_action( "load-$ct_check_spam_logs", array( 'ClassCleantalkFindSpamPage', 'setScreenOption' ) );
35
-
36
- }
37
-
38
- // Set AJAX actions
39
- add_action( 'wp_ajax_ajax_clear_users', array( 'ClassCleantalkFindSpamUsersChecker', 'ct_ajax_clear_users' ) );
40
- add_action( 'wp_ajax_ajax_check_users', array( 'ClassCleantalkFindSpamUsersChecker', 'ct_ajax_check_users' ) );
41
- add_action( 'wp_ajax_ajax_info_users', array( 'ClassCleantalkFindSpamUsersChecker', 'ct_ajax_info' ) );
42
- add_action( 'wp_ajax_ajax_ct_get_csv_file', array( 'ClassCleantalkFindSpamUsersChecker', 'ct_get_csv_file' ) );
43
-
44
- add_action( 'wp_ajax_ajax_clear_comments', array( 'ClassCleantalkFindSpamCommentsChecker', 'ct_ajax_clear_comments' ) );
45
- add_action( 'wp_ajax_ajax_check_comments', array( 'ClassCleantalkFindSpamCommentsChecker', 'ct_ajax_check_comments' ) );
46
- add_action( 'wp_ajax_ajax_info_comments', array( 'ClassCleantalkFindSpamCommentsChecker', 'ct_ajax_info' ) );
47
-
48
- // Hook for saving "per_page" option
49
- add_action( 'wp_loaded', 'ct_save_screen_option' );
50
- function ct_save_screen_option() {
51
-
52
- // Saving screen option for the pagination (per page option)
53
- add_filter( 'set-screen-option', function( $status, $option, $value ){
54
- return ( $option == 'spam_per_page' ) ? (int) $value : $status;
55
- }, 10, 3 );
56
-
57
- }
 
 
1
+ <?php
2
+
3
+ require_once(CLEANTALK_PLUGIN_DIR . 'inc/find-spam/ClassCleantalkFindSpamPage.php');
4
+ require_once(CLEANTALK_PLUGIN_DIR . 'inc/find-spam/ClassCleantalkFindSpamChecker.php');
5
+ require_once(CLEANTALK_PLUGIN_DIR . 'inc/find-spam/ClassCleantalkFindSpamUsersChecker.php');
6
+ require_once(CLEANTALK_PLUGIN_DIR . 'inc/find-spam/ClassCleantalkFindSpamCommentsChecker.php');
7
+
8
+ // Adding menu items for USERS and COMMENTS spam checking pages
9
+ add_action( 'admin_menu', 'ct_add_find_spam_pages' );
10
+ function ct_add_find_spam_pages(){
11
+
12
+ // Check users pages
13
+ $ct_check_users = add_users_page( __( "Check for spam", 'cleantalk' ), __( "Find spam users", 'cleantalk' ), 'activate_plugins', 'ct_check_users', array( 'ClassCleantalkFindSpamPage', 'showFindSpamPage' ) );
14
+ $ct_check_users_total = add_users_page( __( "Total spam found", 'cleantalk' ), '', 'activate_plugins', 'ct_check_users_total', array( 'ClassCleantalkFindSpamPage', 'showFindSpamPage' ) );
15
+ $ct_check_users_logs = add_users_page( __( "Scan logs", 'cleantalk' ), '', 'activate_plugins', 'ct_check_users_logs', array( 'ClassCleantalkFindSpamPage', 'showFindSpamPage' ) );
16
+
17
+ // Cheack comments pages
18
+ $ct_check_spam = add_comments_page( __( "Check for spam", 'cleantalk' ), __( "Find spam comments", 'cleantalk' ), 'activate_plugins', 'ct_check_spam', array( 'ClassCleantalkFindSpamPage', 'showFindSpamPage' ) );
19
+ $ct_check_spam_total = add_comments_page( __( "Total spam found", 'cleantalk' ), '', 'activate_plugins', 'ct_check_spam_total', array( 'ClassCleantalkFindSpamPage', 'showFindSpamPage' ) );
20
+ $ct_check_spam_logs = add_comments_page( __( "Scan logs", 'cleantalk' ), '', 'activate_plugins', 'ct_check_spam_logs', array( 'ClassCleantalkFindSpamPage', 'showFindSpamPage' ) );
21
+
22
+ // Remove some pages from main menu
23
+ remove_submenu_page( 'users.php', 'ct_check_users_total' );
24
+ remove_submenu_page( 'users.php', 'ct_check_users_logs' );
25
+ remove_submenu_page( 'edit-comments.php', 'ct_check_spam_total' );
26
+ remove_submenu_page( 'edit-comments.php', 'ct_check_spam_logs' );
27
+
28
+ // Set screen option for every pages
29
+ add_action( "load-$ct_check_users", array( 'ClassCleantalkFindSpamPage', 'setScreenOption' ) );
30
+ add_action( "load-$ct_check_users_total", array( 'ClassCleantalkFindSpamPage', 'setScreenOption' ) );
31
+ add_action( "load-$ct_check_users_logs", array( 'ClassCleantalkFindSpamPage', 'setScreenOption' ) );
32
+ add_action( "load-$ct_check_spam", array( 'ClassCleantalkFindSpamPage', 'setScreenOption' ) );
33
+ add_action( "load-$ct_check_spam_total", array( 'ClassCleantalkFindSpamPage', 'setScreenOption' ) );
34
+ add_action( "load-$ct_check_spam_logs", array( 'ClassCleantalkFindSpamPage', 'setScreenOption' ) );
35
+
36
+ }
37
+
38
+ // Set AJAX actions
39
+ add_action( 'wp_ajax_ajax_clear_users', array( 'ClassCleantalkFindSpamUsersChecker', 'ct_ajax_clear_users' ) );
40
+ add_action( 'wp_ajax_ajax_check_users', array( 'ClassCleantalkFindSpamUsersChecker', 'ct_ajax_check_users' ) );
41
+ add_action( 'wp_ajax_ajax_info_users', array( 'ClassCleantalkFindSpamUsersChecker', 'ct_ajax_info' ) );
42
+ add_action( 'wp_ajax_ajax_ct_get_csv_file', array( 'ClassCleantalkFindSpamUsersChecker', 'ct_get_csv_file' ) );
43
+ add_action( 'wp_ajax_ajax_delete_all_users', array( 'ClassCleantalkFindSpamUsersChecker', 'ct_ajax_delete_all_users' ) );
44
+
45
+ add_action( 'wp_ajax_ajax_clear_comments', array( 'ClassCleantalkFindSpamCommentsChecker', 'ct_ajax_clear_comments' ) );
46
+ add_action( 'wp_ajax_ajax_check_comments', array( 'ClassCleantalkFindSpamCommentsChecker', 'ct_ajax_check_comments' ) );
47
+ add_action( 'wp_ajax_ajax_info_comments', array( 'ClassCleantalkFindSpamCommentsChecker', 'ct_ajax_info' ) );
48
+ add_action( 'wp_ajax_ajax_delete_all', array( 'ClassCleantalkFindSpamCommentsChecker', 'ct_ajax_delete_all' ) );
49
+
50
+ // Hook for saving "per_page" option
51
+ add_action( 'wp_loaded', 'ct_save_screen_option' );
52
+ function ct_save_screen_option() {
53
+
54
+ // Saving screen option for the pagination (per page option)
55
+ add_filter( 'set-screen-option', function( $status, $option, $value ){
56
+ return ( $option == 'spam_per_page' ) ? (int) $value : $status;
57
+ }, 10, 3 );
58
+
59
+ }
inc/cleantalk-pluggable.php CHANGED
@@ -1,288 +1,288 @@
1
- <?php
2
-
3
- /**
4
- * Getting current user by cookie
5
- *
6
- * @return WP_User|null
7
- */
8
- function apbct_wp_get_current_user(){
9
-
10
- global $apbct, $current_user;
11
-
12
- $user = null;
13
-
14
- if(!(defined('XMLRPC_REQUEST') && XMLRPC_REQUEST)){
15
-
16
- if(!empty($apbct->user)){
17
- $user_id = is_object($current_user) && isset($current_user->ID) && !($current_user instanceof WP_User)
18
- ? $current_user->ID
19
- : null;
20
- }else{
21
- $user_id = empty($user_id) && defined('LOGGED_IN_COOKIE') && !empty($_COOKIE[LOGGED_IN_COOKIE])
22
- ? apbct_wp_validate_auth_cookie($_COOKIE[LOGGED_IN_COOKIE], 'logged_in')
23
- : null;
24
- }
25
-
26
- if($user_id){
27
- $user = new WP_User($user_id);
28
- }
29
-
30
- }
31
-
32
- return $user ? $user : $current_user;
33
- }
34
-
35
- function apbct_wp_set_current_user($user = null){
36
-
37
- global $apbct;
38
-
39
- if( $user instanceof WP_User ){
40
- $apbct->user = $user;
41
- return true;
42
- }
43
-
44
- return false;
45
- }
46
-
47
- /**
48
- * Validates authentication cookie.
49
- *
50
- * The checks include making sure that the authentication cookie is set and
51
- * pulling in the contents (if $cookie is not used).
52
- *
53
- * Makes sure the cookie is not expired. Verifies the hash in cookie is what is
54
- * should be and compares the two.
55
- *
56
- * @param string $cookie Optional. If used, will validate contents instead of cookie's
57
- * @param string $scheme Optional. The cookie scheme to use: auth, secure_auth, or logged_in
58
- *
59
- * @return false|int False if invalid cookie, User ID if valid.
60
- * @global int $login_grace_period
61
- *
62
- */
63
- function apbct_wp_validate_auth_cookie( $cookie = '', $scheme = '' ) {
64
-
65
- $cookie_elements = apbct_wp_parse_auth_cookie($cookie, $scheme);
66
-
67
- $scheme = $cookie_elements['scheme'];
68
- $username = $cookie_elements['username'];
69
- $hmac = $cookie_elements['hmac'];
70
- $token = $cookie_elements['token'];
71
- $expiration = $cookie_elements['expiration'];
72
-
73
- // Allow a grace period for POST and Ajax requests
74
- $expired = apbct_is_ajax() || apbct_is_post()
75
- ? $expiration + HOUR_IN_SECONDS
76
- : $cookie_elements['expiration'];
77
-
78
- // Quick check to see if an honest cookie has expired
79
- if($expired >= time()){
80
- $user = apbct_wp_get_user_by('login', $username);
81
- if($user){
82
- $pass_frag = substr($user->user_pass, 8, 4);
83
- $key = apbct_wp_hash($username . '|' . $pass_frag . '|' . $expiration . '|' . $token, $scheme);
84
- // If ext/hash is not present, compat.php's hash_hmac() does not support sha256.
85
- $algo = function_exists('hash') ? 'sha256' : 'sha1';
86
- $hash = hash_hmac($algo, $username . '|' . $expiration . '|' . $token, $key);
87
- if(hash_equals($hash, $hmac)){
88
- $sessions = get_user_meta($user->ID, 'session_tokens', true);
89
- $sessions = current($sessions);
90
- if(is_array($sessions)){
91
- if(is_int($sessions['expiration']) && $sessions['expiration'] > time()){
92
- return $user->ID;
93
- }else
94
- return false;
95
- }else
96
- return false;
97
- }else
98
- return false;
99
- }else
100
- return false;
101
- }else
102
- return false;
103
- }
104
-
105
- /**
106
- * Gets user by filed
107
- *
108
- * @param $field
109
- * @param $value
110
- *
111
- * @return bool|WP_User
112
- */
113
- function apbct_wp_get_user_by($field, $value){
114
-
115
- $userdata = WP_User::get_data_by($field, $value);
116
-
117
- if(!$userdata)
118
- return false;
119
-
120
- $user = new WP_User;
121
- $user->init($userdata);
122
-
123
- return $user;
124
- }
125
-
126
- /**
127
- * Get hash of given string.
128
- *
129
- * @param string $data Plain text to hash
130
- * @param string $scheme Authentication scheme (auth, secure_auth, logged_in, nonce)
131
- * @return string Hash of $data
132
- */
133
- function apbct_wp_hash( $data, $scheme = 'auth' ) {
134
-
135
- $values = array(
136
- 'key' => '',
137
- 'salt' => '',
138
- );
139
-
140
- foreach(array('key', 'salt') as $type){
141
- $const = strtoupper( "{$scheme}_{$type}");
142
- if ( defined($const) && constant($const)){
143
- $values[$type] = constant($const);
144
- }elseif(!$values[$type]){
145
- $values[$type] = get_site_option( "{$scheme}_{$type}");
146
- if (!$values[$type]){
147
- $values[$type] = '';
148
- }
149
- }
150
- }
151
-
152
- $salt = $values['key'] . $values['salt'];
153
-
154
- return hash_hmac('md5', $data, $salt);
155
- }
156
-
157
- /**
158
- * Parse a cookie into its components
159
- *
160
- * @param string $cookie
161
- * @param string $scheme Optional. The cookie scheme to use: auth, secure_auth, or logged_in
162
- *
163
- * @return array|false Authentication cookie components
164
- *
165
- */
166
- function apbct_wp_parse_auth_cookie($cookie = '', $scheme = '')
167
- {
168
- $cookie_elements = explode('|', $cookie);
169
- if(count($cookie_elements) !== 4){
170
- return false;
171
- }
172
-
173
- list($username, $expiration, $token, $hmac) = $cookie_elements;
174
-
175
- return compact('username', 'expiration', 'token', 'hmac', 'scheme');
176
- }
177
-
178
- /**
179
- * Checks if the plugin is active
180
- *
181
- * @param string $plugin relative path from plugin folder like cleantalk-spam-protect/cleantalk.php
182
- *
183
- * @return bool
184
- */
185
- function apbct_is_plugin_active( $plugin ) {
186
- return in_array( $plugin, (array) get_option( 'active_plugins', array() ) ) || apbct_is_plugin_active_for_network( $plugin );
187
- }
188
-
189
- /**
190
- * Checks if the plugin is active for network
191
- *
192
- * @param string $plugin relative path from plugin folder like cleantalk-spam-protect/cleantalk.php
193
- *
194
- * @return bool
195
- */
196
- function apbct_is_plugin_active_for_network( $plugin ){
197
-
198
- if ( ! APBCT_WPMS )
199
- return false;
200
-
201
- $plugins = get_site_option( 'active_sitewide_plugins' );
202
-
203
- return isset( $plugins[ $plugin ] )
204
- ? true
205
- : false;
206
- }
207
-
208
- /**
209
- * Checks if the request is AJAX
210
- *
211
- * @return boolean
212
- */
213
- function apbct_is_ajax() {
214
-
215
- return
216
- (defined( 'DOING_AJAX' ) && DOING_AJAX) || // by standart WP functions
217
- (apbct_get_server_variable( 'HTTP_X_REQUESTED_WITH' ) && strtolower(apbct_get_server_variable( 'HTTP_X_REQUESTED_WITH' )) == 'xmlhttprequest') || // by Request type
218
- !empty($_POST['quform_ajax']) || // special. QForms
219
- !empty($_POST['iphorm_ajax']); // special. IPHorm
220
-
221
- }
222
-
223
- /**
224
- * Checks if the user is logged in
225
- *
226
- * @return bool
227
- */
228
- function apbct_is_user_logged_in(){
229
- $siteurl = get_site_option( 'siteurl' );
230
- $cookiehash = $siteurl ? md5( $siteurl ) : '';
231
- return count($_COOKIE) && isset($_COOKIE['wordpress_logged_in_'.$cookiehash]);
232
- }
233
-
234
- /*
235
- * GETTING SERVER VARIABLES BY VARIOUS WAYS
236
- */
237
- function apbct_get_server_variable( $server_variable_name ){
238
-
239
- $var_name = strtoupper( $server_variable_name );
240
-
241
- if( function_exists( 'filter_input' ) )
242
- $value = filter_input( INPUT_SERVER, $var_name );
243
-
244
- if( empty( $value ) )
245
- $value = isset( $_SERVER[ $var_name ] ) ? $_SERVER[ $var_name ] : '';
246
-
247
- // Convert to upper case for REQUEST_METHOD
248
- if( in_array( $server_variable_name, array( 'REQUEST_METHOD' ) ) )
249
- $value = strtoupper( $value );
250
-
251
- // Convert HTML chars for HTTP_USER_AGENT, HTTP_USER_AGENT, SERVER_NAME
252
- if( in_array( $server_variable_name, array( 'HTTP_USER_AGENT', 'HTTP_USER_AGENT', 'SERVER_NAME' ) ) )
253
- $value = htmlspecialchars( $value );
254
-
255
- return $value;
256
- }
257
-
258
- function apbct_is_post(){
259
- return apbct_get_server_variable('REQUEST_METHOD') === 'POST';
260
- }
261
-
262
- function apbct_is_get(){
263
- return apbct_get_server_variable('REQUEST_METHOD') === 'GET';
264
- }
265
-
266
- function apbct_is_in_referer( $str ){
267
- return stripos( apbct_get_server_variable('HTTP_REFERER'), $str ) !== false;
268
- }
269
-
270
- function apbct_is_in_uri( $str ){
271
- return stripos( apbct_get_server_variable('REQUEST_URI'), $str ) !== false;
272
- }
273
-
274
- /*
275
- * Checking if current request is a cron job
276
- * Support for wordpress < 4.8.0
277
- *
278
- * @return bool
279
- */
280
- function apbct_wp_doing_cron() {
281
-
282
- if( function_exists( 'wp_doing_cron' ) ) {
283
- return wp_doing_cron();
284
- } else {
285
- return ( defined( 'DOING_CRON' ) && DOING_CRON );
286
- }
287
-
288
  }
1
+ <?php
2
+
3
+ /**
4
+ * Getting current user by cookie
5
+ *
6
+ * @return WP_User|null
7
+ */
8
+ function apbct_wp_get_current_user(){
9
+
10
+ global $apbct, $current_user;
11
+
12
+ $user = null;
13
+
14
+ if(!(defined('XMLRPC_REQUEST') && XMLRPC_REQUEST)){
15
+
16
+ if(!empty($apbct->user)){
17
+ $user_id = is_object($current_user) && isset($current_user->ID) && !($current_user instanceof WP_User)
18
+ ? $current_user->ID
19
+ : null;
20
+ }else{
21
+ $user_id = empty($user_id) && defined('LOGGED_IN_COOKIE') && !empty($_COOKIE[LOGGED_IN_COOKIE])
22
+ ? apbct_wp_validate_auth_cookie($_COOKIE[LOGGED_IN_COOKIE], 'logged_in')
23
+ : null;
24
+ }
25
+
26
+ if($user_id){
27
+ $user = new WP_User($user_id);
28
+ }
29
+
30
+ }
31
+
32
+ return $user ? $user : $current_user;
33
+ }
34
+
35
+ function apbct_wp_set_current_user($user = null){
36
+
37
+ global $apbct;
38
+
39
+ if( $user instanceof WP_User ){
40
+ $apbct->user = $user;
41
+ return true;
42
+ }
43
+
44
+ return false;
45
+ }
46
+
47
+ /**
48
+ * Validates authentication cookie.
49
+ *
50
+ * The checks include making sure that the authentication cookie is set and
51
+ * pulling in the contents (if $cookie is not used).
52
+ *
53
+ * Makes sure the cookie is not expired. Verifies the hash in cookie is what is
54
+ * should be and compares the two.
55
+ *
56
+ * @param string $cookie Optional. If used, will validate contents instead of cookie's
57
+ * @param string $scheme Optional. The cookie scheme to use: auth, secure_auth, or logged_in
58
+ *
59
+ * @return false|int False if invalid cookie, User ID if valid.
60
+ * @global int $login_grace_period
61
+ *
62
+ */
63
+ function apbct_wp_validate_auth_cookie( $cookie = '', $scheme = '' ) {
64
+
65
+ $cookie_elements = apbct_wp_parse_auth_cookie($cookie, $scheme);
66
+
67
+ $scheme = $cookie_elements['scheme'];
68
+ $username = $cookie_elements['username'];
69
+ $hmac = $cookie_elements['hmac'];
70
+ $token = $cookie_elements['token'];
71
+ $expiration = $cookie_elements['expiration'];
72
+
73
+ // Allow a grace period for POST and Ajax requests
74
+ $expired = apbct_is_ajax() || apbct_is_post()
75
+ ? $expiration + HOUR_IN_SECONDS
76
+ : $cookie_elements['expiration'];
77
+
78
+ // Quick check to see if an honest cookie has expired
79
+ if($expired >= time()){
80
+ $user = apbct_wp_get_user_by('login', $username);
81
+ if($user){
82
+ $pass_frag = substr($user->user_pass, 8, 4);
83
+ $key = apbct_wp_hash($username . '|' . $pass_frag . '|' . $expiration . '|' . $token, $scheme);
84
+ // If ext/hash is not present, compat.php's hash_hmac() does not support sha256.
85
+ $algo = function_exists('hash') ? 'sha256' : 'sha1';
86
+ $hash = hash_hmac($algo, $username . '|' . $expiration . '|' . $token, $key);
87
+ if(hash_equals($hash, $hmac)){
88
+ $sessions = get_user_meta($user->ID, 'session_tokens', true);
89
+ $sessions = current($sessions);
90
+ if(is_array($sessions)){
91
+ if(is_int($sessions['expiration']) && $sessions['expiration'] > time()){
92
+ return $user->ID;
93
+ }else
94
+ return false;
95
+ }else
96
+ return false;
97
+ }else
98
+ return false;
99
+ }else
100
+ return false;
101
+ }else
102
+ return false;
103
+ }
104
+
105
+ /**
106
+ * Gets user by filed
107
+ *
108
+ * @param $field
109
+ * @param $value
110
+ *
111
+ * @return bool|WP_User
112
+ */
113
+ function apbct_wp_get_user_by($field, $value){
114
+
115
+ $userdata = WP_User::get_data_by($field, $value);
116
+
117
+ if(!$userdata)
118
+ return false;
119
+
120
+ $user = new WP_User;
121
+ $user->init($userdata);
122
+
123
+ return $user;
124
+ }
125
+
126
+ /**
127
+ * Get hash of given string.
128
+ *
129
+ * @param string $data Plain text to hash
130
+ * @param string $scheme Authentication scheme (auth, secure_auth, logged_in, nonce)
131
+ * @return string Hash of $data
132
+ */
133
+ function apbct_wp_hash( $data, $scheme = 'auth' ) {
134
+
135
+ $values = array(
136
+ 'key' => '',
137
+ 'salt' => '',
138
+ );
139
+
140
+ foreach(array('key', 'salt') as $type){
141
+ $const = strtoupper( "{$scheme}_{$type}");
142
+ if ( defined($const) && constant($const)){
143
+ $values[$type] = constant($const);
144
+ }elseif(!$values[$type]){
145
+ $values[$type] = get_site_option( "{$scheme}_{$type}");
146
+ if (!$values[$type]){
147
+ $values[$type] = '';
148
+ }
149
+ }
150
+ }
151
+
152
+ $salt = $values['key'] . $values['salt'];
153
+
154
+ return hash_hmac('md5', $data, $salt);
155
+ }
156
+
157
+ /**
158
+ * Parse a cookie into its components
159
+ *
160
+ * @param string $cookie
161
+ * @param string $scheme Optional. The cookie scheme to use: auth, secure_auth, or logged_in
162
+ *
163
+ * @return array|false Authentication cookie components
164
+ *
165
+ */
166
+ function apbct_wp_parse_auth_cookie($cookie = '', $scheme = '')
167
+ {
168
+ $cookie_elements = explode('|', $cookie);
169
+ if(count($cookie_elements) !== 4){
170
+ return false;
171
+ }
172
+
173
+ list($username, $expiration, $token, $hmac) = $cookie_elements;
174
+
175
+ return compact('username', 'expiration', 'token', 'hmac', 'scheme');
176
+ }
177
+
178
+ /**
179
+ * Checks if the plugin is active
180
+ *
181
+ * @param string $plugin relative path from plugin folder like cleantalk-spam-protect/cleantalk.php
182
+ *
183
+ * @return bool
184
+ */
185
+ function apbct_is_plugin_active( $plugin ) {
186
+ return in_array( $plugin, (array) get_option( 'active_plugins', array() ) ) || apbct_is_plugin_active_for_network( $plugin );
187
+ }
188
+
189
+ /**
190
+ * Checks if the plugin is active for network
191
+ *
192
+ * @param string $plugin relative path from plugin folder like cleantalk-spam-protect/cleantalk.php
193
+ *
194
+ * @return bool
195
+ */
196
+ function apbct_is_plugin_active_for_network( $plugin ){
197
+
198
+ if ( ! APBCT_WPMS )
199
+ return false;
200
+
201
+ $plugins = get_site_option( 'active_sitewide_plugins' );
202
+
203
+ return isset( $plugins[ $plugin ] )
204
+ ? true
205
+ : false;
206
+ }
207
+
208
+ /**
209
+ * Checks if the request is AJAX
210
+ *
211
+ * @return boolean
212
+ */
213
+ function apbct_is_ajax() {
214
+
215
+ return
216
+ (defined( 'DOING_AJAX' ) && DOING_AJAX) || // by standart WP functions
217
+ (apbct_get_server_variable( 'HTTP_X_REQUESTED_WITH' ) && strtolower(apbct_get_server_variable( 'HTTP_X_REQUESTED_WITH' )) == 'xmlhttprequest') || // by Request type
218
+ !empty($_POST['quform_ajax']) || // special. QForms
219
+ !empty($_POST['iphorm_ajax']); // special. IPHorm
220
+
221
+ }
222
+
223
+ /**
224
+ * Checks if the user is logged in
225
+ *
226
+ * @return bool
227
+ */
228
+ function apbct_is_user_logged_in(){
229
+ $siteurl = get_site_option( 'siteurl' );
230
+ $cookiehash = $siteurl ? md5( $siteurl ) : '';
231
+ return count($_COOKIE) && isset($_COOKIE['wordpress_logged_in_'.$cookiehash]);
232
+ }
233
+
234
+ /*
235
+ * GETTING SERVER VARIABLES BY VARIOUS WAYS
236
+ */
237
+ function apbct_get_server_variable( $server_variable_name ){
238
+
239
+ $var_name = strtoupper( $server_variable_name );
240
+
241
+ if( function_exists( 'filter_input' ) )
242
+ $value = filter_input( INPUT_SERVER, $var_name );
243
+
244
+ if( empty( $value ) )
245
+ $value = isset( $_SERVER[ $var_name ] ) ? $_SERVER[ $var_name ] : '';
246
+
247
+ // Convert to upper case for REQUEST_METHOD
248
+ if( in_array( $server_variable_name, array( 'REQUEST_METHOD' ) ) )
249
+ $value = strtoupper( $value );
250
+
251
+ // Convert HTML chars for HTTP_USER_AGENT, HTTP_USER_AGENT, SERVER_NAME
252
+ if( in_array( $server_variable_name, array( 'HTTP_USER_AGENT', 'HTTP_USER_AGENT', 'SERVER_NAME' ) ) )
253
+ $value = htmlspecialchars( $value );
254
+
255
+ return $value;
256
+ }
257
+
258
+ function apbct_is_post(){
259
+ return apbct_get_server_variable('REQUEST_METHOD') === 'POST';
260
+ }
261
+
262
+ function apbct_is_get(){
263
+ return apbct_get_server_variable('REQUEST_METHOD') === 'GET';
264
+ }
265
+
266
+ function apbct_is_in_referer( $str ){
267
+ return stripos( apbct_get_server_variable('HTTP_REFERER'), $str ) !== false;
268
+ }
269
+
270
+ function apbct_is_in_uri( $str ){
271
+ return stripos( apbct_get_server_variable('REQUEST_URI'), $str ) !== false;
272
+ }
273
+
274
+ /*
275
+ * Checking if current request is a cron job
276
+ * Support for wordpress < 4.8.0
277
+ *
278
+ * @return bool
279
+ */
280
+ function apbct_wp_doing_cron() {
281
+
282
+ if( function_exists( 'wp_doing_cron' ) ) {
283
+ return wp_doing_cron();
284
+ } else {
285
+ return ( defined( 'DOING_CRON' ) && DOING_CRON );
286
+ }
287
+
288
  }
inc/cleantalk-public.php CHANGED
@@ -1,3609 +1,3613 @@
1
- <?php
2
-
3
- /**
4
- * Init functions
5
- * @return mixed[] Array of options
6
- */
7
- function apbct_init() {
8
-
9
- global $ct_wplp_result_label, $ct_jp_comments, $ct_post_data_label, $ct_post_data_authnet_label, $apbct, $test_external_forms, $cleantalk_executed, $wpdb;
10
-
11
- //Check internal forms with such "action" http://wordpress.loc/contact-us/some_script.php
12
- if((isset($_POST['action']) && $_POST['action'] == 'ct_check_internal') &&
13
- $apbct->settings['check_internal']
14
- ){
15
- $ct_result = ct_contact_form_validate();
16
- if($ct_result == null){
17
- echo 'true';
18
- die();
19
- }else{
20
- echo $ct_result;
21
- die();
22
- }
23
- }
24
-
25
- //fix for EPM registration form
26
- if(isset($_POST) && isset($_POST['reg_email']) && shortcode_exists( 'epm_registration_form' ))
27
- {
28
- unset($_POST['ct_checkjs_register_form']);
29
- }
30
-
31
- if(isset($_POST['_wpnonce-et-pb-contact-form-submitted']))
32
- {
33
- add_shortcode( 'et_pb_contact_form', 'ct_contact_form_validate' );
34
- }
35
-
36
- if($apbct->settings['check_external']){
37
-
38
- // Fixing form and directs it this site
39
- if($apbct->settings['check_external__capture_buffer'] && !is_admin() && !apbct_is_ajax() && apbct_is_user_enable() && !(defined('DOING_CRON') && DOING_CRON) && !(defined('XMLRPC_REQUEST') && XMLRPC_REQUEST)){
40
- add_action('wp', 'apbct_buffer__start');
41
- add_action('shutdown', 'apbct_buffer__end', 0);
42
- add_action('shutdown', 'apbct_buffer__output', 2);
43
- }
44
-
45
- // Check and redirecct
46
- if( apbct_is_post()
47
- && isset($_POST['cleantalk_hidden_method'])
48
- && isset($_POST['cleantalk_hidden_action'])
49
- ){
50
- $action = htmlspecialchars($_POST['cleantalk_hidden_action']);
51
- $method = htmlspecialchars($_POST['cleantalk_hidden_method']);
52
- unset($_POST['cleantalk_hidden_action']);
53
- unset($_POST['cleantalk_hidden_method']);
54
- ct_contact_form_validate();
55
- if(!apbct_is_ajax()){
56
- print "<html><body><form method='$method' action='$action'>";
57
- ct_print_form($_POST, '');
58
- print "</form></body></html>";
59
- print "<script>
60
- if(document.forms[0].submit !== 'undefined'){
61
- var objects = document.getElementsByName('submit');
62
- if(objects.length > 0)
63
- document.forms[0].removeChild(objects[0]);
64
- }
65
- document.forms[0].submit();
66
- </script>";
67
- die();
68
- }
69
- }
70
- }
71
-
72
- if(isset($_POST['quform_ajax'], $_POST['quform_csrf_token'], $_POST['quform_form_id'])){
73
- require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-ajax.php');
74
- ct_ajax_hook();
75
- }
76
-
77
- /**hooks for cm answers pro */
78
- if(defined('CMA_PLUGIN_FILE')){
79
- add_action( 'wp', 'ct_ajax_hook',1 );
80
- }
81
-
82
- //hook for Anonymous Post
83
- if($apbct->settings['general_postdata_test'] == 1 && empty($_POST['ct_checkjs_cf7']))
84
- add_action('wp', 'ct_contact_form_validate_postdata',1);
85
-
86
- if($apbct->settings['general_contact_forms_test'] == 1 && empty($_POST['ct_checkjs_cf7'])){
87
- add_action('CMA_custom_post_type_nav', 'ct_contact_form_validate_postdata',1);
88
- //add_action('init','ct_contact_form_validate',1);
89
- ct_contact_form_validate();
90
- if(isset($_POST['reg_redirect_link'])&&isset($_POST['tmpl_registration_nonce_field']))
91
- {
92
- unset($_POST['ct_checkjs_register_form']);
93
- ct_contact_form_validate();
94
- }
95
- /*if(isset($_GET['ait-action'])&&$_GET['ait-action']=='register')
96
- {
97
- $tmp=$_POST['redirect_to'];
98
- unset($_POST['redirect_to']);
99
- ct_contact_form_validate();
100
- $_POST['redirect_to']=$tmp;
101
- }*/
102
- }
103
-
104
- if($apbct->settings['general_postdata_test'] == 1 && empty($_POST['ct_checkjs_cf7']))
105
- add_action('CMA_custom_post_type_nav', 'ct_contact_form_validate_postdata',1);
106
-
107
- //add_action('wp_footer','ct_ajaxurl');
108
-
109
- // Fast Secure contact form
110
- if(defined('FSCF_VERSION')){
111
- add_filter('si_contact_display_after_fields', 'ct_si_contact_display_after_fields');
112
- add_filter('si_contact_form_validate', 'ct_si_contact_form_validate');
113
- }
114
-
115
- // WooCommerce registration
116
- if(class_exists('WooCommerce')){
117
- add_filter( 'woocommerce_registration_errors', 'ct_registration_errors', 1, 3 );
118
- if ($apbct->settings['wc_checkout_test'] == 1) {
119
- add_filter('woocommerce_checkout_process', 'ct_woocommerce_checkout_check', 1, 3);
120
- }
121
- if( isset($_REQUEST['wc-ajax']) && $_REQUEST['wc-ajax'] == 'checkout' && $apbct->settings['wc_checkout_test'] == 0 && $apbct->settings['wc_register_from_order'] == 0 ){
122
- remove_filter( 'woocommerce_registration_errors', 'ct_registration_errors', 1 );
123
- }
124
- }
125
-
126
- // WooCommerce whishlist
127
- if(class_exists('WC_Wishlists_Wishlist'))
128
- add_filter('wc_wishlists_create_list_args', 'ct_woocommerce_wishlist_check', 1, 1);
129
-
130
-
131
- // JetPack Contact form
132
- $jetpack_active_modules = false;
133
- if(defined('JETPACK__VERSION'))
134
- {
135
- if(isset($_POST['action']) && $_POST['action'] == 'grunion-contact-form' ){
136
- if(JETPACK__VERSION=='3.4-beta')
137
- {
138
- add_filter('contact_form_is_spam', 'ct_contact_form_is_spam');
139
- }
140
- else if(JETPACK__VERSION=='3.4-beta2'||JETPACK__VERSION>='3.4')
141
- {
142
- add_filter('jetpack_contact_form_is_spam', 'ct_contact_form_is_spam_jetpack',50,2);
143
- }
144
- else
145
- {
146
- add_filter('contact_form_is_spam', 'ct_contact_form_is_spam');
147
- }
148
- $jetpack_active_modules = get_option('jetpack_active_modules');
149
- if ((class_exists( 'Jetpack', false) && $jetpack_active_modules && in_array('comments', $jetpack_active_modules)))
150
- {
151
- $ct_jp_comments = true;
152
- }
153
- }else
154
- add_filter('grunion_contact_form_field_html', 'ct_grunion_contact_form_field_html', 10, 2);
155
- }
156
-
157
- // WP Maintenance Mode (wpmm)
158
- add_action('wpmm_head', 'apbct_form__wpmm__addField', 1);
159
-
160
- // Contact Form7
161
- if(defined('WPCF7_VERSION')){
162
- add_filter('wpcf7_form_elements', 'apbct_form__contactForm7__addField');
163
- add_filter('wpcf7_validate', 'apbct_form__contactForm7__tesSpam__before_validate', 999, 2);
164
- add_filter(WPCF7_VERSION >= '3.0.0' ? 'wpcf7_spam' : 'wpcf7_acceptance', 'apbct_form__contactForm7__testSpam');
165
- }
166
-
167
- // Formidable
168
- add_filter( 'frm_entries_before_create', 'apbct_rorm__formidable__testSpam', 10, 2 );
169
- add_action( 'frm_entries_footer_scripts', 'apbct_rorm__formidable__footerScripts', 20, 2 );
170
-
171
- // BuddyPress
172
- if(class_exists('BuddyPress')){
173
- add_action('bp_before_registration_submit_buttons','ct_register_form',1);
174
- add_action('messages_message_before_save', 'apbct_integration__buddyPres__private_msg_check', 1);
175
- add_filter('bp_signup_validate', 'ct_registration_errors',1);
176
- add_filter('bp_signup_validate', 'ct_check_registration_erros', 999999);
177
- }
178
-
179
- if(defined('PROFILEPRESS_SYSTEM_FILE_PATH')){
180
- add_filter('pp_registration_validation', 'ct_registration_errors_ppress', 11, 2);
181
- }
182
-
183
-
184
- // bbPress
185
- if(class_exists('bbPress')){
186
- add_filter('bbp_new_topic_pre_title', 'ct_bbp_get_topic', 1);
187
- add_filter('bbp_new_topic_pre_content', 'ct_bbp_new_pre_content', 1);
188
- add_filter('bbp_new_reply_pre_content', 'ct_bbp_new_pre_content', 1);
189
- add_action('bbp_theme_before_topic_form_content', 'ct_comment_form');
190
- add_action('bbp_theme_before_reply_form_content', 'ct_comment_form');
191
- }
192
-
193
- //Custom Contact Forms
194
- if(defined('CCF_VERSION'))
195
- add_filter('ccf_field_validator', 'ct_ccf', 1, 4);
196
-
197
- add_action('comment_form', 'ct_comment_form');
198
-
199
- // intercept WordPress Landing Pages POST
200
- if (defined('LANDINGPAGES_CURRENT_VERSION') && !empty($_POST)){
201
- if(array_key_exists('action', $_POST) && $_POST['action'] === 'inbound_store_lead'){ // AJAX action(s)
202
- ct_check_wplp();
203
- }else if(array_key_exists('inbound_submitted', $_POST) && $_POST['inbound_submitted'] == '1'){ // Final submit
204
- ct_check_wplp();
205
- }
206
- }
207
-
208
- // S2member. intercept POST
209
- if (defined('WS_PLUGIN__S2MEMBER_PRO_VERSION')){
210
- $post_keys = array_keys($_POST);
211
- foreach($post_keys as $post_key){
212
-
213
- // Detect POST keys like /s2member_pro.*registration/
214
- if(strpos($post_key, 's2member') !== false && strpos($post_key, 'registration') !== false){
215
- ct_s2member_registration_test($post_key);
216
- break;
217
- }
218
- }
219
- }
220
-
221
- // New user approve hack
222
- // https://wordpress.org/plugins/new-user-approve/
223
- if (ct_plugin_active('new-user-approve/new-user-approve.php')) {
224
- add_action('register_post', 'ct_register_post', 1, 3);
225
- }
226
-
227
- // Wilcity theme registration validation fix
228
- add_filter( 'wilcity/filter/wiloke-listing-tools/validate-before-insert-account', 'apbct_wilcity_reg_validation', 10, 2 );
229
-
230
-
231
- // Gravity forms
232
- if (defined('GF_MIN_WP_VERSION')) {
233
- add_filter('gform_get_form_filter', 'apbct_form__gravityForms__addField', 10, 2);
234
- add_filter('gform_entry_is_spam', 'apbct_form__gravityForms__testSpam', 999, 3);
235
- add_filter('gform_confirmation', 'apbct_form__gravityForms__showResponse', 999, 4 );
236
- }
237
-
238
- //Pirate forms
239
- if(defined('PIRATE_FORMS_VERSION')){
240
- if(isset($_POST['pirate-forms-contact-name']) && $_POST['pirate-forms-contact-name'] && isset($_POST['pirate-forms-contact-email']) && $_POST['pirate-forms-contact-email'])
241
- apbct_form__piratesForm__testSpam();
242
- }
243
-
244
- // WPForms
245
- // Adding fields
246
- add_action('wpforms_frontend_output', 'apbct_form__WPForms__addField', 1000, 5);
247
- // Gathering data to validate
248
- add_filter('wpforms_process_before_filter', 'apbct_from__WPForms__gatherData', 100, 2);
249
- // Do spam check
250
- add_filter('wpforms_process_initial_errors', 'apbct_form__WPForms__showResponse', 100, 2);
251
-
252
- // QForms integration
253
- add_filter( 'quform_post_validate', 'ct_quform_post_validate', 10, 2 );
254
-
255
- // Ultimate Members
256
- if (class_exists('UM')) {
257
- add_action('um_main_register_fields','ct_register_form',100); // Add hidden fileds
258
- add_action( 'um_submit_form_register', 'apbct_registration__UltimateMembers__check', 9, 1 ); // Check submition
259
- }
260
-
261
- // Paid Memberships Pro integration
262
- add_filter( 'pmpro_required_user_fields', function( $pmpro_required_user_fields ){
263
-
264
- if(
265
- ! empty( $pmpro_required_user_fields['username'] ) &&
266
- ! empty( $pmpro_required_user_fields['bemail'] ) &&
267
- ! empty( $pmpro_required_user_fields['bconfirmemail'] ) &&
268
- $pmpro_required_user_fields['bemail'] == $pmpro_required_user_fields['bconfirmemail']
269
- ) {
270
- $check = ct_test_registration( $pmpro_required_user_fields['username'], $pmpro_required_user_fields['bemail'], apbct_get_server_variable( 'REMOTE_ADDR' ) );
271
- if( $check['allow'] == 0 ) {
272
- pmpro_setMessage( $check['comment'], 'pmpro_error' );
273
- }
274
- }
275
-
276
- return $pmpro_required_user_fields;
277
-
278
- } );
279
-
280
- //
281
- // Load JS code to website footer
282
- //
283
- if (!(defined( 'DOING_AJAX' ) && DOING_AJAX)) {
284
- add_action('wp_head', 'apbct_hook__wp_head__set_cookie__ct_checkjs', 1);
285
- add_action('wp_footer', 'apbct_hook__wp_footer', 1);
286
- }
287
-
288
- if ($apbct->settings['protect_logged_in'] != 1 && is_user_logged_in()) {
289
- ct_contact_form_validate();
290
- }
291
-
292
- if (apbct_is_user_enable()) {
293
-
294
- if ($apbct->settings['general_contact_forms_test'] == 1 && !isset($_POST['comment_post_ID']) && !isset($_GET['for'])){
295
- add_action( 'init', 'ct_contact_form_validate', 999 );
296
- }
297
- if( apbct_is_post() &&
298
- $apbct->settings['general_postdata_test'] == 1 &&
299
- !isset($_POST['ct_checkjs_cf7']) &&
300
- !is_admin() &&
301
- !apbct_is_user_role_in(array('administrator', 'moderator'))
302
- ){
303
- ct_contact_form_validate_postdata();
304
- }
305
- }
306
- }
307
-
308
- function apbct_buffer__start(){
309
- ob_start();
310
- }
311
-
312
- function apbct_buffer__end(){
313
-
314
- if(!ob_get_level())
315
- return;
316
-
317
- global $apbct;
318
- $apbct->buffer = ob_get_contents();
319
- ob_end_clean();
320
- }
321
-
322
- /**
323
- * Outputs changed buffer
324
- *
325
- * @global $apbct
326
- */
327
- function apbct_buffer__output(){
328
-
329
- global $apbct;
330
-
331
- if(empty($apbct->buffer))
332
- return;
333
-
334
- $site_url = get_option('siteurl');
335
- $site__host = parse_url($site_url, PHP_URL_HOST);
336
-
337
- $dom = new DOMDocument();
338
- @$dom->loadHTML($apbct->buffer);
339
-
340
- $forms = $dom->getElementsByTagName('form');
341
-
342
- foreach($forms as $form){
343
-
344
- $action = $form->getAttribute('action');
345
- $action = $action ? $action : $site_url;
346
- $action__host = parse_url($action, PHP_URL_HOST);
347
-
348
- // Check if the form directed to the third party site
349
- if($site__host != $action__host){
350
-
351
- $method = $form->getAttribute('method');
352
- $method = $method ? $method : 'get';
353
- // Directs form to our site
354
- $form->setAttribute('method', 'POST');
355
- $form->setAttribute('action', $site_url);
356
-
357
- // Add cleantalk_hidden_action
358
- $new_input = $dom->createElement('input');
359
- $new_input->setAttribute('type', 'hidden');
360
- $new_input->setAttribute('name', 'cleantalk_hidden_action');
361
- $new_input->setAttribute('value', $action);
362
- $form->appendChild($new_input);
363
-
364
- // Add cleantalk_hidden_method
365
- $new_input = $dom->createElement('input');
366
- $new_input->setAttribute('type', 'hidden');
367
- $new_input->setAttribute('name', 'cleantalk_hidden_method');
368
- $new_input->setAttribute('value', $method);
369
- $form->appendChild($new_input);
370
-
371
- }
372
- } unset($form);
373
-
374
- $html = $dom->getElementsByTagName('html');
375
-
376
- echo gettype($html) == 'object' && !isset( $html[0], $html[0]->childNodes, $html[0]->childNodes[0] )
377
- ? $html[0]
378
- ->childNodes[0]
379
- ->ownerDocument
380
- ->saveHTML()
381
- : $apbct->buffer;
382
- }
383
-
384
- // MailChimp Premium for Wordpress
385
- function ct_add_mc4wp_error_message($messages){
386
-
387
- $messages['ct_mc4wp_response'] = array(
388
- 'type' => 'error',
389
- 'text' => 'Your message looks like spam.'
390
- );
391
- return $messages;
392
- }
393
- add_filter( 'mc4wp_form_messages', 'ct_add_mc4wp_error_message' );
394
-
395
- /*
396
- * Function to set validate fucntion for CCF form
397
- * Input - Сonsistently each form field
398
- * Returns - String. Validate function
399
- */
400
- function ct_ccf($callback, $value, $field_id, $type){
401
- /*
402
- if($type == 'name')
403
- $ct_global_temporary_data['name'] = $value;
404
- elseif($type == 'email')
405
- $ct_global_temporary_data['email'] = $value;
406
- else
407
- $ct_global_temporary_data[] = $value;
408
- //*/
409
- return 'ct_validate_ccf_submission';
410
- }
411
- /*
412
- * Validate function for CCF form. Gatheering data. Multiple calls.
413
- * Input - void. Global $ct_global_temporary_data
414
- * Returns - String. CleanTalk comment.
415
- */
416
- $ct_global_temporary_data = array();
417
- function ct_validate_ccf_submission($value, $field_id, $required){
418
- global $ct_global_temporary_data, $apbct;
419
-
420
-
421
-
422
- //If the check for contact forms enabled
423
- if(!$apbct->settings['contact_forms_test'])
424
- return true;
425
- //If the check for logged in users enabled
426
- if($apbct->settings['protect_logged_in'] == 1 && is_user_logged_in())
427
- return true;
428
-
429
- //Accumulate data
430
- $ct_global_temporary_data[] = $value;
431
-
432
- //If it's the last field of the form
433
- (!isset($ct_global_temporary_data['count']) ? $ct_global_temporary_data['count'] = 1 : $ct_global_temporary_data['count']++);
434
- $form_id = $_POST['form_id'];
435
- if($ct_global_temporary_data['count'] != count(get_post_meta( $form_id, 'ccf_attached_fields', true )))
436
- return true;
437
- unset($ct_global_temporary_data['count']);
438
-
439
- //Getting request params
440
- $ct_temp_msg_data = ct_get_fields_any($_POST);
441
-
442
- unset($ct_global_temporary_data);
443
-
444
- $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
445
- $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
446
- $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
447
- $contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
448
- $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
449
-
450
- if ($subject != '')
451
- $message['subject'] = $subject;
452
-
453
- $post_info['comment_type'] = 'feedback_custom_contact_forms';
454
- $post_info['post_url'] = apbct_get_server_variable( 'HTTP_REFERER' );
455
-
456
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE)
457
- ? apbct_js_test('ct_checkjs', $_COOKIE)
458
- : apbct_js_test('ct_checkjs', $_POST);
459
-
460
- //Making a call
461
- $base_call_result = apbct_base_call(
462
- array(
463
- 'message' => $message,
464
- 'sender_email' => $sender_email,
465
- 'sender_nickname' => $sender_nickname,
466
- 'post_info' => $post_info,
467
- 'js_on' => $checkjs,
468
- 'sender_info' => array('sender_url' => null),
469
- )
470
- );
471
-
472
- $ct_result = $base_call_result['ct_result'];
473
-
474
- return $ct_result->allow == 0 ? $ct_result->comment : true;;
475
- }
476
-
477
- function ct_woocommerce_wishlist_check($args){
478
- global $apbct;
479
-
480
-
481
-
482
- //Protect logged in users
483
- if($args['wishlist_status'])
484
- if($apbct->settings['protect_logged_in'] == 0)
485
- return $args;
486
-
487
- //If the IP is a Google bot
488
- $hostname = gethostbyaddr( apbct_get_server_variable( 'REMOTE_ADDR' ) );
489
- if(!strpos($hostname, 'googlebot.com'))
490
- return $args;
491
-
492
- //Getting request params
493
- $message = '';
494
- $subject = '';
495
- $email = $args['wishlist_owner_email'];
496
- if($args['wishlist_first_name']!='' || $args['wishlist_last_name']!='')
497
- $nickname = trim($args['wishlist_first_name']." ".$args['wishlist_last_name']);
498
- else
499
- $nickname = '';
500
-
501
- $post_info['comment_type'] = 'feedback';
502
- $post_info['post_url'] = apbct_get_server_variable( 'HTTP_REFERER' );
503
-
504
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE)
505
- ? apbct_js_test('ct_checkjs', $_COOKIE)
506
- : apbct_js_test('ct_checkjs', $_POST);
507
-
508
- //Making a call
509
- $base_call_result = apbct_base_call(
510
- array(
511
- 'message' => $subject." ".$message,
512
- 'sender_email' => $email,
513
- 'sender_nickname' => $nickname,
514
- 'post_info' => $post_info,
515
- 'js_on' => $checkjs,
516
- 'sender_info' => array('sender_url' => null),
517
- )
518
- );
519
-
520
- $ct_result = $base_call_result['ct_result'];
521
-
522
- if ($ct_result->allow == 0)
523
- wp_die("<h1>".__('Spam protection by CleanTalk', 'cleantalk')."</h1><h2>".$ct_result->comment."</h2>", '', array('response' => 403, "back_link" => true, "text_direction" => 'ltr'));
524
- else
525
- return $args;
526
- }
527
-
528
- function apbct_integration__buddyPres__getTemplateName( $located, $template_name, $template_names, $template_locations, $load, $require_once ) {
529
- global $apbct;
530
- preg_match("/\/([a-z-_]+)\/buddypress-functions\.php$/", $located, $matches);
531
- $apbct->buddy_press_tmpl = isset($matches[1]) ? $matches[1] : 'unknown';
532
- }
533
-
534
- /**
535
- * Test BuddyPress activity for spam (post update only)
536
- *
537
- * @global SpbcState $apbct
538
- * @param bool $is_spam
539
- * @param BP_Activity_Activity $activity_obj Activity object (\plugins\buddypress\bp-activity\classes\class-bp-activity-activity.php)
540
- * @return boolean Spam flag
541
- */
542
- function apbct_integration__buddyPres__activityWall( $is_spam, $activity_obj = null ){
543
-
544
- global $apbct;
545
-
546
- if($activity_obj === null || $activity_obj->privacy == 'media' || !isset($_POST['action']) || $_POST['action'] && $_POST['action'] !== 'post_update')
547
- return;
548
-
549
- $curr_user = get_user_by('id', $activity_obj->user_id);
550
-
551
- //Making a call
552
- $base_call_result = apbct_base_call(
553
- array(
554
- 'message' => is_string($activity_obj->content) ? $activity_obj->content : '',
555
- 'sender_email' => $curr_user->data->user_email,
556
- 'sender_nickname' => $curr_user->data->user_login,
557
- 'post_info' => array(
558
- 'post_url' => apbct_get_server_variable( 'HTTP_REFERER' ),
559
- 'comment_type' => 'buddypress_activitywall',
560
- ),
561
- 'js_on' => apbct_js_test('ct_checkjs', $_COOKIE),
562
- 'sender_info' => array('sender_url' => null),
563
- )
564
- );
565
-
566
- $ct_result = $base_call_result['ct_result'];
567
-
568
- if ($ct_result->allow == 0){
569
- add_action('bp_activity_after_save', 'apbct_integration__buddyPres__activityWall_showResponse', 1, 1);
570
- $apbct->spam_notification = $ct_result->comment;
571
- return true;
572
- }else
573
- return $is_spam;
574
- }
575
-
576
- /**
577
- * Outputs message to AJAX frontend handler
578
- *
579
- * @global SpbcState $apbct
580
- * @param BP_Activity_Activity $activity_obj Activity object (\plugins\buddypress\bp-activity\classes\class-bp-activity-activity.php)
581
- */
582
- function apbct_integration__buddyPres__activityWall_showResponse( $activity_obj ){
583
-
584
- global $apbct;
585
-
586
- // Legacy template
587
- if($apbct->buddy_press_tmpl === 'bp-legacy'){
588
- die('<div id="message" class="error bp-ajax-message"><p>'. $apbct->spam_notification .'</p></div>');
589
- // Nouveau tamplate and others
590
- }else{
591
- @header( 'Content-Type: application/json; charset=' . get_option('blog_charset'));
592
- die(json_encode(array(
593
- 'success' => false,
594
- 'data' => array('message' => $apbct->spam_notification),
595
- )));
596
- }
597
- }
598
-
599
- /**
600
- * Public function - Tests new private messages (dialogs)
601
- *
602
- * @global SpbcState $apbct
603
- * @param type $bp_message_obj
604
- * @return array with errors if spam has found
605
- */
606
- function apbct_integration__buddyPres__private_msg_check( $bp_message_obj){
607
-
608
- global $apbct;
609
-
610
- //Check for enabled option
611
- if($apbct->settings['bp_private_messages'] == 0)
612
- return;
613
-
614
- //Check for quantity of comments
615
- $comments_check_number = defined('CLEANTALK_CHECK_COMMENTS_NUMBER')
616
- ? CLEANTALK_CHECK_COMMENTS_NUMBER
617
- : 3;
618
-
619
- if($apbct->settings['check_comments_number']){
620
- $args = array(
621
- 'user_id' => $bp_message_obj->sender_id,
622
- 'box' => 'sentbox',
623
- 'type' => 'all',
624
- 'limit' => $comments_check_number,
625
- 'page' => null,
626
- 'search_terms' => '',
627
- 'meta_query' => array()
628
- );
629
- $sentbox_msgs = BP_Messages_Thread::get_current_threads_for_user($args);
630
- $cnt_sentbox_msgs = $sentbox_msgs['total'];
631
- $args['box'] = 'inbox';
632
- $inbox_msgs = BP_Messages_Thread::get_current_threads_for_user($args);
633
- $cnt_inbox_msgs = $inbox_msgs['total'];
634
-
635
- if(($cnt_inbox_msgs + $cnt_sentbox_msgs) >= $comments_check_number)
636
- $is_max_comments = true;
637
- }
638
-
639
- if(!empty($is_max_comments))
640
- return;
641
-
642
- $sender_user_obj = get_user_by('id', $bp_message_obj->sender_id);
643
-
644
- //Making a call
645
- $base_call_result = apbct_base_call(
646
- array(
647
- 'message' => $bp_message_obj->subject." ".$bp_message_obj->message,
648
- 'sender_email' => $sender_user_obj->data->user_email,
649
- 'sender_nickname' => $sender_user_obj->data->user_login,
650
- 'post_info' => array(
651
- 'comment_type' => 'buddypress_comment',
652
- 'post_url' => apbct_get_server_variable( 'HTTP_REFERER' ),
653
- ),
654
- 'js_on' => apbct_js_test('ct_checkjs', $_COOKIE)
655
- ? apbct_js_test('ct_checkjs', $_COOKIE)
656
- : apbct_js_test('ct_checkjs', $_POST),
657
- 'sender_info' => array('sender_url' => null),
658
- )
659
- );
660
-
661
- $ct_result = $base_call_result['ct_result'];
662
-
663
- if ($ct_result->allow == 0)
664
- wp_die("<h1>".__('Spam protection by CleanTalk', 'cleantalk')."</h1><h2>".$ct_result->comment."</h2>", '', array('response' => 403, "back_link" => true, "text_direction" => 'ltr'));
665
- }
666
-
667
- /**
668
- * Adds hiden filed to deafualt serach form
669
- *
670
- * @param $form string
671
- * @return string
672
- */
673
- function apbct_forms__search__addField( $form ){
674
- global $apbct;
675
- if($apbct->settings['search_test'] == 1){
676
- $js_filed = ct_add_hidden_fields('ct_checkjs_search_default', true, false, false, false);
677
- $form = str_replace('</form>', $js_filed, $form);
678
- }
679
- return $form;
680
- }
681
-
682
- /**
683
- * Test default search string for spam
684
- *
685
- * @param $search string
686
- * @return string
687
- */
688
- function apbct_forms__search__testSpam( $search ){
689
-
690
- global $apbct, $cleantalk_executed;
691
-
692
- if(
693
- empty($search) ||
694
- $cleantalk_executed ||
695
- $apbct->settings['search_test'] == 0 ||
696
- $apbct->settings['protect_logged_in'] != 1 && is_user_logged_in() // Skip processing for logged in users.
697
- ){
698
- return $search;
699
- }
700
-
701
- if(apbct_is_user_logged_in())
702
- $user = wp_get_current_user();
703
-
704
- $base_call_result = apbct_base_call(
705
- array(
706
- 'message' => $search,
707
- 'sender_email' => !empty($user) ? $user->user_email : null,
708
- 'sender_nickname' => !empty($user) ? $user->user_login : null,
709
- 'post_info' => array('comment_type' => 'site_search_wordpress'),
710
- //'js_on' => apbct_js_test('ct_checkjs_search_default', $_GET, true),
711
- )
712
- );
713
- $ct_result = $base_call_result['ct_result'];
714
-
715
- $cleantalk_executed = true;
716
-
717
- if ($ct_result->allow == 0){
718
- die($ct_result->comment);
719
- }
720
-
721
- return $search;
722
- }
723
-
724
- /**
725
- * Test woocommerce checkout form for spam
726
- *
727
- */
728
- function ct_woocommerce_checkout_check() {
729
-
730
- //Getting request params
731
- $ct_temp_msg_data = ct_get_fields_any($_POST);
732
-
733
- $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
734
- $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
735
- $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
736
- $contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
737
- $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
738
-
739
- if($subject != '')
740
- $message = array_merge(array('subject' => $subject), $message);
741
-
742
- $post_info['comment_type'] = 'order';
743
- $post_info['post_url'] = apbct_get_server_variable( 'HTTP_REFERER' );
744
-
745
- //Making a call
746
- $base_call_result = apbct_base_call(
747
- array(
748
- 'message' => $message,
749
- 'sender_email' => $sender_email,
750
- 'sender_nickname' => $sender_nickname,
751
- 'post_info' => $post_info,
752
- 'js_on' => apbct_js_test('ct_checkjs', $_COOKIE),
753
- 'sender_info' => array('sender_url' => null),
754
- )
755
- );
756
-
757
- $ct_result = $base_call_result['ct_result'];
758
-
759
- if ($ct_result->allow == 0) {
760
- wp_send_json(array(
761
- 'result' => 'failure',
762
- 'messages' => "<ul class=\"woocommerce-error\"><li>".$ct_result->comment."</li></ul>",
763
- 'refresh' => 'false',
764
- 'reload' => 'false'
765
- ));
766
- }
767
- }
768
-
769
- /**
770
- * Public function - Tests for Pirate contact froms
771
- * return NULL
772
- */
773
- function apbct_form__piratesForm__testSpam(){
774
-
775
- global $apbct;
776
-
777
- //Check for enabled option
778
- if( !$apbct->settings['contact_forms_test'])
779
- return;
780
-
781
- //Getting request params
782
- $ct_temp_msg_data = ct_get_fields_any($_POST);
783
-
784
- $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
785
- $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
786
- $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
787
- $contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
788
- $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
789
-
790
- if($subject != '')
791
- $message = array_merge(array('subject' => $subject), $message);
792
-
793
- $post_info['comment_type'] = 'contact_form_wordpress_feedback_pirate';
794
- $post_info['post_url'] = apbct_get_server_variable( 'HTTP_REFERER' );
795
-
796
- //Making a call
797
- $base_call_result = apbct_base_call(
798
- array(
799
- 'message' => $message,
800
- 'sender_email' => $sender_email,
801
- 'sender_nickname' => $sender_nickname,
802
- 'post_info' => $post_info,
803
- 'js_on' => apbct_js_test('ct_checkjs', $_COOKIE),
804
- 'sender_info' => array('sender_url' => null),
805
- )
806
- );
807
-
808
- $ct_result = $base_call_result['ct_result'];
809
-
810
- if ($ct_result->allow == 0)
811
- wp_die("<h1>".__('Spam protection by CleanTalk', 'cleantalk')."</h1><h2>".$ct_result->comment."</h2>", '', array('response' => 403, "back_link" => true, "text_direction" => 'ltr'));
812
- }
813
-
814
- /**
815
- * Adds hidden filed to comment form
816
- */
817
- function ct_comment_form($post_id){
818
-
819
- global $apbct;
820
-
821
- if (apbct_is_user_enable() === false) {
822
- return false;
823
- }
824
-
825
- if ( !$apbct->settings['comments_test']) {
826
- return false;
827
- }
828
-
829
- ct_add_hidden_fields('ct_checkjs', false, false);
830
-
831
- return null;
832
- }
833
-
834
- /**
835
- * Adds cookie script filed to head
836
- */
837
- function apbct_hook__wp_head__set_cookie__ct_checkjs() {
838
-
839
- ct_add_hidden_fields('ct_checkjs', false, true, true);
840
-
841
- return null;
842
- }
843
-
844
- /**
845
- * Adds cookie script filed to footer
846
- */
847
- function apbct_hook__wp_footer() {
848
-
849
- //ct_add_hidden_fields(true, 'ct_checkjs', false, true, true);
850
-
851
- return null;
852
- }
853
-
854
- /**
855
- * Adds hidden filed to define avaialbility of client's JavaScript
856
- * @param bool $random_key switch on generation random key for every page load
857
- */
858
- function ct_add_hidden_fields($field_name = 'ct_checkjs', $return_string = false, $cookie_check = false, $no_print = false, $ajax = true) {
859
-
860
- global $ct_checkjs_def, $apbct;
861
-
862
- $ct_checkjs_key = ct_get_checkjs_value();
863
- $field_id_hash = md5(rand(0, 1000));
864
-
865
- // Using only cookies
866
- if ($cookie_check && $apbct->settings['set_cookies'] == 1) {
867
-
868
- $html = "<script type='text/javascript'>
869
- function ctSetCookie(c_name, value, def_value){
870
- document.cookie = c_name + '=' + escape(value) + '; path=/';
871
- }
872
- ctSetCookie('{$field_name}', '{$ct_checkjs_key}', '{$ct_checkjs_def}');
873
- </script>";
874
-
875
- // Using AJAX to get key
876
- }elseif($apbct->settings['use_ajax'] && $ajax){
877
-
878
- // Fix only for wp_footer -> apbct_hook__wp_head__set_cookie__ct_checkjs()
879
- if($no_print)
880
- return;
881
-
882
- $ct_input_challenge = sprintf("'%s'", $ct_checkjs_key);
883
- $field_id = $field_name . '_' . $field_id_hash;
884
- $html = "<input type='hidden' id='{$field_id}' name='{$field_name}' value='{$ct_checkjs_def}' />
885
- <script type='text/javascript'>
886
- window.addEventListener('load', function () {
887
- setTimeout(function(){
888
- apbct_sendAJAXRequest(
889
- {action: 'apbct_js_keys__get'},
890
- {callback: apbct_js_keys__set_input_value, input_name: '{$field_id}'}
891
- );
892
- }, 1000);
893
- });
894
- </script>";
895
-
896
- // Set KEY from backend
897
- }else{
898
- // Fix only for wp_footer -> apbct_hook__wp_head__set_cookie__ct_checkjs()
899
- if($no_print)
900
- return;
901
-
902
- $ct_input_challenge = sprintf("'%s'", $ct_checkjs_key);
903
- $field_id = $field_name . '_' . $field_id_hash;
904
- $html = "<input type='hidden' id='{$field_id}' name='{$field_name}' value='{$ct_checkjs_def}' />
905
- <script type='text/javascript'>
906
- setTimeout(function(){
907
- var ct_input_name = '{$field_id}';
908
- if (document.getElementById(ct_input_name) !== null) {
909
- var ct_input_value = document.getElementById(ct_input_name).value;
910
- document.getElementById(ct_input_name).value = document.getElementById(ct_input_name).value.replace(ct_input_value, {$ct_input_challenge});
911
- }
912
- }, 1000);
913
- </script>";
914
- }
915
-
916
- // Simplify JS code and Fixing issue with wpautop()
917
- $html = str_replace(array("\n","\r","\t"),'', $html);
918
-
919
- if ($return_string === true) {
920
- return $html;
921
- } else {
922
- echo $html;
923
- }
924
- }
925
-
926
- /**
927
- * Public function - Insert JS code for spam tests
928
- * return null;
929
- */
930
- function apbct_rorm__formidable__footerScripts($fields, $form) {
931
-
932
- global $apbct, $ct_checkjs_frm;
933
-
934
- if ( !$apbct->settings['contact_forms_test'])
935
- return false;
936
-
937
- $ct_checkjs_key = ct_get_checkjs_value();
938
- $ct_frm_base_name = 'form_';
939
- $ct_frm_name = $ct_frm_base_name . $form->form_key;
940
-
941
- echo "var input = document.createElement('input');
942
- input.setAttribute('type', 'hidden');
943
- input.setAttribute('name', '$ct_checkjs_frm');
944
- input.setAttribute('value', '$ct_checkjs_key');
945
- for (i = 0; i < document.forms.length; i++) {
946
- if (typeof document.forms[i].id == 'string'){
947
- if(document.forms[i].id.search('$ct_frm_name') != -1) {
948
- document.forms[i].appendChild(input);
949
- }
950
- }
951
- }";
952
-
953
- /* Excessive cookie set
954
- $js_code = ct_add_hidden_fields(true, 'ct_checkjs', true, true);
955
- $js_code = strip_tags($js_code); // Removing <script> tag
956
- echo $js_code;
957
- //*/
958
- }
959
-
960
- /**
961
- * Public function - Test Formidable data for spam activity
962
- * @param $errors
963
- * @param $form
964
- *
965
- * @return array with errors if spam has found
966
- */
967
- function apbct_rorm__formidable__testSpam ( $errors, $form ) {
968
-
969
- global $apbct;
970
-
971
- if ( !$apbct->settings['contact_forms_test']) {
972
- return $errors;
973
- }
974
-
975
- // Skip processing for logged in users.
976
- if ( !$apbct->settings['protect_logged_in'] && is_user_logged_in()) {
977
- return $errors;
978
- }
979
-
980
- $ct_temp_msg_data = ct_get_fields_any($_POST['item_meta']);
981
-
982
- $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
983
- $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
984
- $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
985
- $contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
986
- $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
987
-
988
- // Adding 'input_meta[]' to every field /Formidable fix/
989
- $message = array_flip($message);
990
- foreach($message as &$value){
991
- $value = 'item_meta['.$value.']';
992
- } unset($value);
993
- $message = array_flip($message);
994
-
995
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE)
996
- ? apbct_js_test('ct_checkjs', $_COOKIE)
997
- : apbct_js_test('ct_checkjs', $_POST);
998
-
999
- $base_call_result = apbct_base_call(
1000
- array(
1001
- 'message' => $message,
1002
- 'sender_email' => $sender_email,
1003
- 'sender_nickname' => $sender_nickname,
1004
- 'post_info' => array('comment_type' => 'contact_form_wordpress_formidable'),
1005
- 'js_on' => $checkjs
1006
- )
1007
- );
1008
- $ct_result = $base_call_result['ct_result'];
1009
-
1010
- if ($ct_result->allow == 0) {
1011
- $errors['ct_error'] = '<br /><b>' . $ct_result->comment . '</b><br /><br />';
1012
- }
1013
-
1014
- return $errors;
1015
- }
1016
-
1017
- /**
1018
- * Public filter 'bbp_*' - Get new topic name to global $ct_bbp_topic
1019
- * @param mixed[] $comment Comment string
1020
- * @return mixed[] $comment Comment string
1021
- */
1022
- function ct_bbp_get_topic($topic){
1023
- global $ct_bbp_topic;
1024
-
1025
- $ct_bbp_topic=$topic;
1026
-
1027
- return $topic;
1028
- }
1029
-
1030
- /**
1031
- * Public filter 'bbp_*' - Checks topics, replies by cleantalk
1032
- * @param mixed[] $comment Comment string
1033
- * @return mixed[] $comment Comment string
1034
- */
1035
- function ct_bbp_new_pre_content ($comment) {
1036
-
1037
- global $apbct, $current_user;
1038
-
1039
- if ( !$apbct->settings['comments_test']) {
1040
- return $comment;
1041
- }
1042
-
1043
- // Skip processing for logged in users and admin.
1044
- if ( !$apbct->settings['protect_logged_in'] && is_user_logged_in() ||
1045
- in_array("administrator", $current_user->roles))
1046
- return $comment;
1047
-
1048
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE)
1049
- ? apbct_js_test('ct_checkjs', $_COOKIE)
1050
- : apbct_js_test('ct_checkjs', $_POST);
1051
-
1052
- $post_info['comment_type'] = 'bbpress_comment';
1053
- $post_info['post_url'] = bbp_get_topic_permalink();
1054
-
1055
- if( is_user_logged_in() ) {
1056
- $sender_email = $current_user->user_email;
1057
- $sender_nickname = $current_user->display_name;
1058
- } else {
1059
- $sender_email = isset($_POST['bbp_anonymous_email']) ? $_POST['bbp_anonymous_email'] : null;
1060
- $sender_nickname = isset($_POST['bbp_anonymous_name']) ? $_POST['bbp_anonymous_name'] : null;
1061
- }
1062
-
1063
- $base_call_result = apbct_base_call(
1064
- array(
1065
- 'message' => $comment,
1066
- 'sender_email' => $sender_email,
1067
- 'sender_nickname' => $sender_nickname,
1068
- 'post_info' => $post_info,
1069
- 'js_on' => $checkjs,
1070
- 'sender_info' => array('sender_url' => isset($_POST['bbp_anonymous_website']) ? $_POST['bbp_anonymous_website'] : null),
1071
- )
1072
- );
1073
- $ct_result = $base_call_result['ct_result'];
1074
-
1075
- if ($ct_result->allow == 0) {
1076
- bbp_add_error('bbp_reply_content', $ct_result->comment);
1077
- }
1078
-
1079
- return $comment;
1080
- }
1081
-
1082
- function apbct_comment__sanitize_data__before_wp_die($function){
1083
-
1084
- global $apbct;
1085
-
1086
- $comment_data = wp_unslash($_POST);
1087
-
1088
- $user_ID = 0;
1089
-
1090
- $comment_type = '';
1091
-
1092
- $comment_content = isset($comment_data['comment']) ? (string) $comment_data['comment'] : null;
1093
- $comment_parent = isset($comment_data['comment_parent']) ? (int) absint($comment_data['comment_parent']) : null;
1094
-
1095
- $comment_author = isset($comment_data['author']) ? (string) trim(strip_tags($comment_data['author'])) : null;
1096
- $comment_author_email = isset($comment_data['email']) ? (string) trim($comment_data['email']) : null;
1097
- $comment_author_url = isset($comment_data['url']) ? (string) trim($comment_data['url']) : null;
1098
- $comment_post_ID = isset($comment_data['comment_post_ID']) ? (int) $comment_data['comment_post_ID'] : null;
1099
-
1100
- if(isset($comment_content, $comment_parent)){
1101
-
1102
- $user = wp_get_current_user();
1103
-
1104
- if($user->exists()){
1105
- $comment_author = empty($user->display_name) ? $user->user_login : $user->display_name;
1106
- $comment_author_email = $user->user_email;
1107
- $comment_author_url = $user->user_url;
1108
- $user_ID = $user->ID;
1109
- }
1110
-
1111
- $apbct->comment_data = compact(
1112
- 'comment_post_ID',
1113
- 'comment_author',
1114
- 'comment_author_email',
1115
- 'comment_author_url',
1116
- 'comment_content',
1117
- 'comment_type',
1118
- 'comment_parent',
1119
- 'user_ID'
1120
- );
1121
-
1122
- $function = 'apbct_comment__check_via_wp_die';
1123
-
1124
- }
1125
-
1126
- return $function;
1127
- }
1128
-
1129
- function apbct_comment__check_via_wp_die($message, $title, $args){
1130
- if($title == __('Comment Submission Failure')){
1131
- global $apbct;
1132
- $apbct->validation_error = $message;
1133
- ct_preprocess_comment($apbct->comment_data);
1134
- }
1135
- _default_wp_die_handler($message, $title, $args);
1136
- }
1137
-
1138
- /**
1139
- * Public filter 'preprocess_comment' - Checks comment by cleantalk server
1140
- * @param mixed[] $comment Comment data array
1141
- * @return mixed[] New data array of comment
1142
- */
1143
- function ct_preprocess_comment($comment) {
1144
- // this action is called just when WP process POST request (adds new comment)
1145
- // this action is called by wp-comments-post.php
1146
- // after processing WP makes redirect to post page with comment's form by GET request (see above)
1147
- global $current_user, $comment_post_id, $ct_comment_done, $ct_jp_comments, $apbct;
1148
-
1149
- // Send email notification for chosen groups of users
1150
- if($apbct->settings['comment_notify'] && !empty($apbct->settings['comment_notify__roles']) && $apbct->data['moderate']){
1151
-
1152
- add_filter('notify_post_author', 'apbct_comment__Wordpress__doNotify', 100, 2);
1153
-
1154
- $users = get_users(array(
1155
- 'role__in' => $apbct->settings['comment_notify__roles'],
1156
- 'fileds' => array('user_email')
1157
- ));
1158
-
1159
- if($users){
1160
- add_filter('comment_notification_text', 'apbct_comment__Wordpress__changeMailNotificationGroups', 100, 2);
1161
- add_filter('comment_notification_recipients', 'apbct_comment__Wordpress__changeMailNotificationRecipients', 100, 2);
1162
- foreach($users as $user){
1163
- $emails[] = $user->user_email;
1164
- }
1165
- $apbct->comment_notification_recipients = json_encode($emails);
1166
- }
1167
- }
1168
-
1169
- // Skip processing admin.
1170
- if (in_array("administrator", $current_user->roles))
1171
- return $comment;
1172
-
1173
- $comments_check_number = defined('CLEANTALK_CHECK_COMMENTS_NUMBER') ? CLEANTALK_CHECK_COMMENTS_NUMBER : 3;
1174
-
1175
- if($apbct->settings['check_comments_number']){
1176
- $args = array(
1177
- 'author_email' => $comment['comment_author_email'],
1178
- 'status' => 'approve',
1179
- 'count' => false,
1180
- 'number' => $comments_check_number,
1181
- );
1182
- $cnt = count(get_comments($args));
1183
- $is_max_comments = $cnt >= $comments_check_number ? true : false;
1184
- }
1185
-
1186
- if (
1187
- ($comment['comment_type']!='trackback') &&
1188
- (
1189
- apbct_is_user_enable() === false ||
1190
- $apbct->settings['comments_test'] == 0 ||
1191
- $ct_comment_done ||
1192
- (isset($_SERVER['HTTP_REFERER']) && stripos($_SERVER['HTTP_REFERER'],'page=wysija_campaigns&action=editTemplate')!==false) ||
1193
- (isset($is_max_comments) && $is_max_comments) ||
1194
- (isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['REQUEST_URI'],'/wp-admin/')!==false)
1195
- )
1196
- )
1197
- {
1198
- return $comment;
1199
- }
1200
-
1201
- $local_blacklists = wp_blacklist_check(
1202
- $comment['comment_author'],
1203
- $comment['comment_author_email'],
1204
- $comment['comment_author_url'],
1205
- $comment['comment_content'],
1206
- apbct_get_server_variable( 'REMOTE_ADDR' ),
1207
- apbct_get_server_variable( 'HTTP_USER_AGENT' )
1208
- );
1209
-
1210
- // Go out if author in local blacklists
1211
- if ($comment['comment_type']!='trackback' && $local_blacklists === true) {
1212
- return $comment;
1213
- }
1214
-
1215
- // Skip pingback anti-spam test
1216
- /*if ($comment['comment_type'] == 'pingback') {
1217
- return $comment;
1218
- }*/
1219
-
1220
- $ct_comment_done = true;
1221
-
1222
- $comment_post_id = $comment['comment_post_ID'];
1223
-
1224
- // JetPack comments logic
1225
- $post_info['comment_type'] = $ct_jp_comments ? 'jetpack_comment' : $comment['comment_type'];
1226
- $post_info['post_url'] = ct_post_url(null, $comment_post_id);
1227
-
1228
- // Comment type
1229
- $post_info['comment_type'] = empty($post_info['comment_type']) ? 'general_comment' : $post_info['comment_type'];
1230
-
1231
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE)
1232
- ? apbct_js_test('ct_checkjs', $_COOKIE)
1233
- : apbct_js_test('ct_checkjs', $_POST);
1234
-
1235
-
1236
- $example = null;
1237
- if ($apbct->data['relevance_test']) {
1238
- $post = get_post($comment_post_id);
1239
- if ($post !== null){
1240
- $example['title'] = $post->post_title;
1241
- $example['body'] = $post->post_content;
1242
- $example['comments'] = null;
1243
-
1244
- $last_comments = get_comments(array('status' => 'approve', 'number' => 10, 'post_id' => $comment_post_id));
1245
- foreach ($last_comments as $post_comment){
1246
- $example['comments'] .= "\n\n" . $post_comment->comment_content;
1247
- }
1248
-
1249
- $example = json_encode($example);
1250
- }
1251
-
1252
- // Use plain string format if've failed with JSON
1253
- if ($example === false || $example === null){
1254
- $example = ($post->post_title !== null) ? $post->post_title : '';
1255
- $example .= ($post->post_content !== null) ? "\n\n" . $post->post_content : '';
1256
- }
1257
- }
1258
-
1259
- $base_call_result = apbct_base_call(
1260
- array(
1261
- 'message' => $comment['comment_content'],
1262
- 'example' => $example,
1263
- 'sender_email' => $comment['comment_author_email'],
1264
- 'sender_nickname' => $comment['comment_author'],
1265
- 'post_info' => $post_info,
1266
- 'js_on' => $checkjs,
1267
- 'sender_info' => array(
1268
- 'sender_url' => @$comment['comment_author_url'],
1269
- 'form_validation' => !isset($apbct->validation_error)
1270
- ? null
1271
- : json_encode(array(
1272
- 'validation_notice' => $apbct->validation_error,
1273
- 'page_url' => apbct_get_server_variable( 'HTTP_HOST' ) . apbct_get_server_variable( 'REQUEST_URI' ),
1274
- ))
1275
- ),
1276
- )
1277
- );
1278
- $ct_result = $base_call_result['ct_result'];
1279
-
1280
- ct_hash($ct_result->id);
1281
-
1282
- //Don't check trusted users
1283
- if (isset($comment['comment_author_email'])){
1284
- $approved_comments = get_comments(array('status' => 'approve', 'count' => true, 'author_email' => $comment['comment_author_email']));
1285
- $new_user = $approved_comments == 0 ? true : false;
1286
- }
1287
-
1288
- // Change comment flow only for new authors
1289
- if (!empty($new_user) || $ct_result->stop_words !== null || $ct_result->spam == 1)
1290
- add_action('comment_post', 'ct_set_meta', 10, 2);
1291
-
1292
- if($ct_result->allow){ // Pass if allowed
1293
- if(get_option('comment_moderation') === '1') // Wordpress moderation flag
1294
- add_filter('pre_comment_approved', 'ct_set_not_approved', 999, 2);
1295
- else
1296
- add_filter('pre_comment_approved', 'ct_set_approved', 999, 2);
1297
- }else{
1298
-
1299
- global $ct_comment, $ct_stop_words;
1300
-
1301
- $ct_comment = $ct_result->comment;
1302
- $ct_stop_words = $ct_result->stop_words;
1303
-
1304
- $err_text = '<center><b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk.</b> ' . __('Spam protection', 'cleantalk') . "</center><br><br>\n" . $ct_result->comment;
1305
- $err_text .= '<script>setTimeout("history.back()", 5000);</script>';
1306
-
1307
- // Terminate. Definitely spam.
1308
- if($ct_result->stop_queue == 1)
1309
- wp_die($err_text, 'Blacklisted', array('response' => 200, 'back_link' => true));
1310
-
1311
- // Terminate by user's setting.
1312
- if($ct_result->spam == 3)
1313
- wp_die($err_text, 'Blacklisted', array('response' => 200, 'back_link' => true));
1314
-
1315
- // Trash comment.
1316
- if($ct_result->spam == 2){
1317
- add_filter('pre_comment_approved', 'ct_set_comment_spam', 997, 2);
1318
- add_action('comment_post', 'ct_wp_trash_comment', 997, 2);
1319
- }
1320
-
1321
- // Spam comment
1322
- if($ct_result->spam == 1)
1323
- add_filter('pre_comment_approved', 'ct_set_comment_spam', 997, 2);
1324
-
1325
- // Move to pending folder. Contains stop_words.
1326
- if($ct_result->stop_words){
1327
- add_filter('pre_comment_approved', 'ct_set_not_approved', 998, 2);
1328
- add_action('comment_post', 'ct_mark_red', 998, 2);
1329
- }
1330
-
1331
- add_action('comment_post', 'ct_die', 999, 2);
1332
- }
1333
-
1334
- if($apbct->settings['remove_comments_links'] == 1){
1335
- $comment['comment_content'] = preg_replace("~(http|https|ftp|ftps)://(.*?)(\s|\n|[,.?!](\s|\n)|$)~", '[Link deleted]', $comment['comment_content']);
1336
- }
1337
-
1338
- // Change mail notification if license is out of date
1339
- if($apbct->data['moderate'] == 0){
1340
- $apbct->sender_email = $comment['comment_author_email'];
1341
- $apbct->sender_ip = CleantalkHelper::ip__get(array('real'));
1342
- add_filter('comment_moderation_text', 'apbct_comment__Wordpress__changeMailNotification', 100, 2); // Comment sent to moderation
1343
- add_filter('comment_notification_text', 'apbct_comment__Wordpress__changeMailNotification', 100, 2); // Comment approved
1344
- }
1345
-
1346
- return $comment;
1347
- }
1348
-
1349
- /**
1350
- * Changes whether notify admin/athor or not.
1351
- *
1352
- * @param bool $maybe_notify notify flag
1353
- * @param int $comment_ID Comment id
1354
- * @return bool flag
1355
- */
1356
- function apbct_comment__Wordpress__doNotify($maybe_notify, $comment_ID){
1357
- return true;
1358
- }
1359
-
1360
- /**
1361
- * Add notification setting link
1362
- *
1363
- * @param string $notify_message
1364
- * @param integer $comment_id
1365
- *
1366
- * @return string
1367
- */
1368
- function apbct_comment__Wordpress__changeMailNotificationGroups($notify_message, $comment_id){
1369
- return $notify_message
1370
- .PHP_EOL
1371
- .'---'.PHP_EOL
1372
- .'Manage notifications settings: '.get_site_url().'/wp-admin/options-general.php?page=cleantalk';
1373
- }
1374
-
1375
- /**
1376
- * Change email notification recipients
1377
- *
1378
- * @param array $emails
1379
- * @param integer $comment_id
1380
- *
1381
- * @return array
1382
- * @global SpbcState $apbct
1383
- */
1384
- function apbct_comment__Wordpress__changeMailNotificationRecipients($emails, $comment_id){
1385
- global $apbct;
1386
- return array_unique(array_merge($emails, (array)json_decode($apbct->comment_notification_recipients, true)));
1387
- }
1388
-
1389
- /**
1390
- * Changes email notification for spam comment for native Wordpress comment system
1391
- *
1392
- * @param string $notify_message Body of email notification
1393
- * @param int $comment_id Comment id
1394
- * @return string Body for email notification
1395
- */
1396
- function apbct_comment__Wordpress__changeMailNotification($notify_message, $comment_id){
1397
-
1398
- global $apbct;
1399
-
1400
- $notify_message =
1401
- PHP_EOL
1402
- .__('CleanTalk AntiSpam: This message is possible spam.', 'cleantalk')
1403
- ."\n".__('You could check it in CleanTalk\'s anti-spam database:', 'cleantalk')
1404
- ."\n".'IP: https://cleantalk.org/blacklists/' . $apbct->sender_ip
1405
- ."\n".'Email: https://cleantalk.org/blacklists/' . $apbct->sender_email
1406
- ."\n".PHP_EOL . sprintf(
1407
- __('Activate protection in your Anti-Spam Dashboard: %s.', 'clentalk'),
1408
- 'https://cleantalk.org/my/?cp_mode=antispam&utm_source=newsletter&utm_medium=email&utm_campaign=wp_spam_comment_passed'
1409
- .($apbct->data['user_token']
1410
- ? '&iser_token='.$apbct->data['user_token']
1411
- : ''
1412
- )
1413
- )
1414
- .PHP_EOL . '---'
1415
- .PHP_EOL
1416
- .PHP_EOL
1417
- .$notify_message;
1418
-
1419
- return $notify_message;
1420
-
1421
- }
1422
-
1423
- /**
1424
- * Set die page with Cleantalk comment.
1425
- * @global array $ct_comment
1426
- $err_text = '<center><b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk.</b> ' . __('Spam protection', 'cleantalk') . "</center><br><br>\n" . $ct_comment;
1427
- * @param type $comment_status
1428
- */
1429
- function ct_die($comment_id, $comment_status) {
1430
- global $ct_comment;
1431
- $err_text = '<center><b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk.</b> ' . __('Spam protection', 'cleantalk') . "</center><br><br>\n" . $ct_comment;
1432
- $err_text .= '<script>setTimeout("history.back()", 5000);</script>';
1433
- if(isset($_POST['et_pb_contact_email']))
1434
- {
1435
- $mes='<div id="et_pb_contact_form_1" class="et_pb_contact_form_container clearfix"><h1 class="et_pb_contact_main_title">Blacklisted</h1><div class="et-pb-contact-message"><p>'.$ct_comment.'</p></div></div>';
1436
- wp_die($mes, 'Blacklisted', array('back_link' => true,'response'=>200));
1437
- }
1438
- else
1439
- {
1440
- wp_die($err_text, 'Blacklisted', array('response' => 200, 'back_link' => true));
1441
- }
1442
- }
1443
-
1444
- /**
1445
- * Set die page with Cleantalk comment from parameter.
1446
- * @param type $comment_body
1447
- */
1448
- function ct_die_extended($comment_body) {
1449
- $err_text = '<center><b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk.</b> ' . __('Spam protection', 'cleantalk') . "</center><br><br>\n" . $comment_body;
1450
- $err_text .= '<script>setTimeout("history.back()", 5000);</script>';
1451
- wp_die($err_text, 'Blacklisted', array('response' => 200, 'back_link' => true));
1452
- }
1453
-
1454
- /**
1455
- * Validates JavaScript anti-spam test
1456
- *
1457
- * @param string $field_name filed to serach in data
1458
- * @param null $data Data to search in
1459
- * @param bool $random_key
1460
- *
1461
- * @return int|null
1462
- */
1463
- function apbct_js_test($field_name = 'ct_checkjs', $data = null) {
1464
-
1465
- global $apbct;
1466
-
1467
- $out = null;
1468
-
1469
- if($data && isset($data[$field_name])){
1470
-
1471
- $js_key = trim($data[$field_name]);
1472
-
1473
- // Check static key
1474
- if(
1475
- $apbct->settings['use_static_js_key'] == 1 ||
1476
- ( $apbct->settings['use_static_js_key'] == - 1 &&
1477
- ( apbct_is_cache_plugins_exists() ||
1478
- ( apbct_is_post() && isset($apbct->data['cache_detected']) && $apbct->data['cache_detected'] == 1 )
1479
- )
1480
- )
1481
- ){
1482
- $out = ct_get_checkjs_value() === $js_key ? 1 : 0;
1483
-
1484
- // Random key check
1485
- }else{
1486
- $out = array_key_exists( $js_key, $apbct->js_keys ) ? 1 : 0;
1487
- }
1488
- }
1489
-
1490
- return $out;
1491
- }
1492
-
1493
- /**
1494
- * Get post url
1495
- * @param int $comment_id
1496
- * @param int $comment_post_id
1497
- * @return string|bool
1498
- */
1499
- function ct_post_url($comment_id = null, $comment_post_id) {
1500
-
1501
- if (empty($comment_post_id))
1502
- return null;
1503
-
1504
- if ($comment_id === null) {
1505
- $last_comment = get_comments('number=1');
1506
- $comment_id = isset($last_comment[0]->comment_ID) ? (int) $last_comment[0]->comment_ID + 1 : 1;
1507
- }
1508
- $permalink = get_permalink($comment_post_id);
1509
-
1510
- $post_url = null;
1511
- if ($permalink !== null)
1512
- $post_url = $permalink . '#comment-' . $comment_id;
1513
-
1514
- return $post_url;
1515
- }
1516
-
1517
- /**
1518
- * Public filter 'pre_comment_approved' - Mark comment unapproved always
1519
- * @return int Zero
1520
- */
1521
- function ct_set_not_approved() {
1522
- return 0;
1523
- }
1524
-
1525
- /**
1526
- * @author Artem Leontiev
1527
- * Public filter 'pre_comment_approved' - Mark comment approved if it's not 'spam' only
1528
- * @return int 1
1529
- */
1530
- function ct_set_approved($approved, $comment) {
1531
- if ($approved == 'spam'){
1532
- return $approved;
1533
- } else {
1534
- return 1;
1535
- }
1536
- }
1537
-
1538
- /**
1539
- * Public filter 'pre_comment_approved' - Mark comment unapproved always
1540
- * @return int Zero
1541
- */
1542
- function ct_set_comment_spam() {
1543
- return 'spam';
1544
- }
1545
-
1546
- /**
1547
- * Public action 'comment_post' - Store cleantalk hash in comment meta 'ct_hash'
1548
- * @param int $comment_id Comment ID
1549
- * @param mixed $comment_status Approval status ("spam", or 0/1), not used
1550
- */
1551
- function ct_set_meta($comment_id, $comment_status) {
1552
- global $comment_post_id;
1553
- $hash1 = ct_hash();
1554
- if (!empty($hash1)) {
1555
- update_comment_meta($comment_id, 'ct_hash', $hash1);
1556
- if (function_exists('base64_encode') && isset($comment_status) && $comment_status != 'spam') {
1557
- $post_url = ct_post_url($comment_id, $comment_post_id);
1558
- $post_url = base64_encode($post_url);
1559
- if ($post_url === false)
1560
- return false;
1561
- // 01 - URL to approved comment
1562
- $feedback_request = $hash1 . ':' . '01' . ':' . $post_url . ';';
1563
- ct_send_feedback($feedback_request);
1564
- }
1565
- }
1566
- return true;
1567
- }
1568
-
1569
- /**
1570
- * Mark bad words
1571
- * @global string $ct_stop_words
1572
- * @param int $comment_id
1573
- * @param int $comment_status Not use
1574
- */
1575
- function ct_mark_red($comment_id, $comment_status) {
1576
- global $ct_stop_words;
1577
-
1578
- $comment = get_comment($comment_id, 'ARRAY_A');
1579
- $message = $comment['comment_content'];
1580
- foreach (explode(':', $ct_stop_words) as $word) {
1581
- $message = preg_replace("/($word)/ui", '<font rel="cleantalk" color="#FF1000">' . "$1" . '</font>', $message);
1582
-
1583
- }
1584
- $comment['comment_content'] = $message;
1585
- kses_remove_filters();
1586
- wp_update_comment($comment);
1587
- }
1588
-
1589
- //
1590
- //Send post to trash
1591
- //
1592
- function ct_wp_trash_comment($comment_id, $comment_status){
1593
- wp_trash_comment($comment_id);
1594
- }
1595
-
1596
- /**
1597
- * Tests plugin activation status
1598
- * @return bool
1599
- */
1600
- function ct_plugin_active($plugin_name){
1601
- foreach (get_option('active_plugins') as $k => $v) {
1602
- if ($plugin_name == $v)
1603
- return true;
1604
- }
1605
- return false;
1606
- }
1607
-
1608
- /**
1609
- * Insert a hidden field to registration form
1610
- * @return null
1611
- */
1612
- function ct_register_form() {
1613
-
1614
- global $ct_checkjs_register_form, $apbct;
1615
-
1616
- if ($apbct->settings['registrations_test'] == 0) {
1617
- return false;
1618
- }
1619
-
1620
- ct_add_hidden_fields($ct_checkjs_register_form, false, false, false, false);
1621
-
1622
- return null;
1623
- }
1624
-
1625
- function apbct_login__scripts(){
1626
- echo '<script src="'.APBCT_URL_PATH.'/js/apbct-public.min.js"></script>';
1627
- }
1628
-
1629
- /**
1630
- * Adds notification text to login form - to inform about approved registration
1631
- * @return null
1632
- */
1633
- function ct_login_message($message) {
1634
-
1635
- global $errors, $apbct, $apbct_cookie_register_ok_label;
1636
-
1637
-
1638
-
1639
- if ($apbct->settings['registrations_test'] != 0){
1640
- if( isset($_GET['checkemail']) && 'registered' == $_GET['checkemail'] ){
1641
- if (isset($_COOKIE[$apbct_cookie_register_ok_label])){
1642
- if(is_wp_error($errors)){
1643
- $errors->add('ct_message',sprintf(__('Registration approved by %s.', 'cleantalk'), '<b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk</b>'), 'message');
1644
- }
1645
- }
1646
- }
1647
- }
1648
- return $message;
1649
- }
1650
-
1651
- /**
1652
- * Test users registration for pPress
1653
- * @return array with errors
1654
- */
1655
- function ct_registration_errors_ppress($reg_errors, $form_id) {
1656
-
1657
- $email = $_POST['reg_email'];
1658
- $login = $_POST['reg_username'];
1659
-
1660
- $reg_errors = ct_registration_errors($reg_errors, $login, $email);
1661
-
1662
- return $reg_errors;
1663
- }
1664
-
1665
- /**
1666
- * Test users registration for multisite enviroment
1667
- * @return array with errors
1668
- */
1669
- function ct_registration_errors_wpmu($errors) {
1670
- global $ct_signup_done;
1671
-
1672
- //
1673
- // Multisite actions
1674
- //
1675
- $sanitized_user_login = null;
1676
- if (isset($errors['user_name'])) {
1677
- $sanitized_user_login = $errors['user_name'];
1678
- $wpmu = true;
1679
- }
1680
- $user_email = null;
1681
- if (isset($errors['user_email'])) {
1682
- $user_email = $errors['user_email'];
1683
- $wpmu = true;
1684
- }
1685
-
1686
- if ($wpmu && isset($errors['errors']->errors) && count($errors['errors']->errors) > 0) {
1687
- return $errors;
1688
- }
1689
-
1690
- $errors['errors'] = ct_registration_errors($errors['errors'], $sanitized_user_login, $user_email);
1691
-
1692
- // Show CleanTalk errors in user_name field
1693
- if (isset($errors['errors']->errors['ct_error'])) {
1694
- $errors['errors']->errors['user_name'] = $errors['errors']->errors['ct_error'];
1695
- unset($errors['errors']->errors['ct_error']);
1696
- }
1697
-
1698
- return $errors;
1699
- }
1700
-
1701
- /**
1702
- * Shell for action register_post
1703
- * @return array with errors
1704
- */
1705
- function ct_register_post($sanitized_user_login = null, $user_email = null, $errors) {
1706
- return ct_registration_errors($errors, $sanitized_user_login, $user_email);
1707
- }
1708
-
1709
- /**
1710
- * Check messages for external plugins
1711
- * @return array with checking result;
1712
- */
1713
-
1714
- function ct_test_message($nickname, $email, $ip, $text){
1715
-
1716
- $base_call_result = apbct_base_call(
1717
- array(
1718
- 'message' => $text,
1719
- 'sender_email' => $email,
1720
- 'sender_nickname' => $nickname,
1721
- 'post_info' => array('comment_type' => 'feedback_plugin_check'),
1722
- 'js_on' => apbct_js_test('ct_checkjs', $_COOKIE),
1723
- )
1724
- );
1725
-
1726
- $ct_result = $base_call_result['ct_result'];
1727
-
1728
- $result=Array(
1729
- 'allow' => $ct_result->allow,
1730
- 'comment' => $ct_result->comment,
1731
- );
1732
- return $result;
1733
- }
1734
-
1735
- /**
1736
- * Check registrations for external plugins
1737
- * @return array with checking result;
1738
- */
1739
- function ct_test_registration($nickname, $email, $ip){
1740
-
1741
- global $ct_checkjs_register_form, $apbct;
1742
-
1743
- if(apbct_js_test($ct_checkjs_register_form, $_POST)){
1744
- $checkjs = apbct_js_test($ct_checkjs_register_form, $_POST);
1745
- $sender_info['post_checkjs_passed'] = $checkjs;
1746
- }else{
1747
- $checkjs = $checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
1748
- $sender_info['cookie_checkjs_passed'] = $checkjs;
1749
- }
1750
-
1751
- //Making a call
1752
- $base_call_result = apbct_base_call(
1753
- array(
1754
- 'sender_ip' => $ip,
1755
- 'sender_email' => $email,
1756
- 'sender_nickname' => $nickname,
1757
- 'sender_info' => $sender_info,
1758
- 'js_on' => $checkjs,
1759
- ),
1760
- true
1761
- );
1762
- $ct_result = $base_call_result['ct_result'];
1763
-
1764
- $result = array(
1765
- 'allow' => $ct_result->allow,
1766
- 'comment' => $ct_result->comment,
1767
- );
1768
- return $result;
1769
- }
1770
-
1771
- /**
1772
- * Test users registration
1773
- *
1774
- * @param $errors
1775
- * @param null $sanitized_user_login
1776
- * @param null $user_email
1777
- *
1778
- * @return void with errors
1779
- */
1780
- function ct_registration_errors($errors, $sanitized_user_login = null, $user_email = null) {
1781
-
1782
- global $ct_checkjs_register_form, $apbct_cookie_request_id_label, $apbct_cookie_register_ok_label, $bp, $ct_signup_done, $ct_negative_comment, $apbct, $ct_registration_error_comment, $cleantalk_executed;
1783
-
1784
- // Go out if a registrered user action
1785
- if (apbct_is_user_enable() === false) {
1786
- return $errors;
1787
- }
1788
-
1789
- if ($apbct->settings['registrations_test'] == 0) {
1790
- return $errors;
1791
- }
1792
-
1793
- // The function already executed
1794
- // It happens when used ct_register_post();
1795
- if ($ct_signup_done && is_object($errors) && count($errors->errors) > 0) {
1796
- return $errors;
1797
- }
1798
-
1799
- // Facebook registration
1800
- if ($sanitized_user_login === null && isset($_POST['FB_userdata'])){
1801
- $sanitized_user_login = $_POST['FB_userdata']['name'];
1802
- $facebook = true;
1803
- }
1804
- if ($user_email === null && isset($_POST['FB_userdata'])){
1805
- $user_email = $_POST['FB_userdata']['email'];
1806
- $facebook = true;
1807
- }
1808
-
1809
- // BuddyPress actions
1810
- $buddypress = false;
1811
- if ($sanitized_user_login === null && isset($_POST['signup_username'])) {
1812
- $sanitized_user_login = $_POST['signup_username'];
1813
- $buddypress = true;
1814
- }
1815
- if ($user_email === null && isset($_POST['signup_email'])) {
1816
- $user_email = $_POST['signup_email'];
1817
- $buddypress = true;
1818
- }
1819
-
1820
- //
1821
- // Break tests because we already have servers response
1822
- //
1823
- if ($buddypress && $ct_signup_done) {
1824
- if ($ct_negative_comment) {
1825
- $bp->signup->errors['signup_username'] = $ct_negative_comment;
1826
- }
1827
- return $errors;
1828
- }
1829
-
1830
-
1831
- if(current_filter() == 'woocommerce_registration_errors'){
1832
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
1833
- $checkjs_post = null;
1834
- $checkjs_cookie = $checkjs;
1835
- }else{
1836
- // This hack can be helpfull when plugin uses with untested themes&signups plugins.
1837
- $checkjs_post = apbct_js_test($ct_checkjs_register_form, $_POST);
1838
- $checkjs_cookie = apbct_js_test($ct_checkjs_register_form, $_COOKIE);
1839
- $checkjs = $checkjs_cookie ? $checkjs_cookie : $checkjs_post;
1840
- }
1841
-
1842
- $sender_info = array(
1843
- 'post_checkjs_passed' => $checkjs_post,
1844
- 'cookie_checkjs_passed' => $checkjs_cookie,
1845
- 'form_validation' => ! empty( $errors )
1846
- ? json_encode( array(
1847
- 'validation_notice' => $errors->get_error_message(),
1848
- 'page_url' => apbct_get_server_variable( 'HTTP_HOST' ) . apbct_get_server_variable( 'REQUEST_URI' ),
1849
- ) )
1850
- : null,
1851
- );
1852
-
1853
- $base_call_result = apbct_base_call(
1854
- array(
1855
- 'sender_email' => $user_email,
1856
- 'sender_nickname' => $sanitized_user_login,
1857
- 'sender_info' => $sender_info,
1858
- 'js_on' => $checkjs,
1859
- ),
1860
- true
1861
- );
1862
- $ct_result = $base_call_result['ct_result'];
1863
-
1864
- // Change mail notification if license is out of date
1865
- if($apbct->data['moderate'] == 0 &&
1866
- ($ct_result->fast_submit == 1 || $ct_result->blacklisted == 1 || $ct_result->js_disabled == 1)
1867
- ){
1868
- $apbct->sender_email = $user_email;
1869
- $apbct->sender_ip = CleantalkHelper::ip__get(array('real'));
1870
- add_filter('wp_new_user_notification_email_admin', 'apbct_registration__Wordpress__changeMailNotification', 100, 3);
1871
- }
1872
-
1873
- $ct_signup_done = true;
1874
-
1875
- $ct_result = ct_change_plugin_resonse($ct_result, $checkjs);
1876
-
1877
- $cleantalk_executed = true;
1878
-
1879
- if ($ct_result->inactive != 0) {
1880
- ct_send_error_notice($ct_result->comment);
1881
- return $errors;
1882
- }
1883
-
1884
- if ($ct_result->allow == 0) {
1885
-
1886
- if ($buddypress === true) {
1887
- $bp->signup->errors['signup_username'] = $ct_result->comment;
1888
- }elseif(!empty($facebook)){
1889
- $_POST['FB_userdata']['email'] = '';
1890
- $_POST['FB_userdata']['name'] = '';
1891
- return;
1892
- }else{
1893
- if(is_wp_error($errors))
1894
- $errors->add('ct_error', $ct_result->comment);
1895
- $ct_negative_comment = $ct_result->comment;
1896
- }
1897
-
1898
- $ct_registration_error_comment = $ct_result->comment;
1899
-
1900
- } else {
1901
- if ($ct_result->id !== null) {
1902
- setcookie($apbct_cookie_register_ok_label, $ct_result->id, time()+10, '/');
1903
- setcookie($apbct_cookie_request_id_label, $ct_result->id, time()+10, '/');
1904
- }
1905
- }
1906
-
1907
- return $errors;
1908
- }
1909
-
1910
- /**
1911
- * Changes email notification for newly registred user
1912
- *
1913
- * @param string $wp_new_user_notification_email_admin Body of email notification
1914
- * @param array $user User inof
1915
- * @param string $blogname Blog name
1916
- * @return string Body for email notification
1917
- */
1918
- function apbct_registration__Wordpress__changeMailNotification($wp_new_user_notification_email_admin, $user, $blogname){
1919
-
1920
- global $apbct;
1921
-
1922
- $wp_new_user_notification_email_admin['message'] = PHP_EOL
1923
- .__('CleanTalk AntiSpam: This registration is spam.', 'cleantalk')
1924
- ."\n" . __('CleanTalk\'s anti-spam database:', 'cleantalk')
1925
- ."\n" . 'IP: ' . $apbct->sender_ip
1926
- ."\n" . 'Email: ' . $apbct->sender_email
1927
- .PHP_EOL . PHP_EOL .
1928
- __('Activate protection in your Anti-Spam Dashboard: ', 'clentalk')
1929
- .'https://cleantalk.org/my/?cp_mode=antispam&utm_source=newsletter&utm_medium=email&utm_campaign=wp_spam_registration_passed'
1930
- .($apbct->data['user_token']
1931
- ? '&iser_token='.$apbct->data['user_token']
1932
- : ''
1933
- )
1934
- .PHP_EOL . '---'
1935
- .PHP_EOL
1936
- .$wp_new_user_notification_email_admin['message'];
1937
-
1938
- return $wp_new_user_notification_email_admin;
1939
-
1940
-
1941
- }
1942
-
1943
- /**
1944
- * Checks Ultimate Members registration for spam
1945
- *
1946
- * @param $args forms arguments with names and values
1947
- *
1948
- * @return mixed
1949
- *
1950
- */
1951
- function apbct_registration__UltimateMembers__check( $args ){
1952
-
1953
- if ( isset( UM()->form()->errors ) ) {
1954
- $sender_info['previous_form_validation'] = true;
1955
- $sender_info['validation_notice'] = json_encode( UM()->form()->errors );
1956
- }
1957
-
1958
- global $apbct, $cleantalk_executed;
1959
-
1960
- if ($apbct->settings['registrations_test'] == 0)
1961
- return $args;
1962
-
1963
- $checkjs = apbct_js_test('ct_checkjs_register_form', $args);
1964
- $sender_info['post_checkjs_passed'] = $checkjs;
1965
-
1966
- // This hack can be helpfull when plugin uses with untested themes&signups plugins.
1967
- if ($checkjs == 0) {
1968
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
1969
- $sender_info['cookie_checkjs_passed'] = $checkjs;
1970
- }
1971
-
1972
- $base_call_result = apbct_base_call(
1973
- array(
1974
- 'sender_email' => $args['user_email'],
1975
- 'sender_nickname' => $args['user_login'],
1976
- 'sender_info' => $sender_info,
1977
- 'js_on' => $checkjs,
1978
- ),
1979
- true
1980
- );
1981
- $ct_result = $base_call_result['ct_result'];
1982
-
1983
- $cleantalk_executed = true;
1984
-
1985
- if ($ct_result->inactive != 0) {
1986
- ct_send_error_notice($ct_result->comment);
1987
- return $args;
1988
- }
1989
-
1990
- if ($ct_result->allow == 0)
1991
- UM()->form()->add_error('user_password', $ct_result->comment );
1992
-
1993
- return $args;
1994
- }
1995
-
1996
- /**
1997
- * Checks registration error and set it if it was dropped
1998
- * @return errors
1999
- */
2000
- function ct_check_registration_erros($errors, $sanitized_user_login = null, $user_email = null) {
2001
- global $bp, $ct_registration_error_comment;
2002
-
2003
- if($ct_registration_error_comment){
2004
-
2005
- if(isset($bp))
2006
- if(method_exists($bp, 'signup'))
2007
- if(method_exists($bp->signup, 'errors'))
2008
- if(isset($bp->signup->errors['signup_username']))
2009
- if($bp->signup->errors['signup_username'] != $ct_registration_error_comment)
2010
- $bp->signup->errors['signup_username'] = $ct_registration_error_comment;
2011
-
2012
- if(isset($errors))
2013
- if(method_exists($errors, 'errors'))
2014
- if(isset($errors->errors['ct_error']))
2015
- if($errors->errors['ct_error'][0] != $ct_registration_error_comment)
2016
- $errors->add('ct_error', $ct_registration_error_comment);
2017
-
2018
- }
2019
- return $errors;
2020
- }
2021
-
2022
- /**
2023
- * Set user meta (ct_hash) for successed registration
2024
- * @return null
2025
- */
2026
- function apbct_user_register($user_id) {
2027
- global $apbct_cookie_request_id_label;
2028
- if (isset($_COOKIE[$apbct_cookie_request_id_label])) {
2029
- if(update_user_meta($user_id, 'ct_hash', $_COOKIE[$apbct_cookie_request_id_label])){
2030
- setcookie($apbct_cookie_request_id_label, '0', 1, '/');
2031
- }
2032
- }
2033
- }
2034
-
2035
-
2036
- /**
2037
- * Test for JetPack contact form
2038
- */
2039
- function ct_grunion_contact_form_field_html($r, $field_label) {
2040
-
2041
- global $ct_checkjs_jpcf, $ct_jpcf_patched, $ct_jpcf_fields, $apbct;
2042
-
2043
- if ($apbct->settings['contact_forms_test'] == 1 && $ct_jpcf_patched === false && preg_match( "/(text|email)/i", $r)) {
2044
-
2045
- // Looking for element name prefix
2046
- $name_patched = false;
2047
- foreach ($ct_jpcf_fields as $v) {
2048
- if ($name_patched === false && preg_match("/(g\d-)$v/", $r, $matches)) {
2049
- $ct_checkjs_jpcf = $matches[1] . $ct_checkjs_jpcf;
2050
- $name_patched = true;
2051
- }
2052
- }
2053
-
2054
- $r .= ct_add_hidden_fields($ct_checkjs_jpcf, true);
2055
- $ct_jpcf_patched = true;
2056
- }
2057
-
2058
- return $r;
2059
- }
2060
- /**
2061
- * Test for JetPack contact form
2062
- */
2063
- function ct_contact_form_is_spam($form) {
2064
-
2065
- global $ct_checkjs_jpcf, $apbct;
2066
-
2067
- if ($apbct->settings['contact_forms_test'] == 0) {
2068
- return null;
2069
- }
2070
-
2071
- $js_field_name = $ct_checkjs_jpcf;
2072
- foreach ($_POST as $k => $v) {
2073
- if (preg_match("/^.+$ct_checkjs_jpcf$/", $k))
2074
- $js_field_name = $k;
2075
- }
2076
-
2077
- $sender_email = null;
2078
- $sender_nickname = null;
2079
- $message = '';
2080
- if (isset($form['comment_author_email']))
2081
- $sender_email = $form['comment_author_email'];
2082
-
2083
- if (isset($form['comment_author']))
2084
- $sender_nickname = $form['comment_author'];
2085
-
2086
- if (isset($form['comment_content']))
2087
- $message = $form['comment_content'];
2088
-
2089
- $base_call_result = apbct_base_call(
2090
- array(
2091
- 'message' => $message,
2092
- 'sender_email' => $sender_email,
2093
- 'sender_nickname' => $sender_nickname,
2094
- 'post_info' => array('comment_type' => 'contact_form_wordpress_grunion'),
2095
- 'sender_info' => array('sender_url' => @$form['comment_author_url']),
2096
- 'js_on' => apbct_js_test($js_field_name, $_POST),
2097
- )
2098
- );
2099
- $ct_result = $base_call_result['ct_result'];
2100
-
2101
- if ($ct_result->allow == 0) {
2102
- global $ct_comment;
2103
- $ct_comment = $ct_result->comment;
2104
- ct_die(null, null);
2105
- exit;
2106
- }
2107
-
2108
- return (bool) !$ct_result->allow;
2109
- }
2110
-
2111
- function ct_contact_form_is_spam_jetpack($is_spam,$form) {
2112
- global $ct_checkjs_jpcf, $apbct;
2113
-
2114
- if ($apbct->settings['contact_forms_test'] == 0) {
2115
- return null;
2116
- }
2117
-
2118
- $js_field_name = $ct_checkjs_jpcf;
2119
- foreach ($_POST as $k => $v) {
2120
- if (preg_match("/^.+$ct_checkjs_jpcf$/", $k))
2121
- $js_field_name = $k;
2122
- }
2123
-
2124
- $base_call_result = apbct_base_call(
2125
- array(
2126
- 'message' => isset($form['comment_content']) ? $form['comment_content'] : '',
2127
- 'sender_email' => isset($form['comment_author_email']) ? $form['comment_author_email'] : null,
2128
- 'sender_nickname' => isset($form['comment_author']) ? $form['comment_author'] : null,
2129
- 'post_info' => array('comment_type' => 'contact_form_wordpress_grunion'),
2130
- 'sender_info' => array('sender_url' => @$form['comment_author_url']),
2131
- )
2132
- );
2133
- $ct_result = $base_call_result['ct_result'];
2134
-
2135
- if ($ct_result->allow == 0) {
2136
- global $ct_comment;
2137
- $ct_comment = $ct_result->comment;
2138
- ct_die(null, null);
2139
- exit;
2140
- }
2141
-
2142
- return (bool) !$ct_result->allow;
2143
- }
2144
-
2145
- /**
2146
- * Inserts anti-spam hidden to WP Maintenance Mode (wpmm)
2147
- */
2148
- function apbct_form__wpmm__addField(){
2149
- ct_add_hidden_fields('ct_checkjs', false, true, true);
2150
- }
2151
-
2152
- /**
2153
- * Inserts anti-spam hidden to CF7
2154
- */
2155
- function apbct_form__contactForm7__addField($html) {
2156
- global $ct_checkjs_cf7, $apbct;
2157
-
2158
-
2159
-
2160
- if ($apbct->settings['contact_forms_test'] == 0) {
2161
- return $html;
2162
- }
2163
-
2164
- $html .= ct_add_hidden_fields($ct_checkjs_cf7, true);
2165
-
2166
- return $html;
2167
- }
2168
-
2169
- /**
2170
- * Test spam for Contact Fomr 7 (CF7) right before validation
2171
- *
2172
- * @global SpbcState $apbct
2173
- * @param type $result
2174
- * @param type $tags
2175
- * @return type
2176
- */
2177
- function apbct_form__contactForm7__tesSpam__before_validate($result = null, $tags = null) {
2178
- global $apbct;
2179
-
2180
- if ($result && method_exists($result, 'get_invalid_fields')){
2181
- $invalid_fields = $result->get_invalid_fields();
2182
- if(!empty($invalid_fields) && is_array($invalid_fields)){
2183
- $apbct->validation_error = $invalid_fields[key($invalid_fields)]['reason'];
2184
- apbct_form__contactForm7__testSpam(false);
2185
- }
2186
- }
2187
-
2188
- return $result;
2189
- }
2190
-
2191
- /**
2192
- * Test CF7 message for spam
2193
- */
2194
- function apbct_form__contactForm7__testSpam($param) {
2195
-
2196
- global $ct_checkjs_cf7, $apbct;
2197
-
2198
- if(
2199
- $apbct->settings['contact_forms_test'] == 0 ||
2200
- $param == false && WPCF7_VERSION < '3.0.0' ||
2201
- $param === true && WPCF7_VERSION >= '3.0.0' ||
2202
- $apbct->settings['protect_logged_in'] != 1 && is_user_logged_in() || // Skip processing for logged in users.
2203
- apbct_exclusions_check__url() ||
2204
- apbct_exclusions_check__ip() ||
2205
- isset($apbct->cf7_checked)
2206
- ){
2207
- return $param;
2208
- }
2209
-
2210
- $checkjs = apbct_js_test($ct_checkjs_cf7, $_POST)
2211
- ? apbct_js_test($ct_checkjs_cf7, $_POST)
2212
- : apbct_js_test('ct_checkjs', $_COOKIE);
2213
-
2214
- $ct_temp_msg_data = ct_get_fields_any($_POST);
2215
-
2216
- $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
2217
- $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
2218
- $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
2219
- $contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
2220
- $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
2221
- if ($subject != '') {
2222
- $message = array_merge(array('subject' => $subject), $message);
2223
- }
2224
-
2225
- $base_call_result = apbct_base_call(
2226
- array(
2227
- 'message' => $message,
2228
- 'sender_email' => $sender_email,
2229
- 'sender_nickname' => $sender_nickname,
2230
- 'js_on' => $checkjs,
2231
- 'post_info' => array('comment_type' => 'contact_form_wordpress_cf7'),
2232
- 'sender_info' => array(
2233
- 'form_validation' => !isset($apbct->validation_error)
2234
- ? null
2235
- : json_encode(array(
2236
- 'validation_notice' => $apbct->validation_error,
2237
- 'page_url' => apbct_get_server_variable( 'HTTP_HOST' ) . apbct_get_server_variable( 'REQUEST_URI' ),
2238
- ))
2239
- ),
2240
- )
2241
- );
2242
-
2243
- $ct_result = $base_call_result['ct_result'];
2244
-
2245
- // Change mail notification if license is out of date
2246
- if($apbct->data['moderate'] == 0 &&
2247
- ($ct_result->fast_submit == 1 || $ct_result->blacklisted == 1 || $ct_result->js_disabled == 1)
2248
- ){
2249
- $apbct->sender_email = $sender_email;
2250
- $apbct->sender_ip = CleantalkHelper::ip__get(array('real'));
2251
- add_filter('wpcf7_mail_components', 'apbct_form__contactForm7__changeMailNotification');
2252
- }
2253
-
2254
- if ($ct_result->allow == 0) {
2255
-
2256
- global $ct_cf7_comment;
2257
- $ct_cf7_comment = $ct_result->comment;
2258
-
2259
- add_filter('wpcf7_display_message', 'apbct_form__contactForm7__showResponse', 10, 2);
2260
-
2261
- $param = WPCF7_VERSION >= '3.0.0' ? true : false;
2262
-
2263
- }
2264
-
2265
- $apbct->cf7_checked = true;
2266
-
2267
- return $param;
2268
- }
2269
-
2270
- /**
2271
- * Changes CF7 status message
2272
- * @param string $hook URL of hooked page
2273
- */
2274
- function apbct_form__contactForm7__showResponse($message, $status = 'spam') {
2275
- global $ct_cf7_comment;
2276
-
2277
- if ($status == 'spam') {
2278
- $message = $ct_cf7_comment;
2279
- }
2280
-
2281
- return $message;
2282
- }
2283
-
2284
- /**
2285
- * Changes email notification for succes subscription for Contact Form 7
2286
- *
2287
- * @param array $component Arguments for email notification
2288
- * @return array Arguments for email notification
2289
- */
2290
- function apbct_form__contactForm7__changeMailNotification($component){
2291
-
2292
- global $apbct;
2293
-
2294
- $component['body'] =
2295
- __('CleanTalk AntiSpam: This message is spam.', 'cleantalk')
2296
- .PHP_EOL . __('CleanTalk\'s anti-spam database:', 'cleantalk')
2297
- .PHP_EOL . 'IP: ' . $apbct->sender_ip
2298
- .PHP_EOL . 'Email: ' . $apbct->sender_email
2299
- .PHP_EOL . sprintf(
2300
- __('Activate protection in your Anti-Spam Dashboard: %s.', 'clentalk'),
2301
- 'https://cleantalk.org/my/?cp_mode=antispam&utm_source=newsletter&utm_medium=email&utm_campaign=cf7_activate_antispam&user_token='.$apbct->user_token
2302
- )
2303
- .PHP_EOL . '---' . PHP_EOL . PHP_EOL
2304
- .$component['body'];
2305
-
2306
- return (array) $component;
2307
- }
2308
-
2309
- /**
2310
- * Test Ninja Forms message for spam
2311
- *
2312
- * @global SpbcState $apbct
2313
- * @return void
2314
- */
2315
- function apbct_form__ninjaForms__testSpam() {
2316
-
2317
- global $apbct;
2318
-
2319
- if(
2320
- $apbct->settings['contact_forms_test'] == 0
2321
- || ($apbct->settings['protect_logged_in'] != 1 && is_user_logged_in()) // Skip processing for logged in users.
2322
- || apbct_exclusions_check__url()
2323
- ){
2324
- return;
2325
- }
2326
-
2327
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
2328
-
2329
- // Choosing between POST and GET
2330
- $params = ct_get_fields_any(isset($_GET['ninja_forms_ajax_submit']) || isset($_GET['nf_ajax_submit']) ? $_GET : $_POST);
2331
-
2332
- $sender_email = ($params['email'] ? $params['email'] : '');
2333
- $sender_nickname = ($params['nickname'] ? $params['nickname'] : '');
2334
- $subject = ($params['subject'] ? $params['subject'] : '');
2335
- $message = ($params['message'] ? $params['message'] : array());
2336
- if ($subject != '') {
2337
- $message = array_merge(array('subject' => $subject), $message);
2338
- }
2339
-
2340
- //Ninja Forms xml fix
2341
- foreach ($message as $key => $value){
2342
- if (strpos($value, '<xml>') !== false)
2343
- unset($message[$key]);
2344
- }
2345
-
2346
- $base_call_result = apbct_base_call(
2347
- array(
2348
- 'message' => $message,
2349
- 'sender_email' => $sender_email,
2350
- 'sender_nickname' => $sender_nickname,
2351
- 'post_info' => array('comment_type' => 'contact_form_wordpress_ninja_froms'),
2352
- 'js_on' => $checkjs,
2353
- )
2354
- );
2355
- $ct_result = $base_call_result['ct_result'];
2356
-
2357
- // Change mail notification if license is out of date
2358
- if($apbct->data['moderate'] == 0 &&
2359
- ($ct_result->fast_submit == 1 || $ct_result->blacklisted == 1 || $ct_result->js_disabled == 1)
2360
- ){
2361
- $apbct->sender_email = $sender_email;
2362
- $apbct->sender_ip = CleantalkHelper::ip__get(array('real'));
2363
- add_filter('ninja_forms_action_email_message', 'apbct_form__ninjaForms__changeMailNotification', 1, 3);
2364
- }
2365
-
2366
- if ($ct_result->allow == 0) {
2367
-
2368
- // We have to use GLOBAL variable to transfer the comment to apbct_form__ninjaForms__changeResponse() function :(
2369
- $apbct->response = $ct_result->comment;
2370
- add_action( 'ninja_forms_before_response', 'apbct_form__ninjaForms__changeResponse', 10, 1 );
2371
- }
2372
- }
2373
-
2374
- function apbct_form__ninjaForms__changeResponse( $data ) {
2375
-
2376
- global $apbct;
2377
-
2378
- // Show error message below field found by ID
2379
- if(array_key_exists('email', $data['fields_by_key'])){
2380
- // Find ID of EMAIL field
2381
- $nf_field_id = $data['fields_by_key']['email']['id'];
2382
- }else{
2383
- // Find ID of last field (usually SUBMIT)
2384
- $nf_field_id = array_pop(array_keys($data['fields']));
2385
- }
2386
-
2387
- // Below is modified NJ logic
2388
- $error = array(
2389
- 'fields' => array(
2390
- $nf_field_id => $apbct->response,
2391
- ),
2392
- );
2393
-
2394
- $response = array( 'data' => $data, 'errors' => $error, 'debug' => '' );
2395
-
2396
- die(wp_json_encode( $response, JSON_FORCE_OBJECT ));
2397
-
2398
- }
2399
-
2400
- function apbct_form__seedprod_coming_soon__testSpam() {
2401
-
2402
- global $apbct;
2403
-
2404
- if(
2405
- $apbct->settings['contact_forms_test'] == 0
2406
- || ($apbct->settings['protect_logged_in'] != 1 && is_user_logged_in()) // Skip processing for logged in users.
2407
- || apbct_exclusions_check__url()
2408
- ){
2409
- return;
2410
- }
2411
-
2412
- $ct_temp_msg_data = ct_get_fields_any($_REQUEST);
2413
-
2414
- $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
2415
- $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
2416
- $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
2417
- $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
2418
- if ($subject != '') {
2419
- $message = array_merge(array('subject' => $subject), $message);
2420
- }
2421
-
2422
- $post_info['comment_type'] = 'contact_form_wordpress_seedprod_coming_soon';
2423
-
2424
- $base_call_result = apbct_base_call(
2425
- array(
2426
- 'message' => $message,
2427
- 'sender_email' => $sender_email,
2428
- 'sender_nickname' => $sender_nickname,
2429
- 'post_info' => $post_info,
2430
- )
2431
- );
2432
-
2433
- $ct_result = $base_call_result['ct_result'];
2434
- if ($ct_result->allow == 0) {
2435
- global $ct_comment;
2436
- $ct_comment = $ct_result->comment;
2437
-
2438
- $response = array(
2439
- 'status' => 200,
2440
- 'html' => "<h1>".__('Spam protection by CleanTalk', 'cleantalk')."</h1><h2>".$ct_result->comment."</h2>"
2441
- );
2442
-
2443
- echo sanitize_text_field($_GET['callback']) . '(' . json_encode($response) . ')';
2444
- exit();
2445
- }
2446
-
2447
- }
2448
-
2449
- /**
2450
- * Changes email notification for succes subscription for Ninja Forms
2451
- *
2452
- * @param string $message Body of email notification
2453
- * @return string Body for email notification
2454
- */
2455
- function apbct_form__ninjaForms__changeMailNotification($message, $data, $action_settings){
2456
-
2457
- global $apbct;
2458
-
2459
- if($action_settings['to'] !== $apbct->sender_email){
2460
-
2461
- $message .= wpautop(PHP_EOL . '---'
2462
- .PHP_EOL
2463
- .__('CleanTalk AntiSpam: This message is spam.', 'cleantalk')
2464
- .PHP_EOL . __('CleanTalk\'s anti-spam database:', 'cleantalk')
2465
- .PHP_EOL . 'IP: ' . $apbct->sender_ip
2466
- .PHP_EOL . 'Email: ' . $apbct->sender_email
2467
- .PHP_EOL .
2468
- __('Activate protection in your Anti-Spam Dashboard: ', 'clentalk').
2469
- 'https://cleantalk.org/my/?cp_mode=antispam&utm_source=newsletter&utm_medium=email&utm_campaign=ninjaform_activate_antispam'.$apbct->user_token
2470
- );
2471
- }
2472
-
2473
- return $message;
2474
- }
2475
-
2476
- /**
2477
- * Inserts anti-spam hidden to WPForms
2478
- *
2479
- * @global SpbcState $apbct
2480
- * @return void
2481
- */
2482
- function apbct_form__WPForms__addField($form_data, $some, $title, $description, $errors) {
2483
-
2484
- global $apbct;
2485
-
2486
- if($apbct->settings['contact_forms_test'] == 1)
2487
- ct_add_hidden_fields('checkjs_wpforms', false);
2488
-
2489
- }
2490
-
2491
- /**
2492
- * Gather fields data from submission and store it
2493
- *
2494
- * @param array $entry
2495
- * @param $form
2496
- *
2497
- * @return array
2498
- * @global SpbcState $apbct
2499
- */
2500
- function apbct_from__WPForms__gatherData($entry, $form){
2501
-
2502
- global $apbct;
2503
-
2504
- $data = array();
2505
- foreach($entry['fields'] as $key => $val){
2506
- $true_key = strtolower(str_replace(' ', '_', $form['fields'][$key]['label']));
2507
- $true_key = $true_key ? $true_key : $key;
2508
- $data[$true_key] = $val;
2509
- } unset($key, $val);
2510
-
2511
- $apbct->form_data = $data;
2512
-
2513
- return $entry;
2514
- }
2515
-
2516
- /**
2517
- * Adding error to form entry if message is spam
2518
- * Call spam test from here
2519
- *
2520
- * @param array $errors
2521
- * @param array $form_data
2522
- * @return array
2523
- */
2524
- function apbct_form__WPForms__showResponse($errors, $form_data) {
2525
-
2526
- if(empty($errors) || ( isset($form_data['id'], $errors[$form_data['id']]) && !count($errors[$form_data['id']]) ) ){
2527
-
2528
- $spam_comment = apbct_form__WPForms__testSpam();
2529
-
2530
- $filed_id = $form_data && !empty($form_data['fields']) && is_array($form_data['fields'])
2531
- ? key($form_data['fields'])
2532
- : 0;
2533
-
2534
- if($spam_comment)
2535
- $errors[ $form_data['id'] ][ $filed_id ] = $spam_comment;
2536
-
2537
- }
2538
-
2539
- return $errors;
2540
- }
2541
-
2542
- /**
2543
- * Test WPForms message for spam
2544
- * Doesn't hooked anywhere.
2545
- * Called directly from apbct_form__WPForms__showResponse()
2546
- *
2547
- * @global SpbcState $apbct
2548
- * @global array $apbct->form_data Contains form data
2549
- * @param array $errors Array of errors to write false result in
2550
- * @return void|array|null
2551
- */
2552
- function apbct_form__WPForms__testSpam() {
2553
-
2554
- global $apbct;
2555
-
2556
- if(
2557
- $apbct->settings['contact_forms_test'] == 0 ||
2558
- $apbct->settings['protect_logged_in'] != 1 && is_user_logged_in() // Skip processing for logged in users.
2559
- ){
2560
- return;
2561
- }
2562
-
2563
- $checkjs = apbct_js_test('checkjs_wpforms', $_POST);
2564
-
2565
- $params = ct_get_fields_any($apbct->form_data);
2566
-
2567
- $sender_email = ($params['email'] ? $params['email'] : '');
2568
- $sender_nickname = ($params['nickname'] ? $params['nickname'] : '');
2569
- $subject = ($params['subject'] ? $params['subject'] : '');
2570
- $message = ($params['message'] ? $params['message'] : array());
2571
- if ($subject != '') {
2572
- $message = array_merge(array('subject' => $subject), $message);
2573
- }
2574
-
2575
- $base_call_result = apbct_base_call(
2576
- array(
2577
- 'message' => $message,
2578
- 'sender_email' => $sender_email,
2579
- 'sender_nickname' => $sender_nickname,
2580
- 'post_info' => array('comment_type' => 'contact_form_wordpress_wp_forms'),
2581
- 'js_on' => $checkjs,
2582
- )
2583
- );
2584
- $ct_result = $base_call_result['ct_result'];
2585
-
2586
- // Change mail notification if license is out of date
2587
- if($apbct->data['moderate'] == 0 &&
2588
- ($ct_result->fast_submit == 1 || $ct_result->blacklisted == 1 || $ct_result->js_disabled == 1)
2589
- ){
2590
- $apbct->sender_email = $sender_email;
2591
- $apbct->sender_ip = CleantalkHelper::ip__get(array('real'));
2592
- add_filter('wpforms_email_message', 'apbct_form__WPForms__changeMailNotification', 100, 2);
2593
- }
2594
-
2595
- if ($ct_result->allow == 0){
2596
- return $ct_result->comment;
2597
- }
2598
-
2599
- return null;
2600
-
2601
- }
2602
-
2603
- /**
2604
- * Changes email notification for succes subscription for Ninja Forms
2605
- *
2606
- * @param string $message Body of email notification
2607
- * @param WPForms_WP_Emails $wpforms_email WPForms email class object
2608
- * @return string Body for email notification
2609
- */
2610
- function apbct_form__WPForms__changeMailNotification($message, $wpforms_email){
2611
-
2612
- global $apbct;
2613
-
2614
- $message = str_replace('</html>', '', $message);
2615
- $message = str_replace('</body>', '', $message);
2616
- $message .= wpautop(PHP_EOL . '---'
2617
- .PHP_EOL
2618
- .__('CleanTalk AntiSpam: This message is spam.', 'cleantalk')
2619
- .PHP_EOL . __('CleanTalk\'s anti-spam database:', 'cleantalk')
2620
- .PHP_EOL . 'IP: ' . '<a href="https://cleantalk.org/blacklists/' . $apbct->sender_ip . '?utm_source=newsletter&utm_medium=email&utm_campaign=wpforms_spam_passed" target="_blank">' . $apbct->sender_ip . '</a>'
2621
- .PHP_EOL . 'Email: ' . '<a href="https://cleantalk.org/blacklists/' . $apbct->sender_email . '?utm_source=newsletter&utm_medium=email&utm_campaign=wpforms_spam_passed" target="_blank">' . $apbct->sender_email . '</a>'
2622
- .PHP_EOL . sprintf(
2623
- __('Activate protection in your %sAnti-Spam Dashboard%s.', 'clentalk'),
2624
- '<a href="https://cleantalk.org/my/?cp_mode=antispam&utm_source=newsletter&utm_medium=email&utm_campaign=wpforms_activate_antispam" target="_blank">',
2625
- '</a>'
2626
- ))
2627
- .'</body></html>';
2628
-
2629
- return $message;
2630
-
2631
- }
2632
-
2633
- /*
2634
- * QuForms check spam
2635
- * works with singl-paged forms
2636
- * and with multi-paged forms - check only last step of the forms
2637
- */
2638
- function ct_quform_post_validate($result, $form) {
2639
-
2640
- if ( $form->hasPages() ) {
2641
- $comment_type = 'contact_form_wordpress_quforms_multipage';
2642
- } else {
2643
- $comment_type = 'contact_form_wordpress_quforms_singlepage';
2644
- }
2645
-
2646
- $ct_temp_msg_data = ct_get_fields_any( $form->getValues() );
2647
- // @ToDo If we have several emails at the form - will be used only the first detected!
2648
- $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
2649
-
2650
- $checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
2651
- $base_call_result = apbct_base_call(
2652
- array(
2653
- 'message' => $form->getValues(),
2654
- 'sender_email' => $sender_email,
2655
- 'post_info' => array('comment_type' => $comment_type),
2656
- 'js_on' => $checkjs,
2657
- )
2658
- );
2659
-
2660
- $ct_result = $base_call_result['ct_result'];
2661
- if ($ct_result->allow == 0) {
2662
- die(json_encode(array('type' => 'error', 'apbct' => array('blocked' => true, 'comment' => $ct_result->comment))));
2663
- } else {
2664
- return $result;
2665
- }
2666
-
2667
- return $result;
2668
-
2669
- }
2670
-
2671
- /**
2672
- * Inserts anti-spam hidden to Fast Secure contact form
2673
- */
2674
- function ct_si_contact_display_after_fields($string = '', $style = '', $form_errors = array(), $form_id_num = 0) {
2675
- $string .= ct_add_hidden_fields('ct_checkjs', true);
2676
- return $string;
2677
- }
2678
-
2679
- /**
2680
- * Test for Fast Secure contact form
2681
- */
2682
- function ct_si_contact_form_validate($form_errors = array(), $form_id_num = 0) {
2683
- global $apbct, $cleantalk_executed;
2684
-
2685
- if (!empty($form_errors))
2686
- return $form_errors;
2687
-
2688
- if ($apbct->settings['contact_forms_test'] == 0)
2689
- return $form_errors;
2690
-
2691
- // Skip processing because data already processed.
2692
- if ($cleantalk_executed) {
2693
- return $form_errors;
2694
- }
2695
-
2696
- //getting info from custom fields
2697
- $ct_temp_msg_data = ct_get_fields_any($_POST);
2698
-
2699
- $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
2700
- $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
2701
- $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
2702
- $contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
2703
- $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
2704
- if($subject != '') {
2705
- $message['subject'] = $subject;
2706
- }
2707
-
2708
- $base_call_result = apbct_base_call(
2709
- array(
2710
- 'message' => $message,
2711
- 'sender_email' => $sender_email,
2712
- 'sender_nickname' => $sender_nickname,
2713
- 'post_info' => array('comment_type' => 'contact_form_wordpress_fscf'),
2714
- 'js_on' => apbct_js_test('ct_checkjs', $_POST),
2715
- )
2716
- );
2717
-
2718
- $ct_result = $base_call_result['ct_result'];
2719
-
2720
- $cleantalk_executed = true;
2721
-
2722
- if ($ct_result->allow == 0) {
2723
- global $ct_comment;
2724
- $ct_comment = $ct_result->comment;
2725
- ct_die(null, null);
2726
- exit;
2727
- }
2728
-
2729
- return $form_errors;
2730
- }
2731
-
2732
- /**
2733
- * Notice for commentators which comment has automatically approved by plugin
2734
- * @param string $hook URL of hooked page
2735
- */
2736
- function ct_comment_text($comment_text) {
2737
- global $comment, $ct_approved_request_id_label;
2738
-
2739
- if (isset($_COOKIE[$ct_approved_request_id_label]) && isset($comment->comment_ID)) {
2740
- $ct_hash = get_comment_meta($comment->comment_ID, 'ct_hash', true);
2741
-
2742
- if ($ct_hash !== '' && $_COOKIE[$ct_approved_request_id_label] == $ct_hash) {
2743
- $comment_text .= '<br /><br /> <em class="comment-awaiting-moderation">' . __('Comment approved. Anti-spam by CleanTalk.', 'cleantalk') . '</em>';
2744
- }
2745
- }
2746
-
2747
- return $comment_text;
2748
- }
2749
-
2750
-
2751
- /**
2752
- * Checks WordPress Landing Pages raw $_POST values
2753
- */
2754
- function ct_check_wplp(){
2755
-
2756
- global $ct_wplp_result_label, $apbct;
2757
-
2758
- if (!isset($_COOKIE[$ct_wplp_result_label])) {
2759
- // First AJAX submit of WPLP form
2760
- if ($apbct->settings['contact_forms_test'] == 0)
2761
- return;
2762
-
2763
- $post_info['comment_type'] = 'feedback';
2764
- $post_info = json_encode($post_info);
2765
- if ($post_info === false)
2766
- $post_info = '';
2767
-
2768
- $sender_email = '';
2769
- foreach ($_POST as $v) {
2770
- if (preg_match("/^\S+@\S+\.\S+$/", $v)) {
2771
- $sender_email = $v;
2772
- break;
2773
- }
2774
- }
2775
-
2776
- $message = '';
2777
- if(array_key_exists('form_input_values', $_POST)){
2778
- $form_input_values = json_decode(stripslashes($_POST['form_input_values']), true);
2779
- if (is_array($form_input_values) && array_key_exists('null', $form_input_values))
2780
- $message = $form_input_values['null'];
2781
- } else if (array_key_exists('null', $_POST)) {
2782
- $message = $_POST['null'];
2783
- }
2784
-
2785
- $base_call_result = apbct_base_call(
2786
- array(
2787
- 'message' => $message,
2788
- 'sender_email' => $sender_email,
2789
- 'post_info' => array('comment_type' => 'contact_form_wordpress_wplp'),
2790
- )
2791
- );
2792
-
2793
- $ct_result = $base_call_result['ct_result'];
2794
-
2795
- if ($ct_result->allow == 0) {
2796
- $cleantalk_comment = $ct_result->comment;
2797
- } else {
2798
- $cleantalk_comment = 'OK';
2799
- }
2800
-
2801
- setcookie($ct_wplp_result_label, $cleantalk_comment, strtotime("+5 seconds"), '/');
2802
- } else {
2803
- // Next POST/AJAX submit(s) of same WPLP form
2804
- $cleantalk_comment = $_COOKIE[$ct_wplp_result_label];
2805
- }
2806
- if ($cleantalk_comment !== 'OK')
2807
- ct_die_extended($cleantalk_comment);
2808
- }
2809
-
2810
- /**
2811
- * Places a hidding field to Gravity forms.
2812
- * @return string
2813
- */
2814
- function apbct_form__gravityForms__addField($form_string, $form){
2815
- $ct_hidden_field = 'ct_checkjs';
2816
-
2817
- // Do not add a hidden field twice.
2818
- if (preg_match("/$ct_hidden_field/", $form_string)) {
2819
- return $form_string;
2820
- }
2821
-
2822
- $search = "</form>";
2823
-
2824
- // Adding JS code
2825
- $js_code = ct_add_hidden_fields($ct_hidden_field, true, false);
2826
- $form_string = str_replace($search, $js_code . $search, $form_string);
2827
-
2828
- // Adding field for multipage form. Look for cleantalk.php -> apbct_cookie();
2829
- $append_string = isset($form['lastPageButton']) ? "<input type='hidden' name='ct_multipage_form' value='yes'>" : '';
2830
- $form_string = str_replace($search, $append_string.$search, $form_string);
2831
-
2832
- return $form_string;
2833
- }
2834
-
2835
- /**
2836
- * Gravity forms anti-spam test.
2837
- * @return boolean
2838
- */
2839
- function apbct_form__gravityForms__testSpam($is_spam, $form, $entry) {
2840
-
2841
- global $apbct, $cleantalk_executed, $ct_gform_is_spam, $ct_gform_response;
2842
-
2843
- if (
2844
- $apbct->settings['contact_forms_test'] == 0 ||
2845
- $is_spam ||
2846
- $cleantalk_executed // Return unchanged result if the submission was already tested.
2847
- )
2848
- return $is_spam;
2849
-
2850
- $ct_temp = array();
2851
- foreach($entry as $key => $value){
2852
- if(is_numeric($key))
2853
- $ct_temp[$key]=$value;
2854
- } unset($key, $value);
2855
-
2856
- $ct_temp_msg_data = ct_get_fields_any($ct_temp);
2857
- $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
2858
- $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
2859
- $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
2860
- $contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
2861
- $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
2862
-
2863
- // Adding 'input_' to every field /Gravity Forms fix/
2864
- $message = array_flip($message);
2865
- foreach($message as &$value){
2866
- $value = 'input_'.$value;
2867
- } unset($value);
2868
- $message = array_flip($message);
2869
-
2870
- if($subject != '')
2871
- $message['subject'] = $subject;
2872
-
2873
- $checkjs = apbct_js_test('ct_checkjs', $_POST)
2874
- ? apbct_js_test('ct_checkjs', $_POST)
2875
- : apbct_js_test('ct_checkjs', $_COOKIE);
2876
-
2877
- $base_call_result = apbct_base_call(
2878
- array(
2879
- 'message' => $message,
2880
- 'sender_email' => $sender_email,
2881
- 'sender_nickname' => $sender_nickname,
2882
- 'post_info' => array('comment_type' => 'contact_form_wordpress_gravity_forms'),
2883
- 'js_on' => $checkjs,
2884
- )
2885
- );
2886
-
2887
- $ct_result = $base_call_result['ct_result'];
2888
- if ($ct_result->allow == 0) {
2889
- $is_spam = true;
2890
- $ct_gform_is_spam = true;
2891
- $ct_gform_response = $ct_result->comment;
2892
- }
2893
-
2894
- return $is_spam;
2895
- }
2896
-
2897
- function apbct_form__gravityForms__showResponse( $confirmation, $form, $entry, $ajax ){
2898
-
2899
- global $ct_gform_is_spam, $ct_gform_response;
2900
-
2901
- if(!empty($ct_gform_is_spam)){
2902
- $confirmation = '<a id="gf_'.$form['id'].'" class="gform_anchor" ></a><div id="gform_confirmation_wrapper_'.$form['id'].'" class="gform_confirmation_wrapper "><div id="gform_confirmation_message_'.$form['id'].'" class="gform_confirmation_message_'.$form['id'].' gform_confirmation_message"><font style="color: red">'.$ct_gform_response.'</font></div></div>';
2903
- }
2904
-
2905
- return $confirmation;
2906
- }
2907
-
2908
- /**
2909
- * Test S2member registration
2910
- * @return array with errors
2911
- */
2912
- function ct_s2member_registration_test($post_key) {
2913
-
2914
- global $apbct;
2915
-
2916
- if ($apbct->settings['registrations_test'] == 0) {
2917
- return null;
2918
- }
2919
-
2920
- $sender_email = isset($_POST[$post_key]['email']) ? sanitize_email($_POST[$post_key]['email']) : null;
2921
- $sender_nickname = isset($_POST[$post_key]['username']) ? sanitize_email($_POST[$post_key]['username']) : null;
2922
-
2923
- //Making a call
2924
- $base_call_result = apbct_base_call(
2925
- array(
2926
- 'sender_email' => $sender_email,
2927
- 'sender_nickname' => $sender_nickname,
2928
- ),
2929
- true
2930
- );
2931
- $ct_result = $base_call_result['ct_result'];
2932
-
2933
- if ($ct_result->allow == 0) {
2934
- ct_die_extended($ct_result->comment);
2935
- }
2936
-
2937
- return true;
2938
- }
2939
-
2940
- function apbct_form__the7_contact_form() {
2941
-
2942
- global $cleantalk_executed;
2943
-
2944
- if ( check_ajax_referer( 'dt_contact_form', 'nonce', false ) && isset($_POST) ) {
2945
-
2946
- $post_info['comment_type'] = 'contact_the7_theme_contact_form';
2947
-
2948
- $ct_temp_msg_data = ct_get_fields_any($_POST);
2949
-
2950
- $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
2951
- $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
2952
- $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
2953
- $contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
2954
- $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
2955
- if ($subject != '') {
2956
- $message = array_merge(array('subject' => $subject), $message);
2957
- }
2958
-
2959
- // Skip submission if no data found
2960
- if ($sender_email === ''|| !$contact_form) {
2961
- return false;
2962
- }
2963
- $cleantalk_executed = true;
2964
-
2965
- $base_call_result = apbct_base_call(
2966
- array(
2967
- 'message' => $message,
2968
- 'sender_email' => $sender_email,
2969
- 'sender_nickname' => $sender_nickname,
2970
- 'post_info' => $post_info,
2971
- )
2972
- );
2973
-
2974
- $ct_result = $base_call_result['ct_result'];
2975
- if ($ct_result->allow == 0) {
2976
-
2977
- $response = json_encode(
2978
- array(
2979
- 'success' => false ,
2980
- 'errors' => $ct_result->comment,
2981
- 'nonce' => wp_create_nonce( 'dt_contact_form' )
2982
- )
2983
- );
2984
-
2985
- // response output
2986
- header( "Content-Type: application/json" );
2987
- echo $response;
2988
-
2989
- // IMPORTANT: don't forget to "exit"
2990
- exit;
2991
-
2992
- }
2993
-
2994
- }
2995
-
2996
- }
2997
-
2998
- function apbct_form__elementor_pro__testSpam() {
2999
-
3000
- global $apbct, $cleantalk_executed;
3001
-
3002
- if(
3003
- $apbct->settings['contact_forms_test'] == 0
3004
- || ($apbct->settings['protect_logged_in'] != 1 && is_user_logged_in()) // Skip processing for logged in users.
3005
- || apbct_exclusions_check__url()
3006
- ){
3007
- return;
3008
- }
3009
-
3010
- $ct_temp_msg_data = ct_get_fields_any($_POST);
3011
-
3012
- $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
3013
- $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
3014
- $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
3015
- $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
3016
- if ($subject != '') {
3017
- $message = array_merge(array('subject' => $subject), $message);
3018
- }
3019
-
3020
- $post_info['comment_type'] = 'contact_form_wordpress_elementor_pro';
3021
-
3022
- $cleantalk_executed = true;
3023
- $base_call_result = apbct_base_call(
3024
- array(
3025
- 'message' => $message,
3026
- 'sender_email' => $sender_email,
3027
- 'sender_nickname' => $sender_nickname,
3028
- 'post_info' => $post_info,
3029
- )
3030
- );
3031
-
3032
- $ct_result = $base_call_result['ct_result'];
3033
-
3034
- if ($ct_result->allow == 0) {
3035
-
3036
- wp_send_json_error( array(
3037
- 'message' => $ct_result->comment,
3038
- 'data' => array()
3039
- ) );
3040
-
3041
- }
3042
-
3043
- }
3044
-
3045
- /**
3046
- * General test for any contact form
3047
- */
3048
- function ct_contact_form_validate() {
3049
-
3050
- global $pagenow,$cleantalk_executed ,$apbct, $ct_checkjs_frm;
3051
-
3052
- // Exclusios common function
3053
- if ( apbct_exclusions_check(__FUNCTION__) )
3054
- return null;
3055
-
3056
- if (@sizeof($_POST)==0 ||
3057
- (isset($_POST['signup_username']) && isset($_POST['signup_email']) && isset($_POST['signup_password'])) ||
3058
- (isset($pagenow) && $pagenow == 'wp-login.php') || // WordPress log in form
3059
- (isset($pagenow) && $pagenow == 'wp-login.php' && isset($_GET['action']) && $_GET['action']=='lostpassword') ||
3060
- apbct_is_in_referer( 'lostpassword' ) ||
3061
- apbct_is_in_referer( 'lost-password' ) || //Skip lost-password form check
3062
- (apbct_is_in_uri('/wp-admin/') && (empty($_POST['your-phone']) && empty($_POST['your-email']) && empty($_POST['your-message']))) || //Bitrix24 Contact
3063
- apbct_is_in_uri('wp-login.php') ||
3064
- apbct_is_in_uri('wp-comments-post.php') ||
3065
- apbct_is_in_uri('?provider=facebook&') ||
3066
- apbct_is_in_uri('reset-password/') || // Ticket #13668. Password reset.
3067
- apbct_is_in_referer( '/wp-admin/') ||
3068
- apbct_is_in_uri('/login/') ||
3069
- apbct_is_in_uri( '/my-account/edit-account/') || // WooCommerce edit account page
3070
- apbct_is_in_uri( '/my-account/edit-address/') || // WooCommerce edit account page
3071
- (isset($_POST['action']) && $_POST['action'] == 'save_account_details') || // WooCommerce edit account action
3072
- apbct_is_in_uri( '/peepsoajax/profilefieldsajax.validate_register') ||
3073
- isset($_GET['ptype']) && $_GET['ptype']=='login' ||
3074
- isset($_POST['ct_checkjs_register_form']) ||
3075
- (isset($_POST['signup_username']) && isset($_POST['signup_password_confirm']) && isset($_POST['signup_submit']) ) ||
3076
- $apbct->settings['general_contact_forms_test'] == 0 ||
3077
- isset($_POST['bbp_topic_content']) ||
3078
- isset($_POST['bbp_reply_content']) ||
3079
- isset($_POST['fscf_submitted']) ||
3080
- apbct_is_in_uri('/wc-api/') ||
3081
- isset($_POST['log']) && isset($_POST['pwd']) && isset($_POST['wp-submit']) ||
3082
- isset($_POST[$ct_checkjs_frm]) && $apbct->settings['contact_forms_test'] == 1 ||// Formidable forms
3083
- isset($_POST['comment_post_ID']) || // The comment form
3084
- isset($_GET['for']) ||
3085
- (isset($_POST['log'], $_POST['pwd'])) || //WooCommerce Sensei login form fix
3086
- (isset($_POST['wc_reset_password'], $_POST['_wpnonce'], $_POST['_wp_http_referer'])) || // WooCommerce recovery password form
3087
- ((isset($_POST['woocommerce-login-nonce']) || isset($_POST['_wpnonce'])) && isset($_POST['login'], $_POST['password'], $_POST['_wp_http_referer'])) || // WooCommerce login form
3088
- (isset($_POST['wc-api']) && strtolower($_POST['wc-api']) == 'wc_gateway_systempay') || // Woo Systempay payment plugin
3089
- (isset($_POST['_wpcf7'], $_POST['_wpcf7_version'], $_POST['_wpcf7_locale'])) || //CF7 fix)
3090
- (isset($_POST['hash'], $_POST['device_unique_id'], $_POST['device_name'])) ||//Mobile Assistant Connector fix
3091
- isset($_POST['gform_submit']) || //Gravity form
3092
- apbct_is_in_uri( 'wc-ajax=get_refreshed_fragments') ||
3093
- (isset($_POST['ccf_form']) && intval($_POST['ccf_form']) == 1) ||
3094
- (isset($_POST['contact_tags']) && strpos($_POST['contact_tags'], 'MBR:') !== false) ||
3095
- (apbct_is_in_uri( 'bizuno.php') && !empty($_POST['bizPass'])) ||
3096
- apbct_is_in_referer( 'my-dashboard/' ) || // ticket_id=7885
3097
- isset($_POST['slm_action'], $_POST['license_key'], $_POST['secret_key'], $_POST['registered_domain']) || // ticket_id=9122
3098
- (isset($_POST['wpforms']['submit']) && $_POST['wpforms']['submit'] == 'wpforms-submit') || // WPForms
3099
- (isset($_POST['action']) && $_POST['action'] == 'grunion-contact-form') || // JetPack
3100
- (isset($_POST['action']) && $_POST['action'] == 'bbp-update-user') || //BBP update user info page
3101
- apbct_is_in_referer( '?wc-api=WC_Gateway_Transferuj' ) || //WC Gateway
3102
- (isset($_GET['mbr'], $_GET['amp;appname'], $_GET['amp;master'])) || // ticket_id=10773
3103
- (isset($_POST['call_function']) && $_POST['call_function'] == 'push_notification_settings') || // Skip mobile requests (push settings)
3104
- apbct_is_in_uri('membership-login') || // Skip login form
3105
- (isset($_GET['cookie-state-change'])) || //skip GDPR plugin
3106
- ( apbct_get_server_variable( 'HTTP_USER_AGENT' ) == 'MailChimp' && apbct_is_in_uri( 'mc4wp-sync-api/webhook-listener') ) || // Mailchimp webhook skip
3107
- apbct_is_in_uri('researcher-log-in') || // Skip login form
3108
- apbct_is_in_uri('admin_aspcms/_system/AspCms_SiteSetting.asp?action=saves') || // Skip admin save callback
3109
- apbct_is_in_uri('?profile_tab=postjobs') || // Skip post vacancies
3110
- (isset($_POST['btn_insert_post_type_hotel']) && $_POST['btn_insert_post_type_hotel'] == 'SUBMIT HOTEL') || // Skip adding hotel
3111
- (isset($_POST['action']) && $_POST['action'] == 'updraft_savesettings') || // Updraft save settings
3112
- isset($_POST['quform_submit']) || //QForms multi-paged form skip
3113
- (isset($_POST['wpum_form']) && $_POST['wpum_form'] == 'login') || //WPUM login skip
3114
- isset($_POST['password']) || // Exception for login form. From Analysis uid=406596
3115
- (isset($_POST['action']) && $_POST['action'] == 'wilcity_reset_password') || // Exception for reset password form. From Analysis uid=430898
3116
- (isset($_POST['action']) && $_POST['action'] == 'wilcity_login') || // Exception for login form. From Analysis uid=430898
3117
- (isset($_POST['qcfsubmit'])) || //Exception for submit quick forms - duplicates with qcfvalidate
3118
- apbct_is_in_uri('tin-canny-learndash-reporting/src/h5p-xapi/process-xapi-statement.php?v=asd') //Skip Tin Canny plugin
3119
- ) {
3120
- return null;
3121
- }
3122
-
3123
- //Skip woocommerce checkout
3124
- if (apbct_is_in_uri('wc-ajax=update_order_review') || apbct_is_in_uri('wc-ajax=checkout') || !empty($_POST['woocommerce_checkout_place_order']) || apbct_is_in_uri('wc-ajax=wc_ppec_start_checkout') || apbct_is_in_referer('wc-ajax=update_order_review')) {
3125
- return null;
3126
- }
3127
- // Do not execute anti-spam test for logged in users.
3128
- if (isset($_COOKIE[LOGGED_IN_COOKIE]) && $apbct->settings['protect_logged_in'] != 1)
3129
- return null;
3130
-
3131
- $post_info['comment_type'] = 'feedback_general_contact_form';
3132
-
3133
- $ct_temp_msg_data = ct_get_fields_any($_POST);
3134
-
3135
- $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
3136
- $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
3137
- $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
3138
- $contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
3139
- $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
3140
- if ($subject != '') {
3141
- $message = array_merge(array('subject' => $subject), $message);
3142
- }
3143
-
3144
- // Skip submission if no data found
3145
- if ($sender_email === ''|| !$contact_form) {
3146
- return false;
3147
- }
3148
- $cleantalk_executed=true;
3149
-
3150
- if(isset($_POST['TellAFriend_Link'])){
3151
- $tmp = $_POST['TellAFriend_Link'];
3152
- unset($_POST['TellAFriend_Link']);
3153
- }
3154
-
3155
- $base_call_result = apbct_base_call(
3156
- array(
3157
- 'message' => $message,
3158
- 'sender_email' => $sender_email,
3159
- 'sender_nickname' => $sender_nickname,
3160
- 'post_info' => $post_info,
3161
- )
3162
- );
3163
-
3164
- if(isset($_POST['TellAFriend_Link'])){
3165
- $_POST['TellAFriend_Link']=$tmp;
3166
- }
3167
-
3168
- $ct_result = $base_call_result['ct_result'];
3169
- if ($ct_result->allow == 0) {
3170
-
3171
- // Recognize contact form an set it's name to $contact_form to use later
3172
- $contact_form = null;
3173
- foreach($_POST as $param => $value){
3174
- if(strpos($param, 'et_pb_contactform_submit') === 0){
3175
- $contact_form = 'contact_form_divi_theme';
3176
- $contact_form_additional = str_replace('et_pb_contactform_submit', '', $param);
3177
- }
3178
- if(strpos($param, 'avia_generated_form') === 0){
3179
- $contact_form = 'contact_form_enfold_theme';
3180
- $contact_form_additional = str_replace('avia_generated_form', '', $param);
3181
- }
3182
- if(!empty($contact_form))
3183
- break;
3184
- }
3185
-
3186
- $ajax_call = false;
3187
- if ((defined( 'DOING_AJAX' ) && DOING_AJAX)
3188
- ) {
3189
- $ajax_call = true;
3190
- }
3191
- if ($ajax_call) {
3192
- echo $ct_result->comment;
3193
- } else {
3194
-
3195
- global $ct_comment;
3196
- $ct_comment = $ct_result->comment;
3197
- if(isset($_POST['cma-action'])&&$_POST['cma-action']=='add'){
3198
- $result=Array('success'=>0, 'thread_id'=>null,'messages'=>Array($ct_result->comment));
3199
- header("Content-Type: application/json");
3200
- print json_encode($result);
3201
- die();
3202
-
3203
- }else if(isset($_POST['TellAFriend_email'])){
3204
- echo $ct_result->comment;
3205
- die();
3206
-
3207
- }else if(isset($_POST['gform_submit'])){ // Gravity forms submission
3208
- $response = sprintf("<!DOCTYPE html><html><head><meta charset='UTF-8' /></head><body class='GF_AJAX_POSTBACK'><div id='gform_confirmation_wrapper_1' class='gform_confirmation_wrapper '><div id='gform_confirmation_message_1' class='gform_confirmation_message_1
3209
- gform_confirmation_message'>%s</div></div></body></html>",
3210
- $ct_result->comment
3211
- );
3212
- echo $response;
3213
- die();
3214
-
3215
- }elseif(isset($_POST['action']) && $_POST['action'] == 'ct_check_internal'){
3216
- return $ct_result->comment;
3217
-
3218
- }elseif(isset($_POST['vfb-submit']) && defined('VFB_VERSION')){
3219
- wp_die("<h1>".__('Spam protection by CleanTalk', 'cleantalk')."</h1><h2>".$ct_result->comment."</h2>", '', array('response' => 403, "back_link" => true, "text_direction" => 'ltr'));
3220
- // Caldera Contact Forms
3221
- }elseif(isset($_POST['action']) && $_POST['action'] == 'cf_process_ajax_submit'){
3222
- print json_encode("<h3 style='color: red;'><red>".$ct_result->comment);
3223
- die();
3224
- // Mailster
3225
- }elseif(isset($_POST['_referer'], $_POST['formid'], $_POST['email'])){
3226
- $return = array(
3227
- 'success' => false,
3228
- 'html' => '<p>' . $ct_result->comment . '</p>',
3229
- );
3230
- print json_encode($return);
3231
- die();
3232
- // Divi Theme Contact Form. Using $contact_form
3233
- }elseif(!empty($contact_form) && $contact_form == 'contact_form_divi_theme'){
3234
- echo "<div id='et_pb_contact_form{$contact_form_additional}'><h1>Your request looks like spam.</h1><div><p>{$ct_result->comment}</p></div></div>";
3235
- die();
3236
- // Enfold Theme Contact Form. Using $contact_form
3237
- }elseif(!empty($contact_form) && $contact_form == 'contact_form_enfold_theme'){
3238
- echo "<div id='ajaxresponse_1' class='ajaxresponse ajaxresponse_1' style='display: block;'><div id='ajaxresponse_1' class='ajaxresponse ajaxresponse_1'><h3 class='avia-form-success'>Antispam by CleanTalk: ".$ct_result->comment."</h3><a href='.'><-Back</a></div></div>";
3239
- die();
3240
- }else{
3241
- ct_die(null, null);
3242
- }
3243
- }
3244
- exit;
3245
- }
3246
-
3247
- return null;
3248
- }
3249
-
3250
- /**
3251
- * General test for any post data
3252
- */
3253
- function ct_contact_form_validate_postdata() {
3254
-
3255
- global $apbct, $pagenow,$cleantalk_executed;
3256
-
3257
- // Exclusios common function
3258
- if ( apbct_exclusions_check(__FUNCTION__) )
3259
- return null;
3260
-
3261
- if (@sizeof($_POST)==0 ||
3262
- (isset($_POST['signup_username']) && isset($_POST['signup_email']) && isset($_POST['signup_password'])) ||
3263
- (isset($pagenow) && $pagenow == 'wp-login.php') || // WordPress log in form
3264
- (isset($pagenow) && $pagenow == 'wp-login.php' && isset($_GET['action']) && $_GET['action']=='lostpassword') ||
3265
- apbct_is_in_uri('/checkout/') ||
3266
- /* WooCommerce Service Requests - skip them */
3267
- isset($_GET['wc-ajax']) && (
3268
- $_GET['wc-ajax']=='checkout' ||
3269
- $_GET['wc-ajax']=='get_refreshed_fragments' ||
3270
- $_GET['wc-ajax']=='apply_coupon' ||
3271
- $_GET['wc-ajax']=='remove_coupon' ||
3272
- $_GET['wc-ajax']=='update_shipping_method' ||
3273
- $_GET['wc-ajax']=='get_cart_totals' ||
3274
- $_GET['wc-ajax']=='update_order_review' ||
3275
- $_GET['wc-ajax']=='add_to_cart' ||
3276
- $_GET['wc-ajax']=='remove_from_cart' ||
3277
- $_GET['wc-ajax']=='get_variation' ||
3278
- $_GET['wc-ajax']=='get_customer_location'
3279
- ) ||
3280
- /* END: WooCommerce Service Requests */
3281
- apbct_is_in_uri('/wp-admin/') ||
3282
- apbct_is_in_uri('wp-login.php') ||
3283
- apbct_is_in_uri('wp-comments-post.php') ||
3284
- apbct_is_in_referer('/wp-admin/') ||
3285
- apbct_is_in_uri('/login/') ||
3286
- apbct_is_in_uri('?provider=facebook&') ||
3287
- isset($_GET['ptype']) && $_GET['ptype']=='login' ||
3288
- isset($_POST['ct_checkjs_register_form']) ||
3289
- (isset($_POST['signup_username']) && isset($_POST['signup_password_confirm']) && isset($_POST['signup_submit']) ) ||
3290
- $apbct->settings['general_contact_forms_test']==0 ||
3291
- isset($_POST['bbp_topic_content']) ||
3292
- isset($_POST['bbp_reply_content']) ||
3293
- isset($_POST['fscf_submitted']) ||
3294
- isset($_POST['log']) && isset($_POST['pwd']) && isset($_POST['wp-submit'])||
3295
- apbct_is_in_uri('/wc-api/') ||
3296
- (isset($_POST['wc_reset_password'], $_POST['_wpnonce'], $_POST['_wp_http_referer'])) || //WooCommerce recovery password form
3297
- (isset($_POST['woocommerce-login-nonce'], $_POST['login'], $_POST['password'], $_POST['_wp_http_referer'])) || //WooCommerce login form
3298
- (isset($_POST['provider'], $_POST['authcode']) && $_POST['provider'] == 'Two_Factor_Totp') || //TwoFactor authorization
3299
- (isset($_GET['wc-ajax']) && $_GET['wc-ajax'] == 'sa_wc_buy_now_get_ajax_buy_now_button') || //BuyNow add to cart
3300
- apbct_is_in_uri('/wp-json/wpstatistics/v1/hit') || //WPStatistics
3301
- (isset($_POST['ihcaction']) && $_POST['ihcaction'] == 'login') || //Skip login form
3302
- (isset($_POST['action']) && $_POST['action'] == 'infinite_scroll') || //Scroll
3303
- isset($_POST['gform_submit']) //Skip gravity checking because of direct integration
3304
- ) {
3305
- return null;
3306
- }
3307
-
3308
- $message = ct_get_fields_any_postdata($_POST);
3309
-
3310
- // ???
3311
- if(strlen(json_encode($message))<10)
3312
- return null;
3313
-
3314
- // Skip if request contains params
3315
- $skip_params = array(
3316
- 'ipn_track_id', // PayPal IPN #
3317
- 'txn_type', // PayPal transaction type
3318
- 'payment_status', // PayPal payment status
3319
- );
3320
- foreach($skip_params as $key=>$value){
3321
- if(@array_key_exists($value,$_GET)||@array_key_exists($value,$_POST))
3322
- return null;
3323
- }
3324
-
3325
- $base_call_result = apbct_base_call(
3326
- array(
3327
- 'message' => $message,
3328
- 'post_info' => array('comment_type' => 'feedback_general_postdata'),
3329
- )
3330
- );
3331
-
3332
- $cleantalk_executed=true;
3333
-
3334
- $ct_result = $base_call_result['ct_result'];
3335
-
3336
- if ($ct_result->allow == 0) {
3337
-
3338
- if (!(defined( 'DOING_AJAX' ) && DOING_AJAX)) {
3339
- global $ct_comment;
3340
- $ct_comment = $ct_result->comment;
3341
- if(isset($_POST['cma-action'])&&$_POST['cma-action']=='add')
3342
- {
3343
- $result=Array('success'=>0, 'thread_id'=>null,'messages'=>Array($ct_result->comment));
3344
- header("Content-Type: application/json");
3345
- print json_encode($result);
3346
- die();
3347
- }
3348
- else
3349
- {
3350
- ct_die(null, null);
3351
- }
3352
- } else {
3353
- echo $ct_result->comment;
3354
- }
3355
- exit;
3356
- }
3357
-
3358
- return null;
3359
- }
3360
-
3361
-
3362
- /**
3363
- * Inner function - Finds and returns pattern in string
3364
- * @return null|bool
3365
- */
3366
- function ct_get_data_from_submit($value = null, $field_name = null) {
3367
- if (!$value || !$field_name || !is_string($value)) {
3368
- return false;
3369
- }
3370
- if (preg_match("/[a-z0-9_\-]*" . $field_name. "[a-z0-9_\-]*$/", $value)) {
3371
- return true;
3372
- }
3373
- }
3374
-
3375
- /**
3376
- * Sends error notice to admin
3377
- * @return null
3378
- */
3379
- function ct_send_error_notice ($comment = '') {
3380
- global $ct_admin_notoice_period, $apbct;
3381
-
3382
- $timelabel_reg = intval( get_option('cleantalk_timelabel_reg') );
3383
- if(time() - $ct_admin_notoice_period > $timelabel_reg){
3384
- update_option('cleantalk_timelabel_reg', time());
3385
-
3386
- $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
3387
- $message = __('Attention, please!', 'cleantalk') . "\r\n\r\n";
3388
- $message .= sprintf(__('"%s" plugin error on your site "%s":', 'cleantalk'), $apbct->plugin_name, $blogname) . "\r\n\r\n";
3389
- $message .= preg_replace('/^(.*?)<a.*?"(.*?)".*?>(.*?)<.a>(.*)$/', '$1. $3: $2?user_token='. $apbct->user_token .' $4', $comment) . "\r\n\r\n";
3390
- @wp_mail(ct_get_admin_email(), sprintf(__('[%s] "%s" error!', 'cleantalk'), $apbct->plugin_name, $blogname), $message);
3391
- }
3392
-
3393
- return null;
3394
- }
3395
-
3396
- function ct_print_form($arr, $k)
3397
- {
3398
- foreach($arr as $key => $value){
3399
- if(!is_array($value)){
3400
- if($k == ''){
3401
- print '<textarea name="' . $key . '" style="display:none;">' . htmlspecialchars($value) . '</textarea>';
3402
- }else{
3403
- print '<textarea name="' . $k . '[' . $key . ']" style="display:none;">' . htmlspecialchars($value) . '</textarea>';
3404
- }
3405
- }else{
3406
- if($k == ''){
3407
- ct_print_form($value, $key);
3408
- }else{
3409
- ct_print_form($value, $k . '[' . $key . ']');
3410
- }
3411
- }
3412
- }
3413
- }
3414
-
3415
- /**
3416
- * Attaches public scripts and styles.
3417
- */
3418
- function ct_enqueue_scripts_public($hook){
3419
-
3420
- global $current_user, $apbct;
3421
-
3422
- if (apbct_exclusions_check__url()) {
3423
- return;
3424
- }
3425
- if($apbct->settings['registrations_test'] || $apbct->settings['comments_test'] || $apbct->settings['contact_forms_test'] || $apbct->settings['general_contact_forms_test'] || $apbct->settings['wc_checkout_test'] || $apbct->settings['check_external'] || $apbct->settings['check_internal'] || $apbct->settings['bp_private_messages'] || $apbct->settings['general_postdata_test']){
3426
-
3427
- // Differnt JS params
3428
- wp_enqueue_script('ct_public', APBCT_URL_PATH.'/js/apbct-public.min.js', array('jquery'), APBCT_VERSION, false /*in header*/);
3429
-
3430
- wp_localize_script('ct_public', 'ctPublic', array(
3431
- '_ajax_nonce' => wp_create_nonce('ct_secret_stuff'),
3432
- '_ajax_url' => admin_url('admin-ajax.php'),
3433
- ));
3434
-
3435
- // GDPR script
3436
- if($apbct->settings['gdpr_enabled']){
3437
-
3438
- wp_enqueue_script('ct_public_gdpr', APBCT_URL_PATH.'/js/apbct-public--gdpr.min.js', array('jquery', 'ct_public'), APBCT_VERSION, false /*in header*/);
3439
-
3440
- wp_localize_script('ct_public_gdpr', 'ctPublicGDPR', array(
3441
- 'gdpr_forms' => array(),
3442
- 'gdpr_text' => $apbct->settings['gdpr_text'] ? $apbct->settings['gdpr_text'] : __('By using this form you agree with the storage and processing of your data by using the Privacy Policy on this website.', 'cleantalk'),
3443
- ));
3444
- }
3445
-
3446
- }
3447
-
3448
- if(!defined('CLEANTALK_AJAX_USE_FOOTER_HEADER') || (defined('CLEANTALK_AJAX_USE_FOOTER_HEADER') && CLEANTALK_AJAX_USE_FOOTER_HEADER)){
3449
- if($apbct->settings['use_ajax'] && ! apbct_is_in_uri('.xml') && ! apbct_is_in_uri('.xsl')){
3450
- if( ! apbct_is_in_uri('jm-ajax') ){
3451
-
3452
- // Use AJAX for JavaScript check
3453
- if($apbct->settings['use_ajax']){
3454
-
3455
- wp_enqueue_script('ct_nocache', plugins_url('/cleantalk-spam-protect/js/cleantalk_nocache.min.js'), array(), APBCT_VERSION, false /*in header*/);
3456
-
3457
- wp_localize_script('ct_nocache', 'ctNocache', array(
3458
- 'ajaxurl' => admin_url('admin-ajax.php'),
3459
- 'info_flag' => $apbct->settings['collect_details'] && $apbct->settings['set_cookies'] ? true : false,
3460
- 'set_cookies_flag' => $apbct->settings['set_cookies'] ? false : true,
3461
- 'blog_home' => get_home_url().'/',
3462
- ));
3463
- }
3464
-
3465
- // External forms check
3466
- if($apbct->settings['check_external'])
3467
- wp_enqueue_script('ct_external', plugins_url('/cleantalk-spam-protect/js/cleantalk_external.min.js'), array('jquery'), APBCT_VERSION, false /*in header*/);
3468
-
3469
- // Internal forms check
3470
- if($apbct->settings['check_internal'])
3471
- wp_enqueue_script('ct_internal', plugins_url('/cleantalk-spam-protect/js/cleantalk_internal.min.js'), array('jquery'), APBCT_VERSION, false /*in header*/);
3472
-
3473
- }
3474
- }
3475
- }
3476
-
3477
- // Show controls for commentaies
3478
- if(in_array("administrator", $current_user->roles)){
3479
-
3480
- if($apbct->settings['show_check_links']){
3481
-
3482
- $ajax_nonce = wp_create_nonce( "ct_secret_nonce" );
3483
-
3484
- wp_enqueue_style ('ct_public_admin_css', plugins_url('/cleantalk-spam-protect/css/cleantalk-public-admin.min.css'), array(), APBCT_VERSION, 'all');
3485
- wp_enqueue_script('ct_public_admin_js', plugins_url('/cleantalk-spam-protect/js/cleantalk-public-admin.min.js'), array('jquery'), APBCT_VERSION, false /*in header*/);
3486
-
3487
- wp_localize_script('ct_public_admin_js', 'ctPublicAdmin', array(
3488
- 'ct_ajax_nonce' => $ajax_nonce,
3489
- 'ajaxurl' => admin_url('admin-ajax.php'),
3490
- 'ct_feedback_error' => __('Error occured while sending feedback.', 'cleantalk'),
3491
- 'ct_feedback_no_hash' => __('Feedback wasn\'t sent. There is no associated request.', 'cleantalk'),
3492
- 'ct_feedback_msg' => sprintf(__("Feedback has been sent to %sCleanTalk Dashboard%s.", 'cleantalk'), $apbct->user_token ? "<a target='_blank' href=https://cleantalk.org/my/show_requests?user_token={$apbct->user_token}&cp_mode=antispam>" : '', $apbct->user_token ? "</a>" : ''),
3493
- ));
3494
-
3495
- }
3496
- }
3497
-
3498
- // Debug
3499
- if($apbct->settings['debug_ajax']){
3500
- wp_enqueue_script('ct_debug_js', plugins_url('/cleantalk-spam-protect/js/cleantalk-debug-ajax.min.js'), array('jquery'), APBCT_VERSION, false /*in header*/);
3501
-
3502
- wp_localize_script('ct_debug_js', 'apbctDebug', array(
3503
- 'reload' => false,
3504
- 'reload_time' => 10000,
3505
- ));
3506
- }
3507
- }
3508
-
3509
- /**
3510
- * Reassign callbackback function for the bootom of comment output.
3511
- */
3512
- function ct_wp_list_comments_args($options){
3513
-
3514
- global $current_user, $apbct;
3515
-
3516
- if(in_array("administrator", $current_user->roles))
3517
- if($apbct->settings['show_check_links'])
3518
- $options['end-callback'] = 'ct_comments_output';
3519
-
3520
- return $options;
3521
- }
3522
-
3523
- /**
3524
- * Callback function for the bootom comment output.
3525
- */
3526
- function ct_comments_output($curr_comment, $param2, $wp_list_comments_args){
3527
-
3528
- $email = $curr_comment->comment_author_email;
3529
- $ip = $curr_comment->comment_author_IP;
3530
- $id = $curr_comment->comment_ID;
3531
-
3532
- $settings_link = '/wp-admin/'.(is_network_admin() ? "settings.php?page=cleantalk" : "options-general.php?page=cleantalk");
3533
-
3534
- echo "<div class='ct_comment_info'><div class ='ct_comment_titles'>";
3535
- echo "<p class='ct_comment_info_title'>".__('Sender info', 'cleantalk')."</p>";
3536
-
3537
- echo "<p class='ct_comment_logo_title'>
3538
- ".__('by', 'cleantalk')
3539
- ." <a href='{$settings_link}' target='_blank'><img class='ct_comment_logo_img' src='".plugins_url()."/cleantalk-spam-protect/inc/images/logo_color.png'></a>"
3540
- ." <a href='{$settings_link}' target='_blank'>CleanTalk</a>"
3541
- ."</p></div>";
3542
- // Outputs email if exists
3543
- if($email)
3544
- echo "<a href='https://cleantalk.org/blacklists/$email' target='_blank' title='https://cleantalk.org/blacklists/$email'>"
3545
- ."$email"
3546
- ."&nbsp;<img src='".plugins_url()."/cleantalk-spam-protect/inc/images/new_window.gif' border='0' style='float:none; box-shadow: transparent 0 0 0 !important;'/>"
3547
- ."</a>";
3548
- else
3549
- echo __('No email', 'cleantalk');
3550
- echo "&nbsp;|&nbsp;";
3551
-
3552
- // Outputs IP if exists
3553
- if($ip)
3554
- echo "<a href='https://cleantalk.org/blacklists/$ip' target='_blank' title='https://cleantalk.org/blacklists/$ip'>"
3555
- ."$ip"
3556
- ."&nbsp;<img src='".plugins_url()."/cleantalk-spam-protect/inc/images/new_window.gif' border='0' style='float:none; box-shadow: transparent 0 0 0 !important;'/>"
3557
- ."</a>";
3558
- else
3559
- echo __('No IP', 'cleantalk');
3560
- echo '&nbsp;|&nbsp;';
3561
-
3562
- echo "<span commentid='$id' class='ct_this_is ct_this_is_spam' href='#'>".__('Mark as spam', 'cleantalk')."</span>";
3563
- echo "<span commentid='$id' class='ct_this_is ct_this_is_not_spam ct_hidden' href='#'>".__('Unspam', 'cleantalk')."</span>";
3564
- echo "<p class='ct_feedback_wrap'>";
3565
- echo "<span class='ct_feedback_result ct_feedback_result_spam'>".__('Marked as spam.', 'cleantalk')."</span>";
3566
- echo "<span class='ct_feedback_result ct_feedback_result_not_spam'>".__('Marked as not spam.', 'cleantalk')."</span>";
3567
- echo "&nbsp;<span class='ct_feedback_msg'><span>";
3568
- echo "</p>";
3569
-
3570
- echo "</div>";
3571
-
3572
- // Ending comment output
3573
- echo "</{$wp_list_comments_args['style']}>";
3574
- }
3575
-
3576
- /**
3577
- * Callback function for the bootom comment output.
3578
- *
3579
- * attrs = array()
3580
- */
3581
- function apbct_shrotcode_handler__GDPR_public_notice__form( $attrs ){
3582
-
3583
- $out = '';
3584
-
3585
- if(isset($attrs['id']))
3586
- $out .= 'ctPublicGDPR.gdpr_forms.push("'.$attrs['id'].'");';
3587
-
3588
- if(isset($attrs['text']))
3589
- $out .= 'ctPublicGDPR.gdpr_text = "'.$attrs['text'].'";';
3590
-
3591
- $out = '<script>'.$out.'</script>';
3592
- return $out;
3593
- }
3594
-
3595
- /**
3596
- * Filters the 'status' array before register the user
3597
- * using only by WICITY theme
3598
- *
3599
- * @param $success array array( 'status' => 'success' )
3600
- * @param $data array ['username'] ['password'] ['email']
3601
- * @return array array( 'status' => 'error' ) or array( 'status' => 'success' ) by default
3602
- */
3603
- function apbct_wilcity_reg_validation( $success, $data ) {
3604
- $check = ct_test_registration( $data['username'], $data['email'], '' );
3605
- if( $check['allow'] == 0 ) {
3606
- return array( 'status' => 'error' );
3607
- }
3608
- return $success;
3609
- }
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Init functions
5
+ * @return mixed[] Array of options
6
+ */
7
+ function apbct_init() {
8
+
9
+ global $ct_wplp_result_label, $ct_jp_comments, $ct_post_data_label, $ct_post_data_authnet_label, $apbct, $test_external_forms, $cleantalk_executed, $wpdb;
10
+
11
+ //Check internal forms with such "action" http://wordpress.loc/contact-us/some_script.php
12
+ if((isset($_POST['action']) && $_POST['action'] == 'ct_check_internal') &&
13
+ $apbct->settings['check_internal']
14
+ ){
15
+ $ct_result = ct_contact_form_validate();
16
+ if($ct_result == null){
17
+ echo 'true';
18
+ die();
19
+ }else{
20
+ echo $ct_result;
21
+ die();
22
+ }
23
+ }
24
+
25
+ //fix for EPM registration form
26
+ if(isset($_POST) && isset($_POST['reg_email']) && shortcode_exists( 'epm_registration_form' ))
27
+ {
28
+ unset($_POST['ct_checkjs_register_form']);
29
+ }
30
+
31
+ if(isset($_POST['_wpnonce-et-pb-contact-form-submitted']))
32
+ {
33
+ add_shortcode( 'et_pb_contact_form', 'ct_contact_form_validate' );
34
+ }
35
+
36
+ if($apbct->settings['check_external']){
37
+
38
+ // Fixing form and directs it this site
39
+ if($apbct->settings['check_external__capture_buffer'] && !is_admin() && !apbct_is_ajax() && apbct_is_user_enable() && !(defined('DOING_CRON') && DOING_CRON) && !(defined('XMLRPC_REQUEST') && XMLRPC_REQUEST)){
40
+ add_action('wp', 'apbct_buffer__start');
41
+ add_action('shutdown', 'apbct_buffer__end', 0);
42
+ add_action('shutdown', 'apbct_buffer__output', 2);
43
+ }
44
+
45
+ // Check and redirecct
46
+ if( apbct_is_post()
47
+ && isset($_POST['cleantalk_hidden_method'])
48
+ && isset($_POST['cleantalk_hidden_action'])
49
+ ){
50
+ $action = htmlspecialchars($_POST['cleantalk_hidden_action']);
51
+ $method = htmlspecialchars($_POST['cleantalk_hidden_method']);
52
+ unset($_POST['cleantalk_hidden_action']);
53
+ unset($_POST['cleantalk_hidden_method']);
54
+ ct_contact_form_validate();
55
+ if(!apbct_is_ajax()){
56
+ print "<html><body><form method='$method' action='$action'>";
57
+ ct_print_form($_POST, '');
58
+ print "</form></body></html>";
59
+ print "<script>
60
+ if(document.forms[0].submit !== 'undefined'){
61
+ var objects = document.getElementsByName('submit');
62
+ if(objects.length > 0)
63
+ document.forms[0].removeChild(objects[0]);
64
+ }
65
+ document.forms[0].submit();
66
+ </script>";
67
+ die();
68
+ }
69
+ }
70
+ }
71
+
72
+ if(isset($_POST['quform_ajax'], $_POST['quform_csrf_token'], $_POST['quform_form_id'])){
73
+ require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-ajax.php');
74
+ ct_ajax_hook();
75
+ }
76
+
77
+ /**hooks for cm answers pro */
78
+ if(defined('CMA_PLUGIN_FILE')){
79
+ add_action( 'wp', 'ct_ajax_hook',1 );
80
+ }
81
+
82
+ //hook for Anonymous Post
83
+ if($apbct->settings['general_postdata_test'] == 1 && empty($_POST['ct_checkjs_cf7']))
84
+ add_action('wp', 'ct_contact_form_validate_postdata',1);
85
+
86
+ if($apbct->settings['general_contact_forms_test'] == 1 && empty($_POST['ct_checkjs_cf7'])){
87
+ add_action('CMA_custom_post_type_nav', 'ct_contact_form_validate_postdata',1);
88
+ //add_action('init','ct_contact_form_validate',1);
89
+ ct_contact_form_validate();
90
+ if(isset($_POST['reg_redirect_link'])&&isset($_POST['tmpl_registration_nonce_field']))
91
+ {
92
+ unset($_POST['ct_checkjs_register_form']);
93
+ ct_contact_form_validate();
94
+ }
95
+ /*if(isset($_GET['ait-action'])&&$_GET['ait-action']=='register')
96
+ {
97
+ $tmp=$_POST['redirect_to'];
98
+ unset($_POST['redirect_to']);
99
+ ct_contact_form_validate();
100
+ $_POST['redirect_to']=$tmp;
101
+ }*/
102
+ }
103
+
104
+ if($apbct->settings['general_postdata_test'] == 1 && empty($_POST['ct_checkjs_cf7']))
105
+ add_action('CMA_custom_post_type_nav', 'ct_contact_form_validate_postdata',1);
106
+
107
+ //add_action('wp_footer','ct_ajaxurl');
108
+
109
+ // Fast Secure contact form
110
+ if(defined('FSCF_VERSION')){
111
+ add_filter('si_contact_display_after_fields', 'ct_si_contact_display_after_fields');
112
+ add_filter('si_contact_form_validate', 'ct_si_contact_form_validate');
113
+ }
114
+
115
+ // WooCommerce registration
116
+ if(class_exists('WooCommerce')){
117
+ add_filter( 'woocommerce_registration_errors', 'ct_registration_errors', 1, 3 );
118
+ if ($apbct->settings['wc_checkout_test'] == 1) {
119
+ add_filter('woocommerce_checkout_process', 'ct_woocommerce_checkout_check', 1, 3);
120
+ }
121
+ if( isset($_REQUEST['wc-ajax']) && $_REQUEST['wc-ajax'] == 'checkout' && $apbct->settings['wc_checkout_test'] == 0 && $apbct->settings['wc_register_from_order'] == 0 ){
122
+ remove_filter( 'woocommerce_registration_errors', 'ct_registration_errors', 1 );
123
+ }
124
+ }
125
+
126
+ // WooCommerce whishlist
127
+ if(class_exists('WC_Wishlists_Wishlist'))
128
+ add_filter('wc_wishlists_create_list_args', 'ct_woocommerce_wishlist_check', 1, 1);
129
+
130
+
131
+ // JetPack Contact form
132
+ $jetpack_active_modules = false;
133
+ if(defined('JETPACK__VERSION'))
134
+ {
135
+ if(isset($_POST['action']) && $_POST['action'] == 'grunion-contact-form' ){
136
+ if(JETPACK__VERSION=='3.4-beta')
137
+ {
138
+ add_filter('contact_form_is_spam', 'ct_contact_form_is_spam');
139
+ }
140
+ else if(JETPACK__VERSION=='3.4-beta2'||JETPACK__VERSION>='3.4')
141
+ {
142
+ add_filter('jetpack_contact_form_is_spam', 'ct_contact_form_is_spam_jetpack',50,2);
143
+ }
144
+ else
145
+ {
146
+ add_filter('contact_form_is_spam', 'ct_contact_form_is_spam');
147
+ }
148
+ $jetpack_active_modules = get_option('jetpack_active_modules');
149
+ if ((class_exists( 'Jetpack', false) && $jetpack_active_modules && in_array('comments', $jetpack_active_modules)))
150
+ {
151
+ $ct_jp_comments = true;
152
+ }
153
+ }else
154
+ add_filter('grunion_contact_form_field_html', 'ct_grunion_contact_form_field_html', 10, 2);
155
+ }
156
+
157
+ // WP Maintenance Mode (wpmm)
158
+ add_action('wpmm_head', 'apbct_form__wpmm__addField', 1);
159
+
160
+ // Contact Form7
161
+ if(defined('WPCF7_VERSION')){
162
+ add_filter('wpcf7_form_elements', 'apbct_form__contactForm7__addField');
163
+ add_filter('wpcf7_validate', 'apbct_form__contactForm7__tesSpam__before_validate', 999, 2);
164
+ add_filter(WPCF7_VERSION >= '3.0.0' ? 'wpcf7_spam' : 'wpcf7_acceptance', 'apbct_form__contactForm7__testSpam');
165
+ }
166
+
167
+ // Formidable
168
+ add_filter( 'frm_entries_before_create', 'apbct_rorm__formidable__testSpam', 10, 2 );
169
+ add_action( 'frm_entries_footer_scripts', 'apbct_rorm__formidable__footerScripts', 20, 2 );
170
+
171
+ // BuddyPress
172
+ if(class_exists('BuddyPress')){
173
+ add_action('bp_before_registration_submit_buttons','ct_register_form',1);
174
+ add_action('messages_message_before_save', 'apbct_integration__buddyPres__private_msg_check', 1);
175
+ add_filter('bp_signup_validate', 'ct_registration_errors',1);
176
+ add_filter('bp_signup_validate', 'ct_check_registration_erros', 999999);
177
+ }
178
+
179
+ if(defined('PROFILEPRESS_SYSTEM_FILE_PATH')){
180
+ add_filter('pp_registration_validation', 'ct_registration_errors_ppress', 11, 2);
181
+ }
182
+
183
+
184
+ // bbPress
185
+ if(class_exists('bbPress')){
186
+ add_filter('bbp_new_topic_pre_title', 'ct_bbp_get_topic', 1);
187
+ add_filter('bbp_new_topic_pre_content', 'ct_bbp_new_pre_content', 1);
188
+ add_filter('bbp_new_reply_pre_content', 'ct_bbp_new_pre_content', 1);
189
+ add_action('bbp_theme_before_topic_form_content', 'ct_comment_form');
190
+ add_action('bbp_theme_before_reply_form_content', 'ct_comment_form');
191
+ }
192
+
193
+ //Custom Contact Forms
194
+ if(defined('CCF_VERSION'))
195
+ add_filter('ccf_field_validator', 'ct_ccf', 1, 4);
196
+
197
+ add_action('comment_form', 'ct_comment_form');
198
+
199
+ // intercept WordPress Landing Pages POST
200
+ if (defined('LANDINGPAGES_CURRENT_VERSION') && !empty($_POST)){
201
+ if(array_key_exists('action', $_POST) && $_POST['action'] === 'inbound_store_lead'){ // AJAX action(s)
202
+ ct_check_wplp();
203
+ }else if(array_key_exists('inbound_submitted', $_POST) && $_POST['inbound_submitted'] == '1'){ // Final submit
204
+ ct_check_wplp();
205
+ }
206
+ }
207
+
208
+ // S2member. intercept POST
209
+ if (defined('WS_PLUGIN__S2MEMBER_PRO_VERSION')){
210
+ $post_keys = array_keys($_POST);
211
+ foreach($post_keys as $post_key){
212
+
213
+ // Detect POST keys like /s2member_pro.*registration/
214
+ if(strpos($post_key, 's2member') !== false && strpos($post_key, 'registration') !== false){
215
+ ct_s2member_registration_test($post_key);
216
+ break;
217
+ }
218
+ }
219
+ }
220
+
221
+ // New user approve hack
222
+ // https://wordpress.org/plugins/new-user-approve/
223
+ if (ct_plugin_active('new-user-approve/new-user-approve.php')) {
224
+ add_action('register_post', 'ct_register_post', 1, 3);
225
+ }
226
+
227
+ // Wilcity theme registration validation fix
228
+ add_filter( 'wilcity/filter/wiloke-listing-tools/validate-before-insert-account', 'apbct_wilcity_reg_validation', 10, 2 );
229
+
230
+
231
+ // Gravity forms
232
+ if (defined('GF_MIN_WP_VERSION')) {
233
+ add_filter('gform_get_form_filter', 'apbct_form__gravityForms__addField', 10, 2);
234
+ add_filter('gform_entry_is_spam', 'apbct_form__gravityForms__testSpam', 999, 3);
235
+ add_filter('gform_confirmation', 'apbct_form__gravityForms__showResponse', 999, 4 );
236
+ }
237
+
238
+ //Pirate forms
239
+ if(defined('PIRATE_FORMS_VERSION')){
240
+ if(isset($_POST['pirate-forms-contact-name']) && $_POST['pirate-forms-contact-name'] && isset($_POST['pirate-forms-contact-email']) && $_POST['pirate-forms-contact-email'])
241
+ apbct_form__piratesForm__testSpam();
242
+ }
243
+
244
+ // WPForms
245
+ // Adding fields
246
+ add_action('wpforms_frontend_output', 'apbct_form__WPForms__addField', 1000, 5);
247
+ // Gathering data to validate
248
+ add_filter('wpforms_process_before_filter', 'apbct_from__WPForms__gatherData', 100, 2);
249
+ // Do spam check
250
+ add_filter('wpforms_process_initial_errors', 'apbct_form__WPForms__showResponse', 100, 2);
251
+
252
+ // QForms integration
253
+ add_filter( 'quform_post_validate', 'ct_quform_post_validate', 10, 2 );
254
+
255
+ // Ultimate Members
256
+ if (class_exists('UM')) {
257
+ add_action('um_main_register_fields','ct_register_form',100); // Add hidden fileds
258
+ add_action( 'um_submit_form_register', 'apbct_registration__UltimateMembers__check', 9, 1 ); // Check submition
259
+ }
260
+
261
+ // Paid Memberships Pro integration
262
+ add_filter( 'pmpro_required_user_fields', function( $pmpro_required_user_fields ){
263
+
264
+ if(
265
+ ! empty( $pmpro_required_user_fields['username'] ) &&
266
+ ! empty( $pmpro_required_user_fields['bemail'] ) &&
267
+ ! empty( $pmpro_required_user_fields['bconfirmemail'] ) &&
268
+ $pmpro_required_user_fields['bemail'] == $pmpro_required_user_fields['bconfirmemail']
269
+ ) {
270
+ $check = ct_test_registration( $pmpro_required_user_fields['username'], $pmpro_required_user_fields['bemail'], apbct_get_server_variable( 'REMOTE_ADDR' ) );
271
+ if( $check['allow'] == 0 ) {
272
+ pmpro_setMessage( $check['comment'], 'pmpro_error' );
273
+ }
274
+ }
275
+
276
+ return $pmpro_required_user_fields;
277
+
278
+ } );
279
+
280
+ //
281
+ // Load JS code to website footer
282
+ //
283
+ if (!(defined( 'DOING_AJAX' ) && DOING_AJAX)) {
284
+ add_action('wp_head', 'apbct_hook__wp_head__set_cookie__ct_checkjs', 1);
285
+ add_action('wp_footer', 'apbct_hook__wp_footer', 1);
286
+ }
287
+
288
+ if ($apbct->settings['protect_logged_in'] != 1 && is_user_logged_in()) {
289
+ ct_contact_form_validate();
290
+ }
291
+
292
+ if (apbct_is_user_enable()) {
293
+
294
+ if ($apbct->settings['general_contact_forms_test'] == 1 && !isset($_POST['comment_post_ID']) && !isset($_GET['for'])){
295
+ add_action( 'init', 'ct_contact_form_validate', 999 );
296
+ }
297
+ if( apbct_is_post() &&
298
+ $apbct->settings['general_postdata_test'] == 1 &&
299
+ !isset($_POST['ct_checkjs_cf7']) &&
300
+ !is_admin() &&
301
+ !apbct_is_user_role_in(array('administrator', 'moderator'))
302
+ ){
303
+ ct_contact_form_validate_postdata();
304
+ }
305
+ }
306
+ }
307
+
308
+ function apbct_buffer__start(){
309
+ ob_start();
310
+ }
311
+
312
+ function apbct_buffer__end(){
313
+
314
+ if(!ob_get_level())
315
+ return;
316
+
317
+ global $apbct;
318
+ $apbct->buffer = ob_get_contents();
319
+ ob_end_clean();
320
+ }
321
+
322
+ /**
323
+ * Outputs changed buffer
324
+ *
325
+ * @global $apbct
326
+ */
327
+ function apbct_buffer__output(){
328
+
329
+ global $apbct;
330
+
331
+ if(empty($apbct->buffer))
332
+ return;
333
+
334
+ $site_url = get_option('siteurl');
335
+ $site__host = parse_url($site_url, PHP_URL_HOST);
336
+
337
+ $dom = new DOMDocument();
338
+ @$dom->loadHTML($apbct->buffer);
339
+
340
+ $forms = $dom->getElementsByTagName('form');
341
+
342
+ foreach($forms as $form){
343
+
344
+ $action = $form->getAttribute('action');
345
+ $action = $action ? $action : $site_url;
346
+ $action__host = parse_url($action, PHP_URL_HOST);
347
+
348
+ // Check if the form directed to the third party site
349
+ if($site__host != $action__host){
350
+
351
+ $method = $form->getAttribute('method');
352
+ $method = $method ? $method : 'get';
353
+ // Directs form to our site
354
+ $form->setAttribute('method', 'POST');
355
+ $form->setAttribute('action', $site_url);
356
+
357
+ // Add cleantalk_hidden_action
358
+ $new_input = $dom->createElement('input');
359
+ $new_input->setAttribute('type', 'hidden');
360
+ $new_input->setAttribute('name', 'cleantalk_hidden_action');
361
+ $new_input->setAttribute('value', $action);
362
+ $form->appendChild($new_input);
363
+
364
+ // Add cleantalk_hidden_method
365
+ $new_input = $dom->createElement('input');
366
+ $new_input->setAttribute('type', 'hidden');
367
+ $new_input->setAttribute('name', 'cleantalk_hidden_method');
368
+ $new_input->setAttribute('value', $method);
369
+ $form->appendChild($new_input);
370
+
371
+ }
372
+ } unset($form);
373
+
374
+ $html = $dom->getElementsByTagName('html');
375
+
376
+ echo gettype($html) == 'object' && !isset( $html[0], $html[0]->childNodes, $html[0]->childNodes[0] )
377
+ ? $html[0]
378
+ ->childNodes[0]
379
+ ->ownerDocument
380
+ ->saveHTML()
381
+ : $apbct->buffer;
382
+ }
383
+
384
+ // MailChimp Premium for Wordpress
385
+ function ct_add_mc4wp_error_message($messages){
386
+
387
+ $messages['ct_mc4wp_response'] = array(
388
+ 'type' => 'error',
389
+ 'text' => 'Your message looks like spam.'
390
+ );
391
+ return $messages;
392
+ }
393
+ add_filter( 'mc4wp_form_messages', 'ct_add_mc4wp_error_message' );
394
+
395
+ /*
396
+ * Function to set validate fucntion for CCF form
397
+ * Input - Сonsistently each form field
398
+ * Returns - String. Validate function
399
+ */
400
+ function ct_ccf($callback, $value, $field_id, $type){
401
+ /*
402
+ if($type == 'name')
403
+ $ct_global_temporary_data['name'] = $value;
404
+ elseif($type == 'email')
405
+ $ct_global_temporary_data['email'] = $value;
406
+ else
407
+ $ct_global_temporary_data[] = $value;
408
+ //*/
409
+ return 'ct_validate_ccf_submission';
410
+ }
411
+ /*
412
+ * Validate function for CCF form. Gatheering data. Multiple calls.
413
+ * Input - void. Global $ct_global_temporary_data
414
+ * Returns - String. CleanTalk comment.
415
+ */
416
+ $ct_global_temporary_data = array();
417
+ function ct_validate_ccf_submission($value, $field_id, $required){
418
+ global $ct_global_temporary_data, $apbct;
419
+
420
+
421
+
422
+ //If the check for contact forms enabled
423
+ if(!$apbct->settings['contact_forms_test'])
424
+ return true;
425
+ //If the check for logged in users enabled
426
+ if($apbct->settings['protect_logged_in'] == 1 && is_user_logged_in())
427
+ return true;
428
+
429
+ //Accumulate data
430
+ $ct_global_temporary_data[] = $value;
431
+
432
+ //If it's the last field of the form
433
+ (!isset($ct_global_temporary_data['count']) ? $ct_global_temporary_data['count'] = 1 : $ct_global_temporary_data['count']++);
434
+ $form_id = $_POST['form_id'];
435
+ if($ct_global_temporary_data['count'] != count(get_post_meta( $form_id, 'ccf_attached_fields', true )))
436
+ return true;
437
+ unset($ct_global_temporary_data['count']);
438
+
439
+ //Getting request params
440
+ $ct_temp_msg_data = ct_get_fields_any($_POST);
441
+
442
+ unset($ct_global_temporary_data);
443
+
444
+ $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
445
+ $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
446
+ $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
447
+ $contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
448
+ $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
449
+
450
+ if ($subject != '')
451
+ $message['subject'] = $subject;
452
+
453
+ $post_info['comment_type'] = 'feedback_custom_contact_forms';
454
+ $post_info['post_url'] = apbct_get_server_variable( 'HTTP_REFERER' );
455
+
456
+ $checkjs = apbct_js_test('ct_checkjs', $_COOKIE)
457
+ ? apbct_js_test('ct_checkjs', $_COOKIE)
458
+ : apbct_js_test('ct_checkjs', $_POST);
459
+
460
+ //Making a call
461
+ $base_call_result = apbct_base_call(
462
+ array(
463
+ 'message' => $message,
464
+ 'sender_email' => $sender_email,
465
+ 'sender_nickname' => $sender_nickname,
466
+ 'post_info' => $post_info,
467
+ 'js_on' => $checkjs,
468
+ 'sender_info' => array('sender_url' => null),
469
+ )
470
+ );
471
+
472
+ $ct_result = $base_call_result['ct_result'];
473
+
474
+ return $ct_result->allow == 0 ? $ct_result->comment : true;;
475
+ }
476
+
477
+ function ct_woocommerce_wishlist_check($args){
478
+ global $apbct;
479
+
480
+
481
+
482
+ //Protect logged in users
483
+ if($args['wishlist_status'])
484
+ if($apbct->settings['protect_logged_in'] == 0)
485
+ return $args;
486
+
487
+ //If the IP is a Google bot
488
+ $hostname = gethostbyaddr( apbct_get_server_variable( 'REMOTE_ADDR' ) );
489
+ if(!strpos($hostname, 'googlebot.com'))
490
+ return $args;
491
+
492
+ //Getting request params
493
+ $message = '';
494
+ $subject = '';
495
+ $email = $args['wishlist_owner_email'];
496
+ if($args['wishlist_first_name']!='' || $args['wishlist_last_name']!='')
497
+ $nickname = trim($args['wishlist_first_name']." ".$args['wishlist_last_name']);
498
+ else
499
+ $nickname = '';
500
+
501
+ $post_info['comment_type'] = 'feedback';
502
+ $post_info['post_url'] = apbct_get_server_variable( 'HTTP_REFERER' );
503
+
504
+ $checkjs = apbct_js_test('ct_checkjs', $_COOKIE)
505
+ ? apbct_js_test('ct_checkjs', $_COOKIE)
506
+ : apbct_js_test('ct_checkjs', $_POST);
507
+
508
+ //Making a call
509
+ $base_call_result = apbct_base_call(
510
+ array(
511
+ 'message' => $subject." ".$message,
512
+ 'sender_email' => $email,
513
+ 'sender_nickname' => $nickname,
514
+ 'post_info' => $post_info,
515
+ 'js_on' => $checkjs,
516
+ 'sender_info' => array('sender_url' => null),
517
+ )
518
+ );
519
+
520
+ $ct_result = $base_call_result['ct_result'];
521
+
522
+ if ($ct_result->allow == 0)
523
+ wp_die("<h1>".__('Spam protection by CleanTalk', 'cleantalk')."</h1><h2>".$ct_result->comment."</h2>", '', array('response' => 403, "back_link" => true, "text_direction" => 'ltr'));
524
+ else
525
+ return $args;
526
+ }
527
+
528
+ function apbct_integration__buddyPres__getTemplateName( $located, $template_name, $template_names, $template_locations, $load, $require_once ) {
529
+ global $apbct;
530
+ preg_match("/\/([a-z-_]+)\/buddypress-functions\.php$/", $located, $matches);
531
+ $apbct->buddy_press_tmpl = isset($matches[1]) ? $matches[1] : 'unknown';
532
+ }
533
+
534
+ /**
535
+ * Test BuddyPress activity for spam (post update only)
536
+ *
537
+ * @global SpbcState $apbct
538
+ * @param bool $is_spam
539
+ * @param BP_Activity_Activity $activity_obj Activity object (\plugins\buddypress\bp-activity\classes\class-bp-activity-activity.php)
540
+ * @return boolean Spam flag
541
+ */
542
+ function apbct_integration__buddyPres__activityWall( $is_spam, $activity_obj = null ){
543
+
544
+ global $apbct;
545
+
546
+ if($activity_obj === null || $activity_obj->privacy == 'media' || !isset($_POST['action']) || $_POST['action'] && $_POST['action'] !== 'post_update')
547
+ return;
548
+
549
+ $curr_user = get_user_by('id', $activity_obj->user_id);
550
+
551
+ //Making a call
552
+ $base_call_result = apbct_base_call(
553
+ array(
554
+ 'message' => is_string($activity_obj->content) ? $activity_obj->content : '',
555
+ 'sender_email' => $curr_user->data->user_email,
556
+ 'sender_nickname' => $curr_user->data->user_login,
557
+ 'post_info' => array(
558
+ 'post_url' => apbct_get_server_variable( 'HTTP_REFERER' ),
559
+ 'comment_type' => 'buddypress_activitywall',
560
+ ),
561
+ 'js_on' => apbct_js_test('ct_checkjs', $_COOKIE),
562
+ 'sender_info' => array('sender_url' => null),
563
+ )
564
+ );
565
+
566
+ $ct_result = $base_call_result['ct_result'];
567
+
568
+ if ($ct_result->allow == 0){
569
+ add_action('bp_activity_after_save', 'apbct_integration__buddyPres__activityWall_showResponse', 1, 1);
570
+ $apbct->spam_notification = $ct_result->comment;
571
+ return true;
572
+ }else
573
+ return $is_spam;
574
+ }
575
+
576
+ /**
577
+ * Outputs message to AJAX frontend handler
578
+ *
579
+ * @global SpbcState $apbct
580
+ * @param BP_Activity_Activity $activity_obj Activity object (\plugins\buddypress\bp-activity\classes\class-bp-activity-activity.php)
581
+ */
582
+ function apbct_integration__buddyPres__activityWall_showResponse( $activity_obj ){
583
+
584
+ global $apbct;
585
+
586
+ // Legacy template
587
+ if($apbct->buddy_press_tmpl === 'bp-legacy'){
588
+ die('<div id="message" class="error bp-ajax-message"><p>'. $apbct->spam_notification .'</p></div>');
589
+ // Nouveau tamplate and others
590
+ }else{
591
+ @header( 'Content-Type: application/json; charset=' . get_option('blog_charset'));
592
+ die(json_encode(array(
593
+ 'success' => false,
594
+ 'data' => array('message' => $apbct->spam_notification),
595
+ )));
596
+ }
597
+ }
598
+
599
+ /**
600
+ * Public function - Tests new private messages (dialogs)
601
+ *
602
+ * @global SpbcState $apbct
603
+ * @param type $bp_message_obj
604
+ * @return array with errors if spam has found
605
+ */
606
+ function apbct_integration__buddyPres__private_msg_check( $bp_message_obj){
607
+
608
+ global $apbct;
609
+
610
+ //Check for enabled option
611
+ if($apbct->settings['bp_private_messages'] == 0)
612
+ return;
613
+
614
+ //Check for quantity of comments
615
+ $comments_check_number = defined('CLEANTALK_CHECK_COMMENTS_NUMBER')
616
+ ? CLEANTALK_CHECK_COMMENTS_NUMBER
617
+ : 3;
618
+
619
+ if($apbct->settings['check_comments_number']){
620
+ $args = array(
621
+ 'user_id' => $bp_message_obj->sender_id,
622
+ 'box' => 'sentbox',
623
+ 'type' => 'all',
624
+ 'limit' => $comments_check_number,
625
+ 'page' => null,
626
+ 'search_terms' => '',
627
+ 'meta_query' => array()
628
+ );
629
+ $sentbox_msgs = BP_Messages_Thread::get_current_threads_for_user($args);
630
+ $cnt_sentbox_msgs = $sentbox_msgs['total'];
631
+ $args['box'] = 'inbox';
632
+ $inbox_msgs = BP_Messages_Thread::get_current_threads_for_user($args);
633
+ $cnt_inbox_msgs = $inbox_msgs['total'];
634
+
635
+ if(($cnt_inbox_msgs + $cnt_sentbox_msgs) >= $comments_check_number)
636
+ $is_max_comments = true;
637
+ }
638
+
639
+ if(!empty($is_max_comments))
640
+ return;
641
+
642
+ $sender_user_obj = get_user_by('id', $bp_message_obj->sender_id);
643
+
644
+ //Making a call
645
+ $base_call_result = apbct_base_call(
646
+ array(
647
+ 'message' => $bp_message_obj->subject." ".$bp_message_obj->message,
648
+ 'sender_email' => $sender_user_obj->data->user_email,
649
+ 'sender_nickname' => $sender_user_obj->data->user_login,
650
+ 'post_info' => array(
651
+ 'comment_type' => 'buddypress_comment',
652
+ 'post_url' => apbct_get_server_variable( 'HTTP_REFERER' ),
653
+ ),
654
+ 'js_on' => apbct_js_test('ct_checkjs', $_COOKIE)
655
+ ? apbct_js_test('ct_checkjs', $_COOKIE)
656
+ : apbct_js_test('ct_checkjs', $_POST),
657
+ 'sender_info' => array('sender_url' => null),
658
+ )
659
+ );
660
+
661
+ $ct_result = $base_call_result['ct_result'];
662
+
663
+ if ($ct_result->allow == 0)
664
+ wp_die("<h1>".__('Spam protection by CleanTalk', 'cleantalk')."</h1><h2>".$ct_result->comment."</h2>", '', array('response' => 403, "back_link" => true, "text_direction" => 'ltr'));
665
+ }
666
+
667
+ /**
668
+ * Adds hiden filed to deafualt serach form
669
+ *
670
+ * @param $form string
671
+ * @return string
672
+ */
673
+ function apbct_forms__search__addField( $form ){
674
+ global $apbct;
675
+ if($apbct->settings['search_test'] == 1){
676
+ $js_filed = ct_add_hidden_fields('ct_checkjs_search_default', true, false, false, false);
677
+ $form = str_replace('</form>', $js_filed, $form);
678
+ }
679
+ return $form;
680
+ }
681
+
682
+ /**
683
+ * Test default search string for spam
684
+ *
685
+ * @param $search string
686
+ * @return string
687
+ */
688
+ function apbct_forms__search__testSpam( $search ){
689
+
690
+ global $apbct, $cleantalk_executed;
691
+
692
+ if(
693
+ empty($search) ||
694
+ $cleantalk_executed ||
695
+ $apbct->settings['search_test'] == 0 ||
696
+ $apbct->settings['protect_logged_in'] != 1 && is_user_logged_in() // Skip processing for logged in users.
697
+ ){
698
+ return $search;
699
+ }
700
+
701
+ if(apbct_is_user_logged_in())
702
+ $user = wp_get_current_user();
703
+
704
+ $base_call_result = apbct_base_call(
705
+ array(
706
+ 'message' => $search,
707
+ 'sender_email' => !empty($user) ? $user->user_email : null,
708
+ 'sender_nickname' => !empty($user) ? $user->user_login : null,
709
+ 'post_info' => array('comment_type' => 'site_search_wordpress'),
710
+ //'js_on' => apbct_js_test('ct_checkjs_search_default', $_GET, true),
711
+ )
712
+ );
713
+ $ct_result = $base_call_result['ct_result'];
714
+
715
+ $cleantalk_executed = true;
716
+
717
+ if ($ct_result->allow == 0){
718
+ die($ct_result->comment);
719
+ }
720
+
721
+ return $search;
722
+ }
723
+
724
+ /**
725
+ * Test woocommerce checkout form for spam
726
+ *
727
+ */
728
+ function ct_woocommerce_checkout_check() {
729
+
730
+ //Getting request params
731
+ $ct_temp_msg_data = ct_get_fields_any($_POST);
732
+
733
+ $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
734
+ $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
735
+ $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
736
+ $contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
737
+ $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
738
+
739
+ if($subject != '')
740
+ $message = array_merge(array('subject' => $subject), $message);
741
+
742
+ $post_info['comment_type'] = 'order';
743
+ $post_info['post_url'] = apbct_get_server_variable( 'HTTP_REFERER' );
744
+
745
+ //Making a call
746
+ $base_call_result = apbct_base_call(
747
+ array(
748
+ 'message' => $message,
749
+ 'sender_email' => $sender_email,
750
+ 'sender_nickname' => $sender_nickname,
751
+ 'post_info' => $post_info,
752
+ 'js_on' => apbct_js_test('ct_checkjs', $_COOKIE),
753
+ 'sender_info' => array('sender_url' => null),
754
+ )
755
+ );
756
+
757
+ $ct_result = $base_call_result['ct_result'];
758
+
759
+ if ($ct_result->allow == 0) {
760
+ wp_send_json(array(
761
+ 'result' => 'failure',
762
+ 'messages' => "<ul class=\"woocommerce-error\"><li>".$ct_result->comment."</li></ul>",
763
+ 'refresh' => 'false',
764
+ 'reload' => 'false'
765
+ ));
766
+ }
767
+ }
768
+
769
+ /**
770
+ * Public function - Tests for Pirate contact froms
771
+ * return NULL
772
+ */
773
+ function apbct_form__piratesForm__testSpam(){
774
+
775
+ global $apbct;
776
+
777
+ //Check for enabled option
778
+ if( !$apbct->settings['contact_forms_test'])
779
+ return;
780
+
781
+ //Getting request params
782
+ $ct_temp_msg_data = ct_get_fields_any($_POST);
783
+
784
+ $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
785
+ $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
786
+ $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
787
+ $contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
788
+ $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
789
+
790
+ if($subject != '')
791
+ $message = array_merge(array('subject' => $subject), $message);
792
+
793
+ $post_info['comment_type'] = 'contact_form_wordpress_feedback_pirate';
794
+ $post_info['post_url'] = apbct_get_server_variable( 'HTTP_REFERER' );
795
+
796
+ //Making a call
797
+ $base_call_result = apbct_base_call(
798
+ array(
799
+ 'message' => $message,
800
+ 'sender_email' => $sender_email,
801
+ 'sender_nickname' => $sender_nickname,
802
+ 'post_info' => $post_info,
803
+ 'js_on' => apbct_js_test('ct_checkjs', $_COOKIE),
804
+ 'sender_info' => array('sender_url' => null),
805
+ )
806
+ );
807
+
808
+ $ct_result = $base_call_result['ct_result'];
809
+
810
+ if ($ct_result->allow == 0)
811
+ wp_die("<h1>".__('Spam protection by CleanTalk', 'cleantalk')."</h1><h2>".$ct_result->comment."</h2>", '', array('response' => 403, "back_link" => true, "text_direction" => 'ltr'));
812
+ }
813
+
814
+ /**
815
+ * Adds hidden filed to comment form
816
+ */
817
+ function ct_comment_form($post_id){
818
+
819
+ global $apbct;
820
+
821
+ if (apbct_is_user_enable() === false) {
822
+ return false;
823
+ }
824
+
825
+ if ( !$apbct->settings['comments_test']) {
826
+ return false;
827
+ }
828
+
829
+ ct_add_hidden_fields('ct_checkjs', false, false);
830
+
831
+ return null;
832
+ }
833
+
834
+ /**
835
+ * Adds cookie script filed to head
836
+ */
837
+ function apbct_hook__wp_head__set_cookie__ct_checkjs() {
838
+
839
+ ct_add_hidden_fields('ct_checkjs', false, true, true);
840
+
841
+ return null;
842
+ }
843
+
844
+ /**
845
+ * Adds cookie script filed to footer
846
+ */
847
+ function apbct_hook__wp_footer() {
848
+
849
+ //ct_add_hidden_fields(true, 'ct_checkjs', false, true, true);
850
+
851
+ return null;
852
+ }
853
+
854
+ /**
855
+ * Adds hidden filed to define avaialbility of client's JavaScript
856
+ * @param bool $random_key switch on generation random key for every page load
857
+ */
858
+ function ct_add_hidden_fields($field_name = 'ct_checkjs', $return_string = false, $cookie_check = false, $no_print = false, $ajax = true) {
859
+
860
+ global $ct_checkjs_def, $apbct;
861
+
862
+ $ct_checkjs_key = ct_get_checkjs_value();
863
+ $field_id_hash = md5(rand(0, 1000));
864
+
865
+ // Using only cookies
866
+ if ($cookie_check && $apbct->settings['set_cookies'] == 1) {
867
+
868
+ $html = "<script type='text/javascript'>
869
+ function ctSetCookie(c_name, value, def_value){
870
+ document.cookie = c_name + '=' + escape(value) + '; path=/';
871
+ }
872
+ ctSetCookie('{$field_name}', '{$ct_checkjs_key}', '{$ct_checkjs_def}');
873
+ </script>";
874
+
875
+ // Using AJAX to get key
876
+ }elseif($apbct->settings['use_ajax'] && $ajax){
877
+
878
+ // Fix only for wp_footer -> apbct_hook__wp_head__set_cookie__ct_checkjs()
879
+ if($no_print)
880
+ return;
881
+
882
+ $ct_input_challenge = sprintf("'%s'", $ct_checkjs_key);
883
+ $field_id = $field_name . '_' . $field_id_hash;
884
+ $html = "<input type='hidden' id='{$field_id}' name='{$field_name}' value='{$ct_checkjs_def}' />
885
+ <script type='text/javascript'>
886
+ window.addEventListener('load', function () {
887
+ setTimeout(function(){
888
+ apbct_sendAJAXRequest(
889
+ {action: 'apbct_js_keys__get'},
890
+ {callback: apbct_js_keys__set_input_value, input_name: '{$field_id}'}
891
+ );
892
+ }, 1000);
893
+ });
894
+ </script>";
895
+
896
+ // Set KEY from backend
897
+ }else{
898
+ // Fix only for wp_footer -> apbct_hook__wp_head__set_cookie__ct_checkjs()
899
+ if($no_print)
900
+ return;
901
+
902
+ $ct_input_challenge = sprintf("'%s'", $ct_checkjs_key);
903
+ $field_id = $field_name . '_' . $field_id_hash;
904
+ $html = "<input type='hidden' id='{$field_id}' name='{$field_name}' value='{$ct_checkjs_def}' />
905
+ <script type='text/javascript'>
906
+ setTimeout(function(){
907
+ var ct_input_name = '{$field_id}';
908
+ if (document.getElementById(ct_input_name) !== null) {
909
+ var ct_input_value = document.getElementById(ct_input_name).value;
910
+ document.getElementById(ct_input_name).value = document.getElementById(ct_input_name).value.replace(ct_input_value, {$ct_input_challenge});
911
+ }
912
+ }, 1000);
913
+ </script>";
914
+ }
915
+
916
+ // Simplify JS code and Fixing issue with wpautop()
917
+ $html = str_replace(array("\n","\r","\t"),'', $html);
918
+
919
+ if ($return_string === true) {
920
+ return $html;
921
+ } else {
922
+ echo $html;
923
+ }
924
+ }
925
+
926
+ /**
927
+ * Public function - Insert JS code for spam tests
928
+ * return null;
929
+ */
930
+ function apbct_rorm__formidable__footerScripts($fields, $form) {
931
+
932
+ global $apbct, $ct_checkjs_frm;
933
+
934
+ if ( !$apbct->settings['contact_forms_test'])
935
+ return false;
936
+
937
+ $ct_checkjs_key = ct_get_checkjs_value();
938
+ $ct_frm_base_name = 'form_';
939
+ $ct_frm_name = $ct_frm_base_name . $form->form_key;
940
+
941
+ echo "var input = document.createElement('input');
942
+ input.setAttribute('type', 'hidden');
943
+ input.setAttribute('name', '$ct_checkjs_frm');
944
+ input.setAttribute('value', '$ct_checkjs_key');
945
+ for (i = 0; i < document.forms.length; i++) {
946
+ if (typeof document.forms[i].id == 'string'){
947
+ if(document.forms[i].id.search('$ct_frm_name') != -1) {
948
+ document.forms[i].appendChild(input);
949
+ }
950
+ }
951
+ }";
952
+
953
+ /* Excessive cookie set
954
+ $js_code = ct_add_hidden_fields(true, 'ct_checkjs', true, true);
955
+ $js_code = strip_tags($js_code); // Removing <script> tag
956
+ echo $js_code;
957
+ //*/
958
+ }
959
+
960
+ /**
961
+ * Public function - Test Formidable data for spam activity
962
+ * @param $errors
963
+ * @param $form
964
+ *
965
+ * @return array with errors if spam has found
966
+ */
967
+ function apbct_rorm__formidable__testSpam ( $errors, $form ) {
968
+
969
+ global $apbct;
970
+
971
+ if ( !$apbct->settings['contact_forms_test']) {
972
+ return $errors;
973
+ }
974
+
975
+ // Skip processing for logged in users.
976
+ if ( !$apbct->settings['protect_logged_in'] && is_user_logged_in()) {
977
+ return $errors;
978
+ }
979
+
980
+ $ct_temp_msg_data = ct_get_fields_any($_POST['item_meta']);
981
+
982
+ $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
983
+ $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
984
+ $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
985
+ $contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
986
+ $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
987
+
988
+ // Adding 'input_meta[]' to every field /Formidable fix/
989
+ $message = array_flip($message);
990
+ foreach($message as &$value){
991
+ $value = 'item_meta['.$value.']';
992
+ } unset($value);
993
+ $message = array_flip($message);
994
+
995
+ $checkjs = apbct_js_test('ct_checkjs', $_COOKIE)
996
+ ? apbct_js_test('ct_checkjs', $_COOKIE)
997
+ : apbct_js_test('ct_checkjs', $_POST);
998
+
999
+ $base_call_result = apbct_base_call(
1000
+ array(
1001
+ 'message' => $message,
1002
+ 'sender_email' => $sender_email,
1003
+ 'sender_nickname' => $sender_nickname,
1004
+ 'post_info' => array('comment_type' => 'contact_form_wordpress_formidable'),
1005
+ 'js_on' => $checkjs
1006
+ )
1007
+ );
1008
+ $ct_result = $base_call_result['ct_result'];
1009
+
1010
+ if ($ct_result->allow == 0) {
1011
+ $errors['ct_error'] = '<br /><b>' . $ct_result->comment . '</b><br /><br />';
1012
+ }
1013
+
1014
+ return $errors;
1015
+ }
1016
+
1017
+ /**
1018
+ * Public filter 'bbp_*' - Get new topic name to global $ct_bbp_topic
1019
+ * @param mixed[] $comment Comment string
1020
+ * @return mixed[] $comment Comment string
1021
+ */
1022
+ function ct_bbp_get_topic($topic){
1023
+ global $ct_bbp_topic;
1024
+
1025
+ $ct_bbp_topic=$topic;
1026
+
1027
+ return $topic;
1028
+ }
1029
+
1030
+ /**
1031
+ * Public filter 'bbp_*' - Checks topics, replies by cleantalk
1032
+ * @param mixed[] $comment Comment string
1033
+ * @return mixed[] $comment Comment string
1034
+ */
1035
+ function ct_bbp_new_pre_content ($comment) {
1036
+
1037
+ global $apbct, $current_user;
1038
+
1039
+ if ( !$apbct->settings['comments_test']) {
1040
+ return $comment;
1041
+ }
1042
+
1043
+ // Skip processing for logged in users and admin.
1044
+ if ( !$apbct->settings['protect_logged_in'] && is_user_logged_in() ||
1045
+ in_array("administrator", $current_user->roles))
1046
+ return $comment;
1047
+
1048
+ $checkjs = apbct_js_test('ct_checkjs', $_COOKIE)
1049
+ ? apbct_js_test('ct_checkjs', $_COOKIE)
1050
+ : apbct_js_test('ct_checkjs', $_POST);
1051
+
1052
+ $post_info['comment_type'] = 'bbpress_comment';
1053
+ $post_info['post_url'] = bbp_get_topic_permalink();
1054
+
1055
+ if( is_user_logged_in() ) {
1056
+ $sender_email = $current_user->user_email;
1057
+ $sender_nickname = $current_user->display_name;
1058
+ } else {
1059
+ $sender_email = isset($_POST['bbp_anonymous_email']) ? $_POST['bbp_anonymous_email'] : null;
1060
+ $sender_nickname = isset($_POST['bbp_anonymous_name']) ? $_POST['bbp_anonymous_name'] : null;
1061
+ }
1062
+
1063
+ $base_call_result = apbct_base_call(
1064
+ array(
1065
+ 'message' => $comment,
1066
+ 'sender_email' => $sender_email,
1067
+ 'sender_nickname' => $sender_nickname,
1068
+ 'post_info' => $post_info,
1069
+ 'js_on' => $checkjs,
1070
+ 'sender_info' => array('sender_url' => isset($_POST['bbp_anonymous_website']) ? $_POST['bbp_anonymous_website'] : null),
1071
+ )
1072
+ );
1073
+ $ct_result = $base_call_result['ct_result'];
1074
+
1075
+ if ($ct_result->allow == 0) {
1076
+ bbp_add_error('bbp_reply_content', $ct_result->comment);
1077
+ }
1078
+
1079
+ return $comment;
1080
+ }
1081
+
1082
+ function apbct_comment__sanitize_data__before_wp_die($function){
1083
+
1084
+ global $apbct;
1085
+
1086
+ $comment_data = wp_unslash($_POST);
1087
+
1088
+ $user_ID = 0;
1089
+
1090
+ $comment_type = '';
1091
+
1092
+ $comment_content = isset($comment_data['comment']) ? (string) $comment_data['comment'] : null;
1093
+ $comment_parent = isset($comment_data['comment_parent']) ? (int) absint($comment_data['comment_parent']) : null;
1094
+
1095
+ $comment_author = isset($comment_data['author']) ? (string) trim(strip_tags($comment_data['author'])) : null;
1096
+ $comment_author_email = isset($comment_data['email']) ? (string) trim($comment_data['email']) : null;
1097
+ $comment_author_url = isset($comment_data['url']) ? (string) trim($comment_data['url']) : null;
1098
+ $comment_post_ID = isset($comment_data['comment_post_ID']) ? (int) $comment_data['comment_post_ID'] : null;
1099
+
1100
+ if(isset($comment_content, $comment_parent)){
1101
+
1102
+ $user = wp_get_current_user();
1103
+
1104
+ if($user->exists()){
1105
+ $comment_author = empty($user->display_name) ? $user->user_login : $user->display_name;
1106
+ $comment_author_email = $user->user_email;
1107
+ $comment_author_url = $user->user_url;
1108
+ $user_ID = $user->ID;
1109
+ }
1110
+
1111
+ $apbct->comment_data = compact(
1112
+ 'comment_post_ID',
1113
+ 'comment_author',
1114
+ 'comment_author_email',
1115
+ 'comment_author_url',
1116
+ 'comment_content',
1117
+ 'comment_type',
1118
+ 'comment_parent',
1119
+ 'user_ID'
1120
+ );
1121
+
1122
+ $function = 'apbct_comment__check_via_wp_die';
1123
+
1124
+ }
1125
+
1126
+ return $function;
1127
+ }
1128
+
1129
+ function apbct_comment__check_via_wp_die($message, $title, $args){
1130
+ if($title == __('Comment Submission Failure')){
1131
+ global $apbct;
1132
+ $apbct->validation_error = $message;
1133
+ ct_preprocess_comment($apbct->comment_data);
1134
+ }
1135
+ _default_wp_die_handler($message, $title, $args);
1136
+ }
1137
+
1138
+ /**
1139
+ * Public filter 'preprocess_comment' - Checks comment by cleantalk server
1140
+ * @param mixed[] $comment Comment data array
1141
+ * @return mixed[] New data array of comment
1142
+ */
1143
+ function ct_preprocess_comment($comment) {
1144
+ // this action is called just when WP process POST request (adds new comment)
1145
+ // this action is called by wp-comments-post.php
1146
+ // after processing WP makes redirect to post page with comment's form by GET request (see above)
1147
+ global $current_user, $comment_post_id, $ct_comment_done, $ct_jp_comments, $apbct;
1148
+
1149
+ // Send email notification for chosen groups of users
1150
+ if($apbct->settings['comment_notify'] && !empty($apbct->settings['comment_notify__roles']) && $apbct->data['moderate']){
1151
+
1152
+ add_filter('notify_post_author', 'apbct_comment__Wordpress__doNotify', 100, 2);
1153
+
1154
+ $users = get_users(array(
1155
+ 'role__in' => $apbct->settings['comment_notify__roles'],
1156
+ 'fileds' => array('user_email')
1157
+ ));
1158
+
1159
+ if($users){
1160
+ add_filter('comment_notification_text', 'apbct_comment__Wordpress__changeMailNotificationGroups', 100, 2);
1161
+ add_filter('comment_notification_recipients', 'apbct_comment__Wordpress__changeMailNotificationRecipients', 100, 2);
1162
+ foreach($users as $user){
1163
+ $emails[] = $user->user_email;
1164
+ }
1165
+ $apbct->comment_notification_recipients = json_encode($emails);
1166
+ }
1167
+ }
1168
+
1169
+ // Skip processing admin.
1170
+ if (in_array("administrator", $current_user->roles))
1171
+ return $comment;
1172
+
1173
+ $comments_check_number = defined('CLEANTALK_CHECK_COMMENTS_NUMBER') ? CLEANTALK_CHECK_COMMENTS_NUMBER : 3;
1174
+
1175
+ if($apbct->settings['check_comments_number']){
1176
+ $args = array(
1177
+ 'author_email' => $comment['comment_author_email'],
1178
+ 'status' => 'approve',
1179
+ 'count' => false,
1180
+ 'number' => $comments_check_number,
1181
+ );
1182
+ $cnt = count(get_comments($args));
1183
+ $is_max_comments = $cnt >= $comments_check_number ? true : false;
1184
+ }
1185
+
1186
+ if (
1187
+ ($comment['comment_type']!='trackback') &&
1188
+ (
1189
+ apbct_is_user_enable() === false ||
1190
+ $apbct->settings['comments_test'] == 0 ||
1191
+ $ct_comment_done ||
1192
+ (isset($_SERVER['HTTP_REFERER']) && stripos($_SERVER['HTTP_REFERER'],'page=wysija_campaigns&action=editTemplate')!==false) ||
1193
+ (isset($is_max_comments) && $is_max_comments) ||
1194
+ (isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['REQUEST_URI'],'/wp-admin/')!==false)
1195
+ )
1196
+ )
1197
+ {
1198
+ return $comment;
1199
+ }
1200
+
1201
+ $local_blacklists = wp_blacklist_check(
1202
+ $comment['comment_author'],
1203
+ $comment['comment_author_email'],
1204
+ $comment['comment_author_url'],
1205
+ $comment['comment_content'],
1206
+ apbct_get_server_variable( 'REMOTE_ADDR' ),
1207
+ apbct_get_server_variable( 'HTTP_USER_AGENT' )
1208
+ );
1209
+
1210
+ // Go out if author in local blacklists
1211
+ if ($comment['comment_type']!='trackback' && $local_blacklists === true) {
1212
+ return $comment;
1213
+ }
1214
+
1215
+ // Skip pingback anti-spam test
1216
+ /*if ($comment['comment_type'] == 'pingback') {
1217
+ return $comment;
1218
+ }*/
1219
+
1220
+ $ct_comment_done = true;
1221
+
1222
+ $comment_post_id = $comment['comment_post_ID'];
1223
+
1224
+ // JetPack comments logic
1225
+ $post_info['comment_type'] = $ct_jp_comments ? 'jetpack_comment' : $comment['comment_type'];
1226
+ $post_info['post_url'] = ct_post_url(null, $comment_post_id);
1227
+
1228
+ // Comment type
1229
+ $post_info['comment_type'] = empty($post_info['comment_type']) ? 'general_comment' : $post_info['comment_type'];
1230
+
1231
+ $checkjs = apbct_js_test('ct_checkjs', $_COOKIE)
1232
+ ? apbct_js_test('ct_checkjs', $_COOKIE)
1233
+ : apbct_js_test('ct_checkjs', $_POST);
1234
+
1235
+
1236
+ $example = null;
1237
+ if ($apbct->data['relevance_test']) {
1238
+ $post = get_post($comment_post_id);
1239
+ if ($post !== null){
1240
+ $example['title'] = $post->post_title;
1241
+ $example['body'] = $post->post_content;
1242
+ $example['comments'] = null;
1243
+
1244
+ $last_comments = get_comments(array('status' => 'approve', 'number' => 10, 'post_id' => $comment_post_id));
1245
+ foreach ($last_comments as $post_comment){
1246
+ $example['comments'] .= "\n\n" . $post_comment->comment_content;
1247
+ }
1248
+
1249
+ $example = json_encode($example);
1250
+ }
1251
+
1252
+ // Use plain string format if've failed with JSON
1253
+ if ($example === false || $example === null){
1254
+ $example = ($post->post_title !== null) ? $post->post_title : '';
1255
+ $example .= ($post->post_content !== null) ? "\n\n" . $post->post_content : '';
1256
+ }
1257
+ }
1258
+
1259
+ $base_call_result = apbct_base_call(
1260
+ array(
1261
+ 'message' => $comment['comment_content'],
1262
+ 'example' => $example,
1263
+ 'sender_email' => $comment['comment_author_email'],
1264
+ 'sender_nickname' => $comment['comment_author'],
1265
+ 'post_info' => $post_info,
1266
+ 'js_on' => $checkjs,
1267
+ 'sender_info' => array(
1268
+ 'sender_url' => @$comment['comment_author_url'],
1269
+ 'form_validation' => !isset($apbct->validation_error)
1270
+ ? null
1271
+ : json_encode(array(
1272
+ 'validation_notice' => $apbct->validation_error,
1273
+ 'page_url' => apbct_get_server_variable( 'HTTP_HOST' ) . apbct_get_server_variable( 'REQUEST_URI' ),
1274
+ ))
1275
+ ),
1276
+ )
1277
+ );
1278
+ $ct_result = $base_call_result['ct_result'];
1279
+
1280
+ ct_hash($ct_result->id);
1281
+
1282
+ //Don't check trusted users
1283
+ if (isset($comment['comment_author_email'])){
1284
+ $approved_comments = get_comments(array('status' => 'approve', 'count' => true, 'author_email' => $comment['comment_author_email']));
1285
+ $new_user = $approved_comments == 0 ? true : false;
1286
+ }
1287
+
1288
+ // Change comment flow only for new authors
1289
+ if (!empty($new_user) || $ct_result->stop_words !== null || $ct_result->spam == 1)
1290
+ add_action('comment_post', 'ct_set_meta', 10, 2);
1291
+
1292
+ if($ct_result->allow){ // Pass if allowed
1293
+ if(get_option('comment_moderation') === '1') // Wordpress moderation flag
1294
+ add_filter('pre_comment_approved', 'ct_set_not_approved', 999, 2);
1295
+ else
1296
+ add_filter('pre_comment_approved', 'ct_set_approved', 999, 2);
1297
+ }else{
1298
+
1299
+ global $ct_comment, $ct_stop_words;
1300
+
1301
+ $ct_comment = $ct_result->comment;
1302
+ $ct_stop_words = $ct_result->stop_words;
1303
+
1304
+ $err_text = '<center><b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk.</b> ' . __('Spam protection', 'cleantalk') . "</center><br><br>\n" . $ct_result->comment;
1305
+ $err_text .= '<script>setTimeout("history.back()", 5000);</script>';
1306
+
1307
+ // Terminate. Definitely spam.
1308
+ if($ct_result->stop_queue == 1)
1309
+ wp_die($err_text, 'Blacklisted', array('response' => 200, 'back_link' => true));
1310
+
1311
+ // Terminate by user's setting.
1312
+ if($ct_result->spam == 3)
1313
+ wp_die($err_text, 'Blacklisted', array('response' => 200, 'back_link' => true));
1314
+
1315
+ // Trash comment.
1316
+ if($ct_result->spam == 2){
1317
+ add_filter('pre_comment_approved', 'ct_set_comment_spam', 997, 2);
1318
+ add_action('comment_post', 'ct_wp_trash_comment', 997, 2);
1319
+ }
1320
+
1321
+ // Spam comment
1322
+ if($ct_result->spam == 1)
1323
+ add_filter('pre_comment_approved', 'ct_set_comment_spam', 997, 2);
1324
+
1325
+ // Move to pending folder. Contains stop_words.
1326
+ if($ct_result->stop_words){
1327
+ add_filter('pre_comment_approved', 'ct_set_not_approved', 998, 2);
1328
+ add_action('comment_post', 'ct_mark_red', 998, 2);
1329
+ }
1330
+
1331
+ add_action('comment_post', 'ct_die', 999, 2);
1332
+ }
1333
+
1334
+ if($apbct->settings['remove_comments_links'] == 1){
1335
+ $comment['comment_content'] = preg_replace("~(http|https|ftp|ftps)://(.*?)(\s|\n|[,.?!](\s|\n)|$)~", '[Link deleted]', $comment['comment_content']);
1336
+ }
1337
+
1338
+ // Change mail notification if license is out of date
1339
+ if($apbct->data['moderate'] == 0){
1340
+ $apbct->sender_email = $comment['comment_author_email'];
1341
+ $apbct->sender_ip = CleantalkHelper::ip__get(array('real'));
1342
+ add_filter('comment_moderation_text', 'apbct_comment__Wordpress__changeMailNotification', 100, 2); // Comment sent to moderation
1343
+ add_filter('comment_notification_text', 'apbct_comment__Wordpress__changeMailNotification', 100, 2); // Comment approved
1344
+ }
1345
+
1346
+ return $comment;
1347
+ }
1348
+
1349
+ /**
1350
+ * Changes whether notify admin/athor or not.
1351
+ *
1352
+ * @param bool $maybe_notify notify flag
1353
+ * @param int $comment_ID Comment id
1354
+ * @return bool flag
1355
+ */
1356
+ function apbct_comment__Wordpress__doNotify($maybe_notify, $comment_ID){
1357
+ return true;
1358
+ }
1359
+
1360
+ /**
1361
+ * Add notification setting link
1362
+ *
1363
+ * @param string $notify_message
1364
+ * @param integer $comment_id
1365
+ *
1366
+ * @return string
1367
+ */
1368
+ function apbct_comment__Wordpress__changeMailNotificationGroups($notify_message, $comment_id){
1369
+ return $notify_message
1370
+ .PHP_EOL
1371
+ .'---'.PHP_EOL
1372
+ .'Manage notifications settings: '.get_site_url().'/wp-admin/options-general.php?page=cleantalk';
1373
+ }
1374
+
1375
+ /**
1376
+ * Change email notification recipients
1377
+ *
1378
+ * @param array $emails
1379
+ * @param integer $comment_id
1380
+ *
1381
+ * @return array
1382
+ * @global SpbcState $apbct
1383
+ */
1384
+ function apbct_comment__Wordpress__changeMailNotificationRecipients($emails, $comment_id){
1385
+ global $apbct;
1386
+ return array_unique(array_merge($emails, (array)json_decode($apbct->comment_notification_recipients, true)));
1387
+ }
1388
+
1389
+ /**
1390
+ * Changes email notification for spam comment for native Wordpress comment system
1391
+ *
1392
+ * @param string $notify_message Body of email notification
1393
+ * @param int $comment_id Comment id
1394
+ * @return string Body for email notification
1395
+ */
1396
+ function apbct_comment__Wordpress__changeMailNotification($notify_message, $comment_id){
1397
+
1398
+ global $apbct;
1399
+
1400
+ $notify_message =
1401
+ PHP_EOL
1402
+ .__('CleanTalk AntiSpam: This message is possible spam.', 'cleantalk')
1403
+ ."\n".__('You could check it in CleanTalk\'s anti-spam database:', 'cleantalk')
1404
+ ."\n".'IP: https://cleantalk.org/blacklists/' . $apbct->sender_ip
1405
+ ."\n".'Email: https://cleantalk.org/blacklists/' . $apbct->sender_email
1406
+ ."\n".PHP_EOL . sprintf(
1407
+ __('Activate protection in your Anti-Spam Dashboard: %s.', 'clentalk'),
1408
+ 'https://cleantalk.org/my/?cp_mode=antispam&utm_source=newsletter&utm_medium=email&utm_campaign=wp_spam_comment_passed'
1409
+ .($apbct->data['user_token']
1410
+ ? '&iser_token='.$apbct->data['user_token']
1411
+ : ''
1412
+ )
1413
+ )
1414
+ .PHP_EOL . '---'
1415
+ .PHP_EOL
1416
+ .PHP_EOL
1417
+ .$notify_message;
1418
+
1419
+ return $notify_message;
1420
+
1421
+ }
1422
+
1423
+ /**
1424
+ * Set die page with Cleantalk comment.
1425
+ * @global array $ct_comment
1426
+ $err_text = '<center><b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk.</b> ' . __('Spam protection', 'cleantalk') . "</center><br><br>\n" . $ct_comment;
1427
+ * @param type $comment_status
1428
+ */
1429
+ function ct_die($comment_id, $comment_status) {
1430
+ global $ct_comment;
1431
+ $err_text = '<center><b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk.</b> ' . __('Spam protection', 'cleantalk') . "</center><br><br>\n" . $ct_comment;
1432
+ $err_text .= '<script>setTimeout("history.back()", 5000);</script>';
1433
+ if(isset($_POST['et_pb_contact_email']))
1434
+ {
1435
+ $mes='<div id="et_pb_contact_form_1" class="et_pb_contact_form_container clearfix"><h1 class="et_pb_contact_main_title">Blacklisted</h1><div class="et-pb-contact-message"><p>'.$ct_comment.'</p></div></div>';
1436
+ wp_die($mes, 'Blacklisted', array('back_link' => true,'response'=>200));
1437
+ }
1438
+ else
1439
+ {
1440
+ wp_die($err_text, 'Blacklisted', array('response' => 200, 'back_link' => true));
1441
+ }
1442
+ }
1443
+
1444
+ /**
1445
+ * Set die page with Cleantalk comment from parameter.
1446
+ * @param type $comment_body
1447
+ */
1448
+ function ct_die_extended($comment_body) {
1449
+ $err_text = '<center><b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk.</b> ' . __('Spam protection', 'cleantalk') . "</center><br><br>\n" . $comment_body;
1450
+ $err_text .= '<script>setTimeout("history.back()", 5000);</script>';
1451
+ wp_die($err_text, 'Blacklisted', array('response' => 200, 'back_link' => true));
1452
+ }
1453
+
1454
+ /**
1455
+ * Validates JavaScript anti-spam test
1456
+ *
1457
+ * @param string $field_name filed to serach in data
1458
+ * @param null $data Data to search in
1459
+ * @param bool $random_key
1460
+ *
1461
+ * @return int|null
1462
+ */
1463
+ function apbct_js_test($field_name = 'ct_checkjs', $data = null) {
1464
+
1465
+ global $apbct;
1466
+
1467
+ $out = null;
1468
+
1469
+ if($data && isset($data[$field_name])){
1470
+
1471
+ $js_key = trim($data[$field_name]);
1472
+
1473
+ // Check static key
1474
+ if(
1475
+ $apbct->settings['use_static_js_key'] == 1 ||
1476
+ ( $apbct->settings['use_static_js_key'] == - 1 &&
1477
+ ( apbct_is_cache_plugins_exists() ||
1478
+ ( apbct_is_post() && isset($apbct->data['cache_detected']) && $apbct->data['cache_detected'] == 1 )
1479
+ )
1480
+ )
1481
+ ){
1482
+ $out = ct_get_checkjs_value() === $js_key ? 1 : 0;
1483
+
1484
+ // Random key check
1485
+ }else{
1486
+ $out = array_key_exists( $js_key, $apbct->js_keys ) ? 1 : 0;
1487
+ }
1488
+ }
1489
+
1490
+ return $out;
1491
+ }
1492
+
1493
+ /**
1494
+ * Get post url
1495
+ * @param int $comment_id
1496
+ * @param int $comment_post_id
1497
+ * @return string|bool
1498
+ */
1499
+ function ct_post_url($comment_id = null, $comment_post_id) {
1500
+
1501
+ if (empty($comment_post_id))
1502
+ return null;
1503
+
1504
+ if ($comment_id === null) {
1505
+ $last_comment = get_comments('number=1');
1506
+ $comment_id = isset($last_comment[0]->comment_ID) ? (int) $last_comment[0]->comment_ID + 1 : 1;
1507
+ }
1508
+ $permalink = get_permalink($comment_post_id);
1509
+
1510
+ $post_url = null;
1511
+ if ($permalink !== null)
1512
+ $post_url = $permalink . '#comment-' . $comment_id;
1513
+
1514
+ return $post_url;
1515
+ }
1516
+
1517
+ /**
1518
+ * Public filter 'pre_comment_approved' - Mark comment unapproved always
1519
+ * @return int Zero
1520
+ */
1521
+ function ct_set_not_approved() {
1522
+ return 0;
1523
+ }
1524
+
1525
+ /**
1526
+ * @author Artem Leontiev
1527
+ * Public filter 'pre_comment_approved' - Mark comment approved if it's not 'spam' only
1528
+ * @return int 1
1529
+ */
1530
+ function ct_set_approved($approved, $comment) {
1531
+ if ($approved == 'spam'){
1532
+ return $approved;
1533
+ } else {
1534
+ return 1;
1535
+ }
1536
+ }
1537
+
1538
+ /**
1539
+ * Public filter 'pre_comment_approved' - Mark comment unapproved always
1540
+ * @return int Zero
1541
+ */
1542
+ function ct_set_comment_spam() {
1543
+ return 'spam';
1544
+ }
1545
+
1546
+ /**
1547
+ * Public action 'comment_post' - Store cleantalk hash in comment meta 'ct_hash'
1548
+ * @param int $comment_id Comment ID
1549
+ * @param mixed $comment_status Approval status ("spam", or 0/1), not used
1550
+ */
1551
+ function ct_set_meta($comment_id, $comment_status) {
1552
+ global $comment_post_id;
1553
+ $hash1 = ct_hash();
1554
+ if (!empty($hash1)) {
1555
+ update_comment_meta($comment_id, 'ct_hash', $hash1);
1556
+ if (function_exists('base64_encode') && isset($comment_status) && $comment_status != 'spam') {
1557
+ $post_url = ct_post_url($comment_id, $comment_post_id);
1558
+ $post_url = base64_encode($post_url);
1559
+ if ($post_url === false)
1560
+ return false;
1561
+ // 01 - URL to approved comment
1562
+ $feedback_request = $hash1 . ':' . '01' . ':' . $post_url . ';';
1563
+ ct_send_feedback($feedback_request);
1564
+ }
1565
+ }
1566
+ return true;
1567
+ }
1568
+
1569
+ /**
1570
+ * Mark bad words
1571
+ * @global string $ct_stop_words
1572
+ * @param int $comment_id
1573
+ * @param int $comment_status Not use
1574
+ */
1575
+ function ct_mark_red($comment_id, $comment_status) {
1576
+ global $ct_stop_words;
1577
+
1578
+ $comment = get_comment($comment_id, 'ARRAY_A');
1579
+ $message = $comment['comment_content'];
1580
+ foreach (explode(':', $ct_stop_words) as $word) {
1581
+ $message = preg_replace("/($word)/ui", '<font rel="cleantalk" color="#FF1000">' . "$1" . '</font>', $message);
1582
+
1583
+ }
1584
+ $comment['comment_content'] = $message;
1585
+ kses_remove_filters();
1586
+ wp_update_comment($comment);
1587
+ }
1588
+
1589
+ //
1590
+ //Send post to trash
1591
+ //
1592
+ function ct_wp_trash_comment($comment_id, $comment_status){
1593
+ wp_trash_comment($comment_id);
1594
+ }
1595
+
1596
+ /**
1597
+ * Tests plugin activation status
1598
+ * @return bool
1599
+ */
1600
+ function ct_plugin_active($plugin_name){
1601
+ foreach (get_option('active_plugins') as $k => $v) {
1602
+ if ($plugin_name == $v)
1603
+ return true;
1604
+ }
1605
+ return false;
1606
+ }
1607
+
1608
+ /**
1609
+ * Insert a hidden field to registration form
1610
+ * @return null
1611
+ */
1612
+ function ct_register_form() {
1613
+
1614
+ global $ct_checkjs_register_form, $apbct;
1615
+
1616
+ if ($apbct->settings['registrations_test'] == 0) {
1617
+ return false;
1618
+ }
1619
+
1620
+ ct_add_hidden_fields($ct_checkjs_register_form, false, false, false, false);
1621
+
1622
+ return null;
1623
+ }
1624
+
1625
+ function apbct_login__scripts(){
1626
+ echo '<script src="'.APBCT_URL_PATH.'/js/apbct-public.min.js"></script>';
1627
+ }
1628
+
1629
+ /**
1630
+ * Adds notification text to login form - to inform about approved registration
1631
+ * @return null
1632
+ */
1633
+ function ct_login_message($message) {
1634
+
1635
+ global $errors, $apbct, $apbct_cookie_register_ok_label;
1636
+
1637
+
1638
+
1639
+ if ($apbct->settings['registrations_test'] != 0){
1640
+ if( isset($_GET['checkemail']) && 'registered' == $_GET['checkemail'] ){
1641
+ if (isset($_COOKIE[$apbct_cookie_register_ok_label])){
1642
+ if(is_wp_error($errors)){
1643
+ $errors->add('ct_message',sprintf(__('Registration approved by %s.', 'cleantalk'), '<b style="color: #49C73B;">Clean</b><b style="color: #349ebf;">Talk</b>'), 'message');
1644
+ }
1645
+ }
1646
+ }
1647
+ }
1648
+ return $message;
1649
+ }
1650
+
1651
+ /**
1652
+ * Test users registration for pPress
1653
+ * @return array with errors
1654
+ */
1655
+ function ct_registration_errors_ppress($reg_errors, $form_id) {
1656
+
1657
+ $email = $_POST['reg_email'];
1658
+ $login = $_POST['reg_username'];
1659
+
1660
+ $reg_errors = ct_registration_errors($reg_errors, $login, $email);
1661
+
1662
+ return $reg_errors;
1663
+ }
1664
+
1665
+ /**
1666
+ * Test users registration for multisite enviroment
1667
+ * @return array with errors
1668
+ */
1669
+ function ct_registration_errors_wpmu($errors) {
1670
+ global $ct_signup_done;
1671
+
1672
+ //
1673
+ // Multisite actions
1674
+ //
1675
+ $sanitized_user_login = null;
1676
+ if (isset($errors['user_name'])) {
1677
+ $sanitized_user_login = $errors['user_name'];
1678
+ $wpmu = true;
1679
+ }
1680
+ $user_email = null;
1681
+ if (isset($errors['user_email'])) {
1682
+ $user_email = $errors['user_email'];
1683
+ $wpmu = true;
1684
+ }
1685
+
1686
+ if ($wpmu && isset($errors['errors']->errors) && count($errors['errors']->errors) > 0) {
1687
+ return $errors;
1688
+ }
1689
+
1690
+ $errors['errors'] = ct_registration_errors($errors['errors'], $sanitized_user_login, $user_email);
1691
+
1692
+ // Show CleanTalk errors in user_name field
1693
+ if (isset($errors['errors']->errors['ct_error'])) {
1694
+ $errors['errors']->errors['user_name'] = $errors['errors']->errors['ct_error'];
1695
+ unset($errors['errors']->errors['ct_error']);
1696
+ }
1697
+
1698
+ return $errors;
1699
+ }
1700
+
1701
+ /**
1702
+ * Shell for action register_post
1703
+ * @return array with errors
1704
+ */
1705
+ function ct_register_post($sanitized_user_login = null, $user_email = null, $errors) {
1706
+ return ct_registration_errors($errors, $sanitized_user_login, $user_email);
1707
+ }
1708
+
1709
+ /**
1710
+ * Check messages for external plugins
1711
+ * @return array with checking result;
1712
+ */
1713
+
1714
+ function ct_test_message($nickname, $email, $ip, $text){
1715
+
1716
+ $base_call_result = apbct_base_call(
1717
+ array(
1718
+ 'message' => $text,
1719
+ 'sender_email' => $email,
1720
+ 'sender_nickname' => $nickname,
1721
+ 'post_info' => array('comment_type' => 'feedback_plugin_check'),
1722
+ 'js_on' => apbct_js_test('ct_checkjs', $_COOKIE),
1723
+ )
1724
+ );
1725
+
1726
+ $ct_result = $base_call_result['ct_result'];
1727
+
1728
+ $result=Array(
1729
+ 'allow' => $ct_result->allow,
1730
+ 'comment' => $ct_result->comment,
1731
+ );
1732
+ return $result;
1733
+ }
1734
+
1735
+ /**
1736
+ * Check registrations for external plugins
1737
+ * @return array with checking result;
1738
+ */
1739
+ function ct_test_registration($nickname, $email, $ip){
1740
+
1741
+ global $ct_checkjs_register_form, $apbct;
1742
+
1743
+ if(apbct_js_test($ct_checkjs_register_form, $_POST)){
1744
+ $checkjs = apbct_js_test($ct_checkjs_register_form, $_POST);
1745
+ $sender_info['post_checkjs_passed'] = $checkjs;
1746
+ }else{
1747
+ $checkjs = $checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
1748
+ $sender_info['cookie_checkjs_passed'] = $checkjs;
1749
+ }
1750
+
1751
+ //Making a call
1752
+ $base_call_result = apbct_base_call(
1753
+ array(
1754
+ 'sender_ip' => $ip,
1755
+ 'sender_email' => $email,
1756
+ 'sender_nickname' => $nickname,
1757
+ 'sender_info' => $sender_info,
1758
+ 'js_on' => $checkjs,
1759
+ ),
1760
+ true
1761
+ );
1762
+ $ct_result = $base_call_result['ct_result'];
1763
+
1764
+ $result = array(
1765
+ 'allow' => $ct_result->allow,
1766
+ 'comment' => $ct_result->comment,
1767
+ );
1768
+ return $result;
1769
+ }
1770
+
1771
+ /**
1772
+ * Test users registration
1773
+ *
1774
+ * @param $errors
1775
+ * @param null $sanitized_user_login
1776
+ * @param null $user_email
1777
+ *
1778
+ * @return void with errors
1779
+ */
1780
+ function ct_registration_errors($errors, $sanitized_user_login = null, $user_email = null) {
1781
+
1782
+ global $ct_checkjs_register_form, $apbct_cookie_request_id_label, $apbct_cookie_register_ok_label, $bp, $ct_signup_done, $ct_negative_comment, $apbct, $ct_registration_error_comment, $cleantalk_executed;
1783
+
1784
+ // Go out if a registrered user action
1785
+ if (apbct_is_user_enable() === false) {
1786
+ return $errors;
1787
+ }
1788
+
1789
+ if ($apbct->settings['registrations_test'] == 0) {
1790
+ return $errors;
1791
+ }
1792
+
1793
+ // The function already executed
1794
+ // It happens when used ct_register_post();
1795
+ if ($ct_signup_done && is_object($errors) && count($errors->errors) > 0) {
1796
+ return $errors;
1797
+ }
1798
+
1799
+ // Facebook registration
1800
+ if ($sanitized_user_login === null && isset($_POST['FB_userdata'])){
1801
+ $sanitized_user_login = $_POST['FB_userdata']['name'];
1802
+ $facebook = true;
1803
+ }
1804
+ if ($user_email === null && isset($_POST['FB_userdata'])){
1805
+ $user_email = $_POST['FB_userdata']['email'];
1806
+ $facebook = true;
1807
+ }
1808
+
1809
+ // BuddyPress actions
1810
+ $buddypress = false;
1811
+ if ($sanitized_user_login === null && isset($_POST['signup_username'])) {
1812
+ $sanitized_user_login = $_POST['signup_username'];
1813
+ $buddypress = true;
1814
+ }
1815
+ if ($user_email === null && isset($_POST['signup_email'])) {
1816
+ $user_email = $_POST['signup_email'];
1817
+ $buddypress = true;
1818
+ }
1819
+
1820
+ //
1821
+ // Break tests because we already have servers response
1822
+ //
1823
+ if ($buddypress && $ct_signup_done) {
1824
+ if ($ct_negative_comment) {
1825
+ $bp->signup->errors['signup_username'] = $ct_negative_comment;
1826
+ }
1827
+ return $errors;
1828
+ }
1829
+
1830
+
1831
+ if(current_filter() == 'woocommerce_registration_errors'){
1832
+ $checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
1833
+ $checkjs_post = null;
1834
+ $checkjs_cookie = $checkjs;
1835
+ }else{
1836
+ // This hack can be helpfull when plugin uses with untested themes&signups plugins.
1837
+ $checkjs_post = apbct_js_test($ct_checkjs_register_form, $_POST);
1838
+ $checkjs_cookie = apbct_js_test($ct_checkjs_register_form, $_COOKIE);
1839
+ $checkjs = $checkjs_cookie ? $checkjs_cookie : $checkjs_post;
1840
+ }
1841
+
1842
+ $sender_info = array(
1843
+ 'post_checkjs_passed' => $checkjs_post,
1844
+ 'cookie_checkjs_passed' => $checkjs_cookie,
1845
+ 'form_validation' => ! empty( $errors )
1846
+ ? json_encode( array(
1847
+ 'validation_notice' => $errors->get_error_message(),
1848
+ 'page_url' => apbct_get_server_variable( 'HTTP_HOST' ) . apbct_get_server_variable( 'REQUEST_URI' ),
1849
+ ) )
1850
+ : null,
1851
+ );
1852
+
1853
+ $base_call_result = apbct_base_call(
1854
+ array(
1855
+ 'sender_email' => $user_email,
1856
+ 'sender_nickname' => $sanitized_user_login,
1857
+ 'sender_info' => $sender_info,
1858
+ 'js_on' => $checkjs,
1859
+ ),
1860
+ true
1861
+ );
1862
+ $ct_result = $base_call_result['ct_result'];
1863
+
1864
+ // Change mail notification if license is out of date
1865
+ if($apbct->data['moderate'] == 0 &&
1866
+ ($ct_result->fast_submit == 1 || $ct_result->blacklisted == 1 || $ct_result->js_disabled == 1)
1867
+ ){
1868
+ $apbct->sender_email = $user_email;
1869
+ $apbct->sender_ip = CleantalkHelper::ip__get(array('real'));
1870
+ add_filter('wp_new_user_notification_email_admin', 'apbct_registration__Wordpress__changeMailNotification', 100, 3);
1871
+ }
1872
+
1873
+ $ct_signup_done = true;
1874
+
1875
+ $ct_result = ct_change_plugin_resonse($ct_result, $checkjs);
1876
+
1877
+ $cleantalk_executed = true;
1878
+
1879
+ if ($ct_result->inactive != 0) {
1880
+ ct_send_error_notice($ct_result->comment);
1881
+ return $errors;
1882
+ }
1883
+
1884
+ if ($ct_result->allow == 0) {
1885
+
1886
+ if ($buddypress === true) {
1887
+ $bp->signup->errors['signup_username'] = $ct_result->comment;
1888
+ }elseif(!empty($facebook)){
1889
+ $_POST['FB_userdata']['email'] = '';
1890
+ $_POST['FB_userdata']['name'] = '';
1891
+ return;
1892
+ }else{
1893
+ if(is_wp_error($errors))
1894
+ $errors->add('ct_error', $ct_result->comment);
1895
+ $ct_negative_comment = $ct_result->comment;
1896
+ }
1897
+
1898
+ $ct_registration_error_comment = $ct_result->comment;
1899
+
1900
+ } else {
1901
+ if ($ct_result->id !== null) {
1902
+ setcookie($apbct_cookie_register_ok_label, $ct_result->id, time()+10, '/');
1903
+ setcookie($apbct_cookie_request_id_label, $ct_result->id, time()+10, '/');
1904
+ }
1905
+ }
1906
+
1907
+ return $errors;
1908
+ }
1909
+
1910
+ /**
1911
+ * Changes email notification for newly registred user
1912
+ *
1913
+ * @param string $wp_new_user_notification_email_admin Body of email notification
1914
+ * @param array $user User inof
1915
+ * @param string $blogname Blog name
1916
+ * @return string Body for email notification
1917
+ */
1918
+ function apbct_registration__Wordpress__changeMailNotification($wp_new_user_notification_email_admin, $user, $blogname){
1919
+
1920
+ global $apbct;
1921
+
1922
+ $wp_new_user_notification_email_admin['message'] = PHP_EOL
1923
+ .__('CleanTalk AntiSpam: This registration is spam.', 'cleantalk')
1924
+ ."\n" . __('CleanTalk\'s anti-spam database:', 'cleantalk')
1925
+ ."\n" . 'IP: ' . $apbct->sender_ip
1926
+ ."\n" . 'Email: ' . $apbct->sender_email
1927
+ .PHP_EOL . PHP_EOL .
1928
+ __('Activate protection in your Anti-Spam Dashboard: ', 'clentalk')
1929
+ .'https://cleantalk.org/my/?cp_mode=antispam&utm_source=newsletter&utm_medium=email&utm_campaign=wp_spam_registration_passed'
1930
+ .($apbct->data['user_token']
1931
+ ? '&iser_token='.$apbct->data['user_token']
1932
+ : ''
1933
+ )
1934
+ .PHP_EOL . '---'
1935
+ .PHP_EOL
1936
+ .$wp_new_user_notification_email_admin['message'];
1937
+
1938
+ return $wp_new_user_notification_email_admin;
1939
+
1940
+
1941
+ }
1942
+
1943
+ /**
1944
+ * Checks Ultimate Members registration for spam
1945
+ *
1946
+ * @param $args forms arguments with names and values
1947
+ *
1948
+ * @return mixed
1949
+ *
1950
+ */
1951
+ function apbct_registration__UltimateMembers__check( $args ){
1952
+
1953
+ if ( isset( UM()->form()->errors ) ) {
1954
+ $sender_info['previous_form_validation'] = true;
1955
+ $sender_info['validation_notice'] = json_encode( UM()->form()->errors );
1956
+ }
1957
+
1958
+ global $apbct, $cleantalk_executed;
1959
+
1960
+ if ($apbct->settings['registrations_test'] == 0)
1961
+ return $args;
1962
+
1963
+ $checkjs = apbct_js_test('ct_checkjs_register_form', $args);
1964
+ $sender_info['post_checkjs_passed'] = $checkjs;
1965
+
1966
+ // This hack can be helpfull when plugin uses with untested themes&signups plugins.
1967
+ if ($checkjs == 0) {
1968
+ $checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
1969
+ $sender_info['cookie_checkjs_passed'] = $checkjs;
1970
+ }
1971
+
1972
+ $base_call_result = apbct_base_call(
1973
+ array(
1974
+ 'sender_email' => $args['user_email'],
1975
+ 'sender_nickname' => $args['user_login'],
1976
+ 'sender_info' => $sender_info,
1977
+ 'js_on' => $checkjs,
1978
+ ),
1979
+ true
1980
+ );
1981
+ $ct_result = $base_call_result['ct_result'];
1982
+
1983
+ $cleantalk_executed = true;
1984
+
1985
+ if ($ct_result->inactive != 0) {
1986
+ ct_send_error_notice($ct_result->comment);
1987
+ return $args;
1988
+ }
1989
+
1990
+ if ($ct_result->allow == 0)
1991
+ UM()->form()->add_error('user_password', $ct_result->comment );
1992
+
1993
+ return $args;
1994
+ }
1995
+
1996
+ /**
1997
+ * Checks registration error and set it if it was dropped
1998
+ * @return errors
1999
+ */
2000
+ function ct_check_registration_erros($errors, $sanitized_user_login = null, $user_email = null) {
2001
+ global $bp, $ct_registration_error_comment;
2002
+
2003
+ if($ct_registration_error_comment){
2004
+
2005
+ if(isset($bp))
2006
+ if(method_exists($bp, 'signup'))
2007
+ if(method_exists($bp->signup, 'errors'))
2008
+ if(isset($bp->signup->errors['signup_username']))
2009
+ if($bp->signup->errors['signup_username'] != $ct_registration_error_comment)
2010
+ $bp->signup->errors['signup_username'] = $ct_registration_error_comment;
2011
+
2012
+ if(isset($errors))
2013
+ if(method_exists($errors, 'errors'))
2014
+ if(isset($errors->errors['ct_error']))
2015
+ if($errors->errors['ct_error'][0] != $ct_registration_error_comment)
2016
+ $errors->add('ct_error', $ct_registration_error_comment);
2017
+
2018
+ }
2019
+ return $errors;
2020
+ }
2021
+
2022
+ /**
2023
+ * Set user meta (ct_hash) for successed registration
2024
+ * @return null
2025
+ */
2026
+ function apbct_user_register($user_id) {
2027
+ global $apbct_cookie_request_id_label;
2028
+ if (isset($_COOKIE[$apbct_cookie_request_id_label])) {
2029
+ if(update_user_meta($user_id, 'ct_hash', $_COOKIE[$apbct_cookie_request_id_label])){
2030
+ setcookie($apbct_cookie_request_id_label, '0', 1, '/');
2031
+ }
2032
+ }
2033
+ }
2034
+
2035
+
2036
+ /**
2037
+ * Test for JetPack contact form
2038
+ */
2039
+ function ct_grunion_contact_form_field_html($r, $field_label) {
2040
+
2041
+ global $ct_checkjs_jpcf, $ct_jpcf_patched, $ct_jpcf_fields, $apbct;
2042
+
2043
+ if ($apbct->settings['contact_forms_test'] == 1 && $ct_jpcf_patched === false && preg_match( "/(text|email)/i", $r)) {
2044
+
2045
+ // Looking for element name prefix
2046
+ $name_patched = false;
2047
+ foreach ($ct_jpcf_fields as $v) {
2048
+ if ($name_patched === false && preg_match("/(g\d-)$v/", $r, $matches)) {
2049
+ $ct_checkjs_jpcf = $matches[1] . $ct_checkjs_jpcf;
2050
+ $name_patched = true;
2051
+ }
2052
+ }
2053
+
2054
+ $r .= ct_add_hidden_fields($ct_checkjs_jpcf, true);
2055
+ $ct_jpcf_patched = true;
2056
+ }
2057
+
2058
+ return $r;
2059
+ }
2060
+ /**
2061
+ * Test for JetPack contact form
2062
+ */
2063
+ function ct_contact_form_is_spam($form) {
2064
+
2065
+ global $ct_checkjs_jpcf, $apbct;
2066
+
2067
+ if ($apbct->settings['contact_forms_test'] == 0) {
2068
+ return null;
2069
+ }
2070
+
2071
+ $js_field_name = $ct_checkjs_jpcf;
2072
+ foreach ($_POST as $k => $v) {
2073
+ if (preg_match("/^.+$ct_checkjs_jpcf$/", $k))
2074
+ $js_field_name = $k;
2075
+ }
2076
+
2077
+ $sender_email = null;
2078
+ $sender_nickname = null;
2079
+ $message = '';
2080
+ if (isset($form['comment_author_email']))
2081
+ $sender_email = $form['comment_author_email'];
2082
+
2083
+ if (isset($form['comment_author']))
2084
+ $sender_nickname = $form['comment_author'];
2085
+
2086
+ if (isset($form['comment_content']))
2087
+ $message = $form['comment_content'];
2088
+
2089
+ $base_call_result = apbct_base_call(
2090
+ array(
2091
+ 'message' => $message,
2092
+ 'sender_email' => $sender_email,
2093
+ 'sender_nickname' => $sender_nickname,
2094
+ 'post_info' => array('comment_type' => 'contact_form_wordpress_grunion'),
2095
+ 'sender_info' => array('sender_url' => @$form['comment_author_url']),
2096
+ 'js_on' => apbct_js_test($js_field_name, $_POST),
2097
+ )
2098
+ );
2099
+ $ct_result = $base_call_result['ct_result'];
2100
+
2101
+ if ($ct_result->allow == 0) {
2102
+ global $ct_comment;
2103
+ $ct_comment = $ct_result->comment;
2104
+ ct_die(null, null);
2105
+ exit;
2106
+ }
2107
+
2108
+ return (bool) !$ct_result->allow;
2109
+ }
2110
+
2111
+ function ct_contact_form_is_spam_jetpack($is_spam,$form) {
2112
+ global $ct_checkjs_jpcf, $apbct;
2113
+
2114
+ if ($apbct->settings['contact_forms_test'] == 0) {
2115
+ return null;
2116
+ }
2117
+
2118
+ $js_field_name = $ct_checkjs_jpcf;
2119
+ foreach ($_POST as $k => $v) {
2120
+ if (preg_match("/^.+$ct_checkjs_jpcf$/", $k))
2121
+ $js_field_name = $k;
2122
+ }
2123
+
2124
+ $base_call_result = apbct_base_call(
2125
+ array(
2126
+ 'message' => isset($form['comment_content']) ? $form['comment_content'] : '',
2127
+ 'sender_email' => isset($form['comment_author_email']) ? $form['comment_author_email'] : null,
2128
+ 'sender_nickname' => isset($form['comment_author']) ? $form['comment_author'] : null,
2129
+ 'post_info' => array('comment_type' => 'contact_form_wordpress_grunion'),
2130
+ 'sender_info' => array('sender_url' => @$form['comment_author_url']),
2131
+ )
2132
+ );
2133
+ $ct_result = $base_call_result['ct_result'];
2134
+
2135
+ if ($ct_result->allow == 0) {
2136
+ global $ct_comment;
2137
+ $ct_comment = $ct_result->comment;
2138
+ ct_die(null, null);
2139
+ exit;
2140
+ }
2141
+
2142
+ return (bool) !$ct_result->allow;
2143
+ }
2144
+
2145
+ /**
2146
+ * Inserts anti-spam hidden to WP Maintenance Mode (wpmm)
2147
+ */
2148
+ function apbct_form__wpmm__addField(){
2149
+ ct_add_hidden_fields('ct_checkjs', false, true, true);
2150
+ }
2151
+
2152
+ /**
2153
+ * Inserts anti-spam hidden to CF7
2154
+ */
2155
+ function apbct_form__contactForm7__addField($html) {
2156
+ global $ct_checkjs_cf7, $apbct;
2157
+
2158
+
2159
+
2160
+ if ($apbct->settings['contact_forms_test'] == 0) {
2161
+ return $html;
2162
+ }
2163
+
2164
+ $html .= ct_add_hidden_fields($ct_checkjs_cf7, true);
2165
+
2166
+ return $html;
2167
+ }
2168
+
2169
+ /**
2170
+ * Test spam for Contact Fomr 7 (CF7) right before validation
2171
+ *
2172
+ * @global SpbcState $apbct
2173
+ * @param type $result
2174
+ * @param type $tags
2175
+ * @return type
2176
+ */
2177
+ function apbct_form__contactForm7__tesSpam__before_validate($result = null, $tags = null) {
2178
+ global $apbct;
2179
+
2180
+ if ($result && method_exists($result, 'get_invalid_fields')){
2181
+ $invalid_fields = $result->get_invalid_fields();
2182
+ if(!empty($invalid_fields) && is_array($invalid_fields)){
2183
+ $apbct->validation_error = $invalid_fields[key($invalid_fields)]['reason'];
2184
+ apbct_form__contactForm7__testSpam(false);
2185
+ }
2186
+ }
2187
+
2188
+ return $result;
2189
+ }
2190
+
2191
+ /**
2192
+ * Test CF7 message for spam
2193
+ */
2194
+ function apbct_form__contactForm7__testSpam($param) {
2195
+
2196
+ global $ct_checkjs_cf7, $apbct;
2197
+
2198
+ if(
2199
+ $apbct->settings['contact_forms_test'] == 0 ||
2200
+ $param == false && WPCF7_VERSION < '3.0.0' ||
2201
+ $param === true && WPCF7_VERSION >= '3.0.0' ||
2202
+ $apbct->settings['protect_logged_in'] != 1 && is_user_logged_in() || // Skip processing for logged in users.
2203
+ apbct_exclusions_check__url() ||
2204
+ apbct_exclusions_check__ip() ||
2205
+ isset($apbct->cf7_checked)
2206
+ ){
2207
+ return $param;
2208
+ }
2209
+
2210
+ $checkjs = apbct_js_test($ct_checkjs_cf7, $_POST)
2211
+ ? apbct_js_test($ct_checkjs_cf7, $_POST)
2212
+ : apbct_js_test('ct_checkjs', $_COOKIE);
2213
+
2214
+ $ct_temp_msg_data = ct_get_fields_any($_POST);
2215
+
2216
+ $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
2217
+ $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
2218
+ $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
2219
+ $contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
2220
+ $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
2221
+ if ($subject != '') {
2222
+ $message = array_merge(array('subject' => $subject), $message);
2223
+ }
2224
+
2225
+ $base_call_result = apbct_base_call(
2226
+ array(
2227
+ 'message' => $message,
2228
+ 'sender_email' => $sender_email,
2229
+ 'sender_nickname' => $sender_nickname,
2230
+ 'js_on' => $checkjs,
2231
+ 'post_info' => array('comment_type' => 'contact_form_wordpress_cf7'),
2232
+ 'sender_info' => array(
2233
+ 'form_validation' => !isset($apbct->validation_error)
2234
+ ? null
2235
+ : json_encode(array(
2236
+ 'validation_notice' => $apbct->validation_error,
2237
+ 'page_url' => apbct_get_server_variable( 'HTTP_HOST' ) . apbct_get_server_variable( 'REQUEST_URI' ),
2238
+ ))
2239
+ ),
2240
+ )
2241
+ );
2242
+
2243
+ $ct_result = $base_call_result['ct_result'];
2244
+
2245
+ // Change mail notification if license is out of date
2246
+ if($apbct->data['moderate'] == 0 &&
2247
+ ($ct_result->fast_submit == 1 || $ct_result->blacklisted == 1 || $ct_result->js_disabled == 1)
2248
+ ){
2249
+ $apbct->sender_email = $sender_email;
2250
+ $apbct->sender_ip = CleantalkHelper::ip__get(array('real'));
2251
+ add_filter('wpcf7_mail_components', 'apbct_form__contactForm7__changeMailNotification');
2252
+ }
2253
+
2254
+ if ($ct_result->allow == 0) {
2255
+
2256
+ global $ct_cf7_comment;
2257
+ $ct_cf7_comment = $ct_result->comment;
2258
+
2259
+ add_filter('wpcf7_display_message', 'apbct_form__contactForm7__showResponse', 10, 2);
2260
+
2261
+ $param = WPCF7_VERSION >= '3.0.0' ? true : false;
2262
+
2263
+ }
2264
+
2265
+ $apbct->cf7_checked = true;
2266
+
2267
+ return $param;
2268
+ }
2269
+
2270
+ /**
2271
+ * Changes CF7 status message
2272
+ * @param string $hook URL of hooked page
2273
+ */
2274
+ function apbct_form__contactForm7__showResponse($message, $status = 'spam') {
2275
+ global $ct_cf7_comment;
2276
+
2277
+ if ($status == 'spam') {
2278
+ $message = $ct_cf7_comment;
2279
+ }
2280
+
2281
+ return $message;
2282
+ }
2283
+
2284
+ /**
2285
+ * Changes email notification for succes subscription for Contact Form 7
2286
+ *
2287
+ * @param array $component Arguments for email notification
2288
+ * @return array Arguments for email notification
2289
+ */
2290
+ function apbct_form__contactForm7__changeMailNotification($component){
2291
+
2292
+ global $apbct;
2293
+
2294
+ $component['body'] =
2295
+ __('CleanTalk AntiSpam: This message is spam.', 'cleantalk')
2296
+ .PHP_EOL . __('CleanTalk\'s anti-spam database:', 'cleantalk')
2297
+ .PHP_EOL . 'IP: ' . $apbct->sender_ip
2298
+ .PHP_EOL . 'Email: ' . $apbct->sender_email
2299
+ .PHP_EOL . sprintf(
2300
+ __('Activate protection in your Anti-Spam Dashboard: %s.', 'clentalk'),
2301
+ 'https://cleantalk.org/my/?cp_mode=antispam&utm_source=newsletter&utm_medium=email&utm_campaign=cf7_activate_antispam&user_token='.$apbct->user_token
2302
+ )
2303
+ .PHP_EOL . '---' . PHP_EOL . PHP_EOL
2304
+ .$component['body'];
2305
+
2306
+ return (array) $component;
2307
+ }
2308
+
2309
+ /**
2310
+ * Test Ninja Forms message for spam
2311
+ *
2312
+ * @global SpbcState $apbct
2313
+ * @return void
2314
+ */
2315
+ function apbct_form__ninjaForms__testSpam() {
2316
+
2317
+ global $apbct;
2318
+
2319
+ if(
2320
+ $apbct->settings['contact_forms_test'] == 0
2321
+ || ($apbct->settings['protect_logged_in'] != 1 && is_user_logged_in()) // Skip processing for logged in users.
2322
+ || apbct_exclusions_check__url()
2323
+ ){
2324
+ return;
2325
+ }
2326
+
2327
+ $checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
2328
+
2329
+ // Choosing between POST and GET
2330
+ $params = ct_get_fields_any(isset($_GET['ninja_forms_ajax_submit']) || isset($_GET['nf_ajax_submit']) ? $_GET : $_POST);
2331
+
2332
+ $sender_email = ($params['email'] ? $params['email'] : '');
2333
+ $sender_nickname = ($params['nickname'] ? $params['nickname'] : '');
2334
+ $subject = ($params['subject'] ? $params['subject'] : '');
2335
+ $message = ($params['message'] ? $params['message'] : array());
2336
+ if ($subject != '') {
2337
+ $message = array_merge(array('subject' => $subject), $message);
2338
+ }
2339
+
2340
+ //Ninja Forms xml fix
2341
+ foreach ($message as $key => $value){
2342
+ if (strpos($value, '<xml>') !== false)
2343
+ unset($message[$key]);
2344
+ }
2345
+
2346
+ $base_call_result = apbct_base_call(
2347
+ array(
2348
+ 'message' => $message,
2349
+ 'sender_email' => $sender_email,
2350
+ 'sender_nickname' => $sender_nickname,
2351
+ 'post_info' => array('comment_type' => 'contact_form_wordpress_ninja_froms'),
2352
+ 'js_on' => $checkjs,
2353
+ )
2354
+ );
2355
+ $ct_result = $base_call_result['ct_result'];
2356
+
2357
+ // Change mail notification if license is out of date
2358
+ if($apbct->data['moderate'] == 0 &&
2359
+ ($ct_result->fast_submit == 1 || $ct_result->blacklisted == 1 || $ct_result->js_disabled == 1)
2360
+ ){
2361
+ $apbct->sender_email = $sender_email;
2362
+ $apbct->sender_ip = CleantalkHelper::ip__get(array('real'));
2363
+ add_filter('ninja_forms_action_email_message', 'apbct_form__ninjaForms__changeMailNotification', 1, 3);
2364
+ }
2365
+
2366
+ if ($ct_result->allow == 0) {
2367
+
2368
+ // We have to use GLOBAL variable to transfer the comment to apbct_form__ninjaForms__changeResponse() function :(
2369
+ $apbct->response = $ct_result->comment;
2370
+ add_action( 'ninja_forms_before_response', 'apbct_form__ninjaForms__changeResponse', 10, 1 );
2371
+ }
2372
+ }
2373
+
2374
+ function apbct_form__ninjaForms__changeResponse( $data ) {
2375
+
2376
+ global $apbct;
2377
+
2378
+ // Show error message below field found by ID
2379
+ if(array_key_exists('email', $data['fields_by_key'])){
2380
+ // Find ID of EMAIL field
2381
+ $nf_field_id = $data['fields_by_key']['email']['id'];
2382
+ }else{
2383
+ // Find ID of last field (usually SUBMIT)
2384
+ $nf_field_id = array_pop(array_keys($data['fields']));
2385
+ }
2386
+
2387
+ // Below is modified NJ logic
2388
+ $error = array(
2389
+ 'fields' => array(
2390
+ $nf_field_id => $apbct->response,
2391
+ ),
2392
+ );
2393
+
2394
+ $response = array( 'data' => $data, 'errors' => $error, 'debug' => '' );
2395
+
2396
+ die(wp_json_encode( $response, JSON_FORCE_OBJECT ));
2397
+
2398
+ }
2399
+
2400
+ function apbct_form__seedprod_coming_soon__testSpam() {
2401
+
2402
+ global $apbct;
2403
+
2404
+ if(
2405
+ $apbct->settings['contact_forms_test'] == 0
2406
+ || ($apbct->settings['protect_logged_in'] != 1 && is_user_logged_in()) // Skip processing for logged in users.
2407
+ || apbct_exclusions_check__url()
2408
+ ){
2409
+ return;
2410
+ }
2411
+
2412
+ $ct_temp_msg_data = ct_get_fields_any($_REQUEST);
2413
+
2414
+ $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
2415
+ $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
2416
+ $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
2417
+ $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
2418
+ if ($subject != '') {
2419
+ $message = array_merge(array('subject' => $subject), $message);
2420
+ }
2421
+
2422
+ $post_info['comment_type'] = 'contact_form_wordpress_seedprod_coming_soon';
2423
+
2424
+ $base_call_result = apbct_base_call(
2425
+ array(
2426
+ 'message' => $message,
2427
+ 'sender_email' => $sender_email,
2428
+ 'sender_nickname' => $sender_nickname,
2429
+ 'post_info' => $post_info,
2430
+ )
2431
+ );
2432
+
2433
+ $ct_result = $base_call_result['ct_result'];
2434
+ if ($ct_result->allow == 0) {
2435
+ global $ct_comment;
2436
+ $ct_comment = $ct_result->comment;
2437
+
2438
+ $response = array(
2439
+ 'status' => 200,
2440
+ 'html' => "<h1>".__('Spam protection by CleanTalk', 'cleantalk')."</h1><h2>".$ct_result->comment."</h2>"
2441
+ );
2442
+
2443
+ echo sanitize_text_field($_GET['callback']) . '(' . json_encode($response) . ')';
2444
+ exit();
2445
+ }
2446
+
2447
+ }
2448
+
2449
+ /**
2450
+ * Changes email notification for succes subscription for Ninja Forms
2451
+ *
2452
+ * @param string $message Body of email notification
2453
+ * @return string Body for email notification
2454
+ */
2455
+ function apbct_form__ninjaForms__changeMailNotification($message, $data, $action_settings){
2456
+
2457
+ global $apbct;
2458
+
2459
+ if($action_settings['to'] !== $apbct->sender_email){
2460
+
2461
+ $message .= wpautop(PHP_EOL . '---'
2462
+ .PHP_EOL
2463
+ .__('CleanTalk AntiSpam: This message is spam.', 'cleantalk')
2464
+ .PHP_EOL . __('CleanTalk\'s anti-spam database:', 'cleantalk')
2465
+ .PHP_EOL . 'IP: ' . $apbct->sender_ip
2466
+ .PHP_EOL . 'Email: ' . $apbct->sender_email
2467
+ .PHP_EOL .
2468
+ __('Activate protection in your Anti-Spam Dashboard: ', 'clentalk').
2469
+ 'https://cleantalk.org/my/?cp_mode=antispam&utm_source=newsletter&utm_medium=email&utm_campaign=ninjaform_activate_antispam'.$apbct->user_token
2470
+ );
2471
+ }
2472
+
2473
+ return $message;
2474
+ }
2475
+
2476
+ /**
2477
+ * Inserts anti-spam hidden to WPForms
2478
+ *
2479
+ * @global SpbcState $apbct
2480
+ * @return void
2481
+ */
2482
+ function apbct_form__WPForms__addField($form_data, $some, $title, $description, $errors) {
2483
+
2484
+ global $apbct;
2485
+
2486
+ if($apbct->settings['contact_forms_test'] == 1)
2487
+ ct_add_hidden_fields('checkjs_wpforms', false);
2488
+
2489
+ }
2490
+
2491
+ /**
2492
+ * Gather fields data from submission and store it
2493
+ *
2494
+ * @param array $entry
2495
+ * @param $form
2496
+ *
2497
+ * @return array
2498
+ * @global SpbcState $apbct
2499
+ */
2500
+ function apbct_from__WPForms__gatherData($entry, $form){
2501
+
2502
+ global $apbct;
2503
+
2504
+ $data = array();
2505
+ foreach($entry['fields'] as $key => $val){
2506
+ $true_key = strtolower(str_replace(' ', '_', $form['fields'][$key]['label']));
2507
+ $true_key = $true_key ? $true_key : $key;
2508
+ $data[$true_key] = $val;
2509
+ } unset($key, $val);
2510
+
2511
+ $apbct->form_data = $data;
2512
+
2513
+ return $entry;
2514
+ }
2515
+
2516
+ /**
2517
+ * Adding error to form entry if message is spam
2518
+ * Call spam test from here
2519
+ *
2520
+ * @param array $errors
2521
+ * @param array $form_data
2522
+ * @return array
2523
+ */
2524
+ function apbct_form__WPForms__showResponse($errors, $form_data) {
2525
+
2526
+ if(empty($errors) || ( isset($form_data['id'], $errors[$form_data['id']]) && !count($errors[$form_data['id']]) ) ){
2527
+
2528
+ $spam_comment = apbct_form__WPForms__testSpam();
2529
+
2530
+ $filed_id = $form_data && !empty($form_data['fields']) && is_array($form_data['fields'])
2531
+ ? key($form_data['fields'])
2532
+ : 0;
2533
+
2534
+ if($spam_comment)
2535
+ $errors[ $form_data['id'] ][ $filed_id ] = $spam_comment;
2536
+
2537
+ }
2538
+
2539
+ return $errors;
2540
+ }
2541
+
2542
+ /**
2543
+ * Test WPForms message for spam
2544
+ * Doesn't hooked anywhere.
2545
+ * Called directly from apbct_form__WPForms__showResponse()
2546
+ *
2547
+ * @global SpbcState $apbct
2548
+ * @global array $apbct->form_data Contains form data
2549
+ * @param array $errors Array of errors to write false result in
2550
+ * @return void|array|null
2551
+ */
2552
+ function apbct_form__WPForms__testSpam() {
2553
+
2554
+ global $apbct;
2555
+
2556
+ if(
2557
+ $apbct->settings['contact_forms_test'] == 0 ||
2558
+ $apbct->settings['protect_logged_in'] != 1 && is_user_logged_in() // Skip processing for logged in users.
2559
+ ){
2560
+ return;
2561
+ }
2562
+
2563
+ $checkjs = apbct_js_test('checkjs_wpforms', $_POST);
2564
+
2565
+ $params = ct_get_fields_any($apbct->form_data);
2566
+
2567
+ $sender_email = ($params['email'] ? $params['email'] : '');
2568
+ $sender_nickname = ($params['nickname'] ? $params['nickname'] : '');
2569
+ $subject = ($params['subject'] ? $params['subject'] : '');
2570
+ $message = ($params['message'] ? $params['message'] : array());
2571
+ if ($subject != '') {
2572
+ $message = array_merge(array('subject' => $subject), $message);
2573
+ }
2574
+
2575
+ $base_call_result = apbct_base_call(
2576
+ array(
2577
+ 'message' => $message,
2578
+ 'sender_email' => $sender_email,
2579
+ 'sender_nickname' => $sender_nickname,
2580
+ 'post_info' => array('comment_type' => 'contact_form_wordpress_wp_forms'),
2581
+ 'js_on' => $checkjs,
2582
+ )
2583
+ );
2584
+ $ct_result = $base_call_result['ct_result'];
2585
+
2586
+ // Change mail notification if license is out of date
2587
+ if($apbct->data['moderate'] == 0 &&
2588
+ ($ct_result->fast_submit == 1 || $ct_result->blacklisted == 1 || $ct_result->js_disabled == 1)
2589
+ ){
2590
+ $apbct->sender_email = $sender_email;
2591
+ $apbct->sender_ip = CleantalkHelper::ip__get(array('real'));
2592
+ add_filter('wpforms_email_message', 'apbct_form__WPForms__changeMailNotification', 100, 2);
2593
+ }
2594
+
2595
+ if ($ct_result->allow == 0){
2596
+ return $ct_result->comment;
2597
+ }
2598
+
2599
+ return null;
2600
+
2601
+ }
2602
+
2603
+ /**
2604
+ * Changes email notification for succes subscription for Ninja Forms
2605
+ *
2606
+ * @param string $message Body of email notification
2607
+ * @param WPForms_WP_Emails $wpforms_email WPForms email class object
2608
+ * @return string Body for email notification
2609
+ */
2610
+ function apbct_form__WPForms__changeMailNotification($message, $wpforms_email){
2611
+
2612
+ global $apbct;
2613
+
2614
+ $message = str_replace('</html>', '', $message);
2615
+ $message = str_replace('</body>', '', $message);
2616
+ $message .= wpautop(PHP_EOL . '---'
2617
+ .PHP_EOL
2618
+ .__('CleanTalk AntiSpam: This message is spam.', 'cleantalk')
2619
+ .PHP_EOL . __('CleanTalk\'s anti-spam database:', 'cleantalk')
2620
+ .PHP_EOL . 'IP: ' . '<a href="https://cleantalk.org/blacklists/' . $apbct->sender_ip . '?utm_source=newsletter&utm_medium=email&utm_campaign=wpforms_spam_passed" target="_blank">' . $apbct->sender_ip . '</a>'
2621
+ .PHP_EOL . 'Email: ' . '<a href="https://cleantalk.org/blacklists/' . $apbct->sender_email . '?utm_source=newsletter&utm_medium=email&utm_campaign=wpforms_spam_passed" target="_blank">' . $apbct->sender_email . '</a>'
2622
+ .PHP_EOL . sprintf(
2623
+ __('Activate protection in your %sAnti-Spam Dashboard%s.', 'clentalk'),
2624
+ '<a href="https://cleantalk.org/my/?cp_mode=antispam&utm_source=newsletter&utm_medium=email&utm_campaign=wpforms_activate_antispam" target="_blank">',
2625
+ '</a>'
2626
+ ))
2627
+ .'</body></html>';
2628
+
2629
+ return $message;
2630
+
2631
+ }
2632
+
2633
+ /*
2634
+ * QuForms check spam
2635
+ * works with singl-paged forms
2636
+ * and with multi-paged forms - check only last step of the forms
2637
+ */
2638
+ function ct_quform_post_validate($result, $form) {
2639
+
2640
+ if ( $form->hasPages() ) {
2641
+ $comment_type = 'contact_form_wordpress_quforms_multipage';
2642
+ } else {
2643
+ $comment_type = 'contact_form_wordpress_quforms_singlepage';
2644
+ }
2645
+
2646
+ $ct_temp_msg_data = ct_get_fields_any( $form->getValues() );
2647
+ // @ToDo If we have several emails at the form - will be used only the first detected!
2648
+ $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
2649
+
2650
+ $checkjs = apbct_js_test('ct_checkjs', $_COOKIE);
2651
+ $base_call_result = apbct_base_call(
2652
+ array(
2653
+ 'message' => $form->getValues(),
2654
+ 'sender_email' => $sender_email,
2655
+ 'post_info' => array('comment_type' => $comment_type),
2656
+ 'js_on' => $checkjs,
2657
+ )
2658
+ );
2659
+
2660
+ $ct_result = $base_call_result['ct_result'];
2661
+ if ($ct_result->allow == 0) {
2662
+ die(json_encode(array('type' => 'error', 'apbct' => array('blocked' => true, 'comment' => $ct_result->comment))));
2663
+ } else {
2664
+ return $result;
2665
+ }
2666
+
2667
+ return $result;
2668
+
2669
+ }
2670
+
2671
+ /**
2672
+ * Inserts anti-spam hidden to Fast Secure contact form
2673
+ */
2674
+ function ct_si_contact_display_after_fields($string = '', $style = '', $form_errors = array(), $form_id_num = 0) {
2675
+ $string .= ct_add_hidden_fields('ct_checkjs', true);
2676
+ return $string;
2677
+ }
2678
+
2679
+ /**
2680
+ * Test for Fast Secure contact form
2681
+ */
2682
+ function ct_si_contact_form_validate($form_errors = array(), $form_id_num = 0) {
2683
+ global $apbct, $cleantalk_executed;
2684
+
2685
+ if (!empty($form_errors))
2686
+ return $form_errors;
2687
+
2688
+ if ($apbct->settings['contact_forms_test'] == 0)
2689
+ return $form_errors;
2690
+
2691
+ // Skip processing because data already processed.
2692
+ if ($cleantalk_executed) {
2693
+ return $form_errors;
2694
+ }
2695
+
2696
+ //getting info from custom fields
2697
+ $ct_temp_msg_data = ct_get_fields_any($_POST);
2698
+
2699
+ $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
2700
+ $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
2701
+ $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
2702
+ $contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
2703
+ $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
2704
+ if($subject != '') {
2705
+ $message['subject'] = $subject;
2706
+ }
2707
+
2708
+ $base_call_result = apbct_base_call(
2709
+ array(
2710
+ 'message' => $message,
2711
+ 'sender_email' => $sender_email,
2712
+ 'sender_nickname' => $sender_nickname,
2713
+ 'post_info' => array('comment_type' => 'contact_form_wordpress_fscf'),
2714
+ 'js_on' => apbct_js_test('ct_checkjs', $_POST),
2715
+ )
2716
+ );
2717
+
2718
+ $ct_result = $base_call_result['ct_result'];
2719
+
2720
+ $cleantalk_executed = true;
2721
+
2722
+ if ($ct_result->allow == 0) {
2723
+ global $ct_comment;
2724
+ $ct_comment = $ct_result->comment;
2725
+ ct_die(null, null);
2726
+ exit;
2727
+ }
2728
+
2729
+ return $form_errors;
2730
+ }
2731
+
2732
+ /**
2733
+ * Notice for commentators which comment has automatically approved by plugin
2734
+ * @param string $hook URL of hooked page
2735
+ */
2736
+ function ct_comment_text($comment_text) {
2737
+ global $comment, $ct_approved_request_id_label;
2738
+
2739
+ if (isset($_COOKIE[$ct_approved_request_id_label]) && isset($comment->comment_ID)) {
2740
+ $ct_hash = get_comment_meta($comment->comment_ID, 'ct_hash', true);
2741
+
2742
+ if ($ct_hash !== '' && $_COOKIE[$ct_approved_request_id_label] == $ct_hash) {
2743
+ $comment_text .= '<br /><br /> <em class="comment-awaiting-moderation">' . __('Comment approved. Anti-spam by CleanTalk.', 'cleantalk') . '</em>';
2744
+ }
2745
+ }
2746
+
2747
+ return $comment_text;
2748
+ }
2749
+
2750
+
2751
+ /**
2752
+ * Checks WordPress Landing Pages raw $_POST values
2753
+ */
2754
+ function ct_check_wplp(){
2755
+
2756
+ global $ct_wplp_result_label, $apbct;
2757
+
2758
+ if (!isset($_COOKIE[$ct_wplp_result_label])) {
2759
+ // First AJAX submit of WPLP form
2760
+ if ($apbct->settings['contact_forms_test'] == 0)
2761
+ return;
2762
+
2763
+ $post_info['comment_type'] = 'feedback';
2764
+ $post_info = json_encode($post_info);
2765
+ if ($post_info === false)
2766
+ $post_info = '';
2767
+
2768
+ $sender_email = '';
2769
+ foreach ($_POST as $v) {
2770
+ if (preg_match("/^\S+@\S+\.\S+$/", $v)) {
2771
+ $sender_email = $v;
2772
+ break;
2773
+ }
2774
+ }
2775
+
2776
+ $message = '';
2777
+ if(array_key_exists('form_input_values', $_POST)){
2778
+ $form_input_values = json_decode(stripslashes($_POST['form_input_values']), true);
2779
+ if (is_array($form_input_values) && array_key_exists('null', $form_input_values))
2780
+ $message = $form_input_values['null'];
2781
+ } else if (array_key_exists('null', $_POST)) {
2782
+ $message = $_POST['null'];
2783
+ }
2784
+
2785
+ $base_call_result = apbct_base_call(
2786
+ array(
2787
+ 'message' => $message,
2788
+ 'sender_email' => $sender_email,
2789
+ 'post_info' => array('comment_type' => 'contact_form_wordpress_wplp'),
2790
+ )
2791
+ );
2792
+
2793
+ $ct_result = $base_call_result['ct_result'];
2794
+
2795
+ if ($ct_result->allow == 0) {
2796
+ $cleantalk_comment = $ct_result->comment;
2797
+ } else {
2798
+ $cleantalk_comment = 'OK';
2799
+ }
2800
+
2801
+ setcookie($ct_wplp_result_label, $cleantalk_comment, strtotime("+5 seconds"), '/');
2802
+ } else {
2803
+ // Next POST/AJAX submit(s) of same WPLP form
2804
+ $cleantalk_comment = $_COOKIE[$ct_wplp_result_label];
2805
+ }
2806
+ if ($cleantalk_comment !== 'OK')
2807
+ ct_die_extended($cleantalk_comment);
2808
+ }
2809
+
2810
+ /**
2811
+ * Places a hidding field to Gravity forms.
2812
+ * @return string
2813
+ */
2814
+ function apbct_form__gravityForms__addField($form_string, $form){
2815
+ $ct_hidden_field = 'ct_checkjs';
2816
+
2817
+ // Do not add a hidden field twice.
2818
+ if (preg_match("/$ct_hidden_field/", $form_string)) {
2819
+ return $form_string;
2820
+ }
2821
+
2822
+ $search = "</form>";
2823
+
2824
+ // Adding JS code
2825
+ $js_code = ct_add_hidden_fields($ct_hidden_field, true, false);
2826
+ $form_string = str_replace($search, $js_code . $search, $form_string);
2827
+
2828
+ // Adding field for multipage form. Look for cleantalk.php -> apbct_cookie();
2829
+ $append_string = isset($form['lastPageButton']) ? "<input type='hidden' name='ct_multipage_form' value='yes'>" : '';
2830
+ $form_string = str_replace($search, $append_string.$search, $form_string);
2831
+
2832
+ return $form_string;
2833
+ }
2834
+
2835
+ /**
2836
+ * Gravity forms anti-spam test.
2837
+ * @return boolean
2838
+ */
2839
+ function apbct_form__gravityForms__testSpam($is_spam, $form, $entry) {
2840
+
2841
+ global $apbct, $cleantalk_executed, $ct_gform_is_spam, $ct_gform_response;
2842
+
2843
+ if (
2844
+ $apbct->settings['contact_forms_test'] == 0 ||
2845
+ $is_spam ||
2846
+ $cleantalk_executed // Return unchanged result if the submission was already tested.
2847
+ )
2848
+ return $is_spam;
2849
+
2850
+ $ct_temp = array();
2851
+ foreach($entry as $key => $value){
2852
+ if(is_numeric($key))
2853
+ $ct_temp[$key]=$value;
2854
+ } unset($key, $value);
2855
+
2856
+ $ct_temp_msg_data = ct_get_fields_any($ct_temp);
2857
+ $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
2858
+ $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
2859
+ $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
2860
+ $contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
2861
+ $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
2862
+
2863
+ // Adding 'input_' to every field /Gravity Forms fix/
2864
+ $message = array_flip($message);
2865
+ foreach($message as &$value){
2866
+ $value = 'input_'.$value;
2867
+ } unset($value);
2868
+ $message = array_flip($message);
2869
+
2870
+ if($subject != '')
2871
+ $message['subject'] = $subject;
2872
+
2873
+ $checkjs = apbct_js_test('ct_checkjs', $_POST)
2874
+ ? apbct_js_test('ct_checkjs', $_POST)
2875
+ : apbct_js_test('ct_checkjs', $_COOKIE);
2876
+
2877
+ $base_call_result = apbct_base_call(
2878
+ array(
2879
+ 'message' => $message,
2880
+ 'sender_email' => $sender_email,
2881
+ 'sender_nickname' => $sender_nickname,
2882
+ 'post_info' => array('comment_type' => 'contact_form_wordpress_gravity_forms'),
2883
+ 'js_on' => $checkjs,
2884
+ )
2885
+ );
2886
+
2887
+ $ct_result = $base_call_result['ct_result'];
2888
+ if ($ct_result->allow == 0) {
2889
+ $is_spam = true;
2890
+ $ct_gform_is_spam = true;
2891
+ $ct_gform_response = $ct_result->comment;
2892
+ }
2893
+
2894
+ return $is_spam;
2895
+ }
2896
+
2897
+ function apbct_form__gravityForms__showResponse( $confirmation, $form, $entry, $ajax ){
2898
+
2899
+ global $ct_gform_is_spam, $ct_gform_response;
2900
+
2901
+ if(!empty($ct_gform_is_spam)){
2902
+ $confirmation = '<a id="gf_'.$form['id'].'" class="gform_anchor" ></a><div id="gform_confirmation_wrapper_'.$form['id'].'" class="gform_confirmation_wrapper "><div id="gform_confirmation_message_'.$form['id'].'" class="gform_confirmation_message_'.$form['id'].' gform_confirmation_message"><font style="color: red">'.$ct_gform_response.'</font></div></div>';
2903
+ }
2904
+
2905
+ return $confirmation;
2906
+ }
2907
+
2908
+ /**
2909
+ * Test S2member registration
2910
+ * @return array with errors
2911
+ */
2912
+ function ct_s2member_registration_test($post_key) {
2913
+
2914
+ global $apbct;
2915
+
2916
+ if ($apbct->settings['registrations_test'] == 0) {
2917
+ return null;
2918
+ }
2919
+
2920
+ $sender_email = isset($_POST[$post_key]['email']) ? sanitize_email($_POST[$post_key]['email']) : null;
2921
+ $sender_nickname = isset($_POST[$post_key]['username']) ? sanitize_email($_POST[$post_key]['username']) : null;
2922
+
2923
+ //Making a call
2924
+ $base_call_result = apbct_base_call(
2925
+ array(
2926
+ 'sender_email' => $sender_email,
2927
+ 'sender_nickname' => $sender_nickname,
2928
+ ),
2929
+ true
2930
+ );
2931
+ $ct_result = $base_call_result['ct_result'];
2932
+
2933
+ if ($ct_result->allow == 0) {
2934
+ ct_die_extended($ct_result->comment);
2935
+ }
2936
+
2937
+ return true;
2938
+ }
2939
+
2940
+ function apbct_form__the7_contact_form() {
2941
+
2942
+ global $cleantalk_executed;
2943
+
2944
+ if ( check_ajax_referer( 'dt_contact_form', 'nonce', false ) && isset($_POST) ) {
2945
+
2946
+ $post_info['comment_type'] = 'contact_the7_theme_contact_form';
2947
+
2948
+ $ct_temp_msg_data = ct_get_fields_any($_POST);
2949
+
2950
+ $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
2951
+ $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
2952
+ $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
2953
+ $contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
2954
+ $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
2955
+ if ($subject != '') {
2956
+ $message = array_merge(array('subject' => $subject), $message);
2957
+ }
2958
+
2959
+ // Skip submission if no data found
2960
+ if ($sender_email === ''|| !$contact_form) {
2961
+ return false;
2962
+ }
2963
+ $cleantalk_executed = true;
2964
+
2965
+ $base_call_result = apbct_base_call(
2966
+ array(
2967
+ 'message' => $message,
2968
+ 'sender_email' => $sender_email,
2969
+ 'sender_nickname' => $sender_nickname,
2970
+ 'post_info' => $post_info,
2971
+ )
2972
+ );
2973
+
2974
+ $ct_result = $base_call_result['ct_result'];
2975
+ if ($ct_result->allow == 0) {
2976
+
2977
+ $response = json_encode(
2978
+ array(
2979
+ 'success' => false ,
2980
+ 'errors' => $ct_result->comment,
2981
+ 'nonce' => wp_create_nonce( 'dt_contact_form' )
2982
+ )
2983
+ );
2984
+
2985
+ // response output
2986
+ header( "Content-Type: application/json" );
2987
+ echo $response;
2988
+
2989
+ // IMPORTANT: don't forget to "exit"
2990
+ exit;
2991
+
2992
+ }
2993
+
2994
+ }
2995
+
2996
+ }
2997
+
2998
+ function apbct_form__elementor_pro__testSpam() {
2999
+
3000
+ global $apbct, $cleantalk_executed;
3001
+
3002
+ if(
3003
+ $apbct->settings['contact_forms_test'] == 0
3004
+ || ($apbct->settings['protect_logged_in'] != 1 && is_user_logged_in()) // Skip processing for logged in users.
3005
+ || apbct_exclusions_check__url()
3006
+ ){
3007
+ return;
3008
+ }
3009
+
3010
+ $ct_temp_msg_data = ct_get_fields_any($_POST);
3011
+
3012
+ $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
3013
+ $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
3014
+ $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
3015
+ $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
3016
+ if ($subject != '') {
3017
+ $message = array_merge(array('subject' => $subject), $message);
3018
+ }
3019
+
3020
+ $post_info['comment_type'] = 'contact_form_wordpress_elementor_pro';
3021
+
3022
+ $cleantalk_executed = true;
3023
+ $base_call_result = apbct_base_call(
3024
+ array(
3025
+ 'message' => $message,
3026
+ 'sender_email' => $sender_email,
3027
+ 'sender_nickname' => $sender_nickname,
3028
+ 'post_info' => $post_info,
3029
+ )
3030
+ );
3031
+
3032
+ $ct_result = $base_call_result['ct_result'];
3033
+
3034
+ if ($ct_result->allow == 0) {
3035
+
3036
+ wp_send_json_error( array(
3037
+ 'message' => $ct_result->comment,
3038
+ 'data' => array()
3039
+ ) );
3040
+
3041
+ }
3042
+
3043
+ }
3044
+
3045
+ /**
3046
+ * General test for any contact form
3047
+ */
3048
+ function ct_contact_form_validate() {
3049
+
3050
+ global $pagenow,$cleantalk_executed ,$apbct, $ct_checkjs_frm;
3051
+
3052
+ // Exclusios common function
3053
+ if ( apbct_exclusions_check(__FUNCTION__) )
3054
+ return null;
3055
+
3056
+ if (@sizeof($_POST)==0 ||
3057
+ (isset($_POST['signup_username']) && isset($_POST['signup_email']) && isset($_POST['signup_password'])) ||
3058
+ (isset($pagenow) && $pagenow == 'wp-login.php') || // WordPress log in form
3059
+ (isset($pagenow) && $pagenow == 'wp-login.php' && isset($_GET['action']) && $_GET['action']=='lostpassword') ||
3060
+ apbct_is_in_referer( 'lostpassword' ) ||
3061
+ apbct_is_in_referer( 'lost-password' ) || //Skip lost-password form check
3062
+ (apbct_is_in_uri('/wp-admin/') && (empty($_POST['your-phone']) && empty($_POST['your-email']) && empty($_POST['your-message']))) || //Bitrix24 Contact
3063
+ apbct_is_in_uri('wp-login.php') ||
3064
+ apbct_is_in_uri('wp-comments-post.php') ||
3065
+ apbct_is_in_uri('?provider=facebook&') ||
3066
+ apbct_is_in_uri('reset-password/') || // Ticket #13668. Password reset.
3067
+ apbct_is_in_referer( '/wp-admin/') ||
3068
+ apbct_is_in_uri('/login/') ||
3069
+ apbct_is_in_uri( '/my-account/edit-account/') || // WooCommerce edit account page
3070
+ apbct_is_in_uri( '/my-account/edit-address/') || // WooCommerce edit account page
3071
+ (isset($_POST['action']) && $_POST['action'] == 'save_account_details') || // WooCommerce edit account action
3072
+ apbct_is_in_uri( '/peepsoajax/profilefieldsajax.validate_register') ||
3073
+ isset($_GET['ptype']) && $_GET['ptype']=='login' ||
3074
+ isset($_POST['ct_checkjs_register_form']) ||
3075
+ (isset($_POST['signup_username']) && isset($_POST['signup_password_confirm']) && isset($_POST['signup_submit']) ) ||
3076
+ $apbct->settings['general_contact_forms_test'] == 0 ||
3077
+ isset($_POST['bbp_topic_content']) ||
3078
+ isset($_POST['bbp_reply_content']) ||
3079
+ isset($_POST['fscf_submitted']) ||
3080
+ apbct_is_in_uri('/wc-api/') ||
3081
+ isset($_POST['log']) && isset($_POST['pwd']) && isset($_POST['wp-submit']) ||
3082
+ isset($_POST[$ct_checkjs_frm]) && $apbct->settings['contact_forms_test'] == 1 ||// Formidable forms
3083
+ isset($_POST['comment_post_ID']) || // The comment form
3084
+ isset($_GET['for']) ||
3085
+ (isset($_POST['log'], $_POST['pwd'])) || //WooCommerce Sensei login form fix
3086
+ (isset($_POST['wc_reset_password'], $_POST['_wpnonce'], $_POST['_wp_http_referer'])) || // WooCommerce recovery password form
3087
+ ((isset($_POST['woocommerce-login-nonce']) || isset($_POST['_wpnonce'])) && isset($_POST['login'], $_POST['password'], $_POST['_wp_http_referer'])) || // WooCommerce login form
3088
+ (isset($_POST['wc-api']) && strtolower($_POST['wc-api']) == 'wc_gateway_systempay') || // Woo Systempay payment plugin
3089
+ (isset($_POST['_wpcf7'], $_POST['_wpcf7_version'], $_POST['_wpcf7_locale'])) || //CF7 fix)
3090
+ (isset($_POST['hash'], $_POST['device_unique_id'], $_POST['device_name'])) ||//Mobile Assistant Connector fix
3091
+ isset($_POST['gform_submit']) || //Gravity form
3092
+ apbct_is_in_uri( 'wc-ajax=get_refreshed_fragments') ||
3093
+ (isset($_POST['ccf_form']) && intval($_POST['ccf_form']) == 1) ||
3094
+ (isset($_POST['contact_tags']) && strpos($_POST['contact_tags'], 'MBR:') !== false) ||
3095
+ (apbct_is_in_uri( 'bizuno.php') && !empty($_POST['bizPass'])) ||
3096
+ apbct_is_in_referer( 'my-dashboard/' ) || // ticket_id=7885
3097
+ isset($_POST['slm_action'], $_POST['license_key'], $_POST['secret_key'], $_POST['registered_domain']) || // ticket_id=9122
3098
+ (isset($_POST['wpforms']['submit']) && $_POST['wpforms']['submit'] == 'wpforms-submit') || // WPForms
3099
+ (isset($_POST['action']) && $_POST['action'] == 'grunion-contact-form') || // JetPack
3100
+ (isset($_POST['action']) && $_POST['action'] == 'bbp-update-user') || //BBP update user info page
3101
+ apbct_is_in_referer( '?wc-api=WC_Gateway_Transferuj' ) || //WC Gateway
3102
+ (isset($_GET['mbr'], $_GET['amp;appname'], $_GET['amp;master'])) || // ticket_id=10773
3103
+ (isset($_POST['call_function']) && $_POST['call_function'] == 'push_notification_settings') || // Skip mobile requests (push settings)
3104
+ apbct_is_in_uri('membership-login') || // Skip login form
3105
+ (isset($_GET['cookie-state-change'])) || //skip GDPR plugin
3106
+ ( apbct_get_server_variable( 'HTTP_USER_AGENT' ) == 'MailChimp' && apbct_is_in_uri( 'mc4wp-sync-api/webhook-listener') ) || // Mailchimp webhook skip
3107
+ apbct_is_in_uri('researcher-log-in') || // Skip login form
3108
+ apbct_is_in_uri('admin_aspcms/_system/AspCms_SiteSetting.asp?action=saves') || // Skip admin save callback
3109
+ apbct_is_in_uri('?profile_tab=postjobs') || // Skip post vacancies
3110
+ (isset($_POST['btn_insert_post_type_hotel']) && $_POST['btn_insert_post_type_hotel'] == 'SUBMIT HOTEL') || // Skip adding hotel
3111
+ (isset($_POST['action']) && $_POST['action'] == 'updraft_savesettings') || // Updraft save settings
3112
+ isset($_POST['quform_submit']) || //QForms multi-paged form skip
3113
+ (isset($_POST['wpum_form']) && $_POST['wpum_form'] == 'login') || //WPUM login skip
3114
+ isset($_POST['password']) || // Exception for login form. From Analysis uid=406596
3115
+ (isset($_POST['action']) && $_POST['action'] == 'wilcity_reset_password') || // Exception for reset password form. From Analysis uid=430898
3116
+ (isset($_POST['action']) && $_POST['action'] == 'wilcity_login') || // Exception for login form. From Analysis uid=430898
3117
+ (isset($_POST['qcfsubmit'])) || //Exception for submit quick forms - duplicates with qcfvalidate
3118
+ apbct_is_in_uri('tin-canny-learndash-reporting/src/h5p-xapi/process-xapi-statement.php?v=asd') || //Skip Tin Canny plugin
3119
+ ( isset( $_POST['na'], $_POST['ts'], $_POST['nhr'] ) && !apbct_is_in_uri( '?na=s' ) ) || // The Newsletter Plugin double requests fix. Ticket #14772
3120
+ (isset($_POST['spl_action']) && $_POST['spl_action'] == 'register') || //Skip interal action with empty params
3121
+ (isset($_POST['action']) && $_POST['action'] == 'bwfan_insert_abandoned_cart' && apbct_is_in_uri( 'my-account/edit-address' )) //Skip edit account
3122
+ ) {
3123
+ return null;
3124
+ }
3125
+
3126
+ //Skip woocommerce checkout
3127
+ if (apbct_is_in_uri('wc-ajax=update_order_review') || apbct_is_in_uri('wc-ajax=checkout') || !empty($_POST['woocommerce_checkout_place_order']) || apbct_is_in_uri('wc-ajax=wc_ppec_start_checkout') || apbct_is_in_referer('wc-ajax=update_order_review')) {
3128
+ return null;
3129
+ }
3130
+ // Do not execute anti-spam test for logged in users.
3131
+ if (isset($_COOKIE[LOGGED_IN_COOKIE]) && $apbct->settings['protect_logged_in'] != 1)
3132
+ return null;
3133
+
3134
+ $post_info['comment_type'] = 'feedback_general_contact_form';
3135
+
3136
+ $ct_temp_msg_data = ct_get_fields_any($_POST);
3137
+
3138
+ $sender_email = ($ct_temp_msg_data['email'] ? $ct_temp_msg_data['email'] : '');
3139
+ $sender_nickname = ($ct_temp_msg_data['nickname'] ? $ct_temp_msg_data['nickname'] : '');
3140
+ $subject = ($ct_temp_msg_data['subject'] ? $ct_temp_msg_data['subject'] : '');
3141
+ $contact_form = ($ct_temp_msg_data['contact'] ? $ct_temp_msg_data['contact'] : true);
3142
+ $message = ($ct_temp_msg_data['message'] ? $ct_temp_msg_data['message'] : array());
3143
+ if ($subject != '') {
3144
+ $message = array_merge(array('subject' => $subject), $message);
3145
+ }
3146
+
3147
+ // Skip submission if no data found
3148
+ if ($sender_email === ''|| !$contact_form) {
3149
+ return false;
3150
+ }
3151
+ $cleantalk_executed=true;
3152
+
3153
+ if(isset($_POST['TellAFriend_Link'])){
3154
+ $tmp = $_POST['TellAFriend_Link'];
3155
+ unset($_POST['TellAFriend_Link']);
3156
+ }
3157
+
3158
+ $base_call_result = apbct_base_call(
3159
+ array(
3160
+ 'message' => $message,
3161
+ 'sender_email' => $sender_email,
3162
+ 'sender_nickname' => $sender_nickname,
3163
+ 'post_info' => $post_info,
3164
+ )
3165
+ );
3166
+
3167
+ if(isset($_POST['TellAFriend_Link'])){
3168
+ $_POST['TellAFriend_Link']=$tmp;
3169
+ }
3170
+
3171
+ $ct_result = $base_call_result['ct_result'];
3172
+ if ($ct_result->allow == 0) {
3173
+
3174
+ // Recognize contact form an set it's name to $contact_form to use later
3175
+ $contact_form = null;
3176
+ foreach($_POST as $param => $value){
3177
+ if(strpos($param, 'et_pb_contactform_submit') === 0){
3178
+ $contact_form = 'contact_form_divi_theme';
3179
+ $contact_form_additional = str_replace('et_pb_contactform_submit', '', $param);
3180
+ }
3181
+ if(strpos($param, 'avia_generated_form') === 0){
3182
+ $contact_form = 'contact_form_enfold_theme';
3183
+ $contact_form_additional = str_replace('avia_generated_form', '', $param);
3184
+ }
3185
+ if(!empty($contact_form))
3186
+ break;
3187
+ }
3188
+
3189
+ $ajax_call = false;
3190
+ if ((defined( 'DOING_AJAX' ) && DOING_AJAX)
3191
+ ) {
3192
+ $ajax_call = true;
3193
+ }
3194
+ if ($ajax_call) {
3195
+ echo $ct_result->comment;
3196
+ } else {
3197
+
3198
+ global $ct_comment;
3199
+ $ct_comment = $ct_result->comment;
3200
+ if(isset($_POST['cma-action'])&&$_POST['cma-action']=='add'){
3201
+ $result=Array('success'=>0, 'thread_id'=>null,'messages'=>Array($ct_result->comment));
3202
+ header("Content-Type: application/json");
3203
+ print json_encode($result);
3204
+ die();
3205
+
3206
+ }else if(isset($_POST['TellAFriend_email'])){
3207
+ echo $ct_result->comment;
3208
+ die();
3209
+
3210
+ }else if(isset($_POST['gform_submit'])){ // Gravity forms submission
3211
+ $response = sprintf("<!DOCTYPE html><html><head><meta charset='UTF-8' /></head><body class='GF_AJAX_POSTBACK'><div id='gform_confirmation_wrapper_1' class='gform_confirmation_wrapper '><div id='gform_confirmation_message_1' class='gform_confirmation_message_1
3212
+ gform_confirmation_message'>%s</div></div></body></html>",
3213
+ $ct_result->comment
3214
+ );
3215
+ echo $response;
3216
+ die();
3217
+
3218
+ }elseif(isset($_POST['action']) && $_POST['action'] == 'ct_check_internal'){
3219
+ return $ct_result->comment;
3220
+
3221
+ }elseif(isset($_POST['vfb-submit']) && defined('VFB_VERSION')){
3222
+ wp_die("<h1>".__('Spam protection by CleanTalk', 'cleantalk')."</h1><h2>".$ct_result->comment."</h2>", '', array('response' => 403, "back_link" => true, "text_direction" => 'ltr'));
3223
+ // Caldera Contact Forms
3224
+ }elseif(isset($_POST['action']) && $_POST['action'] == 'cf_process_ajax_submit'){
3225
+ print json_encode("<h3 style='color: red;'><red>".$ct_result->comment);
3226
+ die();
3227
+ // Mailster
3228
+ }elseif(isset($_POST['_referer'], $_POST['formid'], $_POST['email'])){
3229
+ $return = array(
3230
+ 'success' => false,
3231
+ 'html' => '<p>' . $ct_result->comment . '</p>',
3232
+ );
3233
+ print json_encode($return);
3234
+ die();
3235
+ // Divi Theme Contact Form. Using $contact_form
3236
+ }elseif(!empty($contact_form) && $contact_form == 'contact_form_divi_theme'){
3237
+ echo "<div id='et_pb_contact_form{$contact_form_additional}'><h1>Your request looks like spam.</h1><div><p>{$ct_result->comment}</p></div></div>";
3238
+ die();
3239
+ // Enfold Theme Contact Form. Using $contact_form
3240
+ }elseif(!empty($contact_form) && $contact_form == 'contact_form_enfold_theme'){
3241
+ echo "<div id='ajaxresponse_1' class='ajaxresponse ajaxresponse_1' style='display: block;'><div id='ajaxresponse_1' class='ajaxresponse ajaxresponse_1'><h3 class='avia-form-success'>Antispam by CleanTalk: ".$ct_result->comment."</h3><a href='.'><-Back</a></div></div>";
3242
+ die();
3243
+ }else{
3244
+ ct_die(null, null);
3245
+ }
3246
+ }
3247
+ exit;
3248
+ }
3249
+
3250
+ return null;
3251
+ }
3252
+
3253
+ /**
3254
+ * General test for any post data
3255
+ */
3256
+ function ct_contact_form_validate_postdata() {
3257
+
3258
+ global $apbct, $pagenow,$cleantalk_executed;
3259
+
3260
+ // Exclusios common function
3261
+ if ( apbct_exclusions_check(__FUNCTION__) )
3262
+ return null;
3263
+
3264
+ if (@sizeof($_POST)==0 ||
3265
+ (isset($_POST['signup_username']) && isset($_POST['signup_email']) && isset($_POST['signup_password'])) ||
3266
+ (isset($pagenow) && $pagenow == 'wp-login.php') || // WordPress log in form
3267
+ (isset($pagenow) && $pagenow == 'wp-login.php' && isset($_GET['action']) && $_GET['action']=='lostpassword') ||
3268
+ apbct_is_in_uri('/checkout/') ||
3269
+ /* WooCommerce Service Requests - skip them */
3270
+ isset($_GET['wc-ajax']) && (
3271
+ $_GET['wc-ajax']=='checkout' ||
3272
+ $_GET['wc-ajax']=='get_refreshed_fragments' ||
3273
+ $_GET['wc-ajax']=='apply_coupon' ||
3274
+ $_GET['wc-ajax']=='remove_coupon' ||
3275
+ $_GET['wc-ajax']=='update_shipping_method' ||
3276
+ $_GET['wc-ajax']=='get_cart_totals' ||
3277
+ $_GET['wc-ajax']=='update_order_review' ||
3278
+ $_GET['wc-ajax']=='add_to_cart' ||
3279
+ $_GET['wc-ajax']=='remove_from_cart' ||
3280
+ $_GET['wc-ajax']=='get_variation' ||
3281
+ $_GET['wc-ajax']=='get_customer_location'
3282
+ ) ||
3283
+ /* END: WooCommerce Service Requests */
3284
+ apbct_is_in_uri('/wp-admin/') ||
3285
+ apbct_is_in_uri('wp-login.php') ||
3286
+ apbct_is_in_uri('wp-comments-post.php') ||
3287
+ apbct_is_in_referer('/wp-admin/') ||
3288
+ apbct_is_in_uri('/login/') ||
3289
+ apbct_is_in_uri('?provider=facebook&') ||
3290
+ isset($_GET['ptype']) && $_GET['ptype']=='login' ||
3291
+ isset($_POST['ct_checkjs_register_form']) ||
3292
+ (isset($_POST['signup_username']) && isset($_POST['signup_password_confirm']) && isset($_POST['signup_submit']) ) ||
3293
+ $apbct->settings['general_contact_forms_test']==0 ||
3294
+ isset($_POST['bbp_topic_content']) ||
3295
+ isset($_POST['bbp_reply_content']) ||
3296
+ isset($_POST['fscf_submitted']) ||
3297
+ isset($_POST['log']) && isset($_POST['pwd']) && isset($_POST['wp-submit'])||
3298
+ apbct_is_in_uri('/wc-api/') ||
3299
+ (isset($_POST['wc_reset_password'], $_POST['_wpnonce'], $_POST['_wp_http_referer'])) || //WooCommerce recovery password form
3300
+ (isset($_POST['woocommerce-login-nonce'], $_POST['login'], $_POST['password'], $_POST['_wp_http_referer'])) || //WooCommerce login form
3301
+ (isset($_POST['provider'], $_POST['authcode']) && $_POST['provider'] == 'Two_Factor_Totp') || //TwoFactor authorization
3302
+ (isset($_GET['wc-ajax']) && $_GET['wc-ajax'] == 'sa_wc_buy_now_get_ajax_buy_now_button') || //BuyNow add to cart
3303
+ apbct_is_in_uri('/wp-json/wpstatistics/v1/hit') || //WPStatistics
3304
+ (isset($_POST['ihcaction']) && $_POST['ihcaction'] == 'login') || //Skip login form
3305
+ (isset($_POST['action']) && $_POST['action'] == 'infinite_scroll') || //Scroll
3306
+ isset($_POST['gform_submit']) || //Skip gravity checking because of direct integration
3307
+ (isset($_POST['lrm_action']) && $_POST['lrm_action'] == 'login') //Skip login form
3308
+ ) {
3309
+ return null;
3310
+ }
3311
+
3312
+ $message = ct_get_fields_any_postdata($_POST);
3313
+
3314
+ // ???
3315
+ if(strlen(json_encode($message))<10)
3316
+ return null;
3317
+
3318
+ // Skip if request contains params
3319
+ $skip_params = array(
3320
+ 'ipn_track_id', // PayPal IPN #
3321
+ 'txn_type', // PayPal transaction type
3322
+ 'payment_status', // PayPal payment status
3323
+ );
3324
+ foreach($skip_params as $key=>$value){
3325
+ if(@array_key_exists($value,$_GET)||@array_key_exists($value,$_POST))
3326
+ return null;
3327
+ }
3328
+
3329
+ $base_call_result = apbct_base_call(
3330
+ array(
3331
+ 'message' => $message,
3332
+ 'post_info' => array('comment_type' => 'feedback_general_postdata'),
3333
+ )
3334
+ );
3335
+
3336
+ $cleantalk_executed=true;
3337
+
3338
+ $ct_result = $base_call_result['ct_result'];
3339
+
3340
+ if ($ct_result->allow == 0) {
3341
+
3342
+ if (!(defined( 'DOING_AJAX' ) && DOING_AJAX)) {
3343
+ global $ct_comment;
3344
+ $ct_comment = $ct_result->comment;
3345
+ if(isset($_POST['cma-action'])&&$_POST['cma-action']=='add')
3346
+ {
3347
+ $result=Array('success'=>0, 'thread_id'=>null,'messages'=>Array($ct_result->comment));
3348
+ header("Content-Type: application/json");
3349
+ print json_encode($result);
3350
+ die();
3351
+ }
3352
+ else
3353
+ {
3354
+ ct_die(null, null);
3355
+ }
3356
+ } else {
3357
+ echo $ct_result->comment;
3358
+ }
3359
+ exit;
3360
+ }
3361
+
3362
+ return null;
3363
+ }
3364
+
3365
+
3366
+ /**
3367
+ * Inner function - Finds and returns pattern in string
3368
+ * @return null|bool
3369
+ */
3370
+ function ct_get_data_from_submit($value = null, $field_name = null) {
3371
+ if (!$value || !$field_name || !is_string($value)) {
3372
+ return false;
3373
+ }
3374
+ if (preg_match("/[a-z0-9_\-]*" . $field_name. "[a-z0-9_\-]*$/", $value)) {
3375
+ return true;
3376
+ }
3377
+ }
3378
+
3379
+ /**
3380
+ * Sends error notice to admin
3381
+ * @return null
3382
+ */
3383
+ function ct_send_error_notice ($comment = '') {
3384
+ global $ct_admin_notoice_period, $apbct;
3385
+
3386
+ $timelabel_reg = intval( get_option('cleantalk_timelabel_reg') );
3387
+ if(time() - $ct_admin_notoice_period > $timelabel_reg){
3388
+ update_option('cleantalk_timelabel_reg', time());
3389
+
3390
+ $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
3391
+ $message = __('Attention, please!', 'cleantalk') . "\r\n\r\n";
3392
+ $message .= sprintf(__('"%s" plugin error on your site "%s":', 'cleantalk'), $apbct->plugin_name, $blogname) . "\r\n\r\n";
3393
+ $message .= preg_replace('/^(.*?)<a.*?"(.*?)".*?>(.*?)<.a>(.*)$/', '$1. $3: $2?user_token='. $apbct->user_token .' $4', $comment) . "\r\n\r\n";
3394
+ @wp_mail(ct_get_admin_email(), sprintf(__('[%s] "%s" error!', 'cleantalk'), $apbct->plugin_name, $blogname), $message);
3395
+ }
3396
+
3397
+ return null;
3398
+ }
3399
+
3400
+ function ct_print_form($arr, $k)
3401
+ {
3402
+ foreach($arr as $key => $value){
3403
+ if(!is_array($value)){
3404
+ if($k == ''){
3405
+ print '<textarea name="' . $key . '" style="display:none;">' . htmlspecialchars($value) . '</textarea>';
3406
+ }else{
3407
+ print '<textarea name="' . $k . '[' . $key . ']" style="display:none;">' . htmlspecialchars($value) . '</textarea>';
3408
+ }
3409
+ }else{
3410
+ if($k == ''){
3411
+ ct_print_form($value, $key);
3412
+ }else{
3413
+ ct_print_form($value, $k . '[' . $key . ']');
3414
+ }
3415
+ }
3416
+ }
3417
+ }
3418
+
3419
+ /**
3420
+ * Attaches public scripts and styles.
3421
+ */
3422
+ function ct_enqueue_scripts_public($hook){
3423
+
3424
+ global $current_user, $apbct;
3425
+
3426
+ if (apbct_exclusions_check__url()) {
3427
+ return;
3428
+ }
3429
+ if($apbct->settings['registrations_test'] || $apbct->settings['comments_test'] || $apbct->settings['contact_forms_test'] || $apbct->settings['general_contact_forms_test'] || $apbct->settings['wc_checkout_test'] || $apbct->settings['check_external'] || $apbct->settings['check_internal'] || $apbct->settings['bp_private_messages'] || $apbct->settings['general_postdata_test']){
3430
+
3431
+ // Differnt JS params
3432
+ wp_enqueue_script('ct_public', APBCT_URL_PATH.'/js/apbct-public.min.js', array('jquery'), APBCT_VERSION, false /*in header*/);
3433
+
3434
+ wp_localize_script('ct_public', 'ctPublic', array(
3435
+ '_ajax_nonce' => wp_create_nonce('ct_secret_stuff'),
3436
+ '_ajax_url' => admin_url('admin-ajax.php'),
3437
+ ));
3438
+
3439
+ // GDPR script
3440
+ if($apbct->settings['gdpr_enabled']){
3441
+
3442
+ wp_enqueue_script('ct_public_gdpr', APBCT_URL_PATH.'/js/apbct-public--gdpr.min.js', array('jquery', 'ct_public'), APBCT_VERSION, false /*in header*/);
3443
+
3444
+ wp_localize_script('ct_public_gdpr', 'ctPublicGDPR', array(
3445
+ 'gdpr_forms' => array(),
3446
+ 'gdpr_text' => $apbct->settings['gdpr_text'] ? $apbct->settings['gdpr_text'] : __('By using this form you agree with the storage and processing of your data by using the Privacy Policy on this website.', 'cleantalk'),
3447
+ ));
3448
+ }
3449
+
3450
+ }
3451
+
3452
+ if(!defined('CLEANTALK_AJAX_USE_FOOTER_HEADER') || (defined('CLEANTALK_AJAX_USE_FOOTER_HEADER') && CLEANTALK_AJAX_USE_FOOTER_HEADER)){
3453
+ if($apbct->settings['use_ajax'] && ! apbct_is_in_uri('.xml') && ! apbct_is_in_uri('.xsl')){
3454
+ if( ! apbct_is_in_uri('jm-ajax') ){
3455
+
3456
+ // Use AJAX for JavaScript check
3457
+ if($apbct->settings['use_ajax']){
3458
+
3459
+ wp_enqueue_script('ct_nocache', plugins_url('/cleantalk-spam-protect/js/cleantalk_nocache.min.js'), array(), APBCT_VERSION, false /*in header*/);
3460
+
3461
+ wp_localize_script('ct_nocache', 'ctNocache', array(
3462
+ 'ajaxurl' => admin_url('admin-ajax.php'),
3463
+ 'info_flag' => $apbct->settings['collect_details'] && $apbct->settings['set_cookies'] ? true : false,
3464
+ 'set_cookies_flag' => $apbct->settings['set_cookies'] ? false : true,
3465
+ 'blog_home' => get_home_url().'/',
3466
+ ));
3467
+ }
3468
+
3469
+ // External forms check
3470
+ if($apbct->settings['check_external'])
3471
+ wp_enqueue_script('ct_external', plugins_url('/cleantalk-spam-protect/js/cleantalk_external.min.js'), array('jquery'), APBCT_VERSION, false /*in header*/);
3472
+
3473
+ // Internal forms check
3474
+ if($apbct->settings['check_internal'])
3475
+ wp_enqueue_script('ct_internal', plugins_url('/cleantalk-spam-protect/js/cleantalk_internal.min.js'), array('jquery'), APBCT_VERSION, false /*in header*/);
3476
+
3477
+ }
3478
+ }
3479
+ }
3480
+
3481
+ // Show controls for commentaies
3482
+ if(in_array("administrator", $current_user->roles)){
3483
+
3484
+ if($apbct->settings['show_check_links']){
3485
+
3486
+ $ajax_nonce = wp_create_nonce( "ct_secret_nonce" );
3487
+
3488
+ wp_enqueue_style ('ct_public_admin_css', plugins_url('/cleantalk-spam-protect/css/cleantalk-public-admin.min.css'), array(), APBCT_VERSION, 'all');
3489
+ wp_enqueue_script('ct_public_admin_js', plugins_url('/cleantalk-spam-protect/js/cleantalk-public-admin.min.js'), array('jquery'), APBCT_VERSION, false /*in header*/);
3490
+
3491
+ wp_localize_script('ct_public_admin_js', 'ctPublicAdmin', array(
3492
+ 'ct_ajax_nonce' => $ajax_nonce,
3493
+ 'ajaxurl' => admin_url('admin-ajax.php'),
3494
+ 'ct_feedback_error' => __('Error occured while sending feedback.', 'cleantalk'),
3495
+ 'ct_feedback_no_hash' => __('Feedback wasn\'t sent. There is no associated request.', 'cleantalk'),
3496
+ 'ct_feedback_msg' => sprintf(__("Feedback has been sent to %sCleanTalk Dashboard%s.", 'cleantalk'), $apbct->user_token ? "<a target='_blank' href=https://cleantalk.org/my/show_requests?user_token={$apbct->user_token}&cp_mode=antispam>" : '', $apbct->user_token ? "</a>" : ''),
3497
+ ));
3498
+
3499
+ }
3500
+ }
3501
+
3502
+ // Debug
3503
+ if($apbct->settings['debug_ajax']){
3504
+ wp_enqueue_script('ct_debug_js', plugins_url('/cleantalk-spam-protect/js/cleantalk-debug-ajax.min.js'), array('jquery'), APBCT_VERSION, false /*in header*/);
3505
+
3506
+ wp_localize_script('ct_debug_js', 'apbctDebug', array(
3507
+ 'reload' => false,
3508
+ 'reload_time' => 10000,
3509
+ ));
3510
+ }
3511
+ }
3512
+
3513
+ /**
3514
+ * Reassign callbackback function for the bootom of comment output.
3515
+ */
3516
+ function ct_wp_list_comments_args($options){
3517
+
3518
+ global $current_user, $apbct;
3519
+
3520
+ if(in_array("administrator", $current_user->roles))
3521
+ if($apbct->settings['show_check_links'])
3522
+ $options['end-callback'] = 'ct_comments_output';
3523
+
3524
+ return $options;
3525
+ }
3526
+
3527
+ /**
3528
+ * Callback function for the bootom comment output.
3529
+ */
3530
+ function ct_comments_output($curr_comment, $param2, $wp_list_comments_args){
3531
+
3532
+ $email = $curr_comment->comment_author_email;
3533
+ $ip = $curr_comment->comment_author_IP;
3534
+ $id = $curr_comment->comment_ID;
3535
+
3536
+ $settings_link = '/wp-admin/'.(is_network_admin() ? "settings.php?page=cleantalk" : "options-general.php?page=cleantalk");
3537
+
3538
+ echo "<div class='ct_comment_info'><div class ='ct_comment_titles'>";
3539
+ echo "<p class='ct_comment_info_title'>".__('Sender info', 'cleantalk')."</p>";
3540
+
3541
+ echo "<p class='ct_comment_logo_title'>
3542
+ ".__('by', 'cleantalk')
3543
+ ." <a href='{$settings_link}' target='_blank'><img class='ct_comment_logo_img' src='".plugins_url()."/cleantalk-spam-protect/inc/images/logo_color.png'></a>"
3544
+ ." <a href='{$settings_link}' target='_blank'>CleanTalk</a>"
3545
+ ."</p></div>";
3546
+ // Outputs email if exists
3547
+ if($email)
3548
+ echo "<a href='https://cleantalk.org/blacklists/$email' target='_blank' title='https://cleantalk.org/blacklists/$email'>"
3549
+ ."$email"
3550
+ ."&nbsp;<img src='".plugins_url()."/cleantalk-spam-protect/inc/images/new_window.gif' border='0' style='float:none; box-shadow: transparent 0 0 0 !important;'/>"
3551
+ ."</a>";
3552
+ else
3553
+ echo __('No email', 'cleantalk');
3554
+ echo "&nbsp;|&nbsp;";
3555
+
3556
+ // Outputs IP if exists
3557
+ if($ip)
3558
+ echo "<a href='https://cleantalk.org/blacklists/$ip' target='_blank' title='https://cleantalk.org/blacklists/$ip'>"
3559
+ ."$ip"
3560
+ ."&nbsp;<img src='".plugins_url()."/cleantalk-spam-protect/inc/images/new_window.gif' border='0' style='float:none; box-shadow: transparent 0 0 0 !important;'/>"
3561
+ ."</a>";
3562
+ else
3563
+ echo __('No IP', 'cleantalk');
3564
+ echo '&nbsp;|&nbsp;';
3565
+
3566
+ echo "<span commentid='$id' class='ct_this_is ct_this_is_spam' href='#'>".__('Mark as spam', 'cleantalk')."</span>";
3567
+ echo "<span commentid='$id' class='ct_this_is ct_this_is_not_spam ct_hidden' href='#'>".__('Unspam', 'cleantalk')."</span>";
3568
+ echo "<p class='ct_feedback_wrap'>";
3569
+ echo "<span class='ct_feedback_result ct_feedback_result_spam'>".__('Marked as spam.', 'cleantalk')."</span>";
3570
+ echo "<span class='ct_feedback_result ct_feedback_result_not_spam'>".__('Marked as not spam.', 'cleantalk')."</span>";
3571
+ echo "&nbsp;<span class='ct_feedback_msg'><span>";
3572
+ echo "</p>";
3573
+
3574
+ echo "</div>";
3575
+
3576
+ // Ending comment output
3577
+ echo "</{$wp_list_comments_args['style']}>";
3578
+ }
3579
+
3580
+ /**
3581
+ * Callback function for the bootom comment output.
3582
+ *
3583
+ * attrs = array()
3584
+ */
3585
+ function apbct_shrotcode_handler__GDPR_public_notice__form( $attrs ){
3586
+
3587
+ $out = '';
3588
+
3589
+ if(isset($attrs['id']))
3590
+ $out .= 'ctPublicGDPR.gdpr_forms.push("'.$attrs['id'].'");';
3591
+
3592
+ if(isset($attrs['text']))
3593
+ $out .= 'ctPublicGDPR.gdpr_text = "'.$attrs['text'].'";';
3594
+
3595
+ $out = '<script>'.$out.'</script>';
3596
+ return $out;
3597
+ }
3598
+
3599
+ /**
3600
+ * Filters the 'status' array before register the user
3601
+ * using only by WICITY theme
3602
+ *
3603
+ * @param $success array array( 'status' => 'success' )
3604
+ * @param $data array ['username'] ['password'] ['email']
3605
+ * @return array array( 'status' => 'error' ) or array( 'status' => 'success' ) by default
3606
+ */
3607
+ function apbct_wilcity_reg_validation( $success, $data ) {
3608
+ $check = ct_test_registration( $data['username'], $data['email'], '' );
3609
+ if( $check['allow'] == 0 ) {
3610
+ return array( 'status' => 'error' );
3611
+ }
3612
+ return $success;
3613
+ }
inc/cleantalk-settings.php CHANGED
@@ -1,1496 +1,1496 @@
1
- <?php
2
-
3
- /**
4
- * Admin action 'admin_menu' - Add the admin options page
5
- */
6
- function apbct_settings_add_page() {
7
-
8
- global $apbct, $pagenow;
9
-
10
- $parent_slug = is_network_admin() ? 'settings.php' : 'options-general.php';
11
- $callback = is_network_admin() ? 'apbct_settings__display__network' : 'apbct_settings__display';
12
-
13
- // Adding settings page
14
- add_submenu_page(
15
- $parent_slug,
16
- $apbct->plugin_name.' '.__('settings'),
17
- $apbct->plugin_name,
18
- 'manage_options',
19
- 'cleantalk',
20
- $callback
21
- );
22
-
23
- if(!in_array($pagenow, array('options.php', 'options-general.php', 'settings.php', 'admin.php')))
24
- return;
25
-
26
- register_setting('cleantalk_settings', 'cleantalk_settings', 'apbct_settings__validate');
27
-
28
- $fields = array();
29
- $fields = apbct_settings__set_fileds($fields);
30
- $fields = APBCT_WPMS && is_main_site() ? apbct_settings__set_fileds__network($fields) : $fields;
31
- apbct_settings__add_groups_and_fields($fields);
32
-
33
- }
34
-
35
- function apbct_settings__set_fileds( $fields ){
36
- global $apbct;
37
-
38
- $fields = array(
39
-
40
- 'main' => array(
41
- 'title' => '',
42
- 'default_params' => array(),
43
- 'description' => '',
44
- 'html_before' => '',
45
- 'html_after' => '',
46
- 'fields' => array(
47
- 'action_buttons' => array(
48
- 'callback' => 'apbct_settings__field__action_buttons',
49
- ),
50
- 'connection_reports' => array(
51
- 'callback' => 'apbct_settings__field__statistics',
52
- ),
53
- 'api_key' => array(
54
- 'display' => !$apbct->white_label || is_main_site(),
55
- 'callback' => 'apbct_settings__field__apikey',
56
- ),
57
- ),
58
- ),
59
-
60
- 'state' => array(
61
- 'title' => '',
62
- 'default_params' => array(),
63
- 'description' => '',
64
- 'html_before' => '<hr style="width: 100%;">',
65
- 'html_after' => '',
66
- 'fields' => array(
67
- 'state' => array(
68
- 'callback' => 'apbct_settings__field__state',
69
- ),
70
- ),
71
- ),
72
-
73
- 'debug' => array(
74
- 'title' => '',
75
- 'default_params' => array(),
76
- 'description' => '',
77
- 'html_before' => '',
78
- 'html_after' => '',
79
- 'fields' => array(
80
- 'state' => array(
81
- 'callback' => 'apbct_settings__field__debug',
82
- ),
83
- ),
84
- ),
85
-
86
- // Different
87
- 'different' => array(
88
- 'title' => '',
89
- 'default_params' => array(),
90
- 'description' => '',
91
- 'html_before' => '<hr>',
92
- 'html_after' => '',
93
- 'fields' => array(
94
- 'spam_firewall' => array(
95
- 'type' => 'checkbox',
96
- 'title' => __('SpamFireWall', 'cleantalk'),
97
- 'description' => __("This option allows to filter spam bots before they access website. Also reduces CPU usage on hosting server and accelerates pages load time.", 'cleantalk'),
98
- ),
99
- ),
100
- ),
101
-
102
- // Forms protection
103
- 'forms_protection' => array(
104
- 'title' => __('Forms to protect', 'cleantalk'),
105
- 'default_params' => array(),
106
- 'description' => '',
107
- 'html_before' => '<hr><br>'
108
- .'<span id="ct_adv_showhide">'
109
- .'<a href="#" class="apbct_color--gray" onclick="event.preventDefault(); apbct_show_hide_elem(\'apbct_settings__davanced_settings\');">'
110
- .__('Advanced settings', 'cleantalk')
111
- .'</a>'
112
- .'</span>'
113
- .'<div id="apbct_settings__davanced_settings" style="display: none;">',
114
- 'html_after' => '',
115
- 'fields' => array(
116
- 'registrations_test' => array(
117
- 'title' => __('Registration Forms', 'cleantalk'),
118
- 'description' => __('WordPress, BuddyPress, bbPress, S2Member, WooCommerce.', 'cleantalk'),
119
- ),
120
- 'comments_test' => array(
121
- 'title' => __('Comments form', 'cleantalk'),
122
- 'description' => __('WordPress, JetPack, WooCommerce.', 'cleantalk'),
123
- ),
124
- 'contact_forms_test' => array(
125
- 'title' => __('Contact forms', 'cleantalk'),
126
- 'description' => __('Contact Form 7, Formidable forms, JetPack, Fast Secure Contact Form, WordPress Landing Pages, Gravity Forms.', 'cleantalk'),
127
- ),
128
- 'general_contact_forms_test' => array(
129
- 'title' => __('Custom contact forms', 'cleantalk'),
130
- 'description' => __('Anti spam test for any WordPress themes or contacts forms.', 'cleantalk'),
131
- ),
132
- 'search_test' => array(
133
- 'title' => __('Test default Wordpress search form for spam', 'cleantalk'),
134
- 'description' => __('Spam protection for Search form.', 'cleantalk')
135
- . (!$apbct->white_label || is_main_site()
136
- ? sprintf(__('Read more about %sspam protection for Search form%s on our blog.', 'cleantalk'),
137
- '<a href="https://blog.cleantalk.org/how-to-protect-website-search-from-spambots/" target="_blank">',
138
- '</a>'
139
- )
140
- : ''
141
- )
142
- ),
143
- 'check_external' => array(
144
- 'title' => __('Protect external forms', 'cleantalk'),
145
- 'description' => __('Turn this option on to protect forms on your WordPress that send data to third-part servers (like MailChimp).', 'cleantalk'),
146
- 'childrens' => array('check_external__capture_buffer'),
147
- ),
148
- 'check_external__capture_buffer' => array(
149
- 'title' => __('Capture buffer', 'cleantalk'),
150
- 'description' => __('This setting gives you more sophisticated and strengthened protection for external forms. But it could break plugins which use a buffer like Ninja Forms.', 'cleantalk'),
151
- 'class' => 'apbct_settings-field_wrapper--sub',
152
- 'parent' => 'check_external',
153
- ),
154
- 'check_internal' => array(
155
- 'title' => __('Protect internal forms', 'cleantalk'),
156
- 'description' => __('This option will enable protection for custom (hand-made) AJAX forms with PHP scripts handlers on your WordPress.', 'cleantalk'),
157
- ),
158
- ),
159
- ),
160
-
161
- // Comments and Messages
162
- 'wc' => array(
163
- 'title' => __('WooCommerce', 'cleantalk'),
164
- 'fields' => array(
165
- 'wc_checkout_test' => array(
166
- 'title' => __('WooCommerce checkout form', 'cleantalk'),
167
- 'description' => __('Anti spam test for WooCommerce checkout form.', 'cleantalk'),
168
- 'childrens' => array('wc_register_from_order')
169
- ),
170
- 'wc_register_from_order' => array(
171
- 'title' => __('Spam test for registration during checkout', 'cleantalk'),
172
- 'description' => __('Enable anti spam test for registration process which during woocommerce\'s checkout.', 'cleantalk'),
173
- 'parent' => 'wc_checkout_test',
174
- 'class' => 'apbct_settings-field_wrapper--sub',
175
- 'reverse_trigger' => true
176
- ),
177
- ),
178
- ),
179
-
180
- // Comments and Messages
181
- 'comments_and_messages' => array(
182
- 'title' => __('Comments and Messages', 'cleantalk'),
183
- 'fields' => array(
184
- 'disable_comments__all' => array(
185
- 'title' => __( 'Disable all comments', 'cleantalk' ),
186
- 'description' => __( 'Disabling comments for all types of content.', 'cleantalk' ),
187
- 'childrens' => array(
188
- 'disable_comments__posts',
189
- 'disable_comments__pages',
190
- 'disable_comments__media',
191
- ),
192
- 'options' => array(
193
- array( 'val' => 1, 'label' => __( 'On' ), 'childrens_enable' => 0, ),
194
- array( 'val' => 0, 'label' => __( 'Off' ), 'childrens_enable' => 1, ),
195
- ),
196
- ),
197
- 'disable_comments__posts' => array(
198
- 'title' => __( 'Disable comments for all posts', 'cleantalk' ),
199
- 'class' => 'apbct_settings-field_wrapper--sub',
200
- 'parent' => 'disable_comments__all',
201
- 'reverse_trigger' => true,
202
- ),
203
- 'disable_comments__pages' => array(
204
- 'title' => __( 'Disable comments for all pages', 'cleantalk' ),
205
- 'class' => 'apbct_settings-field_wrapper--sub',
206
- 'parent' => 'disable_comments__all',
207
- 'reverse_trigger' => true,
208
- ),
209
- 'disable_comments__media' => array(
210
- 'title' => __( 'Disable comments for all media', 'cleantalk' ),
211
- 'class' => 'apbct_settings-field_wrapper--sub',
212
- 'parent' => 'disable_comments__all',
213
- 'reverse_trigger' => true,
214
- ),
215
- 'bp_private_messages' => array(
216
- 'title' => __('BuddyPress Private Messages', 'cleantalk'),
217
- 'description' => __('Check buddyPress private messages.', 'cleantalk'),
218
- ),
219
- 'check_comments_number' => array(
220
- 'title' => __("Don't check trusted user's comments", 'cleantalk'),
221
- 'description' => sprintf(__("Don't check comments for users with above %d comments.", 'cleantalk'), defined('CLEANTALK_CHECK_COMMENTS_NUMBER') ? CLEANTALK_CHECK_COMMENTS_NUMBER : 3),
222
- ),
223
- 'remove_old_spam' => array(
224
- 'title' => __('Automatically delete spam comments', 'cleantalk'),
225
- 'description' => sprintf(__('Delete spam comments older than %d days.', 'cleantalk'), $apbct->data['spam_store_days']),
226
- ),
227
- 'remove_comments_links' => array(
228
- 'title' => __('Remove links from approved comments', 'cleantalk'),
229
- 'description' => __('Remove links from approved comments. Replace it with "[Link deleted]"', 'cleantalk'),
230
- ),
231
- 'show_check_links' => array(
232
- 'title' => __('Show links to check Emails, IPs for spam.', 'cleantalk'),
233
- 'description' => __('Shows little icon near IP addresses and Emails allowing you to check it via CleanTalk\'s database. Also allowing you to manage comments from the public post\'s page.', 'cleantalk'),
234
- 'display' => !$apbct->white_label,
235
- ),
236
- ),
237
- ),
238
-
239
- // Data Processing
240
- 'data_processing' => array(
241
- 'title' => __('Data Processing', 'cleantalk'),
242
- 'fields' => array(
243
- 'protect_logged_in' => array(
244
- 'title' => __("Protect logged in Users", 'cleantalk'),
245
- 'description' => __('Turn this option on to check for spam any submissions (comments, contact forms and etc.) from registered Users.', 'cleantalk'),
246
- ),
247
- 'use_ajax' => array(
248
- 'title' => __('Use AJAX for JavaScript check', 'cleantalk'),
249
- 'description' => __('Options helps protect WordPress against spam with any caching plugins. Turn this option on to avoid issues with caching plugins.', 'cleantalk'),
250
- ),
251
- 'use_static_js_key' => array(
252
- 'title' => __('Use static keys for JS check.', 'cleantalk'),
253
- 'description' => __('Could help if you have cache for AJAX requests and you are dealing with false positives. Slightly decreases protection quality. Auto - Static key will be used if caching plugin is spotted.', 'cleantalk'),
254
- 'options' => array(
255
- array('val' => 1, 'label' => __('On'), ),
256
- array('val' => 0, 'label' => __('Off'), ),
257
- array('val' => -1, 'label' => __('Auto'),),
258
- ),
259
- ),
260
- 'general_postdata_test' => array(
261
- 'title' => __('Check all post data', 'cleantalk'),
262
- 'description' => __('Check all POST submissions from website visitors. Enable this option if you have spam misses on website.', 'cleantalk')
263
- .(!$apbct->white_label
264
- ? __(' Or you don`t have records about missed spam here:', 'cleantalk') . '&nbsp;' . '<a href="https://cleantalk.org/my/?user_token='.$apbct->user_token.'&utm_source=wp-backend&utm_medium=admin-bar&cp_mode=antispam" target="_blank">' . __('CleanTalk dashboard', 'cleantalk') . '</a>.'
265
- : ''
266
- )
267
- .'<br />' . __('СAUTION! Option can catch POST requests in WordPress backend', 'cleantalk'),
268
- ),
269
- 'set_cookies' => array(
270
- 'title' => __("Set cookies", 'cleantalk'),
271
- 'description' => __('Turn this option off to deny plugin generates any cookies on website front-end. This option is helpful if you use Varnish. But most of contact forms will not be protected if the option is turned off! <b>Warning: We strongly recommend you to enable this otherwise it could cause false positives spam detection.</b>', 'cleantalk'),
272
- 'childrens' => array('set_cookies__sessions'),
273
- ),
274
- 'set_cookies__sessions' => array(
275
- 'title' => __('Use alternative mechanism for cookies', 'cleantalk'),
276
- 'description' => __('Doesn\'t use cookie or PHP sessions. Collect data for all types of bots.', 'cleantalk'),
277
- 'parent' => 'set_cookies',
278
- 'class' => 'apbct_settings-field_wrapper--sub',
279
- ),
280
- 'ssl_on' => array(
281
- 'title' => __("Use SSL", 'cleantalk'),
282
- 'description' => __('Turn this option on to use encrypted (SSL) connection with servers.', 'cleantalk'),
283
- ),
284
- 'use_buitin_http_api' => array(
285
- 'title' => __("Use Wordpress HTTP API", 'cleantalk'),
286
- 'description' => __('Alternative way to connect the Cloud. Use this if you have connection problems.', 'cleantalk'),
287
- ),
288
- ),
289
- ),
290
-
291
- // Exclusions
292
- 'exclusions' => array(
293
- 'title' => __('Exclusions', 'cleantalk'),
294
- 'fields' => array(
295
- 'exclusions__urls' => array(
296
- 'type' => 'text',
297
- 'title' => __('URL exclusions', 'cleantalk'),
298
- 'description' => __('You could type here URL you want to exclude. Use comma as separator.', 'cleantalk'),
299
- ),
300
- 'exclusions__urls__use_regexp' => array(
301
- 'type' => 'checkbox',
302
- 'title' => __('Use Regular Expression in URL Exclusions', 'cleantalk'),
303
- ),
304
- 'exclusions__fields' => array(
305
- 'type' => 'text',
306
- 'title' => __('Field name exclusions', 'cleantalk'),
307
- 'description' => __('You could type here fields names you want to exclude. Use comma as separator.', 'cleantalk'),
308
- ),
309
- 'exclusions__fields__use_regexp' => array(
310
- 'type' => 'checkbox',
311
- 'title' => __('Use Regular Expression in Field Exclusions', 'cleantalk'),
312
- ),
313
- 'exclusions__roles' => array(
314
- 'type' => 'select',
315
- 'multiple' => true,
316
- 'options_callback' => 'apbct_get_all_roles',
317
- 'options_callback_params' => array(true),
318
- 'description' => __('Roles which bypass spam test. Hold CTRL to select multiple roles.', 'cleantalk'),
319
- ),
320
- ),
321
- ),
322
-
323
- // Admin bar
324
- 'admin_bar' => array(
325
- 'title' => __('Admin bar', 'cleantalk'),
326
- 'default_params' => array(),
327
- 'description' => '',
328
- 'html_before' => '',
329
- 'html_after' => '',
330
- 'fields' => array(
331
- 'show_adminbar' => array(
332
- 'title' => __('Show statistics in admin bar', 'cleantalk'),
333
- 'description' => __('Show/hide icon in top level menu in WordPress backend. The number of submissions is being counted for past 24 hours.', 'cleantalk'),
334
- 'childrens' => array('all_time_counter','daily_counter','sfw_counter'),
335
- ),
336
- 'all_time_counter' => array(
337
- 'title' => __('Show All-time counter', 'cleantalk'),
338
- 'description' => __('Display all-time requests counter in the admin bar. Counter displays number of requests since plugin installation.', 'cleantalk'),
339
- 'parent' => 'show_adminbar',
340
- 'class' => 'apbct_settings-field_wrapper--sub',
341
- ),
342
- 'daily_counter' => array(
343
- 'title' => __('Show 24 hours counter', 'cleantalk'),
344
- 'description' => __('Display daily requests counter in the admin bar. Counter displays number of requests of the past 24 hours.', 'cleantalk'),
345
- 'parent' => 'show_adminbar',
346
- 'class' => 'apbct_settings-field_wrapper--sub',
347
- ),
348
- 'sfw_counter' => array(
349
- 'title' => __('SpamFireWall counter', 'cleantalk'),
350
- 'description' => __('Display SpamFireWall requests in the admin bar. Counter displays number of requests since plugin installation.', 'cleantalk'),
351
- 'parent' => 'show_adminbar',
352
- 'class' => 'apbct_settings-field_wrapper--sub',
353
- ),
354
- ),
355
- ),
356
-
357
- // Misc
358
- 'misc' => array(
359
- 'html_after' => '</div><br>',
360
- 'fields' => array(
361
- 'collect_details' => array(
362
- 'type' => 'checkbox',
363
- 'title' => __('Collect details about browsers', 'cleantalk'),
364
- 'description' => __("Checking this box you allow plugin store information about screen size and browser plugins of website visitors. The option in a beta state.", 'cleantalk'),
365
- ),
366
- 'send_connection_reports' => array(
367
- 'type' => 'checkbox',
368
- 'title' => __('Send connection reports', 'cleantalk'),
369
- 'description' => __("Checking this box you allow plugin to send the information about your connection. The option in a beta state.", 'cleantalk'),
370
- ),
371
- 'async_js' => array(
372
- 'type' => 'checkbox',
373
- 'title' => __('Async JavaScript loading', 'cleantalk'),
374
- 'description' => __('Use async loading for scripts. Warning: This could reduce filtration quality.', 'cleantalk'),
375
- ),
376
- 'gdpr_enabled' => array(
377
- 'type' => 'checkbox',
378
- 'title' => __('Allow to add GDPR notice via shortcode', 'cleantalk'),
379
- 'description' => __(' Adds small checkbox under your website form. To add it you should use the shortcode on the form\'s page: [cleantalk_gdpr_form id="FORM_ID"]', 'cleantalk'),
380
- 'childrens' => array('gdpr_text'),
381
- ),
382
- 'gdpr_text' => array(
383
- 'type' => 'text',
384
- 'title' => __('GDPR text notice', 'cleantalk'),
385
- 'description' => __('This text will be added as a description to the GDPR checkbox.', 'cleantalk'),
386
- 'parent' => 'gdpr_enabled',
387
- 'class' => 'apbct_settings-field_wrapper--sub',
388
- ),
389
- 'store_urls' => array(
390
- 'type' => 'checkbox',
391
- 'title' => __('Store visited URLs', 'cleantalk'),
392
- 'description' => __("Plugin stores last 10 visited URLs (HTTP REFFERERS) before visitor submits form on the site. You can see stored visited URLS for each visitor in your Dashboard. Turn the option on to improve Anti-Spam protection.", 'cleantalk'),
393
- 'childrens' => array('store_urls__sessions'),
394
- ),
395
- 'store_urls__sessions' => array(
396
- 'type' => 'checkbox',
397
- 'title' => __('Use cookies less sessions', 'cleantalk'),
398
- 'description' => __('Doesn\'t use cookie or PHP sessions. Collect data for all types of bots.', 'cleantalk'),
399
- 'parent' => 'store_urls',
400
- 'class' => 'apbct_settings-field_wrapper--sub',
401
- ),
402
- 'comment_notify' => array(
403
- 'type' => 'checkbox',
404
- 'title' => __('Notify users with selected roles about new approved comments. Hold CTRL to select multiple roles.', 'cleantalk'),
405
- 'description' => sprintf(__("If enabled, overrides similar Wordpress %sdiscussion settings%s.", 'cleantalk'), '<a href="options-discussion.php">','</a>'),
406
- 'childrens' => array('comment_notify__roles'),
407
- ),
408
- 'comment_notify__roles' => array(
409
- 'type' => 'select',
410
- 'multiple' => true,
411
- 'parent' => 'comment_notify',
412
- 'options_callback' => 'apbct_get_all_roles',
413
- 'options_callback_params' => array(true),
414
- 'class' => 'apbct_settings-field_wrapper--sub',
415
- ),
416
- 'complete_deactivation' => array(
417
- 'type' => 'checkbox',
418
- 'title' => __('Complete deactivation', 'cleantalk'),
419
- 'description' => __('Leave no trace in the system after deactivation.', 'cleantalk'),
420
- ),
421
-
422
- ),
423
- ),
424
- );
425
-
426
- return $fields;
427
- }
428
-
429
- function apbct_settings__set_fileds__network( $fields ){
430
- global $apbct;
431
- $additional_fields = array(
432
- 'main' => array(
433
- 'fields' => array(
434
- 'white_label' => array(
435
- 'type' => 'checkbox',
436
- 'title' => __('Enable White Label Mode', 'cleantalk'),
437
- 'description' => sprintf(__("Learn more information %shere%s.", 'cleantalk'), '<a tearget="_blank" href="https://cleantalk.org/ru/help/hosting-white-label">', '</a>'),
438
- 'childrens' => array('white_label__hoster_key', 'white_label__plugin_name', 'allow_custom_key'),
439
- 'network' => true,
440
- ),
441
- 'white_label__hoster_key' => array(
442
- 'title' => __('Hoster API Key', 'cleantalk'),
443
- 'description' => sprintf(__("You can get it in %sCleantalk's Control Panel%s", 'cleantalk'), '<a tearget="_blank" href="https://cleantalk.org/my/?cp_mode=hosting-antispam">', '</a>'),
444
- 'type' => 'text',
445
- 'parent' => 'white_label',
446
- 'class' => 'apbct_settings-field_wrapper--sub',
447
- 'network' => true,
448
- 'required' => true,
449
- ),
450
- 'white_label__plugin_name' => array(
451
- 'title' => __('Plugin name', 'cleantalk'),
452
- 'description' => sprintf(__("Specify plugin name. Leave empty for deafult %sAntispam by Cleantalk%s", 'cleantalk'), '<b>', '</b>'),
453
- 'type' => 'text',
454
- 'parent' => 'white_label',
455
- 'class' => 'apbct_settings-field_wrapper--sub',
456
- 'network' => true,
457
- 'required' => true,
458
- ),
459
- 'allow_custom_key' => array(
460
- 'type' => 'checkbox',
461
- 'title' => __('Allow users to use other key', 'cleantalk'),
462
- 'description' => __('Allow users to use different Access key in their plugin settings on child blogs. They could use different CleanTalk account.', 'cleantalk')
463
- . (defined('CLEANTALK_ACCESS_KEY')
464
- ? ' <span style="color: red">'
465
- . __('Constant <b>CLEANTALK_ACCESS_KEY</b> is set. All websites will use API key from this constant. Look into wp-config.php', 'cleantalk')
466
- . '</span>'
467
- : ''
468
- ),
469
- 'display' => APBCT_WPMS && is_main_site(),
470
- 'disabled' => $apbct->network_settings['white_label'],
471
- 'network' => true,
472
- ),
473
- )
474
- )
475
- );
476
-
477
- $fields = array_merge_recursive($fields, $additional_fields);
478
-
479
- return $fields;
480
-
481
- }
482
-
483
- function apbct_settings__add_groups_and_fields( $fields ){
484
-
485
- global $apbct;
486
-
487
- $apbct->settings_fields_in_groups = $fields;
488
-
489
- $field_default_params = array(
490
- 'callback' => 'apbct_settings__field__draw',
491
- 'type' => 'radio',
492
- 'options' => array(
493
- array('val' => 1, 'label' => __('On'), 'childrens_enable' => 1, ),
494
- array('val' => 0, 'label' => __('Off'), 'childrens_enable' => 0, ),
495
- ),
496
- 'def_class' => 'apbct_settings-field_wrapper',
497
- 'class' => '',
498
- 'parent' => '',
499
- 'childrens' => array(),
500
- 'hide' => array(),
501
- // 'title' => 'Default title',
502
- // 'description' => 'Default description',
503
- 'display' => true, // Draw settings or not
504
- 'reverse_trigger' => false, // How to allow child settings. Childrens are opened when the parent triggered "ON". This is overrides by this option
505
- 'multiple' => false,
506
- 'description' => '',
507
- 'network' => false,
508
- 'disabled' => false,
509
- 'required' => false,
510
- );
511
-
512
- foreach($apbct->settings_fields_in_groups as $group_name => $group){
513
-
514
- add_settings_section('apbct_section__'.$group_name, '', 'apbct_section__'.$group_name, 'cleantalk');
515
-
516
- foreach($group['fields'] as $field_name => $field){
517
-
518
- // Normalize $field['options'] from callback function to this type array( array( 'val' => 1, 'label' => __('On'), ), )
519
- if(!empty($field['options_callback'])){
520
- $options = call_user_func_array($field['options_callback'], !empty($field['options_callback_params']) ? $field['options_callback_params'] : array());
521
- foreach ($options as &$option){
522
- $option = array('val' => $option, 'label' => $option);
523
- } unset($option);
524
- $field['options'] = $options;
525
- }
526
-
527
- $params = !empty($group['default_params'])
528
- ? array_merge($group['default_params'], $field)
529
- : array_merge($field_default_params, $field);
530
-
531
- $params['name'] = $field_name;
532
-
533
- if(!$params['display'])
534
- continue;
535
-
536
- add_settings_field(
537
- 'apbct_field__'.$field_name,
538
- '',
539
- $params['callback'],
540
- 'cleantalk',
541
- 'apbct_section__'.$group_name,
542
- $params
543
- );
544
-
545
- }
546
- }
547
- }
548
-
549
- /**
550
- * Admin callback function - Displays plugin options page
551
- */
552
- function apbct_settings__display() {
553
-
554
- global $apbct;
555
-
556
- // Title
557
- echo '<h2 class="apbct_settings-title">'.__($apbct->plugin_name, 'cleantalk').'</h2>';
558
-
559
- // Subtitle for IP license
560
- if($apbct->moderate_ip)
561
- echo '<h4 class="apbct_settings-subtitle apbct_color--gray">'. __('Hosting AntiSpam', 'cleantalk').'</h4>';
562
-
563
- echo '<form action="options.php" method="post">';
564
-
565
- apbct_settings__error__output();
566
-
567
- // Top info
568
- if(!$apbct->white_label){
569
- echo '<div style="float: right; padding: 15px 15px 5px 15px; font-size: 13px; position: relative; top: -55px; background: #f1f1f1;">';
570
-
571
- echo __('CleanTalk\'s tech support:', 'cleantalk')
572
- .'&nbsp;'
573
- .'<a target="_blank" href="https://wordpress.org/support/plugin/cleantalk-spam-protect">Wordpress.org</a>.'
574
- // .' <a href="https://community.cleantalk.org/viewforum.php?f=25" target="_blank">'.__("Tech forum", 'cleantalk').'</a>'
575
- // .($user_token ? ", <a href='https://cleantalk.org/my/support?user_token=$user_token&cp_mode=antispam' target='_blank'>".__("Service support ", 'cleantalk').'</a>' : '').
576
- .'<br>';
577
- echo __('Plugin Homepage at', 'cleantalk').' <a href="https://cleantalk.org" target="_blank">cleantalk.org</a>.<br/>';
578
- echo '<span id="apbct_gdpr_open_modal" style="text-decoration: underline;">'.__('GDPR compliance', 'cleantalk').'</span><br/>';
579
- echo __('Use s@cleantalk.org to test plugin in any WordPress form.', 'cleantalk').'<br>';
580
- echo __('CleanTalk is registered Trademark. All rights reserved.', 'cleantalk').'<br/>';
581
- if($apbct->key_is_ok)
582
- echo '<b style="display: inline-block; margin-top: 10px;">'.sprintf(__('Do you like CleanTalk? %sPost your feedback here%s.', 'cleantalk'), '<a href="https://wordpress.org/support/plugin/cleantalk-spam-protect/reviews/#new-post" target="_blank">', '</a>').'</b><br />';
583
- apbct_admin__badge__get_premium();
584
- echo '<div id="gdpr_dialog" style="display: none; padding: 7px;">';
585
- apbct_settings_show_gdpr_text('print');
586
- echo '</div>';
587
- echo '</div>';
588
- }
589
-
590
- // Output spam count
591
- if($apbct->key_is_ok && apbct_api_key__is_correct()){
592
- if($apbct->spam_count > 0){
593
- echo '<div class="apbct_settings-subtitle" style="top: 0; margin-bottom: 10px; width: 200px;">'
594
- .'<br>'
595
- .'<span>'
596
- .sprintf(
597
- __( '%s has blocked <b>%s</b> spam.', 'cleantalk' ),
598
- $apbct->plugin_name,
599
- number_format($apbct->spam_count, 0, ',', ' ')
600
- )
601
- .'</span>'
602
- .'<br>'
603
- .'<br>'
604
- .'</div>';
605
- }
606
- if(!$apbct->white_label){
607
- // CP button
608
- echo '<a class="cleantalk_link cleantalk_link-manual" target="__blank" href="https://cleantalk.org/my?user_token='.$apbct->user_token.'&cp_mode=antispam">'
609
- .__('Click here to get anti-spam statistics', 'cleantalk')
610
- .'</a>';
611
- echo '&nbsp;&nbsp;';
612
- // Support button
613
- echo '<a class="cleantalk_link cleantalk_link-auto" target="__blank" href="https://wordpress.org/support/plugin/cleantalk-spam-protect">'.__('Support', 'cleantalk').'</a>';
614
- echo '<br>'
615
- .'<br>';
616
- }
617
- }
618
-
619
- settings_fields('cleantalk_settings');
620
- do_settings_fields('cleantalk', 'cleantalk_section_settings_main');
621
-
622
- foreach($apbct->settings_fields_in_groups as $group_name => $group){
623
-
624
- echo !empty($group['html_before']) ? $group['html_before'] : '';
625
- echo !empty($group['title']) ? '<h3 style="margin-left: 220px;">'.$group['title'].'</h3>' : '';
626
-
627
- do_settings_fields('cleantalk', 'apbct_section__'.$group_name);
628
-
629
- echo !empty($group['html_after']) ? $group['html_after'] : '';
630
-
631
- }
632
-
633
- echo '<br>';
634
- echo '<button name="submit" class="cleantalk_link cleantalk_link-manual" value="save_changes">'.__('Save Changes').'</button>';
635
-
636
- echo "</form>";
637
-
638
- if(!$apbct->white_label){
639
- // Translate banner for non EN locale
640
- if(substr(get_locale(), 0, 2) != 'en'){
641
- global $ct_translate_banner_template;
642
- require_once(CLEANTALK_PLUGIN_DIR.'templates/translate_banner.php');
643
- printf($ct_translate_banner_template, substr(get_locale(), 0, 2));
644
- }
645
- }
646
- }
647
-
648
- function apbct_settings__display__network(){
649
- // If it's network admin dashboard
650
- if(is_network_admin()){
651
- $site_url = get_site_option('siteurl');
652
- $site_url = preg_match( '/\/$/', $site_url ) ? $site_url : $site_url . '/';
653
- $link = $site_url . 'wp-admin/options-general.php?page=cleantalk';
654
- printf("<h2>" . __("Please, enter the %splugin settings%s in main site dashboard.", 'cleantalk') . "</h2>", "<a href='$link'>", "</a>");
655
- return;
656
- }
657
- }
658
-
659
- function apbct_settings__error__output($return = false){
660
-
661
- global $apbct;
662
-
663
- // If have error message output error block.
664
-
665
- $out = '';
666
-
667
- if(!empty($apbct->errors) && !defined('CLEANTALK_ACCESS_KEY')){
668
-
669
- $errors = $apbct->errors;
670
-
671
- $error_texts = array(
672
- // Misc
673
- 'key_invalid' => __('Error occured while API key validating. Error: ', 'cleantalk'),
674
- 'key_get' => __('Error occured while automatically gettings access key. Error: ', 'cleantalk'),
675
- 'sfw_send_logs' => __('Error occured while sending sending SpamFireWall logs. Error: ', 'cleantalk'),
676
- 'sfw_update' => __('Error occured while updating SpamFireWall local base. Error: ' , 'cleantalk'),
677
- 'account_check' => __('Error occured while checking account status. Error: ', 'cleantalk'),
678
- 'api' => __('Error occured while excuting API call. Error: ', 'cleantalk'),
679
-
680
- // Validating settings
681
- 'settings_validate' => 'Validate Settings',
682
- 'exclusions_urls' => 'URL Exclusions',
683
- 'exclusions_fields' => 'Field Exclusions',
684
-
685
- // Unknown
686
- 'unknown' => __('Unknown error. Error: ', 'cleantalk'),
687
- );
688
-
689
- $errors_out = array();
690
-
691
- foreach($errors as $type => $error){
692
-
693
- if(!empty($error)){
694
-
695
- if(is_array(current($error))){
696
-
697
- foreach($error as $sub_type => $sub_error){
698
- $errors_out[$sub_type] = '';
699
- if(isset($sub_error['error_time']))
700
- $errors_out[$sub_type] .= date('Y-m-d H:i:s', $sub_error['error_time']) . ': ';
701
- $errors_out[$sub_type] .= (isset($error_texts[$type]) ? $error_texts[$type] : ucfirst($type)) . ': ';
702
- $errors_out[$sub_type] .= (isset($error_texts[$sub_type]) ? $error_texts[$sub_type] : $error_texts['unknown']) . ' ' . $sub_error['error'];
703
- }
704
- continue;
705
- }
706
-
707
- $errors_out[$type] = '';
708
- if(isset($error['error_time']))
709
- $errors_out[$type] .= date('Y-m-d H:i:s', $error['error_time']) . ': ';
710
- $errors_out[$type] .= (isset($error_texts[$type]) ? $error_texts[$type] : $error_texts['unknown']) . ' ' . (isset($error['error']) ? $error['error'] : '');
711
-
712
- }
713
- }
714
-
715
- if(!empty($errors_out)){
716
- $out .= '<div id="apbctTopWarning" class="error" style="position: relative;">'
717
- .'<h3 style="display: inline-block;">'.__('Errors:', 'cleantalk').'</h3>';
718
- foreach($errors_out as $value){
719
- $out .= '<h4>'.$value.'</h4>';
720
- }
721
- $out .= !$apbct->white_label
722
- ? '<h4 style="text-align: unset;">'.sprintf(__('You can get support any time here: %s.', 'cleantalk'), '<a target="blank" href="https://wordpress.org/support/plugin/cleantalk-spam-protect">https://wordpress.org/support/plugin/cleantalk-spam-protect</a>').'</h4>'
723
- : '';
724
- $out .= '</div>';
725
- }
726
- }
727
-
728
- if($return) return $out; else echo $out;
729
- }
730
-
731
- function apbct_settings__field__debug(){
732
-
733
- global $apbct;
734
-
735
- if($apbct->debug){
736
-
737
- echo '<hr /><h2>Debug:</h2>';
738
- echo '<h4>Constants:</h4>';
739
- echo 'CLEANTALK_AJAX_USE_BUFFER '. (defined('CLEANTALK_AJAX_USE_BUFFER') ? (CLEANTALK_AJAX_USE_BUFFER ? 'true' : 'flase') : 'NOT_DEFINED')."<br>";
740
- echo 'CLEANTALK_AJAX_USE_FOOTER_HEADER '. (defined('CLEANTALK_AJAX_USE_FOOTER_HEADER') ? (CLEANTALK_AJAX_USE_FOOTER_HEADER ? 'true' : 'flase') : 'NOT_DEFINED')."<br>";
741
- echo 'CLEANTALK_ACCESS_KEY '. (defined('CLEANTALK_ACCESS_KEY') ? (CLEANTALK_ACCESS_KEY ? CLEANTALK_ACCESS_KEY : 'flase') : 'NOT_DEFINED')."<br>";
742
- echo 'CLEANTALK_CHECK_COMMENTS_NUMBER '. (defined('CLEANTALK_CHECK_COMMENTS_NUMBER') ? (CLEANTALK_CHECK_COMMENTS_NUMBER ? CLEANTALK_CHECK_COMMENTS_NUMBER : 0) : 'NOT_DEFINED')."<br>";
743
- echo 'CLEANTALK_CHECK_MESSAGES_NUMBER '. (defined('CLEANTALK_CHECK_MESSAGES_NUMBER') ? (CLEANTALK_CHECK_MESSAGES_NUMBER ? CLEANTALK_CHECK_MESSAGES_NUMBER : 0) : 'NOT_DEFINED')."<br>";
744
- echo 'CLEANTALK_PLUGIN_DIR '. (defined('CLEANTALK_PLUGIN_DIR') ? (CLEANTALK_PLUGIN_DIR ? CLEANTALK_PLUGIN_DIR : 'flase') : 'NOT_DEFINED')."<br>";
745
- echo 'WP_ALLOW_MULTISITE '. (defined('WP_ALLOW_MULTISITE') ? (WP_ALLOW_MULTISITE ? 'true' : 'flase') : 'NOT_DEFINED');
746
-
747
- echo "<h4>Debug log: <button type='submit' value='debug_drop' name='submit' style='font-size: 11px; padding: 1px;'>Drop debug data</button></h4>";
748
- echo "<div style='height: 500px; width: 80%; overflow: auto;'>";
749
-
750
- $output = print_r($apbct->debug, true);
751
- $output = str_replace("\n", "<br>", $output);
752
- $output = preg_replace("/[^\S]{4}/", "&nbsp;&nbsp;&nbsp;&nbsp;", $output);
753
- echo "$output";
754
-
755
- echo "</div>";
756
-
757
- }
758
- }
759
-
760
- function apbct_settings__field__state(){
761
-
762
- global $apbct;
763
-
764
- $path_to_img = plugin_dir_url(__FILE__) . "images/";
765
-
766
- $img = $path_to_img."yes.png";
767
- $img_no = $path_to_img."no.png";
768
- $img_no_gray = $path_to_img."no_gray.png";
769
- $color="black";
770
-
771
- if(!$apbct->key_is_ok){
772
- $img=$path_to_img."no.png";
773
- $img_no=$path_to_img."no.png";
774
- $color="black";
775
- }
776
-
777
- if(!apbct_api_key__is_correct($apbct->api_key)){
778
- $img = $path_to_img."yes_gray.png";
779
- $img_no = $path_to_img."no_gray.png";
780
- $color="gray";
781
- }
782
-
783
- if($apbct->moderate_ip){
784
- $img = $path_to_img."yes.png";
785
- $img_no = $path_to_img."no.png";
786
- $color="black";
787
- }
788
-
789
- if($apbct->moderate == 0){
790
- $img = $path_to_img."no.png";
791
- $img_no = $path_to_img."no.png";
792
- $color="black";
793
- }
794
-
795
- print '<div class="apbct_settings-field_wrapper" style="color:'.$color.'">';
796
-
797
- print '<h2>'.__('Protection is active', 'cleantalk').'</h2>';
798
-
799
- echo '<img class="apbct_status_icon" src="'.($apbct->settings['registrations_test'] == 1 ? $img : $img_no).'"/>'.__('Registration forms', 'cleantalk');
800
- echo '<img class="apbct_status_icon" src="'.($apbct->settings['comments_test']==1 ? $img : $img_no).'"/>'.__('Comments forms', 'cleantalk');
801
- echo '<img class="apbct_status_icon" src="'.($apbct->settings['contact_forms_test']==1 ? $img : $img_no).'"/>'.__('Contact forms', 'cleantalk');
802
- echo '<img class="apbct_status_icon" src="'.($apbct->settings['general_contact_forms_test']==1 ? $img : $img_no).'"/>'.__('Custom contact forms', 'cleantalk');
803
- if(!$apbct->white_label || is_main_site())
804
- echo '<img class="apbct_status_icon" src="'.($apbct->data['moderate'] == 1 ? $img : $img_no).'"/>'
805
- .'<a style="color: black" href="https://blog.cleantalk.org/real-time-email-address-existence-validation/">'.__('Validate email for existence', 'cleantalk').'</a>';
806
-
807
- // Autoupdate status
808
- if($apbct->notice_auto_update && (!$apbct->white_label || is_main_site())){
809
- echo '<img class="apbct_status_icon" src="'.($apbct->auto_update == 1 ? $img : ($apbct->auto_update == -1 ? $img_no : $img_no_gray)).'"/>'.__('Auto update', 'cleantalk')
810
- .' <sup><a href="https://cleantalk.org/help/cleantalk-auto-update" target="_blank">?</a></sup>';
811
- }
812
-
813
- // WooCommerce
814
- if(class_exists('WooCommerce'))
815
- echo '<img class="apbct_status_icon" src="'.($apbct->settings['wc_checkout_test'] == 1 ? $img : $img_no).'"/>'.__('WooCommerce checkout form', 'cleantalk');
816
- if($apbct->moderate_ip)
817
- print "<br /><br />The anti-spam service is paid by your hosting provider. License #".$apbct->data['ip_license'].".<br />";
818
-
819
- print "</div>";
820
- }
821
-
822
- /**
823
- * Admin callback function - Displays inputs of 'apikey' plugin parameter
824
- */
825
- function apbct_settings__field__apikey(){
826
-
827
- global $apbct;
828
-
829
- echo '<div id="cleantalk_apikey_wrapper" class="apbct_settings-field_wrapper">';
830
-
831
- // Using key from Main site, or from CLEANTALK_ACCESS_KEY constant
832
- if(APBCT_WPMS && !is_main_site() && (!$apbct->allow_custom_key || defined('CLEANTALK_ACCESS_KEY'))){
833
- _e('<h3>Key is provided by Super Admin.</h3>', 'cleantalk');
834
- return;
835
- }
836
-
837
- echo '<label class="apbct_settings__label" for="cleantalk_apkey">' . __('Access key', 'cleantalk') . '</label>';
838
-
839
- echo '<input
840
- id="apbct_setting_apikey"
841
- class="apbct_setting_text apbct_setting---apikey"
842
- type="text"
843
- name="cleantalk_settings[apikey]"
844
- value="'
845
- . ($apbct->key_is_ok
846
- ? str_repeat('*', strlen($apbct->api_key))
847
- : $apbct->api_key
848
- )
849
- . '"
850
- key="' . $apbct->api_key . '"
851
- size="20"
852
- placeholder="' . __('Enter the key', 'cleantalk') . '"'
853
- . ' />';
854
-
855
- // Show account name associated with key
856
- if(!empty($apbct->data['account_name_ob'])){
857
- echo '<div class="apbct_display--none">'
858
- . sprintf( __('Account at cleantalk.org is %s.', 'cleantalk'),
859
- '<b>'.$apbct->data['account_name_ob'].'</b>'
860
- )
861
- . '</div>';
862
- };
863
-
864
- // Show key button
865
- if((apbct_api_key__is_correct($apbct->api_key) && $apbct->key_is_ok)){
866
- echo '<a id="apbct_showApiKey" class="ct_support_link" style="display: block" href="#">'
867
- . __('Show the access key', 'cleantalk')
868
- . '</a>';
869
-
870
- // "Auto Get Key" buttons. License agreement
871
- }else{
872
-
873
- echo '<br /><br />';
874
-
875
- // Auto get key
876
- if(!$apbct->ip_license){
877
- echo '<button class="cleantalk_link cleantalk_link-manual apbct_setting---get_key_auto" name="submit" type="submit" value="get_key_auto">'
878
- .__('Get Access Key Automatically', 'cleantalk')
879
- .'</button>';
880
- echo '<input type="hidden" id="ct_admin_timezone" name="ct_admin_timezone" value="null" />';
881
- echo '<br />';
882
- echo '<br />';
883
- }
884
-
885
- // Warnings and GDPR
886
- printf( __('Admin e-mail (%s) will be used for registration, if you want to use other email please %sGet Access Key Manually%s.', 'cleantalk'),
887
- ct_get_admin_email(),
888
- '<a class="apbct_color--gray" target="__blank" href="'
889
- . sprintf( 'https://cleantalk.org/register?platform=wordpress&email=%s&website=%s',
890
- urlencode(ct_get_admin_email()),
891
- urlencode(parse_url(get_option('siteurl'),PHP_URL_HOST))
892
- )
893
- . '">',
894
- '</a>'
895
- );
896
-
897
- // License agreement
898
- if(!$apbct->ip_license){
899
- echo '<div>';
900
- echo '<input checked type="checkbox" id="license_agreed" onclick="apbctSettingsDependencies(\'apbct_setting---get_key_auto\');"/>';
901
- echo '<label for="spbc_license_agreed">';
902
- printf( __('I accept %sLicense Agreement%s.', 'cleantalk'),
903
- '<a class = "apbct_color--gray" href="https://cleantalk.org/publicoffer" target="_blank">',
904
- '</a>'
905
- );
906
- echo "</label>";
907
- echo '</div>';
908
- }
909
- }
910
-
911
- echo '</div>';
912
- }
913
-
914
- function apbct_settings__field__action_buttons(){
915
-
916
- global $apbct;
917
-
918
- echo '<div class="apbct_settings-field_wrapper">';
919
-
920
- if(apbct_api_key__is_correct($apbct->api_key) && $apbct->key_is_ok){
921
- echo '<div>'
922
- .'<a href="edit-comments.php?page=ct_check_spam" class="ct_support_link">' . __('Check comments for spam', 'cleantalk') . '</a>'
923
- .'&nbsp;&nbsp;'
924
- .'&nbsp;&nbsp;'
925
- .'<a href="users.php?page=ct_check_users" class="ct_support_link">' . __('Check users for spam', 'cleantalk') . '</a>'
926
- .'&nbsp;&nbsp;'
927
- .'&nbsp;&nbsp;'
928
- .'<a href="#" class="ct_support_link" onclick="apbct_show_hide_elem(\'apbct_statistics\')">' . __('Statistics & Reports', 'cleantalk') . '</a>'
929
- .'</div>';
930
-
931
- }
932
-
933
- echo '</div>';
934
- }
935
-
936
- function apbct_settings__field__statistics() {
937
-
938
- global $apbct, $wpdb;
939
-
940
- echo '<div id="apbct_statistics" class="apbct_settings-field_wrapper" style="display: none;">';
941
-
942
- // Last request
943
- printf(
944
- __('Last spam check request to %s server was at %s.', 'cleantalk'),
945
- $apbct->stats['last_request']['server'] ? $apbct->stats['last_request']['server'] : __('unknown', 'cleantalk'),
946
- $apbct->stats['last_request']['time'] ? date('M d Y H:i:s', $apbct->stats['last_request']['time']) : __('unknown', 'cleantalk')
947
- );
948
- echo '<br>';
949
-
950
- // Avarage time request
951
- printf(
952
- __('Average request time for past 7 days: %s seconds.', 'cleantalk'),
953
- $apbct->stats['requests'][min(array_keys($apbct->stats['requests']))]['average_time']
954
- ? round($apbct->stats['requests'][min(array_keys($apbct->stats['requests']))]['average_time'], 3)
955
- : __('unknown', 'cleantalk')
956
- );
957
- echo '<br>';
958
-
959
- // SFW last die
960
- printf(
961
- __('Last time SpamFireWall was triggered for %s IP at %s', 'cleantalk'),
962
- $apbct->stats['last_sfw_block']['ip'] ? $apbct->stats['last_sfw_block']['ip'] : __('unknown', 'cleantalk'),
963
- $apbct->stats['last_sfw_block']['time'] ? date('M d Y H:i:s', $apbct->stats['last_sfw_block']['time']) : __('unknown', 'cleantalk')
964
- );
965
- echo '<br>';
966
-
967
- // SFW last update
968
- $sfw_netwoks_amount = $wpdb->get_results("SELECT count(*) AS cnt FROM `".$wpdb->prefix."cleantalk_sfw`", ARRAY_A);
969
- printf(
970
- __('SpamFireWall was updated %s. Now contains %s entries.', 'cleantalk'),
971
- $apbct->stats['sfw']['last_update_time'] ? date('M d Y H:i:s', $apbct->stats['sfw']['last_update_time']) : __('unknown', 'cleantalk'),
972
- isset($sfw_netwoks_amount[0]['cnt']) ? $sfw_netwoks_amount[0]['cnt'] : __('unknown', 'cleantalk')
973
- );
974
- echo '<br>';
975
-
976
- // SFW last sent logs
977
- printf(
978
- __('SpamFireWall sent %s events at %s.', 'cleantalk'),
979
- $apbct->stats['sfw']['last_send_amount'] ? $apbct->stats['sfw']['last_send_amount'] : __('unknown', 'cleantalk'),
980
- $apbct->stats['sfw']['last_send_time'] ? date('M d Y H:i:s', $apbct->stats['sfw']['last_send_time']) : __('unknown', 'cleantalk')
981
- );
982
- echo '<br>';
983
-
984
- // Connection reports
985
- if ($apbct->connection_reports){
986
-
987
- if ($apbct->connection_reports['negative'] == 0){
988
- _e('There are no failed connections to server.', 'cleantalk');
989
- }else{
990
- echo "<table id='negative_reports_table''>
991
- <tr>
992
- <td>#</td>
993
- <td><b>Date</b></td>
994
- <td><b>Page URL</b></td>
995
- <td><b>Report</b></td>
996
- <td><b>Server IP</b></td>
997
- </tr>";
998
- foreach($apbct->connection_reports['negative_report'] as $key => $report){
999
- echo '<tr>'
1000
- . '<td>'.($key+1).'.</td>'
1001
- . '<td>'.$report['date'].'</td>'
1002
- . '<td>'.$report['page_url'].'</td>'
1003
- . '<td>'.$report['lib_report'].'</td>'
1004
- . '<td>'.$report['work_url'].'</td>'
1005
- . '</tr>';
1006
- }
1007
- echo "</table>";
1008
- echo '<br/>';
1009
- echo '<button'
1010
- . ' name="submit"'
1011
- . ' class="cleantalk_link cleantalk_link-manual"'
1012
- . ' value="ct_send_connection_report"'
1013
- . (!$apbct->settings['send_connection_reports'] ? ' disabled="disabled"' : '')
1014
- . '>'
1015
- .__('Send report', 'cleantalk')
1016
- .'</button>';
1017
- if (!$apbct->settings['send_connection_reports']){
1018
- echo '<br><br>';
1019
- _e('Please, enable "Send connection reports" setting to be able to send reports', 'cleantalk');
1020
- }
1021
- }
1022
-
1023
- }
1024
-
1025
- echo '</div>';
1026
- }
1027
-
1028
- /**
1029
- * Get all current Wordpress roles, could except 'subscriber' role
1030
- *
1031
- * @param bool $except_subscriber
1032
- *
1033
- * @return array
1034
- */
1035
- function apbct_get_all_roles($except_subscriber = false) {
1036
-
1037
- global $wp_roles;
1038
-
1039
- $wp_roles = new WP_Roles();
1040
- $roles = $wp_roles->get_names();
1041
-
1042
- if($except_subscriber) {
1043
- $key = array_search( 'Subscriber', $roles );
1044
- if ( $key !== false ) {
1045
- unset( $roles[ $key ] );
1046
- }
1047
- }
1048
-
1049
- return $roles;
1050
- }
1051
-
1052
- function apbct_settings__field__draw($params = array()){
1053
-
1054
- global $apbct;
1055
-
1056
- $value = $params['network'] ? $apbct->network_settings[$params['name']] : $apbct->settings[$params['name']];
1057
- $value_parent = $params['parent']
1058
- ? ($params['network'] ? $apbct->network_settings[$params['parent']] : $apbct->settings[$params['parent']])
1059
- : false;
1060
-
1061
- $disabled = $params['parent'] && !$value_parent ? ' disabled="disabled"' : '';
1062
- $disabled = $params['disabled'] ? ' disabled="disabled"' : $disabled;
1063
-
1064
- $childrens = $params['childrens'] ? 'apbct_setting---' . implode(",apbct_setting---",$params['childrens']) : '';
1065
- $hide = $params['hide'] ? implode(",",$params['hide']) : '';
1066
-
1067
- echo '<div class="'.$params['def_class'].(isset($params['class']) ? ' '.$params['class'] : '').'">';
1068
-
1069
- switch($params['type']){
1070
-
1071
- // Checkbox type
1072
- case 'checkbox':
1073
- echo '<input
1074
- type="checkbox"
1075
- name="cleantalk_settings['.$params['name'].']"
1076
- id="apbct_setting_'.$params['name'].'"
1077
- value="1" '
1078
- ." class='apbct_setting_{$params['type']} apbct_setting---{$params['name']}'"
1079
- .($value == '1' ? ' checked' : '')
1080
- .$disabled
1081
- .($params['required'] ? ' required="required"' : '')
1082
- .' onchange="'
1083
- . ($params['childrens'] ? ' apbctSettingsDependencies(\''. $childrens .'\');' : '')
1084
- . ($params['hide'] ? ' apbct_show_hide_elem(\''. $hide . '\');' : '')
1085
- . '"'
1086
- .' />'
1087
- .'<label for="apbct_setting_'.$params['name'].'" class="apbct_setting-field_title--'.$params['type'].'">'
1088
- .$params['title']
1089
- .'</label>';
1090
- echo isset($params['long_description'])
1091
- ? '<i setting="'.$params['name'].'" class="apbct_settings-long_description---show icon-help-circled"></i>'
1092
- : '';
1093
- echo '<div class="apbct_settings-field_description">'
1094
- .$params['description']
1095
- .'</div>';
1096
- break;
1097
-
1098
- // Radio type
1099
- case 'radio':
1100
-
1101
- // Title
1102
- echo isset($params['title'])
1103
- ? '<h4 class="apbct_settings-field_title apbct_settings-field_title--'.$params['type'].'">'.$params['title'].'</h4>'
1104
- : '';
1105
-
1106
- // Popup description
1107
- echo isset($params['long_description'])
1108
- ? '<i setting="'.$params['name'].'" class="apbct_settings-long_description---show icon-help-circled"></i>'
1109
- : '';
1110
-
1111
- echo '<div class="apbct_settings-field_content apbct_settings-field_content--'.$params['type'].'">';
1112
-
1113
- $disabled = '';
1114
-
1115
- // Disable child option if parent is ON
1116
- if($params['reverse_trigger']){
1117
- if($params['parent'] && $apbct->settings[$params['parent']]){
1118
- $disabled = ' disabled="disabled"';
1119
- }
1120
-
1121
- // Disable child option if parent if OFF
1122
- }else{
1123
- if($params['parent'] && !$apbct->settings[$params['parent']]){
1124
- $disabled = ' disabled="disabled"';
1125
- }
1126
- }
1127
-
1128
- foreach($params['options'] as $option){
1129
- echo '<input'
1130
- .' type="radio"'
1131
- ." class='apbct_setting_{$params['type']} apbct_setting---{$params['name']}'"
1132
- ." id='apbct_setting_{$params['name']}__{$option['label']}'"
1133
- .' name="cleantalk_settings['.$params['name'].']"'
1134
- .' value="'.$option['val'].'"'
1135
- .($params['parent'] ? $disabled : '')
1136
- .($params['childrens']
1137
- ? ' onchange="apbctSettingsDependencies(\'' . $childrens . '\', ' . $option['childrens_enable'] . ')"'
1138
- : ''
1139
- )
1140
- .($value == $option['val'] ? ' checked' : '')
1141
- .($params['required'] ? ' required="required"' : '')
1142
- .' />';
1143
- echo '<label for="apbct_setting_'.$params['name'].'__'.$option['label'].'"> ' . $option['label'] . '</label>';
1144
- echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
1145
- }
1146
-
1147
- echo isset($params['description'])
1148
- ? '<div class="apbct_settings-field_description">'.$params['description'].'</div>'
1149
- : '';
1150
-
1151
- echo '</div>';
1152
- break;
1153
-
1154
- // Dropdown list type
1155
- case 'select':
1156
- echo isset($params['title'])
1157
- ? '<h4 class="apbct_settings-field_title apbct_settings-field_title--'.$params['type'].'">'.$params['title'].'</h4>'
1158
- : '';
1159
- echo isset($params['long_description'])
1160
- ? '<i setting="'.$params['name'].'" class="apbct_settings-long_description---show icon-help-circled"></i>'
1161
- : '';
1162
- echo '<select'
1163
- . ' id="apbct_setting_'.$params['name'].'"'
1164
- . " class='apbct_setting_{$params['type']} apbct_setting---{$params['name']}'"
1165
- . ' name="cleantalk_settings['.$params['name'].']'.($params['multiple'] ? '[]"' : '"')
1166
- . ($params['multiple'] ? ' size="'. count($params['options']). '""' : '')
1167
- . ($params['multiple'] ? ' multiple="multiple"' : '')
1168
- . $disabled
1169
- . ($params['required'] ? ' required="required"' : '')
1170
- . ' >';
1171
-
1172
- foreach($params['options'] as $option){
1173
- echo '<option'
1174
- . ' value="' . $option['val'] . '"'
1175
- . ($params['multiple']
1176
- ? (in_array($option['val'], $value) ? ' selected="selected"' : '')
1177
- : ($value == $option['val'] ? 'selected="selected"' : '')
1178
- )
1179
- .'>'
1180
- . $option['label']
1181
- . '</option>';
1182
- }
1183
-
1184
- echo '</select>';
1185
- echo isset($params['long_description'])
1186
- ? '<i setting="'.$params['name'].'" class="apbct_settings-long_description---show icon-help-circled"></i>'
1187
- : '';
1188
- echo isset($params['description'])
1189
- ? '<div class="apbct_settings-field_description">'.$params['description'].'</div>'
1190
- : '';
1191
-
1192
- break;
1193
-
1194
- // Text type
1195
- case 'text':
1196
-
1197
- echo '<input
1198
- type="text"
1199
- id="apbct_setting_'.$params['name'].'"
1200
- name="cleantalk_settings['.$params['name'].']"'
1201
- ." class='apbct_setting_{$params['type']} apbct_setting---{$params['name']}'"
1202
- .' value="'. $value .'" '
1203
- .$disabled
1204
- .($params['required'] ? ' required="required"' : '')
1205
- .($params['childrens'] ? ' onchange="apbctSettingsDependencies(\'' . $childrens . '\')"' : '')
1206
- .' />'
1207
- . '&nbsp;'
1208
- .'<label for="apbct_setting_'.$params['name'].'" class="apbct_setting-field_title--'.$params['type'].'">'
1209
- .$params['title']
1210
- .'</label>';
1211
- echo '<div class="apbct_settings-field_description">'
1212
- .$params['description']
1213
- .'</div>';
1214
- break;
1215
- }
1216
-
1217
- echo '</div>';
1218
- }
1219
-
1220
- /**
1221
- * Admin callback function - Plugin parameters validator
1222
- *
1223
- * @global CleantalkState $apbct
1224
- * @param array $settings Array with passed settings
1225
- * @return array Array with processed settings
1226
- */
1227
- function apbct_settings__validate($settings) {
1228
-
1229
- global $apbct;
1230
-
1231
- // Set missing settings.
1232
- foreach($apbct->def_settings as $setting => $value){
1233
- if(!isset($settings[$setting])){
1234
- $settings[$setting] = null;
1235
- settype($settings[$setting], gettype($value));
1236
- }
1237
- } unset($setting, $value);
1238
-
1239
- // Set missing settings.
1240
- foreach($apbct->def_network_settings as $setting => $value){
1241
- if(!isset($settings[$setting])){
1242
- $settings[$setting] = null;
1243
- settype($settings[$setting], gettype($value));
1244
- }
1245
- } unset($setting, $value);
1246
-
1247
- // Validating API key
1248
- $settings['apikey'] = !empty($settings['apikey']) ? trim($settings['apikey']) : '';
1249
- $settings['apikey'] = defined('CLEANTALK_ACCESS_KEY') ? CLEANTALK_ACCESS_KEY : $settings['apikey'];
1250
- $settings['apikey'] = is_main_site() || $apbct->allow_custom_key ? $settings['apikey'] : $apbct->network_settings['apikey'];
1251
- $settings['apikey'] = is_main_site() || !$settings['white_label'] ? $settings['apikey'] : $apbct->settings['apikey'];
1252
- $settings['apikey'] = strpos($settings['apikey'], '*') === false ? $settings['apikey'] : $apbct->settings['apikey'];
1253
-
1254
- // Validate Exclusions
1255
- // URLs
1256
- $result = apbct_settings__sanitize__exclusions($settings['exclusions__urls'], $settings['exclusions__urls__use_regexp']);
1257
- $result === false
1258
- ? $apbct->error_add( 'exclusions_urls', 'is not valid: "' . $settings['exclusions__urls'] . '"', 'settings_validate' )
1259
- : $apbct->error_delete( 'exclusions_urls', true, 'settings_validate' );
1260
- $settings['exclusions__urls'] = $result ? $result: '';
1261
-
1262
- // Fields
1263
- $result = apbct_settings__sanitize__exclusions($settings['exclusions__fields'], $settings['exclusions__fields__use_regexp']);
1264
- $result === false
1265
- ? $apbct->error_add( 'exclusions_fields', 'is not valid: "' . $settings['exclusions__fields'] . '"', 'settings_validate' )
1266
- : $apbct->error_delete( 'exclusions_fields', true, 'settings_validate' );
1267
- $settings['exclusions__fields'] = $result ? $result: '';
1268
-
1269
- // WPMS Logic.
1270
- if(APBCT_WPMS && is_main_site()){
1271
- $network_settings = array(
1272
- 'allow_custom_key' => $settings['allow_custom_key'],
1273
- 'white_label' => $settings['white_label'],
1274
- 'white_label__hoster_key' => $settings['white_label__hoster_key'],
1275
- 'white_label__plugin_name' => $settings['white_label__plugin_name'],
1276
- );
1277
- unset( $settings['allow_custom_key'], $settings['white_label'], $settings['white_label__hoster_key'], $settings['white_label__plugin_name'] );
1278
- }
1279
-
1280
- // Drop debug data
1281
- if (isset($_POST['submit']) && $_POST['submit'] == 'debug_drop'){
1282
- $apbct->debug = false;
1283
- delete_option('cleantalk_debug');
1284
- return $settings;
1285
- }
1286
-
1287
- // Send connection reports
1288
- if (isset($_POST['submit']) && $_POST['submit'] == 'ct_send_connection_report'){
1289
- ct_mail_send_connection_report();
1290
- return $settings;
1291
- }
1292
-
1293
- // Auto getting key
1294
- if (isset($_POST['submit']) && $_POST['submit'] == 'get_key_auto'){
1295
-
1296
- $website = parse_url(get_option('siteurl'), PHP_URL_HOST).parse_url(get_option('siteurl'), PHP_URL_PATH);
1297
- $platform = 'wordpress';
1298
- $user_ip = CleantalkHelper::ip__get(array('real'), false);
1299
- $timezone = filter_input(INPUT_POST, 'ct_admin_timezone');
1300
- $language = apbct_get_server_variable( 'HTTP_ACCEPT_LANGUAGE' );
1301
- $wpms = APBCT_WPMS && defined('SUBDOMAIN_INSTALL') && !SUBDOMAIN_INSTALL ? true : false;
1302
- $white_label = $apbct->network_settings['white_label'] ? 1 : 0;
1303
- $hoster_api_key = $apbct->network_settings['white_label__hoster_key'] ? $apbct->network_settings['white_label__hoster_key'] : '';
1304
-
1305
- $result = CleantalkAPI::method__get_api_key(
1306
- 'antispam',
1307
- ct_get_admin_email(),
1308
- $website,
1309
- $platform,
1310
- $timezone,
1311
- $language,
1312
- $user_ip,
1313
- $wpms,
1314
- $white_label,
1315
- $hoster_api_key
1316
- );
1317
-
1318
- if(empty($result['error'])){
1319
-
1320
- if(isset($result['user_token'])){
1321
- $apbct->data['user_token'] = $result['user_token'];
1322
- }
1323
-
1324
- if(!empty($result['auth_key'])){
1325
- $settings['apikey'] = $result['auth_key'];
1326
- }
1327
-
1328
- }else{
1329
- $apbct->error_add(
1330
- 'key_get',
1331
- $result['error']
1332
- . ($apbct->white_label
1333
- ? ' <button name="submit" type="submit" class="cleantalk_link cleantalk_link-manual" value="get_key_auto">'
1334
- : ''
1335
- )
1336
- );
1337
- }
1338
- }
1339
-
1340
- // Feedback with app_agent
1341
- ct_send_feedback('0:' . APBCT_AGENT); // 0 - request_id, agent version.
1342
-
1343
- // Key is good by default
1344
- $apbct->data['key_is_ok'] = true;
1345
-
1346
- // Check account status and validate key. Even if it's not correct because of IP license.
1347
- $result = ct_account_status_check($settings['apikey']);
1348
-
1349
- // Is key valid?
1350
- if($result){
1351
-
1352
- // Deleting errors about invalid key
1353
- $apbct->error_delete('key_invalid key_get', 'save');
1354
-
1355
- // SFW actions
1356
- if($apbct->settings['spam_firewall'] == 1){
1357
- ct_sfw_update($settings['apikey']);
1358
- ct_sfw_send_logs($settings['apikey']);
1359
- }
1360
-
1361
- // Updating brief data for dashboard widget
1362
- $apbct->data['brief_data'] = CleantalkAPI::method__get_antispam_report_breif($settings['apikey']);
1363
-
1364
- // Key is not valid
1365
- }else{
1366
- $apbct->data['key_is_ok'] = false;
1367
- $apbct->error_add('key_invalid', __('Testing is failed. Please check the Access key.', 'cleantalk'));
1368
- }
1369
-
1370
- // WPMS Logic.
1371
- if(APBCT_WPMS){
1372
- if(is_main_site()){
1373
-
1374
- // Network settings
1375
- $network_settings['apikey'] = $settings['apikey'];
1376
- $apbct->network_settings = $network_settings;
1377
- $apbct->saveNetworkSettings();
1378
-
1379
- // Network data
1380
- $apbct->network_data = array(
1381
- 'key_is_ok' => $apbct->data['key_is_ok'],
1382
- 'moderate' => $apbct->data['moderate'],
1383
- 'valid' => $apbct->data['valid'],
1384
- 'auto_update' => $apbct->data['auto_update'],
1385
- 'user_token' => $apbct->data['user_token'],
1386
- 'service_id' => $apbct->data['service_id'],
1387
- );
1388
- $apbct->saveNetworkData();
1389
- }
1390
- if(!$apbct->white_label && !is_main_site() && !$apbct->allow_custom_key){
1391
- $settings['apikey'] = '';
1392
- }
1393
- }
1394
-
1395
- if($apbct->data['key_is_ok'] == false && $apbct->data['moderate_ip'] == 0){
1396
-
1397
- // Notices
1398
- $apbct->data['notice_show'] = 1;
1399
- $apbct->data['notice_renew'] = 0;
1400
- $apbct->data['notice_trial'] = 0;
1401
- $apbct->data['notice_review'] = 0;
1402
- $apbct->data['notice_auto_update'] = 0;
1403
-
1404
- // Other
1405
- $apbct->data['service_id'] = 0;
1406
- $apbct->data['valid'] = 0;
1407
- $apbct->data['moderate'] = 0;
1408
- $apbct->data['ip_license'] = 0;
1409
- $apbct->data['moderate_ip'] = 0;
1410
- $apbct->data['spam_count'] = 0;
1411
- $apbct->data['auto_update'] = 0;
1412
- $apbct->data['user_token'] = '';
1413
- $apbct->data['license_trial'] = 0;
1414
- $apbct->data['account_name_ob'] = '';
1415
- }
1416
-
1417
- $apbct->saveData();
1418
-
1419
- return $settings;
1420
- }
1421
-
1422
- /**
1423
- * Sanitize and validate exclusions.
1424
- * Explode given string by commas and trim each string.
1425
- * Skip element if it's empty.
1426
- *
1427
- * Return false if exclusion is bad
1428
- * Return sanitized string if all is ok
1429
- *
1430
- * @param string $exclusions
1431
- * @param bool $regexp
1432
- *
1433
- * @return bool|string
1434
- */
1435
- function apbct_settings__sanitize__exclusions($exclusions, $regexp = false){
1436
- $result = array();
1437
- if( ! empty( $exclusions ) ){
1438
- $exclusions = explode( ',', $exclusions );
1439
- foreach ( $exclusions as $exclusion ){
1440
- $sanitized_exclusion = trim( $exclusion );
1441
- if ( ! empty( $sanitized_exclusion ) ) {
1442
- if( $regexp && ! apbct_is_regexp( $exclusion ) )
1443
- return false;
1444
- $result[] = $sanitized_exclusion;
1445
- }
1446
- }
1447
- }
1448
- return implode( ',', $result );
1449
- }
1450
-
1451
- function apbct_settings_show_gdpr_text($print = false){
1452
-
1453
- $out = wpautop('The notice requirements remain and are expanded. They must include the retention time for personal data, and contact information for data controller and data protection officer has to be provided.
1454
- Automated individual decision-making, including profiling (Article 22) is contestable, similarly to the Data Protection Directive (Article 15). Citizens have rights to question and fight significant decisions that affect them that have been made on a solely-algorithmic basis. Many media outlets have commented on the introduction of a "right to explanation" of algorithmic decisions, but legal scholars have since argued that the existence of such a right is highly unclear without judicial tests and is limited at best.
1455
- To be able to demonstrate compliance with the GDPR, the data controller should implement measures, which meet the principles of data protection by design and data protection by default. Privacy by design and by default (Article 25) require data protection measures to be designed into the development of business processes for products and services. Such measures include pseudonymising personal data, by the controller, as soon as possible (Recital 78).
1456
- It is the responsibility and the liability of the data controller to implement effective measures and be able to demonstrate the compliance of processing activities even if the processing is carried out by a data processor on behalf of the controller (Recital 74).
1457
- Data Protection Impact Assessments (Article 35) have to be conducted when specific risks occur to the rights and freedoms of data subjects. Risk assessment and mitigation is required and prior approval of the national data protection authorities (DPAs) is required for high risks. Data protection officers (Articles 37–39) are required to ensure compliance within organisations.
1458
- They have to be appointed:')
1459
- .'<ul style="padding: 0px 25px; list-style: disc;">'
1460
- .'<li>for all public authorities, except for courts acting in their judicial capacity</li>'
1461
- .'<li>if the core activities of the controller or the processor are:</li>'
1462
- .'<ul style="padding: 0px 25px; list-style: disc;">'
1463
- .'<li>processing operations, which, by virtue of their nature, their scope and/or their purposes, require regular and systematic monitoring of data subjects on a large scale</li>'
1464
- .'<li>processing on a large scale of special categories of data pursuant to Article 9 and personal data relating to criminal convictions and offences referred to in Article 10;</li>'
1465
- .'</ul>'
1466
- .'</li>'
1467
- .'</ul>';
1468
-
1469
- if($print) echo $out; else return $out;
1470
- }
1471
-
1472
- function apbct_settings__get__long_description(){
1473
-
1474
- global $apbct;
1475
-
1476
- check_ajax_referer('ct_secret_nonce' );
1477
-
1478
- $setting_id = $_POST['setting_id'] ? $_POST['setting_id'] : '';
1479
-
1480
- $descriptions = array(
1481
- 'white_label' => array(
1482
- 'title' => __( 'XSS check', 'cleantalk' ),
1483
- 'desc' => __( 'Cross-Site Scripting (XSS) — prevents malicious code to be executed/sent to any user. As a result malicious scripts can not get access to the cookie files, session tokens and any other confidential information browsers use and store. Such scripts can even overwrite content of HTML pages. CleanTalk WAF monitors for patterns of these parameters and block them.', 'cleantalk' ),
1484
- ),
1485
- 'white_label__hoster_key' => array(
1486
- 'title' => __( 'SQL-injection check', 'cleantalk' ),
1487
- 'desc' => __( 'SQL Injection — one of the most popular ways to hack websites and programs that work with databases. It is based on injection of a custom SQL code into database queries. It could transmit data through GET, POST requests or cookie files in an SQL code. If a website is vulnerable and execute such injections then it would allow attackers to apply changes to the website\'s MySQL database.', 'cleantalk' ),
1488
- ),
1489
- 'white_label__plugin_name' => array(
1490
- 'title' => __( 'Check uploaded files', 'cleantalk' ),
1491
- 'desc' => __( 'The option checks each uploaded file to a website for malicious code. If it\'s possible for visitors to upload files to a website, for instance a work resume, then attackers could abuse it and upload an infected file to execute it later and get access to your website.', 'cleantalk' ),
1492
- ),
1493
- );
1494
-
1495
- die(json_encode($descriptions[$setting_id]));
1496
  }
1
+ <?php
2
+
3
+ /**
4
+ * Admin action 'admin_menu' - Add the admin options page
5
+ */
6
+ function apbct_settings_add_page() {
7
+
8
+ global $apbct, $pagenow;
9
+
10
+ $parent_slug = is_network_admin() ? 'settings.php' : 'options-general.php';
11
+ $callback = is_network_admin() ? 'apbct_settings__display__network' : 'apbct_settings__display';
12
+
13
+ // Adding settings page
14
+ add_submenu_page(
15
+ $parent_slug,
16
+ $apbct->plugin_name.' '.__('settings'),
17
+ $apbct->plugin_name,
18
+ 'manage_options',
19
+ 'cleantalk',
20
+ $callback
21
+ );
22
+
23
+ if(!in_array($pagenow, array('options.php', 'options-general.php', 'settings.php', 'admin.php')))
24
+ return;
25
+
26
+ register_setting('cleantalk_settings', 'cleantalk_settings', 'apbct_settings__validate');
27
+
28
+ $fields = array();
29
+ $fields = apbct_settings__set_fileds($fields);
30
+ $fields = APBCT_WPMS && is_main_site() ? apbct_settings__set_fileds__network($fields) : $fields;
31
+ apbct_settings__add_groups_and_fields($fields);
32
+
33
+ }
34
+
35
+ function apbct_settings__set_fileds( $fields ){
36
+ global $apbct;
37
+
38
+ $fields = array(
39
+
40
+ 'main' => array(
41
+ 'title' => '',
42
+ 'default_params' => array(),
43
+ 'description' => '',
44
+ 'html_before' => '',
45
+ 'html_after' => '',
46
+ 'fields' => array(
47
+ 'action_buttons' => array(
48
+ 'callback' => 'apbct_settings__field__action_buttons',
49
+ ),
50
+ 'connection_reports' => array(
51
+ 'callback' => 'apbct_settings__field__statistics',
52
+ ),
53
+ 'api_key' => array(
54
+ 'display' => !$apbct->white_label || is_main_site(),
55
+ 'callback' => 'apbct_settings__field__apikey',
56
+ ),
57
+ ),
58
+ ),
59
+
60
+ 'state' => array(
61
+ 'title' => '',
62
+ 'default_params' => array(),
63
+ 'description' => '',
64
+ 'html_before' => '<hr style="width: 100%;">',
65
+ 'html_after' => '',
66
+ 'fields' => array(
67
+ 'state' => array(
68
+ 'callback' => 'apbct_settings__field__state',
69
+ ),
70
+ ),
71
+ ),
72
+
73
+ 'debug' => array(
74
+ 'title' => '',
75
+ 'default_params' => array(),
76
+ 'description' => '',
77
+ 'html_before' => '',
78
+ 'html_after' => '',
79
+ 'fields' => array(
80
+ 'state' => array(
81
+ 'callback' => 'apbct_settings__field__debug',
82
+ ),
83
+ ),
84
+ ),
85
+
86
+ // Different
87
+ 'different' => array(
88
+ 'title' => '',
89
+ 'default_params' => array(),
90
+ 'description' => '',
91
+ 'html_before' => '<hr>',
92
+ 'html_after' => '',
93
+ 'fields' => array(
94
+ 'spam_firewall' => array(
95
+ 'type' => 'checkbox',
96
+ 'title' => __('SpamFireWall', 'cleantalk'),
97
+ 'description' => __("This option allows to filter spam bots before they access website. Also reduces CPU usage on hosting server and accelerates pages load time.", 'cleantalk'),
98
+ ),
99
+ ),
100
+ ),
101
+
102
+ // Forms protection
103
+ 'forms_protection' => array(
104
+ 'title' => __('Forms to protect', 'cleantalk'),
105
+ 'default_params' => array(),
106
+ 'description' => '',
107
+ 'html_before' => '<hr><br>'
108
+ .'<span id="ct_adv_showhide">'
109
+ .'<a href="#" class="apbct_color--gray" onclick="event.preventDefault(); apbct_show_hide_elem(\'apbct_settings__davanced_settings\');">'
110
+ .__('Advanced settings', 'cleantalk')
111
+ .'</a>'
112
+ .'</span>'
113
+ .'<div id="apbct_settings__davanced_settings" style="display: none;">',
114
+ 'html_after' => '',
115
+ 'fields' => array(
116
+ 'registrations_test' => array(
117
+ 'title' => __('Registration Forms', 'cleantalk'),
118
+ 'description' => __('WordPress, BuddyPress, bbPress, S2Member, WooCommerce.', 'cleantalk'),
119
+ ),
120
+ 'comments_test' => array(
121
+ 'title' => __('Comments form', 'cleantalk'),
122
+ 'description' => __('WordPress, JetPack, WooCommerce.', 'cleantalk'),
123
+ ),
124
+ 'contact_forms_test' => array(
125
+ 'title' => __('Contact forms', 'cleantalk'),
126
+ 'description' => __('Contact Form 7, Formidable forms, JetPack, Fast Secure Contact Form, WordPress Landing Pages, Gravity Forms.', 'cleantalk'),
127
+ ),
128
+ 'general_contact_forms_test' => array(
129
+ 'title' => __('Custom contact forms', 'cleantalk'),
130
+ 'description' => __('Anti spam test for any WordPress themes or contacts forms.', 'cleantalk'),
131
+ ),
132
+ 'search_test' => array(
133
+ 'title' => __('Test default Wordpress search form for spam', 'cleantalk'),
134
+ 'description' => __('Spam protection for Search form.', 'cleantalk')
135
+ . (!$apbct->white_label || is_main_site()
136
+ ? sprintf(__('Read more about %sspam protection for Search form%s on our blog.', 'cleantalk'),
137
+ '<a href="https://blog.cleantalk.org/how-to-protect-website-search-from-spambots/" target="_blank">',
138
+ '</a>'
139
+ )
140
+ : ''
141
+ )
142
+ ),
143
+ 'check_external' => array(
144
+ 'title' => __('Protect external forms', 'cleantalk'),
145
+ 'description' => __('Turn this option on to protect forms on your WordPress that send data to third-part servers (like MailChimp).', 'cleantalk'),
146
+ 'childrens' => array('check_external__capture_buffer'),
147
+ ),
148
+ 'check_external__capture_buffer' => array(
149
+ 'title' => __('Capture buffer', 'cleantalk'),
150
+ 'description' => __('This setting gives you more sophisticated and strengthened protection for external forms. But it could break plugins which use a buffer like Ninja Forms.', 'cleantalk'),
151
+ 'class' => 'apbct_settings-field_wrapper--sub',
152
+ 'parent' => 'check_external',
153
+ ),
154
+ 'check_internal' => array(
155
+ 'title' => __('Protect internal forms', 'cleantalk'),
156
+ 'description' => __('This option will enable protection for custom (hand-made) AJAX forms with PHP scripts handlers on your WordPress.', 'cleantalk'),
157
+ ),
158
+ ),
159
+ ),
160
+
161
+ // Comments and Messages
162
+ 'wc' => array(
163
+ 'title' => __('WooCommerce', 'cleantalk'),
164
+ 'fields' => array(
165
+ 'wc_checkout_test' => array(
166
+ 'title' => __('WooCommerce checkout form', 'cleantalk'),
167
+ 'description' => __('Anti spam test for WooCommerce checkout form.', 'cleantalk'),
168
+ 'childrens' => array('wc_register_from_order')
169
+ ),
170
+ 'wc_register_from_order' => array(
171
+ 'title' => __('Spam test for registration during checkout', 'cleantalk'),
172
+ 'description' => __('Enable anti spam test for registration process which during woocommerce\'s checkout.', 'cleantalk'),
173
+ 'parent' => 'wc_checkout_test',
174
+ 'class' => 'apbct_settings-field_wrapper--sub',
175
+ 'reverse_trigger' => true
176
+ ),
177
+ ),
178
+ ),
179
+
180
+ // Comments and Messages
181
+ 'comments_and_messages' => array(
182
+ 'title' => __('Comments and Messages', 'cleantalk'),
183
+ 'fields' => array(
184
+ 'disable_comments__all' => array(
185
+ 'title' => __( 'Disable all comments', 'cleantalk' ),
186
+ 'description' => __( 'Disabling comments for all types of content.', 'cleantalk' ),
187
+ 'childrens' => array(
188
+ 'disable_comments__posts',
189
+ 'disable_comments__pages',
190
+ 'disable_comments__media',
191
+ ),
192
+ 'options' => array(
193
+ array( 'val' => 1, 'label' => __( 'On' ), 'childrens_enable' => 0, ),
194
+ array( 'val' => 0, 'label' => __( 'Off' ), 'childrens_enable' => 1, ),
195
+ ),
196
+ ),
197
+ 'disable_comments__posts' => array(
198
+ 'title' => __( 'Disable comments for all posts', 'cleantalk' ),
199
+ 'class' => 'apbct_settings-field_wrapper--sub',
200
+ 'parent' => 'disable_comments__all',
201
+ 'reverse_trigger' => true,
202
+ ),
203
+ 'disable_comments__pages' => array(
204
+ 'title' => __( 'Disable comments for all pages', 'cleantalk' ),
205
+ 'class' => 'apbct_settings-field_wrapper--sub',
206
+ 'parent' => 'disable_comments__all',
207
+ 'reverse_trigger' => true,
208
+ ),
209
+ 'disable_comments__media' => array(
210
+ 'title' => __( 'Disable comments for all media', 'cleantalk' ),
211
+ 'class' => 'apbct_settings-field_wrapper--sub',
212
+ 'parent' => 'disable_comments__all',
213
+ 'reverse_trigger' => true,
214
+ ),
215
+ 'bp_private_messages' => array(
216
+ 'title' => __('BuddyPress Private Messages', 'cleantalk'),
217
+ 'description' => __('Check buddyPress private messages.', 'cleantalk'),
218
+ ),
219
+ 'check_comments_number' => array(
220
+ 'title' => __("Don't check trusted user's comments", 'cleantalk'),
221
+ 'description' => sprintf(__("Don't check comments for users with above %d comments.", 'cleantalk'), defined('CLEANTALK_CHECK_COMMENTS_NUMBER') ? CLEANTALK_CHECK_COMMENTS_NUMBER : 3),
222
+ ),
223
+ 'remove_old_spam' => array(
224
+ 'title' => __('Automatically delete spam comments', 'cleantalk'),
225
+ 'description' => sprintf(__('Delete spam comments older than %d days.', 'cleantalk'), $apbct->data['spam_store_days']),
226
+ ),
227
+ 'remove_comments_links' => array(
228
+ 'title' => __('Remove links from approved comments', 'cleantalk'),
229
+ 'description' => __('Remove links from approved comments. Replace it with "[Link deleted]"', 'cleantalk'),
230
+ ),
231
+ 'show_check_links' => array(
232
+ 'title' => __('Show links to check Emails, IPs for spam.', 'cleantalk'),
233
+ 'description' => __('Shows little icon near IP addresses and Emails allowing you to check it via CleanTalk\'s database. Also allowing you to manage comments from the public post\'s page.', 'cleantalk'),
234
+ 'display' => !$apbct->white_label,
235
+ ),
236
+ ),
237
+ ),
238
+
239
+ // Data Processing
240
+ 'data_processing' => array(
241
+ 'title' => __('Data Processing', 'cleantalk'),
242
+ 'fields' => array(
243
+ 'protect_logged_in' => array(
244
+ 'title' => __("Protect logged in Users", 'cleantalk'),
245
+ 'description' => __('Turn this option on to check for spam any submissions (comments, contact forms and etc.) from registered Users.', 'cleantalk'),
246
+ ),
247
+ 'use_ajax' => array(
248
+ 'title' => __('Use AJAX for JavaScript check', 'cleantalk'),
249
+ 'description' => __('Options helps protect WordPress against spam with any caching plugins. Turn this option on to avoid issues with caching plugins.', 'cleantalk'),
250
+ ),
251
+ 'use_static_js_key' => array(
252
+ 'title' => __('Use static keys for JS check.', 'cleantalk'),
253
+ 'description' => __('Could help if you have cache for AJAX requests and you are dealing with false positives. Slightly decreases protection quality. Auto - Static key will be used if caching plugin is spotted.', 'cleantalk'),
254
+ 'options' => array(
255
+ array('val' => 1, 'label' => __('On'), ),
256
+ array('val' => 0, 'label' => __('Off'), ),
257
+ array('val' => -1, 'label' => __('Auto'),),
258
+ ),
259
+ ),
260
+ 'general_postdata_test' => array(
261
+ 'title' => __('Check all post data', 'cleantalk'),
262
+ 'description' => __('Check all POST submissions from website visitors. Enable this option if you have spam misses on website.', 'cleantalk')
263
+ .(!$apbct->white_label
264
+ ? __(' Or you don`t have records about missed spam here:', 'cleantalk') . '&nbsp;' . '<a href="https://cleantalk.org/my/?user_token='.$apbct->user_token.'&utm_source=wp-backend&utm_medium=admin-bar&cp_mode=antispam" target="_blank">' . __('CleanTalk dashboard', 'cleantalk') . '</a>.'
265
+ : ''
266
+ )
267
+ .'<br />' . __('СAUTION! Option can catch POST requests in WordPress backend', 'cleantalk'),
268
+ ),
269
+ 'set_cookies' => array(
270
+ 'title' => __("Set cookies", 'cleantalk'),
271
+ 'description' => __('Turn this option off to deny plugin generates any cookies on website front-end. This option is helpful if you use Varnish. But most of contact forms will not be protected if the option is turned off! <b>Warning: We strongly recommend you to enable this otherwise it could cause false positives spam detection.</b>', 'cleantalk'),
272
+ 'childrens' => array('set_cookies__sessions'),
273
+ ),
274
+ 'set_cookies__sessions' => array(
275
+ 'title' => __('Use alternative mechanism for cookies', 'cleantalk'),
276
+ 'description' => __('Doesn\'t use cookie or PHP sessions. Collect data for all types of bots.', 'cleantalk'),
277
+ 'parent' => 'set_cookies',
278
+ 'class' => 'apbct_settings-field_wrapper--sub',
279
+ ),
280
+ 'ssl_on' => array(
281
+ 'title' => __("Use SSL", 'cleantalk'),
282
+ 'description' => __('Turn this option on to use encrypted (SSL) connection with servers.', 'cleantalk'),
283
+ ),
284
+ 'use_buitin_http_api' => array(
285
+ 'title' => __("Use Wordpress HTTP API", 'cleantalk'),
286
+ 'description' => __('Alternative way to connect the Cloud. Use this if you have connection problems.', 'cleantalk'),
287
+ ),
288
+ ),
289
+ ),
290
+
291
+ // Exclusions
292
+ 'exclusions' => array(
293
+ 'title' => __('Exclusions', 'cleantalk'),
294
+ 'fields' => array(
295
+ 'exclusions__urls' => array(
296
+ 'type' => 'text',
297
+ 'title' => __('URL exclusions', 'cleantalk'),
298
+ 'description' => __('You could type here URL you want to exclude. Use comma as separator.', 'cleantalk'),
299
+ ),
300
+ 'exclusions__urls__use_regexp' => array(
301
+ 'type' => 'checkbox',
302
+ 'title' => __('Use Regular Expression in URL Exclusions', 'cleantalk'),
303
+ ),
304
+ 'exclusions__fields' => array(
305
+ 'type' => 'text',
306
+ 'title' => __('Field name exclusions', 'cleantalk'),
307
+ 'description' => __('You could type here fields names you want to exclude. Use comma as separator.', 'cleantalk'),
308
+ ),
309
+ 'exclusions__fields__use_regexp' => array(
310
+ 'type' => 'checkbox',
311
+ 'title' => __('Use Regular Expression in Field Exclusions', 'cleantalk'),
312
+ ),
313
+ 'exclusions__roles' => array(
314
+ 'type' => 'select',
315
+ 'multiple' => true,
316
+ 'options_callback' => 'apbct_get_all_roles',
317
+ 'options_callback_params' => array(true),
318
+ 'description' => __('Roles which bypass spam test. Hold CTRL to select multiple roles.', 'cleantalk'),
319
+ ),
320
+ ),
321
+ ),
322
+
323
+ // Admin bar
324
+ 'admin_bar' => array(
325
+ 'title' => __('Admin bar', 'cleantalk'),
326
+ 'default_params' => array(),
327
+ 'description' => '',
328
+ 'html_before' => '',
329
+ 'html_after' => '',
330
+ 'fields' => array(
331
+ 'show_adminbar' => array(
332
+ 'title' => __('Show statistics in admin bar', 'cleantalk'),
333
+ 'description' => __('Show/hide icon in top level menu in WordPress backend. The number of submissions is being counted for past 24 hours.', 'cleantalk'),
334
+ 'childrens' => array('all_time_counter','daily_counter','sfw_counter'),
335
+ ),
336
+ 'all_time_counter' => array(
337
+ 'title' => __('Show All-time counter', 'cleantalk'),
338
+ 'description' => __('Display all-time requests counter in the admin bar. Counter displays number of requests since plugin installation.', 'cleantalk'),
339
+ 'parent' => 'show_adminbar',
340
+ 'class' => 'apbct_settings-field_wrapper--sub',
341
+ ),
342
+ 'daily_counter' => array(
343
+ 'title' => __('Show 24 hours counter', 'cleantalk'),
344
+ 'description' => __('Display daily requests counter in the admin bar. Counter displays number of requests of the past 24 hours.', 'cleantalk'),
345
+ 'parent' => 'show_adminbar',
346
+ 'class' => 'apbct_settings-field_wrapper--sub',
347
+ ),
348
+ 'sfw_counter' => array(
349
+ 'title' => __('SpamFireWall counter', 'cleantalk'),
350
+ 'description' => __('Display SpamFireWall requests in the admin bar. Counter displays number of requests since plugin installation.', 'cleantalk'),
351
+ 'parent' => 'show_adminbar',
352
+ 'class' => 'apbct_settings-field_wrapper--sub',
353
+ ),
354
+ ),
355
+ ),
356
+
357
+ // Misc
358
+ 'misc' => array(
359
+ 'html_after' => '</div><br>',
360
+ 'fields' => array(
361
+ 'collect_details' => array(
362
+ 'type' => 'checkbox',
363
+ 'title' => __('Collect details about browsers', 'cleantalk'),
364
+ 'description' => __("Checking this box you allow plugin store information about screen size and browser plugins of website visitors. The option in a beta state.", 'cleantalk'),
365
+ ),
366
+ 'send_connection_reports' => array(
367
+ 'type' => 'checkbox',
368
+ 'title' => __('Send connection reports', 'cleantalk'),
369
+ 'description' => __("Checking this box you allow plugin to send the information about your connection. The option in a beta state.", 'cleantalk'),
370
+ ),
371
+ 'async_js' => array(
372
+ 'type' => 'checkbox',
373
+ 'title' => __('Async JavaScript loading', 'cleantalk'),
374
+ 'description' => __('Use async loading for scripts. Warning: This could reduce filtration quality.', 'cleantalk'),
375
+ ),
376
+ 'gdpr_enabled' => array(
377
+ 'type' => 'checkbox',
378
+ 'title' => __('Allow to add GDPR notice via shortcode', 'cleantalk'),
379
+ 'description' => __(' Adds small checkbox under your website form. To add it you should use the shortcode on the form\'s page: [cleantalk_gdpr_form id="FORM_ID"]', 'cleantalk'),
380
+ 'childrens' => array('gdpr_text'),
381
+ ),
382
+ 'gdpr_text' => array(
383
+ 'type' => 'text',
384
+ 'title' => __('GDPR text notice', 'cleantalk'),
385
+ 'description' => __('This text will be added as a description to the GDPR checkbox.', 'cleantalk'),
386
+ 'parent' => 'gdpr_enabled',
387
+ 'class' => 'apbct_settings-field_wrapper--sub',
388
+ ),
389
+ 'store_urls' => array(
390
+ 'type' => 'checkbox',
391
+ 'title' => __('Store visited URLs', 'cleantalk'),
392
+ 'description' => __("Plugin stores last 10 visited URLs (HTTP REFFERERS) before visitor submits form on the site. You can see stored visited URLS for each visitor in your Dashboard. Turn the option on to improve Anti-Spam protection.", 'cleantalk'),
393
+ 'childrens' => array('store_urls__sessions'),
394
+ ),
395
+ 'store_urls__sessions' => array(
396
+ 'type' => 'checkbox',
397
+ 'title' => __('Use cookies less sessions', 'cleantalk'),
398
+ 'description' => __('Doesn\'t use cookie or PHP sessions. Collect data for all types of bots.', 'cleantalk'),
399
+ 'parent' => 'store_urls',
400
+ 'class' => 'apbct_settings-field_wrapper--sub',
401
+ ),
402
+ 'comment_notify' => array(
403
+ 'type' => 'checkbox',
404
+ 'title' => __('Notify users with selected roles about new approved comments. Hold CTRL to select multiple roles.', 'cleantalk'),
405
+ 'description' => sprintf(__("If enabled, overrides similar Wordpress %sdiscussion settings%s.", 'cleantalk'), '<a href="options-discussion.php">','</a>'),
406
+ 'childrens' => array('comment_notify__roles'),
407
+ ),
408
+ 'comment_notify__roles' => array(
409
+ 'type' => 'select',
410
+ 'multiple' => true,
411
+ 'parent' => 'comment_notify',
412
+ 'options_callback' => 'apbct_get_all_roles',
413
+ 'options_callback_params' => array(true),
414
+ 'class' => 'apbct_settings-field_wrapper--sub',
415
+ ),
416
+ 'complete_deactivation' => array(
417
+ 'type' => 'checkbox',
418
+ 'title' => __('Complete deactivation', 'cleantalk'),
419
+ 'description' => __('Leave no trace in the system after deactivation.', 'cleantalk'),
420
+ ),
421
+
422
+ ),
423
+ ),
424
+ );
425
+
426
+ return $fields;
427
+ }
428
+
429
+ function apbct_settings__set_fileds__network( $fields ){
430
+ global $apbct;
431
+ $additional_fields = array(
432
+ 'main' => array(
433
+ 'fields' => array(
434
+ 'white_label' => array(
435
+ 'type' => 'checkbox',
436
+ 'title' => __('Enable White Label Mode', 'cleantalk'),
437
+ 'description' => sprintf(__("Learn more information %shere%s.", 'cleantalk'), '<a tearget="_blank" href="https://cleantalk.org/ru/help/hosting-white-label">', '</a>'),
438
+ 'childrens' => array('white_label__hoster_key', 'white_label__plugin_name', 'allow_custom_key'),
439
+ 'network' => true,
440
+ ),
441
+ 'white_label__hoster_key' => array(
442
+ 'title' => __('Hoster API Key', 'cleantalk'),
443
+ 'description' => sprintf(__("You can get it in %sCleantalk's Control Panel%s", 'cleantalk'), '<a tearget="_blank" href="https://cleantalk.org/my/?cp_mode=hosting-antispam">', '</a>'),
444
+ 'type' => 'text',
445
+ 'parent' => 'white_label',
446
+ 'class' => 'apbct_settings-field_wrapper--sub',
447
+ 'network' => true,
448
+ 'required' => true,
449
+ ),
450
+ 'white_label__plugin_name' => array(
451
+ 'title' => __('Plugin name', 'cleantalk'),
452
+ 'description' => sprintf(__("Specify plugin name. Leave empty for deafult %sAntispam by Cleantalk%s", 'cleantalk'), '<b>', '</b>'),
453
+ 'type' => 'text',
454
+ 'parent' => 'white_label',
455
+ 'class' => 'apbct_settings-field_wrapper--sub',
456
+ 'network' => true,
457
+ 'required' => true,
458
+ ),
459
+ 'allow_custom_key' => array(
460
+ 'type' => 'checkbox',
461
+ 'title' => __('Allow users to use other key', 'cleantalk'),
462
+ 'description' => __('Allow users to use different Access key in their plugin settings on child blogs. They could use different CleanTalk account.', 'cleantalk')
463
+ . (defined('CLEANTALK_ACCESS_KEY')
464
+ ? ' <span style="color: red">'
465
+ . __('Constant <b>CLEANTALK_ACCESS_KEY</b> is set. All websites will use API key from this constant. Look into wp-config.php', 'cleantalk')
466
+ . '</span>'
467
+ : ''
468
+ ),
469
+ 'display' => APBCT_WPMS && is_main_site(),
470
+ 'disabled' => $apbct->network_settings['white_label'],
471
+ 'network' => true,
472
+ ),
473
+ )
474
+ )
475
+ );
476
+
477
+ $fields = array_merge_recursive($fields, $additional_fields);
478
+
479
+ return $fields;
480
+
481
+ }
482
+
483
+ function apbct_settings__add_groups_and_fields( $fields ){
484
+
485
+ global $apbct;
486
+
487
+ $apbct->settings_fields_in_groups = $fields;
488
+
489
+ $field_default_params = array(
490
+ 'callback' => 'apbct_settings__field__draw',
491
+ 'type' => 'radio',
492
+ 'options' => array(
493
+ array('val' => 1, 'label' => __('On'), 'childrens_enable' => 1, ),
494
+ array('val' => 0, 'label' => __('Off'), 'childrens_enable' => 0, ),
495
+ ),
496
+ 'def_class' => 'apbct_settings-field_wrapper',
497
+ 'class' => '',
498
+ 'parent' => '',
499
+ 'childrens' => array(),
500
+ 'hide' => array(),
501
+ // 'title' => 'Default title',
502
+ // 'description' => 'Default description',
503
+ 'display' => true, // Draw settings or not
504
+ 'reverse_trigger' => false, // How to allow child settings. Childrens are opened when the parent triggered "ON". This is overrides by this option
505
+ 'multiple' => false,
506
+ 'description' => '',
507
+ 'network' => false,
508
+ 'disabled' => false,
509
+ 'required' => false,
510
+ );
511
+
512
+ foreach($apbct->settings_fields_in_groups as $group_name => $group){
513
+
514
+ add_settings_section('apbct_section__'.$group_name, '', 'apbct_section__'.$group_name, 'cleantalk');
515
+
516
+ foreach($group['fields'] as $field_name => $field){
517
+
518
+ // Normalize $field['options'] from callback function to this type array( array( 'val' => 1, 'label' => __('On'), ), )
519
+ if(!empty($field['options_callback'])){
520
+ $options = call_user_func_array($field['options_callback'], !empty($field['options_callback_params']) ? $field['options_callback_params'] : array());
521
+ foreach ($options as &$option){
522
+ $option = array('val' => $option, 'label' => $option);
523
+ } unset($option);
524
+ $field['options'] = $options;
525
+ }
526
+
527
+ $params = !empty($group['default_params'])
528
+ ? array_merge($group['default_params'], $field)
529
+ : array_merge($field_default_params, $field);
530
+
531
+ $params['name'] = $field_name;
532
+
533
+ if(!$params['display'])
534
+ continue;
535
+
536
+ add_settings_field(
537
+ 'apbct_field__'.$field_name,
538
+ '',
539
+ $params['callback'],
540
+ 'cleantalk',
541
+ 'apbct_section__'.$group_name,
542
+ $params
543
+ );
544
+
545
+ }
546
+ }
547
+ }
548
+
549
+ /**
550
+ * Admin callback function - Displays plugin options page
551
+ */
552
+ function apbct_settings__display() {
553
+
554
+ global $apbct;
555
+
556
+ // Title
557
+ echo '<h2 class="apbct_settings-title">'.__($apbct->plugin_name, 'cleantalk').'</h2>';
558
+
559
+ // Subtitle for IP license
560
+ if($apbct->moderate_ip)
561
+ echo '<h4 class="apbct_settings-subtitle apbct_color--gray">'. __('Hosting AntiSpam', 'cleantalk').'</h4>';
562
+
563
+ echo '<form action="options.php" method="post">';
564
+
565
+ apbct_settings__error__output();
566
+
567
+ // Top info
568
+ if(!$apbct->white_label){
569
+ echo '<div style="float: right; padding: 15px 15px 5px 15px; font-size: 13px; position: relative; background: #f1f1f1;">';
570
+
571
+ echo __('CleanTalk\'s tech support:', 'cleantalk')
572
+ .'&nbsp;'
573
+ .'<a target="_blank" href="https://wordpress.org/support/plugin/cleantalk-spam-protect">Wordpress.org</a>.'
574
+ // .' <a href="https://community.cleantalk.org/viewforum.php?f=25" target="_blank">'.__("Tech forum", 'cleantalk').'</a>'
575
+ // .($user_token ? ", <a href='https://cleantalk.org/my/support?user_token=$user_token&cp_mode=antispam' target='_blank'>".__("Service support ", 'cleantalk').'</a>' : '').
576
+ .'<br>';
577
+ echo __('Plugin Homepage at', 'cleantalk').' <a href="https://cleantalk.org" target="_blank">cleantalk.org</a>.<br/>';
578
+ echo '<span id="apbct_gdpr_open_modal" style="text-decoration: underline;">'.__('GDPR compliance', 'cleantalk').'</span><br/>';
579
+ echo __('Use s@cleantalk.org to test plugin in any WordPress form.', 'cleantalk').'<br>';
580
+ echo __('CleanTalk is registered Trademark. All rights reserved.', 'cleantalk').'<br/>';
581
+ if($apbct->key_is_ok)
582
+ echo '<b style="display: inline-block; margin-top: 10px;">'.sprintf(__('Do you like CleanTalk? %sPost your feedback here%s.', 'cleantalk'), '<a href="https://wordpress.org/support/plugin/cleantalk-spam-protect/reviews/#new-post" target="_blank">', '</a>').'</b><br />';
583
+ apbct_admin__badge__get_premium();
584
+ echo '<div id="gdpr_dialog" style="display: none; padding: 7px;">';
585
+ apbct_settings_show_gdpr_text('print');
586
+ echo '</div>';
587
+ echo '</div>';
588
+ }
589
+
590
+ // Output spam count
591
+ if($apbct->key_is_ok && apbct_api_key__is_correct()){
592
+ if($apbct->spam_count > 0){
593
+ echo '<div class="apbct_settings-subtitle" style="top: 0; margin-bottom: 10px; width: 200px;">'
594
+ .'<br>'
595
+ .'<span>'
596
+ .sprintf(
597
+ __( '%s has blocked <b>%s</b> spam.', 'cleantalk' ),
598
+ $apbct->plugin_name,
599
+ number_format($apbct->spam_count, 0, ',', ' ')
600
+ )
601
+ .'</span>'
602
+ .'<br>'
603
+ .'<br>'
604
+ .'</div>';
605
+ }
606
+ if(!$apbct->white_label){
607
+ // CP button
608
+ echo '<a class="cleantalk_link cleantalk_link-manual" target="__blank" href="https://cleantalk.org/my?user_token='.$apbct->user_token.'&cp_mode=antispam">'
609
+ .__('Click here to get anti-spam statistics', 'cleantalk')
610
+ .'</a>';
611
+ echo '&nbsp;&nbsp;';
612
+ // Support button
613
+ echo '<a class="cleantalk_link cleantalk_link-auto" target="__blank" href="https://wordpress.org/support/plugin/cleantalk-spam-protect">'.__('Support', 'cleantalk').'</a>';
614
+ echo '<br>'
615
+ .'<br>';
616
+ }
617
+ }
618
+
619
+ settings_fields('cleantalk_settings');
620
+ do_settings_fields('cleantalk', 'cleantalk_section_settings_main');
621
+
622
+ foreach($apbct->settings_fields_in_groups as $group_name => $group){
623
+
624
+ echo !empty($group['html_before']) ? $group['html_before'] : '';
625
+ echo !empty($group['title']) ? '<h3 style="margin-left: 220px;">'.$group['title'].'</h3>' : '';
626
+
627
+ do_settings_fields('cleantalk', 'apbct_section__'.$group_name);
628
+
629
+ echo !empty($group['html_after']) ? $group['html_after'] : '';
630
+
631
+ }
632
+
633
+ echo '<br>';
634
+ echo '<button name="submit" class="cleantalk_link cleantalk_link-manual" value="save_changes">'.__('Save Changes').'</button>';
635
+
636
+ echo "</form>";
637
+
638
+ if(!$apbct->white_label){
639
+ // Translate banner for non EN locale
640
+ if(substr(get_locale(), 0, 2) != 'en'){
641
+ global $ct_translate_banner_template;
642
+ require_once(CLEANTALK_PLUGIN_DIR.'templates/translate_banner.php');
643
+ printf($ct_translate_banner_template, substr(get_locale(), 0, 2));
644
+ }
645
+ }
646
+ }
647
+
648
+ function apbct_settings__display__network(){
649
+ // If it's network admin dashboard
650
+ if(is_network_admin()){
651
+ $site_url = get_site_option('siteurl');
652
+ $site_url = preg_match( '/\/$/', $site_url ) ? $site_url : $site_url . '/';
653
+ $link = $site_url . 'wp-admin/options-general.php?page=cleantalk';
654
+ printf("<h2>" . __("Please, enter the %splugin settings%s in main site dashboard.", 'cleantalk') . "</h2>", "<a href='$link'>", "</a>");
655
+ return;
656
+ }
657
+ }
658
+
659
+ function apbct_settings__error__output($return = false){
660
+
661
+ global $apbct;
662
+
663
+ // If have error message output error block.
664
+
665
+ $out = '';
666
+
667
+ if(!empty($apbct->errors) && !defined('CLEANTALK_ACCESS_KEY')){
668
+
669
+ $errors = $apbct->errors;
670
+
671
+ $error_texts = array(
672
+ // Misc
673
+ 'key_invalid' => __('Error occured while API key validating. Error: ', 'cleantalk'),
674
+ 'key_get' => __('Error occured while automatically gettings access key. Error: ', 'cleantalk'),
675
+ 'sfw_send_logs' => __('Error occured while sending sending SpamFireWall logs. Error: ', 'cleantalk'),
676
+ 'sfw_update' => __('Error occured while updating SpamFireWall local base. Error: ' , 'cleantalk'),
677
+ 'account_check' => __('Error occured while checking account status. Error: ', 'cleantalk'),
678
+ 'api' => __('Error occured while excuting API call. Error: ', 'cleantalk'),
679
+
680
+ // Validating settings
681
+ 'settings_validate' => 'Validate Settings',
682
+ 'exclusions_urls' => 'URL Exclusions',
683
+ 'exclusions_fields' => 'Field Exclusions',
684
+
685
+ // Unknown
686
+ 'unknown' => __('Unknown error. Error: ', 'cleantalk'),
687
+ );
688
+
689
+ $errors_out = array();
690
+
691
+ foreach($errors as $type => $error){
692
+
693
+ if(!empty($error)){
694
+
695
+ if(is_array(current($error))){
696
+
697
+ foreach($error as $sub_type => $sub_error){
698
+ $errors_out[$sub_type] = '';
699
+ if(isset($sub_error['error_time']))
700
+ $errors_out[$sub_type] .= date('Y-m-d H:i:s', $sub_error['error_time']) . ': ';
701
+ $errors_out[$sub_type] .= (isset($error_texts[$type]) ? $error_texts[$type] : ucfirst($type)) . ': ';
702
+ $errors_out[$sub_type] .= (isset($error_texts[$sub_type]) ? $error_texts[$sub_type] : $error_texts['unknown']) . ' ' . $sub_error['error'];
703
+ }
704
+ continue;
705
+ }
706
+
707
+ $errors_out[$type] = '';
708
+ if(isset($error['error_time']))
709
+ $errors_out[$type] .= date('Y-m-d H:i:s', $error['error_time']) . ': ';
710
+ $errors_out[$type] .= (isset($error_texts[$type]) ? $error_texts[$type] : $error_texts['unknown']) . ' ' . (isset($error['error']) ? $error['error'] : '');
711
+
712
+ }
713
+ }
714
+
715
+ if(!empty($errors_out)){
716
+ $out .= '<div id="apbctTopWarning" class="error" style="position: relative;">'
717
+ .'<h3 style="display: inline-block;">'.__('Errors:', 'cleantalk').'</h3>';
718
+ foreach($errors_out as $value){
719
+ $out .= '<h4>'.$value.'</h4>';
720
+ }
721
+ $out .= !$apbct->white_label
722
+ ? '<h4 style="text-align: unset;">'.sprintf(__('You can get support any time here: %s.', 'cleantalk'), '<a target="blank" href="https://wordpress.org/support/plugin/cleantalk-spam-protect">https://wordpress.org/support/plugin/cleantalk-spam-protect</a>').'</h4>'
723
+ : '';
724
+ $out .= '</div>';
725
+ }
726
+ }
727
+
728
+ if($return) return $out; else echo $out;
729
+ }
730
+
731
+ function apbct_settings__field__debug(){
732
+
733
+ global $apbct;
734
+
735
+ if($apbct->debug){
736
+
737
+ echo '<hr /><h2>Debug:</h2>';
738
+ echo '<h4>Constants:</h4>';
739
+ echo 'CLEANTALK_AJAX_USE_BUFFER '. (defined('CLEANTALK_AJAX_USE_BUFFER') ? (CLEANTALK_AJAX_USE_BUFFER ? 'true' : 'flase') : 'NOT_DEFINED')."<br>";
740
+ echo 'CLEANTALK_AJAX_USE_FOOTER_HEADER '. (defined('CLEANTALK_AJAX_USE_FOOTER_HEADER') ? (CLEANTALK_AJAX_USE_FOOTER_HEADER ? 'true' : 'flase') : 'NOT_DEFINED')."<br>";
741
+ echo 'CLEANTALK_ACCESS_KEY '. (defined('CLEANTALK_ACCESS_KEY') ? (CLEANTALK_ACCESS_KEY ? CLEANTALK_ACCESS_KEY : 'flase') : 'NOT_DEFINED')."<br>";
742
+ echo 'CLEANTALK_CHECK_COMMENTS_NUMBER '. (defined('CLEANTALK_CHECK_COMMENTS_NUMBER') ? (CLEANTALK_CHECK_COMMENTS_NUMBER ? CLEANTALK_CHECK_COMMENTS_NUMBER : 0) : 'NOT_DEFINED')."<br>";
743
+ echo 'CLEANTALK_CHECK_MESSAGES_NUMBER '. (defined('CLEANTALK_CHECK_MESSAGES_NUMBER') ? (CLEANTALK_CHECK_MESSAGES_NUMBER ? CLEANTALK_CHECK_MESSAGES_NUMBER : 0) : 'NOT_DEFINED')."<br>";
744
+ echo 'CLEANTALK_PLUGIN_DIR '. (defined('CLEANTALK_PLUGIN_DIR') ? (CLEANTALK_PLUGIN_DIR ? CLEANTALK_PLUGIN_DIR : 'flase') : 'NOT_DEFINED')."<br>";
745
+ echo 'WP_ALLOW_MULTISITE '. (defined('WP_ALLOW_MULTISITE') ? (WP_ALLOW_MULTISITE ? 'true' : 'flase') : 'NOT_DEFINED');
746
+
747
+ echo "<h4>Debug log: <button type='submit' value='debug_drop' name='submit' style='font-size: 11px; padding: 1px;'>Drop debug data</button></h4>";
748
+ echo "<div style='height: 500px; width: 80%; overflow: auto;'>";
749
+
750
+ $output = print_r($apbct->debug, true);
751
+ $output = str_replace("\n", "<br>", $output);
752
+ $output = preg_replace("/[^\S]{4}/", "&nbsp;&nbsp;&nbsp;&nbsp;", $output);
753
+ echo "$output";
754
+
755
+ echo "</div>";
756
+
757
+ }
758
+ }
759
+
760
+ function apbct_settings__field__state(){
761
+
762
+ global $apbct;
763
+
764
+ $path_to_img = plugin_dir_url(__FILE__) . "images/";
765
+
766
+ $img = $path_to_img."yes.png";
767
+ $img_no = $path_to_img."no.png";
768
+ $img_no_gray = $path_to_img."no_gray.png";
769
+ $color="black";
770
+
771
+ if(!$apbct->key_is_ok){
772
+ $img=$path_to_img."no.png";
773
+ $img_no=$path_to_img."no.png";
774
+ $color="black";
775
+ }
776
+
777
+ if(!apbct_api_key__is_correct($apbct->api_key)){
778
+ $img = $path_to_img."yes_gray.png";
779
+ $img_no = $path_to_img."no_gray.png";
780
+ $color="gray";
781
+ }
782
+
783
+ if($apbct->moderate_ip){
784
+ $img = $path_to_img."yes.png";
785
+ $img_no = $path_to_img."no.png";
786
+ $color="black";
787
+ }
788
+
789
+ if($apbct->moderate == 0){
790
+ $img = $path_to_img."no.png";
791
+ $img_no = $path_to_img."no.png";
792
+ $color="black";
793
+ }
794
+
795
+ print '<div class="apbct_settings-field_wrapper" style="color:'.$color.'">';
796
+
797
+ print '<h2>'.__('Protection is active', 'cleantalk').'</h2>';
798
+
799
+ echo '<img class="apbct_status_icon" src="'.($apbct->settings['registrations_test'] == 1 ? $img : $img_no).'"/>'.__('Registration forms', 'cleantalk');
800
+ echo '<img class="apbct_status_icon" src="'.($apbct->settings['comments_test']==1 ? $img : $img_no).'"/>'.__('Comments forms', 'cleantalk');
801
+ echo '<img class="apbct_status_icon" src="'.($apbct->settings['contact_forms_test']==1 ? $img : $img_no).'"/>'.__('Contact forms', 'cleantalk');
802
+ echo '<img class="apbct_status_icon" src="'.($apbct->settings['general_contact_forms_test']==1 ? $img : $img_no).'"/>'.__('Custom contact forms', 'cleantalk');
803
+ if(!$apbct->white_label || is_main_site())
804
+ echo '<img class="apbct_status_icon" src="'.($apbct->data['moderate'] == 1 ? $img : $img_no).'"/>'
805
+ .'<a style="color: black" href="https://blog.cleantalk.org/real-time-email-address-existence-validation/">'.__('Validate email for existence', 'cleantalk').'</a>';
806
+
807
+ // Autoupdate status
808
+ if($apbct->notice_auto_update && (!$apbct->white_label || is_main_site())){
809
+ echo '<img class="apbct_status_icon" src="'.($apbct->auto_update == 1 ? $img : ($apbct->auto_update == -1 ? $img_no : $img_no_gray)).'"/>'.__('Auto update', 'cleantalk')
810
+ .' <sup><a href="https://cleantalk.org/help/cleantalk-auto-update" target="_blank">?</a></sup>';
811
+ }
812
+
813
+ // WooCommerce
814
+ if(class_exists('WooCommerce'))
815
+ echo '<img class="apbct_status_icon" src="'.($apbct->settings['wc_checkout_test'] == 1 ? $img : $img_no).'"/>'.__('WooCommerce checkout form', 'cleantalk');
816
+ if($apbct->moderate_ip)
817
+ print "<br /><br />The anti-spam service is paid by your hosting provider. License #".$apbct->data['ip_license'].".<br />";
818
+
819
+ print "</div>";
820
+ }
821
+
822
+ /**
823
+ * Admin callback function - Displays inputs of 'apikey' plugin parameter
824
+ */
825
+ function apbct_settings__field__apikey(){
826
+
827
+ global $apbct;
828
+
829
+ echo '<div id="cleantalk_apikey_wrapper" class="apbct_settings-field_wrapper">';
830
+
831
+ // Using key from Main site, or from CLEANTALK_ACCESS_KEY constant
832
+ if(APBCT_WPMS && !is_main_site() && (!$apbct->allow_custom_key || defined('CLEANTALK_ACCESS_KEY'))){
833
+ _e('<h3>Key is provided by Super Admin.</h3>', 'cleantalk');
834
+ return;
835
+ }
836
+
837
+ echo '<label class="apbct_settings__label" for="cleantalk_apkey">' . __('Access key', 'cleantalk') . '</label>';
838
+
839
+ echo '<input
840
+ id="apbct_setting_apikey"
841
+ class="apbct_setting_text apbct_setting---apikey"
842
+ type="text"
843
+ name="cleantalk_settings[apikey]"
844
+ value="'
845
+ . ($apbct->key_is_ok
846
+ ? str_repeat('*', strlen($apbct->api_key))
847
+ : $apbct->api_key
848
+ )
849
+ . '"
850
+ key="' . $apbct->api_key . '"
851
+ size="20"
852
+ placeholder="' . __('Enter the key', 'cleantalk') . '"'
853
+ . ' />';
854
+
855
+ // Show account name associated with key
856
+ if(!empty($apbct->data['account_name_ob'])){
857
+ echo '<div class="apbct_display--none">'
858
+ . sprintf( __('Account at cleantalk.org is %s.', 'cleantalk'),
859
+ '<b>'.$apbct->data['account_name_ob'].'</b>'
860
+ )
861
+ . '</div>';
862
+ };
863
+
864
+ // Show key button
865
+ if((apbct_api_key__is_correct($apbct->api_key) && $apbct->key_is_ok)){
866
+ echo '<a id="apbct_showApiKey" class="ct_support_link" style="display: block" href="#">'
867
+ . __('Show the access key', 'cleantalk')
868
+ . '</a>';
869
+
870
+ // "Auto Get Key" buttons. License agreement
871
+ }else{
872
+
873
+ echo '<br /><br />';
874
+
875
+ // Auto get key
876
+ if(!$apbct->ip_license){
877
+ echo '<button class="cleantalk_link cleantalk_link-manual apbct_setting---get_key_auto" name="submit" type="submit" value="get_key_auto">'
878
+ .__('Get Access Key Automatically', 'cleantalk')
879
+ .'</button>';
880
+ echo '<input type="hidden" id="ct_admin_timezone" name="ct_admin_timezone" value="null" />';
881
+ echo '<br />';
882
+ echo '<br />';
883
+ }
884
+
885
+ // Warnings and GDPR
886
+ printf( __('Admin e-mail (%s) will be used for registration, if you want to use other email please %sGet Access Key Manually%s.', 'cleantalk'),
887
+ ct_get_admin_email(),
888
+ '<a class="apbct_color--gray" target="__blank" href="'
889
+ . sprintf( 'https://cleantalk.org/register?platform=wordpress&email=%s&website=%s',
890
+ urlencode(ct_get_admin_email()),
891
+ urlencode(parse_url(get_option('siteurl'),PHP_URL_HOST))
892
+ )
893
+ . '">',
894
+ '</a>'
895
+ );
896
+
897
+ // License agreement
898
+ if(!$apbct->ip_license){
899
+ echo '<div>';
900
+ echo '<input checked type="checkbox" id="license_agreed" onclick="apbctSettingsDependencies(\'apbct_setting---get_key_auto\');"/>';
901
+ echo '<label for="spbc_license_agreed">';
902
+ printf( __('I accept %sLicense Agreement%s.', 'cleantalk'),
903
+ '<a class = "apbct_color--gray" href="https://cleantalk.org/publicoffer" target="_blank">',
904
+ '</a>'
905
+ );
906
+ echo "</label>";
907
+ echo '</div>';
908
+ }
909
+ }
910
+
911
+ echo '</div>';
912
+ }
913
+
914
+ function apbct_settings__field__action_buttons(){
915
+
916
+ global $apbct;
917
+
918
+ echo '<div class="apbct_settings-field_wrapper">';
919
+
920
+ if(apbct_api_key__is_correct($apbct->api_key) && $apbct->key_is_ok){
921
+ echo '<div>'
922
+ .'<a href="edit-comments.php?page=ct_check_spam" class="ct_support_link">' . __('Check comments for spam', 'cleantalk') . '</a>'
923
+ .'&nbsp;&nbsp;'
924
+ .'&nbsp;&nbsp;'
925
+ .'<a href="users.php?page=ct_check_users" class="ct_support_link">' . __('Check users for spam', 'cleantalk') . '</a>'
926
+ .'&nbsp;&nbsp;'
927
+ .'&nbsp;&nbsp;'
928
+ .'<a href="#" class="ct_support_link" onclick="apbct_show_hide_elem(\'apbct_statistics\')">' . __('Statistics & Reports', 'cleantalk') . '</a>'
929
+ .'</div>';
930
+
931
+ }
932
+
933
+ echo '</div>';
934
+ }
935
+
936
+ function apbct_settings__field__statistics() {
937
+
938
+ global $apbct, $wpdb;
939
+
940
+ echo '<div id="apbct_statistics" class="apbct_settings-field_wrapper" style="display: none;">';
941
+
942
+ // Last request
943
+ printf(
944
+ __('Last spam check request to %s server was at %s.', 'cleantalk'),
945
+ $apbct->stats['last_request']['server'] ? $apbct->stats['last_request']['server'] : __('unknown', 'cleantalk'),
946
+ $apbct->stats['last_request']['time'] ? date('M d Y H:i:s', $apbct->stats['last_request']['time']) : __('unknown', 'cleantalk')
947
+ );
948
+ echo '<br>';
949
+
950
+ // Avarage time request
951
+ printf(
952
+ __('Average request time for past 7 days: %s seconds.', 'cleantalk'),
953
+ $apbct->stats['requests'][min(array_keys($apbct->stats['requests']))]['average_time']
954
+ ? round($apbct->stats['requests'][min(array_keys($apbct->stats['requests']))]['average_time'], 3)
955
+ : __('unknown', 'cleantalk')
956
+ );
957
+ echo '<br>';
958
+
959
+ // SFW last die
960
+ printf(
961
+ __('Last time SpamFireWall was triggered for %s IP at %s', 'cleantalk'),
962
+ $apbct->stats['last_sfw_block']['ip'] ? $apbct->stats['last_sfw_block']['ip'] : __('unknown', 'cleantalk'),
963
+ $apbct->stats['last_sfw_block']['time'] ? date('M d Y H:i:s', $apbct->stats['last_sfw_block']['time']) : __('unknown', 'cleantalk')
964
+ );
965
+ echo '<br>';
966
+
967
+ // SFW last update
968
+ $sfw_netwoks_amount = $wpdb->get_results("SELECT count(*) AS cnt FROM `".$wpdb->prefix."cleantalk_sfw`", ARRAY_A);
969
+ printf(
970
+ __('SpamFireWall was updated %s. Now contains %s entries.', 'cleantalk'),
971
+ $apbct->stats['sfw']['last_update_time'] ? date('M d Y H:i:s', $apbct->stats['sfw']['last_update_time']) : __('unknown', 'cleantalk'),
972
+ isset($sfw_netwoks_amount[0]['cnt']) ? $sfw_netwoks_amount[0]['cnt'] : __('unknown', 'cleantalk')
973
+ );
974
+ echo '<br>';
975
+
976
+ // SFW last sent logs
977
+ printf(
978
+ __('SpamFireWall sent %s events at %s.', 'cleantalk'),
979
+ $apbct->stats['sfw']['last_send_amount'] ? $apbct->stats['sfw']['last_send_amount'] : __('unknown', 'cleantalk'),
980
+ $apbct->stats['sfw']['last_send_time'] ? date('M d Y H:i:s', $apbct->stats['sfw']['last_send_time']) : __('unknown', 'cleantalk')
981
+ );
982
+ echo '<br>';
983
+
984
+ // Connection reports
985
+ if ($apbct->connection_reports){
986
+
987
+ if ($apbct->connection_reports['negative'] == 0){
988
+ _e('There are no failed connections to server.', 'cleantalk');
989
+ }else{
990
+ echo "<table id='negative_reports_table''>
991
+ <tr>
992
+ <td>#</td>
993
+ <td><b>Date</b></td>
994
+ <td><b>Page URL</b></td>
995
+ <td><b>Report</b></td>
996
+ <td><b>Server IP</b></td>
997
+ </tr>";
998
+ foreach($apbct->connection_reports['negative_report'] as $key => $report){
999
+ echo '<tr>'
1000
+ . '<td>'.($key+1).'.</td>'
1001
+ . '<td>'.$report['date'].'</td>'
1002
+ . '<td>'.$report['page_url'].'</td>'
1003
+ . '<td>'.$report['lib_report'].'</td>'
1004
+ . '<td>'.$report['work_url'].'</td>'
1005
+ . '</tr>';
1006
+ }
1007
+ echo "</table>";
1008
+ echo '<br/>';
1009
+ echo '<button'
1010
+ . ' name="submit"'
1011
+ . ' class="cleantalk_link cleantalk_link-manual"'
1012
+ . ' value="ct_send_connection_report"'
1013
+ . (!$apbct->settings['send_connection_reports'] ? ' disabled="disabled"' : '')
1014
+ . '>'
1015
+ .__('Send report', 'cleantalk')
1016
+ .'</button>';
1017
+ if (!$apbct->settings['send_connection_reports']){
1018
+ echo '<br><br>';
1019
+ _e('Please, enable "Send connection reports" setting to be able to send reports', 'cleantalk');
1020
+ }
1021
+ }
1022
+
1023
+ }
1024
+
1025
+ echo '</div>';
1026
+ }
1027
+
1028
+ /**
1029
+ * Get all current Wordpress roles, could except 'subscriber' role
1030
+ *
1031
+ * @param bool $except_subscriber
1032
+ *
1033
+ * @return array
1034
+ */
1035
+ function apbct_get_all_roles($except_subscriber = false) {
1036
+
1037
+ global $wp_roles;
1038
+
1039
+ $wp_roles = new WP_Roles();
1040
+ $roles = $wp_roles->get_names();
1041
+
1042
+ if($except_subscriber) {
1043
+ $key = array_search( 'Subscriber', $roles );
1044
+ if ( $key !== false ) {
1045
+ unset( $roles[ $key ] );
1046
+ }
1047
+ }
1048
+
1049
+ return $roles;
1050
+ }
1051
+
1052
+ function apbct_settings__field__draw($params = array()){
1053
+
1054
+ global $apbct;
1055
+
1056
+ $value = $params['network'] ? $apbct->network_settings[$params['name']] : $apbct->settings[$params['name']];
1057
+ $value_parent = $params['parent']
1058
+ ? ($params['network'] ? $apbct->network_settings[$params['parent']] : $apbct->settings[$params['parent']])
1059
+ : false;
1060
+
1061
+ $disabled = $params['parent'] && !$value_parent ? ' disabled="disabled"' : '';
1062
+ $disabled = $params['disabled'] ? ' disabled="disabled"' : $disabled;
1063
+
1064
+ $childrens = $params['childrens'] ? 'apbct_setting---' . implode(",apbct_setting---",$params['childrens']) : '';
1065
+ $hide = $params['hide'] ? implode(",",$params['hide']) : '';
1066
+
1067
+ echo '<div class="'.$params['def_class'].(isset($params['class']) ? ' '.$params['class'] : '').'">';
1068
+
1069
+ switch($params['type']){
1070
+
1071
+ // Checkbox type
1072
+ case 'checkbox':
1073
+ echo '<input
1074
+ type="checkbox"
1075
+ name="cleantalk_settings['.$params['name'].']"
1076
+ id="apbct_setting_'.$params['name'].'"
1077
+ value="1" '
1078
+ ." class='apbct_setting_{$params['type']} apbct_setting---{$params['name']}'"
1079
+ .($value == '1' ? ' checked' : '')
1080
+ .$disabled
1081
+ .($params['required'] ? ' required="required"' : '')
1082
+ .' onchange="'
1083
+ . ($params['childrens'] ? ' apbctSettingsDependencies(\''. $childrens .'\');' : '')
1084
+ . ($params['hide'] ? ' apbct_show_hide_elem(\''. $hide . '\');' : '')
1085
+ . '"'
1086
+ .' />'
1087
+ .'<label for="apbct_setting_'.$params['name'].'" class="apbct_setting-field_title--'.$params['type'].'">'
1088
+ .$params['title']
1089
+ .'</label>';
1090
+ echo isset($params['long_description'])
1091
+ ? '<i setting="'.$params['name'].'" class="apbct_settings-long_description---show icon-help-circled"></i>'
1092
+ : '';
1093
+ echo '<div class="apbct_settings-field_description">'
1094
+ .$params['description']
1095
+ .'</div>';
1096
+ break;
1097
+
1098
+ // Radio type
1099
+ case 'radio':
1100
+
1101
+ // Title
1102
+ echo isset($params['title'])
1103
+ ? '<h4 class="apbct_settings-field_title apbct_settings-field_title--'.$params['type'].'">'.$params['title'].'</h4>'
1104
+ : '';
1105
+
1106
+ // Popup description
1107
+ echo isset($params['long_description'])
1108
+ ? '<i setting="'.$params['name'].'" class="apbct_settings-long_description---show icon-help-circled"></i>'
1109
+ : '';
1110
+
1111
+ echo '<div class="apbct_settings-field_content apbct_settings-field_content--'.$params['type'].'">';
1112
+
1113
+ $disabled = '';
1114
+
1115
+ // Disable child option if parent is ON
1116
+ if($params['reverse_trigger']){
1117
+ if($params['parent'] && $apbct->settings[$params['parent']]){
1118
+ $disabled = ' disabled="disabled"';
1119
+ }
1120
+
1121
+ // Disable child option if parent if OFF
1122
+ }else{
1123
+ if($params['parent'] && !$apbct->settings[$params['parent']]){
1124
+ $disabled = ' disabled="disabled"';
1125
+ }
1126
+ }
1127
+
1128
+ foreach($params['options'] as $option){
1129
+ echo '<input'
1130
+ .' type="radio"'
1131
+ ." class='apbct_setting_{$params['type']} apbct_setting---{$params['name']}'"
1132
+ ." id='apbct_setting_{$params['name']}__{$option['label']}'"
1133
+ .' name="cleantalk_settings['.$params['name'].']"'
1134
+ .' value="'.$option['val'].'"'
1135
+ .($params['parent'] ? $disabled : '')
1136
+ .($params['childrens']
1137
+ ? ' onchange="apbctSettingsDependencies(\'' . $childrens . '\', ' . $option['childrens_enable'] . ')"'
1138
+ : ''
1139
+ )
1140
+ .($value == $option['val'] ? ' checked' : '')
1141
+ .($params['required'] ? ' required="required"' : '')
1142
+ .' />';
1143
+ echo '<label for="apbct_setting_'.$params['name'].'__'.$option['label'].'"> ' . $option['label'] . '</label>';
1144
+ echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
1145
+ }
1146
+
1147
+ echo isset($params['description'])
1148
+ ? '<div class="apbct_settings-field_description">'.$params['description'].'</div>'
1149
+ : '';
1150
+
1151
+ echo '</div>';
1152
+ break;
1153
+
1154
+ // Dropdown list type
1155
+ case 'select':
1156
+ echo isset($params['title'])
1157
+ ? '<h4 class="apbct_settings-field_title apbct_settings-field_title--'.$params['type'].'">'.$params['title'].'</h4>'
1158
+ : '';
1159
+ echo isset($params['long_description'])
1160
+ ? '<i setting="'.$params['name'].'" class="apbct_settings-long_description---show icon-help-circled"></i>'
1161
+ : '';
1162
+ echo '<select'
1163
+ . ' id="apbct_setting_'.$params['name'].'"'
1164
+ . " class='apbct_setting_{$params['type']} apbct_setting---{$params['name']}'"
1165
+ . ' name="cleantalk_settings['.$params['name'].']'.($params['multiple'] ? '[]"' : '"')
1166
+ . ($params['multiple'] ? ' size="'. count($params['options']). '""' : '')
1167
+ . ($params['multiple'] ? ' multiple="multiple"' : '')
1168
+ . $disabled
1169
+ . ($params['required'] ? ' required="required"' : '')
1170
+ . ' >';
1171
+
1172
+ foreach($params['options'] as $option){
1173
+ echo '<option'
1174
+ . ' value="' . $option['val'] . '"'
1175
+ . ($params['multiple']
1176
+ ? (in_array($option['val'], $value) ? ' selected="selected"' : '')
1177
+ : ($value == $option['val'] ? 'selected="selected"' : '')
1178
+ )
1179
+ .'>'
1180
+ . $option['label']
1181
+ . '</option>';
1182
+ }
1183
+
1184
+ echo '</select>';
1185
+ echo isset($params['long_description'])
1186
+ ? '<i setting="'.$params['name'].'" class="apbct_settings-long_description---show icon-help-circled"></i>'
1187
+ : '';
1188
+ echo isset($params['description'])
1189
+ ? '<div class="apbct_settings-field_description">'.$params['description'].'</div>'
1190
+ : '';
1191
+
1192
+ break;
1193
+
1194
+ // Text type
1195
+ case 'text':
1196
+
1197
+ echo '<input
1198
+ type="text"
1199
+ id="apbct_setting_'.$params['name'].'"
1200
+ name="cleantalk_settings['.$params['name'].']"'
1201
+ ." class='apbct_setting_{$params['type']} apbct_setting---{$params['name']}'"
1202
+ .' value="'. $value .'" '
1203
+ .$disabled
1204
+ .($params['required'] ? ' required="required"' : '')
1205
+ .($params['childrens'] ? ' onchange="apbctSettingsDependencies(\'' . $childrens . '\')"' : '')
1206
+ .' />'
1207
+ . '&nbsp;'
1208
+ .'<label for="apbct_setting_'.$params['name'].'" class="apbct_setting-field_title--'.$params['type'].'">'
1209
+ .$params['title']
1210
+ .'</label>';
1211
+ echo '<div class="apbct_settings-field_description">'
1212
+ .$params['description']
1213
+ .'</div>';
1214
+ break;
1215
+ }
1216
+
1217
+ echo '</div>';
1218
+ }
1219
+
1220
+ /**
1221
+ * Admin callback function - Plugin parameters validator
1222
+ *
1223
+ * @global CleantalkState $apbct
1224
+ * @param array $settings Array with passed settings
1225
+ * @return array Array with processed settings
1226
+ */
1227
+ function apbct_settings__validate($settings) {
1228
+
1229
+ global $apbct;
1230
+
1231
+ // Set missing settings.
1232
+ foreach($apbct->def_settings as $setting => $value){
1233
+ if(!isset($settings[$setting])){
1234
+ $settings[$setting] = null;
1235
+ settype($settings[$setting], gettype($value));
1236
+ }
1237
+ } unset($setting, $value);
1238
+
1239
+ // Set missing settings.
1240
+ foreach($apbct->def_network_settings as $setting => $value){
1241
+ if(!isset($settings[$setting])){
1242
+ $settings[$setting] = null;
1243
+ settype($settings[$setting], gettype($value));
1244
+ }
1245
+ } unset($setting, $value);
1246
+
1247
+ // Validating API key
1248
+ $settings['apikey'] = !empty($settings['apikey']) ? trim($settings['apikey']) : '';
1249
+ $settings['apikey'] = defined('CLEANTALK_ACCESS_KEY') ? CLEANTALK_ACCESS_KEY : $settings['apikey'];
1250
+ $settings['apikey'] = is_main_site() || $apbct->allow_custom_key ? $settings['apikey'] : $apbct->network_settings['apikey'];
1251
+ $settings['apikey'] = is_main_site() || !$settings['white_label'] ? $settings['apikey'] : $apbct->settings['apikey'];
1252
+ $settings['apikey'] = strpos($settings['apikey'], '*') === false ? $settings['apikey'] : $apbct->settings['apikey'];
1253
+
1254
+ // Validate Exclusions
1255
+ // URLs
1256
+ $result = apbct_settings__sanitize__exclusions($settings['exclusions__urls'], $settings['exclusions__urls__use_regexp']);
1257
+ $result === false
1258
+ ? $apbct->error_add( 'exclusions_urls', 'is not valid: "' . $settings['exclusions__urls'] . '"', 'settings_validate' )
1259
+ : $apbct->error_delete( 'exclusions_urls', true, 'settings_validate' );
1260
+ $settings['exclusions__urls'] = $result ? $result: '';
1261
+
1262
+ // Fields
1263
+ $result = apbct_settings__sanitize__exclusions($settings['exclusions__fields'], $settings['exclusions__fields__use_regexp']);
1264
+ $result === false
1265
+ ? $apbct->error_add( 'exclusions_fields', 'is not valid: "' . $settings['exclusions__fields'] . '"', 'settings_validate' )
1266
+ : $apbct->error_delete( 'exclusions_fields', true, 'settings_validate' );
1267
+ $settings['exclusions__fields'] = $result ? $result: '';
1268
+
1269
+ // WPMS Logic.
1270
+ if(APBCT_WPMS && is_main_site()){
1271
+ $network_settings = array(
1272
+ 'allow_custom_key' => $settings['allow_custom_key'],
1273
+ 'white_label' => $settings['white_label'],
1274
+ 'white_label__hoster_key' => $settings['white_label__hoster_key'],
1275
+ 'white_label__plugin_name' => $settings['white_label__plugin_name'],
1276
+ );
1277
+ unset( $settings['allow_custom_key'], $settings['white_label'], $settings['white_label__hoster_key'], $settings['white_label__plugin_name'] );
1278
+ }
1279
+
1280
+ // Drop debug data
1281
+ if (isset($_POST['submit']) && $_POST['submit'] == 'debug_drop'){
1282
+ $apbct->debug = false;
1283
+ delete_option('cleantalk_debug');
1284
+ return $settings;
1285
+ }
1286
+
1287
+ // Send connection reports
1288
+ if (isset($_POST['submit']) && $_POST['submit'] == 'ct_send_connection_report'){
1289
+ ct_mail_send_connection_report();
1290
+ return $settings;
1291
+ }
1292
+
1293
+ // Auto getting key
1294
+ if (isset($_POST['submit']) && $_POST['submit'] == 'get_key_auto'){
1295
+
1296
+ $website = parse_url(get_option('siteurl'), PHP_URL_HOST).parse_url(get_option('siteurl'), PHP_URL_PATH);
1297
+ $platform = 'wordpress';
1298
+ $user_ip = CleantalkHelper::ip__get(array('real'), false);
1299
+ $timezone = filter_input(INPUT_POST, 'ct_admin_timezone');
1300
+ $language = apbct_get_server_variable( 'HTTP_ACCEPT_LANGUAGE' );
1301
+ $wpms = APBCT_WPMS && defined('SUBDOMAIN_INSTALL') && !SUBDOMAIN_INSTALL ? true : false;
1302
+ $white_label = $apbct->network_settings['white_label'] ? 1 : 0;
1303
+ $hoster_api_key = $apbct->network_settings['white_label__hoster_key'] ? $apbct->network_settings['white_label__hoster_key'] : '';
1304
+
1305
+ $result = CleantalkAPI::method__get_api_key(
1306
+ 'antispam',
1307
+ ct_get_admin_email(),
1308
+ $website,
1309
+ $platform,
1310
+ $timezone,
1311
+ $language,
1312
+ $user_ip,
1313
+ $wpms,
1314
+ $white_label,
1315
+ $hoster_api_key
1316
+ );
1317
+
1318
+ if(empty($result['error'])){
1319
+
1320
+ if(isset($result['user_token'])){
1321
+ $apbct->data['user_token'] = $result['user_token'];
1322
+ }
1323
+
1324
+ if(!empty($result['auth_key'])){
1325
+ $settings['apikey'] = $result['auth_key'];
1326
+ }
1327
+
1328
+ }else{
1329
+ $apbct->error_add(
1330
+ 'key_get',
1331
+ $result['error']
1332
+ . ($apbct->white_label
1333
+ ? ' <button name="submit" type="submit" class="cleantalk_link cleantalk_link-manual" value="get_key_auto">'
1334
+ : ''
1335
+ )
1336
+ );
1337
+ }
1338
+ }
1339
+
1340
+ // Feedback with app_agent
1341
+ ct_send_feedback('0:' . APBCT_AGENT); // 0 - request_id, agent version.
1342
+
1343
+ // Key is good by default
1344
+ $apbct->data['key_is_ok'] = true;
1345
+
1346
+ // Check account status and validate key. Even if it's not correct because of IP license.
1347
+ $result = ct_account_status_check($settings['apikey']);
1348
+
1349
+ // Is key valid?
1350
+ if($result){
1351
+
1352
+ // Deleting errors about invalid key
1353
+ $apbct->error_delete('key_invalid key_get', 'save');
1354
+
1355
+ // SFW actions
1356
+ if($apbct->settings['spam_firewall'] == 1){
1357
+ ct_sfw_update($settings['apikey']);
1358
+ ct_sfw_send_logs($settings['apikey']);
1359
+ }
1360
+
1361
+ // Updating brief data for dashboard widget
1362
+ $apbct->data['brief_data'] = CleantalkAPI::method__get_antispam_report_breif($settings['apikey']);
1363
+
1364
+ // Key is not valid
1365
+ }else{
1366
+ $apbct->data['key_is_ok'] = false;
1367
+ $apbct->error_add('key_invalid', __('Testing is failed. Please check the Access key.', 'cleantalk'));
1368
+ }
1369
+
1370
+ // WPMS Logic.
1371
+ if(APBCT_WPMS){
1372
+ if(is_main_site()){
1373
+
1374
+ // Network settings
1375
+ $network_settings['apikey'] = $settings['apikey'];
1376
+ $apbct->network_settings = $network_settings;
1377
+ $apbct->saveNetworkSettings();
1378
+
1379
+ // Network data
1380
+ $apbct->network_data = array(
1381
+ 'key_is_ok' => $apbct->data['key_is_ok'],
1382
+ 'moderate' => $apbct->data['moderate'],
1383
+ 'valid' => $apbct->data['valid'],
1384
+ 'auto_update' => $apbct->data['auto_update'],
1385
+ 'user_token' => $apbct->data['user_token'],
1386
+ 'service_id' => $apbct->data['service_id'],
1387
+ );
1388
+ $apbct->saveNetworkData();
1389
+ }
1390
+ if(!$apbct->white_label && !is_main_site() && !$apbct->allow_custom_key){
1391
+ $settings['apikey'] = '';
1392
+ }
1393
+ }
1394
+
1395
+ if($apbct->data['key_is_ok'] == false && $apbct->data['moderate_ip'] == 0){
1396
+
1397
+ // Notices
1398
+ $apbct->data['notice_show'] = 1;
1399
+ $apbct->data['notice_renew'] = 0;
1400
+ $apbct->data['notice_trial'] = 0;
1401
+ $apbct->data['notice_review'] = 0;
1402
+ $apbct->data['notice_auto_update'] = 0;
1403
+
1404
+ // Other
1405
+ $apbct->data['service_id'] = 0;
1406
+ $apbct->data['valid'] = 0;
1407
+ $apbct->data['moderate'] = 0;
1408
+ $apbct->data['ip_license'] = 0;
1409
+ $apbct->data['moderate_ip'] = 0;
1410
+ $apbct->data['spam_count'] = 0;
1411
+ $apbct->data['auto_update'] = 0;
1412
+ $apbct->data['user_token'] = '';
1413
+ $apbct->data['license_trial'] = 0;
1414
+ $apbct->data['account_name_ob'] = '';
1415
+ }
1416
+
1417
+ $apbct->saveData();
1418
+
1419
+ return $settings;
1420
+ }
1421
+
1422
+ /**
1423
+ * Sanitize and validate exclusions.
1424
+ * Explode given string by commas and trim each string.
1425
+ * Skip element if it's empty.
1426
+ *
1427
+ * Return false if exclusion is bad
1428
+ * Return sanitized string if all is ok
1429
+ *
1430
+ * @param string $exclusions
1431
+ * @param bool $regexp
1432
+ *
1433
+ * @return bool|string
1434
+ */
1435
+ function apbct_settings__sanitize__exclusions($exclusions, $regexp = false){
1436
+ $result = array();
1437
+ if( ! empty( $exclusions ) ){
1438
+ $exclusions = explode( ',', $exclusions );
1439
+ foreach ( $exclusions as $exclusion ){
1440
+ $sanitized_exclusion = trim( $exclusion );
1441
+ if ( ! empty( $sanitized_exclusion ) ) {
1442
+ if( $regexp && ! apbct_is_regexp( $exclusion ) )
1443
+ return false;
1444
+ $result[] = $sanitized_exclusion;
1445
+ }
1446
+ }
1447
+ }
1448
+ return implode( ',', $result );
1449
+ }
1450
+
1451
+ function apbct_settings_show_gdpr_text($print = false){
1452
+
1453
+ $out = wpautop('The notice requirements remain and are expanded. They must include the retention time for personal data, and contact information for data controller and data protection officer has to be provided.
1454
+ Automated individual decision-making, including profiling (Article 22) is contestable, similarly to the Data Protection Directive (Article 15). Citizens have rights to question and fight significant decisions that affect them that have been made on a solely-algorithmic basis. Many media outlets have commented on the introduction of a "right to explanation" of algorithmic decisions, but legal scholars have since argued that the existence of such a right is highly unclear without judicial tests and is limited at best.
1455
+ To be able to demonstrate compliance with the GDPR, the data controller should implement measures, which meet the principles of data protection by design and data protection by default. Privacy by design and by default (Article 25) require data protection measures to be designed into the development of business processes for products and services. Such measures include pseudonymising personal data, by the controller, as soon as possible (Recital 78).
1456
+ It is the responsibility and the liability of the data controller to implement effective measures and be able to demonstrate the compliance of processing activities even if the processing is carried out by a data processor on behalf of the controller (Recital 74).
1457
+ Data Protection Impact Assessments (Article 35) have to be conducted when specific risks occur to the rights and freedoms of data subjects. Risk assessment and mitigation is required and prior approval of the national data protection authorities (DPAs) is required for high risks. Data protection officers (Articles 37–39) are required to ensure compliance within organisations.
1458
+ They have to be appointed:')
1459
+ .'<ul style="padding: 0px 25px; list-style: disc;">'
1460
+ .'<li>for all public authorities, except for courts acting in their judicial capacity</li>'
1461
+ .'<li>if the core activities of the controller or the processor are:</li>'
1462
+ .'<ul style="padding: 0px 25px; list-style: disc;">'
1463
+ .'<li>processing operations, which, by virtue of their nature, their scope and/or their purposes, require regular and systematic monitoring of data subjects on a large scale</li>'
1464
+ .'<li>processing on a large scale of special categories of data pursuant to Article 9 and personal data relating to criminal convictions and offences referred to in Article 10;</li>'
1465
+ .'</ul>'
1466
+ .'</li>'
1467
+ .'</ul>';
1468
+
1469
+ if($print) echo $out; else return $out;
1470
+ }
1471
+
1472
+ function apbct_settings__get__long_description(){
1473
+
1474
+ global $apbct;
1475
+
1476
+ check_ajax_referer('ct_secret_nonce' );
1477
+
1478
+ $setting_id = $_POST['setting_id'] ? $_POST['setting_id'] : '';
1479
+
1480
+ $descriptions = array(
1481
+ 'white_label' => array(
1482
+ 'title' => __( 'XSS check', 'cleantalk' ),
1483
+ 'desc' => __( 'Cross-Site Scripting (XSS) — prevents malicious code to be executed/sent to any user. As a result malicious scripts can not get access to the cookie files, session tokens and any other confidential information browsers use and store. Such scripts can even overwrite content of HTML pages. CleanTalk WAF monitors for patterns of these parameters and block them.', 'cleantalk' ),
1484
+ ),
1485
+ 'white_label__hoster_key' => array(
1486
+ 'title' => __( 'SQL-injection check', 'cleantalk' ),
1487
+ 'desc' => __( 'SQL Injection — one of the most popular ways to hack websites and programs that work with databases. It is based on injection of a custom SQL code into database queries. It could transmit data through GET, POST requests or cookie files in an SQL code. If a website is vulnerable and execute such injections then it would allow attackers to apply changes to the website\'s MySQL database.', 'cleantalk' ),
1488
+ ),
1489
+ 'white_label__plugin_name' => array(
1490
+ 'title' => __( 'Check uploaded files', 'cleantalk' ),
1491
+ 'desc' => __( 'The option checks each uploaded file to a website for malicious code. If it\'s possible for visitors to upload files to a website, for instance a work resume, then attackers could abuse it and upload an infected file to execute it later and get access to your website.', 'cleantalk' ),
1492
+ ),
1493
+ );
1494
+
1495
+ die(json_encode($descriptions[$setting_id]));
1496
  }
inc/cleantalk-updater.php CHANGED
@@ -1,413 +1,413 @@
1
- <?php
2
-
3
- function apbct_run_update_actions($current_version, $new_version){
4
-
5
- $current_version = apbct_version_standartization($current_version);
6
- $new_version = apbct_version_standartization($new_version);
7
-
8
- $current_version_str = implode('.', $current_version);
9
- $new_version_str = implode('.', $new_version);
10
-
11
- for($ver_major = $current_version[0]; $ver_major <= $new_version[0]; $ver_major++){
12
- for($ver_minor = 0; $ver_minor <= 200; $ver_minor++){
13
- for($ver_fix = 0; $ver_fix <= 10; $ver_fix++){
14
-
15
- if(version_compare("{$ver_major}.{$ver_minor}.{$ver_fix}", $current_version_str, '<='))
16
- continue;
17
-
18
- if(function_exists("apbct_update_to_{$ver_major}_{$ver_minor}_{$ver_fix}")){
19
- $result = call_user_func("apbct_update_to_{$ver_major}_{$ver_minor}_{$ver_fix}");
20
- if(!empty($result['error']))
21
- break;
22
- }
23
-
24
- if(version_compare("{$ver_major}.{$ver_minor}.{$ver_fix}", $new_version_str, '>='))
25
- break(2);
26
-
27
- }
28
- }
29
- }
30
-
31
- return true;
32
-
33
- }
34
-
35
- function apbct_version_standartization($version){
36
-
37
- $version = explode('.', $version);
38
- $version = !empty($version) ? $version : array();
39
-
40
- $version[0] = !empty($version[0]) ? (int)$version[0] : 0;
41
- $version[1] = !empty($version[1]) ? (int)$version[1] : 0;
42
- $version[2] = !empty($version[2]) ? (int)$version[2] : 0;
43
-
44
- return $version;
45
- }
46
-
47
- function apbct_update_to_5_50_0(){
48
- global $wpdb;
49
- $wpdb->query('CREATE TABLE IF NOT EXISTS `'. APBCT_TBL_FIREWALL_DATA .'` (
50
- `network` int(11) unsigned NOT NULL,
51
- `mask` int(11) unsigned NOT NULL,
52
- INDEX ( `network` , `mask` )
53
- );');
54
-
55
- $wpdb->query('CREATE TABLE IF NOT EXISTS `'. APBCT_TBL_FIREWALL_LOG .'` (
56
- `ip` VARCHAR(15) NOT NULL ,
57
- `all` INT NOT NULL ,
58
- `blocked` INT NOT NULL ,
59
- `timestamp` INT NOT NULL ,
60
- PRIMARY KEY (`ip`));');
61
- }
62
-
63
- function apbct_update_to_5_56_0(){
64
- if (!wp_next_scheduled('cleantalk_update_sfw_hook'))
65
- wp_schedule_event(time()+1800, 'daily', 'cleantalk_update_sfw_hook' );
66
- }
67
- function apbct_update_to_5_70_0(){
68
-
69
- global $wpdb;
70
-
71
- i