WP Live Chat Support - Version 2.6

Version Description

  • Fixed a bug that showed 'page not found' when saving the live chat settings
  • Better UI
  • Added the ability to end live chats
Download this release

Release Info

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

Code changes from version 2.5 to 2.6

Files changed (6) hide show
  1. ajax.php +19 -2
  2. css/wplcstyle.css +2 -1
  3. js/wplc_tabs.js +3 -0
  4. js/wplc_u.js +98 -14
  5. readme.txt +35 -25
  6. wp-live-chat-support.php +171 -81
ajax.php CHANGED
@@ -158,7 +158,11 @@ if ($check == 1) {
158
  }
159
 
160
 
161
-
 
 
 
 
162
 
163
 
164
 
@@ -166,14 +170,23 @@ if ($check == 1) {
166
  // user
167
 
168
 
169
- if ($_POST['action'] == "wplc_user_awaiting_chat") {
170
  $chat_id = $_POST['id'];
171
  echo wplc_return_chat_status($chat_id);
172
  }
 
 
 
 
173
  if ($_POST['action'] == "wplc_user_close_chat") {
174
  $chat_id = $_POST['cid'];
175
  wplc_change_chat_status($_POST['cid'],1);
176
  }
 
 
 
 
 
177
  if ($_POST['action'] == "wplc_user_send_msg") {
178
  $chat_id = $_POST['cid'];
179
  $chat_msg = $_POST['msg'];
@@ -189,6 +202,10 @@ if ($check == 1) {
189
  echo wplc_return_user_chat_messages($_POST['cid']);
190
  wplc_mark_as_read_user_chat_messages($_POST['cid']);
191
  }
 
 
 
 
192
  if ($_POST['action'] == "wplc_user_reactivate_chat") {
193
  wplc_change_chat_status($_POST['cid'],3);
194
  echo wplc_return_chat_messages($_POST['cid']);
158
  }
159
 
160
 
161
+ if ($_POST['action'] == "wplc_admin_close_chat") {
162
+ $chat_id = $_POST['cid'];
163
+ wplc_change_chat_status($chat_id,1);
164
+ echo 'done';
165
+ }
166
 
167
 
168
 
170
  // user
171
 
172
 
173
+ if ($_POST['action'] == "wplc_user_awaiting_chat") {
174
  $chat_id = $_POST['id'];
175
  echo wplc_return_chat_status($chat_id);
176
  }
177
+ if ($_POST['action'] == "wplc_user_minimize_chat") {
178
+ $chat_id = $_POST['cid'];
179
+ wplc_change_chat_status($_POST['cid'],2);
180
+ }
181
  if ($_POST['action'] == "wplc_user_close_chat") {
182
  $chat_id = $_POST['cid'];
183
  wplc_change_chat_status($_POST['cid'],1);
184
  }
185
+ if ($_POST['action'] == "wplc_user_maximize_chat") {
186
+ $chat_id = $_POST['cid'];
187
+ wplc_change_chat_status($_POST['cid'],3);
188
+ }
189
+
190
  if ($_POST['action'] == "wplc_user_send_msg") {
191
  $chat_id = $_POST['cid'];
192
  $chat_msg = $_POST['msg'];
202
  echo wplc_return_user_chat_messages($_POST['cid']);
203
  wplc_mark_as_read_user_chat_messages($_POST['cid']);
204
  }
205
+ if ($_POST['action'] == "wplc_update_user_chat_status") {
206
+ echo wplc_return_chat_status($_POST['cid']);
207
+ }
208
+
209
  if ($_POST['action'] == "wplc_user_reactivate_chat") {
210
  wplc_change_chat_status($_POST['cid'],3);
211
  echo wplc_return_chat_messages($_POST['cid']);
css/wplcstyle.css CHANGED
@@ -38,7 +38,8 @@
38
 
39
  color:#FFF;
40
  }
41
- #wp-live-chat-close { position:absolute; right:5px; top:10px; width:10px; cursor: pointer; height:3px; background:#FFF; }
 
42
  #wp-live-chat-2-info {
43
  font-size:11px;
44
  display:block;
38
 
39
  color:#FFF;
40
  }
41
+ #wp-live-chat-minimize { position:absolute; right:23px; top:15px; width:10px; cursor: pointer; height:3px; background:#FFF; }
42
+ #wp-live-chat-close { position:absolute; right:5px; top:4px; width:10px; cursor: pointer; font-weight:bold; }
43
  #wp-live-chat-2-info {
44
  font-size:11px;
45
  display:block;
js/wplc_tabs.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ jQuery("document").ready(function() {
2
+ jQuery("#wplc_tabs").tabs();
3
+ });
js/wplc_u.js CHANGED
@@ -2,6 +2,8 @@ jQuery(document).ready(function() {
2
 
3
 
4
 
 
 
5
 
6
  var wplc_check_cookie_id;
7
  var wplc_check_cookie_stage;
@@ -33,18 +35,22 @@ jQuery(document).ready(function() {
33
  });
34
  }
35
 
36
- /* close chat window */
37
- jQuery("#wp-live-chat-close").live("click", function() {
38
  jQuery("#wp-live-chat-1").show();
39
  jQuery("#wp-live-chat-1").css('cursor', 'pointer');
40
 
41
  jQuery("#wp-live-chat-2").hide();
42
  jQuery("#wp-live-chat-3").hide();
43
  jQuery("#wp-live-chat-4").hide();
44
- jQuery("#wp-live-chat-close").hide();
45
  jQuery.cookie('wplc_hide', "yes", { expires: 1, path: '/' });
 
 
 
 
46
  var data = {
47
- action: 'wplc_user_close_chat',
48
  security: wplc_nonce,
49
  cid: wplc_check_cookie_id
50
  };
@@ -52,24 +58,64 @@ jQuery(document).ready(function() {
52
  //console.log("wplc_user_close_chat");
53
  });
54
  });
55
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
 
57
 
58
  jQuery("#wp-live-chat-1").live("click", function() {
59
- ///jQuery("#wp-live-chat-1").hide();
60
  jQuery("#wp-live-chat-1").css('cursor', 'default');
61
- jQuery.cookie('wplc_hide', "");
 
62
  jQuery("#wp-live-chat-close").show();
63
- jQuery("#wp-live-chat-2").show();
64
  wplc_check_cookie_stage = jQuery.cookie('wplc_stage');
65
  if (wplc_check_cookie_stage == "3") {
66
  jQuery("#wp-live-chat-4").show();
67
- jQuery("#wplc_chatmsg").focus();
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  jQuery("#wp-live-chat-2").hide();
69
  }
70
  else {
71
  jQuery("#wp-live-chat-2").show();
72
- }
 
 
73
 
74
  });
75
 
@@ -124,6 +170,7 @@ jQuery(document).ready(function() {
124
  jQuery.cookie('wplc_name', wplc_name, { expires: 1, path: '/' });
125
  jQuery.cookie('wplc_stage', 3, { expires: 1, path: '/' });
126
  wplc_user_auto_refresh = setInterval(function (){wpcl_user_auto_update_chat_box(cid);}, 3500);
 
127
 
128
  };
129
  });
@@ -158,6 +205,29 @@ jQuery(document).ready(function() {
158
  });
159
 
160
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
161
 
162
  function wpcl_user_auto_update_chat_box(cid) {
163
  var data = {
@@ -176,15 +246,24 @@ jQuery(document).ready(function() {
176
  }
177
 
178
 
179
- if (wplc_check_hide_cookie == "yes") {
 
 
180
  jQuery("#wp-live-chat-1").show();
181
  jQuery("#wp-live-chat-2").hide();
182
  jQuery("#wp-live-chat-3").hide();
183
  jQuery("#wp-live-chat-4").hide();
184
- } else {
185
- if (typeof wplc_check_cookie_id == "undefined" || wplc_check_cookie_id == null) {
186
- wplc_dc = setTimeout(function (){jQuery("#wp-live-chat").css({ "display" : "block" }); }, 10000);
 
 
 
 
 
 
187
  }
 
188
  else {
189
 
190
  jQuery("#wplc_cid").val(wplc_check_cookie_id);
@@ -196,6 +275,8 @@ jQuery(document).ready(function() {
196
  jQuery("#wp-live-chat-3").hide();
197
  jQuery("#wp-live-chat-4").hide();
198
  jQuery("#wp-live-chat-react").show();
 
 
199
 
200
 
201
 
@@ -214,12 +295,15 @@ jQuery(document).ready(function() {
214
  jQuery("#wp-live-chat-4").show();
215
  jQuery("#wplc_chatmsg").focus();
216
  jQuery("#wp-live-chat-close").show();
 
217
 
218
  jQuery("#wplc_chatbox").append(response);
219
  var height = jQuery('#wplc_chatbox')[0].scrollHeight;
220
  jQuery('#wplc_chatbox').scrollTop(height);
221
 
222
  wplc_user_auto_refresh = setInterval(function (){wpcl_user_auto_update_chat_box(wplc_check_cookie_id);}, 3500);
 
 
223
  });
224
  }
225
  }
2
 
3
 
4
 
5
+ var wplc_user_auto_refresh = "";
6
+ var wplc_user_auto_refresh_status = "";
7
 
8
  var wplc_check_cookie_id;
9
  var wplc_check_cookie_stage;
35
  });
36
  }
37
 
38
+ /* minimize chat window */
39
+ jQuery("#wp-live-chat-minimize").live("click", function() {
40
  jQuery("#wp-live-chat-1").show();
41
  jQuery("#wp-live-chat-1").css('cursor', 'pointer');
42
 
43
  jQuery("#wp-live-chat-2").hide();
44
  jQuery("#wp-live-chat-3").hide();
45
  jQuery("#wp-live-chat-4").hide();
46
+ jQuery("#wp-live-chat-minimize").hide();
47
  jQuery.cookie('wplc_hide', "yes", { expires: 1, path: '/' });
48
+ jQuery.cookie('wplc_stage', "2", { expires: 1, path: '/' });
49
+
50
+
51
+
52
  var data = {
53
+ action: 'wplc_user_minimize_chat',
54
  security: wplc_nonce,
55
  cid: wplc_check_cookie_id
56
  };
58
  //console.log("wplc_user_close_chat");
59
  });
60
  });
61
+ /* close chat window */
62
+ jQuery("#wp-live-chat-close").live("click", function() {
63
+ jQuery("#wp-live-chat").hide();
64
+ jQuery("#wp-live-chat-1").hide();
65
+ jQuery("#wp-live-chat-2").hide();
66
+ jQuery("#wp-live-chat-3").hide();
67
+ jQuery("#wp-live-chat-4").hide();
68
+ jQuery("#wp-live-chat-minimize").hide();
69
+ jQuery.cookie('wplc_hide', "yes", { expires: 1, path: '/' });
70
+ jQuery.cookie('wplc_stage', "1", { expires: 1, path: '/' });
71
+
72
+
73
+
74
+ var data = {
75
+ action: 'wplc_user_close_chat',
76
+ security: wplc_nonce,
77
+ cid: wplc_check_cookie_id
78
+ };
79
+ jQuery.post(wplc_ajaxurl, data, function(response) {
80
+ //console.log("wplc_user_close_chat");
81
+ clearInterval(wplc_user_auto_refresh_status);
82
+ clearInterval(wplc_user_auto_refresh);
83
+
84
+ });
85
+ });
86
 
87
 
88
  jQuery("#wp-live-chat-1").live("click", function() {
89
+ //jQuery("#wp-live-chat-1").hide();
90
  jQuery("#wp-live-chat-1").css('cursor', 'default');
91
+ jQuery.cookie('wplc_hide', "", { expires: 1, path: '/' });
92
+ jQuery("#wp-live-chat-minimize").show();
93
  jQuery("#wp-live-chat-close").show();
94
+
95
  wplc_check_cookie_stage = jQuery.cookie('wplc_stage');
96
  if (wplc_check_cookie_stage == "3") {
97
  jQuery("#wp-live-chat-4").show();
98
+ jQuery("#wplc_chatmsg").focus();
99
+ jQuery("#wp-live-chat-2").hide();
100
+ }
101
+ else if (wplc_check_cookie_stage == "2") {
102
+ var data = {
103
+ action: 'wplc_user_maximize_chat',
104
+ security: wplc_nonce,
105
+ cid: wplc_check_cookie_id
106
+ };
107
+ jQuery.post(wplc_ajaxurl, data, function(response) {
108
+ //log("user maximized chat success");
109
+ });
110
+ jQuery("#wp-live-chat-4").show();
111
+ jQuery("#wplc_chatmsg").focus();
112
  jQuery("#wp-live-chat-2").hide();
113
  }
114
  else {
115
  jQuery("#wp-live-chat-2").show();
116
+ }
117
+
118
+
119
 
120
  });
121
 
170
  jQuery.cookie('wplc_name', wplc_name, { expires: 1, path: '/' });
171
  jQuery.cookie('wplc_stage', 3, { expires: 1, path: '/' });
172
  wplc_user_auto_refresh = setInterval(function (){wpcl_user_auto_update_chat_box(cid);}, 3500);
173
+ wplc_user_auto_refresh_status = setInterval(function (){wpcl_user_auto_update_chat_status(wplc_check_cookie_id);}, 3500);
174
 
175
  };
176
  });
205
  });
206
 
207
  });
208
+ function wpcl_user_auto_update_chat_status(cid) {
209
+ var data = {
210
+ action: 'wplc_update_user_chat_status',
211
+ cid: cid,
212
+ security: wplc_nonce
213
+ };
214
+ jQuery.post(wplc_ajaxurl, data, function(response) {
215
+ if (response == "1") {
216
+ jQuery("#wplc_chatbox").append("The chat has been ended by the operator.<br />");
217
+ var height = jQuery('#wplc_chatbox')[0].scrollHeight;
218
+ jQuery('#wplc_chatbox').scrollTop(height);
219
+ jQuery.cookie('wplc_stage', '1', { path: '/' } );
220
+ jQuery.cookie('wplc_hide', null, { path: '/' } );
221
+ jQuery.cookie('wplc_cid', null, { path: '/' } );
222
+ clearInterval(wplc_user_auto_refresh_status);
223
+ jQuery("#wp-live-chat-minimize").hide();
224
+ document.getElementById('wplc_chatmsg').disabled = true;
225
+ }
226
+ console.log("wplc_update_user_chat_response "+response);
227
+ });
228
+
229
+
230
+ }
231
 
232
  function wpcl_user_auto_update_chat_box(cid) {
233
  var data = {
246
  }
247
 
248
 
249
+ // user pushed the X button, dont show chat window
250
+ if (wplc_check_hide_cookie === "yes" && wplc_check_cookie_stage !== '1') {
251
+ jQuery("#wp-live-chat").css({ "display" : "block" });
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
+ }
257
+ else if (wplc_check_cookie_stage === "1") {
258
+ jQuery("#wp-live-chat").hide();
259
+ }
260
+ else {
261
+
262
+ // First time visitor has visited the site, show chat window and set cookie
263
+ if (typeof wplc_check_cookie_id === "undefined" || wplc_check_cookie_id == null) {
264
+ wplc_dc = setTimeout(function (){jQuery("#wp-live-chat").css({ "display" : "block" }); wplc_relay_user_stage(1,''); }, window.wplc_delay);
265
  }
266
+ // user has been here before, show different chat windows depending on which stage of the chat funnel he/she was in
267
  else {
268
 
269
  jQuery("#wplc_cid").val(wplc_check_cookie_id);
275
  jQuery("#wp-live-chat-3").hide();
276
  jQuery("#wp-live-chat-4").hide();
277
  jQuery("#wp-live-chat-react").show();
278
+ jQuery("#wp-live-chat-minimize").show();
279
+ jQuery("#wp-live-chat-close").show();
280
 
281
 
282
 
295
  jQuery("#wp-live-chat-4").show();
296
  jQuery("#wplc_chatmsg").focus();
297
  jQuery("#wp-live-chat-close").show();
298
+ jQuery("#wp-live-chat-minimize").show();
299
 
300
  jQuery("#wplc_chatbox").append(response);
301
  var height = jQuery('#wplc_chatbox')[0].scrollHeight;
302
  jQuery('#wplc_chatbox').scrollTop(height);
303
 
304
  wplc_user_auto_refresh = setInterval(function (){wpcl_user_auto_update_chat_box(wplc_check_cookie_id);}, 3500);
305
+ wplc_user_auto_refresh_status = setInterval(function (){wpcl_user_auto_update_chat_status(wplc_check_cookie_id);}, 3500);
306
+
307
  });
308
  }
309
  }
readme.txt CHANGED
@@ -1,10 +1,11 @@
1
- === WP Live Chat Support ===
2
  Contributors: WP-LiveChat
3
  Donate link: http://www.wp-livechat.com
4
- Tags: live chat, live support, live help, plugin, widget, wordpress chat, customer support, chat, live chat plugin
5
  Requires at least: 3.4
6
- Tested up to: 3.5.1
7
  Stable tag: trunk
 
8
 
9
  The most cost effective Live Chat plugin. Chat with your visitors for free!
10
 
@@ -12,27 +13,32 @@ The most cost effective Live Chat plugin. Chat with your visitors for free!
12
 
13
  The most cost effective Live Chat plugin. Chat with your visitors for free! WP Live Chat Support is perfect for small businesses. No third party connections or subscriptions required. There's no need to pay for live chat 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
- * The free version of WP Live Chat Support is a fully functional live chat plugin
17
- * Initiate live chats with your visitors
18
- * Easy to use interface for both the admin and the visitor
19
- * No advertising or links
20
- * No monthly live chat subscriptions needed
21
-
22
-
23
- = Pro add-on =
24
- * Initiate live chats with online visitors
25
- * Chat to more than one visitor at a time
26
- * Access historical live chat records
27
- * Set up your user profile
28
- * Add your company logo to the live chat window
29
- * Add your photo to the live chat window
30
- * Edit all text fields
31
- * World-class support
32
- * Fully customizable live chat experience
33
- * Get the [WP Live Chat Support Pro Add-on](http://wp-livechat.com/purchase-pro/) for only $14.95 once off!
 
 
 
 
34
 
35
  = Coming Soon =
 
36
  * Multiple live chat operators
37
  * Better control of chat history
38
  * More advanced customization
@@ -61,10 +67,16 @@ Once installed and activated, a link should appear in your left navigation panel
61
 
62
  == Upgrade Notice ==
63
 
 
64
 
65
 
66
  == Changelog ==
67
 
 
 
 
 
 
68
  = 2.5 =
69
  * Major performance improvements
70
  * Small UI improvements
@@ -96,6 +108,4 @@ Once installed and activated, a link should appear in your left navigation panel
96
  * More text fields can be customized
97
 
98
  = 1.0 =
99
- * Launch!
100
-
101
-
1
+ === WP Live Chat Support ===
2
  Contributors: WP-LiveChat
3
  Donate link: http://www.wp-livechat.com
4
+ Tags: live chat, live support, chat plugin, live help, wordpress chat, customer support, chat, live chat plugin
5
  Requires at least: 3.4
6
+ Tested up to: 3.7.1
7
  Stable tag: trunk
8
+ License: GPLv2
9
 
10
  The most cost effective Live Chat plugin. Chat with your visitors for free!
11
 
13
 
14
  The most cost effective Live Chat plugin. Chat with your visitors for free! WP Live Chat Support is perfect for small businesses. No third party connections or subscriptions required. There's no need to pay for live chat 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.
15
 
16
+ = Free Version Features =
17
+
18
+ WP Live Chat Support is a fully functional live chat plugin
19
+ Initiate live chats with your visitors
20
+ Easy to use interface for both the admin and the visitor
21
+ No advertising or links
22
+ ► No "Powered by" links on the live chat window
23
+ ► No monthly live chat subscriptions needed
24
+
25
+
26
+ = Pro Version Features =
27
+
28
+ Initiate live chats with online visitors
29
+ Chat to more than one visitor at a time
30
+ Access historical live chat records
31
+ Set up your user profile
32
+ Add your company logo to the live chat window
33
+ Add your photo to the live chat window
34
+ Edit all text fields
35
+ ► World-class support
36
+ ► Fully customizable live chat experience
37
+
38
+ Get the [WP Live Chat Support Pro Add-on](http://wp-livechat.com/purchase-pro/) for only $14.95 once off!
39
 
40
  = Coming Soon =
41
+
42
  * Multiple live chat operators
43
  * Better control of chat history
44
  * More advanced customization
67
 
68
  == Upgrade Notice ==
69
 
70
+ * Nothing required
71
 
72
 
73
  == Changelog ==
74
 
75
+ = 2.6 =
76
+ * Fixed a bug that showed 'page not found' when saving the live chat settings
77
+ * Better UI
78
+ * Added the ability to end live chats
79
+
80
  = 2.5 =
81
  * Major performance improvements
82
  * Small UI improvements
108
  * More text fields can be customized
109
 
110
  = 1.0 =
111
+ * Launch!
 
 
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.5
7
  Author: WP-LiveChat
8
  Author URI: http://www.wp-livechat.com
9
  */
@@ -17,15 +17,25 @@ global $wplc_tblname_chats;
17
  global $wplc_tblname_msgs;
18
  $wplc_tblname_chats = $wpdb->prefix . "wplc_chat_sessions";
19
  $wplc_tblname_msgs = $wpdb->prefix . "wplc_chat_msgs";
20
- $wplc_version = "2.5";
21
 
22
  require_once ("functions.php");
23
 
24
  add_action('wp_ajax_wplc_admin_set_transient', 'wplc_action_callback');
25
 
26
  add_action('wp_footer', 'wplc_display_box');
27
- add_action('admin_head', 'wplc_head');
28
- add_action( 'wp_enqueue_scripts', 'wplc_add_user_stylesheet' );
 
 
 
 
 
 
 
 
 
 
29
  add_action('admin_menu', 'wplc_admin_menu');
30
  add_action('admin_head', 'wplc_superadmin_javascript');
31
  register_activation_hook( __FILE__, 'wplc_activate' );
@@ -103,7 +113,7 @@ function wplc_output_box() {
103
  }
104
 
105
  ?>
106
- <div id="wp-live-chat" style="<?php echo $wplc_box_align; ?>;">
107
 
108
 
109
  <?php if (function_exists("wplc_register_pro_version")) {
@@ -111,7 +121,8 @@ function wplc_output_box() {
111
  } else {
112
  ?>
113
 
114
- <div id="wp-live-chat-close" style="display:none;"></div>
 
115
  <div id="wp-live-chat-1" style="background-color: <?php echo $wplc_settings_fill; ?> !important; color: <?php echo $wplc_settings_font; ?> !important;">
116
  <strong>Questions?</strong> Chat with us
117
  </div>
@@ -393,6 +404,7 @@ function wplc_draw_chat_area($cid) {
393
  echo "</div>";
394
 
395
  echo "
 
396
  <div id='admin_chat_box'>
397
  <div id='admin_chat_box_area_".$result->id."' style='height:200px; width:290px; border:1px solid #ccc; overflow:auto;'>".wplc_return_chat_messages($cid)."</div>
398
  <p>
@@ -449,6 +461,21 @@ function wplc_return_admin_chat_javascript($cid) {
449
  jQuery("#wplc_admin_send_msg").click();
450
  }
451
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
452
 
453
  jQuery("#wplc_admin_send_msg").live("click", function() {
454
  var wplc_cid = jQuery("#wplc_admin_cid").val();
@@ -515,15 +542,38 @@ function wplc_return_admin_chat_javascript($cid) {
515
  };
516
  jQuery.post(wplc_ajaxurl, data, function(response) {
517
  //console.log("wplc_update_admin_return_chat_status");
518
- if (chat_status != response) {
519
- chat_status = response;
520
- if (chat_status == "1") {
521
- //clearInterval(wplc_auto_check_status_of_chat);
522
- //clearInterval(wplc_auto_refresh);
523
- jQuery("#admin_chat_box_area_"+cid).append("<em><?php _e("User has minimized the chat window","wplivechat"); ?></em><br />");
524
- var height = jQuery('#admin_chat_box_area_'+cid)[0].scrollHeight;
525
- jQuery('#admin_chat_box_area_'+cid).scrollTop(height);
526
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
527
  }
528
  }
529
 
@@ -593,15 +643,28 @@ function wplc_handle_db() {
593
  function wplc_add_user_stylesheet() {
594
  wp_register_style( 'wplc-style', plugins_url('/css/wplcstyle.css', __FILE__) );
595
  wp_enqueue_style( 'wplc-style' );
 
 
 
 
 
 
596
  }
597
 
598
  if (isset($_GET['page']) && $_GET['page'] == 'wplivechat-menu-settings') {
599
  add_action('admin_print_scripts', 'wplc_admin_scripts_basic');
600
  }
601
  function wplc_admin_scripts_basic() {
 
602
  if ($_GET['page'] == "wplivechat-menu-settings") {
 
 
 
603
  wp_register_script('my-wplc-color', plugins_url('js/jscolor.js',__FILE__), false, '1.4.1', false);
604
  wp_enqueue_script('my-wplc-color');
 
 
 
605
  }
606
  }
607
 
@@ -619,6 +682,7 @@ function wplc_admin_history_layout() {
619
  }
620
  }
621
 
 
622
  function wplc_settings_page_basic() {
623
  echo"<div class=\"wrap\"><div id=\"icon-edit\" class=\"icon32 icon32-posts-post\"><br></div><h2>".__("WP Live Chat Support Settings","wplivechat")."</h2>";
624
 
@@ -632,7 +696,10 @@ function wplc_settings_page_basic() {
632
 
633
 
634
 
635
- echo "<form action='' name='wplc_settings' method='post' id='wplc_settings'>";
 
 
 
636
 
637
  if (function_exists("wplc_register_pro_version")) {
638
  $wplc_pro_chat_name = wplc_settings_page_pro('chat_name');
@@ -640,7 +707,9 @@ function wplc_settings_page_basic() {
640
  $wplc_pro_chat_logo = wplc_settings_page_pro('chat_logo');
641
  $wplc_pro_chat_delay = wplc_settings_page_pro('chat_delay');
642
  $wplc_pro_chat_fs = wplc_settings_page_pro('wplc_chat_window_text1');
 
643
  $wplc_pro_chat_emailme = wplc_settings_page_pro('chat_email_on_chat');
 
644
  } else {
645
  $wplc_pro_chat_name = "
646
  <tr>
@@ -710,94 +779,115 @@ function wplc_settings_page_basic() {
710
 
711
  </td>
712
  </tr>
 
 
713
  <tr>
714
  <td width='200' valign='top'>".__("Offline text","wplivechat").":</td>
715
  <td>
716
  <input type='text' size='50' maxlength='50' class='regular-text' readonly value='Chat offline. Leave a message' /><small><i> ".__("Edit these text fields using the ","wplivechat")." <a href=\"http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=textfields4\" title=\"".__("Pro Add-on","wplivechat")."\" target=\"_BLANK\">".__("Pro Add-on","wplivechat")."</a>. </i></small> <br />
717
 
718
 
 
 
 
 
 
 
 
 
719
  </td>
720
  </tr>
721
  ";
722
  }
723
 
724
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
725
 
726
- echo "
727
- <h3>".__("Main Settings",'wplivechat')."</h3>
728
- <table class='form-table' width='700'>
729
- <tr>
730
- <td width='200' valign='top'>".__("Chat enabled","wplivechat").":</td>
731
- <td>
732
- <select id='wplc_settings_enabled' name='wplc_settings_enabled'>
733
- <option value=\"1\" ".$wplc_settings_enabled[1].">".__("Yes","wplivechat")."</option>
734
- <option value=\"2\" ".$wplc_settings_enabled[2].">".__("No","wplivechat")."</option>
735
- </select>
736
- </td>
737
- </tr>
738
-
739
- </table>
740
-
741
-
742
- <h3>".__("Chat Window Settings",'wplivechat')."</h3>
743
- <table class='form-table' width='700'>
744
- $wplc_pro_chat_name
745
- $wplc_pro_chat_pic
746
- $wplc_pro_chat_logo
747
- $wplc_pro_chat_delay
748
- $wplc_pro_chat_emailme
749
- <tr>
750
- <td width='200' valign='top'>".__("Chat box alignment","wplivechat").":</td>
751
- <td>
752
- <select id='wplc_settings_align' name='wplc_settings_align'>
753
- <option value=\"1\" ".$wplc_settings_align[1].">".__("Bottom left","wplivechat")."</option>
754
- <option value=\"2\" ".$wplc_settings_align[2].">".__("Bottom right","wplivechat")."</option>
755
- </select>
756
- </td>
757
- </tr>
758
- <tr>
759
- <td width='200' valign='top'>".__("Chat box fill color","wplivechat").":</td>
760
- <td>
761
- <input id=\"wplc_settings_fill\" name=\"wplc_settings_fill\" type=\"text\" class=\"color\" value=\"".$wplc_settings_fill."\" />
762
- </td>
763
- </tr>
764
- <tr>
765
- <td width='200' valign='top'>".__("Chat box font color","wplivechat").":</td>
766
- <td>
767
- <input id=\"wplc_settings_font\" name=\"wplc_settings_font\" type=\"text\" class=\"color\" value=\"".$wplc_settings_font."\" />
768
- </td>
769
- </tr>
770
-
771
- $wplc_pro_chat_fs
772
-
773
- </table>
774
-
775
-
776
- <p class='submit'><input type='submit' name='wplc_save_settings' class='button-primary' value='".__("Save Settings","wplivechat")." &raquo;' /></p>
777
-
778
-
779
- </form>
780
- ";
781
-
782
  echo "</div>";
783
 
784
 
785
  }
786
- function wplc_head() {
787
  global $wpdb;
788
 
789
  if (isset($_POST['wplc_save_settings'])){
790
 
791
- $wplc_data['wplc_settings_align'] = attribute_escape($_POST['wplc_settings_align']);
792
- $wplc_data['wplc_settings_fill'] = attribute_escape($_POST['wplc_settings_fill']);
793
- $wplc_data['wplc_settings_font'] = attribute_escape($_POST['wplc_settings_font']);
794
- $wplc_data['wplc_settings_enabled'] = attribute_escape($_POST['wplc_settings_enabled']);
795
  update_option('WPLC_SETTINGS', $wplc_data);
796
 
797
- if (function_exists("wplc_register_pro_version")) {
798
- wplc_pro_save_settings();
799
- }
800
-
801
  echo "<div class='updated'>";
802
  _e("Your settings have been saved.","wplivechat");
803
  echo "</div>";
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.6
7
  Author: WP-LiveChat
8
  Author URI: http://www.wp-livechat.com
9
  */
17
  global $wplc_tblname_msgs;
18
  $wplc_tblname_chats = $wpdb->prefix . "wplc_chat_sessions";
19
  $wplc_tblname_msgs = $wpdb->prefix . "wplc_chat_msgs";
20
+ $wplc_version = "2.6";
21
 
22
  require_once ("functions.php");
23
 
24
  add_action('wp_ajax_wplc_admin_set_transient', 'wplc_action_callback');
25
 
26
  add_action('wp_footer', 'wplc_display_box');
27
+
28
+
29
+ if (function_exists('wplc_head_pro')) {
30
+ add_action('admin_head', 'wplc_head_pro');
31
+ } else {
32
+ add_action('admin_head', 'wplc_head_basic');
33
+ }
34
+
35
+
36
+ add_action('wp_enqueue_scripts', 'wplc_add_user_stylesheet' );
37
+ add_action('admin_enqueue_scripts', 'wplc_add_admin_stylesheet');
38
+
39
  add_action('admin_menu', 'wplc_admin_menu');
40
  add_action('admin_head', 'wplc_superadmin_javascript');
41
  register_activation_hook( __FILE__, 'wplc_activate' );
113
  }
114
 
115
  ?>
116
+ <div id="wp-live-chat" style="display:none; <?php echo $wplc_box_align; ?>;">
117
 
118
 
119
  <?php if (function_exists("wplc_register_pro_version")) {
121
  } else {
122
  ?>
123
 
124
+ <div id="wp-live-chat-minimize" style="display:none;"></div>
125
+ <div id="wp-live-chat-close" style="display:none; background-color: <?php echo $wplc_settings_fill; ?> !important; color: <?php echo $wplc_settings_font; ?> !important;">X</div>
126
  <div id="wp-live-chat-1" style="background-color: <?php echo $wplc_settings_fill; ?> !important; color: <?php echo $wplc_settings_font; ?> !important;">
127
  <strong>Questions?</strong> Chat with us
128
  </div>
404
  echo "</div>";
405
 
406
  echo "
407
+ <p style=\"display:block; width:290px; text-align:right; font-size:10px;\"><a href=\"javascript:void(0);\" class=\"wplc_admin_close_chat\" id=\"wplc_admin_close_chat\">".__("End chat","wplivechat")."</a></p>
408
  <div id='admin_chat_box'>
409
  <div id='admin_chat_box_area_".$result->id."' style='height:200px; width:290px; border:1px solid #ccc; overflow:auto;'>".wplc_return_chat_messages($cid)."</div>
410
  <p>
461
  jQuery("#wplc_admin_send_msg").click();
462
  }
463
  });
464
+ jQuery("#wplc_admin_close_chat").live("click", function() {
465
+ var wplc_cid = jQuery("#wplc_admin_cid").val();
466
+ var data = {
467
+ action: 'wplc_admin_close_chat',
468
+ security: '<?php echo $ajax_nonce; ?>',
469
+ cid: wplc_cid
470
+
471
+ };
472
+ jQuery.post(wplc_ajaxurl, data, function(response) {
473
+ //console.log("wplc_admin_close_chat");
474
+ //console.log(response);
475
+ window.close();
476
+ });
477
+
478
+ });
479
 
480
  jQuery("#wplc_admin_send_msg").live("click", function() {
481
  var wplc_cid = jQuery("#wplc_admin_cid").val();
542
  };
543
  jQuery.post(wplc_ajaxurl, data, function(response) {
544
  //console.log("wplc_update_admin_return_chat_status");
545
+ if (response == "0") { } else {
546
+ if (chat_status != response) {
547
+ previous_chat_status = chat_status;
548
+ console.log("previous chat status: "+previous_chat_status)
549
+ chat_status = response;
550
+ //console.log("chat status: "+chat_status)
551
+ if (chat_status == "2") {
552
+ //clearInterval(wplc_auto_check_status_of_chat);
553
+ //clearInterval(wplc_auto_refresh);
554
+ jQuery("#admin_chat_box_area_"+cid).append("<em><?php _e("User has minimized the chat window","wplivechat"); ?></em><br />");
555
+ var height = jQuery('#admin_chat_box_area_'+cid)[0].scrollHeight;
556
+ jQuery('#admin_chat_box_area_'+cid).scrollTop(height);
557
+
558
+ }
559
+ else if (previous_chat_status == "2" && chat_status == "3") {
560
+ jQuery("#admin_chat_box_area_"+cid).append("<em><?php _e("User has opened the chat window","wplivechat"); ?></em><br />");
561
+ var height = jQuery('#admin_chat_box_area_'+cid)[0].scrollHeight;
562
+ jQuery('#admin_chat_box_area_'+cid).scrollTop(height);
563
+ }
564
+ else if (chat_status == "1") {
565
+ //clearInterval(wplc_auto_check_status_of_chat);
566
+ //clearInterval(wplc_auto_refresh);
567
+ jQuery("#admin_chat_box_area_"+cid).append("<em><?php _e("User has closed and ended the chat","wplivechat"); ?></em><br />");
568
+ var height = jQuery('#admin_chat_box_area_'+cid)[0].scrollHeight;
569
+ jQuery('#admin_chat_box_area_'+cid).scrollTop(height);
570
+ clearInterval(wplc_auto_check_status_of_chat);
571
+ clearInterval(wplc_auto_refresh);
572
+ document.getElementById('wplc_admin_chatmsg').disabled = true;
573
+
574
+
575
+ }
576
+
577
  }
578
  }
579
 
643
  function wplc_add_user_stylesheet() {
644
  wp_register_style( 'wplc-style', plugins_url('/css/wplcstyle.css', __FILE__) );
645
  wp_enqueue_style( 'wplc-style' );
646
+
647
+ }
648
+ function wplc_add_admin_stylesheet() {
649
+ wp_register_style( 'wplc-admin-style', 'http://code.jquery.com/ui/1.8.24/themes/smoothness/jquery-ui.css' );
650
+ wp_enqueue_style( 'wplc-admin-style' );
651
+
652
  }
653
 
654
  if (isset($_GET['page']) && $_GET['page'] == 'wplivechat-menu-settings') {
655
  add_action('admin_print_scripts', 'wplc_admin_scripts_basic');
656
  }
657
  function wplc_admin_scripts_basic() {
658
+
659
  if ($_GET['page'] == "wplivechat-menu-settings") {
660
+ wp_enqueue_script( 'jquery' );
661
+ wp_enqueue_script('jquery-ui-core');
662
+
663
  wp_register_script('my-wplc-color', plugins_url('js/jscolor.js',__FILE__), false, '1.4.1', false);
664
  wp_enqueue_script('my-wplc-color');
665
+ wp_enqueue_script( 'jquery-ui-tabs');
666
+ wp_register_script('my-wplc-tabs', plugins_url('js/wplc_tabs.js',__FILE__), array('jquery-ui-core'), '', true);
667
+ wp_enqueue_script('my-wplc-tabs');
668
  }
669
  }
670
 
682
  }
683
  }
684
 
685
+
686
  function wplc_settings_page_basic() {
687
  echo"<div class=\"wrap\"><div id=\"icon-edit\" class=\"icon32 icon32-posts-post\"><br></div><h2>".__("WP Live Chat Support Settings","wplivechat")."</h2>";
688
 
696
 
697
 
698
 
699
+ echo "<form action='' name='wplc_settings' method='POST' id='wplc_settings'>";
700
+
701
+
702
+
703
 
704
  if (function_exists("wplc_register_pro_version")) {
705
  $wplc_pro_chat_name = wplc_settings_page_pro('chat_name');
707
  $wplc_pro_chat_logo = wplc_settings_page_pro('chat_logo');
708
  $wplc_pro_chat_delay = wplc_settings_page_pro('chat_delay');
709
  $wplc_pro_chat_fs = wplc_settings_page_pro('wplc_chat_window_text1');
710
+ $wplc_pro_chat_fs2 = wplc_settings_page_pro('wplc_chat_window_text2');
711
  $wplc_pro_chat_emailme = wplc_settings_page_pro('chat_email_on_chat');
712
+ $wplc_pro_email_address = wplc_settings_page_pro('chat_email_address');
713
  } else {
714
  $wplc_pro_chat_name = "
715
  <tr>
779
 
780
  </td>
781
  </tr>
782
+ ";
783
+ $wplc_pro_chat_fs2 = "
784
  <tr>
785
  <td width='200' valign='top'>".__("Offline text","wplivechat").":</td>
786
  <td>
787
  <input type='text' size='50' maxlength='50' class='regular-text' readonly value='Chat offline. Leave a message' /><small><i> ".__("Edit these text fields using the ","wplivechat")." <a href=\"http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=textfields4\" title=\"".__("Pro Add-on","wplivechat")."\" target=\"_BLANK\">".__("Pro Add-on","wplivechat")."</a>. </i></small> <br />
788
 
789
 
790
+ </td>
791
+ </tr>
792
+ ";
793
+ $wplc_pro_email_address = "
794
+ <tr>
795
+ <td width='200' valign='top'>".__("Email Address","wplivechat").":</td>
796
+ <td>
797
+ <input type='text' size='50' maxlength='150' class='regular-text' readonly value='' /><small><i> ".__("Get offline messages with the ","wplivechat")." <a href=\"http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=offlinemessages\" title=\"".__("Pro Add-on","wplivechat")."\" target=\"_BLANK\">".__("Pro Add-on","wplivechat")."</a>. </i></small> <br />
798
  </td>
799
  </tr>
800
  ";
801
  }
802
 
803
 
804
+ echo "<div id=\"wplc_tabs\">";
805
+ echo " <ul>";
806
+ echo " <li><a href=\"#tabs-1\">".__("General Settings","wplivechat")."</a></li>";
807
+ echo " <li><a href=\"#tabs-2\">".__("Chat Box","wplivechat")."</a></li>";
808
+ echo " <li><a href=\"#tabs-3\">".__("Offline Messages","wplivechat")."</a></li>";
809
+ echo " <li><a href=\"#tabs-4\">".__("Styling","wplivechat")."</a></li>";
810
+ echo " </ul>";
811
+ echo " <div id=\"tabs-1\">";
812
+ echo " <h3>".__("Main Settings",'wplivechat')."</h3>";
813
+ echo " <table class='form-table' width='700'>";
814
+ echo " <tr>";
815
+ echo " <td width='200' valign='top'>".__("Chat enabled","wplivechat").":</td>";
816
+ echo " <td>";
817
+ echo " <select id='wplc_settings_enabled' name='wplc_settings_enabled'>";
818
+ echo " <option value=\"1\" ".$wplc_settings_enabled[1].">".__("Yes","wplivechat")."</option>";
819
+ echo " <option value=\"2\" ".$wplc_settings_enabled[2].">".__("No","wplivechat")."</option>";
820
+ echo " </select>";
821
+ echo " </td>";
822
+ echo " </tr>";
823
+ echo " </table>";
824
+
825
+ echo " </div>";
826
+ echo " <div id=\"tabs-2\">";
827
+ echo " <h3>".__("Chat Window Settings",'wplivechat')."</h3>";
828
+ echo " <table class='form-table' width='700'>";
829
+ echo " <tr>";
830
+ echo " <td width='200' valign='top'>".__("Chat box alignment","wplivechat").":</td>";
831
+ echo " <td>";
832
+ echo " <select id='wplc_settings_align' name='wplc_settings_align'>";
833
+ echo " <option value=\"1\" ".$wplc_settings_align[1].">".__("Bottom left","wplivechat")."</option>";
834
+ echo " <option value=\"2\" ".$wplc_settings_align[2].">".__("Bottom right","wplivechat")."</option>";
835
+ echo " </select>";
836
+ echo " </td>";
837
+ echo " </tr>";
838
+ echo " $wplc_pro_chat_name";
839
+ echo " $wplc_pro_chat_pic";
840
+ echo " $wplc_pro_chat_logo";
841
+ echo " $wplc_pro_chat_delay";
842
+ echo " $wplc_pro_chat_emailme";
843
+ echo " </table>";
844
+
845
+ echo " </div>";
846
+ echo " <div id=\"tabs-3\">";
847
+ echo " <h3>".__("Offline Messages",'wplivechat')."</h3>";
848
+ echo " <table class='form-table' width='700'>";
849
+ echo " $wplc_pro_email_address";
850
+ echo " $wplc_pro_chat_fs2";
851
+ echo " </table>";
852
+ echo " </div>";
853
+
854
+ echo " <div id=\"tabs-4\">";
855
+ echo " <h3>".__("Styling",'wplivechat')."</h3>";
856
+ echo " <table class='form-table' width='700'>";
857
+ echo " <tr>";
858
+ echo " <td width='200' valign='top'>".__("Chat box fill color","wplivechat").":</td>";
859
+ echo " <td>";
860
+ echo " <input id=\"wplc_settings_fill\" name=\"wplc_settings_fill\" type=\"text\" class=\"color\" value=\"".$wplc_settings_fill."\" />";
861
+ echo " </td>";
862
+ echo " </tr>";
863
+ echo " <tr>";
864
+ echo " <td width='200' valign='top'>".__("Chat box font color","wplivechat").":</td>";
865
+ echo " <td>";
866
+ echo " <input id=\"wplc_settings_font\" name=\"wplc_settings_font\" type=\"text\" class=\"color\" value=\"".$wplc_settings_font."\" />";
867
+ echo " </td>";
868
+ echo " </tr>";
869
+ echo " $wplc_pro_chat_fs";
870
+ echo " </table>";
871
+ echo " </div>";
872
+ echo "</div>";
873
+ echo "<p class='submit'><input type='submit' name='wplc_save_settings' class='button-primary' value='".__("Save Settings","wplivechat")."' /></p>";
874
+ echo "</form>";
875
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
876
  echo "</div>";
877
 
878
 
879
  }
880
+ function wplc_head_basic() {
881
  global $wpdb;
882
 
883
  if (isset($_POST['wplc_save_settings'])){
884
 
885
+ $wplc_data['wplc_settings_align'] = esc_attr($_POST['wplc_settings_align']);
886
+ $wplc_data['wplc_settings_fill'] = esc_attr($_POST['wplc_settings_fill']);
887
+ $wplc_data['wplc_settings_font'] = esc_attr($_POST['wplc_settings_font']);
888
+ $wplc_data['wplc_settings_enabled'] = esc_attr($_POST['wplc_settings_enabled']);
889
  update_option('WPLC_SETTINGS', $wplc_data);
890
 
 
 
 
 
891
  echo "<div class='updated'>";
892
  _e("Your settings have been saved.","wplivechat");
893
  echo "</div>";