WP Live Chat Support - Version 9.0.12

Version Description

  • 2020-07-31 =
  • Fix utf8 encoding on settings json.
Download this release

Release Info

Developer wpdev3cx
Plugin Icon 128x128 WP Live Chat Support
Version 9.0.12
Comparing to
See all releases

Code changes from version 9.0.11 to 9.0.12

changelog.txt CHANGED
@@ -1,3 +1,6 @@
 
 
 
1
  = 9.0.11 - 2020-07-30 =
2
  * Fix error on update plugin process.
3
 
1
+ = 9.0.12 - 2020-07-31 =
2
+ * Fix utf8 encoding on settings json.
3
+
4
  = 9.0.11 - 2020-07-30 =
5
  * Fix error on update plugin process.
6
 
config.php CHANGED
@@ -9,10 +9,10 @@ if ( ! defined( 'ABSPATH' ) ) {
9
 
10
  define('WPLC_MIN_WP_VERSION', "5.3");
11
  define('WPLC_MIN_PHP_VERSION', "5.4");
12
- define('WPLC_PLUGIN_VERSION', "9.0.11");
13
  define('WPLC_PLUGIN_DIR', dirname(__FILE__));
14
  define('WPLC_PLUGIN_URL', wplc_plugins_url( '/', __FILE__ ) );
15
  define('WPLC_PLUGIN', plugin_basename( __FILE__ ) );
16
- define('WPLC_ACTIVATION_SERVER', 'https://wplc.3cx.net' );
17
  define('WPLC_CHAT_SERVER','https://wplc.3cx.net/api/chatrouter');
18
  define('WPLC_ENABLE_CHANNELS', "wp,mcu,phone" );
9
 
10
  define('WPLC_MIN_WP_VERSION', "5.3");
11
  define('WPLC_MIN_PHP_VERSION', "5.4");
12
+ define('WPLC_PLUGIN_VERSION', "9.0.12");
13
  define('WPLC_PLUGIN_DIR', dirname(__FILE__));
14
  define('WPLC_PLUGIN_URL', wplc_plugins_url( '/', __FILE__ ) );
15
  define('WPLC_PLUGIN', plugin_basename( __FILE__ ) );
16
+ define('WPLC_ACTIVATION_SERVER', 'https://wplc.3cx.net' );
17
  define('WPLC_CHAT_SERVER','https://wplc.3cx.net/api/chatrouter');
18
  define('WPLC_ENABLE_CHANNELS', "wp,mcu,phone" );
css/vendor/bootstrap/{wplc_bootstrap_9_0_11.css → wplc_bootstrap_9_0_12.css} RENAMED
File without changes
includes/helpers/utils_helper.php CHANGED
@@ -473,7 +473,8 @@ class TCXUtilsHelper {
473
  ( $wplc_settings->wplc_hide_when_offline && ! TCXAgentsHelper::exist_available_agent() ) ||
474
  TCXUtilsHelper::wplc_is_user_banned() ||
475
  ! $wplc_compatibility->wp ||
476
- ! $wplc_compatibility->php
 
477
  ) {
478
  $result = false;
479
  }
@@ -691,6 +692,49 @@ class TCXUtilsHelper {
691
  wp_localize_script( 'wplc-agent-chat', 'localization_data', $script_data );
692
 
693
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
694
  }
695
 
696
 
473
  ( $wplc_settings->wplc_hide_when_offline && ! TCXAgentsHelper::exist_available_agent() ) ||
474
  TCXUtilsHelper::wplc_is_user_banned() ||
475
  ! $wplc_compatibility->wp ||
476
+ ! $wplc_compatibility->php ||
477
+ ! $wplc_compatibility->ie
478
  ) {
479
  $result = false;
480
  }
692
  wp_localize_script( 'wplc-agent-chat', 'localization_data', $script_data );
693
 
694
  }
695
+
696
+ public static function wplc_json_encode($value, $options = 0, $depth = 512){
697
+ $utf8_value = self::wplc_utf8_encode($value);
698
+ return json_encode($utf8_value, $options, $depth);
699
+ }
700
+
701
+ public static function wplc_json_decode( $json, $assoc = false, $depth = 512 , $options = 0 ) {
702
+ $result_utf8_encoded = json_decode($json,$assoc, $depth, $options);
703
+ return self::wplc_utf8_decode($result_utf8_encoded);
704
+
705
+ }
706
+
707
+
708
+ public static function wplc_utf8_encode($mixed) {
709
+ if (is_array($mixed)) {
710
+ foreach ($mixed as $key => $value) {
711
+ $mixed[$key] = self::wplc_utf8_encode($value);
712
+ }
713
+ }else if (is_object ($mixed)) {
714
+ foreach ($mixed as $key => $value) {
715
+ $mixed->$key = self::wplc_utf8_encode($value);
716
+ }
717
+ } else if (is_string($mixed)) {
718
+ return utf8_encode($mixed);
719
+ }
720
+ return $mixed;
721
+ }
722
+
723
+ public static function wplc_utf8_decode($mixed) {
724
+ if (is_array($mixed)) {
725
+ foreach ($mixed as $key => $value) {
726
+ $mixed[$key] = self::wplc_utf8_decode($value);
727
+ }
728
+ }else if (is_object ($mixed)) {
729
+ foreach ($mixed as $key => $value) {
730
+ $mixed->$key = self::wplc_utf8_decode($value);
731
+ }
732
+ } else if (is_string ($mixed)) {
733
+ return utf8_decode($mixed);
734
+ }
735
+ return $mixed;
736
+ }
737
+
738
  }
739
 
740
 
includes/models/settings.php CHANGED
@@ -407,7 +407,7 @@ class TCXSettings {
407
  if ( ! $json_settings || empty( $json_settings ) ) {
408
  $DbSettings = get_option( "WPLC_SETTINGS" );
409
  } else {
410
- $DbSettings = json_decode( $json_settings, true );
411
  }
412
 
413
  return $DbSettings;
@@ -437,7 +437,7 @@ class TCXSettings {
437
  $settings = self::getSettings();
438
  if ( property_exists( $settings, $setting_name ) ) {
439
  $settings->$setting_name = $value;
440
- update_option( "WPLC_JSON_SETTINGS", json_encode( TCXUtilsHelper::convertToArray( $settings ), JSON_UNESCAPED_UNICODE ) );
441
  } else if ( get_option( $setting_name, null ) !== null ) {
442
  update_option( $setting_name, $value );
443
  } else {
407
  if ( ! $json_settings || empty( $json_settings ) ) {
408
  $DbSettings = get_option( "WPLC_SETTINGS" );
409
  } else {
410
+ $DbSettings = TCXUtilsHelper::wplc_json_decode( $json_settings, true );
411
  }
412
 
413
  return $DbSettings;
437
  $settings = self::getSettings();
438
  if ( property_exists( $settings, $setting_name ) ) {
439
  $settings->$setting_name = $value;
440
+ update_option( "WPLC_JSON_SETTINGS", TCXUtilsHelper::wplc_json_encode( TCXUtilsHelper::convertToArray( $settings ), JSON_UNESCAPED_UNICODE ) );
441
  } else if ( get_option( $setting_name, null ) !== null ) {
442
  update_option( $setting_name, $value );
443
  } else {
includes/wplc_updater.php CHANGED
@@ -11,7 +11,7 @@ class TCXUpdater {
11
  $this->wplc_migration_functions = array(
12
  "9.0.0" => array( "wplc_migrate_settings_9_0", "migrate_old_user_info", "wplc_cleanup_old_options","wplc_migrate_old_business_hours", "wplc_migrate_quick_responses" ),
13
  "9.0.4" => array( "wplc_migrate_settings_9_0_4" ),
14
- "9.0.8" => array( "wplc_fix_trailing_zeros_business_hours" )
15
  );
16
  }
17
 
@@ -263,10 +263,10 @@ class TCXUpdater {
263
 
264
  $old_settings = get_option( "WPLC_SETTINGS" );
265
  if ( ! empty( $old_settings ) ) {
266
- add_option( "WPLC_JSON_SETTINGS", json_encode( TCXUtilsHelper::convertToArray( $wplc_settings ), JSON_UNESCAPED_UNICODE ) );
267
  delete_option( "WPLC_SETTINGS" );
268
  } else {
269
- update_option( "WPLC_JSON_SETTINGS", json_encode( TCXUtilsHelper::convertToArray( $wplc_settings ), JSON_UNESCAPED_UNICODE ) );
270
  }
271
 
272
  $activator = wp_get_current_user();
@@ -285,7 +285,7 @@ class TCXUpdater {
285
  $wplc_settings->wplc_files_url = WPLC_PLUGIN_URL;
286
  }
287
 
288
- update_option( "WPLC_JSON_SETTINGS", json_encode( TCXUtilsHelper::convertToArray( $wplc_settings ), JSON_UNESCAPED_UNICODE ) );
289
 
290
  return $wplc_settings;
291
  }
@@ -467,11 +467,12 @@ class TCXUpdater {
467
  }
468
 
469
  $wplc_settings->wplc_bh_schedule = $result;
470
- update_option( "WPLC_JSON_SETTINGS", json_encode( TCXUtilsHelper::convertToArray( $wplc_settings ), JSON_UNESCAPED_UNICODE ) );
471
 
472
  return $wplc_settings;
473
  }
474
 
 
475
  public function wplc_complete_existing_chats() {
476
  TCXChatHelper::complete_all_ended_chats();
477
  }
11
  $this->wplc_migration_functions = array(
12
  "9.0.0" => array( "wplc_migrate_settings_9_0", "migrate_old_user_info", "wplc_cleanup_old_options","wplc_migrate_old_business_hours", "wplc_migrate_quick_responses" ),
13
  "9.0.4" => array( "wplc_migrate_settings_9_0_4" ),
14
+ "9.0.8" => array( "wplc_fix_trailing_zeros_business_hours" ),
15
  );
16
  }
17
 
263
 
264
  $old_settings = get_option( "WPLC_SETTINGS" );
265
  if ( ! empty( $old_settings ) ) {
266
+ add_option( "WPLC_JSON_SETTINGS", TCXUtilsHelper::wplc_json_encode( TCXUtilsHelper::convertToArray( $wplc_settings ), JSON_UNESCAPED_UNICODE ) );
267
  delete_option( "WPLC_SETTINGS" );
268
  } else {
269
+ update_option( "WPLC_JSON_SETTINGS", TCXUtilsHelper::wplc_json_encode( TCXUtilsHelper::convertToArray( $wplc_settings ), JSON_UNESCAPED_UNICODE ) );
270
  }
271
 
272
  $activator = wp_get_current_user();
285
  $wplc_settings->wplc_files_url = WPLC_PLUGIN_URL;
286
  }
287
 
288
+ update_option( "WPLC_JSON_SETTINGS", TCXUtilsHelper::wplc_json_encode( TCXUtilsHelper::convertToArray( $wplc_settings ), JSON_UNESCAPED_UNICODE ) );
289
 
290
  return $wplc_settings;
291
  }
467
  }
468
 
469
  $wplc_settings->wplc_bh_schedule = $result;
470
+ update_option( "WPLC_JSON_SETTINGS", TCXUtilsHelper::wplc_json_encode( TCXUtilsHelper::convertToArray( $wplc_settings ), JSON_UNESCAPED_UNICODE ) );
471
 
472
  return $wplc_settings;
473
  }
474
 
475
+
476
  public function wplc_complete_existing_chats() {
477
  TCXChatHelper::complete_all_ended_chats();
478
  }
modules/agent_chat/agent_chat_style.css CHANGED
@@ -26,10 +26,7 @@ img {
26
  }
27
 
28
 
29
- .recent_heading {
30
- float: left;
31
- width: 40%;
32
- }
33
 
34
  .srch_bar {
35
  display: inline-block;
@@ -44,6 +41,11 @@ img {
44
  border-bottom: 1px solid #c4c4c4;
45
  }
46
 
 
 
 
 
 
47
  .recent_heading h4 {
48
  color: #05728f;
49
  font-size: 21px;
26
  }
27
 
28
 
29
+
 
 
 
30
 
31
  .srch_bar {
32
  display: inline-block;
41
  border-bottom: 1px solid #c4c4c4;
42
  }
43
 
44
+ .recent_heading {
45
+ float: left;
46
+ width: 40%;
47
+ }
48
+
49
  .recent_heading h4 {
50
  color: #05728f;
51
  font-size: 21px;
modules/agent_chat/agent_chat_view.php CHANGED
@@ -48,7 +48,7 @@
48
 
49
  <div id="active_chat_box" style="display: none;">
50
  <div class="heading_mesgs">
51
- <div id="wplc_picker_button" class="wplc_on_premise_chat_window_header">
52
  <div id="wplc_avatar_header">
53
  <img id="wplc_avatar_user" alt="user avatar" src="">
54
  </div>
48
 
49
  <div id="active_chat_box" style="display: none;">
50
  <div class="heading_mesgs">
51
+ <div class="wplc_on_premise_chat_window_header">
52
  <div id="wplc_avatar_header">
53
  <img id="wplc_avatar_user" alt="user avatar" src="">
54
  </div>
modules/chat_client/chat_client_preview.php CHANGED
@@ -11,7 +11,7 @@
11
  id="wp-live-chat-by-3CX"
12
  channel-url="<?= wplc_protocol_agnostic_url( $channel_url ) ?>"
13
  files-url=""
14
- notifications-url=""
15
  minimized="false"
16
  animation-style="none"
17
  party=""
11
  id="wp-live-chat-by-3CX"
12
  channel-url="<?= wplc_protocol_agnostic_url( $channel_url ) ?>"
13
  files-url=""
14
+ wp-url="<?= wplc_protocol_agnostic_url( $channel_url ) ?>"
15
  minimized="false"
16
  animation-style="none"
17
  party=""
modules/settings/settings_controller.php CHANGED
@@ -312,7 +312,7 @@ class SettingsController extends BaseController {
312
  $settings->$key = $setting_value;
313
  }
314
  }
315
- update_option( 'WPLC_JSON_SETTINGS', json_encode( TCXUtilsHelper::convertToArray( $settings ),JSON_UNESCAPED_UNICODE ) );
316
 
317
  TCXWebhookHelper::send_webhook( WebHookTypes::SETTINGS_CHANGED, array( "user_id" => get_current_user_id() ) );
318
  //vd($data, true);
312
  $settings->$key = $setting_value;
313
  }
314
  }
315
+ update_option( 'WPLC_JSON_SETTINGS', TCXUtilsHelper::wplc_json_encode( TCXUtilsHelper::convertToArray( $settings ),JSON_UNESCAPED_UNICODE ) );
316
 
317
  TCXWebhookHelper::send_webhook( WebHookTypes::SETTINGS_CHANGED, array( "user_id" => get_current_user_id() ) );
318
  //vd($data, true);
readme.txt CHANGED
@@ -159,6 +159,9 @@ If the live chat box still does not appear on your website, please go through th
159
  Huge update with over 300 changes that include: Bugfixes, Vulnerability Fixes & Plugin Security, Plugin Optimization & Rebranding Updates. We suggest you remove any existing installations of this plugin and install 8.1.x fresh.
160
 
161
  == Changelog ==
 
 
 
162
  = 9.0.11 - 2020-07-30 =
163
  * Fix error on update plugin process.
164
 
159
  Huge update with over 300 changes that include: Bugfixes, Vulnerability Fixes & Plugin Security, Plugin Optimization & Rebranding Updates. We suggest you remove any existing installations of this plugin and install 8.1.x fresh.
160
 
161
  == Changelog ==
162
+ = 9.0.12 - 2020-07-31 =
163
+ * Fix utf8 encoding on settings json.
164
+
165
  = 9.0.11 - 2020-07-30 =
166
  * Fix error on update plugin process.
167
 
wp-live-chat-support.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP-Live Chat by 3CX
4
  Plugin URI: https://www.3cx.com/wp-live-chat/
5
  Description: The easiest to use website live chat plugin. Let your visitors chat with you and increase sales conversion rates with WP-Live Chat by 3CX.
6
- Version: 9.0.11
7
  Author: 3CX
8
  Author URI: https://www.3cx.com/wp-live-chat/
9
  Domain Path: /languages
@@ -76,13 +76,14 @@ register_uninstall_hook( __FILE__, 'wplc_uninstall' );
76
  function wplc_check_compatibility() {
77
  global $wplc_error;
78
  $compatible = wplc_check_version_compatibility();
79
- if ( ! $compatible->php || ! $compatible->wp ) {
80
  wp_register_style( "wplc-bootstrap", admin_url( '/admin.php?wplc_action=loadbootstrap', __FILE__ ), array(), WPLC_PLUGIN_VERSION );
81
  wp_enqueue_style( "wplc-bootstrap" );
82
  $wplc_error = new stdClass();
83
  $wplc_error->Title = __( "Incompatible Environment", "wp-live-chat-support" );
84
  $wplc_error->Message = ! $compatible->php ? __( "Your PHP version is lower than required.", "wp-live-chat-support" ) . "<br/>" : "";
85
- $wplc_error->Message = $wplc_error->Message . ( ! $compatible->wp ? __( "Your Wordpress version is lower than required.", "wp-live-chat-support" ) : "" );
 
86
  $wplc_error->HtmlContent = "";
87
  }
88
  }
@@ -283,6 +284,7 @@ function wplc_check_guid( $force_update = false ) {
283
  )
284
  );
285
  $response = wp_remote_post( WPLC_ACTIVATION_SERVER . '/api/v1', $data_array );
 
286
  if ( is_array( $response ) ) {
287
  if ( $response['response']['code'] == "200" ) {
288
  $data = json_decode( $response['body'], true );
@@ -339,6 +341,7 @@ function wplc_check_version_compatibility() {
339
  $result = new stdClass();
340
  $result->php = true;
341
  $result->wp = true;
 
342
 
343
 
344
  if ( version_compare( $wp_version, WPLC_MIN_WP_VERSION ) < 0 ) {
@@ -349,6 +352,12 @@ function wplc_check_version_compatibility() {
349
  $result->php = false;
350
  }
351
 
 
 
 
 
 
 
352
  return $result;
353
  }
354
 
3
  Plugin Name: WP-Live Chat by 3CX
4
  Plugin URI: https://www.3cx.com/wp-live-chat/
5
  Description: The easiest to use website live chat plugin. Let your visitors chat with you and increase sales conversion rates with WP-Live Chat by 3CX.
6
+ Version: 9.0.12
7
  Author: 3CX
8
  Author URI: https://www.3cx.com/wp-live-chat/
9
  Domain Path: /languages
76
  function wplc_check_compatibility() {
77
  global $wplc_error;
78
  $compatible = wplc_check_version_compatibility();
79
+ if ( ! $compatible->php || ! $compatible->wp || !$compatible->ie ) {
80
  wp_register_style( "wplc-bootstrap", admin_url( '/admin.php?wplc_action=loadbootstrap', __FILE__ ), array(), WPLC_PLUGIN_VERSION );
81
  wp_enqueue_style( "wplc-bootstrap" );
82
  $wplc_error = new stdClass();
83
  $wplc_error->Title = __( "Incompatible Environment", "wp-live-chat-support" );
84
  $wplc_error->Message = ! $compatible->php ? __( "Your PHP version is lower than required.", "wp-live-chat-support" ) . "<br/>" : "";
85
+ $wplc_error->Message = $wplc_error->Message . ( ! $compatible->wp ? __( "Your Wordpress version is lower than required.", "wp-live-chat-support" ) . "<br/>" : "");
86
+ $wplc_error->Message = $wplc_error->Message . ( ! $compatible->ie ? __( "Internet Explorer is not compatible with WP-Live Chat by 3CX plugin.", "wp-live-chat-support" ) : "" );
87
  $wplc_error->HtmlContent = "";
88
  }
89
  }
284
  )
285
  );
286
  $response = wp_remote_post( WPLC_ACTIVATION_SERVER . '/api/v1', $data_array );
287
+ update_option( 'WPLC_GUID', '' );
288
  if ( is_array( $response ) ) {
289
  if ( $response['response']['code'] == "200" ) {
290
  $data = json_decode( $response['body'], true );
341
  $result = new stdClass();
342
  $result->php = true;
343
  $result->wp = true;
344
+ $result->ie = true;
345
 
346
 
347
  if ( version_compare( $wp_version, WPLC_MIN_WP_VERSION ) < 0 ) {
352
  $result->php = false;
353
  }
354
 
355
+ $ua = htmlentities($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, 'UTF-8');
356
+ if (preg_match('~MSIE|Internet Explorer~i', $ua) || (strpos($ua, 'Trident/7.0') !== false && strpos($ua, 'rv:11.0') !== false)) {
357
+ $result->ie = false;
358
+ }
359
+
360
+
361
  return $result;
362
  }
363