Version Description
- 2015-08-06 - Medium Priority =
- WP Live Chat Support is now compatible with all caching plugins
- Fixed a bug that set the wrong permissions for the default chat agent
- Fixed the bug that shows the status of undefined if the user minimized the chat
Download this release
Release Info
Developer | WP-LiveChat |
Plugin | WP Live Chat Support |
Version | 5.0.4 |
Comparing to | |
See all releases |
Code changes from version 5.0.3 to 5.0.4
- ajax_new.php +9 -0
- functions.php +77 -71
- js/wplc_u.js +49 -21
- readme.txt +5 -1
- wp-live-chat-support.php +283 -151
ajax_new.php
CHANGED
@@ -18,6 +18,11 @@ add_action('wp_ajax_nopriv_wplc_user_minimize_chat', 'wplc_init_ajax_callback');
|
|
18 |
add_action('wp_ajax_nopriv_wplc_user_maximize_chat', 'wplc_init_ajax_callback');
|
19 |
add_action('wp_ajax_nopriv_wplc_user_send_msg', 'wplc_init_ajax_callback');
|
20 |
|
|
|
|
|
|
|
|
|
|
|
21 |
function wplc_init_ajax_callback() {
|
22 |
@ob_start();
|
23 |
$check = check_ajax_referer( 'wplc', 'security' );
|
@@ -39,6 +44,10 @@ function wplc_init_ajax_callback() {
|
|
39 |
/* we're using PHP 'sleep' which may lock other requests until our script wakes up. Call this function to ensure that other requests can run without waiting for us to finish */
|
40 |
session_write_close();
|
41 |
|
|
|
|
|
|
|
|
|
42 |
if($_POST['action'] == 'wplc_admin_long_poll'){
|
43 |
if (defined('WPLC_TIMEOUT')) { @set_time_limit(WPLC_TIMEOUT); } else { @set_time_limit(120); }
|
44 |
//sleep(6);
|
18 |
add_action('wp_ajax_nopriv_wplc_user_maximize_chat', 'wplc_init_ajax_callback');
|
19 |
add_action('wp_ajax_nopriv_wplc_user_send_msg', 'wplc_init_ajax_callback');
|
20 |
|
21 |
+
add_action('wp_ajax_wplc_get_chat_box', 'wplc_init_ajax_callback');
|
22 |
+
add_action('wp_ajax_nopriv_wplc_get_chat_box', 'wplc_init_ajax_callback');
|
23 |
+
|
24 |
+
|
25 |
+
|
26 |
function wplc_init_ajax_callback() {
|
27 |
@ob_start();
|
28 |
$check = check_ajax_referer( 'wplc', 'security' );
|
44 |
/* we're using PHP 'sleep' which may lock other requests until our script wakes up. Call this function to ensure that other requests can run without waiting for us to finish */
|
45 |
session_write_close();
|
46 |
|
47 |
+
if ($_POST['action'] == "wplc_get_chat_box") {
|
48 |
+
echo wplc_output_box_ajax();
|
49 |
+
}
|
50 |
+
|
51 |
if($_POST['action'] == 'wplc_admin_long_poll'){
|
52 |
if (defined('WPLC_TIMEOUT')) { @set_time_limit(WPLC_TIMEOUT); } else { @set_time_limit(120); }
|
53 |
//sleep(6);
|
functions.php
CHANGED
@@ -140,7 +140,7 @@ function wplc_record_chat_msg($from,$cid,$msg) {
|
|
140 |
global $wplc_tblname_msgs;
|
141 |
|
142 |
if ($from == "2") {
|
143 |
-
if (
|
144 |
}
|
145 |
|
146 |
if ($from == "1") {
|
@@ -726,97 +726,103 @@ function wplc_mark_as_read_user_chat_messages($cid) {
|
|
726 |
//here
|
727 |
function wplc_return_admin_chat_messages($cid) {
|
728 |
|
729 |
-
if (
|
730 |
-
|
731 |
|
732 |
|
733 |
-
|
|
|
|
|
|
|
734 |
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
"
|
746 |
-
);
|
747 |
|
748 |
-
|
749 |
-
|
750 |
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
|
|
764 |
}
|
765 |
-
}
|
766 |
-
|
767 |
-
$class = "wplc-user-message";
|
768 |
|
769 |
-
|
770 |
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
|
|
775 |
}
|
776 |
-
}
|
777 |
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
|
|
786 |
}
|
787 |
-
}
|
788 |
|
789 |
|
790 |
|
791 |
-
|
|
|
|
|
|
|
792 |
|
793 |
|
794 |
}
|
795 |
function wplc_mark_as_read_admin_chat_messages($mid) {
|
796 |
-
if (
|
797 |
|
798 |
-
|
799 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
800 |
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
$wplc_tblname_msgs,
|
813 |
-
array(
|
814 |
-
'status' => 1
|
815 |
-
),
|
816 |
-
array('id' => $mid),
|
817 |
-
array('%d'),
|
818 |
-
array('%d')
|
819 |
-
);
|
820 |
|
821 |
|
822 |
}
|
140 |
global $wplc_tblname_msgs;
|
141 |
|
142 |
if ($from == "2") {
|
143 |
+
if (current_user_can("wplc_ma_agent") || current_user_can("manage_options")) { } else { return "security issue"; }
|
144 |
}
|
145 |
|
146 |
if ($from == "1") {
|
726 |
//here
|
727 |
function wplc_return_admin_chat_messages($cid) {
|
728 |
|
729 |
+
if (current_user_can("wplc_ma_agent") || current_user_can("manage_options")) {
|
730 |
+
$wplc_settings = get_option("WPLC_SETTINGS");
|
731 |
|
732 |
|
733 |
+
if(isset($wplc_settings['wplc_display_name']) && $wplc_settings['wplc_display_name'] == 1){ $display_name = 1; } else { $display_name = 0; }
|
734 |
+
|
735 |
+
global $wpdb;
|
736 |
+
global $wplc_tblname_msgs;
|
737 |
|
738 |
+
$results = $wpdb->get_results(
|
739 |
+
"
|
740 |
+
SELECT *
|
741 |
+
FROM $wplc_tblname_msgs
|
742 |
+
WHERE `chat_sess_id` = '$cid' AND `status` = '0' AND `originates` = '2'
|
743 |
+
ORDER BY `timestamp` ASC
|
744 |
+
|
745 |
+
"
|
746 |
+
);
|
|
|
|
|
|
|
747 |
|
748 |
+
$msg_hist = "";
|
749 |
+
foreach ($results as $result) {
|
750 |
|
751 |
+
$id = $result->id;
|
752 |
+
$from = $result->from;
|
753 |
+
wplc_mark_as_read_admin_chat_messages($id);
|
754 |
+
$msg = $result->msg;
|
755 |
+
//$timestamp = strtotime($result->timestamp);
|
756 |
+
//$timeshow = date("H:i",$timestamp);
|
757 |
+
$image = "";
|
758 |
+
if($result->originates == 1){
|
759 |
+
$class = "wplc-admin-message";
|
760 |
+
if(function_exists("wplc_pro_get_admin_picture")){
|
761 |
+
$src = wplc_pro_get_admin_picture();
|
762 |
+
if($src){
|
763 |
+
$image = "<img src=".$src." width='20px' id='wp-live-chat-2-img'/>";
|
764 |
+
}
|
765 |
}
|
766 |
+
} else {
|
767 |
+
$class = "wplc-user-message";
|
|
|
768 |
|
769 |
+
if(isset($_COOKIE['wplc_email']) && $_COOKIE['wplc_email'] != ""){ $wplc_user_gravatar = md5(strtolower(trim($_COOKIE['wplc_email']))); } else { $wplc_user_gravatar = ""; }
|
770 |
|
771 |
+
if($wplc_user_gravatar != ""){
|
772 |
+
$image = "<img src='//www.gravatar.com/avatar/$wplc_user_gravatar?s=20' />";
|
773 |
+
} else {
|
774 |
+
$image = "";
|
775 |
+
}
|
776 |
}
|
|
|
777 |
|
778 |
+
if(function_exists('wplc_decrypt_msg')){
|
779 |
+
$msg = wplc_decrypt_msg($msg);
|
780 |
+
}
|
781 |
|
782 |
+
if($display_name){
|
783 |
+
$msg_hist .= "<span class='wplc-user-message'>".$image."<strong>$from</strong>: $msg</span><br /><div class='wplc-clear-float-message'></div>";
|
784 |
+
} else {
|
785 |
+
$msg_hist .= "<span class='wplc-user-message'>$msg</span><br /><div class='wplc-clear-float-message'></div>";
|
786 |
+
}
|
787 |
}
|
|
|
788 |
|
789 |
|
790 |
|
791 |
+
return $msg_hist;
|
792 |
+
} else {
|
793 |
+
return "security issue";
|
794 |
+
}
|
795 |
|
796 |
|
797 |
}
|
798 |
function wplc_mark_as_read_admin_chat_messages($mid) {
|
799 |
+
if (current_user_can("wplc_ma_agent") || current_user_can("manage_options")) {
|
800 |
|
801 |
+
|
802 |
+
global $wpdb;
|
803 |
+
global $wplc_tblname_msgs;
|
804 |
+
|
805 |
+
// $check = $wpdb->query(
|
806 |
+
// "
|
807 |
+
// UPDATE $wplc_tblname_msgs
|
808 |
+
// SET `status` = 1
|
809 |
+
// WHERE `id` = '$mid'
|
810 |
+
// LIMIT 1
|
811 |
+
//
|
812 |
+
// "
|
813 |
+
// );
|
814 |
|
815 |
+
$wpdb->update(
|
816 |
+
$wplc_tblname_msgs,
|
817 |
+
array(
|
818 |
+
'status' => 1
|
819 |
+
),
|
820 |
+
array('id' => $mid),
|
821 |
+
array('%d'),
|
822 |
+
array('%d')
|
823 |
+
);
|
824 |
+
|
825 |
+
} else { return "security issue"; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
826 |
|
827 |
|
828 |
}
|
js/wplc_u.js
CHANGED
@@ -45,22 +45,50 @@ jQuery(document).ready(function() {
|
|
45 |
// var wplc_details = 1;
|
46 |
// console.log(wplc_details);
|
47 |
|
|
|
|
|
|
|
48 |
var data = {
|
49 |
-
action: '
|
50 |
-
security: wplc_nonce
|
51 |
-
cid:wplc_cid,
|
52 |
-
wplc_name: wplc_cookie_name,
|
53 |
-
wplc_email: wplc_cookie_email,
|
54 |
-
status:wplc_chat_status,
|
55 |
-
wplcsession:wplc_session_variable,
|
56 |
};
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
function wplc_call_to_server_chat(data) {
|
65 |
jQuery.ajax({
|
66 |
url: wplc_ajaxurl,
|
@@ -244,7 +272,7 @@ jQuery(document).ready(function() {
|
|
244 |
|
245 |
|
246 |
/* minimize chat window */
|
247 |
-
jQuery("#wp-live-chat-minimize"
|
248 |
jQuery('#wp-live-chat').height("");
|
249 |
if(jQuery("#wp-live-chat").attr("original_pos") === "bottom_right"){
|
250 |
jQuery("#wp-live-chat").css("left", "");
|
@@ -289,7 +317,7 @@ jQuery(document).ready(function() {
|
|
289 |
|
290 |
});
|
291 |
/* close chat window */
|
292 |
-
jQuery("#wp-live-chat-close"
|
293 |
|
294 |
jQuery("#wp-live-chat").hide();
|
295 |
jQuery("#wp-live-chat-1").hide();
|
@@ -379,18 +407,18 @@ jQuery(document).ready(function() {
|
|
379 |
|
380 |
}
|
381 |
//opens chat when clicked on top bar
|
382 |
-
jQuery("#wp-live-chat-1"
|
383 |
open_chat();
|
384 |
});
|
385 |
//allows for a class to open chat window now
|
386 |
-
jQuery(".wp-live-chat-now"
|
387 |
open_chat();
|
388 |
});
|
389 |
|
390 |
|
391 |
|
392 |
|
393 |
-
jQuery("
|
394 |
var wplc_name = jQuery("#wplc_name").val();
|
395 |
var wplc_email = jQuery("#wplc_email").val();
|
396 |
|
@@ -458,12 +486,12 @@ jQuery(document).ready(function() {
|
|
458 |
}
|
459 |
|
460 |
|
461 |
-
jQuery("
|
462 |
if(event.keyCode === 13){
|
463 |
jQuery("#wplc_send_msg").trigger("click");
|
464 |
}
|
465 |
});
|
466 |
-
jQuery("
|
467 |
var wplc_cid = jQuery("#wplc_cid").val();
|
468 |
var wplc_chat = wplc_strip(document.getElementById('wplc_chatmsg').value);
|
469 |
|
45 |
// var wplc_details = 1;
|
46 |
// console.log(wplc_details);
|
47 |
|
48 |
+
var wplc_run = true;
|
49 |
+
|
50 |
+
|
51 |
var data = {
|
52 |
+
action: 'wplc_get_chat_box',
|
53 |
+
security: wplc_nonce
|
|
|
|
|
|
|
|
|
|
|
54 |
};
|
55 |
+
jQuery.ajax({
|
56 |
+
url: wplc_ajaxurl,
|
57 |
+
data:data,
|
58 |
+
type:"POST",
|
59 |
+
success: function(response) {
|
60 |
+
/* inject html */
|
61 |
+
if(response){
|
62 |
+
response = JSON.parse(response);
|
63 |
+
|
64 |
+
jQuery( "body" ).append( response);
|
65 |
+
|
66 |
+
|
67 |
+
/* start long polling */
|
68 |
+
var data = {
|
69 |
+
action: 'wplc_call_to_server_visitor',
|
70 |
+
security: wplc_nonce,
|
71 |
+
cid:wplc_cid,
|
72 |
+
wplc_name: wplc_cookie_name,
|
73 |
+
wplc_email: wplc_cookie_email,
|
74 |
+
status:wplc_chat_status,
|
75 |
+
wplcsession:wplc_session_variable,
|
76 |
+
};
|
77 |
+
// ajax long polling function
|
78 |
+
wplc_call_to_server_chat(data);
|
79 |
+
if(wplc_cid !== null && wplc_init_chat_box_check == true){
|
80 |
+
wplc_init_chat_box(wplc_cid,wplc_chat_status);
|
81 |
+
}
|
82 |
+
|
83 |
+
|
84 |
+
}
|
85 |
+
|
86 |
+
}
|
87 |
+
|
88 |
+
});
|
89 |
+
|
90 |
+
|
91 |
+
|
92 |
function wplc_call_to_server_chat(data) {
|
93 |
jQuery.ajax({
|
94 |
url: wplc_ajaxurl,
|
272 |
|
273 |
|
274 |
/* minimize chat window */
|
275 |
+
jQuery("body").on("click", "#wp-live-chat-minimize", function() {
|
276 |
jQuery('#wp-live-chat').height("");
|
277 |
if(jQuery("#wp-live-chat").attr("original_pos") === "bottom_right"){
|
278 |
jQuery("#wp-live-chat").css("left", "");
|
317 |
|
318 |
});
|
319 |
/* close chat window */
|
320 |
+
jQuery("body").on("click", "#wp-live-chat-close", function() {
|
321 |
|
322 |
jQuery("#wp-live-chat").hide();
|
323 |
jQuery("#wp-live-chat-1").hide();
|
407 |
|
408 |
}
|
409 |
//opens chat when clicked on top bar
|
410 |
+
jQuery("body").on("click", "#wp-live-chat-1", function() {
|
411 |
open_chat();
|
412 |
});
|
413 |
//allows for a class to open chat window now
|
414 |
+
jQuery("body").on("click", ".wp-live-chat-now", function() {
|
415 |
open_chat();
|
416 |
});
|
417 |
|
418 |
|
419 |
|
420 |
|
421 |
+
jQuery("body").on("click", "#wplc_start_chat_btn", function() {
|
422 |
var wplc_name = jQuery("#wplc_name").val();
|
423 |
var wplc_email = jQuery("#wplc_email").val();
|
424 |
|
486 |
}
|
487 |
|
488 |
|
489 |
+
jQuery("body").on("keyup","#wplc_chatmsg", function(event){
|
490 |
if(event.keyCode === 13){
|
491 |
jQuery("#wplc_send_msg").trigger("click");
|
492 |
}
|
493 |
});
|
494 |
+
jQuery("body").on("click", "#wplc_send_msg", function() {
|
495 |
var wplc_cid = jQuery("#wplc_cid").val();
|
496 |
var wplc_chat = wplc_strip(document.getElementById('wplc_chatmsg').value);
|
497 |
|
readme.txt
CHANGED
@@ -34,7 +34,6 @@ The most cost effective Live Chat plugin. Chat with your visitors for free! WP L
|
|
34 |
* Select whether Name and Email is required when users initiate a chat
|
35 |
* Enable/Disable the chat box on mobile devices
|
36 |
|
37 |
-
|
38 |
= Pro Version Features =
|
39 |
|
40 |
* Unlimited live chat agents
|
@@ -194,6 +193,11 @@ It is highly recommended that you upgrade to WP Live Chat Support version 4.1.4
|
|
194 |
|
195 |
== Changelog ==
|
196 |
|
|
|
|
|
|
|
|
|
|
|
197 |
= 5.0.3 - 2015-08-05 - Medium Priority =
|
198 |
* Small bug fix
|
199 |
|
34 |
* Select whether Name and Email is required when users initiate a chat
|
35 |
* Enable/Disable the chat box on mobile devices
|
36 |
|
|
|
37 |
= Pro Version Features =
|
38 |
|
39 |
* Unlimited live chat agents
|
193 |
|
194 |
== Changelog ==
|
195 |
|
196 |
+
= 5.0.4 - 2015-08-06 - Medium Priority =
|
197 |
+
* WP Live Chat Support is now compatible with all caching plugins
|
198 |
+
* Fixed a bug that set the wrong permissions for the default chat agent
|
199 |
+
* Fixed the bug that shows the status of undefined if the user minimized the chat
|
200 |
+
|
201 |
= 5.0.3 - 2015-08-05 - Medium Priority =
|
202 |
* Small bug fix
|
203 |
|
wp-live-chat-support.php
CHANGED
@@ -3,13 +3,19 @@
|
|
3 |
Plugin Name: WP Live Chat Support
|
4 |
Plugin URI: http://www.wp-livechat.com
|
5 |
Description: The easiest to use website live chat plugin. Let your visitors chat with you and increase sales conversion rates with WP Live Chat Support. No third party connection required!
|
6 |
-
Version: 5.0.
|
7 |
Author: WP-LiveChat
|
8 |
Author URI: http://www.wp-livechat.com
|
9 |
*/
|
10 |
|
11 |
|
12 |
/*
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
* 5.0.3 - 2015-08-05 - High Priority
|
14 |
* Small bug fix
|
15 |
*
|
@@ -245,7 +251,7 @@ global $wplc_tblname_chats;
|
|
245 |
global $wplc_tblname_msgs;
|
246 |
$wplc_tblname_chats = $wpdb->prefix . "wplc_chat_sessions";
|
247 |
$wplc_tblname_msgs = $wpdb->prefix . "wplc_chat_msgs";
|
248 |
-
$wplc_version = "5.0.
|
249 |
|
250 |
define('WPLC_BASIC_PLUGIN_DIR', dirname(__FILE__));
|
251 |
define('WPLC_BASIC_PLUGIN_URL', plugins_url() . "/wp-live-chat-support/");
|
@@ -262,6 +268,7 @@ add_action('wp_ajax_wplc_admin_set_transient', 'wplc_action_callback');
|
|
262 |
add_action('wp_ajax_wplc_hide_ftt','wplc_action_callback');
|
263 |
add_action('init', 'wplc_version_control');
|
264 |
|
|
|
265 |
add_action('wp_footer', 'wplc_display_box');
|
266 |
|
267 |
add_action('init', 'wplc_init');
|
@@ -360,8 +367,11 @@ add_action("init","wplc_load_user_js",0);
|
|
360 |
|
361 |
|
362 |
function wplc_load_user_js () {
|
363 |
-
|
364 |
if (!is_admin()) {
|
|
|
|
|
|
|
365 |
if(function_exists('wplc_display_chat_contents')){
|
366 |
$display_contents = wplc_display_chat_contents();
|
367 |
} else {
|
@@ -479,19 +489,21 @@ if (function_exists('wplc_pro_user_top_js')) {
|
|
479 |
}
|
480 |
|
481 |
function wplc_user_top_js() {
|
|
|
482 |
if(function_exists('wplc_display_chat_contents')){
|
483 |
$display_contents = wplc_display_chat_contents();
|
484 |
} else {
|
485 |
$display_contents = 1;
|
486 |
}
|
487 |
if($display_contents >= 1){
|
488 |
-
echo "<!-- DEFINING DO NOT CACHE -->";
|
489 |
if (!defined('DONOTCACHEPAGE')) {
|
490 |
define('DONOTCACHEPAGE', true);
|
491 |
}
|
492 |
if (!defined('DONOTCACHEDB')) {
|
493 |
define('DONOTCACHEDB', true);
|
494 |
}
|
|
|
495 |
$ajax_nonce = wp_create_nonce("wplc");
|
496 |
$wplc_settings = get_option("WPLC_SETTINGS");
|
497 |
?>
|
@@ -522,184 +534,238 @@ function wplc_draw_user_box() {
|
|
522 |
}
|
523 |
|
524 |
function wplc_output_box_ajax() {
|
525 |
-
$wplc_class = "";
|
526 |
-
$ret_msg = "";
|
527 |
-
$wplc_settings = get_option("WPLC_SETTINGS");
|
528 |
|
529 |
-
if
|
530 |
-
|
|
|
|
|
531 |
}
|
532 |
|
533 |
-
if
|
534 |
-
$
|
535 |
-
|
536 |
-
$
|
537 |
-
} else if ($wplc_settings["wplc_settings_align"] == 2) {
|
538 |
-
$original_pos = "bottom_right";
|
539 |
-
//$wplc_box_align = "right:100px; bottom:0px;";
|
540 |
-
$wplc_box_align = "bottom:0px;";
|
541 |
-
} else if ($wplc_settings["wplc_settings_align"] == 3) {
|
542 |
-
$original_pos = "left";
|
543 |
-
// $wplc_box_align = "left:0; bottom:100px;";
|
544 |
-
$wplc_box_align = " bottom:100px;";
|
545 |
-
$wplc_class = "wplc_left";
|
546 |
-
} else if ($wplc_settings["wplc_settings_align"] == 4) {
|
547 |
-
$original_pos = "right";
|
548 |
-
// $wplc_box_align = "right:0; bottom:100px;";
|
549 |
-
$wplc_box_align = "bottom:100px;";
|
550 |
-
$wplc_class = "wplc_right";
|
551 |
-
}
|
552 |
-
|
553 |
-
if ($wplc_settings["wplc_settings_fill"]) {
|
554 |
-
$wplc_settings_fill = "#" . $wplc_settings["wplc_settings_fill"];
|
555 |
} else {
|
556 |
-
$
|
557 |
}
|
558 |
-
if
|
559 |
-
|
560 |
-
|
561 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
562 |
}
|
563 |
|
564 |
-
|
565 |
-
|
|
|
|
|
566 |
$ret_msg = "";
|
567 |
-
|
568 |
-
|
569 |
-
if(function_exists('wplc_pro_activate')){
|
570 |
-
if(function_exists('wplc_return_animations')){
|
571 |
-
|
572 |
-
$animations = wplc_return_animations();
|
573 |
-
|
574 |
-
isset($animations['animation']) ? $wplc_animation = $animations['animation'] : $wplc_animation = 'animation-4';
|
575 |
-
isset($animations['starting_point']) ? $wplc_starting_point = $animations['starting_point'] : $wplc_starting_point = 'display: none;';
|
576 |
-
isset($animations['box_align']) ? $wplc_box_align = $animations['box_align'] : $wplc_box_align = '';
|
577 |
|
578 |
-
|
579 |
-
|
580 |
}
|
581 |
-
|
582 |
-
|
583 |
-
$wplc_starting_point = '';
|
584 |
-
$wplc_animation = '';
|
585 |
-
|
586 |
if ($wplc_settings["wplc_settings_align"] == 1) {
|
587 |
$original_pos = "bottom_left";
|
588 |
-
|
|
|
589 |
} else if ($wplc_settings["wplc_settings_align"] == 2) {
|
590 |
$original_pos = "bottom_right";
|
591 |
-
|
|
|
592 |
} else if ($wplc_settings["wplc_settings_align"] == 3) {
|
593 |
$original_pos = "left";
|
594 |
-
|
|
|
595 |
$wplc_class = "wplc_left";
|
596 |
} else if ($wplc_settings["wplc_settings_align"] == 4) {
|
597 |
$original_pos = "right";
|
598 |
-
|
|
|
599 |
$wplc_class = "wplc_right";
|
600 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
601 |
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
if
|
608 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
609 |
} else {
|
610 |
|
611 |
-
$
|
612 |
-
$
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
623 |
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
630 |
|
631 |
-
|
632 |
-
$
|
633 |
-
} else {
|
634 |
-
$wplc_use_loggedin_user_details = 0;
|
635 |
-
}
|
636 |
|
637 |
-
|
638 |
-
|
639 |
|
640 |
-
|
641 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
642 |
|
643 |
-
if ($
|
644 |
-
|
645 |
-
|
646 |
-
$
|
647 |
}
|
648 |
-
} else {
|
649 |
-
$wplc_loggedin_user_name = '';
|
650 |
-
$wplc_loggedin_user_email = '';
|
651 |
-
}
|
652 |
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
658 |
|
659 |
-
if ($wplc_ask_user_details == 1) {
|
660 |
-
//Ask the user to enter name and email
|
661 |
-
?>
|
662 |
-
<input type="text" name="wplc_name" id="wplc_name" value="<?php echo $wplc_loggedin_user_name; ?>" placeholder="<?php _e("Name", "wplivechat"); ?>" />
|
663 |
-
<input type="text" name="wplc_email" id="wplc_email" wplc_hide="0" value="<?php echo $wplc_loggedin_user_email; ?>" placeholder="<?php _e("Email", "wplivechat"); ?>" />
|
664 |
-
<?php
|
665 |
-
} else {
|
666 |
-
//Dont ask the user
|
667 |
-
echo '<div style="padding: 7px; text-align: center;">';
|
668 |
-
if (isset($wplc_settings['wplc_user_alternative_text'])) {
|
669 |
-
echo stripslashes($wplc_settings['wplc_user_alternative_text']);
|
670 |
-
}
|
671 |
-
echo '</div>';
|
672 |
|
673 |
-
$wplc_random_user_number = rand(0, 9) . rand(0, 9) . rand(0, 9) . rand(0, 9) . rand(0, 9) . rand(0, 9);
|
674 |
-
//$wplc_loggedin_user_email = $wplc_random_user_number."@".$wplc_random_user_number.".com";
|
675 |
-
?>
|
676 |
-
<input type="hidden" name="wplc_name" id="wplc_name" value="<?php if ($wplc_loggedin_user_name != '') { echo $wplc_loggedin_user_name; } else { echo 'user' . $wplc_random_user_number; } ?>" />
|
677 |
-
<input type="hidden" name="wplc_email" id="wplc_email" wplc_hide="1" value="<?php if ($wplc_loggedin_user_email != '' && $wplc_loggedin_user_email != null) { echo $wplc_loggedin_user_email; } else { echo $wplc_random_user_number . '@' . $wplc_random_user_number . '.com'; } ?>" />
|
678 |
-
<?php
|
679 |
-
}
|
680 |
-
?>
|
681 |
-
<input id="wplc_start_chat_btn" type="button" value="<?php _e("Start Chat", "wplivechat"); ?>" style="background-color: <?php echo $wplc_settings_fill; ?> !important; color: <?php echo $wplc_settings_font; ?> !important;"/>
|
682 |
-
</div>
|
683 |
-
<div id="wp-live-chat-3" style="display:none;">
|
684 |
-
<p><?php _e("Connecting you to a sales person. Please be patient.", "wplivechat") ?></p>
|
685 |
-
</div>
|
686 |
-
<div id="wp-live-chat-react" style="display:none;">
|
687 |
-
<p><?php _e("Reactivating your previous chat...", "wplivechat") ?></p>
|
688 |
-
</div>
|
689 |
-
<div id="wp-live-chat-4" style="display:none;">
|
690 |
-
<div id="wplc_sound_update" style='height:0; width:0; display:none; border:0;'></div>
|
691 |
-
<div id="wplc_chatbox"></div>
|
692 |
-
<p style="text-align:center; font-size:11px;"><?php _e("Press ENTER to send your message", "wplivechat") ?></p>
|
693 |
-
<p>
|
694 |
-
<input type="text" name="wplc_chatmsg" id="wplc_chatmsg" value="" />
|
695 |
-
<input type="hidden" name="wplc_cid" id="wplc_cid" value="" />
|
696 |
-
<input id="wplc_send_msg" type="button" value="<?php _e("Send", "wplivechat"); ?>" style="display:none;" />
|
697 |
-
</p>
|
698 |
-
</div>
|
699 |
-
</div>
|
700 |
-
<?php } ?>
|
701 |
-
</div>
|
702 |
-
<?php
|
703 |
}
|
704 |
|
705 |
function wplc_output_box() {
|
@@ -883,6 +949,68 @@ function wplc_output_box() {
|
|
883 |
}
|
884 |
|
885 |
function wplc_display_box() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
886 |
if(function_exists('wplc_display_chat_contents')){
|
887 |
$display_contents = wplc_display_chat_contents();
|
888 |
} else {
|
@@ -899,7 +1027,7 @@ function wplc_display_box() {
|
|
899 |
if($display_contents && $user_banned == 0){
|
900 |
$wplc_is_admin_logged_in = get_transient("wplc_is_admin_logged_in");
|
901 |
if ($wplc_is_admin_logged_in != 1) {
|
902 |
-
|
903 |
}
|
904 |
|
905 |
/* do not show if pro is outdated */
|
@@ -1282,6 +1410,9 @@ function wplc_admin_javascript() {
|
|
1282 |
if (status === 9){
|
1283 |
return "<span class='wplc_status_box wplc_status_"+status+"'>chat closed</span>";
|
1284 |
}
|
|
|
|
|
|
|
1285 |
}
|
1286 |
function wplc_get_type_box(type) {
|
1287 |
if (type === "New") {
|
@@ -2048,6 +2179,7 @@ function wplc_handle_db() {
|
|
2048 |
}
|
2049 |
|
2050 |
function wplc_add_user_stylesheet() {
|
|
|
2051 |
if(function_exists('wplc_display_chat_contents')){
|
2052 |
$show_chat_contents = wplc_display_chat_contents();
|
2053 |
} else {
|
@@ -2370,4 +2502,4 @@ function wp_button_pointers_load_scripts($hook) {
|
|
2370 |
wp_enqueue_script('wplc-user-admin-pointer');
|
2371 |
wp_localize_script('wplc-user-admin-pointer', 'pointer_localize_strings', $pointer_localize_strings);
|
2372 |
|
2373 |
-
|
3 |
Plugin Name: WP Live Chat Support
|
4 |
Plugin URI: http://www.wp-livechat.com
|
5 |
Description: The easiest to use website live chat plugin. Let your visitors chat with you and increase sales conversion rates with WP Live Chat Support. No third party connection required!
|
6 |
+
Version: 5.0.4
|
7 |
Author: WP-LiveChat
|
8 |
Author URI: http://www.wp-livechat.com
|
9 |
*/
|
10 |
|
11 |
|
12 |
/*
|
13 |
+
* 5.0.4 - 2015-08-06 - Medium priority
|
14 |
+
* WP Live Chat Support is now compatible with all caching plugins
|
15 |
+
* Fixed a bug that set the wrong permissions for the default agent
|
16 |
+
* Fixed the bug that shows the status of undefined if the user minimized the chat
|
17 |
+
*
|
18 |
+
*
|
19 |
* 5.0.3 - 2015-08-05 - High Priority
|
20 |
* Small bug fix
|
21 |
*
|
251 |
global $wplc_tblname_msgs;
|
252 |
$wplc_tblname_chats = $wpdb->prefix . "wplc_chat_sessions";
|
253 |
$wplc_tblname_msgs = $wpdb->prefix . "wplc_chat_msgs";
|
254 |
+
$wplc_version = "5.0.4";
|
255 |
|
256 |
define('WPLC_BASIC_PLUGIN_DIR', dirname(__FILE__));
|
257 |
define('WPLC_BASIC_PLUGIN_URL', plugins_url() . "/wp-live-chat-support/");
|
268 |
add_action('wp_ajax_wplc_hide_ftt','wplc_action_callback');
|
269 |
add_action('init', 'wplc_version_control');
|
270 |
|
271 |
+
|
272 |
add_action('wp_footer', 'wplc_display_box');
|
273 |
|
274 |
add_action('init', 'wplc_init');
|
367 |
|
368 |
|
369 |
function wplc_load_user_js () {
|
370 |
+
|
371 |
if (!is_admin()) {
|
372 |
+
|
373 |
+
|
374 |
+
|
375 |
if(function_exists('wplc_display_chat_contents')){
|
376 |
$display_contents = wplc_display_chat_contents();
|
377 |
} else {
|
489 |
}
|
490 |
|
491 |
function wplc_user_top_js() {
|
492 |
+
|
493 |
if(function_exists('wplc_display_chat_contents')){
|
494 |
$display_contents = wplc_display_chat_contents();
|
495 |
} else {
|
496 |
$display_contents = 1;
|
497 |
}
|
498 |
if($display_contents >= 1){
|
499 |
+
/*echo "<!-- DEFINING DO NOT CACHE -->";
|
500 |
if (!defined('DONOTCACHEPAGE')) {
|
501 |
define('DONOTCACHEPAGE', true);
|
502 |
}
|
503 |
if (!defined('DONOTCACHEDB')) {
|
504 |
define('DONOTCACHEDB', true);
|
505 |
}
|
506 |
+
*/
|
507 |
$ajax_nonce = wp_create_nonce("wplc");
|
508 |
$wplc_settings = get_option("WPLC_SETTINGS");
|
509 |
?>
|
534 |
}
|
535 |
|
536 |
function wplc_output_box_ajax() {
|
|
|
|
|
|
|
537 |
|
538 |
+
if(function_exists('wplc_display_chat_contents')){
|
539 |
+
$display_contents = wplc_display_chat_contents();
|
540 |
+
} else {
|
541 |
+
$display_contents = 1;
|
542 |
}
|
543 |
|
544 |
+
if(function_exists('wplc_is_user_banned')){
|
545 |
+
$user_banned = wplc_is_user_banned();
|
546 |
+
} else if (function_exists('wplc_is_user_banned')){
|
547 |
+
$user_banned = wplc_is_user_banned_basic();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
548 |
} else {
|
549 |
+
$user_banned = 0;
|
550 |
}
|
551 |
+
if($display_contents && $user_banned == 0){
|
552 |
+
|
553 |
+
|
554 |
+
/* do not show if pro is outdated */
|
555 |
+
global $wplc_pro_version;
|
556 |
+
if (isset($wplc_pro_version)) {
|
557 |
+
$float_version = floatval($wplc_pro_version);
|
558 |
+
if ($float_version < 4 || $wplc_pro_version == "4.1.0" || $wplc_pro_version == "4.1.1") {
|
559 |
+
return "";
|
560 |
+
}
|
561 |
+
}
|
562 |
+
|
563 |
+
if (function_exists("wplc_register_pro_version")) {
|
564 |
+
$wplc_settings = get_option("WPLC_SETTINGS");
|
565 |
+
if (!class_exists('Mobile_Detect')) {
|
566 |
+
require_once (plugin_dir_path(__FILE__) . 'includes/Mobile_Detect.php');
|
567 |
+
}
|
568 |
+
$wplc_detect_device = new Mobile_Detect;
|
569 |
+
$wplc_is_mobile = $wplc_detect_device->isMobile();
|
570 |
+
if ($wplc_is_mobile && !isset($wplc_settings['wplc_enabled_on_mobile']) && $wplc_settings['wplc_enabled_on_mobile'] != 1) {
|
571 |
+
return "";
|
572 |
+
}
|
573 |
+
if (function_exists('wplc_hide_chat_when_offline')) {
|
574 |
+
$wplc_hide_chat = wplc_hide_chat_when_offline();
|
575 |
+
if (!$wplc_hide_chat) {
|
576 |
+
$draw_box = true;
|
577 |
+
}
|
578 |
+
} else {
|
579 |
+
$draw_box = true;
|
580 |
+
}
|
581 |
+
} else {
|
582 |
+
$draw_box = true;
|
583 |
+
}
|
584 |
}
|
585 |
|
586 |
+
|
587 |
+
|
588 |
+
if ($draw_box) {
|
589 |
+
$wplc_class = "";
|
590 |
$ret_msg = "";
|
591 |
+
$wplc_settings = get_option("WPLC_SETTINGS");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
592 |
|
593 |
+
if ($wplc_settings["wplc_settings_enabled"] == 2) {
|
594 |
+
return;
|
595 |
}
|
596 |
+
|
|
|
|
|
|
|
|
|
597 |
if ($wplc_settings["wplc_settings_align"] == 1) {
|
598 |
$original_pos = "bottom_left";
|
599 |
+
//$wplc_box_align = "left:100px; bottom:0px;";
|
600 |
+
$wplc_box_align = "bottom:0px;";
|
601 |
} else if ($wplc_settings["wplc_settings_align"] == 2) {
|
602 |
$original_pos = "bottom_right";
|
603 |
+
//$wplc_box_align = "right:100px; bottom:0px;";
|
604 |
+
$wplc_box_align = "bottom:0px;";
|
605 |
} else if ($wplc_settings["wplc_settings_align"] == 3) {
|
606 |
$original_pos = "left";
|
607 |
+
// $wplc_box_align = "left:0; bottom:100px;";
|
608 |
+
$wplc_box_align = " bottom:100px;";
|
609 |
$wplc_class = "wplc_left";
|
610 |
} else if ($wplc_settings["wplc_settings_align"] == 4) {
|
611 |
$original_pos = "right";
|
612 |
+
// $wplc_box_align = "right:0; bottom:100px;";
|
613 |
+
$wplc_box_align = "bottom:100px;";
|
614 |
$wplc_class = "wplc_right";
|
615 |
}
|
616 |
+
|
617 |
+
if ($wplc_settings["wplc_settings_fill"]) {
|
618 |
+
$wplc_settings_fill = "#" . $wplc_settings["wplc_settings_fill"];
|
619 |
+
} else {
|
620 |
+
$wplc_settings_fill = "#ed832f";
|
621 |
+
}
|
622 |
+
if ($wplc_settings["wplc_settings_font"]) {
|
623 |
+
$wplc_settings_font = "#" . $wplc_settings["wplc_settings_font"];
|
624 |
+
} else {
|
625 |
+
$wplc_settings_font = "#FFFFFF";
|
626 |
+
}
|
627 |
|
628 |
+
$wplc_is_admin_logged_in = get_transient("wplc_is_admin_logged_in");
|
629 |
+
if (!function_exists("wplc_register_pro_version") && $wplc_is_admin_logged_in != 1) {
|
630 |
+
$ret_msg = "";
|
631 |
+
}
|
632 |
+
|
633 |
+
if(function_exists('wplc_pro_activate')){
|
634 |
+
if(function_exists('wplc_return_animations')){
|
635 |
+
|
636 |
+
$animations = wplc_return_animations();
|
637 |
+
|
638 |
+
isset($animations['animation']) ? $wplc_animation = $animations['animation'] : $wplc_animation = 'animation-4';
|
639 |
+
isset($animations['starting_point']) ? $wplc_starting_point = $animations['starting_point'] : $wplc_starting_point = 'display: none;';
|
640 |
+
isset($animations['box_align']) ? $wplc_box_align = $animations['box_align'] : $wplc_box_align = '';
|
641 |
+
|
642 |
+
} else {
|
643 |
+
|
644 |
+
}
|
645 |
} else {
|
646 |
|
647 |
+
$wplc_starting_point = '';
|
648 |
+
$wplc_animation = '';
|
649 |
+
|
650 |
+
if ($wplc_settings["wplc_settings_align"] == 1) {
|
651 |
+
$original_pos = "bottom_left";
|
652 |
+
$wplc_box_align = "left:100px; bottom:0px;";
|
653 |
+
} else if ($wplc_settings["wplc_settings_align"] == 2) {
|
654 |
+
$original_pos = "bottom_right";
|
655 |
+
$wplc_box_align = "right:100px; bottom:0px;";
|
656 |
+
} else if ($wplc_settings["wplc_settings_align"] == 3) {
|
657 |
+
$original_pos = "left";
|
658 |
+
$wplc_box_align = "left:0; bottom:100px;";
|
659 |
+
$wplc_class = "wplc_left";
|
660 |
+
} else if ($wplc_settings["wplc_settings_align"] == 4) {
|
661 |
+
$original_pos = "right";
|
662 |
+
$wplc_box_align = "right:0; bottom:100px;";
|
663 |
+
$wplc_class = "wplc_right";
|
664 |
+
}
|
665 |
|
666 |
+
}
|
667 |
+
|
668 |
+
if (isset($wplc_settings['wplc_auto_pop_up'])) { $wplc_auto_popup = $wplc_settings['wplc_auto_pop_up']; } else { $wplc_auto_popup = "" ;}
|
669 |
+
$ret_msg .= "<div id=\"wp-live-chat\" wplc_animation=\"".$wplc_animation."\" style=\"".$wplc_starting_point." ".$wplc_box_align.";\" class=\"".$wplc_class." wplc_close\" original_pos=\"".$original_pos."\" wplc-auto-pop-up=\"". $wplc_auto_popup."\" > ";
|
670 |
+
|
671 |
+
if (function_exists("wplc_pro_output_box_ajax")) {
|
672 |
+
$ret_msg .= wplc_pro_output_box_ajax();
|
673 |
+
} else {
|
674 |
+
|
675 |
+
$ret_msg .= "<div class=\"wp-live-chat-wraper\">";
|
676 |
+
$ret_msg .= "<div id=\"wp-live-chat-header\" style=\"background-color: ".$wplc_settings_fill." !important; color: ".$wplc_settings_font." !important; \">";
|
677 |
+
$ret_msg .= "<i id=\"wp-live-chat-minimize\" class=\"fa fa-minus\" style=\"display:none;\" ></i>";
|
678 |
+
|
679 |
+
$ret_msg .= "<i id=\"wp-live-chat-close\" class=\"fa fa-times\" style=\"display:none;\" ></i>";
|
680 |
+
|
681 |
+
$ret_msg .= " <div id=\"wp-live-chat-1\" >";
|
682 |
+
$ret_msg .= "<div style=\"display:block; \">";
|
683 |
+
$ret_msg .= "<strong>".__("Questions?", "wplivechat")."</strong> ".__("Chat with us", "wplivechat");
|
684 |
+
$ret_msg .= "</div>";
|
685 |
+
$ret_msg .= "</div>";
|
686 |
+
$ret_msg .= "</div>";
|
687 |
+
|
688 |
+
$ret_msg .= "<div id=\"wp-live-chat-2\" style=\"display:none;\">";
|
689 |
+
$ret_msg .= "<div id=\"wp-live-chat-2-info\">";
|
690 |
+
$ret_msg .= "<strong>".__('Start Live Chat', 'wplivechat')."</strong>";
|
691 |
+
$ret_msg .= "</div>";
|
692 |
+
|
693 |
+
if (isset($wplc_settings['wplc_loggedin_user_info']) && $wplc_settings['wplc_loggedin_user_info'] == 1) {
|
694 |
+
$wplc_use_loggedin_user_details = 1;
|
695 |
+
} else {
|
696 |
+
$wplc_use_loggedin_user_details = 0;
|
697 |
+
}
|
698 |
|
699 |
+
$wplc_loggedin_user_name = "";
|
700 |
+
$wplc_loggedin_user_email = "";
|
|
|
|
|
|
|
701 |
|
702 |
+
if ($wplc_use_loggedin_user_details == 1) {
|
703 |
+
global $current_user;
|
704 |
|
705 |
+
if ($current_user->data != null) {
|
706 |
+
//Logged in. Get name and email
|
707 |
+
$wplc_loggedin_user_name = $current_user->user_nicename;
|
708 |
+
$wplc_loggedin_user_email = $current_user->user_email;
|
709 |
+
}
|
710 |
+
} else {
|
711 |
+
$wplc_loggedin_user_name = '';
|
712 |
+
$wplc_loggedin_user_email = '';
|
713 |
+
}
|
714 |
|
715 |
+
if (isset($wplc_settings['wplc_require_user_info']) && $wplc_settings['wplc_require_user_info'] == 1) {
|
716 |
+
$wplc_ask_user_details = 1;
|
717 |
+
} else {
|
718 |
+
$wplc_ask_user_details = 0;
|
719 |
}
|
|
|
|
|
|
|
|
|
720 |
|
721 |
+
if ($wplc_ask_user_details == 1) {
|
722 |
+
//Ask the user to enter name and email
|
723 |
+
|
724 |
+
$ret_msg .= "<input type=\"text\" name=\"wplc_name\" id=\"wplc_name\" value=\"".$wplc_loggedin_user_name."\" placeholder=\"".__("Name", "wplivechat")."\" />";
|
725 |
+
$ret_msg .= "<input type=\"text\" name=\"wplc_email\" id=\"wplc_email\" wplc_hide=\"0\" value=\"".$wplc_loggedin_user_email."\" placeholder=\"".__("Email", "wplivechat")."\" />";
|
726 |
+
} else {
|
727 |
+
//Dont ask the user
|
728 |
+
$ret_msg .= "<div style=\"padding: 7px; text-align: center;\">";
|
729 |
+
if (isset($wplc_settings['wplc_user_alternative_text'])) {
|
730 |
+
$ret_msg .= stripslashes($wplc_settings['wplc_user_alternative_text']);
|
731 |
+
}
|
732 |
+
$ret_msg .= '</div>';
|
733 |
+
|
734 |
+
$wplc_random_user_number = rand(0, 9) . rand(0, 9) . rand(0, 9) . rand(0, 9) . rand(0, 9) . rand(0, 9);
|
735 |
+
//$wplc_loggedin_user_email = $wplc_random_user_number."@".$wplc_random_user_number.".com";
|
736 |
+
if ($wplc_loggedin_user_name != '') { $wplc_lin = $wplc_loggedin_user_name; } else { $wplc_lin = 'user' . $wplc_random_user_number; }
|
737 |
+
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'; }
|
738 |
+
$ret_msg .= "<input type=\"hidden\" name=\"wplc_name\" id=\"wplc_name\" value=\"".$wplc_lin."\" />";
|
739 |
+
$ret_msg .= "<input type=\"hidden\" name=\"wplc_email\" id=\"wplc_email\" wplc_hide=\"1\" value=\"".$wplc_lie."\" />";
|
740 |
+
}
|
741 |
+
|
742 |
+
$ret_msg .= "<input id=\"wplc_start_chat_btn\" type=\"button\" value=\"".__("Start Chat", "wplivechat")."\" style=\"background-color: ".$wplc_settings_fill." !important; color: ".$wplc_settings_font." !important;\"/>";
|
743 |
+
$ret_msg .= "</div>";
|
744 |
+
$ret_msg .= "<div id=\"wp-live-chat-3\" style=\"display:none;\">";
|
745 |
+
$ret_msg .= "<p>".__("Connecting you to a sales person. Please be patient.", "wplivechat")."</p>";
|
746 |
+
$ret_msg .= "</div>";
|
747 |
+
$ret_msg .= "<div id=\"wp-live-chat-react\" style=\"display:none;\">";
|
748 |
+
$ret_msg .= "<p>".__("Reactivating your previous chat...", "wplivechat")."</p>";
|
749 |
+
$ret_msg .= "</div>";
|
750 |
+
$ret_msg .= "<div id=\"wp-live-chat-4\" style=\"display:none;\">";
|
751 |
+
$ret_msg .= "<div id=\"wplc_sound_update\" style=\"height:0; width:0; display:none; border:0;\"></div>";
|
752 |
+
$ret_msg .= "<div id=\"wplc_chatbox\"></div>";
|
753 |
+
$ret_msg .= "<p style=\"text-align:center; font-size:11px;\">".__("Press ENTER to send your message", "wplivechat")."</p>";
|
754 |
+
$ret_msg .= "<p>";
|
755 |
+
$ret_msg .= "<input type=\"text\" name=\"wplc_chatmsg\" id=\"wplc_chatmsg\" value=\"\" />";
|
756 |
+
$ret_msg .= "<input type=\"hidden\" name=\"wplc_cid\" id=\"wplc_cid\" value=\"\" />";
|
757 |
+
$ret_msg .= "<input id=\"wplc_send_msg\" type=\"button\" value=\"".__("Send", "wplivechat")."\" style=\"display:none;\" />";
|
758 |
+
$ret_msg .= "</p>";
|
759 |
+
$ret_msg .= "</div>";
|
760 |
+
$ret_msg .= "</div>";
|
761 |
+
}
|
762 |
+
$ret_msg .= "</div>";
|
763 |
+
return json_encode($ret_msg);
|
764 |
+
} else {
|
765 |
+
return "";
|
766 |
+
}
|
767 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
768 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
769 |
}
|
770 |
|
771 |
function wplc_output_box() {
|
949 |
}
|
950 |
|
951 |
function wplc_display_box() {
|
952 |
+
|
953 |
+
global $wplc_pro_version;
|
954 |
+
$wplc_ver = str_replace('.', '', $wplc_pro_version);
|
955 |
+
$checker = intval($wplc_ver);
|
956 |
+
|
957 |
+
if (function_exists("wplc_pro_version_control") && ($checker <= 501 || $checker == 4410)) {
|
958 |
+
/* prior to latest pro version with ajax handling */
|
959 |
+
|
960 |
+
if(function_exists('wplc_display_chat_contents')){
|
961 |
+
$display_contents = wplc_display_chat_contents();
|
962 |
+
} else {
|
963 |
+
$display_contents = 1;
|
964 |
+
}
|
965 |
+
|
966 |
+
if(function_exists('wplc_is_user_banned')){
|
967 |
+
$user_banned = wplc_is_user_banned();
|
968 |
+
} else if (function_exists('wplc_is_user_banned')){
|
969 |
+
$user_banned = wplc_is_user_banned_basic();
|
970 |
+
} else {
|
971 |
+
$user_banned = 0;
|
972 |
+
}
|
973 |
+
if($display_contents && $user_banned == 0){
|
974 |
+
$wplc_is_admin_logged_in = get_transient("wplc_is_admin_logged_in");
|
975 |
+
if ($wplc_is_admin_logged_in != 1) {
|
976 |
+
echo "<!-- wplc a-n-c -->";
|
977 |
+
}
|
978 |
+
|
979 |
+
/* do not show if pro is outdated */
|
980 |
+
global $wplc_pro_version;
|
981 |
+
if (isset($wplc_pro_version)) {
|
982 |
+
$float_version = floatval($wplc_pro_version);
|
983 |
+
if ($float_version < 4 || $wplc_pro_version == "4.1.0" || $wplc_pro_version == "4.1.1") {
|
984 |
+
return;
|
985 |
+
}
|
986 |
+
}
|
987 |
+
|
988 |
+
if (function_exists("wplc_register_pro_version")) {
|
989 |
+
$wplc_settings = get_option("WPLC_SETTINGS");
|
990 |
+
if (!class_exists('Mobile_Detect')) {
|
991 |
+
require_once (plugin_dir_path(__FILE__) . 'includes/Mobile_Detect.php');
|
992 |
+
}
|
993 |
+
$wplc_detect_device = new Mobile_Detect;
|
994 |
+
$wplc_is_mobile = $wplc_detect_device->isMobile();
|
995 |
+
if ($wplc_is_mobile && !isset($wplc_settings['wplc_enabled_on_mobile']) && $wplc_settings['wplc_enabled_on_mobile'] != 1) {
|
996 |
+
return;
|
997 |
+
}
|
998 |
+
if (function_exists('wplc_hide_chat_when_offline')) {
|
999 |
+
$wplc_hide_chat = wplc_hide_chat_when_offline();
|
1000 |
+
if (!$wplc_hide_chat) {
|
1001 |
+
wplc_pro_draw_user_box();
|
1002 |
+
}
|
1003 |
+
} else {
|
1004 |
+
wplc_pro_draw_user_box();
|
1005 |
+
}
|
1006 |
+
} else {
|
1007 |
+
wplc_draw_user_box();
|
1008 |
+
}
|
1009 |
+
}
|
1010 |
+
}
|
1011 |
+
}
|
1012 |
+
function wplc_display_box_ajax() {
|
1013 |
+
|
1014 |
if(function_exists('wplc_display_chat_contents')){
|
1015 |
$display_contents = wplc_display_chat_contents();
|
1016 |
} else {
|
1027 |
if($display_contents && $user_banned == 0){
|
1028 |
$wplc_is_admin_logged_in = get_transient("wplc_is_admin_logged_in");
|
1029 |
if ($wplc_is_admin_logged_in != 1) {
|
1030 |
+
return "";
|
1031 |
}
|
1032 |
|
1033 |
/* do not show if pro is outdated */
|
1410 |
if (status === 9){
|
1411 |
return "<span class='wplc_status_box wplc_status_"+status+"'>chat closed</span>";
|
1412 |
}
|
1413 |
+
if (status === 10){
|
1414 |
+
return "<span class='wplc_status_box wplc_status_8'>minimized</span>";
|
1415 |
+
}
|
1416 |
}
|
1417 |
function wplc_get_type_box(type) {
|
1418 |
if (type === "New") {
|
2179 |
}
|
2180 |
|
2181 |
function wplc_add_user_stylesheet() {
|
2182 |
+
|
2183 |
if(function_exists('wplc_display_chat_contents')){
|
2184 |
$show_chat_contents = wplc_display_chat_contents();
|
2185 |
} else {
|
2502 |
wp_enqueue_script('wplc-user-admin-pointer');
|
2503 |
wp_localize_script('wplc-user-admin-pointer', 'pointer_localize_strings', $pointer_localize_strings);
|
2504 |
|
2505 |
+
}
|