Spam protection, AntiSpam, FireWall by CleanTalk - Version 5.114

Version Description

January 31 2019 = * New: Setting "Use Wordpress HTTP API" as alternative to CURL. Disabled by default. * Fix: Formidable: Adding small JS check when adding JS_key. * Mod: layout of settings page. * Mod: Banner logic altered.

Download this release

Release Info

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

Code changes from version 5.113.2 to 5.114

cleantalk.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Anti-Spam by CleanTalk
4
  Plugin URI: http://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.113.2
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: http://cleantalk.org
9
  */
3
  Plugin Name: Anti-Spam by CleanTalk
4
  Plugin URI: http://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.114
7
  Author: СleanTalk <welcome@cleantalk.org>
8
  Author URI: http://cleantalk.org
9
  */
inc/cleantalk-admin.php CHANGED
@@ -400,7 +400,7 @@ function apbct_admin__notice_message(){
400
  $is_dashboard = (is_network_admin() || is_admin() ? true : false);
401
  $is_admin = (current_user_can('activate_plugins') ? true : false);
402
 
403
- $page_is_ct_settings = ($page->id == 'settings_page_cleantalk' || $page->id == 'settings_page_cleantalk-network' ? true : false);
404
 
405
  //Misc
406
  $user_token = ($apbct->user_token ? '&user_token='.$apbct->user_token : '');
@@ -468,7 +468,7 @@ function apbct_admin__notice_message(){
468
  }
469
 
470
  //"Wrong access key" notice (if ct_update_option().METHOD_notice_validate_key returns a error)
471
- if ($apbct->notice_show && !$apbct->data['key_is_ok'] && $apbct->moderate_ip == 0 && !$apbct->white_label){
472
  echo '<div class="error">
473
  <h3><b>'.
474
  __("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').
400
  $is_dashboard = (is_network_admin() || is_admin() ? true : false);
401
  $is_admin = (current_user_can('activate_plugins') ? true : false);
402
 
403
+ $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);
404
 
405
  //Misc
406
  $user_token = ($apbct->user_token ? '&user_token='.$apbct->user_token : '');
468
  }
469
 
470
  //"Wrong access key" notice (if ct_update_option().METHOD_notice_validate_key returns a error)
471
+ if ($apbct->notice_show && $page_is_ct_settings && !$apbct->data['key_is_ok'] && $apbct->moderate_ip == 0 && !$apbct->white_label){
472
  echo '<div class="error">
473
  <h3><b>'.
474
  __("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').
inc/cleantalk-comments.php CHANGED
@@ -35,8 +35,8 @@ function ct_show_checkspam_page(){
35
  '</a>'
36
  )
37
  .'</h3>';
 
38
  }
39
- return;
40
  }
41
 
42
  // Getting total spam comments
@@ -72,7 +72,7 @@ function ct_show_checkspam_page(){
72
 
73
  <!-- Check options -->
74
  <div class="ct_to_hide" id="ct_check_params_wrapper">
75
- <button class="button ct_check_params_elem" id="ct_check_spam_button"><?php _e("Start check", 'cleantalk'); ?></button>
76
  <?php if(!empty($_COOKIE['ct_paused_comments_check'])) { ?><button class="button ct_check_params_elem" id="ct_proceed_check_button"><?php _e("Continue check", 'cleantalk'); ?></button><?php } ?>
77
  <p class="ct_check_params_desc"><?php _e("The plugin will check all comments against blacklists database and show you senders that have spam activity on other websites.", 'cleantalk'); ?></p>
78
  <br />
35
  '</a>'
36
  )
37
  .'</h3>';
38
+ return;
39
  }
 
40
  }
41
 
42
  // Getting total spam comments
72
 
73
  <!-- Check options -->
74
  <div class="ct_to_hide" id="ct_check_params_wrapper">
75
+ <button class="button ct_check_params_elem" id="ct_check_spam_button" <?php echo !$apbct->data['moderate'] ? 'disabled="disabled"' : ''; ?>><?php _e("Start check", 'cleantalk'); ?></button>
76
  <?php if(!empty($_COOKIE['ct_paused_comments_check'])) { ?><button class="button ct_check_params_elem" id="ct_proceed_check_button"><?php _e("Continue check", 'cleantalk'); ?></button><?php } ?>
77
  <p class="ct_check_params_desc"><?php _e("The plugin will check all comments against blacklists database and show you senders that have spam activity on other websites.", 'cleantalk'); ?></p>
78
  <br />
inc/cleantalk-public.php CHANGED
@@ -715,7 +715,7 @@ function ct_frm_entries_footer_scripts($fields, $form) {
715
  input.setAttribute('name', '$ct_checkjs_frm');
716
  input.setAttribute('value', '$ct_checkjs_key');
717
  for (i = 0; i < document.forms.length; i++) {
718
- if (document.forms[i].id){
719
  if(document.forms[i].id.search('$ct_frm_name') != -1) {
720
  document.forms[i].appendChild(input);
721
  }
@@ -1040,26 +1040,26 @@ function apbct_comment__Wordpress__changeMailNotification($notify_message, $comm
1040
 
1041
  global $apbct;
1042
 
1043
- $notify_message = preg_replace(
1044
- '/\n\r\n\r/',
1045
- strrev(PHP_EOL . PHP_EOL . '---'
1046
- .PHP_EOL
1047
  .__('CleanTalk AntiSpam: This message is spam.', 'cleantalk')
1048
  ."\n".__('You could check it in CleanTalk\'s anti-spam database:', 'cleantalk')
1049
- ."\n".'IP: https://cleantalk.org/blacklists/' . $apbct->sender_ip . '?utm_source=newsletter&utm_medium=email&utm_campaign=wp_spam_comment_passed" target="_blank'
1050
- ."\n".'Email: https://cleantalk.org/blacklists/' . $apbct->sender_email . '?utm_source=newsletter&utm_medium=email&utm_campaign=wp_spam_comment_passed" target="_blank'
1051
  ."\n".PHP_EOL . sprintf(
1052
  __('Activate protection in your Anti-Spam Dashboard: %s.', 'clentalk'),
1053
- 'https://cleantalk.org/my/?cp_mode=antispam&utm_source=newsletter&utm_medium=email&utm_campaign=wp_spam_comment_passed" target="_blank'
 
 
 
 
1054
  )
1055
  .PHP_EOL . '---'
1056
  .PHP_EOL
1057
- .PHP_EOL),
1058
- strrev($notify_message),
1059
- 1
1060
- );
1061
 
1062
- return strrev($notify_message);
1063
 
1064
  }
1065
 
@@ -1534,17 +1534,21 @@ function apbct_registration__Wordpress__changeMailNotification($wp_new_user_noti
1534
 
1535
  global $apbct;
1536
 
1537
- $wp_new_user_notification_email_admin['message'] .= PHP_EOL . '---'
1538
- .PHP_EOL
1539
  .__('CleanTalk AntiSpam: This registration is spam.', 'cleantalk')
1540
  ."\n" . __('CleanTalk\'s anti-spam database:', 'cleantalk')
1541
- ."\n" . 'IP: ' . '<a href="https://cleantalk.org/blacklists/' . $apbct->sender_ip . '?utm_source=newsletter&utm_medium=email&utm_campaign=wp_spam_registration_passed" target="_blank">' . $apbct->sender_ip . '</a>'
1542
- ."\n" . 'Email: ' . '<a href="https://cleantalk.org/blacklists/' . $apbct->sender_email . '?utm_source=newsletter&utm_medium=email&utm_campaign=wp_spam_registration_passed" target="_blank">' . $apbct->sender_email . '</a>'
1543
- .PHP_EOL . PHP_EOL . sprintf(
1544
- __('Activate protection in your %sAnti-Spam Dashboard%s.', 'clentalk'),
1545
- '<a href="https://cleantalk.org/my/?cp_mode=antispam&utm_source=newsletter&utm_medium=email&utm_campaign=wp_spam_registration_passed" target="_blank">',
1546
- '</a>'
1547
- );
 
 
 
 
 
1548
 
1549
  return $wp_new_user_notification_email_admin;
1550
 
@@ -1919,13 +1923,12 @@ function apbct_form__ninjaForms__changeMailNotification($message, $data, $action
1919
  .PHP_EOL
1920
  .__('CleanTalk AntiSpam: This message is spam.', 'cleantalk')
1921
  .PHP_EOL . __('CleanTalk\'s anti-spam database:', 'cleantalk')
1922
- .PHP_EOL . 'IP: ' . '<a href="https://cleantalk.org/blacklists/' . $apbct->sender_ip . '?utm_source=newsletter&utm_medium=email&utm_campaign=ninjaform_spam_passed" target="_blank">' . $apbct->sender_ip . '</a>'
1923
- .PHP_EOL . 'Email: ' . '<a href="https://cleantalk.org/blacklists/' . $apbct->sender_email . '?utm_source=newsletter&utm_medium=email&utm_campaign=ninjaform_spam_passed" target="_blank">' . $apbct->sender_email . '</a>'
1924
- .PHP_EOL . sprintf(
1925
- __('Activate protection in your %sAnti-Spam Dashboard%s.', 'clentalk'),
1926
- '<a href="https://cleantalk.org/my/?cp_mode=antispam&utm_source=newsletter&utm_medium=email&utm_campaign=ninjaform_activate_antispam" target="_blank">',
1927
- '</a>'
1928
- ));
1929
  }
1930
 
1931
  return $message;
@@ -2365,7 +2368,8 @@ function ct_contact_form_validate() {
2365
  strpos($_SERVER['REQUEST_URI'],'wp-comments-post.php')!==false ||
2366
  strpos($_SERVER['REQUEST_URI'],'?provider=facebook&')!==false ||
2367
  (isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'],'/wp-admin/') !== false) ||
2368
- strpos($_SERVER['REQUEST_URI'],'/login/')!==false||
 
2369
  strpos($_SERVER['REQUEST_URI'], '/peepsoajax/profilefieldsajax.validate_register')!== false ||
2370
  isset($_GET['ptype']) && $_GET['ptype']=='login' ||
2371
  check_url_exclusions() ||
715
  input.setAttribute('name', '$ct_checkjs_frm');
716
  input.setAttribute('value', '$ct_checkjs_key');
717
  for (i = 0; i < document.forms.length; i++) {
718
+ if (typeof document.forms[i].id == 'string'){
719
  if(document.forms[i].id.search('$ct_frm_name') != -1) {
720
  document.forms[i].appendChild(input);
721
  }
1040
 
1041
  global $apbct;
1042
 
1043
+ $notify_message =
1044
+ PHP_EOL
 
 
1045
  .__('CleanTalk AntiSpam: This message is spam.', 'cleantalk')
1046
  ."\n".__('You could check it in CleanTalk\'s anti-spam database:', 'cleantalk')
1047
+ ."\n".'IP: https://cleantalk.org/blacklists/' . $apbct->sender_ip . '?utm_source=newsletter&utm_medium=email&utm_campaign=wp_spam_comment_activate_antispam'
1048
+ ."\n".'Email: https://cleantalk.org/blacklists/' . $apbct->sender_email . '?utm_source=newsletter&utm_medium=email&utm_campaign=wp_spam_comment_activate_antispam'
1049
  ."\n".PHP_EOL . sprintf(
1050
  __('Activate protection in your Anti-Spam Dashboard: %s.', 'clentalk'),
1051
+ 'https://cleantalk.org/my/?cp_mode=antispam&utm_source=newsletter&utm_medium=email&utm_campaign=wp_spam_comment_passed'
1052
+ .($apbct->data['user_token']
1053
+ ? '&iser_token='.$apbct->data['user_token']
1054
+ : ''
1055
+ )
1056
  )
1057
  .PHP_EOL . '---'
1058
  .PHP_EOL
1059
+ .PHP_EOL
1060
+ .$notify_message;
 
 
1061
 
1062
+ return $notify_message;
1063
 
1064
  }
1065
 
1534
 
1535
  global $apbct;
1536
 
1537
+ $wp_new_user_notification_email_admin['message'] = PHP_EOL
 
1538
  .__('CleanTalk AntiSpam: This registration is spam.', 'cleantalk')
1539
  ."\n" . __('CleanTalk\'s anti-spam database:', 'cleantalk')
1540
+ ."\n" . 'IP: ' . 'https://cleantalk.org/blacklists/' . $apbct->sender_ip . '?utm_source=newsletter&utm_medium=email&utm_campaign=wp_spam_registration_passed'
1541
+ ."\n" . 'Email: ' . 'https://cleantalk.org/blacklists/' . $apbct->sender_email . '?utm_source=newsletter&utm_medium=email&utm_campaign=wp_spam_registration_passed'
1542
+ .PHP_EOL . PHP_EOL .
1543
+ __('Activate protection in your Anti-Spam Dashboard: ', 'clentalk')
1544
+ .'https://cleantalk.org/my/?cp_mode=antispam&utm_source=newsletter&utm_medium=email&utm_campaign=wp_spam_registration_passed'
1545
+ .($apbct->data['user_token']
1546
+ ? '&iser_token='.$apbct->data['user_token']
1547
+ : ''
1548
+ )
1549
+ .PHP_EOL . '---'
1550
+ .PHP_EOL
1551
+ .$wp_new_user_notification_email_admin['message'];
1552
 
1553
  return $wp_new_user_notification_email_admin;
1554
 
1923
  .PHP_EOL
1924
  .__('CleanTalk AntiSpam: This message is spam.', 'cleantalk')
1925
  .PHP_EOL . __('CleanTalk\'s anti-spam database:', 'cleantalk')
1926
+ .PHP_EOL . 'IP: ' . 'https://cleantalk.org/blacklists/' . $apbct->sender_ip . '?utm_source=newsletter&utm_medium=email&utm_campaign=ninjaform_spam_passed'
1927
+ .PHP_EOL . 'Email: ' . 'https://cleantalk.org/blacklists/' . $apbct->sender_email . '?utm_source=newsletter&utm_medium=email&utm_campaign=ninjaform_spam_passed'
1928
+ .PHP_EOL .
1929
+ __('Activate protection in your Anti-Spam Dashboard: ', 'clentalk').
1930
+ 'https://cleantalk.org/my/?cp_mode=antispam&utm_source=newsletter&utm_medium=email&utm_campaign=ninjaform_activate_antispam'.$apbct->user_token
1931
+ );
 
1932
  }
1933
 
1934
  return $message;
2368
  strpos($_SERVER['REQUEST_URI'],'wp-comments-post.php')!==false ||
2369
  strpos($_SERVER['REQUEST_URI'],'?provider=facebook&')!==false ||
2370
  (isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'],'/wp-admin/') !== false) ||
2371
+ strpos($_SERVER['REQUEST_URI'],'/login/')!==false ||
2372
+ strpos($_SERVER['REQUEST_URI'], '/my-account/edit-account/')!==false ||
2373
  strpos($_SERVER['REQUEST_URI'], '/peepsoajax/profilefieldsajax.validate_register')!== false ||
2374
  isset($_GET['ptype']) && $_GET['ptype']=='login' ||
2375
  check_url_exclusions() ||
inc/cleantalk-settings.php CHANGED
@@ -114,11 +114,12 @@ function apbct_settings__add_page() {
114
  'title' => __('Forms to protect', 'cleantalk'),
115
  'default_params' => array(),
116
  'description' => '',
117
- 'html_before' => '<hr><br><span id="ct_adv_showhide">'
 
118
  .'<a href="#" class="apbct_color--gray" onclick="event.preventDefault(); apbct_show_hide_elem(\'#apbct_settings__davanced_settings\');">'
119
  .__('Advanced settings', 'cleantalk')
120
  .'</a>'
121
- .'</span>'
122
  .'<div id="apbct_settings__davanced_settings" style="display: none;">',
123
  'html_after' => '',
124
  'fields' => array(
@@ -214,6 +215,10 @@ function apbct_settings__add_page() {
214
  'title' => __("Use SSL", 'cleantalk'),
215
  'description' => __('Turn this option on to use encrypted (SSL) connection with servers.', 'cleantalk'),
216
  ),
 
 
 
 
217
  ),
218
  ),
219
 
@@ -340,7 +345,7 @@ function apbct_settings_page() {
340
  apbct_settings__error__output();
341
 
342
  // Top info
343
- if(!$apbct->white_label){
344
  echo '<div style="float: right; padding: 15px 15px 5px 15px; font-size: 13px; position: relative; top: -55px; background: #f1f1f1;">';
345
 
346
  echo __('CleanTalk\'s tech support:', 'cleantalk')
@@ -576,7 +581,8 @@ function apbct_settings__field__state(){
576
  .__('Contact forms', 'cleantalk');
577
  echo '<img class="apbct_status_icon" src="'.($apbct->settings['general_contact_forms_test']==1 || $apbct->moderate_ip ? $img : $img_no).'"/>'
578
  .__('Custom contact forms', 'cleantalk');
579
- echo '<img class="apbct_status_icon" src="'.($apbct->data['moderate'] == 1 || $apbct->moderate_ip ? $img : $img_no).'"/>'
 
580
  .'<a style="color: black" href="https://blog.cleantalk.org/real-time-email-address-existence-validation/">'.__('Validate email for existence', 'cleantalk').'</a>';
581
 
582
  // SFW + current network count
@@ -946,12 +952,35 @@ function apbct_settings__validate($settings) {
946
 
947
  // Key is not correct
948
  }else{
 
949
  if(empty($settings['apikey'])){
950
  $apbct->error_delete('key_invalid account_check', 'save');
951
  }else
952
  $apbct->error_add('key_invalid', __('Key is not correct', 'cleantalk'));
953
  }
954
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
955
  $apbct->saveData();
956
 
957
  return $settings;
114
  'title' => __('Forms to protect', 'cleantalk'),
115
  'default_params' => array(),
116
  'description' => '',
117
+ 'html_before' => '<hr><br>'
118
+ .($apbct->api_key ? '<span id="ct_adv_showhide">'
119
  .'<a href="#" class="apbct_color--gray" onclick="event.preventDefault(); apbct_show_hide_elem(\'#apbct_settings__davanced_settings\');">'
120
  .__('Advanced settings', 'cleantalk')
121
  .'</a>'
122
+ .'</span>' : '')
123
  .'<div id="apbct_settings__davanced_settings" style="display: none;">',
124
  'html_after' => '',
125
  'fields' => array(
215
  'title' => __("Use SSL", 'cleantalk'),
216
  'description' => __('Turn this option on to use encrypted (SSL) connection with servers.', 'cleantalk'),
217
  ),
218
+ 'use_buitin_http_api' => array(
219
+ 'title' => __("Use Wordpress HTTP API", 'cleantalk'),
220
+ 'description' => __('Alternative way to connect the CleanTalk\'s Cloud. Use this if you have connection problems.', 'cleantalk'),
221
+ ),
222
  ),
223
  ),
224
 
345
  apbct_settings__error__output();
346
 
347
  // Top info
348
+ if(!$apbct->white_label && $apbct->api_key){
349
  echo '<div style="float: right; padding: 15px 15px 5px 15px; font-size: 13px; position: relative; top: -55px; background: #f1f1f1;">';
350
 
351
  echo __('CleanTalk\'s tech support:', 'cleantalk')
581
  .__('Contact forms', 'cleantalk');
582
  echo '<img class="apbct_status_icon" src="'.($apbct->settings['general_contact_forms_test']==1 || $apbct->moderate_ip ? $img : $img_no).'"/>'
583
  .__('Custom contact forms', 'cleantalk');
584
+ if($apbct->api_key)
585
+ echo '<img class="apbct_status_icon" src="'.($apbct->data['moderate'] == 1 || $apbct->moderate_ip ? $img : $img_no).'"/>'
586
  .'<a style="color: black" href="https://blog.cleantalk.org/real-time-email-address-existence-validation/">'.__('Validate email for existence', 'cleantalk').'</a>';
587
 
588
  // SFW + current network count
952
 
953
  // Key is not correct
954
  }else{
955
+ $apbct->data['key_is_ok'] = false;
956
  if(empty($settings['apikey'])){
957
  $apbct->error_delete('key_invalid account_check', 'save');
958
  }else
959
  $apbct->error_add('key_invalid', __('Key is not correct', 'cleantalk'));
960
  }
961
 
962
+ if($apbct->data['key_is_ok'] == false && $apbct->data['moderate_ip'] == 0){
963
+
964
+ // Notices
965
+ $apbct->data['notice_show'] = 1;
966
+ $apbct->data['notice_renew'] = 0;
967
+ $apbct->data['notice_trial'] = 0;
968
+ $apbct->data['notice_review'] = 0;
969
+ $apbct->data['notice_auto_update'] = 0;
970
+
971
+ // Other
972
+ $apbct->data['service_id'] = 0;
973
+ $apbct->data['valid'] = 0;
974
+ $apbct->data['moderate'] = 0;
975
+ $apbct->data['ip_license'] = 0;
976
+ $apbct->data['moderate_ip'] = 0;
977
+ $apbct->data['spam_count'] = 0;
978
+ $apbct->data['auto_update'] = 0;
979
+ $apbct->data['user_token'] = '';
980
+ $apbct->data['license_trial'] = 0;
981
+ $apbct->data['account_name_ob'] = '';
982
+ }
983
+
984
  $apbct->saveData();
985
 
986
  return $settings;
inc/cleantalk-users.php CHANGED
@@ -36,8 +36,8 @@ function ct_show_users_page(){
36
  '</a>'
37
  )
38
  .'</h3>';
 
39
  }
40
- return;
41
  }
42
 
43
 
@@ -71,10 +71,10 @@ function ct_show_users_page(){
71
 
72
  <!-- Main info -->
73
  <h3 id="ct_checking_status"><?php echo ct_ajax_info_users(true); ?></h3>
74
-
75
  <!-- Check options -->
76
  <div class="ct_to_hide" id="ct_check_params_wrapper">
77
- <button class="button ct_check_params_elem" id="ct_check_spam_button"><?php _e("Start check", 'cleantalk'); ?></button>
78
  <?php if(!empty($_COOKIE['ct_paused_users_check'])) { ?><button class="button ct_check_params_elem" id="ct_proceed_check_button"><?php _e("Continue check", 'cleantalk'); ?></button><?php } ?>
79
  <p class="ct_check_params_desc"><?php _e("The plugin will check all comments against blacklists database and show you senders that have spam activity on other websites.", 'cleantalk'); ?></p>
80
  <br />
36
  '</a>'
37
  )
38
  .'</h3>';
39
+ return;
40
  }
 
41
  }
42
 
43
 
71
 
72
  <!-- Main info -->
73
  <h3 id="ct_checking_status"><?php echo ct_ajax_info_users(true); ?></h3>
74
+
75
  <!-- Check options -->
76
  <div class="ct_to_hide" id="ct_check_params_wrapper">
77
+ <button class="button ct_check_params_elem" id="ct_check_spam_button" <?php echo !$apbct->data['moderate'] ? 'disabled="disabled"' : ''; ?>><?php _e("Start check", 'cleantalk'); ?></button>
78
  <?php if(!empty($_COOKIE['ct_paused_users_check'])) { ?><button class="button ct_check_params_elem" id="ct_proceed_check_button"><?php _e("Continue check", 'cleantalk'); ?></button><?php } ?>
79
  <p class="ct_check_params_desc"><?php _e("The plugin will check all comments against blacklists database and show you senders that have spam activity on other websites.", 'cleantalk'); ?></p>
80
  <br />
lib/CleantalkAPI.php CHANGED
@@ -364,7 +364,9 @@ class CleantalkAPI
364
  * @return type
365
  */
366
  static public function send_request($data, $url = self::URL, $timeout = 5, $ssl = false)
367
- {
 
 
368
  // Possibility to switch API url
369
  $url = defined('CLEANTALK_API_URL') ? CLEANTALK_API_URL : $url;
370
 
@@ -372,53 +374,74 @@ class CleantalkAPI
372
  if(defined('CLEANTALK_AGENT'))
373
  $data['agent'] = CLEANTALK_AGENT;
374
 
375
- // Make URL string
376
- $data_string = http_build_query($data);
377
- $data_string = str_replace("&amp;", "&", $data_string);
378
-
379
- // For debug purposes
380
- global $apbct_debug;
381
- $apbct_debug['sent_data'] = $data;
382
- $apbct_debug['request_string'] = $data_string;
383
-
384
- if (function_exists('curl_init')){
385
-
386
- $ch = curl_init();
387
 
388
- // Set diff options
389
- curl_setopt($ch, CURLOPT_URL, $url);
390
- curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
391
- curl_setopt($ch, CURLOPT_POST, true);
392
- curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
393
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
394
- curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
395
 
396
- // Switch on/off SSL
397
- if ($ssl === true) {
398
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
399
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
400
- curl_setopt($ch, CURLOPT_CAINFO, APBCT_CASERT_PATH);
401
- }else{
402
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
403
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
404
- }
405
 
406
- // Make a request
407
- $result = curl_exec($ch);
408
- $errors = curl_error($ch);
409
- curl_close($ch);
410
 
411
- // Get cURL error if result failed
412
- if($result === false){
413
-
414
- // And retry with SSL enabled
415
- if($ssl === false)
416
- return self::send_request($data, $url, $timeout, true);
417
-
418
  }
419
-
420
- }else
421
- $errors = 'CURL_NOT_INSTALLED';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
422
 
423
  // Trying to use file_get_contents() to make a API call
424
  if(!empty($errors) && ini_get('allow_url_fopen')){
364
  * @return type
365
  */
366
  static public function send_request($data, $url = self::URL, $timeout = 5, $ssl = false)
367
+ {
368
+ global $apbct;
369
+
370
  // Possibility to switch API url
371
  $url = defined('CLEANTALK_API_URL') ? CLEANTALK_API_URL : $url;
372
 
374
  if(defined('CLEANTALK_AGENT'))
375
  $data['agent'] = CLEANTALK_AGENT;
376
 
377
+ if($apbct->settings['use_buitin_http_api']){
 
 
 
 
 
 
 
 
 
 
 
378
 
 
 
 
 
 
 
 
379
 
380
+ $args = array(
381
+ 'body' => $data,
382
+ 'timeout' => $timeout,
383
+ 'user-agent' => CLEANTALK_AGENT.' '.get_bloginfo( 'url' ),
384
+ );
 
 
 
 
385
 
386
+ $result = wp_remote_post($url, $args);
 
 
 
387
 
388
+ if( is_wp_error( $result ) ) {
389
+ $errors = $result->get_error_message();
390
+ $result = false;
391
+ }else{
392
+ $result = wp_remote_retrieve_body($result);
 
 
393
  }
394
+
395
+ }else{
396
+
397
+ // Make URL string
398
+ $data_string = http_build_query($data);
399
+ $data_string = str_replace("&amp;", "&", $data_string);
400
+
401
+ // For debug purposes
402
+ global $apbct_debug;
403
+ $apbct_debug['sent_data'] = $data;
404
+ $apbct_debug['request_string'] = $data_string;
405
+
406
+ if (function_exists('curl_init')){
407
+
408
+ $ch = curl_init();
409
+
410
+ // Set diff options
411
+ curl_setopt($ch, CURLOPT_URL, $url);
412
+ curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
413
+ curl_setopt($ch, CURLOPT_POST, true);
414
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
415
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
416
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
417
+
418
+ // Switch on/off SSL
419
+ if ($ssl === true) {
420
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
421
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
422
+ curl_setopt($ch, CURLOPT_CAINFO, APBCT_CASERT_PATH);
423
+ }else{
424
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
425
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
426
+ }
427
+
428
+ // Make a request
429
+ $result = curl_exec($ch);
430
+ $errors = curl_error($ch);
431
+ curl_close($ch);
432
+
433
+ // Get cURL error if result failed
434
+ if($result === false){
435
+
436
+ // And retry with SSL enabled
437
+ if($ssl === false)
438
+ return self::send_request($data, $url, $timeout, true);
439
+
440
+ }
441
+
442
+ }else
443
+ $errors = 'CURL_NOT_INSTALLED';
444
+ }
445
 
446
  // Trying to use file_get_contents() to make a API call
447
  if(!empty($errors) && ini_get('allow_url_fopen')){
lib/CleantalkState.php CHANGED
@@ -49,6 +49,7 @@ class CleantalkState
49
  'general_postdata_test' => 0, //CAPD
50
  'set_cookies'=> 1, // Disable cookies generatation to be compatible with Varnish.
51
  'ssl_on' => 0, // Secure connection to servers
 
52
 
53
  // Administrator Panel
54
  'show_adminbar' => 1, // Show the admin bar.
49
  'general_postdata_test' => 0, //CAPD
50
  'set_cookies'=> 1, // Disable cookies generatation to be compatible with Varnish.
51
  'ssl_on' => 0, // Secure connection to servers
52
+ 'use_buitin_http_api' => 0, // Using Wordpress HTTP built in API
53
 
54
  // Administrator Panel
55
  'show_adminbar' => 1, // Show the admin bar.
readme.txt CHANGED
@@ -3,10 +3,10 @@ Contributors: safronik
3
  Tags: spam, antispam, protection, comments, firewall
4
  Requires at least: 3.0
5
  Tested up to: 5.0
6
- Stable tag: 5.113.2
7
  License: GPLv2
8
 
9
- Spam protection, antispam FireWall, all-in-one, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
10
 
11
  == Description ==
12
 
@@ -558,6 +558,12 @@ If your website has forms that send data to external sources, you can enable opt
558
  10. Website's options.
559
 
560
  == Changelog ==
 
 
 
 
 
 
561
  = 5.113.2 January 18 2019 =
562
  * Fix: "Settings" link returns to plugin page.
563
 
@@ -1780,6 +1786,12 @@ If your website has forms that send data to external sources, you can enable opt
1780
  * First version
1781
 
1782
  == Upgrade Notice ==
 
 
 
 
 
 
1783
  = 5.113.2 January 18 2019 =
1784
  * Fix: "Settings" link returns to plugin page.
1785
 
3
  Tags: spam, antispam, protection, comments, firewall
4
  Requires at least: 3.0
5
  Tested up to: 5.0
6
+ Stable tag: 5.114
7
  License: GPLv2
8
 
9
+ Spam protection, antispam, all-in-one, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.
10
 
11
  == Description ==
12
 
558
  10. Website's options.
559
 
560
  == Changelog ==
561
+ = 5.114 January 31 2019 =
562
+ * New: Setting "Use Wordpress HTTP API" as alternative to CURL. Disabled by default.
563
+ * Fix: Formidable: Adding small JS check when adding JS_key.
564
+ * Mod: layout of settings page.
565
+ * Mod: Banner logic altered.
566
+
567
  = 5.113.2 January 18 2019 =
568
  * Fix: "Settings" link returns to plugin page.
569
 
1786
  * First version
1787
 
1788
  == Upgrade Notice ==
1789
+ = 5.114 January 31 2019 =
1790
+ * New: Setting "Use Wordpress HTTP API" as alternative to CURL. Disabled by default.
1791
+ * Fix: Formidable: Adding small JS check when adding JS_key.
1792
+ * Mod: layout of settings page.
1793
+ * Mod: Banner logic altered.
1794
+
1795
  = 5.113.2 January 18 2019 =
1796
  * Fix: "Settings" link returns to plugin page.
1797