Version Description
- More precise functionality to handle if you are online or offline
- Fixed a bug that recorded visitors when offline
- Neatened up some code
- Fixed some small bugs
Download this release
Release Info
Developer | WP-LiveChat |
Plugin | WP Live Chat Support |
Version | 2.1 |
Comparing to | |
See all releases |
Code changes from version 2.0 to 2.1
- wplcstyle.css → css/wplcstyle.css +0 -0
- jquery-cookie.js → js/jquery-cookie.js +0 -0
- js/wplc_u.js +226 -0
- readme.txt +11 -5
- screenshot-3.JPG +0 -0
- wp-live-chat-support.php +30 -242
wplcstyle.css → css/wplcstyle.css
RENAMED
File without changes
|
jquery-cookie.js → js/jquery-cookie.js
RENAMED
File without changes
|
js/wplc_u.js
ADDED
@@ -0,0 +1,226 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery(document).ready(function() {
|
2 |
+
|
3 |
+
|
4 |
+
|
5 |
+
|
6 |
+
var wplc_check_cookie_id;
|
7 |
+
var wplc_check_cookie_stage;
|
8 |
+
var wplc_check_hide_cookie;
|
9 |
+
|
10 |
+
wplc_check_cookie_id = jQuery.cookie('wplc_cid');
|
11 |
+
wplc_check_cookie_stage = jQuery.cookie('wplc_stage');
|
12 |
+
wplc_check_hide_cookie = jQuery.cookie('wplc_hide');
|
13 |
+
|
14 |
+
|
15 |
+
function wplc_relay_user_stage(stage,cid) {
|
16 |
+
if (cid.length) {
|
17 |
+
var data = {
|
18 |
+
action: 'wplc_relay_stage',
|
19 |
+
security: wplc_nonce,
|
20 |
+
stage: stage,
|
21 |
+
cid: cid
|
22 |
+
};
|
23 |
+
} else {
|
24 |
+
var data = {
|
25 |
+
action: 'wplc_relay_stage',
|
26 |
+
security: wplc_nonce,
|
27 |
+
stage: stage
|
28 |
+
};
|
29 |
+
}
|
30 |
+
jQuery.post(ajaxurl, data, function(response) {
|
31 |
+
//console.log("wplc_relay_stage");
|
32 |
+
});
|
33 |
+
}
|
34 |
+
|
35 |
+
/* close chat window */
|
36 |
+
jQuery("#wp-live-chat-close").live("click", function() {
|
37 |
+
jQuery("#wp-live-chat-1").show();
|
38 |
+
jQuery("#wp-live-chat-1").css('cursor', 'pointer');
|
39 |
+
|
40 |
+
jQuery("#wp-live-chat-2").hide();
|
41 |
+
jQuery("#wp-live-chat-3").hide();
|
42 |
+
jQuery("#wp-live-chat-4").hide();
|
43 |
+
jQuery("#wp-live-chat-close").hide();
|
44 |
+
jQuery.cookie('wplc_hide', "yes", { expires: 1, path: '/' });
|
45 |
+
var data = {
|
46 |
+
action: 'wplc_user_close_chat',
|
47 |
+
security: wplc_nonce,
|
48 |
+
cid: wplc_check_cookie_id
|
49 |
+
};
|
50 |
+
jQuery.post(ajaxurl, data, function(response) {
|
51 |
+
//console.log("wplc_user_close_chat");
|
52 |
+
});
|
53 |
+
});
|
54 |
+
|
55 |
+
|
56 |
+
|
57 |
+
jQuery("#wp-live-chat-1").live("click", function() {
|
58 |
+
///jQuery("#wp-live-chat-1").hide();
|
59 |
+
jQuery("#wp-live-chat-1").css('cursor', 'default');
|
60 |
+
jQuery.cookie('wplc_hide', "");
|
61 |
+
jQuery("#wp-live-chat-close").show();
|
62 |
+
jQuery("#wp-live-chat-2").show();
|
63 |
+
wplc_check_cookie_stage = jQuery.cookie('wplc_stage');
|
64 |
+
if (wplc_check_cookie_stage == "3") {
|
65 |
+
jQuery("#wp-live-chat-4").show();
|
66 |
+
jQuery("#wplc_chatmsg").focus();
|
67 |
+
jQuery("#wp-live-chat-2").hide();
|
68 |
+
}
|
69 |
+
else {
|
70 |
+
jQuery("#wp-live-chat-2").show();
|
71 |
+
}
|
72 |
+
|
73 |
+
});
|
74 |
+
|
75 |
+
var wplc_user_waiting = null;
|
76 |
+
|
77 |
+
jQuery("#wplc_start_chat_btn").live("click", function() {
|
78 |
+
var wplc_name = jQuery("#wplc_name").val();
|
79 |
+
var wplc_email = jQuery("#wplc_email").val();
|
80 |
+
if (wplc_name.length <= 0) { alert("Please enter your name"); return false; }
|
81 |
+
if (wplc_email.length <= 0) { alert("Please enter your email address"); return false; }
|
82 |
+
|
83 |
+
jQuery("#wp-live-chat-2").hide();
|
84 |
+
jQuery("#wp-live-chat-3").show();
|
85 |
+
|
86 |
+
wplc_check_cookie_id = jQuery.cookie('wplc_cid');
|
87 |
+
var wplc_chat_session_id;
|
88 |
+
|
89 |
+
var data = {
|
90 |
+
action: 'wplc_start_chat',
|
91 |
+
security: wplc_nonce,
|
92 |
+
name: wplc_name,
|
93 |
+
email: wplc_email
|
94 |
+
};
|
95 |
+
jQuery.post(ajaxurl, data, function(response) {
|
96 |
+
//console.log("wplc_start_chat");
|
97 |
+
wplc_chat_session_id = response;
|
98 |
+
wplc_check_cookie_id = response;
|
99 |
+
wplc_user_waiting = setInterval(function (){wplc_user_await_session(wplc_chat_session_id);}, 5000);
|
100 |
+
|
101 |
+
});
|
102 |
+
});
|
103 |
+
|
104 |
+
function wplc_user_await_session(cid) {
|
105 |
+
var data = {
|
106 |
+
action: 'wplc_user_awaiting_chat',
|
107 |
+
security: wplc_nonce,
|
108 |
+
id: cid
|
109 |
+
};
|
110 |
+
jQuery.post(ajaxurl, data, function(response) {
|
111 |
+
//console.log("wplc_user_awaiting_chat");
|
112 |
+
//alert("chat status"+response);
|
113 |
+
if (response == "3") {
|
114 |
+
clearInterval(wplc_user_waiting);
|
115 |
+
var wplc_name = jQuery("#wplc_name").val();
|
116 |
+
jQuery("#wplc_cid").val(cid)
|
117 |
+
jQuery("#wp-live-chat-3").hide();
|
118 |
+
jQuery("#wp-live-chat-4").show();
|
119 |
+
jQuery("#wplc_chatmsg").focus();
|
120 |
+
|
121 |
+
// chat is now active
|
122 |
+
jQuery.cookie('wplc_cid', cid, { expires: 1, path: '/' });
|
123 |
+
jQuery.cookie('wplc_name', wplc_name, { expires: 1, path: '/' });
|
124 |
+
jQuery.cookie('wplc_stage', 3, { expires: 1, path: '/' });
|
125 |
+
wplc_user_auto_refresh = setInterval(function (){wpcl_user_auto_update_chat_box(cid);}, 3500);
|
126 |
+
|
127 |
+
};
|
128 |
+
});
|
129 |
+
return;
|
130 |
+
}
|
131 |
+
jQuery("#wplc_chatmsg").keyup(function(event){
|
132 |
+
if(event.keyCode == 13){
|
133 |
+
jQuery("#wplc_send_msg").click();
|
134 |
+
}
|
135 |
+
});
|
136 |
+
|
137 |
+
jQuery("#wplc_send_msg").live("click", function() {
|
138 |
+
var wplc_cid = jQuery("#wplc_cid").val();
|
139 |
+
var wplc_chat = jQuery("#wplc_chatmsg").val();
|
140 |
+
var wplc_name = jQuery("#wplc_name").val();
|
141 |
+
if (typeof wplc_name == "undefined" || wplc_name == null || wplc_name == "") {
|
142 |
+
wplc_name = jQuery.cookie('wplc_name');
|
143 |
+
}
|
144 |
+
jQuery("#wplc_chatmsg").val('');
|
145 |
+
jQuery("#wplc_chatbox").append("<strong>"+wplc_name+"</strong>: "+wplc_chat+"<br />");
|
146 |
+
var height = jQuery('#wplc_chatbox')[0].scrollHeight;
|
147 |
+
jQuery('#wplc_chatbox').scrollTop(height);
|
148 |
+
|
149 |
+
var data = {
|
150 |
+
action: 'wplc_user_send_msg',
|
151 |
+
security: wplc_nonce,
|
152 |
+
cid: wplc_cid,
|
153 |
+
msg: wplc_chat
|
154 |
+
};
|
155 |
+
jQuery.post(ajaxurl, data, function(response) {
|
156 |
+
//console.log("wplc_user_send_msg");
|
157 |
+
});
|
158 |
+
|
159 |
+
});
|
160 |
+
|
161 |
+
function wpcl_user_auto_update_chat_box(cid) {
|
162 |
+
var data = {
|
163 |
+
action: 'wplc_update_user_chat_boxes',
|
164 |
+
cid: cid,
|
165 |
+
security: wplc_nonce
|
166 |
+
};
|
167 |
+
jQuery.post(ajaxurl, data, function(response) {
|
168 |
+
//console.log("wplc_update_user_chat_boxes");
|
169 |
+
jQuery("#wplc_chatbox").append(response);
|
170 |
+
var height = jQuery('#wplc_chatbox')[0].scrollHeight;
|
171 |
+
jQuery('#wplc_chatbox').scrollTop(height);
|
172 |
+
|
173 |
+
});
|
174 |
+
|
175 |
+
}
|
176 |
+
|
177 |
+
|
178 |
+
if (wplc_check_hide_cookie == "yes") {
|
179 |
+
jQuery("#wp-live-chat-1").show();
|
180 |
+
jQuery("#wp-live-chat-2").hide();
|
181 |
+
jQuery("#wp-live-chat-3").hide();
|
182 |
+
jQuery("#wp-live-chat-4").hide();
|
183 |
+
} else {
|
184 |
+
if (typeof wplc_check_cookie_id == "undefined" || wplc_check_cookie_id == null) {
|
185 |
+
wplc_dc = setTimeout(function (){jQuery("#wp-live-chat").css({ "display" : "block" }); }, 10000);
|
186 |
+
}
|
187 |
+
else {
|
188 |
+
|
189 |
+
jQuery("#wplc_cid").val(wplc_check_cookie_id);
|
190 |
+
|
191 |
+
|
192 |
+
|
193 |
+
jQuery("#wp-live-chat-1").show();
|
194 |
+
jQuery("#wp-live-chat-2").hide();
|
195 |
+
jQuery("#wp-live-chat-3").hide();
|
196 |
+
jQuery("#wp-live-chat-4").hide();
|
197 |
+
jQuery("#wp-live-chat-react").show();
|
198 |
+
|
199 |
+
|
200 |
+
|
201 |
+
jQuery("#wp-live-chat").css({ "display" : "block" });
|
202 |
+
|
203 |
+
|
204 |
+
|
205 |
+
var data = {
|
206 |
+
action: 'wplc_user_reactivate_chat',
|
207 |
+
security: wplc_nonce,
|
208 |
+
cid: wplc_check_cookie_id
|
209 |
+
};
|
210 |
+
jQuery.post(ajaxurl, data, function(response) {
|
211 |
+
//console.log("wplc_user_reactivate_chat");
|
212 |
+
jQuery("#wp-live-chat-react").hide();
|
213 |
+
jQuery("#wp-live-chat-4").show();
|
214 |
+
jQuery("#wplc_chatmsg").focus();
|
215 |
+
jQuery("#wp-live-chat-close").show();
|
216 |
+
|
217 |
+
jQuery("#wplc_chatbox").append(response);
|
218 |
+
var height = jQuery('#wplc_chatbox')[0].scrollHeight;
|
219 |
+
jQuery('#wplc_chatbox').scrollTop(height);
|
220 |
+
|
221 |
+
wplc_user_auto_refresh = setInterval(function (){wpcl_user_auto_update_chat_box(wplc_check_cookie_id);}, 3500);
|
222 |
+
});
|
223 |
+
}
|
224 |
+
}
|
225 |
+
|
226 |
+
});
|
readme.txt
CHANGED
@@ -6,16 +6,16 @@ Requires at least: 3.4
|
|
6 |
Tested up to: 3.5
|
7 |
Stable tag: trunk
|
8 |
|
9 |
-
The
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
-
The
|
14 |
|
15 |
= Free version =
|
|
|
16 |
* Chat with your visitors
|
17 |
* Easy to use interface for both the admin and the visitor
|
18 |
-
* Fully functional free version
|
19 |
* No advertising or links
|
20 |
* No monthly subscriptions needed
|
21 |
|
@@ -50,8 +50,8 @@ Once installed and activated, a link should appear in your left navigation panel
|
|
50 |
|
51 |
== Screenshots ==
|
52 |
|
53 |
-
1. Front-end Chat Window
|
54 |
-
2. Back-end Chat Window
|
55 |
|
56 |
|
57 |
== Upgrade Notice ==
|
@@ -60,6 +60,12 @@ Once installed and activated, a link should appear in your left navigation panel
|
|
60 |
|
61 |
== Changelog ==
|
62 |
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
= 2.0 =
|
64 |
* Bug fixes
|
65 |
* Better front-end UI (Basic + Pro)
|
6 |
Tested up to: 3.5
|
7 |
Stable tag: trunk
|
8 |
|
9 |
+
The most cost effective Live Chat plugin. Chat with your visitors for free!
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
+
The most cost effective Live Chat plugin. Chat with your visitors for free! Perfect for small businesses. No third party connections or subscriptions required. There's no need to pay monthly subscriptions in order to better understand your visitors. This is a fully functional live chat plugin. Increase your conversion rates by communicating directly with your visitors when they're ready to do so.
|
14 |
|
15 |
= Free version =
|
16 |
+
* Fully functional free live chat
|
17 |
* Chat with your visitors
|
18 |
* Easy to use interface for both the admin and the visitor
|
|
|
19 |
* No advertising or links
|
20 |
* No monthly subscriptions needed
|
21 |
|
50 |
|
51 |
== Screenshots ==
|
52 |
|
53 |
+
1. Front-end Live Chat Window
|
54 |
+
2. Back-end Live Chat Window
|
55 |
|
56 |
|
57 |
== Upgrade Notice ==
|
60 |
|
61 |
== Changelog ==
|
62 |
|
63 |
+
= 2.1 =
|
64 |
+
* More precise functionality to handle if you are online or offline
|
65 |
+
* Fixed a bug that recorded visitors when offline
|
66 |
+
* Neatened up some code
|
67 |
+
* Fixed some small bugs
|
68 |
+
|
69 |
= 2.0 =
|
70 |
* Bug fixes
|
71 |
* Better front-end UI (Basic + Pro)
|
screenshot-3.JPG
ADDED
Binary file
|
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: 2.
|
7 |
Author: WP-LiveChat
|
8 |
Author URI: http://www.wp-livechat.com
|
9 |
*/
|
@@ -59,248 +59,24 @@ function wplc_admin_menu() {
|
|
59 |
add_submenu_page('wplivechat-menu', __('History','wplivechat'), __('History','wplivechat'), 'manage_options' , 'wplivechat-menu-history', 'wplc_admin_history_layout');
|
60 |
|
61 |
}
|
62 |
-
|
63 |
-
|
64 |
-
function wplc_draw_user_box() {
|
65 |
$ajax_nonce = wp_create_nonce("wplc");
|
66 |
-
wp_register_script( 'wplc-user-jquery-cookie', plugins_url('/jquery-cookie.js', __FILE__) );
|
67 |
wp_enqueue_script( 'wplc-user-jquery-cookie' );
|
68 |
$wplc_settings = get_option("WPLC_SETTINGS");
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
var ajaxurl = '<?php echo admin_url( 'admin-ajax.php' ); ?>';
|
78 |
-
var wplc_nonce = '<?php echo $ajax_nonce; ?>';
|
79 |
-
var wplc_check_cookie_id;
|
80 |
-
var wplc_check_cookie_stage;
|
81 |
-
var wplc_check_hide_cookie;
|
82 |
-
|
83 |
-
wplc_check_cookie_id = jQuery.cookie('wplc_cid');
|
84 |
-
wplc_check_cookie_stage = jQuery.cookie('wplc_stage');
|
85 |
-
wplc_check_hide_cookie = jQuery.cookie('wplc_hide');
|
86 |
-
|
87 |
-
|
88 |
-
function wplc_relay_user_stage(stage,cid) {
|
89 |
-
if (cid.length) {
|
90 |
-
var data = {
|
91 |
-
action: 'wplc_relay_stage',
|
92 |
-
security: wplc_nonce,
|
93 |
-
stage: stage,
|
94 |
-
cid: cid
|
95 |
-
};
|
96 |
-
} else {
|
97 |
-
var data = {
|
98 |
-
action: 'wplc_relay_stage',
|
99 |
-
security: wplc_nonce,
|
100 |
-
stage: stage
|
101 |
-
};
|
102 |
-
}
|
103 |
-
jQuery.post(ajaxurl, data, function(response) {
|
104 |
-
//console.log("wplc_relay_stage");
|
105 |
-
});
|
106 |
-
}
|
107 |
-
|
108 |
-
/* close chat window */
|
109 |
-
jQuery("#wp-live-chat-close").live("click", function() {
|
110 |
-
jQuery("#wp-live-chat-1").show();
|
111 |
-
jQuery("#wp-live-chat-1").css('cursor', 'pointer');
|
112 |
-
|
113 |
-
jQuery("#wp-live-chat-2").hide();
|
114 |
-
jQuery("#wp-live-chat-3").hide();
|
115 |
-
jQuery("#wp-live-chat-4").hide();
|
116 |
-
jQuery("#wp-live-chat-close").hide();
|
117 |
-
jQuery.cookie('wplc_hide', "yes", { expires: 1, path: '/' });
|
118 |
-
var data = {
|
119 |
-
action: 'wplc_user_close_chat',
|
120 |
-
security: wplc_nonce,
|
121 |
-
cid: wplc_check_cookie_id
|
122 |
-
};
|
123 |
-
jQuery.post(ajaxurl, data, function(response) {
|
124 |
-
//console.log("wplc_user_close_chat");
|
125 |
-
});
|
126 |
-
});
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
jQuery("#wp-live-chat-1").live("click", function() {
|
131 |
-
///jQuery("#wp-live-chat-1").hide();
|
132 |
-
jQuery("#wp-live-chat-1").css('cursor', 'default');
|
133 |
-
jQuery.cookie('wplc_hide', "");
|
134 |
-
jQuery("#wp-live-chat-close").show();
|
135 |
-
jQuery("#wp-live-chat-2").show();
|
136 |
-
wplc_check_cookie_stage = jQuery.cookie('wplc_stage');
|
137 |
-
if (wplc_check_cookie_stage == "3") {
|
138 |
-
jQuery("#wp-live-chat-4").show();
|
139 |
-
jQuery("#wplc_chatmsg").focus();
|
140 |
-
jQuery("#wp-live-chat-2").hide();
|
141 |
-
}
|
142 |
-
else {
|
143 |
-
jQuery("#wp-live-chat-2").show();
|
144 |
-
}
|
145 |
-
|
146 |
-
});
|
147 |
-
|
148 |
-
var wplc_user_waiting = null;
|
149 |
-
|
150 |
-
jQuery("#wplc_start_chat_btn").live("click", function() {
|
151 |
-
var wplc_name = jQuery("#wplc_name").val();
|
152 |
-
var wplc_email = jQuery("#wplc_email").val();
|
153 |
-
if (wplc_name.length <= 0) { alert("Please enter your name"); return false; }
|
154 |
-
if (wplc_email.length <= 0) { alert("Please enter your email address"); return false; }
|
155 |
-
|
156 |
-
jQuery("#wp-live-chat-2").hide();
|
157 |
-
jQuery("#wp-live-chat-3").show();
|
158 |
-
|
159 |
-
wplc_check_cookie_id = jQuery.cookie('wplc_cid');
|
160 |
-
var wplc_chat_session_id;
|
161 |
-
|
162 |
-
var data = {
|
163 |
-
action: 'wplc_start_chat',
|
164 |
-
security: wplc_nonce,
|
165 |
-
name: wplc_name,
|
166 |
-
email: wplc_email
|
167 |
-
};
|
168 |
-
jQuery.post(ajaxurl, data, function(response) {
|
169 |
-
//console.log("wplc_start_chat");
|
170 |
-
wplc_chat_session_id = response;
|
171 |
-
wplc_check_cookie_id = response;
|
172 |
-
wplc_user_waiting = setInterval(function (){wplc_user_await_session(wplc_chat_session_id);}, 5000);
|
173 |
-
|
174 |
-
});
|
175 |
-
});
|
176 |
-
|
177 |
-
function wplc_user_await_session(cid) {
|
178 |
-
var data = {
|
179 |
-
action: 'wplc_user_awaiting_chat',
|
180 |
-
security: wplc_nonce,
|
181 |
-
id: cid
|
182 |
-
};
|
183 |
-
jQuery.post(ajaxurl, data, function(response) {
|
184 |
-
//console.log("wplc_user_awaiting_chat");
|
185 |
-
//alert("chat status"+response);
|
186 |
-
if (response == "3") {
|
187 |
-
clearInterval(wplc_user_waiting);
|
188 |
-
var wplc_name = jQuery("#wplc_name").val();
|
189 |
-
jQuery("#wplc_cid").val(cid)
|
190 |
-
jQuery("#wp-live-chat-3").hide();
|
191 |
-
jQuery("#wp-live-chat-4").show();
|
192 |
-
jQuery("#wplc_chatmsg").focus();
|
193 |
-
|
194 |
-
// chat is now active
|
195 |
-
jQuery.cookie('wplc_cid', cid, { expires: 1, path: '/' });
|
196 |
-
jQuery.cookie('wplc_name', wplc_name, { expires: 1, path: '/' });
|
197 |
-
jQuery.cookie('wplc_stage', 3, { expires: 1, path: '/' });
|
198 |
-
wplc_user_auto_refresh = setInterval(function (){wpcl_user_auto_update_chat_box(cid);}, 3500);
|
199 |
-
|
200 |
-
};
|
201 |
-
});
|
202 |
-
return;
|
203 |
-
}
|
204 |
-
jQuery("#wplc_chatmsg").keyup(function(event){
|
205 |
-
if(event.keyCode == 13){
|
206 |
-
jQuery("#wplc_send_msg").click();
|
207 |
-
}
|
208 |
-
});
|
209 |
-
|
210 |
-
jQuery("#wplc_send_msg").live("click", function() {
|
211 |
-
var wplc_cid = jQuery("#wplc_cid").val();
|
212 |
-
var wplc_chat = jQuery("#wplc_chatmsg").val();
|
213 |
-
var wplc_name = jQuery("#wplc_name").val();
|
214 |
-
if (typeof wplc_name == "undefined" || wplc_name == null || wplc_name == "") {
|
215 |
-
wplc_name = jQuery.cookie('wplc_name');
|
216 |
-
}
|
217 |
-
jQuery("#wplc_chatmsg").val('');
|
218 |
-
jQuery("#wplc_chatbox").append("<strong>"+wplc_name+"</strong>: "+wplc_chat+"<br />");
|
219 |
-
var height = jQuery('#wplc_chatbox')[0].scrollHeight;
|
220 |
-
jQuery('#wplc_chatbox').scrollTop(height);
|
221 |
-
|
222 |
-
var data = {
|
223 |
-
action: 'wplc_user_send_msg',
|
224 |
-
security: wplc_nonce,
|
225 |
-
cid: wplc_cid,
|
226 |
-
msg: wplc_chat
|
227 |
-
};
|
228 |
-
jQuery.post(ajaxurl, data, function(response) {
|
229 |
-
//console.log("wplc_user_send_msg");
|
230 |
-
});
|
231 |
-
|
232 |
-
});
|
233 |
-
|
234 |
-
function wpcl_user_auto_update_chat_box(cid) {
|
235 |
-
var data = {
|
236 |
-
action: 'wplc_update_user_chat_boxes',
|
237 |
-
cid: cid,
|
238 |
-
security: wplc_nonce
|
239 |
-
};
|
240 |
-
jQuery.post(ajaxurl, data, function(response) {
|
241 |
-
//console.log("wplc_update_user_chat_boxes");
|
242 |
-
jQuery("#wplc_chatbox").append(response);
|
243 |
-
var height = jQuery('#wplc_chatbox')[0].scrollHeight;
|
244 |
-
jQuery('#wplc_chatbox').scrollTop(height);
|
245 |
-
|
246 |
-
});
|
247 |
-
|
248 |
-
}
|
249 |
-
|
250 |
-
|
251 |
-
if (wplc_check_hide_cookie == "yes") {
|
252 |
-
jQuery("#wp-live-chat-1").show();
|
253 |
-
jQuery("#wp-live-chat-2").hide();
|
254 |
-
jQuery("#wp-live-chat-3").hide();
|
255 |
-
jQuery("#wp-live-chat-4").hide();
|
256 |
-
} else {
|
257 |
-
if (typeof wplc_check_cookie_id == "undefined" || wplc_check_cookie_id == null) {
|
258 |
-
wplc_dc = setTimeout(function (){jQuery("#wp-live-chat").css({ "display" : "block" }); }, 10000);
|
259 |
-
}
|
260 |
-
else {
|
261 |
-
|
262 |
-
jQuery("#wplc_cid").val(wplc_check_cookie_id);
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
jQuery("#wp-live-chat-1").show();
|
267 |
-
jQuery("#wp-live-chat-2").hide();
|
268 |
-
jQuery("#wp-live-chat-3").hide();
|
269 |
-
jQuery("#wp-live-chat-4").hide();
|
270 |
-
jQuery("#wp-live-chat-react").show();
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
jQuery("#wp-live-chat").css({ "display" : "block" });
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
var data = {
|
279 |
-
action: 'wplc_user_reactivate_chat',
|
280 |
-
security: wplc_nonce,
|
281 |
-
cid: wplc_check_cookie_id
|
282 |
-
};
|
283 |
-
jQuery.post(ajaxurl, data, function(response) {
|
284 |
-
//console.log("wplc_user_reactivate_chat");
|
285 |
-
jQuery("#wp-live-chat-react").hide();
|
286 |
-
jQuery("#wp-live-chat-4").show();
|
287 |
-
jQuery("#wplc_chatmsg").focus();
|
288 |
-
jQuery("#wp-live-chat-close").show();
|
289 |
-
|
290 |
-
jQuery("#wplc_chatbox").append(response);
|
291 |
-
var height = jQuery('#wplc_chatbox')[0].scrollHeight;
|
292 |
-
jQuery('#wplc_chatbox').scrollTop(height);
|
293 |
-
|
294 |
-
wplc_user_auto_refresh = setInterval(function (){wpcl_user_auto_update_chat_box(wplc_check_cookie_id);}, 3500);
|
295 |
-
});
|
296 |
-
}
|
297 |
-
}
|
298 |
-
|
299 |
-
});
|
300 |
-
</script>
|
301 |
|
302 |
-
|
303 |
-
|
|
|
|
|
304 |
|
305 |
}
|
306 |
function wplc_output_box() {
|
@@ -308,6 +84,15 @@ function wplc_output_box() {
|
|
308 |
|
309 |
if ($wplc_settings["wplc_settings_align"] == 1) { $wplc_box_align = "left:100px;"; } else { $wplc_box_align = "right:100px;"; }
|
310 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
311 |
|
312 |
?>
|
313 |
<div id="wp-live-chat" style="<?php echo $wplc_box_align; ?>;">
|
@@ -687,6 +472,7 @@ function wplc_admin_accept_chat($cid) {
|
|
687 |
return true;
|
688 |
|
689 |
}
|
|
|
690 |
function wplc_update_chat_statuses() {
|
691 |
global $wpdb;
|
692 |
global $wplc_tblname_chats;
|
@@ -1302,7 +1088,7 @@ function wplc_handle_db() {
|
|
1302 |
}
|
1303 |
|
1304 |
function wplc_add_user_stylesheet() {
|
1305 |
-
wp_register_style( 'wplc-style', plugins_url('wplcstyle.css', __FILE__) );
|
1306 |
wp_enqueue_style( 'wplc-style' );
|
1307 |
}
|
1308 |
|
@@ -1474,5 +1260,7 @@ function wplc_head() {
|
|
1474 |
|
1475 |
}
|
1476 |
|
1477 |
-
|
1478 |
-
|
|
|
|
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: 2.1
|
7 |
Author: WP-LiveChat
|
8 |
Author URI: http://www.wp-livechat.com
|
9 |
*/
|
59 |
add_submenu_page('wplivechat-menu', __('History','wplivechat'), __('History','wplivechat'), 'manage_options' , 'wplivechat-menu-history', 'wplc_admin_history_layout');
|
60 |
|
61 |
}
|
62 |
+
add_action('wp_head','wplc_user_top_js');
|
63 |
+
function wplc_user_top_js() {
|
|
|
64 |
$ajax_nonce = wp_create_nonce("wplc");
|
65 |
+
wp_register_script( 'wplc-user-jquery-cookie', plugins_url('/js/jquery-cookie.js', __FILE__) );
|
66 |
wp_enqueue_script( 'wplc-user-jquery-cookie' );
|
67 |
$wplc_settings = get_option("WPLC_SETTINGS");
|
68 |
+
?>
|
69 |
+
<script type="text/javascript">
|
70 |
+
var ajaxurl = '<?php echo admin_url( 'admin-ajax.php' ); ?>';
|
71 |
+
var wplc_nonce = '<?php echo $ajax_nonce; ?>';
|
72 |
+
</script>
|
73 |
+
<?php
|
74 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
|
76 |
+
function wplc_draw_user_box() {
|
77 |
+
wp_register_script( 'wplc-user-script', plugins_url('/js/wplc_u.js', __FILE__) );
|
78 |
+
wp_enqueue_script( 'wplc-user-script' );
|
79 |
+
wplc_output_box();
|
80 |
|
81 |
}
|
82 |
function wplc_output_box() {
|
84 |
|
85 |
if ($wplc_settings["wplc_settings_align"] == 1) { $wplc_box_align = "left:100px;"; } else { $wplc_box_align = "right:100px;"; }
|
86 |
|
87 |
+
$wplc_is_admin_logged_in = get_transient("wplc_is_admin_logged_in");
|
88 |
+
if ($wplc_is_admin_logged_in == 1) {
|
89 |
+
|
90 |
+
} else {
|
91 |
+
return "";
|
92 |
+
}
|
93 |
+
|
94 |
+
|
95 |
+
|
96 |
|
97 |
?>
|
98 |
<div id="wp-live-chat" style="<?php echo $wplc_box_align; ?>;">
|
472 |
return true;
|
473 |
|
474 |
}
|
475 |
+
add_action('admin_head','wplc_update_chat_statuses');
|
476 |
function wplc_update_chat_statuses() {
|
477 |
global $wpdb;
|
478 |
global $wplc_tblname_chats;
|
1088 |
}
|
1089 |
|
1090 |
function wplc_add_user_stylesheet() {
|
1091 |
+
wp_register_style( 'wplc-style', plugins_url('/css/wplcstyle.css', __FILE__) );
|
1092 |
wp_enqueue_style( 'wplc-style' );
|
1093 |
}
|
1094 |
|
1260 |
|
1261 |
}
|
1262 |
|
1263 |
+
function wplc_logout() {
|
1264 |
+
delete_transient('wplc_is_admin_logged_in');
|
1265 |
+
}
|
1266 |
+
add_action('wp_logout', 'wplc_logout');
|