WP Live Chat Support - Version 7.1.00

Version Description

  • 2017-06-15 - Medium priority =
  • Modernised the live chat box
  • Fixed a bug that caused the wrong agent name to show up in the "typing" element after a chat was transferred
  • Other minor bug fixes
  • Added better support for caching systems (style sheets now have a version tag)
  • Added additional support for the new features of the Cloud server
  • Replaced all appropriate references of get_option('siteurl'); with site_url(); to embrace SSL where needed
  • Images are now preloaded on the front end for a better user experience
  • Fixed a fatal error found on some installations (https://github.com/CodeCabin/wp-live-chat-support/issues/329)
  • Fixed a bug that cause the "Retry chat" to not work with the modern chat box
  • Fixed a bug with the missed chat functionality - when an agent missed the chat, the chat ID would change and the agent would not be able to communicate with the visitor
  • Fixed a bug with the listing of all missed chats
  • Fixed a bug that sent pings to the node server when it was not necessary, causing an overload of the node server
  • Fixed a bug that did not allow you to view the chat history of a missed chat
  • Fixed a bug that caused the 'display name' and 'display avatar' to behave erratically
  • Fixed a bug that caused the time and date display functionality to behave erratically
  • Fixed a bug that caused a JavaScript error on the admin chat dashboard when a single visitor leaves the site
  • Fixed a bug that caused the chat widow to appear before the chat circle when engaged in a chat and moving from page to page
  • The visitor can now restart any chat that has been ended by an agent
  • You can now customize the text "The chat has been ended by the operator"
  • Fixed a bug that caused duplicate loading of messages
  • When using a custom element to open the chat window, that element now has a cursor pointer styled to it by default
  • Fixed a bug that incorrectly fired off ajax events when minimizing or maximizing the offline message box
  • Fixed a bug that caused the offline message box to show up incorrectly after being dragged
  • Fixed a bug that caused "maximize" notifications to not get sent through to agents when using the Node server
  • Fixed a bug that did not allow single missed chats to be deleted
  • Fixed a bug that caused the text input field to continually be focused on thereby causing issues
Download this release

Release Info

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

Code changes from version 7.0.08 to 7.1.00

ajax_new.php CHANGED
@@ -23,6 +23,8 @@ add_action('wp_ajax_nopriv_wplc_get_chat_box', 'wplc_init_ajax_callback');
23
 
24
  function wplc_init_ajax_callback() {
25
  @ob_start();
 
 
26
  $check = check_ajax_referer( 'wplc', 'security' );
27
 
28
  if ($check == 1) {
@@ -69,7 +71,13 @@ function wplc_init_ajax_callback() {
69
  session_write_close();
70
 
71
  if ($_POST['action'] == "wplc_get_chat_box") {
72
- echo wplc_output_box_5100(sanitize_text_field($_POST['cid']));
 
 
 
 
 
 
73
  }
74
 
75
  if($_POST['action'] == 'wplc_admin_long_poll'){
@@ -111,7 +119,8 @@ function wplc_init_ajax_callback() {
111
 
112
 
113
  if ($new_chat_data == "false") { $new_chat_data = false; }
114
-
 
115
  if($new_chat_data !== $old_chat_data){
116
  $array['old_chat_data'] = $old_chat_data;
117
  $array['wplc_update_admin_chat_table'] = $new_chat_data;
@@ -196,6 +205,8 @@ function wplc_init_ajax_callback() {
196
  wplc_update_chat_statuses();
197
  }
198
 
 
 
199
  if($_POST['cid'] == null || $_POST['cid'] == "" || $_POST['cid'] == "null" || $_POST['cid'] == 0){
200
  // echo 1;
201
 
@@ -237,10 +248,10 @@ function wplc_init_ajax_callback() {
237
  $array['aid'] = sanitize_text_field($_POST['cid']);
238
 
239
  $array = apply_filters("wplc_filter_user_long_poll_chat_loop_iteration",$array,$_POST,$i,$cdata);
240
-
241
 
242
  if($new_status == $_POST['status']){ // if status matches do the following
243
- if($_POST['status'] != 2){
244
  /* check if session_variable is different? if yes then stop this script completely. */
245
  if (isset($_POST['wplcsession']) && $_POST['wplcsession'] != '' && $i > 1) {
246
  $wplc_session_variable = sanitize_text_field($_POST['wplcsession']);
@@ -255,25 +266,28 @@ function wplc_init_ajax_callback() {
255
 
256
 
257
  if ($i == 1) {
258
- wplc_update_user_on_page(sanitize_text_field($_POST['cid']), sanitize_text_field($_POST['status']), sanitize_text_field($_POST['wplcsession']));
 
 
 
259
  }
260
  }
261
- if (intval($_POST['status']) == 0 || intval($_POST['status']) == 12){ // browsing - user tried to chat but admin didn't answer so turn back to browsing
 
262
  //wplc_update_user_on_page(sanitize_text_field($_POST['cid']), 0, sanitize_text_field($_POST['wplcsession']));
263
  //$array['status'] = 5;
264
- wplc_update_user_on_page(sanitize_text_field($_POST['cid']), 12, sanitize_text_field($_POST['wplcsession']));
265
  $array['status'] = 12;
266
  //$array['check'] = true;
267
 
268
  }
269
- else if($_POST['status'] == 3 || $_POST['status'] == 10){
270
  //wplc_update_user_on_page(sanitize_text_field($_POST['cid']), 3);
271
  $messages = wplc_return_user_chat_messages(sanitize_text_field($_POST['cid']),$wplc_settings,$cdata);
272
- if ( $_POST['status'] == 10 ) {
273
  $array['alert'] = true;
274
  }
275
  if ($messages){
276
- wplc_mark_as_read_user_chat_messages(sanitize_text_field($_POST['cid']));
277
  $array['status'] = 3;
278
  $array['data'] = $messages;
279
  $array['check'] = true;
@@ -290,6 +304,13 @@ function wplc_init_ajax_callback() {
290
  $array['check'] = true;
291
  }
292
  }
 
 
 
 
 
 
 
293
 
294
  /* check if this is part of the first run */
295
  if (isset($_POST['first_run']) && sanitize_text_field($_POST['first_run']) == 1) {
@@ -303,47 +324,55 @@ function wplc_init_ajax_callback() {
303
  $array['check'] = true;
304
  }
305
  } else { // statuses do not match
 
306
  $array['debug'] = $array['debug']. " ". "Doesnt match $new_status ".$_POST['status'];
307
  $array['status'] = $new_status;
308
- if($new_status == 1){ // completed
309
- wplc_update_user_on_page(sanitize_text_field($_POST['cid']), 8, sanitize_text_field($_POST['wplcsession']));
310
  $array['check'] = true;
311
  $array['status'] = 8;
312
- $array['data'] = __("Admin has closed and ended the chat","wplivechat");
 
 
 
313
  }
314
- else if(intval($new_status == 2)) { // pending
315
  $array['debug'] = "we are here ".__LINE__;
316
  $array['check'] = true;
317
- $array['wplc_name'] = wplc_return_chat_name(sanitize_text_field($_POST['cid']));
318
- $array['wplc_email'] = wplc_return_chat_email(sanitize_text_field($_POST['cid']));
319
- $messages = wplc_return_chat_messages(sanitize_text_field($_POST['cid']),false,true,$wplc_settings,$cdata,'array',false);
320
  if ($messages){
321
  $array['data'] = $messages;
322
  }
323
  }
324
- else if($new_status == 3){ // active
325
  $array['data'] = null;
326
  $array['check'] = true;
327
- if($_POST['status'] == 5){
 
328
  $array['sound'] = false;
329
  $messages = wplc_return_chat_messages(sanitize_text_field($_POST['cid']),false,true,$wplc_settings,$cdata,'array',false);
330
  if ($messages){
331
  $array['data'] = $messages;
332
  }
333
- }
334
  }
335
- else if($new_status == 7){ // timed out
336
  wplc_update_user_on_page(sanitize_text_field($_POST['cid']), 5, sanitize_text_field($_POST['wplcsession']));
337
  }
338
- else if($new_status == 9){ // user closed chat without inputting or starting a chat
339
  $array['check'] = true;
340
  }
341
- else if($new_status == 12){ // no answer from admin
 
342
  $array['data'] = wplc_return_no_answer_string(sanitize_text_field($_POST['cid']));
343
  $array['check'] = true;
 
344
  @do_action("wplc_hook_missed_chat",array("cid" => $_POST['cid'],"name" => $_POST['wplc_name'],"email" => $_POST['wplc_email']));
 
345
  }
346
- else if($new_status == 10){ // minimized active chat
347
  $array['check'] = true;
348
  if($_POST['status'] == 5){
349
  $messages = wplc_return_chat_messages(sanitize_text_field($_POST['cid']),false,true,$wplc_settings,$cdata,'array',false);
@@ -372,7 +401,7 @@ function wplc_init_ajax_callback() {
372
  break;
373
  }
374
  $i++;
375
-
376
  if (defined('WPLC_DELAY_BETWEEN_LOOPS')) { usleep(WPLC_DELAY_BETWEEN_LOOPS); } else { usleep(500000); }
377
 
378
  @ob_end_flush();
@@ -409,7 +438,6 @@ function wplc_init_ajax_callback() {
409
  }
410
  }
411
  if ($_POST['action'] == "wplc_start_chat") {
412
-
413
  if (isset($_POST['cid'])) {
414
  if ($_POST['name'] && $_POST['email']) {
415
  echo wplc_user_initiate_chat(sanitize_text_field($_POST['name']),sanitize_email($_POST['email']),sanitize_text_field($_POST['cid']), sanitize_text_field($_POST['wplcsession'])); // echo the chat session id
23
 
24
  function wplc_init_ajax_callback() {
25
  @ob_start();
26
+
27
+ $wplc_session_id = rand(0,9).rand(0,9).rand(0,9).rand(0,9).rand(0,9).rand(0,9).rand(0,9);
28
  $check = check_ajax_referer( 'wplc', 'security' );
29
 
30
  if ($check == 1) {
71
  session_write_close();
72
 
73
  if ($_POST['action'] == "wplc_get_chat_box") {
74
+ $continue = apply_filters( "wplc_version_check_continue", true );
75
+ if ($continue === true) {
76
+ echo wplc_output_box_5100(sanitize_text_field($_POST['cid']));
77
+ } else {
78
+ echo $continue;
79
+ }
80
+ die();
81
  }
82
 
83
  if($_POST['action'] == 'wplc_admin_long_poll'){
119
 
120
 
121
  if ($new_chat_data == "false") { $new_chat_data = false; }
122
+
123
+
124
  if($new_chat_data !== $old_chat_data){
125
  $array['old_chat_data'] = $old_chat_data;
126
  $array['wplc_update_admin_chat_table'] = $new_chat_data;
205
  wplc_update_chat_statuses();
206
  }
207
 
208
+
209
+
210
  if($_POST['cid'] == null || $_POST['cid'] == "" || $_POST['cid'] == "null" || $_POST['cid'] == 0){
211
  // echo 1;
212
 
248
  $array['aid'] = sanitize_text_field($_POST['cid']);
249
 
250
  $array = apply_filters("wplc_filter_user_long_poll_chat_loop_iteration",$array,$_POST,$i,$cdata);
251
+
252
 
253
  if($new_status == $_POST['status']){ // if status matches do the following
254
+ if( intval( $_POST['status'] ) != 2){
255
  /* check if session_variable is different? if yes then stop this script completely. */
256
  if (isset($_POST['wplcsession']) && $_POST['wplcsession'] != '' && $i > 1) {
257
  $wplc_session_variable = sanitize_text_field($_POST['wplcsession']);
266
 
267
 
268
  if ($i == 1) {
269
+ if (intval( $_POST['status'] ) != 12) {
270
+ /* we dont want to update the time if the user was not answered by the agent as this needs to eventually time out and become a "missed chat" - status: 0 */
271
+ wplc_update_user_on_page(sanitize_text_field($_POST['cid']), sanitize_text_field($_POST['status']), sanitize_text_field($_POST['wplcsession']));
272
+ }
273
  }
274
  }
275
+
276
+ if ( intval( $_POST['status'] ) == 0 || intval($_POST['status'] ) == 12 ){ // browsing - user tried to chat but admin didn't answer so turn back to browsing
277
  //wplc_update_user_on_page(sanitize_text_field($_POST['cid']), 0, sanitize_text_field($_POST['wplcsession']));
278
  //$array['status'] = 5;
 
279
  $array['status'] = 12;
280
  //$array['check'] = true;
281
 
282
  }
283
+ else if( intval($_POST['status'] ) == 3 || intval($_POST['status'] ) == 10){
284
  //wplc_update_user_on_page(sanitize_text_field($_POST['cid']), 3);
285
  $messages = wplc_return_user_chat_messages(sanitize_text_field($_POST['cid']),$wplc_settings,$cdata);
286
+ if ( intval( $_POST['status'] ) == 10 ) {
287
  $array['alert'] = true;
288
  }
289
  if ($messages){
290
+ wplc_mark_as_read_user_chat_messages( sanitize_text_field($_POST['cid']) );
291
  $array['status'] = 3;
292
  $array['data'] = $messages;
293
  $array['check'] = true;
304
  $array['check'] = true;
305
  }
306
  }
307
+ else if( intval( $new_status ) == 12){ // no answer from admin, for the second+ time.
308
+ $array['data'] = wplc_return_no_answer_string(sanitize_text_field($_POST['cid']));
309
+ $array['check'] = true;
310
+ @do_action("wplc_hook_missed_chat",array("cid" => $_POST['cid'],"name" => $_POST['wplc_name'],"email" => $_POST['wplc_email']));
311
+
312
+ }
313
+
314
 
315
  /* check if this is part of the first run */
316
  if (isset($_POST['first_run']) && sanitize_text_field($_POST['first_run']) == 1) {
324
  $array['check'] = true;
325
  }
326
  } else { // statuses do not match
327
+
328
  $array['debug'] = $array['debug']. " ". "Doesnt match $new_status ".$_POST['status'];
329
  $array['status'] = $new_status;
330
+ if( intval( $new_status ) == 1 ){ // completed
331
+ wplc_update_user_on_page( sanitize_text_field( $_POST['cid'] ), 8, sanitize_text_field( $_POST['wplcsession'] ) );
332
  $array['check'] = true;
333
  $array['status'] = 8;
334
+ $array['data'] = array();
335
+ $array['data'][9999] = array();
336
+ $array['data'][9999]['msg'] = __("Admin has closed and ended the chat","wplivechat");
337
+
338
  }
339
+ else if( intval( $new_status ) == 2 ) { // pending
340
  $array['debug'] = "we are here ".__LINE__;
341
  $array['check'] = true;
342
+ $array['wplc_name'] = wplc_return_chat_name( sanitize_text_field($_POST['cid'] ) );
343
+ $array['wplc_email'] = wplc_return_chat_email( sanitize_text_field($_POST['cid'] ) );
344
+ $messages = wplc_return_chat_messages( sanitize_text_field($_POST['cid']), false, true, $wplc_settings, $cdata, 'array', false );
345
  if ($messages){
346
  $array['data'] = $messages;
347
  }
348
  }
349
+ else if( intval( $new_status ) == 3 ){ // active
350
  $array['data'] = null;
351
  $array['check'] = true;
352
+
353
+ if($_POST['status'] == 5 || $_POST['status'] == 3){
354
  $array['sound'] = false;
355
  $messages = wplc_return_chat_messages(sanitize_text_field($_POST['cid']),false,true,$wplc_settings,$cdata,'array',false);
356
  if ($messages){
357
  $array['data'] = $messages;
358
  }
359
+ }
360
  }
361
+ else if( intval( $new_status ) == 7){ // timed out
362
  wplc_update_user_on_page(sanitize_text_field($_POST['cid']), 5, sanitize_text_field($_POST['wplcsession']));
363
  }
364
+ else if( intval( $new_status ) == 9){ // user closed chat without inputting or starting a chat
365
  $array['check'] = true;
366
  }
367
+ else if( intval( $new_status ) == 12){ // no answer from admin
368
+
369
  $array['data'] = wplc_return_no_answer_string(sanitize_text_field($_POST['cid']));
370
  $array['check'] = true;
371
+ wplc_update_user_on_page(sanitize_text_field($_POST['cid']), 12, sanitize_text_field($_POST['wplcsession']));
372
  @do_action("wplc_hook_missed_chat",array("cid" => $_POST['cid'],"name" => $_POST['wplc_name'],"email" => $_POST['wplc_email']));
373
+
374
  }
375
+ else if( intval( $new_status ) == 10 ) { // minimized active chat
376
  $array['check'] = true;
377
  if($_POST['status'] == 5){
378
  $messages = wplc_return_chat_messages(sanitize_text_field($_POST['cid']),false,true,$wplc_settings,$cdata,'array',false);
401
  break;
402
  }
403
  $i++;
404
+
405
  if (defined('WPLC_DELAY_BETWEEN_LOOPS')) { usleep(WPLC_DELAY_BETWEEN_LOOPS); } else { usleep(500000); }
406
 
407
  @ob_end_flush();
438
  }
439
  }
440
  if ($_POST['action'] == "wplc_start_chat") {
 
441
  if (isset($_POST['cid'])) {
442
  if ($_POST['name'] && $_POST['email']) {
443
  echo wplc_user_initiate_chat(sanitize_text_field($_POST['name']),sanitize_email($_POST['email']),sanitize_text_field($_POST['cid']), sanitize_text_field($_POST['wplcsession'])); // echo the chat session id
css/admin-chat-box-style.css CHANGED
@@ -7,4 +7,21 @@
7
  margin-left: 10px;
8
  font-style: italic;
9
  color: grey !important;
10
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  margin-left: 10px;
8
  font-style: italic;
9
  color: grey !important;
10
+ }
11
+
12
+ .admin_chat_box_inner span.timedate {
13
+ clear: both;
14
+ position: relative;
15
+ font-size: 0.8em;
16
+ font-style:italic
17
+ }
18
+ .wplc-msg-float-left {
19
+ left: 32px;
20
+ float:left;
21
+ }
22
+ .wplc-msg-float-right {
23
+ right: 32px;
24
+ float:right;
25
+ }
26
+
27
+
css/chat-style.css CHANGED
@@ -992,4 +992,32 @@ span.wplc_system_notification {
992
  .wplc-require-user-info__item {
993
  margin-bottom: 5px;
994
 
995
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
992
  .wplc-require-user-info__item {
993
  margin-bottom: 5px;
994
 
995
+ }
996
+ .wplc-chat-box-notification--disabled {
997
+ padding: 5px;
998
+ display: block;
999
+ width: 40%;
1000
+ margin-left: auto;
1001
+ margin-right: auto;
1002
+ border: 1px solid #d26d6d;
1003
+ background-color: #f3bfbf;
1004
+ font-weight: bold;
1005
+ }
1006
+
1007
+
1008
+ .admin_chat_box_inner span.timedate {
1009
+ clear: both;
1010
+ position: relative;
1011
+ font-size: 0.8em;
1012
+ font-style:italic
1013
+ }
1014
+ .wplc-msg-float-left {
1015
+ left: 32px;
1016
+ float:left;
1017
+ }
1018
+ .wplc-msg-float-right {
1019
+ right: 32px;
1020
+ float:right;
1021
+ }
1022
+
1023
+
css/themes/classic.css CHANGED
@@ -1,8 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  #wp-live-chat textarea {
2
  width: 100%;
3
- height: 100px;
4
  }
5
- #wp-live-chat input, #wp-live-chat textarea, #wp-live-chat select{
 
 
 
6
  border: 1px solid rgba(0, 0, 0, 0.1);
7
  border-radius: 2px;
8
  color: #2b2b2b;
@@ -13,6 +43,7 @@
13
  height: inherit;
14
  width: 100%;
15
  }
 
16
  #wplc_chatbox {
17
  padding: 5px;
18
  height: 190px;
@@ -241,10 +272,14 @@
241
  padding-right: 45px;
242
  height: 220px;
243
  }
244
-
245
  .wplc_left #wplc_chatbox, .wplc_right #wplc_chatbox{
246
  height: 330px !important;
247
  width: 240px;
 
 
 
 
248
  }
249
 
250
  .wplc_close.wplc_right #wp-live-chat-1{
@@ -263,6 +298,13 @@
263
  position: absolute;
264
  left: 8px;
265
  }
 
 
 
 
 
 
 
266
 
267
  .wplc_close.wplc_right #wp-live-chat-header{
268
  position: absolute;
@@ -295,14 +337,12 @@
295
  top: initial;
296
  }
297
 
298
-
299
- .wplc-user-message img{
300
  border-radius: 25px;
301
  position: absolute;
302
  top: 3px;
303
  right: -38px;
304
  }
305
-
306
  .wplc-admin-message img{
307
  border-radius: 25px;
308
  position: absolute;
@@ -411,7 +451,7 @@
411
  }
412
 
413
  #nifty_text_editor_holder {
414
- margin-top: -8px;
415
  margin-left: 4px;
416
  }
417
 
@@ -429,31 +469,24 @@
429
 
430
  #nifty_ratings_form {
431
  position: absolute;
432
- left: 65px;
433
- top: -3px;
434
  width: 250px;
435
  padding: 2px;
436
- border-radius: 2px;
437
  }
438
 
439
  input#nifty_ratings_comment {
440
- width: 70%;
441
  margin-bottom: 0px;
442
  line-height: inherit;
443
  font-size: 12px;
444
- top: -2px;
445
  position: relative;
 
446
  }
447
 
448
- #nifty_ratings_form:before {
449
- top: 11px;
450
- left: -7px;
451
- border-width: 6px 7px 6px 0;
452
- border-color: transparent #666;
453
- content: "";
454
- position: absolute;
455
- border-style: solid;
456
- }
457
 
458
  #nifty_ratings_comment {
459
  height: 25px !important;
@@ -461,16 +494,18 @@ input#nifty_ratings_comment {
461
  }
462
 
463
  #nifty_rating_button {
464
- float: right;
465
  border-style: none;
466
  width: 27%;
467
  border-radius: 2px;
468
  text-align: center;
469
  font-size: 12px;
470
- padding: 4px;
471
- top: 3px;
472
- right: 2px;
473
  position: relative;
 
 
474
  }
475
 
476
  #nifty_rating_thanks {
@@ -648,4 +683,18 @@ input#nifty_ratings_comment {
648
  position: absolute;
649
  bottom: 3px;
650
  padding: 3px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
651
  }
1
+ #wplc_chatmsg {
2
+ background-color: #fff !important;
3
+ font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
4
+ font-size: 15px;
5
+ line-height: 32px;
6
+ color: #60686e;
7
+ /* width: 100%; */
8
+ width: 275px !important;
9
+ height: 40px;
10
+ /* margin-bottom: 10px; */
11
+ border: 0;
12
+ border-radius: 5px;
13
+ background: #fff;
14
+ resize: none;
15
+ border: none;
16
+ white-space: pre-wrap;
17
+ word-wrap: break-word;
18
+ padding-left: 30px;
19
+ padding-right: 100px;
20
+ box-sizing: border-box;
21
+ min-height: 35px;
22
+ overflow-y: hidden;
23
+ padding: 5px !important;
24
+ margin-top: 10px;
25
+ background-color: #fff !important;
26
+ padding-left: 30px !important;
27
+ }
28
  #wp-live-chat textarea {
29
  width: 100%;
30
+
31
  }
32
+ .nifty_rating_icon {
33
+ margin-right: 10px;
34
+ }
35
+ #wp-live-chat-2-inner input, #wp-live-chat-2-inner textarea, #wp-live-chat-2-inner select{
36
  border: 1px solid rgba(0, 0, 0, 0.1);
37
  border-radius: 2px;
38
  color: #2b2b2b;
43
  height: inherit;
44
  width: 100%;
45
  }
46
+
47
  #wplc_chatbox {
48
  padding: 5px;
49
  height: 190px;
272
  padding-right: 45px;
273
  height: 220px;
274
  }
275
+ /*
276
  .wplc_left #wplc_chatbox, .wplc_right #wplc_chatbox{
277
  height: 330px !important;
278
  width: 240px;
279
+ }*/
280
+ #wplc_user_message_div {
281
+ border-top:1px solid #eee;
282
+ background-color:#FFF;
283
  }
284
 
285
  .wplc_close.wplc_right #wp-live-chat-1{
298
  position: absolute;
299
  left: 8px;
300
  }
301
+ span.wplc_system_notification {
302
+ display: block;
303
+ padding: 8px;
304
+ clear:both;
305
+ font-style: italic;
306
+ text-align: left;
307
+ }
308
 
309
  .wplc_close.wplc_right #wp-live-chat-header{
310
  position: absolute;
337
  top: initial;
338
  }
339
 
340
+ .wplc-user-message .wplc-user-message-avatar{
 
341
  border-radius: 25px;
342
  position: absolute;
343
  top: 3px;
344
  right: -38px;
345
  }
 
346
  .wplc-admin-message img{
347
  border-radius: 25px;
348
  position: absolute;
451
  }
452
 
453
  #nifty_text_editor_holder {
454
+ margin-top: 0;
455
  margin-left: 4px;
456
  }
457
 
469
 
470
  #nifty_ratings_form {
471
  position: absolute;
472
+ left: -40px;
473
+ top: -38px;
474
  width: 250px;
475
  padding: 2px;
476
+ border-radius: 4px;
477
  }
478
 
479
  input#nifty_ratings_comment {
480
+ width: 60%;
481
  margin-bottom: 0px;
482
  line-height: inherit;
483
  font-size: 12px;
484
+ top: 0px;
485
  position: relative;
486
+ float: left;
487
  }
488
 
489
+
 
 
 
 
 
 
 
 
490
 
491
  #nifty_ratings_comment {
492
  height: 25px !important;
494
  }
495
 
496
  #nifty_rating_button {
497
+ float: left;
498
  border-style: none;
499
  width: 27%;
500
  border-radius: 2px;
501
  text-align: center;
502
  font-size: 12px;
503
+ padding: 2px;
504
+ /* top: 3px; */
505
+ /* right: 2px; */
506
  position: relative;
507
+ margin-left: 10px;
508
+ margin-top:1px;
509
  }
510
 
511
  #nifty_rating_thanks {
683
  position: absolute;
684
  bottom: 3px;
685
  padding: 3px;
686
+ }
687
+
688
+ #wplc_chatbox span.timedate {
689
+ font-size: 0.8em;
690
+ display:block;
691
+ font-style:italic;
692
+ }
693
+ .wplc-msg-float-left {
694
+ margin-left: 15%;
695
+ text-align: left;
696
+ }
697
+ .wplc-msg-float-right {
698
+ margin-right: 15%;
699
+ text-align: right;
700
  }
css/themes/modern.css CHANGED
@@ -1,17 +1,72 @@
1
- #wp-live-chat textarea {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  width: 100%;
3
  height: 100px;
4
  }
5
  #wp-live-chat input, #wp-live-chat textarea {
6
- border: 1px solid rgba(0, 0, 0, 0.1);
7
- border-radius: 2px;
8
  color: #2b2b2b;
9
  padding: 8px 10px 7px;
10
- -webkit-box-sizing: border-box;
11
- -moz-box-sizing: border-box;
12
- box-sizing: border-box;
 
 
 
13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  }
 
 
 
 
 
 
15
  #wplc_chatbox {
16
  top: 35px;
17
  bottom: 113px;
@@ -21,9 +76,10 @@
21
  overflow-y: auto;
22
  padding:10px;
23
  width:100%;
 
24
  }
25
  #wp-live-chat-inner-container {
26
- padding:16px;
27
 
28
  }
29
 
@@ -40,16 +96,17 @@
40
  border: 0 !important;
41
  }
42
  #wplc_user_message_div {
43
- min-height: 100px;
44
  position: absolute;
45
- bottom: 0px;
46
- left: 0;
47
  width: 100%;
48
- padding: 10px;
49
- border-top:1px solid #eee;
50
- }
 
51
  }
52
 
 
53
  #wp-live-chat h4 {
54
  font-size: 20px;
55
  margin: 3px;
@@ -67,11 +124,18 @@
67
 
68
  #wp-live-chat-4 {
69
  position: fixed;
70
- top: 0;
71
- right: 0;
72
- height: 100%;
 
73
  width: 368px;
74
  max-width: 100%;
 
 
 
 
 
 
75
  }
76
  #wp-live-chat-3 {
77
  padding: 10px;
@@ -79,6 +143,7 @@
79
  }
80
 
81
  #wp-live-chat {
 
82
  position: fixed;
83
  z-index: 28000000;
84
  display: block;
@@ -92,6 +157,7 @@
92
  padding-right: 20px;
93
  color: #000;
94
  text-align:center;
 
95
  }
96
 
97
  #wp-live-chat-minimize {
@@ -137,18 +203,19 @@
137
  #wp-live-chat-2-info {
138
  font-size: 1em;
139
  display: block;
140
- width: 80%;
141
  overflow: hidden;
142
  text-align: center;
143
  margin: 0 auto;
144
- padding-bottom:10px;
 
 
 
145
  }
146
  #wp-live-chat-2-inner {
147
  padding: 20px 12px 26px;
148
  background-color: #fff;
149
  overflow: hidden;
150
- box-shadow: 0 0 3px rgba(0,0,0,.2);
151
- border-radius: 5px;
152
  }
153
 
154
  #wp-live-chat-2-img {
@@ -156,8 +223,24 @@
156
  }
157
 
158
  .wplc_offline {
159
- font-size: 1.1em;
160
- font-weight: 700;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
161
  }
162
 
163
  .wplc_logo_class {
@@ -165,49 +248,75 @@
165
  max-height:180px;
166
  }
167
  #wplc_logo {
168
- position: absolute;
169
  width: 100%;
170
- top: 41px;
 
171
  }
172
  #wp-live-chat-header{
173
- margin-bottom:25px;
174
- border-radius: 25px 25px;
 
175
  position:relative;
176
- width:50px;
177
- height:50px;
178
- -webkit-box-shadow: 0px 0px 5px 0px rgba(50, 50, 50, 0.5);
179
- -moz-box-shadow: 0px 0px 5px 0px rgba(50, 50, 50, 0.5);
180
- box-shadow: 0px 0px 5px 0px rgba(50, 50, 50, 0.5);
181
  cursor:pointer;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
182
  }
183
 
184
  #wp-live-chat-2 {
185
-
186
- z-index: 2147483000;
187
  position: fixed;
188
- height: 100%;
 
189
  width: 368px;
190
  max-width: 100%;
191
- bottom: 0;
192
- right: 0;
193
- background: #fafafb;
194
- background: rgba(250,250,251,.98);
195
- border-left: 1px solid #dadee2;
196
- box-shadow: 0 0 4px 1px rgba(0,0,0,.07);
197
-
198
-
199
-
200
  }
201
  #wp-live-chat-2 input{
202
- font-family: Helvetica Neue,Helvetica,Arial,sans-serif;
203
  font-size: 15px;
204
  line-height: 32px;
205
  color: #60686e;
206
  width: 100%;
207
- border: 1px solid #e4e5e7;
208
- border-radius: 2px;
209
- background-color: #fff;
210
-
211
  }
212
  .wplc-clear-float-message{
213
  clear: both;
@@ -225,12 +334,13 @@
225
 
226
  #wplc_message_div{
227
  text-align: center;
 
228
  }
229
  #wp-live-chat-inner-image-div{
230
  overflow: hidden;
231
  height: 32px;
232
  }
233
-
234
  .wplc_close.wplc_left #wp-live-chat-1{
235
  -ms-transform: rotate(90deg);
236
  -moz-transform: rotate(90deg);
@@ -248,18 +358,19 @@
248
  left: 39px;
249
  }
250
  .wplc_left #wp-live-chat-header{
251
- border-radius: 25px 25px;
252
  }
 
253
  .wplc_close.wplc_left #wp-live-chat-header{
254
  position: absolute;
255
  top: 0;
256
- width: 50px;
257
  bottom: 0;
258
  right: 0;
259
  left: 15px;
260
  }
261
  .wplc_open.wplc_left #wp-live-chat-header{
262
- border-radius: 0px 5px 0px 0;
263
  }
264
 
265
  .wplc_close.wplc_left .wp-live-chat-wrapper, .wplc_close.wplc_right .wp-live-chat-wrapper{
@@ -271,7 +382,7 @@
271
  }
272
  .wplc_close.wplc_left{
273
  padding-right: 45px;
274
- height: 220px;
275
  }
276
 
277
 
@@ -301,12 +412,9 @@
301
 
302
  .wplc_close.wplc_right{
303
  padding-left: 75px;
304
- height: 220px;
305
  border-radius: 5px 0px 0px 5px !important;
306
  }
307
- .wplc_open.wplc_right #wp-live-chat-header{
308
- border-radius: 5px 0px 0px 0;
309
- }
310
  .wplc_right{
311
  border-radius: 5px 0px 0px 5px !important;
312
  }
@@ -320,8 +428,7 @@
320
  right: 38px;
321
  top: initial;
322
  }
323
-
324
-
325
 
326
 
327
  .wplc-admin-message {
@@ -348,15 +455,75 @@
348
  left: -38px;
349
  border-radius: 15px;
350
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
351
  #wplc_chatbox_header {
352
- position: absolute;
353
- background-color: #FFF;
354
- background: rgba(255,255,255,.98);
355
  top: 0;
356
  right: 0;
357
- height: 35px;
358
- width: 367px;
359
- border-bottom: 1px solid #eee;
 
 
 
 
 
 
 
 
 
 
 
 
360
  }
361
  .wplc-admin-message:before {
362
  display: block;
@@ -375,9 +542,9 @@
375
  .wplc-user-message {
376
 
377
  padding:10px;
378
- -webkit-border-radius: 2px;
379
- -moz-border-radius: 2px;
380
- border-radius: 2px;
381
  border: 1px solid #ffdb99;
382
  margin-top:2px;
383
  background-color:#ffdb99;
@@ -430,18 +597,20 @@
430
  }
431
 
432
  #wplc_hovercard {
 
 
 
433
  position: fixed;
434
- bottom: 96px;
435
- right: 75px;
436
  width: 300px;
437
  height: 145px;
438
- border: 1px solid #ccc ;
439
  background-color: #FFF;
440
  border-radius: 5px;
441
  z-index: 9999999;
442
  height:auto;
443
  }
444
-
445
  #wplc_hovercard:before {
446
  content: "";
447
  position: absolute;
@@ -462,7 +631,7 @@
462
  border-color: #fafafb transparent;
463
  display: block;
464
  width: 0;
465
- }
466
 
467
  .wplc_button_standard {
468
  border: 1px solid #ED832F;
@@ -497,7 +666,7 @@
497
  line-height: 16px;
498
  }
499
  #wplc_hovercard_bottom{
500
- border-top: 1px solid #ccc;
501
  padding-top: 10px;
502
  height: 43px;
503
  border-bottom-right-radius: 5px;
@@ -521,6 +690,7 @@
521
  margin-right: 15px;
522
  border-style: none;
523
  line-height: 12px;
 
524
  }
525
 
526
  #wplc_first_message {
@@ -540,6 +710,7 @@
540
  padding-left: 10px;
541
  padding-right: 10px;
542
  width: 80px;
 
543
  }
544
  .wplc_hovercard_content_right {
545
  float: left;
@@ -558,15 +729,26 @@
558
  }
559
 
560
  .wplc_hovercard_content_right .wplc_offline {
561
- font-size:0.9em;
562
- font-weight:bold;
563
  }
564
 
565
  #wplc_message_div {
566
  margin-top: 20px;
567
  }
568
  #wp-live-chat-2-inner #wplc_start_chat_btn {
569
- width:100%;
 
 
 
 
 
 
 
 
 
 
 
570
  }
571
  #wplc_social_holder {
572
  position: absolute;
@@ -588,50 +770,66 @@
588
  }
589
 
590
  #nifty_text_editor_holder{
591
-
 
592
 
593
  }
594
  .nifty_attach_icon {
595
  position: absolute;
596
- bottom: 62px;
597
- right: 20px;
 
 
 
 
 
 
 
598
  }
599
-
600
  #nifty_ratings_holder {
601
- position: relative;
602
  z-index: 9999999999999999999999;
603
- left: 8px;
604
- top: 4px;
605
  }
606
-
607
  #nifty_ratings_form {
608
  position: absolute;
609
- left: 65px;
610
- top: -4px;
611
  width: 220px;
612
  padding: 2px;
613
  border-radius: 2px;
614
  }
615
-
 
 
 
 
 
 
 
 
 
616
  input#nifty_ratings_comment {
617
  width: 70%;
618
  margin-bottom: 0px;
619
  line-height: inherit;
620
  font-size: 12px;
621
- top: -1px;
622
  position: relative;
 
623
  }
624
-
625
- #nifty_ratings_form:before {
626
- top: 11px;
627
- left: -7px;
628
- border-width: 6px 7px 6px 0;
629
  border-color: transparent #666;
630
  content: "";
631
  position: absolute;
632
  border-style: solid;
633
  }
634
-
635
  #nifty_ratings_comment {
636
  height: 25px !important;
637
  margin-left: 2px;
@@ -644,63 +842,60 @@ input#nifty_ratings_comment {
644
  border-radius: 2px;
645
  text-align: center;
646
  font-size: 12px;
647
- padding: 4px;
648
- top: 1px;
649
  right: 2px;
650
  position: relative;
651
  }
652
 
653
- #nifty_rating_thanks {
654
- position: absolute;
655
- top: 0px;
656
- left: 58px;
657
- width: 200px;
658
- }
659
-
660
  #nifty_recording {
661
  margin-left: 5px;
 
 
 
662
  }
663
  .wplc_powered_by_link {
664
  font-size: 10px;
665
  padding: 5px;
666
  }
667
 
668
- #wplc_msg_notice { margin-left:4px !important; }
 
 
 
669
  .typing_indicator {
670
- width:100%;
671
- position:relative;
672
- height: 11px;
673
- z-index:99;
674
- opacity:0.3;
 
 
 
 
 
 
675
  font-size: 0.8em;
676
- font-style:italic;
677
- margin-left:4px;
678
- transition-property:all;
679
- -webkit-transition-property:all;
680
- -moz-transition-property:all;
681
- -o-transition-property:all;
682
- transition-duration:0.5s;
683
- -webkit-transition-duration:0.5s;
684
- -moz-transition-duration:0.5s;
685
- -o-transition-propdurationerty:0.5s;
686
  }
687
  .typing_indicator_active {
688
- position:relative;
689
- height:11px;
690
- opacity:0.9;
691
- transition-property:all;
692
- -webkit-transition-property:all;
693
- -moz-transition-property:all;
694
- -o-transition-property:all;
695
- transition-duration:0.5s;
696
- -webkit-transition-duration:0.5s;
697
- -moz-transition-duration:0.5s;
698
- -o-transition-propdurationerty:0.5s;
699
 
700
  }
701
 
702
  #wp-live-chat-2 select {
703
- font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
704
  font-size: 15px;
705
  line-height: 32px;
706
  width: 100%;
@@ -725,4 +920,105 @@ span.wplc_system_notification {
725
  }
726
  button.wplc_retry_chat {
727
  margin: 10px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
728
  }
1
+ #wplc_chatmsg {
2
+ background-color: #fff !important;
3
+ font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
4
+ font-size: 15px;
5
+ line-height: 32px;
6
+ color: #60686e;
7
+ /* width: 100%; */
8
+ width: 275px !important;
9
+ height: 40px;
10
+ /* margin-bottom: 10px; */
11
+ border: 0;
12
+ border-radius: 5px;
13
+ background: #fff;
14
+ resize: none;
15
+ border: none;
16
+ white-space: pre-wrap;
17
+ word-wrap: break-word;
18
+ padding-left: 30px;
19
+ padding-right: 100px;
20
+ box-sizing: border-box;
21
+ min-height: 35px;
22
+ overflow-y: hidden;
23
+ padding: 5px !important;
24
+ margin-top: 10px;
25
+ background-color: #fff !important;
26
+ padding-left: 30px !important;
27
+ }
28
+ #wplc_chatmsg:focus {
29
+ outline: none !important;
30
+ background-color: #fff;
31
+ box-shadow: none !important;
32
+ }
33
+
34
+ #wp-live-chat-inner-container textarea {
35
  width: 100%;
36
  height: 100px;
37
  }
38
  #wp-live-chat input, #wp-live-chat textarea {
 
 
39
  color: #2b2b2b;
40
  padding: 8px 10px 7px;
41
+ margin-bottom: 10px;
42
+ border: 0;
43
+ border-radius: 5px;
44
+ font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
45
+ font-weight:normal;
46
+ font-size:12px;
47
 
48
+
49
+ background-color: #fafafa;
50
+ resize: none;
51
+ border: none;
52
+ transition: background-color .2s ease,box-shadow .2s ease;
53
+ }
54
+ #wp-live-chat input:focus {
55
+ outline: none;
56
+ background-color: #fff;
57
+ box-shadow: 0 0 40px 0 rgba(150,165,190,.14);
58
+ }
59
+ #wp-live-chat textarea:focus {
60
+ outline: none;
61
+ background-color: #fff;
62
+ box-shadow: 0 0 40px 0 rgba(150,165,190,.14);
63
  }
64
+ #wp-live-chat select:focus {
65
+ outline: none;
66
+ background-color: #fff;
67
+ box-shadow: 0 0 40px 0 rgba(150,165,190,.14);
68
+ }
69
+
70
  #wplc_chatbox {
71
  top: 35px;
72
  bottom: 113px;
76
  overflow-y: auto;
77
  padding:10px;
78
  width:100%;
79
+ overflow-y: scroll;
80
  }
81
  #wp-live-chat-inner-container {
82
+ /* padding:16px; */
83
 
84
  }
85
 
96
  border: 0 !important;
97
  }
98
  #wplc_user_message_div {
99
+ min-height: 60px;
100
  position: absolute;
101
+ bottom: -60px;
 
102
  width: 100%;
103
+ background-color:#fff;
104
+ border-bottom-right-radius: 10px;
105
+ border-bottom-left-radius: 10px;
106
+ box-shadow: 0 0 40px 1px rgba(0,0,0,.07);
107
  }
108
 
109
+
110
  #wp-live-chat h4 {
111
  font-size: 20px;
112
  margin: 3px;
124
 
125
  #wp-live-chat-4 {
126
  position: fixed;
127
+ bottom: 150px;
128
+ right: 20px;
129
+ /* min-height: 350px; */
130
+ /* max-height: 500px; */
131
  width: 368px;
132
  max-width: 100%;
133
+ /* height: 80%; */
134
+ top: 10%;
135
+ border-top-left-radius: 15px;
136
+ border-top-right-radius: 15px;
137
+ box-shadow: 0 0 40px 0 rgba(150,165,190,.14);
138
+ z-index:28000000;
139
  }
140
  #wp-live-chat-3 {
141
  padding: 10px;
143
  }
144
 
145
  #wp-live-chat {
146
+ font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
147
  position: fixed;
148
  z-index: 28000000;
149
  display: block;
157
  padding-right: 20px;
158
  color: #000;
159
  text-align:center;
160
+ padding-top:18px;
161
  }
162
 
163
  #wp-live-chat-minimize {
203
  #wp-live-chat-2-info {
204
  font-size: 1em;
205
  display: block;
206
+ width: 100%;
207
  overflow: hidden;
208
  text-align: center;
209
  margin: 0 auto;
210
+ padding-bottom: 10px;
211
+ padding: 16px;
212
+ color: #fff;
213
+ padding-top:5px;
214
  }
215
  #wp-live-chat-2-inner {
216
  padding: 20px 12px 26px;
217
  background-color: #fff;
218
  overflow: hidden;
 
 
219
  }
220
 
221
  #wp-live-chat-2-img {
223
  }
224
 
225
  .wplc_offline {
226
+
227
+
228
+ }
229
+ .wplc_agent_involved {
230
+ margin-top:5px;
231
+ }
232
+ .wplc_agent_info {
233
+ display:block;
234
+ overflow:auto;
235
+
236
+ }
237
+ .wplc_agent_name {
238
+ font-weight: bold;
239
+ margin-top: 18px;
240
+ display: block;
241
+ float: left;
242
+ margin-left: 10px;
243
+ font-size: 1.2em;
244
  }
245
 
246
  .wplc_logo_class {
248
  max-height:180px;
249
  }
250
  #wplc_logo {
251
+ /* position: absolute; */
252
  width: 100%;
253
+ /* top: 16px; */
254
+ padding-top: 13px;
255
  }
256
  #wp-live-chat-header{
257
+
258
+ margin-bottom:14px;
259
+ border-radius: 62px 62px;
260
  position:relative;
261
+ width:62px;
262
+ height:62px;
263
+ -webkit-box-shadow: 0 5px 40px rgba(0,0,0,.16)!important;
264
+ -moz-box-shadow: 0 5px 40px rgba(0,0,0,.16)!important;
265
+ box-shadow: 0 5px 40px rgba(0,0,0,.16)!important;
266
  cursor:pointer;
267
+
268
+ transform: rotate(0deg);
269
+ -o-transform: rotate(0deg);
270
+ -ms-transform: rotate(0deg);
271
+ -moz-transform: rotate(0deg);
272
+ -webkit-transform: rotate(0deg);
273
+
274
+ transition: all 300ms ease;
275
+ -webkit-transition: all 300ms ease;
276
+ -moz-transition: all 300ms ease;
277
+ -ms-transition: all 300ms ease;;
278
+ -o-transition: all 300ms ease;
279
+
280
+ }
281
+ #wp-live-chat-header.active {
282
+ transform: rotate(-90deg);
283
+ -o-transform: rotate(-90deg);
284
+ -ms-transform: rotate(-90deg);
285
+ -moz-transform: rotate(-90deg);
286
+ -webkit-transform: rotate(-90deg);
287
+
288
+ transition: all 300ms ease;
289
+ -webkit-transition: all 300ms ease;
290
+ -moz-transition: all 300ms ease;
291
+ -ms-transition: all 300ms ease;;
292
+ -o-transition: all 300ms ease;
293
  }
294
 
295
  #wp-live-chat-2 {
296
+ z-index: 2147483000;
 
297
  position: fixed;
298
+ /* min-height: 350px; */
299
+
300
  width: 368px;
301
  max-width: 100%;
302
+ bottom: 90px;
303
+ right: 20px;
304
+ background: #fff;
305
+ box-shadow: 0 0 40px 1px rgba(0,0,0,.07);
306
+ overflow: auto;
307
+ display: block;
308
+ border-radius: 10px;
309
+ border-radius: 10px;
 
310
  }
311
  #wp-live-chat-2 input{
312
+ font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
313
  font-size: 15px;
314
  line-height: 32px;
315
  color: #60686e;
316
  width: 100%;
317
+ margin-bottom: 10px;
318
+ border: 0;
319
+ border-radius: 5px;
 
320
  }
321
  .wplc-clear-float-message{
322
  clear: both;
334
 
335
  #wplc_message_div{
336
  text-align: center;
337
+ padding:16px;
338
  }
339
  #wp-live-chat-inner-image-div{
340
  overflow: hidden;
341
  height: 32px;
342
  }
343
+ /*
344
  .wplc_close.wplc_left #wp-live-chat-1{
345
  -ms-transform: rotate(90deg);
346
  -moz-transform: rotate(90deg);
358
  left: 39px;
359
  }
360
  .wplc_left #wp-live-chat-header{
361
+ border-radius: 62px 62px;
362
  }
363
+
364
  .wplc_close.wplc_left #wp-live-chat-header{
365
  position: absolute;
366
  top: 0;
367
+ width: 62px;
368
  bottom: 0;
369
  right: 0;
370
  left: 15px;
371
  }
372
  .wplc_open.wplc_left #wp-live-chat-header{
373
+ border-radius: 62px;
374
  }
375
 
376
  .wplc_close.wplc_left .wp-live-chat-wrapper, .wplc_close.wplc_right .wp-live-chat-wrapper{
382
  }
383
  .wplc_close.wplc_left{
384
  padding-right: 45px;
385
+ height: 120px;
386
  }
387
 
388
 
412
 
413
  .wplc_close.wplc_right{
414
  padding-left: 75px;
415
+ height: 120px;
416
  border-radius: 5px 0px 0px 5px !important;
417
  }
 
 
 
418
  .wplc_right{
419
  border-radius: 5px 0px 0px 5px !important;
420
  }
428
  right: 38px;
429
  top: initial;
430
  }
431
+ */
 
432
 
433
 
434
  .wplc-admin-message {
455
  left: -38px;
456
  border-radius: 15px;
457
  }
458
+
459
+
460
+ .wplc-shrink .wplc_agent_involved {
461
+ float: left;
462
+ margin-left: 30px;
463
+ margin-top: 3px;
464
+ width:40px;
465
+ height:40px;
466
+
467
+ }
468
+ .wplc-shrink {
469
+ height: 50px !important;
470
+ }
471
+
472
+ .wplc-shrink .wplc_agent_name {
473
+ float: left;
474
+ margin-left: 10px;
475
+ margin-top: -10px;
476
+ }
477
+
478
+ .wplc-shrink .wplc_agent_infosection {
479
+ display: none;
480
+ }
481
+
482
+ .wplc_agent_infosection {
483
+ display: block;
484
+ clear: both;
485
+ float: left;
486
+ margin-left: 45px;
487
+ margin-top: 20px;
488
+ font-weight: 100;
489
+ text-align:left;
490
+ }
491
+
492
+
493
+ .wplc_agent_tagline {
494
+ display: block;
495
+ clear: both;
496
+ float: left;
497
+ margin-left: 45px;
498
+ font-weight: 100;
499
+
500
+ }
501
+
502
+ #wplc_chatbox {
503
+ transition:all 0.2s ease;
504
+ }
505
+
506
  #wplc_chatbox_header {
507
+ /* position: absolute; */
508
+ /* background-color: #FFF; */
509
+ /* background: rgba(255,255,255,.98); */
510
  top: 0;
511
  right: 0;
512
+ /* height: 60px; */
513
+ /* width: 367px; */
514
+ /* border-bottom: 1px solid #eee; */
515
+ border-top-left-radius: 10px;
516
+ border-top-right-radius: 10px;
517
+ box-shadow: 0 5px 20px -2px rgba(0,0,0,.16) !important;
518
+ margin-top:0px;
519
+ opacity:0.90;
520
+ transition: all .2s ease;
521
+ padding-bottom:18px;
522
+ }
523
+ #wplc_chatbox_header_bg {
524
+ border-top-left-radius: 10px;
525
+ border-top-right-radius: 10px;
526
+
527
  }
528
  .wplc-admin-message:before {
529
  display: block;
542
  .wplc-user-message {
543
 
544
  padding:10px;
545
+ -webkit-border-radius: 26x;
546
+ -moz-border-radius: 26x;
547
+ border-radius: 6px;
548
  border: 1px solid #ffdb99;
549
  margin-top:2px;
550
  background-color:#ffdb99;
597
  }
598
 
599
  #wplc_hovercard {
600
+ -webkit-box-shadow: 0 5px 40px rgba(0,0,0,.16)!important;
601
+ -moz-box-shadow: 0 5px 40px rgba(0,0,0,.16)!important;
602
+ box-shadow: 0 5px 40px rgba(0,0,0,.16) !important;
603
  position: fixed;
604
+ bottom: 110px;
605
+ right: 20px;
606
  width: 300px;
607
  height: 145px;
 
608
  background-color: #FFF;
609
  border-radius: 5px;
610
  z-index: 9999999;
611
  height:auto;
612
  }
613
+ /*
614
  #wplc_hovercard:before {
615
  content: "";
616
  position: absolute;
631
  border-color: #fafafb transparent;
632
  display: block;
633
  width: 0;
634
+ }*/
635
 
636
  .wplc_button_standard {
637
  border: 1px solid #ED832F;
666
  line-height: 16px;
667
  }
668
  #wplc_hovercard_bottom{
669
+
670
  padding-top: 10px;
671
  height: 43px;
672
  border-bottom-right-radius: 5px;
690
  margin-right: 15px;
691
  border-style: none;
692
  line-height: 12px;
693
+ font-weight: normal;
694
  }
695
 
696
  #wplc_first_message {
710
  padding-left: 10px;
711
  padding-right: 10px;
712
  width: 80px;
713
+ font-weight:normal;
714
  }
715
  .wplc_hovercard_content_right {
716
  float: left;
729
  }
730
 
731
  .wplc_hovercard_content_right .wplc_offline {
732
+
733
+
734
  }
735
 
736
  #wplc_message_div {
737
  margin-top: 20px;
738
  }
739
  #wp-live-chat-2-inner #wplc_start_chat_btn {
740
+ margin-left: auto;
741
+ margin-right: auto;
742
+ display: block;
743
+ padding-left: 30px;
744
+ padding-right: 30px;
745
+ }
746
+ #wp-live-chat-2-inner #wplc_na_msg_btn {
747
+ margin-left: auto;
748
+ margin-right: auto;
749
+ display: block;
750
+ padding-left: 30px;
751
+ padding-right: 30px;
752
  }
753
  #wplc_social_holder {
754
  position: absolute;
770
  }
771
 
772
  #nifty_text_editor_holder{
773
+ display:none;
774
+
775
 
776
  }
777
  .nifty_attach_icon {
778
  position: absolute;
779
+ bottom: 22px;
780
+ right: 65px;
781
+ color:#999;
782
+ font-size:20px;
783
+ }
784
+ .nifty_rating_icon {
785
+ margin-right: 10px;
786
+ color:#999;
787
+ font-size: 17px;
788
  }
 
789
  #nifty_ratings_holder {
790
+ position: absolute;
791
  z-index: 9999999999999999999999;
792
+ right: 6px;
793
+ top: 16px;
794
  }
 
795
  #nifty_ratings_form {
796
  position: absolute;
797
+ left: -165px;
798
+ top: -52px;
799
  width: 220px;
800
  padding: 2px;
801
  border-radius: 2px;
802
  }
803
+ #nifty_rating_thanks {
804
+ position: absolute;
805
+ width: 200px;
806
+ margin-left: 5px;
807
+ position: absolute;
808
+ top: -22px;
809
+ right: 0px;
810
+ text-align: right;
811
+ }
812
+
813
  input#nifty_ratings_comment {
814
  width: 70%;
815
  margin-bottom: 0px;
816
  line-height: inherit;
817
  font-size: 12px;
818
+ top: 0px;
819
  position: relative;
820
+ float: left;
821
  }
822
+ /*
823
+ #nifty_ratings_form:after {
824
+ top: 28px;
825
+ left: 128px;
826
+ border-width: 6px 6px 0 6;
827
  border-color: transparent #666;
828
  content: "";
829
  position: absolute;
830
  border-style: solid;
831
  }
832
+ */
833
  #nifty_ratings_comment {
834
  height: 25px !important;
835
  margin-left: 2px;
842
  border-radius: 2px;
843
  text-align: center;
844
  font-size: 12px;
845
+ padding: 1px;
846
+ top: 2px;
847
  right: 2px;
848
  position: relative;
849
  }
850
 
 
 
 
 
 
 
 
851
  #nifty_recording {
852
  margin-left: 5px;
853
+ position: absolute;
854
+ top: -21px;
855
+ right: 22px;
856
  }
857
  .wplc_powered_by_link {
858
  font-size: 10px;
859
  padding: 5px;
860
  }
861
 
862
+ #wplc_msg_notice {
863
+ margin-left:4px !important;
864
+ display:none;
865
+ }
866
  .typing_indicator {
867
+ display: none;
868
+
869
+ /* width: 100%; */
870
+ position: absolute;
871
+ padding: 3px;
872
+ padding-left: 6px;
873
+ padding-right: 6px;
874
+ border-radius: 6px;
875
+ top: 65px;
876
+ z-index: 99;
877
+ opacity: 0;
878
  font-size: 0.8em;
879
+ font-style: italic;
880
+ margin-left: 4px;
881
+ transition: all 0.1s ease;
882
+ -webkit-transition: all 0.1s ease;
883
+ -moz-transition: all 0.1s ease;
884
+ -o-transition: all 0.1s ease;
885
+ left: 6px;
 
 
 
886
  }
887
  .typing_indicator_active {
888
+ display: block;
889
+ opacity:0.7;
890
+ transition: all 0.1s ease;
891
+ -webkit-transition: all 0.1s ease;
892
+ -moz-transition: all 0.1s ease;
893
+ -o-transition: all 0.1s ease;
 
 
 
 
 
894
 
895
  }
896
 
897
  #wp-live-chat-2 select {
898
+ font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
899
  font-size: 15px;
900
  line-height: 32px;
901
  width: 100%;
920
  }
921
  button.wplc_retry_chat {
922
  margin: 10px;
923
+ }
924
+
925
+
926
+ #wplc_start_chat_btn, #wplc_na_msg_btn {
927
+ min-height: 40px;
928
+ }
929
+
930
+ #speeching_button, #wplc_start_chat_btn, #wplc_na_msg_btn {
931
+ font-weight:normal !important;
932
+ border-radius:40px !important;
933
+ padding-top: 7px !important;
934
+ padding-bottom: 7px !important;
935
+ padding-left:10px !important;
936
+ padding-right:10px !important;
937
+
938
+ -webkit-box-shadow: 0 3px 15px rgba(0,0,0,.16)!important;
939
+ -moz-box-shadow: 0 3px 15px rgba(0,0,0,.16)!important;
940
+ -o-box-shadow: 0 3px 15px rgba(0,0,0,.16)!important;
941
+ box-shadow: 0 3px 15px rgba(0,0,0,.16)!important;
942
+
943
+ -webkit-transition: all 0.3s ease;
944
+ -moz-transition: all 0.3s ease;
945
+ -o-transition: all 0.3s ease;
946
+ transition: all 0.3s ease;
947
+ }
948
+
949
+ #speeching_button:hover, #wplc_start_chat_btn:hover, #wplc_na_msg_btn:hover {
950
+ -webkit-box-shadow: 0 5px 10px rgba(0,0,0,.19)!important;
951
+ -moz-box-shadow: 0 5px 10px rgba(0,0,0,.19)!important;
952
+ -o-box-shadow: 0 4px 10px rgba(0,0,0,.19)!important;
953
+ box-shadow: 0 5px 10px rgba(0,0,0,.19)!important;
954
+ }
955
+
956
+ .wplc_thumb32 {
957
+ border-radius:32px;
958
+ float: left;
959
+ height: 60px;
960
+ margin-left: 45px;
961
+ margin-top: 20px;
962
+ }
963
+
964
+
965
+
966
+ #wplc_chatbox span.timedate {
967
+ clear: both;
968
+ position: relative;
969
+ font-size: 0.8em;
970
+ font-style:italic
971
+ }
972
+ .wplc-msg-float-left {
973
+ left: 32px;
974
+ float:left;
975
+ }
976
+ .wplc-msg-float-right {
977
+ right: 32px;
978
+ float:right;
979
+ }
980
+
981
+ @media screen and (max-width: 400px) {
982
+
983
+ #wp-live-chat-4 {
984
+ bottom: 150px;
985
+ right: 2%;
986
+ left: 2%;
987
+ top: 2%;
988
+ width:auto;
989
+ }
990
+
991
+ #wp-live-chat-2 {
992
+ bottom: 150px;
993
+ right: 2%;
994
+ left: 2%;
995
+
996
+ width:auto;
997
+ }
998
+
999
+ #wplc_chatbox {
1000
+ top:65px !important;
1001
+ }
1002
+
1003
+ .wplc_agent_involved {
1004
+ float: left;
1005
+ margin-left: 30px;
1006
+ margin-top: 3px;
1007
+ width:40px;
1008
+ height:40px;
1009
+
1010
+ }
1011
+
1012
+ .wplc_agent_name {
1013
+ float: left;
1014
+ margin-left: 10px;
1015
+ margin-top: -10px;
1016
+ }
1017
+
1018
+ .wplc_agent_infosection {
1019
+ display: none;
1020
+ }
1021
+ .wplc_agent_infosection {
1022
+ display: none;
1023
+ }
1024
  }
css/themes/position-bottom-left.css CHANGED
@@ -1,7 +1,7 @@
1
  #wplc_hovercard.modern {
2
  position: fixed;
3
  bottom: 96px;
4
- left: 75px;
5
  width: 300px;
6
  height: 145px;
7
  border: 1px solid #ccc;
@@ -18,7 +18,7 @@
18
  left: 41px;
19
  }
20
  .modern #wp-live-chat-2 {
21
- left:0 !important;
22
  right:auto;
23
  }
24
 
1
  #wplc_hovercard.modern {
2
  position: fixed;
3
  bottom: 96px;
4
+ left: 20px;
5
  width: 300px;
6
  height: 145px;
7
  border: 1px solid #ccc;
18
  left: 41px;
19
  }
20
  .modern #wp-live-chat-2 {
21
+ left:20px !important;
22
  right:auto;
23
  }
24
 
css/themes/position-left.css CHANGED
@@ -1,45 +1,18 @@
1
 
2
  #wplc_hovercard.modern {
3
- bottom: 200px;
4
  left: 93px;
5
  }
6
 
7
 
8
 
9
- #wplc_hovercard:before {
10
- content: "";
11
- position: absolute;
12
- left: -9px;
13
- top: auto;
14
- border-width: 9px 9px 9px 0;
15
- border-style: solid;
16
- border-color: transparent #ccc;
17
- display: block;
18
- width: 0;
19
- right:auto;
20
- bottom:83px;
21
- }
22
- #wplc_hovercard:after {
23
- content: "";
24
- position: absolute;
25
- left: -8px;
26
- top: auto;
27
- border-width: 8px 8px 8px 0;
28
- border-style: solid;
29
- border-color: transparent #FFF;
30
- display: block;
31
- width: 0;
32
- right:auto;
33
- bottom:84px;
34
- }
35
-
36
  .modern #wp-live-chat-2 {
37
- left:0 !important;
38
  right:auto;
39
  }
40
 
41
  .modern #wp-live-chat-4 {
42
- left:0 !important;
43
  right:auto;
44
  }
45
 
@@ -83,4 +56,13 @@ content: "";
83
  .wplc_close.wplc_left #wp-live-chat-image {
84
  top: 160px;
85
  left: 35px;
86
- }
 
 
 
 
 
 
 
 
 
1
 
2
  #wplc_hovercard.modern {
3
+ bottom: 135px;
4
  left: 93px;
5
  }
6
 
7
 
8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  .modern #wp-live-chat-2 {
10
+ left:93px !important;
11
  right:auto;
12
  }
13
 
14
  .modern #wp-live-chat-4 {
15
+ left:93px !important;
16
  right:auto;
17
  }
18
 
56
  .wplc_close.wplc_left #wp-live-chat-image {
57
  top: 160px;
58
  left: 35px;
59
+ }
60
+ .modern div#wp-live-chat-header {
61
+ position: absolute;
62
+ bottom: 0px;
63
+ left: 20px;
64
+ }
65
+ div#wp-live-chat-2 {
66
+ left:93px;
67
+ }
68
+
css/themes/position-right.css CHANGED
@@ -1,37 +1,10 @@
1
 
2
  #wplc_hovercard.modern {
3
- bottom: 200px;
4
  right: 93px;
5
 
6
  }
7
 
8
- #wplc_hovercard:before {
9
- content: "";
10
- position: absolute;
11
- right: -9px;
12
- top: auto;
13
- border-width: 9px 0 9px 9px;
14
- border-style: solid;
15
- border-color: transparent #ccc;
16
- display: block;
17
- width: 0;
18
- left:auto;
19
- bottom:83px;
20
- }
21
- #wplc_hovercard:after {
22
- content: "";
23
- position: absolute;
24
- right: -8px;
25
- top: auto;
26
- border-width: 8px 0 8px 8px;
27
- border-style: solid;
28
- border-color: transparent #FFF;
29
- display: block;
30
- width: 0;
31
- left:auto;
32
- bottom:84px;
33
- }
34
-
35
 
36
  #wplc_social_holder {
37
  left: -18px;
@@ -70,4 +43,15 @@
70
 
71
  }
72
 
 
 
 
 
 
 
 
 
 
 
 
73
 
1
 
2
  #wplc_hovercard.modern {
3
+ bottom: 120px;
4
  right: 93px;
5
 
6
  }
7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
  #wplc_social_holder {
10
  left: -18px;
43
 
44
  }
45
 
46
+ .modern div#wp-live-chat-header {
47
+ position: absolute;
48
+ bottom: 0;
49
+ right: 20px;
50
+ }
51
+ div#wp-live-chat-2 {
52
+ right:93px;
53
+ }
54
+ .wplc_right #wp-live-chat-4 {
55
+ right:93px;
56
+ }
57
 
css/wplcstyle.css CHANGED
@@ -4,8 +4,8 @@
4
  width: 30px;
5
  height: 30px;
6
  position: absolute;
7
- top: -14px;
8
- right: -14px;
9
  background-color: #666;
10
  border-radius: 15px;
11
  }
4
  width: 30px;
5
  height: 30px;
6
  position: absolute;
7
+ top: -10px;
8
+ right: -10px;
9
  background-color: #666;
10
  border-radius: 15px;
11
  }
functions.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- $wplc_basic_plugin_url = get_option('siteurl')."/wp-content/plugins/wp-live-chat-support/";
3
 
4
  function wplc_log_user_on_page($name,$email,$session, $is_mobile = false) {
5
  global $wpdb;
@@ -82,7 +82,6 @@ function wplc_log_user_on_page($name,$email,$session, $is_mobile = false) {
82
 
83
  }
84
  function wplc_update_user_on_page($cid, $status = 5,$session) {
85
-
86
  global $wpdb;
87
  global $wplc_tblname_chats;
88
  $wplc_settings = get_option('WPLC_SETTINGS');
@@ -164,6 +163,15 @@ function wplc_record_chat_msg($from,$cid,$msg,$rest_check = false) {
164
 
165
  $msg = apply_filters("wplc_filter_message_control",$msg);
166
 
 
 
 
 
 
 
 
 
 
167
  $wpdb->insert(
168
  $wplc_tblname_msgs,
169
  array(
@@ -172,7 +180,8 @@ function wplc_record_chat_msg($from,$cid,$msg,$rest_check = false) {
172
  'msgfrom' => $fromname,
173
  'msg' => $msg,
174
  'status' => 0,
175
- 'originates' => $orig
 
176
  ),
177
  array(
178
  '%s',
@@ -180,6 +189,7 @@ function wplc_record_chat_msg($from,$cid,$msg,$rest_check = false) {
180
  '%s',
181
  '%s',
182
  '%d',
 
183
  '%s'
184
  )
185
  );
@@ -443,7 +453,7 @@ function wplc_filter_control_list_chats_actions($actions,$result,$post_data) {
443
  $url = admin_url( 'admin.php?page=wplivechat-menu'.$url_params);
444
  $actions = "<a href=\"".$url."\" class=\"wplc_open_chat button button-primary\" window-title=\"WP_Live_Chat_".$result->id."\">". apply_filters("wplc_accept_chat_button_filter", __("Accept Chat","wplivechat"), $result->id)."</a>";
445
  }
446
- else if (intval($result->status) == 3) {
447
  $url_params = "&action=ac&cid=".$result->id.$aid;
448
  $url = admin_url( 'admin.php?page=wplivechat-menu'.$url_params);
449
  if ( ! function_exists("wplc_pro_version_control") || !isset( $result->agent_id ) || $wplc_current_user == $result->agent_id ) { //Added backwards compat checks
@@ -457,7 +467,7 @@ function wplc_filter_control_list_chats_actions($actions,$result,$post_data) {
457
  $url = admin_url( 'admin.php?page=wplivechat-menu'.$url_params);
458
  $actions = "<a href=\"".$url."\" class=\"wplc_open_chat button button-primary\" window-title=\"WP_Live_Chat_".$result->id."\">".__("Accept Chat","wplivechat")."</a>";
459
  }
460
- else if (intval($result->status) == 12) {
461
  $url_params = "&action=ac&cid=".$result->id.$aid;
462
  $url = admin_url( 'admin.php?page=wplivechat-menu'.$url_params);
463
  $actions = "<a href=\"".$url."\" class=\"wplc_open_chat button button-primary\" window-title=\"WP_Live_Chat_".$result->id."\">".__("Open Chat","wplivechat")."</a>";
@@ -568,7 +578,6 @@ function wplc_list_chats_new($post_data) {
568
 
569
 
570
  function wplc_return_user_chat_messages($cid,$wplc_settings = false,$cdata = false) {
571
-
572
  global $wpdb;
573
  global $wplc_tblname_msgs;
574
 
@@ -578,20 +587,13 @@ function wplc_return_user_chat_messages($cid,$wplc_settings = false,$cdata = fal
578
 
579
  if(isset($wplc_settings['wplc_display_name']) && $wplc_settings['wplc_display_name'] == 1){ $display_name = 1; } else { $display_name = 0; }
580
 
581
-
582
- $results = $wpdb->get_results(
583
- "
584
- SELECT *
585
- FROM $wplc_tblname_msgs
586
- WHERE `chat_sess_id` = '$cid' AND `status` = '0' AND (`originates` = '1' OR `originates` = '0')
587
- ORDER BY `timestamp` ASC
588
-
589
- "
590
- );
591
  if (!$cdata) {
592
  $cdata = wplc_get_chat_data($cid,__LINE__);
593
  }
594
 
 
595
  $msg_hist = array();
596
  foreach ($results as $result) {
597
  $system_notification = false;
@@ -602,10 +604,15 @@ function wplc_return_user_chat_messages($cid,$wplc_settings = false,$cdata = fal
602
 
603
  $msg = $result->msg;
604
 
605
- //$timestamp = strtotime($result->timestamp);
606
- //$timeshow = date("H:i",$timestamp);
 
 
 
 
607
  //
608
  if($result->originates == 1){
 
609
  $class = "wplc-admin-message wplc-color-bg-4 wplc-color-2 wplc-color-border-4";
610
  if(function_exists("wplc_pro_get_admin_picture")){
611
  $src = wplc_pro_get_admin_picture();
@@ -620,16 +627,16 @@ function wplc_return_user_chat_messages($cid,$wplc_settings = false,$cdata = fal
620
 
621
 
622
  $user_info = get_userdata(intval($other['aid']));
623
- /* get agent id */
624
  $image = "<img src='//www.gravatar.com/avatar/".md5($user_info->user_email)."?s=30' class='wplc-admin-message-avatar' />";
625
  } else {
626
 
627
- /* get default setting in the notifications tab */
628
  $image = "";
629
  if(1 == 1) {
630
 
631
  } else {
632
- /* there's nothing Jim.. */
633
  $image = "";
634
  }
635
  }
@@ -637,6 +644,7 @@ function wplc_return_user_chat_messages($cid,$wplc_settings = false,$cdata = fal
637
  }
638
 
639
  $from = apply_filters("wplc_filter_admin_name",$from, $cid);
 
640
 
641
  }
642
  else if (intval($result->originates) == 0) {
@@ -647,7 +655,10 @@ function wplc_return_user_chat_messages($cid,$wplc_settings = false,$cdata = fal
647
  $system_notification = true;
648
 
649
  }
650
- else {
 
 
 
651
  $class = "wplc-user-message wplc-color-bg-1 wplc-color-2 wplc-color-border-1";
652
 
653
  if(isset($_COOKIE['wplc_email']) && $_COOKIE['wplc_email'] != ""){ $wplc_user_gravatar = md5(strtolower(trim(sanitize_text_field($_COOKIE['wplc_email'])))); } else { $wplc_user_gravatar = ""; }
@@ -657,11 +668,11 @@ function wplc_return_user_chat_messages($cid,$wplc_settings = false,$cdata = fal
657
  } else {
658
  $image = "";
659
  }
 
660
  }
661
 
662
  if (!$system_notification) {
663
  /* this is a normal message */
664
- // var_dump($msg);
665
  if(function_exists('wplc_encrypt_decrypt_msg')){
666
  $msg = wplc_encrypt_decrypt_msg($msg);
667
  }
@@ -678,16 +689,24 @@ function wplc_return_user_chat_messages($cid,$wplc_settings = false,$cdata = fal
678
 
679
  $msg = stripslashes($msg);
680
 
681
-
 
 
682
 
 
 
683
  if($display_name){
684
- $msg_hist[$id] = "<span class='wplc-admin-message wplc-color-bg-4 wplc-color-2 wplc-color-border-4'>$image <strong>$from </strong> $msg</span><br /><div class='wplc-clear-float-message'></div>";
685
  } else {
686
- $msg_hist[$id] = "<span class='wplc-admin-message wplc-color-bg-4 wplc-color-2 wplc-color-border-4'>$msg</span><div class='wplc-clear-float-message'></div>";
687
- }
688
  } else {
689
  /* add the system notification to the list */
690
- $msg_hist[$id] = "<span class='wplc_system_notification wplc-color-4'>".$msg."</span>";
 
 
 
 
691
  }
692
 
693
 
@@ -700,6 +719,10 @@ function wplc_return_user_chat_messages($cid,$wplc_settings = false,$cdata = fal
700
 
701
  }
702
 
 
 
 
 
703
  function wplc_return_no_answer_string($cid) {
704
 
705
  $wplc_settings = get_option("WPLC_SETTINGS");
@@ -709,7 +732,7 @@ function wplc_return_no_answer_string($cid) {
709
  $string = __("No agent was able to answer your chat request. Please try again.","wplivechat");
710
  }
711
  $string = apply_filters("wplc_filter_no_answer_string",$string,$cid);
712
- return "<span class='wplc_system_notification wplc-color-4'><center>".$string."</center></span>";
713
  }
714
  add_filter("wplc_filter_no_answer_string","wplc_filter_control_no_answer_string",10,2);
715
 
@@ -821,54 +844,29 @@ function wplc_return_chat_messages($cid, $transcript = false, $html = true, $wpl
821
  $previous_time = "";
822
  $previous_timestamp = 0;
823
  foreach ($results as $result) {
824
-
825
  $system_notification = false;
826
 
827
  $from = $result->msgfrom;
828
  $id = $result->id;
829
  $msg = $result->msg;
830
- $timestamp = strtotime($result->timestamp);
831
 
832
- $time_diff = $timestamp - $previous_timestamp;
833
- if ($time_diff > 60) { $show_time = true; } else { $show_time = false; }
834
- // $date = new DateTime($timestamp);
835
-
836
- if( ( isset( $wplc_settings['wplc_show_date'] ) && $wplc_settings['wplc_show_date'] == '1' ) || ( isset( $wplc_settings['wplc_show_time'] ) && $wplc_settings['wplc_show_time'] == '1' ) ){
837
- /**
838
- * Only show one or the other
839
- */
840
- if( isset( $wplc_settings['wplc_show_date'] ) ){
841
- $timeshow = date('l, F d Y ',$timestamp);
842
- } else {
843
- $timeshow = date('h:i A',$timestamp);
844
- }
845
- } else if( ( isset( $wplc_settings['wplc_show_date'] ) && $wplc_settings['wplc_show_date'] == '1' ) && ( isset( $wplc_settings['wplc_show_time'] ) && $wplc_settings['wplc_show_time'] == '1' ) ){
846
- /**
847
- * Show both
848
- */
849
- $timeshow = date('l, F d Y h:i A',$timestamp);
850
- } else {
851
 
852
- $timeshow = "";
 
853
 
854
- }
 
 
 
855
 
856
- if( !isset( $wplc_settings['wplc_show_date'] ) || !isset( $wplc_settings['wplc_show_time'] ) ){
857
- /**
858
- * Doesnt exist yet, so default to being on always
859
- */
860
- $timeshow = date('l, F d Y h:i A',$timestamp);
861
- }
862
-
863
- if (!$transcript) { if ($previous_time == $timeshow || !$show_time) { $timeshow = ""; } }
864
- $previous_time = $timeshow;
865
- $previous_timestamp = $timestamp;
866
 
867
 
868
  $image = "";
869
  if($result->originates == 1){
870
  /* message from admin to user */
871
 
 
872
  $class = "wplc-admin-message wplc-color-bg-4 wplc-color-2 wplc-color-border-4";
873
  if(function_exists("wplc_pro_get_admin_picture")){
874
  $src = wplc_pro_get_admin_picture();
@@ -881,10 +879,10 @@ function wplc_return_chat_messages($cid, $transcript = false, $html = true, $wpl
881
  if (isset($other['aid'])) {
882
 
883
  $user_info = get_userdata(intval($other['aid']));
884
- /* get agent id */
885
  $image = "<img src='//www.gravatar.com/avatar/".md5($user_info->user_email)."?s=30' class='wplc-admin-message-avatar' />";
886
  } else {
887
- /* get default setting in the notifications tab */
888
  $image = "";
889
  }
890
  } else {
@@ -894,10 +892,13 @@ function wplc_return_chat_messages($cid, $transcript = false, $html = true, $wpl
894
  }
895
 
896
  $from = apply_filters("wplc_filter_admin_from", $from, $cid);
 
897
 
898
 
899
  } else if ($result->originates == 2){
900
  /* message from user to admin */
 
 
901
  $class = "wplc-user-message wplc-color-bg-1 wplc-color-2 wplc-color-border-1";
902
 
903
  if(isset($_COOKIE['wplc_email']) && $_COOKIE['wplc_email'] != ""){ $wplc_user_gravatar = md5(strtolower(trim(sanitize_text_field($_COOKIE['wplc_email'])))); } else { $wplc_user_gravatar = ""; }
@@ -906,24 +907,29 @@ function wplc_return_chat_messages($cid, $transcript = false, $html = true, $wpl
906
  $image = "<img src='//www.gravatar.com/avatar/$wplc_user_gravatar?s=30' class='wplc-user-message-avatar' />";
907
  } else {
908
  $image = "";
909
- }
 
910
  } else if ($result->originates == 0 || $result->originates == 3) {
 
911
  $system_notification = true;
912
  $cuid = get_current_user_id();
913
  $is_agent = get_user_meta(esc_html( $cuid ), 'wplc_ma_agent', true);
914
- if ($is_agent && $result->originates == 3) {
915
  /* this user is an agent and the notification is meant for an agent, therefore display it */
916
  $display_notification = true;
 
 
 
 
 
917
  }
918
  else if (!$is_agent && $result->originates == 0) {
919
  /* this user is a not an agent and the notification is meant for a users, therefore display it */
920
  $display_notification = true;
921
  } else {
922
  /* this notification is not intended for this user */
923
-
924
  $display_notification = false;
925
  }
926
-
927
  }
928
 
929
  if (!$system_notification) {
@@ -946,35 +952,46 @@ function wplc_return_chat_messages($cid, $transcript = false, $html = true, $wpl
946
  $msg = stripslashes($msg);
947
  }
948
 
 
 
 
 
949
 
 
 
950
  if($display_name){
951
  if ($html) {
952
  $str = "<span class='chat_time wplc-color-4'>$timeshow</span> <span class='$class'>$image <strong>$from </strong> $msg</span><br /><div class='wplc-clear-float-message'></div>";
953
- $msg_array[$id] = $str;
954
- $msg_hist .= $str;
955
 
956
  } else {
957
  $str = "($timeshow) $from: $msg\r\n";
958
- $msg_array[$id] = $str;
959
- $msg_hist .= $str;
960
  }
961
  } else {
962
  if ($html) {
963
  $str = "<span class='chat_time wplc-color-4'>$timeshow</span> <span class='$class'>$msg</span><br /><div class='wplc-clear-float-message'></div>";
964
- $msg_array[$id] = $str;
965
- $msg_hist .= $str;
966
  } else {
967
  $str = "($timeshow) $msg\r\n";
968
- $msg_array[$id] = $str;
969
  $msg_hist .= $str;
970
  }
971
 
972
- }
973
  } else {
974
  /* this is a system notification */
975
  if ($display_notification) {
976
- $str = "<span class='chat_time wplc-color-4'>$timeshow</span> <span class='wplc_system_notification wplc-color-4'>".$msg."</span>";
977
- $msg_array[$id] = $str;
 
 
 
 
 
978
  $msg_hist .= $str;
979
  }
980
  }
@@ -1025,11 +1042,11 @@ function wplc_mark_as_read_user_chat_messages($cid) {
1025
  function wplc_return_admin_chat_messages($cid) {
1026
  $wplc_current_user = get_current_user_id();
1027
  if( get_user_meta( $wplc_current_user, 'wplc_ma_agent', true ) ){
1028
- /*
1029
- -- modified in in 6.0.04 --
1030
 
1031
- if(current_user_can('wplc_ma_agent') || current_user_can('manage_options')){
1032
- */
1033
  $wplc_settings = get_option("WPLC_SETTINGS");
1034
 
1035
  if(isset($wplc_settings['wplc_display_name']) && $wplc_settings['wplc_display_name'] == 1){ $display_name = 1; } else { $display_name = 0; }
@@ -1045,59 +1062,45 @@ function wplc_return_admin_chat_messages($cid) {
1045
  * 3 - System notification to be delivered to agents
1046
  *
1047
  */
1048
- $results = $wpdb->get_results(
1049
- "
1050
- SELECT *
1051
- FROM $wplc_tblname_msgs
1052
- WHERE `chat_sess_id` = '$cid' AND `status` = '0' AND (`originates` = '2' OR `originates` = '3')
1053
- ORDER BY `timestamp` ASC
1054
-
1055
- "
1056
- );
1057
 
1058
- $current_user = get_user_by( 'id', $wplc_current_user );
1059
-
1060
- if( $current_user ){
1061
- $wplc_user_gravatar = md5( trim($current_user->data->user_email) );
1062
- } else {
1063
- $wplc_user_gravatar = "";
1064
- }
1065
 
1066
- $msg_hist = "";
1067
  foreach ($results as $result) {
1068
-
1069
-
1070
  $system_notification = false;
 
1071
  $id = $result->id;
 
1072
  $from = $result->msgfrom;
1073
- wplc_mark_as_read_admin_chat_messages($id);
 
1074
  $msg = $result->msg;
1075
- //$timestamp = strtotime($result->timestamp);
1076
- //$timeshow = date("H:i",$timestamp);
1077
- $image = "";
1078
- if($result->originates == 2) {
1079
- $class = "wplc-admin-message wplc-color-bg-4 wplc-color-2 wplc-color-border-4";
1080
- if(function_exists("wplc_pro_get_admin_picture")){
1081
- $src = wplc_pro_get_admin_picture();
1082
- if($src){
1083
- $image = "<img src=".$src." width='20px' id='wp-live-chat-2-img'/>";
1084
- }
1085
- } else {
1086
- /* HERE */
1087
- $image = "<img src='//www.gravatar.com/avatar/$wplc_user_gravatar?s=20' class='wplc-admin-message-avatar' />";
1088
- }
1089
 
1090
- $from = apply_filters("wplc_filter_admin_from", $from, $cid);
 
1091
 
1092
- } else if (intval($result->originates) == 3) {
 
 
 
 
 
 
 
1093
  $system_notification = true;
1094
- }
 
 
 
 
 
 
1095
  if (!$system_notification) {
1096
-
1097
  if(function_exists('wplc_encrypt_decrypt_msg')){
1098
  $msg = wplc_encrypt_decrypt_msg($msg);
1099
- }
1100
-
1101
  $msg_array = maybe_unserialize( $msg );
1102
 
1103
  if( is_array( $msg_array ) ){
@@ -1106,23 +1109,34 @@ function wplc_return_admin_chat_messages($cid) {
1106
 
1107
  $msg = stripslashes($msg);
1108
 
1109
- $msg = apply_filters("wplc_filter_message_control_out",$msg);
 
 
 
 
 
 
1110
 
1111
- if($display_name){
1112
- $msg_hist .= "<span class='wplc-user-message wplc-color-bg-1 wplc-color-2 wplc-color-border-1'>".$image."<strong>$from </strong> $msg</span><br /><div class='wplc-clear-float-message'></div>";
1113
- } else {
1114
- $msg_hist .= "<span class='wplc-user-message wplc-color-bg-1 wplc-color-2 wplc-color-border-1'>$msg</span><br /><div class='wplc-clear-float-message'></div>";
1115
- }
1116
  } else {
1117
- $msg_hist .= "<span class='wplc_system_notification wplc-color-4'>".$msg."</span>";
1118
- }
1119
- }
1120
 
 
 
 
 
1121
 
 
 
1122
 
 
1123
 
1124
  return $msg_hist;
1125
- } else {
 
 
 
 
1126
  return "security issue";
1127
  }
1128
 
@@ -1264,7 +1278,7 @@ function wplc_filter_control_mail_body($header,$msg) {
1264
  <tbody>
1265
  <tr>
1266
  <td id="" align="center">
1267
- <p>'.get_option('siteurl').'</p>
1268
  </td>
1269
  </tr>
1270
  </tbody>
@@ -1487,7 +1501,6 @@ function wplc_user_initiate_chat($name,$email,$cid = null,$session) {
1487
 
1488
  global $wpdb;
1489
  global $wplc_tblname_chats;
1490
- do_action("wplc_hook_initiate_chat",array("cid" => $cid, "name" => $name, "email" => $email));
1491
 
1492
 
1493
  $wplc_settings = get_option('WPLC_SETTINGS');
@@ -1533,12 +1546,12 @@ function wplc_user_initiate_chat($name,$email,$cid = null,$session) {
1533
 
1534
  $other_data = apply_filters("wplc_start_chat_hook_other_data_hook", $other_data);
1535
  if (!isset($other_data['welcome'])) {
1536
- wplc_send_welcome($cid,$wplc_settings);
1537
  $other_data['welcome'] = true;
1538
  }
1539
 
1540
  } else {
1541
- wplc_send_welcome($cid,$wplc_settings);
1542
  $other_data = array();
1543
  $other_data['welcome'] = true;
1544
 
@@ -1572,6 +1585,8 @@ function wplc_user_initiate_chat($name,$email,$cid = null,$session) {
1572
  ),
1573
  array('%d')
1574
  );
 
 
1575
 
1576
  do_action("wplc_start_chat_hook_after_data_insert", $cid);
1577
  return $cid;
@@ -1582,6 +1597,8 @@ function wplc_user_initiate_chat($name,$email,$cid = null,$session) {
1582
 
1583
  $other_data = apply_filters("wplc_start_chat_hook_other_data_hook", $other_data);
1584
 
 
 
1585
  $wpdb->insert(
1586
  $wplc_tblname_chats,
1587
  array(
@@ -1631,7 +1648,6 @@ function wplc_get_msg() {
1631
  return "<a href=\"javascript:void(0);\" class=\"wplc_second_chat_request button button-primary\" style='cursor:not-allowed' title=\"".__("Get Pro Add-on to accept more chats","wplivechat")."\" target=\"_BLANK\">".__("Accept Chat","wplivechat")."</a>";
1632
  }
1633
  function wplc_update_chat_statuses() {
1634
-
1635
  global $wpdb;
1636
  global $wplc_tblname_chats;
1637
  $results = $wpdb->get_results(
@@ -1649,14 +1665,13 @@ function wplc_update_chat_statuses() {
1649
 
1650
 
1651
 
1652
-
1653
  if (intval($result->status) == 2) {
1654
- if ($difference >= 60) { // 30 seconds max
1655
  wplc_change_chat_status($id,12);
1656
  }
1657
  }
1658
  else if (intval($result->status) == 12) {
1659
- if ($difference >= 120) { // 120 seconds max
1660
  wplc_change_chat_status($id,0);
1661
  }
1662
  }
@@ -1801,30 +1816,24 @@ function wplc_error_log($error) {
1801
 
1802
 
1803
  }
1804
- function Memory_Usage($decimals = 2)
1805
- {
1806
  $result = 0;
1807
 
1808
- if (function_exists('memory_get_usage'))
1809
- {
1810
  $result = memory_get_usage() / 1024;
1811
  }
1812
 
1813
- else
1814
- {
1815
- if (function_exists('exec'))
1816
- {
1817
  $output = array();
1818
 
1819
- if (substr(strtoupper(PHP_OS), 0, 3) == 'WIN')
1820
- {
1821
  exec('tasklist /FI "PID eq ' . getmypid() . '" /FO LIST', $output);
1822
 
1823
  $result = preg_replace('/[\D]/', '', $output[5]);
1824
  }
1825
 
1826
- else
1827
- {
1828
  exec('ps -eo%mem,rss,pid | grep ' . getmypid(), $output);
1829
 
1830
  $output = explode(' ', $output[0]);
@@ -1858,26 +1867,15 @@ function wplc_admin_display_missed_chats() {
1858
  global $wplc_tblname_chats;
1859
 
1860
 
1861
- if(isset($_GET['wplc_action']) && $_GET['wplc_action'] == 'remove_cid'){
1862
  if(isset($_GET['cid'])){
1863
  if(isset($_GET['wplc_confirm'])){
1864
  //Confirmed - delete
1865
  $delete_sql = "";
1866
- if (function_exists("wplc_register_pro_version")) {
1867
- $delete_sql = "
1868
- DELETE FROM $wplc_tblname_chats
1869
- WHERE `id` = '".intval($_GET['cid'])."'
1870
- AND (`status` = 7 OR `agent_id` = 0)
1871
- AND `email` != 'no email set'
1872
- ";
1873
- } else {
1874
- $delete_sql = "
1875
- DELETE FROM $wplc_tblname_chats
1876
- WHERE `id` = '".intval($_GET['cid'])."'
1877
- AND `status` = 7
1878
- AND `email` != 'no email set'
1879
- ";
1880
  }
 
1881
 
1882
  $wpdb->query($delete_sql);
1883
  if ($wpdb->last_error) {
@@ -1894,7 +1892,7 @@ function wplc_admin_display_missed_chats() {
1894
  //Prompt
1895
  echo "<div class='update-nag' style='margin-top: 0px;margin-bottom: 5px;'>
1896
  ".__("Are you sure you would like to delete this chat?", "wplivechat")."<br>
1897
- <a class='button' href='?page=wplivechat-menu-missed-chats&wplc_action=remove_cid&cid=".$_GET['cid']."&wplc_confirm=1''>".__("Yes", "wplivechat")."</a> <a class='button' href='?page=wplivechat-menu-missed-chats'>".__("No", "wplivechat")."</a>
1898
  </div>";
1899
  }
1900
  }
@@ -1913,23 +1911,11 @@ function wplc_admin_display_missed_chats() {
1913
  </thead>
1914
  <tbody id=\"the-list\" class='list:wp_list_text_link'>";
1915
 
 
1916
  if (function_exists("wplc_register_pro_version")) {
1917
- $sql = "
1918
- SELECT *
1919
- FROM $wplc_tblname_chats
1920
- WHERE (`status` = 7
1921
- OR `agent_id` = 0)
1922
- AND `email` != 'no email set'
1923
- ORDER BY `timestamp` DESC
1924
- ";
1925
  } else {
1926
- $sql = "
1927
- SELECT *
1928
- FROM $wplc_tblname_chats
1929
- WHERE `status` = 7
1930
- AND `email` != 'no email set'
1931
- ORDER BY `timestamp` DESC
1932
- ";
1933
  }
1934
 
1935
  $results = $wpdb->get_results($sql);
@@ -1938,12 +1924,20 @@ function wplc_admin_display_missed_chats() {
1938
  echo "<tr><td></td><td>" . __("You have not missed any chat requests.", "wplivechat") . "</td></tr>";
1939
  } else {
1940
  foreach ($results as $result) {
 
 
 
 
 
 
 
 
1941
  echo "<tr id=\"record_" . $result->id . "\">";
1942
  echo "<td class='chat_id column-chat_d'>" . $result->timestamp . "</td>";
1943
  echo "<td class='chat_name column_chat_name' id='chat_name_" . $result->id . "'><img src=\"//www.gravatar.com/avatar/" . md5($result->email) . "?s=30\" class='wplc-user-message-avatar' /> " . $result->name . "</td>";
1944
  echo "<td class='chat_email column_chat_email' id='chat_email_" . $result->id . "'><a href='mailto:" . $result->email . "' title='Email " . ".$result->email." . "'>" . $result->email . "</a></td>";
1945
  echo "<td class='chat_name column_chat_url' id='chat_url_" . $result->id . "'>" . esc_url($result->url) . "</td>";
1946
- echo "<td class='chat_name column_chat_url'><a class='button' href='?page=wplivechat-menu-missed-chats&wplc_action=remove_cid&cid=".$result->id."'><i class='fa fa-trash-o'></i></a></td>";
1947
  echo "</tr>";
1948
  }
1949
  }
@@ -2021,10 +2015,10 @@ function wplc_return_animations_basic(){
2021
  if(isset($wplc_settings['wplc_animation']) && $wplc_settings['wplc_animation'] == 'animation-1'){
2022
 
2023
  if($original_pos == 'bottom_right'){
2024
- $wplc_starting_point = 'margin-bottom: -350px; right: 100px;';
2025
  $wplc_animation = 'animation-1';
2026
  } else if ($original_pos == 'bottom_left'){
2027
- $wplc_starting_point = 'margin-bottom: -350px; left: 100px;';
2028
  $wplc_animation = 'animation-1';
2029
  } else if ($original_pos == 'left'){
2030
  $wplc_starting_point = 'margin-bottom: -350px; left: 0px;';
@@ -2065,9 +2059,9 @@ function wplc_return_animations_basic(){
2065
  $wplc_animation = 'animation-3';
2066
 
2067
  if($original_pos == 'bottom_right'){
2068
- $wplc_starting_point = 'margin-bottom: 0; right: 100px; display: none;';
2069
  } else if ($original_pos == 'bottom_left'){
2070
- $wplc_starting_point = 'margin-bottom: 0px; left: 100px; display: none;';
2071
  } else if ($original_pos == 'left'){
2072
  $wplc_starting_point = 'margin-bottom: 100px; left: 0px; display: none;';
2073
  } else if ($original_pos == 'right'){
@@ -2084,9 +2078,9 @@ function wplc_return_animations_basic(){
2084
  $wplc_animation = "animation-4";
2085
 
2086
  if($original_pos == 'bottom_right'){
2087
- $wplc_starting_point = 'margin-bottom: 0; right: 100px; display: none;';
2088
  } else if ($original_pos == 'bottom_left'){
2089
- $wplc_starting_point = 'margin-bottom: 0px; left: 100px; display: none;';
2090
  } else if ($original_pos == 'left'){
2091
  $wplc_starting_point = 'margin-bottom: 100px; left: 0px; display: none;';
2092
  } else if ($original_pos == 'right'){
@@ -2100,9 +2094,9 @@ function wplc_return_animations_basic(){
2100
  } else {
2101
 
2102
  if($original_pos == 'bottom_right'){
2103
- $wplc_starting_point = 'margin-bottom: 0; right: 100px; display: none;';
2104
  } else if ($original_pos == 'bottom_left'){
2105
- $wplc_starting_point = 'margin-bottom: 0px; left: 100px; display: none;';
2106
  } else if ($original_pos == 'left'){
2107
  $wplc_starting_point = 'margin-bottom: 100px; left: 0px; display: none;';
2108
  } else if ($original_pos == 'right'){
1
  <?php
2
+ $wplc_basic_plugin_url = site_url()."/wp-content/plugins/wp-live-chat-support/";
3
 
4
  function wplc_log_user_on_page($name,$email,$session, $is_mobile = false) {
5
  global $wpdb;
82
 
83
  }
84
  function wplc_update_user_on_page($cid, $status = 5,$session) {
 
85
  global $wpdb;
86
  global $wplc_tblname_chats;
87
  $wplc_settings = get_option('WPLC_SETTINGS');
163
 
164
  $msg = apply_filters("wplc_filter_message_control",$msg);
165
 
166
+ $wplc_current_user = get_current_user_id();
167
+ if( get_user_meta( $wplc_current_user, 'wplc_ma_agent', true ) ){
168
+ $other_data = array('aid'=>$wplc_current_user);
169
+ } else {
170
+ $other_data = '';
171
+ }
172
+
173
+
174
+
175
  $wpdb->insert(
176
  $wplc_tblname_msgs,
177
  array(
180
  'msgfrom' => $fromname,
181
  'msg' => $msg,
182
  'status' => 0,
183
+ 'originates' => $orig,
184
+ 'other' => maybe_serialize( $other_data )
185
  ),
186
  array(
187
  '%s',
189
  '%s',
190
  '%s',
191
  '%d',
192
+ '%s',
193
  '%s'
194
  )
195
  );
453
  $url = admin_url( 'admin.php?page=wplivechat-menu'.$url_params);
454
  $actions = "<a href=\"".$url."\" class=\"wplc_open_chat button button-primary\" window-title=\"WP_Live_Chat_".$result->id."\">". apply_filters("wplc_accept_chat_button_filter", __("Accept Chat","wplivechat"), $result->id)."</a>";
455
  }
456
+ else if (intval($result->status) == 3 || intval($result->status) == 10) {
457
  $url_params = "&action=ac&cid=".$result->id.$aid;
458
  $url = admin_url( 'admin.php?page=wplivechat-menu'.$url_params);
459
  if ( ! function_exists("wplc_pro_version_control") || !isset( $result->agent_id ) || $wplc_current_user == $result->agent_id ) { //Added backwards compat checks
467
  $url = admin_url( 'admin.php?page=wplivechat-menu'.$url_params);
468
  $actions = "<a href=\"".$url."\" class=\"wplc_open_chat button button-primary\" window-title=\"WP_Live_Chat_".$result->id."\">".__("Accept Chat","wplivechat")."</a>";
469
  }
470
+ else if (intval($result->status) == 12 ) {
471
  $url_params = "&action=ac&cid=".$result->id.$aid;
472
  $url = admin_url( 'admin.php?page=wplivechat-menu'.$url_params);
473
  $actions = "<a href=\"".$url."\" class=\"wplc_open_chat button button-primary\" window-title=\"WP_Live_Chat_".$result->id."\">".__("Open Chat","wplivechat")."</a>";
578
 
579
 
580
  function wplc_return_user_chat_messages($cid,$wplc_settings = false,$cdata = false) {
 
581
  global $wpdb;
582
  global $wplc_tblname_msgs;
583
 
587
 
588
  if(isset($wplc_settings['wplc_display_name']) && $wplc_settings['wplc_display_name'] == 1){ $display_name = 1; } else { $display_name = 0; }
589
 
590
+ $sql = "SELECT * FROM $wplc_tblname_msgs WHERE `chat_sess_id` = '$cid' AND `status` = '0' AND (`originates` = '1' OR `originates` = '0') ORDER BY `timestamp` ASC";
591
+ $results = $wpdb->get_results($sql);
 
 
 
 
 
 
 
 
592
  if (!$cdata) {
593
  $cdata = wplc_get_chat_data($cid,__LINE__);
594
  }
595
 
596
+
597
  $msg_hist = array();
598
  foreach ($results as $result) {
599
  $system_notification = false;
604
 
605
  $msg = $result->msg;
606
 
607
+ if ( isset( $result->other ) ) { $other_data = maybe_unserialize( $result->other ); } else { $other_data = array(); }
608
+ if ($other_data == '') { $other_data = array(); }
609
+
610
+ $timestamp = strtotime( $result->timestamp );
611
+ $other_data['datetime'] = $timestamp;
612
+
613
  //
614
  if($result->originates == 1){
615
+ /* removed in 7.1.00
616
  $class = "wplc-admin-message wplc-color-bg-4 wplc-color-2 wplc-color-border-4";
617
  if(function_exists("wplc_pro_get_admin_picture")){
618
  $src = wplc_pro_get_admin_picture();
627
 
628
 
629
  $user_info = get_userdata(intval($other['aid']));
630
+
631
  $image = "<img src='//www.gravatar.com/avatar/".md5($user_info->user_email)."?s=30' class='wplc-admin-message-avatar' />";
632
  } else {
633
 
634
+
635
  $image = "";
636
  if(1 == 1) {
637
 
638
  } else {
639
+
640
  $image = "";
641
  }
642
  }
644
  }
645
 
646
  $from = apply_filters("wplc_filter_admin_name",$from, $cid);
647
+ */
648
 
649
  }
650
  else if (intval($result->originates) == 0) {
655
  $system_notification = true;
656
 
657
  }
658
+ else {
659
+
660
+ /*
661
+ removed in 7.1.00
662
  $class = "wplc-user-message wplc-color-bg-1 wplc-color-2 wplc-color-border-1";
663
 
664
  if(isset($_COOKIE['wplc_email']) && $_COOKIE['wplc_email'] != ""){ $wplc_user_gravatar = md5(strtolower(trim(sanitize_text_field($_COOKIE['wplc_email'])))); } else { $wplc_user_gravatar = ""; }
668
  } else {
669
  $image = "";
670
  }
671
+ */
672
  }
673
 
674
  if (!$system_notification) {
675
  /* this is a normal message */
 
676
  if(function_exists('wplc_encrypt_decrypt_msg')){
677
  $msg = wplc_encrypt_decrypt_msg($msg);
678
  }
689
 
690
  $msg = stripslashes($msg);
691
 
692
+ $msg_hist[$id]['msg'] = $msg;
693
+ $msg_hist[$id]['originates'] = intval($result->originates);
694
+ $msg_hist[$id]['other'] = $other_data;
695
 
696
+ /*
697
+ removed this in 7.1.00 as the JS now handles this
698
  if($display_name){
699
+ $msg_hist[$id]['msg'] = "<span class='wplc-admin-message wplc-color-bg-4 wplc-color-2 wplc-color-border-4'>$image <strong>$from </strong> $msg</span><br /><div class='wplc-clear-float-message'></div>";
700
  } else {
701
+ $msg_hist[$id]['msg'] = "<span class='wplc-admin-message wplc-color-bg-4 wplc-color-2 wplc-color-border-4'>$msg</span><div class='wplc-clear-float-message'></div>";
702
+ }*/
703
  } else {
704
  /* add the system notification to the list */
705
+ if ( isset( $msg_hist[$id] ) ) { $msg_hist[$id] = array(); }
706
+
707
+ $msg_hist[$id]['msg'] = $msg;
708
+ $msg_hist[$id]['other'] = $other_data;
709
+ $msg_hist[$id]['originates'] = intval($result->originates);
710
  }
711
 
712
 
719
 
720
  }
721
 
722
+
723
+
724
+
725
+
726
  function wplc_return_no_answer_string($cid) {
727
 
728
  $wplc_settings = get_option("WPLC_SETTINGS");
732
  $string = __("No agent was able to answer your chat request. Please try again.","wplivechat");
733
  }
734
  $string = apply_filters("wplc_filter_no_answer_string",$string,$cid);
735
+ return "<span class='wplc_system_notification wplc_no_answer wplc-color-4'><center>".$string."</center></span>";
736
  }
737
  add_filter("wplc_filter_no_answer_string","wplc_filter_control_no_answer_string",10,2);
738
 
844
  $previous_time = "";
845
  $previous_timestamp = 0;
846
  foreach ($results as $result) {
847
+ $display_notification = false;
848
  $system_notification = false;
849
 
850
  $from = $result->msgfrom;
851
  $id = $result->id;
852
  $msg = $result->msg;
 
853
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
854
 
855
+ if ( isset( $result->other ) ) { $other_data = maybe_unserialize( $result->other ); } else { $other_data = array(); }
856
+ if ($other_data == '') { $other_data = array(); }
857
 
858
+ $timestamp = strtotime( $result->timestamp );
859
+ $other_data['datetime'] = $timestamp;
860
+ $nice_time = date("d M Y H:i:s",$timestamp);
861
+
862
 
 
 
 
 
 
 
 
 
 
 
863
 
864
 
865
  $image = "";
866
  if($result->originates == 1){
867
  /* message from admin to user */
868
 
869
+ /* removed in 7.1.00
870
  $class = "wplc-admin-message wplc-color-bg-4 wplc-color-2 wplc-color-border-4";
871
  if(function_exists("wplc_pro_get_admin_picture")){
872
  $src = wplc_pro_get_admin_picture();
879
  if (isset($other['aid'])) {
880
 
881
  $user_info = get_userdata(intval($other['aid']));
882
+
883
  $image = "<img src='//www.gravatar.com/avatar/".md5($user_info->user_email)."?s=30' class='wplc-admin-message-avatar' />";
884
  } else {
885
+
886
  $image = "";
887
  }
888
  } else {
892
  }
893
 
894
  $from = apply_filters("wplc_filter_admin_from", $from, $cid);
895
+ */
896
 
897
 
898
  } else if ($result->originates == 2){
899
  /* message from user to admin */
900
+
901
+ /* removed in 7.1.00
902
  $class = "wplc-user-message wplc-color-bg-1 wplc-color-2 wplc-color-border-1";
903
 
904
  if(isset($_COOKIE['wplc_email']) && $_COOKIE['wplc_email'] != ""){ $wplc_user_gravatar = md5(strtolower(trim(sanitize_text_field($_COOKIE['wplc_email'])))); } else { $wplc_user_gravatar = ""; }
907
  $image = "<img src='//www.gravatar.com/avatar/$wplc_user_gravatar?s=30' class='wplc-user-message-avatar' />";
908
  } else {
909
  $image = "";
910
+ }*/
911
+
912
  } else if ($result->originates == 0 || $result->originates == 3) {
913
+
914
  $system_notification = true;
915
  $cuid = get_current_user_id();
916
  $is_agent = get_user_meta(esc_html( $cuid ), 'wplc_ma_agent', true);
917
+ if ($is_agent && $result->originates == 3 ) {
918
  /* this user is an agent and the notification is meant for an agent, therefore display it */
919
  $display_notification = true;
920
+
921
+ /* check if this came from the front end.. if it did, then dont display it (if this code is removed, all notifications will be displayed to agents who are logged in and chatting with themselves during testing, which may cause confusion) */
922
+ if (isset($_POST) && isset($_POST['action']) && sanitize_text_field( $_POST['action'] ) == "wplc_call_to_server_visitor") {
923
+ $display_notification = false;
924
+ }
925
  }
926
  else if (!$is_agent && $result->originates == 0) {
927
  /* this user is a not an agent and the notification is meant for a users, therefore display it */
928
  $display_notification = true;
929
  } else {
930
  /* this notification is not intended for this user */
 
931
  $display_notification = false;
932
  }
 
933
  }
934
 
935
  if (!$system_notification) {
952
  $msg = stripslashes($msg);
953
  }
954
 
955
+ $msg_array[$id]['msg'] = $msg;
956
+ $msg_hist .= $msg;
957
+ $msg_array[$id]['originates'] = $result->originates;
958
+ $msg_array[$id]['other'] = $other_data;
959
 
960
+ /*
961
+ removed in 7.1.00
962
  if($display_name){
963
  if ($html) {
964
  $str = "<span class='chat_time wplc-color-4'>$timeshow</span> <span class='$class'>$image <strong>$from </strong> $msg</span><br /><div class='wplc-clear-float-message'></div>";
965
+ $msg_array[$id]['msg'] = $msg;
966
+ $msg_hist .= $msg;
967
 
968
  } else {
969
  $str = "($timeshow) $from: $msg\r\n";
970
+ $msg_array[$id]['msg'] = $msg;
971
+ $msg_hist .= $msg;
972
  }
973
  } else {
974
  if ($html) {
975
  $str = "<span class='chat_time wplc-color-4'>$timeshow</span> <span class='$class'>$msg</span><br /><div class='wplc-clear-float-message'></div>";
976
+ $msg_array[$id]['msg'] = $msg;
977
+ $msg_hist .= $msg;
978
  } else {
979
  $str = "($timeshow) $msg\r\n";
980
+ $msg_array[$id]['msg'] = $msg;
981
  $msg_hist .= $str;
982
  }
983
 
984
+ }*/
985
  } else {
986
  /* this is a system notification */
987
  if ($display_notification) {
988
+ $str = "<span class='chat_time wplc-color-4'>".$nice_time."</span> <span class='wplc_system_notification wplc-color-4'>".$msg."</span>";
989
+
990
+ if ( !isset( $msg_array[$id] ) ) { $msg_array[$id] = array(); }
991
+ $msg_array[$id]['msg'] = $str;
992
+ $msg_array[$id]['other'] = $other_data;
993
+ $msg_array[$id]['originates'] = $result->originates;
994
+
995
  $msg_hist .= $str;
996
  }
997
  }
1042
  function wplc_return_admin_chat_messages($cid) {
1043
  $wplc_current_user = get_current_user_id();
1044
  if( get_user_meta( $wplc_current_user, 'wplc_ma_agent', true ) ){
1045
+ /*
1046
+ -- modified in in 6.0.04 --
1047
 
1048
+ if(current_user_can('wplc_ma_agent') || current_user_can('manage_options')){
1049
+ */
1050
  $wplc_settings = get_option("WPLC_SETTINGS");
1051
 
1052
  if(isset($wplc_settings['wplc_display_name']) && $wplc_settings['wplc_display_name'] == 1){ $display_name = 1; } else { $display_name = 0; }
1062
  * 3 - System notification to be delivered to agents
1063
  *
1064
  */
1065
+ $results = $wpdb->get_results("SELECT * FROM $wplc_tblname_msgs WHERE `chat_sess_id` = '$cid' AND `status` = '0' AND (`originates` = '2' OR `originates` = '3') ORDER BY `timestamp` ASC");
 
 
 
 
 
 
 
 
1066
 
 
 
 
 
 
 
 
1067
 
1068
+ $msg_hist = array();
1069
  foreach ($results as $result) {
 
 
1070
  $system_notification = false;
1071
+
1072
  $id = $result->id;
1073
+ wplc_mark_as_read_admin_chat_messages($id);
1074
  $from = $result->msgfrom;
1075
+
1076
+
1077
  $msg = $result->msg;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1078
 
1079
+ if ( isset( $result->other ) ) { $other_data = maybe_unserialize( $result->other ); } else { $other_data = array(); }
1080
+ if ($other_data == '') { $other_data = array(); }
1081
 
1082
+ $timestamp = strtotime( $result->timestamp );
1083
+ $other_data['datetime'] = $timestamp;
1084
+
1085
+ if (intval($result->originates) == 3) {
1086
+ /*
1087
+ system notifications
1088
+ from version 7
1089
+ */
1090
  $system_notification = true;
1091
+
1092
+ }
1093
+ else {
1094
+
1095
+
1096
+ }
1097
+
1098
  if (!$system_notification) {
1099
+ /* this is a normal message */
1100
  if(function_exists('wplc_encrypt_decrypt_msg')){
1101
  $msg = wplc_encrypt_decrypt_msg($msg);
1102
+ }
1103
+
1104
  $msg_array = maybe_unserialize( $msg );
1105
 
1106
  if( is_array( $msg_array ) ){
1109
 
1110
  $msg = stripslashes($msg);
1111
 
1112
+ $msg = apply_filters("wplc_filter_message_control_out",$msg);
1113
+
1114
+ $msg = stripslashes($msg);
1115
+
1116
+ $msg_hist[$id]['msg'] = $msg;
1117
+ $msg_hist[$id]['originates'] = intval($result->originates);
1118
+ $msg_hist[$id]['other'] = $other_data;
1119
 
 
 
 
 
 
1120
  } else {
1121
+ /* add the system notification to the list */
1122
+ if ( isset( $msg_hist[$id] ) ) { $msg_hist[$id] = array(); }
 
1123
 
1124
+ $msg_hist[$id]['msg'] = $msg;
1125
+ $msg_hist[$id]['other'] = $other_data;
1126
+ $msg_hist[$id]['originates'] = intval($result->originates);
1127
+ }
1128
 
1129
+
1130
+
1131
 
1132
+ }
1133
 
1134
  return $msg_hist;
1135
+ }
1136
+
1137
+
1138
+
1139
+ else {
1140
  return "security issue";
1141
  }
1142
 
1278
  <tbody>
1279
  <tr>
1280
  <td id="" align="center">
1281
+ <p>'.site_url().'</p>
1282
  </td>
1283
  </tr>
1284
  </tbody>
1501
 
1502
  global $wpdb;
1503
  global $wplc_tblname_chats;
 
1504
 
1505
 
1506
  $wplc_settings = get_option('WPLC_SETTINGS');
1546
 
1547
  $other_data = apply_filters("wplc_start_chat_hook_other_data_hook", $other_data);
1548
  if (!isset($other_data['welcome'])) {
1549
+ //wplc_send_welcome($cid,$wplc_settings);
1550
  $other_data['welcome'] = true;
1551
  }
1552
 
1553
  } else {
1554
+ //wplc_send_welcome($cid,$wplc_settings);
1555
  $other_data = array();
1556
  $other_data['welcome'] = true;
1557
 
1585
  ),
1586
  array('%d')
1587
  );
1588
+
1589
+ do_action("wplc_hook_initiate_chat",array("cid" => $cid, "name" => $name, "email" => $email));
1590
 
1591
  do_action("wplc_start_chat_hook_after_data_insert", $cid);
1592
  return $cid;
1597
 
1598
  $other_data = apply_filters("wplc_start_chat_hook_other_data_hook", $other_data);
1599
 
1600
+
1601
+
1602
  $wpdb->insert(
1603
  $wplc_tblname_chats,
1604
  array(
1648
  return "<a href=\"javascript:void(0);\" class=\"wplc_second_chat_request button button-primary\" style='cursor:not-allowed' title=\"".__("Get Pro Add-on to accept more chats","wplivechat")."\" target=\"_BLANK\">".__("Accept Chat","wplivechat")."</a>";
1649
  }
1650
  function wplc_update_chat_statuses() {
 
1651
  global $wpdb;
1652
  global $wplc_tblname_chats;
1653
  $results = $wpdb->get_results(
1665
 
1666
 
1667
 
 
1668
  if (intval($result->status) == 2) {
1669
+ if ($difference >= 30) { // 60 seconds max
1670
  wplc_change_chat_status($id,12);
1671
  }
1672
  }
1673
  else if (intval($result->status) == 12) {
1674
+ if ($difference >= 30) { // 30 seconds max
1675
  wplc_change_chat_status($id,0);
1676
  }
1677
  }
1816
 
1817
 
1818
  }
1819
+ function Memory_Usage($decimals = 2) {
 
1820
  $result = 0;
1821
 
1822
+ if (function_exists('memory_get_usage')) {
 
1823
  $result = memory_get_usage() / 1024;
1824
  }
1825
 
1826
+ else {
1827
+ if (function_exists('exec')) {
 
 
1828
  $output = array();
1829
 
1830
+ if (substr(strtoupper(PHP_OS), 0, 3) == 'WIN') {
 
1831
  exec('tasklist /FI "PID eq ' . getmypid() . '" /FO LIST', $output);
1832
 
1833
  $result = preg_replace('/[\D]/', '', $output[5]);
1834
  }
1835
 
1836
+ else {
 
1837
  exec('ps -eo%mem,rss,pid | grep ' . getmypid(), $output);
1838
 
1839
  $output = explode(' ', $output[0]);
1867
  global $wplc_tblname_chats;
1868
 
1869
 
1870
+ if(isset($_GET['wplc_action']) && $_GET['wplc_action'] == 'remove_missed_cid'){
1871
  if(isset($_GET['cid'])){
1872
  if(isset($_GET['wplc_confirm'])){
1873
  //Confirmed - delete
1874
  $delete_sql = "";
1875
+ if ( empty( $_GET['cid'] ) ) {
1876
+ exit('No CID?');
 
 
 
 
 
 
 
 
 
 
 
 
1877
  }
1878
+ $delete_sql = "DELETE FROM $wplc_tblname_chats WHERE `id` = '".intval( sanitize_text_field( $_GET['cid'] ) )."' LIMIT 1";
1879
 
1880
  $wpdb->query($delete_sql);
1881
  if ($wpdb->last_error) {
1892
  //Prompt
1893
  echo "<div class='update-nag' style='margin-top: 0px;margin-bottom: 5px;'>
1894
  ".__("Are you sure you would like to delete this chat?", "wplivechat")."<br>
1895
+ <a class='button' href='?page=wplivechat-menu-missed-chats&wplc_action=remove_missed_cid&cid=".$_GET['cid']."&wplc_confirm=1''>".__("Yes", "wplivechat")."</a> <a class='button' href='?page=wplivechat-menu-missed-chats'>".__("No", "wplivechat")."</a>
1896
  </div>";
1897
  }
1898
  }
1911
  </thead>
1912
  <tbody id=\"the-list\" class='list:wp_list_text_link'>";
1913
 
1914
+
1915
  if (function_exists("wplc_register_pro_version")) {
1916
+ $sql = "SELECT * FROM $wplc_tblname_chats WHERE (`status` = 0 OR `agent_id` = 0) ORDER BY `timestamp` DESC";
 
 
 
 
 
 
 
1917
  } else {
1918
+ $sql = "SELECT * FROM $wplc_tblname_chats WHERE `status` = 0 ORDER BY `timestamp` DESC";
 
 
 
 
 
 
1919
  }
1920
 
1921
  $results = $wpdb->get_results($sql);
1924
  echo "<tr><td></td><td>" . __("You have not missed any chat requests.", "wplivechat") . "</td></tr>";
1925
  } else {
1926
  foreach ($results as $result) {
1927
+
1928
+ $url = admin_url('admin.php?page=wplivechat-menu&action=history&cid=' . $result->id);
1929
+ $url2 = admin_url('admin.php?page=wplivechat-menu&action=download_history&type=csv&cid=' . $result->id);
1930
+ $url3 = "?page=wplivechat-menu-missed-chats&wplc_action=remove_missed_cid&cid=" . $result->id;
1931
+ $actions = "
1932
+ <a href='$url' class='button' title='".__('View Chat History', 'wplivechat')."' target='_BLANK' id=''><i class='fa fa-eye'></i></a> <a href='$url2' class='button' title='".__('Download Chat History', 'wplivechat')."' target='_BLANK' id=''><i class='fa fa-download'></i></a> <a href='$url3' class='button'><i class='fa fa-trash-o'></i></a>
1933
+ ";
1934
+
1935
  echo "<tr id=\"record_" . $result->id . "\">";
1936
  echo "<td class='chat_id column-chat_d'>" . $result->timestamp . "</td>";
1937
  echo "<td class='chat_name column_chat_name' id='chat_name_" . $result->id . "'><img src=\"//www.gravatar.com/avatar/" . md5($result->email) . "?s=30\" class='wplc-user-message-avatar' /> " . $result->name . "</td>";
1938
  echo "<td class='chat_email column_chat_email' id='chat_email_" . $result->id . "'><a href='mailto:" . $result->email . "' title='Email " . ".$result->email." . "'>" . $result->email . "</a></td>";
1939
  echo "<td class='chat_name column_chat_url' id='chat_url_" . $result->id . "'>" . esc_url($result->url) . "</td>";
1940
+ echo "<td class='chat_name column_chat_url'>".$actions."</td>";
1941
  echo "</tr>";
1942
  }
1943
  }
2015
  if(isset($wplc_settings['wplc_animation']) && $wplc_settings['wplc_animation'] == 'animation-1'){
2016
 
2017
  if($original_pos == 'bottom_right'){
2018
+ $wplc_starting_point = 'margin-bottom: -350px; right: 20px;';
2019
  $wplc_animation = 'animation-1';
2020
  } else if ($original_pos == 'bottom_left'){
2021
+ $wplc_starting_point = 'margin-bottom: -350px; left: 20px;';
2022
  $wplc_animation = 'animation-1';
2023
  } else if ($original_pos == 'left'){
2024
  $wplc_starting_point = 'margin-bottom: -350px; left: 0px;';
2059
  $wplc_animation = 'animation-3';
2060
 
2061
  if($original_pos == 'bottom_right'){
2062
+ $wplc_starting_point = 'margin-bottom: 0; right: 20px; display: none;';
2063
  } else if ($original_pos == 'bottom_left'){
2064
+ $wplc_starting_point = 'margin-bottom: 0px; left: 20px; display: none;';
2065
  } else if ($original_pos == 'left'){
2066
  $wplc_starting_point = 'margin-bottom: 100px; left: 0px; display: none;';
2067
  } else if ($original_pos == 'right'){
2078
  $wplc_animation = "animation-4";
2079
 
2080
  if($original_pos == 'bottom_right'){
2081
+ $wplc_starting_point = 'margin-bottom: 0; right: 20px; display: none;';
2082
  } else if ($original_pos == 'bottom_left'){
2083
+ $wplc_starting_point = 'margin-bottom: 0px; left: 20px; display: none;';
2084
  } else if ($original_pos == 'left'){
2085
  $wplc_starting_point = 'margin-bottom: 100px; left: 0px; display: none;';
2086
  } else if ($original_pos == 'right'){
2094
  } else {
2095
 
2096
  if($original_pos == 'bottom_right'){
2097
+ $wplc_starting_point = 'margin-bottom: 0; right: 20px; display: none;';
2098
  } else if ($original_pos == 'bottom_left'){
2099
+ $wplc_starting_point = 'margin-bottom: 0px; left: 20px; display: none;';
2100
  } else if ($original_pos == 'left'){
2101
  $wplc_starting_point = 'margin-bottom: 100px; left: 0px; display: none;';
2102
  } else if ($original_pos == 'right'){
images/bg/cloudy.jpg ADDED
Binary file
images/bg/geometry.jpg ADDED
Binary file
images/bg/social.jpg ADDED
Binary file
images/bg/tech.jpg ADDED
Binary file
images/iconCloseRetina.png ADDED
Binary file
images/iconRetina.png ADDED
Binary file
includes/notification_control.php CHANGED
@@ -15,7 +15,6 @@ function wplc_record_chat_notification($type,$cid,$data) {
15
  add_action("wplc_hook_chat_notification","wplc_filter_control_chat_notification_user_loaded",10,3);
16
  function wplc_filter_control_chat_notification_user_loaded($type,$cid,$data) {
17
  if ($type == "user_loaded") {
18
-
19
  /**
20
  * Only run if the chat status is not 1 or 5 (complete or browsing)
21
  * 1 is questionable here, we may have to remove it at a later stage.
@@ -48,6 +47,9 @@ function wplc_filter_control_chat_notification_user_loaded($type,$cid,$data) {
48
  '%d'
49
  )
50
  );
 
 
 
51
  }
52
  }
53
  return $type;
@@ -60,6 +62,9 @@ function wplc_filter_control_chat_notification_await_agent($type,$cid,$data) {
60
  if(isset($wplc_settings['wplc_use_node_server']) && intval($wplc_settings['wplc_use_node_server']) == 1){ } else {
61
 
62
  if ($type == "await_agent") {
 
 
 
63
  global $wpdb;
64
  global $wplc_tblname_msgs;
65
  $wpdb->insert(
@@ -95,12 +100,22 @@ function wplc_filter_control_chat_notification_agent_joined($type,$cid,$data) {
95
 
96
  global $wpdb;
97
  global $wplc_tblname_msgs;
98
-
99
-
 
100
  $wplc_acbc_data = get_option("WPLC_ACBC_SETTINGS");
 
 
 
 
 
 
 
 
 
101
 
102
  if( isset( $wplc_acbc_data['wplc_use_wp_name'] ) && $wplc_acbc_data['wplc_use_wp_name'] == '1' ){
103
- $user_info = get_userdata(intval($data['aid']));
104
  $agent = $user_info->display_name;
105
  } else {
106
  if (!empty($wplc_acbc_data['wplc_chat_name'])) {
@@ -109,29 +124,58 @@ function wplc_filter_control_chat_notification_agent_joined($type,$cid,$data) {
109
  $agent = 'Admin';
110
  }
111
  }
112
-
 
 
 
 
113
 
114
  $msg = $agent . " ". __("has joined the chat.","wplivechat");
115
 
116
- $wpdb->insert(
117
- $wplc_tblname_msgs,
118
- array(
119
- 'chat_sess_id' => $cid,
120
- 'timestamp' => current_time('mysql'),
121
- 'msgfrom' => __('System notification',"wplivechat"),
122
- 'msg' => $msg,
123
- 'status' => 0,
124
- 'originates' => 0
125
- ),
126
- array(
127
- '%s',
128
- '%s',
129
- '%s',
130
- '%s',
131
- '%d',
132
- '%d'
133
- )
134
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
135
  }
136
  return $type;
137
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  add_action("wplc_hook_chat_notification","wplc_filter_control_chat_notification_user_loaded",10,3);
16
  function wplc_filter_control_chat_notification_user_loaded($type,$cid,$data) {
17
  if ($type == "user_loaded") {
 
18
  /**
19
  * Only run if the chat status is not 1 or 5 (complete or browsing)
20
  * 1 is questionable here, we may have to remove it at a later stage.
47
  '%d'
48
  )
49
  );
50
+
51
+
52
+
53
  }
54
  }
55
  return $type;
62
  if(isset($wplc_settings['wplc_use_node_server']) && intval($wplc_settings['wplc_use_node_server']) == 1){ } else {
63
 
64
  if ($type == "await_agent") {
65
+
66
+
67
+
68
  global $wpdb;
69
  global $wplc_tblname_msgs;
70
  $wpdb->insert(
100
 
101
  global $wpdb;
102
  global $wplc_tblname_msgs;
103
+
104
+ $chat_data = wplc_get_chat_data( $cid );
105
+
106
  $wplc_acbc_data = get_option("WPLC_ACBC_SETTINGS");
107
+ $user_info = get_userdata(intval($data['aid']));
108
+
109
+ $agent_tagline = '';
110
+ $agent_bio = '';
111
+ $a_twitter = '';
112
+ $a_linkedin = '';
113
+ $a_facebook = '';
114
+ $a_website = '';
115
+ $social_links = '';
116
 
117
  if( isset( $wplc_acbc_data['wplc_use_wp_name'] ) && $wplc_acbc_data['wplc_use_wp_name'] == '1' ){
118
+
119
  $agent = $user_info->display_name;
120
  } else {
121
  if (!empty($wplc_acbc_data['wplc_chat_name'])) {
124
  $agent = 'Admin';
125
  }
126
  }
127
+
128
+
129
+ $agent_tagline = apply_filters( "wplc_filter_agent_data_agent_tagline", $agent_tagline, $cid, $chat_data, $agent, $wplc_acbc_data, $user_info, $data );
130
+ $agent_bio = apply_filters( "wplc_filter_agent_data_agent_bio", $agent_bio, $cid, $chat_data, $agent, $wplc_acbc_data, $user_info, $data );
131
+ $social_links = apply_filters( "wplc_filter_agent_data_social_links", $social_links, $cid, $chat_data, $agent, $wplc_acbc_data, $user_info, $data);
132
 
133
  $msg = $agent . " ". __("has joined the chat.","wplivechat");
134
 
135
+ $data_array = array(
136
+ 'chat_sess_id' => $cid,
137
+ 'timestamp' => current_time('mysql'),
138
+ 'msgfrom' => __('System notification',"wplivechat"),
139
+ 'msg' => $msg,
140
+ 'status' => 0,
141
+ 'originates' => 0,
142
+ 'other' => maybe_serialize(array(
143
+ 'ntype' => 'joined',
144
+ 'email' => md5($user_info->user_email),
145
+ 'name' => $agent,
146
+ 'aid' => $user_info->ID,
147
+ 'agent_tagline' => $agent_tagline,
148
+ 'agent_bio' => $agent_bio,
149
+ "social_links" => $social_links
150
+ ))
 
 
151
  );
152
+ $type_array = array(
153
+ '%s',
154
+ '%s',
155
+ '%s',
156
+ '%s',
157
+ '%d',
158
+ '%d',
159
+ '%s'
160
+ );
161
+
162
+ do_action( "wplc_store_agent_joined_notification", $data_array, $type_array );
163
+
164
+
165
  }
166
  return $type;
167
  }
168
+
169
+
170
+ add_action( "wplc_store_agent_joined_notification", "wplc_hook_control_store_agent_joined_notification", 10, 2 );
171
+ function wplc_hook_control_store_agent_joined_notification($data_array, $type_array) {
172
+ global $wpdb;
173
+ global $wplc_tblname_msgs;
174
+
175
+ $wpdb->insert(
176
+ $wplc_tblname_msgs,
177
+ $data_array,
178
+ $type_array
179
+ );
180
+ return;
181
+ }
includes/settings_page.php CHANGED
@@ -233,12 +233,20 @@ if (get_option("WPLC_HIDE_CHAT") == true) {
233
  </tr>
234
  <tr>
235
  <td width='300' valign='top'>
236
- <?php _e("Enable Font Awesome set","wplivechat"); ?>: <i class="fa fa-question-circle wplc_light_grey wplc_settings_tooltip" title="<?php _e("Disable this if you have Font Awesome set included with your theme", "wplivechat") ?>"></i>
237
  </td>
238
  <td valign='top'>
239
  <input type="checkbox" value="1" name="wplc_enable_font_awesome" <?php if(isset($wplc_settings['wplc_enable_font_awesome']) && $wplc_settings['wplc_enable_font_awesome'] == 1 ) { echo "checked"; } ?> />
240
  </td>
241
  </tr>
 
 
 
 
 
 
 
 
242
  <?php if (!function_exists("wplc_pro_activate")) { ?>
243
 
244
  <tr>
@@ -316,7 +324,9 @@ if (get_option("WPLC_HIDE_CHAT") == true) {
316
  <input type="checkbox" name="wplc_auto_pop_up" value="1" <?php if(isset($wplc_settings['wplc_auto_pop_up']) && $wplc_settings['wplc_auto_pop_up'] == 1 ) { echo "checked"; } ?>/>
317
  </td>
318
  </tr>
319
- <tr>
 
 
320
 
321
  <?php if (!function_exists("wplc_pro_activate")) { ?>
322
  <tr>
@@ -757,7 +767,7 @@ if (isset($wplc_settings['wplc_hide_when_offline']) && $wplc_settings['wplc_hide
757
  </tr>
758
 
759
  <tr style='margin-bottom: 10px;'>
760
- <td><label for=""><?php _e('Colour Scheme', 'wplivechat'); ?></label></td>
761
  <td>
762
  <div class='wplc_theme_block'>
763
  <div class='wplc_palette'>
@@ -832,10 +842,20 @@ if (isset($wplc_settings['wplc_hide_when_offline']) && $wplc_settings['wplc_hide
832
 
833
  </td>
834
  </tr>
835
- <tr height="30">
836
- <td>&nbsp;</td>
837
- <td>&nbsp;</td>
838
- </tr>
 
 
 
 
 
 
 
 
 
 
839
  <tr>
840
  <td width='200' valign='top'><?php _e("Palette Color 1","wplivechat")?>:</td>
841
  <td>
@@ -921,15 +941,18 @@ if (isset($wplc_settings['wplc_hide_when_offline']) && $wplc_settings['wplc_hide
921
  <tr class="wplc_localization_strings">
922
  <td width="200" valign="top"><?php _e("Other text", "wplivechat") ?>:</td>
923
  <td>
924
- <input id="wplc_user_enter" name="wplc_user_enter" type="text" size="50" maxlength="150" class="regular-text" value="<?php echo stripslashes($wplc_settings['wplc_user_enter']) ?>" /> <span class='description'><?php _e('This text is shown above the user chat input field', 'wplivechat'); ?></span><br />
 
925
  </td>
926
  </tr>
 
927
  <tr class="wplc_localization_strings">
928
  <td width="200" valign="top"><?php _e("Close Button Text", "wplivechat") ?>:</td>
929
  <td>
930
  <input id="wplc_close_btn_text" name="wplc_close_btn_text" type="text" size="50" maxlength="150" class="regular-text" value="<?php echo stripslashes($wplc_settings['wplc_close_btn_text']) ?>" /><br />
931
  </td>
932
  </tr>
 
933
 
934
  <tr>
935
  <th><label for=""><?php _e('Choose an animation', 'wplivechat'); ?></label></th>
233
  </tr>
234
  <tr>
235
  <td width='300' valign='top'>
236
+ <?php _e("Enable Font Awesome set","wplivechat"); ?>: <i class="fa fa-question-circle wplc_light_grey wplc_settings_tooltip" title="<?php _e("Disable this if you have Font Awesome set included with your theme", "wplivechat") ?>"></i>
237
  </td>
238
  <td valign='top'>
239
  <input type="checkbox" value="1" name="wplc_enable_font_awesome" <?php if(isset($wplc_settings['wplc_enable_font_awesome']) && $wplc_settings['wplc_enable_font_awesome'] == 1 ) { echo "checked"; } ?> />
240
  </td>
241
  </tr>
242
+ <tr>
243
+ <td width='300' valign='top'>
244
+ <?php _e("Enable chat notifications on all admin pages","wplivechat"); ?>: <i class="fa fa-question-circle wplc_light_grey wplc_settings_tooltip" title="<?php _e("This will allow you to receive chat notifications while browsing any admin page.", "wplivechat") ?>"></i>
245
+ </td>
246
+ <td valign='top'>
247
+ <input type="checkbox" value="1" name="wplc_enable_all_admin_pages" <?php if(isset($wplc_settings['wplc_enable_all_admin_pages']) && $wplc_settings['wplc_enable_all_admin_pages'] == 1 ) { echo "checked"; } ?> />
248
+ </td>
249
+ </tr>
250
  <?php if (!function_exists("wplc_pro_activate")) { ?>
251
 
252
  <tr>
324
  <input type="checkbox" name="wplc_auto_pop_up" value="1" <?php if(isset($wplc_settings['wplc_auto_pop_up']) && $wplc_settings['wplc_auto_pop_up'] == 1 ) { echo "checked"; } ?>/>
325
  </td>
326
  </tr>
327
+
328
+
329
+
330
 
331
  <?php if (!function_exists("wplc_pro_activate")) { ?>
332
  <tr>
767
  </tr>
768
 
769
  <tr style='margin-bottom: 10px;'>
770
+ <td><label for=""><?php _e('Color Scheme', 'wplivechat'); ?></label></td>
771
  <td>
772
  <div class='wplc_theme_block'>
773
  <div class='wplc_palette'>
842
 
843
  </td>
844
  </tr>
845
+
846
+ <tr>
847
+ <td width='300' valign='top'><?php _e("Chat background","wplivechat")?>:</td>
848
+ <td>
849
+
850
+ <select id='wplc_settings_bg' name='wplc_settings_bg'>
851
+ <option value="cloudy.jpg" <?php if (!isset($wplc_settings['wplc_settings_bg']) || ($wplc_settings['wplc_settings_bg'] == "cloudy.jpg") ) { echo "selected"; } ?>><?php _e("Cloudy","wplivechat"); ?></option>
852
+ <option value="geometry.jpg" <?php if (isset($wplc_settings['wplc_settings_bg']) && $wplc_settings['wplc_settings_bg'] == "geometry.jpg") { echo "selected"; } ?>><?php _e("Geometry","wplivechat"); ?></option>
853
+ <option value="tech.jpg" <?php if (isset($wplc_settings['wplc_settings_bg']) && $wplc_settings['wplc_settings_bg'] == "tech.jpg") { echo "selected"; } ?>><?php _e("Tech","wplivechat"); ?></option>
854
+ <option value="social.jpg" <?php if (isset($wplc_settings['wplc_settings_bg']) && $wplc_settings['wplc_settings_bg'] == "social.jpg") { echo "selected"; } ?>><?php _e("Social","wplivechat"); ?></option>
855
+ <option value="0" <?php if (isset($wplc_settings['wplc_settings_bg']) && $wplc_settings['wplc_settings_bg'] == "0") { echo "selected"; } ?>><?php _e("None","wplivechat"); ?></option>
856
+ </select>
857
+ </td>
858
+ </tr>
859
  <tr>
860
  <td width='200' valign='top'><?php _e("Palette Color 1","wplivechat")?>:</td>
861
  <td>
941
  <tr class="wplc_localization_strings">
942
  <td width="200" valign="top"><?php _e("Other text", "wplivechat") ?>:</td>
943
  <td>
944
+ <input id="wplc_user_enter" name="wplc_user_enter" type="text" size="50" maxlength="150" class="regular-text" value="<?php echo stripslashes($wplc_settings['wplc_user_enter']) ?>" /><br />
945
+ <input id="wplc_text_chat_ended" name="wplc_text_chat_ended" type="text" size="50" maxlength="150" class="regular-text" value="<?php echo ( empty( $wplc_settings['wplc_text_chat_ended'] ) ) ? stripslashes(__("The chat has been ended by the operator.", "wplivechat")) : stripslashes( $wplc_settings['wplc_text_chat_ended'] ) ?>" /> <br />
946
  </td>
947
  </tr>
948
+ <!--
949
  <tr class="wplc_localization_strings">
950
  <td width="200" valign="top"><?php _e("Close Button Text", "wplivechat") ?>:</td>
951
  <td>
952
  <input id="wplc_close_btn_text" name="wplc_close_btn_text" type="text" size="50" maxlength="150" class="regular-text" value="<?php echo stripslashes($wplc_settings['wplc_close_btn_text']) ?>" /><br />
953
  </td>
954
  </tr>
955
+ -->
956
 
957
  <tr>
958
  <th><label for=""><?php _e('Choose an animation', 'wplivechat'); ?></label></th>
includes/surveys.php CHANGED
@@ -126,7 +126,7 @@ function wplc_return_nimble_surveys() {
126
  'body' => array(
127
  'wordpress_plugin' => 1,
128
  'action' => 'return_surveys',
129
- 'siteurl' => get_option('siteurl')
130
  )
131
  )
132
  );
@@ -302,7 +302,7 @@ function wplc_admin_survey_layout() {
302
  else {
303
 
304
  $link1 = sprintf( __( 'Register on <a href="%s" target="_BLANK" title="NimbleSquirrel">NimbleSquirrel</a> (It\'s free.)', 'wplivechat' ),
305
- 'http://app.nimblesquirrel.com/join.php?email='.get_option("admin_email")."&site=".get_option('siteurl').'&utm_source=wplc&utm_medium=click&utm_campaign=plugin_register'
306
  );
307
  $link2 = sprintf( __( '<a href="%s" target="_BLANK" title="Create a survey">Create a survey</a>.', 'wplivechat' ),
308
  'http://app.nimblesquirrel.com/my_account.php?a=add_survey_wizard&utm_source=wplc&utm_medium=click&utm_campaign=add_survey'
126
  'body' => array(
127
  'wordpress_plugin' => 1,
128
  'action' => 'return_surveys',
129
+ 'siteurl' => site_url()
130
  )
131
  )
132
  );
302
  else {
303
 
304
  $link1 = sprintf( __( 'Register on <a href="%s" target="_BLANK" title="NimbleSquirrel">NimbleSquirrel</a> (It\'s free.)', 'wplivechat' ),
305
+ 'http://app.nimblesquirrel.com/join.php?email='.get_option("admin_email")."&site=".site_url().'&utm_source=wplc&utm_medium=click&utm_campaign=plugin_register'
306
  );
307
  $link2 = sprintf( __( '<a href="%s" target="_BLANK" title="Create a survey">Create a survey</a>.', 'wplivechat' ),
308
  'http://app.nimblesquirrel.com/my_account.php?a=add_survey_wizard&utm_source=wplc&utm_medium=click&utm_campaign=add_survey'
js/themes/classic.js CHANGED
@@ -11,11 +11,14 @@ jQuery(document).on("wplc_minimize_chat", function( e ) {
11
  } else if(jQuery("#wp-live-chat").attr("original_pos") === "left"){
12
  jQuery("#wp-live-chat").css("left", "0");
13
  jQuery("#wp-live-chat").css("bottom", "100px");
 
 
14
  } else if(jQuery("#wp-live-chat").attr("original_pos") === "right"){
15
  jQuery("#wp-live-chat").css("left", "");
16
  jQuery("#wp-live-chat").css("right", "0");
17
  jQuery("#wp-live-chat").css("bottom", "100px");
18
  jQuery("#wp-live-chat").css("width", "");
 
19
  }
20
  jQuery('#wp-live-chat').addClass("wplc_close");
21
  jQuery('#wp-live-chat').removeClass("wplc_open");
@@ -30,10 +33,9 @@ jQuery(document).on("wplc_minimize_chat", function( e ) {
30
  jQuery("#nifty_ratings_holder").hide();
31
  jQuery("#wp-live-chat-react").hide();
32
  jQuery("#wp-live-chat-minimize").hide();
33
-
34
-
35
-
36
-
37
  });
38
 
39
  jQuery(document).on("wplc_start_chat", function( e ) {
@@ -48,13 +50,21 @@ jQuery(document).on( "wplc_open_chat_1", function( e ) {
48
 
49
  jQuery('#wp-live-chat').removeClass("wplc_close");
50
  jQuery('#wp-live-chat').addClass("wplc_open");
51
- //jQuery("#wp-live-chat-1").hide();
52
  jQuery("#wp-live-chat-react").hide();
53
  jQuery("#wp-live-chat-header").css('cursor', 'all-scroll');
54
- //jQuery("#wp-live-chat-1").css('cursor', 'all-scroll');
55
  Cookies.set('wplc_hide', "", { expires: 1, path: '/' });
56
  jQuery("#wp-live-chat-minimize").show();
57
 
 
 
 
 
 
 
 
 
 
 
58
  jQuery(function() {
59
  jQuery( "#wp-live-chat" ).draggable({
60
  handle: "#wp-live-chat-header",
@@ -68,23 +78,27 @@ jQuery(document).on( "wplc_open_chat_1", function( e ) {
68
 
69
  });
70
 
 
71
  jQuery(document).on( "wplc_open_chat_2", function( e ) {
72
 
73
  jQuery("#wp-live-chat-2").hide();
74
 
 
 
 
 
75
  wplc_chat_status = Cookies.get('wplc_chat_status');
76
  if (typeof e.wplc_online !== "undefined" && e.wplc_online === true) {
77
  jQuery("#wp-live-chat-4").show();
78
  jQuery("#wplc_social_holder").show();
79
  jQuery("#nifty_ratings_holder").show();
80
- jQuery("#wplc_chatmsg").focus();
81
  jQuery("#wp-live-chat-1").css("cursor","pointer");
82
  } else if (e.wplc_online === false) {
83
  jQuery("#wp-live-chat-2").show();
 
84
  jQuery("#wp-live-chat-4").hide();
85
  jQuery("#wplc_social_holder").hide();
86
  jQuery("#nifty_ratings_holder").hide();
87
- jQuery("#wplc_chatmsg").focus();
88
  jQuery("#wp-live-chat-1").css("cursor","pointer");
89
  }
90
 
@@ -100,15 +114,12 @@ jQuery(document).ready(function() {
100
  jQuery.event.trigger({type: "wplc_open_chat"});
101
  });
102
  jQuery("body").on("click", ".wplc_retry_chat", function() {
103
-
104
  Cookies.set('wplc_chat_status', 5);
105
-
106
  jQuery("#wplc_chatbox").html("");
107
  jQuery("#wp-live-chat-4").fadeOut();
108
  jQuery("#wp-live-chat-2").fadeIn();
109
  jQuery("#wp-live-chat-2-inner").fadeIn();
110
-
111
-
112
  });
113
  jQuery("body").on("click", "#speeching_button", function() {
114
  jQuery("#wplc_hovercard").hide();
@@ -124,6 +135,7 @@ jQuery(document).ready(function() {
124
 
125
  jQuery("body").on("click", "#wp-live-chat-header", function(){
126
  jQuery("#wplc_hovercard").hide();
 
127
  jQuery("#wplc-chat-alert").removeClass('is-active');
128
  });
129
 
11
  } else if(jQuery("#wp-live-chat").attr("original_pos") === "left"){
12
  jQuery("#wp-live-chat").css("left", "0");
13
  jQuery("#wp-live-chat").css("bottom", "100px");
14
+ jQuery("#wp-live-chat").css("width", "");
15
+ jQuery("#wp-live-chat").css("height", "");
16
  } else if(jQuery("#wp-live-chat").attr("original_pos") === "right"){
17
  jQuery("#wp-live-chat").css("left", "");
18
  jQuery("#wp-live-chat").css("right", "0");
19
  jQuery("#wp-live-chat").css("bottom", "100px");
20
  jQuery("#wp-live-chat").css("width", "");
21
+ jQuery("#wp-live-chat").css("height", "");
22
  }
23
  jQuery('#wp-live-chat').addClass("wplc_close");
24
  jQuery('#wp-live-chat').removeClass("wplc_open");
33
  jQuery("#nifty_ratings_holder").hide();
34
  jQuery("#wp-live-chat-react").hide();
35
  jQuery("#wp-live-chat-minimize").hide();
36
+ });
37
+ jQuery(document).on("click", "#wp-live-chat", function( e ){
38
+
 
39
  });
40
 
41
  jQuery(document).on("wplc_start_chat", function( e ) {
50
 
51
  jQuery('#wp-live-chat').removeClass("wplc_close");
52
  jQuery('#wp-live-chat').addClass("wplc_open");
 
53
  jQuery("#wp-live-chat-react").hide();
54
  jQuery("#wp-live-chat-header").css('cursor', 'all-scroll');
 
55
  Cookies.set('wplc_hide', "", { expires: 1, path: '/' });
56
  jQuery("#wp-live-chat-minimize").show();
57
 
58
+ /* set the width again as jQuery sometimes messes this up completely. */
59
+ if(jQuery("#wp-live-chat").attr("original_pos") === "left"){
60
+ jQuery("#wp-live-chat").css("width", "280px");
61
+ jQuery("#wp-live-chat").css("height", "auto !important");
62
+ } else if(jQuery("#wp-live-chat").attr("original_pos") === "right"){
63
+ jQuery("#wp-live-chat").css("width", "280px");
64
+ jQuery("#wp-live-chat").css("height", "auto !important");
65
+ }
66
+
67
+
68
  jQuery(function() {
69
  jQuery( "#wp-live-chat" ).draggable({
70
  handle: "#wp-live-chat-header",
78
 
79
  });
80
 
81
+
82
  jQuery(document).on( "wplc_open_chat_2", function( e ) {
83
 
84
  jQuery("#wp-live-chat-2").hide();
85
 
86
+ if(!jQuery("#wp-live-chat").hasClass("wplc_open")){
87
+ jQuery("#wplc_chatmsg").focus();
88
+ }
89
+
90
  wplc_chat_status = Cookies.get('wplc_chat_status');
91
  if (typeof e.wplc_online !== "undefined" && e.wplc_online === true) {
92
  jQuery("#wp-live-chat-4").show();
93
  jQuery("#wplc_social_holder").show();
94
  jQuery("#nifty_ratings_holder").show();
 
95
  jQuery("#wp-live-chat-1").css("cursor","pointer");
96
  } else if (e.wplc_online === false) {
97
  jQuery("#wp-live-chat-2").show();
98
+ jQuery("#wp-live-chat").css("height","auto !important");
99
  jQuery("#wp-live-chat-4").hide();
100
  jQuery("#wplc_social_holder").hide();
101
  jQuery("#nifty_ratings_holder").hide();
 
102
  jQuery("#wp-live-chat-1").css("cursor","pointer");
103
  }
104
 
114
  jQuery.event.trigger({type: "wplc_open_chat"});
115
  });
116
  jQuery("body").on("click", ".wplc_retry_chat", function() {
 
117
  Cookies.set('wplc_chat_status', 5);
 
118
  jQuery("#wplc_chatbox").html("");
119
  jQuery("#wp-live-chat-4").fadeOut();
120
  jQuery("#wp-live-chat-2").fadeIn();
121
  jQuery("#wp-live-chat-2-inner").fadeIn();
122
+ wplc_shown_welcome = false;
 
123
  });
124
  jQuery("body").on("click", "#speeching_button", function() {
125
  jQuery("#wplc_hovercard").hide();
135
 
136
  jQuery("body").on("click", "#wp-live-chat-header", function(){
137
  jQuery("#wplc_hovercard").hide();
138
+ jQuery("#wp-live-chat").css("height","");
139
  jQuery("#wplc-chat-alert").removeClass('is-active');
140
  });
141
 
js/themes/modern.js CHANGED
@@ -1,28 +1,30 @@
1
 
 
2
  jQuery(document).on("wplc_minimize_chat", function( e ) {
3
  wplc_is_chat_open = false;
4
  jQuery('#wp-live-chat').height("");
5
  if(jQuery("#wp-live-chat").attr("original_pos") === "bottom_right"){
6
  jQuery("#wp-live-chat").css("left", "");
7
  jQuery("#wp-live-chat").css("bottom", "0");
8
- jQuery("#wp-live-chat").css("right", "100px");
9
  } else if(jQuery("#wp-live-chat").attr("original_pos") === "bottom_left"){
10
- jQuery("#wp-live-chat").css("left", "100px");
11
  jQuery("#wp-live-chat").css("bottom", "0");
12
  jQuery("#wp-live-chat").css("right", "");
13
  } else if(jQuery("#wp-live-chat").attr("original_pos") === "left"){
14
- jQuery("#wp-live-chat").css("left", "0");
15
  jQuery("#wp-live-chat").css("bottom", "100px");
16
  } else if(jQuery("#wp-live-chat").attr("original_pos") === "right"){
17
- jQuery("#wp-live-chat").css("left", "");
18
- jQuery("#wp-live-chat").css("right", "0");
19
- jQuery("#wp-live-chat").css("bottom", "100px");
20
- jQuery("#wp-live-chat").css("width", "");
21
  }
22
  jQuery('#wp-live-chat').addClass("wplc_close");
23
  jQuery('#wp-live-chat').removeClass("wplc_open");
24
  //jQuery("#wp-live-chat").css(jQuery("#wp-live-chat").attr("original_pos"), "100px");
25
  jQuery("#wp-live-chat").css("top", "");
 
26
  jQuery("#wp-live-chat-1").show();
27
  jQuery("#wp-live-chat-1").css('cursor', 'pointer');
28
  jQuery("#wp-live-chat-2").hide();
@@ -51,7 +53,9 @@ jQuery(document).on( "wplc_open_chat_1", function( e ) {
51
  jQuery('#wp-live-chat').removeClass("wplc_close");
52
  jQuery('#wp-live-chat').addClass("wplc_open");
53
  jQuery("#wp-live-chat-react").hide();
54
- jQuery("#wp-live-chat-header").hide();
 
 
55
  Cookies.set('wplc_hide', "", { expires: 1, path: '/' });
56
  jQuery("#wp-live-chat-minimize").show();
57
 
@@ -59,15 +63,78 @@ jQuery(document).on( "wplc_open_chat_1", function( e ) {
59
 
60
 
61
  });
 
62
 
 
 
 
 
 
63
 
64
- jQuery(document).on("wplc_animation_done", function(e) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  jQuery("#wplc_chatbox").css("top",
66
- 35+jQuery("#wplc_logo").height()+"px"
67
- );
68
- jQuery("#wplc_chatbox").css("bottom",
69
- jQuery("#wplc_user_message_div").outerHeight()+"px"
70
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
 
72
 
73
  });
@@ -77,15 +144,20 @@ jQuery(document).on( "wplc_open_chat_2", function( e ) {
77
 
78
  jQuery("#wp-live-chat-2").show();
79
 
 
 
 
 
 
 
80
  wplc_chat_status = Cookies.get('wplc_chat_status');
81
- //console.log("x1");
82
  if (typeof e.wplc_online !== "undefined" && e.wplc_online === true) {
83
- //console.log("x2");
84
  jQuery("#wp-live-chat-4").show();
85
  jQuery("#wplc_social_holder").show();
86
  jQuery("#nifty_ratings_holder").show();
87
  jQuery.event.trigger({type: "wplc_animation_done"});
88
- jQuery("#wplc_chatmsg").focus();
 
89
  }
90
 
91
  jQuery("#wp-live-chat-3").hide();
@@ -96,44 +168,105 @@ jQuery(document).on( "wplc_open_chat_2", function( e ) {
96
 
97
 
98
  });
99
-
 
 
 
100
 
101
  jQuery(document).ready(function() {
102
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
 
104
 
105
  //opens chat when clicked on top bar
106
  jQuery("body").on("click", "#wp-live-chat-header", function() {
107
- jQuery("#wplc_hovercard").fadeOut("fast");
108
- jQuery("#wplc-chat-alert").removeClass('is-active');
109
- wplc_is_chat_open = true;
110
- jQuery.event.trigger({type: "wplc_open_chat"});
111
  });
112
 
 
113
  jQuery("body").on("click", ".wplc_retry_chat", function() {
114
  jQuery("#wplc_chatbox").html("");
115
  jQuery("#wp-live-chat-4").fadeOut();
116
- Cookies.remove('wplc_cid');
117
  Cookies.remove('wplc_chat_status');
118
  jQuery("#wp-live-chat-2-inner").fadeIn();
 
119
  });
120
 
121
 
122
- jQuery("body").on("hover", "#wp-live-chat-header", function(){
123
- if (!wplc_is_chat_open) {
124
- jQuery("#wplc_hovercard").fadeIn('fast');
125
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
  });
127
  jQuery("body").on("click", "#wplc_hovercard_min", function() {
128
  jQuery("#wplc_hovercard").fadeOut('fast');
129
  });
130
  jQuery("body").on("click", "#speeching_button", function() {
131
- jQuery("#wp-live-chat-header").click();
 
 
 
 
132
  });
 
 
 
 
133
 
134
 
135
 
136
 
137
 
138
 
139
- });
 
 
1
 
2
+
3
  jQuery(document).on("wplc_minimize_chat", function( e ) {
4
  wplc_is_chat_open = false;
5
  jQuery('#wp-live-chat').height("");
6
  if(jQuery("#wp-live-chat").attr("original_pos") === "bottom_right"){
7
  jQuery("#wp-live-chat").css("left", "");
8
  jQuery("#wp-live-chat").css("bottom", "0");
9
+ jQuery("#wp-live-chat").css("right", "20px");
10
  } else if(jQuery("#wp-live-chat").attr("original_pos") === "bottom_left"){
11
+ jQuery("#wp-live-chat").css("left", "20px");
12
  jQuery("#wp-live-chat").css("bottom", "0");
13
  jQuery("#wp-live-chat").css("right", "");
14
  } else if(jQuery("#wp-live-chat").attr("original_pos") === "left"){
15
+ jQuery("#wp-live-chat").css("left", "20px");
16
  jQuery("#wp-live-chat").css("bottom", "100px");
17
  } else if(jQuery("#wp-live-chat").attr("original_pos") === "right"){
18
+ //jQuery("#wp-live-chat").css("left", "");
19
+ //jQuery("#wp-live-chat").css("right", "0");
20
+ //jQuery("#wp-live-chat").css("bottom", "100px");
21
+ //jQuery("#wp-live-chat").css("width", "");
22
  }
23
  jQuery('#wp-live-chat').addClass("wplc_close");
24
  jQuery('#wp-live-chat').removeClass("wplc_open");
25
  //jQuery("#wp-live-chat").css(jQuery("#wp-live-chat").attr("original_pos"), "100px");
26
  jQuery("#wp-live-chat").css("top", "");
27
+ jQuery("#wp-live-chat").css("height", "");
28
  jQuery("#wp-live-chat-1").show();
29
  jQuery("#wp-live-chat-1").css('cursor', 'pointer');
30
  jQuery("#wp-live-chat-2").hide();
53
  jQuery('#wp-live-chat').removeClass("wplc_close");
54
  jQuery('#wp-live-chat').addClass("wplc_open");
55
  jQuery("#wp-live-chat-react").hide();
56
+
57
+ //jQuery("#wp-live-chat-header").hide();
58
+
59
  Cookies.set('wplc_hide', "", { expires: 1, path: '/' });
60
  jQuery("#wp-live-chat-minimize").show();
61
 
63
 
64
 
65
  });
66
+ jQuery(document).on("wplc_agent_joined", function(e) {
67
 
68
+ var temail = '';
69
+ var tname = '';
70
+ var taid = '';
71
+ var ta_tagline = '';
72
+ var ta_bio = '';
73
 
74
+ if (typeof e.ndata.other.email !== "undefined") { temail = e.ndata.other.email; }
75
+ if (typeof e.ndata.other.name !== "undefined") { tname = e.ndata.other.name; }
76
+ if (typeof e.ndata.other.aid !== "undefined") { taid = e.ndata.other.aid; }
77
+ if (typeof e.ndata.other.agent_tagline !== "undefined") { ta_tagline = e.ndata.other.agent_tagline; }
78
+ if (typeof e.ndata.other.agent_bio !== "undefined") { ta_bio = e.ndata.other.agent_bio; }
79
+
80
+
81
+ jQuery(".wplc_no_answer").remove();
82
+
83
+ jQuery(".admin_chat_name").html(tname);
84
+ wplc_node_pair_name = tname;
85
+ wplc_agent_name = tname;
86
+
87
+ var timageurl = 'http://www.gravatar.com/avatar/'+temail;
88
+
89
+ jQuery(".wplc_agent_info").html('');
90
+ if ( ! jQuery( '#agent_grav_'+taid ).length ) {
91
+ jQuery('<p/>', {
92
+ 'class': '',
93
+ 'style': 'text-align:center;',
94
+ html: '<img class="img-thumbnail img-circle wplc_thumb32 wplc_agent_involved" style="max-width:inherit;" id="agent_grav_'+taid+'" title="'+tname+'" src="'+timageurl+'?s=40" /><br /><span class="wplc_agent_name wplc-color-2">'+tname+'</span>'+ta_tagline+ta_bio
95
+ }).appendTo('.wplc_agent_info');
96
+ }
97
+ var csst = "url(http://www.gravatar.com/avatar/20a6e5c8b75ce87f4896f46ed6f49832?s=60);";
98
+
99
+ jQuery("#wplc_chatbox_header_bg").css('background-image', 'url('+timageurl+'?s=380)');
100
  jQuery("#wplc_chatbox").css("top",
101
+ jQuery("#wplc_chatbox_header").height()+18+"px"
 
 
 
102
  );
103
+ })
104
+
105
+
106
+
107
+ jQuery(document).on("wplc_animation_done", function(e) {
108
+
109
+ jQuery("#nifty_text_editor_holder").remove();
110
+ jQuery("#wplc_msg_notice").remove();
111
+ jQuery("#wp-live-chat-minimize").remove();
112
+
113
+ jQuery("#wplc_logo").prependTo("#wplc_chatbox_header");
114
+
115
+
116
+
117
+
118
+
119
+ if (jQuery("wplc_chatbox").hasClass("wplc-shrink")) {
120
+ /**
121
+ * The +18px is to compensate for the 18px of padding at the bottom of the header box
122
+ */
123
+ jQuery("#wplc_chatbox").css("top",
124
+ jQuery("#wplc_chatbox_header").height()+18+"px"
125
+ );
126
+ jQuery("#wplc_logo").show();
127
+ } else {
128
+ /**
129
+ * The +18px is to compensate for the 18px of padding at the bottom of the header box
130
+ */
131
+ jQuery("#wplc_chatbox").css("top",
132
+ jQuery("#wplc_chatbox_header").height()+18+"px"
133
+ );
134
+ jQuery("#wplc_logo").hide();
135
+ }
136
+ jQuery("#wplc_chatbox").css("bottom", "0");
137
+
138
 
139
 
140
  });
144
 
145
  jQuery("#wp-live-chat-2").show();
146
 
147
+ if(!jQuery("#wp-live-chat-header").hasClass("active")){
148
+ jQuery("#wplc_chatmsg").focus();
149
+ }
150
+
151
+ jQuery("#wp-live-chat-header").addClass("active");
152
+
153
  wplc_chat_status = Cookies.get('wplc_chat_status');
 
154
  if (typeof e.wplc_online !== "undefined" && e.wplc_online === true) {
 
155
  jQuery("#wp-live-chat-4").show();
156
  jQuery("#wplc_social_holder").show();
157
  jQuery("#nifty_ratings_holder").show();
158
  jQuery.event.trigger({type: "wplc_animation_done"});
159
+
160
+
161
  }
162
 
163
  jQuery("#wp-live-chat-3").hide();
168
 
169
 
170
  });
171
+
172
+
173
+
174
+ var wplc_leave_window_alone = false;
175
 
176
  jQuery(document).ready(function() {
177
 
178
+
179
+ jQuery("body").on("mousewheel", "#wplc_chatbox", function(turn, delta){
180
+
181
+ if (delta == 1) {
182
+ /**
183
+ * The +18px is to compensate for the 18px of padding at the bottom of the header box
184
+ */
185
+ jQuery("#wplc_chatbox_header").removeClass("wplc-shrink");
186
+ jQuery("#wplc_chatbox").css("top",
187
+ jQuery("#wplc_chatbox_header").height()+18+"px"
188
+ );
189
+ jQuery("#wplc_logo").show();
190
+ }
191
+ else {
192
+ // going down
193
+
194
+
195
+
196
+ /**
197
+ * The +18px is to compensate for the 18px of padding at the bottom of the header box
198
+ */
199
+ jQuery("#wplc_chatbox_header").addClass("wplc-shrink");
200
+ jQuery("#wplc_chatbox").css("top",
201
+ jQuery("#wplc_chatbox_header").height()+18+"px"
202
+ );
203
+ jQuery("#wplc_logo").hide();
204
+
205
+ }
206
+
207
+ });
208
 
209
 
210
  //opens chat when clicked on top bar
211
  jQuery("body").on("click", "#wp-live-chat-header", function() {
212
+
213
+
 
 
214
  });
215
 
216
+
217
  jQuery("body").on("click", ".wplc_retry_chat", function() {
218
  jQuery("#wplc_chatbox").html("");
219
  jQuery("#wp-live-chat-4").fadeOut();
 
220
  Cookies.remove('wplc_chat_status');
221
  jQuery("#wp-live-chat-2-inner").fadeIn();
222
+ wplc_shown_welcome = false;
223
  });
224
 
225
 
226
+ jQuery("body").on("click", "#wp-live-chat-header", function(){
227
+ //if (!wplc_is_chat_open) {
228
+
229
+ if (jQuery(this).hasClass('active')) {
230
+ jQuery("#wplc_hovercard").fadeOut("fast");
231
+ jQuery("#wp-live-chat-2").fadeOut("fast");
232
+ jQuery(this).removeClass('active');
233
+ jQuery.event.trigger({type: "wplc_minimize_chat"});
234
+
235
+ } else {
236
+ jQuery("#wplc_hovercard").fadeIn('fast');
237
+ jQuery(this).addClass('active');
238
+
239
+ wplc_chat_status = Cookies.get('wplc_chat_status');
240
+ if (parseInt(wplc_chat_status) == 3 || parseInt(wplc_chat_status) == 2 || parseInt(wplc_chat_status) == 0 || parseInt(wplc_chat_status) == 12 || parseInt(wplc_chat_status) == 10) {
241
+ jQuery("#speeching_button").click();
242
+ }
243
+
244
+ }
245
+
246
+
247
+
248
+ //}
249
  });
250
  jQuery("body").on("click", "#wplc_hovercard_min", function() {
251
  jQuery("#wplc_hovercard").fadeOut('fast');
252
  });
253
  jQuery("body").on("click", "#speeching_button", function() {
254
+ jQuery("#wplc_hovercard").fadeOut("fast");
255
+ jQuery("#wplc-chat-alert").removeClass('is-active');
256
+ wplc_is_chat_open = true;
257
+ jQuery.event.trigger({type: "wplc_open_chat"});
258
+
259
  });
260
+ jQuery("body").on("click", "#wp-live-chat-minimize", function() {
261
+
262
+ jQuery("#wp-live-chat-header").removeClass('active');
263
+ })
264
 
265
 
266
 
267
 
268
 
269
 
270
+ });
271
+
272
+ !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a:a(jQuery)}(function(a){function b(b){var g=b||window.event,h=i.call(arguments,1),j=0,l=0,m=0,n=0,o=0,p=0;if(b=a.event.fix(g),b.type="mousewheel","detail"in g&&(m=-1*g.detail),"wheelDelta"in g&&(m=g.wheelDelta),"wheelDeltaY"in g&&(m=g.wheelDeltaY),"wheelDeltaX"in g&&(l=-1*g.wheelDeltaX),"axis"in g&&g.axis===g.HORIZONTAL_AXIS&&(l=-1*m,m=0),j=0===m?l:m,"deltaY"in g&&(m=-1*g.deltaY,j=m),"deltaX"in g&&(l=g.deltaX,0===m&&(j=-1*l)),0!==m||0!==l){if(1===g.deltaMode){var q=a.data(this,"mousewheel-line-height");j*=q,m*=q,l*=q}else if(2===g.deltaMode){var r=a.data(this,"mousewheel-page-height");j*=r,m*=r,l*=r}if(n=Math.max(Math.abs(m),Math.abs(l)),(!f||f>n)&&(f=n,d(g,n)&&(f/=40)),d(g,n)&&(j/=40,l/=40,m/=40),j=Math[j>=1?"floor":"ceil"](j/f),l=Math[l>=1?"floor":"ceil"](l/f),m=Math[m>=1?"floor":"ceil"](m/f),k.settings.normalizeOffset&&this.getBoundingClientRect){var s=this.getBoundingClientRect();o=b.clientX-s.left,p=b.clientY-s.top}return b.deltaX=l,b.deltaY=m,b.deltaFactor=f,b.offsetX=o,b.offsetY=p,b.deltaMode=0,h.unshift(b,j,l,m),e&&clearTimeout(e),e=setTimeout(c,200),(a.event.dispatch||a.event.handle).apply(this,h)}}function c(){f=null}function d(a,b){return k.settings.adjustOldDeltas&&"mousewheel"===a.type&&b%120===0}var e,f,g=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],h="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],i=Array.prototype.slice;if(a.event.fixHooks)for(var j=g.length;j;)a.event.fixHooks[g[--j]]=a.event.mouseHooks;var k=a.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var c=h.length;c;)this.addEventListener(h[--c],b,!1);else this.onmousewheel=b;a.data(this,"mousewheel-line-height",k.getLineHeight(this)),a.data(this,"mousewheel-page-height",k.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var c=h.length;c;)this.removeEventListener(h[--c],b,!1);else this.onmousewheel=null;a.removeData(this,"mousewheel-line-height"),a.removeData(this,"mousewheel-page-height")},getLineHeight:function(b){var c=a(b),d=c["offsetParent"in a.fn?"offsetParent":"parent"]();return d.length||(d=a("body")),parseInt(d.css("fontSize"),10)||parseInt(c.css("fontSize"),10)||16},getPageHeight:function(b){return a(b).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})});
js/wplc_server.js CHANGED
@@ -23,6 +23,7 @@ var wplc_node_pair_name = "";
23
  var wplc_node_switch_ajax_complete = false;
24
  var wplc_node_retry_count = 0;
25
 
 
26
 
27
 
28
  function WPLCServer(){
@@ -282,7 +283,7 @@ WPLCServer.Ajax = {
282
  },
283
  complete : function(response){
284
  if(typeof wplc_send_complete_callback === "function"){
285
- wplc_send_complete_callback(response);
286
  }
287
  }
288
  });
@@ -474,10 +475,11 @@ function wplc_node_global_message_receiver(data){
474
  }
475
 
476
  if(typeof data['pair_typing'] !== "undefined"){
 
477
  if(data['pair_typing'] === true || data['pair_typing'] === "true"){
478
  if(wplc_node_is_pair_typing_indicator_visible === false){
479
  if (jQuery("#wplc_user_typing").length>0) { } else {
480
- jQuery(".typing_indicator").html("<span id='wplc_user_typing'>"+wplc_node_pair_name+" "+wplc_localized_string_is_typing+"</span>");
481
  jQuery(".typing_indicator").addClass("typing_indicator_active");
482
  }
483
  }
@@ -494,6 +496,216 @@ function wplc_node_global_message_receiver(data){
494
 
495
  }
496
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
497
 
498
  jQuery(function(){
499
  jQuery(document).ready(function(){
23
  var wplc_node_switch_ajax_complete = false;
24
  var wplc_node_retry_count = 0;
25
 
26
+ var wplc_msg_history = new Array();
27
 
28
 
29
  function WPLCServer(){
283
  },
284
  complete : function(response){
285
  if(typeof wplc_send_complete_callback === "function"){
286
+ wplc_send_complete_callback(response, wplc_send_data);
287
  }
288
  }
289
  });
475
  }
476
 
477
  if(typeof data['pair_typing'] !== "undefined"){
478
+
479
  if(data['pair_typing'] === true || data['pair_typing'] === "true"){
480
  if(wplc_node_is_pair_typing_indicator_visible === false){
481
  if (jQuery("#wplc_user_typing").length>0) { } else {
482
+ jQuery(".typing_indicator").html("<span id='wplc_user_typing'>"+wplc_node_pair_name+" "+wplc_localized_string_is_typing_single+"</span>");
483
  jQuery(".typing_indicator").addClass("typing_indicator_active");
484
  }
485
  }
496
 
497
  }
498
  }
499
+ String.prototype.wplcStripSlashes = function(){
500
+ return this.replace(/\\(.)/mg, "$1");
501
+ }
502
+
503
+ function wplc_add_date_and_time(the_message,originates) {
504
+ if (parseInt(originates) === 1 || parseInt(originates) === 2) {
505
+
506
+ var time_msg = '';
507
+
508
+ /* identfy the timestamp */
509
+ if (typeof the_message.other === "undefined" || typeof the_message.other.datetime === "undefined" || the_message.other === false) {
510
+ /* only run if it hasnt got a timestamp in the .other.datetime key */
511
+ if (typeof the_message.timestamp !== "undefined") {
512
+ /* most likely came from node as node */
513
+
514
+ if (typeof the_message.other !== "object") { the_message.other = {}; }
515
+ the_message.other.datetime = the_message.timestamp;
516
+
517
+ }
518
+ }
519
+
520
+
521
+ if (typeof the_message.other === "undefined" || typeof the_message.other.datetime === "undefined") {
522
+ /* there is no datetime so return nothing */
523
+ return '';
524
+ } else {
525
+ if (typeof wplc_show_chat_detail !== "undefined") {
526
+
527
+ if (typeof wplc_show_chat_detail.date !== "undefined" && wplc_show_chat_detail.date === "1") {
528
+ var dateTime = new Date(parseInt(the_message.other.datetime)*1000);
529
+ dateTime = dateTime.getMonth() + '/' + dateTime.getDate();
530
+ time_msg += dateTime+ " ";
531
+
532
+ }
533
+ if (typeof wplc_show_chat_detail.time !== "undefined" && wplc_show_chat_detail.time === "1") {
534
+
535
+
536
+ var dateTime = new Date(parseInt(the_message.other.datetime)*1000);
537
+ dateTime = dateTime.getHours() + ':' + dateTime.getMinutes();
538
+
539
+ time_msg += dateTime;
540
+ }
541
+ if (time_msg !== '') {
542
+ if (parseInt(originates) === 1) { aoru_class = 'wplc-msg-float-left'; } else { aoru_class = 'wplc-msg-float-right'; }
543
+ time_msg = '<span class="timedate '+aoru_class+'">'+time_msg+'</span>';
544
+ }
545
+ }
546
+
547
+
548
+ return time_msg;
549
+ }
550
+ } else {
551
+ return '';
552
+ }
553
+
554
+ }
555
+
556
+ /**
557
+ * Pushes the message object to the chat box
558
+ *
559
+ * @param {object} the_message The message object
560
+ * @param {string} aoru a for Agent, u for User
561
+ * @return void
562
+ */
563
+ function wplc_push_message_to_chatbox(the_message, aoru, next) {
564
+
565
+ /**
566
+ * First check if we have processed this message already, by comparing the ID
567
+ *
568
+ * Some system notifications may not come through with an ID so we can accept those.
569
+ */
570
+ var add_message = true;
571
+ if (typeof the_message.mid !== "undefined") {
572
+ if (parseInt(the_message.mid) === 0 || the_message.mid === null) {
573
+ add_message = true;
574
+ } else {
575
+ if (typeof wplc_msg_history[the_message.mid] !== "undefined") {
576
+ /* we have this message already */
577
+ add_message = false;
578
+ } else {
579
+ /* add this to our history */
580
+ wplc_msg_history[the_message.mid] = true;
581
+ }
582
+ }
583
+ }
584
+ if (add_message) {
585
+ if(typeof the_message.originates !== "undefined" && the_message.originates !== null && the_message.originates !== "null"){
586
+ var message_class = "";
587
+ var grav_hash = "";
588
+ var message_grav = "";
589
+ var message_from = "";
590
+ var message_content = "";
591
+ var message_aid;
592
+
593
+
594
+ if(parseInt(the_message.originates) === 1) {
595
+ //From Admin
596
+
597
+ /* Define which agent it was sent from */
598
+ if (typeof the_message.other !== "undefined" && typeof the_message.other.aid !== "undefined") {
599
+ message_aid = the_message.other.aid.toString(); /* set it to a string because wp_localize doesnt know how to set keys as integers */
600
+ } else if (typeof the_message.other !== "undefined" && typeof the_message.other.agent_id !== "undefined") {
601
+ /* cloud server uses "agent_id" instead of "aid" */
602
+ message_aid = the_message.other.agent_id.toString();
603
+ } else {
604
+ message_aid = false;
605
+ }
606
+ message_class = "wplc-admin-message wplc-color-bg-4 wplc-color-2 wplc-color-border-4";
607
+
608
+ if (aoru === 'u') {
609
+ if (message_aid !== false && typeof wplc_agent_data !== "undefined" && typeof wplc_agent_data[message_aid] !== "undefined") {
610
+ /* we know who the agent was that sent this message (v7.1.00+) */
611
+ if (typeof wplc_show_chat_detail !== "undefined") {
612
+ if (typeof wplc_show_chat_detail.avatar !== "undefined" && wplc_show_chat_detail.avatar === "1") { message_grav = (typeof wplc_agent_data[message_aid].md5 !== "undefined" ? "<img src='//www.gravatar.com/avatar/"+wplc_agent_data[message_aid].md5+"?s=30' class='wplc-admin-message-avatar' />" : ""); }
613
+ if (typeof wplc_show_chat_detail.name !== "undefined" && wplc_show_chat_detail.name === "1") { message_from = (typeof wplc_agent_data[message_aid].name !== "undefined" ? wplc_agent_data[message_aid].name : "") + ": "; }
614
+ }
615
+
616
+ } else {
617
+ /* we do'nt know which agent sent this message, so lets set it as the current user instead (backwards compat) */
618
+ if (typeof wplc_show_chat_detail !== "undefined") {
619
+ if (typeof wplc_show_chat_detail.avatar !== "undefined" && wplc_show_chat_detail.avatar === "1") { message_grav = (typeof wplc_current_agent.email !== "undefined" ? "<img src='//www.gravatar.com/avatar/"+wplc_current_agent.email+"?s=30' class='wplc-admin-message-avatar' />" : ""); }
620
+ if (typeof wplc_show_chat_detail.name !== "undefined" && wplc_show_chat_detail.name === "1") { message_from = (typeof wplc_current_agent.name !== "undefined" ? wplc_current_agent.name : "") + ": "; }
621
+ }
622
+ }
623
+ } else {
624
+ if (message_aid !== false && typeof wplc_agent_data !== "undefined" && typeof wplc_agent_data[message_aid] !== "undefined") {
625
+ /* we know who the agent was that sent this message (v7.1.00+) */
626
+ if (typeof wplc_show_chat_detail !== "undefined") {
627
+ if (typeof wplc_show_chat_detail.avatar !== "undefined" && wplc_show_chat_detail.avatar === "1") { message_grav = (typeof wplc_agent_data[message_aid].md5 !== "undefined" ? "<img src='//www.gravatar.com/avatar/"+wplc_agent_data[message_aid].md5+"?s=30' class='wplc-admin-message-avatar' />" : ""); }
628
+ if (typeof wplc_show_chat_detail.name !== "undefined" && wplc_show_chat_detail.name === "1") { message_from = (typeof wplc_agent_data[message_aid].name !== "undefined" ? wplc_agent_data[message_aid].name : "") + ": "; }
629
+ }
630
+
631
+ } else {
632
+ if (typeof wplc_show_chat_detail.avatar !== "undefined" && wplc_show_chat_detail.avatar === "1") { message_grav = (typeof wplc_admin_agent_email !== "undefined" ? "<img src='//www.gravatar.com/avatar/"+wplc_admin_agent_email+"?s=30' class='wplc-admin-message-avatar' />" : ""); }
633
+ if (typeof wplc_show_chat_detail.name !== "undefined" && wplc_show_chat_detail.name === "1") { message_from = (typeof wplc_admin_agent_name !== "undefined" ? wplc_admin_agent_name : "") + ": "; }
634
+ }
635
+ }
636
+
637
+ message_content = the_message.msg.wplcStripSlashes();
638
+ wplc_new_message_sound = true;
639
+
640
+ } else if (parseInt(the_message.originates) === 0 || parseInt(the_message.originates) === 3) {
641
+ //System Notification
642
+ message_class = "wplc_system_notification wplc-color-4";
643
+ message_content = the_message.msg;
644
+ if (typeof the_message.other.ntype !== "undefined") {
645
+ if (the_message.other.ntype === "joined") {
646
+ jQuery.event.trigger({type: "wplc_agent_joined", ndata:the_message});
647
+ }
648
+ }
649
+
650
+ } else {
651
+ /* most likely from the user */
652
+ message_class = "wplc-user-message wplc-color-bg-1 wplc-color-2 wplc-color-border-1";
653
+ if (aoru === 'u') {
654
+ if (jQuery(wplc_email).val() !== "") {
655
+ message_grav = md5(jQuery(wplc_email).val());
656
+ message_grav = "<img src='//www.gravatar.com/avatar/" + message_grav + "?s=30' class='wplc-user-message-avatar' />";
657
+ }
658
+ if (typeof Cookies.get("wplc_name") === "undefined") {
659
+ message_from = 'Guest: ';
660
+ } else {
661
+ message_from = Cookies.get("wplc_name") + ": ";
662
+ }
663
+ } else {
664
+ if (typeof wplc_chat_email !== "undefined") {
665
+ message_grav = "<img src='//www.gravatar.com/avatar/" + wplc_chat_email + "?s=30' class='wplc-user-message-avatar' />";
666
+ }
667
+ if (typeof wplc_chat_name !== "undefined") {
668
+ message_from = wplc_chat_name + ": ";
669
+ }
670
+ }
671
+ message_content = the_message.msg.wplcStripSlashes();
672
+ }
673
+
674
+ if(message_content !== ""){
675
+ var concatenated_message = "<span class='" + message_class + "'>";
676
+ if (typeof wplc_show_chat_detail !== "undefined") {
677
+ if (typeof wplc_show_chat_detail.avatar !== "undefined" && wplc_show_chat_detail.avatar === "1") {
678
+ concatenated_message += message_grav;
679
+ }
680
+ if (typeof wplc_show_chat_detail.name !== "undefined" && wplc_show_chat_detail.name === "1") {
681
+ concatenated_message += message_from;
682
+ }
683
+
684
+ }
685
+
686
+ concatenated_message += message_content;
687
+ concatenated_message += "</span>";
688
+ concatenated_message += wplc_add_date_and_time(the_message,the_message.originates);
689
+
690
+ if (aoru === 'u') {
691
+ wplc_chat_box_elemn = "#wplc_chatbox";
692
+ } else {
693
+ wplc_chat_box_elemn = "#admin_chat_box_area_"+wplc_cid;
694
+ }
695
+
696
+
697
+ if(typeof niftyFormatParser !== "undefined"){
698
+
699
+ jQuery(wplc_chat_box_elemn).append(niftyFormatParser(concatenated_message));
700
+ } else{
701
+ jQuery(wplc_chat_box_elemn).append(concatenated_message);
702
+ }
703
+
704
+ }
705
+ }
706
+ }
707
+ next();
708
+ }
709
 
710
  jQuery(function(){
711
  jQuery(document).ready(function(){
js/wplc_tabs.js CHANGED
@@ -216,4 +216,4 @@ jQuery("document").ready(function() {
216
  position: {my: "left+15 center", at: "right center"}
217
  });
218
  });
219
- });
216
  position: {my: "left+15 center", at: "right center"}
217
  });
218
  });
219
+ });
js/wplc_u.js CHANGED
@@ -30,6 +30,12 @@ wplc_server = new WPLCServer();
30
 
31
  var wplc_server_last_loop_data = null;
32
 
 
 
 
 
 
 
33
  jQuery(document).ready(function() {
34
  var wplc_session_variable = new Date().getTime();
35
  var wplc_cid;
@@ -43,7 +49,9 @@ jQuery(document).ready(function() {
43
  var initial_data = {};
44
  var wplc_fist_run = true;
45
  var wplc_long_poll_delay = 1500;
46
-
 
 
47
 
48
  wplc_cid = Cookies.get('wplc_cid');
49
 
@@ -59,8 +67,12 @@ jQuery(document).ready(function() {
59
  wplc_cookie_name = Cookies.get('wplc_name');
60
  wplc_cookie_email = Cookies.get('wplc_email');
61
  // Always start on 5 - ajax will then return chat status if active
 
62
  Cookies.set('wplc_chat_status', 5, { expires: 1, path: '/' });
63
  wplc_chat_status = 5;
 
 
 
64
 
65
  var data = {
66
  action: 'wplc_get_chat_box',
@@ -81,6 +93,8 @@ jQuery(document).ready(function() {
81
 
82
  jQuery( "body" ).append( response['cbox']);
83
 
 
 
84
  if( typeof wplc_cookie_name == 'undefined' || typeof wplc_cookie_email == 'undefined' ){
85
 
86
  var wplc_cookie_name = jQuery( jQuery.parseHTML( response['cbox'] ) ).find( "#wplc_name" ).val();
@@ -88,6 +102,8 @@ jQuery(document).ready(function() {
88
 
89
  }
90
 
 
 
91
  /* is an agent online? */
92
  if (response['online'] === false) {
93
  wplc_run = false;
@@ -95,8 +111,29 @@ jQuery(document).ready(function() {
95
  } else {
96
  wplc_online = true;
97
  }
 
 
 
98
  if (wplc_filter_run_override !== "1" || wplc_online === false) { wplc_run = false; } else { /* we can run */ }
99
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
  /*Support mobile loggin*/
101
  var wplc_mobile_check = false;
102
  if(typeof wplc_is_mobile !== "undefined" && (wplc_is_mobile === "true" || wplc_is_mobile === true)){
@@ -139,6 +176,71 @@ jQuery(document).ready(function() {
139
 
140
  });
141
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
142
  function wplc_user_message_receiver(data){
143
  if(typeof wplc_loop_response_handler !== "undefined" && typeof wplc_loop_response_handler === "function"){
144
  wplc_loop_response_handler(data, wplc_server_last_loop_data);
@@ -149,6 +251,7 @@ jQuery(document).ready(function() {
149
 
150
  if(data.keep_alive === true){
151
  setTimeout(function(){
 
152
  wplc_call_to_server_chat(wplc_server_last_loop_data);
153
  },100);
154
  }
@@ -231,7 +334,7 @@ jQuery(document).ready(function() {
231
  }, 7500);
232
  }
233
  } else {
234
- if(typeof response !== "undefined" && typeof response.responseText !== "undefined"){
235
  var response_data = JSON.parse(response.responseText);
236
  if (typeof wplc_transport_prepared !== "undefined") {
237
  if(wplc_transport_prepared !== true && (parseInt(response_data.status) === 3 || parseInt(response_data.status) === 2)){
@@ -261,7 +364,7 @@ jQuery(document).ready(function() {
261
  if(typeof response['wplc_email'] !== "undefined"){ data['wplc_email'] = response['wplc_email']; /* Cookies.set('wplc_email', response['wplc_email'], { expires: 1, path: '/' }); */ }
262
  if(typeof response['cid'] !== "undefined"){ data['cid'] = response['cid']; Cookies.set('wplc_cid', response['cid'], { expires: 1, path: '/' }); }
263
  if(typeof response['aname'] !== "undefined") { wplc_agent_name = response['aname']; }
264
- if(typeof response['cid'] !== "undefined" && wplc_cid !== jQuery.trim(response['cid'])){ wplc_cid = jQuery.trim(response['cid']); }
265
  if(typeof response['status'] !== "undefined" && parseInt(wplc_chat_status) !== parseInt(response['status'])){
266
  wplc_chat_status = response['status'];
267
  Cookies.set('wplc_chat_status', null, { path: '/' });
@@ -281,17 +384,20 @@ jQuery(document).ready(function() {
281
  wplc_run = true;
282
  var wplc_new_message_sound = false;
283
  if (typeof response['data'] === "object") {
 
284
  for (var index in response['data']) {
285
  if(typeof response['data'][index] !== "object"){
286
  if (typeof msg_history[index] === "undefined") {
287
  //Not from node
288
  /* we dont have this message */
289
- // console.log("new message!: "+response['data'][index]);
290
  msg_history[index] = true;
291
 
 
 
292
  if(typeof niftyFormatParser !== "undefined"){
293
- jQuery("#wplc_chatbox").append(niftyFormatParser(response['data'][index].wplcStripSlashes()));
294
  } else{
 
295
  jQuery("#wplc_chatbox").append(response['data'][index].wplcStripSlashes());
296
  }
297
 
@@ -299,59 +405,15 @@ jQuery(document).ready(function() {
299
 
300
  } else {
301
  /* we already have this message */
302
- // console.log("we already have "+response['data'][index]);
303
  }
304
  } else {
305
  var the_message = response['data'][index];
 
 
 
 
306
 
307
- if(typeof the_message.originates !== "undefined" && the_message.originates !== null && the_message.originates !== "null"){
308
- var message_class = "";
309
- var grav_hash = "";
310
- var message_grav = "";
311
- var message_from = "";
312
- var message_content = "";
313
-
314
- if(parseInt(the_message.originates) === 1){
315
- //From Admin
316
- message_class = "wplc-admin-message wplc-color-bg-4 wplc-color-2 wplc-color-border-4";
317
- // message_grav = "<img src='//www.gravatar.com/avatar/MD5_this_section_with_email?s=30' class='wplc-admin-message-avatar' />";
318
- message_grav = "";
319
- // message_from = (typeof the_message.msgfrom !== "undefined" ? the_message.msgfrom : "") + ": ";
320
- message_from = "";
321
- message_content = the_message.msg.wplcStripSlashes();
322
-
323
- wplc_new_message_sound = true;
324
- } else if (parseInt(the_message.originates) === 0){
325
- //System Notification
326
- message_class = "wplc_system_notification wplc-color-4";
327
- message_content = the_message.msg;
328
- } else {
329
- message_class = "wplc-user-message wplc-color-bg-1 wplc-color-2 wplc-color-border-1";
330
- // message_grav = md5(wplc_cookie_email);
331
- // message_grav = "<img src='//www.gravatar.com/avatar/" + message_grav + "?s=30' class='wplc-admin-message-avatar' />";
332
- message_grav = "";
333
- message_from = Cookies.get("wplc_name") + ": ";
334
- message_from = "";
335
- message_content = the_message.msg.wplcStripSlashes();
336
- wplc_new_message_sound = false;
337
- }
338
-
339
- if(message_content !== ""){
340
- var concatenated_message = "<span class='" + message_class + "'>";
341
- // concatenated_message += message_grav;
342
- // concatenated_message += message_from;
343
- concatenated_message += message_content;
344
- concatenated_message += "</span>";
345
-
346
- if(typeof niftyFormatParser !== "undefined"){
347
- jQuery("#wplc_chatbox").append(niftyFormatParser(concatenated_message));
348
- } else{
349
- jQuery("#wplc_chatbox").append(concatenated_message);
350
- }
351
- var height = jQuery('#wplc_chatbox')[0].scrollHeight;
352
- jQuery('#wplc_chatbox').scrollTop(height);
353
- }
354
- }
355
  }
356
  }
357
  }
@@ -367,8 +429,7 @@ jQuery(document).ready(function() {
367
  }
368
 
369
  if(wplc_new_message_sound){
370
- var height = jQuery('#wplc_chatbox')[0].scrollHeight;
371
- jQuery('#wplc_chatbox').scrollTop(height);
372
  if (typeof wplc_enable_ding !== 'undefined' && wplc_enable_ding === "1") {
373
  new Audio(wplc_plugin_url+'/wp-live-chat-support/ding.mp3').play();
374
  }
@@ -388,12 +449,26 @@ jQuery(document).ready(function() {
388
  else if(response['status'] == 8){ // chat has been ended by admin
389
  wplc_run = false;
390
 
391
- jQuery("#wp-live-chat-minimize").show();
392
  document.getElementById('wplc_chatmsg').disabled = true;
 
 
 
 
 
 
 
 
 
 
 
 
393
 
 
 
394
  if(typeof response['data'] === "object") {
395
  for (var index in response['data']) {
396
  if(typeof response['data'][index] === "object"){
 
397
  var the_message = response['data'][index];
398
  if(typeof the_message.originates !== "undefined"){
399
  var message_class = "";
@@ -421,9 +496,10 @@ jQuery(document).ready(function() {
421
  } else {
422
  //Backwards Compat
423
  jQuery("#wplc_chatbox").append("<em>"+response['data']+"</em><br />");
424
- }
425
- var height = jQuery('#wplc_chatbox')[0].scrollHeight;
426
- jQuery('#wplc_chatbox').scrollTop(height);
 
427
 
428
 
429
  jQuery.event.trigger({type: "wplc_end_chat"});
@@ -435,7 +511,6 @@ jQuery(document).ready(function() {
435
  }
436
  else if(parseInt(response['status']) == 3 || parseInt(response['status']) == 2 || parseInt(response['status']) == 10){ // re-initialize chat
437
  wplc_run = true;
438
- jQuery("#wplc_cid").val(wplc_cid);
439
  if(parseInt(response['status']) == 3) { // only if not minimized open aswell
440
  /* HERE NODE */
441
 
@@ -449,12 +524,17 @@ jQuery(document).ready(function() {
449
  }
450
  }
451
  if (!wplc_is_minimized) {
452
- open_chat(0);
 
 
 
 
 
453
  }
454
 
455
 
456
  if(jQuery('#wp-live-chat').hasClass('wplc_left') === true || jQuery('#wp-live-chat').hasClass('wplc_right') === true){
457
- jQuery('#wp-live-chat').height("400px");
458
  }
459
  }
460
  if(parseInt(response['status']) == 10) { // only if not minimized open aswell
@@ -464,12 +544,13 @@ jQuery(document).ready(function() {
464
  }
465
  if(response['data'] != null){ // append messages to chat area
466
  if (typeof response['data'] === "object") {
 
467
  for (var index in response['data']) {
468
  wplc_new_message_sound = false;
469
  if(typeof response['data'][index] !== "object"){
 
470
  if (typeof msg_history[index] === "undefined") {
471
  /* we dont have this message */
472
- // console.log("new message!: "+response['data'][index]);
473
  msg_history[index] = true;
474
  if(typeof niftyFormatParser !== "undefined"){
475
  jQuery("#wplc_chatbox").append(niftyFormatParser(response['data'][index].wplcStripSlashes()));
@@ -480,62 +561,22 @@ jQuery(document).ready(function() {
480
  wplc_new_message_sound = true;
481
  } else {
482
  /* we already have this message */
483
- // console.log("we already have "+response['data'][index]);
484
  }
485
  } else {
486
  var the_message = response['data'][index];
487
-
488
- if(typeof the_message.originates !== "undefined" && the_message.originates !== null && the_message.originates !== "null"){
489
- var message_class = "";
490
- var grav_hash = "";
491
- var message_grav = "";
492
- var message_from = "";
493
- var message_content = "";
494
-
495
- if(parseInt(the_message.originates) === 1){
496
- //From Admin
497
- message_class = "wplc-admin-message wplc-color-bg-4 wplc-color-2 wplc-color-border-4";
498
- message_grav = "<img src='//www.gravatar.com/avatar/MD5_this_section_with_email?s=30' class='wplc-admin-message-avatar' />";
499
- message_from = (typeof the_message.msgfrom !== "undefined" ? the_message.msgfrom : "") + ": ";
500
- message_content = the_message.msg.wplcStripSlashes();
501
-
502
- wplc_new_message_sound = true;
503
- } else if (parseInt(the_message.originates) === 0){
504
- //System Notification
505
- message_class = "wplc_system_notification wplc-color-4";
506
- message_content = the_message.msg;
507
- } else {
508
- message_class = "wplc-user-message wplc-color-bg-1 wplc-color-2 wplc-color-border-1";
509
- message_grav = md5(wplc_email);
510
- message_grav = "<img src='//www.gravatar.com/avatar/" + message_grav + "?s=30' class='wplc-admin-message-avatar' />";
511
- message_from = Cookies.get("wplc_name") + ": ";
512
- message_content = the_message.msg.wplcStripSlashes();
513
- }
514
-
515
- if(message_content !== ""){
516
- var concatenated_message = "<span class='" + message_class + "'>";
517
- // concatenated_message += message_grav;
518
- // concatenated_message += message_from;
519
- concatenated_message += message_content;
520
- concatenated_message += "</span>";
521
-
522
- if(typeof niftyFormatParser !== "undefined"){
523
- jQuery("#wplc_chatbox").append(niftyFormatParser(concatenated_message));
524
- } else{
525
- jQuery("#wplc_chatbox").append(concatenated_message);
526
- }
527
- // var height = jQuery('#wplc_chatbox')[0].scrollHeight;
528
- // jQuery('#wplc_chatbox').scrollTop(height);
529
- }
530
- }
531
  }
532
 
533
  if(wplc_new_message_sound){
534
  if (response['alert']) {
535
  jQuery('#wplc-chat-alert').addClass('is-active');
536
  }
537
- var height = jQuery('#wplc_chatbox')[0].scrollHeight;
538
- jQuery('#wplc_chatbox').scrollTop(height);
539
  if (typeof wplc_enable_ding !== 'undefined' && wplc_enable_ding === "1") {
540
  new Audio(wplc_plugin_url+'/wp-live-chat-support/ding.mp3').play();
541
  }
@@ -553,8 +594,7 @@ jQuery(document).ready(function() {
553
  }
554
 
555
  if(response['data']){
556
- var height = jQuery('#wplc_chatbox')[0].scrollHeight;
557
- jQuery('#wplc_chatbox').scrollTop(height);
558
 
559
  }
560
  }
@@ -563,84 +603,106 @@ jQuery(document).ready(function() {
563
  }
564
  }
565
 
 
 
566
  function wplc_log_connection_error(error){
567
  if (window.console) { console.log(error); }
568
 
569
  jQuery("#wplc_chatbox").append("<small>" + error + "</small><br>");
570
- var height = jQuery('#wplc_chatbox')[0].scrollHeight;
571
- jQuery('#wplc_chatbox').scrollTop(height);
572
  }
573
 
574
  function wplc_display_error(error) {
575
- jQuery("#wplc_chatbox").append(wplc_error_messages.server_connection_lost+" "+error);
576
- var height = jQuery('#wplc_chatbox')[0].scrollHeight;
577
- jQuery('#wplc_chatbox').scrollTop(height);
 
 
 
 
 
 
 
 
 
 
578
  }
579
 
580
  function wplc_init_chat_box(cid, status){
 
 
581
  if(wplc_chat_status == 9 && wplc_check_hide_cookie == "yes"){
582
 
 
 
583
  } else {
584
  if(wplc_check_hide_cookie != "yes"){
585
  wplc_dc = setTimeout(function (){
586
- /*
587
- * 1- Slide Up
588
- * 2- Slide Across (Left/Right)
589
- * 3- Slide Down
590
- * 4- Fade In
591
- */
592
-
593
- var wplc_window_id = jQuery("#wp-live-chat");
594
-
595
- var wplc_theme_chosen = jQuery(wplc_window_id).attr('wplc_animation');
596
-
597
- switch(wplc_theme_chosen){
598
- case 'none':
599
- jQuery(wplc_window_id).css('display', 'block');
600
- break;
601
- case 'animation-1':
602
- // Slide Up
603
- jQuery(wplc_window_id).animate({'marginBottom' : '0px'}, 1000);
604
- break;
605
- case 'animation-2-bl':
606
- // Slide Accross from left
607
- jQuery(wplc_window_id).animate({'left' : '100px'}, 1000);
608
- break;
609
- case 'animation-2-br':
610
- // Slide Accross from right
611
- jQuery(wplc_window_id).animate({'right' : '100px'}, 1000);
612
- break;
613
- case 'animation-2-l':
614
- // Slide Accross from left
615
- jQuery(wplc_window_id).animate({"left" : '0px'}, 1000);
616
- break;
617
- case 'animation-2-r':
618
- // Slide Accross from right
619
- jQuery(wplc_window_id).animate({'right' : '0px'}, 1000);
620
- break;
621
- case 'animation-3':
622
- // Fade In
623
- jQuery(wplc_window_id).fadeIn('slow');
624
- case 'animation-4':
625
- jQuery(wplc_window_id).css('display', 'block');
626
- break;
627
- default:
628
- jQuery(wplc_window_id).css('display', 'block');
629
- break;
630
- }
631
-
632
- //jQuery("#wp-live-chat").css({ "display" : "block" });
633
- if(jQuery("#wp-live-chat").attr('wplc-auto-pop-up') === "1"){
634
- open_chat(0);
635
- }
636
-
637
- jQuery.event.trigger({type: "wplc_animation_done"});
638
  }, parseInt(window.wplc_delay));
639
  }
640
  }
641
  wplc_init_chat_box = false;
642
  }
643
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
644
 
645
  function wplc_sound(source,volume,loop) {
646
  this.source=source;
@@ -697,22 +759,9 @@ jQuery(document).ready(function() {
697
 
698
  /* minimize chat window */
699
  jQuery("body").on("click", "#wp-live-chat-minimize", function() {
 
700
  jQuery.event.trigger({type: "wplc_minimize_chat"});
701
- wplc_is_minimized = true;
702
-
703
- Cookies.set('wplc_minimize', "yes", { expires: 1, path: '/' });
704
- wplc_chat_status = Cookies.get('wplc_chat_status');
705
- if(wplc_chat_status != 5 && wplc_chat_status != 10 && wplc_chat_status != 9 && wplc_chat_status != 8){
706
- var data = {
707
- action: 'wplc_user_minimize_chat',
708
- security: wplc_nonce,
709
- cid: wplc_cid
710
- };
711
-
712
- jQuery.post(wplc_ajaxurl, data, function(response) {
713
-
714
- });
715
- }
716
 
717
  });
718
 
@@ -754,28 +803,48 @@ jQuery(document).ready(function() {
754
 
755
 
756
  wplc_chat_status = Cookies.get('wplc_chat_status');
 
 
 
 
 
 
 
 
 
 
 
757
  if (parseInt(wplc_chat_status) == 3 || parseInt(wplc_chat_status) == 2 || parseInt(wplc_chat_status) == 0 || parseInt(wplc_chat_status) == 12) {
758
 
759
  jQuery.event.trigger({type: "wplc_open_chat_2", wplc_online: wplc_online});
760
 
761
  Cookies.set('wplc_had_chat', true, { path: '/' });
762
 
 
 
 
763
  if (parseInt(wplc_chat_status) == 0 || parseInt( wplc_chat_status ) == 11 || parseInt(wplc_chat_status) == 12) {
764
  /* user was a missed chat, now lets change them back to "pending" */
765
  wplc_chat_status = 2;
766
  }
767
- if (typeof wplc_use_node_server === "undefined" || wplc_use_node_server === 'false') {
 
 
 
 
768
  var data = {
769
  action: 'wplc_user_maximize_chat',
770
  security: wplc_nonce,
771
  cid: wplc_cid,
772
- chat_status : parseInt(wplc_chat_status)
 
773
  };
774
  jQuery.post(wplc_ajaxurl, data, function(response) {
775
 
776
  //log("user maximized chat success");
777
  });
778
  }
 
779
  }
780
  else if (parseInt(wplc_chat_status) == 10) {
781
  jQuery("#wp-live-chat-minimize").trigger("click");
@@ -791,6 +860,7 @@ jQuery(document).ready(function() {
791
  jQuery("#wplc_name").val(Cookies.get('wplc_name'));
792
  jQuery("#wplc_email").val(Cookies.get('wplc_email'));
793
  }
 
794
  }
795
  }
796
  /*else if (wplc_chat_status == 2){
@@ -802,12 +872,15 @@ jQuery(document).ready(function() {
802
  jQuery("#nifty_ratings_holder").show();
803
  jQuery.event.trigger({type: "wplc_animation_done"});
804
  jQuery("#wplc_chatbox").append(wplc_error_messages.chat_ended_by_operator+"<br />");
805
- var height = jQuery('#wplc_chatbox')[0].scrollHeight;
806
- jQuery('#wplc_chatbox').scrollTop(height);
807
  jQuery("#wp-live-chat-minimize").hide();
808
  document.getElementById('wplc_chatmsg').disabled = true;
809
  }
 
 
 
810
 
 
811
 
812
  }
813
 
@@ -817,7 +890,31 @@ jQuery(document).ready(function() {
817
  });
818
 
819
  jQuery(document).on("wplc_minimize_chat", function() {
820
- if (typeof wplc_enable_ga !== "undefined" && wplc_enable_ga === '1') {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
821
  if (typeof ga !== "undefined") {
822
  ga('send', {
823
  hitType: 'event',
@@ -864,6 +961,27 @@ jQuery(document).ready(function() {
864
  }
865
  }
866
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
867
 
868
 
869
  jQuery("body").on("click", "#wplc_start_chat_btn", function() {
@@ -881,16 +999,20 @@ jQuery(document).ready(function() {
881
  alert(wplc_error_messages.valid_email); return false;
882
  }
883
  }
 
884
 
885
  /* start the long polling */
886
  wplc_run = true;
 
 
 
887
 
 
888
  if (wplc_filter_run_override === "1" || wplc_online === false) { } else {
889
  initial_data.status = 2;
890
-
891
- /* force the loop to start only now, as we are not using the initiate extension */
892
  wplc_call_to_server_chat(initial_data,false,false);
893
- }
894
 
895
  jQuery.event.trigger({type: "wplc_start_chat"});
896
 
@@ -937,10 +1059,9 @@ jQuery(document).ready(function() {
937
  Cookies.set('wplc_name', wplc_name, { path: '/' } );
938
  Cookies.set('wplc_email', wplc_email, { path: '/' } );
939
 
940
- /* changed ajax url so wp_mail function will work and not stop plugin from alerting admin there is a pending chat */
941
- /* jQuery.post(wplc_ajaxurl, data, function(response) {*/
942
- wplc_server.send(wplc_ajaxurl, data, "POST", 120000,
943
  function(response){
 
944
  Cookies.set('wplc_chat_status', 2, { expires: date, path: '/' });
945
  wplc_cid = jQuery.trim(response);
946
 
@@ -948,14 +1069,32 @@ jQuery(document).ready(function() {
948
  wplc_server.prepareTransport(function(){
949
  //Transport ready...
950
  wplc_server_last_loop_data.status = 2; //Set to waiting
951
- wplc_call_to_server_chat(wplc_server_last_loop_data);
 
 
952
  }, wplc_user_message_receiver, wplc_user_retry_handler, wplc_log_connection_error);
953
  },
954
  function(){
955
  //Fails
956
  },
957
- function(){
958
  //Complete
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
959
  }
960
  );
961
  });
@@ -1020,6 +1159,9 @@ jQuery(document).ready(function() {
1020
  str=str.replace('<', "");
1021
  str=str.replace('>', "");
1022
 
 
 
 
1023
  return str;
1024
  }
1025
 
@@ -1036,7 +1178,7 @@ jQuery(document).ready(function() {
1036
  var wplc_cid = Cookies.get('wplc_cid');
1037
  }
1038
  var wplc_chat = wplc_strip(document.getElementById('wplc_chatmsg').value);
1039
-
1040
  if(wplc_chat !== ""){
1041
  var wplc_name = jQuery("#wplc_name").val();
1042
  if (typeof wplc_name == "undefined" || wplc_name == null || wplc_name == "") {
@@ -1055,13 +1197,14 @@ jQuery(document).ready(function() {
1055
  }
1056
 
1057
 
1058
- jQuery("#wplc_chatmsg").val('');
1059
 
1060
  /*Nifty format Parse*/
1061
  var wplc_chat_parsed = wplc_chat;
1062
- if(typeof niftyFormatParser !== "undefined"){
1063
- wplc_chat_parsed = niftyFormatParser(wplc_chat_parsed);
1064
- }
 
1065
 
1066
  if( typeof wplc_display_name !== 'undefined' ){
1067
  /**
@@ -1076,63 +1219,28 @@ jQuery(document).ready(function() {
1076
  } else {
1077
  jQuery("#wplc_chatbox").append("<span class='wplc-user-message wplc-color-bg-1 wplc-color-2 wplc-color-border-1'>"+wplc_chat_parsed+"</span><div class='wplc-clear-float-message'></div>");
1078
  }
1079
- } else {
1080
- if( typeof wplc_show_chat_detail !== 'undefined' ){
1081
- if( typeof wplc_show_chat_detail.name !== 'undefined' && wplc_show_chat_detail.name == '1' ){
1082
- /**
1083
- * Show the name
1084
- */
1085
- var the_name = "<strong>"+wplc_name+"</strong>: ";
1086
- if( typeof wplc_show_chat_detail.avatar !== 'undefined' && wplc_show_chat_detail.avatar != '' ){
1087
- /**
1088
- * Show the avatar
1089
- */
1090
- wplc_gravatar_image = "<img src='https://www.gravatar.com/avatar/"+md5( wplc_email )+"?s=30&d=mm' class='wplc-user-message-avatar'/>";
1091
-
1092
- } else {
1093
- /**
1094
- * Don't show the avatar
1095
- */
1096
- wplc_gravatar_image = "";
1097
- }
1098
- } else {
1099
- /**
1100
- * Don't show the name
1101
- */
1102
- var the_name = "";
1103
- if( typeof wplc_show_chat_detail.avatar !== 'undefined' && wplc_show_chat_detail.avatar != '' ){
1104
- /**
1105
- * Show the avatar
1106
- */
1107
- wplc_gravatar_image = "<img src='https://www.gravatar.com/avatar/"+md5( wplc_email )+"?s=30&d=mm' class='wplc-user-message-avatar'/>";
1108
- } else {
1109
- /**
1110
- * Don't show the avatar
1111
- */
1112
- wplc_gravatar_image = "";
1113
- }
1114
- }
1115
-
1116
- wplc_chat = wplc_gravatar_image+the_name+wplc_chat_parsed;
1117
-
1118
- jQuery("#wplc_chatbox").append("<span class='wplc-user-message wplc-color-bg-1 wplc-color-2 wplc-color-border-1'>"+wplc_chat+"</span><br /><div class='wplc-clear-float-message'></div>");
1119
-
1120
- } else {
1121
- wplc_chat = wplc_chat_parsed;
1122
 
1123
- jQuery("#wplc_chatbox").append("<span class='wplc-user-message wplc-color-bg-1 wplc-color-2 wplc-color-border-1'>"+wplc_chat_parsed+"</span><div class='wplc-clear-float-message'></div>");
1124
-
1125
- }
1126
  }
1127
-
1128
- var height = jQuery('#wplc_chatbox')[0].scrollHeight;
1129
- jQuery('#wplc_chatbox').scrollTop(height);
1130
 
1131
  var data = {
1132
  action: 'wplc_user_send_msg',
1133
  security: wplc_nonce,
1134
  cid: wplc_cid,
1135
- msg: wplc_chat,
1136
  wplc_extra_data:wplc_extra_data
1137
  };
1138
 
@@ -1159,12 +1267,15 @@ jQuery(document).ready(function() {
1159
  }
1160
  }
1161
 
 
 
 
1162
  });
1163
 
1164
  jQuery(document).on("wplc_open_chat", function (event) {
1165
  /* what is the current status? */
1166
  wplc_chat_status = Cookies.get('wplc_chat_status');
1167
- if( typeof wplc_chat_status == 'undefined' ){
1168
  Cookies.set('wplc_chat_status', 5, { expires: 1, path: '/' });
1169
  }
1170
  var wplc_tmp_checker = wplc_pre_open_check_status(status, function() {
@@ -1201,16 +1312,14 @@ jQuery(document).ready(function() {
1201
  }
1202
  if (parseInt(wplc_chat_status) === 8) {
1203
  /* no answer from agent previously */
 
1204
  Cookies.set('wplc_chat_status', 5, { expires: 1, path: '/' });
1205
  }
1206
 
1207
  }
1208
  callback();
1209
  }
1210
- String.prototype.wplcStripSlashes = function(){
1211
- return this.replace(/\\(.)/mg, "$1");
1212
- }
1213
-
1214
  if(typeof wplc_elem_trigger_id !== "undefined" && wplc_elem_trigger_id !== ""){
1215
  var wplc_click_or_hover = 0;
1216
  var wplc_class_or_id = 0;
30
 
31
  var wplc_server_last_loop_data = null;
32
 
33
+ var wplc_shown_welcome = false;
34
+
35
+ var wplc_current_agent = false;
36
+
37
+
38
+
39
  jQuery(document).ready(function() {
40
  var wplc_session_variable = new Date().getTime();
41
  var wplc_cid;
49
  var initial_data = {};
50
  var wplc_fist_run = true;
51
  var wplc_long_poll_delay = 1500;
52
+
53
+ /* preload the images */
54
+ wplc_preload();
55
 
56
  wplc_cid = Cookies.get('wplc_cid');
57
 
67
  wplc_cookie_name = Cookies.get('wplc_name');
68
  wplc_cookie_email = Cookies.get('wplc_email');
69
  // Always start on 5 - ajax will then return chat status if active
70
+
71
  Cookies.set('wplc_chat_status', 5, { expires: 1, path: '/' });
72
  wplc_chat_status = 5;
73
+ //if (typeof wplc_chat_status !== "undefined" && parseInt(wplc_chat_status) === 3) { } else {
74
+
75
+ //}
76
 
77
  var data = {
78
  action: 'wplc_get_chat_box',
93
 
94
  jQuery( "body" ).append( response['cbox']);
95
 
96
+ wplc_listenForScrollEvent(jQuery("#wplc_chatbox"));
97
+
98
  if( typeof wplc_cookie_name == 'undefined' || typeof wplc_cookie_email == 'undefined' ){
99
 
100
  var wplc_cookie_name = jQuery( jQuery.parseHTML( response['cbox'] ) ).find( "#wplc_name" ).val();
102
 
103
  }
104
 
105
+
106
+
107
  /* is an agent online? */
108
  if (response['online'] === false) {
109
  wplc_run = false;
111
  } else {
112
  wplc_online = true;
113
  }
114
+
115
+
116
+
117
  if (wplc_filter_run_override !== "1" || wplc_online === false) { wplc_run = false; } else { /* we can run */ }
118
 
119
+
120
+ /* has this user been assigned an agent? */
121
+ if (typeof response['type'] === "undefined") {
122
+ wplc_shown_welcome = false;
123
+ } else {
124
+ if (response['type'] === "returning") {
125
+ wplc_shown_welcome = true;
126
+ /* set the agent vars so we can access them on the fly */
127
+ if (typeof response['agent_data'] !== "undefined") {
128
+ wplc_current_agent = response['agent_data'];
129
+ }
130
+ } else {
131
+ wplc_shown_welcome = false;
132
+ }
133
+
134
+ }
135
+
136
+
137
  /*Support mobile loggin*/
138
  var wplc_mobile_check = false;
139
  if(typeof wplc_is_mobile !== "undefined" && (wplc_is_mobile === "true" || wplc_is_mobile === true)){
176
 
177
  });
178
 
179
+ /**
180
+ * Preload images from the localized variable
181
+ * @return void
182
+ */
183
+ function wplc_preload() {
184
+ var images = [];
185
+ if (typeof wplc_preload_images !== "undefined" && typeof wplc_preload_images === "object" ) {
186
+ var wplc_i = 0;
187
+ for (var key in wplc_preload_images) {
188
+ images[wplc_i] = new Image();
189
+ images[wplc_i].src = wplc_preload_images[key];
190
+ wplc_i++;
191
+ }
192
+ }
193
+ }
194
+
195
+
196
+ /**
197
+ * Detect if the chatbox is being scrolled.
198
+ *
199
+ * This had to be created as jQuery does not allow the scroll event to bubble up the DOM tree.
200
+ *
201
+ * Thank you Bikal Basnet (https://stackoverflow.com/questions/16505182/bind-scroll-event-to-dynamic-div)
202
+ *
203
+ * @param object el The element in question
204
+ */
205
+ function wplc_listenForScrollEvent(el) {
206
+ el.on("scroll", function(){
207
+ el.trigger("wplc-custom-scroll");
208
+ })
209
+
210
+ }
211
+
212
+ /**
213
+ * This instantly sends the user the welcome message (i.e. to wait for any agent and start typing so long)
214
+ *
215
+ *
216
+ */
217
+ function wplc_send_welcome_message() {
218
+ if(wplc_welcome_msg !== "" && !wplc_shown_welcome){
219
+ message_class = "wplc_system_notification wplc-color-4";
220
+ var concatenated_message = "<span class='" + message_class + "'>";
221
+ concatenated_message += wplc_welcome_msg;
222
+ concatenated_message += "</span>";
223
+
224
+ if(typeof niftyFormatParser !== "undefined"){
225
+ jQuery("#wplc_chatbox").append(niftyFormatParser(concatenated_message));
226
+ } else{
227
+ jQuery("#wplc_chatbox").append(concatenated_message);
228
+ }
229
+ wplc_scroll_to_bottom();
230
+
231
+ wplc_shown_welcome = true;
232
+ }
233
+
234
+ }
235
+
236
+ /**
237
+ * Scrolls the chat box to the bottom
238
+ *
239
+ */
240
+ function wplc_scroll_to_bottom() {
241
+ var height = jQuery('#wplc_chatbox')[0].scrollHeight;
242
+ jQuery('#wplc_chatbox').scrollTop(height);
243
+ }
244
  function wplc_user_message_receiver(data){
245
  if(typeof wplc_loop_response_handler !== "undefined" && typeof wplc_loop_response_handler === "function"){
246
  wplc_loop_response_handler(data, wplc_server_last_loop_data);
251
 
252
  if(data.keep_alive === true){
253
  setTimeout(function(){
254
+ wplc_server_last_loop_data.status = wplc_chat_status;
255
  wplc_call_to_server_chat(wplc_server_last_loop_data);
256
  },100);
257
  }
334
  }, 7500);
335
  }
336
  } else {
337
+ if(typeof response !== "undefined" && typeof response.responseText !== "undefined" && response.responseText !== ""){
338
  var response_data = JSON.parse(response.responseText);
339
  if (typeof wplc_transport_prepared !== "undefined") {
340
  if(wplc_transport_prepared !== true && (parseInt(response_data.status) === 3 || parseInt(response_data.status) === 2)){
364
  if(typeof response['wplc_email'] !== "undefined"){ data['wplc_email'] = response['wplc_email']; /* Cookies.set('wplc_email', response['wplc_email'], { expires: 1, path: '/' }); */ }
365
  if(typeof response['cid'] !== "undefined"){ data['cid'] = response['cid']; Cookies.set('wplc_cid', response['cid'], { expires: 1, path: '/' }); }
366
  if(typeof response['aname'] !== "undefined") { wplc_agent_name = response['aname']; }
367
+ if(typeof response['cid'] !== "undefined" && wplc_cid !== jQuery.trim(response['cid'])){ wplc_cid = jQuery.trim(response['cid']); jQuery("#wplc_cid").val(wplc_cid); }
368
  if(typeof response['status'] !== "undefined" && parseInt(wplc_chat_status) !== parseInt(response['status'])){
369
  wplc_chat_status = response['status'];
370
  Cookies.set('wplc_chat_status', null, { path: '/' });
384
  wplc_run = true;
385
  var wplc_new_message_sound = false;
386
  if (typeof response['data'] === "object") {
387
+
388
  for (var index in response['data']) {
389
  if(typeof response['data'][index] !== "object"){
390
  if (typeof msg_history[index] === "undefined") {
391
  //Not from node
392
  /* we dont have this message */
 
393
  msg_history[index] = true;
394
 
395
+ msg_to_parse = response['data'][index].wplcStripSlashes();
396
+
397
  if(typeof niftyFormatParser !== "undefined"){
398
+ jQuery("#wplc_chatbox").append(niftyFormatParser(msg_to_parse));
399
  } else{
400
+
401
  jQuery("#wplc_chatbox").append(response['data'][index].wplcStripSlashes());
402
  }
403
 
405
 
406
  } else {
407
  /* we already have this message */
 
408
  }
409
  } else {
410
  var the_message = response['data'][index];
411
+ the_message.mid = index;
412
+ wplc_push_message_to_chatbox(the_message,'u', function() {
413
+ wplc_scroll_to_bottom();
414
+ });
415
 
416
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
417
  }
418
  }
419
  }
429
  }
430
 
431
  if(wplc_new_message_sound){
432
+ wplc_scroll_to_bottom();
 
433
  if (typeof wplc_enable_ding !== 'undefined' && wplc_enable_ding === "1") {
434
  new Audio(wplc_plugin_url+'/wp-live-chat-support/ding.mp3').play();
435
  }
449
  else if(response['status'] == 8){ // chat has been ended by admin
450
  wplc_run = false;
451
 
 
452
  document.getElementById('wplc_chatmsg').disabled = true;
453
+ wplc_shown_welcome = false;
454
+
455
+ the_message = {};
456
+ the_message.originates = 0;
457
+ the_message.msg = wplc_error_messages.chat_ended_by_operator;
458
+ the_message.other = {};
459
+ var wplc_d = new Date();
460
+ the_message.other.datetime = Math.round( wplc_d.getTime() / 1000 );
461
+
462
+ wplc_push_message_to_chatbox(the_message,'u', function() {
463
+ wplc_scroll_to_bottom();
464
+ });
465
 
466
+
467
+ /*
468
  if(typeof response['data'] === "object") {
469
  for (var index in response['data']) {
470
  if(typeof response['data'][index] === "object"){
471
+
472
  var the_message = response['data'][index];
473
  if(typeof the_message.originates !== "undefined"){
474
  var message_class = "";
496
  } else {
497
  //Backwards Compat
498
  jQuery("#wplc_chatbox").append("<em>"+response['data']+"</em><br />");
499
+ }*/
500
+
501
+
502
+
503
 
504
 
505
  jQuery.event.trigger({type: "wplc_end_chat"});
511
  }
512
  else if(parseInt(response['status']) == 3 || parseInt(response['status']) == 2 || parseInt(response['status']) == 10){ // re-initialize chat
513
  wplc_run = true;
 
514
  if(parseInt(response['status']) == 3) { // only if not minimized open aswell
515
  /* HERE NODE */
516
 
524
  }
525
  }
526
  if (!wplc_is_minimized) {
527
+ if (!wplc_is_chat_open) {
528
+ wplc_cbox_animation();
529
+ setTimeout(function() {
530
+ open_chat(0);
531
+ },1500);
532
+ }
533
  }
534
 
535
 
536
  if(jQuery('#wp-live-chat').hasClass('wplc_left') === true || jQuery('#wp-live-chat').hasClass('wplc_right') === true){
537
+ //jQuery('#wp-live-chat').height("400px");
538
  }
539
  }
540
  if(parseInt(response['status']) == 10) { // only if not minimized open aswell
544
  }
545
  if(response['data'] != null){ // append messages to chat area
546
  if (typeof response['data'] === "object") {
547
+
548
  for (var index in response['data']) {
549
  wplc_new_message_sound = false;
550
  if(typeof response['data'][index] !== "object"){
551
+
552
  if (typeof msg_history[index] === "undefined") {
553
  /* we dont have this message */
 
554
  msg_history[index] = true;
555
  if(typeof niftyFormatParser !== "undefined"){
556
  jQuery("#wplc_chatbox").append(niftyFormatParser(response['data'][index].wplcStripSlashes()));
561
  wplc_new_message_sound = true;
562
  } else {
563
  /* we already have this message */
 
564
  }
565
  } else {
566
  var the_message = response['data'][index];
567
+ the_message.mid = index;
568
+ wplc_push_message_to_chatbox(the_message,'u', function() {
569
+ wplc_scroll_to_bottom();
570
+ });
571
+
572
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
573
  }
574
 
575
  if(wplc_new_message_sound){
576
  if (response['alert']) {
577
  jQuery('#wplc-chat-alert').addClass('is-active');
578
  }
579
+ wplc_scroll_to_bottom();
 
580
  if (typeof wplc_enable_ding !== 'undefined' && wplc_enable_ding === "1") {
581
  new Audio(wplc_plugin_url+'/wp-live-chat-support/ding.mp3').play();
582
  }
594
  }
595
 
596
  if(response['data']){
597
+ wplc_scroll_to_bottom();
 
598
 
599
  }
600
  }
603
  }
604
  }
605
 
606
+
607
+
608
  function wplc_log_connection_error(error){
609
  if (window.console) { console.log(error); }
610
 
611
  jQuery("#wplc_chatbox").append("<small>" + error + "</small><br>");
612
+ wplc_scroll_to_bottom();
 
613
  }
614
 
615
  function wplc_display_error(error) {
616
+
617
+ the_message = {};
618
+ the_message.originates = 2;
619
+ the_message.msg = error;
620
+ the_message.other = {};
621
+ var wplc_d = new Date();
622
+ the_message.other.datetime = Math.round( wplc_d.getTime() / 1000 );
623
+ wplc_push_message_to_chatbox(the_message,'u', function() {
624
+ wplc_scroll_to_bottom();
625
+ });
626
+
627
+
628
+
629
  }
630
 
631
  function wplc_init_chat_box(cid, status){
632
+
633
+
634
  if(wplc_chat_status == 9 && wplc_check_hide_cookie == "yes"){
635
 
636
+ } else if (wplc_chat_status === 3) {
637
+ wplc_cbox_animation();
638
  } else {
639
  if(wplc_check_hide_cookie != "yes"){
640
  wplc_dc = setTimeout(function (){
641
+ wplc_cbox_animation();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
642
  }, parseInt(window.wplc_delay));
643
  }
644
  }
645
  wplc_init_chat_box = false;
646
  }
647
 
648
+ function wplc_cbox_animation() {
649
+ /*
650
+ * 1- Slide Up
651
+ * 2- Slide Across (Left/Right)
652
+ * 3- Slide Down
653
+ * 4- Fade In
654
+ */
655
+
656
+
657
+ var wplc_window_id = jQuery("#wp-live-chat");
658
+
659
+ var wplc_theme_chosen = jQuery(wplc_window_id).attr('wplc_animation');
660
+
661
+ switch(wplc_theme_chosen){
662
+ case 'none':
663
+ jQuery(wplc_window_id).css('display', 'block');
664
+ break;
665
+ case 'animation-1':
666
+ // Slide Up
667
+ jQuery(wplc_window_id).animate({'marginBottom' : '0px'}, 1000);
668
+ break;
669
+ case 'animation-2-bl':
670
+ // Slide Accross from left
671
+ jQuery(wplc_window_id).animate({'left' : '20px'}, 1000);
672
+ break;
673
+ case 'animation-2-br':
674
+ // Slide Accross from right
675
+ jQuery(wplc_window_id).animate({'right' : '20px'}, 1000);
676
+ break;
677
+ case 'animation-2-l':
678
+ // Slide Accross from left
679
+ jQuery(wplc_window_id).animate({"left" : '0px'}, 1000);
680
+ break;
681
+ case 'animation-2-r':
682
+
683
+ // Slide Accross from right
684
+ jQuery(wplc_window_id).animate({'right' : '0px'}, 1000);
685
+ break;
686
+ case 'animation-3':
687
+ // Fade In
688
+ jQuery(wplc_window_id).fadeIn('slow');
689
+ case 'animation-4':
690
+ jQuery(wplc_window_id).css('display', 'block');
691
+ break;
692
+ default:
693
+ jQuery(wplc_window_id).css('display', 'block');
694
+ break;
695
+ }
696
+
697
+ //jQuery("#wp-live-chat").css({ "display" : "block" });
698
+ if(jQuery("#wp-live-chat").attr('wplc-auto-pop-up') === "1"){
699
+
700
+ open_chat(0);
701
+ }
702
+
703
+ jQuery.event.trigger({type: "wplc_animation_done"});
704
+ }
705
+
706
 
707
  function wplc_sound(source,volume,loop) {
708
  this.source=source;
759
 
760
  /* minimize chat window */
761
  jQuery("body").on("click", "#wp-live-chat-minimize", function() {
762
+
763
  jQuery.event.trigger({type: "wplc_minimize_chat"});
764
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
765
 
766
  });
767
 
803
 
804
 
805
  wplc_chat_status = Cookies.get('wplc_chat_status');
806
+
807
+ /**
808
+ * double check we have a cookie. If not, set to 5 so that the chat box can atleast restart
809
+ * https://github.com/CodeCabin/wp-live-chat-support/issues/313
810
+ */
811
+ if( wplc_chat_status == null || wplc_chat_status == 'null' ){
812
+ Cookies.set('wplc_chat_status', 5, { expires: 1, path: '/' });
813
+ wplc_chat_status = 5;
814
+ }
815
+
816
+
817
  if (parseInt(wplc_chat_status) == 3 || parseInt(wplc_chat_status) == 2 || parseInt(wplc_chat_status) == 0 || parseInt(wplc_chat_status) == 12) {
818
 
819
  jQuery.event.trigger({type: "wplc_open_chat_2", wplc_online: wplc_online});
820
 
821
  Cookies.set('wplc_had_chat', true, { path: '/' });
822
 
823
+
824
+ wplc_send_welcome_message();
825
+
826
  if (parseInt(wplc_chat_status) == 0 || parseInt( wplc_chat_status ) == 11 || parseInt(wplc_chat_status) == 12) {
827
  /* user was a missed chat, now lets change them back to "pending" */
828
  wplc_chat_status = 2;
829
  }
830
+ if(typeof wplc_start_chat_pro_custom_fields_filter !== "undefined" && typeof wplc_start_chat_pro_custom_fields_filter === "function"){
831
+ wplc_extra_data = wplc_start_chat_pro_custom_fields_filter(wplc_extra_data);
832
+ }
833
+
834
+ if (wplc_online) {
835
  var data = {
836
  action: 'wplc_user_maximize_chat',
837
  security: wplc_nonce,
838
  cid: wplc_cid,
839
+ chat_status : parseInt(wplc_chat_status),
840
+ wplc_extra_data:wplc_extra_data
841
  };
842
  jQuery.post(wplc_ajaxurl, data, function(response) {
843
 
844
  //log("user maximized chat success");
845
  });
846
  }
847
+
848
  }
849
  else if (parseInt(wplc_chat_status) == 10) {
850
  jQuery("#wp-live-chat-minimize").trigger("click");
860
  jQuery("#wplc_name").val(Cookies.get('wplc_name'));
861
  jQuery("#wplc_email").val(Cookies.get('wplc_email'));
862
  }
863
+ jQuery("#wp-live-chat-header").addClass("active");
864
  }
865
  }
866
  /*else if (wplc_chat_status == 2){
872
  jQuery("#nifty_ratings_holder").show();
873
  jQuery.event.trigger({type: "wplc_animation_done"});
874
  jQuery("#wplc_chatbox").append(wplc_error_messages.chat_ended_by_operator+"<br />");
875
+ wplc_scroll_to_bottom();
 
876
  jQuery("#wp-live-chat-minimize").hide();
877
  document.getElementById('wplc_chatmsg').disabled = true;
878
  }
879
+
880
+ wplc_is_chat_open = true;
881
+
882
 
883
+
884
 
885
  }
886
 
890
  });
891
 
892
  jQuery(document).on("wplc_minimize_chat", function() {
893
+ wplc_is_minimized = true;
894
+
895
+ Cookies.set('wplc_minimize', "yes", { expires: 1, path: '/' });
896
+ wplc_chat_status = Cookies.get('wplc_chat_status');
897
+
898
+ if(typeof wplc_start_chat_pro_custom_fields_filter !== "undefined" && typeof wplc_start_chat_pro_custom_fields_filter === "function"){
899
+ wplc_extra_data = wplc_start_chat_pro_custom_fields_filter(wplc_extra_data);
900
+ }
901
+
902
+ if(wplc_chat_status != 5 && wplc_chat_status != 10 && wplc_chat_status != 9 && wplc_chat_status != 8){
903
+ if (wplc_online) {
904
+ var data = {
905
+ action: 'wplc_user_minimize_chat',
906
+ security: wplc_nonce,
907
+ cid: wplc_cid,
908
+ wplc_extra_data:wplc_extra_data
909
+ };
910
+
911
+ jQuery.post(wplc_ajaxurl, data, function(response) {
912
+
913
+ });
914
+ }
915
+ }
916
+
917
+ if (typeof wplc_enable_ga !== "undefined" && wplc_enable_ga === '1' && wplc_online) {
918
  if (typeof ga !== "undefined") {
919
  ga('send', {
920
  hitType: 'event',
961
  }
962
  }
963
  });
964
+
965
+ jQuery(document).on("wplc_agent_joined", function(e) {
966
+ var temail = '';
967
+ var tname = '';
968
+ var taid = '';
969
+ var ta_tagline = '';
970
+ var ta_bio = '';
971
+
972
+ if (typeof e.ndata.other.email !== "undefined") { temail = e.ndata.other.email; }
973
+ if (typeof e.ndata.other.name !== "undefined") { tname = e.ndata.other.name; }
974
+ if (typeof e.ndata.other.aid !== "undefined") { taid = e.ndata.other.aid; }
975
+ if (typeof e.ndata.other.agent_tagline !== "undefined") { ta_tagline = e.ndata.other.agent_tagline; }
976
+ if (typeof e.ndata.other.agent_bio !== "undefined") { ta_bio = e.ndata.other.agent_bio; }
977
+ wplc_current_agent = e.ndata.other;
978
+
979
+ jQuery(".wplc_no_answer").remove();
980
+
981
+ jQuery(".admin_chat_name").html(tname);
982
+ wplc_node_pair_name = tname;
983
+ wplc_agent_name = tname;
984
+ });
985
 
986
 
987
  jQuery("body").on("click", "#wplc_start_chat_btn", function() {
999
  alert(wplc_error_messages.valid_email); return false;
1000
  }
1001
  }
1002
+ document.getElementById('wplc_chatmsg').disabled = false;
1003
 
1004
  /* start the long polling */
1005
  wplc_run = true;
1006
+
1007
+ wplc_send_welcome_message();
1008
+ wplc_scroll_to_bottom();
1009
 
1010
+ /*
1011
  if (wplc_filter_run_override === "1" || wplc_online === false) { } else {
1012
  initial_data.status = 2;
1013
+ // force the loop to start only now, as we are not using the initiate extension
 
1014
  wplc_call_to_server_chat(initial_data,false,false);
1015
+ }*/
1016
 
1017
  jQuery.event.trigger({type: "wplc_start_chat"});
1018
 
1059
  Cookies.set('wplc_name', wplc_name, { path: '/' } );
1060
  Cookies.set('wplc_email', wplc_email, { path: '/' } );
1061
 
1062
+ wplc_server.send(wplc_ajaxurl, data, "POST", 120000,
 
 
1063
  function(response){
1064
+ wplc_chat_status = 2;
1065
  Cookies.set('wplc_chat_status', 2, { expires: date, path: '/' });
1066
  wplc_cid = jQuery.trim(response);
1067
 
1069
  wplc_server.prepareTransport(function(){
1070
  //Transport ready...
1071
  wplc_server_last_loop_data.status = 2; //Set to waiting
1072
+ if (wplc_filter_run_override === "1" || wplc_online === false) { } else {
1073
+ wplc_call_to_server_chat(wplc_server_last_loop_data);
1074
+ }
1075
  }, wplc_user_message_receiver, wplc_user_retry_handler, wplc_log_connection_error);
1076
  },
1077
  function(){
1078
  //Fails
1079
  },
1080
+ function(response, wplc_send_data){
1081
  //Complete
1082
+ if (typeof wplc_send_data !== "undefined" && typeof wplc_send_data['action'] !== "undefined" && wplc_send_data['action'] == 'wplc_start_chat') {
1083
+ /* we got here because the short poll (when disabling the initiate chat feature) comes back on the "complete" callback. This check makes sure we restart the longpoll */
1084
+ wplc_chat_status = 2;
1085
+ Cookies.set('wplc_chat_status', 2, { expires: date, path: '/' });
1086
+ wplc_cid = jQuery.trim(response);
1087
+
1088
+ //All sorted, let's check for message transport mode
1089
+ wplc_server.prepareTransport(function(){
1090
+ //Transport ready...
1091
+ wplc_server_last_loop_data.status = 2; //Set to waiting
1092
+ if (wplc_filter_run_override === "1" || wplc_online === false) { } else {
1093
+ wplc_call_to_server_chat(wplc_server_last_loop_data);
1094
+ }
1095
+ }, wplc_user_message_receiver, wplc_user_retry_handler, wplc_log_connection_error);
1096
+ }
1097
+
1098
  }
1099
  );
1100
  });
1159
  str=str.replace('<', "");
1160
  str=str.replace('>', "");
1161
 
1162
+ /* remove the last carriage return from the text area output */
1163
+ str=str.replace(/\n$/, "")
1164
+
1165
  return str;
1166
  }
1167
 
1178
  var wplc_cid = Cookies.get('wplc_cid');
1179
  }
1180
  var wplc_chat = wplc_strip(document.getElementById('wplc_chatmsg').value);
1181
+
1182
  if(wplc_chat !== ""){
1183
  var wplc_name = jQuery("#wplc_name").val();
1184
  if (typeof wplc_name == "undefined" || wplc_name == null || wplc_name == "") {
1197
  }
1198
 
1199
 
1200
+
1201
 
1202
  /*Nifty format Parse*/
1203
  var wplc_chat_parsed = wplc_chat;
1204
+
1205
+ //if(typeof niftyFormatParser !== "undefined"){
1206
+ // wplc_chat_parsed = niftyFormatParser(wplc_chat_parsed);
1207
+ //}
1208
 
1209
  if( typeof wplc_display_name !== 'undefined' ){
1210
  /**
1219
  } else {
1220
  jQuery("#wplc_chatbox").append("<span class='wplc-user-message wplc-color-bg-1 wplc-color-2 wplc-color-border-1'>"+wplc_chat_parsed+"</span><div class='wplc-clear-float-message'></div>");
1221
  }
1222
+ } else {
1223
+ the_message = {};
1224
+ the_message.originates = 2;
1225
+ the_message.msg = wplc_chat_parsed;
1226
+ the_message.other = {};
1227
+ var wplc_d = new Date();
1228
+ the_message.other.datetime = Math.round( wplc_d.getTime() / 1000 );
1229
+ wplc_push_message_to_chatbox(the_message,'u', function() {
1230
+ wplc_scroll_to_bottom();
1231
+ });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1232
 
1233
+
 
 
1234
  }
1235
+
1236
+ wplc_scroll_to_bottom();
1237
+
1238
 
1239
  var data = {
1240
  action: 'wplc_user_send_msg',
1241
  security: wplc_nonce,
1242
  cid: wplc_cid,
1243
+ msg: wplc_chat_parsed,
1244
  wplc_extra_data:wplc_extra_data
1245
  };
1246
 
1267
  }
1268
  }
1269
 
1270
+ jQuery("#wplc_chatmsg").val('');
1271
+
1272
+
1273
  });
1274
 
1275
  jQuery(document).on("wplc_open_chat", function (event) {
1276
  /* what is the current status? */
1277
  wplc_chat_status = Cookies.get('wplc_chat_status');
1278
+ if( typeof wplc_chat_status === 'undefined' ){
1279
  Cookies.set('wplc_chat_status', 5, { expires: 1, path: '/' });
1280
  }
1281
  var wplc_tmp_checker = wplc_pre_open_check_status(status, function() {
1312
  }
1313
  if (parseInt(wplc_chat_status) === 8) {
1314
  /* no answer from agent previously */
1315
+ cnonsole.log("now setting it to 5");
1316
  Cookies.set('wplc_chat_status', 5, { expires: 1, path: '/' });
1317
  }
1318
 
1319
  }
1320
  callback();
1321
  }
1322
+
 
 
 
1323
  if(typeof wplc_elem_trigger_id !== "undefined" && wplc_elem_trigger_id !== ""){
1324
  var wplc_click_or_hover = 0;
1325
  var wplc_class_or_id = 0;
js/wplc_u_admin.js CHANGED
@@ -160,7 +160,6 @@ function wplc_call_to_server(data) {
160
  }
161
  },
162
  complete: function (response) {
163
- //console.log(wplc_run);
164
  if (wplc_run) {
165
  setTimeout(function () {
166
  wplc_call_to_server(data);
@@ -184,7 +183,7 @@ function wplc_display_error(error, dismiss) {
184
 
185
  function wplc_handle_chat_output(response) {
186
  var obj = jQuery.parseJSON(response);
187
- if (obj === false || obj === null) {
188
  jQuery("#wplc_chat_ul").html("");
189
  current_chat_ids = {};
190
  wplc_handle_count_change(0);
@@ -213,16 +212,19 @@ function wplc_handle_chat_output(response) {
213
 
214
  }
215
 
216
- if(obj["visitor_count"])
217
- {
218
  var size = obj["visitor_count"];
219
- wplc_handle_count_change(size);
 
 
 
 
 
 
220
  }
221
 
222
  }
223
  function wplc_handle_count_change(qty) {
224
- console.log(chat_count);
225
- console.log(qty);
226
  if (parseInt(qty) !== parseInt(chat_count)) {
227
  jQuery(".wplc_chat_vis_count_box").animate({backgroundColor: '#B3D24B'}, 300);
228
  jQuery(".wplc_vis_online").html(qty);
160
  }
161
  },
162
  complete: function (response) {
 
163
  if (wplc_run) {
164
  setTimeout(function () {
165
  wplc_call_to_server(data);
183
 
184
  function wplc_handle_chat_output(response) {
185
  var obj = jQuery.parseJSON(response);
186
+ if (obj === false || obj === null) {
187
  jQuery("#wplc_chat_ul").html("");
188
  current_chat_ids = {};
189
  wplc_handle_count_change(0);
212
 
213
  }
214
 
215
+ if(obj !== null && typeof obj !== "undefined" && obj["visitor_count"]) {
 
216
  var size = obj["visitor_count"];
217
+ if (parseInt(size) === 0) {
218
+ jQuery("#wplc_chat_ul").html("");
219
+ current_chat_ids = {};
220
+ wplc_handle_count_change(0);
221
+ } else {
222
+ wplc_handle_count_change(size);
223
+ }
224
  }
225
 
226
  }
227
  function wplc_handle_count_change(qty) {
 
 
228
  if (parseInt(qty) !== parseInt(chat_count)) {
229
  jQuery(".wplc_chat_vis_count_box").animate({backgroundColor: '#B3D24B'}, 300);
230
  jQuery(".wplc_vis_online").html(qty);
js/wplc_u_admin_chat.js CHANGED
@@ -9,6 +9,7 @@ wplc_server = new WPLCServer();
9
 
10
  var wplc_server_last_loop_data = null;
11
 
 
12
  function wplc_admin_message_receiver(data){
13
  if(typeof wplc_loop_response_handler !== "undefined" && typeof wplc_loop_response_handler === "function"){
14
  wplc_loop_response_handler(data);
@@ -54,7 +55,7 @@ var wplc_run = true;
54
  var wplc_had_error = false;
55
  var wplc_display_name = wplc_name;
56
  var wplc_enable_ding = wplc_enable_ding;
57
- var wplc_user_email_address = wplc_user_email;
58
 
59
  jQuery(document).ready(function(){
60
  //Parse existing data
@@ -69,6 +70,8 @@ function wplc_call_to_server_admin_chat(data) {
69
  if(typeof wplc_admin_agent_name !== "undefined"){
70
  data.msg_from_print = wplc_admin_agent_name;
71
  }
 
 
72
 
73
  wplc_server_last_loop_data = data;
74
 
@@ -107,6 +110,16 @@ function wplc_call_to_server_admin_chat(data) {
107
  }
108
  );
109
  }
 
 
 
 
 
 
 
 
 
 
110
 
111
  function wplc_loop_response_handler(response){
112
  if (response) {
@@ -117,11 +130,24 @@ function wplc_loop_response_handler(response){
117
 
118
  jQuery.event.trigger({type: "wplc_admin_chat_loop",response:response});
119
 
120
-
121
  if (response['action'] === "wplc_ma_agant_already_answered") {
122
- jQuery(".end_chat_div").empty();
123
- jQuery('#admin_chat_box').empty().append("<h2>This chat has already been answered. Please close the chat window</h2>");
124
- wplc_run = false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
  }
126
 
127
  if (response['action'] === "wplc_update_chat_status") {
@@ -130,20 +156,32 @@ function wplc_loop_response_handler(response){
130
  }
131
  if (response['action'] === "wplc_new_chat_message") {
132
  jQuery("#wplc_user_typing").fadeOut("slow").remove();
 
133
  current_len = jQuery("#admin_chat_box_area_" + cid).html().length;
134
- if(typeof niftyFormatParser !== "undefined"){
135
- jQuery("#admin_chat_box_area_" + cid).append(niftyFormatParser(response['chat_message']));
136
- }else{
137
- jQuery("#admin_chat_box_area_" + cid).append(response['chat_message']);
138
- }
139
- new_length = jQuery("#admin_chat_box_area_" + cid).html().length;
140
- if (current_len < new_length) {
141
- if (typeof wplc_enable_ding !== 'undefined' && wplc_enable_ding === "1" && ! (/User is browsing <small/.test(response['chat_message']))) {
142
- new Audio(wplc_ding_file).play()
143
  }
 
 
 
 
 
 
 
 
 
 
 
 
144
  }
145
- var height = jQuery('#admin_chat_box_area_' + cid)[0].scrollHeight;
146
- jQuery('#admin_chat_box_area_' + cid).scrollTop(height);
147
 
148
  }
149
  if (response['action'] === "wplc_user_open_chat") {
@@ -155,60 +193,31 @@ function wplc_loop_response_handler(response){
155
  for (var index in response['data']) {
156
  if(typeof response['data'][index] === "object"){
157
  var the_message = response['data'][index];
 
 
 
 
 
158
 
159
- if(typeof the_message.originates !== "undefined"){
160
- var message_class = "";
161
- var grav_hash = "";
162
- var message_grav = "";
163
- var message_from = "";
164
- var message_content = "";
165
- if(parseInt(the_message.originates) === 1){
166
- //From Admin
167
- message_class = "wplc-admin-message wplc-color-bg-4 wplc-color-2 wplc-color-border-4";
168
- message_grav = "<img src='//www.gravatar.com/avatar/MD5_this_section_with_email?s=30' class='wplc-admin-message-avatar' />";
169
- message_from = "";
170
- message_content = the_message.msg.wplcStripSlashes();
171
- } else if (parseInt(the_message.originates) === 3){
172
- //System Notification
173
- message_class = "wplc_system_notification wplc-color-4";
174
- message_content = the_message.msg;
175
- } else {
176
- message_class = "wplc-user-message wplc-color-bg-1 wplc-color-2 wplc-color-border-1";
177
- // message_grav = md5(wplc_email);
178
- message_grav = "<img src='//www.gravatar.com/avatar/" + message_grav + "?s=30' class='wplc-admin-message-avatar' />";
179
- message_from = (typeof wplc_chat_name !== "undefined" ? wplc_chat_name : "Unknown");
180
- message_content = the_message.msg;
181
- }
182
-
183
- if(message_content !== ""){
184
- var concatenated_message = "<span class='" + message_class + "'>";
185
- // concatenated_message += message_grav;
186
- // concatenated_message += message_from;
187
- concatenated_message += message_content;
188
- concatenated_message += "</span>";
189
-
190
- if(typeof niftyFormatParser !== "undefined"){
191
- jQuery("#admin_chat_box_area_" + cid).append(niftyFormatParser(concatenated_message));
192
- } else{
193
- jQuery("#admin_chat_box_area_" + cid).append(concatenated_message);
194
- }
195
-
196
- var height = jQuery('#admin_chat_box_area_' + cid)[0].scrollHeight;
197
- jQuery('#admin_chat_box_area_' + cid).scrollTop(height);
198
- }
199
- }
200
  }
201
  }
202
  }
203
  }
204
  }
 
 
 
 
 
 
 
 
205
 
206
  function wplc_display_error(error) {
207
  if (window.console) { console.log(error); }
208
 
209
  jQuery("#admin_chat_box_area_" + cid).append("<small>" + error + "</small><br>");
210
- var height = jQuery('#admin_chat_box_area_' + cid)[0].scrollHeight;
211
- jQuery('#admin_chat_box_area_' + cid).scrollTop(height);
212
  }
213
 
214
  function wplc_display_chat_status_update(new_chat_status, cid) {
@@ -219,26 +228,49 @@ if (new_chat_status === "0") {
219
  chat_status = new_chat_status;
220
 
221
  if ((previous_chat_status === "2" && chat_status === "3") || (previous_chat_status === "5" && chat_status === "3")) {
222
- jQuery("#admin_chat_box_area_" + cid).append("<em>"+wplc_string1+"</em><br />");
223
- var height = jQuery('#admin_chat_box_area_' + cid)[0].scrollHeight;
224
- jQuery('#admin_chat_box_area_' + cid).scrollTop(height);
225
 
226
  } else if (chat_status == "10" && previous_chat_status == "3") {
227
- jQuery("#admin_chat_box_area_" + cid).append("<em>"+wplc_string2+"</em><br />");
228
- var height = jQuery('#admin_chat_box_area_' + cid)[0].scrollHeight;
229
- jQuery('#admin_chat_box_area_' + cid).scrollTop(height);
 
 
 
 
 
 
 
 
230
  }
231
  else if (chat_status === "3" && previous_chat_status === "10") {
232
- jQuery("#admin_chat_box_area_" + cid).append("<em>"+wplc_string3+"</em><br />");
233
- var height = jQuery('#admin_chat_box_area_' + cid)[0].scrollHeight;
234
- jQuery('#admin_chat_box_area_' + cid).scrollTop(height);
 
 
 
 
 
 
 
235
  }
236
  else if (chat_status === "1" || chat_status === "8") {
237
  wplc_run = false;
238
- jQuery("#admin_chat_box_area_" + cid).append("<em>"+wplc_string4+"</em><br />");
239
- var height = jQuery('#admin_chat_box_area_' + cid)[0].scrollHeight;
240
- jQuery('#admin_chat_box_area_' + cid).scrollTop(height);
241
- document.getElementById('wplc_admin_chatmsg').disabled = true;
 
 
 
 
 
 
 
 
 
242
  jQuery(".admin_chat_box_inner_bottom").hide();
243
  jQuery(".admin_chat_quick_controls").hide();
244
  jQuery(".end_chat_div").hide();
@@ -265,13 +297,23 @@ jQuery(document).ready(function () {
265
  wplc_server.prepareTransport(function(){
266
  wplc_call_to_server_admin_chat(data);
267
  }, wplc_admin_message_receiver, wplc_admin_retry_handler, wplc_display_error);
 
 
 
 
 
 
 
 
 
 
 
268
 
269
  if (typeof wplc_action2 !== "undefined" && wplc_action2 !== "") { return; }
270
 
271
  if (jQuery('#wplc_admin_cid').length) {
272
  var wplc_cid = jQuery("#wplc_admin_cid").val();
273
- var height = jQuery('#admin_chat_box_area_' + wplc_cid)[0].scrollHeight;
274
- jQuery('#admin_chat_box_area_' + wplc_cid).scrollTop(height);
275
  }
276
 
277
 
@@ -360,62 +402,33 @@ jQuery(document).ready(function () {
360
  if(typeof niftyFormatParser !== "undefined"){
361
  //PRO
362
  wplc_chat_parsed = niftyFormatParser(wplc_chat_parsed);
363
- }
364
- if( typeof wplc_show_chat_detail !== 'undefined' ){
365
- if( wplc_name !== ""){
366
- /**
367
- * Show the name
368
- */
369
- var the_name = "<strong>"+wplc_name +"</strong>";
370
- if( typeof wplc_show_chat_detail.avatar !== 'undefined' && wplc_show_chat_detail.avatar != '' ){
371
- /**
372
- * Show the avatar
373
- */
374
- wplc_gravatar_image = wplc_show_chat_detail.avatar;
375
- } else {
376
- /**
377
- * Don't show the avatar
378
- */
379
-
380
- }
381
- } else {
382
- /**
383
- * Don't show the name
384
- */
385
- var the_name = "";
386
- if( typeof wplc_show_chat_detail.avatar !== 'undefined' && wplc_show_chat_detail.avatar != '' ){
387
- /**
388
- * Show the avatar
389
- */
390
- wplc_gravatar_image = wplc_show_chat_detail.avatar;
391
- } else {
392
- /**
393
- * Don't show the avatar
394
- */
395
-
396
- }
397
- }
398
-
399
- wplc_chat_contents = wplc_gravatar_image + the_name + wplc_chat_parsed
400
-
401
- jQuery("#admin_chat_box_area_" + wplc_cid).append("<span class='wplc-admin-message wplc-color-bg-4 wplc-color-2 wplc-color-border-4'>" + wplc_chat_contents + "</span><br /><div class='wplc-clear-float-message'></div>");
402
-
403
- } else {
404
-
405
- wplc_chat_contents = wplc_chat_parsed;
406
 
407
- jQuery("#admin_chat_box_area_" + wplc_cid).append("<span class='wplc-admin-message wplc-color-bg-4 wplc-color-2 wplc-color-border-4'>" + wplc_chat_parsed + "</span><br /><div class='wplc-clear-float-message'></div>");
408
- }
409
 
410
- var height = jQuery('#admin_chat_box_area_' + wplc_cid)[0].scrollHeight;
 
 
 
 
411
 
412
- jQuery('#admin_chat_box_area_' + wplc_cid).scrollTop(height);
413
 
414
  var data = {
415
  action: 'wplc_admin_send_msg',
416
  security: wplc_ajax_nonce,
417
  cid: wplc_cid,
418
- msg: wplc_chat_contents,
419
  wplc_extra_data:wplc_extra_data
420
  };
421
 
9
 
10
  var wplc_server_last_loop_data = null;
11
 
12
+
13
  function wplc_admin_message_receiver(data){
14
  if(typeof wplc_loop_response_handler !== "undefined" && typeof wplc_loop_response_handler === "function"){
15
  wplc_loop_response_handler(data);
55
  var wplc_had_error = false;
56
  var wplc_display_name = wplc_name;
57
  var wplc_enable_ding = wplc_enable_ding;
58
+ var wplc_first_run = true;
59
 
60
  jQuery(document).ready(function(){
61
  //Parse existing data
70
  if(typeof wplc_admin_agent_name !== "undefined"){
71
  data.msg_from_print = wplc_admin_agent_name;
72
  }
73
+ data.first_run = wplc_first_run;
74
+ wplc_first_run = false;
75
 
76
  wplc_server_last_loop_data = data;
77
 
110
  }
111
  );
112
  }
113
+ function wplc_findGetParameter(parameterName) {
114
+ var result = null,
115
+ tmp = [];
116
+ var items = location.search.substr(1).split("&");
117
+ for (var index = 0; index < items.length; index++) {
118
+ tmp = items[index].split("=");
119
+ if (tmp[0] === parameterName) result = decodeURIComponent(tmp[1]);
120
+ }
121
+ return result;
122
+ }
123
 
124
  function wplc_loop_response_handler(response){
125
  if (response) {
130
 
131
  jQuery.event.trigger({type: "wplc_admin_chat_loop",response:response});
132
 
 
133
  if (response['action'] === "wplc_ma_agant_already_answered") {
134
+ if (wplc_findGetParameter('action') == 'history') {
135
+ wplc_run = false;
136
+ } else {
137
+ jQuery(".end_chat_div").empty();
138
+ jQuery('#admin_chat_box').empty().append("<h2>This chat has already been answered. Please close the chat window</h2>");
139
+ wplc_run = false;
140
+ }
141
+ }
142
+ if (response['action'] === 'wplc_chat_history') {
143
+ for (k in response['chat_history']) {
144
+ the_message = response['chat_history'][k];
145
+ the_message.mid = k;
146
+ wplc_push_message_to_chatbox(the_message,'a', function() {
147
+ wplc_scroll_to_bottom();
148
+ });
149
+
150
+ }
151
  }
152
 
153
  if (response['action'] === "wplc_update_chat_status") {
156
  }
157
  if (response['action'] === "wplc_new_chat_message") {
158
  jQuery("#wplc_user_typing").fadeOut("slow").remove();
159
+
160
  current_len = jQuery("#admin_chat_box_area_" + cid).html().length;
161
+
162
+ if (typeof response['chat_message'] === "object") {
163
+ for (k in response['chat_message']) {
164
+ response['chat_message'][k].mid = k;
165
+ wplc_push_message_to_chatbox(response['chat_message'][k], 'a', function() {
166
+ wplc_scroll_to_bottom();
167
+ });
168
+
 
169
  }
170
+ } else {
171
+ wplc_push_message_to_chatbox(response['chat_message'], 'a', function() {
172
+ wplc_scroll_to_bottom();
173
+ });
174
+
175
+ new_length = jQuery("#admin_chat_box_area_" + cid).html().length;
176
+ if (current_len < new_length) {
177
+ if (typeof wplc_enable_ding !== 'undefined' && wplc_enable_ding === "1" && ! (/User is browsing <small/.test(response['chat_message']))) {
178
+ new Audio(wplc_ding_file).play()
179
+ }
180
+ }
181
+
182
  }
183
+
184
+
185
 
186
  }
187
  if (response['action'] === "wplc_user_open_chat") {
193
  for (var index in response['data']) {
194
  if(typeof response['data'][index] === "object"){
195
  var the_message = response['data'][index];
196
+ the_message.mid = index;
197
+ wplc_push_message_to_chatbox(the_message,'a', function() {
198
+ wplc_scroll_to_bottom();
199
+ });
200
+
201
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
  }
203
  }
204
  }
205
  }
206
  }
207
+ /**
208
+ * Scrolls the chat box to the bottom
209
+ *
210
+ */
211
+ function wplc_scroll_to_bottom() {
212
+ var height = jQuery('#admin_chat_box_area_' + cid)[0].scrollHeight;
213
+ jQuery('#admin_chat_box_area_' + cid).scrollTop(height);
214
+ }
215
 
216
  function wplc_display_error(error) {
217
  if (window.console) { console.log(error); }
218
 
219
  jQuery("#admin_chat_box_area_" + cid).append("<small>" + error + "</small><br>");
220
+ wplc_scroll_to_bottom();
 
221
  }
222
 
223
  function wplc_display_chat_status_update(new_chat_status, cid) {
228
  chat_status = new_chat_status;
229
 
230
  if ((previous_chat_status === "2" && chat_status === "3") || (previous_chat_status === "5" && chat_status === "3")) {
231
+ //jQuery("#admin_chat_box_area_" + cid).append("<em>"+wplc_string1+"</em><br />");
232
+ wplc_scroll_to_bottom();
 
233
 
234
  } else if (chat_status == "10" && previous_chat_status == "3") {
235
+ //jQuery("#admin_chat_box_area_" + cid).append("<em>"+wplc_string2+"</em><br />");
236
+ the_message = {};
237
+ the_message.originates = 3;
238
+ the_message.msg = wplc_string2;
239
+ the_message.other = {};
240
+ var wplc_d = new Date();
241
+ the_message.other.datetime = Math.round( wplc_d.getTime() / 1000 );
242
+ wplc_push_message_to_chatbox(the_message,'a', function() {
243
+ wplc_scroll_to_bottom();
244
+ });
245
+
246
  }
247
  else if (chat_status === "3" && previous_chat_status === "10") {
248
+ //jQuery("#admin_chat_box_area_" + cid).append("<em>"+wplc_string3+"</em><br />");
249
+ the_message = {};
250
+ the_message.originates = 3;
251
+ the_message.msg = wplc_string3;
252
+ the_message.other = {};
253
+ var wplc_d = new Date();
254
+ the_message.other.datetime = Math.round( wplc_d.getTime() / 1000 );
255
+ wplc_push_message_to_chatbox(the_message,'a', function() {
256
+ wplc_scroll_to_bottom();
257
+ });
258
  }
259
  else if (chat_status === "1" || chat_status === "8") {
260
  wplc_run = false;
261
+ the_message = {};
262
+ the_message.originates = 3;
263
+ the_message.msg = wplc_string4;
264
+ the_message.other = {};
265
+ var wplc_d = new Date();
266
+ the_message.other.datetime = Math.round( wplc_d.getTime() / 1000 );
267
+ wplc_push_message_to_chatbox(the_message,'a', function() {
268
+ wplc_scroll_to_bottom();
269
+ document.getElementById('wplc_admin_chatmsg').disabled = true;
270
+ });
271
+ //jQuery("#admin_chat_box_area_" + cid).append("<em>"+wplc_string4+"</em><br />");
272
+ wplc_scroll_to_bottom();
273
+
274
  jQuery(".admin_chat_box_inner_bottom").hide();
275
  jQuery(".admin_chat_quick_controls").hide();
276
  jQuery(".end_chat_div").hide();
297
  wplc_server.prepareTransport(function(){
298
  wplc_call_to_server_admin_chat(data);
299
  }, wplc_admin_message_receiver, wplc_admin_retry_handler, wplc_display_error);
300
+
301
+ if(typeof wplc_use_node_server !== "undefined" && wplc_use_node_server === "true"){
302
+ var firstRunData = data;
303
+ firstRunData.first_run = "true";
304
+ WPLCServer.Ajax.send(wplc_ajaxurl, firstRunData, "POST", 120000,
305
+ function (response) {
306
+ wplc_poll_delay = 1500; //This section is not really relevant as this wont run again, but copy and paste haha
307
+ wplc_loop_response_handler(response);
308
+ }
309
+ );
310
+ }
311
 
312
  if (typeof wplc_action2 !== "undefined" && wplc_action2 !== "") { return; }
313
 
314
  if (jQuery('#wplc_admin_cid').length) {
315
  var wplc_cid = jQuery("#wplc_admin_cid").val();
316
+ wplc_scroll_to_bottom();
 
317
  }
318
 
319
 
402
  if(typeof niftyFormatParser !== "undefined"){
403
  //PRO
404
  wplc_chat_parsed = niftyFormatParser(wplc_chat_parsed);
405
+ }
406
+ the_message = {};
407
+ the_message.originates = 1;
408
+ the_message.aid = wplc_extra_data.agent_id;
409
+ the_message.msg = wplc_chat_parsed;
410
+ the_message.other = {};
411
+ var wplc_d = new Date();
412
+ the_message.other.datetime = Math.round( wplc_d.getTime() / 1000 );
413
+ wplc_push_message_to_chatbox(the_message,'a', function() {
414
+ wplc_scroll_to_bottom();
415
+ });
416
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
417
 
 
 
418
 
419
+ wplc_extra_data.msg_data = {};
420
+ if (typeof wplc_admin_agent_name !== "undefined")
421
+ wplc_extra_data.msg_data.aname = wplc_admin_agent_name;
422
+ if (typeof wplc_admin_agent_email !== "undefined")
423
+ wplc_extra_data.msg_data.aemail = wplc_admin_agent_email;
424
 
425
+
426
 
427
  var data = {
428
  action: 'wplc_admin_send_msg',
429
  security: wplc_ajax_nonce,
430
  cid: wplc_cid,
431
+ msg: wplc_chat_parsed,
432
  wplc_extra_data:wplc_extra_data
433
  };
434
 
modules/api/wplc-api.php CHANGED
@@ -244,7 +244,6 @@ function wplc_api_test_component(){
244
  var returned_data = wplcParseResponse(response);
245
  jQuery("#wplc_rest_console_response").text("Success:\n--------\n" + returned_data);
246
  }).fail(function(e){
247
- //console.log("somin wrong ");
248
  var errors = "";
249
  errors = wplcParseResponse(e.responseText);
250
  jQuery("#wplc_rest_console_response").text("Error:\n--------\n" + errors);
244
  var returned_data = wplcParseResponse(response);
245
  jQuery("#wplc_rest_console_response").text("Success:\n--------\n" + returned_data);
246
  }).fail(function(e){
 
247
  var errors = "";
248
  errors = wplcParseResponse(e.responseText);
249
  jQuery("#wplc_rest_console_response").text("Error:\n--------\n" + errors);
modules/module_subscribe.php CHANGED
@@ -12,7 +12,9 @@ function wplc_plugin_action_links( $links ) {
12
  array_unshift( $links,
13
  '<a class="edit" href="' . admin_url('admin.php?page=wplivechat-menu-settings') . '">' . __( 'Settings', 'wplivechat' ) . '</a>' );
14
  array_unshift( $links,
15
- '<a class="" target="_BLANK" href="https://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=pro_settings_link">' . __( 'Extensions', 'wplivechat' ) . '</a>' );
 
 
16
 
17
 
18
  return $links;
12
  array_unshift( $links,
13
  '<a class="edit" href="' . admin_url('admin.php?page=wplivechat-menu-settings') . '">' . __( 'Settings', 'wplivechat' ) . '</a>' );
14
  array_unshift( $links,
15
+ '<a class="" target="_BLANK" href="https://www.wp-livechat.com/extensions/?utm_source=plugin&utm_medium=link&utm_campaign=pro_settings_link">' . __( 'Extensions', 'wplivechat' ) . '</a>' );
16
+ array_unshift( $links,
17
+ '<a class="" target="_BLANK" href="https://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=plugin_link_upgrade">' . __( 'Get Pro Version', 'wplivechat' ) . '</a>' );
18
 
19
 
20
  return $links;
modules/node_server.php CHANGED
@@ -91,132 +91,195 @@ add_action("wplc_hook_chat_notification","wplc_filter_notification_hook_node",20
91
  * @return void
92
  */
93
  function wplc_filter_notification_hook_node($type,$cid,$data){
94
- $msg = false;
95
- $msg_admin = false;
96
- switch($type){
97
- case "user_loaded":
98
- $msg_admin = sprintf( __("User is browsing <small><a href='%s' target='_BLANK'>%s</a></small>","wplivechat") , $data['uri'] , wplc_shortenurl($data['uri']) );
99
- break;
100
- case "await_agent":
101
- /**
102
- * Removed this as it is duplicated on the second loop to the server
103
- */
104
- $msg = $data['msg'];
105
- break;
106
- case "joined":
107
- $user_info = get_userdata(intval($data['aid']));
108
- $agent = $user_info->display_name;
109
- $msg = $agent . " ". __("has joined the chat.","wplivechat");
110
- break;
111
- case "doc_suggestion":
112
- $msg = $data['formatted_msg'];
113
- $msg_admin = $data['formatted_msg_admin'];
114
- break;
115
- case "system_dep_transfer":
116
- if(function_exists("wplc_filter_control_chat_notification_auto_department_transfer")){
117
- $from_department = null;
118
- $to_department = null;
119
-
120
- if(isset($data['to_dep_id']) && isset($data['from_dep_id'])){
121
- if(function_exists("wplc_get_department")){
122
- $from_department = wplc_get_department(intval($data['from_dep_id']));
123
- $to_department = wplc_get_department(intval($data['to_dep_id']));
124
- }
125
- }
126
 
127
- //User
128
- $msg = __("No agents available in","wplivechat") . " ";
129
- if($from_department === null){
130
- $msg .= __("selected department", "wplivechat");
131
- } else {
132
- $msg .= $from_department[0]->name;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
  }
134
- $msg .= ", " . __("automatically transferring you to", "wplivechat") . " ";
135
- if($to_department === null){
136
- $msg .= __("the next available department", "wplivechat");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
  } else {
138
- $msg .= $to_department[0]->name;
139
  }
140
- $msg .= ".";
141
 
142
- //Admin
143
- $msg_admin = __("User has been transfered from ","wplivechat") . " ";
144
- if($from_department === null){
145
- $msg_admin .= __("department", "wplivechat");
 
 
 
146
  } else {
147
- $msg_admin .= $from_department[0]->name;
148
- }
149
-
150
- if($to_department !== null){
151
- $msg_admin .= __(" to ", "wplivechat") . " " . $to_department[0]->name;
152
  }
153
- $msg_admin .= " " . __("as there were no agents online") . ".";
154
- }
155
- break;
156
- case "transfer":
157
-
158
- $user_info = get_userdata(intval($data['aid']));
159
- if( $user_info ){
160
- $agent = $user_info->display_name;
161
- } else {
162
- $agent = "";
163
- }
164
-
165
- if(isset($data["auto_transfer"]) && $data["auto_transfer"] == true){
166
- if(intval($data['aid']) === 0){
167
- //Came from a department originally
168
- $msg = __("Department took too long to respond, we are transferring this chat to the next available agent.","wplivechat");
169
- } else {
170
- $msg = $agent . " " . __("took too long to respond, we are transferring this chat to the next available agent.","wplivechat");
171
- }
172
- } else {
173
- $msg = $agent . " ". __("has transferred the chat.","wplivechat");
174
- }
175
-
176
- $msg_admin = "<strong>" . __("User received this message", "wplivechat") . ":</strong> " . $msg;
177
 
178
- break;
179
- }
180
 
181
- if(isset($cid)){
182
- $cid = intval($cid);
183
- if($msg !== false){
184
- $user_message = array(
185
- 'cid' => $cid,
186
- 'timestamp' => current_time('mysql'),
187
- 'msgfrom' => __('System notification',"wplivechat"),
188
- 'msg' => $msg,
189
- 'status' => 0,
190
- 'originates' => '0'
191
- );
192
-
193
- $user_request = wplc_node_server_post("system_message", $user_message);
194
-
195
- if($user_request === false){
196
- //Something is wrong
197
- } else {
198
-
199
- }
200
  }
201
 
202
- if($msg_admin !== false){
203
- $agent_message = array(
204
- 'cid' => $cid,
205
- 'timestamp' => current_time('mysql'),
206
- 'msgfrom' => __('System notification',"wplivechat"),
207
- 'msg' => $msg_admin,
208
- 'status' => 0,
209
- 'originates' => '3'
210
- );
 
 
 
 
 
 
 
 
 
 
 
 
211
 
212
- $agent_request = wplc_node_server_post("system_message", $agent_message);
213
- if($agent_request === false){
214
- //Something is wrong
215
- } else {
 
 
 
 
 
 
 
 
 
 
 
 
 
216
 
217
- }
218
  }
219
-
220
  }
221
 
222
  return;
@@ -384,16 +447,16 @@ add_action("wplc_change_chat_status_hook", "wplc_node_notify_server_of_status_ch
384
  * @return void
385
  */
386
  function wplc_node_notify_server_of_status_change($cid, $status){
387
- $wplc_settings = get_option("WPLC_SETTINGS");
388
 
389
- if(isset($wplc_settings['wplc_use_node_server']) && $wplc_settings['wplc_use_node_server'] == 1){
390
- $cid = intval($cid);
391
- $status = intval($status);
392
- if($status === 1){
393
- //End - This is most commonly done when the user has not sent a message in a long time.
394
 
395
- //Notify the user and agent of this occurring
396
- $msg = __("Chat has been ended.", "wplivechat");
397
 
398
  $system_message = array(
399
  'cid' => $cid,
@@ -405,12 +468,28 @@ function wplc_node_notify_server_of_status_change($cid, $status){
405
  'tripswitch' => true
406
  );
407
 
408
- $node_request = wplc_node_server_post("end_chat", $system_message);
409
  if($node_request === false){ } else { }
410
- }
411
- }
412
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
413
 
 
 
 
414
  add_filter("wplc_log_user_on_page_insert_other_data_filter", "wplc_is_client_socket_enabled", 10, 1);
415
  /**
416
  * Checks if the user is socket enabled (ready to chat via a socket connection)
91
  * @return void
92
  */
93
  function wplc_filter_notification_hook_node($type,$cid,$data){
94
+ $wplc_settings = get_option("WPLC_SETTINGS");
95
+ if(isset($wplc_settings['wplc_use_node_server']) && intval($wplc_settings['wplc_use_node_server']) == 1) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
 
97
+ $msg = false;
98
+ $msg_admin = false;
99
+
100
+
101
+ $other = false;
102
+ switch($type){
103
+ case "user_loaded":
104
+ $msg_admin = sprintf( __("User is browsing <small><a href='%s' target='_BLANK'>%s</a></small>","wplivechat") , $data['uri'] , wplc_shortenurl($data['uri']) );
105
+ break;
106
+ case "await_agent":
107
+ /**
108
+ * Removed this as it is duplicated on the second loop to the server
109
+ */
110
+ $msg = $data['msg'];
111
+ break;
112
+ case "joined":
113
+ $user_info = get_userdata(intval($data['aid']));
114
+ $agent = $user_info->display_name;
115
+ $msg = $agent . " ". __("has joined the chat.","wplivechat");
116
+
117
+ $agent_tagline = '';
118
+ $agent_bio = '';
119
+ $a_twitter = '';
120
+ $a_linkedin = '';
121
+ $a_facebook = '';
122
+ $a_website = '';
123
+ $social_links = '';
124
+
125
+ $tagline = get_user_meta( intval($data['aid']), 'wplc_user_tagline', true );
126
+ if( $tagline !== "" ){
127
+ $agent_tagline = $tagline;
128
+ $agent_tagline = '<span class="wplc_agent_infosection wplc_agent_tagline wplc-color-2">'.$agent_tagline.'</span>';
129
  }
130
+ $bio = get_user_meta( intval($data['aid']), 'wplc_user_bio', true );
131
+ if( $bio !== "" ){
132
+ $agent_bio = $bio;
133
+ $agent_bio = '<span class="wplc_agent_infosection wplc_agent_bio wplc-color-2">'.$agent_bio.'</span>';
134
+ }
135
+
136
+ $a_twitter = get_user_meta( intval($data['aid']), 'wplc_user_twitter', true );
137
+ $a_linkedin = get_user_meta( intval($data['aid']), 'wplc_user_linkedin', true );
138
+ $a_facebook = get_user_meta( intval($data['aid']), 'wplc_user_facebook', true );
139
+ $a_website = get_user_meta( intval($data['aid']), 'wplc_user_website', true );
140
+
141
+ if ($a_twitter === '' && $a_linkedin === '' && $a_facebook === '' && $a_website === '') {
142
+ $social_links = '';
143
+ } else {
144
+ $social_links = '<span class="wplc_agent_infosection wplc_agent_social_links wplc-color-2">';
145
+ if ($a_twitter !== '') {
146
+ $social_links .= '<a href="'.$a_twitter.'" title="'.$agent.' - Twitter" border="0" rel="nofollow" target="_BLANK"><img src="'.plugins_url('/images/social/twitter.png',__FILE__).'" title="'.$agent.' - Twitter" border="0" /></a> &nbsp; ';
147
+ }
148
+ if ($a_linkedin !== '') {
149
+ $social_links .= '<a href="'.$a_linkedin.'" title="'.$agent.' - Twitter" border="0" rel="nofollow" target="_BLANK"><img src="'.plugins_url('/images/social/linkedin.png',__FILE__).'" title="'.$agent.' - LinkedIn" border="0" /></a> &nbsp; ';
150
+ }
151
+ if ($a_facebook !== '') {
152
+ $social_links .= '<a href="'.$a_facebook.'" title="'.$agent.' - Twitter" border="0" rel="nofollow" target="_BLANK"><img src="'.plugins_url('/images/social/facebook.png',__FILE__).'" title="'.$agent.' - Facebook" border="0" /></a> &nbsp; ';
153
+ }
154
+ if ($a_website !== '') {
155
+ $social_links .= '<a href="'.$a_website.'" title="'.$agent.' - Twitter" border="0" rel="nofollow" target="_BLANK"><img src="'.plugins_url('/images/social/website.png',__FILE__).'" title="'.$agent.' - Website" border="0" /></a> &nbsp; ';
156
+ }
157
+ $social_links .= '</span>';
158
+ }
159
+
160
+ $other = array(
161
+ 'ntype' => 'joined',
162
+ 'email' => md5($user_info->user_email),
163
+ 'name' => $agent,
164
+ 'aid' => $user_info->ID,
165
+ 'agent_tagline' => $agent_tagline,
166
+ 'agent_bio' => $agent_bio,
167
+ 'social_links' => $social_links
168
+ );
169
+ break;
170
+ case "doc_suggestion":
171
+ $msg = $data['formatted_msg'];
172
+ $msg_admin = $data['formatted_msg_admin'];
173
+ break;
174
+ case "system_dep_transfer":
175
+ if(function_exists("wplc_filter_control_chat_notification_auto_department_transfer")){
176
+ $from_department = null;
177
+ $to_department = null;
178
+
179
+ if(isset($data['to_dep_id']) && isset($data['from_dep_id'])){
180
+ if(function_exists("wplc_get_department")){
181
+ $from_department = wplc_get_department(intval($data['from_dep_id']));
182
+ $to_department = wplc_get_department(intval($data['to_dep_id']));
183
+ }
184
+ }
185
+
186
+ //User
187
+ $msg = __("No agents available in","wplivechat") . " ";
188
+ if($from_department === null){
189
+ $msg .= __("selected department", "wplivechat");
190
+ } else {
191
+ $msg .= $from_department[0]->name;
192
+ }
193
+ $msg .= ", " . __("automatically transferring you to", "wplivechat") . " ";
194
+ if($to_department === null){
195
+ $msg .= __("the next available department", "wplivechat");
196
+ } else {
197
+ $msg .= $to_department[0]->name;
198
+ }
199
+ $msg .= ".";
200
+
201
+ //Admin
202
+ $msg_admin = __("User has been transfered from ","wplivechat") . " ";
203
+ if($from_department === null){
204
+ $msg_admin .= __("department", "wplivechat");
205
+ } else {
206
+ $msg_admin .= $from_department[0]->name;
207
+ }
208
+
209
+ if($to_department !== null){
210
+ $msg_admin .= __(" to ", "wplivechat") . " " . $to_department[0]->name;
211
+ }
212
+ $msg_admin .= " " . __("as there were no agents online") . ".";
213
+ }
214
+ break;
215
+ case "transfer":
216
+
217
+ $user_info = get_userdata(intval($data['aid']));
218
+ if( $user_info ){
219
+ $agent = $user_info->display_name;
220
  } else {
221
+ $agent = "";
222
  }
 
223
 
224
+ if(isset($data["auto_transfer"]) && $data["auto_transfer"] == true){
225
+ if(intval($data['aid']) === 0){
226
+ //Came from a department originally
227
+ $msg = __("Department took too long to respond, we are transferring this chat to the next available agent.","wplivechat");
228
+ } else {
229
+ $msg = $agent . " " . __("took too long to respond, we are transferring this chat to the next available agent.","wplivechat");
230
+ }
231
  } else {
232
+ $msg = $agent . " ". __("has transferred the chat.","wplivechat");
 
 
 
 
233
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
234
 
235
+ $msg_admin = "<strong>" . __("User received this message", "wplivechat") . ":</strong> " . $msg;
 
236
 
237
+ break;
238
+ default:
239
+ break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
240
  }
241
 
242
+ if(isset($cid)){
243
+ $cid = intval($cid);
244
+ if($msg !== false){
245
+ $user_message = array(
246
+ 'cid' => $cid,
247
+ 'timestamp' => current_time('mysql'),
248
+ 'msgfrom' => __('System notification',"wplivechat"),
249
+ 'msg' => $msg,
250
+ 'status' => 0,
251
+ 'originates' => '0',
252
+ 'other' => $other
253
+ );
254
+
255
+ $user_request = wplc_node_server_post("system_message", $user_message);
256
+
257
+ if($user_request === false){
258
+ //Something is wrong
259
+ } else {
260
+
261
+ }
262
+ }
263
 
264
+ if($msg_admin !== false){
265
+ $agent_message = array(
266
+ 'cid' => $cid,
267
+ 'timestamp' => current_time('mysql'),
268
+ 'msgfrom' => __('System notification',"wplivechat"),
269
+ 'msg' => $msg_admin,
270
+ 'status' => 0,
271
+ 'originates' => '3'
272
+ );
273
+
274
+ $agent_request = wplc_node_server_post("system_message", $agent_message);
275
+ if($agent_request === false){
276
+ //Something is wrong
277
+ } else {
278
+
279
+ }
280
+ }
281
 
 
282
  }
 
283
  }
284
 
285
  return;
447
  * @return void
448
  */
449
  function wplc_node_notify_server_of_status_change($cid, $status){
450
+ $wplc_settings = get_option("WPLC_SETTINGS");
451
 
452
+ if(isset($wplc_settings['wplc_use_node_server']) && $wplc_settings['wplc_use_node_server'] == 1){
453
+ $cid = intval($cid);
454
+ $status = intval($status);
455
+ if($status === 1){
456
+ //End - This is most commonly done when the user has not sent a message in a long time.
457
 
458
+ //Notify the user and agent of this occurring
459
+ $msg = __("Chat has been ended.", "wplivechat");
460
 
461
  $system_message = array(
462
  'cid' => $cid,
468
  'tripswitch' => true
469
  );
470
 
471
+ $node_request = wplc_node_server_post("end_chat", $system_message);
472
  if($node_request === false){ } else { }
473
+ } else if ($status === 0){
474
+ //Notify the user and agent of this occurring
475
+ $system_message = array(
476
+ 'cid' => $cid,
477
+ 'timestamp' => current_time('mysql'),
478
+ 'msgfrom' => __('System notification',"wplivechat"),
479
+ 'msg' => wplc_return_no_answer_string($cid),
480
+ 'status' => 0,
481
+ 'originates' => '0'
482
+ );
483
+
484
+
485
+ $node_request = wplc_node_server_post("system_message", $system_message);
486
+ if($node_request === false){ } else { }
487
+
488
+
489
 
490
+ }
491
+ }
492
+ }
493
  add_filter("wplc_log_user_on_page_insert_other_data_filter", "wplc_is_client_socket_enabled", 10, 1);
494
  /**
495
  * Checks if the user is socket enabled (ready to chat via a socket connection)
readme.txt CHANGED
@@ -220,6 +220,34 @@ It is highly recommended that you upgrade to WP Live Chat Support version 4.4.0
220
 
221
  == Changelog ==
222
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
223
  = 7.0.08 - 2017-06-08 - Low Priority =
224
  * Tested on WordPress 4.8
225
 
220
 
221
  == Changelog ==
222
 
223
+ = 7.1.00 - 2017-06-15 - Medium priority =
224
+ * Modernised the live chat box
225
+ * Fixed a bug that caused the wrong agent name to show up in the "typing" element after a chat was transferred
226
+ * Other minor bug fixes
227
+ * Added better support for caching systems (style sheets now have a version tag)
228
+ * Added additional support for the new features of the Cloud server
229
+ * Replaced all appropriate references of get_option('siteurl'); with site_url(); to embrace SSL where needed
230
+ * Images are now preloaded on the front end for a better user experience
231
+ * Fixed a fatal error found on some installations (https://github.com/CodeCabin/wp-live-chat-support/issues/329)
232
+ * Fixed a bug that cause the "Retry chat" to not work with the modern chat box
233
+ * Fixed a bug with the missed chat functionality - when an agent missed the chat, the chat ID would change and the agent would not be able to communicate with the visitor
234
+ * Fixed a bug with the listing of all missed chats
235
+ * Fixed a bug that sent pings to the node server when it was not necessary, causing an overload of the node server
236
+ * Fixed a bug that did not allow you to view the chat history of a missed chat
237
+ * Fixed a bug that caused the 'display name' and 'display avatar' to behave erratically
238
+ * Fixed a bug that caused the time and date display functionality to behave erratically
239
+ * Fixed a bug that caused a JavaScript error on the admin chat dashboard when a single visitor leaves the site
240
+ * Fixed a bug that caused the chat widow to appear before the chat circle when engaged in a chat and moving from page to page
241
+ * The visitor can now restart any chat that has been ended by an agent
242
+ * You can now customize the text "The chat has been ended by the operator"
243
+ * Fixed a bug that caused duplicate loading of messages
244
+ * When using a custom element to open the chat window, that element now has a cursor pointer styled to it by default
245
+ * Fixed a bug that incorrectly fired off ajax events when minimizing or maximizing the offline message box
246
+ * Fixed a bug that caused the offline message box to show up incorrectly after being dragged
247
+ * Fixed a bug that caused "maximize" notifications to not get sent through to agents when using the Node server
248
+ * Fixed a bug that did not allow single missed chats to be deleted
249
+ * Fixed a bug that caused the text input field to continually be focused on thereby causing issues
250
+
251
  = 7.0.08 - 2017-06-08 - Low Priority =
252
  * Tested on WordPress 4.8
253
 
wp-live-chat-support.php CHANGED
@@ -3,7 +3,7 @@
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: 7.0.08
7
  Author: WP-LiveChat
8
  Author URI: http://www.wp-livechat.com
9
  Text Domain: wplivechat
@@ -11,23 +11,54 @@
11
  */
12
 
13
  /**
14
- * 7.0.08 - 2017-06-08 - Low Priority
15
- * Tested on WordPress 4.8
16
- *
17
- * 7.0.07 - 2017-05-16 - Medium Priority
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  * You can now change the text of the offline message button
19
  * You can now change the text of the close chat button
20
  * Added a notification to the chat dashboard to help agents identify if the chat box is not showing up on the front end, and provide a reason
21
  * Added ability to set a default visitor name
22
  * Added ability to choose which user fields are required (name, email or both)
23
- * Added visual aid when new message is sent and chat is minimized (users side)
 
24
  * Fixed a bug that caused a sound to be played on every page load of a visitor
25
  * Fixed a bug that stopped a user from sending a message when the admin initiated a chat
26
  * Fixed the bug that showed the incorrect icon for IE
27
  * Fixed a bug that caused empty button without remove/delete icon in Missed Chats
28
  * Fixed a bug that caused attached images to not display correctly
29
  * Fixed a bug that caused notifications to show up in the front end when the agent is testing a chat with him or herself
30
- *
 
31
  * 7.0.06 -2017-03-13 - Low Priority
32
  * Enhancement: 'Open Chat' button changes to 'Chat Accepted' once a chat is active
33
  * Bug Fix: Compatibility bug fix for decryption in the Pro version
@@ -504,15 +535,23 @@ global $wplc_tblname_chats;
504
  global $wplc_tblname_msgs;
505
  global $wplc_tblname_offline_msgs;
506
 
 
 
 
 
 
 
 
 
507
  $wplc_tblname_offline_msgs = $wpdb->prefix . "wplc_offline_messages";
508
  $wplc_tblname_chats = $wpdb->prefix . "wplc_chat_sessions";
509
  $wplc_tblname_msgs = $wpdb->prefix . "wplc_chat_msgs";
510
- $wplc_version = "7.0.08";
511
 
512
  define('WPLC_BASIC_PLUGIN_DIR', dirname(__FILE__));
513
  define('WPLC_BASIC_PLUGIN_URL', plugins_url() . "/wp-live-chat-support/");
514
  global $wplc_basic_plugin_url;
515
- $wplc_basic_plugin_url = get_option('siteurl') . "/wp-content/plugins/wp-live-chat-support/";
516
 
517
 
518
  global $wplc_pro_version;
@@ -607,7 +646,9 @@ function wplc_version_control() {
607
 
608
 
609
  $admins = get_role('administrator');
610
- $admins->add_cap('wplc_ma_agent');
 
 
611
 
612
  $uid = get_current_user_id();
613
  update_user_meta($uid, 'wplc_ma_agent', 1);
@@ -901,11 +942,10 @@ function wplc_api_keys_menu() {
901
  }
902
 
903
 
904
- add_action("init","wplc_load_user_js",999);
905
 
906
 
907
  function wplc_load_user_js () {
908
-
909
  if (!is_admin()) {
910
  if (in_array($GLOBALS['pagenow'], array('wp-login.php', 'wp-register.php'))) {
911
  return false;
@@ -923,7 +963,6 @@ function wplc_load_user_js () {
923
  } else {
924
  $user_banned = 0;
925
  }
926
-
927
  $display_contents = apply_filters("wplc_filter_display_contents",$display_contents);
928
 
929
  if($display_contents && $user_banned == 0){
@@ -979,6 +1018,8 @@ function wplc_push_js_to_front_basic() {
979
  wp_enqueue_script('jquery');
980
 
981
  $wplc_settings = get_option("WPLC_SETTINGS");
 
 
982
 
983
  if (isset($wplc_settings['wplc_display_to_loggedin_only']) && $wplc_settings['wplc_display_to_loggedin_only'] == 1) {
984
  /* Only show to users that are logged in */
@@ -987,9 +1028,9 @@ function wplc_push_js_to_front_basic() {
987
  }
988
  }
989
 
990
- if ($wplc_settings["wplc_settings_enabled"] == 2) {
991
- return;
992
- }
993
  wp_register_script('wplc-md5', plugins_url('/js/md5.js', __FILE__),array('wplc-user-script'),$wplc_version);
994
  wp_enqueue_script('wplc-md5');
995
  if (isset($wplc_settings['wplc_display_name']) && $wplc_settings['wplc_display_name'] == 1) {
@@ -997,11 +1038,9 @@ function wplc_push_js_to_front_basic() {
997
  } else {
998
  $wplc_display = 'hide';
999
  }
1000
- if (isset($wplc_settings['wplc_enable_msg_sound']) && intval($wplc_settings['wplc_enable_msg_sound']) == 1) {
1001
- $wplc_ding = '1';
1002
- } else {
1003
- $wplc_ding = '0';
1004
- }
1005
 
1006
  $ajax_nonce = wp_create_nonce("wplc");
1007
  if (!function_exists("wplc_register_pro_version")) {
@@ -1027,6 +1066,8 @@ function wplc_push_js_to_front_basic() {
1027
 
1028
  }
1029
 
 
 
1030
 
1031
  wp_register_script('wplc-user-script', plugins_url('/js/wplc_u.js', __FILE__),array('jquery', 'wplc-server-script'),$wplc_version);
1032
  /**
@@ -1068,12 +1109,12 @@ function wplc_push_js_to_front_basic() {
1068
  if(class_exists("WP_REST_Request")) {
1069
  wp_localize_script('wplc-user-script', 'wplc_restapi_enabled', '1');
1070
  wp_localize_script('wplc-user-script', 'wplc_restapi_token', get_option('wplc_api_secret_token'));
1071
- wp_localize_script('wplc-user-script', 'wplc_restapi_endpoint', get_option('siteurl').'/wp-json/wp_live_chat_support/v1');
1072
  } else {
1073
  wp_localize_script('wplc-user-script', 'wplc_restapi_enabled', '0');
1074
  }
1075
 
1076
- $wplc_ga_enabled = get_option("WPLC_GA_SETTINGS");
1077
  if (isset($wplc_ga_enabled['wplc_enable_ga']) && $wplc_ga_enabled['wplc_enable_ga'] == '1') {
1078
  wp_localize_script('wplc-user-script', 'wplc_enable_ga', '1');
1079
  }
@@ -1091,31 +1132,49 @@ function wplc_push_js_to_front_basic() {
1091
 
1092
  $wplc_display = false;
1093
 
1094
- $wplc_settings = get_option("WPLC_SETTINGS");
 
 
 
 
 
 
 
 
 
 
 
 
 
1095
 
1096
- if( isset($wplc_settings['wplc_show_name']) && $wplc_settings['wplc_show_name'] == '1' ){
1097
- $wplc_show_name = true;
1098
-
1099
- } else {
1100
- $wplc_show_name = false;
1101
- }
1102
- if( isset($wplc_settings['wplc_show_avatar']) && $wplc_settings['wplc_show_avatar'] ){
1103
- $wplc_show_avatar = true;
1104
- } else {
1105
- $wplc_show_avatar = false;
1106
- }
1107
- $wplc_chat_detail = array( 'name' => $wplc_show_name, 'avatar' => $wplc_show_avatar );
1108
  if( $wplc_display !== FALSE && $wplc_display !== 'hide' ){
1109
  wp_localize_script('wplc-user-script', 'wplc_display_name', $wplc_display);
1110
  } else {
1111
  wp_localize_script( 'wplc-user-script', 'wplc_show_chat_detail', $wplc_chat_detail );
1112
  }
1113
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1114
  $wplc_error_messages = array(
1115
  'valid_name' => __( "Please enter your name", "wplivechat" ),
1116
  'valid_email' => __( "Please enter your email address", "wplivechat" ),
1117
  'server_connection_lost' => __("Connection to server lost. Please reload this page. Error: ", "wplivechat"),
1118
- 'chat_ended_by_operator' => __("The chat has been ended by the operator", "wplivechat"),
1119
  'empty_message' => __( "Please enter a message", "wplivechat" ),
1120
 
1121
  );
@@ -1135,26 +1194,19 @@ function wplc_push_js_to_front_basic() {
1135
 
1136
  wp_localize_script('wplc-user-script', 'wplc_offline_msg', stripslashes($wplc_settings['wplc_pro_offline2']));
1137
  wp_localize_script('wplc-user-script', 'wplc_offline_msg3',stripslashes($wplc_settings['wplc_pro_offline3']));
 
1138
 
1139
- $wplc_acbc_data = get_option("WPLC_ACBC_SETTINGS");
1140
 
1141
  if( isset( $wplc_acbc_data['wplc_use_wp_name'] ) && $wplc_acbc_data['wplc_use_wp_name'] == '1' ){
1142
-
1143
  if( isset( $_COOKIE['wplc_cid'] ) ){
1144
  $chat_data = wplc_get_chat_data( $_COOKIE['wplc_cid'] );
1145
-
1146
  $user_info = get_userdata( intval( $chat_data->agent_id ) );
1147
-
1148
  if( $user_info ){
1149
-
1150
  $agent = $user_info->display_name;
1151
-
1152
- } else {
1153
-
1154
  $agent = "agent";
1155
-
1156
  }
1157
-
1158
  } else {
1159
  $agent = 'agent';
1160
  }
@@ -1167,16 +1219,17 @@ function wplc_push_js_to_front_basic() {
1167
  }
1168
  }
1169
  wp_localize_script('wplc-user-script', 'wplc_localized_string_is_typing', $agent . __(" is typing...","wplivechat"));
 
1170
 
1171
 
1172
- if(isset($wplc_settings['wplc_elem_trigger_id']) && trim($wplc_settings['wplc_elem_trigger_id']) !== "") {
1173
- if(isset($wplc_settings['wplc_elem_trigger_action'])){
1174
- wp_localize_script('wplc-user-script', 'wplc_elem_trigger_action',stripslashes($wplc_settings['wplc_elem_trigger_action']));
1175
  }
1176
- if(isset($wplc_settings['wplc_elem_trigger_type'])){
1177
- wp_localize_script('wplc-user-script', 'wplc_elem_trigger_type',stripslashes($wplc_settings['wplc_elem_trigger_type']));
1178
  }
1179
- wp_localize_script('wplc-user-script', 'wplc_elem_trigger_id',stripslashes($wplc_settings['wplc_elem_trigger_id']));
1180
  }
1181
 
1182
  $extra_data_array = array("object_switch" => true);
@@ -1211,6 +1264,25 @@ if (function_exists('wplc_pro_user_top_js')) {
1211
 
1212
  }
1213
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1214
  function wplc_user_top_js() {
1215
 
1216
  if(function_exists('wplc_display_chat_contents')){
@@ -1375,7 +1447,9 @@ function wplc_hook_control_show_chat_box($cid) {
1375
  if (function_exists("wplc_pro_version_control")) {
1376
  global $wplc_pro_version;
1377
  if (intval(str_replace(".","",$wplc_pro_version)) < 5100) {
 
1378
  echo wplc_output_box_ajax();
 
1379
  } else {
1380
  echo wplc_output_box_ajax_new($cid);
1381
  }
@@ -1443,10 +1517,10 @@ function wplc_filter_control_live_chat_box_html_main_div_top($wplc_settings,$log
1443
 
1444
  if ($wplc_settings["wplc_settings_align"] == 1) {
1445
  $original_pos = "bottom_left";
1446
- $wplc_box_align = "left:100px; bottom:0px;";
1447
  } else if ($wplc_settings["wplc_settings_align"] == 2) {
1448
  $original_pos = "bottom_right";
1449
- $wplc_box_align = "right:100px; bottom:0px;";
1450
  } else if ($wplc_settings["wplc_settings_align"] == 3) {
1451
  $original_pos = "left";
1452
  $wplc_box_align = "left:0; bottom:100px;";
@@ -1468,21 +1542,21 @@ function wplc_filter_control_live_chat_box_html_main_div_top($wplc_settings,$log
1468
  }
1469
 
1470
  if (isset($wplc_settings['wplc_newtheme']) && $wplc_settings['wplc_newtheme'] == "theme-2") {
1471
- $hovercard_content = "<div class='wplc_hovercard_content_left'>".apply_filters("wplc_filter_modern_theme_hovercard_content_left","")."</div><div class='wplc_hovercard_content_right'>".apply_filters("wplc_filter_live_chat_box_html_1st_layer",wplc_filter_control_live_chat_box_html_1st_layer($wplc_settings,$logged_in,$wplc_using_locale))."</div>";
1472
  $hovercard_content = apply_filters("wplc_filter_hovercard_content", $hovercard_content);
1473
 
1474
  $ret_msg .= "<div id='wplc_hovercard' style='display:none' class='".$wplc_theme_type."'>";
1475
- $ret_msg .= "<div id='wplc_hovercard_min' class='wplc_button_standard wplc-color-border-1 wplc-color-bg-1'>".stripslashes( $wplc_settings['wplc_close_btn_text'] )."</div>";
1476
  $ret_msg .= "<div id='wplc_hovercard_content'>".apply_filters("wplc_filter_live_chat_box_pre_layer1","").$hovercard_content."</div>";
1477
  $ret_msg .= "<div id='wplc_hovercard_bottom'>".apply_filters("wplc_filter_hovercard_bottom_before","").apply_filters("wplc_filter_live_chat_box_hover_html_start_chat_button","",$wplc_settings,$logged_in,$wplc_using_locale)."</div>";
1478
  $ret_msg .= "</div>";
1479
 
1480
  } else if (isset($wplc_settings['wplc_newtheme']) && $wplc_settings['wplc_newtheme'] == "theme-1"){
1481
- $hovercard_content = "<div class='wplc_hovercard_content_right'>".apply_filters("wplc_filter_live_chat_box_html_1st_layer",wplc_filter_control_live_chat_box_html_1st_layer($wplc_settings,$logged_in,$wplc_using_locale, "wplc-color-4"))."</div>";
1482
  $hovercard_content = apply_filters("wplc_filter_hovercard_content", $hovercard_content);
1483
 
1484
  $ret_msg .= "<div id='wplc_hovercard' style='display:none' class='".$wplc_theme_type."'>";
1485
- $ret_msg .= "<div id='wplc_hovercard_min' class='wplc_button_standard wplc-color-border-1 wplc-color-bg-1'>".__("close", "wplivechat")."</div>";
1486
  $ret_msg .= "<div id='wplc_hovercard_content'>".apply_filters("wplc_filter_live_chat_box_pre_layer1","").$hovercard_content."</div>";
1487
  $ret_msg .= "<div id='wplc_hovercard_bottom'>".apply_filters("wplc_filter_hovercard_bottom_before","").apply_filters("wplc_filter_live_chat_box_hover_html_start_chat_button","",$wplc_settings,$logged_in,$wplc_using_locale)."</div>";
1488
  $ret_msg .= "</div>";
@@ -1526,22 +1600,15 @@ function wplc_filter_control_live_chat_box_html_header_div_top($wplc_settings) {
1526
 
1527
  add_filter("wplc_filter_chat_header_under","wplc_filter_control_chat_header_under",1,2);
1528
  function wplc_filter_control_chat_header_under($ret_msg,$wplc_settings) {
1529
- if (isset($wplc_settings['wplc_newtheme']) && $wplc_settings['wplc_newtheme'] == "theme-2") {
1530
-
1531
- // Serve the icon up over HTTPS if needs be
1532
- $icon = plugins_url('images/chaticon.png', __FILE__);
1533
- if( isset( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] ){
1534
- $icon = preg_replace('/^http:\/\//', 'https:\/\/', $icon);
1535
  }
1536
- $icon = apply_filters("wplc_filter_chaticon",$icon);
1537
 
1538
- $ret_msg .= "<style>#wp-live-chat-header { background:url('$icon') no-repeat; background-size: cover; }</style>";
1539
- if (function_exists("wplc_acbc_filter_control_chat_header_under")) {
1540
- remove_filter("wplc_filter_chat_header_under","wplc_acbc_filter_control_chat_header_under");
1541
- }
1542
-
1543
- }
1544
- return $ret_msg;
1545
 
1546
  }
1547
 
@@ -1593,11 +1660,11 @@ function wplc_filter_control_live_chat_box_html_ask_user_detail($wplc_settings)
1593
  $ret_msg .= apply_filters( "wplc_start_chat_user_form_after_filter", "" );
1594
 
1595
  } elseif (isset($wplc_settings['wplc_require_user_info']) && $wplc_settings['wplc_require_user_info'] == 'email') {
1596
- $ret_msg .= "<div style=\"padding: 7px; text-align: center;\">";
1597
  if (isset($wplc_settings['wplc_user_alternative_text'])) {
1598
  $ret_msg .= html_entity_decode( stripslashes($wplc_settings['wplc_user_alternative_text']) );
1599
  }
1600
- $ret_msg .= '</div>';
1601
 
1602
  $wplc_random_user_number = rand(0, 9) . rand(0, 9) . rand(0, 9) . rand(0, 9) . rand(0, 9) . rand(0, 9);
1603
  if ($wplc_loggedin_user_name != '') { $wplc_lin = $wplc_loggedin_user_name; } else { $wplc_lin = 'user' . $wplc_random_user_number; }
@@ -1605,11 +1672,12 @@ function wplc_filter_control_live_chat_box_html_ask_user_detail($wplc_settings)
1605
  $ret_msg .= "<input type=\"text\" name=\"wplc_email\" id=\"wplc_email\" wplc_hide=\"0\" value=\"" . $wplc_loggedin_user_email . "\" placeholder=\"" . __( "Email", "wplivechat" ) . "\" />";
1606
  $ret_msg .= apply_filters("wplc_start_chat_user_form_after_filter", "");
1607
  } elseif (isset($wplc_settings['wplc_require_user_info']) && $wplc_settings['wplc_require_user_info'] == 'name') {
 
1608
  $ret_msg .= "<div style=\"padding: 7px; text-align: center;\">";
1609
  if (isset($wplc_settings['wplc_user_alternative_text'])) {
1610
  $ret_msg .= html_entity_decode( stripslashes($wplc_settings['wplc_user_alternative_text']) );
1611
  }
1612
- $ret_msg .= '</div>';
1613
 
1614
  $wplc_random_user_number = rand(0, 9) . rand(0, 9) . rand(0, 9) . rand(0, 9) . rand(0, 9) . rand(0, 9);
1615
  if ($wplc_loggedin_user_email != '' && $wplc_loggedin_user_email != null) { $wplc_lie = $wplc_loggedin_user_email; } else { $wplc_lie = $wplc_random_user_number . '@' . $wplc_random_user_number . '.com'; }
@@ -1618,11 +1686,12 @@ function wplc_filter_control_live_chat_box_html_ask_user_detail($wplc_settings)
1618
  $ret_msg .= apply_filters("wplc_start_chat_user_form_after_filter", "");
1619
  } else {
1620
  //Dont ask the user
 
1621
  $ret_msg .= "<div style=\"padding: 7px; text-align: center;\">";
1622
  if (isset($wplc_settings['wplc_user_alternative_text'])) {
1623
  $ret_msg .= html_entity_decode( stripslashes($wplc_settings['wplc_user_alternative_text']) );
1624
  }
1625
- $ret_msg .= '</div>';
1626
 
1627
  $wplc_random_user_number = rand(0, 9) . rand(0, 9) . rand(0, 9) . rand(0, 9) . rand(0, 9) . rand(0, 9);
1628
  //$wplc_loggedin_user_email = $wplc_random_user_number."@".$wplc_random_user_number.".com";
@@ -1737,7 +1806,7 @@ if (isset($wplc_settings['wplc_theme'])) { $wplc_theme = $wplc_settings['wplc_th
1737
  $wplc_settings_font = "#FFFFFF";
1738
  }
1739
  }
1740
- $ret_msg = "<input id=\"wplc_na_msg_btn\" type=\"button\" value=\"".stripslashes($wplc_settings['wplc_pro_offline_btn_send'])."\" style=\"background-color: ".$wplc_settings_fill." !important; color: ".$wplc_settings_font." !important;\"/>";
1741
  return $ret_msg;
1742
  }
1743
 
@@ -1751,18 +1820,19 @@ if (isset($wplc_settings['wplc_theme'])) { $wplc_theme = $wplc_settings['wplc_th
1751
  * @since 6.0.00
1752
  * @author Nick Duncan <nick@codecabin.co.za>
1753
  */
1754
- function wplc_filter_control_live_chat_box_html_2nd_layer($wplc_settings,$logged_in,$wplc_using_locale) {
 
1755
  if ($logged_in) {
1756
  $wplc_intro = __('Hello. Please input your details so that I may help you.', 'wplivechat');
1757
  if (!isset($wplc_settings['wplc_pro_intro']) || $wplc_settings['wplc_pro_intro'] == "") { $wplc_settings['wplc_pro_intro'] = $wplc_intro; }
1758
  $text = ($wplc_using_locale ? $wplc_intro : stripslashes($wplc_settings['wplc_pro_intro']));
1759
 
1760
  $ret_msg = "<div id=\"wp-live-chat-2-inner\">";
1761
- $ret_msg .= " <div id=\"wp-live-chat-2-info\" class='wplc-color-bg-2 wplc-color-4'>";
1762
- $ret_msg .= " <strong>".$text."</strong>";
1763
  $ret_msg .= " </div>";
1764
  $ret_msg .= apply_filters("wplc_filter_live_chat_box_html_ask_user_details",wplc_filter_control_live_chat_box_html_ask_user_detail($wplc_settings));
1765
- $ret_msg .= apply_filters("wplc_filter_live_chat_box_html_start_chat_button",wplc_filter_control_live_chat_box_html_start_chat_button($wplc_settings,$wplc_using_locale ));
1766
  $ret_msg .= "</div>";
1767
  } else {
1768
  if ( isset( $wplc_settings['wplc_loggedin_user_info'] ) && $wplc_settings['wplc_loggedin_user_info'] == 1 ) {
@@ -1795,7 +1865,7 @@ function wplc_filter_control_live_chat_box_html_2nd_layer($wplc_settings,$logged
1795
  $wplc_offline = __("We are currently offline. Please leave a message and we'll get back to you shortly.", "wplivechat");
1796
  $text = ($wplc_using_locale ? $wplc_offline : stripslashes($wplc_settings['wplc_pro_offline1']));
1797
 
1798
- $ret_msg = "<div id=\"wp-live-chat-2-info\">";
1799
  $ret_msg .= $text;
1800
  $ret_msg .= "</div>";
1801
  $ret_msg .= "<div id=\"wplc_message_div\">";
@@ -1812,7 +1882,7 @@ function wplc_filter_control_live_chat_box_html_2nd_layer($wplc_settings,$logged
1812
  if(isset($wplc_settings['wplc_record_ip_address']) && $wplc_settings['wplc_record_ip_address'] == 1) { $offline_ip_address = $ip_address; } else { $offline_ip_address = ""; }
1813
 
1814
  $ret_msg .= "<input type=\"hidden\" name=\"wplc_ip_address\" id=\"wplc_ip_address\" value=\"".$offline_ip_address."\" />";
1815
- $ret_msg .= "<input type=\"hidden\" name=\"wplc_domain_offline\" id=\"wplc_domain_offline\" value=\"".get_option('siteurl')."\" />";
1816
  $ret_msg .= apply_filters("wplc_filter_live_chat_box_html_send_offline_message_button",wplc_filter_control_live_chat_box_html_send_offline_message_button($wplc_settings));
1817
  $ret_msg .= "</div>";
1818
 
@@ -1854,10 +1924,61 @@ function wplc_filter_control_live_chat_box_html_3rd_layer($wplc_settings,$wplc_u
1854
  }
1855
 
1856
 
1857
- add_filter("wplc_filter_live_chat_box_above_main_div","wplc_filter_control_live_chat_box_above_main_div",10,2);
1858
- function wplc_filter_control_live_chat_box_above_main_div($msg,$wplc_settings) {
1859
  if (isset($wplc_settings['wplc_newtheme']) && $wplc_settings['wplc_newtheme'] == "theme-2") {
1860
- $msg .= "<div id='wplc_chatbox_header' class='wplc-color-bg-2 wplc-color-4'></div>";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1861
 
1862
  }
1863
  return $msg;
@@ -1870,7 +1991,7 @@ function wplc_filter_control_live_chat_box_above_main_div($msg,$wplc_settings) {
1870
  * @since 6.0.00
1871
  * @author Nick Duncan <nick@codecabin.co.za>
1872
  */
1873
- function wplc_filter_control_live_chat_box_html_4th_layer($wplc_settings,$wplc_using_locale ) {
1874
  $wplc_enter = __('Connecting. Please be patient...', 'wplivechat');
1875
  if (!isset($wplc_settings['wplc_user_enter']) || $wplc_settings['wplc_user_enter'] == "") { $wplc_settings['wplc_pro_sst2'] = $wplc_enter; }
1876
  $text = ($wplc_using_locale ? $wplc_enter : stripslashes($wplc_settings['wplc_user_enter']));
@@ -1889,7 +2010,7 @@ function wplc_filter_control_live_chat_box_html_4th_layer($wplc_settings,$wplc_u
1889
  }
1890
  $ret_msg .= "<div id=\"wplc_sound_update\" style=\"height:0; width:0; display:none; border:0;\"></div>";
1891
 
1892
- $ret_msg .= apply_filters("wplc_filter_live_chat_box_above_main_div","",$wplc_settings);
1893
 
1894
 
1895
  $ret_msg .= "<div id=\"wplc_chatbox\">";
@@ -1908,7 +2029,8 @@ function wplc_filter_control_live_chat_box_html_4th_layer($wplc_settings,$wplc_u
1908
  $ret_msg .= apply_filters("wplc_filter_chat_text_editor","");
1909
 
1910
  $ret_msg .= "<p>";
1911
- $ret_msg .= "<input type=\"text\" name=\"wplc_chatmsg\" id=\"wplc_chatmsg\" value=\"\" />";
 
1912
  if (isset($wplc_settings['wplc_newtheme']) && $wplc_settings['wplc_newtheme'] == 'theme-2') {
1913
  $ret_msg .= apply_filters("wplc_filter_typing_control_div_theme_2","");
1914
  }
@@ -2040,8 +2162,13 @@ function wplc_output_box_ajax_new($cid = null) {
2040
 
2041
  $logged_in = apply_filters("wplc_loggedin_filter",false);
2042
 
2043
- $wplc_settings = get_option('WPLC_SETTINGS');
2044
- $ret_msg['cbox'] = apply_filters("wplc_theme_control",$wplc_settings,$logged_in,$wplc_using_locale);
 
 
 
 
 
2045
  $ret_msg['online'] = $logged_in;
2046
 
2047
  global $wplc_pro_version;
@@ -2051,8 +2178,57 @@ function wplc_output_box_ajax_new($cid = null) {
2051
  if ($cid !== null) {
2052
  $chat_data = wplc_get_chat_data( $cid );
2053
  wplc_record_chat_notification('user_loaded',$cid,array('uri' => $_SERVER['HTTP_REFERER'], 'chat_data' => $chat_data ));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2054
  }
2055
 
 
2056
  if (function_exists("wplc_pro_version_control")) {
2057
  if ($checker < 6000) {
2058
  /* backwards compatibilitty for the old pro version */
@@ -2071,20 +2247,20 @@ function wplc_output_box_ajax_new($cid = null) {
2071
 
2072
 
2073
  }
2074
- function wplc_return_default_theme($wplc_settings,$logged_in,$wplc_using_locale) {
2075
  $ret_msg = apply_filters("wplc_filter_live_chat_box_html_main_div_top",wplc_filter_control_live_chat_box_html_main_div_top($wplc_settings,$logged_in,$wplc_using_locale));
2076
  $ret_msg .= "<div class=\"wp-live-chat-wraper\">";
2077
  $ret_msg .= apply_filters("wplc_filter_live_chat_box_html_header_div_top",wplc_filter_control_live_chat_box_html_header_div_top($wplc_settings));
2078
  $ret_msg .= " <i id=\"wp-live-chat-minimize\" class=\"fa fa-minus wplc-color-bg-2 wplc-color-1\" style=\"display:none;\"></i>";
2079
  $ret_msg .= " <i id=\"wp-live-chat-close\" class=\"fa fa-times\" style=\"display:none;\" ></i>";
2080
  $ret_msg .= " <div id=\"wp-live-chat-1\" >";
2081
- $ret_msg .= apply_filters("wplc_filter_live_chat_box_html_1st_layer",wplc_filter_control_live_chat_box_html_1st_layer($wplc_settings,$logged_in,$wplc_using_locale));
2082
  $ret_msg .= " </div>";
2083
  $ret_msg .= '<div id="wplc-chat-alert" class="wplc-chat-alert wplc-chat-alert--' . $wplc_settings["wplc_theme"] . '"></div>';
2084
  $ret_msg .= " </div>";
2085
  $ret_msg .= " <div id=\"wp-live-chat-2\" style=\"display:none;\">";
2086
  $ret_msg .= apply_filters("wplc_filter_live_chat_box_survey","");
2087
- $ret_msg .= apply_filters("wplc_filter_live_chat_box_html_2nd_layer",wplc_filter_control_live_chat_box_html_2nd_layer($wplc_settings,$logged_in,$wplc_using_locale));
2088
  $ret_msg .= " </div>";
2089
  $ret_msg .= " <div id=\"wp-live-chat-3\" style=\"display:none;\">";
2090
  $ret_msg .= apply_filters("wplc_filter_live_chat_box_html_3rd_layer",wplc_filter_control_live_chat_box_html_3rd_layer($wplc_settings,$wplc_using_locale));
@@ -2092,24 +2268,24 @@ function wplc_return_default_theme($wplc_settings,$logged_in,$wplc_using_locale)
2092
  $ret_msg .= " <div id=\"wp-live-chat-react\" style=\"display:none;\">";
2093
  $ret_msg .= " <p>".__("Reactivating your previous chat...", "wplivechat")."</p>";
2094
  $ret_msg .= " </div>";
2095
- $ret_msg .= " <div id=\"wp-live-chat-4\" style=\"display:none;\">";
2096
- $ret_msg .= apply_filters("wplc_filter_live_chat_box_html_4th_layer",wplc_filter_control_live_chat_box_html_4th_layer($wplc_settings,$wplc_using_locale));
2097
- $ret_msg .= "</div>";
2098
  $ret_msg .= " <div id=\"wplc-extra-div\" style=\"display:none;\">";
2099
  $ret_msg .= apply_filters("wplc_filter_wplc_extra_div","",$wplc_settings,$wplc_using_locale);
2100
  $ret_msg .= "</div>";
2101
  $ret_msg .= "</div>";
 
 
 
2102
  return $ret_msg;
2103
  }
2104
 
2105
 
2106
- add_filter("wplc_theme_control","wplc_theme_control_function",10,3);
2107
- function wplc_theme_control_function($wplc_settings,$logged_in,$wplc_using_locale) {
2108
 
2109
  if (!$wplc_settings) { return ""; }
2110
  if (isset($wplc_settings['wplc_newtheme'])) { $wplc_newtheme = $wplc_settings['wplc_newtheme']; } else { }
2111
 
2112
- $default_theme = wplc_return_default_theme($wplc_settings,$logged_in,$wplc_using_locale);
2113
  if (isset($wplc_newtheme)) {
2114
 
2115
 
@@ -2129,29 +2305,30 @@ function wplc_theme_control_function($wplc_settings,$logged_in,$wplc_using_local
2129
  $ret_msg .= " </div>";
2130
  $ret_msg .= '<div id="wplc-chat-alert" class="wplc-chat-alert wplc-chat-alert--' . $wplc_settings["wplc_theme"] . '"></div>';
2131
  $ret_msg .= " <div id=\"wp-live-chat-2\" style=\"display:none;\">";
2132
- $ret_msg .= " <i id=\"wp-live-chat-minimize\" class=\"fa fa-minus wplc-color-bg-1 wplc-color-2\" style=\"display:none;\" ></i>";
2133
- $ret_msg .= " <i id=\"wp-live-chat-close\" class=\"fa fa-times\" style=\"display:none;\" ></i>";
2134
- $ret_msg .= " <div id=\"wplc-extra-div\" style=\"display:none;\">";
2135
- $ret_msg .= apply_filters("wplc_filter_wplc_extra_div","",$wplc_settings,$wplc_using_locale);
2136
- $ret_msg .= "</div>";
2137
- $ret_msg .= " <div id='wp-live-chat-inner-container'>";
2138
- $ret_msg .= " <div id='wp-live-chat-inner'>";
2139
- $ret_msg .= " <div id=\"wp-live-chat-1\" >";
2140
- $ret_msg .= apply_filters("wplc_filter_live_chat_box_html_1st_layer",wplc_filter_control_live_chat_box_html_1st_layer($wplc_settings,$logged_in,$wplc_using_locale));
2141
- $ret_msg .= " </div>";
2142
- $ret_msg .= apply_filters("wplc_filter_live_chat_box_html_2nd_layer",wplc_filter_control_live_chat_box_html_2nd_layer($wplc_settings,$logged_in,$wplc_using_locale));
2143
- $ret_msg .= " </div>";
2144
- $ret_msg .= " <div id=\"wp-live-chat-react\" style=\"display:none;\">";
2145
- $ret_msg .= " <p>".__("Reactivating your previous chat...", "wplivechat")."</p>";
2146
- $ret_msg .= " </div>";
2147
- $ret_msg .= " </div>";
2148
  $ret_msg .= " <div id=\"wp-live-chat-3\" style=\"display:none;\">";
2149
- $ret_msg .= apply_filters("wplc_filter_live_chat_box_html_3rd_layer",wplc_filter_control_live_chat_box_html_3rd_layer($wplc_settings,$wplc_using_locale));
2150
  $ret_msg .= " </div>";
 
2151
  $ret_msg .= " <div id=\"wp-live-chat-4\" style=\"display:none;\">";
2152
- $ret_msg .= apply_filters("wplc_filter_live_chat_box_html_4th_layer",wplc_filter_control_live_chat_box_html_4th_layer($wplc_settings,$wplc_using_locale));
2153
  $ret_msg .= " </div>";
2154
- $ret_msg .= " </div>";
2155
  $ret_msg .= "</div>";
2156
 
2157
  } else {
@@ -2346,8 +2523,64 @@ function wplc_hook_control_superadmin_head() {
2346
  }
2347
  }
2348
 
 
2349
  function wplc_superadmin_javascript() {
2350
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2351
  if (isset($_GET['page']) && ($_GET['page'] == 'wplivechat-menu' || $_GET['page'] == 'wplivechat-menu-settings' || $_GET['page'] == 'wplivechat-menu-offline-messages' || $_GET['page'] == 'wplc-pro-custom-fields' ) ) {
2352
 
2353
  if (!isset($_GET['action'])) {
@@ -2358,10 +2591,15 @@ function wplc_superadmin_javascript() {
2358
  }
2359
  do_action("wplc_hook_admin_javascript");
2360
  } // main page
2361
- else if ( isset($_GET['action']) && ( $_GET['action'] != 'welcome' && $_GET['action'] != 'credits' ) ) {
2362
  if (function_exists("wplc_register_pro_version")) {
2363
  wplc_return_pro_admin_chat_javascript(sanitize_text_field($_GET['cid']));
2364
  } else {
 
 
 
 
 
2365
  wplc_return_admin_chat_javascript(sanitize_text_field($_GET['cid']));
2366
 
2367
 
@@ -2405,42 +2643,76 @@ function wplc_superadmin_javascript() {
2405
  * @author Nick Duncan <nick@codecabin.co.za>
2406
  */
2407
  function wplc_admin_javascript() {
2408
- $ajax_nonce = wp_create_nonce("wplc");
2409
- global $wplc_version;
2410
 
2411
- $wplc_current_user = get_current_user_id();
2412
- if( get_user_meta( $wplc_current_user, 'wplc_ma_agent', true )) {
 
 
 
 
 
 
 
 
 
 
 
2413
 
2414
- wp_register_script('wplc-admin-js', plugins_url('js/wplc_u_admin.js', __FILE__), false, $wplc_version, false);
2415
- wp_enqueue_script('wplc-admin-js');
2416
- $not_icon = plugins_url('/images/wplc_notification_icon.png', __FILE__);
2417
 
2418
- $wplc_wav_file = plugins_url('/ring.wav', __FILE__);
2419
- $wplc_wav_file = apply_filters("wplc_filter_wav_file",$wplc_wav_file);
2420
- wp_localize_script('wplc-admin-js', 'wplc_wav_file', $wplc_wav_file);
2421
 
2422
- wp_localize_script('wplc-admin-js', 'wplc_ajax_nonce', $ajax_nonce);
2423
 
2424
- wp_localize_script('wplc-admin-js', 'wplc_notification_icon', $not_icon);
2425
 
2426
- $extra_data = apply_filters("wplc_filter_admin_javascript",array());
2427
- wp_localize_script('wplc-admin-js', 'wplc_extra_data', $extra_data);
2428
 
2429
- $ajax_url = admin_url('admin-ajax.php');
2430
- $wplc_ajax_url = apply_filters("wplc_filter_ajax_url",$ajax_url);
2431
- wp_localize_script('wplc-admin-js', 'wplc_ajaxurl', $wplc_ajax_url);
2432
- wp_localize_script('wplc-admin-js', 'wplc_ajaxurl_home', admin_url( 'admin-ajax.php' ) );
 
 
 
 
 
 
2433
 
2434
- $wpc_ma_js_strings = array(
2435
- 'remove_agent' => __('Remove', 'wplivechat'),
2436
- 'nonce' => wp_create_nonce("wplc"),
2437
- 'user_id' => get_current_user_id()
2438
- );
2439
- wp_localize_script('wplc-admin-js', 'wplc_admin_strings', $wpc_ma_js_strings);
2440
 
2441
- }
2442
-
 
 
 
 
 
 
 
 
 
 
 
 
 
2443
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2444
  }
2445
 
2446
  function wplc_admin_menu_layout() {
@@ -2606,6 +2878,22 @@ function wplc_admin_menu_layout_display() {
2606
 
2607
  <p><?php _e("Please note: This window must be open in order to receive new chat notifications.", "wplivechat"); ?></p>
2608
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2609
 
2610
  <div id="wplc_sound"></div>
2611
 
@@ -2647,7 +2935,7 @@ function wplc_admin_menu_layout_display() {
2647
 
2648
  </div>
2649
  </div>
2650
-
2651
 
2652
 
2653
 
@@ -2702,8 +2990,8 @@ function wplc_admin_menu_layout_display() {
2702
  }
2703
  }
2704
 
2705
- add_action("wplc_hook_change_status_on_answer","wplc_hook_control_change_status_on_answer",10,1);
2706
- function wplc_hook_control_change_status_on_answer($get_data) {
2707
 
2708
  $user_ID = get_current_user_id();
2709
  wplc_change_chat_status(sanitize_text_field($get_data['cid']), 3,$user_ID );
@@ -2713,37 +3001,103 @@ function wplc_hook_control_change_status_on_answer($get_data) {
2713
 
2714
  add_action('wplc_hook_accept_chat','wplc_hook_control_accept_chat',10,2);
2715
  function wplc_hook_control_accept_chat($get_data,$aid) {
2716
- do_action("wplc_hook_change_status_on_answer",$get_data);
2717
 
2718
-
2719
- do_action("wplc_hook_accept_chat_url",$get_data);
 
 
 
 
 
 
 
 
 
 
2720
 
2721
- if (function_exists("wplc_register_pro_version")) {
2722
- wplc_pro_draw_chat_area(sanitize_text_field($get_data['cid']));
2723
- } else {
2724
- do_action("wplc_hook_draw_chat_area",$get_data);
2725
 
2726
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2727
 
2728
 
2729
  }
2730
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2731
 
2732
  add_action("wplc_hook_chat_dashboard_bottom","wplc_hook_control_app_chat_dashboard_bottom",10);
2733
  function wplc_hook_control_app_chat_dashboard_bottom() {
2734
  //echo "<p>Tired of logging in to accept chats? Use our <a href='https://wp-livechat.com/extensions/mobile-desktop-app-extension/?utm_source=plugin&utm_medium=plugin&utm_campaign=main_app' target='_BLANK'>Android app</a> or <a href='https://wp-livechat.com/extensions/mobile-desktop-app-extension/?utm_source=plugin&utm_medium=plugin&utm_campaign=main_desktop' target='_BLANK'>desktop app</a> to monitor visitors, accept and initiate chats.</p>";
2735
  }
2736
 
2737
- add_action("wplc_hook_draw_chat_area","wplc_hook_control_draw_chat_area",10,1);
2738
- function wplc_hook_control_draw_chat_area($get_data) {
2739
 
2740
- wplc_draw_chat_area(sanitize_text_field($get_data['cid']));
2741
  }
2742
 
2743
- function wplc_draw_chat_area($cid) {
2744
 
2745
  global $wpdb;
2746
  global $wplc_tblname_chats;
 
2747
  $results = $wpdb->get_results(
2748
  "
2749
  SELECT *
@@ -2753,7 +3107,11 @@ function wplc_draw_chat_area($cid) {
2753
  "
2754
  );
2755
  if ($results) { } else { $results[0] = null; } /* if chat ID doesnt exist, create the variable anyway to avoid an error. Hopefully the Chat ID exists on the server..! */
2756
- $result = apply_filters("wplc_filter_chat_area_data",$results[0],$cid);
 
 
 
 
2757
  ?>
2758
  <style>
2759
 
@@ -2788,6 +3146,8 @@ function wplc_draw_chat_area($cid) {
2788
  $user_ip = $user_data['ip'];
2789
  $browser = wplc_return_browser_string($user_data['user_agent']);
2790
  $browser_image = wplc_return_browser_image($browser, "16");
 
 
2791
  global $wplc_basic_plugin_url;
2792
  if ($result->status == 1) {
2793
  $status = __("Previous", "wplivechat");
@@ -2818,22 +3178,24 @@ function wplc_draw_chat_area($cid) {
2818
 
2819
  echo "</div>";
2820
 
2821
- do_action("wplc_add_js_admin_chat_area", $cid);
2822
 
2823
  echo "<div id='admin_chat_box'>";
2824
 
2825
  $result->continue = true;
2826
 
2827
  do_action("wplc_hook_wplc_draw_chat_area",$result);
2828
-
2829
  if (!$result->continue) { return; }
2830
 
2831
- echo"<div class='admin_chat_box'><div class='admin_chat_box_inner' id='admin_chat_box_area_" . $result->id . "'>" . wplc_return_chat_messages($cid, false, true, false, false, 'string', true) . "</div><div class='admin_chat_box_inner_bottom'>" . wplc_return_chat_response_box($cid) . "</div>";
2832
 
2833
 
2834
  echo "</div>";
2835
  echo "<div class='admin_visitor_info'>";
2836
  do_action("wplc_hook_admin_visitor_info_display_before",$cid);
 
 
2837
  echo " <div style='float:left; width:100px;'><img src=\"//www.gravatar.com/avatar/" . md5($result->email) . "\" class=\"admin_chat_img\" /></div>";
2838
  echo " <div style='float:left;'>";
2839
 
@@ -2857,7 +3219,7 @@ function wplc_draw_chat_area($cid) {
2857
  echo " </div>";
2858
  echo "<hr />";
2859
 
2860
- echo (apply_filters("wplc_filter_advanced_info","", $result->id, $result->name));
2861
 
2862
  echo " <div id=\"wplc_sound_update\"></div>";
2863
 
@@ -2866,17 +3228,14 @@ function wplc_draw_chat_area($cid) {
2866
  echo "<a href='".admin_url('admin.php?page=wplivechat-menu-extensions-page')."' class='button button-primary' target='_BLANK'>".__("Get more add-ons","wplivechat")."</a>";
2867
  echo "</div>";
2868
 
2869
-
2870
-
2871
  if ($result->status != 1) {
2872
 
2873
  do_action("wplc_hook_admin_below_chat_box",$result);
2874
-
2875
- //echo wplc_return_admin_chat_javascript($_GET['cid']);
2876
  }
2877
 
2878
  }
2879
 
 
2880
  add_action("wplc_hook_admin_below_chat_box","wplc_hook_control_admin_below_chat_box",10);
2881
  function wplc_hook_control_admin_below_chat_box() {
2882
  echo "<div class='admin_chat_quick_controls'>";
@@ -2887,7 +3246,8 @@ function wplc_hook_control_admin_below_chat_box() {
2887
 
2888
  }
2889
 
2890
- function wplc_return_chat_response_box($cid) {
 
2891
  $ret = "<div class=\"chat_response_box\">";
2892
  $ret .= apply_filters("wplc_filter_typing_control_div","");
2893
  $ret .= "<input type='text' name='wplc_admin_chatmsg' id='wplc_admin_chatmsg' value='' placeholder='" . __("type here...", "wplivechat") . "' />";
@@ -2910,12 +3270,24 @@ function wplc_return_admin_chat_javascript($cid) {
2910
  wp_register_script('wplc-admin-chat-server', plugins_url('js/wplc_server.js', __FILE__), false, $wplc_version, false);
2911
  wp_enqueue_script('wplc-admin-chat-server');
2912
 
2913
- $cdata = wplc_get_chat_data($cid, __LINE__);
 
 
 
 
 
 
 
2914
  $other = maybe_unserialize($cdata->other);
2915
 
2916
  if(isset($wplc_settings['wplc_use_node_server']) && $wplc_settings['wplc_use_node_server'] == 1){
2917
  if (isset($other['socket']) && ($other['socket'] == true || $other['socket'] == "true")) {
2918
- wp_localize_script('wplc-admin-chat-server', 'wplc_use_node_server', "true");
 
 
 
 
 
2919
 
2920
  $wplc_node_token = get_option("wplc_node_server_secret_token");
2921
  if(!$wplc_node_token){
@@ -2928,15 +3300,34 @@ function wplc_return_admin_chat_javascript($cid) {
2928
  }
2929
  }
2930
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2931
  /**
2932
- * We could probably skip this check for the AID all the time as AID is actually the current user's ID we just use this for the cloud server actually.
2933
  */
2934
  if(isset($_GET['aid'])){
2935
  $agent_data = get_user_by('ID', intval($_GET['aid']));
2936
  wp_localize_script('wplc-admin-chat-server', 'wplc_admin_agent_name', $agent_data->display_name);
 
2937
  } else {
2938
  $agent_data = get_user_by('ID', intval(get_current_user_id()));
2939
  wp_localize_script('wplc-admin-chat-server', 'wplc_admin_agent_name', $agent_data->display_name);
 
2940
  }
2941
 
2942
 
@@ -2950,32 +3341,32 @@ function wplc_return_admin_chat_javascript($cid) {
2950
 
2951
  if ( (isset($wplc_theme) && $checker >= 6000 ) || (! function_exists("wplc_pro_version_control") ) ) {
2952
  if($wplc_theme == 'theme-default') {
2953
- wp_register_style('wplc-theme-palette-default', plugins_url('/css/themes/theme-default.css', __FILE__));
2954
  wp_enqueue_style('wplc-theme-palette-default');
2955
 
2956
  }
2957
  else if($wplc_theme == 'theme-1') {
2958
- wp_register_style('wplc-theme-palette-1', plugins_url('/css/themes/theme-1.css', __FILE__));
2959
  wp_enqueue_style('wplc-theme-palette-1');
2960
 
2961
  }
2962
  else if($wplc_theme == 'theme-2') {
2963
- wp_register_style('wplc-theme-palette-2', plugins_url('/css/themes/theme-2.css', __FILE__));
2964
  wp_enqueue_style('wplc-theme-palette-2');
2965
 
2966
  }
2967
  else if($wplc_theme == 'theme-3') {
2968
- wp_register_style('wplc-theme-palette-3', plugins_url('/css/themes/theme-3.css', __FILE__));
2969
  wp_enqueue_style('wplc-theme-palette-3');
2970
 
2971
  }
2972
  else if($wplc_theme == 'theme-4') {
2973
- wp_register_style('wplc-theme-palette-4', plugins_url('/css/themes/theme-4.css', __FILE__));
2974
  wp_enqueue_style('wplc-theme-palette-4');
2975
 
2976
  }
2977
  else if($wplc_theme == 'theme-5') {
2978
- wp_register_style('wplc-theme-palette-5', plugins_url('/css/themes/theme-5.css', __FILE__));
2979
  wp_enqueue_style('wplc-theme-palette-5');
2980
 
2981
  }
@@ -2990,29 +3381,39 @@ function wplc_return_admin_chat_javascript($cid) {
2990
  $wplc_settings = get_option("WPLC_SETTINGS");
2991
  $wplc_user_data = get_user_by( 'id', get_current_user_id() );
2992
 
2993
- if( isset($wplc_settings['wplc_show_name']) && $wplc_settings['wplc_show_name'] == '1' ){
2994
- $wplc_show_name = apply_filters( 'wplc_filter_admin_name', 'Admin' );
2995
- } else {
2996
- $wplc_show_name = false;
2997
- }
2998
- if( isset($wplc_settings['wplc_show_avatar']) && $wplc_settings['wplc_show_avatar'] ){
2999
- $args = array('class' => array('wplc-admin-message-avatar' ) );
3000
- $wplc_show_avatar = get_avatar( get_current_user_id(), 30, '', false, $args);
3001
- } else {
3002
- $wplc_show_avatar = false;
3003
- }
3004
- $wplc_chat_detail = array( 'name' => $wplc_show_name, 'avatar' => $wplc_show_avatar );
3005
 
3006
- wp_localize_script( 'wplc-admin-chat-js', 'wplc_show_chat_detail', $wplc_chat_detail );
3007
 
3008
  wp_enqueue_script('wplc-admin-chat-js');
3009
 
 
 
 
 
 
 
 
 
 
 
 
3010
  wp_localize_script('wplc-admin-chat-js', 'wplc_chat_name', $cdata->name);
 
3011
 
3012
  if(class_exists("WP_REST_Request")) {
3013
  wp_localize_script('wplc-admin-chat-js', 'wplc_restapi_enabled', '1');
3014
  wp_localize_script('wplc-admin-chat-js', 'wplc_restapi_token', get_option('wplc_api_secret_token'));
3015
- wp_localize_script('wplc-admin-chat-js', 'wplc_restapi_endpoint', get_option('siteurl').'/wp-json/wp_live_chat_support/v1');
3016
  } else {
3017
  wp_localize_script('wplc-admin-chat-js', 'wplc_restapi_enabled', '0');
3018
  }
@@ -3060,7 +3461,6 @@ function wplc_return_admin_chat_javascript($cid) {
3060
 
3061
  wp_localize_script('wplc-admin-chat-js', 'wplc_name', $display_name);
3062
  wp_localize_script('wplc-admin-chat-js', 'wplc_enable_ding', $enable_ding);
3063
- wp_localize_script('wplc-admin-chat-js', 'wplc_user_email', $wplc_user_email_address);
3064
 
3065
  $ajax_url = admin_url('admin-ajax.php');
3066
  $home_ajax_url = $ajax_url;
@@ -3132,6 +3532,7 @@ function wplc_activate() {
3132
  "wplc_pro_offline_btn" => __("Leave a message", "wplivechat"),
3133
  "wplc_pro_offline_btn_send" => __("Send message", "wplivechat"),
3134
  "wplc_user_enter" => __("Press ENTER to send your message", "wplivechat"),
 
3135
  "wplc_close_btn_text" => __("close", "wplivechat"),
3136
  "wplc_user_welcome_chat" => __("Welcome. How may I help you?", "wplivechat"),
3137
  'wplc_welcome_msg' => __("Please standby for an agent. While you wait for the agent you may type your message.","wplivechat")
@@ -3143,9 +3544,10 @@ function wplc_activate() {
3143
 
3144
 
3145
 
3146
-
3147
  $admins = get_role('administrator');
3148
- $admins->add_cap('wplc_ma_agent');
 
3149
 
3150
  $uid = get_current_user_id();
3151
  update_user_meta($uid, 'wplc_ma_agent', 1);
@@ -3176,6 +3578,7 @@ function wplc_handle_db() {
3176
  session varchar(100) NOT NULL,
3177
  url varchar(700) NOT NULL,
3178
  last_active_timestamp datetime NOT NULL,
 
3179
  other LONGTEXT NOT NULL,
3180
  PRIMARY KEY (id)
3181
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
@@ -3196,6 +3599,7 @@ function wplc_handle_db() {
3196
  timestamp datetime NOT NULL,
3197
  status INT(3) NOT NULL,
3198
  originates INT(3) NOT NULL,
 
3199
  PRIMARY KEY (id)
3200
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
3201
  ';
@@ -3236,7 +3640,7 @@ function wplc_handle_db() {
3236
  }
3237
 
3238
  function wplc_add_user_stylesheet() {
3239
-
3240
  if(function_exists('wplc_display_chat_contents')){
3241
  $show_chat_contents = wplc_display_chat_contents();
3242
  } else {
@@ -3248,9 +3652,50 @@ function wplc_add_user_stylesheet() {
3248
  wp_register_style( 'wplc-font-awesome', plugins_url( '/css/font-awesome.min.css', __FILE__ ) );
3249
  wp_enqueue_style( 'wplc-font-awesome' );
3250
  }
3251
- wp_register_style('wplc-style', plugins_url('/css/wplcstyle.css', __FILE__));
3252
  wp_enqueue_style('wplc-style');
3253
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3254
 
3255
  global $wplc_pro_version;
3256
  $wplc_ver = str_replace('.', '', $wplc_pro_version);
@@ -3271,32 +3716,32 @@ function wplc_add_user_stylesheet() {
3271
 
3272
  if ( (isset($wplc_theme) && $checker >= 6000 ) || (! function_exists("wplc_pro_version_control") ) ) {
3273
  if($wplc_theme == 'theme-default') {
3274
- wp_register_style('wplc-theme-palette-default', plugins_url('/css/themes/theme-default.css', __FILE__));
3275
  wp_enqueue_style('wplc-theme-palette-default');
3276
 
3277
  }
3278
  else if($wplc_theme == 'theme-1') {
3279
- wp_register_style('wplc-theme-palette-1', plugins_url('/css/themes/theme-1.css', __FILE__));
3280
  wp_enqueue_style('wplc-theme-palette-1');
3281
 
3282
  }
3283
  else if($wplc_theme == 'theme-2') {
3284
- wp_register_style('wplc-theme-palette-2', plugins_url('/css/themes/theme-2.css', __FILE__));
3285
  wp_enqueue_style('wplc-theme-palette-2');
3286
 
3287
  }
3288
  else if($wplc_theme == 'theme-3') {
3289
- wp_register_style('wplc-theme-palette-3', plugins_url('/css/themes/theme-3.css', __FILE__));
3290
  wp_enqueue_style('wplc-theme-palette-3');
3291
 
3292
  }
3293
  else if($wplc_theme == 'theme-4') {
3294
- wp_register_style('wplc-theme-palette-4', plugins_url('/css/themes/theme-4.css', __FILE__));
3295
  wp_enqueue_style('wplc-theme-palette-4');
3296
 
3297
  }
3298
  else if($wplc_theme == 'theme-5') {
3299
- wp_register_style('wplc-theme-palette-5', plugins_url('/css/themes/theme-5.css', __FILE__));
3300
  wp_enqueue_style('wplc-theme-palette-5');
3301
 
3302
  }
@@ -3315,31 +3760,31 @@ function wplc_add_user_stylesheet() {
3315
  if (isset($wplc_settings['wplc_newtheme'])) { $wplc_newtheme = $wplc_settings['wplc_newtheme']; } else { }
3316
  if (isset($wplc_newtheme)) {
3317
  if($wplc_newtheme == 'theme-1') {
3318
- wp_register_style('wplc-theme-classic', plugins_url('/css/themes/classic.css', __FILE__));
3319
  wp_enqueue_style('wplc-theme-classic');
3320
 
3321
  }
3322
  else if($wplc_newtheme == 'theme-2') {
3323
- wp_register_style('wplc-theme-modern', plugins_url('/css/themes/modern.css', __FILE__));
3324
  wp_enqueue_style('wplc-theme-modern');
3325
 
3326
  }
3327
  }
3328
 
3329
  if ($wplc_settings["wplc_settings_align"] == 1) {
3330
- wp_register_style('wplc-theme-position', plugins_url('/css/themes/position-bottom-left.css', __FILE__));
3331
  wp_enqueue_style('wplc-theme-position');
3332
  } else if ($wplc_settings["wplc_settings_align"] == 2) {
3333
- wp_register_style('wplc-theme-position', plugins_url('/css/themes/position-bottom-right.css', __FILE__));
3334
  wp_enqueue_style('wplc-theme-position');
3335
  } else if ($wplc_settings["wplc_settings_align"] == 3) {
3336
- wp_register_style('wplc-theme-position', plugins_url('/css/themes/position-left.css', __FILE__));
3337
  wp_enqueue_style('wplc-theme-position');
3338
  } else if ($wplc_settings["wplc_settings_align"] == 4) {
3339
- wp_register_style('wplc-theme-position', plugins_url('/css/themes/position-right.css', __FILE__));
3340
  wp_enqueue_style('wplc-theme-position');
3341
  } else {
3342
- wp_register_style('wplc-theme-position', plugins_url('/css/themes/position-bottom-right.css', __FILE__));
3343
  wp_enqueue_style('wplc-theme-position');
3344
  }
3345
 
@@ -3360,25 +3805,26 @@ function wplc_add_user_stylesheet() {
3360
  * @return void
3361
  */
3362
  function wplc_add_admin_stylesheet() {
 
3363
  if (isset($_GET['page']) && ($_GET['page'] == 'wplivechat-menu' || $_GET['page'] == 'wplivechat-menu-api-keys-page' || $_GET['page'] == 'wplivechat-menu-extensions-page' || $_GET['page'] == 'wplivechat-menu-settings' || $_GET['page'] == 'wplivechat-menu-offline-messages' || $_GET['page'] == 'wplivechat-menu-history' || $_GET['page'] == 'wplivechat-menu-missed-chats')) {
3364
- wp_register_style('wplc-admin-style', plugins_url('/css/jquery-ui.css', __FILE__));
3365
- wp_enqueue_style('wplc-admin-style');
3366
- wp_register_style('wplc-chat-style', plugins_url('/css/chat-style.css', __FILE__));
3367
- wp_enqueue_style('wplc-chat-style');
3368
- wp_register_style('wplc-font-awesome', plugins_url('/css/font-awesome.min.css', __FILE__));
3369
- wp_enqueue_style('wplc-font-awesome');
3370
- wp_enqueue_script('jquery-ui-core');
3371
- wp_enqueue_script('jquery-effects-core');
3372
  }
3373
  if (isset($_GET['page']) && $_GET['page'] == 'wplivechat-menu' && isset($_GET['action']) && $_GET['action'] == "ac") {
3374
- wp_register_style('wplc-admin-chat-box-style', plugins_url('/css/admin-chat-box-style.css', __FILE__));
3375
  wp_enqueue_style('wplc-admin-chat-box-style');
3376
 
3377
  }
3378
  if (isset($_GET['page']) && $_GET['page'] == "wplivechat-menu-support-page") {
3379
- wp_register_style('fontawesome', plugins_url('css/font-awesome.min.css', __FILE__));
3380
  wp_enqueue_style('fontawesome');
3381
- wp_register_style('wplc-support-page-css', plugins_url('css/support-css.css', __FILE__));
3382
  wp_enqueue_style('wplc-support-page-css');
3383
  }
3384
  }
@@ -3497,7 +3943,7 @@ function wplc_hook_control_chat_history() {
3497
  //Prompt
3498
  echo "<div class='update-nag' style='margin-top: 0px;margin-bottom: 5px;'>
3499
  ".__("Are you sure you would like to delete this chat?", "wplivechat")."<br>
3500
- <a class='button' href='?page=wplivechat-menu-history&wplc_action=remove_cid&cid=".$_GET['cid']."&wplc_confirm=1''>".__("Yes", "wplivechat")."</a> <a class='button' href='?page=wplivechat-menu-history'>".__("No", "wplivechat")."</a>
3501
  </div>";
3502
  }
3503
  }
@@ -3765,6 +4211,7 @@ function wplc_head_basic() {
3765
 
3766
  do_action("wplc_hook_admin_settings_save");
3767
  if (isset($_POST['wplc_settings_align'])) { $wplc_data['wplc_settings_align'] = esc_attr($_POST['wplc_settings_align']); }
 
3768
  if (isset($_POST['wplc_environment'])) { $wplc_data['wplc_environment'] = esc_attr($_POST['wplc_environment']); }
3769
  if (isset($_POST['wplc_settings_fill'])) { $wplc_data['wplc_settings_fill'] = esc_attr($_POST['wplc_settings_fill']); }
3770
  if (isset($_POST['wplc_settings_font'])) { $wplc_data['wplc_settings_font'] = esc_attr($_POST['wplc_settings_font']); }
@@ -3791,6 +4238,7 @@ function wplc_head_basic() {
3791
  if(isset($_POST['wplc_record_ip_address'])){ $wplc_data['wplc_record_ip_address'] = esc_attr($_POST['wplc_record_ip_address']); } else { $wplc_data['wplc_record_ip_address'] = "0"; }
3792
  if(isset($_POST['wplc_enable_msg_sound'])){ $wplc_data['wplc_enable_msg_sound'] = esc_attr($_POST['wplc_enable_msg_sound']); } else { $wplc_data['wplc_enable_msg_sound'] = "0"; }
3793
  if(isset($_POST['wplc_enable_font_awesome'])){ $wplc_data['wplc_enable_font_awesome'] = esc_attr($_POST['wplc_enable_font_awesome']); } else { $wplc_data['wplc_enable_font_awesome'] = "0"; }
 
3794
 
3795
  if (isset($_POST['wplc_pro_na'])) { $wplc_data['wplc_pro_na'] = esc_attr($_POST['wplc_pro_na']); }
3796
  if (isset($_POST['wplc_hide_when_offline'])) { $wplc_data['wplc_hide_when_offline'] = esc_attr($_POST['wplc_hide_when_offline']); }
@@ -3816,6 +4264,7 @@ function wplc_head_basic() {
3816
  if (isset($_POST['wplc_pro_tst1'])) { $wplc_data['wplc_pro_tst1'] = esc_attr($_POST['wplc_pro_tst1']); }
3817
  if (isset($_POST['wplc_pro_intro'])) { $wplc_data['wplc_pro_intro'] = esc_attr($_POST['wplc_pro_intro']); }
3818
  if (isset($_POST['wplc_user_enter'])) { $wplc_data['wplc_user_enter'] = esc_attr($_POST['wplc_user_enter']); }
 
3819
  if (isset($_POST['wplc_close_btn_text'])) { $wplc_data['wplc_close_btn_text'] = esc_attr($_POST['wplc_close_btn_text']); }
3820
  if (isset($_POST['wplc_user_welcome_chat'])) { $wplc_data['wplc_user_welcome_chat'] = esc_attr($_POST['wplc_user_welcome_chat']); }
3821
  if (isset($_POST['wplc_welcome_msg'])) { $wplc_data['wplc_welcome_msg'] = esc_attr($_POST['wplc_welcome_msg']); }
@@ -3957,7 +4406,7 @@ function wplc_logout() {
3957
  */
3958
  function wplc_get_home_path() {
3959
  $home = get_option('home');
3960
- $siteurl = get_option('siteurl');
3961
  if (!empty($home) && 0 !== strcasecmp($home, $siteurl)) {
3962
  $wp_path_rel_to_home = str_ireplace($home, '', $siteurl); /* $siteurl - $home */
3963
  $pos = strripos(str_replace('\\', '/', $_SERVER['SCRIPT_FILENAME']), trailingslashit($wp_path_rel_to_home));
@@ -4249,17 +4698,26 @@ function wplc_filter_control_wplc_admin_long_poll_chat_iteration($array,$post_da
4249
  }
4250
  } else {
4251
 
4252
- $new_chat_status = wplc_return_chat_status(sanitize_text_field($post_data['cid']));
4253
- if($new_chat_status != $post_data['chat_status']){
4254
- $array['chat_status'] = $new_chat_status;
4255
- $array['action'] = "wplc_update_chat_status";
4256
- }
4257
- $new_chat_message = wplc_return_admin_chat_messages(sanitize_text_field($post_data['cid']));
4258
- if($new_chat_message){
4259
-
4260
- $array['chat_message'] = $new_chat_message;
4261
- $array['action'] = "wplc_new_chat_message";
4262
- }
 
 
 
 
 
 
 
 
 
4263
  }
4264
 
4265
  return $array;
@@ -4362,14 +4820,21 @@ function wplc_hook_control_agents_settings() {
4362
  * @return array Contents of the chat based on the ID provided
4363
  */
4364
  function wplc_get_chat_data($cid,$line = false) {
4365
- global $wpdb;
4366
- global $wplc_tblname_chats;
 
 
 
 
 
 
 
 
 
 
 
 
4367
 
4368
- $sql = "SELECT * FROM $wplc_tblname_chats WHERE `id` = '".intval($cid)."' LIMIT 1";
4369
- $results = $wpdb->get_results($sql);
4370
- if (isset($results[0])) { $result = $results[0]; } else { $result = null; }
4371
- $result = apply_filters("wplc_filter_get_chat_data",$result,$cid);
4372
- return $result;
4373
  }
4374
 
4375
  /**
@@ -4687,7 +5152,7 @@ function wplc_filter_control_hovercard_bottom_before_pro($content) {
4687
  } else if(!isset($wplc_settings["wplc_powered_by_link"])) {
4688
 
4689
  } else{
4690
- $content .= "<a title='".__("Powered By WP Live Chat Support", "wplivechat")."' target='_blank' rel='nofollow' href='https://wp-livechat.com?utm_source=poweredby&utm_medium=click&utm_campaign=".esc_html(site_url())."' class='wplc_powered_by_link'>".__("Powered By WP Live Chat Support", "wplivechat")."</a>"; //Empty Content to start
4691
  }
4692
  return $content;
4693
  }
@@ -4938,7 +5403,7 @@ function nifty_text_edit_upsell($msg){
4938
  return $msg;
4939
  }
4940
 
4941
- add_filter("wplc_filter_advanced_info","nifty_rating_advanced_info_upsell",1,3);
4942
  /**
4943
  * Chat experience ratings upselling page
4944
  * @param string $msg current chat window contents
@@ -4946,7 +5411,7 @@ add_filter("wplc_filter_advanced_info","nifty_rating_advanced_info_upsell",1,3);
4946
  * @param string $name User's name
4947
  * @return string current chat window contents with the experience rating content appended
4948
  */
4949
- function nifty_rating_advanced_info_upsell($msg, $cid, $name){
4950
  if(!function_exists("nifty_rating_advanced_info_control") && is_admin() && !function_exists("wplc_pro_activate")){
4951
  $msg .= "<div class='admin_visitor_advanced_info admin_agent_rating wplc_faded_upsell'>
4952
  <strong>" . __("Experience Rating", "wplivechat") . "</strong>
@@ -4966,7 +5431,7 @@ function wplc_basic_filter_control_return_chat_response_box_before($string) {
4966
  add_filter("wplc_filter_typing_control_div_theme_2","wplc_basic_filter_control_return_chat_response_box_before_theme2",2,1);
4967
  function wplc_basic_filter_control_return_chat_response_box_before_theme2($string) {
4968
  remove_filter("wplc_filter_typing_control_div_theme_2","wplc_pro_filter_control_return_chat_response_box_before_theme2");
4969
- $string = $string. "<div class='typing_indicator wplc-color-4'></div>";
4970
 
4971
  return $string;
4972
  }
@@ -5237,8 +5702,7 @@ function wplc_powered_by_link_in_chat( $string ){
5237
  $show_powered_by = get_option( "WPLC_POWERED_BY" );
5238
 
5239
  if( $show_powered_by == 1){
5240
-
5241
- $ret = "<i style='text-align: center; display: block; padding: 5px 0; font-size: 10px;'><a href='https://wp-livechat.com' target='_BLANK' rel='nofollow'>".__("Powered by WP Live Chat Support", "wplivechat")."</a></i>";
5242
 
5243
  } else {
5244
 
@@ -5403,4 +5867,72 @@ function wplc_basic_version_departments(){
5403
  $content .= "</table>";
5404
 
5405
  echo $content;
5406
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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: 7.1.00
7
  Author: WP-LiveChat
8
  Author URI: http://www.wp-livechat.com
9
  Text Domain: wplivechat
11
  */
12
 
13
  /**
14
+ * 7.1.00 - 2017-06-15 - Medium priority
15
+ * Modernised the live chat box
16
+ * Fixed a bug that caused the wrong agent name to show up in the "typing" element after a chat was transferred
17
+ * Other minor bug fixes
18
+ * Added better support for caching systems (style sheets now have a version tag)
19
+ * Added additional support for the new features of the Cloud server
20
+ * Replaced all appropriate references of get_option('siteurl'); with site_url(); to embrace SSL where needed
21
+ * Images are now preloaded on the front end for a better user experience
22
+ * Fixed a fatal error found on some installations (https://github.com/CodeCabin/wp-live-chat-support/issues/329)
23
+ * Fixed a bug that cause the "Retry chat" to not work with the modern chat box
24
+ * Fixed a bug with the missed chat functionality - when an agent missed the chat, the chat ID would change and the agent would not be able to communicate with the visitor
25
+ * Fixed a bug with the listing of all missed chats
26
+ * Fixed a bug that sent pings to the node server when it was not necessary, causing an overload of the node server
27
+ * Fixed a bug that did not allow you to view the chat history of a missed chat
28
+ * Fixed a bug that caused the 'display name' and 'display avatar' to behave erratically
29
+ * Fixed a bug that caused the time and date display functionality to behave erratically
30
+ * Fixed a bug that caused a JavaScript error on the admin chat dashboard when a single visitor leaves the site
31
+ * Fixed a bug that caused the chat widow to appear before the chat circle when engaged in a chat and moving from page to page
32
+ * The visitor can now restart any chat that has been ended by an agent
33
+ * You can now customize the text "The chat has been ended by the operator"
34
+ * Fixed a bug that caused duplicate loading of messages
35
+ * When using a custom element to open the chat window, that element now has a cursor pointer styled to it by default
36
+ * Fixed a bug that incorrectly fired off ajax events when minimizing or maximizing the offline message box
37
+ * Fixed a bug that caused the offline message box to show up incorrectly after being dragged
38
+ * Fixed a bug that caused "maximize" notifications to not get sent through to agents when using the Node server
39
+ * Fixed a bug that did not allow single missed chats to be deleted
40
+ * Fixed a bug that caused the text input field to continually be focused on thereby causing issues
41
+ *
42
+ * 7.0.08 - 2017-05-21 - Low priority
43
+ * Fixed the powered by link
44
+ * Added supporting code for new extensions
45
+ *
46
+ * 7.0.07 - 2017-05-15 - Medium priority
47
  * You can now change the text of the offline message button
48
  * You can now change the text of the close chat button
49
  * Added a notification to the chat dashboard to help agents identify if the chat box is not showing up on the front end, and provide a reason
50
  * Added ability to set a default visitor name
51
  * Added ability to choose which user fields are required (name, email or both)
52
+ * Added visual aid when new message is sent and chat is minimized (user's side)
53
+ * Fixed a security issue in the back end (thank you JPCERT Coordination Center (https://www.jpcert.or.jp/english/))
54
  * Fixed a bug that caused a sound to be played on every page load of a visitor
55
  * Fixed a bug that stopped a user from sending a message when the admin initiated a chat
56
  * Fixed the bug that showed the incorrect icon for IE
57
  * Fixed a bug that caused empty button without remove/delete icon in Missed Chats
58
  * Fixed a bug that caused attached images to not display correctly
59
  * Fixed a bug that caused notifications to show up in the front end when the agent is testing a chat with him or herself
60
+ * Fixed a bug that caused the visitor count to flash when the visitor count had not changed
61
+ *
62
  * 7.0.06 -2017-03-13 - Low Priority
63
  * Enhancement: 'Open Chat' button changes to 'Chat Accepted' once a chat is active
64
  * Bug Fix: Compatibility bug fix for decryption in the Pro version
535
  global $wplc_tblname_msgs;
536
  global $wplc_tblname_offline_msgs;
537
 
538
+ /**
539
+ * This stores the admin chat data once so that we do not need to keep sourcing it via the WP DB or Cloud DB
540
+ */
541
+ global $admin_chat_data;
542
+ $admin_chat_data = false;
543
+
544
+ global $debug_start;
545
+
546
  $wplc_tblname_offline_msgs = $wpdb->prefix . "wplc_offline_messages";
547
  $wplc_tblname_chats = $wpdb->prefix . "wplc_chat_sessions";
548
  $wplc_tblname_msgs = $wpdb->prefix . "wplc_chat_msgs";
549
+ $wplc_version = "7.1.00";
550
 
551
  define('WPLC_BASIC_PLUGIN_DIR', dirname(__FILE__));
552
  define('WPLC_BASIC_PLUGIN_URL', plugins_url() . "/wp-live-chat-support/");
553
  global $wplc_basic_plugin_url;
554
+ $wplc_basic_plugin_url = site_url() . "/wp-content/plugins/wp-live-chat-support/";
555
 
556
 
557
  global $wplc_pro_version;
646
 
647
 
648
  $admins = get_role('administrator');
649
+ if( $admins !== null ) {
650
+ $admins->add_cap('wplc_ma_agent');
651
+ }
652
 
653
  $uid = get_current_user_id();
654
  update_user_meta($uid, 'wplc_ma_agent', 1);
942
  }
943
 
944
 
945
+ add_action("wp_head","wplc_load_user_js",0);
946
 
947
 
948
  function wplc_load_user_js () {
 
949
  if (!is_admin()) {
950
  if (in_array($GLOBALS['pagenow'], array('wp-login.php', 'wp-register.php'))) {
951
  return false;
963
  } else {
964
  $user_banned = 0;
965
  }
 
966
  $display_contents = apply_filters("wplc_filter_display_contents",$display_contents);
967
 
968
  if($display_contents && $user_banned == 0){
1018
  wp_enqueue_script('jquery');
1019
 
1020
  $wplc_settings = get_option("WPLC_SETTINGS");
1021
+ $wplc_acbc_data = get_option("WPLC_ACBC_SETTINGS");
1022
+ $wplc_ga_enabled = get_option("WPLC_GA_SETTINGS");
1023
 
1024
  if (isset($wplc_settings['wplc_display_to_loggedin_only']) && $wplc_settings['wplc_display_to_loggedin_only'] == 1) {
1025
  /* Only show to users that are logged in */
1028
  }
1029
  }
1030
 
1031
+ /* is the chat enabled? */
1032
+ if ($wplc_settings["wplc_settings_enabled"] == 2) { return; }
1033
+
1034
  wp_register_script('wplc-md5', plugins_url('/js/md5.js', __FILE__),array('wplc-user-script'),$wplc_version);
1035
  wp_enqueue_script('wplc-md5');
1036
  if (isset($wplc_settings['wplc_display_name']) && $wplc_settings['wplc_display_name'] == 1) {
1038
  } else {
1039
  $wplc_display = 'hide';
1040
  }
1041
+
1042
+
1043
+ if (isset($wplc_settings['wplc_enable_msg_sound']) && intval($wplc_settings['wplc_enable_msg_sound']) == 1) { $wplc_ding = '1'; } else { $wplc_ding = '0'; }
 
 
1044
 
1045
  $ajax_nonce = wp_create_nonce("wplc");
1046
  if (!function_exists("wplc_register_pro_version")) {
1066
 
1067
  }
1068
 
1069
+
1070
+
1071
 
1072
  wp_register_script('wplc-user-script', plugins_url('/js/wplc_u.js', __FILE__),array('jquery', 'wplc-server-script'),$wplc_version);
1073
  /**
1109
  if(class_exists("WP_REST_Request")) {
1110
  wp_localize_script('wplc-user-script', 'wplc_restapi_enabled', '1');
1111
  wp_localize_script('wplc-user-script', 'wplc_restapi_token', get_option('wplc_api_secret_token'));
1112
+ wp_localize_script('wplc-user-script', 'wplc_restapi_endpoint', site_url().'/wp-json/wp_live_chat_support/v1');
1113
  } else {
1114
  wp_localize_script('wplc-user-script', 'wplc_restapi_enabled', '0');
1115
  }
1116
 
1117
+
1118
  if (isset($wplc_ga_enabled['wplc_enable_ga']) && $wplc_ga_enabled['wplc_enable_ga'] == '1') {
1119
  wp_localize_script('wplc-user-script', 'wplc_enable_ga', '1');
1120
  }
1132
 
1133
  $wplc_display = false;
1134
 
1135
+ $wplc_images = apply_filters( 'wplc_get_images_to_preload', array(), $wplc_acbc_data );
1136
+ wp_localize_script( 'wplc-user-script', 'wplc_preload_images', $wplc_images );
1137
+
1138
+
1139
+
1140
+
1141
+ if( isset($wplc_settings['wplc_show_name']) && $wplc_settings['wplc_show_name'] == '1' ){ $wplc_show_name = true; } else { $wplc_show_name = false; }
1142
+ if( isset($wplc_settings['wplc_show_avatar']) && $wplc_settings['wplc_show_avatar'] ){ $wplc_show_avatar = true; } else { $wplc_show_avatar = false; }
1143
+ if( isset($wplc_settings['wplc_show_date']) && $wplc_settings['wplc_show_date'] == '1' ){ $wplc_show_date = true; } else { $wplc_show_date = false; }
1144
+ if( isset($wplc_settings['wplc_show_time']) && $wplc_settings['wplc_show_time'] == '1' ){ $wplc_show_time = true; } else { $wplc_show_time = false; }
1145
+
1146
+ $wplc_chat_detail = array( 'name' => $wplc_show_name, 'avatar' => $wplc_show_avatar, 'date' => $wplc_show_date, 'time' => $wplc_show_time );
1147
+
1148
+
1149
 
 
 
 
 
 
 
 
 
 
 
 
 
1150
  if( $wplc_display !== FALSE && $wplc_display !== 'hide' ){
1151
  wp_localize_script('wplc-user-script', 'wplc_display_name', $wplc_display);
1152
  } else {
1153
  wp_localize_script( 'wplc-user-script', 'wplc_show_chat_detail', $wplc_chat_detail );
1154
  }
1155
 
1156
+ /**
1157
+ * Create a JS object for all Agent ID's and Gravatar MD5's
1158
+ */
1159
+ $user_array = get_users(array(
1160
+ 'meta_key' => 'wplc_ma_agent',
1161
+ ));
1162
+
1163
+ $a_array = array();
1164
+ if ($user_array) {
1165
+ foreach ($user_array as $user) {
1166
+ $a_array[$user->ID] = array();
1167
+ $a_array[$user->ID]['name'] = apply_filters( "wplc_decide_agents_name", $user->display_name, $wplc_acbc_data );
1168
+ $a_array[$user->ID]['md5'] = md5( $user->user_email );
1169
+ }
1170
+ }
1171
+ wp_localize_script('wplc-user-script', 'wplc_agent_data', $a_array);
1172
+
1173
  $wplc_error_messages = array(
1174
  'valid_name' => __( "Please enter your name", "wplivechat" ),
1175
  'valid_email' => __( "Please enter your email address", "wplivechat" ),
1176
  'server_connection_lost' => __("Connection to server lost. Please reload this page. Error: ", "wplivechat"),
1177
+ 'chat_ended_by_operator' => ( empty( $wplc_settings['wplc_text_chat_ended'] ) ) ? __("The chat has been ended by the operator.", "wplivechat") : esc_attr( $wplc_settings['wplc_text_chat_ended'] ) ,
1178
  'empty_message' => __( "Please enter a message", "wplivechat" ),
1179
 
1180
  );
1194
 
1195
  wp_localize_script('wplc-user-script', 'wplc_offline_msg', stripslashes($wplc_settings['wplc_pro_offline2']));
1196
  wp_localize_script('wplc-user-script', 'wplc_offline_msg3',stripslashes($wplc_settings['wplc_pro_offline3']));
1197
+ wp_localize_script('wplc-user-script', 'wplc_welcome_msg',stripslashes($wplc_settings['wplc_welcome_msg']));
1198
 
1199
+
1200
 
1201
  if( isset( $wplc_acbc_data['wplc_use_wp_name'] ) && $wplc_acbc_data['wplc_use_wp_name'] == '1' ){
 
1202
  if( isset( $_COOKIE['wplc_cid'] ) ){
1203
  $chat_data = wplc_get_chat_data( $_COOKIE['wplc_cid'] );
 
1204
  $user_info = get_userdata( intval( $chat_data->agent_id ) );
 
1205
  if( $user_info ){
 
1206
  $agent = $user_info->display_name;
1207
+ } else {
 
 
1208
  $agent = "agent";
 
1209
  }
 
1210
  } else {
1211
  $agent = 'agent';
1212
  }
1219
  }
1220
  }
1221
  wp_localize_script('wplc-user-script', 'wplc_localized_string_is_typing', $agent . __(" is typing...","wplivechat"));
1222
+ wp_localize_script('wplc-user-script', 'wplc_localized_string_is_typing_single', __(" is typing...","wplivechat"));
1223
 
1224
 
1225
+ if( isset( $wplc_settings['wplc_elem_trigger_id'] ) && trim( $wplc_settings['wplc_elem_trigger_id'] ) !== "" ) {
1226
+ if( isset( $wplc_settings['wplc_elem_trigger_action'] ) ){
1227
+ wp_localize_script( 'wplc-user-script', 'wplc_elem_trigger_action', stripslashes( $wplc_settings['wplc_elem_trigger_action'] ) );
1228
  }
1229
+ if( isset( $wplc_settings['wplc_elem_trigger_type'] ) ){
1230
+ wp_localize_script( 'wplc-user-script', 'wplc_elem_trigger_type', stripslashes( $wplc_settings['wplc_elem_trigger_type'] ) );
1231
  }
1232
+ wp_localize_script( 'wplc-user-script', 'wplc_elem_trigger_id', stripslashes( $wplc_settings['wplc_elem_trigger_id'] ) );
1233
  }
1234
 
1235
  $extra_data_array = array("object_switch" => true);
1264
 
1265
  }
1266
 
1267
+
1268
+
1269
+ /**
1270
+ * Add to the array to determine which images need to be preloaded via JS on the front end.
1271
+ *
1272
+ * @param array $images Array of images to be preloaded
1273
+ * @return array
1274
+ */
1275
+ add_filter( "wplc_get_images_to_preload", "wplc_filter_control_get_images_to_preload", 10, 2 );
1276
+ function wplc_filter_control_get_images_to_preload( $images, $wplc_acbc_data ) {
1277
+ $icon = plugins_url('images/iconRetina.png', __FILE__);
1278
+ $close_icon = plugins_url('images/iconCloseRetina.png', __FILE__);
1279
+ array_push( $images, $icon );
1280
+ array_push( $images, $close_icon );
1281
+ return $images;
1282
+ }
1283
+
1284
+
1285
+
1286
  function wplc_user_top_js() {
1287
 
1288
  if(function_exists('wplc_display_chat_contents')){
1447
  if (function_exists("wplc_pro_version_control")) {
1448
  global $wplc_pro_version;
1449
  if (intval(str_replace(".","",$wplc_pro_version)) < 5100) {
1450
+
1451
  echo wplc_output_box_ajax();
1452
+
1453
  } else {
1454
  echo wplc_output_box_ajax_new($cid);
1455
  }
1517
 
1518
  if ($wplc_settings["wplc_settings_align"] == 1) {
1519
  $original_pos = "bottom_left";
1520
+ $wplc_box_align = "left:20px; bottom:0px;";
1521
  } else if ($wplc_settings["wplc_settings_align"] == 2) {
1522
  $original_pos = "bottom_right";
1523
+ $wplc_box_align = "right:20px; bottom:0px;";
1524
  } else if ($wplc_settings["wplc_settings_align"] == 3) {
1525
  $original_pos = "left";
1526
  $wplc_box_align = "left:0; bottom:100px;";
1542
  }
1543
 
1544
  if (isset($wplc_settings['wplc_newtheme']) && $wplc_settings['wplc_newtheme'] == "theme-2") {
1545
+ $hovercard_content = "<div class='wplc_hovercard_content_left'>".apply_filters("wplc_filter_modern_theme_hovercard_content_left","")."</div><div class='wplc_hovercard_content_right'>".apply_filters("wplc_filter_live_chat_box_html_1st_layer",wplc_filter_control_live_chat_box_html_1st_layer($wplc_settings,$logged_in,$wplc_using_locale,'wplc-color-4'))."</div>";
1546
  $hovercard_content = apply_filters("wplc_filter_hovercard_content", $hovercard_content);
1547
 
1548
  $ret_msg .= "<div id='wplc_hovercard' style='display:none' class='".$wplc_theme_type."'>";
1549
+ //$ret_msg .= "<div id='wplc_hovercard_min' class='wplc_button_standard wplc-color-border-1 wplc-color-bg-1'>".stripslashes( $wplc_settings['wplc_close_btn_text'] )."</div>";
1550
  $ret_msg .= "<div id='wplc_hovercard_content'>".apply_filters("wplc_filter_live_chat_box_pre_layer1","").$hovercard_content."</div>";
1551
  $ret_msg .= "<div id='wplc_hovercard_bottom'>".apply_filters("wplc_filter_hovercard_bottom_before","").apply_filters("wplc_filter_live_chat_box_hover_html_start_chat_button","",$wplc_settings,$logged_in,$wplc_using_locale)."</div>";
1552
  $ret_msg .= "</div>";
1553
 
1554
  } else if (isset($wplc_settings['wplc_newtheme']) && $wplc_settings['wplc_newtheme'] == "theme-1"){
1555
+ $hovercard_content = "<div class='wplc_hovercard_content_right'>".apply_filters("wplc_filter_live_chat_box_html_1st_layer",wplc_filter_control_live_chat_box_html_1st_layer($wplc_settings,$logged_in,$wplc_using_locale, "wplc-color-2"))."</div>";
1556
  $hovercard_content = apply_filters("wplc_filter_hovercard_content", $hovercard_content);
1557
 
1558
  $ret_msg .= "<div id='wplc_hovercard' style='display:none' class='".$wplc_theme_type."'>";
1559
+ //$ret_msg .= "<div id='wplc_hovercard_min' class='wplc_button_standard wplc-color-border-1 wplc-color-bg-1'>".__("close", "wplivechat")."</div>";
1560
  $ret_msg .= "<div id='wplc_hovercard_content'>".apply_filters("wplc_filter_live_chat_box_pre_layer1","").$hovercard_content."</div>";
1561
  $ret_msg .= "<div id='wplc_hovercard_bottom'>".apply_filters("wplc_filter_hovercard_bottom_before","").apply_filters("wplc_filter_live_chat_box_hover_html_start_chat_button","",$wplc_settings,$logged_in,$wplc_using_locale)."</div>";
1562
  $ret_msg .= "</div>";
1600
 
1601
  add_filter("wplc_filter_chat_header_under","wplc_filter_control_chat_header_under",1,2);
1602
  function wplc_filter_control_chat_header_under($ret_msg,$wplc_settings) {
1603
+ $current_theme = isset($wplc_settings['wplc_newtheme']) ? $wplc_settings['wplc_newtheme'] : "";
1604
+ if($current_theme === "theme-2"){
1605
+
1606
+ if (function_exists("wplc_acbc_filter_control_chat_header_under")) {
1607
+ remove_filter("wplc_filter_chat_header_under","wplc_acbc_filter_control_chat_header_under");
1608
+ }
1609
  }
 
1610
 
1611
+ return $ret_msg;
 
 
 
 
 
 
1612
 
1613
  }
1614
 
1660
  $ret_msg .= apply_filters( "wplc_start_chat_user_form_after_filter", "" );
1661
 
1662
  } elseif (isset($wplc_settings['wplc_require_user_info']) && $wplc_settings['wplc_require_user_info'] == 'email') {
1663
+ /*$ret_msg .= "<div style=\"padding: 7px; text-align: center;\">";
1664
  if (isset($wplc_settings['wplc_user_alternative_text'])) {
1665
  $ret_msg .= html_entity_decode( stripslashes($wplc_settings['wplc_user_alternative_text']) );
1666
  }
1667
+ $ret_msg .= '</div>';*/
1668
 
1669
  $wplc_random_user_number = rand(0, 9) . rand(0, 9) . rand(0, 9) . rand(0, 9) . rand(0, 9) . rand(0, 9);
1670
  if ($wplc_loggedin_user_name != '') { $wplc_lin = $wplc_loggedin_user_name; } else { $wplc_lin = 'user' . $wplc_random_user_number; }
1672
  $ret_msg .= "<input type=\"text\" name=\"wplc_email\" id=\"wplc_email\" wplc_hide=\"0\" value=\"" . $wplc_loggedin_user_email . "\" placeholder=\"" . __( "Email", "wplivechat" ) . "\" />";
1673
  $ret_msg .= apply_filters("wplc_start_chat_user_form_after_filter", "");
1674
  } elseif (isset($wplc_settings['wplc_require_user_info']) && $wplc_settings['wplc_require_user_info'] == 'name') {
1675
+ /*
1676
  $ret_msg .= "<div style=\"padding: 7px; text-align: center;\">";
1677
  if (isset($wplc_settings['wplc_user_alternative_text'])) {
1678
  $ret_msg .= html_entity_decode( stripslashes($wplc_settings['wplc_user_alternative_text']) );
1679
  }
1680
+ $ret_msg .= '</div>';*/
1681
 
1682
  $wplc_random_user_number = rand(0, 9) . rand(0, 9) . rand(0, 9) . rand(0, 9) . rand(0, 9) . rand(0, 9);
1683
  if ($wplc_loggedin_user_email != '' && $wplc_loggedin_user_email != null) { $wplc_lie = $wplc_loggedin_user_email; } else { $wplc_lie = $wplc_random_user_number . '@' . $wplc_random_user_number . '.com'; }
1686
  $ret_msg .= apply_filters("wplc_start_chat_user_form_after_filter", "");
1687
  } else {
1688
  //Dont ask the user
1689
+ /*
1690
  $ret_msg .= "<div style=\"padding: 7px; text-align: center;\">";
1691
  if (isset($wplc_settings['wplc_user_alternative_text'])) {
1692
  $ret_msg .= html_entity_decode( stripslashes($wplc_settings['wplc_user_alternative_text']) );
1693
  }
1694
+ $ret_msg .= '</div>';*/
1695
 
1696
  $wplc_random_user_number = rand(0, 9) . rand(0, 9) . rand(0, 9) . rand(0, 9) . rand(0, 9) . rand(0, 9);
1697
  //$wplc_loggedin_user_email = $wplc_random_user_number."@".$wplc_random_user_number.".com";
1806
  $wplc_settings_font = "#FFFFFF";
1807
  }
1808
  }
1809
+ $ret_msg = "<input id=\"wplc_na_msg_btn\" type=\"button\" value=\"".stripslashes($wplc_settings['wplc_pro_offline_btn_send'])."\" style=\"background: ".$wplc_settings_fill." !important; background-color: ".$wplc_settings_fill." !important; color: ".$wplc_settings_font." !important;\"/>";
1810
  return $ret_msg;
1811
  }
1812
 
1820
  * @since 6.0.00
1821
  * @author Nick Duncan <nick@codecabin.co.za>
1822
  */
1823
+ function wplc_filter_control_live_chat_box_html_2nd_layer($wplc_settings,$logged_in,$wplc_using_locale, $cid) {
1824
+
1825
  if ($logged_in) {
1826
  $wplc_intro = __('Hello. Please input your details so that I may help you.', 'wplivechat');
1827
  if (!isset($wplc_settings['wplc_pro_intro']) || $wplc_settings['wplc_pro_intro'] == "") { $wplc_settings['wplc_pro_intro'] = $wplc_intro; }
1828
  $text = ($wplc_using_locale ? $wplc_intro : stripslashes($wplc_settings['wplc_pro_intro']));
1829
 
1830
  $ret_msg = "<div id=\"wp-live-chat-2-inner\">";
1831
+ $ret_msg .= " <div id=\"wp-live-chat-2-info\" class='wplc-color-4'>";
1832
+ $ret_msg .= $text;
1833
  $ret_msg .= " </div>";
1834
  $ret_msg .= apply_filters("wplc_filter_live_chat_box_html_ask_user_details",wplc_filter_control_live_chat_box_html_ask_user_detail($wplc_settings));
1835
+ $ret_msg .= apply_filters("wplc_filter_live_chat_box_html_start_chat_button",wplc_filter_control_live_chat_box_html_start_chat_button($wplc_settings,$wplc_using_locale ), $cid);
1836
  $ret_msg .= "</div>";
1837
  } else {
1838
  if ( isset( $wplc_settings['wplc_loggedin_user_info'] ) && $wplc_settings['wplc_loggedin_user_info'] == 1 ) {
1865
  $wplc_offline = __("We are currently offline. Please leave a message and we'll get back to you shortly.", "wplivechat");
1866
  $text = ($wplc_using_locale ? $wplc_offline : stripslashes($wplc_settings['wplc_pro_offline1']));
1867
 
1868
+ $ret_msg = "<div id=\"wp-live-chat-2-info\" class=\"wplc-color-bg-1 wplc-color-2\">";
1869
  $ret_msg .= $text;
1870
  $ret_msg .= "</div>";
1871
  $ret_msg .= "<div id=\"wplc_message_div\">";
1882
  if(isset($wplc_settings['wplc_record_ip_address']) && $wplc_settings['wplc_record_ip_address'] == 1) { $offline_ip_address = $ip_address; } else { $offline_ip_address = ""; }
1883
 
1884
  $ret_msg .= "<input type=\"hidden\" name=\"wplc_ip_address\" id=\"wplc_ip_address\" value=\"".$offline_ip_address."\" />";
1885
+ $ret_msg .= "<input type=\"hidden\" name=\"wplc_domain_offline\" id=\"wplc_domain_offline\" value=\"".site_url()."\" />";
1886
  $ret_msg .= apply_filters("wplc_filter_live_chat_box_html_send_offline_message_button",wplc_filter_control_live_chat_box_html_send_offline_message_button($wplc_settings));
1887
  $ret_msg .= "</div>";
1888
 
1924
  }
1925
 
1926
 
1927
+ add_filter("wplc_filter_live_chat_box_above_main_div","wplc_filter_control_live_chat_box_above_main_div",10,3);
1928
+ function wplc_filter_control_live_chat_box_above_main_div( $msg, $wplc_settings, $cid ) {
1929
  if (isset($wplc_settings['wplc_newtheme']) && $wplc_settings['wplc_newtheme'] == "theme-2") {
1930
+
1931
+ $agent_info = '';
1932
+ $cbox_header_bg = '';
1933
+ $agent_tagline = '';
1934
+ $agent_bio = '';
1935
+
1936
+ $a_twitter = '';
1937
+ $a_linkedin = '';
1938
+ $a_facebook = '';
1939
+ $a_website = '';
1940
+ $social_links = '';
1941
+ $agent_string = '';
1942
+ if ( $cid ) {
1943
+ $chat_data = wplc_get_chat_data( $cid );
1944
+
1945
+ if ( isset( $chat_data->agent_id ) ) {
1946
+ $agent_id = intval( $chat_data->agent_id );
1947
+ } else {
1948
+ $agent_id = get_current_user_id();
1949
+ }
1950
+
1951
+ if ( $agent_id ) {
1952
+
1953
+ $wplc_acbc_data = get_option("WPLC_ACBC_SETTINGS");
1954
+ $user_info = get_userdata( $agent_id );
1955
+
1956
+
1957
+ if( isset( $wplc_acbc_data['wplc_use_wp_name'] ) && $wplc_acbc_data['wplc_use_wp_name'] == '1' ){
1958
+
1959
+ $agent = $user_info->display_name;
1960
+ } else {
1961
+ if (!empty($wplc_acbc_data['wplc_chat_name'])) {
1962
+ $agent = $wplc_acbc_data['wplc_chat_name'];
1963
+ } else {
1964
+ $agent = 'Admin';
1965
+ }
1966
+ }
1967
+ $cbox_header_bg = "style='background-image:url(http://www.gravatar.com/avatar/".md5($user_info->user_email)."?s=380); no-repeat; cover;'";
1968
+
1969
+ $extra = apply_filters( "wplc_filter_further_live_chat_box_above_main_div", '', $wplc_settings, $cid, $chat_data );
1970
+
1971
+ $agent_string = '
1972
+ <p style="text-align:center;">
1973
+ <img class="img-thumbnail img-circle wplc_thumb32 wplc_agent_involved" style="max-width:inherit;" id="agent_grav_'.$agent_id.'" title="'.$agent.'" src="http://www.gravatar.com/avatar/'.md5($user_info->user_email).'?s=60" /><br />
1974
+ <span class="wplc_agent_name wplc-color-2">'.$agent.'</span>
1975
+ '.$extra.'
1976
+ </p>';
1977
+
1978
+ }
1979
+ }
1980
+
1981
+ $msg .= "<div id='wplc_chatbox_header_bg' ".$cbox_header_bg."><div id='wplc_chatbox_header' class='wplc-color-bg-1 wplc-color-4'><div class='wplc_agent_info'>".$agent_string."</div></div></div>";
1982
 
1983
  }
1984
  return $msg;
1991
  * @since 6.0.00
1992
  * @author Nick Duncan <nick@codecabin.co.za>
1993
  */
1994
+ function wplc_filter_control_live_chat_box_html_4th_layer($wplc_settings,$wplc_using_locale, $cid ) {
1995
  $wplc_enter = __('Connecting. Please be patient...', 'wplivechat');
1996
  if (!isset($wplc_settings['wplc_user_enter']) || $wplc_settings['wplc_user_enter'] == "") { $wplc_settings['wplc_pro_sst2'] = $wplc_enter; }
1997
  $text = ($wplc_using_locale ? $wplc_enter : stripslashes($wplc_settings['wplc_user_enter']));
2010
  }
2011
  $ret_msg .= "<div id=\"wplc_sound_update\" style=\"height:0; width:0; display:none; border:0;\"></div>";
2012
 
2013
+ $ret_msg .= apply_filters("wplc_filter_live_chat_box_above_main_div","",$wplc_settings, $cid);
2014
 
2015
 
2016
  $ret_msg .= "<div id=\"wplc_chatbox\">";
2029
  $ret_msg .= apply_filters("wplc_filter_chat_text_editor","");
2030
 
2031
  $ret_msg .= "<p>";
2032
+ $placeholder = __('Type here','wplivechat');
2033
+ $ret_msg .= "<textarea type=\"text\" name=\"wplc_chatmsg\" id=\"wplc_chatmsg\" placeholder=\"".$placeholder."\" onclick=\"jQuery(this).select();\" ></textarea>";
2034
  if (isset($wplc_settings['wplc_newtheme']) && $wplc_settings['wplc_newtheme'] == 'theme-2') {
2035
  $ret_msg .= apply_filters("wplc_filter_typing_control_div_theme_2","");
2036
  }
2162
 
2163
  $logged_in = apply_filters("wplc_loggedin_filter",false);
2164
 
2165
+
2166
+
2167
+
2168
+
2169
+
2170
+ $ret_msg['cbox'] = apply_filters("wplc_theme_control",$wplc_settings,$logged_in,$wplc_using_locale,$cid);
2171
+
2172
  $ret_msg['online'] = $logged_in;
2173
 
2174
  global $wplc_pro_version;
2178
  if ($cid !== null) {
2179
  $chat_data = wplc_get_chat_data( $cid );
2180
  wplc_record_chat_notification('user_loaded',$cid,array('uri' => $_SERVER['HTTP_REFERER'], 'chat_data' => $chat_data ));
2181
+
2182
+
2183
+
2184
+ if ( !isset($chat_data) || !$chat_data->agent_id ) {
2185
+ $ret_msg['type'] = 'new';
2186
+ } else {
2187
+ $ret_msg['type'] = 'returning';
2188
+
2189
+
2190
+ /* build the AGENT DATA array */
2191
+ $wplc_acbc_data = get_option("WPLC_ACBC_SETTINGS");
2192
+ $user_info = get_userdata( intval( $chat_data->agent_id ) );
2193
+
2194
+ $agent_tagline = '';
2195
+ $agent_bio = '';
2196
+ $a_twitter = '';
2197
+ $a_linkedin = '';
2198
+ $a_facebook = '';
2199
+ $a_website = '';
2200
+ $social_links = '';
2201
+
2202
+ if( isset( $wplc_acbc_data['wplc_use_wp_name'] ) && $wplc_acbc_data['wplc_use_wp_name'] == '1' ){
2203
+
2204
+ $agent = $user_info->display_name;
2205
+ } else {
2206
+ if (!empty($wplc_acbc_data['wplc_chat_name'])) {
2207
+ $agent = $wplc_acbc_data['wplc_chat_name'];
2208
+ } else {
2209
+ $agent = 'Admin';
2210
+ }
2211
+ }
2212
+
2213
+ $agent_tagline = apply_filters( "wplc_filter_agent_data_agent_tagline", $agent_tagline, $cid, $chat_data, $agent, $wplc_acbc_data, $user_info, $chat_data );
2214
+ $agent_bio = apply_filters( "wplc_filter_agent_data_agent_bio", $agent_bio, $cid, $chat_data, $agent, $wplc_acbc_data, $user_info, $chat_data );
2215
+ $social_links = apply_filters( "wplc_filter_agent_data_social_links", $social_links, $cid, $chat_data, $agent, $wplc_acbc_data, $user_info, $chat_data);
2216
+
2217
+ $ret_msg['agent_data'] = array(
2218
+ 'email' => md5($user_info->user_email),
2219
+ 'name' => $agent,
2220
+ 'aid' => $user_info->ID,
2221
+ 'agent_tagline' => $agent_tagline,
2222
+ 'agent_bio' => $agent_bio,
2223
+ "social_links" => $social_links
2224
+ );
2225
+
2226
+ }
2227
+
2228
+
2229
  }
2230
 
2231
+
2232
  if (function_exists("wplc_pro_version_control")) {
2233
  if ($checker < 6000) {
2234
  /* backwards compatibilitty for the old pro version */
2247
 
2248
 
2249
  }
2250
+ function wplc_return_default_theme($wplc_settings,$logged_in,$wplc_using_locale,$cid) {
2251
  $ret_msg = apply_filters("wplc_filter_live_chat_box_html_main_div_top",wplc_filter_control_live_chat_box_html_main_div_top($wplc_settings,$logged_in,$wplc_using_locale));
2252
  $ret_msg .= "<div class=\"wp-live-chat-wraper\">";
2253
  $ret_msg .= apply_filters("wplc_filter_live_chat_box_html_header_div_top",wplc_filter_control_live_chat_box_html_header_div_top($wplc_settings));
2254
  $ret_msg .= " <i id=\"wp-live-chat-minimize\" class=\"fa fa-minus wplc-color-bg-2 wplc-color-1\" style=\"display:none;\"></i>";
2255
  $ret_msg .= " <i id=\"wp-live-chat-close\" class=\"fa fa-times\" style=\"display:none;\" ></i>";
2256
  $ret_msg .= " <div id=\"wp-live-chat-1\" >";
2257
+ $ret_msg .= apply_filters("wplc_filter_live_chat_box_html_1st_layer",wplc_filter_control_live_chat_box_html_1st_layer($wplc_settings,$logged_in,$wplc_using_locale,'wplc-color-2'));
2258
  $ret_msg .= " </div>";
2259
  $ret_msg .= '<div id="wplc-chat-alert" class="wplc-chat-alert wplc-chat-alert--' . $wplc_settings["wplc_theme"] . '"></div>';
2260
  $ret_msg .= " </div>";
2261
  $ret_msg .= " <div id=\"wp-live-chat-2\" style=\"display:none;\">";
2262
  $ret_msg .= apply_filters("wplc_filter_live_chat_box_survey","");
2263
+ $ret_msg .= apply_filters("wplc_filter_live_chat_box_html_2nd_layer",wplc_filter_control_live_chat_box_html_2nd_layer($wplc_settings,$logged_in,$wplc_using_locale,$cid), $cid);
2264
  $ret_msg .= " </div>";
2265
  $ret_msg .= " <div id=\"wp-live-chat-3\" style=\"display:none;\">";
2266
  $ret_msg .= apply_filters("wplc_filter_live_chat_box_html_3rd_layer",wplc_filter_control_live_chat_box_html_3rd_layer($wplc_settings,$wplc_using_locale));
2268
  $ret_msg .= " <div id=\"wp-live-chat-react\" style=\"display:none;\">";
2269
  $ret_msg .= " <p>".__("Reactivating your previous chat...", "wplivechat")."</p>";
2270
  $ret_msg .= " </div>";
 
 
 
2271
  $ret_msg .= " <div id=\"wplc-extra-div\" style=\"display:none;\">";
2272
  $ret_msg .= apply_filters("wplc_filter_wplc_extra_div","",$wplc_settings,$wplc_using_locale);
2273
  $ret_msg .= "</div>";
2274
  $ret_msg .= "</div>";
2275
+ $ret_msg .= " <div id=\"wp-live-chat-4\" style=\"display:none;\">";
2276
+ $ret_msg .= apply_filters("wplc_filter_live_chat_box_html_4th_layer",wplc_filter_control_live_chat_box_html_4th_layer($wplc_settings,$wplc_using_locale, $cid));
2277
+ $ret_msg .= "</div>";
2278
  return $ret_msg;
2279
  }
2280
 
2281
 
2282
+ add_filter("wplc_theme_control","wplc_theme_control_function",10,4);
2283
+ function wplc_theme_control_function($wplc_settings,$logged_in,$wplc_using_locale, $cid) {
2284
 
2285
  if (!$wplc_settings) { return ""; }
2286
  if (isset($wplc_settings['wplc_newtheme'])) { $wplc_newtheme = $wplc_settings['wplc_newtheme']; } else { }
2287
 
2288
+ $default_theme = wplc_return_default_theme($wplc_settings,$logged_in,$wplc_using_locale, $cid);
2289
  if (isset($wplc_newtheme)) {
2290
 
2291
 
2305
  $ret_msg .= " </div>";
2306
  $ret_msg .= '<div id="wplc-chat-alert" class="wplc-chat-alert wplc-chat-alert--' . $wplc_settings["wplc_theme"] . '"></div>';
2307
  $ret_msg .= " <div id=\"wp-live-chat-2\" style=\"display:none;\">";
2308
+ $ret_msg .= " <i id=\"wp-live-chat-minimize\" class=\"fa fa-minus wplc-color-bg-2 wplc-color-1\" style=\"display:none;\" ></i>";
2309
+ $ret_msg .= " <i id=\"wp-live-chat-close\" class=\"fa fa-times\" style=\"display:none;\" ></i>";
2310
+ $ret_msg .= " <div id=\"wplc-extra-div\" style=\"display:none;\">";
2311
+ $ret_msg .= apply_filters("wplc_filter_wplc_extra_div","",$wplc_settings,$wplc_using_locale);
2312
+ $ret_msg .= " </div>";
2313
+ $ret_msg .= " <div id='wp-live-chat-inner-container'>";
2314
+ $ret_msg .= " <div id='wp-live-chat-inner'>";
2315
+ $ret_msg .= " <div id=\"wp-live-chat-1\" class=\"wplc-color-2 wplc-color-bg-1\" >";
2316
+ $ret_msg .= apply_filters("wplc_filter_live_chat_box_html_1st_layer",wplc_filter_control_live_chat_box_html_1st_layer($wplc_settings,$logged_in,$wplc_using_locale,'wplc-color-2'));
2317
+ $ret_msg .= " </div>";
2318
+ $ret_msg .= apply_filters("wplc_filter_live_chat_box_html_2nd_layer",wplc_filter_control_live_chat_box_html_2nd_layer($wplc_settings,$logged_in,$wplc_using_locale, $cid), $cid);
2319
+ $ret_msg .= " </div>";
2320
+ $ret_msg .= " <div id=\"wp-live-chat-react\" style=\"display:none;\">";
2321
+ $ret_msg .= " <p>".__("Reactivating your previous chat...", "wplivechat")."</p>";
2322
+ $ret_msg .= " </div>";
2323
+ $ret_msg .= " </div>";
2324
  $ret_msg .= " <div id=\"wp-live-chat-3\" style=\"display:none;\">";
2325
+ $ret_msg .= apply_filters("wplc_filter_live_chat_box_html_3rd_layer",wplc_filter_control_live_chat_box_html_3rd_layer($wplc_settings,$wplc_using_locale));
2326
  $ret_msg .= " </div>";
2327
+ $ret_msg .= " </div>";
2328
  $ret_msg .= " <div id=\"wp-live-chat-4\" style=\"display:none;\">";
2329
+ $ret_msg .= apply_filters("wplc_filter_live_chat_box_html_4th_layer",wplc_filter_control_live_chat_box_html_4th_layer($wplc_settings,$wplc_using_locale, $cid));
2330
  $ret_msg .= " </div>";
2331
+
2332
  $ret_msg .= "</div>";
2333
 
2334
  } else {
2523
  }
2524
  }
2525
 
2526
+
2527
  function wplc_superadmin_javascript() {
2528
 
2529
+ do_action("wplc_hook_superadmin_head");
2530
+
2531
+ if ( isset( $_GET['page'] ) && isset( $_GET['action'] ) && $_GET['page'] == "wplivechat-menu" && ( $_GET['action'] != 'welcome' && $_GET['action'] != 'credits' ) ) {
2532
+ /* admin chat box page */
2533
+ if (function_exists("wplc_register_pro_version")) {
2534
+ wplc_return_pro_admin_chat_javascript(sanitize_text_field($_GET['cid']));
2535
+ } else {
2536
+
2537
+ /** set the global chat data here so we dont need to keep getting it from the DB or Cloud server */
2538
+ global $admin_chat_data;
2539
+ $admin_chat_data = wplc_get_chat_data($_GET['cid'], __LINE__);
2540
+
2541
+ wplc_return_admin_chat_javascript(sanitize_text_field($_GET['cid']));
2542
+
2543
+
2544
+ }
2545
+ do_action("wplc_hook_admin_javascript_chat");
2546
+ } else {
2547
+ /* load this on every other admin page */
2548
+ if (function_exists("wplc_register_pro_version")) {
2549
+ wplc_pro_admin_javascript();
2550
+ } else {
2551
+ wplc_admin_javascript();
2552
+ }
2553
+ do_action("wplc_hook_admin_javascript");
2554
+ }
2555
+
2556
+
2557
+ ?>
2558
+ <script type="text/javascript">
2559
+
2560
+
2561
+ function wplc_desktop_notification() {
2562
+ if (typeof Notification !== 'undefined') {
2563
+ if (!Notification) {
2564
+ return;
2565
+ }
2566
+ if (Notification.permission !== "granted")
2567
+ Notification.requestPermission();
2568
+
2569
+ var wplc_desktop_notification = new Notification('<?php _e('New chat received', 'wplivechat'); ?>', {
2570
+ icon: wplc_notification_icon_url,
2571
+ body: "<?php _e("A new chat has been received. Please go the 'Live Chat' page to accept the chat", "wplivechat"); ?>"
2572
+ });
2573
+ //Notification.close()
2574
+ }
2575
+ }
2576
+
2577
+ </script>
2578
+ <?php
2579
+ }
2580
+
2581
+
2582
+ function old_wplc_superadmin_javascript() {
2583
+
2584
  if (isset($_GET['page']) && ($_GET['page'] == 'wplivechat-menu' || $_GET['page'] == 'wplivechat-menu-settings' || $_GET['page'] == 'wplivechat-menu-offline-messages' || $_GET['page'] == 'wplc-pro-custom-fields' ) ) {
2585
 
2586
  if (!isset($_GET['action'])) {
2591
  }
2592
  do_action("wplc_hook_admin_javascript");
2593
  } // main page
2594
+ else if ( isset($_GET['action']) && ( $_GET['action'] != 'welcome' && $_GET['action'] != 'credits' && $_GET['action'] != 'history' ) ) {
2595
  if (function_exists("wplc_register_pro_version")) {
2596
  wplc_return_pro_admin_chat_javascript(sanitize_text_field($_GET['cid']));
2597
  } else {
2598
+
2599
+ /** set the global chat data here so we dont need to keep getting it from the DB or Cloud server */
2600
+ global $admin_chat_data;
2601
+ $admin_chat_data = wplc_get_chat_data($_GET['cid'], __LINE__);
2602
+
2603
  wplc_return_admin_chat_javascript(sanitize_text_field($_GET['cid']));
2604
 
2605
 
2643
  * @author Nick Duncan <nick@codecabin.co.za>
2644
  */
2645
  function wplc_admin_javascript() {
 
 
2646
 
2647
+ $wplc_settings = get_option("WPLC_SETTINGS");
2648
+ if ( isset( $wplc_settings['wplc_enable_all_admin_pages'] ) && $wplc_settings['wplc_enable_all_admin_pages'] === '1' ) {
2649
+ /* Run admin JS on all admin pages */
2650
+ if ( isset( $_GET['action'] ) && $_GET['action'] == "history" ) { return; }
2651
+ else {
2652
+ wplc_admin_output_js();
2653
+ }
2654
+ } else {
2655
+ /* Only run admin JS on the chat dashboard page */
2656
+ if ( isset( $_GET['page'] ) && $_GET['page'] === 'wplivechat-menu' && !isset( $_GET['action'] ) ) {
2657
+ wplc_admin_output_js();
2658
+ }
2659
+ }
2660
 
 
 
 
2661
 
 
 
 
2662
 
2663
+
2664
 
2665
+
2666
 
2667
+ }
 
2668
 
2669
+ /**
2670
+ * Outputs the admin JS on to the relevant pages, controlled by wplc_admin_javascript();
2671
+ *
2672
+ * @return void
2673
+ * @since 7.1.00
2674
+ * @author Nick Duncan
2675
+ */
2676
+ function wplc_admin_output_js() {
2677
+ $continue = apply_filters( "wplc_version_check_continue", true );
2678
+ if ($continue === true) {
2679
 
 
 
 
 
 
 
2680
 
2681
+ $ajax_nonce = wp_create_nonce("wplc");
2682
+ global $wplc_version;
2683
+
2684
+ $wplc_current_user = get_current_user_id();
2685
+ if( get_user_meta( $wplc_current_user, 'wplc_ma_agent', true )) {
2686
+
2687
+ wp_register_script('wplc-admin-js', plugins_url('js/wplc_u_admin.js', __FILE__), false, $wplc_version, false);
2688
+ wp_enqueue_script('wplc-admin-js');
2689
+ $not_icon = plugins_url('/images/wplc_notification_icon.png', __FILE__);
2690
+
2691
+ $wplc_wav_file = plugins_url('/ring.wav', __FILE__);
2692
+ $wplc_wav_file = apply_filters("wplc_filter_wav_file",$wplc_wav_file);
2693
+ wp_localize_script('wplc-admin-js', 'wplc_wav_file', $wplc_wav_file);
2694
+
2695
+ wp_localize_script('wplc-admin-js', 'wplc_ajax_nonce', $ajax_nonce);
2696
 
2697
+ wp_localize_script('wplc-admin-js', 'wplc_notification_icon', $not_icon);
2698
+
2699
+ $extra_data = apply_filters("wplc_filter_admin_javascript",array());
2700
+ wp_localize_script('wplc-admin-js', 'wplc_extra_data', $extra_data);
2701
+
2702
+ $ajax_url = admin_url('admin-ajax.php');
2703
+ $wplc_ajax_url = apply_filters("wplc_filter_ajax_url",$ajax_url);
2704
+ wp_localize_script('wplc-admin-js', 'wplc_ajaxurl', $wplc_ajax_url);
2705
+ wp_localize_script('wplc-admin-js', 'wplc_ajaxurl_home', admin_url( 'admin-ajax.php' ) );
2706
+
2707
+ $wpc_ma_js_strings = array(
2708
+ 'remove_agent' => __('Remove', 'wplivechat'),
2709
+ 'nonce' => wp_create_nonce("wplc"),
2710
+ 'user_id' => get_current_user_id()
2711
+ );
2712
+ wp_localize_script('wplc-admin-js', 'wplc_admin_strings', $wpc_ma_js_strings);
2713
+
2714
+ }
2715
+ }
2716
  }
2717
 
2718
  function wplc_admin_menu_layout() {
2878
 
2879
  <p><?php _e("Please note: This window must be open in order to receive new chat notifications.", "wplivechat"); ?></p>
2880
  </div>
2881
+
2882
+ <?php
2883
+ $continue = apply_filters( "wplc_version_check_continue", true );
2884
+ if ($continue !== true) {
2885
+
2886
+ echo "<hr />";
2887
+ echo "<center>";
2888
+ echo "<h1>".$continue."</h1>";
2889
+ echo "<p>".sprintf( __( 'Need help? <a href="%s" target="_BLANK">contact us</a>.'),'https://wp-livechat.com/contact-us/')."</p>";
2890
+ echo "</center>";
2891
+
2892
+
2893
+ } else {
2894
+
2895
+ ?>
2896
+
2897
 
2898
  <div id="wplc_sound"></div>
2899
 
2935
 
2936
  </div>
2937
  </div>
2938
+ <?php } ?>
2939
 
2940
 
2941
 
2990
  }
2991
  }
2992
 
2993
+ add_action("wplc_hook_change_status_on_answer","wplc_hook_control_change_status_on_answer",10,2);
2994
+ function wplc_hook_control_change_status_on_answer($get_data, $chat_data = false) {
2995
 
2996
  $user_ID = get_current_user_id();
2997
  wplc_change_chat_status(sanitize_text_field($get_data['cid']), 3,$user_ID );
3001
 
3002
  add_action('wplc_hook_accept_chat','wplc_hook_control_accept_chat',10,2);
3003
  function wplc_hook_control_accept_chat($get_data,$aid) {
 
3004
 
3005
+ global $admin_chat_data;
3006
+
3007
+ if (!$admin_chat_data) {
3008
+ $chat_data = wplc_get_chat_data($get_data['cid'], __LINE__);
3009
+ } else {
3010
+ if (isset($admin_chat_data->id) && intval($admin_chat_data->id) === intval($get_data['cid'])) {
3011
+ $chat_data = $admin_chat_data;
3012
+ } else {
3013
+ /* chat ID's dont match, get the data for the correct chat ID */
3014
+ $chat_data = wplc_get_chat_data($get_data['cid'], __LINE__);
3015
+ }
3016
+ }
3017
 
 
 
 
 
3018
 
3019
+
3020
+
3021
+
3022
+ do_action("wplc_hook_accept_chat_url",$get_data, $chat_data);
3023
+
3024
+ do_action("wplc_hook_change_status_on_answer",$get_data, $chat_data);
3025
+
3026
+
3027
+ if (function_exists("wplc_register_pro_version")) {
3028
+ /* backwards compatibility */
3029
+ wplc_pro_draw_chat_area(sanitize_text_field($get_data['cid']));
3030
+ } else {
3031
+ do_action("wplc_hook_draw_chat_area",$get_data, $chat_data);
3032
+
3033
+ }
3034
 
3035
 
3036
  }
3037
 
3038
+ /**
3039
+ * Hook to accept chat
3040
+ *
3041
+ * @since 7.1.00
3042
+ * @param
3043
+ * @return void
3044
+ * @author Nick Duncan (nick@codecabin.co.za)
3045
+ *
3046
+ */
3047
+ add_action( 'wplc_hook_accept_chat_url' , 'wplc_b_hook_control_accept_chat_url', 5, 2);
3048
+ remove_action( 'wplc_hook_accept_chat_url' , 'wplc_ma_hook_control_accept_chat_url', 10, 2); /* remove the older Pro hook as this was moved now to the basic version in 7.1.00 */
3049
+ function wplc_b_hook_control_accept_chat_url($get_data, $chat_data = false) {
3050
+ if (!isset($get_data['agent_id'])) {
3051
+ /* free version */
3052
+ wplc_b_update_agent_id(sanitize_text_field($get_data['cid']), get_current_user_id());
3053
+ } else {
3054
+ wplc_b_update_agent_id(sanitize_text_field($get_data['cid']), sanitize_text_field($get_data['agent_id']));
3055
+ }
3056
+
3057
+ }
3058
+
3059
+ /**
3060
+ * Assign the chat to the agent
3061
+ *
3062
+ * Replaces the same function of a different name in the older pro version
3063
+ *
3064
+ * @since 7.1.00
3065
+ * @param
3066
+ * @return void
3067
+ * @author Nick Duncan (nick@codecabin.co.za)
3068
+ *
3069
+ */
3070
+ function wplc_b_update_agent_id($cid, $aid){
3071
+ global $wpdb;
3072
+ global $wplc_tblname_chats;
3073
+ $sql = "SELECT * FROM `$wplc_tblname_chats` WHERE `id` = '$cid' LIMIT 1";
3074
+ $result = $wpdb->get_row($sql);
3075
+ if ($result) {
3076
+ if(intval($result->status) != 3){
3077
+ $update = "UPDATE `$wplc_tblname_chats` SET `agent_id` = '$aid' WHERE `id` = '$cid' LIMIT 1";
3078
+ $wpdb->query($update);
3079
+ }
3080
+ }
3081
+ }
3082
+
3083
+
3084
 
3085
  add_action("wplc_hook_chat_dashboard_bottom","wplc_hook_control_app_chat_dashboard_bottom",10);
3086
  function wplc_hook_control_app_chat_dashboard_bottom() {
3087
  //echo "<p>Tired of logging in to accept chats? Use our <a href='https://wp-livechat.com/extensions/mobile-desktop-app-extension/?utm_source=plugin&utm_medium=plugin&utm_campaign=main_app' target='_BLANK'>Android app</a> or <a href='https://wp-livechat.com/extensions/mobile-desktop-app-extension/?utm_source=plugin&utm_medium=plugin&utm_campaign=main_desktop' target='_BLANK'>desktop app</a> to monitor visitors, accept and initiate chats.</p>";
3088
  }
3089
 
3090
+ add_action("wplc_hook_draw_chat_area","wplc_hook_control_draw_chat_area",10,2);
3091
+ function wplc_hook_control_draw_chat_area($get_data, $chat_data = false) {
3092
 
3093
+ wplc_draw_chat_area(sanitize_text_field($get_data['cid']), $chat_data);
3094
  }
3095
 
3096
+ function wplc_draw_chat_area($cid, $chat_data = false) {
3097
 
3098
  global $wpdb;
3099
  global $wplc_tblname_chats;
3100
+
3101
  $results = $wpdb->get_results(
3102
  "
3103
  SELECT *
3107
  "
3108
  );
3109
  if ($results) { } else { $results[0] = null; } /* if chat ID doesnt exist, create the variable anyway to avoid an error. Hopefully the Chat ID exists on the server..! */
3110
+
3111
+
3112
+ $result = apply_filters("wplc_filter_chat_area_data", $results[0], $cid);
3113
+
3114
+
3115
  ?>
3116
  <style>
3117
 
3146
  $user_ip = $user_data['ip'];
3147
  $browser = wplc_return_browser_string($user_data['user_agent']);
3148
  $browser_image = wplc_return_browser_image($browser, "16");
3149
+
3150
+
3151
  global $wplc_basic_plugin_url;
3152
  if ($result->status == 1) {
3153
  $status = __("Previous", "wplivechat");
3178
 
3179
  echo "</div>";
3180
 
3181
+ do_action("wplc_add_js_admin_chat_area", $cid, $chat_data);
3182
 
3183
  echo "<div id='admin_chat_box'>";
3184
 
3185
  $result->continue = true;
3186
 
3187
  do_action("wplc_hook_wplc_draw_chat_area",$result);
3188
+
3189
  if (!$result->continue) { return; }
3190
 
3191
+ echo"<div class='admin_chat_box'><div class='admin_chat_box_inner' id='admin_chat_box_area_" . $result->id . "'>".apply_filters( "wplc_chat_box_draw_chat_box_inner", "", $cid)."</div><div class='admin_chat_box_inner_bottom'>" . wplc_return_chat_response_box($cid, $result) . "</div>";
3192
 
3193
 
3194
  echo "</div>";
3195
  echo "<div class='admin_visitor_info'>";
3196
  do_action("wplc_hook_admin_visitor_info_display_before",$cid);
3197
+
3198
+
3199
  echo " <div style='float:left; width:100px;'><img src=\"//www.gravatar.com/avatar/" . md5($result->email) . "\" class=\"admin_chat_img\" /></div>";
3200
  echo " <div style='float:left;'>";
3201
 
3219
  echo " </div>";
3220
  echo "<hr />";
3221
 
3222
+ echo (apply_filters("wplc_filter_advanced_info","", $result->id, $result->name, $result));
3223
 
3224
  echo " <div id=\"wplc_sound_update\"></div>";
3225
 
3228
  echo "<a href='".admin_url('admin.php?page=wplivechat-menu-extensions-page')."' class='button button-primary' target='_BLANK'>".__("Get more add-ons","wplivechat")."</a>";
3229
  echo "</div>";
3230
 
 
 
3231
  if ($result->status != 1) {
3232
 
3233
  do_action("wplc_hook_admin_below_chat_box",$result);
 
 
3234
  }
3235
 
3236
  }
3237
 
3238
+
3239
  add_action("wplc_hook_admin_below_chat_box","wplc_hook_control_admin_below_chat_box",10);
3240
  function wplc_hook_control_admin_below_chat_box() {
3241
  echo "<div class='admin_chat_quick_controls'>";
3246
 
3247
  }
3248
 
3249
+ function wplc_return_chat_response_box($cid, $chat_data = false) {
3250
+
3251
  $ret = "<div class=\"chat_response_box\">";
3252
  $ret .= apply_filters("wplc_filter_typing_control_div","");
3253
  $ret .= "<input type='text' name='wplc_admin_chatmsg' id='wplc_admin_chatmsg' value='' placeholder='" . __("type here...", "wplivechat") . "' />";
3270
  wp_register_script('wplc-admin-chat-server', plugins_url('js/wplc_server.js', __FILE__), false, $wplc_version, false);
3271
  wp_enqueue_script('wplc-admin-chat-server');
3272
 
3273
+ global $admin_chat_data;
3274
+ if (!$admin_chat_data) {
3275
+ $cdata = wplc_get_chat_data($cid, __LINE__);
3276
+ } else {
3277
+ /* copy the stored admin chat data variable - more efficient */
3278
+ $cdata = $admin_chat_data;
3279
+ }
3280
+
3281
  $other = maybe_unserialize($cdata->other);
3282
 
3283
  if(isset($wplc_settings['wplc_use_node_server']) && $wplc_settings['wplc_use_node_server'] == 1){
3284
  if (isset($other['socket']) && ($other['socket'] == true || $other['socket'] == "true")) {
3285
+ if ( isset( $_GET['action'] ) && $_GET['action'] === 'history') {
3286
+ wp_localize_script('wplc-admin-chat-server', 'wplc_use_node_server', "false");
3287
+ } else {
3288
+ wp_localize_script('wplc-admin-chat-server', 'wplc_use_node_server', "true");
3289
+ wp_localize_script('wplc-admin-chat-server', 'wplc_localized_string_is_typing_single', __(" is typing...","wplivechat"));
3290
+ }
3291
 
3292
  $wplc_node_token = get_option("wplc_node_server_secret_token");
3293
  if(!$wplc_node_token){
3300
  }
3301
  }
3302
 
3303
+ /**
3304
+ * Create a JS object for all Agent ID's and Gravatar MD5's
3305
+ */
3306
+ $user_array = get_users(array(
3307
+ 'meta_key' => 'wplc_ma_agent',
3308
+ ));
3309
+
3310
+ $a_array = array();
3311
+ if ($user_array) {
3312
+ foreach ($user_array as $user) {
3313
+ $a_array[$user->ID] = array();
3314
+ $a_array[$user->ID]['name'] = $user->display_name;
3315
+ $a_array[$user->ID]['md5'] = md5( $user->user_email );
3316
+ }
3317
+ }
3318
+ wp_localize_script('wplc-admin-chat-server', 'wplc_agent_data', $a_array);
3319
+
3320
  /**
3321
+ * Get the CURRENT agent's data
3322
  */
3323
  if(isset($_GET['aid'])){
3324
  $agent_data = get_user_by('ID', intval($_GET['aid']));
3325
  wp_localize_script('wplc-admin-chat-server', 'wplc_admin_agent_name', $agent_data->display_name);
3326
+ wp_localize_script('wplc-admin-chat-server', 'wplc_admin_agent_email', md5($agent_data->user_email));
3327
  } else {
3328
  $agent_data = get_user_by('ID', intval(get_current_user_id()));
3329
  wp_localize_script('wplc-admin-chat-server', 'wplc_admin_agent_name', $agent_data->display_name);
3330
+ wp_localize_script('wplc-admin-chat-server', 'wplc_admin_agent_email', md5($agent_data->user_email));
3331
  }
3332
 
3333
 
3341
 
3342
  if ( (isset($wplc_theme) && $checker >= 6000 ) || (! function_exists("wplc_pro_version_control") ) ) {
3343
  if($wplc_theme == 'theme-default') {
3344
+ wp_register_style('wplc-theme-palette-default', plugins_url('/css/themes/theme-default.css', __FILE__), array(), $wplc_version);
3345
  wp_enqueue_style('wplc-theme-palette-default');
3346
 
3347
  }
3348
  else if($wplc_theme == 'theme-1') {
3349
+ wp_register_style('wplc-theme-palette-1', plugins_url('/css/themes/theme-1.css', __FILE__), array(), $wplc_version);
3350
  wp_enqueue_style('wplc-theme-palette-1');
3351
 
3352
  }
3353
  else if($wplc_theme == 'theme-2') {
3354
+ wp_register_style('wplc-theme-palette-2', plugins_url('/css/themes/theme-2.css', __FILE__), array(), $wplc_version);
3355
  wp_enqueue_style('wplc-theme-palette-2');
3356
 
3357
  }
3358
  else if($wplc_theme == 'theme-3') {
3359
+ wp_register_style('wplc-theme-palette-3', plugins_url('/css/themes/theme-3.css', __FILE__), array(), $wplc_version);
3360
  wp_enqueue_style('wplc-theme-palette-3');
3361
 
3362
  }
3363
  else if($wplc_theme == 'theme-4') {
3364
+ wp_register_style('wplc-theme-palette-4', plugins_url('/css/themes/theme-4.css', __FILE__), array(), $wplc_version);
3365
  wp_enqueue_style('wplc-theme-palette-4');
3366
 
3367
  }
3368
  else if($wplc_theme == 'theme-5') {
3369
+ wp_register_style('wplc-theme-palette-5', plugins_url('/css/themes/theme-5.css', __FILE__), array(), $wplc_version);
3370
  wp_enqueue_style('wplc-theme-palette-5');
3371
 
3372
  }
3381
  $wplc_settings = get_option("WPLC_SETTINGS");
3382
  $wplc_user_data = get_user_by( 'id', get_current_user_id() );
3383
 
3384
+ if (isset($cdata->agent_id)) {
3385
+ $wplc_agent_data = get_user_by( 'id', intval( $cdata->agent_id ) );
3386
+ }
3387
+
3388
+
3389
+ if( isset($wplc_settings['wplc_show_name']) && $wplc_settings['wplc_show_name'] == '1' ){ $wplc_show_name = true; } else { $wplc_show_name = false; }
3390
+ if( isset($wplc_settings['wplc_show_avatar']) && $wplc_settings['wplc_show_avatar'] ){ $wplc_show_avatar = true; } else { $wplc_show_avatar = false; }
3391
+ if( isset($wplc_settings['wplc_show_date']) && $wplc_settings['wplc_show_date'] == '1' ){ $wplc_show_date = true; } else { $wplc_show_date = false; }
3392
+ if( isset($wplc_settings['wplc_show_time']) && $wplc_settings['wplc_show_time'] == '1' ){ $wplc_show_time = true; } else { $wplc_show_time = false; }
3393
+
3394
+ $wplc_chat_detail = array( 'name' => $wplc_show_name, 'avatar' => $wplc_show_avatar, 'date' => $wplc_show_date, 'time' => $wplc_show_time );
 
3395
 
 
3396
 
3397
  wp_enqueue_script('wplc-admin-chat-js');
3398
 
3399
+
3400
+ wp_localize_script( 'wplc-admin-chat-js', 'wplc_show_chat_detail', $wplc_chat_detail );
3401
+
3402
+ if (!empty( $wplc_agent_data ) ) {
3403
+ wp_localize_script( 'wplc-admin-chat-js', 'wplc_agent_name', $wplc_agent_data->display_name );
3404
+ wp_localize_script( 'wplc-admin-chat-js', 'wplc_agent_email', md5( $wplc_agent_data->user_email ) );
3405
+ } else {
3406
+ wp_localize_script( 'wplc-admin-chat-js', 'wplc_agent_name', '' );
3407
+ wp_localize_script( 'wplc-admin-chat-js', 'wplc_agent_email', '' );
3408
+ }
3409
+
3410
  wp_localize_script('wplc-admin-chat-js', 'wplc_chat_name', $cdata->name);
3411
+ wp_localize_script('wplc-admin-chat-js', 'wplc_chat_email', md5($cdata->email));
3412
 
3413
  if(class_exists("WP_REST_Request")) {
3414
  wp_localize_script('wplc-admin-chat-js', 'wplc_restapi_enabled', '1');
3415
  wp_localize_script('wplc-admin-chat-js', 'wplc_restapi_token', get_option('wplc_api_secret_token'));
3416
+ wp_localize_script('wplc-admin-chat-js', 'wplc_restapi_endpoint', site_url().'/wp-json/wp_live_chat_support/v1');
3417
  } else {
3418
  wp_localize_script('wplc-admin-chat-js', 'wplc_restapi_enabled', '0');
3419
  }
3461
 
3462
  wp_localize_script('wplc-admin-chat-js', 'wplc_name', $display_name);
3463
  wp_localize_script('wplc-admin-chat-js', 'wplc_enable_ding', $enable_ding);
 
3464
 
3465
  $ajax_url = admin_url('admin-ajax.php');
3466
  $home_ajax_url = $ajax_url;
3532
  "wplc_pro_offline_btn" => __("Leave a message", "wplivechat"),
3533
  "wplc_pro_offline_btn_send" => __("Send message", "wplivechat"),
3534
  "wplc_user_enter" => __("Press ENTER to send your message", "wplivechat"),
3535
+ "wplc_text_chat_ended" => __("The chat has been ended by the operator.", "wplivechat"),
3536
  "wplc_close_btn_text" => __("close", "wplivechat"),
3537
  "wplc_user_welcome_chat" => __("Welcome. How may I help you?", "wplivechat"),
3538
  'wplc_welcome_msg' => __("Please standby for an agent. While you wait for the agent you may type your message.","wplivechat")
3544
 
3545
 
3546
 
3547
+
3548
  $admins = get_role('administrator');
3549
+ if( $admins !== null ) { $admins->add_cap('wplc_ma_agent'); }
3550
+
3551
 
3552
  $uid = get_current_user_id();
3553
  update_user_meta($uid, 'wplc_ma_agent', 1);
3578
  session varchar(100) NOT NULL,
3579
  url varchar(700) NOT NULL,
3580
  last_active_timestamp datetime NOT NULL,
3581
+ agent_id INT(11) NOT NULL,
3582
  other LONGTEXT NOT NULL,
3583
  PRIMARY KEY (id)
3584
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
3599
  timestamp datetime NOT NULL,
3600
  status INT(3) NOT NULL,
3601
  originates INT(3) NOT NULL,
3602
+ other LONGTEXT NOT NULL,
3603
  PRIMARY KEY (id)
3604
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
3605
  ';
3640
  }
3641
 
3642
  function wplc_add_user_stylesheet() {
3643
+ global $wplc_version;
3644
  if(function_exists('wplc_display_chat_contents')){
3645
  $show_chat_contents = wplc_display_chat_contents();
3646
  } else {
3652
  wp_register_style( 'wplc-font-awesome', plugins_url( '/css/font-awesome.min.css', __FILE__ ) );
3653
  wp_enqueue_style( 'wplc-font-awesome' );
3654
  }
3655
+ wp_register_style('wplc-style', plugins_url('/css/wplcstyle.css', __FILE__), array(), $wplc_version);
3656
  wp_enqueue_style('wplc-style');
3657
 
3658
+ if( isset( $wplc_settings['wplc_elem_trigger_id'] ) && trim( $wplc_settings['wplc_elem_trigger_id'] ) !== "" ) {
3659
+ if( isset( $wplc_settings['wplc_elem_trigger_type'] ) ){
3660
+ if ( $wplc_settings['wplc_elem_trigger_type'] === "0" ) {
3661
+ /* class */
3662
+ $wplc_elem_style_prefix = ".";
3663
+ } else {
3664
+ /* ID */
3665
+ $wplc_elem_style_prefix = "#";
3666
+ }
3667
+ }
3668
+
3669
+
3670
+ $wplc_elem_inline_style = $wplc_elem_style_prefix.stripslashes( $wplc_settings['wplc_elem_trigger_id'] ).":hover { cursor:pointer; }";
3671
+ wp_add_inline_style( 'wplc-style', stripslashes( $wplc_elem_inline_style ) );
3672
+
3673
+ }
3674
+
3675
+ // Serve the icon up over HTTPS if needs be
3676
+ //$icon = plugins_url('images/chaticon.png', __FILE__);
3677
+ $icon = plugins_url('images/iconRetina.png', __FILE__);
3678
+ $close_icon = plugins_url('images/iconCloseRetina.png', __FILE__);
3679
+
3680
+
3681
+ if ( isset( $wplc_settings['wplc_settings_bg'] ) ) {
3682
+ if ( $wplc_settings['wplc_settings_bg'] == "0" ) { $bg = false; } else { $bg = esc_attr( $wplc_settings['wplc_settings_bg'] ); }
3683
+ } else { $bg = "cloudy.jpg"; }
3684
+ if ($bg) {
3685
+ $bg = plugins_url('images/bg/'.$bg, __FILE__);
3686
+ $bg_string = "#wp-live-chat-4 { background:url('$bg') repeat; background-size: cover; }";
3687
+ } else { $bg_string = "#wp-live-chat-4 { background-color: #fff; }"; }
3688
+
3689
+ if( isset( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] ){ $icon = preg_replace('/^http:\/\//', 'https:\/\/', $icon); }
3690
+ if( isset( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] ){ $close_icon = preg_replace('/^http:\/\//', 'https:\/\/', $close_icon); }
3691
+ $icon = apply_filters("wplc_filter_chaticon",$icon);
3692
+
3693
+ $close_icon = apply_filters("wplc_filter_chaticon_close",$close_icon);
3694
+
3695
+ $wplc_elem_inline_style = "#wp-live-chat-header { background:url('$icon') no-repeat; background-size: cover; } #wp-live-chat-header.active { background:url('$close_icon') no-repeat; background-size: cover; } $bg_string";
3696
+ wp_add_inline_style( 'wplc-style', stripslashes( $wplc_elem_inline_style ) );
3697
+
3698
+
3699
 
3700
  global $wplc_pro_version;
3701
  $wplc_ver = str_replace('.', '', $wplc_pro_version);
3716
 
3717
  if ( (isset($wplc_theme) && $checker >= 6000 ) || (! function_exists("wplc_pro_version_control") ) ) {
3718
  if($wplc_theme == 'theme-default') {
3719
+ wp_register_style('wplc-theme-palette-default', plugins_url('/css/themes/theme-default.css', __FILE__), array(), $wplc_version);
3720
  wp_enqueue_style('wplc-theme-palette-default');
3721
 
3722
  }
3723
  else if($wplc_theme == 'theme-1') {
3724
+ wp_register_style('wplc-theme-palette-1', plugins_url('/css/themes/theme-1.css', __FILE__), array(), $wplc_version);
3725
  wp_enqueue_style('wplc-theme-palette-1');
3726
 
3727
  }
3728
  else if($wplc_theme == 'theme-2') {
3729
+ wp_register_style('wplc-theme-palette-2', plugins_url('/css/themes/theme-2.css', __FILE__), array(), $wplc_version);
3730
  wp_enqueue_style('wplc-theme-palette-2');
3731
 
3732
  }
3733
  else if($wplc_theme == 'theme-3') {
3734
+ wp_register_style('wplc-theme-palette-3', plugins_url('/css/themes/theme-3.css', __FILE__), array(), $wplc_version);
3735
  wp_enqueue_style('wplc-theme-palette-3');
3736
 
3737
  }
3738
  else if($wplc_theme == 'theme-4') {
3739
+ wp_register_style('wplc-theme-palette-4', plugins_url('/css/themes/theme-4.css', __FILE__), array(), $wplc_version);
3740
  wp_enqueue_style('wplc-theme-palette-4');
3741
 
3742
  }
3743
  else if($wplc_theme == 'theme-5') {
3744
+ wp_register_style('wplc-theme-palette-5', plugins_url('/css/themes/theme-5.css', __FILE__), array(), $wplc_version);
3745
  wp_enqueue_style('wplc-theme-palette-5');
3746
 
3747
  }
3760
  if (isset($wplc_settings['wplc_newtheme'])) { $wplc_newtheme = $wplc_settings['wplc_newtheme']; } else { }
3761
  if (isset($wplc_newtheme)) {
3762
  if($wplc_newtheme == 'theme-1') {
3763
+ wp_register_style('wplc-theme-classic', plugins_url('/css/themes/classic.css', __FILE__), array(), $wplc_version);
3764
  wp_enqueue_style('wplc-theme-classic');
3765
 
3766
  }
3767
  else if($wplc_newtheme == 'theme-2') {
3768
+ wp_register_style('wplc-theme-modern', plugins_url('/css/themes/modern.css', __FILE__), array(), $wplc_version);
3769
  wp_enqueue_style('wplc-theme-modern');
3770
 
3771
  }
3772
  }
3773
 
3774
  if ($wplc_settings["wplc_settings_align"] == 1) {
3775
+ wp_register_style('wplc-theme-position', plugins_url('/css/themes/position-bottom-left.css', __FILE__), array(), $wplc_version);
3776
  wp_enqueue_style('wplc-theme-position');
3777
  } else if ($wplc_settings["wplc_settings_align"] == 2) {
3778
+ wp_register_style('wplc-theme-position', plugins_url('/css/themes/position-bottom-right.css', __FILE__), array(), $wplc_version);
3779
  wp_enqueue_style('wplc-theme-position');
3780
  } else if ($wplc_settings["wplc_settings_align"] == 3) {
3781
+ wp_register_style('wplc-theme-position', plugins_url('/css/themes/position-left.css', __FILE__), array(), $wplc_version);
3782
  wp_enqueue_style('wplc-theme-position');
3783
  } else if ($wplc_settings["wplc_settings_align"] == 4) {
3784
+ wp_register_style('wplc-theme-position', plugins_url('/css/themes/position-right.css', __FILE__), array(), $wplc_version);
3785
  wp_enqueue_style('wplc-theme-position');
3786
  } else {
3787
+ wp_register_style('wplc-theme-position', plugins_url('/css/themes/position-bottom-right.css', __FILE__), array(), $wplc_version);
3788
  wp_enqueue_style('wplc-theme-position');
3789
  }
3790
 
3805
  * @return void
3806
  */
3807
  function wplc_add_admin_stylesheet() {
3808
+ global $wplc_version;
3809
  if (isset($_GET['page']) && ($_GET['page'] == 'wplivechat-menu' || $_GET['page'] == 'wplivechat-menu-api-keys-page' || $_GET['page'] == 'wplivechat-menu-extensions-page' || $_GET['page'] == 'wplivechat-menu-settings' || $_GET['page'] == 'wplivechat-menu-offline-messages' || $_GET['page'] == 'wplivechat-menu-history' || $_GET['page'] == 'wplivechat-menu-missed-chats')) {
3810
+ wp_register_style( 'wplc-admin-style', plugins_url( '/css/jquery-ui.css', __FILE__ ), false, $wplc_version );
3811
+ wp_enqueue_style( 'wplc-admin-style' );
3812
+ wp_register_style( 'wplc-chat-style', plugins_url( '/css/chat-style.css', __FILE__ ), false, $wplc_version );
3813
+ wp_enqueue_style( 'wplc-chat-style' );
3814
+ wp_register_style( 'wplc-font-awesome', plugins_url( '/css/font-awesome.min.css', __FILE__ ), false, $wplc_version );
3815
+ wp_enqueue_style( 'wplc-font-awesome' );
3816
+ wp_enqueue_script( 'jquery-ui-core' );
3817
+ wp_enqueue_script( 'jquery-effects-core' );
3818
  }
3819
  if (isset($_GET['page']) && $_GET['page'] == 'wplivechat-menu' && isset($_GET['action']) && $_GET['action'] == "ac") {
3820
+ wp_register_style('wplc-admin-chat-box-style', plugins_url('/css/admin-chat-box-style.css', __FILE__ ), false, $wplc_version );
3821
  wp_enqueue_style('wplc-admin-chat-box-style');
3822
 
3823
  }
3824
  if (isset($_GET['page']) && $_GET['page'] == "wplivechat-menu-support-page") {
3825
+ wp_register_style('fontawesome', plugins_url('css/font-awesome.min.css', __FILE__ ), false, $wplc_version );
3826
  wp_enqueue_style('fontawesome');
3827
+ wp_register_style('wplc-support-page-css', plugins_url('css/support-css.css', __FILE__ ), false, $wplc_version );
3828
  wp_enqueue_style('wplc-support-page-css');
3829
  }
3830
  }
3943
  //Prompt
3944
  echo "<div class='update-nag' style='margin-top: 0px;margin-bottom: 5px;'>
3945
  ".__("Are you sure you would like to delete this chat?", "wplivechat")."<br>
3946
+ <a class='button' href='?page=wplivechat-menu-history&wplc_action=remove_cid&cid=".sanitize_text_field( $_GET['cid'] )."&wplc_confirm=1''>".__("Yes", "wplivechat")."</a> <a class='button' href='?page=wplivechat-menu-history'>".__("No", "wplivechat")."</a>
3947
  </div>";
3948
  }
3949
  }
4211
 
4212
  do_action("wplc_hook_admin_settings_save");
4213
  if (isset($_POST['wplc_settings_align'])) { $wplc_data['wplc_settings_align'] = esc_attr($_POST['wplc_settings_align']); }
4214
+ if (isset($_POST['wplc_settings_bg'])) { $wplc_data['wplc_settings_bg'] = esc_attr($_POST['wplc_settings_bg']); }
4215
  if (isset($_POST['wplc_environment'])) { $wplc_data['wplc_environment'] = esc_attr($_POST['wplc_environment']); }
4216
  if (isset($_POST['wplc_settings_fill'])) { $wplc_data['wplc_settings_fill'] = esc_attr($_POST['wplc_settings_fill']); }
4217
  if (isset($_POST['wplc_settings_font'])) { $wplc_data['wplc_settings_font'] = esc_attr($_POST['wplc_settings_font']); }
4238
  if(isset($_POST['wplc_record_ip_address'])){ $wplc_data['wplc_record_ip_address'] = esc_attr($_POST['wplc_record_ip_address']); } else { $wplc_data['wplc_record_ip_address'] = "0"; }
4239
  if(isset($_POST['wplc_enable_msg_sound'])){ $wplc_data['wplc_enable_msg_sound'] = esc_attr($_POST['wplc_enable_msg_sound']); } else { $wplc_data['wplc_enable_msg_sound'] = "0"; }
4240
  if(isset($_POST['wplc_enable_font_awesome'])){ $wplc_data['wplc_enable_font_awesome'] = esc_attr($_POST['wplc_enable_font_awesome']); } else { $wplc_data['wplc_enable_font_awesome'] = "0"; }
4241
+ if(isset($_POST['wplc_enable_all_admin_pages'])){ $wplc_data['wplc_enable_all_admin_pages'] = esc_attr($_POST['wplc_enable_all_admin_pages']); } else { $wplc_data['wplc_enable_all_admin_pages'] = "0"; }
4242
 
4243
  if (isset($_POST['wplc_pro_na'])) { $wplc_data['wplc_pro_na'] = esc_attr($_POST['wplc_pro_na']); }
4244
  if (isset($_POST['wplc_hide_when_offline'])) { $wplc_data['wplc_hide_when_offline'] = esc_attr($_POST['wplc_hide_when_offline']); }
4264
  if (isset($_POST['wplc_pro_tst1'])) { $wplc_data['wplc_pro_tst1'] = esc_attr($_POST['wplc_pro_tst1']); }
4265
  if (isset($_POST['wplc_pro_intro'])) { $wplc_data['wplc_pro_intro'] = esc_attr($_POST['wplc_pro_intro']); }
4266
  if (isset($_POST['wplc_user_enter'])) { $wplc_data['wplc_user_enter'] = esc_attr($_POST['wplc_user_enter']); }
4267
+ if (isset($_POST['wplc_text_chat_ended'])) { $wplc_data['wplc_text_chat_ended'] = esc_attr($_POST['wplc_text_chat_ended']); }
4268
  if (isset($_POST['wplc_close_btn_text'])) { $wplc_data['wplc_close_btn_text'] = esc_attr($_POST['wplc_close_btn_text']); }
4269
  if (isset($_POST['wplc_user_welcome_chat'])) { $wplc_data['wplc_user_welcome_chat'] = esc_attr($_POST['wplc_user_welcome_chat']); }
4270
  if (isset($_POST['wplc_welcome_msg'])) { $wplc_data['wplc_welcome_msg'] = esc_attr($_POST['wplc_welcome_msg']); }
4406
  */
4407
  function wplc_get_home_path() {
4408
  $home = get_option('home');
4409
+ $siteurl = site_url();
4410
  if (!empty($home) && 0 !== strcasecmp($home, $siteurl)) {
4411
  $wp_path_rel_to_home = str_ireplace($home, '', $siteurl); /* $siteurl - $home */
4412
  $pos = strripos(str_replace('\\', '/', $_SERVER['SCRIPT_FILENAME']), trailingslashit($wp_path_rel_to_home));
4698
  }
4699
  } else {
4700
 
4701
+ if ($post_data['first_run'] === "true") {
4702
+ /* get the chat messages for the first run */
4703
+ $array['chat_history'] = wplc_return_chat_messages($post_data['cid'], false, true, false, false, 'array', false);
4704
+ $array['action'] = "wplc_chat_history";
4705
+
4706
+ } else {
4707
+
4708
+ $new_chat_status = wplc_return_chat_status(sanitize_text_field($post_data['cid']));
4709
+ if($new_chat_status != $post_data['chat_status']){
4710
+ $array['chat_status'] = $new_chat_status;
4711
+ $array['action'] = "wplc_update_chat_status";
4712
+ }
4713
+ $new_chat_message = wplc_return_admin_chat_messages(sanitize_text_field($post_data['cid']));
4714
+
4715
+ if($new_chat_message){
4716
+
4717
+ $array['chat_message'] = $new_chat_message;
4718
+ $array['action'] = "wplc_new_chat_message";
4719
+ }
4720
+ }
4721
  }
4722
 
4723
  return $array;
4820
  * @return array Contents of the chat based on the ID provided
4821
  */
4822
  function wplc_get_chat_data($cid,$line = false) {
4823
+ $result = apply_filters("wplc_filter_get_chat_data",null,$cid);
4824
+ return $result;
4825
+ }
4826
+
4827
+ add_filter( "wplc_filter_get_chat_data", "wplc_get_local_chat_data", 10, 2 );
4828
+ function wplc_get_local_chat_data($result, $cid) {
4829
+ global $wpdb;
4830
+ global $wplc_tblname_chats;
4831
+
4832
+ $sql = "SELECT * FROM $wplc_tblname_chats WHERE `id` = '".intval($cid)."' LIMIT 1";
4833
+ $results = $wpdb->get_results($sql);
4834
+ if (isset($results[0])) { $result = $results[0]; } else { $result = null; }
4835
+
4836
+ return $result;
4837
 
 
 
 
 
 
4838
  }
4839
 
4840
  /**
5152
  } else if(!isset($wplc_settings["wplc_powered_by_link"])) {
5153
 
5154
  } else{
5155
+ $content .= "<a title='".__("Powered By WP Live Chat Support", "wplivechat")."' target='_blank' rel='nofollow' href='https://wp-livechat.com/?utm_source=poweredby&utm_medium=click&utm_campaign=".esc_html(site_url())."' class='wplc_powered_by_link'>".__("Powered By WP Live Chat Support", "wplivechat")."</a>";
5156
  }
5157
  return $content;
5158
  }
5403
  return $msg;
5404
  }
5405
 
5406
+ add_filter("wplc_filter_advanced_info","nifty_rating_advanced_info_upsell",1,4);
5407
  /**
5408
  * Chat experience ratings upselling page
5409
  * @param string $msg current chat window contents
5411
  * @param string $name User's name
5412
  * @return string current chat window contents with the experience rating content appended
5413
  */
5414
+ function nifty_rating_advanced_info_upsell($msg, $cid, $name, $chat_data){
5415
  if(!function_exists("nifty_rating_advanced_info_control") && is_admin() && !function_exists("wplc_pro_activate")){
5416
  $msg .= "<div class='admin_visitor_advanced_info admin_agent_rating wplc_faded_upsell'>
5417
  <strong>" . __("Experience Rating", "wplivechat") . "</strong>
5431
  add_filter("wplc_filter_typing_control_div_theme_2","wplc_basic_filter_control_return_chat_response_box_before_theme2",2,1);
5432
  function wplc_basic_filter_control_return_chat_response_box_before_theme2($string) {
5433
  remove_filter("wplc_filter_typing_control_div_theme_2","wplc_pro_filter_control_return_chat_response_box_before_theme2");
5434
+ $string = $string. "<div class='typing_indicator wplc-color-2 wplc-color-bg-1'></div>";
5435
 
5436
  return $string;
5437
  }
5702
  $show_powered_by = get_option( "WPLC_POWERED_BY" );
5703
 
5704
  if( $show_powered_by == 1){
5705
+ $ret = "<i style='text-align: center; display: block; padding: 5px 0; font-size: 10px;'><a href='https://wp-livechat.com/?utm_source=poweredby&utm_medium=click&utm_campaign=".esc_html(site_url())."'' target='_BLANK' rel='nofollow'>".__("Powered by WP Live Chat Support", "wplivechat")."</a></i>";
 
5706
 
5707
  } else {
5708
 
5867
  $content .= "</table>";
5868
 
5869
  echo $content;
5870
+ }
5871
+
5872
+ add_filter( 'wplc_filter_active_chat_box_notification', 'wplc_active_chat_box_notice' );
5873
+
5874
+ if ( ! function_exists( "wplc_active_chat_box_notices" ) ) {
5875
+ add_action( "wplc_hook_chat_dashboard_above", "wplc_active_chat_box_notices" );
5876
+ function wplc_active_chat_box_notices() {
5877
+ $wplc_settings = get_option( "WPLC_SETTINGS" );
5878
+ if ( $wplc_settings["wplc_settings_enabled"] == 2 ) { ?>
5879
+ <div class="wplc-chat-box-notification wplc-chat-box-notification--disabled">
5880
+ <p><?php echo sprintf( __( 'The Live Chat box is currently disabled on your website due to : <a href="%s">General Settings</a>', 'wp-livechat' ), admin_url( 'admin.php?page=wplivechat-menu-settings#tabs-1' ) ) ?></p>
5881
+ </div>
5882
+ <?php
5883
+ } else {
5884
+ //$notice = '<div class="wplc-chat-box-notification">';
5885
+ //$notice .= '<p>' . __( 'The Live Chat box is currently active', 'wp-livechat' ) . '</p>';
5886
+ //$notice .= '</div>';
5887
+ $notice = '';
5888
+ $notice = apply_filters( 'wplc_filter_active_chat_box_notice', $notice );
5889
+ echo $notice;
5890
+ }
5891
+
5892
+ }
5893
+ }
5894
+
5895
+
5896
+ add_filter("wplc_filter_chat_4th_layer_below_input","nifty_chat_ratings_div_backwards_compat",2,2);
5897
+ /**
5898
+ * This adds backwards compatibility to the new look and feel of the modern chat box
5899
+ *
5900
+ * The ' | ' is removed from the rating icons to fit the new look and feel
5901
+ *
5902
+ */
5903
+ function nifty_chat_ratings_div_backwards_compat($msg, $wplc_setting){
5904
+ $msg = str_replace(" | ","", $msg);
5905
+ return $msg;
5906
+
5907
+ }
5908
+
5909
+ /**
5910
+ * Identifies if the chat box should show, scripts should run and the dashboard should display correctly all based on certain versions.
5911
+ *
5912
+ * i.e. This is the part where we force users to upgrade their extensions to make sure everything works correctly.
5913
+ *
5914
+ * Use with caution and always try add backwards compatibility where necessary
5915
+ *
5916
+ * @param bool $continue
5917
+ * @return bool
5918
+ * @since 7.1.00
5919
+ * @author Nick Duncan
5920
+ */
5921
+ add_filter( "wplc_version_check_continue", "wplc_filter_control_version_check_continue", 10, 1 );
5922
+ function wplc_filter_control_version_check_continue( $continue ) {
5923
+
5924
+ /**
5925
+ * Check to see that we are on the cloud server 1.3.00 or newer
5926
+ */
5927
+ if ( function_exists("wplc_cloud_load_updates") ) {
5928
+ global $wplc_cloud_version;
5929
+ $float_version = intval( str_replace(".", "", $wplc_cloud_version ) );
5930
+ if ($float_version < 2000) {
5931
+ return sprintf( "Your chat has been disabled due to a version conflict. Please <a href='%s'>update your cloud extension</a> to 1.3.00 or higher.", admin_url('update-core.php') )."<br />";
5932
+
5933
+ }
5934
+ }
5935
+
5936
+ return $continue;
5937
+
5938
+ }