WP Live Chat Support - Version 5.0.1

Version Description

  • 2015-08-05 - Medium Priority =
  • Refactored the code so that the live chat box will show up even if there is a JS error from another plugin or theme
  • Live chat box styling fixes: top image padding; centered the "conneting, please be patient" message and added padding
  • The live chat long poll connection will not automatically reinitialize if the connection times out or returns a 5xx error
Download this release

Release Info

Developer WP-LiveChat
Plugin Icon 128x128 WP Live Chat Support
Version 5.0.1
Comparing to
See all releases

Code changes from version 5.0.0 to 5.0.1

css/wplcstyle.css CHANGED
@@ -53,6 +53,10 @@
53
 
54
  #wp-live-chat-4 {
55
  }
 
 
 
 
56
 
57
  #wp-live-chat {
58
  position: fixed;
@@ -190,7 +194,7 @@
190
  }
191
  #wp-live-chat-inner-image-div{
192
  overflow: hidden;
193
- height: 40px;
194
  }
195
 
196
  .wplc_close.wplc_left #wp-live-chat-1{
53
 
54
  #wp-live-chat-4 {
55
  }
56
+ #wp-live-chat-3 {
57
+ padding: 10px;
58
+ text-align: center;
59
+ }
60
 
61
  #wp-live-chat {
62
  position: fixed;
194
  }
195
  #wp-live-chat-inner-image-div{
196
  overflow: hidden;
197
+ height: 32px;
198
  }
199
 
200
  .wplc_close.wplc_left #wp-live-chat-1{
functions.php CHANGED
@@ -140,7 +140,7 @@ function wplc_record_chat_msg($from,$cid,$msg) {
140
  global $wplc_tblname_msgs;
141
 
142
  if ($from == "2") {
143
- if (!current_user_can("manage_options")) { die(); }
144
  }
145
 
146
  if ($from == "1") {
@@ -726,7 +726,7 @@ function wplc_mark_as_read_user_chat_messages($cid) {
726
  //here
727
  function wplc_return_admin_chat_messages($cid) {
728
 
729
- if (!current_user_can("manage_options")) { die(); }
730
  $wplc_settings = get_option("WPLC_SETTINGS");
731
 
732
 
@@ -793,7 +793,7 @@ function wplc_return_admin_chat_messages($cid) {
793
 
794
  }
795
  function wplc_mark_as_read_admin_chat_messages($mid) {
796
- if (!current_user_can("manage_options")) { die(); }
797
 
798
  global $wpdb;
799
  global $wplc_tblname_msgs;
140
  global $wplc_tblname_msgs;
141
 
142
  if ($from == "2") {
143
+ if (!current_user_can("wplc_ma_agent")) { die(); }
144
  }
145
 
146
  if ($from == "1") {
726
  //here
727
  function wplc_return_admin_chat_messages($cid) {
728
 
729
+ if (!current_user_can("wplc_ma_agent")) { die(); }
730
  $wplc_settings = get_option("WPLC_SETTINGS");
731
 
732
 
793
 
794
  }
795
  function wplc_mark_as_read_admin_chat_messages($mid) {
796
+ if (!current_user_can("wplc_ma_agent")) { die(); }
797
 
798
  global $wpdb;
799
  global $wplc_tblname_msgs;
js/wplc_error_handling.js ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ /* developed to stop other plugins and themes erroneous code from stopping our plugin from working */
2
+ window.onerror = function (errorMsg, url, lineNumber, column, errorObj) {
3
+ if (window.console) { console.log('Error: ' + errorMsg + ' \nScript: ' + url + ' \nLine: ' + lineNumber + ' \nColumn: ' + column + ' \nStackTrace: ' + errorObj); }
4
+ return true;
5
+ }
readme.txt CHANGED
@@ -194,6 +194,11 @@ It is highly recommended that you upgrade to WP Live Chat Support version 4.1.4
194
 
195
  == Changelog ==
196
 
 
 
 
 
 
197
  = 5.0.0 - Doppio Update - 2015-07-29 - Medium Priority =
198
  * New, modern chat dashboard
199
  * Better user handling (chat long polling)
194
 
195
  == Changelog ==
196
 
197
+ = 5.0.1 - 2015-08-05 - Medium Priority =
198
+ * Refactored the code so that the live chat box will show up even if there is a JS error from another plugin or theme
199
+ * Live chat box styling fixes: top image padding; centered the "conneting, please be patient" message and added padding
200
+ * The live chat long poll connection will not automatically reinitialize if the connection times out or returns a 5xx error
201
+
202
  = 5.0.0 - Doppio Update - 2015-07-29 - Medium Priority =
203
  * New, modern chat dashboard
204
  * Better user handling (chat long polling)
wp-live-chat-support.php CHANGED
@@ -3,13 +3,19 @@
3
  Plugin Name: WP Live Chat Support
4
  Plugin URI: http://www.wp-livechat.com
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 Support. No third party connection required!
6
- Version: 5.0.0
7
  Author: WP-LiveChat
8
  Author URI: http://www.wp-livechat.com
9
  */
10
 
11
 
12
- /* 5.0.0
 
 
 
 
 
 
13
  * New, modern chat dashboard
14
  * Better user handling (chat long polling)
15
  * Added a welcome page to the live chat dashboard
@@ -18,7 +24,6 @@
18
  * Bug fixes in the javascript that handles the live chat controls
19
  * Fixed the bug that stopped the chats from timing out after a certain amount of time
20
  *
21
- *
22
  * 4.4.4 - 2015-07-20 - Low Priority
23
  * Bug Fix: Big fixed that would cause the live chat to timeout during a conversation
24
  *
@@ -234,7 +239,7 @@ global $wplc_tblname_chats;
234
  global $wplc_tblname_msgs;
235
  $wplc_tblname_chats = $wpdb->prefix . "wplc_chat_sessions";
236
  $wplc_tblname_msgs = $wpdb->prefix . "wplc_chat_msgs";
237
- $wplc_version = "5.0.0";
238
 
239
  define('WPLC_BASIC_PLUGIN_DIR', dirname(__FILE__));
240
  define('WPLC_BASIC_PLUGIN_URL', plugins_url() . "/wp-live-chat-support/");
@@ -343,43 +348,71 @@ function wplc_admin_menu() {
343
  add_submenu_page('wplivechat-menu', __('Support', 'wplivechat'), __('Support', 'wplivechat'), 'manage_options', 'wplivechat-menu-support-page', 'wplc_support_menu');
344
  }
345
 
346
- add_action('wp_head', 'wplc_user_top_js');
347
 
348
- function wplc_user_top_js() {
349
- if(function_exists('wplc_display_chat_contents')){
350
- $display_contents = wplc_display_chat_contents();
351
- } else {
352
- $display_contents = 1;
353
- }
354
- if($display_contents >= 1){
355
- echo "<!-- DEFINING DO NOT CACHE -->";
356
- if (!defined('DONOTCACHEPAGE')) {
357
- define('DONOTCACHEPAGE', true);
 
358
  }
359
- if (!defined('DONOTCACHEDB')) {
360
- define('DONOTCACHEDB', true);
 
 
 
 
 
361
  }
362
- $ajax_nonce = wp_create_nonce("wplc");
363
- wp_register_script('wplc-user-jquery-cookie', plugins_url('/js/jquery-cookie.js', __FILE__), array('jquery-ui-draggable'));
364
- wp_enqueue_script('wplc-user-jquery-cookie');
365
- $wplc_settings = get_option("WPLC_SETTINGS");
366
- ?>
367
 
368
- <script type="text/javascript">
369
- <?php if (!function_exists("wplc_register_pro_version")) { ?>
370
- /* var wplc_ajaxurl = '<?php echo plugins_url('/ajax.php', __FILE__); ?>'; */
371
- var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>';
372
- var wplc_ajaxurl = ajaxurl;
373
- <?php } ?>
374
- var wplc_nonce = '<?php echo $ajax_nonce; ?>';
375
- </script>
376
- <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
377
  }
378
- }
379
 
380
- function wplc_draw_user_box() {
 
381
 
 
 
 
 
382
  global $wplc_is_mobile;
 
383
 
384
  $wplc_settings = get_option("WPLC_SETTINGS");
385
 
@@ -400,8 +433,11 @@ function wplc_draw_user_box() {
400
  $wplc_display = 'hide';
401
  }
402
 
403
- wp_register_script('wplc-user-script', plugins_url('/js/wplc_u.js', __FILE__));
404
  wp_enqueue_script('wplc-user-script');
 
 
 
405
 
406
  wp_localize_script('wplc-user-script', 'wplc_hide_chat', null);
407
  wp_localize_script('wplc-user-script', 'wplc_plugin_url', plugins_url());
@@ -420,9 +456,51 @@ function wplc_draw_user_box() {
420
  }
421
  wp_localize_script('wplc-user-script', 'wplc_gravatar_image', $wplc_grav_image);
422
 
423
- wp_enqueue_script('jquery');
424
- wp_enqueue_script('jquery-ui-core');
425
- wp_enqueue_script('jquery-ui-draggable');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
426
  if(function_exists('wplc_display_chat_contents')){
427
  if(wplc_display_chat_contents() >= 1){
428
  wplc_output_box();
3
  Plugin Name: WP Live Chat Support
4
  Plugin URI: http://www.wp-livechat.com
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 Support. No third party connection required!
6
+ Version: 5.0.1
7
  Author: WP-LiveChat
8
  Author URI: http://www.wp-livechat.com
9
  */
10
 
11
 
12
+ /*
13
+ * 5.0.1 - 2015-08-05 - Medium Priority
14
+ * Refactored the code so that the live chat box will show up even if there is a JS error from another plugin or theme
15
+ * Live chat box styling fixes: top image padding; centered the "conneting, please be patient" message and added padding
16
+ * The live chat long poll connection will not automatically reinitialize if the connection times out or returns a 5xx error
17
+ *
18
+ * 5.0.0 - 2015-07-29 - Doppio update - Medium Priority
19
  * New, modern chat dashboard
20
  * Better user handling (chat long polling)
21
  * Added a welcome page to the live chat dashboard
24
  * Bug fixes in the javascript that handles the live chat controls
25
  * Fixed the bug that stopped the chats from timing out after a certain amount of time
26
  *
 
27
  * 4.4.4 - 2015-07-20 - Low Priority
28
  * Bug Fix: Big fixed that would cause the live chat to timeout during a conversation
29
  *
239
  global $wplc_tblname_msgs;
240
  $wplc_tblname_chats = $wpdb->prefix . "wplc_chat_sessions";
241
  $wplc_tblname_msgs = $wpdb->prefix . "wplc_chat_msgs";
242
+ $wplc_version = "5.0.1";
243
 
244
  define('WPLC_BASIC_PLUGIN_DIR', dirname(__FILE__));
245
  define('WPLC_BASIC_PLUGIN_URL', plugins_url() . "/wp-live-chat-support/");
348
  add_submenu_page('wplivechat-menu', __('Support', 'wplivechat'), __('Support', 'wplivechat'), 'manage_options', 'wplivechat-menu-support-page', 'wplc_support_menu');
349
  }
350
 
 
351
 
352
+
353
+ add_action("init","wplc_load_user_js",0);
354
+
355
+
356
+ function wplc_load_user_js () {
357
+
358
+ if (!is_admin()) {
359
+ if(function_exists('wplc_display_chat_contents')){
360
+ $display_contents = wplc_display_chat_contents();
361
+ } else {
362
+ $display_contents = 1;
363
  }
364
+
365
+ if(function_exists('wplc_is_user_banned')){
366
+ $user_banned = wplc_is_user_banned();
367
+ } else if (function_exists('wplc_is_user_banned')){
368
+ $user_banned = wplc_is_user_banned_basic();
369
+ } else {
370
+ $user_banned = 0;
371
  }
372
+ if($display_contents && $user_banned == 0){
 
 
 
 
373
 
374
+ /* do not show if pro is outdated */
375
+ global $wplc_pro_version;
376
+ if (isset($wplc_pro_version)) {
377
+ $float_version = floatval($wplc_pro_version);
378
+ if ($float_version < 4 || $wplc_pro_version == "4.1.0" || $wplc_pro_version == "4.1.1") {
379
+ return;
380
+ }
381
+ }
382
+
383
+ if (function_exists("wplc_register_pro_version")) {
384
+ $wplc_settings = get_option("WPLC_SETTINGS");
385
+ if (!class_exists('Mobile_Detect')) {
386
+ require_once (plugin_dir_path(__FILE__) . 'includes/Mobile_Detect.php');
387
+ }
388
+ $wplc_detect_device = new Mobile_Detect;
389
+ $wplc_is_mobile = $wplc_detect_device->isMobile();
390
+ if ($wplc_is_mobile && !isset($wplc_settings['wplc_enabled_on_mobile']) && $wplc_settings['wplc_enabled_on_mobile'] != 1) {
391
+ return;
392
+ }
393
+ if (function_exists('wplc_hide_chat_when_offline')) {
394
+ $wplc_hide_chat = wplc_hide_chat_when_offline();
395
+ if (!$wplc_hide_chat) {
396
+ wplc_push_js_to_front_pro();
397
+ }
398
+ } else {
399
+ wplc_push_js_to_front_pro();
400
+ }
401
+ } else {
402
+ wplc_push_js_to_front_basic();
403
+ }
404
+ }
405
  }
 
406
 
407
+
408
+
409
 
410
+
411
+ }
412
+
413
+ function wplc_push_js_to_front_basic() {
414
  global $wplc_is_mobile;
415
+ wp_enqueue_script('jquery');
416
 
417
  $wplc_settings = get_option("WPLC_SETTINGS");
418
 
433
  $wplc_display = 'hide';
434
  }
435
 
436
+ wp_register_script('wplc-user-script', plugins_url('/js/wplc_u.js', __FILE__),array('jquery'));
437
  wp_enqueue_script('wplc-user-script');
438
+ wp_register_script('wplc-user-jquery-cookie', plugins_url('/js/jquery-cookie.js', __FILE__), array('wplc-user-script'),false, false);
439
+ wp_enqueue_script('wplc-user-jquery-cookie');
440
+
441
 
442
  wp_localize_script('wplc-user-script', 'wplc_hide_chat', null);
443
  wp_localize_script('wplc-user-script', 'wplc_plugin_url', plugins_url());
456
  }
457
  wp_localize_script('wplc-user-script', 'wplc_gravatar_image', $wplc_grav_image);
458
 
459
+ wp_enqueue_script('jquery-ui-core',false,array('wplc-user-script'),false,false);
460
+ wp_enqueue_script('jquery-ui-draggable',false,array('wplc-user-script'),false,false);
461
+
462
+ }
463
+ if (function_exists('wplc_pro_user_top_js')) {
464
+ add_action('wp_head', 'wplc_pro_user_top_js');
465
+
466
+ } else {
467
+ add_action('wp_head', 'wplc_user_top_js');
468
+
469
+ }
470
+
471
+ function wplc_user_top_js() {
472
+ if(function_exists('wplc_display_chat_contents')){
473
+ $display_contents = wplc_display_chat_contents();
474
+ } else {
475
+ $display_contents = 1;
476
+ }
477
+ if($display_contents >= 1){
478
+ echo "<!-- DEFINING DO NOT CACHE -->";
479
+ if (!defined('DONOTCACHEPAGE')) {
480
+ define('DONOTCACHEPAGE', true);
481
+ }
482
+ if (!defined('DONOTCACHEDB')) {
483
+ define('DONOTCACHEDB', true);
484
+ }
485
+ $ajax_nonce = wp_create_nonce("wplc");
486
+ $wplc_settings = get_option("WPLC_SETTINGS");
487
+ ?>
488
+
489
+ <script type="text/javascript">
490
+ <?php if (!function_exists("wplc_register_pro_version")) { ?>
491
+ /* var wplc_ajaxurl = '<?php echo plugins_url('/ajax.php', __FILE__); ?>'; */
492
+ var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>';
493
+ var wplc_ajaxurl = ajaxurl;
494
+ <?php } ?>
495
+ var wplc_nonce = '<?php echo $ajax_nonce; ?>';
496
+ </script>
497
+ <?php
498
+ }
499
+ }
500
+
501
+ function wplc_draw_user_box() {
502
+
503
+
504
  if(function_exists('wplc_display_chat_contents')){
505
  if(wplc_display_chat_contents() >= 1){
506
  wplc_output_box();