WP Live Chat Support - Version 6.2.01

Version Description

  • 2016-07-06 - High priority =
  • Surveys/Polls added - you can now add a survey/poll to your chat box either before or after a chat session
Download this release

Release Info

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

Code changes from version 6.2.00 to 6.2.01

ajax_new.php CHANGED
@@ -73,6 +73,7 @@ function wplc_init_ajax_callback() {
73
  session_write_close();
74
 
75
  if ($_POST['action'] == "wplc_get_chat_box") {
 
76
  echo wplc_output_box_5100();
77
  }
78
 
73
  session_write_close();
74
 
75
  if ($_POST['action'] == "wplc_get_chat_box") {
76
+
77
  echo wplc_output_box_5100();
78
  }
79
 
css/wplc-survey-style-before.css ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #wplc_hovercard { height: auto !important; }
2
+ #wplc_hovercard_content { height: auto !important; padding: 5px !important;}
3
+ .wplc_hovercard_content_left { display:none !important; }
4
+ .wplc_hovercard_content_right { display:none !important; }
5
+
6
+ #speeching_button {
7
+ padding: 5px;
8
+ font-size: 12px;
9
+ text-transform: none;
10
+ float:none !important;
11
+
12
+ margin-left: auto;
13
+ margin-right: auto;
14
+ margin-top: -3px;
15
+ display: block;
16
+ padding-right: 10px;
17
+ padding-left: 10px;
18
+ }
css/wplc-survey-style.css ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+
4
+ #nimblesquirrel_div { width: auto !important; }
5
+ html #nimblesquirrel_main { border-bottom: initial;}
6
+
7
+ #nimblesquirrel_main {
8
+ background: inherit !important;
9
+ border: 0 !important;
10
+ }
11
+
12
+
13
+
14
+ .nimblesquirrel_radio { width: auto !important; }
15
+
16
+
17
+
18
+ .nps_score { width: 18px !important; }
19
+
20
+ .nps_score_box {
21
+ width: 230px !important;
22
+ display: block;
23
+ margin-left: auto ;
24
+ margin-right: auto;
25
+ overflow: auto;
26
+ }
images/loader2.gif ADDED
Binary file
includes/settings_page.php CHANGED
@@ -803,6 +803,8 @@ if (isset($wplc_settings['wplc_hide_when_offline']) && $wplc_settings['wplc_hide
803
  <p class="description"><?php _e('Blocking a user\'s IP Address here will hide the chat window from them, preventing them from chatting with you. Each IP Address must be on a new line', 'wplivechat'); ?></p>
804
  </div>
805
 
 
 
806
  <?php do_action("wplc_hook_settings_page_more_tabs"); ?>
807
 
808
  </div>
803
  <p class="description"><?php _e('Blocking a user\'s IP Address here will hide the chat window from them, preventing them from chatting with you. Each IP Address must be on a new line', 'wplivechat'); ?></p>
804
  </div>
805
 
806
+
807
+
808
  <?php do_action("wplc_hook_settings_page_more_tabs"); ?>
809
 
810
  </div>
includes/surveys.php ADDED
@@ -0,0 +1,344 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ add_filter("wplc_filter_setting_tabs","wplc_survey_filter_control_setting_tabs");
4
+ function wplc_survey_filter_control_setting_tabs($tab_array) {
5
+ $tab_array['survey'] = array(
6
+ "href" => "#tabs-survey",
7
+ "icon" => 'fa fa-comment',
8
+ "label" => __("Surveys","wplivechat")
9
+ );
10
+ return $tab_array;
11
+ }
12
+
13
+
14
+
15
+ add_action("wplc_hook_settings_page_more_tabs","wplc_survey_hook_control_settings_page_more_tabs");
16
+ function wplc_survey_hook_control_settings_page_more_tabs() {
17
+ $wplc_survey_data = get_option("WPLC_SURVEY_SETTINGS");
18
+ $wplc_settings = get_option('WPLC_SETTINGS');
19
+ ?>
20
+ <div id="tabs-survey">
21
+ <h3><?php _e("Surveys", "wplivechat") ?></h3>
22
+ <table class='form-table' width='700'>
23
+ <tr>
24
+ <td width='400' valign='top'><?php _e("Enable Surveys", "wplivechat") ?>: <i class="fa fa-question-circle wplc_light_grey wplc_settings_tooltip" title="<?php _e('Enable surveys within your live chat box, either before or after a live chat session.', 'wplivechat'); ?>"></i></td>
25
+ <td>
26
+ <input type="checkbox" name="wplc_enable_surveys" id="wplc_enable_surveys" value="1" <?php if(isset($wplc_survey_data['wplc_enable_surveys']) && $wplc_survey_data['wplc_enable_surveys'] == 1){ echo 'checked'; } ?>/>
27
+ </td>
28
+ </tr>
29
+ <tr>
30
+ <td>Select a survey:</td>
31
+ <td><?php
32
+ $surveys = wplc_return_nimble_surveys();
33
+ $link1 = sprintf( __( 'No surveys created. Please <a href="%s" target="_BLANK" title="NimbleSquirrel">create a survey and then refresh this page.</a>', 'wplivechat' ),
34
+ 'http://app.nimblesquirrel.com/?utm_source=wplc&utm_medium=click&utm_campaign=no_surveys'
35
+ );
36
+ if( $surveys ){
37
+ $surveys = json_decode( $surveys );
38
+ if( $surveys ){
39
+ echo "<select name='nimble_survey'>";
40
+ echo "<option value='0'>".__('Select a survey', 'nimble-squirrel')."</option>";
41
+ $cnt = 0;
42
+ foreach( $surveys as $survey ){
43
+ $nimble_user_id = $survey->uid;
44
+ if (isset($survey->name)) {
45
+ $cnt++;
46
+ if( isset( $wplc_survey_data['survey'] ) && $wplc_survey_data['survey'] == $survey->id ){ $sel = 'selected'; } else { $sel = ''; }
47
+ echo "<option value='".$survey->id."' $sel>".$survey->name."</option>";
48
+ }
49
+ }
50
+ echo "</select>";
51
+ if ($cnt == 0) { echo "<p>".$link1."</p>"; }
52
+ } else {
53
+ echo "<p>".$link1."</p>";
54
+ }
55
+ } else {
56
+ echo "<p>".$link1."</p>";
57
+ }
58
+
59
+ if (isset($nimble_user_id)) {
60
+ echo "<input name='survey_user' type='hidden' value='".$nimble_user_id."' />";
61
+ }
62
+
63
+ ?></td>
64
+ </tr>
65
+ <tr>
66
+ <td><?php _e("Display survey","wplivechat"); ?></td>
67
+ <td>
68
+ <select name='survey_display'>
69
+ <option value='1' <?php if (isset($wplc_survey_data['survey_display']) && $wplc_survey_data['survey_display'] == "1") { echo 'selected'; }?>><?php _e("Before chat","wplivechat"); ?></option>
70
+ <option value='2' <?php if (isset($wplc_survey_data['survey_display']) && $wplc_survey_data['survey_display'] == "2") { echo 'selected'; }?>><?php _e("After chat","wplivechat"); ?></option>
71
+ </select>
72
+ </td>
73
+ </tr>
74
+ <tr>
75
+ <td><?php _e("Chat button text","wplivechat"); ?></td>
76
+ <td>
77
+ <input type='text' name='wplc_pro_sst1_survey' value='<?php echo $wplc_settings['wplc_pro_sst1_survey']; ?>' />
78
+ </td>
79
+ </tr>
80
+ <tr>
81
+ <td><?php _e("Change title of chat box when chat ended to","wplivechat"); ?></td>
82
+ <td>
83
+ <input type='text' name='wplc_pro_sst1e_survey' value='<?php echo $wplc_settings['wplc_pro_sst1e_survey']; ?>' />
84
+ </td>
85
+ </tr>
86
+ </table>
87
+ </div>
88
+ <?php
89
+ }
90
+
91
+ add_action('wplc_hook_admin_settings_save','wplc_survey_save_settings');
92
+ function wplc_survey_save_settings() {
93
+ if (isset($_POST['wplc_save_settings'])) {
94
+ if (isset($_POST['wplc_enable_surveys'])) {
95
+ $wplc_survey_data['wplc_enable_surveys'] = esc_attr($_POST['wplc_enable_surveys']);
96
+ } else {
97
+ $wplc_survey_data['wplc_enable_surveys'] = 0;
98
+ }
99
+ if (isset($_POST['nimble_survey']) && $_POST['nimble_survey'] !== '0') {
100
+ $wplc_survey_data['survey'] = esc_attr($_POST['nimble_survey']);
101
+ } else {
102
+ $wplc_survey_data['survey'] = null;
103
+ }
104
+ if (isset($_POST['survey_user']) && $_POST['survey_user'] !== '0') {
105
+ $wplc_survey_data['survey_user'] = esc_attr($_POST['survey_user']);
106
+ } else {
107
+ $wplc_survey_data['survey_user'] = null;
108
+ }
109
+ if (isset($_POST['survey_display']) && $_POST['survey_display'] !== '0') {
110
+ $wplc_survey_data['survey_display'] = esc_attr($_POST['survey_display']);
111
+ } else {
112
+ $wplc_survey_data['survey_display'] = "1";
113
+ }
114
+
115
+ update_option('WPLC_SURVEY_SETTINGS', $wplc_survey_data);
116
+
117
+ }
118
+ }
119
+
120
+ function wplc_return_nimble_surveys() {
121
+ $nimble_api = 'http://nimblesquirrel.com/api/wordpress.php';
122
+
123
+ $response = wp_remote_post( $nimble_api,
124
+ array(
125
+ 'method' => 'POST',
126
+ 'body' => array(
127
+ 'wordpress_plugin' => 1,
128
+ 'action' => 'return_surveys',
129
+ 'siteurl' => get_option('siteurl')
130
+ )
131
+ )
132
+ );
133
+
134
+ if ( is_wp_error( $response ) ) {
135
+
136
+ $error_message = $response->get_error_message();
137
+ echo $error_message;
138
+ } else {
139
+ return $response['body'];
140
+ }
141
+ }
142
+
143
+ add_filter("wplc_filter_live_chat_box_pre_layer1","wplc_filter_control_live_chat_box_pre_layer1",10,1);
144
+ function wplc_filter_control_live_chat_box_pre_layer1($content) {
145
+ $settings = get_option('WPLC_SURVEY_SETTINGS');
146
+ if( isset( $settings['wplc_enable_surveys'] ) && intval($settings['wplc_enable_surveys']) == 1 && !isset($_COOKIE['ns_participated'])){
147
+
148
+ if( isset( $settings['survey_display']) && $settings['survey_display'] == '1' ) {
149
+ $content .= "<img src='".plugins_url('/images/loader2.gif', __DIR__)."' style='display:block; margin-left:auto; margin-right:auto;' / >";
150
+ return $content;
151
+ }
152
+ }
153
+ }
154
+
155
+
156
+ function wplc_is_survey_enabled() {
157
+ $wplc_survey_data = get_option("WPLC_SURVEY_SETTINGS");
158
+ $cnt = 0;
159
+ if (isset($wplc_survey_data['wplc_enable_surveys']) && $wplc_survey_data['wplc_enable_surveys'] == "1") { $cnt++; }
160
+ if (isset($wplc_survey_data['survey']) && $wplc_survey_data['survey'] !== null) { $cnt++; }
161
+
162
+ if ($cnt >= 2) { return true; }
163
+ else { return false; }
164
+
165
+ }
166
+
167
+ add_action('wp_enqueue_scripts', 'wplc_nimble_load_scripts' , 99 );
168
+ function wplc_nimble_load_scripts() {
169
+ $settings = get_option('WPLC_SURVEY_SETTINGS');
170
+ $wplc_settings = get_option('WPLC_SETTINGS');
171
+
172
+ if( isset( $settings['wplc_enable_surveys'] ) && intval($settings['wplc_enable_surveys']) == 1 && !isset($_COOKIE['ns_participated'])){
173
+
174
+ if( isset( $settings['survey_user'] ) ){ $ns_id = $settings['survey_user']; } else { $ns_id = ''; }
175
+ if( isset( $settings['survey'] ) ){ $ns_sid = $settings['survey']; } else { $ns_sid = ''; }
176
+
177
+ wp_enqueue_script( 'nimble-squirrel-user-script', '//nimblesquirrel.com/api/nimblesquirrel.js', array(), '1.0.0', true );
178
+ wp_localize_script( 'nimble-squirrel-user-script', 'ns_id', $ns_id );
179
+
180
+
181
+ if (isset($wplc_settings['wplc_newtheme'])) { $wplc_newtheme = $wplc_settings['wplc_newtheme']; } else { $wplc_newtheme == 'theme-1'; }
182
+ if (isset($wplc_newtheme)) {
183
+ if($wplc_newtheme == 'theme-1') {
184
+ if( isset( $settings['survey_display']) && $settings['survey_display'] == '1' ) {
185
+ $div = "wp-live-chat-2";
186
+ $clear_div = '0';
187
+ $hide_div = 'wp-live-chat-2-inner';
188
+ wp_localize_script( 'nimble-squirrel-user-script', 'ns_hide_div', $hide_div );
189
+ } else if (isset( $settings['survey_display']) && $settings['survey_display'] == '2' ) {
190
+ $div = "wplc-extra-div";
191
+ $clear_div = '1';
192
+ wp_localize_script( 'nimble-squirrel-user-script', 'wplc_extra_div_enabled', "1" );
193
+ } else {
194
+ $div = "wp-live-chat-2";
195
+ $clear_div = '0';
196
+ $hide_div = 'wp-live-chat-2-inner';
197
+ wp_localize_script( 'nimble-squirrel-user-script', 'ns_hide_div', $hide_div );
198
+
199
+ }
200
+ }
201
+ else if($wplc_newtheme == 'theme-2') {
202
+ if( isset( $settings['survey_display']) && $settings['survey_display'] == '1' ) {
203
+ $div = 'wplc_hovercard_content';
204
+ $clear_div = '1';
205
+ } else if (isset( $settings['survey_display']) && $settings['survey_display'] == '2' ) {
206
+ $div = "wplc-extra-div";
207
+ $clear_div = '1';
208
+ wp_localize_script( 'nimble-squirrel-user-script', 'wplc_extra_div_enabled', "1" );
209
+ } else {
210
+ $div = 'wplc_hovercard_content';
211
+ $clear_div = '1';
212
+
213
+ }
214
+
215
+ }
216
+ }
217
+
218
+ wp_localize_script( 'nimble-squirrel-user-script', 'ns_div', $div );
219
+
220
+
221
+ wp_localize_script( 'nimble-squirrel-user-script', 'ns_hide_min', '1' );
222
+ wp_localize_script( 'nimble-squirrel-user-script', 'ns_sid', $ns_sid );
223
+ wp_localize_script( 'nimble-squirrel-user-script', 'ns_clear_div', $clear_div );
224
+
225
+
226
+ wp_register_style('wplc-survey-style', plugins_url('/css/wplc-survey-style.css', __DIR__));
227
+ wp_enqueue_style('wplc-survey-style');
228
+ if( isset( $settings['survey_display']) && $settings['survey_display'] == '1' ) {
229
+ wp_register_style('wplc-survey-before-style', plugins_url('/css/wplc-survey-style-before.css', __DIR__));
230
+ wp_enqueue_style('wplc-survey-before-style');
231
+ }
232
+ }
233
+ }
234
+
235
+
236
+
237
+ add_filter("wplc_filter_live_chat_box_hover_html_start_chat_button","wplc_filter_survey_control_live_chat_box_html_hovercard_chat_button",1,3);
238
+ function wplc_filter_survey_control_live_chat_box_html_hovercard_chat_button($wplc_settings,$logged_in,$wplc_using_locale ) {
239
+
240
+ $settings = get_option('WPLC_SURVEY_SETTINGS');
241
+
242
+ if( isset( $settings['wplc_enable_surveys'] ) && intval($settings['wplc_enable_surveys']) == 1 && !isset($_COOKIE['ns_participated'])){
243
+ if( isset( $settings['survey_display']) && $settings['survey_display'] == '1' ) {
244
+ remove_filter("wplc_filter_live_chat_box_hover_html_start_chat_button","wplc_filter_control_live_chat_box_html_hovercard_chat_button");
245
+ if ($logged_in) {
246
+ $wplc_sst_1 = __('Or chat to an agent now', 'wplivechat');
247
+ if (!isset($wplc_settings['wplc_pro_sst1_survey']) || $wplc_settings['wplc_pro_sst1_survey'] == "") { $wplc_settings['wplc_pro_sst1_survey'] = $wplc_sst_1; }
248
+ $text = ($wplc_using_locale ? $wplc_sst_1 : stripslashes($wplc_settings['wplc_pro_sst1_survey']));
249
+ return "<button id=\"speeching_button\" type=\"button\" class='wplc-color-bg-1 wplc-color-2'>$text</button>";
250
+ } else {
251
+ $wplc_sst_1 = __('Leave a message', 'wplivechat');
252
+ return "<button id=\"speeching_button\" type=\"button\" class='wplc-color-bg-1 wplc-color-2'>$wplc_sst_1</button>";
253
+
254
+ }
255
+ }
256
+ }
257
+ }
258
+
259
+
260
+ add_action("wplc_hook_push_js_to_front","wplc_hook_survey_push_js_to_front",10,1);
261
+ function wplc_hook_survey_push_js_to_front() {
262
+ $settings = get_option('WPLC_SURVEY_SETTINGS');
263
+
264
+ if( isset( $settings['wplc_enable_surveys'] ) && intval($settings['wplc_enable_surveys']) == 1 ){
265
+
266
+ global $wplc_version;
267
+ $wplc_settings = get_option('WPLC_SETTINGS');
268
+ wp_register_script('wplc-survey-script', plugins_url('/js/wplc_surveys.js', __DIR__),array('jquery'),$wplc_version);
269
+ wp_enqueue_script('wplc-survey-script');
270
+ wp_localize_script( 'wplc-survey-script', 'wplc_end_chat_string', $wplc_settings['wplc_pro_sst1e_survey'] );
271
+ wp_localize_script( 'wplc-survey-script', 'wplc_button_string', $wplc_settings['wplc_pro_sst1_survey'] );
272
+ }
273
+
274
+
275
+ }
276
+
277
+
278
+
279
+ function wplc_admin_survey_layout() {
280
+ wplc_stats("surveys");
281
+ update_option("wplc_seen_surveys",true);
282
+ $settings = get_option('WPLC_SURVEY_SETTINGS');
283
+
284
+ echo"<div class=\"wrap\">";
285
+ echo "<h1>" . __("WP Live Chat Surveys with Nimble Squirrel", "wplivechat") . "</h1>";
286
+ echo "<div style='width:100%; display:block; overflow:auto; background-color:#FFF; padding:10px; border-radius:10px;'>";
287
+
288
+
289
+ if( isset( $settings['wplc_enable_surveys'] ) && intval($settings['wplc_enable_surveys']) == 1 ){
290
+ echo "<h2>".__("Surveys","wplivechat")."</h2>";
291
+ echo "<p>".__("To view your responses, click the button below and log in to your NimbleSquirrel account.","wplivechat")."</p>";
292
+ echo "<a href='http://app.nimblesquirrel.com/?utm_source=wplc&utm_medium=click&utm_campaign=view_responses' target='_BLANK' class='button button-primary'>View your responses</a>";
293
+ echo "<p>&nbsp;</p>";
294
+ echo "<p>".__("Need help? <a href='https://wp-livechat.com/contact-us/' target='_BLANK'>Contact us</a> and we'll get back to you as soon as possible!","wplivechat")."</p>";
295
+ echo "";
296
+ echo "";
297
+ echo "";
298
+ echo "";
299
+ echo "";
300
+
301
+ }
302
+ else {
303
+
304
+ $link1 = sprintf( __( 'Register on <a href="%s" target="_BLANK" title="NimbleSquirrel">NimbleSquirrel</a> (It\'s free.)', 'wplivechat' ),
305
+ 'http://app.nimblesquirrel.com/join.php?email='.get_option("admin_email")."&site=".get_option('siteurl').'&utm_source=wplc&utm_medium=click&utm_campaign=plugin_register'
306
+ );
307
+ $link2 = sprintf( __( '<a href="%s" target="_BLANK" title="Create a survey">Create a survey</a>.', 'wplivechat' ),
308
+ 'http://app.nimblesquirrel.com/my_account.php?a=add_survey_wizard&utm_source=wplc&utm_medium=click&utm_campaign=add_survey'
309
+ );
310
+
311
+
312
+ echo " <div style='display:block; width:50%; float:left; overflow:auto;'>";
313
+ echo " <div style='display:block; padding:10px;'>";
314
+ echo " <h2>".__("Add a Survey to your live chat box","wplivechat")."</h2>";
315
+ echo " <p>".__("Three simple steps:","wplivechat")."</p>";
316
+ echo " <ol>";
317
+ echo " <li>".$link1."</li>";
318
+ echo " <li>".$link2."</li>";
319
+ echo " <li>".__("Enable surveys in your live chat <a href='admin.php?page=wplivechat-menu-settings'>settings page</a>.","wplivechat")."</li>";
320
+ echo " </ol>";
321
+ echo "";
322
+ echo "";
323
+ echo " </div>";
324
+ echo " </div>";
325
+ echo " <div style='display:block; width:50%; float:left; overflow:auto;'>";
326
+ echo " <div style='display:block; padding:10px;'>";
327
+ echo "";
328
+ echo "";
329
+ echo "";
330
+ echo "";
331
+ echo " <img src='http://nimblesquirrel.com/app/img/Survey_Box_Standard.jpg' style='max-width:100%;' />";
332
+ echo "";
333
+ echo "";
334
+ echo "";
335
+ echo "";
336
+ echo "";
337
+ echo " </div>";
338
+ echo " </div>";
339
+
340
+ }
341
+ echo "</div>";
342
+ echo "</div>";
343
+
344
+ }
js/themes/classic.js CHANGED
@@ -96,4 +96,8 @@ jQuery(document).ready(function() {
96
  jQuery("body").on("click", "#wp-live-chat-1", function() {
97
  jQuery.event.trigger({type: "wplc_open_chat"});
98
  });
 
 
 
 
99
  });
96
  jQuery("body").on("click", "#wp-live-chat-1", function() {
97
  jQuery.event.trigger({type: "wplc_open_chat"});
98
  });
99
+
100
+ jQuery("body").on("click", "#speeching_button", function() {
101
+
102
+ });
103
  });
js/wplc_surveys.js ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var orig_title_wplc;
2
+ jQuery(document).on("wplc_end_chat", function( e ) {
3
+ if (typeof wplc_extra_div_enabled !== "undefined" && wplc_extra_div_enabled === "1") {
4
+ jQuery("#wp-live-chat-4").hide();
5
+ jQuery("#wplc-extra-div").show();
6
+ orig_title_wplc = jQuery("#wplc_first_message").html();
7
+ jQuery("#wplc_first_message").html(wplc_end_chat_string);
8
+ }
9
+ });
10
+
11
+
12
+ jQuery(document).on("wplc_minimize_chat", function( e ) {
13
+ if (typeof wplc_extra_div_enabled !== "undefined" && wplc_extra_div_enabled === "1") {
14
+ jQuery("#wplc-extra-div").hide();
15
+ jQuery("#wplc_first_message").html(orig_title_wplc);
16
+ }
17
+
18
+
19
+ });
js/wplc_u.js CHANGED
@@ -186,6 +186,7 @@ jQuery(document).ready(function() {
186
  jQuery("#wplc_chatbox").append("<em>"+response['data']+"</em><br />");
187
  var height = jQuery('#wplc_chatbox')[0].scrollHeight;
188
  jQuery('#wplc_chatbox').scrollTop(height);
 
189
 
190
  }
191
  else if(parseInt(response['status']) == 11){ /* use moved on to another page (perhaps in another tab so close this instance */
186
  jQuery("#wplc_chatbox").append("<em>"+response['data']+"</em><br />");
187
  var height = jQuery('#wplc_chatbox')[0].scrollHeight;
188
  jQuery('#wplc_chatbox').scrollTop(height);
189
+ jQuery.event.trigger({type: "wplc_end_chat"});
190
 
191
  }
192
  else if(parseInt(response['status']) == 11){ /* use moved on to another page (perhaps in another tab so close this instance */
readme.txt CHANGED
@@ -31,6 +31,7 @@ The most cost effective Live Chat plugin. Chat with your visitors for free! WP L
31
  * Access historical live chat records
32
  * Compatible with translation plugins
33
  * No advertising or links
 
34
  * Quick Responses (insert a predefined response to your live chat box)
35
  * Anonymity for your visitors
36
  * No "Powered by" links on the live chat window
@@ -205,6 +206,17 @@ It is highly recommended that you upgrade to WP Live Chat Support version 4.1.4
205
 
206
  == Changelog ==
207
 
 
 
 
 
 
 
 
 
 
 
 
208
  = 6.1.02 - 2016-04-13 - Low Priority =
209
  * Tested on WordPress 4.5
210
  * Fixed a bug that sent offline messages to the wrong email address
31
  * Access historical live chat records
32
  * Compatible with translation plugins
33
  * No advertising or links
34
+ * Add surveys or polls to your chat box, before or after a chat session
35
  * Quick Responses (insert a predefined response to your live chat box)
36
  * Anonymity for your visitors
37
  * No "Powered by" links on the live chat window
206
 
207
  == Changelog ==
208
 
209
+ = 6.2.01 - 2016-07-06 - High priority =
210
+ * Surveys/Polls added - you can now add a survey/poll to your chat box either before or after a chat session
211
+
212
+ = 6.2.00 - 2016-06-10 - High priority =
213
+ * Cloud server bug fix
214
+ * Offline messages bug fix
215
+ * Internet explorer and Edge browser bug fix which caused the chat to not display
216
+ * Fixed the bug that stopped email addresses such as "name@domain.tld" from validating
217
+ * Advanced options to control the long poll variables
218
+ * Support added for many new pro features
219
+
220
  = 6.1.02 - 2016-04-13 - Low Priority =
221
  * Tested on WordPress 4.5
222
  * Fixed a bug that sent offline messages to the wrong email address
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: 6.2.00
7
  Author: WP-LiveChat
8
  Author URI: http://www.wp-livechat.com
9
  Text Domain: wplivechat
@@ -11,6 +11,9 @@
11
  */
12
 
13
  /*
 
 
 
14
  * 6.2.00 - 2016-06-10 - High priority
15
  * Cloud server bug fix
16
  * Offline messages bug fix
@@ -378,7 +381,7 @@ global $wplc_tblname_offline_msgs;
378
  $wplc_tblname_offline_msgs = $wpdb->prefix . "wplc_offline_messages";
379
  $wplc_tblname_chats = $wpdb->prefix . "wplc_chat_sessions";
380
  $wplc_tblname_msgs = $wpdb->prefix . "wplc_chat_msgs";
381
- $wplc_version = "6.2.00";
382
 
383
  define('WPLC_BASIC_PLUGIN_DIR', dirname(__FILE__));
384
  define('WPLC_BASIC_PLUGIN_URL', plugins_url() . "/wp-live-chat-support/");
@@ -395,6 +398,7 @@ if (function_exists("wplc_pro_version_control") && $checker < 6000) { } else {
395
 
396
  require_once (plugin_dir_path(__FILE__) . "functions.php");
397
  require_once (plugin_dir_path(__FILE__) . "includes/deprecated.php");
 
398
 
399
  add_action('wp_ajax_wplc_admin_set_transient', 'wplc_action_callback');
400
  add_action('wp_ajax_wplc_admin_remove_transient', 'wplc_action_callback');
@@ -504,6 +508,8 @@ function wplc_version_control() {
504
  if (!isset($wplc_settings['wplc_pro_fst2']) || (isset($wplc_settings['wplc_pro_fst2']) && $wplc_settings['wplc_pro_fst2'] == "")) { $wplc_settings["wplc_pro_fst2"] = __("Chat with us", "wplivechat"); }
505
  if (!isset($wplc_settings['wplc_pro_fst3']) || (isset($wplc_settings['wplc_pro_fst3']) && $wplc_settings['wplc_pro_fst3'] == "")) { $wplc_settings["wplc_pro_fst3"] = __("Start live chat", "wplivechat"); }
506
  if (!isset($wplc_settings['wplc_pro_sst1']) || (isset($wplc_settings['wplc_pro_sst1']) && $wplc_settings['wplc_pro_sst1'] == "")) { $wplc_settings["wplc_pro_sst1"] = __("Start Chat", "wplivechat"); }
 
 
507
  if (!isset($wplc_settings['wplc_pro_sst2']) || (isset($wplc_settings['wplc_pro_sst2']) && $wplc_settings['wplc_pro_sst2'] == "")) { $wplc_settings["wplc_pro_sst2"] = __("Connecting. Please be patient...", "wplivechat"); }
508
  if (!isset($wplc_settings['wplc_pro_tst1']) || (isset($wplc_settings['wplc_pro_tst1']) && $wplc_settings['wplc_pro_tst1'] == "")) { $wplc_settings["wplc_pro_tst1"] = __("Reactivating your previous chat...", "wplivechat"); }
509
  if (!isset($wplc_settings['wplc_user_welcome_chat']) || (isset($wplc_settings['wplc_user_welcome_chat']) && $wplc_settings['wplc_user_welcome_chat'] == "")) { $wplc_settings["wplc_user_welcome_chat"] = __("Welcome. How may I help you?", "wplivechat"); }
@@ -643,7 +649,8 @@ function wplc_filter_control_menu_control() {
643
  2 => 'read', /* history */
644
  3 => 'read', /* missed chats */
645
  4 => 'read', /* offline messages */
646
- 5 => 'read' /* feedback */
 
647
  );
648
  return $array;
649
  }
@@ -651,6 +658,7 @@ function wplc_filter_control_menu_control() {
651
  function wplc_admin_menu() {
652
 
653
  $cap = apply_filters("wplc_ma_filter_menu_control",array());
 
654
 
655
  $wplc_current_user = get_current_user_id();
656
 
@@ -658,8 +666,9 @@ function wplc_admin_menu() {
658
  if( get_user_meta( $wplc_current_user, 'wplc_ma_agent', true ) || current_user_can("wplc_ma_agent")){
659
  $wplc_mainpage = add_menu_page('WP Live Chat', __('Live Chat', 'wplivechat'), $cap[0], 'wplivechat-menu', 'wplc_admin_menu_layout');
660
  add_submenu_page('wplivechat-menu', __('Settings', 'wplivechat'), __('Settings', 'wplivechat'), $cap[1], 'wplivechat-menu-settings', 'wplc_admin_settings_layout');
 
661
  }
662
- /* only if suer is both an agent and an admin that has the cap assigned, can they access these pages */
663
  if( get_user_meta( $wplc_current_user, 'wplc_ma_agent', true ) && current_user_can("wplc_ma_agent")){
664
 
665
  add_submenu_page('wplivechat-menu', __('History', 'wplivechat'), __('History', 'wplivechat'), $cap[2], 'wplivechat-menu-history', 'wplc_admin_history_layout');
@@ -851,8 +860,11 @@ function wplc_push_js_to_front_basic() {
851
  wp_enqueue_script('wplc-user-jquery-cookie');
852
 
853
  $ajax_url = admin_url('admin-ajax.php');
 
 
854
  $wplc_ajax_url = apply_filters("wplc_filter_ajax_url",$ajax_url);
855
  wp_localize_script('wplc-admin-chat-js', 'wplc_ajaxurl', $wplc_ajax_url);
 
856
 
857
 
858
 
@@ -1167,8 +1179,8 @@ function wplc_filter_control_live_chat_box_html_main_div_top($wplc_settings,$log
1167
 
1168
  $ret_msg .= "<div id='wplc_hovercard' style='display:none' class='".$wplc_theme_type."'>";
1169
  $ret_msg .= "<div id='wplc_hovercard_min' class='wplc_button_standard wplc-color-border-1 wplc-color-bg-1'>close</div>";
1170
- $ret_msg .= "<div id='wplc_hovercard_content'><div class='wplc_hovercard_content_left'>".apply_filters("wplc_filter_modern_theme_hovercard_content_left","")."</div><div class='wplc_hovercard_content_right'>".apply_filters("wplc_filter_live_chat_box_html_1st_layer",wplc_filter_control_live_chat_box_html_1st_layer($wplc_settings,$logged_in,$wplc_using_locale))."</div></div>";
1171
- $ret_msg .= "<div id='wplc_hovercard_bottom'>".apply_filters("wplc_filter_live_chat_box_html_start_chat_button",wplc_filter_control_live_chat_box_html_hovercard_chat_button($wplc_settings,$logged_in,$wplc_using_locale))."</div>";
1172
  $ret_msg .= "</div>";
1173
 
1174
  }
@@ -1298,7 +1310,7 @@ function wplc_filter_control_live_chat_box_html_start_chat_button($wplc_settings
1298
  $wplc_sst_1 = __('Start chat', 'wplivechat');
1299
  if (!isset($wplc_settings['wplc_pro_sst1']) || $wplc_settings['wplc_pro_sst1'] == "") { $wplc_settings['wplc_pro_sst1'] = $wplc_sst_1; }
1300
  $text = ($wplc_using_locale ? $wplc_sst_1 : stripslashes($wplc_settings['wplc_pro_sst1']));
1301
- return "<button id=\"wplc_start_chat_btn\" type=\"button\" class='wplc-color-bg-1 wplc-color-2'>$text</button>";
1302
  }
1303
 
1304
 
@@ -1311,6 +1323,7 @@ function wplc_filter_control_live_chat_box_html_start_chat_button($wplc_settings
1311
  * @since 6.1.00
1312
  * @author Nick Duncan <nick@codecabin.co.za>
1313
  */
 
1314
  function wplc_filter_control_live_chat_box_html_hovercard_chat_button($wplc_settings,$logged_in,$wplc_using_locale ) {
1315
  if ($logged_in) {
1316
  $wplc_sst_1 = __('Start chat', 'wplivechat');
@@ -1411,7 +1424,7 @@ function wplc_filter_control_live_chat_box_html_2nd_layer($wplc_settings,$logged
1411
  $ret_msg .= " <strong>".$text."</strong>";
1412
  $ret_msg .= " </div>";
1413
  $ret_msg .= apply_filters("wplc_filter_live_chat_box_html_ask_user_details",wplc_filter_control_live_chat_box_html_ask_user_detail($wplc_settings));
1414
- $ret_msg .= apply_filters("wplc_filter_live_chat_box_html_start_chat_button",wplc_filter_control_live_chat_box_html_start_chat_button($wplc_settings,$wplc_using_locale));
1415
  $ret_msg .= "</div>";
1416
  } else {
1417
  /* admin not logged in, show offline messages */
@@ -1657,12 +1670,12 @@ function wplc_return_default_theme($wplc_settings,$logged_in,$wplc_using_locale)
1657
  $ret_msg .= apply_filters("wplc_filter_live_chat_box_html_header_div_top",wplc_filter_control_live_chat_box_html_header_div_top($wplc_settings));
1658
  $ret_msg .= " <i id=\"wp-live-chat-minimize\" class=\"fa fa-minus wplc-color-bg-2 wplc-color-1\" style=\"display:none;\"></i>";
1659
  $ret_msg .= " <i id=\"wp-live-chat-close\" class=\"fa fa-times\" style=\"display:none;\" ></i>";
1660
-
1661
  $ret_msg .= " <div id=\"wp-live-chat-1\" >";
1662
  $ret_msg .= apply_filters("wplc_filter_live_chat_box_html_1st_layer",wplc_filter_control_live_chat_box_html_1st_layer($wplc_settings,$logged_in,$wplc_using_locale));
1663
  $ret_msg .= " </div>";
1664
  $ret_msg .= " </div>";
1665
  $ret_msg .= " <div id=\"wp-live-chat-2\" style=\"display:none;\">";
 
1666
  $ret_msg .= apply_filters("wplc_filter_live_chat_box_html_2nd_layer",wplc_filter_control_live_chat_box_html_2nd_layer($wplc_settings,$logged_in,$wplc_using_locale));
1667
  $ret_msg .= " </div>";
1668
  $ret_msg .= " <div id=\"wp-live-chat-3\" style=\"display:none;\">";
@@ -1674,6 +1687,9 @@ function wplc_return_default_theme($wplc_settings,$logged_in,$wplc_using_locale)
1674
  $ret_msg .= " <div id=\"wp-live-chat-4\" style=\"display:none;\">";
1675
  $ret_msg .= apply_filters("wplc_filter_live_chat_box_html_4th_layer",wplc_filter_control_live_chat_box_html_4th_layer($wplc_settings,$wplc_using_locale));
1676
  $ret_msg .= "</div>";
 
 
 
1677
  $ret_msg .= "</div>";
1678
  return $ret_msg;
1679
  }
@@ -1706,6 +1722,9 @@ function wplc_theme_control_function($wplc_settings,$logged_in,$wplc_using_local
1706
  $ret_msg .= " <div id=\"wp-live-chat-2\" style=\"display:none;\">";
1707
  $ret_msg .= " <i id=\"wp-live-chat-minimize\" class=\"fa fa-minus wplc-color-bg-1 wplc-color-2\" style=\"display:none;\" ></i>";
1708
  $ret_msg .= " <i id=\"wp-live-chat-close\" class=\"fa fa-times\" style=\"display:none;\" ></i>";
 
 
 
1709
  $ret_msg .= " <div id='wp-live-chat-inner-container'>";
1710
  $ret_msg .= " <div id='wp-live-chat-inner'>";
1711
  $ret_msg .= " <div id=\"wp-live-chat-1\" >";
@@ -2500,9 +2519,13 @@ function wplc_return_admin_chat_javascript($cid) {
2500
  wp_localize_script('wplc-admin-chat-js', 'wplc_user_email', $wplc_user_email_address);
2501
 
2502
  $ajax_url = admin_url('admin-ajax.php');
 
 
2503
  $wplc_ajax_url = apply_filters("wplc_filter_ajax_url",$ajax_url);
2504
  wp_localize_script('wplc-admin-chat-js', 'wplc_ajaxurl', $wplc_ajax_url);
 
2505
 
 
2506
 
2507
  $wplc_url = admin_url('admin.php?page=wplivechat-menu&action=ac&cid=' . $cid);
2508
  wp_localize_script('wplc-admin-chat-js', 'wplc_url', $wplc_url);
@@ -2549,6 +2572,8 @@ function wplc_activate() {
2549
  "wplc_pro_fst2" => __("Chat with us", "wplivechat"),
2550
  "wplc_pro_fst3" => __("Start live chat", "wplivechat"),
2551
  "wplc_pro_sst1" => __("Start Chat", "wplivechat"),
 
 
2552
  "wplc_pro_sst2" => __("Connecting. Please be patient...", "wplivechat"),
2553
  "wplc_pro_tst1" => __("Reactivating your previous chat...", "wplivechat"),
2554
  "wplc_pro_na" => __("Chat offline. Leave a message", "wplivechat"),
@@ -3141,6 +3166,8 @@ function wplc_head_basic() {
3141
  if (isset($_POST['wplc_pro_fst2'])) { $wplc_data['wplc_pro_fst2'] = esc_attr($_POST['wplc_pro_fst2']); }
3142
  if (isset($_POST['wplc_pro_fst3'])) { $wplc_data['wplc_pro_fst3'] = esc_attr($_POST['wplc_pro_fst3']); }
3143
  if (isset($_POST['wplc_pro_sst1'])) { $wplc_data['wplc_pro_sst1'] = esc_attr($_POST['wplc_pro_sst1']); }
 
 
3144
  if (isset($_POST['wplc_pro_sst2'])) { $wplc_data['wplc_pro_sst2'] = esc_attr($_POST['wplc_pro_sst2']); }
3145
  if (isset($_POST['wplc_pro_tst1'])) { $wplc_data['wplc_pro_tst1'] = esc_attr($_POST['wplc_pro_tst1']); }
3146
  if (isset($_POST['wplc_pro_intro'])) { $wplc_data['wplc_pro_intro'] = esc_attr($_POST['wplc_pro_intro']); }
@@ -4063,6 +4090,8 @@ function wplc_string_check() {
4063
  if (!isset($wplc_settings['wplc_pro_fst2']) || (isset($wplc_settings['wplc_pro_fst2']) && $wplc_settings['wplc_pro_fst2'] == "")) { $wplc_settings["wplc_pro_fst2"] = __("Chat with us", "wplivechat"); }
4064
  if (!isset($wplc_settings['wplc_pro_fst3']) || (isset($wplc_settings['wplc_pro_fst3']) && $wplc_settings['wplc_pro_fst3'] == "")) { $wplc_settings["wplc_pro_fst3"] = __("Start live chat", "wplivechat"); }
4065
  if (!isset($wplc_settings['wplc_pro_sst1']) || (isset($wplc_settings['wplc_pro_sst1']) && $wplc_settings['wplc_pro_sst1'] == "")) { $wplc_settings["wplc_pro_sst1"] = __("Start Chat", "wplivechat"); }
 
 
4066
  if (!isset($wplc_settings['wplc_pro_sst2']) || (isset($wplc_settings['wplc_pro_sst2']) && $wplc_settings['wplc_pro_sst2'] == "")) { $wplc_settings["wplc_pro_sst2"] = __("Connecting. Please be patient...", "wplivechat"); }
4067
  if (!isset($wplc_settings['wplc_pro_tst1']) || (isset($wplc_settings['wplc_pro_tst1']) && $wplc_settings['wplc_pro_tst1'] == "")) { $wplc_settings["wplc_pro_tst1"] = __("Reactivating your previous chat...", "wplivechat"); }
4068
  if (!isset($wplc_settings['wplc_user_welcome_chat']) || (isset($wplc_settings['wplc_user_welcome_chat']) && $wplc_settings['wplc_user_welcome_chat'] == "")) { $wplc_settings["wplc_user_welcome_chat"] = __("Welcome. How may I help you?", "wplivechat"); }
@@ -4163,4 +4192,4 @@ function wplc_hook_control_admin_settings_chat_box_settings_after() {
4163
 
4164
  </table>
4165
  <?php
4166
- }
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: 6.2.01
7
  Author: WP-LiveChat
8
  Author URI: http://www.wp-livechat.com
9
  Text Domain: wplivechat
11
  */
12
 
13
  /*
14
+ * 6.2.01 - 2016-06-07 - Low priority
15
+ * Surveys/Polls added - you can now add a survey/poll to your chat box either before or after a chat session
16
+ *
17
  * 6.2.00 - 2016-06-10 - High priority
18
  * Cloud server bug fix
19
  * Offline messages bug fix
381
  $wplc_tblname_offline_msgs = $wpdb->prefix . "wplc_offline_messages";
382
  $wplc_tblname_chats = $wpdb->prefix . "wplc_chat_sessions";
383
  $wplc_tblname_msgs = $wpdb->prefix . "wplc_chat_msgs";
384
+ $wplc_version = "6.2.01";
385
 
386
  define('WPLC_BASIC_PLUGIN_DIR', dirname(__FILE__));
387
  define('WPLC_BASIC_PLUGIN_URL', plugins_url() . "/wp-live-chat-support/");
398
 
399
  require_once (plugin_dir_path(__FILE__) . "functions.php");
400
  require_once (plugin_dir_path(__FILE__) . "includes/deprecated.php");
401
+ require_once (plugin_dir_path(__FILE__) . "includes/surveys.php");
402
 
403
  add_action('wp_ajax_wplc_admin_set_transient', 'wplc_action_callback');
404
  add_action('wp_ajax_wplc_admin_remove_transient', 'wplc_action_callback');
508
  if (!isset($wplc_settings['wplc_pro_fst2']) || (isset($wplc_settings['wplc_pro_fst2']) && $wplc_settings['wplc_pro_fst2'] == "")) { $wplc_settings["wplc_pro_fst2"] = __("Chat with us", "wplivechat"); }
509
  if (!isset($wplc_settings['wplc_pro_fst3']) || (isset($wplc_settings['wplc_pro_fst3']) && $wplc_settings['wplc_pro_fst3'] == "")) { $wplc_settings["wplc_pro_fst3"] = __("Start live chat", "wplivechat"); }
510
  if (!isset($wplc_settings['wplc_pro_sst1']) || (isset($wplc_settings['wplc_pro_sst1']) && $wplc_settings['wplc_pro_sst1'] == "")) { $wplc_settings["wplc_pro_sst1"] = __("Start Chat", "wplivechat"); }
511
+ if (!isset($wplc_settings['wplc_pro_sst1_survey']) || (isset($wplc_settings['wplc_pro_sst1_survey']) && $wplc_settings['wplc_pro_sst1_survey'] == "")) { $wplc_settings["wplc_pro_sst1_survey"] = __("Or chat to an agent now", "wplivechat"); }
512
+ if (!isset($wplc_settings['wplc_pro_sst1e_survey']) || (isset($wplc_settings['wplc_pro_sst1e_survey']) && $wplc_settings['wplc_pro_sst1e_survey'] == "")) { $wplc_settings["wplc_pro_sst1e_survey"] = __("Chat ended", "wplivechat"); }
513
  if (!isset($wplc_settings['wplc_pro_sst2']) || (isset($wplc_settings['wplc_pro_sst2']) && $wplc_settings['wplc_pro_sst2'] == "")) { $wplc_settings["wplc_pro_sst2"] = __("Connecting. Please be patient...", "wplivechat"); }
514
  if (!isset($wplc_settings['wplc_pro_tst1']) || (isset($wplc_settings['wplc_pro_tst1']) && $wplc_settings['wplc_pro_tst1'] == "")) { $wplc_settings["wplc_pro_tst1"] = __("Reactivating your previous chat...", "wplivechat"); }
515
  if (!isset($wplc_settings['wplc_user_welcome_chat']) || (isset($wplc_settings['wplc_user_welcome_chat']) && $wplc_settings['wplc_user_welcome_chat'] == "")) { $wplc_settings["wplc_user_welcome_chat"] = __("Welcome. How may I help you?", "wplivechat"); }
649
  2 => 'read', /* history */
650
  3 => 'read', /* missed chats */
651
  4 => 'read', /* offline messages */
652
+ 5 => 'read', /* feedback */
653
+ 6 => 'read' /* surveys */
654
  );
655
  return $array;
656
  }
658
  function wplc_admin_menu() {
659
 
660
  $cap = apply_filters("wplc_ma_filter_menu_control",array());
661
+ if (get_option("wplc_seen_surveys")) { $survey_new = ""; } else { $survey_new = ' <span class="update-plugins"><span class="plugin-count">New</span></span>'; }
662
 
663
  $wplc_current_user = get_current_user_id();
664
 
666
  if( get_user_meta( $wplc_current_user, 'wplc_ma_agent', true ) || current_user_can("wplc_ma_agent")){
667
  $wplc_mainpage = add_menu_page('WP Live Chat', __('Live Chat', 'wplivechat'), $cap[0], 'wplivechat-menu', 'wplc_admin_menu_layout');
668
  add_submenu_page('wplivechat-menu', __('Settings', 'wplivechat'), __('Settings', 'wplivechat'), $cap[1], 'wplivechat-menu-settings', 'wplc_admin_settings_layout');
669
+ add_submenu_page('wplivechat-menu', __('Surveys', 'wplivechat'), __('Surveys', 'wplivechat'). $survey_new, $cap[2], 'wplivechat-menu-survey', 'wplc_admin_survey_layout');
670
  }
671
+ /* only if user is both an agent and an admin that has the cap assigned, can they access these pages */
672
  if( get_user_meta( $wplc_current_user, 'wplc_ma_agent', true ) && current_user_can("wplc_ma_agent")){
673
 
674
  add_submenu_page('wplivechat-menu', __('History', 'wplivechat'), __('History', 'wplivechat'), $cap[2], 'wplivechat-menu-history', 'wplc_admin_history_layout');
860
  wp_enqueue_script('wplc-user-jquery-cookie');
861
 
862
  $ajax_url = admin_url('admin-ajax.php');
863
+ $home_ajax_url = $ajax_url;
864
+
865
  $wplc_ajax_url = apply_filters("wplc_filter_ajax_url",$ajax_url);
866
  wp_localize_script('wplc-admin-chat-js', 'wplc_ajaxurl', $wplc_ajax_url);
867
+ wp_localize_script('wplc-ma-js', 'wplc_home_ajaxurl', $home_ajax_url);
868
 
869
 
870
 
1179
 
1180
  $ret_msg .= "<div id='wplc_hovercard' style='display:none' class='".$wplc_theme_type."'>";
1181
  $ret_msg .= "<div id='wplc_hovercard_min' class='wplc_button_standard wplc-color-border-1 wplc-color-bg-1'>close</div>";
1182
+ $ret_msg .= "<div id='wplc_hovercard_content'>".apply_filters("wplc_filter_live_chat_box_pre_layer1","")."<div class='wplc_hovercard_content_left'>".apply_filters("wplc_filter_modern_theme_hovercard_content_left","")."</div><div class='wplc_hovercard_content_right'>".apply_filters("wplc_filter_live_chat_box_html_1st_layer",wplc_filter_control_live_chat_box_html_1st_layer($wplc_settings,$logged_in,$wplc_using_locale))."</div></div>";
1183
+ $ret_msg .= "<div id='wplc_hovercard_bottom'>".apply_filters("wplc_filter_live_chat_box_hover_html_start_chat_button","",$wplc_settings,$logged_in,$wplc_using_locale)."</div>";
1184
  $ret_msg .= "</div>";
1185
 
1186
  }
1310
  $wplc_sst_1 = __('Start chat', 'wplivechat');
1311
  if (!isset($wplc_settings['wplc_pro_sst1']) || $wplc_settings['wplc_pro_sst1'] == "") { $wplc_settings['wplc_pro_sst1'] = $wplc_sst_1; }
1312
  $text = ($wplc_using_locale ? $wplc_sst_1 : stripslashes($wplc_settings['wplc_pro_sst1']));
1313
+ return "<button id=\"wplc_start_chat_btn\" type=\"button\" class='wplc-color-bg-1 wplc-color-2'>$text</button>";
1314
  }
1315
 
1316
 
1323
  * @since 6.1.00
1324
  * @author Nick Duncan <nick@codecabin.co.za>
1325
  */
1326
+ add_filter("wplc_filter_live_chat_box_hover_html_start_chat_button","wplc_filter_control_live_chat_box_html_hovercard_chat_button",10,3);
1327
  function wplc_filter_control_live_chat_box_html_hovercard_chat_button($wplc_settings,$logged_in,$wplc_using_locale ) {
1328
  if ($logged_in) {
1329
  $wplc_sst_1 = __('Start chat', 'wplivechat');
1424
  $ret_msg .= " <strong>".$text."</strong>";
1425
  $ret_msg .= " </div>";
1426
  $ret_msg .= apply_filters("wplc_filter_live_chat_box_html_ask_user_details",wplc_filter_control_live_chat_box_html_ask_user_detail($wplc_settings));
1427
+ $ret_msg .= apply_filters("wplc_filter_live_chat_box_html_start_chat_button",wplc_filter_control_live_chat_box_html_start_chat_button($wplc_settings,$wplc_using_locale ));
1428
  $ret_msg .= "</div>";
1429
  } else {
1430
  /* admin not logged in, show offline messages */
1670
  $ret_msg .= apply_filters("wplc_filter_live_chat_box_html_header_div_top",wplc_filter_control_live_chat_box_html_header_div_top($wplc_settings));
1671
  $ret_msg .= " <i id=\"wp-live-chat-minimize\" class=\"fa fa-minus wplc-color-bg-2 wplc-color-1\" style=\"display:none;\"></i>";
1672
  $ret_msg .= " <i id=\"wp-live-chat-close\" class=\"fa fa-times\" style=\"display:none;\" ></i>";
 
1673
  $ret_msg .= " <div id=\"wp-live-chat-1\" >";
1674
  $ret_msg .= apply_filters("wplc_filter_live_chat_box_html_1st_layer",wplc_filter_control_live_chat_box_html_1st_layer($wplc_settings,$logged_in,$wplc_using_locale));
1675
  $ret_msg .= " </div>";
1676
  $ret_msg .= " </div>";
1677
  $ret_msg .= " <div id=\"wp-live-chat-2\" style=\"display:none;\">";
1678
+ $ret_msg .= apply_filters("wplc_filter_live_chat_box_survey","");
1679
  $ret_msg .= apply_filters("wplc_filter_live_chat_box_html_2nd_layer",wplc_filter_control_live_chat_box_html_2nd_layer($wplc_settings,$logged_in,$wplc_using_locale));
1680
  $ret_msg .= " </div>";
1681
  $ret_msg .= " <div id=\"wp-live-chat-3\" style=\"display:none;\">";
1687
  $ret_msg .= " <div id=\"wp-live-chat-4\" style=\"display:none;\">";
1688
  $ret_msg .= apply_filters("wplc_filter_live_chat_box_html_4th_layer",wplc_filter_control_live_chat_box_html_4th_layer($wplc_settings,$wplc_using_locale));
1689
  $ret_msg .= "</div>";
1690
+ $ret_msg .= " <div id=\"wplc-extra-div\" style=\"display:none;\">";
1691
+ $ret_msg .= apply_filters("wplc_filter_wplc_extra_div","",$wplc_settings,$wplc_using_locale);
1692
+ $ret_msg .= "</div>";
1693
  $ret_msg .= "</div>";
1694
  return $ret_msg;
1695
  }
1722
  $ret_msg .= " <div id=\"wp-live-chat-2\" style=\"display:none;\">";
1723
  $ret_msg .= " <i id=\"wp-live-chat-minimize\" class=\"fa fa-minus wplc-color-bg-1 wplc-color-2\" style=\"display:none;\" ></i>";
1724
  $ret_msg .= " <i id=\"wp-live-chat-close\" class=\"fa fa-times\" style=\"display:none;\" ></i>";
1725
+ $ret_msg .= " <div id=\"wplc-extra-div\" style=\"display:none;\">";
1726
+ $ret_msg .= apply_filters("wplc_filter_wplc_extra_div","",$wplc_settings,$wplc_using_locale);
1727
+ $ret_msg .= "</div>";
1728
  $ret_msg .= " <div id='wp-live-chat-inner-container'>";
1729
  $ret_msg .= " <div id='wp-live-chat-inner'>";
1730
  $ret_msg .= " <div id=\"wp-live-chat-1\" >";
2519
  wp_localize_script('wplc-admin-chat-js', 'wplc_user_email', $wplc_user_email_address);
2520
 
2521
  $ajax_url = admin_url('admin-ajax.php');
2522
+ $home_ajax_url = $ajax_url;
2523
+
2524
  $wplc_ajax_url = apply_filters("wplc_filter_ajax_url",$ajax_url);
2525
  wp_localize_script('wplc-admin-chat-js', 'wplc_ajaxurl', $wplc_ajax_url);
2526
+ wp_localize_script('wplc-admin-chat-js', 'wplc_home_ajaxurl', $home_ajax_url);
2527
 
2528
+
2529
 
2530
  $wplc_url = admin_url('admin.php?page=wplivechat-menu&action=ac&cid=' . $cid);
2531
  wp_localize_script('wplc-admin-chat-js', 'wplc_url', $wplc_url);
2572
  "wplc_pro_fst2" => __("Chat with us", "wplivechat"),
2573
  "wplc_pro_fst3" => __("Start live chat", "wplivechat"),
2574
  "wplc_pro_sst1" => __("Start Chat", "wplivechat"),
2575
+ "wplc_pro_sst1_survey" => __("Or chat to an agent now", "wplivechat"),
2576
+ "wplc_pro_sst1e_survey" => __("Chat ended", "wplivechat"),
2577
  "wplc_pro_sst2" => __("Connecting. Please be patient...", "wplivechat"),
2578
  "wplc_pro_tst1" => __("Reactivating your previous chat...", "wplivechat"),
2579
  "wplc_pro_na" => __("Chat offline. Leave a message", "wplivechat"),
3166
  if (isset($_POST['wplc_pro_fst2'])) { $wplc_data['wplc_pro_fst2'] = esc_attr($_POST['wplc_pro_fst2']); }
3167
  if (isset($_POST['wplc_pro_fst3'])) { $wplc_data['wplc_pro_fst3'] = esc_attr($_POST['wplc_pro_fst3']); }
3168
  if (isset($_POST['wplc_pro_sst1'])) { $wplc_data['wplc_pro_sst1'] = esc_attr($_POST['wplc_pro_sst1']); }
3169
+ if (isset($_POST['wplc_pro_sst1_survey'])) { $wplc_data['wplc_pro_sst1_survey'] = esc_attr($_POST['wplc_pro_sst1_survey']); }
3170
+ if (isset($_POST['wplc_pro_sst1e_survey'])) { $wplc_data['wplc_pro_sst1e_survey'] = esc_attr($_POST['wplc_pro_sst1e_survey']); }
3171
  if (isset($_POST['wplc_pro_sst2'])) { $wplc_data['wplc_pro_sst2'] = esc_attr($_POST['wplc_pro_sst2']); }
3172
  if (isset($_POST['wplc_pro_tst1'])) { $wplc_data['wplc_pro_tst1'] = esc_attr($_POST['wplc_pro_tst1']); }
3173
  if (isset($_POST['wplc_pro_intro'])) { $wplc_data['wplc_pro_intro'] = esc_attr($_POST['wplc_pro_intro']); }
4090
  if (!isset($wplc_settings['wplc_pro_fst2']) || (isset($wplc_settings['wplc_pro_fst2']) && $wplc_settings['wplc_pro_fst2'] == "")) { $wplc_settings["wplc_pro_fst2"] = __("Chat with us", "wplivechat"); }
4091
  if (!isset($wplc_settings['wplc_pro_fst3']) || (isset($wplc_settings['wplc_pro_fst3']) && $wplc_settings['wplc_pro_fst3'] == "")) { $wplc_settings["wplc_pro_fst3"] = __("Start live chat", "wplivechat"); }
4092
  if (!isset($wplc_settings['wplc_pro_sst1']) || (isset($wplc_settings['wplc_pro_sst1']) && $wplc_settings['wplc_pro_sst1'] == "")) { $wplc_settings["wplc_pro_sst1"] = __("Start Chat", "wplivechat"); }
4093
+ if (!isset($wplc_settings['wplc_pro_sst1_survey']) || (isset($wplc_settings['wplc_pro_sst1_survey']) && $wplc_settings['wplc_pro_sst1_survey'] == "")) { $wplc_settings["wplc_pro_sst1_survey"] = __("Or chat to an agent now", "wplivechat"); }
4094
+ if (!isset($wplc_settings['wplc_pro_sst1e_survey']) || (isset($wplc_settings['wplc_pro_sst1e_survey']) && $wplc_settings['wplc_pro_sst1e_survey'] == "")) { $wplc_settings["wplc_pro_sst1e_survey"] = __("Chat ended", "wplivechat"); }
4095
  if (!isset($wplc_settings['wplc_pro_sst2']) || (isset($wplc_settings['wplc_pro_sst2']) && $wplc_settings['wplc_pro_sst2'] == "")) { $wplc_settings["wplc_pro_sst2"] = __("Connecting. Please be patient...", "wplivechat"); }
4096
  if (!isset($wplc_settings['wplc_pro_tst1']) || (isset($wplc_settings['wplc_pro_tst1']) && $wplc_settings['wplc_pro_tst1'] == "")) { $wplc_settings["wplc_pro_tst1"] = __("Reactivating your previous chat...", "wplivechat"); }
4097
  if (!isset($wplc_settings['wplc_user_welcome_chat']) || (isset($wplc_settings['wplc_user_welcome_chat']) && $wplc_settings['wplc_user_welcome_chat'] == "")) { $wplc_settings["wplc_user_welcome_chat"] = __("Welcome. How may I help you?", "wplivechat"); }
4192
 
4193
  </table>
4194
  <?php
4195
+ }